{"text": "module Structure.Real where\n\nimport Lvl\nopen import Data.Boolean\nopen import Data.Boolean.Proofs\nimport Data.Either as Either\nopen import Functional\nopen import Logic\nopen import Logic.Classical\nopen import Logic.Propositional\nopen import Logic.Predicate\nopen import Numeral.Natural using (ℕ)\nimport Numeral.Natural.Relation.Order as ℕ\nopen import Relator.Ordering\nopen import Structure.Setoid\nopen import Structure.Function.Ordering\nopen import Structure.Operator.Field\nopen import Structure.Operator.Monoid\nopen import Structure.Operator.Group\nopen import Structure.Operator.Proofs\nopen import Structure.Operator.Properties\nopen import Structure.Relator.Ordering\nopen Structure.Relator.Ordering.Weak.Properties\nopen import Structure.Relator.Properties\nopen import Structure.OrderedField\nimport Structure.OrderedField.AbsoluteValue\nopen import Syntax.Transitivity\nopen import Type\n\nprivate variable ℓ ℓ₁ ℓ₂ ℓₑ : Lvl.Level\n\n-- Theory defining the axioms of ℝ in classical logic.\n-- The axioms are the following:\n-- • An ordered field.\n-- • Monotone convergence.\nrecord RealTheory {R : Type{ℓ₁}} ⦃ equiv-R : Equiv{ℓₑ}(R) ⦄ (_+_ _⋅_ : R → R → R) (_≤_ : R → R → Stmt{ℓ₂}) ⦃ classical : ∀{ℓ}{P : Stmt{ℓ}} → Classical(P) ⦄ : Type{ℓ₁ Lvl.⊔ ℓ₂ Lvl.⊔ ℓₑ} where\n field\n ⦃ orderedField ⦄ : OrderedField(_+_)(_⋅_)(_≤_)\n\n open OrderedField(orderedField) public\n open Structure.OrderedField.AbsoluteValue(_+_)(_⋅_)(_≤_)\n\n field\n sup-fn : (f : ℕ → R) → ⦃ Increasing(ℕ._≤_)(_≤_)(f) ⦄ → ⦃ UpperBounded(ℕ._≤_)(_≤_)(f) ⦄ → R\n monotone-convergence : ∀{f} → ⦃ inc : Increasing(ℕ._≤_)(_≤_)(f) ⦄ → ⦃ bound : UpperBounded(ℕ._≤_)(_≤_)(f) ⦄ → ∃{Obj = R → ℕ}(N ↦ ∀{ε} → (ε > 𝟎) → ∀{n} → (n ℕ.> N(ε)) → (‖ f(n) − sup-fn (f) ⦃ inc ⦄ ⦃ bound ⦄ ‖ < ε))\n\n -- TODO: Consider adding something that relates addition and multiplication so that it conform to the axioms of arithmetic and their definitions of addition and multiplication. This is so that one should be able to prove (x + x ≡ 𝐒(𝐒(𝟎)) ⋅ x) or (2.5 ⋅ x = x + x + x/2) (when 𝐒, the successor function is defined as (1 +_)) for easier to write statements. In other words: add ((1 + x) ⋅ y = x + (x ⋅ y)) as an axiom. (20201210 Is this TODO outdated?)\n", "meta": {"hexsha": "ba295b28bf4d05889377d8672d654cff7b0e9993", "size": 2217, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Real.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Real.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Real.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 46.1875, "max_line_length": 452, "alphanum_fraction": 0.7032025259, "num_tokens": 743, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9005297914570318, "lm_q2_score": 0.7772998663336158, "lm_q1q2_score": 0.6999816865289897}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Functor.Instance.Discrete where\n\n-- Discrete Functor\n-- from Sets to Cats. This works, unlike in the previous version of the library,\n-- because the equality in Cats is properly NaturalIsomorphism instead of something stricter,\n-- no need for that pesky Heterogeneous anything.\n\nopen import Categories.Category\nopen import Categories.Functor\nopen import Categories.Category.Instance.Sets\nopen import Categories.Category.Instance.Cats\nopen import Categories.NaturalTransformation using (ntHelper)\nopen import Categories.NaturalTransformation.NaturalIsomorphism\nimport Categories.Category.Discrete as D\n\nimport Relation.Binary.PropositionalEquality as ≡\nopen import Function renaming (id to idf; _∘_ to _●_)\n\nDiscrete : ∀ {o} → Functor (Sets o) (Cats o o o)\nDiscrete {o} = record\n { F₀ = D.Discrete\n ; F₁ = DiscreteFunctor\n ; identity = DiscreteId\n ; homomorphism = PointwiseHom\n ; F-resp-≈ = ExtensionalityNI\n }\n where\n DiscreteFunctor : {A B : Set o} → (A → B) → Cats o o o [ D.Discrete A , D.Discrete B ]\n DiscreteFunctor f = record\n { F₀ = f\n ; F₁ = ≡.cong f\n ; identity = ≡.refl\n ; homomorphism = λ { {_} {_} {_} {≡.refl} {≡.refl} → ≡.refl}\n ; F-resp-≈ = λ g≡h → ≡.cong (≡.cong f) g≡h -- marvel at the weirdness involved\n }\n DiscreteId : {A : Set o} → NaturalIsomorphism (DiscreteFunctor {A} idf) id\n DiscreteId = record\n { F⇒G = record { η = λ X → ≡.refl ; commute = λ { ≡.refl → ≡.refl } ; sym-commute = λ { ≡.refl → ≡.refl} }\n ; F⇐G = record { η = λ _ → ≡.refl ; commute = λ { ≡.refl → ≡.refl } ; sym-commute = λ { ≡.refl → ≡.refl} }\n ; iso = λ X → record { isoˡ = ≡.refl ; isoʳ = ≡.refl }\n }\n PointwiseHom : {X Y Z : Set o} {g : X → Y} {h : Y → Z} →\n NaturalIsomorphism (DiscreteFunctor (h ● g)) (DiscreteFunctor h ∘F DiscreteFunctor g)\n PointwiseHom = record\n { F⇒G = record { η = λ _ → ≡.refl ; commute = λ { ≡.refl → ≡.refl} ; sym-commute = λ { ≡.refl → ≡.refl} }\n ; F⇐G = record { η = λ _ → ≡.refl ; commute = λ { ≡.refl → ≡.refl} ; sym-commute = λ { ≡.refl → ≡.refl} }\n ; iso = λ X → record { isoˡ = ≡.refl ; isoʳ = ≡.refl }\n }\n ExtensionalityNI : {A B : Set o} {g h : A → B} →\n ({x : A} → g x ≡.≡ h x) → NaturalIsomorphism (DiscreteFunctor g) (DiscreteFunctor h)\n ExtensionalityNI g≡h = record\n { F⇒G = ntHelper record { η = λ X → g≡h {X} ; commute = λ { ≡.refl → ≡.sym (≡.trans-reflʳ g≡h)} }\n ; F⇐G = ntHelper record { η = λ X → ≡.sym (g≡h {X}) ; commute = λ { ≡.refl → ≡.sym (≡.trans-reflʳ _)} }\n ; iso = λ X → record { isoˡ = ≡.trans-symʳ g≡h ; isoʳ = ≡.trans-symˡ g≡h }\n }\n", "meta": {"hexsha": "022ddf4d99362acf2208275c70eb2356a106a6aa", "size": 2714, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Instance/Discrete.agda", "max_stars_repo_name": "bblfish/agda-categories", "max_stars_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "src/Categories/Functor/Instance/Discrete.agda", "max_issues_repo_name": "bblfish/agda-categories", "max_issues_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Functor/Instance/Discrete.agda", "max_forks_repo_name": "bblfish/agda-categories", "max_forks_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 47.6140350877, "max_line_length": 113, "alphanum_fraction": 0.5935887988, "num_tokens": 1017, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297914570319, "lm_q2_score": 0.7772998611746911, "lm_q1q2_score": 0.6999816818832244}} {"text": "module Structure.Relator.Equivalence where\n\nimport Lvl\nopen import Logic\nopen import Logic.Propositional\nopen import Structure.Relator.Properties\n hiding (reflexivity ; symmetry ; transitivity)\nopen import Type\n\nprivate variable ℓ₁ ℓ₂ : Lvl.Level\n\n-- An equivalence relation is a reflexive, symmetric and transitive relation.\nrecord Equivalence {T : Type{ℓ₁}} (_≡_ : T → T → Stmt{ℓ₂}) : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where\n instance constructor intro\n field\n instance ⦃ reflexivity ⦄ : Reflexivity (_≡_)\n instance ⦃ symmetry ⦄ : Symmetry (_≡_)\n instance ⦃ transitivity ⦄ : Transitivity (_≡_)\n", "meta": {"hexsha": "7b138d80ed317ddc532ac511f7d6bdf50fb2b9d3", "size": 607, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Relator/Equivalence.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Relator/Equivalence.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Relator/Equivalence.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.9473684211, "max_line_length": 84, "alphanum_fraction": 0.7215815486, "num_tokens": 182, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9005297861178929, "lm_q2_score": 0.7772998611746912, "lm_q1q2_score": 0.6999816777331125}} {"text": "module Tuple where\n\nimport Level\nimport Data.List as List\nopen import Data.List hiding (_++_; [_]; _∷ʳ_)\nopen import Data.Fin\n\nopen import Relation.Binary.PropositionalEquality hiding ([_])\n\ninfixr 5 _∷_\n\ndata Tuple {a} : List (Set a) → Set a where\n [] : Tuple []\n _∷_ : ∀ {A As} → A → Tuple As → Tuple (A ∷ As)\n\n[_] : ∀ {a} {A : Set a} → A → Tuple (A ∷ [])\n[ x ] = x ∷ []\n\n_++_ : ∀ {a} {xs ys : List (Set a)}\n → Tuple xs → Tuple ys → Tuple (xs List.++ ys)\n_++_ {xs = []} [] ys = ys\n_++_ {xs = _ ∷ _} (x ∷ xs) ys = x ∷ (xs ++ ys)\n\n_∷ʳ_ : ∀ {a} {x : Set a} {xs : List (Set a)}\n → Tuple xs → x → Tuple (xs List.∷ʳ x)\n_∷ʳ_ xs x = xs ++ [ x ]\n\nprivate\n listLookup : ∀ {a} {A : Set a} (xs : List A) → (n : Fin (length xs)) → A\n listLookup [] ()\n listLookup (x ∷ xs) zero = x\n listLookup (x ∷ xs) (suc n) = listLookup xs n\n\nlookup : ∀ {a} {xs : List (Set a)}\n → (n : Fin (length xs)) → Tuple xs → listLookup xs n\nlookup {xs = []} () []\nlookup {xs = _ ∷ _} zero (x ∷ xs) = x\nlookup {xs = _ ∷ _} (suc n) (x ∷ xs) = lookup n xs\n\nunfoldToFunc : ∀ {a} → List (Set a) → Set a → Set a\nunfoldToFunc [] B = B\nunfoldToFunc (A ∷ As) B = A → unfoldToFunc As B\n\napply : {Xs : List Set} {A : Set} → unfoldToFunc Xs A → Tuple Xs → A\napply {[]} f [] = f\napply {_ ∷ _} f (x ∷ xs) = apply (f x) xs\n\nlist-proof : ∀ {a} {A : Set a} (xs : List A) → xs ≡ (xs List.++ [])\nlist-proof [] = refl\nlist-proof (x ∷ xs) = cong (_∷_ x) (list-proof xs)\n\nlist-proof₁ : ∀ {a} {A : Set a} (xs ys zs : List A)\n → (xs List.++ ys) List.++ zs ≡ xs List.++ (ys List.++ zs)\nlist-proof₁ [] ys zs = refl\nlist-proof₁ (x ∷ xs) ys zs = cong (_∷_ x) (list-proof₁ xs ys zs)\n\ncurry : ∀ {a} (xs : List (Set a)) → unfoldToFunc xs (Tuple xs)\ncurry xs = curry' [] xs []\n where curry' : ∀ {a} (xs ys : List (Set a)) → Tuple xs\n → unfoldToFunc ys (Tuple (xs List.++ ys))\n curry' xs [] tpl = subst Tuple (list-proof xs) tpl\n curry' xs (y ∷ ys) tpl x₁ =\n subst (λ x → unfoldToFunc ys (Tuple x))\n (list-proof₁ xs List.[ y ] ys)\n (curry' (xs List.∷ʳ y) ys (tpl ∷ʳ x₁))\n\nproof₁ : ∀ {a} (As : List (Set a)) {B : Set a}\n → (Tuple As → B) → unfoldToFunc As B\nproof₁ [] f = f []\nproof₁ (A ∷ As) f x = proof₁ As (λ xs → f (x ∷ xs))\n\nproof₂ : ∀ {a} (As : List (Set a)) {B : Set a}\n → unfoldToFunc As B → Tuple As → B\nproof₂ [] f [] = f\nproof₂ (A ∷ As) f (x ∷ xs) = proof₂ As (f x) xs\n", "meta": {"hexsha": "7e92f6c22a8bec2f76bed1c28ac2658677585187", "size": 2423, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Tuple.agda", "max_stars_repo_name": "mr-ohman/general-induction", "max_stars_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Tuple.agda", "max_issues_repo_name": "mr-ohman/general-induction", "max_issues_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Tuple.agda", "max_forks_repo_name": "mr-ohman/general-induction", "max_forks_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.8815789474, "max_line_length": 74, "alphanum_fraction": 0.5163021048, "num_tokens": 949, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267762381844, "lm_q2_score": 0.8056321936479701, "lm_q1q2_score": 0.6999548216408625}} {"text": "module Numeral.Natural.Prime.Proofs.Product where\n\nimport Lvl\nopen import Data.Either as Either using ()\nopen import Functional\nopen import Lang.Instance\nopen import Logic.Propositional\nopen import Numeral.Natural\nopen import Numeral.Natural.Relation.Divisibility.Proofs\nopen import Numeral.Natural.Oper\nopen import Numeral.Natural.Prime\nopen import Numeral.Natural.Relation.Divisibility.Proofs.Product\nopen import Sets.PredicateSet renaming (_≡_ to _≡ₛ_)\nopen import Type\n\nprivate variable a b : ℕ\n\n-- The prime factors of a product is the prime factors of its factors.\nproduct-primeFactors : PrimeFactor(a ⋅ b) ≡ₛ (PrimeFactor(a) ∪ PrimeFactor(b))\nproduct-primeFactors = [↔]-intro l r where\n l : PrimeFactor(a ⋅ b) ⊇ (PrimeFactor(a) ∪ PrimeFactor(b))\n l{a}{b}{x} (Either.Left intro) = intro ⦃ factor = divides-with-[⋅] {x}{a}{b} ([∨]-introₗ infer) ⦄\n l{a}{b}{x} (Either.Right intro) = intro ⦃ factor = divides-with-[⋅] {x}{a}{b} ([∨]-introᵣ infer) ⦄\n\n r : PrimeFactor(a ⋅ b) ⊆ (PrimeFactor(a) ∪ PrimeFactor(b))\n r{a}{b}{x} intro = Either.map (p ↦ intro ⦃ factor = p ⦄) (p ↦ intro ⦃ factor = p ⦄) (prime-divides-of-[⋅] {x}{a}{b} infer infer)\n", "meta": {"hexsha": "12c7332d8fd455de1bc8129caf32d7f2ed7905cc", "size": 1154, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Prime/Proofs/Product.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Prime/Proofs/Product.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Prime/Proofs/Product.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.7407407407, "max_line_length": 130, "alphanum_fraction": 0.7071057192, "num_tokens": 390, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9343951661947456, "lm_q2_score": 0.7490872187162396, "lm_q1q2_score": 0.6999434762267205}} {"text": "module RecursiveInstanceSearch where\n\nopen import Common.Prelude\nopen import Common.Product\n\n_&&_ : Bool → Bool → Bool\ntrue && b = b\nfalse && _ = false\n\nrecord Eq (A : Set) : Set where\n constructor eq\n field\n _==_ : A → A → Bool\nopen Eq {{...}} public\n\ninstance\n eq-Bool : Eq Bool\n eq-Bool = eq aux where\n\n aux : Bool → Bool → Bool\n aux true true = true\n aux false false = true\n aux _ _ = false\n\n eq-Nat : Eq Nat\n eq-Nat = eq aux where\n\n aux : Nat → Nat → Bool\n aux zero zero = true\n aux (suc n) (suc m) = aux n m\n aux _ _ = false\n\n eq-Maybe : {A : Set} {{_ : Eq A}} → Eq (Maybe A)\n eq-Maybe {A} = eq aux where\n\n aux : Maybe A → Maybe A → Bool\n aux nothing nothing = true\n aux (just y) (just z) = (y == z)\n aux _ _ = false\n\n eq-List : {A : Set} {{_ : Eq A}} → Eq (List A)\n eq-List {A} = eq aux where\n\n aux : List A → List A → Bool\n aux [] [] = true\n aux (x ∷ l) (y ∷ l') = (x == y) && (aux l l')\n aux _ _ = false\n\n eq-× : {A B : Set} {{_ : Eq A}} {{_ : Eq B}} → Eq (A × B)\n eq-× {A} {B} = eq (λ x y → (proj₁ x == proj₁ y) && (proj₂ x == proj₂ y))\n\ntest₂ : Bool\ntest₂ = (3 == 4)\n\ntest₃ : Bool\ntest₃ = ((just 9) == nothing)\n\ntest₃' : Bool\ntest₃' = (nothing == just 6)\n\ntest₄ : Bool\ntest₄ = (true ∷ []) == (false ∷ [])\n\ntest₅ : Bool\ntest₅ = (just ((true ,′ (1 ,′ just 0)) ∷ []) == just ((true , (1 , just 0)) ∷ []))\n", "meta": {"hexsha": "c913059c7e79291f02c443404a1592085f3fc3bf", "size": 1380, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/RecursiveInstanceSearch.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/RecursiveInstanceSearch.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/RecursiveInstanceSearch.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 20.9090909091, "max_line_length": 82, "alphanum_fraction": 0.5202898551, "num_tokens": 526, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096158798117, "lm_q2_score": 0.7634837581726991, "lm_q1q2_score": 0.6994348124300663}} {"text": "-- Testing parameterised records in parameterised modules\nmodule Exist (X : Set) where\n\ndata [_] (a : Set) : Set where\n [] : [ a ]\n _∷_ : a -> [ a ] -> [ a ]\n\nmap : forall {a b} -> (a -> b) -> [ a ] -> [ b ]\nmap f [] = []\nmap f (x ∷ xs) = f x ∷ map f xs\n\nrecord ∃ (a : Set) (P : a -> Set) : Set where\n field\n witness : a\n proof : P witness\n\nListP : (a : Set) -> (a -> Set) -> Set\nListP a P = [ ∃ a P ]\n\nmapP : forall {a b P Q}\n -> (f : a -> b) -> (forall {x} -> P x -> Q (f x))\n -> ListP a P -> ListP b Q\nmapP {a} {b} {P} {Q} f pres xs = map helper xs\n where\n helper : ∃ a P -> ∃ b Q\n helper r = record { witness = f (∃.witness r)\n ; proof = pres (∃.proof r)\n }\n\n", "meta": {"hexsha": "aea3fc8ea2ab7707e1da32a9a518734d3f13f070", "size": 726, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Exist.agda", "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/succeed/Exist.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/Exist.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 24.2, "max_line_length": 57, "alphanum_fraction": 0.4517906336, "num_tokens": 273, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.916109606718245, "lm_q2_score": 0.7634837635542925, "lm_q1q2_score": 0.6994348103654885}} {"text": "module trees where\n\n data Tree (A : Set) : Set where\n empty : Tree A\n node : Tree A -> A -> Tree A -> Tree A\n\n open import Data.Nat\n\n #nodes : {A : Set} -> Tree A -> ℕ\n #nodes empty = 0\n #nodes (node t x t₁) = (#nodes t) + (1 + (#nodes t₁))\n\n #leafs : {A : Set} -> Tree A -> ℕ\n #leafs empty = zero\n -- #leafs (node empty x empty) = 1\n #leafs (node t x t₁) with t | t₁\n ... | empty | empty = 1\n ... | _ | _ = (#leafs t) + (#leafs t₁)\n\n", "meta": {"hexsha": "42d477bd80624d56d4d10b4cc9da682932b97ba6", "size": 495, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/main/agda/trees.agda", "max_stars_repo_name": "hablapps/safeoptics", "max_stars_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/main/agda/trees.agda", "max_issues_repo_name": "hablapps/safeoptics", "max_issues_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/agda/trees.agda", "max_forks_repo_name": "hablapps/safeoptics", "max_forks_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.75, "max_line_length": 64, "alphanum_fraction": 0.4686868687, "num_tokens": 178, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9161096090086367, "lm_q2_score": 0.7634837581726991, "lm_q1q2_score": 0.699434807184036}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Category.Cocomplete.Properties {o ℓ e} (C : Category o ℓ e) where\n\nopen import Level\nopen import Data.Product using (_,_)\n\nopen import Categories.Adjoint.Properties\nopen import Categories.Category.Complete\nopen import Categories.Category.Complete.Properties\nopen import Categories.Category.Cocomplete\nopen import Categories.Category.Cocomplete.Finitely\nopen import Categories.Category.Duality\nopen import Categories.Category.Construction.Functors\nopen import Categories.Functor\nopen import Categories.Functor.Cocontinuous\nopen import Categories.Functor.Duality\nopen import Categories.NaturalTransformation as N\nopen import Categories.NaturalTransformation.NaturalIsomorphism using (_≃_)\nopen import Categories.Diagram.Limit\nopen import Categories.Diagram.Limit.Properties\nopen import Categories.Diagram.Colimit\nopen import Categories.Diagram.Duality\n\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n variable\n o′ ℓ′ e′ o″ ℓ″ e″ : Level\n module C = Category C\n \nCocomplete⇒FinitelyCocomplete : Cocomplete o′ ℓ′ e′ C → FinitelyCocomplete C\nCocomplete⇒FinitelyCocomplete Coc =\n coFinitelyComplete⇒FinitelyCocomplete C (Complete⇒FinitelyComplete C.op (Cocomplete⇒coComplete C Coc))\n\nmodule _ {D : Category o′ ℓ′ e′} (Coc : Cocomplete o″ ℓ″ e″ D) where\n private\n module D = Category D\n\n Functors-Cocomplete : Cocomplete o″ ℓ″ e″ (Functors C D)\n Functors-Cocomplete {J} F = coLimit⇒Colimit (Functors C D) LFop\n where module J = Category J\n module F = Functor F\n open Functor F\n F′ : Functor J.op (Functors C.op D.op)\n F′ = opF⇒ ∘F F.op\n \n L : (H : Functor J.op (Functors C.op D.op)) → Limit H\n L = Functors-Complete C.op {D = D.op} (λ G → Colimit⇒coLimit D (Coc (Functor.op G)))\n \n LF′ : Limit F′\n LF′ = L F′\n \n LF″ : Limit (opF⇐ ∘F F′)\n LF″ = rapl (Functorsᵒᵖ-equiv.L⊣R C.op D.op) F′ LF′\n \n iso : opF⇐ ∘F F′ ≃ F.op\n iso = record\n { F⇒G = ntHelper record\n { η = λ _ → N.id\n ; commute = λ f → id-comm\n }\n ; F⇐G = ntHelper record\n { η = λ _ → N.id\n ; commute = λ f → id-comm\n }\n ; iso = λ j → record\n { isoˡ = D.identity²\n ; isoʳ = D.identity²\n }\n }\n where open MR D\n \n LFop : Limit op\n LFop = ≃-resp-lim iso LF″\n\n -- TODO: need to refactor the where block above to show cocontinuous. there is no need to do it now.\n -- \n -- evalF-Cocontinuous : ∀ X → Cocontinuous o″ ℓ″ e″ (evalF C D X)\n -- evalF-Cocontinuous X {J} {F} L = Coc (evalF C D X ∘F F) , {!!}\n -- where \n", "meta": {"hexsha": "81fc8691ca0d1ad041fd43dc3bab11b775de8b88", "size": 2789, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Cocomplete/Properties.agda", "max_stars_repo_name": "laMudri/agda-categories", "max_stars_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Cocomplete/Properties.agda", "max_issues_repo_name": "laMudri/agda-categories", "max_issues_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Cocomplete/Properties.agda", "max_forks_repo_name": "laMudri/agda-categories", "max_forks_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.2023809524, "max_line_length": 104, "alphanum_fraction": 0.6292577985, "num_tokens": 802, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096112990283, "lm_q2_score": 0.7634837527911057, "lm_q1q2_score": 0.6994348040025833}} {"text": "module Data.Boolean.Numeral where\n\nopen import Data\nopen import Data.Boolean\nopen import Data.Boolean.Stmt\nimport Lvl\nopen import Numeral.Natural\nopen import Numeral.Natural.Oper.Comparisons\nopen import Syntax.Number\nopen import Type\n\nBool-to-ℕ : Bool → ℕ\nBool-to-ℕ 𝐹 = 0\nBool-to-ℕ 𝑇 = 1\n\nℕ-to-Bool : (n : ℕ) → . ⦃ _ : IsTrue(n A\n inc : L.A P.A -> A\n\ntheory\n (S) p : P a : P.A |> inc (l. rec (l, p[]), x. a[x]) = a[p[]]\n (E) a : L.A |> k : L |- inc (l. a[l], x. rec(k, x)) = a[k]\n (W) m : A a : P.A |> inc (l. m[], x. a[x]) = m[]\n (A) p : (L,L).A a : (L,P).A b : P.A |> inc (l. inc (k. p[l, k], x. a[l,x]), y. b[y]) = inc (k. inc(l. p[l,k], y.b[y]), x. inc(l. a[l,x], y.b[y]))\n-}\n\nmodule Inception.Equality where\n\nopen import SOAS.Common\nopen import SOAS.Context\nopen import SOAS.Variable\nopen import SOAS.Families.Core\nopen import SOAS.Families.Build\nopen import SOAS.ContextMaps.Inductive\n\nopen import Inception.Signature\nopen import Inception.Syntax\n\nopen import SOAS.Metatheory.SecondOrder.Metasubstitution IA:Syn\nopen import SOAS.Metatheory.SecondOrder.Equality IA:Syn\n\nprivate\n variable\n α β γ τ : IAT\n Γ Δ Π : Ctx\n\ninfix 1 _▹_⊢_≋ₐ_\n\n-- Axioms of equality\ndata _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ IA) α Γ → (𝔐 ▷ IA) α Γ → Set where\n S : ⁅ P ⁆ ⁅ P ⊩ A ⁆̣ ▹ ∅ ⊢ inc (rec x₀ 𝔞) (𝔟⟨ x₀ ⟩) ≋ₐ 𝔟⟨ 𝔞 ⟩\n E : ⁅ L ⊩ A ⁆̣ ▹ ⌊ L ⌋ ⊢ inc (𝔞⟨ x₀ ⟩) (rec x₁ x₀) ≋ₐ 𝔞⟨ x₀ ⟩\n W : ⁅ A ⁆ ⁅ P ⊩ A ⁆̣ ▹ ∅ ⊢ inc 𝔞 (𝔟⟨ x₀ ⟩) ≋ₐ 𝔞\n A : ⁅ L · L ⊩ A ⁆ ⁅ L · P ⊩ A ⁆ ⁅ P ⊩ A ⁆̣ ▹ ∅\n ⊢ inc (inc (𝔞⟨ x₁ ◂ x₀ ⟩) (𝔟⟨ x₁ ◂ x₀ ⟩)) (𝔠⟨ x₀ ⟩)\n ≋ₐ inc (inc (𝔞⟨ x₀ ◂ x₁ ⟩) (𝔠⟨ x₀ ⟩)) (inc (𝔟⟨ x₀ ◂ x₁ ⟩) (𝔠⟨ x₀ ⟩))\n\nopen EqLogic _▹_⊢_≋ₐ_\nopen ≋-Reasoning\n", "meta": {"hexsha": "b76c9357d77b44597aa1b1a297bc8cb86ddda14d", "size": 1550, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/Inception/Equality.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/Inception/Equality.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/Inception/Equality.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 28.1818181818, "max_line_length": 163, "alphanum_fraction": 0.5232258065, "num_tokens": 788, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8933094088947399, "lm_q2_score": 0.7826624840223698, "lm_q1q2_score": 0.699159760966112}} {"text": "module Sort where\n open import Sec4\n import Sec2\n postulate _≤_ : {A : Set} → A → A → Prop\n postulate tot-list : {A : Set} → (a b : A) → (a ≤ b) ∨ (b ≤ a)\n postulate trans-list : {A : Set} → (a b c : A) → (a ≤ b) → (b ≤ c) → (a ≤ c)\n\n-- XXX: Definition of a list\n data List (A : Set) : Set where\n Nil : List A\n _∷_ : A → List A → List A\n\n-- XXX: definition of an ordered list\n all-ordered-list : {A : Set} → (a : A)\n → (l : List A)\n → Prop\n all-ordered-list a Nil = ⊤\n all-ordered-list a (x ∷ l) = (a ≤ x) ∧ all-ordered-list a l\n\n ordered-list : {A : Set} → List A → Prop\n ordered-list Nil = ⊤\n ordered-list (x ∷ l) = all-ordered-list x l ∧ (ordered-list l)\n\n-- XXX: Inserting elements in the list\n insert-list : {A : Set} → (a : A) → (l : List A) → List A\n insert-list a Nil = a ∷ Nil\n insert-list a (x ∷ l) with (tot-list a x)\n insert-list a (x ∷ l) | ora h = a ∷ (x ∷ l)\n insert-list a (x ∷ l) | orb h = x ∷ (insert-list a l)\n\n lem1 : {A : Set}\n → (a x : A)\n → (l : List A)\n → (p : all-ordered-list x l)\n → (p1 : a ≤ x)\n → (all-ordered-list a l)\n lem1 a x Nil p p1 = ⋆\n lem1 a x (x₁ ∷ l) (and x₂ x₃) p1 = and (trans-list a x x₁ p1 x₂) (lem1 a x l x₃ p1)\n\n\n lem2 : {A : Set} → (x a : A) → (l : List A) → (h : x ≤ a)\n → (p1 : all-ordered-list x l) → (p2 : ordered-list l)\n → (v : ordered-list (insert-list a l))\n → all-ordered-list x (insert-list a l)\n lem2 x a Nil h p1 p3 v = and h ⋆\n lem2 x a (x₁ ∷ l) h p1 p3 v with (tot-list a x₁)\n lem2 x₂ a (x₁ ∷ l) h p1 p3 v | ora x = and h p1\n lem2 x₂ a (x₁ ∷ l) h (and x₃ x₄) (and x₅ x₆) (and x₇ x₈) | orb x = and x₃ (lem2 x₂ a l h x₄ x₆ x₈)\n\n thm2 : {A : Set}\n → ∀ (a : A)\n → ∀ (l : List A)\n → (p : ordered-list l)\n → (ordered-list (insert-list a l))\n thm2 a Nil p = and ⋆ ⋆\n thm2 a (x ∷ l) p with (tot-list a x)\n thm2 a (x ∷ l) (and x₁ x₂) | ora h = and (and h (lem1 a x l x₁ h)) (and x₁ x₂)\n thm2 a (x ∷ l) (and x₁ x₂) | orb h =\n let v = (thm2 a l x₂)\n in\n and (lem2 x a l h x₁ x₂ v) v\n\n-- XXX: append lists\n _++_ : {A : Set} → (l : List A) → (m : List A) → List A\n Nil ++ m = m\n (x ∷ l) ++ m = x ∷ (l ++ m)\n\n-- XXX: Length of a list\n length : {A : Set} → (l : List A) → Sec2.ℕ\n length Nil = Sec2.Z\n length (x ∷ l) = Sec2.S (length l)\n\n\n-- XXX: reverse of a list\n rev : {A : Set} → (List A) → (List A)\n rev Nil = Nil\n rev (x ∷ l) = (rev l) ++ (x ∷ Nil)\n\n-- XXX: Theorem on length of lists\n thm : {A : Set} → (l : List A) → (m : List A) → ((length l) Sec2.+ (length m) Sec2.≡ length (l ++ m))\n thm Nil m = Sec2.refl\n thm (x ∷ l) m =\n let\n xx = thm l m\n in\n Sec2.cong xx\n\n cong : {A : Set} → (x : A) → (l m : List A) → (l Sec2.≡ m)\n → (x ∷ l) Sec2.≡ (x ∷ m)\n cong x l .l Sec2.refl = Sec2.refl\n\n cong2 : {A : Set} → (l m q : List A) → (l Sec2.≡ m)\n → (l ++ q) Sec2.≡ (m ++ q)\n cong2 l .l q Sec2.refl = Sec2.refl\n\n ++-lem : {A : Set} → (l : List A) → ((l ++ Nil) Sec2.≡ l)\n ++-lem Nil = Sec2.refl\n ++-lem (x ∷ l) = cong x (l ++ Nil) l (++-lem l)\n\n assoc : {A : Set} → (l m q : List A)\n → l ++ (m ++ q) Sec2.≡ (l ++ m) ++ q \n assoc Nil m q = Sec2.refl\n assoc (x ∷ l) m q = cong x (l ++ (m ++ q)) ((l ++ m) ++ q) (assoc l m q)\n\n rev-lem : {A : Set} → ∀ (l m : List A)\n → rev (l ++ m) Sec2.≡ (rev m) ++ (rev l)\n rev-lem Nil m rewrite\n ++-lem (rev m) = Sec2.refl\n rev-lem (x ∷ l) m rewrite\n assoc (rev m) (rev l) (x ∷ Nil)\n = let p = rev-lem l m in\n cong2 (rev (l ++ m)) (rev m ++ rev l) (x ∷ Nil) p\n\n-- XXX: Involution of reversal of lists\n rev-involute : {A : Set} → (l : List A) → l Sec2.≡ (rev (rev l))\n rev-involute Nil = Sec2.refl\n rev-involute (x ∷ l) rewrite \n rev-lem (rev l) (x ∷ Nil)\n = cong x l (rev (rev l)) (rev-involute l)\n\n", "meta": {"hexsha": "57315dad5c52ba579d6781f472830f0de4153e26", "size": 4099, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Sort.agda", "max_stars_repo_name": "amal029/agda-tutorial-dybjer", "max_stars_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:52:30.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-08T12:52:30.000Z", "max_issues_repo_path": "Sort.agda", "max_issues_repo_name": "amal029/agda-tutorial-dybjer", "max_issues_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Sort.agda", "max_forks_repo_name": "amal029/agda-tutorial-dybjer", "max_forks_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.8760330579, "max_line_length": 103, "alphanum_fraction": 0.4520614784, "num_tokens": 1659, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094117351309, "lm_q2_score": 0.7826624688140726, "lm_q1q2_score": 0.6991597496034645}} {"text": "module Forcing4 where\n\nopen import Common.Nat renaming (zero to Z; suc to S)\nopen import Lib.Fin\nopen import Common.Equality\nopen import Common.String\nopen import Common.IO\nopen import Common.Unit\n\n{-\ntoNat : {n : Nat} → Fin n → Nat\ntoNat (zero _) = 0\ntoNat (suc _ i) = suc (toNat i)\n-}\n\nRel : (X : Set) -> Set1\nRel X = X -> X -> Set\n\ndata _<=_ : Rel Nat where\n z<=n : ∀ n → Z <= n\n s<=s : ∀ m n (m<=n : m <= n) → S m <= S n\n\n_ℕ<_ : Rel Nat\nm ℕ< n = S m <= n\n\n\nfromℕ≤ : ∀ {m n} → m ℕ< n → Fin n\nfromℕ≤ (s<=s .0 n (z<=n .n)) = fz {n}\nfromℕ≤ (s<=s .(S m) .(S n) (s<=s m n m<=n)) = fs {S n} (fromℕ≤ (s<=s m n m<=n))\n\n\nfromℕ≤-toℕ : ∀ m (i : Fin m) (i fs n) (fromℕ≤-toℕ (S n) y (s<=s (forget y) n m≤n))\n\n[_/2] : Nat -> Nat\n[ 0 /2] = 0\n[ 1 /2] = 0\n[ S (S n) /2] = S [ n /2]\n\n[1/2]-mono : (m n : Nat) -> m <= n -> [ m /2] <= [ n /2]\n[1/2]-mono .0 .n (z<=n n) = z<=n [ n /2]\n[1/2]-mono .1 .(S n) (s<=s .0 .n (z<=n n)) = z<=n [ S n /2]\n[1/2]-mono .(S (S m)) .(S (S n)) (s<=s .(S m) .(S n) (s<=s m n m<=n)) = s<=s [ m /2] [ n /2] ([1/2]-mono m n m<=n)\n\nshowEq : {X : Set}{A : X} -> A ≡ A -> String\nshowEq refl = \"refl\"\n\nshow<= : {m n : Nat} -> m <= n -> String\nshow<= (z<=n n) = \"0 <= \" +S+ natToString n\nshow<= (s<=s m n m<=n) = natToString (S m) +S+ \" <= \" +S+ natToString (S n)\n\ndata Bot : Set where\n-- Only to check that it compiles..\nfoo : (n : Nat) -> S n <= n -> Bot\nfoo .(S n) (s<=s .(S n) n le) = foo n le\n\nmain : IO Unit\nmain = putStrLn (showEq (fromℕ≤-toℕ 3 (inc (inject 1)) le)) ,,\n putStrLn (show<= ([1/2]-mono 4 6 le'))\n where\n le : 2 <= 3\n le = s<=s _ _ (s<=s _ _ (z<=n _))\n le' : 4 <= 6\n le' = s<=s _ _ (s<=s _ _ (s<=s _ _ (s<=s _ _ (z<=n _))))\n", "meta": {"hexsha": "58139761632cc12e0a44ba2fc45c5242c78f4849", "size": 1892, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Compiler/simple/Forcing4.agda", "max_stars_repo_name": "alhassy/agda", "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2018-11-05T22:13:36.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-06T16:38:43.000Z", "max_issues_repo_path": "test/Compiler/simple/Forcing4.agda", "max_issues_repo_name": "alhassy/agda", "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 16, "max_issues_repo_issues_event_min_datetime": "2018-10-08T00:32:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-09-08T13:47:04.000Z", "max_forks_repo_path": "test/Compiler/simple/Forcing4.agda", "max_forks_repo_name": "alhassy/agda", "max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 28.6666666667, "max_line_length": 156, "alphanum_fraction": 0.4630021142, "num_tokens": 926, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8962513675912913, "lm_q2_score": 0.7799929053683038, "lm_q1q2_score": 0.699069708147847}} {"text": "-- Proof: insertion sort computes a permutation of the input list\n\nmodule sortnat where\n\nopen import bool\nopen import eq\nopen import nat\nopen import list\nopen import nondet\nopen import nondet-thms\n\n-- non-deterministic insert.\n--This takes a nondeterministic list because I need to be able to call it with the result of perm\n--\n--implementation in curry:\n-- ndinsert x [] = []\n-- ndinsert x (y:ys) = (x : y : xs) ? (y : insert x ys)\nndinsert : {A : Set} → A → 𝕃 A → ND (𝕃 A)\nndinsert x [] = Val ( x :: [])\nndinsert x (y :: ys) = (Val ( x :: y :: ys ))\n ?? ((_::_ y) $* (ndinsert x ys))\n\n--non-deterministic permutation\n--this is identical to the curry code (except for the Val constructor)\nperm : {A : Set} → (𝕃 A) → ND (𝕃 A)\nperm [] = Val []\nperm (x :: xs) = (ndinsert x) *$* (perm xs)\n\n--insert a value into a sorted list.\n--this is identical to curry or haskell code.\n--\n--note that the structure here is identical to ndinsert\ninsert : ℕ → 𝕃 ℕ → 𝕃 ℕ\ninsert x [] = x :: []\ninsert x (y :: ys) = if x < y then (x :: y :: ys)\n else (y :: insert x ys)\n\n--simple insertion sort\n--again this is identical to curry or haskell\n--also, note that the structure is identical to perm\nsort : 𝕃 ℕ → 𝕃 ℕ\nsort [] = []\nsort (x :: xs) = insert x (sort xs)\n\n\n--If introduction rule for non-deterministic values.\n--if x and y are both possible values in z then\n--∀ c. if c then x else y will give us either x or y, so it must be a possible value of z.\n--\nifIntro : {A : Set} → (x : A) → (y : A) → (nx : ND A)\n → x ∈ nx → y ∈ nx → (c : 𝔹) → (if c then x else y) ∈ nx\nifIntro x y nx p q tt = p\nifIntro x y nx p q ff = q\n\n---------------------------------------------------------------------------\n--\n-- this should prove that if xs ∈ nxs then, insert x xs ∈ ndinsert x nxs\n-- parameters:\n-- x : the value we are inserting into the list\n-- xs : the list\n--\n--returns: insert x xs ∈ ndinsert x xs\n-- a proof that inserting a value in a list is ok with non-deterministic lists\n\ninsert=ndinsert : (y : ℕ) → (xs : 𝕃 ℕ) → (insert y xs) ∈ (ndinsert y xs)\n\n-- the first case is simple: inserting into an empty list is trivial\ninsert=ndinsert y [] = ndrefl\n\n--The recursive case is the interesting one.\n--The list to insert an element has the form (x :: xs)\n--At this point we have two possible cases.\n--Either y is smaller then every element in (x :: xs), in which case it's inserted at the front,\n--or y is larger than x, in which case it's inserted somewhere in xs.\n--Since both of these cases are covered by ndinsert we can invoke the ifIntro lemma, to say that we don't care which case it is.\n--\n--variables:\n-- step : one step of insert\n-- l : the left hand side of insert y xs (the then branch)\n-- r : the right hand side of insert y xs (the else branch)\n-- nr : a non-deterministic r\n-- (Val l) : a non-deterministic l (but since ndinsert only has a deterministic value on the left it's not very interesting)\n-- rec : The recursive call. If y isn't inserted into the front, then we need to find it.\n-- l∈step : a proof that l is a possible value for step\n-- r∈step : a proof that r is a possible value for step\ninsert=ndinsert y (x :: xs) = ifIntro l r step l∈step r∈step (y < x)\n where step = ndinsert y (x :: xs)\n l = (y :: x :: xs)\n r = x :: insert y xs\n nl = Val l\n nr = (_::_ x) $* (ndinsert y xs)\n rec = ∈-$* (_::_ x) (insert y xs) (ndinsert y xs)\n (insert=ndinsert y xs)\n l∈step = left nl nr ndrefl\n r∈step = right nl nr rec\n\n---------------------------------------------------------------------------\n\n-- Main theorem: Sorting a list preserves permutations\n-- all of the work is really done by insert=ndinsert\nsortPerm : (xs : 𝕃 ℕ) → sort xs ∈ perm xs\nsortPerm [] = ndrefl\nsortPerm (x :: xs) = ∈-*$* (sort xs) (perm xs) (insert x) (ndinsert x)\n (sortPerm xs) (insert=ndinsert x (sort xs))\n\n", "meta": {"hexsha": "62b03996e17f229450ca10342193ff51213ffd1d", "size": 4025, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "nondet/sortnat.agda", "max_stars_repo_name": "mihanus/curry-agda", "max_stars_repo_head_hexsha": "b7cfdda11cdadeba882b6b72d75448acd8b0a294", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "nondet/sortnat.agda", "max_issues_repo_name": "mihanus/curry-agda", "max_issues_repo_head_hexsha": "b7cfdda11cdadeba882b6b72d75448acd8b0a294", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "nondet/sortnat.agda", "max_forks_repo_name": "mihanus/curry-agda", "max_forks_repo_head_hexsha": "b7cfdda11cdadeba882b6b72d75448acd8b0a294", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.9716981132, "max_line_length": 128, "alphanum_fraction": 0.590310559, "num_tokens": 1159, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045817875224, "lm_q2_score": 0.787931185683219, "lm_q1q2_score": 0.699056158071427}} {"text": "{-# OPTIONS --warning=error --safe --without-K #-}\n\nopen import Boolean.Definition\nopen import LogicalFormulae\nopen import Decidable.Lemmas\n\nmodule Numbers.Naturals.Definition where\n\ndata ℕ : Set where\n zero : ℕ\n succ : ℕ → ℕ\n\ninfix 100 succ\n\n{-# BUILTIN NATURAL ℕ #-}\n\nsuccInjective : {a b : ℕ} → (succ a ≡ succ b) → a ≡ b\nsuccInjective {a} {.a} refl = refl\n\nnaughtE : {a : ℕ} → zero ≡ succ a → False\nnaughtE ()\n\naIsNotSuccA : (a : ℕ) → (a ≡ succ a) → False\naIsNotSuccA zero pr = naughtE pr\naIsNotSuccA (succ a) pr = aIsNotSuccA a (succInjective pr)\n\nℕDecideEquality : (a b : ℕ) → ((a ≡ b) || ((a ≡ b) → False))\nℕDecideEquality zero zero = inl refl\nℕDecideEquality zero (succ b) = inr (λ ())\nℕDecideEquality (succ a) zero = inr (λ ())\nℕDecideEquality (succ a) (succ b) with ℕDecideEquality a b\nℕDecideEquality (succ a) (succ b) | inl x = inl (applyEquality succ x)\nℕDecideEquality (succ a) (succ b) | inr x = inr λ pr → x (succInjective pr)\n\nℕDecideEquality' : (a b : ℕ) → Bool\nℕDecideEquality' a b with ℕDecideEquality a b\nℕDecideEquality' a b | inl x = BoolTrue\nℕDecideEquality' a b | inr x = BoolFalse\n\nrecord _=N'_ (a b : ℕ) : Set where\n field\n .eq : a ≡ b\n\nsquashN : {a b : ℕ} → a =N' b → a ≡ b\nsquashN record { eq = eq } = squash ℕDecideEquality eq\n\ncollapseN : {a b : ℕ} → a ≡ b → a =N' b\ncollapseN refl = record { eq = refl }\n\n=N'Refl : {a b : ℕ} → (p1 p2 : a =N' b) → p1 ≡ p2\n=N'Refl p1 p2 = refl\n", "meta": {"hexsha": "2263738d62f6598ee28eb16851293a3e88944048", "size": 1413, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numbers/Naturals/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Numbers/Naturals/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Numbers/Naturals/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 27.1730769231, "max_line_length": 75, "alphanum_fraction": 0.6426043878, "num_tokens": 546, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711832583696, "lm_q2_score": 0.8221891305219504, "lm_q1q2_score": 0.6988370681319123}} {"text": "-- This module closely follows a section of Martín Escardó's HoTT lecture notes:\n-- https://www.cs.bham.ac.uk/~mhe/HoTT-UF-in-Agda-Lecture-Notes/HoTT-UF-Agda.html#unicharac\n{-# OPTIONS --without-K #-}\nmodule Util.HoTT.Univalence.ContrFormulation where\n\nopen import Util.Data.Product using (map₂)\nopen import Util.Prelude\nopen import Util.HoTT.Equiv\nopen import Util.HoTT.HLevel.Core\nopen import Util.HoTT.Singleton\nopen import Util.HoTT.Univalence.Axiom\nopen import Util.HoTT.Univalence.Statement\n\n\nprivate\n variable\n α β γ : Level\n\n\nUnivalenceContr : ∀ α → Set (lsuc α)\nUnivalenceContr α = (A : Set α) → IsContr (Σ[ B ∈ Set α ] (A ≃ B))\n\n\nUnivalenceProp : ∀ α → Set (lsuc α)\nUnivalenceProp α = (A : Set α) → IsProp (Σ[ B ∈ Set α ] (A ≃ B))\n\n\nabstract\n IsEquiv→Σ-IsContr : {A : Set α} {B : A → Set β} (x : A)\n → (f : ∀ y → x ≡ y → B y)\n → (∀ y → IsEquiv (f y))\n → IsContr (Σ A B)\n IsEquiv→Σ-IsContr {A = A} {B = B} x f f-equiv\n = ≃-pres-IsContr Singleton≃ΣB IsContr-Singleton′\n where\n ≡≃B : ∀ y → (x ≡ y) ≃ B y\n ≡≃B y .forth = f y\n ≡≃B y .isEquiv = f-equiv y\n\n Singleton≃ΣB : Singleton′ x ≃ Σ A B\n Singleton≃ΣB = Σ-≃⁺ ≡≃B\n\n\n Σ-IsContr→IsEquiv : {A : Set α} {B : A → Set β} (x : A)\n → (f : ∀ y → x ≡ y → B y)\n → IsContr (Σ A B)\n → ∀ y → IsEquiv (f y)\n Σ-IsContr→IsEquiv {A = A} {B = B} x f Σ-contr\n = IsEquiv-map₂-f→IsEquiv-f f f-equiv\n where\n f-equiv : IsEquiv (map₂ f)\n f-equiv = IsContr→IsEquiv IsContr-Singleton′ Σ-contr (map₂ f)\n\n\n Univalence→UnivalenceContr : Univalence α → UnivalenceContr α\n Univalence→UnivalenceContr ua A = IsEquiv→Σ-IsContr A (λ B → ≡→≃) (λ B → ua)\n\n\n UnivalenceContr→Univalence : UnivalenceContr α → Univalence α\n UnivalenceContr→Univalence ua {A} {B}\n = Σ-IsContr→IsEquiv A (λ B → ≡→≃) (ua A) B\n\n\n univalenceContr : (A : Set α) → IsContr (Σ[ B ∈ Set α ] (A ≃ B))\n univalenceContr = Univalence→UnivalenceContr univalence\n\n\n UnivalenceContr→UnivalenceProp : UnivalenceContr α → UnivalenceProp α\n UnivalenceContr→UnivalenceProp ua = IsContr→IsProp ∘ ua\n\n\n UnivalenceProp→UnivalenceContr : UnivalenceProp α → UnivalenceContr α\n UnivalenceProp→UnivalenceContr ua A\n = IsProp∧Pointed→IsContr (ua A) (A , ≃-refl)\n\n\n Univalence→UnivalenceProp : Univalence α → UnivalenceProp α\n Univalence→UnivalenceProp\n = UnivalenceContr→UnivalenceProp ∘ Univalence→UnivalenceContr\n\n\n UnivalenceProp→Univalence : UnivalenceProp α → Univalence α\n UnivalenceProp→Univalence\n = UnivalenceContr→Univalence ∘ UnivalenceProp→UnivalenceContr\n\n\n univalenceProp : ∀ {α} → UnivalenceProp α\n univalenceProp = Univalence→UnivalenceProp univalence\n", "meta": {"hexsha": "cf3d9fe2b89b049b5c584ef3a50563d3801365e2", "size": 2642, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Util/HoTT/Univalence/ContrFormulation.agda", "max_stars_repo_name": "JLimperg/msc-thesis-code", "max_stars_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2021-04-13T21:31:17.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-26T06:37:31.000Z", "max_issues_repo_path": "src/Util/HoTT/Univalence/ContrFormulation.agda", "max_issues_repo_name": "JLimperg/msc-thesis-code", "max_issues_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Util/HoTT/Univalence/ContrFormulation.agda", "max_forks_repo_name": "JLimperg/msc-thesis-code", "max_forks_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.6853932584, "max_line_length": 91, "alphanum_fraction": 0.6672975019, "num_tokens": 961, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178870347122, "lm_q2_score": 0.7690802423634963, "lm_q1q2_score": 0.6988000647764644}} {"text": "module ListThms where\nopen import Sec4\nimport Sec2\n\n{-\n Definition of a list\n-}\ndata List (A : Set) : Set where\n [] : List A -- Empty list\n _∷_ : A → List A → List A -- Cons\n\n\ninfixr 4 _∷_\n\n\n-- Proposition stating what is a non empty list\nnelist : {A : Set} → (List A) → Prop\nnelist [] = ⊥\nnelist (x ∷ x₁) = ⊤\n\n\n-- Head function that only works on non empty list\nhead : {A : Set} → (l : List A) → (p : nelist l) → A\nhead [] () -- This can never happen\nhead (x ∷ _) ⋆ = x -- This is the head of the list\n\n-- The tail of the list only works on non empty list\ntail : {A : Set} → (l : List A) → (p : nelist l) → (List A)\ntail [] ()\ntail (_ ∷ l) ⋆ = l\n\n\n-- definition of a map\nmap : {A B : Set} → (A → B) → (List A) → List B\nmap f [] = []\nmap f (x ∷ l) = (f x) ∷ map f l\n\n\n-- definition of fold left\nfold : {A B : Set} → (A → B → B) → B → (List A) → B\nfold f x [] = x\nfold f x (x₁ ∷ l) = fold f (f x₁ x) l\n\n-- reduce only works on lists of length > 0\nreduce : {A : Set} → (l : List A) → (p : nelist l) → (A → A → A) → A \nreduce [] ()\nreduce (x ∷ l) _ f = fold f x l\n\n-- length of a list \nlength : {A : Set} → (List A) → Sec2.ℕ\nlength [] = Sec2.Z\nlength (x ∷ l) = (Sec2.S Sec2.Z) Sec2.+ (length l)\n\n-- Proposition on ≤\n_<=_ : Sec2.ℕ → Sec2.ℕ → Prop\nSec2.Z <= Sec2.Z = ⊤\nSec2.Z <= Sec2.S y = ⊤\nSec2.S x <= y = x <= y\n\n_>=_ : Sec2.ℕ → Sec2.ℕ → Prop\nSec2.Z >= Sec2.Z = ⊤\nSec2.Z >= Sec2.S y = ⊥\nSec2.S x >= y = x >= y\n\n-- Indexing into the list\n_!!_ : {A : Set} → ∀ (l : List A) → ∀ (i : Sec2.ℕ) → (nelist l)\n → Exists A (λ _ → ((i >= Sec2.Z) ∧ (i <= (length l))))\n([] !! i) () \n((x ∷ l) !! i) ⋆ = [ x , (and (lem1 i) (lem (x ∷ l) i))]\n where\n cong-<= : (x y : Sec2.ℕ) → (x <= y) → (x <= Sec2.S y)\n cong-<= Sec2.Z y p = ⋆\n cong-<= (Sec2.S x) Sec2.Z p = cong-<= x Sec2.Z p\n cong-<= (Sec2.S x) (Sec2.S y) p = cong-<= x (Sec2.S y) p\n\n lem1 : (i : Sec2.ℕ) → (i >= Sec2.Z)\n lem1 Sec2.Z = ⋆\n lem1 (Sec2.S i) = lem1 i\n\n lem2 : (i : Sec2.ℕ) → (i <= Sec2.Z)\n lem2 Sec2.Z = ⋆\n lem2 (Sec2.S i₁) = lem2 i₁\n\n lem : {A : Set} → (l : List A) → (i : Sec2.ℕ) → (i <= (length l))\n lem [] Sec2.Z = ⋆\n lem [] (Sec2.S i) = lem2 i\n lem (x₁ ∷ l₁) i = cong-<= i (length l₁) (lem l₁ i)\n\n\ndata Maybe (A : Set) : Set where\n Nothing : Maybe A\n Just : A → Maybe A\n\nindex : {A : Set} → ∀ (l : List A)\n → (nelist l)\n → ∀ (i : Sec2.ℕ)\n → Sec2.So ((i Sec2.≥ Sec2.Z) Sec2.& (i Sec2.< (length l)))\n → Maybe A\nindex l _ i _ = index' l i (Sec2.Z)\n where\n index' : {A : Set} → ∀ (l : List A) → ∀(i : Sec2.ℕ)\n → (c : Sec2.ℕ) → Maybe A\n index' [] i₁ c = Nothing\n index' (x₁ ∷ l₁) i₁ c with (i₁ Sec2.== c) \n index' (x₁ ∷ l₁) i₁ c | Sec2.T = Just x₁\n index' (x₁ ∷ l₁) i₁ c | Sec2.F = index' l₁ i₁ (Sec2.S c)\n\nexx1 : Maybe Sec2.ℕ\nexx1 = index (1 ∷ []) ⋆ 0 Sec2.ok\n\nindex'' : {A : Set} → ∀ (l : List A)\n → ∀ (i : Sec2.ℕ)\n → Sec2.So (i Sec2.< (length l))\n → A\nindex'' [] Sec2.Z ()\nindex'' [] (Sec2.S i) ()\nindex'' (x ∷ l) Sec2.Z Sec2.ok = x\nindex'' (x ∷ l) (Sec2.S i) p = index'' l i p\n\n-- append two lists\n_++_ : {A : Set} → (l : List A) → (l' : List A) → (List A)\n[] ++ l' = l'\n(x ∷ l) ++ l' = (x ∷ (l ++ l'))\n\n\n-- composition of two functions\n_∘_ : {A B C : Set} → (A → B) → (B → C) → (A → C)\nf ∘ g = λ x → (g (f x))\n\ncong : {A : Set} → (x : A) → (l m : List A) → (l Sec2.≡ m) → (x ∷ l) Sec2.≡ (x ∷ m)\ncong x l .l Sec2.refl = Sec2.refl\n\ncong2 : {A : Set} → (l m q : List A) → (l Sec2.≡ m) → (l ++ q) Sec2.≡ (m ++ q)\ncong2 l .l q Sec2.refl = Sec2.refl\n\nthm1-map : {A B : Set} → (f : A → B) → (l : List A) → (m : List A) → (map f (l ++ m)) Sec2.≡ (map f l) ++ (map f m)\nthm1-map f [] m = Sec2.refl\nthm1-map f (x ∷ l) m with (f x)\nthm1-map f (x ∷ l) m | p = cong p (map f (l ++ m)) (map f l ++ map f m) (thm1-map f l m)\n\n-- map ∘\nthm2-map : {A B C : Set} → (f : A → B) → (g : B → C) → (l : List A) → (map (f ∘ g) l Sec2.≡ ((map f) ∘ (map g)) l)\nthm2-map f₁ g₁ [] = Sec2.refl\nthm2-map f₁ g₁ (x ∷ l) with (thm2-map f₁ g₁ l)\nthm2-map f₁ g₁ (x ∷ l) | p = cong (g₁ (f₁ x)) (map (λ z → g₁ (f₁ z)) l) (map g₁ (map f₁ l)) p\n\n-- Non empty list by construction \ndata NeList (A : Set) : Set where\n ^_^ : A → NeList A\n _∶_ : A → NeList A → NeList A\n\ninfixr 60 ^_^\ninfixr 60 _∶_\n\n\n\n-- XXX: Prove these in Coq along with the other theorem from Mike Naha's\n-- tutorial in Agda.\n", "meta": {"hexsha": "95cbd3fa5e9fb035b3cac057b91352c02147cd04", "size": 4452, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "ListThms.agda", "max_stars_repo_name": "amal029/agda-tutorial-dybjer", "max_stars_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:52:30.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-08T12:52:30.000Z", "max_issues_repo_path": "ListThms.agda", "max_issues_repo_name": "amal029/agda-tutorial-dybjer", "max_issues_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ListThms.agda", "max_forks_repo_name": "amal029/agda-tutorial-dybjer", "max_forks_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.0, "max_line_length": 115, "alphanum_fraction": 0.4757412399, "num_tokens": 1961, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8596637397236824, "lm_q2_score": 0.8128673110375457, "lm_q1q2_score": 0.6987925525056703}} {"text": "{-# OPTIONS --warning=error --safe --without-K #-}\n\nopen import LogicalFormulae\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import Functions.Definition\nopen import Setoids.Setoids\nopen import Setoids.Subset\nopen import Graphs.Definition\nopen import Sets.FinSet.Definition\nopen import Numbers.Naturals.Semiring\nopen import Sets.EquivalenceRelations\n\nmodule Graphs.CompleteGraph where\n\nCompleteGraph : {a b : _} {V' : Set a} (V : Setoid {a} {b} V') → Graph b V\nGraph._<->_ (CompleteGraph V) x y = ((Setoid._∼_ V x y) → False)\nGraph.noSelfRelation (CompleteGraph V) x x!=x = x!=x (Equivalence.reflexive (Setoid.eq V))\nGraph.symmetric (CompleteGraph V) x!=y y=x = x!=y ((Equivalence.symmetric (Setoid.eq V)) y=x)\nGraph.wellDefined (CompleteGraph V) {x} {y} {r} {s} x=y r=s x!=r y=s = x!=r (transitive x=y (transitive y=s (symmetric r=s)))\n where\n open Setoid V\n open Equivalence eq\n\nKn : (n : ℕ) → Graph _ (reflSetoid (FinSet n))\nKn n = CompleteGraph (reflSetoid (FinSet n))\n\ntriangle : Graph _ (reflSetoid (FinSet 3))\ntriangle = Kn 3\n", "meta": {"hexsha": "665e6454598aad54eed6380ddfffd64b7eabf649", "size": 1058, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Graphs/CompleteGraph.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Graphs/CompleteGraph.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Graphs/CompleteGraph.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 36.4827586207, "max_line_length": 125, "alphanum_fraction": 0.7107750473, "num_tokens": 339, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9219218327098192, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6986271755827018}} {"text": "\nmodule Category where\n\nopen import Logic.Equivalence\nopen import Logic.Relations\n\nopen Equivalence using () renaming (_==_ to eq)\n\nrecord Cat : Set2 where\n field\n Obj : Set1\n _─→_ : Obj -> Obj -> Set\n id : {A : Obj} -> A ─→ A\n _∘_ : {A B C : Obj} -> B ─→ C -> A ─→ B -> A ─→ C\n Eq : {A B : Obj} -> Equivalence (A ─→ B)\n cong : {A B C : Obj}{f₁ f₂ : B ─→ C}{g₁ g₂ : A ─→ B} ->\n eq Eq f₁ f₂ -> eq Eq g₁ g₂ -> eq Eq (f₁ ∘ g₁) (f₂ ∘ g₂)\n idLeft : {A B : Obj}{f : A ─→ B} -> eq Eq (id ∘ f) f\n idRight : {A B : Obj}{f : A ─→ B} -> eq Eq (f ∘ id) f\n assoc : {A B C D : Obj}{f : C ─→ D}{g : B ─→ C}{h : A ─→ B} ->\n eq Eq ((f ∘ g) ∘ h) (f ∘ (g ∘ h))\n\nmodule Category (ℂ : Cat) where\n\n private module CC = Cat ℂ\n open CC public hiding (_─→_; _∘_)\n\n private module Eq {A B : Obj} = Equivalence (Eq {A}{B})\n open Eq public hiding (_==_)\n\n infix\t 20 _==_\n infixr 30 _─→_\n infixr 90 _∘_\n\n _─→_ = CC._─→_\n\n _==_ : {A B : Obj} -> Rel (A ─→ B)\n _==_ = Eq._==_\n\n _∘_ : {A B C : Obj} -> B ─→ C -> A ─→ B -> A ─→ C\n _∘_ = CC._∘_\n\n congL : {A B C : Obj}{f₁ f₂ : B ─→ C}{g : A ─→ B} ->\n\t f₁ == f₂ -> f₁ ∘ g == f₂ ∘ g\n congL p = cong p refl\n\n congR : {A B C : Obj}{f : B ─→ C}{g₁ g₂ : A ─→ B} ->\n\t g₁ == g₂ -> f ∘ g₁ == f ∘ g₂\n congR p = cong refl p\n", "meta": {"hexsha": "ac19fede027bfb2c2331f926f80ed847a179b658", "size": 1327, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/AIM6/Cat/Category.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/AIM6/Cat/Category.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/AIM6/Cat/Category.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 26.54, "max_line_length": 69, "alphanum_fraction": 0.4476262246, "num_tokens": 604, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9219218305645895, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6986271739570589}} {"text": "{-# OPTIONS --universe-polymorphism #-}\nmodule Categories.Functor.Diagonal where\n\nopen import Data.Product\n\nopen import Categories.Category\nopen import Categories.Functor\nopen import Categories.Product\nopen import Categories.FunctorCategory\nopen import Categories.Functor.Constant\n\nimport Categories.Power as Power\n\nΔ : ∀ {o ℓ e} → (C : Category o ℓ e) → Functor C (Product C C)\nΔ C = record\n { F₀ = λ x → x , x\n ; F₁ = λ f → f , f\n ; identity = refl , refl\n ; homomorphism = refl , refl\n ; F-resp-≡ = λ x → x , x\n }\n where \n open Category C\n open Equiv\n\nΔ′ : ∀ {o ℓ e} → (I : Set) → (C : Category o ℓ e) → Functor C (Power.Exp C I)\nΔ′ I C = record \n { F₀ = λ x _ → x\n ; F₁ = λ f _ → f\n ; identity = λ _ → refl\n ; homomorphism = λ _ → refl\n ; F-resp-≡ = λ x _ → x\n }\n where\n open Power C\n open Category C\n open Equiv\n\nΔF : ∀ {o ℓ e o₁ ℓ₁ e₁} {C : Category o ℓ e} (I : Category o₁ ℓ₁ e₁) → Functor C (Functors I C)\nΔF {C = C} I = record \n { F₀ = λ c → Constant c\n ; F₁ = λ f → record { η = λ X → f; commute = λ g → trans C.identityʳ (sym C.identityˡ) }\n ; identity = refl\n ; homomorphism = refl\n ; F-resp-≡ = λ x → x\n }\n where\n module C = Category C\n open C.Equiv\n module I = Category I\n", "meta": {"hexsha": "314adc4507da08e8aafe6fb0d8a935cd6346bc1e", "size": 1217, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Functor/Diagonal.agda", "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 98, "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_issues_repo_path": "Categories/Functor/Diagonal.agda", "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 19, "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_forks_repo_path": "Categories/Functor/Diagonal.agda", "max_forks_repo_name": "p-pavel/categories", "max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 23, "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "avg_line_length": 23.862745098, "max_line_length": 95, "alphanum_fraction": 0.6080525883, "num_tokens": 449, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206686206199, "lm_q2_score": 0.7745833893685269, "lm_q1q2_score": 0.6986127684416877}} {"text": "{-# OPTIONS --without-K #-}\nmodule sets.vec.properties where\n\nopen import equality.core\nopen import function.core\nopen import function.extensionality\nopen import function.isomorphism\nopen import sets.nat.core using (ℕ; zero; suc)\nopen import sets.fin using (Fin; zero; suc)\nopen import sets.vec.core\n\ntabulate-lookup : ∀ {i}{A : Set i}{n : ℕ}\n → (xs : Vec A n)\n → tabulate (lookup xs) ≡ xs\ntabulate-lookup [] = refl\ntabulate-lookup (x ∷ xs) = ap (_∷_ x) (tabulate-lookup xs)\n\nlookup-tabulate-funext : ∀ {i}{A : Set i}{n : ℕ}\n → (f : Fin n → A)(i : Fin n)\n → lookup (tabulate f) i ≡ f i\nlookup-tabulate-funext {n = zero} f ()\nlookup-tabulate-funext {n = suc m} f zero = refl\nlookup-tabulate-funext {n = suc m} f (suc i) =\n lookup-tabulate-funext (f ∘ suc) i\n\nlookup-tabulate : ∀ {i}{A : Set i}{n : ℕ}\n → (f : Fin n → A)\n → lookup (tabulate f) ≡ f\nlookup-tabulate f = funext (lookup-tabulate-funext f)\n\nlookup-iso : ∀ {i}{A : Set i}{n : ℕ}\n → Vec A n ≅ (Fin n → A)\nlookup-iso = iso lookup tabulate tabulate-lookup lookup-tabulate\n", "meta": {"hexsha": "aece6dc9dcfddfdf789128a9b6c5bac613e23c43", "size": 1137, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "sets/vec/properties.agda", "max_stars_repo_name": "HoTT/M-types", "max_stars_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 27, "max_stars_repo_stars_event_min_datetime": "2015-04-14T15:47:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-09T07:26:57.000Z", "max_issues_repo_path": "src/sets/vec/properties.agda", "max_issues_repo_name": "pcapriotti/agda-base", "max_issues_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-02T14:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-26T11:57:26.000Z", "max_forks_repo_path": "sets/vec/properties.agda", "max_forks_repo_name": "HoTT/M-types", "max_forks_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-04-11T17:19:12.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-26T06:17:38.000Z", "avg_line_length": 33.4411764706, "max_line_length": 64, "alphanum_fraction": 0.5954265611, "num_tokens": 354, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206712569267, "lm_q2_score": 0.7745833841649232, "lm_q1q2_score": 0.6986127657904895}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Groups.Definition\nopen import Setoids.Orders.Partial.Definition\nopen import Setoids.Orders.Total.Definition\nopen import Setoids.Setoids\nopen import Functions.Definition\nopen import Rings.Definition\nopen import Rings.Orders.Partial.Definition\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Rings.Orders.Total.Definition {n m : _} {A : Set n} {S : Setoid {n} {m} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} where\n\nopen Ring R\nopen Group additiveGroup\nopen Setoid S\n\nrecord TotallyOrderedRing {p : _} {_<_ : Rel {_} {p} A} {pOrder : SetoidPartialOrder S _<_} (pRing : PartiallyOrderedRing R pOrder) : Set (lsuc n ⊔ m ⊔ p) where\n field\n total : SetoidTotalOrder pOrder\n open SetoidPartialOrder pOrder\n", "meta": {"hexsha": "15218ef80c28f9c1e549532768aa5d788de0d008", "size": 803, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Orders/Total/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Orders/Total/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Orders/Total/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 34.9130434783, "max_line_length": 160, "alphanum_fraction": 0.7222914072, "num_tokens": 244, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9362850110816423, "lm_q2_score": 0.7461390043208003, "lm_q1q2_score": 0.698598765928946}} {"text": "{-# OPTIONS --cubical --no-exact-split --safe #-}\nmodule Multidimensional.Data.Extra.Nat.Properties where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Empty\n\nopen import Cubical.Relation.Nullary\n\nopen import Multidimensional.Data.Extra.Nat.Base\n\nsucnsuc : (n m : ℕ) → sucn n (suc m) ≡ suc (sucn n m)\nsucnsuc zero m = refl\nsucnsuc (suc n) m = \n sucn (suc n) (suc m) ≡⟨ refl ⟩\n suc (sucn n (suc m)) ≡⟨ cong suc (sucnsuc n m) ⟩ \n suc (suc (sucn n m)) ∎\n\ndoublePred : (n : ℕ) → doubleℕ (predℕ n) ≡ predℕ (predℕ (doubleℕ n))\ndoublePred zero = refl\ndoublePred (suc n) = refl\n\nsucPred : (n : ℕ) → ¬ (n ≡ zero) → suc (predℕ n) ≡ n\nsucPred zero 0≠0 = ⊥-elim (0≠0 refl)\nsucPred (suc n) sucn≠0 = refl\n\ndoubleDoubles : (n m : ℕ) → doubleℕ (doublesℕ n m) ≡ doublesℕ (suc n) m\ndoubleDoubles zero m = refl\ndoubleDoubles (suc n) m = doubleDoubles n (doubleℕ m)\n\ndoublePos : (n : ℕ) → ¬ (n ≡ 0) → ¬ (doubleℕ n ≡ 0)\ndoublePos zero 0≠0 = ⊥-elim (0≠0 refl)\ndoublePos (suc n) sn≠0 = snotz\n\ndoublesPos : (n m : ℕ) → ¬ (m ≡ 0) → ¬ (doublesℕ n m ≡ 0)\ndoublesPos zero m m≠0 = m≠0\ndoublesPos (suc n) m m≠0 = doublesPos n (doubleℕ m) (doublePos m (m≠0))\n\npredDoublePos : (n : ℕ) → ¬ (n ≡ 0) → ¬ (predℕ (doubleℕ n)) ≡ 0\npredDoublePos zero n≠0 = ⊥-elim (n≠0 refl)\npredDoublePos (suc n) sn≠0 = snotz\n\ndoubleDoublesOne≠0 : (n : ℕ) → ¬ (doubleℕ (doublesℕ n (suc zero)) ≡ 0)\ndoubleDoublesOne≠0 zero = snotz\ndoubleDoublesOne≠0 (suc n) = doublePos (doublesℕ n 2) (doublesPos n 2 (snotz))\n\npredDoubleDoublesOne≠0 : (n : ℕ) → ¬ (predℕ (doubleℕ (doublesℕ n (suc zero))) ≡ 0)\npredDoubleDoublesOne≠0 zero = snotz\npredDoubleDoublesOne≠0 (suc n) = predDoublePos (doublesℕ n 2) (doublesPos n 2 snotz)\n\ndoublesZero : (n : ℕ) → doublesℕ n zero ≡ zero\ndoublesZero zero = refl\ndoublesZero (suc n) = doublesZero n\n\ndoubleSucn : (i n : ℕ) → doubleℕ (sucn i n) ≡ sucn (doubleℕ i) (doubleℕ n)\ndoubleSucn zero n = refl\ndoubleSucn (suc i) n = \n suc (suc (doubleℕ (sucn i n)))\n ≡⟨ cong (λ z → suc (suc z)) (doubleSucn i n) ⟩ \n suc (suc (sucn (doubleℕ i) (doubleℕ n)))\n ≡⟨ refl ⟩ \n suc (sucn (suc (doubleℕ i)) (doubleℕ n))\n ≡⟨ cong suc refl ⟩ \n sucn (suc (suc (doubleℕ i))) (doubleℕ n)\n ∎\n\ndoublesSucn : (i n m : ℕ) → doublesℕ n (sucn i m) ≡ sucn (doublesℕ n i) (doublesℕ n m)\ndoublesSucn i zero m = refl\ndoublesSucn i (suc n) m = \n doublesℕ n (doubleℕ (sucn i m))\n ≡⟨ cong (doublesℕ n) (doubleSucn i m) ⟩ \n doublesℕ n (sucn (doubleℕ i) (doubleℕ m))\n ≡⟨ doublesSucn (doubleℕ i) n (doubleℕ m) ⟩ \n sucn (doublesℕ n (doubleℕ i)) (doublesℕ n (doubleℕ m))\n ∎\n\n-- 2^n * (m + 2) =\ndoublesSucSuc : (n m : ℕ) → doublesℕ n (suc (suc m)) ≡ sucn (doublesℕ (suc n) 1) (doublesℕ n m)\ndoublesSucSuc zero m = refl\ndoublesSucSuc (suc n) m = \n doublesℕ (suc n) (suc (suc m))\n ≡⟨ refl ⟩\n doublesℕ n (sucn 4 (doubleℕ m))\n ≡⟨ doublesSucn 4 n (doubleℕ m) ⟩ \n sucn (doublesℕ n 4) (doublesℕ n (doubleℕ m))\n ∎\n\n\nn+n≡2n : (n : ℕ) → sucn n n ≡ doubleℕ n\nn+n≡2n zero = refl\nn+n≡2n (suc n) = \n sucn (suc n) (suc n)\n ≡⟨ sucnsuc (suc n) n ⟩\n suc (sucn (suc n) n)\n ≡⟨ refl ⟩ \n suc (suc (sucn n n))\n ≡⟨ cong (λ z → suc (suc z)) (n+n≡2n n) ⟩ \n suc (suc (doubleℕ n))\n ∎\n", "meta": {"hexsha": "c312c72ef049f1d512a2e6cb307b8732520d1a34", "size": 3234, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Multidimensional/Data/Extra/Nat/Properties.agda", "max_stars_repo_name": "wrrnhttn/agda-cubical-multidimensional", "max_stars_repo_head_hexsha": "55709dd950e319c4a105ace33ddaf8b955354add", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Multidimensional/Data/Extra/Nat/Properties.agda", "max_issues_repo_name": "wrrnhttn/agda-cubical-multidimensional", "max_issues_repo_head_hexsha": "55709dd950e319c4a105ace33ddaf8b955354add", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-06-19T20:40:07.000Z", "max_issues_repo_issues_event_max_datetime": "2019-07-02T16:24:01.000Z", "max_forks_repo_path": "Multidimensional/Data/Extra/Nat/Properties.agda", "max_forks_repo_name": "wrrnhttn/agda-cubical-multidimensional", "max_forks_repo_head_hexsha": "55709dd950e319c4a105ace33ddaf8b955354add", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.3980582524, "max_line_length": 95, "alphanum_fraction": 0.6199752628, "num_tokens": 1502, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970842359877, "lm_q2_score": 0.7931059560743422, "lm_q1q2_score": 0.698565413600476}} {"text": "module Mutual2 where\n\ndata Bool\n : Set\n where\n\n false\n : Bool\n\n true\n : Bool\n\ndata ℕ\n : Set\n where\n\n zero\n : ℕ\n\n suc\n : ℕ\n → ℕ\n\nis-even\n : ℕ\n → Bool\n\nis-odd\n : ℕ\n → Bool\n\nis-even zero\n = true\nis-even (suc n)\n = is-odd n\n\nis-odd zero\n = false\nis-odd (suc n)\n = is-even n\n\nis-even'\n : ℕ\n → Bool\nis-even'\n = is-even\n\n", "meta": {"hexsha": "e26e2843f2113ab629525f5b121805c4c0b9485e", "size": 348, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "data/declaration/Mutual2.agda", "max_stars_repo_name": "msuperdock/agda-unused", "max_stars_repo_head_hexsha": "f327f9aab8dcb07022b857736d8201906bba02e9", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-10-29T09:38:43.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-01T16:38:05.000Z", "max_issues_repo_path": "data/declaration/Mutual2.agda", "max_issues_repo_name": "msuperdock/agda-unused", "max_issues_repo_head_hexsha": "f327f9aab8dcb07022b857736d8201906bba02e9", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "data/declaration/Mutual2.agda", "max_forks_repo_name": "msuperdock/agda-unused", "max_forks_repo_head_hexsha": "f327f9aab8dcb07022b857736d8201906bba02e9", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-01T16:38:14.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-01T16:38:14.000Z", "avg_line_length": 7.25, "max_line_length": 20, "alphanum_fraction": 0.5114942529, "num_tokens": 144, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970654616711, "lm_q2_score": 0.793105953629227, "lm_q1q2_score": 0.6985653965568034}} {"text": "module IIDg where\n\nopen import LF\n\n-- Codes for indexed inductive types\ndata OPg (I : Set) : Set1 where\n ι : I -> OPg I\n σ : (A : Set)(γ : A -> OPg I) -> OPg I\n δ : (H : Set)(i : H -> I)(γ : OPg I) -> OPg I\n\n-- The top-level structure of values in an IIDg\nArgs : {I : Set}(γ : OPg I)(U : I -> Set) -> Set\nArgs (ι _) U = One\nArgs (σ A γ) U = A × \\a -> Args (γ a) U\nArgs (δ H i γ) U = ((x : H) -> U (i x)) × \\_ -> Args γ U\n\n-- The index of a value in an IIDg\nIndex : {I : Set}(γ : OPg I)(U : I -> Set) -> Args γ U -> I\nIndex (ι i)\tU _\t = i\nIndex (σ A γ)\tU < a | b > = Index (γ a) U b\nIndex (δ _ _ γ) U < _ | b > = Index γ U b\n\n-- The assumptions of a particular inductive occurrence.\nIndArg : {I : Set}(γ : OPg I)(U : I -> Set) -> Args γ U -> Set\nIndArg (ι _) U _\t = Zero\nIndArg (σ A γ)\t U < a | b > = IndArg (γ a) U b\nIndArg (δ H i γ) U < _ | b > = H + IndArg γ U b\n\n-- The index of an inductive occurrence.\nIndIndex : {I : Set}(γ : OPg I)(U : I -> Set)(a : Args γ U) -> IndArg γ U a -> I\nIndIndex (ι _)\t U _\t ()\nIndIndex (σ A γ) U < a | b > h = IndIndex (γ a) U b h\nIndIndex (δ A i γ) U < g | b > (inl h) = i h\nIndIndex (δ A i γ) U < g | b > (inr h) = IndIndex γ U b h\n\n-- An inductive occurrence.\nInd : {I : Set}(γ : OPg I)(U : I -> Set)(a : Args γ U)(h : IndArg γ U a) -> U (IndIndex γ U a h)\nInd (ι _) U _\t ()\nInd (σ A γ) U < a | b > h\t = Ind (γ a) U b h\nInd (δ H i γ) U < g | b > (inl h) = g h\nInd (δ H i γ) U < _ | b > (inr h) = Ind γ U b h\n\n-- The type of induction hypotheses.\nIndHyp : {I : Set}(γ : OPg I)(U : I -> Set)(C : (i : I) -> U i -> Set)(a : Args γ U) -> Set\nIndHyp γ U C a = (hyp : IndArg γ U a) -> C (IndIndex γ U a hyp) (Ind γ U a hyp)\n\n-- Large induction hypostheses.\nIndHyp₁ : {I : Set}(γ : OPg I)(U : I -> Set)(C : (i : I) -> U i -> Set1)(a : Args γ U) -> Set1\nIndHyp₁ γ U C a = (hyp : IndArg γ U a) -> C (IndIndex γ U a hyp) (Ind γ U a hyp)\n\n", "meta": {"hexsha": "d3397b26d20f285420913837302c7643689cb366", "size": 1908, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/iird/IIDg.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/iird/IIDg.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/iird/IIDg.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 37.4117647059, "max_line_length": 96, "alphanum_fraction": 0.5083857442, "num_tokens": 796, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9149009619539554, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6985120297120484}} {"text": "-- {-# OPTIONS -v tc.meta:100 #-}\n-- Andreas, 2011-04-20\n-- see Abel Pientka TLCA 2011\nmodule PruningNonMillerPattern where\n\ndata _≡_ {A : Set}(a : A) : A -> Set where\n refl : a ≡ a\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\ntest : let X : Nat -> Nat -> Nat\n X = _\n Y : Nat -> Nat -> Nat\n Y = _\n in (C : Set) -> \n (({x y : Nat} -> X x x ≡ suc (Y x y)) ->\n ({x y : Nat} -> Y x x ≡ x) ->\n ({x y : Nat} -> X (Y x y) y ≡ X x x) -> C) -> C\ntest C k = k refl refl refl\n{- none of these equations is immediately solvable. However,\n from 1. we deduce that Y does not depend on its second argument, thus\n from 2. we solve Y x y = x, and then\n eqn. 3. simplifies to X x y = X x x, thus, X does not depend on its second arg,\n we can then solve using 1. X x y = suc x\n-}\n\n-- a variant, where pruning is even triggered from a non-pattern\ntest' : let X : Nat -> Nat -> Nat\n X = _\n Y : Nat -> Nat -> Nat\n Y = _\n in (C : Set) -> \n (({x y : Nat} -> X x (suc x) ≡ suc (Y x y)) -> -- non-pattern lhs\n ({x y : Nat} -> Y x x ≡ x) ->\n ({x y : Nat} -> X (Y x y) y ≡ X x x) -> C) -> C\ntest' C k = k refl refl refl\n", "meta": {"hexsha": "1b57b2289bf5504aeb7b3da9e6b7776f211b5bf9", "size": 1280, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/PruningNonMillerPattern.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/succeed/PruningNonMillerPattern.agda", "max_issues_repo_name": "asr/agda-kanso", "max_issues_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/PruningNonMillerPattern.agda", "max_forks_repo_name": "asr/agda-kanso", "max_forks_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.8205128205, "max_line_length": 82, "alphanum_fraction": 0.4734375, "num_tokens": 436, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8615381952105442, "lm_q2_score": 0.8104789155369048, "lm_q1q2_score": 0.698258542147864}} {"text": "import Lvl\nopen import Data.Boolean\nopen import Type\n\nmodule Data.List.Sorting.InsertionSort {ℓ} {T : Type{ℓ}} (_≤?_ : T → T → Bool) where\n\nopen import Data.List\nimport Data.List.Functions as List\nopen import Data.List.Sorting.Functions(_≤?_)\n\ninsertion-sort : List(T) → List(T)\ninsertion-sort = List.foldᵣ insert ∅\n\nmodule Proofs where\n open import Data.Boolean.Stmt\n open import Data.List.Relation.Permutation\n open import Data.List.Sorting(_≤?_)\n open import Data.List.Sorting.Proofs(_≤?_)\n open import Functional using (_∘₂_)\n open import Logic.Propositional\n open import Relator.Equals\n open import Structure.Relator.Properties\n open import Syntax.Transitivity\n\n module _ (asym : ∀{x y} → (x ≤? y ≡ not(y ≤? x))) where -- TODO: Use Structure.Relator.Properties.Asymmetry by the relation (IsTrue ∘₂ (_≤?_))\n instance\n insertion-sort-sorted-proof : ∀{l} → Sorted(insertion-sort l)\n insertion-sort-sorted-proof {∅} = empty\n insertion-sort-sorted-proof {x ⊰ l} = insert-sorted-proof asym (insertion-sort-sorted-proof {l})\n\n insert-permutation-proof : ∀{x}{l} → ((insert x l) permutes (x ⊰ l))\n insert-permutation-proof {x} {∅} = prepend _permutes_.empty\n insert-permutation-proof {x} {a ⊰ l} with (x ≤? a)\n ... | 𝑇 = reflexivity(_permutes_)\n ... | 𝐹 =\n a ⊰ insert x l 🝖-[ _permutes_.prepend (insert-permutation-proof {x} {l}) ]\n a ⊰ x ⊰ l 🝖-[ _permutes_.swap ]\n x ⊰ a ⊰ l 🝖-end\n\n instance\n insertion-sort-permutation-proof : ∀{l} → ((insertion-sort l) permutes l)\n insertion-sort-permutation-proof {∅} = _permutes_.empty\n insertion-sort-permutation-proof {x ⊰ l} =\n insertion-sort (x ⊰ l) 🝖-[ insert-permutation-proof ]\n x ⊰ (insertion-sort l) 🝖-[ prepend (insertion-sort-permutation-proof {l}) ]\n x ⊰ l 🝖-end\n\n instance\n insertion-sort-sorting-algorithm : SortingAlgorithm(insertion-sort)\n SortingAlgorithm.sorts insertion-sort-sorting-algorithm {l} = insertion-sort-sorted-proof {l}\n SortingAlgorithm.permutes insertion-sort-sorting-algorithm = insertion-sort-permutation-proof\n", "meta": {"hexsha": "e7c4edcd6268061e73874add54ac9719b10414b4", "size": 2144, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/List/Sorting/InsertionSort.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/List/Sorting/InsertionSort.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/List/Sorting/InsertionSort.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.2307692308, "max_line_length": 144, "alphanum_fraction": 0.6646455224, "num_tokens": 625, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.904650527388829, "lm_q2_score": 0.7718435030872968, "lm_q1q2_score": 0.6982486321295643}} {"text": "import Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl; sym; trans; cong)\nopen Eq.≡-Reasoning\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Data.Product using (_×_; proj₁; proj₂) renaming (_,_ to ⟨_,_⟩)\nopen import Data.Sum using (_⊎_; inj₁; inj₂)\nopen import Relation.Nullary using (¬_)\nopen import Relation.Nullary.Negation using (contraposition)\nopen import Data.Unit using (⊤; tt)\nopen import Data.Empty using (⊥; ⊥-elim)\nopen import Data.List using (List; []; _∷_; foldr; map)\nopen import Function using (_∘_)\n\ndouble-negation : ∀ {A : Set} → A → ¬ ¬ A\ndouble-negation x ¬x = ¬x x\n\ntriple-negation : ∀ {A : Set} → ¬ ¬ ¬ A → ¬ A\ntriple-negation ¬¬¬x x = ¬¬¬x (double-negation x)\n\nStable : Set → Set\nStable A = ¬ ¬ A → A\n\n¬-stable : ∀ {A : Set} → Stable (¬ A)\n¬-stable = triple-negation\n\n×-stable : ∀ {A B : Set} → Stable A → Stable B → Stable (A × B)\n×-stable ¬¬x→x ¬¬y→y ¬¬xy =\n ⟨ ¬¬x→x (contraposition (contraposition proj₁) ¬¬xy)\n , ¬¬y→y (contraposition (contraposition proj₂) ¬¬xy)\n ⟩\n\n∀-stable : ∀ {A : Set} {B : A → Set} → (∀ (x : A) → Stable (B x)) → Stable (∀ (x : A) → B x)\n∀-stable ∀x→¬¬y→y ¬¬∀x→y x =\n ∀x→¬¬y→y x (contraposition (contraposition λ{∀x→y → ∀x→y x}) ¬¬∀x→y)\n\n-- Gödel-Gentzen translation\n\n{--\ndata Var : ℕ → Set where\n zero : ∀ (n : ℕ) → Var (suc n)\n suc : ∀ (n : ℕ) → Var n → Var (suc n)\n\ndata Formula : ℕ → Set where\n _`≡_ : ∀ (n : ℕ) → Var n → Var n → Formula n\n _`×_ : ∀ (n : ℕ) → Formula n → Formula n → Formula n\n _`⊎_ : ∀ (n : ℕ) → Formula n → Formula n → Formula n\n `¬_ : ∀ (n : ℕ) → Formula n → Formula n\n--}\n\ndata Formula : Set₁ where\n atomic : ∀ (A : Set) → Formula\n _`×_ : Formula → Formula → Formula\n _`⊎_ : Formula → Formula → Formula\n `¬_ : Formula → Formula\n\ninterp : Formula → Set\ninterp (atomic A) = A\ninterp (`A `× `B) = interp `A × interp `B\ninterp (`A `⊎ `B) = interp `A ⊎ interp `B\ninterp (`¬ `A) = ¬ interp `A\n\ng : Formula → Formula\ng (atomic A) = `¬ `¬ (atomic A)\ng (`A `× `B) = g `A `× g `B\ng (`A `⊎ `B) = `¬ ((`¬ g `A) `× (`¬ g `B))\ng (`¬ `A) = `¬ g `A\n\nstable-g : ∀ (`A : Formula) → Stable (interp (g `A))\nstable-g (atomic A) = ¬-stable \nstable-g (`A `× `B) = ×-stable (stable-g `A) (stable-g `B)\nstable-g (`A `⊎ `B) = ¬-stable\nstable-g (`¬ `A) = ¬-stable\n\n\n", "meta": {"hexsha": "7687676da03c7a9e78ddd7f6fa02f4a0ab8011aa", "size": 2262, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "extra/extra/Stable.agda", "max_stars_repo_name": "manikdv/plfa.github.io", "max_stars_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 1003, "max_stars_repo_stars_event_min_datetime": "2018-07-05T18:15:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-27T07:03:28.000Z", "max_issues_repo_path": "extra/extra/Stable.agda", "max_issues_repo_name": "manikdv/plfa.github.io", "max_issues_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": 323, "max_issues_repo_issues_event_min_datetime": "2018-07-05T22:34:34.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T07:42:57.000Z", "max_forks_repo_path": "extra/extra/Stable.agda", "max_forks_repo_name": "manikdv/plfa.github.io", "max_forks_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": 304, "max_forks_repo_forks_event_min_datetime": "2018-07-16T18:24:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T11:35:02.000Z", "avg_line_length": 30.16, "max_line_length": 92, "alphanum_fraction": 0.5663129973, "num_tokens": 907, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797100118214, "lm_q2_score": 0.7662936324115012, "lm_q1q2_score": 0.698231209764617}} {"text": "-- Classical propositional logic, PHOAS approach, initial encoding\n\nmodule Pi.Cp where\n\n\n-- Types\n\ninfixl 2 _&&_\ninfixl 1 _||_\ninfixr 0 _=>_\ndata Ty : Set where\n UNIT : Ty\n _=>_ : Ty -> Ty -> Ty\n _&&_ : Ty -> Ty -> Ty\n _||_ : Ty -> Ty -> Ty\n FALSE : Ty\n\ninfixr 0 _<=>_\n_<=>_ : Ty -> Ty -> Ty\na <=> b = (a => b) && (b => a)\n\nNOT : Ty -> Ty\nNOT a = a => FALSE\n\nTRUE : Ty\nTRUE = FALSE => FALSE\n\n\n-- Context and truth judgement\n\nCx : Set1\nCx = Ty -> Set\n\nisTrue : Ty -> Cx -> Set\nisTrue a tc = tc a\n\n\n-- Terms\n\nmodule Cp where\n infixl 1 _$_\n data Tm (tc : Cx) : Ty -> Set where\n var : forall {a} -> isTrue a tc -> Tm tc a\n lam' : forall {a b} -> (isTrue a tc -> Tm tc b) -> Tm tc (a => b)\n _$_ : forall {a b} -> Tm tc (a => b) -> Tm tc a -> Tm tc b\n pair' : forall {a b} -> Tm tc a -> Tm tc b -> Tm tc (a && b)\n fst : forall {a b} -> Tm tc (a && b) -> Tm tc a\n snd : forall {a b} -> Tm tc (a && b) -> Tm tc b\n left : forall {a b} -> Tm tc a -> Tm tc (a || b)\n right : forall {a b} -> Tm tc b -> Tm tc (a || b)\n case' : forall {a b c} -> Tm tc (a || b) -> (isTrue a tc -> Tm tc c) -> (isTrue b tc -> Tm tc c) -> Tm tc c\n abort' : forall {a} -> (isTrue (NOT a) tc -> Tm tc FALSE) -> Tm tc a\n\n lam'' : forall {tc a b} -> (Tm tc a -> Tm tc b) -> Tm tc (a => b)\n lam'' f = lam' \\x -> f (var x)\n\n case'' : forall {tc a b c} -> Tm tc (a || b) -> (Tm tc a -> Tm tc c) -> (Tm tc b -> Tm tc c) -> Tm tc c\n case'' xy f g = case' xy (\\x -> f (var x)) (\\y -> g (var y))\n\n abort'' : forall {tc a} -> (Tm tc (NOT a) -> Tm tc FALSE) -> Tm tc a\n abort'' f = abort' \\na -> f (var na)\n\n syntax lam'' (\\a -> b) = lam a => b\n syntax pair' x y = [ x , y ]\n syntax case'' xy (\\x -> z1) (\\y -> z2) = case xy of x => z1 or y => z2\n syntax abort'' (\\x -> y) = abort x => y\n\n Thm : Ty -> Set1\n Thm a = forall {tc} -> Tm tc a\nopen Cp public\n", "meta": {"hexsha": "c5bd9ccd980af47bc784043723660fc586eb24a8", "size": 2017, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Pi/Cp.agda", "max_stars_repo_name": "mietek/formal-logic", "max_stars_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_stars_repo_licenses": ["X11"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2015-08-31T09:49:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-13T12:37:44.000Z", "max_issues_repo_path": "src/Pi/Cp.agda", "max_issues_repo_name": "mietek/formal-logic", "max_issues_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_issues_repo_licenses": ["X11"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Pi/Cp.agda", "max_forks_repo_name": "mietek/formal-logic", "max_forks_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_forks_repo_licenses": ["X11"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.4084507042, "max_line_length": 112, "alphanum_fraction": 0.4476945959, "num_tokens": 795, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110425624792, "lm_q2_score": 0.782662489091802, "lm_q1q2_score": 0.697987050371505}} {"text": "-- 2011-10-01 Andreas\nmodule EtaContractIrrelevant where\n\nimport Common.Level\n\ndata _≡_ {a}{A : Set a}(x : A) : A → Set where\n refl : x ≡ x\n\nsubst : ∀ {a b}{A : Set a}(P : A → Set b){x y : A} → x ≡ y → P x → P y\nsubst P refl x = x\n\npostulate \n Val : Set\n \nPred = Val → Set\n\nfam : Pred → Set1\nfam A = {a : Val} → .(A a) → Pred\n\npostulate\n π : (A : Pred)(F : fam A) → Pred\n\nπCong : {A A' : Pred}(A≡A' : A ≡ A') →\n {F : fam A }\n {F' : fam A'}\n (F≡F' : (λ {a} Aa → F {a = a} Aa) \n ≡ (λ {a} Aa → F' {a = a} (subst (λ A → A a) A≡A' Aa))) →\n π A F ≡ π A' F'\nπCong refl refl = refl\n-- needs eta-contraction for irrelevant functions F F'\n", "meta": {"hexsha": "f289589a76bd8053bcf072f33e72c1c0812766f7", "size": 645, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/EtaContractIrrelevant.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/succeed/EtaContractIrrelevant.agda", "max_issues_repo_name": "asr/agda-kanso", "max_issues_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/EtaContractIrrelevant.agda", "max_forks_repo_name": "asr/agda-kanso", "max_forks_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.8064516129, "max_line_length": 70, "alphanum_fraction": 0.5085271318, "num_tokens": 287, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887588023318196, "lm_q2_score": 0.7853085758631159, "lm_q1q2_score": 0.6979499093450098}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Definitions of algebraic structures defined over some other\n-- structure, like modules and vector spaces\n--\n-- Terminology of bundles:\n-- * There are both *semimodules* and *modules*.\n-- - For M an R-semimodule, R is a semiring, and M forms a commutative\n-- monoid.\n-- - For M an R-module, R is a ring, and M forms an Abelian group.\n-- * There are all four of *left modules*, *right modules*, *bimodules*,\n-- and *modules*.\n-- - Left modules have a left-scaling operation.\n-- - Right modules have a right-scaling operation.\n-- - Bimodules have two sorts of scalars. Left-scaling handles one and\n-- right-scaling handles the other. Left-scaling and right-scaling\n-- are furthermore compatible.\n-- - Modules are bimodules with a single sort of scalars and scalar\n-- multiplication must also be commutative. Left-scaling and\n-- right-scaling coincide.\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Algebra.Module.Bundles where\n\nopen import Algebra.Bundles\nopen import Algebra.Core\nopen import Algebra.Module.Structures\nopen import Algebra.Module.Definitions\nopen import Function.Base\nopen import Level\nopen import Relation.Binary\nimport Relation.Binary.Reasoning.Setoid as SetR\n\nprivate\n variable\n r ℓr s ℓs : Level\n\n------------------------------------------------------------------------\n-- Left modules\n------------------------------------------------------------------------\n\nrecord LeftSemimodule (semiring : Semiring r ℓr) m ℓm\n : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where\n open Semiring semiring\n\n infixr 7 _*ₗ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ₗ_ : Opₗ Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n isLeftSemimodule : IsLeftSemimodule semiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ₗ_\n\n open IsLeftSemimodule isLeftSemimodule public\n\n +ᴹ-commutativeMonoid : CommutativeMonoid m ℓm\n +ᴹ-commutativeMonoid = record\n { isCommutativeMonoid = +ᴹ-isCommutativeMonoid\n }\n\n open CommutativeMonoid +ᴹ-commutativeMonoid public\n using () renaming\n ( monoid to +ᴹ-monoid\n ; semigroup to +ᴹ-semigroup\n ; magma to +ᴹ-magma\n ; rawMagma to +ᴹ-rawMagma\n ; rawMonoid to +ᴹ-rawMonoid\n )\n\nrecord LeftModule (ring : Ring r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where\n open Ring ring\n\n infixr 8 -ᴹ_\n infixr 7 _*ₗ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ₗ_ : Opₗ Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n -ᴹ_ : Op₁ Carrierᴹ\n isLeftModule : IsLeftModule ring _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_\n\n open IsLeftModule isLeftModule public\n\n leftSemimodule : LeftSemimodule semiring m ℓm\n leftSemimodule = record { isLeftSemimodule = isLeftSemimodule }\n\n open LeftSemimodule leftSemimodule public\n using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma\n ; +ᴹ-rawMagma; +ᴹ-rawMonoid)\n\n +ᴹ-abelianGroup : AbelianGroup m ℓm\n +ᴹ-abelianGroup = record { isAbelianGroup = +ᴹ-isAbelianGroup }\n\n open AbelianGroup +ᴹ-abelianGroup public\n using () renaming (group to +ᴹ-group)\n\n------------------------------------------------------------------------\n-- Right modules\n------------------------------------------------------------------------\n\nrecord RightSemimodule (semiring : Semiring r ℓr) m ℓm\n : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where\n open Semiring semiring\n\n infixl 7 _*ᵣ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ᵣ_ : Opᵣ Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n isRightSemimodule : IsRightSemimodule semiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ᵣ_\n\n open IsRightSemimodule isRightSemimodule public\n\n +ᴹ-commutativeMonoid : CommutativeMonoid m ℓm\n +ᴹ-commutativeMonoid = record\n { isCommutativeMonoid = +ᴹ-isCommutativeMonoid\n }\n\n open CommutativeMonoid +ᴹ-commutativeMonoid public\n using () renaming\n ( monoid to +ᴹ-monoid\n ; semigroup to +ᴹ-semigroup\n ; magma to +ᴹ-magma\n ; rawMagma to +ᴹ-rawMagma\n ; rawMonoid to +ᴹ-rawMonoid\n )\n\nrecord RightModule (ring : Ring r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where\n open Ring ring\n\n infixr 8 -ᴹ_\n infixl 7 _*ᵣ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ᵣ_ : Opᵣ Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n -ᴹ_ : Op₁ Carrierᴹ\n isRightModule : IsRightModule ring _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ᵣ_\n\n open IsRightModule isRightModule public\n\n rightSemimodule : RightSemimodule semiring m ℓm\n rightSemimodule = record { isRightSemimodule = isRightSemimodule }\n\n open RightSemimodule rightSemimodule public\n using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma\n ; +ᴹ-rawMagma; +ᴹ-rawMonoid)\n\n +ᴹ-abelianGroup : AbelianGroup m ℓm\n +ᴹ-abelianGroup = record { isAbelianGroup = +ᴹ-isAbelianGroup }\n\n open AbelianGroup +ᴹ-abelianGroup public\n using () renaming (group to +ᴹ-group)\n\n------------------------------------------------------------------------\n-- Bimodules\n------------------------------------------------------------------------\n\nrecord Bisemimodule (R-semiring : Semiring r ℓr) (S-semiring : Semiring s ℓs)\n m ℓm : Set (r ⊔ s ⊔ ℓr ⊔ ℓs ⊔ suc (m ⊔ ℓm)) where\n private\n module R = Semiring R-semiring\n module S = Semiring S-semiring\n\n infixr 7 _*ₗ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ₗ_ : Opₗ R.Carrier Carrierᴹ\n _*ᵣ_ : Opᵣ S.Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n isBisemimodule : IsBisemimodule R-semiring S-semiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ₗ_ _*ᵣ_\n\n open IsBisemimodule isBisemimodule public\n\n leftSemimodule : LeftSemimodule R-semiring m ℓm\n leftSemimodule = record { isLeftSemimodule = isLeftSemimodule }\n\n rightSemimodule : RightSemimodule S-semiring m ℓm\n rightSemimodule = record { isRightSemimodule = isRightSemimodule }\n\n open LeftSemimodule leftSemimodule public\n using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma; +ᴹ-rawMagma\n ; +ᴹ-rawMonoid)\n\nrecord Bimodule (R-ring : Ring r ℓr) (S-ring : Ring s ℓs) m ℓm\n : Set (r ⊔ s ⊔ ℓr ⊔ ℓs ⊔ suc (m ⊔ ℓm)) where\n private\n module R = Ring R-ring\n module S = Ring S-ring\n\n infixr 7 _*ₗ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ₗ_ : Opₗ R.Carrier Carrierᴹ\n _*ᵣ_ : Opᵣ S.Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n -ᴹ_ : Op₁ Carrierᴹ\n isBimodule : IsBimodule R-ring S-ring _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_ _*ᵣ_\n\n open IsBimodule isBimodule public\n\n leftModule : LeftModule R-ring m ℓm\n leftModule = record { isLeftModule = isLeftModule }\n\n rightModule : RightModule S-ring m ℓm\n rightModule = record { isRightModule = isRightModule }\n\n open LeftModule leftModule public\n using ( +ᴹ-abelianGroup; +ᴹ-commutativeMonoid; +ᴹ-group; +ᴹ-monoid\n ; +ᴹ-semigroup; +ᴹ-magma; +ᴹ-rawMagma; +ᴹ-rawMonoid)\n\n bisemimodule : Bisemimodule R.semiring S.semiring m ℓm\n bisemimodule = record { isBisemimodule = isBisemimodule }\n\n open Bisemimodule bisemimodule public\n using (leftSemimodule; rightSemimodule)\n\n------------------------------------------------------------------------\n-- Modules over commutative structures\n------------------------------------------------------------------------\n\nrecord Semimodule (commutativeSemiring : CommutativeSemiring r ℓr) m ℓm\n : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where\n open CommutativeSemiring commutativeSemiring\n\n infixr 7 _*ₗ_\n infixl 7 _*ᵣ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ₗ_ : Opₗ Carrier Carrierᴹ\n _*ᵣ_ : Opᵣ Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n isSemimodule : IsSemimodule commutativeSemiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ₗ_ _*ᵣ_\n\n open IsSemimodule isSemimodule public\n\n private\n module L = LeftDefs Carrier _≈ᴹ_\n module R = RightDefs Carrier _≈ᴹ_\n\n bisemimodule : Bisemimodule semiring semiring m ℓm\n bisemimodule = record { isBisemimodule = isBisemimodule }\n\n open Bisemimodule bisemimodule public\n using ( leftSemimodule; rightSemimodule\n ; +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma\n ; +ᴹ-rawMagma; +ᴹ-rawMonoid)\n\n open SetR ≈ᴹ-setoid\n\n *ₗ-comm : L.Commutative _*ₗ_\n *ₗ-comm x y m = begin\n x *ₗ y *ₗ m ≈⟨ ≈ᴹ-sym (*ₗ-assoc x y m) ⟩\n (x * y) *ₗ m ≈⟨ *ₗ-cong (*-comm _ _) ≈ᴹ-refl ⟩\n (y * x) *ₗ m ≈⟨ *ₗ-assoc y x m ⟩\n y *ₗ x *ₗ m ∎\n\n *ᵣ-comm : R.Commutative _*ᵣ_\n *ᵣ-comm m x y = begin\n m *ᵣ x *ᵣ y ≈⟨ *ᵣ-assoc m x y ⟩\n m *ᵣ (x * y) ≈⟨ *ᵣ-cong ≈ᴹ-refl (*-comm _ _) ⟩\n m *ᵣ (y * x) ≈⟨ ≈ᴹ-sym (*ᵣ-assoc m y x) ⟩\n m *ᵣ y *ᵣ x ∎\n\nrecord Module (commutativeRing : CommutativeRing r ℓr) m ℓm\n : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where\n open CommutativeRing commutativeRing\n\n infixr 8 -ᴹ_\n infixr 7 _*ₗ_\n infixl 6 _+ᴹ_\n infix 4 _≈ᴹ_\n\n field\n Carrierᴹ : Set m\n _≈ᴹ_ : Rel Carrierᴹ ℓm\n _+ᴹ_ : Op₂ Carrierᴹ\n _*ₗ_ : Opₗ Carrier Carrierᴹ\n _*ᵣ_ : Opᵣ Carrier Carrierᴹ\n 0ᴹ : Carrierᴹ\n -ᴹ_ : Op₁ Carrierᴹ\n isModule : IsModule commutativeRing _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_ _*ᵣ_\n\n open IsModule isModule public\n\n bimodule : Bimodule ring ring m ℓm\n bimodule = record { isBimodule = isBimodule }\n\n open Bimodule bimodule public\n using ( leftModule; rightModule; leftSemimodule; rightSemimodule\n ; +ᴹ-abelianGroup; +ᴹ-group; +ᴹ-commutativeMonoid; +ᴹ-monoid\n ; +ᴹ-semigroup; +ᴹ-magma ; +ᴹ-rawMonoid; +ᴹ-rawMagma)\n\n semimodule : Semimodule commutativeSemiring m ℓm\n semimodule = record { isSemimodule = isSemimodule }\n\n open Semimodule semimodule public using (*ₗ-comm; *ᵣ-comm)\n", "meta": {"hexsha": "252ae1b072c1f2d0686a9eb5f610e9c3014138f2", "size": 9880, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Algebra/Module/Bundles.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Algebra/Module/Bundles.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Algebra/Module/Bundles.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 29.4925373134, "max_line_length": 80, "alphanum_fraction": 0.620951417, "num_tokens": 3911, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8947894717137996, "lm_q2_score": 0.7799929053683038, "lm_q1q2_score": 0.6979294397350163}} {"text": "module Cats.Category.Preorder.Facts.PreorderAsCategory where\n\nopen import Data.Bool using (true ; false)\nopen import Relation.Binary using (Preorder)\n\nimport Level\n\nopen import Cats.Category\nopen import Cats.Category.Preorder using (preorderAsCategory)\nopen import Cats.Util.Logic.Constructive\n\n\nmodule _ {lc l≈ l≤} (P : Preorder lc l≈ l≤) where\n\n C : Category _ _ _\n C = preorderAsCategory P\n\n\n open module P = Preorder P using (_∼_) renaming (_≈_ to _≋_)\n open Category C\n\n\n _≈_⊔_ : Obj → Obj → Obj → Set l≤\n lub ≈ x ⊔ y = x ∼ lub ∧ y ∼ lub ∧ (lub ∼ x ∨ lub ∼ y)\n\n\n _≈_⊓_ : Obj → Obj → Obj → Set l≤\n glb ≈ x ⊓ y = glb ∼ x ∧ glb ∼ y ∧ (x ∼ glb ∨ y ∼ glb)\n\n\n IsMinimum : Obj → Set (lc Level.⊔ l≤)\n IsMinimum m = ∀ x → m ∼ x\n\n\n IsMaximum : Obj → Set (lc Level.⊔ l≤)\n IsMaximum m = ∀ x → x ∼ m\n\n\n initial : ∀ {x} → IsMinimum x → IsInitial x\n initial min y = ∃!-intro (min y) _ _\n\n\n terminal : ∀ {x} → IsMaximum x → IsTerminal x\n terminal max y = ∃!-intro (max y) _ _\n\n\n ⊓-isBinaryProduct : ∀ {glb x y}\n → (pl : glb ∼ x)\n → (pr : glb ∼ y)\n → (x ∼ glb ∨ y ∼ glb)\n → IsBinaryProduct glb pl pr\n ⊓-isBinaryProduct pl pr (∨-introl x∼glb) xl xr = ∃!-intro (x∼glb ∘ xl) _ _\n ⊓-isBinaryProduct pl pr (∨-intror y∼glb) xl xr = ∃!-intro (y∼glb ∘ xr) _ _\n\n\n ⊓-to-BinaryProduct : ∀ {glb x y} → glb ≈ x ⊓ y → BinaryProduct x y\n ⊓-to-BinaryProduct {glb} (pl , pr , maximal)\n = mkBinaryProduct pl pr (⊓-isBinaryProduct pl pr maximal)\n\n\n mono : ∀ {x y} (f : x ⇒ y) → IsMono f\n mono = _\n\n\n epi : ∀ {x y} (f : x ⇒ y) → IsEpi f\n epi = _\n\n\n unique : ∀ {x y} (f : x ⇒ y) → IsUnique f\n unique = _\n", "meta": {"hexsha": "ca1bb1fec4989afd2348c0d57a07fd7af4f900be", "size": 1615, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cats/Category/Preorder/Facts/PreorderAsCategory.agda", "max_stars_repo_name": "alessio-b-zak/cats", "max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cats/Category/Preorder/Facts/PreorderAsCategory.agda", "max_issues_repo_name": "alessio-b-zak/cats", "max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cats/Category/Preorder/Facts/PreorderAsCategory.agda", "max_forks_repo_name": "alessio-b-zak/cats", "max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.7464788732, "max_line_length": 76, "alphanum_fraction": 0.5832817337, "num_tokens": 659, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8947894717137996, "lm_q2_score": 0.7799928900257126, "lm_q1q2_score": 0.6979294260066272}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Relation.Unary where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Foundations.Isomorphism\nopen import Cubical.Foundations.Univalence\nopen import Cubical.Classes\nimport Cubical.Foundations.Logic as L\n\nopen import Cubical.Data.Sigma\nopen import Cubical.Data.Empty using (⊥)\nopen import Cubical.Data.Sum.Base using (_⊎_; rec)\nopen import Cubical.Foundations.Function\n\nopen import Cubical.Relation.Nullary\nopen import Cubical.Relation.Nullary.Decidable using (IsYes)\n\nprivate\n variable\n a b c ℓ ℓ₁ ℓ₂ : Level\n A : Type a\n B : Type b\n C : Type c\n\n------------------------------------------------------------------------\n-- Definition\n\n-- Unary relations are known as predicates and `Pred A ℓ` can be viewed\n-- as some property that elements of type A might satisfy.\n\n-- Consequently `P : Pred A ℓ` can also be seen as a subset of A\n-- containing all the elements of A that satisfy property P. This view\n-- informs much of the notation used below.\n\nRawPred : Type a → (ℓ : Level) → Type _\nRawPred A ℓ = A → Type ℓ\n\nPred : Type a → (ℓ : Level) → Type _\nPred A ℓ = A → hProp ℓ\n\n\nisPropValued : RawPred A ℓ → Type _\nisPropValued P = ∀ x → isProp (P x)\n\ninstance\n PredCast : Cast (Pred A ℓ) (RawPred A ℓ)\n PredCast = record { [_] = λ P x → P x .fst }\n\nisProp[_] : (P : Pred A ℓ) → isPropValued [ P ]\nisProp[ P ] x = P x .snd\n\nfromRaw : (P : RawPred A ℓ) → isPropValued P → Pred A ℓ\nfromRaw P isPropP x .fst = P x\nfromRaw P isPropP x .snd = isPropP x\n\n\n------------------------------------------------------------------------\n-- Special sets\n\n-- The empty set.\n\n∅ : Pred A _\n∅ _ = L.⊥\n\n-- The singleton set.\n\n{_} : A → Pred A _\n{ x } = L._≡ₚ x\n\n-- The universal set.\n\nU : Pred A _\nU _ = L.⊤\n\nopen import Cubical.Data.Unit public using (tt)\n\n------------------------------------------------------------------------\n-- Membership\n\ninfix 6 _∈_ _∉_\n\n_∈_ : A → Pred A ℓ → Type _\nx ∈ P = ⟨ P x ⟩\n\n_∉_ : A → Pred A ℓ → Type _\nx ∉ P = ¬ x ∈ P\n\n------------------------------------------------------------------------\n-- Subset relations\n\ninfix 6 _⊆_ _⊇_ _⊈_ _⊉_ _⊂_ _⊃_ _⊄_ _⊅_\n\n_⊆_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊆ Q = ∀ {x} → x ∈ P → x ∈ Q\n\n_⊇_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊇ Q = Q ⊆ P\n\n_⊈_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊈ Q = ¬ (P ⊆ Q)\n\n_⊉_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊉ Q = ¬ (P ⊇ Q)\n\n_⊂_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊂ Q = P ⊆ Q × Q ⊈ P\n\n_⊃_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊃ Q = Q ⊂ P\n\n_⊄_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊄ Q = ¬ (P ⊂ Q)\n\n_⊅_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⊅ Q = ¬ (P ⊃ Q)\n\n------------------------------------------------------------------------\n-- Properties of sets\n\ninfix 10 Satisfiable Universal IUniversal\n\n-- Emptiness - no element satisfies P.\n\nEmpty : Pred A ℓ → Type _\nEmpty P = ∀ x → x ∉ P\n\n-- Satisfiable - at least one element satisfies P.\n\nSatisfiable : Pred A ℓ → Type _\nSatisfiable {A = A} P = ∃[ x ∈ A ] x ∈ P\n\nsyntax Satisfiable P = ∃⟨ P ⟩\n\n-- Universality - all elements satisfy P.\n\nUniversal : Pred A ℓ → Type _\nUniversal P = ∀ x → x ∈ P\n\nsyntax Universal P = Π[ P ]\n\n-- Implicit universality - all elements satisfy P.\n\nIUniversal : Pred A ℓ → Type _\nIUniversal P = ∀ {x} → x ∈ P\n\nsyntax IUniversal P = ∀[ P ]\n\n-- Decidability - it is possible to determine if an arbitrary element\n-- satisfies P.\n\nDecidable : Pred A ℓ → Type _\nDecidable P = ∀ x → Dec (x ∈ P)\n\n-- Disjointness - Any element satifsying both P and Q is contradictory.\n\n_⊃⊂_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\n_⊃⊂_ P Q = ∀ {x} → x ∈ P → x ∈ Q → ⊥\n\n-- Positive version of non-disjointness, dual to inclusion.\n\n_≬_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\n_≬_ {A = A} P Q = ∃[ x ∈ A ] x ∈ P × x ∈ Q\n\n------------------------------------------------------------------------\n-- Operations on sets\n\ninfix 10 ⋃ ⋂\ninfixr 9 _⊢_ _⊣_\ninfixr 8 _⇒_\ninfixr 7 _∩_\ninfixr 6 _∪_\ninfix 5 _≬_\n\n-- Complement.\n\n∁ : Pred A ℓ → Pred A ℓ\n∁ P = λ x → L.¬ P x\n\n-- Implication.\n\n_⇒_ : Pred A ℓ₁ → Pred A ℓ₂ → Pred A _\nP ⇒ Q = λ x → P x L.⇒ Q x\n\n-- Union.\n\n_∪_ : Pred A ℓ₁ → Pred A ℓ₂ → Pred A _\nP ∪ Q = λ x → P x L.⊔ Q x\n\n-- Intersection.\n\n_∩_ : Pred A ℓ₁ → Pred A ℓ₂ → Pred A _\nP ∩ Q = λ x → P x L.⊓ Q x\n\n-- Infinitary union.\n\n⋃ : ∀ {i} (I : Type i) → (I → Pred A ℓ) → Pred A _\n⋃ I P = λ x → L.∃[ i ∶ I ] P i x\n\nsyntax ⋃ I (λ i → P) = ⋃[ i ∶ I ] P\n\n-- Infinitary intersection.\n⋂ : ∀ {i} (I : Type i) → (I → Pred A ℓ) → Pred A _\n⋂ I P = λ x → ((i : I) → x ∈ P i) , isPropΠ λ i → isProp[ P i ] x\n\nsyntax ⋂ I (λ i → P) = ⋂[ i ∶ I ] P\n\n-- Preimage.\n\n_⊢_ : (A → B) → Pred B ℓ → Pred A ℓ\nf ⊢ P = λ x → P (f x)\n\n-- Image.\n\n_⊣_ : (A → B) → Pred A ℓ → Pred B _\nf ⊣ P = λ x → L.∥ Σ[ (y , _) ∈ Σ _ (_∈ P) ] (f y ≡ x) ∥ₚ\n\n\n------------------------------------------------------------------------\n-- Preservation under operations\n\n_Preserves_⟶_ : (A → B) → Pred A ℓ₁ → Pred B ℓ₂ → Type _\nf Preserves P ⟶ Q = P ⊆ f ⊢ Q\n\n_Preserves_ : (A → A) → Pred A ℓ → Type _\nf Preserves P = f Preserves P ⟶ P\n\n-- A binary variant of _Preserves_⟶_.\n\n_Preserves₂_⟶_⟶_ : (A → B → C) → Pred A ℓ₁ → Pred B ℓ₂ → Pred C ℓ → Type _\n_∙_ Preserves₂ P ⟶ Q ⟶ R = ∀ {x y} → x ∈ P → y ∈ Q → x ∙ y ∈ R\n\n_Preserves₂_ : (A → A → A) → Pred A ℓ → Type _\n_∙_ Preserves₂ P = _∙_ Preserves₂ P ⟶ P ⟶ P\n\n------------------------------------------------------------------------\n-- Logical equivalence\n\ninfix 8 _⇔_ _⇚⇛_\n\n_⇔_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⇔ Q = P ⊆ Q × P ⊇ Q\n\n-- Direct logical equivalence (more useful for proofs)\n\n_⇚⇛_ : Pred A ℓ₁ → Pred A ℓ₂ → Type _\nP ⇚⇛ Q = ∀ x → x ∈ P ≃ x ∈ Q\n\n\nmodule _ (P : Pred A ℓ₁) (Q : Pred A ℓ₂) where\n\n ⇔-⇚⇛ : P ⇔ Q → P ⇚⇛ Q\n ⇔-⇚⇛ (P⊆Q , Q⊆P) x = isPropEquiv→Equiv (P x .snd) (Q x .snd) P⊆Q Q⊆P\n\n ⇚⇛-⇔ : P ⇚⇛ Q → P ⇔ Q\n ⇚⇛-⇔ P⇚⇛Q = equivFun (P⇚⇛Q _) , invEq (P⇚⇛Q _)\n\n equiv≃ : P ⇔ Q ≃ P ⇚⇛ Q\n equiv≃ = isPropEquiv→Equiv (isProp× (isPropImplicitΠ λ _ → isPropΠ λ _ → (Q _ .snd)) (isPropImplicitΠ λ _ → isPropΠ λ _ → (P _ .snd)))\n (isPropΠ λ _ → isPropΣ (isPropΠ λ _ → Q _ .snd) (λ _ → isPropIsEquiv _)) ⇔-⇚⇛ ⇚⇛-⇔\n\nequiv≡ : _⇔_ ≡ _⇚⇛_ {ℓ₁} {A} {ℓ₂} {ℓ}\nequiv≡ = funExt (λ P → funExt (λ Q → ua (equiv≃ P Q)))\n\n\nmodule _ (P Q : Pred A ℓ) where\n\n ⇚⇛toPath : P ⇚⇛ Q → P ≡ Q\n ⇚⇛toPath P⇚⇛Q = funExt (λ x → L.hProp≡ (ua (P⇚⇛Q x)))\n\n ⇔toPath : P ⇔ Q → P ≡ Q\n ⇔toPath P⇔Q = ⇚⇛toPath (⇔-⇚⇛ P Q P⇔Q)\n\n------------------------------------------------------------------------\n-- Predicate combinators\n\n-- These differ from the set operations above, as the carrier set of the\n-- resulting predicates are not the same as the carrier set of the\n-- component predicates.\n\ninfixr 2 _⟨×⟩_\ninfixr 2 _⟨⊙⟩_\ninfixr 1 _⟨⊎⟩_\ninfixr 0 _⟨→⟩_\ninfixl 9 _⟨·⟩_\ninfix 10 _~\ninfixr 9 _⟨∘⟩_\ninfixr 2 _//_ _\\\\_\n\n-- Product.\n\n_⟨×⟩_ : Pred A ℓ₁ → Pred B ℓ₂ → Pred (A × B) _\n(P ⟨×⟩ Q) (x , y) = P x L.⊓ Q y\n\n-- Sum over one element.\n\n_⟨⊎⟩_ : Pred A ℓ → Pred B ℓ → Pred (A ⊎ B) _\nP ⟨⊎⟩ Q = rec P Q\n\n-- Sum over two elements.\n\n_⟨⊙⟩_ : Pred A ℓ₁ → Pred B ℓ₂ → Pred (A × B) _\n(P ⟨⊙⟩ Q) (x , y) = P x L.⊔ Q y\n\n-- Implication.\n\n_⟨→⟩_ : Pred A ℓ₁ → Pred B ℓ₂ → Pred (A → B) _\n(P ⟨→⟩ Q) f = (∀ {x} → x ∈ P → f x ∈ Q) , isPropImplicitΠ λ _ → isPropΠ\n λ _ → isProp[ Q ] _\n\n-- Product.\n\n_⟨·⟩_ : (P : Pred A ℓ₁) (Q : Pred B ℓ₂) →\n (P ⟨×⟩ (P ⟨→⟩ Q)) ⊆ uncurry (flip _$_) ⊢ Q\n(P ⟨·⟩ Q) (p , f) = f p\n\n-- Converse.\n\n_~ : Pred (A × B) ℓ → Pred (B × A) ℓ\nP ~ = P ∘ λ { (x , y) → y , x }\n\n-- Composition.\n\n_⟨∘⟩_ : Pred (A × B) ℓ₁ → Pred (B × C) ℓ₂ → Pred (A × C) _\n_⟨∘⟩_ {B = B} P Q (x , z) = L.∃[ y ∶ B ] P (x , y) L.⊓ Q (y , z)\n\n-- Post-division.\n\n_//_ : Pred (A × C) ℓ₁ → Pred (B × C) ℓ₂ → Pred (A × B) _\n(P // Q) (x , y) = (∀ {z} → (y , z) ∈ Q → (x , z) ∈ P) ,\n isPropImplicitΠ λ _ → isPropΠ\n λ _ → isProp[ P ] _\n\n-- Pre-division.\n\n_\\\\_ : Pred (A × C) ℓ₁ → Pred (A × B) ℓ₂ → Pred (B × C) _\nP \\\\ Q = (P ~ // Q ~) ~\n", "meta": {"hexsha": "ff3e84eb9e5a29161c3fdc1befac247d54c0610a", "size": 8033, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Relation/Unary.agda", "max_stars_repo_name": "bijan2005/univalent-foundations", "max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Relation/Unary.agda", "max_issues_repo_name": "bijan2005/univalent-foundations", "max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Relation/Unary.agda", "max_forks_repo_name": "bijan2005/univalent-foundations", "max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.6264705882, "max_line_length": 136, "alphanum_fraction": 0.5062865679, "num_tokens": 3332, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8418256353465629, "lm_q2_score": 0.8289388104343892, "lm_q1q2_score": 0.6978219407573537}} {"text": "------------------------------------------------------------------------\n-- An example showing how Container.Tree-sort can be used\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Equality\n\nmodule Container.Tree-sort.Example\n {c⁺} (eq : ∀ {a p} → Equality-with-J a p c⁺) where\n\nopen Derived-definitions-and-properties eq\n\nopen import Prelude using (ℕ; zero; suc; Bool; true; false)\n\nopen import Container eq\nopen import Container.List eq\n\n-- Comparison function for natural numbers.\n\n_≤_ : ℕ → ℕ → Bool\nzero ≤ _ = true\nsuc _ ≤ zero = false\nsuc m ≤ suc n = m ≤ n\n\nopen import Container.Tree-sort eq _≤_\n\n-- The sort function seems to return an ordered list.\n\nordered : sort (3 ∷ 1 ∷ 2 ∷ []) ≡ 1 ∷ 2 ∷ 3 ∷ []\nordered = refl _\n\n-- The sort function definitely returns a list which is bag equivalent\n-- to the input. This property can be used to establish bag\n-- equivalences between concrete lists.\n\na-bag-equivalence : 1 ∷ 2 ∷ 3 ∷ [] ≈-bag 3 ∷ 1 ∷ 2 ∷ []\na-bag-equivalence = sort≈ (3 ∷ 1 ∷ 2 ∷ [])\n", "meta": {"hexsha": "e15721478d5fcd3e363c1dc66688ff8801da419d", "size": 1076, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Container/Tree-sort/Example.agda", "max_stars_repo_name": "nad/equality", "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_issues_repo_path": "src/Container/Tree-sort/Example.agda", "max_issues_repo_name": "nad/equality", "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Container/Tree-sort/Example.agda", "max_forks_repo_name": "nad/equality", "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.5897435897, "max_line_length": 72, "alphanum_fraction": 0.5762081784, "num_tokens": 292, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8856314858927012, "lm_q2_score": 0.7879311981328135, "lm_q1q2_score": 0.69781667778358}} {"text": "\n-- Inductively constructed substitution maps\nmodule SOAS.ContextMaps.Inductive {T : Set} where\n\nopen import SOAS.Common\nopen import SOAS.Context\nopen import SOAS.Sorting\nopen import SOAS.Families.Core {T}\nopen import SOAS.Variable\n\nprivate\n variable\n α : T\n Γ Δ : Ctx\n 𝒳 𝒴 : Familyₛ\n\n-- A list of terms in context Δ for every variable in context Γ\ndata Sub (𝒳 : Familyₛ) : Ctx → Ctx → Set where\n • : Sub 𝒳 ∅ Δ\n _◂_ : 𝒳 α Δ → Sub 𝒳 Γ Δ → Sub 𝒳 (α ∙ Γ) Δ\n\ninfixl 120 _◂_\n\ninfix 150 _⟩\npattern _⟩ t = t ◂ •\n\n-- Functorial mapping\nSub₁ : (f : 𝒳 ⇾̣ 𝒴) → Sub 𝒳 Γ Δ → Sub 𝒴 Γ Δ\nSub₁ f • = •\nSub₁ f (x ◂ σ) = f x ◂ Sub₁ f σ\n\n-- Conversion between inductive substitutions and context maps\nmodule _ {𝒳 : Familyₛ} where\n index : Sub 𝒳 Γ Δ → Γ ~[ 𝒳 ]↝ Δ\n index • ()\n index (t ◂ σ) new = t\n index (t ◂ σ) (old v) = index σ v\n\n tabulate : Γ ~[ 𝒳 ]↝ Δ → Sub 𝒳 Γ Δ\n tabulate {Γ = ∅} σ = •\n tabulate {Γ = α ∙ Γ} σ = σ new ◂ tabulate (σ ∘ old)\n\n\n ix∘tab≈id : (σ : Γ ~[ 𝒳 ]↝ Δ) (v : ℐ α Γ)\n → index (tabulate σ) v ≡ σ v\n ix∘tab≈id {Γ = α ∙ Γ} σ new = refl\n ix∘tab≈id {Γ = α ∙ Γ} σ (old v) = ix∘tab≈id (σ ∘ old) v\n\n tab∘ix≈id : (σ : Sub 𝒳 Γ Δ) → tabulate (index σ) ≡ σ\n tab∘ix≈id • = refl\n tab∘ix≈id (x ◂ σ) rewrite tab∘ix≈id σ = refl\n\n-- Naturality conditions\ntabulate-nat : (f : 𝒳 ⇾̣ 𝒴)(σ : Γ ~[ 𝒳 ]↝ Δ)\n → tabulate {𝒴} (f ∘ σ) ≡ Sub₁ f (tabulate {𝒳} σ)\ntabulate-nat {Γ = ∅} f σ = refl\ntabulate-nat {Γ = α ∙ Γ} f σ = cong (f (σ new) ◂_) (tabulate-nat f (σ ∘ old))\n\nindex-nat : (f : 𝒳 ⇾̣ 𝒴)(σ : Sub 𝒳 Γ Δ)(v : ℐ α Γ)\n → index (Sub₁ f σ) v ≡ f (index σ v)\nindex-nat f (x ◂ σ) new = refl\nindex-nat f (x ◂ σ) (old v) = index-nat f σ v\n", "meta": {"hexsha": "88adb72457d478e99395b804cacf9905c6753f43", "size": 1672, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "SOAS/ContextMaps/Inductive.agda", "max_stars_repo_name": "k4rtik/agda-soas", "max_stars_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "SOAS/ContextMaps/Inductive.agda", "max_issues_repo_name": "k4rtik/agda-soas", "max_issues_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "SOAS/ContextMaps/Inductive.agda", "max_forks_repo_name": "k4rtik/agda-soas", "max_forks_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.5396825397, "max_line_length": 77, "alphanum_fraction": 0.5598086124, "num_tokens": 779, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314768368161, "lm_q2_score": 0.7879311956428946, "lm_q1q2_score": 0.697816668443015}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Component functions of permutations found in `Data.Fin.Permutation`\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Fin.Permutation.Components where\n\nopen import Data.Bool.Base using (Bool; true; false)\nopen import Data.Fin.Base\nopen import Data.Fin.Properties\nopen import Data.Nat.Base as ℕ using (zero; suc; _∸_)\nimport Data.Nat.Properties as ℕₚ\nopen import Data.Product using (proj₂)\nopen import Function.Base using (_∘_)\nopen import Relation.Nullary.Reflects using (invert)\nopen import Relation.Nullary using (does; _because_; yes; no)\nopen import Relation.Nullary.Decidable using (dec-true; dec-false)\nopen import Relation.Binary.PropositionalEquality\nopen import Algebra.Definitions using (Involutive)\nopen ≡-Reasoning\n\n--------------------------------------------------------------------------------\n-- Functions\n--------------------------------------------------------------------------------\n\n-- 'tranpose i j' swaps the places of 'i' and 'j'.\n\ntranspose : ∀ {n} → Fin n → Fin n → Fin n → Fin n\ntranspose i j k with does (k ≟ i)\n... | true = j\n... | false with does (k ≟ j)\n... | true = i\n... | false = k\n\n-- reverse i = n ∸ 1 ∸ i\n\nreverse : ∀ {n} → Fin n → Fin n\nreverse {suc n} i = inject≤ (n ℕ- i) (ℕₚ.m∸n≤m (suc n) (toℕ i))\n\n--------------------------------------------------------------------------------\n-- Properties\n--------------------------------------------------------------------------------\n\ntranspose-inverse : ∀ {n} (i j : Fin n) {k} →\n transpose i j (transpose j i k) ≡ k\ntranspose-inverse i j {k} with k ≟ j\n... | true because [k≡j] rewrite dec-true (i ≟ i) refl = sym (invert [k≡j])\n... | false because [k≢j] with k ≟ i\n... | true because [k≡i]\n rewrite dec-false (j ≟ i) (invert [k≢j] ∘ trans (invert [k≡i]) ∘ sym)\n | dec-true (j ≟ j) refl\n = sym (invert [k≡i])\n... | false because [k≢i] rewrite dec-false (k ≟ i) (invert [k≢i])\n | dec-false (k ≟ j) (invert [k≢j]) = refl\n\nreverse-prop : ∀ {n} → (i : Fin n) → toℕ (reverse i) ≡ n ∸ suc (toℕ i)\nreverse-prop {suc n} i = begin\n toℕ (inject≤ (n ℕ- i) _) ≡⟨ toℕ-inject≤ _ (ℕₚ.m∸n≤m (suc n) (toℕ i)) ⟩\n toℕ (n ℕ- i) ≡⟨ toℕ‿ℕ- n i ⟩\n n ∸ toℕ i ∎\n\nreverse-involutive : ∀ {n} → Involutive _≡_ (reverse {n})\nreverse-involutive {suc n} i = toℕ-injective (begin\n toℕ (reverse (reverse i)) ≡⟨ reverse-prop (reverse i) ⟩\n n ∸ (toℕ (reverse i)) ≡⟨ cong (n ∸_) (reverse-prop i) ⟩\n n ∸ (n ∸ (toℕ i)) ≡⟨ ℕₚ.m∸[m∸n]≡n (ℕₚ.≤-pred (toℕ Obj ⅅ)\n\t (map : {A B : Obj ℂ} -> A ─→ B -> F A ─→ F B)\n\t (mapId : {A : Obj ℂ} -> map (id {A = A}) == id)\n\t (mapCompose : {A B C : Obj ℂ}{f : B ─→ C}{g : A ─→ B} ->\n\t\t\t map (f ∘ g) == map f ∘ map g\n\t ) -> Functor ℂ ⅅ\n\nopen Fun public\n\nmodule Projections where\n\n Map : {ℂ ⅅ : Cat} -> Functor ℂ ⅅ -> Obj ℂ -> Obj ⅅ\n Map (functor F _ _ _) = F\n\n map : {ℂ ⅅ : Cat}(F : Functor ℂ ⅅ)\n\t{A B : Obj ℂ} -> A ─→ B -> Map F A ─→ Map F B\n map (functor _ m _ _) = m\n\n mapId : {ℂ ⅅ : Cat}(F : Functor ℂ ⅅ)\n\t {A : Obj ℂ} -> map F id == id {A = Map F A}\n mapId (functor _ _ i _) = i\n\n mapCompose : {ℂ ⅅ : Cat}(F : Functor ℂ ⅅ)\n\t {A B C : Obj ℂ}{f : B ─→ C}{g : A ─→ B} ->\n\t map F (f ∘ g) == map F f ∘ map F g\n mapCompose (functor _ _ _ c) = c\n\nmodule Functor {ℂ ⅅ : Cat}(F : Functor ℂ ⅅ) where\n\n module P = Projections\n\n Map : Obj ℂ -> Obj ⅅ\n Map = P.Map F\n\n map : {A B : Obj ℂ} -> A ─→ B -> Map A ─→ Map B\n map = P.map F\n\n mapId : {A : Obj ℂ} -> map id == id {A = Map A}\n mapId = P.mapId F\n\n mapCompose : {A B C : Obj ℂ}{f : B ─→ C}{g : A ─→ B} ->\n\t map (f ∘ g) == map f ∘ map g\n mapCompose = P.mapCompose F\n\nmodule Functors where\n\n Id : {ℂ : Cat} -> Functor ℂ ℂ\n Id = functor (\\A -> A) (\\f -> f) (\\{A} -> refl) (\\{A}{B}{C}{f}{g} -> refl)\n\n _○_ : {ℂ ℚ ℝ : Cat} -> Functor ℚ ℝ -> Functor ℂ ℚ -> Functor ℂ ℝ\n _○_ {ℂ}{ℚ}{ℝ} F G = functor FG m mid mcomp\n where\n\n module F = Functor F\n module G = Functor G\n\n FG : Obj ℂ -> Obj ℝ\n FG A = F.Map (G.Map A)\n\n m : {A B : Obj ℂ} -> A ─→ B -> FG A ─→ FG B\n m f = F.map (G.map f)\n\n mid : {A : Obj ℂ} -> m (id {A = A}) == id\n mid = chain> F.map (G.map id)\n\t === F.map id by ? -- cong F.map G.mapId\n\t === id\t by F.mapId\n\twhere\n\t open module Chain = Logic.ChainReasoning.Mono.Homogenous _==_\n\t\t\t (\\f -> refl)\n\t\t\t (\\f g h -> trans)\n\n mcomp : {A B C : Obj ℂ}{f : B ─→ C}{g : A ─→ B} ->\n\t m (f ∘ g) == m f ∘ m g\n mcomp {f = f}{g = g} =\n\tchain> F.map (G.map (f ∘ g))\n\t === F.map (G.map f ∘ G.map g)\n\t by ? -- cong F.map G.mapCompose\n\t === F.map (G.map f) ∘ F.map (G.map g)\n\t by F.mapCompose\n\twhere\n\t open module Chain = Logic.ChainReasoning.Mono.Homogenous _==_\n\t\t\t (\\f -> refl)\n\t\t\t (\\f g h -> trans)\n\n", "meta": {"hexsha": "0abc281c4c34f4981cd5ffae74781648f1d74502", "size": 2518, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/cat/Functor.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "examples/outdated-and-incorrect/cat/Functor.agda", "max_issues_repo_name": "larrytheliquid/agda", "max_issues_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/cat/Functor.agda", "max_forks_repo_name": "larrytheliquid/agda", "max_forks_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 25.4343434343, "max_line_length": 76, "alphanum_fraction": 0.4809372518, "num_tokens": 1026, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9207896780646392, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.697769230128471}} {"text": "module Adjunctions.Adj2Mon where\n\nopen import Library\nopen import Categories\nopen import Functors\nopen import Monads\nopen import Adjunctions\n\nopen Cat\nopen Fun\n\nAdj2Mon : ∀{a b}{C D : Cat {a}{b}} → Adj C D → Monad C\nAdj2Mon {C = C}{D} A = record{\n T = OMap R ∘ OMap L;\n η = left (iden D);\n bind = HMap R ∘ right;\n law1 =\n proof\n HMap R (right (left (iden D)))\n ≅⟨ cong (HMap R) (lawa (iden D)) ⟩\n HMap R (iden D)\n ≅⟨ fid R ⟩\n iden C ∎; \n law2 = λ{_}{_}{f} → \n proof\n comp C (HMap R (right f)) (left (iden D)) \n ≅⟨ cong (comp C (HMap R (right f))) (sym (idr C)) ⟩\n comp C (HMap R (right f)) (comp C (left (iden D)) (iden C))\n ≅⟨ natleft (iden C) (right f) (iden D) ⟩\n left (comp D (right f) (comp D (iden D) (HMap L (iden C))))\n ≅⟨ cong (left ∘ comp D (right f)) (idl D) ⟩\n left (comp D (right f) (HMap L (iden C)))\n ≅⟨ cong (left ∘ comp D (right f)) (fid L) ⟩\n left (comp D (right f) (iden D))\n ≅⟨ cong (left) (idr D) ⟩\n left (right f)\n ≅⟨ lawb f ⟩\n f ∎; \n law3 = λ{_}{_}{_}{f}{g} → \n proof\n HMap R (right (comp C (HMap R (right g)) f))\n ≅⟨ cong (HMap R ∘ right ∘ comp C (HMap R (right g))) \n (sym (idr C)) ⟩\n HMap R (right (comp C (HMap R (right g)) (comp C f (iden C))))\n ≅⟨ cong (HMap R) (natright (iden C) (right g) f) ⟩\n HMap R (comp D (right g) (comp D (right f) (HMap L (iden C))))\n ≅⟨ cong (HMap R ∘ comp D (right g) ∘ comp D (right f)) (fid L)⟩\n HMap R (comp D (right g) (comp D (right f) (iden D)))\n ≅⟨ cong (HMap R ∘ comp D (right g)) (idr D) ⟩\n HMap R (comp D (right g) (right f))\n ≅⟨ fcomp R ⟩\n comp C (HMap R (right g)) (HMap R (right f))\n ∎} \n where open Adj A\n", "meta": {"hexsha": "e59fa01bc2efbe6e2dadfa68d85b52c83be941e3", "size": 1699, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Adjunctions/Adj2Mon.agda", "max_stars_repo_name": "jmchapman/Relative-Monads", "max_stars_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-30T01:25:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-13T18:02:18.000Z", "max_issues_repo_path": "Adjunctions/Adj2Mon.agda", "max_issues_repo_name": "jmchapman/Relative-Monads", "max_issues_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2019-01-13T13:12:33.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-29T09:50:26.000Z", "max_forks_repo_path": "Adjunctions/Adj2Mon.agda", "max_forks_repo_name": "jmchapman/Relative-Monads", "max_forks_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-04T21:33:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-04T21:33:13.000Z", "avg_line_length": 30.8909090909, "max_line_length": 67, "alphanum_fraction": 0.5279576221, "num_tokens": 716, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9173026573249612, "lm_q2_score": 0.7606506418255927, "lm_q1q2_score": 0.6977468550425535}} {"text": "module Operator.Equals {ℓ ℓₑ} where\n\nopen import Data.Boolean\nopen import Logic\nopen import Structure.Setoid\nopen import Type.Properties.Decidable\nopen import Type\n\nDecidableEquiv : (T : Type{ℓ}) ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → Stmt\nDecidableEquiv(T) = Decidable(2)(_≡_)\n\n_==_ : ∀{T : Type{ℓ}} ⦃ equiv : Equiv{ℓₑ}(T) ⦄ ⦃ _ : DecidableEquiv(T) ⦄ → (T → T → Bool)\n_==_ = decide(2)(_≡_)\n", "meta": {"hexsha": "8baa6a469ff8676ceeeadf0525ebca60e405d793", "size": 379, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Operator/Equals.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Operator/Equals.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Operator/Equals.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.0714285714, "max_line_length": 89, "alphanum_fraction": 0.6701846966, "num_tokens": 153, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9241418241572634, "lm_q2_score": 0.7549149868676284, "lm_q1q2_score": 0.6976485130475066}} {"text": "{-# OPTIONS --safe --experimental-lossy-unification #-}\nmodule Cubical.Algebra.CommRing.Instances.MultivariatePoly where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.Nat renaming(_+_ to _+n_; _·_ to _·n_)\nopen import Cubical.Data.Vec\n\nopen import Cubical.Algebra.Ring\nopen import Cubical.Algebra.CommRing\n\nopen import Cubical.Algebra.Polynomials.Multivariate.Base\nopen import Cubical.Algebra.Polynomials.Multivariate.Properties\n\nprivate variable\n ℓ ℓ' : Level\n\n\nmodule _ (A' : CommRing ℓ) (n : ℕ) where\n\n private\n A = fst A'\n Ar = CommRing→Ring A'\n\n open CommRingStr\n open RingTheory Ar\n open Nth-Poly-structure A' n\n\n PolyCommRing : CommRing ℓ\n fst PolyCommRing = Poly A' n\n 0r (snd PolyCommRing) = 0P\n 1r (snd PolyCommRing) = 1P\n _+_ (snd PolyCommRing) = _Poly+_\n _·_ (snd PolyCommRing) = _Poly*_\n - snd PolyCommRing = Poly-inv\n isCommRing (snd PolyCommRing) = makeIsCommRing\n trunc\n Poly+-assoc\n Poly+-Rid\n Poly+-rinv\n Poly+-comm\n Poly*-assoc\n Poly*-Rid\n Poly*-Rdist\n Poly*-comm\n", "meta": {"hexsha": "35bb8eb45ef58aa65e00bd17313a559c3a1fcd7e", "size": 1320, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommRing/Instances/MultivariatePoly.agda", "max_stars_repo_name": "howsiyu/cubical", "max_stars_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommRing/Instances/MultivariatePoly.agda", "max_issues_repo_name": "howsiyu/cubical", "max_issues_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommRing/Instances/MultivariatePoly.agda", "max_forks_repo_name": "howsiyu/cubical", "max_forks_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.6956521739, "max_line_length": 64, "alphanum_fraction": 0.5704545455, "num_tokens": 335, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9425067211996142, "lm_q2_score": 0.7401743620390163, "lm_q1q2_score": 0.6976193110814095}} {"text": "{-# OPTIONS --without-K #-}\nopen import Data.Nat\nopen import Data.Two\nopen import Data.Zero\nopen import Data.Fin.NP\nopen import Type\nopen import Function\nopen import Relation.Binary.PropositionalEquality.NP\n\nimport Explore.Universe.Base\nopen import Explore.Core\nopen import Explore.Zero\nopen import Explore.One\nopen import Explore.Two\nopen import Explore.Universe.Type\n\n-- Exploring Fin comes in two flavors Regular & Custom\n-- We recommend Regular if you want to work for arbitrary values of n.\n-- We recommend Custom if you want to work for particular values of n (2, 6...).\nmodule Explore.Fin where\n\nmodule Regular n = Explore.Universe.Base (≃ᵁ (Finᵁ n) (Fin n) (Finᵁ≃Fin n))\n\nmodule Custom where\n module _ n where\n open Explore.Universe.Base (≃ᵁ (Finᵁ' n) (Fin n) (Finᵁ'≃Fin n))\n public\n\n Finᵉ0-𝟘ᵉ : (λ {M : ★₀} (ε : M) op f → explore 0 ε op (f ∘ Fin▹𝟘)) ≡ 𝟘ᵉ\n Finᵉ0-𝟘ᵉ = refl\n\n Finᵉ1-𝟙ᵉ : (λ {M : ★₀} (ε : M) op f → explore 1 ε op (f ∘ Fin▹𝟙)) ≡ 𝟙ᵉ\n Finᵉ1-𝟙ᵉ = refl\n\n Finᵉ2-𝟚ᵉ : (λ {M : ★₀} (ε : M) op f → explore 2 ε op (f ∘ Fin▹𝟚)) ≡ 𝟚ᵉ\n Finᵉ2-𝟚ᵉ = refl\n\nmodule ByHand {ℓ} where\n Finᵉ' : ∀ n → Explore ℓ (Fin n)\n Finᵉ' zero z _⊕_ f = z\n Finᵉ' (suc n) z _⊕_ f = f zero ⊕ Finᵉ' n z _⊕_ (f ∘ suc)\n\n -- Finᵉ and Finᵉ' are extensionally equal.\n -- Moreover the simplicity of the proof shows that the two functions are computing\n -- in the same way.\n Finᵉ-Finᵉ' : ∀ n {M} (ε : M) (_⊕_ : M → M → M) (f : Fin n → M) → Regular.explore n ε _⊕_ f ≡ Finᵉ' n ε _⊕_ f\n Finᵉ-Finᵉ' zero ε _⊕_ f = idp\n Finᵉ-Finᵉ' (suc n) ε _⊕_ f = ap (_⊕_ (f zero))\n (Finᵉ-Finᵉ' n ε _⊕_ (f ∘ suc))\n", "meta": {"hexsha": "a752e85d8b9f4a9659b441fe04d576a2d816a12e", "size": 1635, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "lib/Explore/Fin.agda", "max_stars_repo_name": "crypto-agda/explore", "max_stars_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-06-05T09:25:32.000Z", "max_stars_repo_stars_event_max_datetime": "2017-06-28T19:19:29.000Z", "max_issues_repo_path": "lib/Explore/Fin.agda", "max_issues_repo_name": "crypto-agda/explore", "max_issues_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-03-16T14:24:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-03-16T14:24:04.000Z", "max_forks_repo_path": "lib/Explore/Fin.agda", "max_forks_repo_name": "crypto-agda/explore", "max_forks_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.7, "max_line_length": 110, "alphanum_fraction": 0.6318042813, "num_tokens": 715, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278602705731, "lm_q2_score": 0.7905303260722198, "lm_q1q2_score": 0.6975859841149074}} {"text": "{-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-}\nmodule Cubical.Data.NatMinusOne.Base where\n\nopen import Cubical.Core.Primitives\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Empty\n\nrecord ℕ₋₁ : Type₀ where\n constructor -1+_\n field\n n : ℕ\n\npattern neg1 = -1+ zero\npattern ℕ→ℕ₋₁ n = -1+ (suc n)\n\n1+_ : ℕ₋₁ → ℕ\n1+_ (-1+ n) = n\n\nsuc₋₁ : ℕ₋₁ → ℕ₋₁\nsuc₋₁ (-1+ n) = -1+ (suc n)\n\n-- Natural number and negative integer literals for ℕ₋₁\n\nopen import Cubical.Data.Nat.Literals public\n\ninstance\n fromNatℕ₋₁ : HasFromNat ℕ₋₁\n fromNatℕ₋₁ = record { Constraint = λ _ → Unit ; fromNat = ℕ→ℕ₋₁ }\n\ninstance\n fromNegℕ₋₁ : HasFromNeg ℕ₋₁\n fromNegℕ₋₁ = record { Constraint = λ { (suc (suc _)) → ⊥ ; _ → Unit }\n ; fromNeg = λ { zero → 0 ; (suc zero) → neg1 } }\n", "meta": {"hexsha": "fd3c36d46cfbb755fa40843e43b4b44471391841", "size": 799, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/NatMinusOne/Base.agda", "max_stars_repo_name": "dan-iel-lee/cubical", "max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/NatMinusOne/Base.agda", "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/Data/NatMinusOne/Base.agda", "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 23.5, "max_line_length": 71, "alphanum_fraction": 0.6295369212, "num_tokens": 303, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278695464501, "lm_q2_score": 0.7905303137346446, "lm_q1q2_score": 0.6975859805607493}} {"text": "module Data.Tuple.Function where\n\nopen import Data\nopen import Data.Tuple as Tuple using (_⨯_ ; _,_)\nopen import Functional\nopen import Type\n\nmodule _ {ℓ₁ ℓ₂ ℓ₃} {T₁ : Type{ℓ₁}} {T₂ : Type{ℓ₂}} {T₃ : Type{ℓ₃}} where\n _,⃝_ : (T₁ → T₂) → (T₁ → T₃) → (T₁ → (T₂ ⨯ T₃))\n _,⃝_ f g x = (f(x) , g(x))\n\n left : (T₁ → (T₂ ⨯ T₃)) → (T₁ → T₂)\n left = Tuple.left ∘_\n\n right : (T₁ → (T₂ ⨯ T₃)) → (T₁ → T₃)\n right = Tuple.right ∘_\n", "meta": {"hexsha": "f69aa2b754779555c0e837840366ea9be3038c4b", "size": 424, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Tuple/Function.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/Tuple/Function.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Tuple/Function.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.9411764706, "max_line_length": 73, "alphanum_fraction": 0.5589622642, "num_tokens": 206, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9136765257642906, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6975771974787665}} {"text": "\nmodule Oscar.Property.Extensionality where\n\nopen import Oscar.Level\n\nrecord Extensionality\n {a} {A : Set a} {b} {B : A → Set b} {ℓ₁}\n (_≤₁_ : (x : A) → B x → Set ℓ₁)\n {c} {C : A → Set c} {d} {D : ∀ {x} → B x → Set d} {ℓ₂}\n (_≤₂_ : ∀ {x} → C x → ∀ {y : B x} → D y → Set ℓ₂)\n (μ₁ : (x : A) → C x)\n (μ₂ : ∀ {x} → (y : B x) → D y)\n : Set (a ⊔ ℓ₁ ⊔ b ⊔ ℓ₂) where\n field\n extensionality : ∀ {x} {y : B x} → x ≤₁ y → μ₁ x ≤₂ μ₂ y\n\nopen Extensionality ⦃ … ⦄ public\n\nextension : ∀\n {a} {A : Set a}\n {b} {B : A → Set b}\n {ℓ₁} {_≤₁_ : (x : A) → B x → Set ℓ₁}\n {c} {C : A → Set c} {d} {D : ∀ {x} → B x → Set d} {ℓ₂}\n (_≤₂_ : ∀ {x} → C x → ∀ {y : B x} → D y → Set ℓ₂)\n {μ₁ : (x : A) → C x}\n {μ₂ : ∀ {x} → (y : B x) → D y}\n ⦃ _ : Extensionality _≤₁_ _≤₂_ μ₁ μ₂ ⦄\n {x} {y : B x}\n → x ≤₁ y → μ₁ x ≤₂ μ₂ y\nextension _≤₂_ = extensionality {_≤₂_ = _≤₂_}\n", "meta": {"hexsha": "31f718821773ee9ce7bdd8bbbfecb3f878f79948", "size": 879, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Property/Extensionality.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Property/Extensionality.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Property/Extensionality.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.3548387097, "max_line_length": 60, "alphanum_fraction": 0.4311717861, "num_tokens": 452, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297887874625, "lm_q2_score": 0.7745833893685269, "lm_q1q2_score": 0.6975354160263163}} {"text": "module list-thms where\n\n-- see list-thms2 for more \n\nopen import bool\nopen import bool-thms\nopen import functions\nopen import list\nopen import nat\nopen import nat-thms\nopen import product-thms\nopen import logic\n\n++[] : ∀{ℓ}{A : Set ℓ} → (l : 𝕃 A) → l ++ [] ≡ l\n++[] [] = refl\n++[] (x :: xs) rewrite ++[] xs = refl\n\n++-assoc : ∀ {ℓ}{A : Set ℓ} (l1 l2 l3 : 𝕃 A) → \n (l1 ++ l2) ++ l3 ≡ l1 ++ (l2 ++ l3)\n++-assoc [] l2 l3 = refl\n++-assoc (x :: xs) l2 l3 rewrite ++-assoc xs l2 l3 = refl\n\nlength-++ : ∀{ℓ}{A : Set ℓ}(l1 l2 : 𝕃 A) → \n length (l1 ++ l2) ≡ (length l1) + (length l2)\nlength-++ [] l2 = refl\nlength-++ (h :: t) l2 rewrite length-++ t l2 = refl\n\nmap-append : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} → \n (f : A → B) (l1 l2 : 𝕃 A) → \n map f (l1 ++ l2) ≡ (map f l1) ++ (map f l2)\nmap-append f [] l2 = refl\nmap-append f (x :: xs) l2 rewrite map-append f xs l2 = refl\n\nmap-compose : ∀ {ℓ ℓ' ℓ''} {A : Set ℓ} {B : Set ℓ'}{C : Set ℓ''} → \n (f : B → C) (g : A → B) (l : 𝕃 A) → \n map f (map g l) ≡ map (f ∘ g) l\nmap-compose f g [] = refl\nmap-compose f g (x :: xs) rewrite map-compose f g xs = refl\n\nfoldr-monoid : ∀{ℓ}{A B : Set ℓ}{l₁ l₂ : 𝕃 A}{_⊗_ : B → B → B}{f : A → B}{b : B}\n {p-sym : ∀{a} → b ⊗ a ≡ a}\n {p-assoc : ∀{a b c} → a ⊗ (b ⊗ c) ≡ (a ⊗ b) ⊗ c}\n → (foldr (λ x r → (f x) ⊗ r) b l₁) ⊗ (foldr (λ x r → (f x) ⊗ r) b l₂) ≡ foldr (λ x r → (f x) ⊗ r) b (l₁ ++ l₂)\nfoldr-monoid {ℓ}{A}{B}{[]}{l₂}{_⊗_}{f}{b}{p-sym} rewrite p-sym {foldr (λ x → _⊗_ (f x)) b l₂} = refl\nfoldr-monoid {ℓ}{A}{B}{y :: ys}{l₂}{_⊗_}{f}{b}{p-sym}{p-assoc}\n rewrite\n sym (p-assoc {f y}{foldr (λ x → _⊗_ (f x)) b ys}{foldr (λ x → _⊗_ (f x)) b l₂})\n | foldr-monoid {l₁ = ys}{l₂}{_⊗_}{f}{b}{p-sym}{p-assoc}\n = refl\n\nfoldr-append : ∀{ℓ₂}{B : Set ℓ₂}{l₁ l₂ : 𝕃 (𝕃 B)} → (foldr _++_ [] l₁) ++ (foldr _++_ [] l₂) ≡ foldr _++_ [] (l₁ ++ l₂)\nfoldr-append {l₁ = []}{l₂} = refl\nfoldr-append {_}{B}{l₁ = x :: xs}{l₂} rewrite sym (foldr-append {l₁ = xs}{l₂}) = ++-assoc x (foldr _++_ [] xs) (foldr _++_ [] l₂)\n\nfoldr-append-fun : ∀{ℓ₁ ℓ₂}{A : Set ℓ₁}{B : Set ℓ₂}{l₁ l₂ : 𝕃 (A → 𝕃 B)}{a : A}\n → (foldr (λ f → _++_ (f a)) [] l₁) ++ (foldr (λ f → _++_ (f a)) [] l₂) ≡ foldr (λ f → _++_ (f a)) [] (l₁ ++ l₂)\nfoldr-append-fun {l₁ = []}{_}{a} = refl\nfoldr-append-fun {l₁ = x :: l₁}{l₂}{a}\n rewrite\n ++-assoc (x a) (foldr (λ f → _++_ (f a)) [] l₁) (foldr (λ f → _++_ (f a)) [] l₂)\n | foldr-append-fun {l₁ = l₁}{l₂}{a}\n = refl\n\nfoldr-map : ∀{ℓ}{A : Set ℓ}{l : 𝕃 A} → l ≡ foldr _++_ [] (map (λ x₁ → x₁ :: []) l)\nfoldr-map {_}{_}{[]} = refl\nfoldr-map {ℓ}{A}{x :: xs} rewrite sym (foldr-map {ℓ}{A}{xs}) = refl\n\ninvert𝕃 : ∀{ℓ}{A : Set ℓ}{t : A}{ts : 𝕃 A} → t :: ts ≢ []\ninvert𝕃 ()\n\nlength-repeat : ∀{ℓ}{A : Set ℓ} (n : ℕ) (a : A) → length (repeat n a) ≡ n\nlength-repeat 0 a = refl\nlength-repeat (suc n) a rewrite length-repeat n a = refl\n\nmap-repeat : ∀ {ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'}(n : ℕ)(a : A)(f : A → B) → map f (repeat n a) ≡ repeat n (f a)\nmap-repeat 0 a f = refl\nmap-repeat (suc x) a f rewrite map-repeat x a f = refl\n\nlength-map : ∀{ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B)(l : 𝕃 A) → length (map f l) ≡ length l\nlength-map f [] = refl\nlength-map f (head :: tail) rewrite length-map f tail = refl\n\nlength-reverse-helper : ∀{ℓ}{A : Set ℓ}(h l : 𝕃 A) → \n length (reverse-helper h l) ≡ length h + length l\nlength-reverse-helper h [] rewrite +0 (length h) = refl\nlength-reverse-helper h (x :: xs) rewrite length-reverse-helper (x :: h) xs = sym (+suc (length h) (length xs))\n\nlength-reverse : ∀{ℓ}{A : Set ℓ}(l : 𝕃 A) → length (reverse l) ≡ length l\nlength-reverse l = length-reverse-helper [] l\n\nreverse-++h : ∀{ℓ}{A : Set ℓ}(l1 l2 : 𝕃 A) → reverse-helper l1 l2 ≡ reverse-helper [] l2 ++ l1\nreverse-++h l1 [] = refl\nreverse-++h l1 (x :: xs) rewrite reverse-++h (x :: l1) xs | reverse-++h (x :: []) xs | ++-assoc (reverse xs) (x :: []) l1 = refl\n\nreverse-++ : ∀{ℓ}{A : Set ℓ}(l1 l2 : 𝕃 A) → reverse(l1 ++ l2) ≡ reverse(l2) ++ reverse(l1)\nreverse-++ [] l2 rewrite ++[] (reverse l2) = refl\nreverse-++ (x :: xs) l2 rewrite reverse-++h (x :: []) (xs ++ l2) | reverse-++ xs l2 | ++-assoc (reverse l2) (reverse xs) (x :: []) | sym (reverse-++h (x :: []) xs) = refl\n\nreverse-involution-aux : ∀{ℓ}{A : Set ℓ}(h h' l : 𝕃 A) → reverse-helper h (reverse-helper h' l) ≡ (reverse-helper [] h') ++ l ++ h\nreverse-involution-aux h h' [] = reverse-++h h h'\nreverse-involution-aux h h' (x₁ :: l) rewrite reverse-involution-aux h (x₁ :: h') l | reverse-++h (x₁ :: []) h' | ++-assoc (reverse-helper [] h') (x₁ :: []) (l ++ h) = refl\n\nreverse-involution : ∀{ℓ}{A : Set ℓ}(l : 𝕃 A) → reverse (reverse l) ≡ l\nreverse-involution l rewrite reverse-involution-aux [] [] l = ++[] l\n\nreverse-++-bad : ∀{ℓ}{A : Set ℓ}(l1 l2 : 𝕃 A) → reverse-bad (l1 ++ l2) ≡ reverse-bad l2 ++ reverse-bad l1\nreverse-++-bad [] l2 = sym (++[] (reverse-bad l2))\nreverse-++-bad (x :: l1) l2 rewrite reverse-++-bad l1 l2 = ++-assoc (reverse-bad l2) (reverse-bad l1) (x :: [])\n\nreverse-involution-bad : ∀{ℓ}{A : Set ℓ}(l : 𝕃 A) → reverse-bad (reverse-bad l) ≡ l\nreverse-involution-bad [] = refl\nreverse-involution-bad (x :: xs) rewrite reverse-++-bad (reverse-bad xs) (x :: []) | reverse-involution-bad xs = refl\n\n=𝕃-refl : ∀{ℓ}{A : Set ℓ}{l1 : 𝕃 A} → (eq : A → A → 𝔹) → ((x y : A) → x ≡ y → eq x y ≡ tt) → =𝕃 eq l1 l1 ≡ tt\n=𝕃-refl{l1 = []} eq rise = refl\n=𝕃-refl{l1 = x :: xs} eq rise = &&-combo (rise x x refl) (=𝕃-refl{l1 = xs} eq rise)\n\n≡𝕃-from-= : ∀{ℓ}{A : Set ℓ}{l1 l2 : 𝕃 A} → (eq : A → A → 𝔹) → ((x y : A) → eq x y ≡ tt → x ≡ y) → =𝕃 eq l1 l2 ≡ tt → l1 ≡ l2\n≡𝕃-from-={l1 = []}{[]} eq drop p = refl\n≡𝕃-from-={l1 = x :: xs}{[]} eq drop ()\n≡𝕃-from-={l1 = []}{y :: ys} eq drop ()\n≡𝕃-from-={l1 = x :: xs}{y :: ys} eq drop p rewrite ≡𝕃-from-={l1 = xs} eq drop (&&-snd{eq x y}{=𝕃 eq xs ys} p) | drop x y (&&-fst p) = refl \n\n=𝕃-from-≡ : ∀{ℓ}{A : Set ℓ}{l1 l2 : 𝕃 A} → (eq : A → A → 𝔹) → ((x y : A) → x ≡ y → eq x y ≡ tt) → l1 ≡ l2 → =𝕃 eq l1 l2 ≡ tt\n=𝕃-from-≡{l2 = l2} eq rise p rewrite p = =𝕃-refl{l1 = l2} eq rise \n\nmulti++-assoc : ∀{ℓ}{A : Set ℓ} → (Ls : 𝕃 (𝕃 A)) → (l0 : 𝕃 A) → (foldr _++_ [] Ls) ++ l0 ≡ (foldr _++_ [] (Ls ++ [ l0 ]))\nmulti++-assoc [] l' rewrite ++[] l' = refl\nmulti++-assoc (l :: ls) l' rewrite ++-assoc l (foldr _++_ [] ls) l' | multi++-assoc ls l' = refl\n\nconcat-foldr : ∀{ℓ}{A : Set ℓ} → (ls : 𝕃 (𝕃 A)) → (l : 𝕃 A) → concat ls ++ l ≡ foldr _++_ l ls\nconcat-foldr [] l = refl\nconcat-foldr (l' :: ls) l rewrite ++-assoc l' (concat ls) l | concat-foldr ls l = refl\n\n--concat-foldr (l' :: (l'' :: ls)) l rewrite ++-assoc l' (concat (l'' :: ls)) l | concat-foldr (l'' :: ls) l = refl\n\nlonger-trans : ∀{ℓ}{A : Set ℓ}(l1 l2 l3 : 𝕃 A) → \n l1 longer l2 ≡ tt →\n l2 longer l3 ≡ tt →\n l1 longer l3 ≡ tt\nlonger-trans [] l2 l3 () q \nlonger-trans (x :: l1) [] l3 p ()\nlonger-trans (x :: l1) (x₁ :: l2) [] p q = refl\nlonger-trans (x :: l1) (x₁ :: l2) (x₂ :: l3) p q = longer-trans l1 l2 l3 p q\n\nfilter-idem : ∀{ℓ}{A : Set ℓ}(p : A → 𝔹)(l : 𝕃 A) →\n (filter p (filter p l)) ≡ (filter p l)\nfilter-idem p [] = refl\nfilter-idem p (x :: l) with keep (p x)\nfilter-idem p (x :: l) | tt , p' rewrite p' | p' | filter-idem p l = refl\nfilter-idem p (x :: l) | ff , p' rewrite p' = filter-idem p l\n\nlength-filter : ∀{ℓ}{A : Set ℓ}(p : A → 𝔹)(l : 𝕃 A) → \n length (filter p l) ≤ length l ≡ tt\nlength-filter p [] = refl\nlength-filter p (x :: l) with p x\nlength-filter p (x :: l) | tt = length-filter p l\nlength-filter p (x :: l) | ff = \n ≤-trans{length (filter p l)} (length-filter p l) (≤-suc (length l))\n\nfilter-++ : ∀{ℓ}{A : Set ℓ}(p : A → 𝔹)(l1 l2 : 𝕃 A) → filter p (l1 ++ l2) ≡ filter p l1 ++ filter p l2\nfilter-++ p [] l2 = refl\nfilter-++ p (x :: l1) l2 with p x \nfilter-++ p (x :: l1) l2 | tt rewrite (filter-++ p l1 l2) = refl\nfilter-++ p (x :: l1) l2 | ff rewrite (filter-++ p l1 l2) = refl\n\nremove-++ : ∀{ℓ}{A : Set ℓ}(eq : A → A → 𝔹)(a : A)(l1 l2 : 𝕃 A) → \n remove eq a (l1 ++ l2) ≡ remove eq a l1 ++ remove eq a l2\nremove-++ eq a l1 l2 = filter-++ (λ x → ~ (eq a x)) l1 l2\n\n::-injective : ∀{ℓ}{A : Set ℓ}{x y : A}{xs ys : 𝕃 A} → \n x :: xs ≡ y :: ys → x ≡ y ∧ xs ≡ ys\n::-injective refl = refl , refl\n\nconcat-++ : ∀{ℓ}{A : Set ℓ}(ls1 ls2 : 𝕃 (𝕃 A)) → concat (ls1 ++ ls2) ≡ (concat ls1) ++ (concat ls2)\nconcat-++ [] ls2 = refl\nconcat-++ (l :: ls) ls2 rewrite concat-++ ls ls2 = sym (++-assoc l (concat ls) (concat ls2))\n\n-- This holds as long as we have the equations p₁ and p₂. We know\n-- that these equations are consistant to adopt, because they are\n-- equivalent up and an isomorphism, and hence, by univalence they are\n-- consistent as equations. The respective isomorphisms can be found\n-- in products-thms.agda.\nall-pred-append : ∀{X : Set}{f : X → Set}{l₁ l₂}\n → (p₁ : ∀{ℓ}{A : Set ℓ} → A ≡ ((⊤ {ℓ}) ∧ A))\n → (p₂ : ∀{ℓ}{A B C : Set ℓ} → (A ∧ (B ∧ C)) ≡ ((A ∧ B) ∧ C))\n → all-pred f (l₁ ++ l₂) ≡ ((all-pred f l₁) ∧ (all-pred f l₂))\nall-pred-append {l₁ = []} {l₂} p₁ p₂ = p₁\nall-pred-append {X}{f}{x :: l₁} {l₂} p₁ p₂ rewrite all-pred-append {X}{f}{l₁ = l₁} {l₂} p₁ p₂ = p₂\n\nall-pred-triv : {ℓ : Level}{l : 𝕃 (⊤ {ℓ})}(γ : ⊤ {ℓ} → Set ℓ)(p : γ triv) → all-pred γ l\nall-pred-triv {_}{[]} γ p = triv\nall-pred-triv {_}{triv :: l} γ p = p , all-pred-triv γ p\n\nmap-proj-⊎₁ : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'} → (l : 𝕃 A) → \n proj-⊎₁ {A = A}{B} (map inj₁ l) ≡ l\nmap-proj-⊎₁ [] = refl\nmap-proj-⊎₁ {A = A}{B} (x :: l) rewrite map-proj-⊎₁ {A = A}{B} l = refl\n\nmap-proj-⊎₂ : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'} → (l : 𝕃 B) → \n proj-⊎₂ {A = A}{B} (map inj₂ l) ≡ l\nmap-proj-⊎₂ [] = refl\nmap-proj-⊎₂ {A = A}{B} (x :: l) rewrite map-proj-⊎₂ {A = A}{B} l = refl\n\nmap-proj-⊎₂-[] : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'} → (l : 𝕃 A) → \n proj-⊎₂ {A = A}{B} (map inj₁ l) ≡ []\nmap-proj-⊎₂-[] [] = refl\nmap-proj-⊎₂-[] {A = A}{B} (x :: l) rewrite map-proj-⊎₂-[] {A = A}{B} l = refl\n\nmap-proj-⊎₁-[] : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'} → (l : 𝕃 B) → \n proj-⊎₁ {A = A}{B} (map inj₂ l) ≡ []\nmap-proj-⊎₁-[] [] = refl\nmap-proj-⊎₁-[] {A = A}{B} (x :: l) rewrite map-proj-⊎₁-[] {A = A}{B} l = refl\n\nis-empty-++ : ∀{ℓ}{A : Set ℓ}(l1 l2 : 𝕃 A) → is-empty (l1 ++ l2) ≡ is-empty l1 && is-empty l2\nis-empty-++ [] l2 = refl\nis-empty-++ (x :: l1) l2 = refl\n\nis-empty-ff-length : ∀{ℓ}{A : Set ℓ}(l : 𝕃 A) → is-empty l ≡ ff → length l =ℕ 0 ≡ ff\nis-empty-ff-length [] ()\nis-empty-ff-length (x :: l) p = refl\n", "meta": {"hexsha": "ee1b17cd5fbf3f95539efd673402e28cbfd42fc6", "size": 10428, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "list-thms.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "list-thms.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "list-thms.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 46.972972973, "max_line_length": 172, "alphanum_fraction": 0.5093018796, "num_tokens": 4738, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8459424295406088, "lm_q2_score": 0.8244619220634456, "lm_q1q2_score": 0.6974473214140713}} {"text": "module chap0 where\n\nopen import Data.List\nopen import Data.Nat hiding (_⊔_)\n-- open import Data.Integer hiding (_⊔_ ; _≟_ ; _+_ )\nopen import Data.Product\n\nA : List ℕ\nA = 1 ∷ 2 ∷ []\n\ndata Literal : Set where\n x : Literal\n y : Literal\n z : Literal\n\nB : List Literal\nB = x ∷ y ∷ z ∷ []\n\n\nListProduct : {A B : Set } → List A → List B → List ( A × B )\nListProduct = {!!}\n\nex05 : List ( ℕ × Literal )\nex05 = ListProduct A B -- (1 , x) ∷ (1 , y) ∷ (1 , z) ∷ (2 , x) ∷ (2 , y) ∷ (2 , z) ∷ [] \n\nex06 : List ( ℕ × Literal × ℕ )\nex06 = ListProduct A (ListProduct B A)\n\nex07 : Set\nex07 = ℕ × ℕ\n\ndata ex08-f : ℕ → ℕ → Set where\n ex08f0 : ex08-f 0 1\n ex08f1 : ex08-f 1 2\n ex08f2 : ex08-f 2 3\n ex08f3 : ex08-f 3 4\n ex08f4 : ex08-f 4 0\n\ndata ex09-g : ℕ → ℕ → ℕ → ℕ → Set where\n ex09g0 : ex09-g 0 1 2 3\n ex09g1 : ex09-g 1 2 3 0\n ex09g2 : ex09-g 2 3 0 1\n ex09g3 : ex09-g 3 0 1 2\n\nopen import Data.Nat.DivMod\nopen import Relation.Binary.PropositionalEquality\nopen import Relation.Binary.Core\nopen import Data.Nat.Properties\n\n-- _%_ : ℕ → ℕ → ℕ\n-- _%_ a b with <-cmp a b\n-- _%_ a b | tri< a₁ ¬b ¬c = a\n-- _%_ a b | tri≈ ¬a b₁ ¬c = 0\n-- _%_ a b | tri> ¬a ¬b c = _%_ (a - b) b\n\n_≡7_ : ℕ → ℕ → Set\nn ≡7 m = (n % 7) ≡ (m % 7 )\n\nrefl7 : { n : ℕ} → n ≡7 n\nrefl7 = {!!}\n\nsym7 : { n m : ℕ} → n ≡7 m → m ≡7 n\nsym7 = {!!}\n\ntrans7 : { n m o : ℕ} → n ≡7 m → m ≡7 o → n ≡7 o\ntrans7 = {!!}\n\nopen import Level renaming ( zero to Zero ; suc to Suc )\n\nrecord Graph { v v' : Level } : Set (Suc v ⊔ Suc v' ) where\n field\n vertex : Set v\n edge : vertex → vertex → Set v'\n\nopen Graph\n\n-- open import Data.Fin hiding ( _≟_ )\nopen import Data.Empty\nopen import Relation.Nullary\nopen import Data.Unit hiding ( _≟_ )\n\n\n-- data Dec (P : Set) : Set where\n-- yes : P → Dec P\n-- no : ¬ P → Dec P\n--\n-- _≟_ : (s t : ℕ ) → Dec ( s ≡ t )\n\n-- ¬ A = A → ⊥\n\n_n≟_ : (s t : ℕ ) → Dec ( s ≡ t )\nzero n≟ zero = yes refl\nzero n≟ suc t = no (λ ())\nsuc s n≟ zero = no (λ ())\nsuc s n≟ suc t with s n≟ t \n... | yes refl = yes refl\n... | no n = no (λ k → n (tt1 k) ) where\n tt1 : suc s ≡ suc t → s ≡ t\n tt1 refl = refl\n\nopen import Data.Bool hiding ( _≟_ )\n\nconn : List ( ℕ × ℕ ) → ℕ → ℕ → Bool\nconn [] _ _ = false\nconn ((n1 , m1 ) ∷ t ) n m with n ≟ n1 | m ≟ m1\nconn ((n1 , m1) ∷ t) n m | yes refl | yes refl = true\nconn ((n1 , m1) ∷ t) n m | _ | _ = conn t n m \n\nlist012a : List ( ℕ × ℕ )\nlist012a = (1 , 2) ∷ (2 , 3) ∷ (3 , 4) ∷ (4 , 5) ∷ (5 , 1) ∷ [] \n\ngraph012a : Graph {Zero} {Zero} \ngraph012a = record { vertex = ℕ ; edge = λ s t → (conn list012a s t) ≡ true }\n\ndata edge012b : ℕ → ℕ → Set where\n e012b-1 : edge012b 1 2\n e012b-2 : edge012b 1 3\n e012b-3 : edge012b 1 4\n e012b-4 : edge012b 2 3\n e012b-5 : edge012b 2 4\n e012b-6 : edge012b 3 4\n\nedge? : (E : ℕ → ℕ → Set) → ( a b : ℕ ) → Set\nedge? E a b = Dec ( E a b ) \n\nlemma3 : ( a b : ℕ ) → edge? edge012b a b\nlemma3 1 2 = yes e012b-1\nlemma3 1 3 = yes e012b-2\nlemma3 1 4 = yes e012b-3\nlemma3 2 3 = yes e012b-4\nlemma3 2 4 = yes e012b-5\nlemma3 3 4 = yes e012b-6\nlemma3 1 1 = no ( λ () )\nlemma3 2 1 = no ( λ () )\nlemma3 2 2 = no ( λ () )\nlemma3 3 1 = no ( λ () )\nlemma3 3 2 = no ( λ () )\nlemma3 3 3 = no ( λ () )\nlemma3 0 _ = no ( λ () )\nlemma3 _ 0 = no ( λ () )\nlemma3 _ (suc (suc (suc (suc (suc _))))) = no ( λ () )\nlemma3 (suc (suc (suc (suc _)))) _ = no ( λ () )\n\ngraph012b : Graph {Zero} {Zero}\ngraph012b = record { vertex = ℕ ; edge = edge012b }\n\ndata connected { V : Set } ( E : V -> V -> Set ) ( x y : V ) : Set where\n direct : E x y → connected E x y \n indirect : ( z : V ) -> E x z → connected {V} E z y → connected E x y\n\nlemma1 : connected ( edge graph012a ) 1 2\nlemma1 = direct refl where\n\nlemma1-2 : connected ( edge graph012a ) 1 3\nlemma1-2 = indirect 2 refl (direct refl ) \n\nlemma2 : connected ( edge graph012b ) 1 2\nlemma2 = direct e012b-1 \n\nreachable : { V : Set } ( E : V -> V -> Set ) ( x y : V ) -> Set\nreachable {V} E X Y = Dec ( connected {V} E X Y )\n\ndag : { V : Set } ( E : V -> V -> Set ) -> Set\ndag {V} E = ∀ (n : V) → ¬ ( connected E n n )\n\nopen import Function\n\nlemma4 : ¬ ( dag ( edge graph012a) )\nlemma4 neg = neg 1 $ indirect 2 refl $ indirect 3 refl $ indirect 4 refl $ indirect 5 refl $ direct refl \n\ndgree : List ( ℕ × ℕ ) → ℕ → ℕ \ndgree [] _ = 0\ndgree ((e , e1) ∷ t) e0 with e0 ≟ e | e0 ≟ e1\ndgree ((e , e1) ∷ t) e0 | yes _ | _ = 1 + (dgree t e0)\ndgree ((e , e1) ∷ t) e0 | _ | yes p = 1 + (dgree t e0)\ndgree ((e , e1) ∷ t) e0 | no _ | no _ = dgree t e0\n\ndgree-c : {t : Set} → List ( ℕ × ℕ ) → ℕ → (ℕ → t) → t \ndgree-c {t} [] e0 next = next 0\ndgree-c {t} ((e , e1) ∷ tail ) e0 next with e0 ≟ e | e0 ≟ e1\n... | yes _ | _ = dgree-c tail e0 ( λ n → next (n + 1 ))\n... | _ | yes _ = dgree-c tail e0 ( λ n → next (n + 1 ))\n... | no _ | no _ = dgree-c tail e0 next\n\nlemma6 = dgree list012a 2\nlemma7 = dgree-c list012a 2 ( λ n → n )\n\neven2 : (n : ℕ ) → n % 2 ≡ 0 → (n + 2) % 2 ≡ 0 \neven2 0 refl = refl\neven2 1 () \neven2 (suc (suc n)) eq = trans ([a+n]%n≡a%n n _) eq -- [a+n]%n≡a%n : ∀ a n → (a + suc n) % suc n ≡ a % suc n\n\nsum-of-dgree : ( g : List ( ℕ × ℕ )) → ℕ\nsum-of-dgree [] = 0\nsum-of-dgree ((e , e1) ∷ t) = 2 + sum-of-dgree t\n\ndgree-even : ( g : List ( ℕ × ℕ )) → sum-of-dgree g % 2 ≡ 0\ndgree-even [] = refl\ndgree-even ((e , e1) ∷ t) = begin\n sum-of-dgree ((e , e1) ∷ t) % 2 \n ≡⟨⟩\n (2 + sum-of-dgree t ) % 2 \n ≡⟨ cong ( λ k → k % 2 ) ( +-comm 2 (sum-of-dgree t) ) ⟩\n (sum-of-dgree t + 2) % 2 \n ≡⟨ [a+n]%n≡a%n (sum-of-dgree t) _ ⟩\n sum-of-dgree t % 2\n ≡⟨ dgree-even t ⟩\n 0\n ∎ where open ≡-Reasoning\n\n", "meta": {"hexsha": "c54303d2e37d17a015ffefac355cce82980c2694", "size": 5610, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/chap0.agda", "max_stars_repo_name": "shinji-kono/automaton-in-agda", "max_stars_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/chap0.agda", "max_issues_repo_name": "shinji-kono/automaton-in-agda", "max_issues_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/chap0.agda", "max_forks_repo_name": "shinji-kono/automaton-in-agda", "max_forks_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.5876777251, "max_line_length": 108, "alphanum_fraction": 0.5162210339, "num_tokens": 2488, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467738423873, "lm_q2_score": 0.7931059560743421, "lm_q1q2_score": 0.6972565425979399}} {"text": "module Structure.Operator.Monoid.Monoids.Function where\n\nopen import Functional\nopen import Function.Equals\nopen import Function.Equals.Proofs\nimport Lvl\nopen import Logic\nopen import Logic.Predicate\nopen import Structure.Function\nopen import Structure.Operator.Monoid\nopen import Structure.Operator.Properties\nopen import Structure.Operator\nopen import Structure.Setoid\nopen import Type\n\nprivate variable ℓ ℓₑ : Lvl.Level\nprivate variable T : Type{ℓ}\n\nfunction-monoid : ⦃ equiv : Equiv{ℓₑ}(T)⦄ ⦃ function : ∀{f : T → T} → Function(f) ⦄ → Monoid(_∘_ {X = T}{Y = T}{Z = T})\nMonoid.binary-operator function-monoid = [⊜][∘]-binaryOperator\nMonoid.associativity function-monoid = intro(\\{f g h} → [⊜]-associativity {x = f}{y = g}{z = h})\nMonoid.identity-existence function-monoid = [∃]-intro id ⦃ [⊜]-identity ⦄\n", "meta": {"hexsha": "89867fdcfb64216d80820aaf89e8d860ca136a1f", "size": 820, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Operator/Monoid/Monoids/Function.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Operator/Monoid/Monoids/Function.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Operator/Monoid/Monoids/Function.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.652173913, "max_line_length": 119, "alphanum_fraction": 0.7341463415, "num_tokens": 243, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9458012640659996, "lm_q2_score": 0.7371581568543043, "lm_q1q2_score": 0.6972051165693635}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- All predicate transformer for fresh lists\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.List.Fresh.Relation.Unary.All where\n\nopen import Level using (Level; _⊔_; Lift)\nopen import Data.Product using (_×_; _,_; proj₁; uncurry)\nopen import Relation.Nullary\nimport Relation.Nullary.Decidable as Dec\nopen import Relation.Nullary.Product using (_×-dec_)\nopen import Relation.Unary as U\nopen import Relation.Binary as B using (Rel)\n\nopen import Data.List.Fresh using (List#; []; cons; _∷#_; _#_)\nopen import Data.List.Fresh.Relation.Unary.Any as Any using (Any; here; there)\n\nprivate\n variable\n a p q r : Level\n A : Set a\n\nmodule _ {A : Set a} {R : Rel A r} (P : Pred A p) where\n\n data All : List# A R → Set (p ⊔ a ⊔ r) where\n [] : All []\n _∷_ : ∀ {x xs pr} → P x → All xs → All (cons x xs pr)\n\nmodule _ {R : Rel A r} {P : Pred A p} where\n\n uncons : ∀ {x} {xs : List# A R} {pr} →\n All P (cons x xs pr) → P x × All P xs\n uncons (p ∷ ps) = p , ps\n\nmodule _ {R : Rel A r} where\n\n append : (xs ys : List# A R) → All (_# ys) xs → List# A R\n append-# : ∀ {x} xs ys {ps} → x # xs → x # ys → x # append xs ys ps\n\n append [] ys _ = ys\n append (cons x xs pr) ys ps =\n let (p , ps) = uncons ps in\n cons x (append xs ys ps) (append-# xs ys pr p)\n\n append-# [] ys x#xs x#ys = x#ys\n append-# (cons x xs pr) ys (r , x#xs) x#ys = r , append-# xs ys x#xs x#ys\n\nmodule _ {R : Rel A r} {P : Pred A p} {Q : Pred A q} where\n\n map : ∀ {xs : List# A R} → ∀[ P ⇒ Q ] → All P xs → All Q xs\n map p⇒q [] = []\n map p⇒q (p ∷ ps) = p⇒q p ∷ map p⇒q ps\n\n lookup : ∀ {xs : List# A R} → All Q xs → (ps : Any P xs) →\n Q (proj₁ (Any.witness ps))\n lookup (q ∷ _) (here _) = q\n lookup (_ ∷ qs) (there k) = lookup qs k\n\nmodule _ {R : Rel A r} {P : Pred A p} (P? : Decidable P) where\n\n all? : (xs : List# A R) → Dec (All P xs)\n all? [] = yes []\n all? (x ∷# xs) = Dec.map′ (uncurry _∷_) uncons (P? x ×-dec all? xs)\n", "meta": {"hexsha": "a4046909775314e68020c240e06e2188e61e722a", "size": 2159, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/List/Fresh/Relation/Unary/All.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/List/Fresh/Relation/Unary/All.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/List/Fresh/Relation/Unary/All.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 31.75, "max_line_length": 78, "alphanum_fraction": 0.5178323298, "num_tokens": 749, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942014971872, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6972017465799655}} {"text": "{-# OPTIONS --without-K #-}\nopen import HoTT.Base\n\nmodule HoTT.Identity where\n\nopen variables\nprivate variable x y z w : A\n\n-- Lemma 2.1.4\n-- (i)\nunitᵣ : {p : x == y} → p == p ∙ refl\nunitᵣ {p = refl} = refl\n\nunitₗ : {p : x == y} → p == refl ∙ p\nunitₗ {p = refl} = refl\n\n-- (ii)\ninvₗ : {p : x == y} → p ⁻¹ ∙ p == refl\ninvₗ {p = refl} = refl\n\ninvᵣ : {p : x == y} → p ∙ p ⁻¹ == refl\ninvᵣ {p = refl} = refl\n\n-- (iv)\nassoc : {p : x == y} {q : y == z} {r : z == w} →\n p ∙ (q ∙ r) == (p ∙ q) ∙ r\nassoc {p = refl} {refl} {refl} = refl\n\ninvinv : {p : x == y} → p ⁻¹ ⁻¹ == p\ninvinv {p = refl} = refl\n\n-- Whiskering\n_∙ᵣ_ : {p q : x == y} (α : p == q) (r : y == z) → p ∙ r == q ∙ r\nrefl ∙ᵣ refl = refl\ninfixl 25 _∙ᵣ_\n\n_∙ₗ_ : {r s : y == z} (q : x == y) (β : r == s) → q ∙ r == q ∙ s\nrefl ∙ₗ refl = refl\ninfixl 25 _∙ₗ_\n\n-- Horizontal composition\n_⋆_ : {p q : x == y} {r s : y == z} → (p == q) → (r == s) → p ∙ r == q ∙ s\nrefl ⋆ refl = refl\n\ncancelᵣ : {p q : x == y} {r : y == z} (α : p ∙ r == q ∙ r) → p == q\ncancelᵣ {r = refl} α = unitᵣ ∙ α ∙ unitᵣ ⁻¹\n\ncancelₗ : {r s : y == z} {q : x == y} (β : q ∙ r == q ∙ s) → r == s\ncancelₗ {q = refl} β = unitₗ ∙ β ∙ unitₗ ⁻¹\n\npivotᵣ : {p : x == y} {q : y == z} {r : x == z} → p ∙ q == r → p == r ∙ q ⁻¹\npivotᵣ {p = refl} {q = refl} α = α ∙ unitᵣ\n\npivotₗ : {p : x == y} {q : y == z} {r : x == z} → p ∙ q == r → q == p ⁻¹ ∙ r\npivotₗ {p = refl} {q = refl} α = α ∙ unitₗ\n\n-- Lemma 2.2.2\n-- (i)\nap-∙ : (f : A → B) (p : x == y) (q : y == z) → ap f (p ∙ q) == ap f p ∙ ap f q\nap-∙ _ refl refl = refl\n\n-- (ii)\nap-inv : (f : A → B) (p : x == y) → ap f (p ⁻¹) == ap f p ⁻¹\nap-inv _ refl = refl\n\n-- (iii)\nap-∘ : {C : 𝒰 i} (f : B → C) (g : A → B) (p : x == y) → ap (f ∘ g) p == ap f (ap g p)\nap-∘ _ _ refl = refl\n\n-- (iv)\nap-id : (p : x == y) → ap id p == p\nap-id refl = refl\n\nap-const : (p : x == y) → ap (const B) p == refl\nap-const refl = refl\n\n-- Lemma 2.3.5\ntransportconst : (p : x == y) → transport (const B) p ~ id\ntransportconst refl _ = refl\n\n-- Lemma 2.3.9\ntransport-∙ : (P : A → 𝒰 i) (p : x == y) (q : y == z) →\n transport P (p ∙ q) ~ transport P q ∘ transport P p\ntransport-∙ P refl refl _ = refl\n\n-- Lemma 2.3.10\ntransport-ap : (P : B → 𝒰 i) (f : A → B) {x y : A} (p : x == y) →\n transport P (ap f p) ~ transport (P ∘ f) p\ntransport-ap _ _ refl _ = refl\n\n-- Lemma 2.3.11\ntransport-∘ : (f : {x : A} → P x → Q x) (p : x == y) →\n transport Q p ∘ f ~ f ∘ transport P p\ntransport-∘ _ refl _ = refl\n\nmodule =-Reasoning {i} {A : 𝒰 i}\n where\n _=⟨_⟩_ : (x : A) {y z : A} → x == y → y == z → x == z\n x =⟨ p ⟩ q = p ∙ q\n infixr 2 _=⟨_⟩_\n\n _=⟨⟩_ : (x : A) {y : A} → x == y → x == y\n _ =⟨⟩ p = p\n infixr 2 _=⟨⟩_\n\n _∎ : (x : A) → x == x\n _ ∎ = refl\n infix 3 _∎\n", "meta": {"hexsha": "170d26688b8672ebc147ab3aa0aa6d7998e4dd3e", "size": 2740, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "HoTT/Identity.agda", "max_stars_repo_name": "michaelforney/hott", "max_stars_repo_head_hexsha": "ef4d9fbb9cc0352657f1a6d0d3534d4c8a6fd508", "max_stars_repo_licenses": ["0BSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "HoTT/Identity.agda", "max_issues_repo_name": "michaelforney/hott", "max_issues_repo_head_hexsha": "ef4d9fbb9cc0352657f1a6d0d3534d4c8a6fd508", "max_issues_repo_licenses": ["0BSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "HoTT/Identity.agda", "max_forks_repo_name": "michaelforney/hott", "max_forks_repo_head_hexsha": "ef4d9fbb9cc0352657f1a6d0d3534d4c8a6fd508", "max_forks_repo_licenses": ["0BSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.1376146789, "max_line_length": 85, "alphanum_fraction": 0.4350364964, "num_tokens": 1363, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677430095496, "lm_q2_score": 0.8221891261650247, "lm_q1q2_score": 0.6971898576411498}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Diagram.Pushout {o ℓ e} (C : Category o ℓ e) where\n\nopen Category C\nopen HomReasoning\n\nopen import Level\n\nprivate\n variable\n A B X Y Z : Obj\n h h₁ h₂ j : A ⇒ B\n\nrecord Pushout (f : X ⇒ Y) (g : X ⇒ Z) : Set (o ⊔ ℓ ⊔ e) where\n field\n {Q} : Obj\n i₁ : Y ⇒ Q\n i₂ : Z ⇒ Q\n\n field\n commute : i₁ ∘ f ≈ i₂ ∘ g\n universal : h₁ ∘ f ≈ h₂ ∘ g → Q ⇒ cod h₁\n unique : ∀ {eq : h₁ ∘ f ≈ h₂ ∘ g} →\n j ∘ i₁ ≈ h₁ → j ∘ i₂ ≈ h₂ →\n j ≈ universal eq\n\n universal∘i₁≈h₁ : ∀ {eq : h₁ ∘ f ≈ h₂ ∘ g} →\n universal eq ∘ i₁ ≈ h₁\n universal∘i₂≈h₂ : ∀ {eq : h₁ ∘ f ≈ h₂ ∘ g} →\n universal eq ∘ i₂ ≈ h₂\n", "meta": {"hexsha": "c3ebe4b4ca0d15f06d48af7461613d931aec503d", "size": 779, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Diagram/Pushout.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Diagram/Pushout.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Diagram/Pushout.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.9117647059, "max_line_length": 68, "alphanum_fraction": 0.4698331194, "num_tokens": 314, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9343951552333003, "lm_q2_score": 0.7461389930307512, "lm_q1q2_score": 0.697188660218587}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Numbers.Naturals.Definition\nopen import LogicalFormulae\nopen import Groups.Definition\nopen import Groups.Orders.Partial.Definition\nopen import Setoids.Orders.Partial.Definition\nopen import Setoids.Setoids\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Groups.Orders.Archimedean {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {G : Group S _+_} {c : _} {_<_ : A → A → Set c} {pOrder : SetoidPartialOrder S _<_} (p : PartiallyOrderedGroup G pOrder) where\n\nopen Setoid S\nopen import Groups.Cyclic.Definition G\nopen Group G\n\nArchimedean : Set (a ⊔ c)\nArchimedean = (x y : A) → (0G < x) → (0G < y) → Sg ℕ (λ n → y < (positiveEltPower x n))\n", "meta": {"hexsha": "c145c27dd58356563008b7718e3c402e73c8c0cf", "size": 735, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Orders/Archimedean.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Orders/Archimedean.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Orders/Archimedean.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 36.75, "max_line_length": 222, "alphanum_fraction": 0.693877551, "num_tokens": 241, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9496693716759489, "lm_q2_score": 0.7341195152660687, "lm_q1q2_score": 0.6971708187977796}} {"text": "\nmodule _ where\n\ndata N : Set where\n zero : N\n suc : N → N\n\nrecord P : Set where\n constructor p\n field fst : N\n snd : N\n\nopen P\n\n-- f = λ z → z internally\nf : P → P\nf z = p (fst z) (snd z)\n\n-- This should also be λ z → z, but was not due to #2157.\ng : P → P\ng (p x y) = p x y\n", "meta": {"hexsha": "b5111526055bfe24310a2e603a42bcfeba5dd6d1", "size": 290, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2571.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue2571.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue2571.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 13.1818181818, "max_line_length": 57, "alphanum_fraction": 0.5344827586, "num_tokens": 112, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8757870046160257, "lm_q2_score": 0.7956580952177051, "lm_q1q2_score": 0.6968270199092065}} {"text": "module DeBruijn where\n\nopen import Prelude -- using (_∘_) -- composition, identity\nopen import Data.Maybe\nopen import Logic.Identity renaming (subst to subst≡)\nimport Logic.ChainReasoning\nmodule Chain = Logic.ChainReasoning.Poly.Homogenous _≡_ (\\x -> refl) (\\x y z -> trans)\nopen Chain\n\n-- untyped de Bruijn terms \ndata Lam (A : Set) : Set where\n var : A -> Lam A\n app : Lam A -> Lam A -> Lam A\n abs : Lam (Maybe A) -> Lam A\n\n-- functoriality of Lam \nlam : {A B : Set} -> (A -> B) -> Lam A -> Lam B\nlam f (var a) = var (f a)\nlam f (app t1 t2) = app (lam f t1) (lam f t2)\nlam f (abs r) = abs (lam (fmap f) r)\n\n-- lifting a substitution A -> Lam B under a binder\nlift : {A B : Set} -> (A -> Lam B) -> Maybe A -> Lam (Maybe B)\nlift f nothing = var nothing\nlift f (just a) = lam just (f a)\n\n-- extensionality of lifting\nliftExt : {A B : Set}(f g : A -> Lam B) ->\n ((a : A) -> f a ≡ g a) -> (t : Maybe A) -> lift f t ≡ lift g t\nliftExt f g H nothing = refl\nliftExt f g H (just a) = cong (lam just) $ H a\n\n-- simultaneous substitution\nsubst : {A B : Set} -> (A -> Lam B) -> Lam A -> Lam B\nsubst f (var a) = f a\nsubst f (app t1 t2) = app (subst f t1) (subst f t2)\nsubst f (abs r) = abs (subst (lift f) r)\n\n-- extensionality of subst\nsubstExt : {A B : Set}(f g : A -> Lam B) ->\n ((a : A) -> f a ≡ g a) -> (t : Lam A) -> subst f t ≡ subst g t\nsubstExt f g H (var a) = H a\nsubstExt f g H (app t1 t2) = \n chain> subst f (app t1 t2)\n === app (subst f t1) (subst f t2)\n by refl \n === app (subst g t1) (subst f t2)\n by cong (\\ x -> app x (subst f t2)) (substExt f g H t1)\n === app (subst g t1) (subst g t2)\n by cong (\\ x -> app (subst g t1) x) (substExt f g H t2)\nsubstExt f g H (abs r) =\n chain> subst f (abs r)\n === abs (subst (lift f) r) \n by refl\n === abs (subst (lift g) r) \n by cong abs (substExt (lift f) (lift g) (liftExt f g H) r)\n === subst g (abs r)\n by refl\n\n-- Lemma: lift g ∘ fmap f = lift (g ∘ f)\nliftLaw1 : {A B C : Set}(f : A -> B)(g : B -> Lam C)(t : Maybe A) ->\n lift g (fmap f t) ≡ lift (g ∘ f) t\nliftLaw1 f g nothing = \n chain> lift g (fmap f nothing) \n === lift g nothing by refl\n === var nothing by refl\n === lift (g ∘ f) nothing by refl\nliftLaw1 f g (just a) =\n chain> lift g (fmap f (just a))\n === lift g (just (f a)) by refl\n === lam just (g (f a)) by refl\n === lift (g ∘ f) (just a) by refl\n\n-- Lemma: subst g (lam f t) = subst (g ∘ f) t\nsubstLaw1 : {A B C : Set}(f : A -> B)(g : B -> Lam C)(t : Lam A) -> \n subst g (lam f t) ≡ subst (g ∘ f) t\n\nsubstLaw1 f g (var a) = refl\n\nsubstLaw1 f g (app t1 t2) = \n chain> subst g (lam f (app t1 t2))\n === subst g (app (lam f t1) (lam f t2)) \n by refl\n === app (subst g (lam f t1)) (subst g (lam f t2)) \n by refl\n === app (subst (g ∘ f) t1) (subst g (lam f t2)) \n by cong (\\ x -> app x (subst g (lam f t2))) (substLaw1 f g t1)\n === app (subst (g ∘ f) t1) (subst (g ∘ f) t2) \n by cong (\\ x -> app (subst (g ∘ f) t1) x) (substLaw1 f g t2)\n\nsubstLaw1 f g (abs r) =\n chain> subst g (lam f (abs r))\n === subst g (abs (lam (fmap f) r))\n by refl\n === abs (subst (lift g) (lam (fmap f) r))\n by refl\n === abs (subst (lift g ∘ fmap f) r)\n by cong abs (substLaw1 (fmap f) (lift g) r)\n === abs (subst (lift (g ∘ f)) r)\n by cong abs (substExt (lift g ∘ fmap f) (lift (g ∘ f)) (liftLaw1 f g) r)\n\n-- Lemma: subst (lam f ∘ g) = lam f ∘ subst g\nsubstLaw2 : {A B C : Set}(f : B -> C)(g : A -> Lam B)(t : Lam A) ->\n subst (lam f ∘ g) t ≡ lam f (subst g t)\nsubstLaw2 f g (var a) = refl \n", "meta": {"hexsha": "07527bd385269558a1b297cf734cbfef1e3b9f5d", "size": 3685, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/NestedDataTypes/DeBruijn.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/NestedDataTypes/DeBruijn.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/NestedDataTypes/DeBruijn.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.7641509434, "max_line_length": 86, "alphanum_fraction": 0.5240162822, "num_tokens": 1377, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869851639066, "lm_q2_score": 0.7956581024858786, "lm_q1q2_score": 0.6968270107973423}} {"text": "------------------------------------------------------------------------------\n-- Testing the conjectures inside a @where@ clause\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule Where2 where\n\ninfixl 6 _+_\ninfix 4 _≡_\n\npostulate\n D : Set\n zero : D\n succ : D → D\n _≡_ : D → D → Set\n\ndata N : D → Set where\n nzero : N zero\n nsucc : ∀ {n} → N n → N (succ n)\n\nN-ind : (A : D → Set) →\n A zero →\n (∀ {n} → A n → A (succ n)) →\n ∀ {n} → N n → A n\nN-ind A A0 h nzero = A0\nN-ind A A0 h (nsucc Nn) = h (N-ind A A0 h Nn)\n\npostulate\n _+_ : D → D → D\n +-0x : ∀ n → zero + n ≡ n\n +-Sx : ∀ m n → succ m + n ≡ succ (m + n)\n{-# ATP axioms +-0x +-Sx #-}\n\n+-assoc : ∀ {m n o} → N m → N n → N o → m + n + o ≡ m + (n + o)\n+-assoc {n = n} {o} Nm Nn No = N-ind A A0 is Nm\n where\n A : D → Set\n A i = i + n + o ≡ i + (n + o)\n\n postulate A0 : zero + n + o ≡ zero + (n + o)\n {-# ATP prove A0 #-}\n\n postulate is : ∀ {i} → i + n + o ≡ i + (n + o) →\n succ i + n + o ≡ succ i + (n + o)\n {-# ATP prove is #-}\n", "meta": {"hexsha": "bf3d02b123ae33a4f870c66dabaa4b21b27df779", "size": 1263, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/fol-theorems/Where2.agda", "max_stars_repo_name": "asr/apia", "max_stars_repo_head_hexsha": "a66c5ddca2ab470539fd68c42c4fbd45f720d682", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:54:16.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-03T13:44:25.000Z", "max_issues_repo_path": "test/Succeed/fol-theorems/Where2.agda", "max_issues_repo_name": "asr/apia", "max_issues_repo_head_hexsha": "a66c5ddca2ab470539fd68c42c4fbd45f720d682", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 121, "max_issues_repo_issues_event_min_datetime": "2015-01-25T13:22:12.000Z", "max_issues_repo_issues_event_max_datetime": "2018-04-22T06:01:44.000Z", "max_forks_repo_path": "test/Succeed/fol-theorems/Where2.agda", "max_forks_repo_name": "asr/apia", "max_forks_repo_head_hexsha": "a66c5ddca2ab470539fd68c42c4fbd45f720d682", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2016-05-10T23:06:19.000Z", "max_forks_repo_forks_event_max_datetime": "2016-08-03T03:54:55.000Z", "avg_line_length": 25.26, "max_line_length": 78, "alphanum_fraction": 0.3808392716, "num_tokens": 447, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094117351309, "lm_q2_score": 0.7799929002541068, "lm_q1q2_score": 0.6967749988835749}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Groups.Definition\nopen import Setoids.Setoids\nopen import Setoids.Subset\nopen import LogicalFormulae\nopen import Sets.EquivalenceRelations\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Homomorphisms.Lemmas\nopen import Groups.Subgroups.Definition\nopen import Groups.Lemmas\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Groups.Homomorphisms.Image {a b c d : _} {A : Set a} {B : Set b} {S : Setoid {a} {c} A} {T : Setoid {b} {d} B} {_+A_ : A → A → A} {_+B_ : B → B → B} {G : Group S _+A_} {H : Group T _+B_} {f : A → B} (fHom : GroupHom G H f) where\n\nimageGroupPred : B → Set (a ⊔ d)\nimageGroupPred b = Sg A (λ a → Setoid._∼_ T (f a) b)\n\nimageGroupSubset : subset T imageGroupPred\nimageGroupSubset {x} {y} x=y (a , fa=x) = a , transitive fa=x x=y\n where\n open Setoid T\n open Equivalence eq\n\nimageGroupSubgroup : Subgroup H imageGroupPred\nSubgroup.isSubset imageGroupSubgroup = imageGroupSubset\nSubgroup.closedUnderPlus imageGroupSubgroup {x} {y} (a , fa=x) (b , fb=y) = (a +A b) , transitive (GroupHom.groupHom fHom) (Group.+WellDefined H fa=x fb=y)\n where\n open Setoid T\n open Equivalence eq\nSubgroup.containsIdentity imageGroupSubgroup = Group.0G G , imageOfIdentityIsIdentity fHom\nSubgroup.closedUnderInverse imageGroupSubgroup {x} (a , fa=x) = Group.inverse G a , transitive (homRespectsInverse fHom) (inverseWellDefined H fa=x)\n where\n open Setoid T\n open Equivalence eq\n", "meta": {"hexsha": "230b4c5aefc1be2a34482c9dd9dc4abd1e418ca3", "size": 1497, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Homomorphisms/Image.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Homomorphisms/Image.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Homomorphisms/Image.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 40.4594594595, "max_line_length": 235, "alphanum_fraction": 0.7214428858, "num_tokens": 487, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.912436153333645, "lm_q2_score": 0.7634837743174788, "lm_q1q2_score": 0.6966301981708931}} {"text": "import Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl)\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Relation.Nullary using (¬_; Dec; yes; no)\n\ndata _≤_ : ℕ → ℕ → Set where\n z≤n : ∀ {n : ℕ} → zero ≤ n\n s≤s : ∀ {m n : ℕ} → m ≤ n → suc m ≤ suc n\n\n¬s≤z : ∀ {m : ℕ} → ¬ (suc m ≤ zero)\n¬s≤z ()\n\n¬s≤s : ∀ {m n : ℕ} → ¬ (m ≤ n) → ¬ (suc m ≤ suc n)\n¬s≤s ¬m≤n (s≤s m≤n) = ¬m≤n m≤n\n\n_≤?_ : ∀ (m n : ℕ) → Dec (m ≤ n)\nzero ≤? n = yes z≤n\nsuc m ≤? zero = no ¬s≤z\nsuc m ≤? suc n with m ≤? n\n... | yes m≤n = yes (s≤s m≤n)\n... | no ¬m≤n = no (¬s≤s ¬m≤n)\n\n_ : 2 ≤? 4 ≡ yes (s≤s (s≤s z≤n))\n_ = refl\n\n_ : 4 ≤? 2 ≡ no (¬s≤s (¬s≤s ¬s≤z))\n_ = refl\n\n", "meta": {"hexsha": "2386f724726d26053dad8dcedd8326775b6f25d4", "size": 659, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "extra/extra/DecidableFixed.agda", "max_stars_repo_name": "manikdv/plfa.github.io", "max_stars_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 1003, "max_stars_repo_stars_event_min_datetime": "2018-07-05T18:15:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-27T07:03:28.000Z", "max_issues_repo_path": "extra/extra/DecidableFixed.agda", "max_issues_repo_name": "manikdv/plfa.github.io", "max_issues_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": 323, "max_issues_repo_issues_event_min_datetime": "2018-07-05T22:34:34.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T07:42:57.000Z", "max_forks_repo_path": "extra/extra/DecidableFixed.agda", "max_forks_repo_name": "manikdv/plfa.github.io", "max_forks_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": 304, "max_forks_repo_forks_event_min_datetime": "2018-07-16T18:24:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T11:35:02.000Z", "avg_line_length": 22.724137931, "max_line_length": 53, "alphanum_fraction": 0.4749620637, "num_tokens": 352, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9449947148047777, "lm_q2_score": 0.7371581568543043, "lm_q1q2_score": 0.6966105622025489}} {"text": "\nmodule ListNat where\n data Nat : Set where\n zero : Nat\n succ : Nat -> Nat\n\n data List (a : Set) : Set where\n [] : List a\n _::_ : a -> List a -> List a\n\n infixr 30 _::_\n\n [1,0,2] = one :: zero :: succ one :: []\n where one = succ zero\n", "meta": {"hexsha": "487234d4074d282352511166bae85680c66264b2", "size": 255, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "tests/covered/ListNat.agda", "max_stars_repo_name": "andrejtokarcik/agda-semantics", "max_stars_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-08-10T15:33:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-06T17:24:25.000Z", "max_issues_repo_path": "tests/covered/ListNat.agda", "max_issues_repo_name": "andrejtokarcik/agda-semantics", "max_issues_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/covered/ListNat.agda", "max_forks_repo_name": "andrejtokarcik/agda-semantics", "max_forks_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.0, "max_line_length": 41, "alphanum_fraction": 0.5137254902, "num_tokens": 88, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9372107984180245, "lm_q2_score": 0.743168019989179, "lm_q1q2_score": 0.6965050933728009}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Functor.Algebra where\n\n-- Algebra for a Functor\n\nopen import Level\nopen import Function using (_$_)\n\nopen import Categories.Category using (Category)\nopen import Categories.Functor using (Functor; Endofunctor)\n\nprivate\n variable\n o ℓ e : Level\n\nmodule _ {C : Category o ℓ e} where\n\n record F-Algebra (F : Endofunctor C) : Set (o ⊔ ℓ) where\n open Category C\n field\n A : Obj\n α : Functor.F₀ F A ⇒ A\n\n open F-Algebra\n\n -- Given an F-Algebra F, one can apply F to it to obtain an new 'iterated' F-Algebra\n iterate : {F : Endofunctor C} → F-Algebra F → F-Algebra F\n iterate {F} c = record { A = Functor.F₀ F $ A c ; α = Functor.F₁ F $ α c }\n\n record F-Algebra-Morphism {F : Endofunctor C} (X Y : F-Algebra F) : Set (ℓ ⊔ e) where\n open Category C\n module X = F-Algebra X\n module Y = F-Algebra Y\n open Functor F\n field\n f : X.A ⇒ Y.A\n commutes : f ∘ X.α ≈ Y.α ∘ F₁ f\n", "meta": {"hexsha": "4c45d60d5ade5b746d586710a79d05cb79fadf76", "size": 964, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Algebra.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Functor/Algebra.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Functor/Algebra.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 25.3684210526, "max_line_length": 87, "alphanum_fraction": 0.6358921162, "num_tokens": 314, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.933430812881347, "lm_q2_score": 0.7461390043208003, "lm_q1q2_score": 0.6964691373256435}} {"text": "import Lvl\nopen import Structure.Setoid\nopen import Type\n\nmodule Automaton.Deterministic.Accessible where\n\nopen import Automaton.Deterministic\nopen import Data.List renaming (∅ to ε ; _⊰_ to _·_)\nopen import Data.List.Functions using (postpend ; _++_)\nopen import Logic.Predicate\nopen import Logic.Predicate.Equiv\nopen import Sets.ExtensionalPredicateSet using (PredSet ; intro ; _∈_ ; _∋_ ; ⊶ ; [∋]-binaryRelator)\nopen import Structure.Operator\nopen import Structure.Relator\nopen import Structure.Relator.Properties\nopen import Syntax.Transitivity\n\nprivate variable ℓₚ ℓₛ ℓₑ₁ ℓₐ ℓₑ₂ : Lvl.Level\n\nmodule _\n {State : Type{ℓₛ}} ⦃ equiv-state : Equiv{ℓₑ₁}(State) ⦄\n {Alphabet : Type{ℓₐ}} ⦃ equiv-alphabet : Equiv{ℓₑ₂}(Alphabet) ⦄\n where\n\n module _ (d : Deterministic{ℓₚ = ℓₚ}(State)(Alphabet)) where\n open Deterministic(d)\n\n -- The subset of State which are the accessible states from the start state by chained transitions.\n Accessible : PredSet(State)\n Accessible = ⊶(wordTransition start)\n\n instance\n accessible-start : (start ∈ Accessible)\n accessible-start = [∃]-intro ε ⦃ reflexivity(_≡_) {x = start} ⦄\n\n instance\n accessible-transition : ∀{s}{a} → ⦃ _ : (s ∈ Accessible) ⦄ → (transition s a ∈ Accessible)\n accessible-transition {s} {a = a} ⦃ [∃]-intro w ⦃ p ⦄ ⦄ = [∃]-intro (postpend a w)\n ⦃\n wordTransition start (postpend a w) 🝖-[ wordTransition-postpend {d = d} {start}{w}{a} ]\n transition (wordTransition start w) a 🝖-[ congruence₂ₗ(transition) a p ]\n transition s a 🝖-end\n ⦄\n\n module _ where\n open Deterministic\n\n accessibleAutomaton : (d : Deterministic{ℓₚ = ℓₚ}(State)(Alphabet)) → Deterministic(∃(_∈ Accessible d)) (Alphabet)\n transition (accessibleAutomaton d) ([∃]-intro s) a = [∃]-intro (transition d s a) ⦃ accessible-transition d ⦄\n BinaryOperator.congruence (transition-binaryOperator (accessibleAutomaton d)) = congruence₂(transition d)\n start (accessibleAutomaton d) = [∃]-intro (start d) ⦃ accessible-start d ⦄\n Final (accessibleAutomaton d) PredSet.∋ [∃]-intro s = s ∈ Final d\n UnaryRelator.substitution (PredSet.preserve-equiv (Final (accessibleAutomaton d))) {[∃]-intro x} {[∃]-intro y} = substitute₂ᵣ(_∋_) {intro (_∈ Final d)}\n", "meta": {"hexsha": "b7ef4d0befab66832d67c0697e97b40cfb10e290", "size": 2287, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Automaton/Deterministic/Accessible.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Automaton/Deterministic/Accessible.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Automaton/Deterministic/Accessible.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.3518518519, "max_line_length": 155, "alphanum_fraction": 0.6803672934, "num_tokens": 726, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357563664174, "lm_q2_score": 0.8031738034238807, "lm_q1q2_score": 0.6963804061453166}} {"text": "open import Type\nopen import Structure.Setoid renaming (_≡_ to _≡ₑ_)\n\n-- Finite sets represented by lists\nmodule Data.List.Relation.Membership {ℓ ℓₑ} {T : Type{ℓ}} ⦃ equiv : Equiv{ℓₑ}(T)⦄ where\n\nopen import Data.List\nopen import Data.List.Relation.Quantification using (ExistsElement ; ExistsUniqueElement)\nopen import Functional\nopen import Logic\n\n_∈_ : T → List(T) → Stmt\n_∈_ = ExistsElement ∘ (_≡ₑ_)\nmodule _∈_ where\n pattern use {x}{l} px = ExistsElement.•_ {x = x}{l = l} px\n pattern skip {x}{l} el = ExistsElement.⊰_ {l = l}{x = x} el\n\nopen _∈_ public\nopen import Relator.Sets(_∈_) public\n\n_∈!_ : T → List(T) → Stmt\n_∈!_ = ExistsUniqueElement ∘ (_≡ₑ_)\n", "meta": {"hexsha": "740fb0ca0aa505c04082897a14147097b080a5e5", "size": 661, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/List/Relation/Membership.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/List/Relation/Membership.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/List/Relation/Membership.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.7391304348, "max_line_length": 89, "alphanum_fraction": 0.6959152799, "num_tokens": 242, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9407897525789547, "lm_q2_score": 0.7401743735019594, "lm_q1q2_score": 0.6963484657121911}} {"text": "open import Agda.Builtin.Nat\nopen import Agda.Builtin.Sigma\n\ninterleaved mutual\n\n data Rec : Set\n ⟦_⟧ : Rec → Set\n\n constructor `Nat : Rec\n ⟦ `Nat ⟧ = Nat\n\n _ : Rec\n _ = `Σ `Nat (λ _ → `Nat)\n\n _ : Rec → Rec\n _ = λ r → `Σ r (λ _ → `Nat)\n\n constructor `Σ : (r : Rec) → (⟦ r ⟧ → Rec) → Rec\n ⟦ `Σ A B ⟧ = Σ ⟦ A ⟧ λ a → ⟦ B a ⟧\n\n_+1-Nats : Nat → Rec\nzero +1-Nats = `Nat\nsuc n +1-Nats = `Σ `Nat λ _ → n +1-Nats\n\nNats : Rec\nNats = `Σ `Nat _+1-Nats\n\n[1] : ⟦ Nats ⟧\n[1] = 0 , 1\n\n[1⋯3] : ⟦ Nats ⟧\n[1⋯3] = 2 , 1 , 2 , 3\n", "meta": {"hexsha": "79f14d85f5157831b779cf18dc3824229f66fb5a", "size": 522, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2858-IR-record.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Succeed/Issue2858-IR-record.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/Issue2858-IR-record.agda", "max_forks_repo_name": "shlevy/agda", "max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 15.8181818182, "max_line_length": 50, "alphanum_fraction": 0.4904214559, "num_tokens": 271, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9407897542390752, "lm_q2_score": 0.7401743505760728, "lm_q1q2_score": 0.6963484453725306}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Data.Vec.DepVec where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Foundations.Isomorphism\n\nimport Cubical.Data.Empty as ⊥\nopen import Cubical.Data.Unit\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Sigma\nopen import Cubical.Data.Vec\n\nopen import Cubical.Relation.Nullary\n\nopen Iso\n\nprivate\n variable\n ℓ : Level\n\ndata depVec (G : (n : ℕ) → Type ℓ) : ℕ → Type ℓ where\n ⋆ : depVec G 0\n _□_ : {n : ℕ} → (a : G n) → (v : depVec G n) → depVec G (suc n)\n\n\nmodule depVecPath (G : (n : ℕ) → Type ℓ)\n where\n\n code : {n : ℕ} → (v v' : depVec G n) → Type ℓ\n code ⋆ ⋆ = Unit*\n code (a □ v) (a' □ v') = (a ≡ a') × (v ≡ v')\n\n -- encode\n reflEncode : {n : ℕ} → (v : depVec G n) → code v v\n reflEncode ⋆ = tt*\n reflEncode (a □ v) = refl , refl\n\n encode : {n : ℕ} → (v v' : depVec G n) → (v ≡ v') → code v v'\n encode v v' p = J (λ v' _ → code v v') (reflEncode v) p\n\n encodeRefl : {n : ℕ} → (v : depVec G n) → encode v v refl ≡ reflEncode v\n encodeRefl v = JRefl (λ v' _ → code v v') (reflEncode v)\n\n -- decode\n decode : {n : ℕ} → (v v' : depVec G n) → (r : code v v') → (v ≡ v')\n decode ⋆ ⋆ _ = refl\n decode (a □ v) (a' □ v') (p , q) = cong₂ _□_ p q\n\n decodeRefl : {n : ℕ} → (v : depVec G n) → decode v v (reflEncode v) ≡ refl\n decodeRefl ⋆ = refl\n decodeRefl (a □ v) = refl\n\n -- equiv\n ≡Vec≃codeVec : {n : ℕ} → (v v' : depVec G n) → (v ≡ v') ≃ (code v v')\n ≡Vec≃codeVec v v' = isoToEquiv is\n where\n is : Iso (v ≡ v') (code v v')\n fun is = encode v v'\n inv is = decode v v'\n rightInv is = sect v v'\n where\n sect : {n : ℕ} → (v v' : depVec G n) → (r : code v v')\n → encode v v' (decode v v' r) ≡ r\n sect ⋆ ⋆ tt* = encodeRefl ⋆\n sect (a □ v) (a' □ v') (p , q) = J (λ a' p → encode (a □ v) (a' □ v') (decode (a □ v) (a' □ v') (p , q)) ≡ (p , q))\n (J (λ v' q → encode (a □ v) (a □ v') (decode (a □ v) (a □ v') (refl , q)) ≡ (refl , q))\n (encodeRefl (a □ v)) q) p\n leftInv is = retr v v'\n where\n retr : {n : ℕ} → (v v' : depVec G n) → (p : v ≡ v')\n → decode v v' (encode v v' p) ≡ p\n retr v v' p = J (λ v' p → decode v v' (encode v v' p) ≡ p)\n (cong (decode v v) (encodeRefl v) ∙ decodeRefl v) p\n", "meta": {"hexsha": "9e507180e7ea3c320d1679dc6a909280f304b154", "size": 2377, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/Vec/DepVec.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/Vec/DepVec.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/Vec/DepVec.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.6933333333, "max_line_length": 126, "alphanum_fraction": 0.5027345393, "num_tokens": 976, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970904940926, "lm_q2_score": 0.7905303186696747, "lm_q1q2_score": 0.6962968046316174}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\n\nmodule Cubical.Categories.Functor where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Data.Sigma\nopen import Cubical.Categories.Category\n\nprivate\n variable\n ℓC ℓC' ℓD ℓD' : Level\n\nrecord Functor (C : Precategory ℓC ℓC') (D : Precategory ℓD ℓD') : Type (ℓ-max (ℓ-max ℓC ℓC') (ℓ-max ℓD ℓD')) where\n no-eta-equality\n open Precategory\n\n field\n F-ob : C .ob → D .ob\n F-hom : {x y : C .ob} → C [ x , y ] → D [(F-ob x) , (F-ob y)]\n F-id : {x : C .ob} → F-hom (C .id x) ≡ D .id (F-ob x)\n F-seq : {x y z : C .ob} (f : C [ x , y ]) (g : C [ y , z ]) → F-hom (f ⋆⟨ C ⟩ g) ≡ (F-hom f) ⋆⟨ D ⟩ (F-hom g)\n\n isFull = (x y : _) (F[f] : D [(F-ob x) , (F-ob y)]) → ∃ (C [ x , y ]) (λ f → F-hom f ≡ F[f])\n isFaithful = (x y : _) (f g : C [ x , y ]) → F-hom f ≡ F-hom g → f ≡ g\n\n\n-- Functor results\n\nmodule _ (C : Precategory ℓC ℓC') (D : Precategory ℓC ℓC') (F : Functor C D ) where\n open Precategory\n open Functor F\n\n open CatIso\n\n -- functors preserve isomorphisms\n preserveIsosF : ∀ {x y : C .ob} → CatIso {C = C} x y → CatIso {C = D} (F-ob x) (F-ob y)\n preserveIsosF {x} {y} (catiso f f⁻¹ sec' ret') =\n catiso\n g g⁻¹\n -- sec\n ( (g⁻¹ ⋆⟨ D ⟩ g)\n ≡⟨ sym (F-seq f⁻¹ f) ⟩\n F-hom (f⁻¹ ⋆⟨ C ⟩ f)\n ≡⟨ cong F-hom sec' ⟩\n F-hom (C .id y)\n ≡⟨ F-id ⟩\n D .id y'\n ∎ )\n -- ret\n ( (g ⋆⟨ D ⟩ g⁻¹)\n ≡⟨ sym (F-seq f f⁻¹) ⟩\n F-hom (f ⋆⟨ C ⟩ f⁻¹)\n ≡⟨ cong F-hom ret' ⟩\n F-hom (C .id x)\n ≡⟨ F-id ⟩\n D .id x'\n ∎ )\n\n where\n x' : D .ob\n x' = F-ob x\n y' : D .ob\n y' = F-ob y\n\n g : D [ x' , y' ]\n g = F-hom f\n g⁻¹ : D [ y' , x' ]\n g⁻¹ = F-hom f⁻¹\n", "meta": {"hexsha": "a1c53762ffdc7799e1e087ac60dd2cd867de48ff", "size": 1769, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Categories/Functor.agda", "max_stars_repo_name": "apabepa10/cubical", "max_stars_repo_head_hexsha": "3a9bb56260c25a6f2e9c20af8d278de0fe8d9e05", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Categories/Functor.agda", "max_issues_repo_name": "apabepa10/cubical", "max_issues_repo_head_hexsha": "3a9bb56260c25a6f2e9c20af8d278de0fe8d9e05", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Categories/Functor.agda", "max_forks_repo_name": "apabepa10/cubical", "max_forks_repo_head_hexsha": "3a9bb56260c25a6f2e9c20af8d278de0fe8d9e05", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.6376811594, "max_line_length": 115, "alphanum_fraction": 0.4584511023, "num_tokens": 807, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473846343394, "lm_q2_score": 0.7981867705385762, "lm_q1q2_score": 0.6962961417290565}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Some properties about signs\n------------------------------------------------------------------------\n\nmodule Data.Sign.Properties where\n\nopen import Data.Empty\nopen import Function\nopen import Data.Sign\nopen import Relation.Binary.PropositionalEquality\n\n-- The opposite of a sign is not equal to the sign.\n\nopposite-not-equal : ∀ s → s ≢ opposite s\nopposite-not-equal - ()\nopposite-not-equal + ()\n\n-- Sign multiplication is right cancellative.\n\ncancel-*-right : ∀ s₁ s₂ {s} → s₁ * s ≡ s₂ * s → s₁ ≡ s₂\ncancel-*-right - - _ = refl\ncancel-*-right - + eq = ⊥-elim (opposite-not-equal _ $ sym eq)\ncancel-*-right + - eq = ⊥-elim (opposite-not-equal _ eq)\ncancel-*-right + + _ = refl\n", "meta": {"hexsha": "55f627831908e83a7df9773f9494b8f780aac70a", "size": 788, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Data/Sign/Properties.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Data/Sign/Properties.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Data/Sign/Properties.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.1851851852, "max_line_length": 72, "alphanum_fraction": 0.5596446701, "num_tokens": 190, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9086179068309441, "lm_q2_score": 0.766293653760418, "lm_q1q2_score": 0.6962681356976272}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Monad.Duality {o ℓ e} (C : Category o ℓ e) where\n\nopen import Categories.Functor\nopen import Categories.NaturalTransformation\nopen import Categories.Monad\nopen import Categories.Comonad\n\nprivate\n module C = Category C\n open C\n open HomReasoning\n\ncoMonad⇒Comonad : Monad C.op → Comonad C\ncoMonad⇒Comonad M = record\n { F = Functor.op F\n ; ε = NaturalTransformation.op η\n ; δ = NaturalTransformation.op μ\n ; assoc = M.sym-assoc\n ; sym-assoc = M.assoc\n ; identityˡ = M.identityˡ\n ; identityʳ = M.identityʳ\n }\n where module M = Monad M\n open M using (F; η; μ)\n\nComonad⇒coMonad : Comonad C → Monad C.op\nComonad⇒coMonad M = record\n { F = Functor.op F\n ; η = NaturalTransformation.op ε\n ; μ = NaturalTransformation.op δ\n ; assoc = M.sym-assoc\n ; sym-assoc = M.assoc\n ; identityˡ = M.identityˡ\n ; identityʳ = M.identityʳ\n }\n where module M = Comonad M\n open M using (F; ε; δ)\n", "meta": {"hexsha": "0e7c889f8b27b7979f9afa08c9ccea83aab3b6b7", "size": 1077, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Monad/Duality.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Monad/Duality.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Monad/Duality.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.6428571429, "max_line_length": 66, "alphanum_fraction": 0.6304549675, "num_tokens": 329, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9294404038127071, "lm_q2_score": 0.7490872187162396, "lm_q1q2_score": 0.6962319270545594}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import LogicalFormulae\nopen import Functions.Definition\nopen import Numbers.Naturals.Definition\nopen import Sets.FinSet.Definition\nopen import Setoids.Setoids\n\nmodule Setoids.Cardinality.Infinite.Definition where\n\nInfiniteSetoid : {a b : _} {A : Set a} (S : Setoid {a} {b} A) → Set (a ⊔ b)\nInfiniteSetoid {A = A} S = (n : ℕ) → (f : FinSet n → A) → (SetoidBijection (reflSetoid (FinSet n)) S f) → False\n\nrecord DedekindInfiniteSetoid {a b : _} {A : Set a} (S : Setoid {a} {b} A) : Set (a ⊔ b) where\n field\n inj : ℕ → A\n isInjection : SetoidInjection (reflSetoid ℕ) S inj\n", "meta": {"hexsha": "8e644d8bb6b74f765d30e69c7a161da2c9096483", "size": 693, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Setoids/Cardinality/Infinite/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Setoids/Cardinality/Infinite/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Setoids/Cardinality/Infinite/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 36.4736842105, "max_line_length": 111, "alphanum_fraction": 0.6868686869, "num_tokens": 238, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9294403999037784, "lm_q2_score": 0.7490872187162397, "lm_q1q2_score": 0.696231924126431}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Mult3 where\n\nopen import Data.Nat\nopen import Data.Nat.Properties\nopen import Relation.Binary.PropositionalEquality\n\ndata Mult3 : ℕ → Set where\n 0-mult : Mult3 0\n SSS-mult : ∀ n → Mult3 n → Mult3 (suc (suc (suc n)))\n\ndata Mult3' : ℕ → Set where\n 30-mult : Mult3' 30\n 21-mult : Mult3' 21\n sum-mult : ∀ n m → Mult3' n → Mult3' m → Mult3' (n + m)\n diff-mult : ∀ l n m → Mult3' n → Mult3' m → l + n ≡ m → Mult3' l\n\nsilly3 : Mult3' 3\nsilly3 = diff-mult 3 9 12 (diff-mult 9 21 30 21-mult 30-mult refl) (diff-mult 12 9 21 (diff-mult 9 21 30 21-mult 30-mult refl) 21-mult refl) refl\n\nlemma-plus : ∀ {n m : ℕ} → Mult3 n → Mult3 m → Mult3 (n + m)\nlemma-plus 0-mult m = m\nlemma-plus {m = m₁} (SSS-mult n n₁) m = SSS-mult (n + m₁) (lemma-plus n₁ m)\n\nlemma-minus : ∀ {l n : ℕ} → Mult3 n → Mult3 (n + l) → Mult3 l\nlemma-minus {l} {.0} 0-mult m₁ = m₁\nlemma-minus {l} {.(suc (suc (suc n)))} (SSS-mult n n₁) (SSS-mult .(n + l) m₁) = lemma-minus n₁ m₁\n\nlemma-silly : ∀ {m n : ℕ} → Mult3 m → m ≡ n → Mult3 n\nlemma-silly m eq rewrite eq = m\n\nmult-imp-mult' : ∀ {n : ℕ} → Mult3 n → Mult3' n\nmult-imp-mult' 0-mult = diff-mult zero 30 30 30-mult 30-mult refl\nmult-imp-mult' (SSS-mult n M) = sum-mult 3 n silly3 (mult-imp-mult' M)\n\nmult'-imp-mult : ∀ {n : ℕ} → Mult3' n → Mult3 n\nmult'-imp-mult 30-mult = SSS-mult 27\n (SSS-mult 24\n (SSS-mult 21\n (SSS-mult 18\n (SSS-mult 15\n (SSS-mult 12\n (SSS-mult 9 (SSS-mult 6 (SSS-mult 3 (SSS-mult zero 0-mult)))))))))\nmult'-imp-mult 21-mult = SSS-mult 18\n (SSS-mult 15\n (SSS-mult 12\n (SSS-mult 9 (SSS-mult 6 (SSS-mult 3 (SSS-mult zero 0-mult))))))\nmult'-imp-mult (sum-mult n m M M₁) = lemma-plus (mult'-imp-mult M) (mult'-imp-mult M₁)\nmult'-imp-mult (diff-mult l n m M M₁ x) rewrite +-comm l n = lemma-minus {l} {n} (mult'-imp-mult M) (lemma-silly {m} {n + l} (mult'-imp-mult M₁) (sym x))\n", "meta": {"hexsha": "5059f9abced38d46ff8dea01f0c4a9e8d89fd4d9", "size": 2102, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/Mult3.agda", "max_stars_repo_name": "Brethland/LEARNING-STUFF", "max_stars_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-02-03T05:05:52.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-11T10:35:42.000Z", "max_issues_repo_path": "Agda/Mult3.agda", "max_issues_repo_name": "Brethland/LEARNING-STUFF", "max_issues_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/Mult3.agda", "max_forks_repo_name": "Brethland/LEARNING-STUFF", "max_forks_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-12-13T04:50:46.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-13T04:50:46.000Z", "avg_line_length": 42.04, "max_line_length": 153, "alphanum_fraction": 0.5432921028, "num_tokens": 763, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9294403959948494, "lm_q2_score": 0.7490872075132153, "lm_q1q2_score": 0.6962319107857587}} {"text": "\nmodule Logic.Congruence where\n\nimport Prelude\nimport Logic.Relations\nimport Logic.Equivalence\n\nopen Prelude\nopen Logic.Relations\nopen Logic.Equivalence using (Equivalence)\n renaming (module Equivalence to Proj)\n\ndata Congruence (A : Set) : Set1 where\n congruence :\n (Eq : Equivalence A) ->\n Congruent (Proj._==_ Eq) ->\n Congruence A\n\nmodule Projections where\n\n eq : {A : Set} -> Congruence A -> Rel A\n eq (congruence Eq _) = Proj._==_ Eq\n\n refl : {A : Set}(Cong : Congruence A) -> Reflexive (eq Cong)\n refl (congruence Eq _) = Proj.refl Eq\n\n sym : {A : Set}(Cong : Congruence A) -> Symmetric (eq Cong)\n sym (congruence Eq _) = Proj.sym Eq\n\n trans : {A : Set}(Cong : Congruence A) -> Transitive (eq Cong)\n trans (congruence Eq _) = Proj.trans Eq\n\n cong : {A : Set}(Cong : Congruence A) -> Congruent (eq Cong)\n cong (congruence _ c) = c\n\nmodule Congruence {A : Set}(Cong : Congruence A) where\n\n _==_ = Projections.eq Cong\n refl = Projections.refl Cong\n sym = Projections.sym Cong\n trans = Projections.trans Cong\n cong = Projections.cong Cong\n\n cong2 : (f : A -> A -> A)(a b c d : A) -> a == c -> b == d -> f a b == f c d\n cong2 f a b c d ac bd = trans _ _ _ rem1 rem2\n where\n rem1 : f a b == f a d\n rem1 = cong (f a) _ _ bd\n\n rem2 : f a d == f c d\n rem2 = cong (flip f d) _ _ ac\n\n", "meta": {"hexsha": "570c0211ec6243fd8c9454f771ced967b5d757fa", "size": 1366, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/lib/Logic/Congruence.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/lib/Logic/Congruence.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/lib/Logic/Congruence.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 25.7735849057, "max_line_length": 78, "alphanum_fraction": 0.6112737921, "num_tokens": 461, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206870747658, "lm_q2_score": 0.7718434978390747, "lm_q1q2_score": 0.6961416178852088}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\n-- a zero object is both terminal and initial.\nmodule Categories.Object.Zero {o ℓ e} (C : Category o ℓ e) where\n\nopen import Level\n\nopen import Categories.Object.Terminal C\nopen import Categories.Object.Initial C\n\nopen import Categories.Morphism C\nopen import Categories.Morphism.Reasoning C\n\nopen Category C\nopen HomReasoning\n\nrecord IsZero (Z : Obj) : Set (o ⊔ ℓ ⊔ e) where\n field\n isInitial : IsInitial Z\n isTerminal : IsTerminal Z\n\n open IsInitial isInitial public\n renaming\n ( ! to ¡\n ; !-unique to ¡-unique\n ; !-unique₂ to ¡-unique₂\n )\n open IsTerminal isTerminal public\n\n zero⇒ : ∀ {A B : Obj} → A ⇒ B\n zero⇒ = ¡ ∘ !\n\n zero-∘ˡ : ∀ {X Y Z} → (f : Y ⇒ Z) → f ∘ zero⇒ {X} ≈ zero⇒\n zero-∘ˡ f = pullˡ (⟺ (¡-unique (f ∘ ¡)))\n\n zero-∘ʳ : ∀ {X Y Z} → (f : X ⇒ Y) → zero⇒ {Y} {Z} ∘ f ≈ zero⇒\n zero-∘ʳ f = pullʳ (⟺ (!-unique (! ∘ f)))\n\nrecord Zero : Set (o ⊔ ℓ ⊔ e) where\n field\n 𝟘 : Obj\n isZero : IsZero 𝟘\n\n open IsZero isZero public\n\n terminal : Terminal\n terminal = record { ⊤-is-terminal = isTerminal }\n\n initial : Initial\n initial = record { ⊥-is-initial = isInitial }\n\nopen Zero\n\n¡-Mono : ∀ {A} {z : Zero} → Mono (¡ z {A})\n¡-Mono {z = z} = from-⊤-is-Mono {t = terminal z} (¡ z)\n\n!-Epi : ∀ {A} {z : Zero} → Epi (! z {A})\n!-Epi {z = z} = to-⊥-is-Epi {i = initial z} (! z)\n", "meta": {"hexsha": "5574f1d39cba797d5a74406e94aeb10ef25ecbe5", "size": 1384, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Object/Zero.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Object/Zero.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Object/Zero.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 22.6885245902, "max_line_length": 64, "alphanum_fraction": 0.5917630058, "num_tokens": 524, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206870747658, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.6961416131517286}} {"text": "-- exercises-04-thursday.agda\n\nopen import mylib\n\n-- 1. Coinduction\n\n{-\n Now your task is to define multiplication _*∞_ for conatural numbers.\n\n This is harder then it sounds. Why? Because to check termination of\n corecursive programs agda needs to make sure that if you want to find out a\n finite amout of information about the result of the function it only needs a\n finite amount of information about its inputs. Such a function is called\n productive. And agda isn't very clever in figuring this out, it has to be\n obvious from the program (similar as structural recursion has to be\n obviously structural). \n You should *not* use the TERMINATING pragma in your solution.\n But it may be useful for experiments.\n\n _*_ : ℕ → ℕ → ℕ\n zero * n = zero\n suc m * n = n + m * n\n-}\n\n{-\n_*∞_ : ℕ∞ → ℕ∞ → ℕ∞\nm *∞ n = {!!}\n-}\n\naux : ℕ∞ → ℕ∞ → ℕ∞ → ℕ∞ -- aux l m n = l +∞ (m *∞ n)\npred∞ (aux l m n) with pred∞ l\npred∞ (aux l m n) | nothing with pred∞ m\npred∞ (aux l m n) | nothing | nothing = nothing\npred∞ (aux l m n) | nothing | just m' with pred∞ n\npred∞ (aux l m n) | nothing | just m' | nothing = nothing\npred∞ (aux l m n) | nothing | just m' | just n' = just (aux n' m' n)\npred∞ (aux l m n) | just l' = just (aux l' m n)\n\n{-# TERMINATING #-}\n_*∞_ : ℕ∞ → ℕ∞ → ℕ∞\nm *∞ n = aux zero∞ m n\n{-\npred∞ (m *∞ n) with pred∞ m\n... | nothing = nothing\n... | just m' with pred∞ n\n... | nothing = nothing\n... | just n' = just (n' +∞ (m' *∞ n))\n-}\n\n{-\nwith pred∞ m\n...| nothing = zero∞\n...| just m' with pred∞ n\n...| nothing = zero∞\n...| just n' = n' +∞ (m' *∞ n)\n-}\n\n-- pred∞ (∞ *∞ zero∞) = nothing\n-- here are some testing tools\nℕ→ℕ∞ : ℕ → ℕ∞\nℕ→ℕ∞ zero = zero∞\nℕ→ℕ∞ (suc n) = suc∞ (ℕ→ℕ∞ n)\n\n{-# TERMINATING #-} -- a lie\n-- this function is a cheat - it doesn't terminate for ∞\nℕ∞→ℕ : ℕ∞ → ℕ\nℕ∞→ℕ n with pred∞ n\nℕ∞→ℕ n | nothing = 0\nℕ∞→ℕ n | just n' = suc (ℕ∞→ℕ n')\n\n-- My unit-test\nx3*5 = ℕ∞→ℕ (ℕ→ℕ∞ 3 *∞ ℕ→ℕ∞ 5)\n\n-- 2. Dependent types Fin\n\n{-\n Define the following operations on Fin\n - max returns the largest element in Fin (suc n)\n - emb embeds Fin n into Fin (suc n) without changing its values\n - inv inverts the order of elements in Fin n\n-}\n\nmax : (n : ℕ) → Fin (suc n)\nmax zero = zero\nmax (suc n) = suc (max n)\n\nemb : {n : ℕ} → Fin n → Fin (suc n)\nemb zero = zero\nemb (suc m) = suc (emb m)\n\ninv : {n : ℕ} → Fin n → Fin n\ninv zero = max _\ninv (suc i) = emb (inv i)\n\n-- 2. Dependent types : Vec\n\nVector : ℕ → Set {- Vec n is an n-dimensional vector -}\nVector m = Vec ℕ m\n\nMatrix : ℕ → ℕ → Set {- Matrix m n is an m x n Matrix -}\nMatrix m n = Vec (Vector n) m\n\nm3 : Matrix 3 3\nm3 = (1 ∷ 2 ∷ 3 ∷ []) \n ∷ (4 ∷ 5 ∷ 6 ∷ []) \n ∷ (7 ∷ 8 ∷ 9 ∷ []) \n ∷ []\n\nm4 : Matrix 3 2\nm4 = (1 ∷ 2 ∷ []) \n ∷ (4 ∷ 5 ∷ []) \n ∷ (7 ∷ 8 ∷ []) \n ∷ []\n\n-- Define the operation transpose which switches columns and rows.\n-- Applicative functor, Vec _ n is an applicative functor\n-- mapVec : (A → B) → Vec A n → Vec B n\n-- return : A → Vec A n\n-- app : Vec (A → B) n → Vec A n → Vec B n\n-- mapVec f as = app (return f) as\n\nreturn : {A : Set}{n : ℕ} → A → Vec A n\nreturn {n = zero} a = []\nreturn {n = suc m} a = a ∷ return {n = m} a\n\napp : {A B : Set}{n : ℕ} → Vec (A → B) n → Vec A n → Vec B n\napp [] [] = []\napp (a2b ∷ a2bs) (a ∷ as) = a2b a ∷ app a2bs as\n\ntranspose : {m n : ℕ} → Matrix m n → Matrix n m\ntranspose [] = return []\ntranspose (ns ∷ mns) = app (app (return _∷_) ns) (transpose mns)\n\n{-\ntranspose : {m n : ℕ} → Matrix m n → Matrix n m\ntranspose [] = {!!} -- [ [] , [] , [] ] m empty rows\ntranspose (ns ∷ mns) = {!transpose mns!}\n-}\n-- if ns = [1 , 2 , 3]\n-- transpose mns = [ns1 , ns2 , ns3] => [1 ∷ ns1 , 2 ∷ ns2 , 3 ∷ ns3]\n\ntest8 : Matrix 2 3\ntest8 = transpose m4\n\ntest9 : Matrix 3 3\ntest9 = transpose m3\n", "meta": {"hexsha": "bc856e22366d175a99d9f5e8e00ac46eca63957e", "size": 3762, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type Theory/exercises-04-thursday.agda", "max_stars_repo_name": "FoxySeta/mgs-2021", "max_stars_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Type Theory/exercises-04-thursday.agda", "max_issues_repo_name": "FoxySeta/mgs-2021", "max_issues_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-07-14T20:34:53.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-14T20:35:48.000Z", "max_forks_repo_path": "Type Theory/exercises-04-thursday.agda", "max_forks_repo_name": "FoxySeta/mgs-2021", "max_forks_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.5918367347, "max_line_length": 78, "alphanum_fraction": 0.5603402446, "num_tokens": 1492, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8397339756938818, "lm_q2_score": 0.8289388104343892, "lm_q1q2_score": 0.6960880828930266}} {"text": "\nmodule Issue408 where\n\nopen import Common.Prelude\nopen import Common.Equality\n\n-- 1. Agda should prefer to split on an argument that covers\n\ndata Fin : Nat → Set where\n zero : {n : Nat} → Fin (suc n)\n suc : {n : Nat} → Fin n → Fin (suc n)\n\nwk : {n : Nat} → Fin n → Fin (suc n)\nwk zero = zero\nwk (suc n) = suc (wk n)\n\npredFin : (n : Nat) → Fin n → Fin n\npredFin (suc n) zero = zero\npredFin (suc n) (suc i) = wk i\n-- predFin should be covering\n\ndata Vec (A : Set) : Nat → Set where\n [] : Vec A zero\n _∷_ : {n : Nat} (x : A) (xs : Vec A n) → Vec A (suc n)\n\n_!!_ : {A : Set}{n : Nat} → Vec A n → Fin n → A\n(x ∷ xs) !! zero = x\n(x ∷ xs) !! (suc i) = xs !! i\n-- should be covering, no need for absurd clause\n\ntest!!1 : ∀ {A}{n} (x : A) (xs : Vec A n) → (x ∷ xs) !! zero ≡ x\ntest!!1 x xs = refl\n\ntest!!2 : ∀ {A}{n} (x : A) (xs : Vec A n) i → (x ∷ xs) !! (suc i) ≡ xs !! i\ntest!!2 x xs i = refl\n\n-- 2. Agda should prefer to split on an argument that has only\n-- constructor patterns. For max below, split on 2nd, then on 1st.\n\nmax : Nat → Nat → Nat\nmax (suc n) (suc m) = suc (max n m)\nmax 0 (suc m) = suc m\nmax n 0 = n\n\ntestmax1 : {n m : Nat} → max (suc n) (suc m) ≡ suc (max n m)\ntestmax1 = refl\n\ntestmax2 : {m : Nat} → max 0 (suc m) ≡ suc m\ntestmax2 = refl\n\n{- DOES NOT WORK YET\ntestmax3 : {n : Nat} → max n 0 ≡ n\ntestmax3 = refl\n-- equation should hold definitionally\n-}\n", "meta": {"hexsha": "64b2ebbfbf64a6ed99a08b8567e79aad15f42030", "size": 1404, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/Issue408.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/succeed/Issue408.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/Issue408.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 25.0714285714, "max_line_length": 75, "alphanum_fraction": 0.5598290598, "num_tokens": 561, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767810736693, "lm_q2_score": 0.7931059609645724, "lm_q1q2_score": 0.6959320656775323}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Setoids.Setoids\nopen import Rings.Definition\nopen import Rings.IntegralDomains.Definition\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Rings.Irreducibles.Definition {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} {R : Ring S _+_ _*_} (intDom : IntegralDomain R) where\n\nopen Setoid S\nopen Ring R\nopen import Rings.Units.Definition R\n\nrecord Irreducible (r : A) : Set (a ⊔ b) where\n field\n nonzero : (r ∼ 0R) → False\n nonunit : (Unit r) → False\n irreducible : (x y : A) → (x * y) ∼ r → (Unit x → False) → Unit y\n", "meta": {"hexsha": "8d12160ad7d2b06323d47bd51bbd6fbf2f4caf57", "size": 654, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Irreducibles/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Irreducibles/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Irreducibles/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 31.1428571429, "max_line_length": 158, "alphanum_fraction": 0.6605504587, "num_tokens": 222, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9518632247867715, "lm_q2_score": 0.731058584489497, "lm_q1q2_score": 0.6958677817402251}} {"text": "------------------------------------------------------------------------\n-- Definitions of combinatorial functions\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe --exact-split #-}\n\nmodule Math.Combinatorics.Function where\n\n-- agda-stdlib\nimport Algebra.Operations.CommutativeMonoid as CommutativeMonoidOperations\nopen import Data.Fin using (toℕ)\nopen import Data.Nat\nopen import Data.Nat.DivMod\nopen import Data.Nat.Properties using (+-0-commutativeMonoid)\nopen import Data.List\nopen import Data.Sum using (_⊎_; inj₁; inj₂)\nopen import Data.Unit using (tt)\nopen import Relation.Binary.PropositionalEquality\nopen import Relation.Nullary using (yes; no; ¬_)\nopen import Relation.Nullary.Decidable using (False; fromWitnessFalse)\n\n-- agda-misc\nopen import Math.NumberTheory.Summation.Nat\n\nopen CommutativeMonoidOperations +-0-commutativeMonoid\n\ninfix 10 _! _!!\n\n------------------------------------------------------------------------\n-- Factorial\n-- n ! = n * (n - 1) * ... * 2 * 1\n-- A000142\n\n_! : ℕ → ℕ\n0 ! = 1\n(suc n) ! = suc n * n !\n\n------------------------------------------------------------------------\n-- Permutation, Falling factorial\n-- P n k = (n)ₖ = n * (n - 1) * ... * (n - k + 1) (k terms)\n\nP : ℕ → ℕ → ℕ\nP n 0 = 1\nP 0 (suc k) = 0\nP (suc n) (suc k) = suc n * P n k\n\n------------------------------------------------------------------------\n-- Combination, Binomial coefficient\n-- C n k = P n k / k !\n\nC : ℕ → ℕ → ℕ\nC n 0 = 1\nC 0 (suc k) = 0\nC (suc n) (suc k) = (C n k * suc n) / suc k\n\n-- recursive definition\nCRec : ℕ → ℕ → ℕ\nCRec n 0 = 1\nCRec 0 (suc k) = 0\nCRec (suc n) (suc k) = CRec n k + CRec n (suc k)\n\n------------------------------------------------------------------------\n-- Double factorial\n-- A006882\n\n_!! : ℕ → ℕ\n0 !! = 1\n1 !! = 1\nsuc (suc n) !! = suc (suc n) * n !!\n\n------------------------------------------------------------------------\n-- unsigned Stirling numbers of the first kind\n\nS1 : ℕ → ℕ → ℕ\nS1 0 0 = 1\nS1 0 (suc k) = 0\nS1 (suc n) 0 = 0\nS1 (suc n) (suc k) = n * S1 n (suc k) + S1 n k\n\n------------------------------------------------------------------------\n-- Stirling numbers of the second kind\n\nS2 : ℕ → ℕ → ℕ\nS2 0 0 = 1\nS2 0 (suc k) = 0\nS2 (suc n) 0 = 0\nS2 (suc n) (suc k) = suc k * S2 n (suc k) + S2 n k\n\n------------------------------------------------------------------------\n-- Lah number\n\nL : ℕ → ℕ → ℕ\nL n 0 = 0\nL 0 (suc k) = 0\nL 1 1 = 1\nL 1 (suc (suc k)) = 0\nL (suc n@(suc _)) (suc k) = (n + suc k) * L n (suc k) + L n k\n\n------------------------------------------------------------------------\n-- Bell number\n-- A000110\n\nB : ℕ → ℕ\nB n = Σ[ i ≤ n ] S2 n i\n\n------------------------------------------------------------------------\n-- Pochhammer symbol, Rising factorial\n-- Poch n k = x^(n) = n * (n + 1) * ... * (n + k - 1) (k terms)\n\nPoch : ℕ → ℕ → ℕ\nPoch n 0 = 1\nPoch n (suc k) = n * Poch (suc n) k\n\n------------------------------------------------------------------------\n-- Central binomial coefficient\n-- A000984\n\nCB : ℕ → ℕ\nCB n = C (2 * n) n\n\n------------------------------------------------------------------------\n-- Catalan number\n-- A000108\n\nCatalan : ℕ → ℕ\nCatalan n = CB n / suc n\n\n------------------------------------------------------------------------\n-- Eulerian number\n\nA : ℕ → ℕ → ℕ\nA 0 0 = 1\nA 0 (suc m) = 0\nA (suc n) 0 = 1\nA (suc n) (suc m) = (n ∸ m) * A n m + suc (suc m) * A n (suc m)\n\n------------------------------------------------------------------------\n-- Eulerian numbers of the second kind\n\nE2 : ℕ → ℕ → ℕ\nE2 0 0 = 1\nE2 0 (suc m) = 0\nE2 (suc n) 0 = 1\nE2 (suc n) (suc m) =\n (2 * suc n ∸ suc m ∸ 1) * E2 n m + suc (suc m) * E2 n (suc m)\n\n------------------------------------------------------------------------\n-- Multinomial coefficient\n-- Multinomial xs = (sum xs) ! / product (map _! xs)\n\nMultinomial : List ℕ → ℕ\nMultinomial [] = 1\nMultinomial xxs@(x ∷ xs) = C (sum xxs) x * Multinomial xs\n\n------------------------------------------------------------------------\n-- Pascal's triangle\n\ngpascal : ∀ {a} {A : Set a} → (A → A → A) → A → A → ℕ → List A\ngpascal f v0 v1 0 = v1 ∷ []\ngpascal f v0 v1 (suc n) =\n let ps = gpascal f v0 v1 n in zipWith f (v0 ∷ ps) (ps ∷ʳ v0)\n\npascal : ℕ → List ℕ\npascal = gpascal _+_ 0 1\n", "meta": {"hexsha": "f124f23fd575d227a21201b24ea5d6fcc01df3bc", "size": 4542, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Math/Combinatorics/Function.agda", "max_stars_repo_name": "rei1024/agda-combinatorics", "max_stars_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-06-25T08:24:15.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-25T07:25:27.000Z", "max_issues_repo_path": "Math/Combinatorics/Function.agda", "max_issues_repo_name": "rei1024/agda-combinatorics", "max_issues_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Math/Combinatorics/Function.agda", "max_forks_repo_name": "rei1024/agda-combinatorics", "max_forks_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.5272727273, "max_line_length": 74, "alphanum_fraction": 0.3866138265, "num_tokens": 1387, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.92522995296862, "lm_q2_score": 0.7520125682019722, "lm_q1q2_score": 0.6957845531093219}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Integer division\n------------------------------------------------------------------------\n\nmodule Issue846.OldDivMod where\n\nopen import Data.Nat as Nat\nopen import Data.Nat.Properties\nopen SemiringSolver\nopen import Data.Fin as Fin using (Fin; zero; suc; toℕ; fromℕ)\nimport Data.Fin.Properties as Fin\nopen import Induction.Nat\nopen import Relation.Nullary.Decidable\nopen import Relation.Binary.PropositionalEquality\nopen ≡-Reasoning\nopen import Function\n\n------------------------------------------------------------------------\n-- Some boring lemmas\n\nprivate\n\n lem₁ : (m k : ℕ) →\n Nat.suc m ≡ suc (toℕ (Fin.inject+ k (fromℕ m)) + 0)\n lem₁ m k = cong suc $ begin\n m\n ≡⟨ sym $ Fin.to-from m ⟩\n toℕ (fromℕ m)\n ≡⟨ Fin.inject+-lemma k (fromℕ m) ⟩\n toℕ (Fin.inject+ k (fromℕ m))\n ≡⟨ solve 1 (λ x → x := x :+ con 0) refl _ ⟩\n toℕ (Fin.inject+ k (fromℕ m)) + 0\n ∎\n\n lem₂ : ∀ n → _\n lem₂ = solve 1 (λ n → con 1 :+ n := con 1 :+ (n :+ con 0)) refl\n\n lem₃ : ∀ n k q (r : Fin n) eq → suc n + k ≡ toℕ r + suc q * n\n lem₃ n k q r eq = begin\n suc n + k\n ≡⟨ solve 2 (λ n k → con 1 :+ n :+ k := n :+ (con 1 :+ k))\n refl n k ⟩\n n + suc k\n ≡⟨ cong (_+_ n) eq ⟩\n n + (toℕ r + q * n)\n ≡⟨ solve 3 (λ n r q → n :+ (r :+ q :* n) :=\n r :+ (con 1 :+ q) :* n)\n refl n (toℕ r) q ⟩\n toℕ r + suc q * n\n ∎\n\n------------------------------------------------------------------------\n-- Division\n\ninfixl 7 _divMod_ _div_ _mod_\n\n-- A specification of integer division.\n\nrecord DivMod (dividend divisor : ℕ) : Set where\n constructor result\n field\n quotient : ℕ\n remainder : Fin divisor\n property : dividend ≡ toℕ remainder + quotient * divisor\n\n-- Integer division with remainder.\n\n-- Note that Induction.Nat.<-rec is used to establish termination of\n-- division. The run-time complexity of this implementation of integer\n-- division should be linear in the size of the dividend, assuming\n-- that well-founded recursion and the equality type are optimised\n-- properly (see \"Inductive Families Need Not Store Their Indices\"\n-- (Brady, McBride, McKinna, TYPES 2003)).\n\n_divMod_ : (dividend divisor : ℕ) {≢0 : False (divisor ≟ 0)} →\n DivMod dividend divisor\n_divMod_ m n {≢0} = <-rec Pred dm m n {≢0}\n where\n Pred : ℕ → Set\n Pred dividend = (divisor : ℕ) {≢0 : False (divisor ≟ 0)} →\n DivMod dividend divisor\n\n 1+_ : ∀ {k n} → DivMod (suc k) n → DivMod (suc n + k) n\n 1+_ {k} {n} (result q r eq) = result (1 + q) r (lem₃ n k q r eq)\n\n dm : (dividend : ℕ) → <-Rec Pred dividend → Pred dividend\n dm m rec zero {≢0 = ()}\n dm zero rec (suc n) = result 0 zero refl\n dm (suc m) rec (suc n) with compare m n\n dm (suc m) rec (suc .(suc m + k)) | less .m k = result 0 r (lem₁ m k)\n where r = suc (Fin.inject+ k (fromℕ m))\n dm (suc m) rec (suc .m) | equal .m = result 1 zero (lem₂ m)\n dm (suc .(suc n + k)) rec (suc n) | greater .n k =\n 1+ rec (suc k) le (suc n)\n where le = s≤′s (s≤′s (n≤′m+n n k))\n\n-- Integer division.\n\n_div_ : (dividend divisor : ℕ) {≢0 : False (divisor ≟ 0)} → ℕ\n_div_ m n {≢0} = DivMod.quotient $ _divMod_ m n {≢0}\n\n-- The remainder after integer division.\n\n_mod_ : (dividend divisor : ℕ) {≢0 : False (divisor ≟ 0)} → Fin divisor\n_mod_ m n {≢0} = DivMod.remainder $ _divMod_ m n {≢0}\n", "meta": {"hexsha": "56030c1b6c8b44903cdd9db4979de0d7e7ac2d56", "size": 3577, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/LibSucceed/Issue846/OldDivMod.agda", "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/LibSucceed/Issue846/OldDivMod.agda", "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/LibSucceed/Issue846/OldDivMod.agda", "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.1203703704, "max_line_length": 79, "alphanum_fraction": 0.5219457646, "num_tokens": 1192, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.904650527388829, "lm_q2_score": 0.76908023177796, "lm_q1q2_score": 0.6957488372822543}} {"text": "\ndata ⊥ : Set where\n\ndata Bool : Set where\n false true : Bool\n\ndata _≡_ (x : Bool) : Bool → Set where\n refl : x ≡ x\n\ntrue≠false : false ≡ true → ⊥\ntrue≠false ()\n\ndata Maybe (A : Set) : Set where\n nothing : Maybe A\n just : A → Maybe A\n\ndata Eq {A : Set} (_≈_ : A → A → Set) : Maybe A → Maybe A → Set where\n just : ∀ {x y} (x≈y : x ≈ y) → Eq _≈_ (just x) (just y)\n nothing : Eq _≈_ nothing nothing\n\ndrop-just : ∀ {A : Set} {_≈_ : A → A → Set} {x y : A} →\n Eq _≈_ (just x) (just y) → x ≈ y\ndrop-just (just x≈y) = x≈y\n", "meta": {"hexsha": "40201d9001bfda75c1ca7191aa0018785a240376", "size": 534, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2235.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue2235.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue2235.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 22.25, "max_line_length": 69, "alphanum_fraction": 0.5280898876, "num_tokens": 225, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9324533144915913, "lm_q2_score": 0.7461389873857264, "lm_q1q2_score": 0.6957397718592202}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Groups.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Homomorphisms.Lemmas\nopen import Groups.Subgroups.Definition\nopen import Groups.Subgroups.Normal.Definition\nopen import Groups.Lemmas\n\n\nmodule Groups.Homomorphisms.Kernel {a b c d : _} {A : Set a} {B : Set b} {S : Setoid {a} {c} A} {T : Setoid {b} {d} B} {_+G_ : A → A → A} {_+H_ : B → B → B} {G : Group S _+G_} {H : Group T _+H_} {f : A → B} (fHom : GroupHom G H f) where\n\nopen Setoid T\nopen Equivalence eq\n\ngroupKernelPred : A → Set d\ngroupKernelPred a = Setoid._∼_ T (f a) (Group.0G H)\n\ngroupKernelPredWd : {x y : A} → (Setoid._∼_ S x y) → groupKernelPred x → groupKernelPred y\ngroupKernelPredWd x=y fx=0 = transitive (GroupHom.wellDefined fHom (Equivalence.symmetric (Setoid.eq S) x=y)) fx=0\n\ngroupKernelIsSubgroup : Subgroup G groupKernelPred\nSubgroup.closedUnderPlus groupKernelIsSubgroup fg=0 fh=0 = transitive (transitive (GroupHom.groupHom fHom) (Group.+WellDefined H fg=0 fh=0)) (Group.identLeft H)\nSubgroup.containsIdentity groupKernelIsSubgroup = imageOfIdentityIsIdentity fHom\nSubgroup.closedUnderInverse groupKernelIsSubgroup fg=0 = transitive (homRespectsInverse fHom) (transitive (inverseWellDefined H fg=0) (invIdent H))\nSubgroup.isSubset groupKernelIsSubgroup = groupKernelPredWd\n\ngroupKernelIsNormalSubgroup : normalSubgroup G groupKernelIsSubgroup\ngroupKernelIsNormalSubgroup {g} fk=0 = transitive (transitive (transitive (GroupHom.groupHom fHom) (transitive (Group.+WellDefined H reflexive (transitive (GroupHom.groupHom fHom) (transitive (Group.+WellDefined H fk=0 reflexive) (Group.identLeft H)))) (symmetric (GroupHom.groupHom fHom)))) (GroupHom.wellDefined fHom (Group.invRight G {g}))) (imageOfIdentityIsIdentity fHom)\n", "meta": {"hexsha": "f9dd404b2a0e77150c93456ca390df6cff5a6f7c", "size": 1856, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Homomorphisms/Kernel.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Homomorphisms/Kernel.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Homomorphisms/Kernel.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 58.0, "max_line_length": 376, "alphanum_fraction": 0.7688577586, "num_tokens": 574, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797124237604, "lm_q2_score": 0.7634837743174788, "lm_q1q2_score": 0.6956709259228075}} {"text": "module Test.Factorial where\n\nopen import Data.Nat\n\nfactorial : ℕ -> ℕ\nfactorial zero = 1\nfactorial n@(suc n') = n * factorial n'\n", "meta": {"hexsha": "822dc28ea61189244b5354cc00564fd191a2f7ea", "size": 129, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Test/Factorial.agda", "max_stars_repo_name": "yanok/normalize-via-instances", "max_stars_repo_head_hexsha": "4f037dad109a5d080023557f0869418ed9fc11c1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Test/Factorial.agda", "max_issues_repo_name": "yanok/normalize-via-instances", "max_issues_repo_head_hexsha": "4f037dad109a5d080023557f0869418ed9fc11c1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Test/Factorial.agda", "max_forks_repo_name": "yanok/normalize-via-instances", "max_forks_repo_head_hexsha": "4f037dad109a5d080023557f0869418ed9fc11c1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.125, "max_line_length": 39, "alphanum_fraction": 0.7054263566, "num_tokens": 41, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9111797100118214, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6956709142741342}} {"text": "{-# OPTIONS --without-K #-}\nmodule hott.level.sets where\n\nopen import level\nopen import decidable\nopen import sum\nopen import equality.core\nopen import equality.calculus\nopen import equality.reasoning\nopen import function.core\nopen import function.extensionality.proof\nopen import sets.empty\nopen import sets.unit\nopen import hott.level.core\n\n-- ⊤ is contractible\n⊤-contr : contr ⊤\n⊤-contr = tt , λ { tt → refl }\n\n-- ⊥ is propositional\n⊥-prop : h 1 ⊥\n⊥-prop x _ = ⊥-elim x\n\n⊥-initial : ∀ {i} {A : Set i} → contr (⊥ → A)\n⊥-initial = (λ ()) , (λ f → funext λ ())\n\n-- Hedberg's theorem\nhedberg : ∀ {i} {A : Set i}\n → ((x y : A) → Dec (x ≡ y))\n → h 2 A\nhedberg {A = A} dec x y = prop⇒h1 ≡-prop\n where\n open ≡-Reasoning\n\n canonical : {x y : A} → x ≡ y → x ≡ y\n canonical {x} {y} p with dec x y\n ... | yes q = q\n ... | no _ = p\n\n canonical-const : {x y : A}\n → (p q : x ≡ y)\n → canonical p ≡ canonical q\n canonical-const {x} {y} p q with dec x y\n ... | yes _ = refl\n ... | no f = ⊥-elim (f p)\n\n canonical-inv : {x y : A}(p : x ≡ y)\n → canonical p · sym (canonical refl) ≡ p\n canonical-inv refl = left-inverse (canonical refl)\n \n ≡-prop : {x y : A}(p q : x ≡ y) → p ≡ q\n ≡-prop p q = begin\n p\n ≡⟨ sym (canonical-inv p) ⟩\n canonical p · sym (canonical refl)\n ≡⟨ ap (λ z → z · sym (canonical refl))\n (canonical-const p q) ⟩\n canonical q · sym (canonical refl)\n ≡⟨ canonical-inv q ⟩\n q\n ∎\n\n-- Bool is a set\nprivate\n module BoolSet where\n open import sets.bool\n bool-set : h 2 Bool\n bool-set = hedberg _≟_\nopen BoolSet public\n\n-- Nat is a set\nprivate\n module NatSet where\n open import sets.nat.core\n nat-set : h 2 ℕ\n nat-set = hedberg _≟_\nopen NatSet public\n\n-- Fin is a set\nprivate\n module FinSet where\n open import sets.fin.core\n fin-set : ∀ n → h 2 (Fin n)\n fin-set n = hedberg _≟_\nopen FinSet public\n", "meta": {"hexsha": "aac92346c3084147aa0f3530e838bd14ef1215e8", "size": 1994, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "hott/level/sets.agda", "max_stars_repo_name": "HoTT/M-types", "max_stars_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 27, "max_stars_repo_stars_event_min_datetime": "2015-04-14T15:47:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-09T07:26:57.000Z", "max_issues_repo_path": "hott/level/sets.agda", "max_issues_repo_name": "HoTT/M-types", "max_issues_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2015-02-11T11:14:59.000Z", "max_issues_repo_issues_event_max_datetime": "2015-02-11T15:20:34.000Z", "max_forks_repo_path": "hott/level/sets.agda", "max_forks_repo_name": "HoTT/M-types", "max_forks_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-04-11T17:19:12.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-26T06:17:38.000Z", "avg_line_length": 23.1860465116, "max_line_length": 58, "alphanum_fraction": 0.5611835507, "num_tokens": 676, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267830311354, "lm_q2_score": 0.8006920092299292, "lm_q1q2_score": 0.6956626625779756}} {"text": "------------------------------------------------------------------------\n-- Propositional equality\n------------------------------------------------------------------------\n\nmodule Relation.Binary.PropositionalEquality1 where\n\nopen import Relation.Nullary\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl)\n\n------------------------------------------------------------------------\n-- Propositional equality\n\ninfix 4 _≡₁_ _≢₁_\n\ndata _≡₁_ {a : Set₁} (x : a) : a → Set where\n refl : x ≡₁ x\n\n-- Nonequality.\n\n_≢₁_ : {a : Set₁} → a → a → Set\nx ≢₁ y = ¬ x ≡₁ y\n\n------------------------------------------------------------------------\n-- Some properties\n\nreflexive : ∀ {a} (x : a) → x ≡₁ x\nreflexive _ = refl\n\nsym : ∀ {a} {x y : a} → x ≡₁ y → y ≡₁ x\nsym refl = refl\n\ntrans : ∀ {a} {x y z : a} → x ≡₁ y → y ≡₁ z → x ≡₁ z\ntrans refl refl = refl\n\nsubst : {a b : Set} → a ≡₁ b → a → b\nsubst refl x = x\n\ncong : ∀ {a b} (f : a → b) → ∀ {x y} → x ≡₁ y → f x ≡₁ f y\ncong _ refl = refl\n\ncong₂ : ∀ {a b c} (f : a → b → c) →\n ∀ {x₁ x₂ y₁ y₂} → x₁ ≡₁ x₂ → y₁ ≡₁ y₂ → f x₁ y₁ ≡₁ f x₂ y₂\ncong₂ _ refl refl = refl\n\ncong₀₁ : ∀ {a b} (f : a → b) → ∀ {x y} → x ≡ y → f x ≡₁ f y\ncong₀₁ _ refl = refl\n\ncong₁₀ : ∀ {a b} (f : a → b) → ∀ {x y} → x ≡₁ y → f x ≡ f y\ncong₁₀ _ refl = refl\n", "meta": {"hexsha": "40c26156d87399247601364a36013408334a08f4", "size": 1309, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Relation/Binary/PropositionalEquality1.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Relation/Binary/PropositionalEquality1.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Relation/Binary/PropositionalEquality1.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 25.6666666667, "max_line_length": 72, "alphanum_fraction": 0.4247517189, "num_tokens": 468, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110425624792, "lm_q2_score": 0.7799928951399098, "lm_q1q2_score": 0.6956062770060495}} {"text": "open import Data.Nat using (ℕ)\n\nmodule Data.BitVector.Properties.LatticeProperties (n : ℕ) where\n\nopen import Data.BitVector\nopen import Algebra.Structures\nopen import Relation.Binary.PropositionalEquality\nopen import Data.Vec\nopen import Data.Product hiding (map)\nimport Data.Bool.Properties as Bool\n\n\nprivate\n module BitProperties = IsBooleanAlgebra Bool.isBooleanAlgebra\n -- All these properties follow trivially from the bit properties. TODO: generalize the pattern to just reuse the bitproperties\n ∨-comm : ∀ {n} (x y : BitVector n) → bitwise-or x y ≡ bitwise-or y x\n ∨-comm [] [] = refl\n ∨-comm (x ∷ xs) (y ∷ ys) rewrite BitProperties.∨-comm x y | ∨-comm xs ys = refl\n\n ∧-comm : ∀ {n} (x y : BitVector n) → bitwise-and x y ≡ bitwise-and y x\n ∧-comm [] [] = refl\n ∧-comm (x ∷ xs) (y ∷ ys) rewrite BitProperties.∧-comm x y | ∧-comm xs ys = refl\n\n ∨-assoc : ∀ {n} (x y z : BitVector n) → bitwise-or (bitwise-or x y) z ≡ bitwise-or x (bitwise-or y z)\n ∨-assoc [] [] [] = refl\n ∨-assoc (x ∷ xs) (y ∷ ys) (z ∷ zs) rewrite BitProperties.∨-assoc x y z | ∨-assoc xs ys zs = refl\n\n ∧-assoc : ∀ {n} (x y z : BitVector n) → bitwise-and (bitwise-and x y) z ≡ bitwise-and x (bitwise-and y z)\n ∧-assoc [] [] [] = refl\n ∧-assoc (x ∷ xs) (y ∷ ys) (z ∷ zs) rewrite BitProperties.∧-assoc x y z | ∧-assoc xs ys zs = refl\n\n ∨∧-absorb : ∀ {n} (x y : BitVector n) → bitwise-or x (bitwise-and x y) ≡ x\n ∨∧-absorb [] [] = refl\n ∨∧-absorb (x ∷ xs) (y ∷ ys) rewrite proj₁ BitProperties.absorptive x y | ∨∧-absorb xs ys = refl\n\n ∧∨-absorb : ∀ {n} (x y : BitVector n) → bitwise-and x (bitwise-or x y) ≡ x\n ∧∨-absorb [] [] = refl\n ∧∨-absorb (x ∷ xs) (y ∷ ys) rewrite proj₂ BitProperties.absorptive x y | ∧∨-absorb xs ys = refl\n\n ∨-cong : ∀ {n} {x y u v : BitVector n} → x ≡ y → u ≡ v → bitwise-or x u ≡ bitwise-or y v\n ∨-cong refl refl = refl\n\n ∧-cong : ∀ {n} {x y u v : BitVector n} → x ≡ y → u ≡ v → bitwise-and x u ≡ bitwise-and y v\n ∧-cong refl refl = refl\n \n isLattice : ∀ {n} → IsLattice _≡_ (bitwise-or {n}) bitwise-and\n isLattice = record \n { isEquivalence = isEquivalence\n ; ∨-comm = ∨-comm\n ; ∨-assoc = ∨-assoc\n ; ∨-cong = ∨-cong\n ; ∧-comm = ∧-comm\n ; ∧-assoc = ∧-assoc\n ; ∧-cong = ∧-cong\n ; absorptive = ∨∧-absorb , ∧∨-absorb\n }\n\n ∨∧-distribʳ : ∀ {n} (x y z : BitVector n) → bitwise-or (bitwise-and y z) x ≡ bitwise-and (bitwise-or y x) (bitwise-or z x)\n ∨∧-distribʳ [] [] [] = refl\n ∨∧-distribʳ (x ∷ xs) (y ∷ ys) (z ∷ zs) rewrite BitProperties.∨-∧-distribʳ x y z | ∨∧-distribʳ xs ys zs = refl\n \n isDistributiveLattice : ∀ {n} → IsDistributiveLattice _≡_ (bitwise-or {n}) bitwise-and\n isDistributiveLattice = record\n { isLattice = isLattice\n ; ∨-∧-distribʳ = ∨∧-distribʳ\n }\n\n ∨-complementʳ : ∀ {n} (x : BitVector n) → bitwise-or x (bitwise-negation x) ≡ ones n\n ∨-complementʳ [] = refl\n ∨-complementʳ (x ∷ xs) rewrite BitProperties.∨-complementʳ x | ∨-complementʳ xs = refl\n\n ∧-complementʳ : ∀ {n} (x : BitVector n) → bitwise-and x (bitwise-negation x) ≡ zero n\n ∧-complementʳ [] = refl\n ∧-complementʳ (x ∷ xs) rewrite BitProperties.∧-complementʳ x | ∧-complementʳ xs = refl\n\n ¬-cong : ∀ {n} {i j : BitVector n} → i ≡ j → bitwise-negation i ≡ bitwise-negation j\n ¬-cong refl = refl\n\n\n\n\n\nisBooleanAlgebra : ∀ {n} → IsBooleanAlgebra _≡_ bitwise-or bitwise-and bitwise-negation (ones n) (zero n)\nisBooleanAlgebra = record\n { isDistributiveLattice = isDistributiveLattice\n ; ∨-complementʳ = ∨-complementʳ\n ; ∧-complementʳ = ∧-complementʳ\n ; ¬-cong = ¬-cong\n }\n", "meta": {"hexsha": "00ee8d7974418fec6a37be61c72696ea3c16e4f7", "size": 3524, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/BitVector/Properties/LatticeProperties.agda", "max_stars_repo_name": "copumpkin/bitvector", "max_stars_repo_head_hexsha": "6902f4bce0330f1b58f48395dac4406056713687", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-01-04T07:19:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-12T01:41:07.000Z", "max_issues_repo_path": "Data/BitVector/Properties/LatticeProperties.agda", "max_issues_repo_name": "copumpkin/bitvector", "max_issues_repo_head_hexsha": "6902f4bce0330f1b58f48395dac4406056713687", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2016-05-25T02:00:59.000Z", "max_issues_repo_issues_event_max_datetime": "2016-05-25T02:00:59.000Z", "max_forks_repo_path": "Data/BitVector/Properties/LatticeProperties.agda", "max_forks_repo_name": "copumpkin/bitvector", "max_forks_repo_head_hexsha": "6902f4bce0330f1b58f48395dac4406056713687", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-05-25T00:15:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-12T01:40:57.000Z", "avg_line_length": 39.1555555556, "max_line_length": 128, "alphanum_fraction": 0.6177639047, "num_tokens": 1402, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887587875995483, "lm_q2_score": 0.7826624840223699, "lm_q1q2_score": 0.6955981603993724}} {"text": "{-# OPTIONS --universe-polymorphism #-}\n-- {-# OPTIONS --verbose tc.records.ifs:15 #-}\n-- {-# OPTIONS --verbose tc.constr.findInScope:15 #-}\n-- {-# OPTIONS --verbose tc.term.args.ifs:15 #-}\n-- {-# OPTIONS --verbose cta.record.ifs:15 #-}\n-- {-# OPTIONS --verbose tc.section.apply:25 #-}\n-- {-# OPTIONS --verbose tc.mod.apply:100 #-}\n-- {-# OPTIONS --verbose scope.rec:15 #-}\n-- {-# OPTIONS --verbose tc.rec.def:15 #-}\n\nmodule 04-equality where\n\nrecord ⊤ : Set where\n constructor tt\n\ndata Bool : Set where\n true : Bool\n false : Bool\n\nor : Bool → Bool → Bool\nor true _ = true\nor _ true = true\nor false false = false\n\nand : Bool → Bool → Bool\nand false _ = false\nand _ false = false\nand true true = false\n\nnot : Bool → Bool\nnot true = false\nnot false = true\n\nid : {A : Set} → A → A\nid v = v\n\nprimEqBool : Bool → Bool → Bool\nprimEqBool true = id\nprimEqBool false = not\n\nrecord Eq (A : Set) : Set where\n field eq : A → A → Bool\n\n\neqBool : Eq Bool\neqBool = record { eq = primEqBool }\n\nopen Eq {{...}}\n\nneq : {t : Set} → {{eqT : Eq t}} → t → t → Bool\nneq a b = not (eq a b)\n\ntest = eq false false\n\n\n-- Instance arguments will also resolve to candidate instances which\n-- still require hidden arguments. This allows us to define a\n-- reasonable instance for Fin types\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n\n{-# BUILTIN NATURAL ℕ #-}\n\ndata Fin : ℕ → Set where\n zero : {n : ℕ} → Fin (suc n)\n suc : {n : ℕ} → Fin n → Fin (suc n)\n\n\n\nprimEqFin : {n : ℕ} → Fin n → Fin n → Bool\nprimEqFin zero zero = true\nprimEqFin zero (suc y) = false\nprimEqFin (suc y) zero = false\nprimEqFin (suc x) (suc y) = primEqFin x y\n\neqFin : {n : ℕ} → Eq (Fin n)\neqFin = record { eq = primEqFin }\n\n-- eqFin′ : Eq (Fin 3)\n-- eqFin′ = record { eq = primEqFin }\n\n-- eqFinSpecial : {n : ℕ} → Prime n → Eq (Fin n)\n-- eqFinSpecial\n\nfin1 : Fin 3\nfin1 = zero\n\nfin2 : Fin 3\nfin2 = suc (suc zero)\n\ntestFin : Bool\ntestFin = eq fin1 fin2\n", "meta": {"hexsha": "8c4a3b4f7249620cee4f11bf54b82eb0620754ff", "size": 1902, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/instance-arguments/04-equality.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "examples/instance-arguments/04-equality.agda", "max_issues_repo_name": "larrytheliquid/agda", "max_issues_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/instance-arguments/04-equality.agda", "max_forks_repo_name": "larrytheliquid/agda", "max_forks_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 20.2340425532, "max_line_length": 68, "alphanum_fraction": 0.6177707676, "num_tokens": 621, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887587905460026, "lm_q2_score": 0.7826624688140726, "lm_q1q2_score": 0.6955981491889437}} {"text": "module Definitions where\n\ndata ℕ : Set where\n zero : ℕ\n suc : (n : ℕ) → ℕ\n\ndata _≡_ (x : ℕ) : ℕ → Set where\n refl : x ≡ x\n\ndata _≢_ : ℕ → ℕ → Set where\n z≢s : ∀ {n} → zero ≢ suc n\n s≢z : ∀ {n} → suc n ≢ zero\n s≢s : ∀ {m n} → m ≢ n → suc m ≢ suc n\n\ndata Equal? (m n : ℕ) : Set where\n yes : m ≡ n → Equal? m n\n no : m ≢ n → Equal? m n\n\ndata ⊥ : Set where\n", "meta": {"hexsha": "dd49f1bd3528e36eb876e291eb75c01ec8e44207", "size": 363, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "problems/NatEquality/Definitions.agda", "max_stars_repo_name": "danr/agder", "max_stars_repo_head_hexsha": "ece25bed081a24f02e9f85056d05933eae2afabf", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-05-17T12:07:03.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-17T12:07:03.000Z", "max_issues_repo_path": "problems/NatEquality/Definitions.agda", "max_issues_repo_name": "danr/agder", "max_issues_repo_head_hexsha": "ece25bed081a24f02e9f85056d05933eae2afabf", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "problems/NatEquality/Definitions.agda", "max_forks_repo_name": "danr/agder", "max_forks_repo_head_hexsha": "ece25bed081a24f02e9f85056d05933eae2afabf", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.15, "max_line_length": 39, "alphanum_fraction": 0.4848484848, "num_tokens": 169, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9284088045171237, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6954591744078944}} {"text": "module ICFPPrelude where\n\nrecord ⊤ : Set where\n constructor ⟨⟩\n\ndata ⊥ : Set where\n\n¬_ : Set → Set\n¬_ A = A → ⊥\n\ndata Nat : Set where\n zero : Nat\n suc : Nat → Nat\n\n{-# BUILTIN NATURAL Nat #-}\n\n_+_ : Nat → Nat → Nat\nzero + n = n\nsuc m + n = suc (m + n)\n\ninfixr 2 _∪_\ndata _∪_ A B : Set where\n inl : A → A ∪ B\n inr : B → A ∪ B\n\ndata _≡_ {a}{A : Set a}(x : A) : A → Set a where\n refl : x ≡ x\n\n{-# BUILTIN EQUALITY _≡_ #-}\n{-# BUILTIN REFL refl #-}\n", "meta": {"hexsha": "464ae51035c7fc5419e7b10d07ab18a68e87efd2", "size": 452, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "explore/typecheck/ICFPPrelude.agda", "max_stars_repo_name": "enlambdment/disco", "max_stars_repo_head_hexsha": "6c7561bcc9877c6df9107f12f7e843f4e880189a", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 138, "max_stars_repo_stars_event_min_datetime": "2016-12-10T08:10:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-22T22:56:45.000Z", "max_issues_repo_path": "explore/typecheck/ICFPPrelude.agda", "max_issues_repo_name": "enlambdment/disco", "max_issues_repo_head_hexsha": "6c7561bcc9877c6df9107f12f7e843f4e880189a", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 282, "max_issues_repo_issues_event_min_datetime": "2016-11-19T18:05:42.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T21:43:15.000Z", "max_forks_repo_path": "explore/typecheck/ICFPPrelude.agda", "max_forks_repo_name": "enlambdment/disco", "max_forks_repo_head_hexsha": "6c7561bcc9877c6df9107f12f7e843f4e880189a", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 20, "max_forks_repo_forks_event_min_datetime": "2017-02-18T20:36:05.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-30T05:37:45.000Z", "avg_line_length": 14.5806451613, "max_line_length": 48, "alphanum_fraction": 0.5376106195, "num_tokens": 186, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8976952975813453, "lm_q2_score": 0.7745833893685269, "lm_q1q2_score": 0.6953398662207467}} {"text": "{-# OPTIONS -v treeless:20 #-}\nmodule _ where\n\ndata N : Set where\n zero : N\n suc : N → N\n\n_+_ : N → N → N\nzero + n = n\nsuc m + n = suc (m + n)\n\nrecord P A B : Set where\n constructor _,_\n field fst : A\n snd : B\n\nopen P\n\n{-# INLINE fst #-}\n{-# INLINE snd #-}\n\n-- Without handling repeated cases:\n-- g = λ a → case a of b , c → b (case a of d , e → e)\n-- Should be\n-- g = λ a → case a of b , c → b c\ng : P (N → N) N → N\ng z = fst z (snd z)\n", "meta": {"hexsha": "7fe391ef18e355b7e1318bebc1f4a7015d83a27a", "size": 448, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/RepeatedCase.agda", "max_stars_repo_name": "asr/eagda", "max_stars_repo_head_hexsha": "7220bebfe9f64297880ecec40314c0090018fdd0", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-03-17T01:45:59.000Z", "max_stars_repo_stars_event_max_datetime": "2016-03-17T01:45:59.000Z", "max_issues_repo_path": "test/Succeed/RepeatedCase.agda", "max_issues_repo_name": "asr/eagda", "max_issues_repo_head_hexsha": "7220bebfe9f64297880ecec40314c0090018fdd0", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/RepeatedCase.agda", "max_forks_repo_name": "asr/eagda", "max_forks_repo_head_hexsha": "7220bebfe9f64297880ecec40314c0090018fdd0", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 16.0, "max_line_length": 54, "alphanum_fraction": 0.5111607143, "num_tokens": 163, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278664544912, "lm_q2_score": 0.7879311906630568, "lm_q1q2_score": 0.6952924394897482}} {"text": "module Logic.DiagonalMethod where\n\nopen import Functional\nopen import Logic.Predicate\nopen import Logic.Propositional\nimport Lvl\nopen import Relator.Equals\nopen import Relator.Equals.Proofs\nopen import Structure.Function.Domain\nopen import Structure.Operator\nopen import Structure.Relator.Properties\nopen import Syntax.Function\nopen import Type.Size\nopen import Type\n\nprivate variable ℓ : Lvl.Level\nprivate variable T A B : Type{ℓ}\n\n-- Also called: Diagonal method, Cantor's diagonal argument.\nfunction-type-surjectivity-fixpoint : (A ≽ (A → B)) → ∀{f : B → B} → ∃(Fixpoint f)\nfunction-type-surjectivity-fixpoint ([∃]-intro s) {f}\n with [∃]-intro i ⦃ p ⦄ ← surjective(s) {f ∘ (s $₂_)}\n = [∃]-intro(s i i) ⦃ intro(symmetry(_≡_) (congruence₂ₗ(_$_)(i) p)) ⦄\n\nmodule _ where\n open import Data.Boolean\n open import Data.Boolean.Proofs\n\n decidable-power-set-no-surjection : ¬(T ≽ (T → Bool))\n decidable-power-set-no-surjection = (p ↦ [!]-no-fixpoints(Fixpoint.proof([∃]-proof(p{not})))) ∘ function-type-surjectivity-fixpoint\n\nmodule _ where\n open import Data.Boolean\n open import Data.Boolean.Proofs\n open import Function.Inverseᵣ\n open import Structure.Function.Domain.Proofs\n open import Structure.Function\n open import Syntax.Transitivity\n\n function-type-no-surjection : (B ≽ Bool) → ¬(A ≽ (A → B))\n function-type-no-surjection ([∃]-intro r-bool) surj\n with [∃]-intro i ⦃ fix ⦄ ← function-type-surjectivity-fixpoint surj {invᵣ r-bool ⦃ surjective-to-invertibleᵣ ⦄ ∘ not ∘ r-bool}\n = [!]-no-fixpoints(symmetry(_≡_) (Inverseᵣ.proof surjective-to-inverseᵣ) 🝖 congruence₁(r-bool) (Fixpoint.proof fix))\n\nmodule _ where\n open import Numeral.Natural\n open import Numeral.Natural.Oper.Proofs\n\n ℕ-function-non-surjectivity : ¬(ℕ ≽ (ℕ → ℕ))\n ℕ-function-non-surjectivity = (p ↦ 𝐒-not-self(Fixpoint.proof([∃]-proof(p{𝐒})))) ∘ function-type-surjectivity-fixpoint\n", "meta": {"hexsha": "0cd7b0ce0d37e0ed0c639b2c6c74d9dff26f6e39", "size": 1876, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Logic/DiagonalMethod.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Logic/DiagonalMethod.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Logic/DiagonalMethod.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.7843137255, "max_line_length": 133, "alphanum_fraction": 0.723347548, "num_tokens": 594, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.882427857178614, "lm_q2_score": 0.7879311956428946, "lm_q1q2_score": 0.6952924365753428}} {"text": "----------------------------------------------------------------------\n-- Copyright: 2013, Jan Stolarek, Lodz University of Technology --\n-- --\n-- License: See LICENSE file in root of the repo --\n-- Repo address: https://github.com/jstolarek/dep-typed-wbl-heaps --\n-- --\n-- Refl datatype and functions required for equational reasoning. --\n----------------------------------------------------------------------\n\nmodule Basics.Reasoning where\n\nopen import Basics.Nat hiding (_≥_)\nopen import Basics.Ordering\n\n-- Basic definition we will need in our proofs is propositional\n-- equality (known as refl). Unlike refl definition provided by Agda's\n-- standard library the definition below is not universe\n-- polymorphic. It works only on Set, but not on Set1 and higher Sets\n-- - this will be perfectly sufficient for our purposes. This datatype\n-- allows to express equality between types belonging to Set.\ndata _≡_ {S : Set} (s : S) : S → Set where\n refl : s ≡ s\n\ninfixl 1 _≡_\n\n-- Below we prove basic properties of relations: symmetry,\n-- transitivity, congruence and substitution. If these proofs are not\n-- familiar I encourage to take a look at tutorials on Agda Wiki. The\n-- most useful source in my opinion are the online lecture notes for\n-- the Computer Aided Formal Reasoning course by Thorsten Altenkirch:\n--\n-- http://www.cs.nott.ac.uk/~txa/g53cfr/\nsym : {A : Set} → {a b : A} → a ≡ b → b ≡ a\nsym refl = refl\n\ntrans : {A : Set}{a b c : A} → a ≡ b → b ≡ c → a ≡ c\ntrans refl refl = refl\n\ncong : {A B : Set} (f : A → B) → ∀ {a b} → a ≡ b → f a ≡ f b\ncong f refl = refl\n\nsubst : {A : Set}(P : A → Set) → {a b : A} → a ≡ b → P a → P b\nsubst prp refl p = p\n\n-- We prove some basic properties of addition that we will need later\n-- in more complex proofs. I assume that you had previous exposure to\n-- these basic proofs, but nevertheless I provide extensive\n-- explanations. Make sure you understand how these proofs work before\n-- proceeding with rest of the paper.\n\n-- Note [0 is right identity of addition]\n-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n--\n-- The fact that 0 is left identity of addition (ie. 0 + a ≡ a)\n-- follows directly from our definition of _+_:\n--\n-- _+_ : Nat → Nat → Nat\n-- zero + m = m\n-- suc n + m = suc (n + m)\n--\n-- But we need a separate proof that 0 is also right identity of\n-- addition, ie. a + 0 ≡ a. Proof proceeds by induction on a. If a is\n-- zero then we have:\n--\n-- 0 + 0 = 0\n--\n-- And the proof follows from the definition of addition - hence we\n-- use refl. In a recursive case we have:\n--\n-- (suc a) + zero ≡ (suc a)\n--\n-- Applying definition of addition to LHS we have:\n--\n-- suc (a + zero) ≡ suc a\n--\n-- Since we have suc on both sides of the equality, we use\n-- congruence. This leaves us with a proof that equality holds for the\n-- parameters of suc:\n--\n-- a + zero ≡ a\n--\n-- But that happens to be the equality we are proving at the\n-- moment. We therefore make a recursive call to (+0 a), which is\n-- equivalent of applying inductive hypothesis in an inductive proof.\n--\n-- ∎\n\n+0 : (a : Nat) → a + zero ≡ a -- See Note [0 is right identity of addition]\n+0 zero = refl\n+0 (suc a) = cong suc (+0 a)\n\n-- Note [1 + (a + b) equals a + (1 + b)]\n-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n--\n-- We will need this property surprisingly often. We proceed by\n-- inductive proof on a. In the base case, when a = 0, we have:\n--\n-- suc (0 + b) ≡ 0 + (suc b)\n--\n-- Applying definition of + to both sides of equality we get:\n--\n-- suc b ≡ suc b\n--\n-- Which is true by definition, hence we use refl. In the recursive\n-- case we have:\n--\n-- suc ((suc a) + b) ≡ (suc a) + (suc b)\n--\n-- We apply definition of + to both sides and get:\n--\n-- suc (suc (a + b)) ≡ suc (a + (suc b))\n--\n-- Again, since we have suc on both sides we use congruence and are\n-- left with a proof:\n--\n-- suc (a + b) ≡ a + (suc b)\n--\n-- Which again is the equality we are proving. We appeal to inductive\n-- hypothesis by making a recursive call.\n--\n-- ∎\n\n+suc : (a b : Nat) → suc (a + b) ≡ a + (suc b)\n+suc zero b = refl\n+suc (suc a) b = cong suc (+suc a b)\n\n-- Note [Commutativity of addition]\n-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n--\n-- Everyone knows that a + b ≡ b + a. But Agda won't take our word and\n-- requires a formal proof. Let's proceed by induction on second\n-- argument. In the base case we have:\n--\n-- a + 0 ≡ 0 + a\n--\n-- Right side reduces by the definition of + which leaves us with\n--\n-- a + 0 ≡ a\n--\n-- We proved that earlier so we appeal to already existing proof. In\n-- the inductive case we have:\n--\n-- a + suc b ≡ (suc b) + a [1]\n--\n-- Right hand side reduces by definition of + giving us:\n--\n-- a + suc b ≡ suc (b + a) [2]\n--\n-- [2] is therefore the equality we have to prove. From +suc we know\n-- that\n--\n-- suc (a + b) ≡ a + (suc b) [3]\n--\n-- And we can use that to transform left hand side of [1]. Note\n-- however that in order to apply [3] to left hand side of [1] we need\n-- to reverse sides of the equality [3]:\n--\n-- a + (suc b) ≡ suc (a + b) [4]\n--\n-- We achieve this by using symmetry.\n--\n-- Looking at right hand sides of [2] and [4] we see they differ by\n-- the order of arguments to +. We can prove them equal by using\n-- congruence on suc and appealing to our inductive hypothesis of\n-- commutativity of addition. This means we have proven two things:\n--\n-- a + (suc b) ≡ suc (a + b) [4, repeated], from symmetry of +suc\n-- suc (a + b) ≡ suc (b + a) [5], from congruence on suc and\n-- inductive hypothesis\n--\n-- Combining [4] and [5] using transitivity yields the proof of [2].\n--\n-- ∎\n--\n-- Here is a diagram, showing how code relates to the proof:\n--\n-- a + b ≡ b + a\n-- ____|____\n-- / \\\n-- trans (sym (+suc a b)) (cong suc (+comm a b))\n-- ̲\\_____________/ \\__________________/\n-- | |\n-- a + (suc b) ≡ suc (a + b) |\n-- suc (a + b) ≡ suc (b + a)\n\n+comm : (a b : Nat) → a + b ≡ b + a\n+comm a zero = +0 a\n+comm a (suc b) = trans (sym (+suc a b)) (cong suc (+comm a b))\n\n-- Note [Associativity of addition]\n-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n--\n-- We proceed by induction on the first parameter. In the base case we\n-- have a = 0:\n--\n-- 0 + (b + c) ≡ (0 + b) + c\n--\n-- Both sides can be normalized using the definition of + giving us\n--\n-- b + c ≡ b + c\n--\n-- Since this is true by definition we use refl. In the inductive case\n-- we have to prove:\n--\n-- suc a + (b + c) ≡ (suc a + b) + c\n--\n-- Again, Agda normalizes each side using definition of + :\n--\n-- LHS: suc a + (b + c) ≡ suc (a + (b + c))\n-- RHS: (suc a + b) + c ≡ suc (a + b) + c ≡ suc ((a + b) + c)\n--\n-- This means we have to prove:\n--\n-- suc (a + (b + c)) ≡ suc ((a + b) + c)\n--\n-- We can use congruence to remove the outer suc on both sides which\n-- leaves us with a proof of:\n--\n-- a + (b + c) ̄≡ (a + b) + c\n--\n-- Which happens to be our inductive hypothesis - hence a recursive\n-- call to +assoc.\n--\n-- ∎\n\n+assoc : (a b c : Nat) → a + (b + c) ≡ (a + b) + c\n+assoc zero b c = refl\n+assoc (suc a) b c = cong suc (+assoc a b c)\n\n-- Note [If numbers are equal they are in the greater-equal relation]\n-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n--\n-- Finally, we need a proof that if a = b then a ≥ b. This property is\n-- specific to our task, so you most likely haven't seen it other\n-- tutorials. There are three interesting things in this proof:\n--\n-- 1) a value of type m ≥ n proves that m is greater-equal than n. We\n-- therefore need to construct the value of this type.\n--\n-- 2) since refl is the only constructor of type ≡ we always use refl\n-- when pattern matching on a value of ≡. We also always pass refl\n-- as a value of ≡ in calls.\n--\n-- 3) we need to match on implicit parameters to construct a\n-- proof. Note that although type signature specifies Nats m and\n-- n, in the proof we require that these are always equal. This\n-- requirement comes from the fact that m ≡ n, i.e. that m and n\n-- are equal.\n--\n-- In the base case we need to construct a proof that 0 ≥ 0, which we\n-- do by using ge0. Inductive case simply applies geS to result of\n-- recursive call to ≥sym.\n\n≥sym : {m n : Nat} → m ≡ n → m ≥ n\n≥sym {zero} {zero} refl = ge0\n≥sym {.(suc n)} {(suc n)} refl = geS (≥sym {n} {n} refl)\n", "meta": {"hexsha": "291da66f49ad32ab1c3bd193766cfc0a7fa7e243", "size": 8624, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Basics/Reasoning.agda", "max_stars_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_stars_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-05-02T21:48:43.000Z", "max_stars_repo_stars_event_max_datetime": "2018-05-02T21:48:43.000Z", "max_issues_repo_path": "src/Basics/Reasoning.agda", "max_issues_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_issues_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Basics/Reasoning.agda", "max_forks_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_forks_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.5564202335, "max_line_length": 75, "alphanum_fraction": 0.5716604824, "num_tokens": 2531, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8577681158979307, "lm_q2_score": 0.8104789086703225, "lm_q1q2_score": 0.6952029664651536}} {"text": "------------------------------------------------------------------------------\n-- First-order Peano arithmetic\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule PA.Inductive.README where\n\n-- Formalization of first-order Peano arithmetic using Agda data types\n-- and primitive recursive functions for addition and multiplication.\n\n------------------------------------------------------------------------------\n-- Inductive definitions\nopen import PA.Inductive.Base\n\n-- Some properties\nopen import PA.Inductive.PropertiesATP\nopen import PA.Inductive.PropertiesI\n\nopen import PA.Inductive.PropertiesByInduction\nopen import PA.Inductive.PropertiesByInductionATP\nopen import PA.Inductive.PropertiesByInductionI\n", "meta": {"hexsha": "138593e91b1626bdc30726bbca96d1622785ac40", "size": 916, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/PA/Inductive/README.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/PA/Inductive/README.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/PA/Inductive/README.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 35.2307692308, "max_line_length": 78, "alphanum_fraction": 0.5502183406, "num_tokens": 151, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8577681049901037, "lm_q2_score": 0.8104789063814616, "lm_q1q2_score": 0.695202955661278}} {"text": "\n-- Generalized variables in datatype (and record) parameters\n\nmodule _ where\n\nopen import Agda.Primitive\nopen import Agda.Builtin.Nat\n\nmodule NotParameterised where\n\n variable\n ℓ : Level\n A : Set ℓ\n x y : A\n m n : Nat\n\n data Vec (A : Set ℓ) : Nat → Set ℓ where\n [] : Vec A zero\n _∷_ : A → Vec A n → Vec A (suc n)\n\n variable\n xs : Vec A n\n\n -- n should be generalized as an index here\n data All (P : A → Set ℓ) : Vec A n → Set ℓ where\n [] : All P []\n _∷_ : P x → All P xs → All P (x ∷ xs)\n\n infix 2 _∈_\n -- need an occurrence of ℓ in the params to not generalize it as an index,\n -- so we bind A explicitly\n data _∈_ {A : Set ℓ} (x : A) : Vec A n → Set ℓ where\n zero : x ∈ x ∷ xs\n suc : x ∈ xs → x ∈ y ∷ xs\n\n lookup : {P : A → Set ℓ} → All P xs → x ∈ xs → P x\n lookup (x ∷ _) zero = x\n lookup (_ ∷ xs) (suc i) = lookup xs i\n\n-- Check that we can do the same in a parameterised module\nmodule Parameterised (Dummy : Set) where\n\n variable\n ℓ : Level\n A : Set ℓ\n x y : A\n m n : Nat\n\n data Vec (A : Set ℓ) : Nat → Set ℓ where\n [] : Vec A zero\n _∷_ : A → Vec A n → Vec A (suc n)\n\n variable\n xs : Vec A n\n\n -- n should be generalized as an index here\n data All (P : A → Set ℓ) : Vec A n → Set ℓ where\n [] : All P []\n _∷_ : P x → All P xs → All P (x ∷ xs)\n\n infix 2 _∈_\n -- need an occurrence of ℓ in the params to not generalize it as an index,\n -- so we bind A explicitly\n data _∈_ {A : Set ℓ} (x : A) : Vec A n → Set ℓ where\n zero : x ∈ x ∷ xs\n suc : x ∈ xs → x ∈ y ∷ xs\n\n lookup : {P : A → Set ℓ} → All P xs → x ∈ xs → P x\n lookup (x ∷ _) zero = x\n lookup (_ ∷ xs) (suc i) = lookup xs i\n", "meta": {"hexsha": "dcbe4853d786413d9d8249b745de852e217a1e57", "size": 1687, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue3296.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue3296.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue3296.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 23.7605633803, "max_line_length": 76, "alphanum_fraction": 0.5489033788, "num_tokens": 637, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8577680977182187, "lm_q2_score": 0.8104789063814616, "lm_q1q2_score": 0.6952029497675686}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.NaturalTransformation.NaturalIsomorphism.Equivalence where\n\n-- a certain notion of equivalence between Natural Isomorphisms.\n\nopen import Level\nopen import Data.Product using (_×_; _,_; map; zip)\nopen import Relation.Binary using (IsEquivalence)\n\nopen import Categories.Category\nopen import Categories.Functor using (Functor)\nopen import Categories.NaturalTransformation.NaturalIsomorphism hiding (_≃_)\nopen import Categories.NaturalTransformation.Equivalence\nopen NaturalIsomorphism\n\nprivate\n variable\n o ℓ e o′ ℓ′ e′ : Level\n C D : Category o ℓ e\n\ninfix 4 _≅_\n_≅_ : ∀ {F G : Functor C D} → (α β : NaturalIsomorphism F G) → Set _\nα ≅ β = F⇒G α ≃ F⇒G β × F⇐G α ≃ F⇐G β\n\n≅-isEquivalence : ∀ {F G : Functor C D} → IsEquivalence (_≅_ {F = F} {G = G})\n≅-isEquivalence {D = D} {F = F} {G = G} = record\n { refl = H.refl , H.refl\n ; sym = map (λ z → H.sym z) (λ z → H.sym z) -- eta expansion needed\n ; trans = zip (λ a b → H.trans a b) λ a b → H.trans a b -- ditto\n }\n where module H = Category.HomReasoning D\n", "meta": {"hexsha": "3a21fd58d9283c62191600b3e4d0210c3f235824", "size": 1072, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Equivalence.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Equivalence.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Equivalence.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.5, "max_line_length": 77, "alphanum_fraction": 0.6828358209, "num_tokens": 354, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9173026550642019, "lm_q2_score": 0.757794360334681, "lm_q1q2_score": 0.6951267787276814}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.NatSolver.NatExpression where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.FinData\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Nat.Order using (zero-≤)\nopen import Cubical.Data.Vec.Base\n\ninfixl 6 _+'_\ninfixl 7 _·'_\n\n-- Expression in a ring on A with n variables\ndata Expr (n : ℕ) : Type ℓ-zero where\n K : ℕ → Expr n\n ∣ : Fin n → Expr n\n _+'_ : Expr n → Expr n → Expr n\n _·'_ : Expr n → Expr n → Expr n\n\nmodule Eval where\n open import Cubical.Data.Vec\n\n ⟦_⟧ : ∀ {n} → Expr n → Vec ℕ n → ℕ\n ⟦ K r ⟧ v = r\n ⟦ ∣ k ⟧ v = lookup k v\n ⟦ x +' y ⟧ v = ⟦ x ⟧ v + ⟦ y ⟧ v\n ⟦ x ·' y ⟧ v = ⟦ x ⟧ v · ⟦ y ⟧ v\n", "meta": {"hexsha": "7c9e4edd58349bedcf15320d2536d395a371b5af", "size": 684, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/NatSolver/NatExpression.agda", "max_stars_repo_name": "FernandoLarrain/cubical", "max_stars_repo_head_hexsha": "9acdecfa6437ec455568be4e5ff04849cc2bc13b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-03-05T00:28:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T00:28:39.000Z", "max_issues_repo_path": "Cubical/Algebra/NatSolver/NatExpression.agda", "max_issues_repo_name": "Seanpm2001-web/cubical", "max_issues_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/NatSolver/NatExpression.agda", "max_forks_repo_name": "Seanpm2001-web/cubical", "max_forks_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.5862068966, "max_line_length": 52, "alphanum_fraction": 0.6096491228, "num_tokens": 265, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.913676530465412, "lm_q2_score": 0.7606506526772883, "lm_q1q2_score": 0.6949886492344358}} {"text": "module Data.List.Relation where\n\nimport Lvl\nimport Data\nopen import Data.List\nopen import Logic\nopen import Logic.Propositional\nopen import Structure.Setoid\nopen import Type\n\nprivate variable ℓ ℓₑ ℓₑ₁ ℓₑ₂ : Lvl.Level\nprivate variable T : Type{ℓ}\n\ndata Empty {ℓ}{T : Type{ℓ}} : List(T) → Stmt{Lvl.𝐒(ℓ)} where\n intro : Empty(∅)\n\n-- Statement of whether a list is contained in the beginning of another list\n_isPrefixOf_ : ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → List(T) → List(T) → Stmt{Lvl.of(T) Lvl.⊔ ℓₑ}\n∅ isPrefixOf _ = Data.Unit\n(p ⊰ prefix) isPrefixOf ∅ = Data.Empty\n(p ⊰ prefix) isPrefixOf (x ⊰ l) = (p ≡ x) ∧ (prefix isPrefixOf l)\n-- _isPrefixOf_ prefix l = (∃ \\rest → l ≡ (prefix ++ rest))\n\n-- Statement of whether a list is contained in the end of another list\n_isSuffixOf_ : ⦃ equiv : Equiv{ℓₑ₁}(T) ⦄ → ⦃ equiv-list : Equiv{ℓₑ₂}(List(T)) ⦄ → List(T) → List(T) → Stmt{Lvl.of(T) Lvl.⊔ ℓₑ₁ Lvl.⊔ ℓₑ₂}\n∅ isSuffixOf _ = Data.Unit\n(p ⊰ prefix) isSuffixOf ∅ = Data.Empty\n(p ⊰ prefix) isSuffixOf (x ⊰ l) = ((p ⊰ prefix) isSuffixOf l) ∨ ((p ⊰ prefix) ≡ (x ⊰ l))\n-- _isSuffixOf_ suffix l = (∃ \\rest → l ≡ (rest ++ suffix))\n", "meta": {"hexsha": "70e9bd55f345f5da1107e9db579fcccf5ec04f68", "size": 1165, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/List/Relation.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/List/Relation.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/List/Relation.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.8333333333, "max_line_length": 137, "alphanum_fraction": 0.6283261803, "num_tokens": 448, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942119105695, "lm_q2_score": 0.7690802476562641, "lm_q1q2_score": 0.6947057362026507}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.Definition\n\n\nmodule Rings.Units.Lemmas {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) where\n\nopen import Rings.Units.Definition R\nopen import Rings.Ideals.Definition R\n\nopen Ring R\nopen Setoid S\nopen Equivalence eq\n\nunitImpliesGeneratedIdealEverything : {x : A} → Unit x → {y : A} → generatedIdealPred x y\nunitImpliesGeneratedIdealEverything {x} (a , xa=1) {y} = (a * y) , transitive *Associative (transitive (*WellDefined xa=1 reflexive) identIsIdent)\n", "meta": {"hexsha": "0b1dfbb1991d9ca6211a1be6f28d42678048a95c", "size": 658, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Units/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Units/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Units/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 32.9, "max_line_length": 146, "alphanum_fraction": 0.7203647416, "num_tokens": 202, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099070060380482, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6946992254543473}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Definition\nopen import Rings.Definition\nopen import Rings.Homomorphisms.Definition\nopen import Rings.IntegralDomains.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\n\nmodule Fields.FieldOfFractions.Lemmas {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (I : IntegralDomain R) where\n\nopen import Fields.FieldOfFractions.Setoid I\nopen import Fields.FieldOfFractions.Ring I\n\nembedIntoFieldOfFractions : A → fieldOfFractionsSet\nembedIntoFieldOfFractions a = record { num = a ; denom = Ring.1R R ; denomNonzero = IntegralDomain.nontrivial I }\n\nhomIntoFieldOfFractions : RingHom R fieldOfFractionsRing embedIntoFieldOfFractions\nRingHom.preserves1 homIntoFieldOfFractions = Equivalence.reflexive (Setoid.eq S)\nRingHom.ringHom homIntoFieldOfFractions {a} {b} = Equivalence.transitive (Setoid.eq S) (Ring.*WellDefined R (Equivalence.reflexive (Setoid.eq S)) (Ring.identIsIdent R)) (Ring.*Commutative R)\nGroupHom.groupHom (RingHom.groupHom homIntoFieldOfFractions) {x} {y} = need\n where\n open Setoid S\n open Equivalence eq\n need : ((x + y) * (Ring.1R R * Ring.1R R)) ∼ (Ring.1R R * ((x * Ring.1R R) + (Ring.1R R * y)))\n need = transitive (transitive (Ring.*WellDefined R reflexive (Ring.identIsIdent R)) (transitive (Ring.*Commutative R) (transitive (Ring.identIsIdent R) (Group.+WellDefined (Ring.additiveGroup R) (symmetric (transitive (Ring.*Commutative R) (Ring.identIsIdent R))) (symmetric (Ring.identIsIdent R)))))) (symmetric (Ring.identIsIdent R))\nGroupHom.wellDefined (RingHom.groupHom homIntoFieldOfFractions) x=y = transitive (Ring.*Commutative R) (Ring.*WellDefined R reflexive x=y)\n where\n open Equivalence (Setoid.eq S)\n\nhomIntoFieldOfFractionsIsInj : SetoidInjection S fieldOfFractionsSetoid embedIntoFieldOfFractions\nSetoidInjection.wellDefined homIntoFieldOfFractionsIsInj x=y = transitive (Ring.*Commutative R) (Ring.*WellDefined R reflexive x=y)\n where\n open Equivalence (Setoid.eq S)\nSetoidInjection.injective homIntoFieldOfFractionsIsInj x~y = transitive (symmetric identIsIdent) (transitive *Commutative (transitive x~y identIsIdent))\n where\n open Ring R\n open Setoid S\n open Equivalence eq\n", "meta": {"hexsha": "0f9f912bd262b61195d5184363e7eeaf9084660d", "size": 2359, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Fields/FieldOfFractions/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Fields/FieldOfFractions/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Fields/FieldOfFractions/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 56.1666666667, "max_line_length": 339, "alphanum_fraction": 0.7664264519, "num_tokens": 709, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869851639066, "lm_q2_score": 0.7931059585194573, "lm_q1q2_score": 0.6945918763272859}} {"text": "open import Agda.Builtin.Coinduction\nopen import Agda.Builtin.Equality\n\nrecord Reveal_·_is_ {A : Set} {B : A → Set}\n (f : (x : A) → B x) (x : A) (y : B x) :\n Set where\n constructor [_]\n field eq : f x ≡ y\n\ninspect : {A : Set} {B : A → Set}\n (f : (x : A) → B x) (x : A) → Reveal f · x is f x\ninspect f x = [ refl ]\n\ninfixr 5 _∷_\n\ndata Stream (A : Set) : Set where\n _∷_ : (x : A) (xs : ∞ (Stream A)) → Stream A\n\ninfix 4 _≈_\n\ndata _≈_ {A} : Stream A → Stream A → Set where\n _∷_ : ∀ {x y xs ys}\n (x≡ : x ≡ y) (xs≈ : ∞ (♭ xs ≈ ♭ ys)) → x ∷ xs ≈ y ∷ ys\n\nmap : ∀ {A B} → (A → B) → Stream A → Stream B\nmap f (x ∷ xs) = f x ∷ ♯ map f (♭ xs)\n\nmap₂ : ∀ {A B} → (A → B) → Stream A → Stream B\nmap₂ f (x ∷ xs) with ♭ xs\nmap₂ f (x ∷ xs) | y ∷ ys = f x ∷ ♯ (f y ∷ ♯ map₂ f (♭ ys))\n\nmap≈map₂ : ∀ {A B} →\n (f : A → B) → (xs : Stream A) → map f xs ≈ map₂ f xs\nmap≈map₂ {A} f (x ∷ xs) with ♭ xs | inspect ♭ xs\nmap≈map₂ {A} f (x ∷ xs) | y ∷ ys | [ eq ] = refl ∷ ♯ helper eq\n where\n map-f-y∷ys = _\n\n helper : ∀ {xs} → xs ≡ y ∷ ys → map f xs ≈ map-f-y∷ys\n helper refl = refl ∷ ♯ map≈map₂ f (♭ ys)\n", "meta": {"hexsha": "a96aa047c638690c0f49583c4b14f172aa26f68e", "size": 1146, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2322.agda", "max_stars_repo_name": "alhassy/agda", "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/Succeed/Issue2322.agda", "max_issues_repo_name": "alhassy/agda", "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/Issue2322.agda", "max_forks_repo_name": "alhassy/agda", "max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 27.9512195122, "max_line_length": 63, "alphanum_fraction": 0.465095986, "num_tokens": 524, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869948899665, "lm_q2_score": 0.7931059438487663, "lm_q1q2_score": 0.6945918711926815}} {"text": "module Ag11 where\n\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl)\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Data.Empty using (⊥; ⊥-elim)\nopen import Data.Sum using (_⊎_; inj₁; inj₂)\nopen import Data.Product using (_×_)\nopen import Ag09 using (_≃_; extensionality)\nopen import Relation.Nullary using (¬_)\nopen import Relation.Nullary.Negation using (contraposition)\nopen import Ag03 using (_⟨_)\n\n⟨-irreflexive : ∀ (n : ℕ) → ¬ (n ⟨ n)\n⟨-irreflexive (suc n) (_⟨_.s⟨s H) = ⟨-irreflexive n H\n\n⊎-dual-× : ∀ {A B : Set} → ¬ (A ⊎ B) ≃ (¬ A) × (¬ B)\n⊎-dual-× =\n record\n { to = λ z → (λ x → z (inj₁ x)) Data.Product., (λ x → z (inj₂ x))\n ; from = λ{ (fst Data.Product., snd) → λ {(inj₁ x) → fst x; (inj₂ y) → snd y} }\n ; from∘to = λ x → extensionality λ { (inj₁ y) → refl ; (inj₂ z) → refl }\n ; to∘from = λ {(fst Data.Product., snd) → refl}\n }\n\n-- ×-dual-⊎ : ∀ {A B : Set} → ¬ (A × B) ≃ (¬ A) ⊎ (¬ B)\n-- ×-dual-⊎ =\n-- record\n-- { to = λ x → inj₁ λ y → {!!} \n-- ; from = λ { (inj₁ x) → λ z → x (Data.Product.proj₁ z) ; (inj₂ y) → λ z → y (Data.Product.proj₂ z)}\n-- ; from∘to = {!!}\n-- ; to∘from = {!!}\n-- }\n\npostulate\n em : ∀ {A : Set} → A ⊎ ¬ A\n\nem-irrefutable : ∀ {A : Set} → ¬ ¬ (A ⊎ ¬ A)\nem-irrefutable k = k (inj₂ (λ x → k (inj₁ x)))\n\npostulate\n dne : ∀ {A : Set} → ¬ ¬ A → A\n\nem-dne : ∀ {A : Set} → (A ⊎ ¬ A) → (¬ ¬ A → A)\nem-dne (inj₁ x) ¬¬A = x\nem-dne (inj₂ y) ¬¬A = ⊥-elim (¬¬A y)\n\ndne-em : (∀ (A : Set) → ¬ ¬ A → A) → (∀ (A : Set) → A ⊎ ¬ A)\ndne-em H = λ a → H (a ⊎ ((x : a) → ⊥)) (λ z → z (inj₂ (λ x → z (inj₁ x))))\n", "meta": {"hexsha": "45499d732eb383dcb54da30daacda49cff6ce719", "size": 1563, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/Ag11.agda", "max_stars_repo_name": "Brethland/LEARNING-STUFF", "max_stars_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-02-03T05:05:52.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-11T10:35:42.000Z", "max_issues_repo_path": "Agda/Ag11.agda", "max_issues_repo_name": "Brethland/LEARNING-STUFF", "max_issues_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/Ag11.agda", "max_forks_repo_name": "Brethland/LEARNING-STUFF", "max_forks_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-12-13T04:50:46.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-13T04:50:46.000Z", "avg_line_length": 31.8979591837, "max_line_length": 103, "alphanum_fraction": 0.5163147793, "num_tokens": 694, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519528057272543, "lm_q2_score": 0.8152324915965392, "lm_q1q2_score": 0.6945396085356919}} {"text": "module gugugu where\n\nopen import Relation.Binary.PropositionalEquality\nopen import Data.List\nopen import Data.List.Properties\nopen import Agda.Builtin.Sigma\n-- you can import other functions from the stdlib here\n\n++-injectiveʳ : ∀ {ℓ} {A : Set ℓ} (a b c : List A) → a ++ b ≡ a ++ c → b ≡ c\n++-injectiveʳ [] b c p = p\n++-injectiveʳ (x ∷ a) b c p = ++-injectiveʳ a b c (snd (∷-injective p))\n\nlemma : ∀ {ℓ} {A : Set ℓ} (x : A) (xs ys : List A) → xs ++ x ∷ ys ≡ (xs ++ x ∷ []) ++ ys\nlemma x [] ys = refl\nlemma x (x₁ ∷ xs) ys = cong (_∷_ x₁) (lemma x xs ys)\n\ncol : ∀ {ℓ} {A : Set ℓ} (x : A) (xs : List A) → xs ++ x ∷ [] ≡ (xs ∷ʳ x)\ncol x [] = refl\ncol x (x₁ ∷ xs) = refl\n\nsilly' : ∀ {ℓ} {A : Set ℓ} (x : A) (xs ys : List A) → xs ++ x ∷ [] ≡ ys ++ x ∷ [] → xs ∷ʳ x ≡ ys ∷ʳ x\nsilly' x xs ys = λ z → z\n\nsilly : ∀ {ℓ} {A : Set ℓ} (x : A) (xs ys : List A) → xs ++ x ∷ [] ≡ ys ++ x ∷ [] → xs ≡ ys\nsilly x xs ys p rewrite col x xs | col x ys = fst (∷ʳ-injective xs ys (silly' x xs ys p))\n\n-- inductive can do this job too.\n++-injectiveˡ : ∀ {ℓ} {A : Set ℓ} (a b c : List A) → a ++ c ≡ b ++ c → a ≡ b\n++-injectiveˡ a b [] p rewrite ++-identityʳ a | ++-identityʳ b = p\n++-injectiveˡ a b (x ∷ c) p rewrite lemma x a c | lemma x b c = silly x a b (++-injectiveˡ (a ++ x ∷ []) (b ++ x ∷ []) c p)\n", "meta": {"hexsha": "e3469d969cb983ea7510ed6f9d87fe870baad449", "size": 1279, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/gugugu.agda", "max_stars_repo_name": "Brethland/LEARNING-STUFF", "max_stars_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-02-03T05:05:52.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-11T10:35:42.000Z", "max_issues_repo_path": "Agda/gugugu.agda", "max_issues_repo_name": "Brethland/LEARNING-STUFF", "max_issues_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/gugugu.agda", "max_forks_repo_name": "Brethland/LEARNING-STUFF", "max_forks_repo_head_hexsha": "eb2cef0556efb9a4ce11783f8516789ea48cc344", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-12-13T04:50:46.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-13T04:50:46.000Z", "avg_line_length": 41.2580645161, "max_line_length": 123, "alphanum_fraction": 0.5293197811, "num_tokens": 556, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519528094861981, "lm_q2_score": 0.8152324826183822, "lm_q1q2_score": 0.6945396039511389}} {"text": "module Common.Sum where\n\nopen import Common.Level\n\ndata _⊎_ {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where\n inj₁ : (x : A) → A ⊎ B\n inj₂ : (y : B) → A ⊎ B\n\n\n[_,_] : ∀ {a b c} {A : Set a} {B : Set b} {C : A ⊎ B → Set c} →\n ((x : A) → C (inj₁ x)) → ((x : B) → C (inj₂ x)) →\n ((x : A ⊎ B) → C x)\n[ f , g ] (inj₁ x) = f x\n[ f , g ] (inj₂ y) = g y\n", "meta": {"hexsha": "44c6ed15ed0c6bf7bbb3672b61ee06cd2b5cdab2", "size": 362, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Common/Sum.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Common/Sum.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Common/Sum.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 24.1333333333, "max_line_length": 63, "alphanum_fraction": 0.4033149171, "num_tokens": 180, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9343951643678382, "lm_q2_score": 0.7431680143008301, "lm_q1q2_score": 0.6944125988755441}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Cubical.Relation.Nullary where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.Empty\n\nprivate\n variable\n ℓ : Level\n A : Type ℓ\n\n-- Negation\ninfix 3 ¬_\n\n¬_ : Type ℓ → Type ℓ\n¬ A = A → ⊥\n\nisProp¬ : (A : Type ℓ) → isProp (¬ A)\nisProp¬ A p q i x = isProp⊥ (p x) (q x) i\n\n-- Decidable types (inspired by standard library)\ndata Dec (P : Type ℓ) : Type ℓ where\n yes : ( p : P) → Dec P\n no : (¬p : ¬ P) → Dec P\n\nStable : Type ℓ → Type ℓ\nStable A = ¬ ¬ A → A\n\nDiscrete : Type ℓ → Type ℓ\nDiscrete A = (x y : A) → Dec (x ≡ y)\n\nStable¬ : Stable (¬ A)\nStable¬ ¬¬¬a a = ¬¬¬a ¬¬a\n where\n ¬¬a = λ ¬a → ¬a a\n\nfromYes : A → Dec A → A\nfromYes _ (yes a) = a\nfromYes a (no _) = a\n\ndiscreteDec : (Adis : Discrete A) → Discrete (Dec A)\ndiscreteDec Adis (yes p) (yes p') = decideYes (Adis p p') -- TODO: monad would simply stuff\n where\n decideYes : Dec (p ≡ p') → Dec (yes p ≡ yes p')\n decideYes (yes eq) = yes (cong yes eq)\n decideYes (no ¬eq) = no λ eq → ¬eq (cong (fromYes p) eq)\ndiscreteDec Adis (yes p) (no ¬p) = ⊥-elim (¬p p)\ndiscreteDec Adis (no ¬p) (yes p) = ⊥-elim (¬p p)\ndiscreteDec {A = A} Adis (no ¬p) (no ¬p') = yes (cong no (isProp¬ A ¬p ¬p'))\n\nisPropDec : (Aprop : isProp A) → isProp (Dec A)\nisPropDec Aprop (yes a) (yes a') = cong yes (Aprop a a')\nisPropDec Aprop (yes a) (no ¬a) = ⊥-elim (¬a a)\nisPropDec Aprop (no ¬a) (yes a) = ⊥-elim (¬a a)\nisPropDec {A = A} Aprop (no ¬a) (no ¬a') = cong no (isProp¬ A ¬a ¬a')\n\nmapDec : ∀ {B : Type ℓ} → (A → B) → (¬ A → ¬ B) → Dec A → Dec B\nmapDec f _ (yes p) = yes (f p)\nmapDec _ f (no ¬p) = no (f ¬p)\n", "meta": {"hexsha": "8aa27eb4305a85f3895dd5cadc8e4abadc71cb24", "size": 1655, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Relation/Nullary.agda", "max_stars_repo_name": "cj-xu/cubical", "max_stars_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Relation/Nullary.agda", "max_issues_repo_name": "cj-xu/cubical", "max_issues_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Relation/Nullary.agda", "max_forks_repo_name": "cj-xu/cubical", "max_forks_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.2698412698, "max_line_length": 91, "alphanum_fraction": 0.5734138973, "num_tokens": 692, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8311430604060731, "lm_q2_score": 0.8354835411997897, "lm_q1q2_score": 0.6944063473516967}} {"text": "module Data.Finitary.Permutation where\n\nopen import Data.Nat\nopen import Data.Fin\nopen import Relation.Binary.PropositionalEquality as P using (_≡_; _≢_)\nopen import Function.Inverse as Inv using (Inverse)\nimport Function.Equality as F\nopen import Function.LeftInverse using (_LeftInverseOf_)\nopen import Data.Finitary\nopen import Data.Vec as Vec using (Vec)\nopen import Data.Vec.Distinct as Distinct using (Distinct)\nopen import Data.Product hiding (swap)\n\nPermutation : ℕ → Set\nPermutation n = Finitary (P.setoid (Fin n)) n\n\nidentity : ∀ {n} → Permutation n\nidentity = Inv.id\n\nswap : ∀ {n} → Fin n → Fin n → Permutation n\nswap {n} i j = record {\n to = P.→-to-⟶ swap′ \n ; from = P.→-to-⟶ swap′\n ; inverse-of = record {\n left-inverse-of = swap′-involutive\n ; right-inverse-of = swap′-involutive\n }\n }\n where\n open import Data.Fin.Properties as FinP\n open import Relation.Nullary\n open import Data.Empty using (⊥-elim)\n swap′ : Fin n → Fin n\n swap′ k with k FinP.≟ i\n swap′ k | yes k≡i = j\n swap′ k | no ¬p with k FinP.≟ j\n swap′ k | no ¬p | yes k≡j = i\n swap′ k | no ¬p | no ¬p₁ = k\n \n swap′-involutive : ∀ k → swap′ (swap′ k) ≡ k\n swap′-involutive k with k FinP.≟ i\n swap′-involutive k | yes k≡i with k≡i | j FinP.≟ i \n swap′-involutive _ | yes k≡i | P.refl | yes j≡i = j≡i\n swap′-involutive _ | yes k≡i | P.refl | no j≢i with j FinP.≟ j\n swap′-involutive _ | yes k≡i | P.refl | no j≢i | yes j≡j = P.refl\n swap′-involutive _ | yes k≡i | P.refl | no j≢i | no j≢j = ⊥-elim (j≢j P.refl)\n swap′-involutive k | no k≢i with k FinP.≟ j\n swap′-involutive k | no k≢i | yes k≡j with k≡j | i FinP.≟ i\n swap′-involutive k | no k≢i | yes k≡j | P.refl | yes P.refl = P.refl\n swap′-involutive k | no k≢i | yes k≡j | P.refl | no i≢i = ⊥-elim (i≢i P.refl)\n swap′-involutive k | no k≢i | no k≢j = lemma k≢i k≢j\n where\n open P.≡-Reasoning \n lemma : ∀ {k} → k ≢ i → k ≢ j → swap′ k ≡ k \n lemma {k} k≢i k≢j with k FinP.≟ i \n lemma k≢i k≢j | yes k≡i = ⊥-elim (k≢i k≡i)\n lemma {k} k≢i k≢j | no ¬k≡i with k FinP.≟ j\n lemma {k} k≢i k≢j | no ¬k≡i | yes k≡j = ⊥-elim (k≢j k≡j)\n lemma {k} k≢i k≢j | no ¬k≡i | no ¬p = P.refl\n \nshift : ∀ {n} → Permutation n → Permutation (ℕ.suc n)\nshift {n} p = record {\n to = P.→-to-⟶ (shift′ Perm.to)\n ; from = P.→-to-⟶ (shift′ Perm.from)\n ; inverse-of = record {\n left-inverse-of = shift′-inverse-of Perm.left-inverse-of\n ; right-inverse-of = shift′-inverse-of Perm.right-inverse-of\n }\n }\n where \n module Perm = Inverse p\n shift′ : P.setoid (Fin n) F.⟶ P.setoid (Fin n) → Fin (ℕ.suc n) → Fin (ℕ.suc n)\n shift′ f Fin.zero = Fin.zero\n shift′ f (Fin.suc i) = Fin.suc (f F.⟨$⟩ i)\n shift′-inverse-of : ∀ {from : P.setoid (Fin n) F.⟶ P.setoid (Fin n)}{to : P.setoid (Fin n) F.⟶ P.setoid (Fin n)} → from LeftInverseOf to → (P.→-to-⟶ (shift′ from)) LeftInverseOf (P.→-to-⟶ (shift′ to))\n shift′-inverse-of inv Fin.zero = P.refl\n shift′-inverse-of inv (Fin.suc i) = P.cong Fin.suc (inv i)\n \n\nPerm→Distinct : ∀ {n} → Permutation n → ∃ λ (xs : Vec (Fin n) n) → Distinct xs\nPerm→Distinct {n} p = , xs-distinct\n where\n open Inverse p renaming (to to f)\n open import Data.Vec.Properties\n\n xs-distinct : Distinct (Vec.tabulate (f F.⟨$⟩_)) \n xs-distinct = P.subst Distinct (P.sym (tabulate-allFin _))\n (Distinct.map injection (Distinct.allFin n))\n\n", "meta": {"hexsha": "36b8802cc2e0436d5cb67c5b0083ed861b9286e6", "size": 3750, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Data/Finitude/Permutation.agda", "max_stars_repo_name": "tizmd/agda-finitary", "max_stars_repo_head_hexsha": "abacd166f63582b7395d9cc10b6323c0f69649e5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Data/Finitude/Permutation.agda", "max_issues_repo_name": "tizmd/agda-finitary", "max_issues_repo_head_hexsha": "abacd166f63582b7395d9cc10b6323c0f69649e5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Data/Finitude/Permutation.agda", "max_forks_repo_name": "tizmd/agda-finitary", "max_forks_repo_head_hexsha": "abacd166f63582b7395d9cc10b6323c0f69649e5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.6666666667, "max_line_length": 206, "alphanum_fraction": 0.5456, "num_tokens": 1364, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045877523148, "lm_q2_score": 0.7826624840223698, "lm_q1q2_score": 0.6943817464862693}} {"text": "module RecordPatternMatching where\n\nrecord _×_ (A B : Set) : Set where\n constructor _,_\n field\n proj₁ : A\n proj₂ : B\n\ndata Unit : Set where\n unit : Unit\n\nfoo : Unit × Unit → Unit\nfoo (x , y) = {!!}\n\nrecord Box (A : Set) : Set where\n constructor [_]\n field\n proj : A\n\nbar : Box Unit → Unit\nbar [ x ] = {!!}\n", "meta": {"hexsha": "44cea86bfe1afcd0df2d6fabd79a62d9d1894008", "size": 320, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/interaction/RecordPatternMatching.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/interaction/RecordPatternMatching.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/interaction/RecordPatternMatching.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 14.5454545455, "max_line_length": 34, "alphanum_fraction": 0.5875, "num_tokens": 104, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8872045817875224, "lm_q2_score": 0.7826624738835052, "lm_q1q2_score": 0.6943817328226028}} {"text": "open import Data.PropFormula 2\n\n⋀comm : ∀ {Γ}{φ ψ : PropFormula} → Γ ⊢ φ ∧ ψ ⊃ ψ ∧ φ\n⋀comm {Γ} {φ = φ}{ψ} =\n ⊃-intro $\n ∧-intro\n (∧-proj₂ $ assume {Γ = Γ} $ φ ∧ ψ)\n (∧-proj₁ {ψ = ψ} $ assume {Γ = Γ} $ φ ∧ ψ)\n", "meta": {"hexsha": "8a8bd3a76564a05368d97b959f5d0ff9b83a5810", "size": 222, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/and-example.agda", "max_stars_repo_name": "jonaprieto/agda-prop", "max_stars_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 13, "max_stars_repo_stars_event_min_datetime": "2017-05-01T16:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T03:33:12.000Z", "max_issues_repo_path": "test/and-example.agda", "max_issues_repo_name": "jonaprieto/agda-prop", "max_issues_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2017-03-08T14:33:10.000Z", "max_issues_repo_issues_event_max_datetime": "2017-12-18T16:34:21.000Z", "max_forks_repo_path": "test/and-example.agda", "max_forks_repo_name": "jonaprieto/agda-prop", "max_forks_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2017-03-30T16:41:56.000Z", "max_forks_repo_forks_event_max_datetime": "2017-12-01T17:01:25.000Z", "avg_line_length": 24.6666666667, "max_line_length": 52, "alphanum_fraction": 0.4459459459, "num_tokens": 115, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9381240160063031, "lm_q2_score": 0.7401743620390163, "lm_q1q2_score": 0.6943753450609453}} {"text": "module Formalization where\n\nmodule Introduction where\n\nopen import Data.Product using (Σ; Σ-syntax; _×_; _,_; proj₁; proj₂)\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl; cong)\n\ndata Iso (A B : Set): Set where\n iso : (f : A → B) → (g : B → A) → (((x : A) → (g (f x)) ≡ x) × ((y : B) → (f (g y)) ≡ y)) → Iso A B\n\nopen import Function using (_∘_)\n\n-- NB: This says every [total] relation can be refined to a function.\n-- Kind of ew...\n-- The Hott Book notes that though the system is strong enough to sufficiently\n-- dilute the consequences of AC, the law of the excluded middle is inconsistent with Univalence\n-- because it acts like a \"Hilbertian Choice Operator\" [p 9].\naxiom-of-choice : {A : Set}\n → {B : A → Set}\n → {R : (a : A) → B a → Set}\n → (∀ (x : A) → Σ[ y ∈ B x ](R x y)) -- If for every x : A, ∃ a y : B x s.t. R x y\n → Σ[ f ∈ ((x : A) → B x) ](∀ (x : A) → (R x (f x))) -- then ∃ f : A → B s.t. ∀ x : A we have R (x, f(x))\naxiom-of-choice g = proj₁ ∘ g , proj₂ ∘ g \n\nmodule Chapter where\n\n-- Simple Polymorphic Functions\n-- ----------------------------\n\nid : ∀{a}{A : Set a} → A → A\nid x = x\n\nswap : ∀{a b c}{A : Set a}{B : Set b}{C : Set c} → (A → B → C) → (B → A → C)\nswap g = λ b a → g a b\n\n-- Product Types\n-- -------------\n\n-- To specify a type (a la Martin Löf's TT) we need:\n-- ∘ Formation Rules (\"We can form f : A → B when A : Type and B : Type\")\n-- ∘ Introduction Rules (Constructors)\n-- ∘ Elimination Rules (How to use the type's elements)\n-- ∘ Computation Rules (How Elimination Rules act on constructors)\n-- OPTIONAL\n-- ∘ Uniqueness Principle (Every element of the type is {uniquely} determined by the result of applying Elimination Rules)\n\n-- Formation and Introduction of Pairs is given in Data.Product, so here's an Eliminator\n\n{- Need function extensionality here, but I'm too lazy to postulate it right now.\nelimₓ-β : {A B C : Set} → (f : (A × B) → C) → (g : (A → B → C)) → (x : A)(y : B) → (f (x , y) ≡ g x y)\nelimₓ-β = λ f g x y → refl\n-}\n\n-- The projection functons also count as eliminators, but are too specific on occaision\n-- so we introduce the recursor for product types.\n\nrecₓ : ∀{a b c}{A : Set a}{B : Set b}{C : Set c} → (A → B → C) → (A × B) → C\nrecₓ g (a , b) = g a b\n\n-- Then define the projection functions in terms of it.\n\npr₁ : ∀{a b}{A : Set a}{B : Set b} → (A × B) → A\npr₁ = recₓ λ a → λ b → a\n\npr₂ : ∀{a b}{A : Set a}{B : Set b} → (A × B) → B\npr₂ = recₓ λ a → λ b → b\n\n-- The Unit Type also has a recursor:\n\nopen import Data.Unit\n\nrec₁ : ∀{c}{C : Set c} → C → ⊤ → C\nrec₁ c ⋆ = c\n\n-- For dependent functions over the product type, we must first generalize the recursor\n\nrecₓ-general : ∀{a b c}{A : Set a}{B : Set b}{C : (A × B) → Set c} → (x : A × B) → (g : (a : A) → (b : B) → C (a , b)) → C x\nrecₓ-general = λ x g → g (pr₁ x) (pr₂ x)\n\n-- Now we can prove the propositional uniqueness principle\n\nuppt : ∀{a b}{A : Set a}{B : Set b} → (x : A × B) → ((pr₁ x) , (pr₂ x) ≡ x)\nuppt x = refl\n\n-- And compute the following equality:\n\nreflₓ : ∀{a b}{A : Set a}{B : Set b}\n → (x : A)(y : B) -- ∀ x, y\n → ((pr₁ (x , y)) , (pr₂ (x , y)) ≡ (x , y)) -- Forming from forming then eliminating is the same as forming\nreflₓ x y = refl\n\n-- Now the induction function for product types;\n\nindₓ : ∀{a b c}{A : Set a}{B : Set b}{C : (A × B) → Set c}\n → ((x : A) → (y : B) -- ∀ x , y\n → C (x , y)) -- and a property that holds for the product (x , y)\n → (x : A × B) → C x -- ∀ products x, C holds\nindₓ g (a , b) = g a b\n\n-- And for the unit type\n\nind₁ : {C : ⊤ → Set} → C tt → (x : ⊤) → C x\nind₁ c ⋆ = c\n\n-- \"Induction enables us to prove the propositional uniqueness principle for 1, which asserts that its\n-- only inhabitant is ⋆. That is, we can construct\"\n\nupun : (x : ⊤) → x ≡ tt\nupun x = refl\n\n-- The uniqueness of unit can also be asserted by induction\n\nupun-ind : (x : ⊤) → x ≡ tt\nupun-ind x = ind₁ {C = λ x → x ≡ tt} refl x\n\n-- Sigma (Dependent Pair) Types \n-- ----------------------------\n\n-- We'll use the Σ in the Agda Stdlib (because of the cool syntax).\n--\n-- For a constant type B rather than a B indexed by x : A, dependent pairs\n-- and just cartesian products. With that in mind, the recursor for dependent\n-- pairs looks much the same as the one for the cartesian product\n\nrecₚ : ∀{a b c}{A : Set a}{B : A → Set b}{C : Set c}\n → ((x : A) → B x → C) -- It suffices to define the dependent function g such that\n → Σ[ x ∈ A ](B x) → C -- ∀ Σ(x : A)B x, C holds.\nrecₚ g (a , b) = g a b\n\n-- Here's Induction\n\nindₚ : ∀{a b c}{A : Set a}{B : A → Set b}{C : Σ[ x ∈ A ](B x) → Set c}\n → ((x : A)(y : B x) -- ∀ x , y\n → C (x , y)) -- and a property that holds for the pair (x , y)\n → (p : Σ[ x ∈ A ](B x)) → C p -- ∀ pairs x, C holds\nindₚ g (a , b) = g a b\n\n\n-- NB: Read Π as \"forall\" and Σ as \"exists\"\n\nrecord Magma (A : Set) : Set where\n field\n mop : A → A → A\nopen Magma {{...}} public\n\nrecord PointedMagma (A : Set) : Set where\n field\n mbasepoint : A\n pmop : (A → A → A)\n pointedMagmaIsMagma : Magma A\n pointedMagmaIsMagma = record { mop = pmop }\nopen PointedMagma {{...}} public\n\n-- Coproducts\n\nopen import Data.Sum\n\nrec₊ : ∀{a b c}{A : Set a}{B : Set b}{C : Set c} → (A → C) → (B → C) → A ⊎ B → C\nrec₊ g₀ g₁ (inj₁ x) = g₀ x\nrec₊ g₀ g₁ (inj₂ y) = g₁ y\n\n-- Oh look, ⊥\n\nopen import Data.Empty\n\n-- Any definition of the recursor would means proving 'ex falso quodlibet'.\n-- Let's try not to do that...\nrec₀ : ∀{c}{C : Set c} → ⊥ → C\nrec₀ ()\n\nind₊ : ∀{a b c}{A : Set a}{B : Set b}{C : (A ⊎ B) → Set c}\n → ((x : A) → C (inj₁ x))\n → ((y : B) → C (inj₂ y))\n → (x : A ⊎ B) → C x\nind₊ g₀ g₁ (inj₁ x) = g₀ x\nind₊ g₀ g₁ (inj₂ y) = g₁ y\n\nind₀ : ∀{c}{C : ⊥ → Set c} → (z : ⊥) → C z\nind₀ ()\n\n-- The type of booleans\n\nopen import Data.Bool\n\nrec₂ : ∀{c}{C : Set c} → C → C → Bool → C\nrec₂ c₀ c₁ true = c₁\nrec₂ c₀ c₁ false = c₀\n\nind₂ : ∀{c}{C : Bool → Set c} → C false → C true → (x : Bool) → C x\nind₂ c₀ c₁ true = c₁\nind₂ c₀ c₁ false = c₀\n\ndec₂ : (x : Bool) → (x ≡ false) ⊎ (x ≡ true)\ndec₂ x = ind₂ {C = λ x → (x ≡ false) ⊎ (x ≡ true)} (inj₁ refl) (inj₂ refl) x\n\n-- The type of Natural Numbers\n\nopen import Data.Nat\n\ndouble : ℕ → ℕ\ndouble zero = zero\ndouble (suc n) = suc (suc (double n))\n\nadd : ℕ → ℕ → ℕ\nadd zero n = n\nadd (suc m) n = suc (add m n)\n\nrecₙ : ∀{c}{C : Set c} → C → (ℕ → C → C) → ℕ → C\nrecₙ c₀ cₛ zero = c₀\nrecₙ c₀ cₛ (suc n) = cₛ n (recₙ c₀ cₛ n)\n\ndouble-recₙ : ℕ → ℕ\ndouble-recₙ = recₙ 0 (λ n y → suc (suc y))\n\nadd-recₙ : ℕ → ℕ → ℕ\nadd-recₙ = recₙ {C = ℕ → ℕ} (λ n → n) (λ n → λ g m → suc (g m))\n\nindₙ : {C : ℕ → Set} → C 0 → ((n : ℕ) → C n → C (suc n)) → (n : ℕ) → C n\nindₙ c₀ cₛ zero = c₀\nindₙ c₀ cₛ (suc n) = cₛ n (indₙ c₀ cₛ n)\n\nassoc : (i j k : ℕ) → i + (j + k) ≡ (i + j) + k\nassoc = indₙ {C = λ i → (j k : ℕ) → i + (j + k) ≡ (i + j) + k} assoc₀ assocₛ\n where\n assoc₀ : (j k : ℕ) → 0 + (j + k) ≡ (0 + j) + k\n assoc₀ j k = refl\n\n assocₛ : (i : ℕ) → ((j k : ℕ) → i + (j + k) ≡ (i + j) + k) → (j k : ℕ) → (suc i) + (j + k) ≡ ((suc i) + j) + k\n assocₛ _ i j k = cong suc (i j k)\n\n-- Propositions As Types\n\n{-\n¬_ : {A : Set} → A → ⊥\n¬ x = ()\n-}\n\n\n-- Path Induction\n\nopen import Level\n\nind₌ : ∀ {i} {A : Set i} → (C : (x y : A) → (x ≡ y) → Set i) → ((x : A) → C x x refl) → {x y : A} → (p : x ≡ y) → C x y p\nind₌ C c {x}{y} p rewrite p = c y\n\nbased-ind₌ : ∀ {i} {A : Set i}{a : A} → (C : (x : A) → (a ≡ x) → Set i) → C a refl → {x : A} → (p : a ≡ x) → C x p\nbased-ind₌ C c p rewrite p = c\n\n{-\nind₌-β : ∀ {i} {A : Set i}\n → (C : (x y : A) → (x ≡ y) → Set i)\n → (c : (x : A) → C x x refl)\n → (x : A)\n → (C' : (y : A) → (x ≡ y) → Set i)\n → (c' : C' x refl)\n → (y : A)\n → (p : x ≡ y)\n → ind₌ C c p <-> based-ind₌ C' c' p\nind₌-β {i} {A} C c x C' c' y p = ? where\n D : (x y : A) → (x ≡ y) → Set i\n D x y p = (C : (z : A) → (x ≡ z) → Set i) → C x refl → C y p\n \n d : (x : A) → D x x refl\n d = λ x₁ → λ C → (c : C x refl) → c\n-}\n", "meta": {"hexsha": "e33a710e085257d244dadb044bc0baa8e257620a", "size": 7915, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Chapter1/Formalization.agda", "max_stars_repo_name": "CodaFi/HoTT-Exercises", "max_stars_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Chapter1/Formalization.agda", "max_issues_repo_name": "CodaFi/HoTT-Exercises", "max_issues_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter1/Formalization.agda", "max_forks_repo_name": "CodaFi/HoTT-Exercises", "max_forks_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.7556390977, "max_line_length": 124, "alphanum_fraction": 0.523436513, "num_tokens": 3249, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8376199633332891, "lm_q2_score": 0.8289388146603364, "lm_q1q2_score": 0.6943356995413311}} {"text": "module Numeral.Natural.Relation.DivisibilityWithRemainder where\n\nimport Lvl\nopen import Logic\nopen import Logic.Propositional\nopen import Numeral.Finite\nopen import Numeral.Natural\nopen import Numeral.Natural.Oper\nopen import Type\n\n-- Divisibility with a remainder.\n-- `(y ∣ x)(r)` means that `y` is divisible by `x − r`.\n-- Note: `(0 ∣ᵣₑₘ _)(_)` is impossible to construct (0 is never a divisor by this definition).\ndata _∣ᵣₑₘ_ : (y : ℕ) → ℕ → 𝕟(y) → Stmt{Lvl.𝟎} where\n DivRem𝟎 : ∀{y : ℕ} {r : 𝕟(y)} → (y ∣ᵣₑₘ 𝕟-to-ℕ(r))(r)\n DivRem𝐒 : ∀{y x : ℕ}{r : 𝕟(y)} → (y ∣ᵣₑₘ x)(r) → (y ∣ᵣₑₘ (x + y))(r)\n\n_∣₊_ : ℕ → ℕ → Stmt\n𝟎 ∣₊ x = ⊥\n𝐒(y) ∣₊ x = (𝐒(y) ∣ᵣₑₘ x)(𝟎)\n\n-- The quotient extracted from the proof of divisibility.\n[∣ᵣₑₘ]-quotient : ∀{y x}{r} → (y ∣ᵣₑₘ x)(r) → ℕ\n[∣ᵣₑₘ]-quotient DivRem𝟎 = 𝟎\n[∣ᵣₑₘ]-quotient (DivRem𝐒 p) = 𝐒([∣ᵣₑₘ]-quotient p)\n\n-- The remainder extracted from the proof of divisibility.\n[∣ᵣₑₘ]-remainder : ∀{y x}{r} → (y ∣ᵣₑₘ x)(r) → 𝕟(y)\n[∣ᵣₑₘ]-remainder{r = r} _ = r\n\ndata _∣ᵣₑₘ₀_ : (y : ℕ) → ℕ → ℕ → Stmt{Lvl.𝟎} where\n base₀ : ∀{y} → (y ∣ᵣₑₘ₀ 𝟎)(𝟎)\n base₊ : ∀{y r} → (y ∣ᵣₑₘ₀ r)(r) → (𝐒(y) ∣ᵣₑₘ₀ 𝐒(r))(𝐒(r))\n step : ∀{y x r} → (y ∣ᵣₑₘ₀ x)(r) → (y ∣ᵣₑₘ₀ (x + y))(r)\n", "meta": {"hexsha": "54b193be0f6f479eb4eacb1c1fc2321b19a674b1", "size": 1205, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Relation/DivisibilityWithRemainder.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Relation/DivisibilityWithRemainder.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Relation/DivisibilityWithRemainder.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.4285714286, "max_line_length": 94, "alphanum_fraction": 0.5825726141, "num_tokens": 675, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898127684335, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.6942542390605647}} {"text": "module Luau.TypeSaturation where\n\nopen import Luau.Type using (Type; _⇒_; _∩_; _∪_)\nopen import Luau.TypeNormalization using (_∪ⁿ_; _∩ⁿ_)\n\n-- So, there's a problem with overloaded functions\n-- (of the form (S_1 ⇒ T_1) ∩⋯∩ (S_n ⇒ T_n))\n-- which is that it's not good enough to compare them\n-- for subtyping by comparing all of their overloads.\n\n-- For example (nil → nil) is a subtype of (number? → number?) ∩ (string? → string?)\n-- but not a subtype of any of its overloads.\n\n-- To fix this, we adapt the semantic subtyping algorithm for\n-- function types, given in\n-- https://www.irif.fr/~gc/papers/covcon-again.pdf and\n-- https://pnwamk.github.io/sst-tutorial/\n\n-- A function type is *intersection-saturated* if for any overloads\n-- (S₁ ⇒ T₁) and (S₂ ⇒ T₂), there exists an overload which is a subtype\n-- of ((S₁ ∩ S₂) ⇒ (T₁ ∩ T₂)).\n\n-- A function type is *union-saturated* if for any overloads\n-- (S₁ ⇒ T₁) and (S₂ ⇒ T₂), there exists an overload which is a subtype\n-- of ((S₁ ∪ S₂) ⇒ (T₁ ∪ T₂)).\n\n-- A function type is *saturated* if it is both intersection- and\n-- union-saturated.\n\n-- For example (number? → number?) ∩ (string? → string?)\n-- is not saturated, but (number? → number?) ∩ (string? → string?) ∩ (nil → nil) ∩ ((number ∪ string)? → (number ∪ string)?)\n-- is.\n\n-- Saturated function types have the nice property that they can ber\n-- compared by just comparing their overloads: F <: G whenever for any\n-- overload of G, there is an overload os F which is a subtype of it.\n\n-- Forunately every function type can be saturated!\n_⋓_ : Type → Type → Type\n(S₁ ⇒ T₁) ⋓ (S₂ ⇒ T₂) = (S₁ ∪ⁿ S₂) ⇒ (T₁ ∪ⁿ T₂)\n(F₁ ∩ G₁) ⋓ F₂ = (F₁ ⋓ F₂) ∩ (G₁ ⋓ F₂)\nF₁ ⋓ (F₂ ∩ G₂) = (F₁ ⋓ F₂) ∩ (F₁ ⋓ G₂)\nF ⋓ G = F ∩ G\n\n_⋒_ : Type → Type → Type\n(S₁ ⇒ T₁) ⋒ (S₂ ⇒ T₂) = (S₁ ∩ⁿ S₂) ⇒ (T₁ ∩ⁿ T₂)\n(F₁ ∩ G₁) ⋒ F₂ = (F₁ ⋒ F₂) ∩ (G₁ ⋒ F₂)\nF₁ ⋒ (F₂ ∩ G₂) = (F₁ ⋒ F₂) ∩ (F₁ ⋒ G₂)\nF ⋒ G = F ∩ G\n\n_∩ᵘ_ : Type → Type → Type\nF ∩ᵘ G = (F ∩ G) ∩ (F ⋓ G)\n\n_∩ⁱ_ : Type → Type → Type\nF ∩ⁱ G = (F ∩ G) ∩ (F ⋒ G)\n\n∪-saturate : Type → Type\n∪-saturate (F ∩ G) = (∪-saturate F ∩ᵘ ∪-saturate G)\n∪-saturate F = F\n\n∩-saturate : Type → Type\n∩-saturate (F ∩ G) = (∩-saturate F ∩ⁱ ∩-saturate G)\n∩-saturate F = F\n\nsaturate : Type → Type\nsaturate F = ∪-saturate (∩-saturate F)\n", "meta": {"hexsha": "fa24ff735bcc9913799ee26ca52f00c01079d375", "size": 2233, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "prototyping/Luau/TypeSaturation.agda", "max_stars_repo_name": "Libertus-Lab/luau", "max_stars_repo_head_hexsha": "f1b46f4b967f11fabe666da1de0e71b225368260", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-11-06T08:03:00.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-06T08:03:00.000Z", "max_issues_repo_path": "prototyping/Luau/TypeSaturation.agda", "max_issues_repo_name": "sthagen/Roblox-luau", "max_issues_repo_head_hexsha": "39fbd2146a379fb0878369b48764cd7e8772c0fb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "prototyping/Luau/TypeSaturation.agda", "max_forks_repo_name": "sthagen/Roblox-luau", "max_forks_repo_head_hexsha": "39fbd2146a379fb0878369b48764cd7e8772c0fb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.328358209, "max_line_length": 124, "alphanum_fraction": 0.6153157188, "num_tokens": 933, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9196425267730008, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.6942519209508651}} {"text": "module Examples where\n\nopen import Data.Maybe using (just ; nothing)\nopen import Data.Nat using (ℕ ; zero ; suc ; _+_ ; ⌈_/2⌉)\nopen import Data.Nat.Properties using (cancel-+-left)\nimport Algebra.Structures\nopen import Data.List using (List ; length) renaming ([] to []L ; _∷_ to _∷L_)\nopen import Data.Vec using (Vec ; [] ; _∷_ ; reverse ; _++_ ; tail ; take ; drop ; map)\nopen import Function using (id)\nimport Relation.Binary\nopen import Relation.Binary.PropositionalEquality using (_≡_ ; refl ; cong)\n\nopen import Structures using (Shaped)\nimport GetTypes\nimport FreeTheorems\nimport BFF\n\nopen GetTypes.PartialVecVec using (Get)\nopen FreeTheorems.PartialVecVec using (assume-get)\nopen BFF.PartialVecBFF using (bff)\n\nℕ-decSetoid = Relation.Binary.DecTotalOrder.Eq.decSetoid Data.Nat.decTotalOrder\n\nreverse' : Get\nreverse' = assume-get id id reverse\n\ndouble' : Get\ndouble' = assume-get id g f\n where g : ℕ → ℕ\n g zero = zero\n g (suc n) = suc (suc (g n))\n f : {A : Set} {n : ℕ} → Vec A n → Vec A (g n)\n f [] = []\n f (x ∷ v) = x ∷ x ∷ f v\n\ndouble'' : Get\ndouble'' = assume-get id _ (λ v → v ++ v)\n\ntail' : Get\ntail' = assume-get suc id tail\n\ntail-example : bff ℕ-decSetoid tail' 2 (8 ∷ 5 ∷ []) (3 ∷ 1 ∷ []) ≡ just (just 8 ∷ just 3 ∷ just 1 ∷ [])\ntail-example = refl\n\ntake' : ℕ → Get\ntake' n = assume-get (_+_ n) _ (take n)\n\ndrop' : ℕ → Get\ndrop' n = assume-get (_+_ n) _ (drop n)\n\nsieve' : Get\nsieve' = assume-get id _ f\n where f : {A : Set} {n : ℕ} → Vec A n → Vec A ⌈ n /2⌉\n f [] = []\n f (x ∷ []) = x ∷ []\n f (x ∷ _ ∷ xs) = x ∷ f xs\n\nsieve-example : bff ℕ-decSetoid sieve' 4 (0 ∷ 2 ∷ []) (1 ∷ 3 ∷ []) ≡ just (just 1 ∷ just 2 ∷ just 3 ∷ nothing ∷ [])\nsieve-example = refl\n\nintersperse-len : ℕ → ℕ\nintersperse-len zero = zero\nintersperse-len (suc zero) = suc zero\nintersperse-len (suc (suc n)) = suc (suc (intersperse-len (suc n)))\n\nintersperse : {A : Set} {n : ℕ} → A → Vec A n → Vec A (intersperse-len n)\nintersperse s [] = []\nintersperse s (x ∷ []) = x ∷ []\nintersperse s (x ∷ y ∷ v) = x ∷ s ∷ intersperse s (y ∷ v)\n\nintersperse' : Get\nintersperse' = assume-get suc intersperse-len f\n where f : {A : Set} {n : ℕ} → Vec A (suc n) → Vec A (intersperse-len n)\n f (s ∷ v) = intersperse s v\n\nintersperse-neg-example : bff ℕ-decSetoid intersperse' 3 (0 ∷ []) (1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ []) ≡ nothing\nintersperse-neg-example = refl\n\nintersperse-pos-example : bff ℕ-decSetoid intersperse' 3 (0 ∷ []) (1 ∷ 2 ∷ 3 ∷ 2 ∷ 5 ∷ []) ≡ just (map just (2 ∷ 1 ∷ 3 ∷ 5 ∷ []))\nintersperse-pos-example = refl\n\ndata PairVec (α : Set) (β : Set) : List α → Set where\n []P : PairVec α β []L\n _,_∷P_ : (x : α) → β → {l : List α} → PairVec α β l → PairVec α β (x ∷L l)\n\nPairVecFirstShaped : (α : Set) → Shaped (List α) (PairVec α)\nPairVecFirstShaped α = record\n { arity = length\n ; content = content\n ; fill = fill\n ; isShaped = record\n { content-fill = content-fill\n ; fill-content = fill-content\n } }\n where content : {β : Set} {s : List α} → PairVec α β s → Vec β (length s)\n content []P = []\n content (a , b ∷P p) = b ∷ content p\n\n fill : {β : Set} → (s : List α) → Vec β (length s) → PairVec α β s\n fill []L v = []P\n fill (a ∷L s) (b ∷ v) = a , b ∷P fill s v\n\n content-fill : {β : Set} {s : List α} → (p : PairVec α β s) → fill s (content p) ≡ p\n content-fill []P = refl\n content-fill (a , b ∷P p) = cong (_,_∷P_ a b) (content-fill p)\n\n fill-content : {β : Set} → (s : List α) → (v : Vec β (length s)) → content (fill s v) ≡ v\n fill-content []L [] = refl\n fill-content (a ∷L s) (b ∷ v) = cong (_∷_ b) (fill-content s v)\n", "meta": {"hexsha": "cfe9432b12ce17d3a36ce03ea8b218921e94fa6a", "size": 3741, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Examples.agda", "max_stars_repo_name": "jvoigtlaender/bidiragda", "max_stars_repo_head_hexsha": "a5abbd177f032523d1d9d3fa4b9137aefe88dee0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Examples.agda", "max_issues_repo_name": "jvoigtlaender/bidiragda", "max_issues_repo_head_hexsha": "a5abbd177f032523d1d9d3fa4b9137aefe88dee0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Examples.agda", "max_forks_repo_name": "jvoigtlaender/bidiragda", "max_forks_repo_head_hexsha": "a5abbd177f032523d1d9d3fa4b9137aefe88dee0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.0090909091, "max_line_length": 129, "alphanum_fraction": 0.5640203154, "num_tokens": 1356, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392909114836, "lm_q2_score": 0.785308580887758, "lm_q1q2_score": 0.694243640994717}} {"text": "------------------------------------------------------------------------\n-- Subsets of finite sets\n------------------------------------------------------------------------\n\nmodule Data.Fin.Subset where\n\nopen import Data.Nat\nopen import Data.Vec hiding (_∈_)\nopen import Data.Fin\nopen import Data.Product\nopen import Relation.Nullary\nopen import Relation.Binary.PropositionalEquality\n\ninfixr 2 _∈_ _∉_ _⊆_ _⊈_\n\n------------------------------------------------------------------------\n-- Definitions\n\ndata Side : Set where\n inside : Side\n outside : Side\n\n-- Partitions a finite set into two parts, the inside and the outside.\n\nSubset : ℕ → Set\nSubset = Vec Side\n\n------------------------------------------------------------------------\n-- Membership and subset predicates\n\n_∈_ : ∀ {n} → Fin n → Subset n → Set\nx ∈ p = p [ x ]= inside\n\n_∉_ : ∀ {n} → Fin n → Subset n → Set\nx ∉ p = ¬ (x ∈ p)\n\n_⊆_ : ∀ {n} → Subset n → Subset n → Set\np₁ ⊆ p₂ = ∀ {x} → x ∈ p₁ → x ∈ p₂\n\n_⊈_ : ∀ {n} → Subset n → Subset n → Set\np₁ ⊈ p₂ = ¬ (p₁ ⊆ p₂)\n\n------------------------------------------------------------------------\n-- Some specific subsets\n\nall : ∀ {n} → Side → Subset n\nall {zero} _ = []\nall {suc n} s = s ∷ all s\n\n------------------------------------------------------------------------\n-- Properties\n\nNonempty : ∀ {n} (p : Subset n) → Set\nNonempty p = ∃ λ f → f ∈ p\n\nEmpty : ∀ {n} (p : Subset n) → Set\nEmpty p = ¬ Nonempty p\n\n-- Point-wise lifting of properties.\n\nLift : ∀ {n} → (Fin n → Set) → (Subset n → Set)\nLift P p = ∀ {x} → x ∈ p → P x\n", "meta": {"hexsha": "3cb707e4c9ee5399e3728359028d532ba1a5aed9", "size": 1535, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Data/Fin/Subset.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Data/Fin/Subset.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Data/Fin/Subset.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 24.3650793651, "max_line_length": 72, "alphanum_fraction": 0.4299674267, "num_tokens": 418, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357598021706, "lm_q2_score": 0.8006920116079209, "lm_q1q2_score": 0.6942286066520021}} {"text": "------------------------------------------------------------------------\n-- Properties of functions\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe --exact-split #-}\n\nmodule Math.Combinatorics.ListFunction.Properties where\n\n-- agda-stdlib\nopen import Data.List hiding (_∷ʳ_)\nimport Data.List.Properties as Lₚ\nopen import Data.List.Membership.Propositional using (_∈_; _∉_)\nimport Data.List.Membership.Propositional.Properties as ∈ₚ\nopen import Data.List.Relation.Binary.BagAndSetEquality\nopen import Data.List.Relation.Binary.Sublist.Propositional using (_⊆_; []; _∷_; _∷ʳ_)\nimport Data.List.Relation.Binary.Sublist.Propositional.Properties as Sublistₚ\nopen import Data.List.Relation.Unary.All as All using (All; []; _∷_)\nimport Data.List.Relation.Unary.All.Properties as Allₚ\nopen import Data.List.Relation.Unary.AllPairs using (AllPairs; []; _∷_)\nopen import Data.List.Relation.Unary.Any as Any using (Any; here; there)\nimport Data.List.Relation.Unary.Unique.Propositional as UniqueP\nimport Data.List.Relation.Unary.Unique.Propositional.Properties as UniquePₚ\nimport Data.List.Relation.Unary.Unique.Setoid as UniqueS\nimport Data.List.Relation.Unary.Unique.Setoid.Properties as UniqueSₚ\nopen import Data.Nat\nopen import Data.Product as Prod using (_×_; _,_; ∃; proj₁; proj₂)\nopen import Data.Sum using (inj₁; inj₂)\nopen import Function.Base\nopen import Function.Equivalence using (_⇔_; equivalence) -- TODO: use new packages\nopen import Relation.Binary.PropositionalEquality as P\n\n-- agda-combinatorics\nopen import Math.Combinatorics.Function\nopen import Math.Combinatorics.Function.Properties\nopen import Math.Combinatorics.ListFunction\nimport Math.Combinatorics.ListFunction.Properties.Lemma as Lemma\n\n------------------------------------------------------------------------\n-- Properties of `applyEach`\n\nmodule _ {a} {A : Set a} where\n open ≡-Reasoning\n\n length-applyEach : ∀ (f : A → A) (xs : List A) →\n length (applyEach f xs) ≡ length xs\n length-applyEach f [] = refl\n length-applyEach f (x ∷ xs) = begin\n 1 + length (map (x ∷_) (applyEach f xs))\n ≡⟨ cong suc $ Lₚ.length-map (x ∷_) (applyEach f xs ) ⟩\n 1 + length (applyEach f xs)\n ≡⟨ cong suc $ length-applyEach f xs ⟩\n 1 + length xs\n ∎\n\n All-length-applyEach : ∀ (f : A → A) (xs : List A) →\n All (λ ys → length ys ≡ length xs) (applyEach f xs)\n All-length-applyEach f [] = []\n All-length-applyEach f (x ∷ xs) =\n refl ∷ (Allₚ.map⁺ $ All.map (cong suc) $ All-length-applyEach f xs)\n\n applyEach-cong : ∀ (f g : A → A) (xs : List A) →\n (∀ x → f x ≡ g x) → applyEach f xs ≡ applyEach g xs\n applyEach-cong f g [] f≡g = refl\n applyEach-cong f g (x ∷ xs) f≡g = begin\n (f x ∷ xs) ∷ map (_∷_ x) (applyEach f xs)\n ≡⟨ cong₂ (λ u v → (u ∷ xs) ∷ map (_∷_ x) v) (f≡g x) (applyEach-cong f g xs f≡g) ⟩\n (g x ∷ xs) ∷ map (_∷_ x) (applyEach g xs)\n ∎\n\n------------------------------------------------------------------------\n-- Properties of `combinations`\n\nmodule _ {a} {A : Set a} where\n open ≡-Reasoning\n\n length-combinations : ∀ (k : ℕ) (xs : List A) →\n length (combinations k xs) ≡ C (length xs) k\n length-combinations 0 xs = refl\n length-combinations (suc k) [] = refl\n length-combinations (suc k) (x ∷ xs) = begin\n length (map (x ∷_) (combinations k xs) ++ combinations (suc k) xs)\n ≡⟨ Lₚ.length-++ (map (x ∷_) (combinations k xs)) ⟩\n length (map (x ∷_) (combinations k xs)) + length (combinations (suc k) xs)\n ≡⟨ cong₂ _+_ (Lₚ.length-map (x ∷_) (combinations k xs)) refl ⟩\n length (combinations k xs) + length (combinations (suc k) xs)\n ≡⟨ cong₂ _+_ (length-combinations k xs) (length-combinations (suc k) xs) ⟩\n C (length xs) k + C (length xs) (suc k)\n ≡⟨ sym $ C[1+n,1+k]≡C[n,k]+C[n,1+k] (length xs) k ⟩\n C (length (x ∷ xs)) (suc k)\n ∎\n\n All-length-combinations : ∀ (k : ℕ) (xs : List A) →\n All (λ ys → length ys ≡ k) (combinations k xs)\n All-length-combinations 0 xs = refl ∷ []\n All-length-combinations (suc k) [] = []\n All-length-combinations (suc k) (x ∷ xs) =\n Allₚ.++⁺ (Allₚ.map⁺ $ All.map (cong suc) $ All-length-combinations k xs)\n (All-length-combinations (suc k) xs)\n\n ∈-length-combinations : ∀ (xs : List A) k ys → xs ∈ combinations k ys → length xs ≡ k\n ∈-length-combinations xs k ys xs∈combinations[k,ys] =\n All.lookup (All-length-combinations k ys) xs∈combinations[k,ys]\n\n combinations-⊆⇒∈ : ∀ {xs ys : List A} → xs ⊆ ys → xs ∈ combinations (length xs) ys\n combinations-⊆⇒∈ {[]} {ys} xs⊆ys = here refl\n combinations-⊆⇒∈ {x ∷ xs} {y ∷ ys} (.y ∷ʳ x∷xs⊆ys) =\n ∈ₚ.∈-++⁺ʳ (map (y ∷_) (combinations (length xs) ys)) (combinations-⊆⇒∈ x∷xs⊆ys)\n combinations-⊆⇒∈ {x ∷ xs} {.x ∷ ys} (refl ∷ xs⊆ys) =\n ∈ₚ.∈-++⁺ˡ $ ∈ₚ.∈-map⁺ (x ∷_) $ combinations-⊆⇒∈ xs⊆ys\n\n combinations-∈⇒⊆ : ∀ {xs ys : List A} → xs ∈ combinations (length xs) ys → xs ⊆ ys\n combinations-∈⇒⊆ {[]} {ys} _ = Lemma.[]⊆xs ys\n combinations-∈⇒⊆ {x ∷ xs} {y ∷ ys} x∷xs∈c[len[x∷xs],y∷ys]\n with ∈ₚ.∈-++⁻ (map (y ∷_) (combinations (length xs) ys)) x∷xs∈c[len[x∷xs],y∷ys]\n ... | inj₁ x∷xs∈map[y∷-][c[len[xs],ys]]\n with ∈ₚ.∈-map⁻ (y ∷_) x∷xs∈map[y∷-][c[len[xs],ys]] -- ∷ ∃ λ zs → zs ∈ combinations (length xs) ys × x ∷ xs ≡ y ∷ zs\n combinations-∈⇒⊆ {x ∷ xs} {y ∷ ys} _ | inj₁ _\n | zs , (zs∈c[len[xs],ys] , x∷xs≡y∷zs) = x≡y ∷ xs⊆ys\n where\n xs≡zs : xs ≡ zs\n xs≡zs = Lₚ.∷-injectiveʳ x∷xs≡y∷zs\n x≡y : x ≡ y\n x≡y = Lₚ.∷-injectiveˡ x∷xs≡y∷zs\n xs⊆ys : xs ⊆ ys\n xs⊆ys = combinations-∈⇒⊆ $ subst (λ v → v ∈ combinations (length xs) ys)\n (sym xs≡zs) zs∈c[len[xs],ys]\n combinations-∈⇒⊆ {x ∷ xs} {y ∷ ys} _ | inj₂ x∷xs∈c[len[x∷xs],ys] = y ∷ʳ x∷xs⊆ys\n where\n x∷xs⊆ys : x ∷ xs ⊆ ys\n x∷xs⊆ys = combinations-∈⇒⊆ x∷xs∈c[len[x∷xs],ys]\n\n combinations-∈⇔⊆ : ∀ {xs ys : List A} → (xs ∈ combinations (length xs) ys) ⇔ (xs ⊆ ys)\n combinations-∈⇔⊆ = equivalence combinations-∈⇒⊆ combinations-⊆⇒∈\n\n All-⊆-combinations : ∀ k (xs : List A) → All (_⊆ xs) (combinations k xs)\n All-⊆-combinations k xs = All.tabulate λ {ys} ys∈combinations[k,xs] →\n combinations-∈⇒⊆ $ subst (λ v → ys ∈ combinations v xs)\n (sym $ ∈-length-combinations ys k xs ys∈combinations[k,xs])\n ys∈combinations[k,xs]\n\n combinations-∈⇒⊆∧length : ∀ {xs : List A} {k ys} →\n xs ∈ combinations k ys → (xs ⊆ ys × length xs ≡ k)\n combinations-∈⇒⊆∧length {xs} {k} {ys} xs∈c[k,ys] =\n combinations-∈⇒⊆ xs∈c[len[xs],ys] , length[xs]≡k\n where\n length[xs]≡k : length xs ≡ k\n length[xs]≡k = ∈-length-combinations xs k ys xs∈c[k,ys]\n xs∈c[len[xs],ys] : xs ∈ combinations (length xs) ys\n xs∈c[len[xs],ys] =\n subst (λ v → xs ∈ combinations v ys) (sym length[xs]≡k) xs∈c[k,ys]\n\n combinations-⊆∧length⇒∈ : ∀ {xs ys : List A} {k} →\n (xs ⊆ ys × length xs ≡ k) → xs ∈ combinations k ys\n combinations-⊆∧length⇒∈ {xs} {ys} {k} (xs⊆ys , len[xs]≡k) =\n subst (λ v → xs ∈ combinations v ys) len[xs]≡k (combinations-⊆⇒∈ xs⊆ys)\n\n combinations-∈⇔⊆∧length : ∀ {xs : List A} {k} {ys} →\n xs ∈ combinations k ys ⇔ (xs ⊆ ys × length xs ≡ k)\n combinations-∈⇔⊆∧length =\n equivalence combinations-∈⇒⊆∧length combinations-⊆∧length⇒∈\n\n unique-combinations : ∀ k {xs : List A} →\n UniqueP.Unique xs → UniqueP.Unique (combinations k xs)\n unique-combinations 0 {xs} xs-unique = [] ∷ []\n unique-combinations (suc k) {[]} xs-unique = []\n unique-combinations (suc k) {x ∷ xs} (All[x≢-]xs ∷ xs-unique) =\n UniquePₚ.++⁺ {_} {_} {map (x ∷_) (combinations k xs)} {combinations (suc k) xs}\n (UniquePₚ.map⁺ Lₚ.∷-injectiveʳ (unique-combinations k {xs} xs-unique))\n (unique-combinations (suc k) {xs} xs-unique)\n λ {vs} vs∈map[x∷-]c[k,xs]×vs∈c[1+k,xs] →\n let\n vs∈map[x∷-]c[k,xs] = proj₁ vs∈map[x∷-]c[k,xs]×vs∈c[1+k,xs]\n vs∈c[1+k,xs] = proj₂ vs∈map[x∷-]c[k,xs]×vs∈c[1+k,xs]\n proof = ∈ₚ.∈-map⁻ (x ∷_) vs∈map[x∷-]c[k,xs]\n us = proj₁ proof\n vs≡x∷us : vs ≡ x ∷ us\n vs≡x∷us = proj₂ (proj₂ proof)\n x∈vs : x ∈ vs\n x∈vs = subst (x ∈_) (sym vs≡x∷us) (here refl)\n vs⊆xs : vs ⊆ xs\n vs⊆xs = proj₁ $ combinations-∈⇒⊆∧length {vs} {suc k} {xs} vs∈c[1+k,xs]\n All[x≢-]vs : All (x ≢_) vs\n All[x≢-]vs = Sublistₚ.All-resp-⊆ vs⊆xs All[x≢-]xs\n x∉vs : x ∉ vs\n x∉vs = Allₚ.All¬⇒¬Any All[x≢-]vs\n in x∉vs x∈vs\n {-\n -- unique⇒drop-cons-set : ∀ {a} {A : Set a} {x : A} {xs ys} →\n unique-combinations-set : ∀ k {xs : List A} →\n UniqueP.Unique xs → UniqueS.Unique ([ set ]-Equality A) (combinations k xs)\n unique-combinations-set 0 xs-unique = [] ∷ []\n unique-combinations-set (suc k) {[]} xs-unique = []\n unique-combinations-set (suc k) {x ∷ xs} (this ∷ xs-unique) =\n UniqueSₚ.++⁺ ([ set ]-Equality A)\n (UniqueSₚ.map⁺ ([ set ]-Equality A) ([ set ]-Equality A) (λ → {! !}) (unique-combinations-set k {xs} xs-unique))\n (unique-combinations-set (suc k) {xs} xs-unique)\n {! !}\n -- {- x∉xs -} Unique -[ set ] xs → Unique -[ set ] (x ∷ xs)\n -}\n\nmodule _ {a b} {A : Set a} {B : Set b} where\n combinations-map : ∀ k (f : A → B) (xs : List A) →\n combinations k (map f xs) ≡ map (map f) (combinations k xs)\n combinations-map 0 f xs = refl\n combinations-map (suc k) f [] = refl\n combinations-map (suc k) f (x ∷ xs) = begin\n map (f x ∷_) (combinations k (map f xs)) ++ combinations (suc k) (map f xs)\n ≡⟨ cong₂ _++_ (cong (map (f x ∷_)) (combinations-map k f xs)) (combinations-map (suc k) f xs) ⟩\n map (f x ∷_) (map (map f) (combinations k xs)) ++ map (map f) (combinations (suc k) xs)\n ≡⟨ cong (_++ map (map f) (combinations (suc k) xs)) $ Lemma.lemma₁ f x (combinations k xs) ⟩\n map (map f) (map (x ∷_) (combinations k xs)) ++ map (map f) (combinations (suc k) xs)\n ≡⟨ sym $ Lₚ.map-++-commute (map f) (map (x ∷_) (combinations k xs)) (combinations (suc k) xs) ⟩\n map (map f) (map (x ∷_) (combinations k xs) ++ combinations (suc k) xs)\n ∎\n where open ≡-Reasoning\n\n------------------------------------------------------------------------\n-- Properties of `combinationsWithComplement`\n\nmodule _ {a} {A : Set a} where\n open ≡-Reasoning\n\n map-proj₁-combinationsWithComplement : ∀ k (xs : List A) →\n map proj₁ (combinationsWithComplement k xs) ≡ combinations k xs\n map-proj₁-combinationsWithComplement 0 xs = refl\n map-proj₁-combinationsWithComplement (suc k) [] = refl\n map-proj₁-combinationsWithComplement (suc k) (x ∷ xs) = begin\n map proj₁ (map f ys ++ map g zs)\n ≡⟨ Lₚ.map-++-commute proj₁ (map f ys) (map g zs) ⟩\n map proj₁ (map f ys) ++ map proj₁ (map g zs)\n ≡⟨ sym $ Lₚ.map-compose ys ⟨ cong₂ _++_ ⟩ Lₚ.map-compose zs ⟩\n map (proj₁ ∘′ f) ys ++ map (λ v → proj₁ (g v)) zs\n ≡⟨ Lₚ.map-cong lemma₁ ys ⟨ cong₂ _++_ ⟩ Lₚ.map-cong lemma₂ zs ⟩\n map ((x ∷_) ∘′ proj₁) ys ++ map proj₁ zs\n ≡⟨ cong (_++ map proj₁ zs) $ Lₚ.map-compose ys ⟩\n map (x ∷_) (map proj₁ ys) ++ map proj₁ zs\n ≡⟨ cong (map (x ∷_)) (map-proj₁-combinationsWithComplement k xs) ⟨ cong₂ _++_ ⟩ map-proj₁-combinationsWithComplement (suc k) xs ⟩\n map (x ∷_) (combinations k xs) ++ combinations (suc k) xs\n ∎\n where\n ys = combinationsWithComplement k xs\n zs = combinationsWithComplement (suc k) xs\n f g : List A × List A → List A × List A\n f = Prod.map₁ (x ∷_)\n g = Prod.map₂ (x ∷_)\n lemma₁ : ∀ (t : List A × List A) → proj₁ (Prod.map₁ (x ∷_) t) ≡ x ∷ proj₁ t\n lemma₁ t = Lemma.proj₁-map₁ (x ∷_) t\n lemma₂ : ∀ (t : List A × List A) → Lemma.proj₁′ {_} {_} {_} {List A} (Prod.map₂ (x ∷_) t) ≡ proj₁ t\n lemma₂ t = Lemma.proj₁-map₂ (x ∷_) t\n\n length-combinationsWithComplement : ∀ k (xs : List A) →\n length (combinationsWithComplement k xs) ≡ C (length xs) k\n length-combinationsWithComplement k xs = begin\n length (combinationsWithComplement k xs)\n ≡⟨ sym $ Lₚ.length-map proj₁ (combinationsWithComplement k xs) ⟩\n length (map proj₁ (combinationsWithComplement k xs))\n ≡⟨ cong length $ map-proj₁-combinationsWithComplement k xs ⟩\n length (combinations k xs)\n ≡⟨ length-combinations k xs ⟩\n C (length xs) k\n ∎\n\n------------------------------------------------------------------------\n-- Properties of `splits₂`\n\nmodule _ {a} {A : Set a} where\n open ≡-Reasoning\n open Prod using (map₁; map₂)\n\n length-splits₂ : ∀ (xs : List A) → length (splits₂ xs) ≡ 1 + length xs\n length-splits₂ [] = refl\n length-splits₂ (x ∷ xs) = begin\n 1 + length (map (map₁ (x ∷_)) (splits₂ xs))\n ≡⟨ cong (1 +_) $ Lₚ.length-map (map₁ (x ∷_)) (splits₂ xs) ⟩\n 1 + length (splits₂ xs)\n ≡⟨ cong (1 +_) $ length-splits₂ xs ⟩\n 1 + length (x ∷ xs)\n ∎\n\n splits₂-defn : ∀ (xs : List A) → splits₂ xs ≡ zip (inits xs) (tails xs)\n splits₂-defn [] = refl\n splits₂-defn (x ∷ xs) = begin\n splits₂ (x ∷ xs) ≡⟨⟩\n ([] , x ∷ xs) ∷ map (map₁ (x ∷_)) (splits₂ xs)\n ≡⟨ cong (([] , x ∷ xs) ∷_) (begin\n map (map₁ (x ∷_)) (splits₂ xs)\n ≡⟨ cong (map (map₁ (x ∷_))) $ splits₂-defn xs ⟩\n map (map₁ (x ∷_)) (zip is ts)\n ≡⟨ Lₚ.map-zipWith _,_ (map₁ (x ∷_)) is ts ⟩\n zipWith (λ ys zs → map₁ (x ∷_) (ys , zs)) is ts\n ≡⟨ sym $ Lₚ.zipWith-map _,_ (x ∷_) id is ts ⟩\n zip (map (x ∷_) is) (map id ts)\n ≡⟨ cong (zip (map (x ∷_) is)) $ Lₚ.map-id ts ⟩\n zip (map (x ∷_) is) ts\n ∎) ⟩\n ([] , x ∷ xs) ∷ zip (map (x ∷_) is) ts\n ∎\n where\n is = inits xs\n ts = tails xs\n\n All-++-splits₂ : (xs : List A) →\n All (Prod.uncurry (λ ys zs → ys ++ zs ≡ xs)) (splits₂ xs)\n All-++-splits₂ [] = refl ∷ []\n All-++-splits₂ (x ∷ xs) =\n All._∷_ refl $ Allₚ.map⁺ $ All.map (cong (x ∷_)) $ All-++-splits₂ xs\n\n splits₂-∈⇒++ : {xs ys zs : List A} → (ys , zs) ∈ splits₂ xs → ys ++ zs ≡ xs\n splits₂-∈⇒++ {xs = xs} = All.lookup (All-++-splits₂ xs)\n\n private\n [],xs∈splits₂[xs] : (xs : List A) → ([] , xs) ∈ splits₂ xs\n [],xs∈splits₂[xs] [] = here refl\n [],xs∈splits₂[xs] (x ∷ xs) = here refl\n\n ∈-split₂-++ : (xs ys : List A) → (xs , ys) ∈ splits₂ (xs ++ ys)\n ∈-split₂-++ [] ys = [],xs∈splits₂[xs] ys\n ∈-split₂-++ (x ∷ xs) ys =\n Any.there $ ∈ₚ.∈-map⁺ (map₁ (x ∷_)) $ ∈-split₂-++ xs ys\n\n splits₂-++⇒∈ : {xs ys zs : List A} → xs ++ ys ≡ zs → (xs , ys) ∈ splits₂ zs\n splits₂-++⇒∈ {xs} {ys} {zs} xs++ys≡zs =\n subst (λ v → (xs , ys) ∈ splits₂ v) xs++ys≡zs (∈-split₂-++ xs ys)\n\n splits₂-∈⇔++ : {xs ys zs : List A} → (xs , ys) ∈ splits₂ zs ⇔ xs ++ ys ≡ zs\n splits₂-∈⇔++ = equivalence splits₂-∈⇒++ splits₂-++⇒∈\n\nmodule _ {a b} {A : Set a} {B : Set b} where\n open ≡-Reasoning\n\n {-\n splits₂-map : ∀ (f : A → B) (xs : List A) →\n splits₂ (map f xs) ≡ map (Prod.map (map f) (map f)) (splits₂ xs)\n splits₂-map f [] = refl\n splits₂-map f (x ∷ xs) = {! !}\n -}\n -- length[xs]\n\n {- contexts are lists of Tp's -}\n Ctx = List Tp\n _,,_ : Ctx → Tp → Ctx\n Γ ,, τ = τ :: Γ\n\n infixr 10 _⇒_\n infixr 9 _,,_\n infixr 8 _|-_ -- type \\entails\n\n {- Γ ⊢ τ represents a term of type τ in context Γ -}\n data _|-_ (Γ : Ctx) : Tp → Set where\n c : Γ |- b -- some constant of the base type\n v : {τ : Tp} \n → τ ∈ Γ\n → Γ |- τ \n lam : {τ1 τ2 : Tp} \n → Γ ,, τ1 |- τ2\n → Γ |- τ1 ⇒ τ2\n app : {τ1 τ2 : Tp} \n → Γ |- τ1 ⇒ τ2 \n → Γ |- τ1 \n → Γ |- τ2\n\n module Examples where\n i : [] |- b ⇒ b\n i = lam (v i0) -- \\ x -> x\n \n k : [] |- b ⇒ b ⇒ b\n k = lam (lam (v (iS i0))) -- \\ x -> \\ y -> x\n \n {- TASK 1: Define a term representing \\ x -> \\ y -> y -}\n k' : [] |- b ⇒ b ⇒ b\n k' = lam (lam (v i0))\n \n\n {- The following proof is like a \"0-ary\" logical relation.\n It gives a semantics of the STLC in Agda.\n This shows that the STLC is sound, relative to Agda. \n -}\n module Semantics (B : Set) (elB : B) where \n -- works for any interpretation of the base type b\n\n -- function mapping STLC types to Agda types\n [_]t : Tp → Set -- type \\(0 and \\)0\n [ b ]t = B\n [ τ1 ⇒ τ2 ]t = [ τ1 ]t → [ τ2 ]t\n\n -- function mapping STLC contexts to Agda types\n [_]c : Ctx → Set\n [ [] ]c = Unit\n [ τ :: Γ ]c = [ Γ ]c × [ τ ]t\n\n {- TASK 2 : Define the interpretation of terms -}\n [_] : {Γ : Ctx} {τ : Tp} → Γ |- τ → [ Γ ]c → [ τ ]t\n [ c ] γ = elB\n [ v i0 ] γ = snd γ\n [ v (iS x) ] γ = [ v x ] (fst γ) \n [ lam e ] γ = \\ x → [ e ] (γ , x)\n [ app e1 e2 ] γ = [ e1 ] γ ([ e2 ] γ)\n\n {- the following test should pass\n test : ⟦ Examples.k ⟧ == \\ γ x y → x\n test = Refl\n -}\n\n\n\n {- you can ignore the implementation of this module.\n the interface for the components you need is listed below\n -}\n module RenamingAndSubstitution where \n\n -- renamings = variable for variable substitutions.\n -- For simplicity, these are defined as tuples, by recursion on the context.\n -- It might clean up some of the proofs to use a functional view,\n -- {τ : Tp} → τ ∈ Γ → τ ∈ Γ'\n -- because then we could avoid some of the inductions here,\n -- and some of the associativity/unit properties would be free. \n module Renamings where\n\n infix 9 _⊇_\n \n _⊇_ : Ctx → Ctx → Set -- type \\sup=\n Γ' ⊇ [] = Unit\n Γ' ⊇ (τ :: Γ) = (Γ' ⊇ Γ) × (τ ∈ Γ')\n\n -- variables are functorial in the context\n rename-var : {Γ Γ' : Ctx} {τ : Tp} → Γ' ⊇ Γ → τ ∈ Γ → τ ∈ Γ'\n rename-var (ρ , x') i0 = x'\n rename-var (ρ , _) (iS x) = rename-var ρ x\n \n {- conceptually, we could define p and ⊇-compose and ⊇-id as primitive\n and derive this.\n but this works better inductively than ⊇-single does.\n -}\n p· : {Γ : Ctx} {Γ' : Ctx} → Γ ⊇ Γ' → {τ : Tp} → (Γ ,, τ) ⊇ Γ'\n p· {Γ' = []} ren = <>\n p· {Γ' = (τ :: Γ')} (ρ , x) = p· ρ , iS x\n \n idr : {Γ : Ctx} → Γ ⊇ Γ\n idr {[]} = <>\n idr {τ :: Γ} = p· idr , i0\n \n _·rr_ : {Γ1 Γ2 Γ3 : Ctx} → Γ1 ⊇ Γ2 → Γ2 ⊇ Γ3 → Γ1 ⊇ Γ3\n _·rr_ {Γ1} {Γ2} {[]} ρ2 ρ3 = <>\n _·rr_ {Γ1} {Γ2} {x :: Γ3} ρ2 (ρ3 , x3) = (ρ2 ·rr ρ3) , rename-var ρ2 x3\n\n -- category with families notation\n p : {Γ : Ctx} {τ : Tp} → (Γ ,, τ ⊇ Γ) \n p = p· idr \n \n -- next, we should show associativity and unit laws for ∘rr.\n -- However:\n -- (1) because renamings are defined using variables, this depends on (some of) functoriality of τ ∈ -,\n -- so we define that here, too. \n -- (2) we only need one of the unit laws\n\n rename-var-· : {Γ1 Γ2 Γ3 : Ctx} → (ρ2 : Γ1 ⊇ Γ2) (ρ3 : Γ2 ⊇ Γ3) {τ : Tp} (x : τ ∈ Γ3)\n → rename-var ρ2 (rename-var ρ3 x) == rename-var (_·rr_ ρ2 ρ3) x\n rename-var-· ρ2 ρ3 i0 = Refl\n rename-var-· ρ2 ρ3 (iS x) = rename-var-· ρ2 (fst ρ3) x\n\n ·rr-assoc : {Γ1 Γ2 Γ3 Γ4 : Ctx} → (ρ2 : Γ1 ⊇ Γ2) (ρ3 : Γ2 ⊇ Γ3) (ρ4 : Γ3 ⊇ Γ4) → _·rr_ ρ2 (_·rr_ ρ3 ρ4) == _·rr_ (_·rr_ ρ2 ρ3) ρ4 \n ·rr-assoc {Γ4 = []} ρ2 ρ3 ρ4 = Refl\n ·rr-assoc {Γ4 = τ4 :: Γ4} ρ2 ρ3 (ρ4 , x4) = ap2 _,_ (·rr-assoc ρ2 ρ3 ρ4) (rename-var-· ρ2 ρ3 x4)\n\n -- rest of functoriality of rename-var\n mutual\n -- generalization to get the induction to go through\n rename-var-p' : {Γ Γ' : Ctx} {τ τ' : Tp} (ρ : Γ' ⊇ Γ) (x : τ ∈ Γ) → rename-var (p· ρ {τ'}) x == (iS (rename-var ρ x))\n rename-var-p' ρ i0 = Refl\n rename-var-p' (ρ , _) (iS x) = rename-var-p' ρ x\n \n -- this would be definitional if renamings were functions.\n -- this instances is often needed below\n rename-var-p : {Γ : Ctx} {τ τ' : Tp} (x : τ ∈ Γ) → rename-var (p· idr {τ'}) x == (iS x)\n rename-var-p x = ap iS (rename-var-ident _ x) ∘ rename-var-p' idr x\n\n rename-var-ident : {τ : Tp} (Γ : Ctx) (x : τ ∈ Γ) → rename-var idr x == x\n rename-var-ident .(τ :: Γ) (i0 {τ} {Γ}) = Refl\n rename-var-ident .(τ' :: Γ) (iS {τ} {τ'} {Γ} x) = rename-var-p x\n\n -- beta reduction for p\n pβ1' : {Γ1 Γ2 Γ3 : Ctx} → (ρ2 : Γ1 ⊇ Γ2) (ρ3 : Γ2 ⊇ Γ3) {τ : Tp} (x : τ ∈ Γ1)\n → (ρ2 , x) ·rr (p· ρ3) == (ρ2 ·rr ρ3)\n pβ1' {Γ1} {_} {[]} ρ2 ρ3 x = Refl\n pβ1' {Γ1} {_} {τ3 :: Γ3} ρ2 (ρ3 , x3) x₁ = ap (λ x → x , rename-var ρ2 x3) (pβ1' ρ2 ρ3 _)\n\n mutual\n ·rr-unitr : {Γ1 Γ2 : Ctx} → (ρ2 : Γ1 ⊇ Γ2) \n → ρ2 ·rr idr == ρ2\n ·rr-unitr {Γ1} {[]} ρ2 = Refl\n ·rr-unitr {Γ1} {τ2 :: Γ2} (ρ2 , x2) = ap (λ x → x , x2) (pβ1 ρ2 x2)\n \n pβ1 : {Γ1 Γ2 : Ctx} → (ρ2 : Γ1 ⊇ Γ2) {τ : Tp} (x : τ ∈ Γ1)\n → (ρ2 , x) ·rr p == ρ2\n pβ1 ρ2 x = ·rr-unitr ρ2 ∘ pβ1' ρ2 idr x\n\n -- p· is equivalent to the alternate definition.\n p·-def : {Γ1 Γ2 : Ctx} {τ : Tp} (ρ : Γ1 ⊇ Γ2) → p· ρ {τ} == p ·rr ρ\n p·-def {_}{[]} ρ = Refl\n p·-def {_}{τ1 :: Γ1} (ρ , x) = ap2 _,_ (p·-def ρ) (! (rename-var-p x))\n\n\n -- terms are functorial in renamings\n\n addvar-ren : {Γ Γ' : Ctx} {τ : Tp} → Γ' ⊇ Γ → Γ' ,, τ ⊇ Γ ,, τ\n addvar-ren ρ = (p· ρ , i0)\n \n rename : {Γ Γ' : Ctx} {τ : Tp} → Γ' ⊇ Γ → Γ |- τ → Γ' |- τ\n rename ρ c = c\n rename ρ (v x) = v (rename-var ρ x)\n rename ρ (lam e) = lam (rename (addvar-ren ρ) e)\n rename ρ (app e e') = app (rename ρ e) (rename ρ e')\n\n rename-· : {Γ1 Γ2 Γ3 : Ctx} → (ρ2 : Γ1 ⊇ Γ2) (ρ3 : Γ2 ⊇ Γ3) {τ : Tp} (e : Γ3 |- τ)\n → rename ρ2 (rename ρ3 e) == rename (ρ2 ·rr ρ3) e\n rename-· ρ2 ρ3 c = Refl\n rename-· ρ2 ρ3 (v x) = ap v (rename-var-· ρ2 ρ3 x)\n rename-·{Γ1}{Γ2}{Γ3} ρ2 ρ3 (lam e) = ap lam (ap (λ x → rename (x , i0) e) lemma1 ∘ rename-· (addvar-ren ρ2) (addvar-ren ρ3) e) where\n lemma1 : (p· ρ2 , i0) ·rr (p· ρ3) == p· (ρ2 ·rr ρ3)\n lemma1 = (p· ρ2 , i0) ·rr (p· ρ3) =⟨ pβ1' (p· ρ2) ρ3 i0 ⟩\n (p· ρ2) ·rr ρ3 =⟨ ap (λ x → _·rr_ x ρ3) (p·-def ρ2) ⟩\n (p ·rr ρ2) ·rr ρ3 =⟨ ! (·rr-assoc p ρ2 ρ3) ⟩ \n p ·rr (ρ2 ·rr ρ3) =⟨ ! (p·-def (ρ2 ·rr ρ3))⟩\n p· (ρ2 ·rr ρ3) ∎\n rename-· ρ2 ρ3 (app e e₁) = ap2 app (rename-· ρ2 ρ3 e) (rename-· ρ2 ρ3 e₁)\n\n -- not necessary for the proof, but an easy corollary of the above\n rename-id : {Γ : Ctx}{τ : Tp} (e : Γ |- τ) → rename idr e == e\n rename-id c = Refl\n rename-id (v x) = ap v (rename-var-ident _ x)\n rename-id (lam e) = ap lam (rename-id e)\n rename-id (app e e₁) = ap2 app (rename-id e) (rename-id e₁)\n open Renamings\n\n -- expression-for-variable substitutions\n\n module Subst where\n\n _|-c_ : Ctx → Ctx → Set\n Γ' |-c [] = Unit\n Γ' |-c (τ :: Γ) = (Γ' |-c Γ) × (Γ' |- τ) \n \n _·rs_ : {Γ1 Γ2 Γ3 : Ctx} → Γ1 ⊇ Γ2 → Γ2 |-c Γ3 → Γ1 |-c Γ3\n _·rs_ {Γ1} {Γ2} {[]} ρ θ = <>\n _·rs_ {Γ1} {Γ2} {τ3 :: Γ3} ρ (θ , e) = ρ ·rs θ , rename ρ e\n \n addvar : {Γ Γ' : Ctx} {τ : Tp} → Γ |-c Γ' → (Γ ,, τ) |-c (Γ' ,, τ)\n addvar θ = p ·rs θ , v i0\n \n ids : {Γ : Ctx} → Γ |-c Γ\n ids {[]} = <>\n ids {τ :: Γ} = p ·rs ids , v i0\n \n subst-var : {Γ Γ' : Ctx}{τ : Tp} → Γ |-c Γ' → τ ∈ Γ' → Γ |- τ\n subst-var (θ , e) i0 = e\n subst-var (θ , _) (iS x) = subst-var θ x\n\n subst : {Γ Γ' : Ctx}{τ : Tp} → Γ |-c Γ' → Γ' |- τ → Γ |- τ\n subst θ c = c\n subst θ (v x) = subst-var θ x\n subst θ (lam e) = lam (subst (addvar θ) e)\n subst θ (app e e') = app (subst θ e) (subst θ e')\n \n subst1 : {τ τ0 : Tp} → [] |- τ0 → ([] ,, τ0) |- τ → [] |- τ\n subst1 e0 e = subst (<> , e0) e\n\n\n -- composition of renamings and substitutions\n\n _·sr_ : {Γ1 Γ2 Γ3 : Ctx} → Γ1 |-c Γ2 → Γ2 ⊇ Γ3 → Γ1 |-c Γ3\n _·sr_ {Γ1} {Γ2} {[]} θ ρ = <>\n _·sr_ {Γ1} {Γ2} {τ3 :: Γ3} θ (ρ , x) = _·sr_ θ ρ , subst-var θ x\n\n _·ss_ : {Γ1 Γ2 Γ3 : Ctx} → Γ1 |-c Γ2 → Γ2 |-c Γ3 → Γ1 |-c Γ3\n _·ss_ {Γ3 = []} θ1 θ2 = <>\n _·ss_ {Γ1} {Γ2} {τ :: Γ3} θ1 (θ2 , e2) = θ1 ·ss θ2 , subst θ1 e2\n\n \n -- subst var functoriality\n\n subst-var-·rs : {Γ1 Γ2 Γ3 : Ctx} (ρ : Γ1 ⊇ Γ2) (θ : Γ2 |-c Γ3) {τ : Tp} (x : τ ∈ Γ3)\n → subst-var (ρ ·rs θ) x == rename ρ (subst-var θ x)\n subst-var-·rs ρ θ i0 = Refl\n subst-var-·rs ρ (θ , _) (iS x) = subst-var-·rs ρ θ x\n\n subst-var-∘ss : {Γ1 Γ2 Γ3 : Ctx} → (θ2 : Γ1 |-c Γ2) (θ3 : Γ2 |-c Γ3) {τ : Tp} (x : τ ∈ Γ3)\n → subst-var (_·ss_ θ2 θ3) x == subst θ2 (subst-var θ3 x)\n subst-var-∘ss θ2 θ3 i0 = Refl\n subst-var-∘ss θ2 (θ3 , _) (iS x) = subst-var-∘ss θ2 θ3 x\n\n subst-var-·sr : {Γ1 Γ2 Γ3 : Ctx} {τ : Tp} → (θ2 : Γ1 |-c Γ2) (ρ : Γ2 ⊇ Γ3) (x : τ ∈ Γ3)\n → (subst-var θ2 (rename-var ρ x)) == subst-var (_·sr_ θ2 ρ) x\n subst-var-·sr θ2 ρ i0 = Refl\n subst-var-·sr θ2 ρ (iS x) = subst-var-·sr θ2 (fst ρ) x\n\n subst-var-id : {Γ : Ctx} {τ : Tp} → (x : τ ∈ Γ) → v x == subst-var ids x\n subst-var-id i0 = Refl\n subst-var-id {τ :: Γ} (iS x) = !\n (_ =〈 subst-var-·rs (p· idr) ids x 〉\n rename (p· idr) _ =〈 ! (ap (rename (p· idr)) (subst-var-id x)) 〉\n rename (p· idr) (v x) =〈 ap v (rename-var-p x) 〉\n v (iS x) ∎)\n\n\n -- associativity and unit laws for composition.\n -- also includes some β rules for composing with p.\n -- and functoriality of subst in the various compositions, since substitutions involve terms.\n\n ∘rsr-assoc : {Γ1 Γ2 Γ3 Γ4 : Ctx} → (ρ2 : Γ1 ⊇ Γ2) (θ3 : Γ2 ⊢c Γ3) (ρ4 : Γ3 ⊇ Γ4)\n → (ρ2 ·rs θ3) ·sr ρ4 == ρ2 ·rs (θ3 ·sr ρ4)\n ∘rsr-assoc {Γ1} {Γ2} {Γ3} {[]} ρ2 θ3 ρ4 = Refl\n ∘rsr-assoc {Γ1} {Γ2} {Γ3} {τ4 :: Γ4} ρ2 θ3 (ρ4 , x4) = ap2 _,_ (∘rsr-assoc ρ2 θ3 ρ4) (subst-var-·rs ρ2 θ3 x4)\n\n ·sr-pβ' : {Γ1 Γ2 Γ3 : Ctx} {τ : Tp} → (θ2 : Γ1 ⊢c Γ2) (ρ : Γ2 ⊇ Γ3) {e : _ ⊢ τ}\n → (θ2 , e) ·sr (p· ρ) == θ2 ·sr ρ\n ·sr-pβ' {Γ1} {Γ2} {[]} θ2 ρ = Refl\n ·sr-pβ' {Γ1} {Γ2} {τ :: Γ3} θ2 (ρ , x) = ap2 _,_ (·sr-pβ' θ2 ρ) Refl\n\n mutual\n ·sr-unitr : {Γ1 Γ2 : Ctx} → (θ : Γ1 ⊢c Γ2) → θ ·sr idr == θ\n ·sr-unitr {Γ1} {[]} θ = Refl\n ·sr-unitr {Γ1} {τ2 :: Γ2} (θ , e) = ap (λ x → x , e) (·sr-pβ θ)\n \n ·sr-pβ : {Γ1 Γ2 : Ctx} {τ : Tp} → (θ2 : Γ1 ⊢c Γ2) {e : _ ⊢ τ}\n → (θ2 , e) ·sr p == θ2\n ·sr-pβ θ2 = ·sr-unitr θ2 ∘ ·sr-pβ' θ2 idr\n\n subst-id : {Γ : Ctx} {τ : Tp} {e : Γ ⊢ τ} → e == subst (ids) e \n subst-id {e = c} = Refl\n subst-id {e = v x} = subst-var-id x\n subst-id {e = lam e} = ap lam (subst-id)\n subst-id {e = app e e₁} = ap2 app subst-id subst-id \n\n subst-·rs : {Γ1 Γ2 Γ4 : Ctx} {τ : Tp} → (ρ : Γ4 ⊇ Γ1) (θ2 : Γ1 ⊢c Γ2) (e : Γ2 ⊢ τ)\n → rename ρ (subst θ2 e) == subst (ρ ·rs θ2) e\n subst-·rs ρ θ2 c = Refl\n subst-·rs ρ θ2 (v x) = ! (subst-var-·rs ρ θ2 x)\n subst-·rs ρ θ2 (lam e) = ap lam (ap (λ x → subst x e) (ap (λ x → x , v i0) (lemma2 ρ θ2)) ∘ subst-·rs (addvar-ren ρ) (addvar θ2) e) where\n lemma1 : {Γ3 Γ5 : Ctx} (ρ₁ : Γ5 ⊇ Γ3) {τ3 : Tp}\n → (addvar-ren {_}{_}{τ3} ρ₁) ·rr (p· idr) == (p· idr) ·rr ρ₁\n lemma1 {Γ3} {Γ5} ρ₁ = (p· ρ₁ , i0) ·rr (p· idr) =〈 Refl 〉\n (p· ρ₁ , i0) ·rr p =〈 ap (λ x → (x , i0) ·rr p) (p·-def ρ₁)〉 \n (p ·rr ρ₁ , i0) ·rr p =〈 pβ1 (p ·rr ρ₁) i0 〉 \n p ·rr ρ₁ =〈 Refl 〉\n (p· idr) ·rr ρ₁ ∎\n\n lemma2 : {Γ1 Γ2 Γ4 : Ctx} {τ : Tp} → (ρ : Γ4 ⊇ Γ1) (θ2 : Γ1 ⊢c Γ2) \n → (addvar-ren{_}{_}{τ} ρ) ·rs (fst (addvar θ2)) == p ·rs (ρ ·rs θ2)\n lemma2 {Γ2 = []} ρ₁ θ3 = Refl\n lemma2 {Γ2 = τ2 :: Γ2} ρ₁ (θ3 , e3) = ap2 _,_ (lemma2 ρ₁ θ3) \n (! (rename-· (p· idr) ρ₁ e3) ∘ \n (ap (λ x → rename x e3) (lemma1 ρ₁) ∘ \n rename-· (addvar-ren ρ₁) (p· idr) e3))\n subst-·rs ρ θ2 (app e e₁) = ap2 app (subst-·rs ρ θ2 e) (subst-·rs ρ θ2 e₁) \n\n ·rss-assoc : {Γ1 Γ2 Γ3 Γ4 : Ctx} → (ρ : Γ4 ⊇ Γ1) (θ2 : Γ1 ⊢c Γ2) (θ3 : Γ2 ⊢c Γ3)\n → ρ ·rs (θ2 ·ss θ3) == (ρ ·rs θ2) ·ss θ3\n ·rss-assoc {Γ1} {Γ2} {[]} ρ θ2 θ3 = Refl\n ·rss-assoc {Γ1} {Γ2} {x :: Γ3} ρ θ2 (θ3 , e3) = ap2 _,_ (·rss-assoc ρ θ2 θ3) (subst-·rs ρ θ2 e3)\n\n subst-·sr : {Γ1 Γ2 Γ3 : Ctx} {τ : Tp} → (θ2 : Γ1 ⊢c Γ2) (ρ : Γ2 ⊇ Γ3) (e : Γ3 ⊢ τ)\n → (subst θ2 (rename ρ e)) == subst (θ2 ·sr ρ) e\n subst-·sr θ2 ρ c = Refl\n subst-·sr θ2 ρ (v x) = subst-var-·sr θ2 ρ x\n subst-·sr θ2 ρ (lam e) = ap lam (ap (λ x → subst x e) (ap (λ x → x , v i0) (lemma θ2 ρ)) ∘ subst-·sr (addvar θ2) (addvar-ren ρ) e) where\n lemma : {Γ1 Γ2 Γ3 : Ctx} {τ : Tp} → (θ2 : Γ1 ⊢c Γ2) (ρ : Γ2 ⊇ Γ3) → (addvar{_}{_}{τ} θ2) ·sr (p· ρ) == p ·rs (θ2 ·sr ρ)\n lemma θ2 ρ = ∘rsr-assoc (p· idr) θ2 ρ ∘ ·sr-pβ' (_·rs_ (p· idr) θ2) ρ {v i0}\n subst-·sr θ2 ρ (app e e₁) = ap2 app (subst-·sr θ2 ρ e) (subst-·sr θ2 ρ e₁) \n\n ·srs-assoc : {Γ1 Γ2 Γ3 Γ4 : Ctx} (θ : Γ1 ⊢c Γ2) (ρ : Γ2 ⊇ Γ3) (θ' : Γ3 ⊢c Γ4) \n → θ ·ss (ρ ·rs θ') == (θ ·sr ρ) ·ss θ'\n ·srs-assoc {Γ1} {Γ2} {Γ3} {[]} θ ρ θ' = Refl\n ·srs-assoc {Γ1} {Γ2} {Γ3} {x :: Γ4} θ ρ (θ' , e') = ap2 _,_ (·srs-assoc θ ρ θ') (subst-·sr θ ρ e')\n\n subst-·ss : {Γ1 Γ2 Γ3 : Ctx} → (θ2 : Γ1 ⊢c Γ2) (θ3 : Γ2 ⊢c Γ3) {τ : Tp} (e : Γ3 ⊢ τ)\n → subst (θ2 ·ss θ3) e == subst θ2 (subst θ3 e)\n subst-·ss θ2 θ3 c = Refl\n subst-·ss θ2 θ3 (v x) = subst-var-∘ss θ2 θ3 x\n subst-·ss θ2 θ3 (lam e) = ap lam (subst-·ss (addvar θ2) (addvar θ3) e ∘ \n ap (λ x → subst x e) (ap (λ x → x , v i0) \n (lemma1 ∘ ·rss-assoc p θ2 θ3))) where\n lemma1 : (p ·rs θ2) ·ss θ3 ==\n (addvar θ2) ·ss (fst (addvar θ3))\n lemma1 = (p ·rs θ2) ·ss θ3 =〈 ! (ap (λ x → x ·ss θ3) (·sr-pβ (p ·rs θ2) {v i0})) 〉 \n ((p ·rs θ2 , v i0) ·sr p) ·ss θ3 =〈 ! (·srs-assoc (p ·rs θ2 , v i0) p θ3) 〉\n (p ·rs θ2 , v i0) ·ss (p ·rs θ3) ∎\n subst-·ss θ2 θ3 (app e e₁) = ap2 app (subst-·ss θ2 θ3 e) (subst-·ss θ2 θ3 e₁)\n\n ·ss-unitl : {Γ1 Γ2 : Ctx} → (θ : Γ1 ⊢c Γ2) → ids ·ss θ == θ\n ·ss-unitl {Γ2 = []} θ = Refl\n ·ss-unitl {Γ2 = τ :: Γ2} (θ , e) = ap2 _,_ (·ss-unitl θ) (! subst-id)\n\n compose1 : {τ1 τ2 : Tp} {Γ : Ctx} (θ : [] ⊢c Γ) (e' : [] ⊢ τ1) \n → (θ , e') == (<> , e') ·ss (addvar θ)\n compose1 {τ1}{τ2} θ e' = ap (λ x → x , e') (! (·srs-assoc (<> , e') (p{_}{τ1}) θ) ∘ ! (·ss-unitl θ))\n\n subst-compose1 : {τ1 τ2 : Tp} {Γ : Ctx} (θ : [] ⊢c Γ) (e' : [] ⊢ τ1) (e : Γ ,, τ1 ⊢ τ2)\n → subst (θ , e') e == subst1 e' (subst (addvar θ) e)\n subst-compose1{τ1}{τ2}{Γ} θ e' e = subst-·ss (<> , e') (addvar θ) e ∘ ap (λ x → subst x e) (compose1{τ1}{τ2}{Γ} θ e')\n\n open Subst public\n\n open RenamingAndSubstitution using (subst1 ; _⊢c_ ; subst ; subst-id ; subst-compose1)\n {- θ : Γ ⊢c Γ' means θ is a substitution for Γ' in terms of Γ. It is defined as follows:\n\n _⊢c_ : Ctx → Ctx → Set\n Γ' ⊢c [] = Unit\n Γ' ⊢c (τ :: Γ) = (Γ' ⊢c Γ) × (Γ' ⊢ τ) \n\n -- apply a substitution to a term\n subst : {Γ Γ' : Ctx}{τ : Tp} → Γ ⊢c Γ' → Γ' ⊢ τ → Γ ⊢ τ\n\n -- substitution for a single variable\n subst1 : {τ τ0 : Tp} → [] ⊢ τ0 → ([] ,, τ0) ⊢ τ → [] ⊢ τ\n\n -- you will need these two properties:\n subst-compose1 : {τ1 τ2 : Tp} {Γ : Ctx} (θ : [] ⊢c Γ) (e' : [] ⊢ τ1) (e : Γ ,, τ1 ⊢ τ2)\n → subst (θ , e') e == subst1 e' (subst (addvar θ) e)\n\n subst-id : {Γ : Ctx} {τ : Tp} {e : Γ ⊢ τ} → e == subst (ids) e \n -}\n\n \n module OpSem where\n -- step relation\n data _↦_ : {τ : Tp} → [] |- τ → [] |- τ → Set where\n Step/app :{τ1 τ2 : Tp} {e e' : [] |- τ1 ⇒ τ2} {e1 : [] |- τ1}\n → e ↦ e'\n → (app e e1) ↦ (app e' e1)\n Step/β : {τ1 τ2 : Tp} {e : [] ,, τ1 |- τ2} {e1 : [] |- τ1}\n → (app (lam e) e1) ↦ subst1 e1 e \n\n -- reflexive/transitive closure\n data _↦*_ : {τ : Tp} → [] |- τ → [] |- τ → Set where\n Done : {τ : Tp} {e : [] |- τ} → e ↦* e\n Step : {τ : Tp} {e1 e2 e3 : [] |- τ} \n → e1 ↦ e2 → e2 ↦* e3\n → e1 ↦* e3\n\n {- Next, you will prove \"very weak normalization\". The theorem is\n that any closed term *of base type b* evaluates to the constant c.\n No claims are made about terms of function type.\n -}\n module VeryWeakNormalization where\n\n open OpSem\n\n WN : (τ : Tp) → [] ⊢ τ → Set\n -- WN_τ(e) iff e ↦* c\n WN b e = e ↦* c\n -- WN_τ(e) iff for all e1 : τ1, if WN_τ1(e1) then WN_τ2(e e1)\n WN (τ1 ⇒ τ2) e = (e1 : [] ⊢ τ1) → WN τ1 e1 → WN τ2 (app e e1)\n\n -- extend WN to contexts and substitutions\n WNc : (Γ : Ctx) → [] ⊢c Γ → Set\n WNc [] θ = Unit\n WNc (τ :: Γ) (θ , e) = WNc Γ θ × WN τ e\n\n {- TASK 3 : show that the relation is closed under head expansion: -}\n head-expand : (τ : Tp) {e e' : [] ⊢ τ} → e ↦ e' → WN τ e' → WN τ e\n head-expand b e↦e' w = Step e↦e' w\n head-expand (τ1 ⇒ τ2) e↦e' w = λ e1 we1 → head-expand τ2 (Step/app e↦e') (w e1 we1)\n\n {- TASK 4 : prove the fundamental theorem -}\n fund : {Γ : Ctx} {τ : Tp} {θ : [] ⊢c Γ} \n → (e : Γ ⊢ τ)\n → WNc Γ θ \n → WN τ (subst θ e)\n fund c wθ = Done\n fund (v i0) (_ , we) = we\n fund (v (iS x)) (wθ , _) = fund (v x) wθ\n fund {_}{._}{θ} (lam{τ1}{τ2} e) wθ = \n λ e1 we1 → head-expand τ2 Step/β\n (transport (λ x → WN τ2 x) (subst-compose1 θ e1 e) (fund e (wθ , we1)))\n fund (app e e₁) wθ = fund e wθ _ (fund e₁ wθ)\n\n {- TASK 5 : conclude weak normalization at base type -}\n corollary : (e : [] ⊢ b) → e ↦* c\n corollary e = transport (\\ x -> x ↦* _) (! subst-id) (fund e <>)\n\n\n {- TASK 6 : change the definition of the logical relation so that you also can conclude normalization \n at function type \n -}\n module WeakNormalization where\n\n open OpSem\n\n WN : (τ : Tp) → [] ⊢ τ → Set\n WN b e = e ↦* c\n WN (τ1 ⇒ τ2) e = \n Σ \\ (e' : [] ,, τ1 ⊢ τ2) → \n (e ↦* lam e') × ((e1 : [] ⊢ τ1) → WN τ1 e1 → WN τ2 (subst1 e1 e'))\n\n -- extend WN to contexts and substitutions\n WNc : (Γ : Ctx) → [] ⊢c Γ → Set\n WNc [] θ = Unit\n WNc (τ :: Γ) (θ , e) = WNc Γ θ × WN τ e\n\n open RenamingAndSubstitution using (addvar)\n --- you will want to use\n -- addvar : {Γ Γ' : Ctx} {τ : Tp} → Γ ⊢c Γ' → (Γ ,, τ) ⊢c (Γ' ,, τ)\n\n head-expand : (τ : Tp) {e e' : [] ⊢ τ} → e ↦ e' → WN τ e' → WN τ e\n head-expand b e↦e' w = Step e↦e' w\n head-expand (τ1 ⇒ τ2) e↦e' (body , steps , wn) = body , Step e↦e' steps , wn\n\n -- Hint: you will need a couple of lemmas about ↦* that we didn't need above\n -- (I used three of them)\n\n head-expand* : {τ : Tp} {e e' : [] ⊢ τ} → e ↦* e' → WN τ e' → WN τ e\n head-expand* Done w = w\n head-expand* (Step s ss) w = head-expand _ s (head-expand* ss w)\n\n Step/app* :{τ1 τ2 : Tp} {e e' : [] ⊢ τ1 ⇒ τ2} {e1 : [] ⊢ τ1}\n → e ↦* e'\n → (app e e1) ↦* (app e' e1)\n Step/app* Done = Done\n Step/app* (Step s ss) = (Step (Step/app s) (Step/app* ss))\n\n Step' : {τ : Tp} {e1 e2 e3 : [] ⊢ τ} \n → e1 ↦* e2 → e2 ↦ e3\n → e1 ↦* e3\n Step' Done s = Step s Done\n Step' (Step s ss) s' = Step s (Step' ss s')\n\n fund : {Γ : Ctx} {τ : Tp} {θ : [] ⊢c Γ} \n → (e : Γ ⊢ τ)\n → WNc Γ θ \n → WN τ (subst θ e)\n fund c wθ = Done\n fund (v i0) (_ , we) = we\n fund (v (iS x)) (wθ , _) = fund (v x) wθ\n fund {_}{._}{θ} (lam{τ1}{τ2} e) wθ = \n subst (addvar θ) e , Done , (λ e1 we1 → transport (WN τ2) (subst-compose1 θ e1 e) (fund e (wθ , we1)))\n fund (app e e₁) wθ with fund e wθ\n ... | (body , reduction , wn) = head-expand* (Step' (Step/app* reduction) Step/β) (wn _ (fund e₁ wθ))\n\n {- TASK 6a -}\n corollary1 : (e : [] ⊢ b) → e ↦* c \n corollary1 e = transport (λ x → x ↦* _) (! subst-id) (fund e <>)\n\n {- TASK 6b -}\n corollary2 : {τ1 τ2 : Tp} (e : [] ⊢ τ1 ⇒ τ2) → Σ \\(e' : _) → e ↦* (lam e')\n corollary2 e with (fund e <>)\n ... | (e' , steps , _) = e' , transport (λ x → x ↦* _) (! subst-id) steps\n", "meta": {"hexsha": "0789d085ae6094b9964515297acce1e9298f3d04", "size": 21678, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Lab3-LRSol.agda", "max_stars_repo_name": "benhuds/Agda", "max_stars_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-04-26T20:22:22.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-08T12:27:18.000Z", "max_issues_repo_path": "old/Lab3-LRSol.agda", "max_issues_repo_name": "benhuds/Agda", "max_issues_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-03-23T08:39:04.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-12T00:32:45.000Z", "max_forks_repo_path": "old/Lab3-LRSol.agda", "max_forks_repo_name": "benhuds/Agda", "max_forks_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.3702290076, "max_line_length": 143, "alphanum_fraction": 0.4495340899, "num_tokens": 9722, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8397339676722393, "lm_q2_score": 0.8267117940706734, "lm_q1q2_score": 0.6942179749564018}} {"text": "module nat-log where\n\nopen import bool\nopen import eq\nopen import nat\nopen import nat-thms\nopen import nat-division\nopen import product\n\ndata log-result (x : ℕ)(b : ℕ) : Set where\n pos-power : (e : ℕ) → (s : ℕ) → b pow e + s ≡ x → log-result x b\n no-power : x < b ≡ tt → log-result x b\n\n-- as a first version, we do not try to prove termination of this function\n{-# NON_TERMINATING #-}\nlog : (x : ℕ) → (b : ℕ) → x =ℕ 0 ≡ ff → b =ℕ 0 ≡ ff → log-result x b\nlog x b p1 p2 with x ÷ b ! p2\nlog x b p1 p2 | 0 , r , u1 , u2 rewrite u1 = no-power u2\nlog x b p1 p2 | (suc q) , r , u1 , u2 with log (suc q) b refl p2\nlog x b p1 p2 | (suc q) , r , u1 , u2 | no-power u rewrite sym u1 = \n pos-power 1 (b * q + r) lem \n where lem : b * 1 + (b * q + r) ≡ b + q * b + r\n lem rewrite *1{b} | *comm b q = +assoc b (q * b) r\nlog x b p1 p2 | (suc q) , r , u1 , u2 | pos-power e s u rewrite sym u1 = \n pos-power (suc e) (b * s + r) lem \n where lem : b * b pow e + (b * s + r) ≡ b + q * b + r\n lem rewrite +assoc (b * b pow e) (b * s) r | sym (*distribl b (b pow e) s) | *comm b (b pow e + s) = \n sym (cong (λ i → i * b + r) (sym u))\n\n", "meta": {"hexsha": "0485f8716af69901ed9a257f3b996e0f40ca51a8", "size": 1143, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "nat-log.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "nat-log.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "nat-log.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.1, "max_line_length": 109, "alphanum_fraction": 0.542432196, "num_tokens": 468, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9230391706552538, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.694137062405566}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Data.Nat.GCD where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Function\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Foundations.Isomorphism\n\nopen import Cubical.Induction.WellFounded\n\nopen import Cubical.Data.Fin\nopen import Cubical.Data.Sigma as Σ\nopen import Cubical.Data.NatPlusOne\n\nopen import Cubical.HITs.PropositionalTruncation as PropTrunc\n\nopen import Cubical.Data.Nat.Base\nopen import Cubical.Data.Nat.Properties\nopen import Cubical.Data.Nat.Order\nopen import Cubical.Data.Nat.Divisibility\n\nprivate\n variable\n m n d : ℕ\n\n-- common divisors\n\nisCD : ℕ → ℕ → ℕ → Type₀\nisCD m n d = (d ∣ m) × (d ∣ n)\n\nisPropIsCD : isProp (isCD m n d)\nisPropIsCD = isProp× isProp∣ isProp∣\n\nsymCD : isCD m n d → isCD n m d\nsymCD (d∣m , d∣n) = (d∣n , d∣m)\n\n-- greatest common divisors\n\nisGCD : ℕ → ℕ → ℕ → Type₀\nisGCD m n d = (isCD m n d) × (∀ d' → isCD m n d' → d' ∣ d)\n\nGCD : ℕ → ℕ → Type₀\nGCD m n = Σ ℕ (isGCD m n)\n\nisPropIsGCD : isProp (isGCD m n d)\nisPropIsGCD = isProp× isPropIsCD (isPropΠ2 (λ _ _ → isProp∣))\n\nisPropGCD : isProp (GCD m n)\nisPropGCD (d , dCD , gr) (d' , d'CD , gr') =\n Σ≡Prop (λ _ → isPropIsGCD) (antisym∣ (gr' d dCD) (gr d' d'CD))\n\n\nsymGCD : isGCD m n d → isGCD n m d\nsymGCD (dCD , gr) = symCD dCD , λ { d' d'CD → gr d' (symCD d'CD) }\n\ndivsGCD : m ∣ n → isGCD m n m\ndivsGCD p = (∣-refl refl , p) , λ { d (d∣m , _) → d∣m }\n\noneGCD : ∀ m → isGCD m 1 1\noneGCD m = symGCD (divsGCD (∣-oneˡ m))\n\n\n-- The base case of the Euclidean algorithm\nzeroGCD : ∀ m → isGCD m 0 m\nzeroGCD m = divsGCD (∣-zeroʳ m)\n\nprivate\n lem₁ : prediv d (suc n) → prediv d (m % suc n) → prediv d m\n lem₁ {d} {n} {m} (c₁ , p₁) (c₂ , p₂) = (q · c₁ + c₂) , p\n where r = m % suc n; q = n%k≡n[modk] m (suc n) .fst\n p = (q · c₁ + c₂) · d ≡⟨ sym (·-distribʳ (q · c₁) c₂ d) ⟩\n (q · c₁) · d + c₂ · d ≡⟨ cong (_+ c₂ · d) (sym (·-assoc q c₁ d)) ⟩\n q · (c₁ · d) + c₂ · d ≡[ i ]⟨ q · (p₁ i) + (p₂ i) ⟩\n q · (suc n) + r ≡⟨ n%k≡n[modk] m (suc n) .snd ⟩\n m ∎\n\n lem₂ : prediv d (suc n) → prediv d m → prediv d (m % suc n)\n lem₂ {d} {n} {m} (c₁ , p₁) (c₂ , p₂) = c₂ ∸ q · c₁ , p\n where r = m % suc n; q = n%k≡n[modk] m (suc n) .fst\n p = (c₂ ∸ q · c₁) · d ≡⟨ ∸-distribʳ c₂ (q · c₁) d ⟩\n c₂ · d ∸ (q · c₁) · d ≡⟨ cong (c₂ · d ∸_) (sym (·-assoc q c₁ d)) ⟩\n c₂ · d ∸ q · (c₁ · d) ≡[ i ]⟨ p₂ i ∸ q · (p₁ i) ⟩\n m ∸ q · (suc n) ≡⟨ cong (_∸ q · (suc n)) (sym (n%k≡n[modk] m (suc n) .snd)) ⟩\n (q · (suc n) + r) ∸ q · (suc n) ≡⟨ cong (_∸ q · (suc n)) (+-comm (q · (suc n)) r) ⟩\n (r + q · (suc n)) ∸ q · (suc n) ≡⟨ ∸-cancelʳ r zero (q · (suc n)) ⟩\n r ∎\n\n-- The inductive step of the Euclidean algorithm\nstepGCD : isGCD (suc n) (m % suc n) d\n → isGCD m (suc n) d\nfst (stepGCD ((d∣n , d∣m%n) , gr)) = PropTrunc.map2 lem₁ d∣n d∣m%n , d∣n\nsnd (stepGCD ((d∣n , d∣m%n) , gr)) d' (d'∣m , d'∣n) = gr d' (d'∣n , PropTrunc.map2 lem₂ d'∣n d'∣m)\n\n-- putting it all together using well-founded induction\n\neuclid< : ∀ m n → n < m → GCD m n\neuclid< = WFI.induction <-wellfounded λ {\n m rec zero p → m , zeroGCD m ;\n m rec (suc n) p → let d , dGCD = rec (suc n) p (m % suc n) (n%sk * | _⊕_ l20\n neg : * -> * | ⊖_ r40\n\ntheory\n (εU⊕ᴸ) a |> add (unit, a) = a\n (εU⊕ᴿ) a |> add (a, unit) = a\n (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c))\n (⊖N⊕ᴸ) a |> add (neg (a), a) = unit\n (⊖N⊕ᴿ) a |> add (a, neg (a)) = unit\n (⊕C) a b |> add(a, b) = add(b, a)\n-}\n\nmodule CommGroup.Signature where\n\nopen import SOAS.Context\n\nopen import SOAS.Common\n\n\nopen import SOAS.Syntax.Signature *T public\nopen import SOAS.Syntax.Build *T public\n\n-- Operator symbols\ndata CGₒ : Set where\n unitₒ addₒ negₒ : CGₒ\n\n-- Term signature\nCG:Sig : Signature CGₒ\nCG:Sig = sig λ\n { unitₒ → ⟼₀ *\n ; addₒ → (⊢₀ *) , (⊢₀ *) ⟼₂ *\n ; negₒ → (⊢₀ *) ⟼₁ *\n }\n\nopen Signature CG:Sig public\n", "meta": {"hexsha": "0e9fc926a00b48028df26550ca2280dec6c99377", "size": 867, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/CommGroup/Signature.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/CommGroup/Signature.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/CommGroup/Signature.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 18.847826087, "max_line_length": 91, "alphanum_fraction": 0.5651672434, "num_tokens": 379, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9124361604769413, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6940451560424047}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category.Core\nopen import Categories.Category.Monoidal.Core\n\n-- This module defines the category of monoids internal to a given monoidal\n-- category.\n\nmodule Categories.Category.Construction.Monoids {o ℓ e} {𝒞 : Category o ℓ e} (C : Monoidal 𝒞) where\n\nopen import Level\n\nopen import Categories.Functor using (Functor)\nopen import Categories.Morphism.Reasoning 𝒞\nopen import Categories.Object.Monoid C\n\nopen Category 𝒞\nopen Monoidal C\nopen HomReasoning\nopen Monoid using (η; μ)\nopen Monoid⇒\n\nMonoids : Category (o ⊔ ℓ ⊔ e) (ℓ ⊔ e) e\nMonoids = record\n { Obj = Monoid\n ; _⇒_ = Monoid⇒\n ; _≈_ = λ f g → arr f ≈ arr g\n ; id = record\n { arr = id\n ; preserves-μ = identityˡ ○ introʳ (Functor.identity ⊗)\n ; preserves-η = identityˡ\n }\n ; _∘_ = λ f g → record\n { arr = arr f ∘ arr g\n ; preserves-μ = glue (preserves-μ f) (preserves-μ g) ○ ∘-resp-≈ʳ (⟺ (Functor.homomorphism ⊗))\n ; preserves-η = glueTrianglesˡ (preserves-η f) (preserves-η g)\n }\n ; assoc = assoc\n ; sym-assoc = sym-assoc\n ; identityˡ = identityˡ\n ; identityʳ = identityʳ\n ; identity² = identity²\n -- We cannot define equiv = equiv here, because _⇒_ of this category is a\n -- different level to the _⇒_ of 𝒞.\n ; equiv = record\n { refl = refl\n ; sym = sym\n ; trans = trans\n }\n ; ∘-resp-≈ = ∘-resp-≈\n } where open Equiv\n", "meta": {"hexsha": "3e9c6ca8e7131a1f749702c7beb9f0094891d483", "size": 1383, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Construction/Monoids.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2019-05-21T17:07:19.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-22T03:54:24.000Z", "max_issues_repo_path": "src/Categories/Category/Construction/Monoids.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Construction/Monoids.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.1176470588, "max_line_length": 99, "alphanum_fraction": 0.6550976139, "num_tokens": 482, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178919837706, "lm_q2_score": 0.7634837743174788, "lm_q1q2_score": 0.6937150175841605}} {"text": "module MonoidTactic where\n\nopen import Prelude\nopen import Container.Traversable\nopen import Tactic.Monoid\nopen import Tactic.Reflection\n\nSemigroupAnd : Semigroup Bool\n_<>_ {{SemigroupAnd}} = _&&_\n\nMonoidAnd : Monoid Bool\nMonoid.super MonoidAnd = SemigroupAnd\nmempty {{MonoidAnd}} = true\n\n\nMonoid/LawsAnd : Monoid/Laws Bool\nMonoid/Laws.super Monoid/LawsAnd = MonoidAnd\nleft-identity {{Monoid/LawsAnd}} x = refl\nright-identity {{Monoid/LawsAnd}} true = refl\nright-identity {{Monoid/LawsAnd}} false = refl\nmonoid-assoc {{Monoid/LawsAnd}} true y z = refl\nmonoid-assoc {{Monoid/LawsAnd}} false y z = refl\n\n\ntest₁ : (a b : Bool) → (a && (b && a && true)) ≡ ((a && b) && a)\ntest₁ a b = auto-monoid {{Laws = Monoid/LawsAnd}}\n\ntest₂ : ∀ {a} {A : Set a} {{Laws : Monoid/Laws A}} →\n (x y : A) → x <> (y <> x <> mempty) ≡ (x <> y) <> x\ntest₂ x y = auto-monoid\n\ntest₃ : ∀ {a} {A : Set a} (xs ys zs : List A) → xs ++ ys ++ zs ≡ (xs ++ []) ++ (ys ++ []) ++ zs\ntest₃ xs ys zs = runT monoidTactic\n", "meta": {"hexsha": "1161ebdaaa9fdb3e6f69eded7239020b70ff615c", "size": 992, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/MonoidTactic.agda", "max_stars_repo_name": "L-TChen/agda-prelude", "max_stars_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 111, "max_stars_repo_stars_event_min_datetime": "2015-01-05T11:28:15.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-12T23:29:26.000Z", "max_issues_repo_path": "test/MonoidTactic.agda", "max_issues_repo_name": "L-TChen/agda-prelude", "max_issues_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 59, "max_issues_repo_issues_event_min_datetime": "2016-02-09T05:36:44.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-14T07:32:36.000Z", "max_forks_repo_path": "test/MonoidTactic.agda", "max_forks_repo_name": "L-TChen/agda-prelude", "max_forks_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 24, "max_forks_repo_forks_event_min_datetime": "2015-03-12T18:03:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-22T06:10:41.000Z", "avg_line_length": 29.1764705882, "max_line_length": 95, "alphanum_fraction": 0.6401209677, "num_tokens": 349, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9372107861416413, "lm_q2_score": 0.7401743620390162, "lm_q1q2_score": 0.6936993957284743}} {"text": "module nat-thms where\n\nopen import bool\nopen import bool-thms\nopen import bool-thms2\nopen import eq\nopen import nat\nopen import neq\nopen import product\nopen import product-thms\nopen import sum\nopen import level\nopen import negation\n\n--------------------------------------------------\n-- properties of addition\n--------------------------------------------------\n\n0+ : ∀ (x : ℕ) → 0 + x ≡ x\n0+ x = refl\n\n+0 : ∀ (x : ℕ) → x + 0 ≡ x\n+0 zero = refl\n+0 (suc x) rewrite +0 x = refl\n\n+1 : ∀ (x : ℕ) → x + 1 ≡ suc x\n+1 zero = refl\n+1 (suc x) rewrite +1 x = refl\n\n+suc : ∀ (x y : ℕ) → x + (suc y) ≡ suc(x + y)\n+suc zero y = refl\n+suc (suc x) y rewrite +suc x y = refl\n\n+assoc : ∀ (x y z : ℕ) → x + (y + z) ≡ (x + y) + z\n+assoc zero y z = refl\n+assoc (suc x) y z rewrite +assoc x y z = refl\n\n+comm : ∀ (x y : ℕ) → x + y ≡ y + x\n+comm zero y rewrite +0 y = refl\n+comm (suc x) y rewrite +suc y x | +comm x y = refl\n\n+perm : ∀ (x y z : ℕ) → x + (y + z) ≡ y + (x + z)\n+perm x y z rewrite +assoc x y z | +comm x y | sym (+assoc y x z) = refl\n\n+perm2 : ∀ (x y z : ℕ) → (x + y) + z ≡ (x + z) + y\n+perm2 x y z rewrite sym (+assoc x y z) | +comm y z | +assoc x z y = refl\n\n+≡0 : ∀ {x y : ℕ} → x + y ≡ 0 → x ≡ 0 ∧ y ≡ 0\n+≡0{zero}{zero} p = refl , refl\n+≡0{zero}{suc y} ()\n+≡0{suc x}{zero} ()\n+≡0{suc x}{suc y} ()\n\n--------------------------------------------------\n-- properties of multiplication\n--------------------------------------------------\n\n*0 : ∀ (x : ℕ) → x * 0 ≡ 0\n*0 zero = refl\n*0 (suc x) rewrite *0 x = refl\n\n*1 : ∀ {n : ℕ} → n * 1 ≡ n\n*1 {0} = refl\n*1 {suc n} rewrite *1 {n} = refl\n\n*suc : ∀ (x y : ℕ) → x * (suc y) ≡ x + x * y\n*suc zero y = refl\n*suc (suc x) y rewrite *suc x y | +assoc y x (x * y) | +assoc x y (x * y) | +comm y x = refl\n\n*distribr : ∀ (x y z : ℕ) → (x + y) * z ≡ x * z + y * z\n*distribr zero y z = refl\n*distribr (suc x) y z rewrite *distribr x y z = +assoc z (x * z) (y * z) \n\n*distribl : ∀ (x y z : ℕ) → x * (y + z) ≡ x * y + x * z\n*distribl 0 y z = refl\n*distribl (suc x) y z rewrite *distribl x y z | +assoc (y + z) (x * y) (x * z) | +assoc (y + x * y) z (x * z) | +comm (y + z) (x * y) | +assoc (x * y) y z | +comm (x * y) y = refl\n\n*comm : ∀ (x y : ℕ) → x * y ≡ y * x\n*comm zero y rewrite *0 y = refl\n*comm (suc x) y rewrite *suc y x | *comm x y = refl\n\n*assoc : ∀ (x y z : ℕ) → x * (y * z) ≡ (x * y) * z\n*assoc zero y z = refl\n*assoc (suc x) y z rewrite *assoc x y z | *distribr y (x * y) z = refl\n\n--------------------------------------------------\n-- basic properties of pred\n--------------------------------------------------\n\nsucpred : ∀ {x : ℕ} → iszero x ≡ ff → suc (pred x) ≡ x\nsucpred{0} ()\nsucpred{suc x} p = refl\n\npred+ : ∀ (x y : ℕ) → iszero x ≡ ff → (pred x) + y ≡ pred (x + y)\npred+ 0 y ()\npred+ (suc x) y p = refl\n\n--------------------------------------------------\n-- properties of <, ≤, and =ℕ, iszero\n--------------------------------------------------\n\n<-0 : ∀ (x : ℕ) → x < 0 ≡ ff\n<-0 0 = refl\n<-0 (suc y) = refl\n\n0-≤ : ∀ (x : ℕ) → 0 ≤ x ≡ tt\n0-≤ 0 = refl\n0-≤ (suc x) = refl\n\n<-drop : ∀ {x y : ℕ} → (x < (suc y) ≡ tt) → x ≡ y ∨ x < y ≡ tt\n<-drop {0} {0} p = inj₁ refl\n<-drop {suc x} {0} p rewrite <-0 x = 𝔹-contra p\n<-drop {0} {suc y} p = inj₂ refl\n<-drop {suc x} {suc y} p with <-drop {x} {y} p \n... | inj₁ u rewrite u = inj₁ refl\n... | inj₂ u = inj₂ u\n\n=ℕ-refl : ∀ (x : ℕ) → (x =ℕ x) ≡ tt\n=ℕ-refl 0 = refl\n=ℕ-refl (suc x) = (=ℕ-refl x)\n\n=ℕ-to-≡ : ∀ {x y : ℕ} → x =ℕ y ≡ tt → x ≡ y\n=ℕ-to-≡ {0} {0} u = refl\n=ℕ-to-≡ {suc x} {0} ()\n=ℕ-to-≡ {0} {suc y} ()\n=ℕ-to-≡ {suc x} {suc y} u rewrite =ℕ-to-≡ {x} {y} u = refl\n\n=ℕ-from-≡ : ∀ {x y : ℕ} → x ≡ y → x =ℕ y ≡ tt\n=ℕ-from-≡ {x} refl = =ℕ-refl x\n\n=ℕ-sym : ∀ (x y : ℕ) → (x =ℕ y) ≡ (y =ℕ x)\n=ℕ-sym 0 0 = refl\n=ℕ-sym 0 (suc y) = refl\n=ℕ-sym (suc x) 0 = refl\n=ℕ-sym (suc x) (suc y) rewrite =ℕ-sym x y = refl\n\n=ℕ-suc : ∀ (x : ℕ) → suc x =ℕ x ≡ ff\n=ℕ-suc 0 = refl\n=ℕ-suc (suc x) = =ℕ-suc x\n\n<-suc : ∀ (n : ℕ) → n < suc n ≡ tt\n<-suc 0 = refl\n<-suc (suc n) rewrite <-suc n = refl\n\n<-suc2 : ∀ (n : ℕ) → suc n < n ≡ ff\n<-suc2 0 = refl\n<-suc2 (suc n) = <-suc2 n\n\n≤-suc : ∀ (n : ℕ) → n ≤ suc n ≡ tt\n≤-suc n rewrite <-suc n = refl\n\n≤-suc2 : ∀ (n : ℕ) → suc n ≤ n ≡ ff\n≤-suc2 n rewrite <-suc2 n | =ℕ-suc n = refl\n\n<-push : ∀ {x y : ℕ} → (suc x) < y ≡ tt → Σ ℕ (λ y' → y ≡ (suc y'))\n<-push {x} {0} ()\n<-push {0} {suc y} p = (y , refl)\n<-push {suc x} {suc y} p with <-push {x} {y} p \n... | ( y' , p' ) rewrite p' = (suc y' , refl)\n\nsuc-inj : ∀ {n m : ℕ} → suc n ≡ suc m → n ≡ m\nsuc-inj {n} {m} p rewrite (=ℕ-to-≡{n} (=ℕ-from-≡ p)) = refl\n\n<-implies-suc : ∀ {x y : ℕ} → x < y ≡ tt → Σ ℕ λ y' → y ≡ suc y'\n<-implies-suc{x}{0} p rewrite <-0 x = 𝔹-contra p\n<-implies-suc{y = suc y} p = y , refl\n\n<=ℕff : ∀ (x : ℕ) → 0 < x ≡ tt → x =ℕ 0 ≡ ff\n<=ℕff 0 ()\n<=ℕff (suc x) p = refl\n\nnonzero< : ∀ {n : ℕ} → iszero n ≡ ff → 0 < n ≡ tt\nnonzero<{0} ()\nnonzero<{(suc n)} p = refl\n\niszerosum : ∀ (x y : ℕ) → iszero(x + y) ≡ iszero(x) && iszero(y)\niszerosum 0 y = refl\niszerosum (suc x) y = refl\n\niszerosum2 : ∀ (x y : ℕ) → iszero x ≡ ff → iszero(x + y) ≡ ff\niszerosum2 0 y ()\niszerosum2 (suc x) y _ = refl\n\niszeromult : ∀ (x y : ℕ) → iszero x ≡ ff → iszero y ≡ ff → \n iszero (x * y) ≡ ff\niszeromult zero zero () q \niszeromult zero (suc y) () q\niszeromult (suc x) zero p ()\niszeromult (suc x) (suc y) p q = refl\n\n<≤ : ∀ {n m : ℕ} → n < m ≡ tt → n ≤ m ≡ tt\n<≤ {n}{m} p rewrite p = refl\n\n≤+1 : ∀(x y : ℕ) → x ≤ x + y ≡ tt\n≤+1 zero zero = refl\n≤+1 zero (suc y) = refl\n≤+1 (suc x) zero rewrite +0 x | =ℕ-refl x | ||-tt (x < x) = refl\n≤+1 (suc x) (suc y) = ≤+1 x (suc y)\n\n≤+2 : ∀(x y : ℕ) → y ≤ x + y ≡ tt\n≤+2 x y rewrite +comm x y = ≤+1 y x\n\n-- a theorem about quotients q, divisors d, and remainders r\n÷< : ∀ {d q r x : ℕ} → 1 < d ≡ tt → q * d + r ≡ suc x → q < suc x ≡ tt\n÷<{0} () p\n÷<{suc 0} () p\n÷<{suc (suc d)}{0} u p = refl\n÷<{suc (suc d)}{suc q}{r}{0} u ()\n÷<{suc (suc d)}{suc q}{r}{suc x} u p with suc-inj{suc (d + q * suc (suc d) + r)}{suc x} p\n... | p' rewrite sym (+suc (d + q * suc (suc d)) r) | +comm d (q * suc (suc d)) \n | sym (+assoc (q * (suc (suc d))) d (suc r)) = ÷<{suc (suc d)}{q}{d + suc r}{x} refl p' \n\n--------------------------------------------------\n-- ordering properties of < and ≤ℕ\n--------------------------------------------------\n\n<-irrefl : ∀ (n : ℕ) → n < n ≡ ff\n<-irrefl 0 = refl\n<-irrefl (suc n) = <-irrefl n\n\n<-asym : ∀ {x y : ℕ} → x < y ≡ tt → y < x ≡ ff\n<-asym {0} {0} _ = refl\n<-asym {0} {suc y} p = refl\n<-asym {suc x}{0} ()\n<-asym {suc x}{suc y} p = <-asym {x} {y} p\n\nℕ-trichotomy𝔹 : ∀ (n m : ℕ) → n < m || n =ℕ m || m < n ≡ tt\nℕ-trichotomy𝔹 0 0 = refl\nℕ-trichotomy𝔹 0 (suc m) = refl\nℕ-trichotomy𝔹 (suc n) 0 = refl\nℕ-trichotomy𝔹 (suc n) (suc m) = ℕ-trichotomy𝔹 n m\n\nℕ-trichotomy : ∀ (n m : ℕ) → (n < m ≡ tt) ∨ (n =ℕ m ≡ tt) ∨ (m < n ≡ tt)\nℕ-trichotomy n m with ||-split{n < m} (ℕ-trichotomy𝔹 n m)\n... | inj₁ p = inj₁ p\n... | inj₂ p with ||-split{n =ℕ m} p\n... | inj₁ p' = inj₂ (inj₁ p')\n... | inj₂ p' = inj₂ (inj₂ p')\n\n<-insert : ∀ {x n m : ℕ} → n ≤ m ≡ tt → (x < n ≡ tt) ∨ (n ≤ x && x ≤ m ≡ tt) ∨ (m < x ≡ tt)\n<-insert{x}{n}{m} q with ℕ-trichotomy x n\n<-insert{x}{n}{m} q | inj₁ p = inj₁ p\n<-insert{x}{n}{m} q | inj₂ (inj₁ p) rewrite (=ℕ-to-≡{x} p) | =ℕ-refl n | ||-tt (n < n) = inj₂ (inj₁ q)\n<-insert{x}{n}{m} q | inj₂ (inj₂ p) rewrite p with ℕ-trichotomy x m\n<-insert{x}{n}{m} q | inj₂ (inj₂ p) | inj₁ p' rewrite p' = inj₂ (inj₁ refl)\n<-insert{x}{n}{m} q | inj₂ (inj₂ p) | inj₂ (inj₁ p') rewrite p' | ||-tt (x < m) = inj₂ (inj₁ refl)\n<-insert{x}{n}{m} q | inj₂ (inj₂ p) | inj₂ (inj₂ p') = inj₂ (inj₂ p')\n\n<-insert2 : ∀ {x n m : ℕ} → n ≤ m ≡ tt → (x < n ≡ tt) ∨ (n ≤ x ≡ tt ∧ x ≤ m ≡ tt) ∨ (m < x ≡ tt)\n<-insert2{x}{n}{m} p with <-insert{x}{n}{m} p\n<-insert2{x}{n}{m} p | inj₁ p' = inj₁ p'\n<-insert2{x}{n}{m} p | inj₂ (inj₁ p') with &&-elim {n ≤ x} {x ≤ m} p'\n<-insert2{x}{n}{m} p | inj₂ (inj₁ p') | p1 , p2 = inj₂ (inj₁ (p1 , p2))\n<-insert2{x}{n}{m} p | inj₂ (inj₂ p') = inj₂ (inj₂ p')\n\n<-trans : ∀ {x y z : ℕ} → x < y ≡ tt → y < z ≡ tt → x < z ≡ tt\n<-trans {x} {0} p1 p2 rewrite <-0 x = 𝔹-contra p1\n<-trans {0} {suc y} {0} p1 () \n<-trans {0} {suc y} {suc z} p1 p2 = refl\n<-trans {suc x} {suc y} {0} p1 () \n<-trans {suc x} {suc y} {suc z} p1 p2 = <-trans {x} {y} {z} p1 p2\n\n-- <≤-trans : ∀ {x y z : ℕ} → x < y ≡ tt → y ≤ z ≡ tt → x < z ≡ tt\n-- <≤-trans {x} {y} {z} p1 p2 with ||-split p2\n-- ... | inj₁ p' = <-trans{x} p1 p'\n-- ... | inj₂ p' rewrite =ℕ-to-≡ {y} {z} p' = p1\n\n≤<-trans : ∀ {x y z : ℕ} → x ≤ y ≡ tt → y < z ≡ tt → x < z ≡ tt\n≤<-trans {x} {y} {z} p1 p2 with ||-split p1\n... | inj₁ p' = <-trans{x} p' p2\n... | inj₂ p' rewrite =ℕ-to-≡ {x} {y} p' = p2\n\n≤-refl : ∀ (x : ℕ) → x ≤ x ≡ tt\n≤-refl 0 = refl\n≤-refl (suc x) = ≤-refl x\n\n≤-trans : ∀ {x y z : ℕ} → x ≤ y ≡ tt → y ≤ z ≡ tt → x ≤ z ≡ tt\n≤-trans {x} {y} {z} p1 p2 with ||-split p1 | ||-split p2\n... | inj₁ p' | inj₁ p'' rewrite <-trans {x} p' p'' = refl\n... | inj₂ p' | inj₁ p'' rewrite =ℕ-to-≡ {x} p' | p'' = refl\n... | inj₁ p' | inj₂ p'' rewrite =ℕ-to-≡ {y} p'' | p' = refl\n... | inj₂ p' | inj₂ p'' rewrite =ℕ-to-≡ {x} p' | =ℕ-to-≡ {y} p'' | =ℕ-refl z | ||-tt (z < z) = refl\n\nsuc≤ : ∀ {n n' : ℕ} → suc n ≤ suc n' ≡ tt → n ≤ n' ≡ tt\nsuc≤{n}{n'} p = p\n\n-- suc≤< : ∀ {n n' : ℕ} → suc n ≤ n' ≡ tt → n < n' ≡ tt\n-- suc≤<{n} p = <≤-trans{n} (<-suc n) p \n\nsuc<< : ∀ {n' n : ℕ} → suc n < n' ≡ tt → n < n' ≡ tt\nsuc<<{n = n} p = <-trans{n} (<-suc n) p \n\n<-suc-trans : ∀{x y : ℕ} → x < y ≡ tt → x < suc y ≡ tt\n<-suc-trans{0}{0} _ = refl\n<-suc-trans{suc x}{0} ()\n<-suc-trans{0}{suc y} _ = refl\n<-suc-trans{suc x}{suc y} p = <-suc-trans{x}{y} p\n\n≤-suc-trans : ∀{x y : ℕ} → x ≤ y ≡ tt → x ≤ suc y ≡ tt\n≤-suc-trans{0}{0} _ = refl\n≤-suc-trans{suc x}{0} ()\n≤-suc-trans{0}{suc y} _ = refl\n≤-suc-trans{suc x}{suc y} p = ≤-suc-trans{x}{y} p\n\n-------------------------------------------------------------\n-- more properties relating <, ≤ with arithmetic operations\n-------------------------------------------------------------\n\n<+ : ∀ {x y : ℕ} → y =ℕ 0 ≡ ff → x < y + x ≡ tt\n<+{y = 0} ()\n<+{x}{suc 0} p = <-suc x\n<+{x}{suc (suc y)} p = <-trans{x}{(suc y) + x}{suc ((suc y) + x)} (<+{x}{suc y} refl) (<-suc ((suc y) + x))\n\n<+2 : ∀ {x y : ℕ} → x < (suc y) + x ≡ tt\n<+2{x}{y} = <+{x}{suc y} refl\n\n<-iter-suc-trans-t-h : (n : ℕ) → (x : ℕ) → (accum : ℕ) → Set\n<-iter-suc-trans-t-h 0 x accum = x < accum ≡ tt\n<-iter-suc-trans-t-h (suc n) x accum = <-iter-suc-trans-t-h n x (suc accum)\n\n<-iter-suc-trans-t : (n : ℕ) → (x : ℕ) → Set\n<-iter-suc-trans-t n x = <-iter-suc-trans-t-h n x (suc x)\n\n<-iter-suc-trans-h : ∀ (n : ℕ) → (x : ℕ) → (accum : ℕ) → x < accum ≡ tt → <-iter-suc-trans-t-h n x accum\n<-iter-suc-trans-h 0 x accum p = p\n<-iter-suc-trans-h (suc n) x accum p = <-iter-suc-trans-h n x (suc accum) (<-suc-trans{x} p)\n\n<-iter-suc-trans : ∀ (n : ℕ) → (x : ℕ) → <-iter-suc-trans-t n x\n<-iter-suc-trans n x = <-iter-suc-trans-h n x (suc x) (<-suc x)\n\n≤0 : ∀ (n : ℕ) → 0 ≤ n ≡ tt\n≤0 0 = refl\n≤0 (suc n) = refl\n\n≤2* : ∀ (x : ℕ) → x ≤ 2 * x ≡ tt\n≤2* 0 = refl\n≤2* (suc x) rewrite +suc x (x + 0) | ≤<-trans {x} (≤2* x) (<-suc (2 * x)) = refl\n\n0<+ : ∀ (x y : ℕ) → 0 < y ≡ tt → 0 < x + y ≡ tt\n0<+ 0 y p = p\n0<+ (suc x) y p = refl\n\n<=ℕff2 : ∀ (x : ℕ) → 1 < x ≡ tt → x =ℕ 0 ≡ ff\n<=ℕff2 x p = <=ℕff x (<-trans{0}{1}{x} refl p)\n\n*≤ : ∀(x y : ℕ) → x ≤ x * (suc y) ≡ tt\n*≤ zero y = refl\n*≤ (suc x) y = ≤-trans {x} (*≤ x y) (≤+2 y (x * suc y))\n\n--------------------------------------------------\n-- relationships between ≤ and <\n--------------------------------------------------\n\n≤ff : ∀ {x y : ℕ} → x ≤ y ≡ ff → y < x ≡ tt\n≤ff{0}{0} ()\n≤ff{0}{suc y} ()\n≤ff{suc x}{0} _ = refl\n≤ff{suc x}{suc y} p rewrite ≤ff {x}{y} p = refl\n\n : ∀{x y : ℕ} → x < y ≡ tt → y < x ≡ ff\n<-not->{0}{0} ()\n<-not->{suc x}{0} ()\n<-not->{0}{suc y} p = refl\n<-not->{suc x}{suc y} p = <-not->{x}{y} p\n\n{x}{y} p = refl\n\n≤-antisym : ∀{x y : ℕ} → x ≤ y ≡ tt → y ≤ x ≡ tt → x ≡ y\n≤-antisym{x}{y} p q with ||-split {x < y} p \n≤-antisym{x}{y} p q | inj₁ u rewrite Nat\n\ndata Bool : Set where\n true : Bool\n false : Bool\n\nisZero : Nat -> Bool\nisZero zero = true\nisZero (suc _) = false\n\n\nf : Nat -> Nat\nf n with isZero n\nf n | true = zero\nf n | false = suc zero\n\ng : Nat -> Nat\ng zero = zero\ng (suc n) with g n\ng (suc n) | zero = n\ng (suc n) | suc _ = n\n\n-- Andreas, 2014-11-06 outlawing with on module parameter.\n-- The following will trigger an error:\n\n-- data T : Set where\n-- tt : T\n\n-- module A (x : T) where\n-- h : T\n-- h with x -- illegal!\n-- h | y = y\n\n-- postulate\n-- C : T -> Set\n\n-- test : C (A.h tt) -> C tt\n-- test x = x\n\n", "meta": {"hexsha": "f1995812a43d58d7e73c82e0978e2f14cd3131cf", "size": 671, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/WithInParModule.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/WithInParModule.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/WithInParModule.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 15.25, "max_line_length": 58, "alphanum_fraction": 0.5692995529, "num_tokens": 244, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8558511469672594, "lm_q2_score": 0.810478913248044, "lm_q1q2_score": 0.6936493074961164}} {"text": "\nmodule Oscar.Class.Reflexive where\n\nopen import Oscar.Level\nopen import Oscar.Property.IsReflexive\n\nrecord Reflexive {𝔬} (⋆ : Set 𝔬) ℓ : Set (𝔬 ⊔ lsuc ℓ) where\n field\n _≣_ : ⋆ → ⋆ → Set ℓ\n isReflexive : IsReflexive ⋆ _≣_\n\n open IsReflexive isReflexive public\n", "meta": {"hexsha": "42695c6ffd213469e668f387eda71351d45877d0", "size": 268, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Class/Reflexive.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Class/Reflexive.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Class/Reflexive.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.6153846154, "max_line_length": 59, "alphanum_fraction": 0.6940298507, "num_tokens": 108, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9294404077216356, "lm_q2_score": 0.7461389817407016, "lm_q1q2_score": 0.6934917194060837}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule TypeTheory.HoTT.Data.Sum.Properties where\n\n-- agda-stdlib\nopen import Level\nopen import Data.Empty\nopen import Data.Product\nopen import Data.Sum\nopen import Function.Base\nopen import Relation.Binary.PropositionalEquality\nopen import Relation.Nullary\n\n-- agda-misc\nopen import TypeTheory.HoTT.Base\n\nprivate\n variable\n a b : Level\n A : Set a\n B : Set b\n\nisProp-⊎ : ¬ (A × B) → isProp A → isProp B → isProp (A ⊎ B)\nisProp-⊎ ¬[A×B] A-isP B-isP (inj₁ x₁) (inj₁ x₂) = cong inj₁ (A-isP x₁ x₂)\nisProp-⊎ ¬[A×B] A-isP B-isP (inj₁ x₁) (inj₂ y₂) = ⊥-elim $ ¬[A×B] (x₁ , y₂)\nisProp-⊎ ¬[A×B] A-isP B-isP (inj₂ y₁) (inj₁ x₂) = ⊥-elim $ ¬[A×B] (x₂ , y₁)\nisProp-⊎ ¬[A×B] A-isP B-isP (inj₂ y₁) (inj₂ y₂) = cong inj₂ (B-isP y₁ y₂)\n", "meta": {"hexsha": "f84ff447909834f882286219dee2a237e3923918", "size": 765, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "TypeTheory/HoTT/Data/Sum/Properties.agda", "max_stars_repo_name": "rei1024/agda-misc", "max_stars_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:49:42.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-21T00:03:43.000Z", "max_issues_repo_path": "TypeTheory/HoTT/Data/Sum/Properties.agda", "max_issues_repo_name": "rei1024/agda-misc", "max_issues_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TypeTheory/HoTT/Data/Sum/Properties.agda", "max_forks_repo_name": "rei1024/agda-misc", "max_forks_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.3214285714, "max_line_length": 75, "alphanum_fraction": 0.6496732026, "num_tokens": 324, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.929440397949314, "lm_q2_score": 0.7461389873857264, "lm_q1q2_score": 0.6934917173612877}} {"text": "module Numeral.Natural.Relation.Order.Existence.Proofs where\n\nimport Lvl\nopen import Data.Tuple as Tuple using (_⨯_ ; _,_)\nopen import Functional\nopen import Logic.Propositional\nopen import Logic.Propositional.Theorems\nopen import Logic.Predicate\nopen import Numeral.Natural\nopen import Numeral.Natural.Oper\nopen import Numeral.Natural.Oper.Proofs\nopen import Numeral.Natural.Induction\nopen import Numeral.Natural.Relation.Order.Existence\nopen import Relator.Equals\nopen import Relator.Equals.Proofs\nopen import Structure.Function.Domain\nopen import Structure.Operator\nopen import Structure.Operator.Properties\nimport Structure.Relator.Names as Names\nopen import Structure.Relator.Ordering\nopen import Structure.Relator.Properties\nopen import Syntax.Transitivity\nopen import Type\n\n[≡]-to-[≤] : ∀{x y : ℕ} → (x ≡ y) → (x ≤ y)\n[≡]-to-[≤] x≡y = [∃]-intro 0 ⦃ x≡y ⦄\n\n[≤]-minimum : ∀{x : ℕ} → (0 ≤ x)\n[≤]-minimum {x} = [∃]-intro x ⦃ identityₗ(_+_)(𝟎) ⦄\n\n[≤][0]ᵣ : ∀{x : ℕ} → (x ≤ 0) ↔ (x ≡ 0)\n[≤][0]ᵣ {𝟎} = [↔]-intro [≡]-to-[≤] (const [≡]-intro)\n[≤][0]ᵣ {𝐒(n)} = [↔]-intro (\\()) (\\{([∃]-intro _ ⦃ ⦄ )})\n\n[≤][0]ᵣ-negation : ∀{x : ℕ} → ¬(𝐒(x) ≤ 0)\n[≤][0]ᵣ-negation {x} (Sx≤0) = [𝐒]-not-0([↔]-to-[→] ([≤][0]ᵣ {𝐒(x)}) (Sx≤0))\n\n[≤]-successor : ∀{a b : ℕ} → (a ≤ b) → (a ≤ 𝐒(b))\n[≤]-successor ([∃]-intro(n) ⦃ proof ⦄) = [∃]-intro (𝐒(n)) ⦃ [≡]-with(𝐒) (proof) ⦄\n\n[≤]-predecessor : ∀{a b : ℕ} → (𝐒(a) ≤ b) → (a ≤ b)\n[≤]-predecessor ([∃]-intro n) = [∃]-intro(𝐒(n))\n\n[≤]-without-[𝐒] : ∀{a b : ℕ} → (a ≤ b) ← (𝐒(a) ≤ 𝐒(b))\n[≤]-without-[𝐒] {𝟎} {b} (_) = [≤]-minimum\n[≤]-without-[𝐒] {𝐒(a)}{𝟎} ()\n[≤]-without-[𝐒] {𝐒(a)}{𝐒(b)} ([∃]-intro(n) ⦃ proof ⦄) = [≤]-with-[𝐒] {a}{b} ([≤]-without-[𝐒] {a}{b} ([∃]-intro(n) ⦃ injective(𝐒) proof ⦄))\n\n[≤][𝐒]ₗ : ∀{x : ℕ} → ¬(𝐒(x) ≤ x)\n[≤][𝐒]ₗ {𝟎} (1≤0) = [≤][0]ᵣ-negation{0}(1≤0)\n[≤][𝐒]ₗ {𝐒(n)} (SSn≤Sn) = [≤][𝐒]ₗ {n} ([≤]-without-[𝐒] {𝐒(n)}{n} (SSn≤Sn))\n\ninstance\n [≤]-transitivity : Transitivity (_≤_)\n Transitivity.proof [≤]-transitivity {a}{b}{c} ([∃]-intro n₁ ⦃ an₁b ⦄) ([∃]-intro n₂ ⦃ bn₂c ⦄) = [∃]-intro (n₁ + n₂) ⦃ p ⦄ where\n p =\n a + (n₁ + n₂) 🝖[ _≡_ ]-[ associativity(_+_) {a}{n₁}{n₂} ]-sym\n (a + n₁) + n₂ 🝖[ _≡_ ]-[ congruence₂ₗ(_+_)(n₂) an₁b ]\n b + n₂ 🝖[ _≡_ ]-[ bn₂c ]\n c 🝖-end\n\ninstance\n [≤]-reflexivity : Reflexivity (_≤_)\n Reflexivity.proof [≤]-reflexivity = [≡]-to-[≤] [≡]-intro\n\ninstance\n [≤]-antisymmetry : Antisymmetry (_≤_) (_≡_)\n Antisymmetry.proof [≤]-antisymmetry {a} {b} ([∃]-intro(n₁) ⦃ an₁b ⦄) ([∃]-intro(n₂) ⦃ bn₂a ⦄) =\n a 🝖[ _≡_ ]-[]\n a + 𝟎 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(a) n₁0 ]-sym\n a + n₁ 🝖[ _≡_ ]-[ an₁b ]\n b 🝖-end\n where\n n₁n₂0 : (n₁ + n₂ ≡ 0)\n n₁n₂0 = cancellationₗ(_+_) $\n a + (n₁ + n₂) 🝖[ _≡_ ]-[ associativity(_+_) {a}{n₁}{n₂} ]-sym\n (a + n₁) + n₂ 🝖[ _≡_ ]-[ congruence₂ₗ(_+_)(n₂) an₁b ]\n b + n₂ 🝖[ _≡_ ]-[ bn₂a ]\n a 🝖[ _≡_ ]-[]\n a + 0 🝖-end\n\n n₁0 : (n₁ ≡ 0)\n n₁0 = [∧]-elimₗ ([+]-sum-is-0 {n₁} {n₂} n₁n₂0)\n\ninstance\n [≤]-weakPartialOrder : Weak.PartialOrder (_≤_) (_≡_)\n [≤]-weakPartialOrder = record{}\n\n[<]-minimum : ∀{x : ℕ} → (0 < 𝐒(x))\n[<]-minimum = [≤]-with-[𝐒] {0} [≤]-minimum\n\n[≥]-is-[≮] : ∀{a b : ℕ} → ¬(a < b) ← (a ≥ b)\n[≥]-is-[≮] {a}{b} b≤a Sa≤b = [≤][𝐒]ₗ (transitivity(_≤_) {x = 𝐒(a)}{y = b}{z = a} Sa≤b b≤a)\n\n-- [≤]-is-[≯] : ∀{a b : ℕ} → ¬(a > b) ← (a ≤ b)\n-- [≤]-is-[≯] {a}{b} = [≥]-is-[≮] {b}{a}\n\n-- [>]-is-[≰] : ∀{a b : ℕ} → ¬(a ≤ b) ← (a > b)\n-- [>]-is-[≰] {a}{b} (Sb≤a) (a≤b) = [≤]-is-[≯] {a}{b} (a≤b) (Sb≤a)\n\n-- [<]-is-[≱] : ∀{a b : ℕ} → ¬(a ≥ b) ← (a < b)\n-- [<]-is-[≱] {a}{b} = [>]-is-[≰] {b}{a}\n\ninstance\n [≤]-totality : ConverseTotal(_≤_)\n [≤]-totality = intro p where\n p : Names.ConverseTotal(_≤_)\n p {𝟎} {𝟎} = [∨]-introₗ ([≡]-to-[≤] [≡]-intro)\n p {𝐒(a)}{𝟎} = [∨]-introᵣ ([≤]-minimum)\n p {𝟎} {𝐒(b)} = [∨]-introₗ ([≤]-minimum)\n p {𝐒(a)}{𝐒(b)} = [∨]-elim ([∨]-introₗ ∘ ([≤]-with-[𝐒] {a}{b})) ([∨]-introᵣ ∘ ([≤]-with-[𝐒] {b}{a})) (p {a}{b})\n\n\n", "meta": {"hexsha": "6ee5b3e528a88c141887e428e8536de170348dd6", "size": 4045, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Relation/Order/Existence/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Relation/Order/Existence/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Relation/Order/Existence/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.4824561404, "max_line_length": 138, "alphanum_fraction": 0.4791100124, "num_tokens": 2126, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391602943619, "lm_q2_score": 0.8031737963569016, "lm_q1q2_score": 0.6934535114788971}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Algebra.Monoid.Properties where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Data.Nat\nopen import Cubical.Data.NatPlusOne\nopen import Cubical.Data.Sigma hiding (_×_)\nopen import Cubical.Data.Prod\n\nopen import Cubical.Algebra\nopen import Cubical.Algebra.Properties\nopen import Cubical.Algebra.Monoid.Morphism\n\nopen import Cubical.Algebra.Semigroup.Properties as Semigroup using (isPropIsSemigroup)\n\nopen import Cubical.Relation.Binary.Reasoning.Equality\nopen import Cubical.Relation.Unary as Unary\nopen import Cubical.Relation.Binary as Binary\n\nopen import Cubical.Algebra.Monoid.MorphismProperties public\n using (MonoidPath; uaMonoid; carac-uaMonoid; Monoid≡; caracMonoid≡)\n\nprivate\n variable\n ℓ : Level\n\n\nisPropIsMonoid : ∀ {M : Type ℓ} {_•_ ε} → isProp (IsMonoid M _•_ ε)\nisPropIsMonoid {_} {_} {_•_} {ε} (ismonoid aSemi aId) (ismonoid bSemi bId) =\n cong₂ ismonoid (isPropIsSemigroup aSemi bSemi) (isPropIdentity (IsSemigroup.is-set aSemi) _•_ ε aId bId)\n\n\nmodule MonoidLemmas (M : Monoid ℓ) where\n open Monoid M\n\n ε-comm : ∀ x → x • ε ≡ ε • x\n ε-comm x = identityʳ x ∙ sym (identityˡ x)\n\n\n ^-zeroˡ : LeftZero ε _^_\n ^-zeroˡ zero = refl\n ^-zeroˡ (suc n) = identityˡ (ε ^ n) ∙ ^-zeroˡ n\n\n ^-suc : ∀ x n → x ^ suc n ≡ x ^ n • x\n ^-suc x zero = ε-comm x\n ^-suc x (suc n) =\n x ^ suc (suc n) ≡⟨⟩\n x • x ^ suc n ≡⟨ cong (x •_) (^-suc x n) ⟩\n x • (x ^ n • x) ≡˘⟨ assoc x (x ^ n) x ⟩\n x • x ^ n • x ≡⟨⟩\n x ^ suc n • x ∎\n\n ^-plus : ∀ x → Homomorphic₂ (x ^_) _+_ _•_\n ^-plus x zero n = sym (identityˡ (x ^ n))\n ^-plus x (suc m) n =\n x ^ (suc m + n) ≡⟨⟩\n x • x ^ (m + n) ≡⟨ cong (x •_) (^-plus x m n) ⟩\n x • (x ^ m • x ^ n) ≡˘⟨ assoc x (x ^ m) (x ^ n) ⟩\n x • x ^ m • x ^ n ≡⟨⟩\n x ^ suc m • x ^ n ∎\n\n infixl 10 _^′_\n _^′_ = Semigroup._^_ semigroup\n\n ^semi≡^ : ∀ x n → x ^′ n ≡ x ^ (ℕ₊₁→ℕ n)\n ^semi≡^ x one = sym (identityʳ x)\n ^semi≡^ x (2+ n) = cong (x •_) (^semi≡^ x (1+ n))\n\n\n-- Invertible elements\nmodule Invertible (M : Monoid ℓ) where\n open Monoid M\n\n Inverses′ : RawRel ⟨ M ⟩ ℓ\n Inverses′ x y = (x • y ≡ ε) × (y • x ≡ ε)\n\n isPropInverses : Binary.isPropValued Inverses′\n isPropInverses _ _ = isPropProd (is-set _ _) (is-set _ _)\n\n Inverses : Rel ⟨ M ⟩ ℓ\n Inverses = Binary.fromRaw Inverses′ isPropInverses\n\n\n inv-unique′ : ∀ {x y z} → x • y ≡ ε → z • x ≡ ε → y ≡ z\n inv-unique′ {x} {y} {z} xy≡ε zx≡ε =\n y ≡˘⟨ identityˡ y ⟩\n ε • y ≡˘⟨ cong (_• y) zx≡ε ⟩\n (z • x) • y ≡⟨ assoc z x y ⟩\n z • (x • y) ≡⟨ cong (z •_) xy≡ε ⟩\n z • ε ≡⟨ identityʳ z ⟩\n z ∎\n\n inv-unique : ∀ {x y z} → ⟨ Inverses x y ⟩ → ⟨ Inverses x z ⟩ → y ≡ z\n inv-unique (xy≡ε , _) (_ , zx≡ε) = inv-unique′ xy≡ε zx≡ε\n\n\n Invertible′ : RawPred ⟨ M ⟩ ℓ\n Invertible′ x = Σ ⟨ M ⟩ (Inverses′ x)\n\n isPropInvertible : Unary.isPropValued Invertible′\n isPropInvertible x (y , x-y) (z , x-z) = ΣPathTransport→PathΣ (y , x-y) (z , x-z)\n (inv-unique x-y x-z , isPropInverses _ _ _ _)\n\n Invertible : Pred ⟨ M ⟩ ℓ\n Invertible = Unary.fromRaw Invertible′ isPropInvertible\n\n\n εInverses : ⟨ Inverses ε ε ⟩\n εInverses = identityˡ ε , identityˡ ε\n\n εInvertible : ε ∈ Invertible\n εInvertible = ε , εInverses\n\n\nmodule Kernel {ℓ ℓ′} {M : Monoid ℓ} {N : Monoid ℓ′} (hom : MonoidHom M N)\n = Semigroup.Kernel (MonoidHom→SemigroupHom hom)\n", "meta": {"hexsha": "5a8fa833f32d1a5af0db14cbe0afdba2881b1646", "size": 3522, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Monoid/Properties.agda", "max_stars_repo_name": "bijan2005/univalent-foundations", "max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/Monoid/Properties.agda", "max_issues_repo_name": "bijan2005/univalent-foundations", "max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/Monoid/Properties.agda", "max_forks_repo_name": "bijan2005/univalent-foundations", "max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.5966386555, "max_line_length": 106, "alphanum_fraction": 0.5928449744, "num_tokens": 1460, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391599428538, "lm_q2_score": 0.8031737963569016, "lm_q1q2_score": 0.6934535086556761}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Functions\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import Numbers.Naturals.Definition\nopen import Numbers.Integers.Integers\nopen import Numbers.Integers.Addition\nopen import Sets.FinSet.Definition\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Groups\nopen import Groups.Subgroups.Definition\nopen import Groups.Lemmas\nopen import Groups.Subgroups.Definition\nopen import Groups.Abelian.Definition\nopen import Groups.Definition\nopen import Groups.Cyclic.Definition\nopen import Groups.Cyclic.DefinitionLemmas\nopen import Semirings.Definition\nopen import Rings.Definition\n\nmodule Groups.Cyclic.Lemmas {m n : _} {A : Set m} {S : Setoid {m} {n} A} {_·_ : A → A → A} (G : Group S _·_) where\n\nelementPowerHom : (x : A) → GroupHom ℤGroup G (λ i → elementPower G x i)\nGroupHom.groupHom (elementPowerHom x) {a} {b} = symmetric (elementPowerCollapse G x a b)\n where\n open Equivalence (Setoid.eq S)\nGroupHom.wellDefined (elementPowerHom x) {.y} {y} refl = reflexive\n where\n open Equivalence (Setoid.eq S)\n\nsubgroupOfCyclicIsCyclic : {c : _} {pred : A → Set c} → (sub : Subgroup G pred) → CyclicGroup G → CyclicGroup (subgroupIsGroup G sub)\nCyclicGroup.generator (subgroupOfCyclicIsCyclic {pred = pred} sub record { generator = g ; cyclic = cyclic }) = {!!}\n where\n leastPowerInGroup : (bound : ℕ) → ℕ\n leastPowerInGroup bound = {!!}\nCyclicGroup.cyclic (subgroupOfCyclicIsCyclic sub cyc) = {!!}\n\n-- Prefer to prove that subgroup of cyclic is cyclic, then deduce this like with abelian groups\n{-\ncyclicIsGroupProperty : {m n o p : _} {A : Set m} {B : Set o} {S : Setoid {m} {n} A} {T : Setoid {o} {p} B} {_+_ : A → A → A} {_*_ : B → B → B} {G : Group S _+_} {H : Group T _*_} → GroupsIsomorphic G H → CyclicGroup G → CyclicGroup H\nCyclicGroup.generator (cyclicIsGroupProperty {H = H} iso G) = GroupsIsomorphic.isomorphism iso (CyclicGroup.generator G)\nCyclicGroup.cyclic (cyclicIsGroupProperty {H = H} iso G) {a} with GroupIso.surj (GroupsIsomorphic.proof iso) {a}\nCyclicGroup.cyclic (cyclicIsGroupProperty {H = H} iso G) {a} | a' , b with CyclicGroup.cyclic G {a'}\n... | pow , prPow = pow , {!!}\n-}\n\ncyclicGroupIsAbelian : (cyclic : CyclicGroup G) → AbelianGroup G\nAbelianGroup.commutative (cyclicGroupIsAbelian record { generator = generator ; cyclic = cyclic }) {a} {b} with cyclic {a}\n... | bl with cyclic {b}\nAbelianGroup.commutative (cyclicGroupIsAbelian record { generator = generator ; cyclic = cyclic }) {a} {b} | nA , prA | nB , prB = transitive (+WellDefined (symmetric prA) (symmetric prB)) (transitive (symmetric (GroupHom.groupHom (elementPowerHom generator) {nA} {nB})) (transitive (transitive (elementPowerWellDefinedZ' G (nA +Z nB) (nB +Z nA) (Ring.groupIsAbelian ℤRing {nA} {nB}) {generator}) (GroupHom.groupHom (elementPowerHom generator) {nB} {nA})) (+WellDefined prB prA)))\n where\n open Setoid S\n open Equivalence eq\n open Group G\n", "meta": {"hexsha": "e3e6af609f3637d62b14ccfc845c1acb4feeb82e", "size": 3058, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Cyclic/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Cyclic/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Cyclic/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 52.724137931, "max_line_length": 480, "alphanum_fraction": 0.7259646828, "num_tokens": 952, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9149009549929797, "lm_q2_score": 0.7577943822145998, "lm_q1q2_score": 0.6933068039764525}} {"text": "open import Data.Nat hiding ( _+_; _*_; _⊔_; zero ) \nopen import Algebra hiding (Zero) \nopen import Level using (Level; _⊔_)\nopen import Data.Product\n\n\n\nmodule quad { c ℓ } ( ring : Ring c ℓ ) where\nopen Ring ring\n\n\ndata Nat4 : Set where\n One : Nat4\n Suc : Nat4 -> Nat4 \n\n\nvariable\n a b d : Level\n A : Set a\n B : Set b\n C : Set c\n m n : Nat4\n\n\n-- Indu:ctive definition of a Quad matrix\ndata Quad ( A : Set a ) : Nat4 → Set a where\n Zero : Quad A n \n Scalar : A → Quad A One\n Mtx : ( nw ne sw se : Quad A n ) → Quad A (Suc n)\n\n\n-- Zero with explicit size\nzeroQ : ( n : Nat4) → Quad A n \nzeroQ n = Zero\n\noneQ : ∀ { n } → Quad Carrier n\noneQ {One} = Scalar 1#\noneQ {Suc n} = Mtx oneQ Zero\n Zero oneQ\n\n-- Equality\n\n-- eq-Zero is only valid when m ≡ n\ndata EqQ {A : Set a} (_∼_ : A -> A -> Set d) :\n (xs : Quad A m) (ys : Quad A n) → Set (a ⊔ d)\n where\n \n eq-Zero : ∀ { n } → EqQ _∼_ (zeroQ n) (zeroQ n)\n\n eq-Scalar : { x y : A } ( x∼y : x ∼ y ) → EqQ _∼_ (Scalar x) (Scalar y)\n \n eq-Mtx : { nw1 ne1 sw1 se1 : Quad A m } { nw2 ne2 sw2 se2 : Quad A n }\n ( nw : EqQ _∼_ nw1 nw2 ) ( ne : EqQ _∼_ ne1 ne2 )\n ( sw : EqQ _∼_ sw1 sw2 ) ( se : EqQ _∼_ se1 se2 ) →\n EqQ _∼_ (Mtx nw1 ne1 sw1 se1) (Mtx nw2 ne2 sw2 se2) \n\n_=q_ : Quad Carrier n -> Quad Carrier n -> Set ( c ⊔ ℓ)\n_=q_ = EqQ _≈_\n\n-- Functions\n\nmapq : ∀ { A B : Set } → ( A → B ) → Quad A n -> Quad B n\nmapq f Zero = Zero\nmapq f (Scalar x) = Scalar (f x) \nmapq f (Mtx nw ne sw se) = Mtx (mapq f nw) (mapq f ne) (mapq f sw) (mapq f se)\n\n\n-- Addition on Quads\n_+q_ : ( x y : Quad Carrier n) → Quad Carrier n\nZero +q y = y\nScalar x +q Zero = Scalar x\nScalar x +q Scalar x₁ = Scalar (x + x₁)\nMtx x x₁ x₂ x₃ +q Zero = Mtx x x₁ x₂ x₃\nMtx x x₁ x₂ x₃ +q Mtx y y₁ y₂ y₃ = Mtx (x +q y) (x₁ +q y₁) (x₂ +q y₂) (x₃ +q y₃)\n\n\n-- Multiplication\n\ndata Q' ( A : Set a) : Set a where\n Mtx' : ( nw ne sw se : A ) → Q' A\n\nQ'toQuad : Q' (Quad A n) → Quad A (Suc n)\n-- Q'toQuad (Mtx' Zero Zero Zero Zero) = Zero\nQ'toQuad (Mtx' nw ne sw se) = Mtx nw ne sw se\n\nzipQ' : ( A → B → C ) → Q' A → Q' B → Q' C\nzipQ' _op_ (Mtx' nw ne sw se) (Mtx' nw₁ ne₁ sw₁ se₁) = Mtx' (nw op nw₁) (ne op ne₁)\n (sw op sw₁) (se op se₁)\n\ncolExchange : Q' A → Q' A\ncolExchange (Mtx' nw ne sw se) = Mtx' ne nw se sw\n\nprmDiagSqsh : Q' A → Q' A\nprmDiagSqsh (Mtx' nw ne sw se) = Mtx' nw se nw se\n\noffDiagSqsh : Q' A → Q' A\noffDiagSqsh (Mtx' nw ne sw se) = Mtx' sw ne sw se\n\n\n_*q_ : ( x y : Quad Carrier n) → Quad Carrier n\nZero *q y = Zero\nScalar x *q Zero = Zero\nScalar x *q Scalar x₁ = Scalar (x * x₁)\nMtx x x₁ x₂ x₃ *q Zero = Zero\nMtx x x₁ x₂ x₃ *q Mtx y y₁ y₂ y₃ =\n let X = Mtx' x x₁ x₂ x₃\n Y = Mtx' y y₁ y₂ y₃\n in Q'toQuad (zipQ' _+q_ (zipQ' _*q_ (colExchange X) (offDiagSqsh Y))\n (zipQ' _*q_ X (prmDiagSqsh Y)))\n\n\n\n-- Example Quad\n\nq1 : Quad ℕ (Suc One)\nq1 = Mtx (Scalar 2) (Scalar 7) Zero Zero \n\nq2 : Quad ℕ (Suc (Suc One))\nq2 = Mtx q1 q1 Zero (Mtx (Scalar 1) Zero Zero (Scalar 1))\n\n\n\n-- Proofs\n\nquad-refl : { a : Quad Carrier n } → a =q a\nquad-refl { n } { Zero } = eq-Zero\nquad-refl { n } { (Scalar x) } = eq-Scalar refl\nquad-refl { n } { (Mtx a a₁ a₂ a₃) } = eq-Mtx quad-refl quad-refl quad-refl quad-refl\n\nquad-sym : { a b : Quad Carrier n } → a =q b → b =q a\nquad-sym eq-Zero = eq-Zero\nquad-sym (eq-Scalar x∼y) = eq-Scalar (sym x∼y)\nquad-sym (eq-Mtx x x₁ x₂ x₃) = eq-Mtx (quad-sym x) (quad-sym x₁) (quad-sym x₂) (quad-sym x₃)\n\n\nquad-zerol : ∀ { n } ( x : Quad Carrier n ) → ( Zero +q x ) =q x\nquad-zerol x = quad-refl\n\nquad-zeror : ∀ { n } ( x : Quad Carrier n ) → ( x +q Zero ) =q x\nquad-zeror Zero = quad-refl\nquad-zeror (Scalar x) = quad-refl\nquad-zeror (Mtx x x₁ x₂ x₃) = quad-refl\n\n-- Need a proof that Zero is left and right +q-identity\n-- Should be some kind of (quad-zerol, quad-zeror)\n\n\n\nquad-comm : ( a b : Quad Carrier n ) → ( a +q b) =q ( b +q a )\nquad-comm Zero b = quad-sym (quad-zeror b)\nquad-comm (Scalar x) Zero = quad-refl\nquad-comm (Scalar x) (Scalar x₁) = eq-Scalar (+-comm x x₁)\nquad-comm (Mtx a a₁ a₂ a₃) Zero = quad-refl \nquad-comm (Mtx a a₁ a₂ a₃) (Mtx b b₁ b₂ b₃) = eq-Mtx (quad-comm a b) (quad-comm a₁ b₁)\n (quad-comm a₂ b₂) (quad-comm a₃ b₃)\n\n\nquad-assoc : ( a b c : Quad Carrier n ) → ((a +q b ) +q c ) =q ( a +q ( b +q c )) \nquad-assoc Zero b c = quad-refl \nquad-assoc (Scalar x) Zero c = quad-refl \nquad-assoc (Scalar x) (Scalar x₁) Zero = quad-refl\nquad-assoc (Scalar x) (Scalar x₁) (Scalar x₂) = eq-Scalar (+-assoc x x₁ x₂)\nquad-assoc (Mtx a a₁ a₂ a₃) Zero c = quad-refl\nquad-assoc (Mtx a a₁ a₂ a₃) (Mtx b b₁ b₂ b₃) Zero = quad-refl\nquad-assoc (Mtx a a₁ a₂ a₃) (Mtx b b₁ b₂ b₃) (Mtx c c₁ c₂ c₃) = eq-Mtx (quad-assoc a b c ) (quad-assoc a₁ b₁ c₁)\n (quad-assoc a₂ b₂ c₂) (quad-assoc a₃ b₃ c₃)\n\n\n\nquad-*-zerol : ( x : Quad Carrier n ) → ( Zero *q x ) =q Zero\nquad-*-zerol x = eq-Zero\n\nquad-*-zeror : ( x : Quad Carrier n ) → ( x *q Zero ) =q Zero\nquad-*-zeror Zero = eq-Zero\nquad-*-zeror (Scalar x) = eq-Zero\nquad-*-zeror (Mtx x x₁ x₂ x₃) = eq-Zero\n\n\nquad-onel : ( x : Quad Carrier n ) → ( oneQ *q x ) =q x\n\nquad-onel-lemma : ( x : Quad Carrier n ) → ((oneQ *q x) +q Zero) =q x\nquad-onel-lemma {One} Zero = eq-Zero\nquad-onel-lemma {Suc n} Zero = eq-Zero\nquad-onel-lemma (Scalar x) = eq-Scalar (*-identityˡ x)\nquad-onel-lemma (Mtx x x₁ x₂ x₃) = eq-Mtx (quad-onel x) (quad-onel-lemma x₁) (quad-onel-lemma x₂) (quad-onel x₃)\n\nquad-onel Zero = quad-*-zeror oneQ\nquad-onel (Scalar x) = eq-Scalar (*-identityˡ x)\nquad-onel (Mtx x x₁ x₂ x₃) = eq-Mtx (quad-onel x) (quad-onel-lemma x₁) (quad-onel-lemma x₂) (quad-onel x₃)\n\n", "meta": {"hexsha": "208af95f451fcfdf17a19b042ccc8e7a336e3a96", "size": 5853, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/quad.agda", "max_stars_repo_name": "DSLsofMath/BScProj2021", "max_stars_repo_head_hexsha": "87c0340515b0965454d9ba240ecc6de84b74ee0a", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/quad.agda", "max_issues_repo_name": "DSLsofMath/BScProj2021", "max_issues_repo_head_hexsha": "87c0340515b0965454d9ba240ecc6de84b74ee0a", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/quad.agda", "max_forks_repo_name": "DSLsofMath/BScProj2021", "max_forks_repo_head_hexsha": "87c0340515b0965454d9ba240ecc6de84b74ee0a", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.6439790576, "max_line_length": 114, "alphanum_fraction": 0.5581752947, "num_tokens": 2366, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9149009573133051, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.6933067907213131}} {"text": "\nmodule Lib.Eq where\n\nopen import Lib.Prelude as P hiding (String)\nopen import Lib.Nat renaming (_==_ to _=Nat=_)\nopen import Lib.Fin\nopen import Lib.List\nopen import Lib.Bool\n\n-- Wrapper type, used to ensure that El is constructor-headed.\n\nrecord String : Set where\n constructor string\n field unString : P.String\n\n-- Codes for types supporting equality\n\ndata EqU : Set where\n nat : EqU\n bool : EqU\n string : EqU\n unit : EqU\n fin : Nat -> EqU\n list : EqU -> EqU\n pair : EqU -> EqU -> EqU\n\nEl : EqU -> Set\nEl nat = Nat\nEl bool = Bool\nEl string = String\nEl unit = Unit\nEl (fin n) = Fin n\nEl (list u) = List (El u)\nEl (pair u v) = El u × El v\n\nprimitive primStringEquality : P.String -> P.String -> Bool\n\ninfix 30 _==_\n\n_==_ : {u : EqU} -> El u -> El u -> Bool\n_==_ {nat} n m = n =Nat= m\n_==_ {fin n} i j = finEq i j\n_==_ {bool} false y = not y\n_==_ {bool} true y = y\n_==_ {string} (string x) (string y) = primStringEquality x y\n_==_ {unit} _ _ = true\n_==_ {list u} [] [] = true\n_==_ {list u} (x :: xs) (y :: ys) = x == y && xs == ys\n_==_ {list u} _ _ = false\n_==_ {pair u v} (x₁ , y₁) (x₂ , y₂) = x₁ == x₂ && y₁ == y₂\n", "meta": {"hexsha": "90df297661d963d4c8d3c6989f635104ccfa31f7", "size": 1316, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/simple-lib/Lib/Eq.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/simple-lib/Lib/Eq.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/simple-lib/Lib/Eq.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 25.8039215686, "max_line_length": 62, "alphanum_fraction": 0.5174772036, "num_tokens": 455, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9219218327098193, "lm_q2_score": 0.7520125682019722, "lm_q1q2_score": 0.6932968050975802}} {"text": "module Avionics.List where\n\nopen import Data.Bool using (Bool; true; false; T)\nopen import Data.List as List using (List; []; _∷_; any)\nopen import Data.List.Relation.Unary.Any using (Any; here; there)\nopen import Function using (_∘_)\nopen import Relation.Binary.PropositionalEquality using (_≡_; inspect; [_]; refl)\n\nopen import Avionics.Bool using (≡→T)\n\n≡→any : ∀ {a} {A : Set a} (f) (ns : List A)\n → any f ns ≡ true\n → Any (T ∘ f) ns\n --→ Any (λ x → T (f x)) ns\n≡→any f [] ()\n≡→any f (n ∷ ns) any-f-⟨n∷ns⟩≡true with f n | inspect f n\n... | true | [ fn≡t ] = here (≡→T fn≡t)\n... | false | _ = there (≡→any f ns any-f-⟨n∷ns⟩≡true)\n\nany→≡ : ∀ {a} {A : Set a} (f) (ns : List A)\n → Any (T ∘ f) ns\n → any f ns ≡ true\nany→≡ f (n ∷ _) (here _) with f n\n... | true = refl -- or: T→≡ [*proof*from*here*]\nany→≡ f (n ∷ ns) (there Any[T∘f]ns) with f n\n... | true = refl\n... | false = any→≡ f ns Any[T∘f]ns\n\n\nany-map : ∀ {A B : Set} {p : B → Set} {ls : List A}\n (f : A → B)\n → Any p (List.map f ls)\n → Any (p ∘ f) ls\n--any-map {ls = []} _ ()\nany-map {ls = l ∷ ls} f (here pb) = here pb\nany-map {ls = l ∷ ls} f (there pb) = there (any-map f pb)\n\nany-map-rev : ∀ {A B : Set} {p : B → Set} {ls : List A}\n (f : A → B)\n → Any (p ∘ f) ls\n → Any p (List.map f ls)\nany-map-rev {ls = l ∷ ls} f (here pb) = here pb\nany-map-rev {ls = l ∷ ls} f (there pb) = there (any-map-rev f pb)\n", "meta": {"hexsha": "2e1c4a16b3287b59508d7cf449f195e67c1fe747", "size": 1450, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Avionics/List.agda", "max_stars_repo_name": "RPI-WCL/safety-envelopes-sentinels", "max_stars_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/Avionics/List.agda", "max_issues_repo_name": "RPI-WCL/safety-envelopes-sentinels", "max_issues_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Avionics/List.agda", "max_forks_repo_name": "RPI-WCL/safety-envelopes-sentinels", "max_forks_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-09-20T00:36:09.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-20T00:36:09.000Z", "avg_line_length": 32.9545454545, "max_line_length": 81, "alphanum_fraction": 0.5137931034, "num_tokens": 581, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772351648678, "lm_q2_score": 0.7931059487389968, "lm_q1q2_score": 0.6932358548665917}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\n-- The core of a category.\n-- See https://ncatlab.org/nlab/show/core\n\nmodule Categories.Category.Construction.Core {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level using (_⊔_)\nopen import Function using (flip)\n\nopen import Categories.Category.Groupoid using (Groupoid; IsGroupoid)\nopen import Categories.Morphism 𝒞 as Morphism\nopen import Categories.Morphism.IsoEquiv 𝒞 as IsoEquiv\n\nopen Category 𝒞\nopen _≃_\n\nCore : Category o (ℓ ⊔ e) e\nCore = record\n { Obj = Obj\n ; _⇒_ = _≅_\n ; _≈_ = _≃_\n ; id = ≅.refl\n ; _∘_ = flip ≅.trans\n ; assoc = ⌞ assoc ⌟\n ; sym-assoc = ⌞ sym-assoc ⌟\n ; identityˡ = ⌞ identityˡ ⌟\n ; identityʳ = ⌞ identityʳ ⌟\n ; identity² = ⌞ identity² ⌟\n ; equiv = ≃-isEquivalence\n ; ∘-resp-≈ = λ where ⌞ eq₁ ⌟ ⌞ eq₂ ⌟ → ⌞ ∘-resp-≈ eq₁ eq₂ ⌟\n }\n\nCore-isGroupoid : IsGroupoid Core\nCore-isGroupoid = record\n { _⁻¹ = ≅.sym\n ; iso = λ {_ _ f} → record { isoˡ = ⌞ isoˡ f ⌟ ; isoʳ = ⌞ isoʳ f ⌟ }\n }\n where open _≅_\n\nCoreGroupoid : Groupoid o (ℓ ⊔ e) e\nCoreGroupoid = record { category = Core; isGroupoid = Core-isGroupoid }\n\nmodule CoreGroupoid = Groupoid CoreGroupoid\n\n-- Useful shorthands for reasoning about isomorphisms and morphisms of\n-- 𝒞 in the same module.\n\nmodule Shorthands where\n module Commutationᵢ where\n open Commutation Core public using () renaming ([_⇒_]⟨_≈_⟩ to [_≅_]⟨_≈_⟩)\n\n infixl 2 connectᵢ\n connectᵢ : ∀ {A C : Obj} (B : Obj) → A ≅ B → B ≅ C → A ≅ C\n connectᵢ B f g = ≅.trans f g\n\n syntax connectᵢ B f g = f ≅⟨ B ⟩ g\n\n open _≅_ public\n open _≃_ public\n open Morphism public using (module _≅_)\n open IsoEquiv public using (⌞_⌟) renaming (module _≃_ to _≈ᵢ_)\n open CoreGroupoid public using (_⁻¹) renaming\n ( _⇒_ to _≅_\n ; _≈_ to _≈ᵢ_\n ; id to idᵢ\n ; _∘_ to _∘ᵢ_\n ; iso to ⁻¹-iso\n ; module Equiv to Equivᵢ\n ; module HomReasoning to HomReasoningᵢ\n ; module iso to ⁻¹-iso\n )\n", "meta": {"hexsha": "4dc229fa7babb31e2e0d2dc4473ae34100f8783c", "size": 2078, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Construction/Core.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Construction/Core.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Construction/Core.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 27.7066666667, "max_line_length": 79, "alphanum_fraction": 0.5981713186, "num_tokens": 801, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9046505376715775, "lm_q2_score": 0.766293653760418, "lm_q1q2_score": 0.6932279658886799}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.NaturalTransformation.Extranatural where\n\n-- Although there is a notion of Extranatural in Categories.NaturalTransformation.Dinatural,\n-- it isn't the most general form, thus the need for this as well.\n\nopen import Level\nopen import Data.Product\nopen import Relation.Binary using (Rel; IsEquivalence; Setoid)\n\nopen import Categories.Category\nopen import Categories.NaturalTransformation as NT hiding (_∘ʳ_)\nopen import Categories.Functor\nopen import Categories.Functor.Construction.Constant\nopen import Categories.Category.Product\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n variable\n o₁ o₂ o₃ o₄ ℓ₁ ℓ₂ ℓ₃ ℓ₄ e₁ e₂ e₃ e₄ : Level\n\nrecord ExtranaturalTransformation\n {A : Category o₁ ℓ₁ e₁}\n {B : Category o₂ ℓ₂ e₂}\n {C : Category o₃ ℓ₃ e₃}\n {D : Category o₄ ℓ₄ e₄}\n (P : Functor (Product A (Product (Category.op B) B)) D)\n (Q : Functor (Product A (Product (Category.op C) C)) D) : Set (o₁ ⊔ o₂ ⊔ o₃ ⊔ ℓ₁ ⊔ ℓ₂ ⊔ ℓ₃ ⊔ ℓ₄ ⊔ e₄) where\n\n private\n module A = Category A\n module B = Category B\n module C = Category C\n module D = Category D\n module P = Functor P\n module Q = Functor Q\n\n open D hiding (op)\n open Commutation D\n\n field\n α : ∀ a b c → D [ P.₀ (a , (b , b)) , Q.₀ (a , (c , c)) ]\n commute : ∀ {a a′ b b′ c c′} (f : A [ a , a′ ]) (g : B [ b , b′ ])\n (h : C [ c , c′ ]) →\n [ P.₀ (a , (b′ , b) ) ⇒ Q.₀ (a′ , (c , c′)) ]⟨\n P.₁ (f , B.id , g) ⇒⟨ P.₀ (a′ , (b′ , b′)) ⟩\n α a′ b′ c ⇒⟨ Q.₀ (a′ , (c , c)) ⟩\n Q.₁ (A.id , C.id , h)\n ≈ P.₁ (A.id , g , B.id) ⇒⟨ P.₀ (a , (b , b)) ⟩\n α a b c′ ⇒⟨ Q.₀ (a , (c′ , c′)) ⟩\n Q.₁ (f , h , C.id)\n ⟩\n", "meta": {"hexsha": "0bff0edbec1f7053d3cd246d508e9d065a052118", "size": 1852, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/NaturalTransformation/Extranatural.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/NaturalTransformation/Extranatural.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/NaturalTransformation/Extranatural.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 34.9433962264, "max_line_length": 112, "alphanum_fraction": 0.5350971922, "num_tokens": 646, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9046505351008904, "lm_q2_score": 0.766293653760418, "lm_q1q2_score": 0.6932279639187786}} {"text": "\nopen import Oscar.Prelude\n\nmodule Oscar.Data.Maybe where\n\ndata Maybe {a} (A : Ø a) : Ø a where\n ∅ : Maybe A\n ↑_ : A → Maybe A\n\n-- A dependent eliminator.\n\nmaybe : ∀ {a b} {A : Set a} {B : Maybe A → Set b} →\n ((x : A) → B (↑ x)) → B ∅ → (x : Maybe A) → B x\nmaybe j n (↑ x) = j x\nmaybe j n ∅ = n\n\n-- A non-dependent eliminator.\n\nmaybe′ : ∀ {a b} {A : Set a} {B : Set b} → (A → B) → B → Maybe A → B\nmaybe′ = maybe\n", "meta": {"hexsha": "4eba1482f1aa41cadd6eb09aa93952b7dc6463db", "size": 422, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-3/src/Oscar/Data/Maybe.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-3/src/Oscar/Data/Maybe.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-3/src/Oscar/Data/Maybe.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.0952380952, "max_line_length": 68, "alphanum_fraction": 0.5118483412, "num_tokens": 168, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8887587964389112, "lm_q2_score": 0.7799928951399098, "lm_q1q2_score": 0.6932255467154481}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Lists.Definition\nopen import Lists.Concat\n\nmodule Lists.Reversal.Reversal where\n\nrev : {a : _} → {A : Set a} → List A → List A\nrev [] = []\nrev (x :: l) = (rev l) ++ [ x ]\n\nrevIsHom : {a : _} → {A : Set a} → (l1 : List A) → (l2 : List A) → (rev (l1 ++ l2) ≡ (rev l2) ++ (rev l1))\nrevIsHom l1 [] = applyEquality rev (appendEmptyList l1)\nrevIsHom [] (x :: l2) with (rev l2 ++ [ x ])\n... | r = equalityCommutative (appendEmptyList r)\nrevIsHom (w :: l1) (x :: l2) = transitivity t (equalityCommutative s)\n where\n s : ((rev l2 ++ [ x ]) ++ (rev l1 ++ [ w ])) ≡ (((rev l2 ++ [ x ]) ++ rev l1) ++ [ w ])\n s = equalityCommutative (concatAssoc (rev l2 ++ (x :: [])) (rev l1) ([ w ]))\n t' : rev (l1 ++ (x :: l2)) ≡ rev (x :: l2) ++ rev l1\n t' = revIsHom l1 (x :: l2)\n t : (rev (l1 ++ (x :: l2)) ++ [ w ]) ≡ ((rev l2 ++ [ x ]) ++ rev l1) ++ [ w ]\n t = applyEquality (λ r → r ++ [ w ]) {rev (l1 ++ (x :: l2))} {((rev l2) ++ [ x ]) ++ rev l1} (transitivity t' (applyEquality (λ r → r ++ rev l1) {rev l2 ++ (x :: [])} {rev l2 ++ (x :: [])} refl))\n\nrevRevIsId : {a : _} → {A : Set a} → (l : List A) → (rev (rev l) ≡ l)\nrevRevIsId [] = refl\nrevRevIsId (x :: l) = t\n where\n s : rev (rev l ++ [ x ] ) ≡ [ x ] ++ rev (rev l)\n s = revIsHom (rev l) [ x ]\n t : rev (rev l ++ [ x ] ) ≡ [ x ] ++ l\n t = identityOfIndiscernablesRight _≡_ s (applyEquality (λ n → [ x ] ++ n) (revRevIsId l))\n", "meta": {"hexsha": "e2fa9d3c2f10c1b1e7023ef280678487c5eb9854", "size": 1488, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Lists/Reversal/Reversal.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Lists/Reversal/Reversal.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Lists/Reversal/Reversal.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 43.7647058824, "max_line_length": 199, "alphanum_fraction": 0.498655914, "num_tokens": 595, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110511888303, "lm_q2_score": 0.7772998611746912, "lm_q1q2_score": 0.6932046062831332}} {"text": "module equational where\r\n\r\nopen import lib\r\n\r\npostulate\r\n A : Set\r\n a : A\r\n b : A\r\n c : A\r\n d : A \r\n f : A → A\r\n g : A → A \r\n h : A → A → A\r\n p : a ≡ b\r\n q : b ≡ c\r\n r : f a ≡ a\r\n s : h a a ≡ a\r\n t : ∀ x → f (g x) ≡ g (f x)\r\n u : ∀ {x} → f x ≡ x → g (g x) ≡ x -- {x} means x is implicit, so you do not need to write it when you call u\r\n v : ∀ x → h x d ≡ x\r\n\r\nL0 : c ≡ c\r\nL0 = refl\r\n\r\nL1 : c ≡ a\r\nL1 rewrite p | q = refl\r\n\r\nL2 : h (f a) (f (f a)) ≡ a\r\nL2 rewrite r | r = s\r\n\r\nL3 : f b ≡ b\r\nL3 rewrite sym p = r \r\n\r\nL4 : h (h d d) d ≡ d\r\nL4 rewrite s | v d = v d\r\n\r\nL5 : f (g (g a)) ≡ a\r\nL5 rewrite t ( g a) | t a | r | u r = refl\r\n\r\nL6 : f (g (f (g a))) ≡ g (g (f (f a)))\r\nL6 rewrite t a | r | u r | r | u r = refl\r\n\r\nL7 : ∀ x → f (f (f x)) ≡ x → f (f (f (f (f x)))) ≡ x → f x ≡ x\r\nL7 x y z rewrite y | z | r = y\r\n", "meta": {"hexsha": "569165cd6da07d52674c4069eb79903278ae41aa", "size": 836, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "equational.agda", "max_stars_repo_name": "DTMcNamara/CS3820-ProgrammingLanguageConcepts-Workout6", "max_stars_repo_head_hexsha": "51d54ed9c232f93baad238d328b77dd024344226", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "equational.agda", "max_issues_repo_name": "DTMcNamara/CS3820-ProgrammingLanguageConcepts-Workout6", "max_issues_repo_head_hexsha": "51d54ed9c232f93baad238d328b77dd024344226", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "equational.agda", "max_forks_repo_name": "DTMcNamara/CS3820-ProgrammingLanguageConcepts-Workout6", "max_forks_repo_head_hexsha": "51d54ed9c232f93baad238d328b77dd024344226", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.5777777778, "max_line_length": 112, "alphanum_fraction": 0.4078947368, "num_tokens": 399, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110339361276, "lm_q2_score": 0.7772998663336158, "lm_q1q2_score": 0.6932045974733957}} {"text": "{-# OPTIONS --safe --without-K #-}\nopen import Relation.Binary\nmodule Data.List.Membership.Setoid.Trans {a p} (S : Setoid a p) where\nopen Setoid S\nopen import Data.List.Membership.Setoid (S)\nopen import Data.List.Any\n\n≈-trans-∈ : ∀ {x y xs} → x ≈ y → y ∈ xs → x ∈ xs\n≈-trans-∈ x≈y (here px) = here (trans x≈y px)\n≈-trans-∈ x≈y (there p) = there (≈-trans-∈ x≈y p)\n\n", "meta": {"hexsha": "de639efbf196032e0098f0d6ce4d50443309115c", "size": 364, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Data/List/Membership/Setoid/Trans.agda", "max_stars_repo_name": "tizmd/agda-distinct-disjoint", "max_stars_repo_head_hexsha": "d4cd2a3442a9b58e6139499d16a2b31268f27f80", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Data/List/Membership/Setoid/Trans.agda", "max_issues_repo_name": "tizmd/agda-distinct-disjoint", "max_issues_repo_head_hexsha": "d4cd2a3442a9b58e6139499d16a2b31268f27f80", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Data/List/Membership/Setoid/Trans.agda", "max_forks_repo_name": "tizmd/agda-distinct-disjoint", "max_forks_repo_head_hexsha": "d4cd2a3442a9b58e6139499d16a2b31268f27f80", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.3333333333, "max_line_length": 69, "alphanum_fraction": 0.6318681319, "num_tokens": 141, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9111797075998823, "lm_q2_score": 0.7606506526772884, "lm_q1q2_score": 0.6930894392921513}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Diagram.Cone.Properties where\n\nopen import Level\n\nopen import Categories.Category\nopen import Categories.Functor\nopen import Categories.Functor.Properties\nopen import Categories.NaturalTransformation\nimport Categories.Diagram.Cone as Con\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n variable\n o ℓ e : Level\n C D J J′ : Category o ℓ e\n\nmodule _ {F : Functor J C} (G : Functor C D) where\n private\n module C = Category C\n module D = Category D\n module F = Functor F\n module G = Functor G\n module CF = Con F\n GF = G ∘F F\n module CGF = Con GF\n\n F-map-Coneˡ : CF.Cone → CGF.Cone\n F-map-Coneˡ K = record\n { apex = record\n { ψ = λ X → G.F₁ (ψ X)\n ; commute = λ f → [ G ]-resp-∘ (commute f)\n }\n }\n where open CF.Cone K\n\n F-map-Cone⇒ˡ : ∀ {K K′} (f : CF.Cone⇒ K K′) → CGF.Cone⇒ (F-map-Coneˡ K) (F-map-Coneˡ K′)\n F-map-Cone⇒ˡ f = record\n { arr = G.F₁ arr\n ; commute = [ G ]-resp-∘ commute\n }\n where open CF.Cone⇒ f\n\nmodule _ {F : Functor J C} (G : Functor J′ J) where\n private\n module C = Category C\n module J′ = Category J′\n module F = Functor F\n module G = Functor G\n module CF = Con F\n FG = F ∘F G\n module CFG = Con FG\n\n F-map-Coneʳ : CF.Cone → CFG.Cone\n F-map-Coneʳ K = record\n { apex = record\n { ψ = λ j → ψ (G.F₀ j)\n ; commute = λ f → commute (G.F₁ f)\n }\n }\n where open CF.Cone K\n\n F-map-Cone⇒ʳ : ∀ {K K′} (f : CF.Cone⇒ K K′) → CFG.Cone⇒ (F-map-Coneʳ K) (F-map-Coneʳ K′)\n F-map-Cone⇒ʳ f = record\n { arr = arr\n ; commute = commute\n }\n where open CF.Cone⇒ f\n\nmodule _ {F G : Functor J C} (α : NaturalTransformation F G) where\n private\n module C = Category C\n module J = Category J\n module F = Functor F\n module G = Functor G\n module α = NaturalTransformation α\n module CF = Con F\n module CG = Con G\n open C\n open HomReasoning\n open MR C\n\n nat-map-Cone : CF.Cone → CG.Cone\n nat-map-Cone K = record\n { apex = record\n { ψ = λ j → α.η j C.∘ ψ j\n ; commute = λ {X Y} f → begin\n G.F₁ f ∘ α.η X ∘ ψ X ≈˘⟨ pushˡ (α.commute f) ⟩\n (α.η Y ∘ F.F₁ f) ∘ ψ X ≈⟨ pullʳ (commute f) ⟩\n α.η Y ∘ ψ Y ∎\n }\n }\n where open CF.Cone K\n\n nat-map-Cone⇒ : ∀ {K K′} (f : CF.Cone⇒ K K′) → CG.Cone⇒ (nat-map-Cone K) (nat-map-Cone K′)\n nat-map-Cone⇒ {K} {K′} f = record\n { arr = arr\n ; commute = pullʳ commute\n }\n where open CF.Cone⇒ f\n", "meta": {"hexsha": "34891b35099daf0f42b9fb5248b3e7e80db2498b", "size": 2525, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Diagram/Cone/Properties.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Diagram/Cone/Properties.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Diagram/Cone/Properties.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 24.7549019608, "max_line_length": 92, "alphanum_fraction": 0.5615841584, "num_tokens": 955, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8947894745194281, "lm_q2_score": 0.7745833841649232, "lm_q1q2_score": 0.693089059288412}} {"text": "{-# OPTIONS --without-K #-}\n\nopen import lib.Basics\nopen import lib.NConnected\nopen import lib.types.Bool\nopen import lib.types.Lift\nopen import lib.types.Nat\nopen import lib.types.Pointed\nopen import lib.types.TLevel\nopen import lib.types.Suspension\n\nmodule lib.types.IteratedSuspension where\n\n⊙Susp^ : ∀ {i} (n : ℕ) → Ptd i → Ptd i\n⊙Susp^ O X = X\n⊙Susp^ (S n) X = ⊙Susp (⊙Susp^ n X)\n\n⊙Susp^-conn : ∀ {i} (n : ℕ) {X : Ptd i} {m : ℕ₋₂}\n → is-connected m (fst X) → is-connected (⟨ n ⟩₋₂ +2+ m) (fst (⊙Susp^ n X))\n⊙Susp^-conn O cX = cX\n⊙Susp^-conn (S n) cX = Susp-conn (⊙Susp^-conn n cX)\n\n⊙Susp^-+ : ∀ {i} (m n : ℕ) {X : Ptd i}\n → ⊙Susp^ m (⊙Susp^ n X) == ⊙Susp^ (m + n) X\n⊙Susp^-+ O n = idp\n⊙Susp^-+ (S m) n = ap ⊙Susp (⊙Susp^-+ m n)\n\n⊙susp^-fmap : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j}\n → fst (X ⊙→ Y) → fst (⊙Susp^ n X ⊙→ ⊙Susp^ n Y)\n⊙susp^-fmap O f = f\n⊙susp^-fmap (S n) f = ⊙susp-fmap (⊙susp^-fmap n f)\n\n⊙susp^-fmap-idf : ∀ {i} (n : ℕ) (X : Ptd i)\n → ⊙susp^-fmap n (⊙idf X) == ⊙idf (⊙Susp^ n X)\n⊙susp^-fmap-idf O X = idp\n⊙susp^-fmap-idf (S n) X =\n ap ⊙susp-fmap (⊙susp^-fmap-idf n X) ∙ ⊙susp-fmap-idf (⊙Susp^ n X)\n\n⊙susp^-fmap-cst : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j}\n → ⊙susp^-fmap n (⊙cst {X = X} {Y = Y}) == ⊙cst\n⊙susp^-fmap-cst O = idp\n⊙susp^-fmap-cst (S n) = ap ⊙susp-fmap (⊙susp^-fmap-cst n)\n ∙ (⊙susp-fmap-cst {X = ⊙Susp^ n _})\n\n⊙susp^-fmap-∘ : ∀ {i j k} (n : ℕ) {X : Ptd i} {Y : Ptd j} {Z : Ptd k}\n (g : fst (Y ⊙→ Z)) (f : fst (X ⊙→ Y))\n → ⊙susp^-fmap n (g ⊙∘ f) == ⊙susp^-fmap n g ⊙∘ ⊙susp^-fmap n f\n⊙susp^-fmap-∘ O g f = idp\n⊙susp^-fmap-∘ (S n) g f =\n ap ⊙susp-fmap (⊙susp^-fmap-∘ n g f)\n ∙ ⊙susp-fmap-∘ (⊙susp^-fmap n g) (⊙susp^-fmap n f)\n\n\n⊙Sphere : (n : ℕ) → Ptd₀\n⊙Sphere n = ⊙Susp^ n ⊙Bool\n\nSphere : (n : ℕ) → Type₀\nSphere n = fst (⊙Sphere n)\n\n-- favonia: [S¹] has its own elim rules in Circle.agda.\n⊙S⁰ = ⊙Sphere 0\n⊙S¹ = ⊙Sphere 1\n⊙S² = ⊙Sphere 2\n⊙S³ = ⊙Sphere 3\nS⁰ = Sphere 0\nS¹ = Sphere 1\nS² = Sphere 2\nS³ = Sphere 3\n", "meta": {"hexsha": "36f02a3632783ba57173520e1fb2044e2472462c", "size": 1980, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "core/lib/types/IteratedSuspension.agda", "max_stars_repo_name": "cmknapp/HoTT-Agda", "max_stars_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "core/lib/types/IteratedSuspension.agda", "max_issues_repo_name": "cmknapp/HoTT-Agda", "max_issues_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "core/lib/types/IteratedSuspension.agda", "max_forks_repo_name": "cmknapp/HoTT-Agda", "max_forks_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.6956521739, "max_line_length": 76, "alphanum_fraction": 0.5338383838, "num_tokens": 1055, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278788223265, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.69297818968764}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Setoids.Setoids\nopen import Functions.Definition\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import Numbers.Naturals.Naturals\nopen import Numbers.Integers.Integers\nopen import Groups.Definition\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Homomorphisms.Lemmas\nopen import Groups.Isomorphisms.Definition\nopen import Groups.Abelian.Definition\nopen import Groups.Subgroups.Definition\nopen import Groups.Lemmas\nopen import Groups.Groups\nopen import Rings.Definition\nopen import Rings.Lemmas\nopen import Fields.Fields\nopen import Sets.EquivalenceRelations\n\nmodule Groups.Examples.ExampleSheet1 where\n\n {-\n Question 1: e is the unique solution of x^2 = x\n -}\n question1 : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} → (G : Group S _+_) → (x : A) → Setoid._∼_ S (x + x) x → Setoid._∼_ S x (Group.0G G)\n question1 {S = S} {_+_ = _+_} G x x+x=x = transitive (symmetric identRight) (transitive (+WellDefined reflexive (symmetric invRight)) (transitive +Associative (transitive (+WellDefined x+x=x reflexive) invRight)))\n where\n open Group G\n open Setoid S\n open Equivalence eq\n\n question1' : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} → (G : Group S _+_) → Setoid._∼_ S ((Group.0G G) + (Group.0G G)) (Group.0G G)\n question1' G = Group.identRight G\n\n {-\n Question 3. We can't talk about ℝ yet, so we'll just work in an arbitrary integral domain.\n Show that the collection of linear functions over a ring forms a group; is it abelian?\n -}\n\n record LinearFunction {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (F : Field R) : Set (a ⊔ b) where\n field\n xCoeff : A\n xCoeffNonzero : (Setoid._∼_ S xCoeff (Ring.0R R) → False)\n constant : A\n\n interpretLinearFunction : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} {F : Field R} (f : LinearFunction F) → A → A\n interpretLinearFunction {_+_ = _+_} {_*_ = _*_} record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant } a = (xCoeff * a) + constant\n\n composeLinearFunctions : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} {F : Field R} (f1 : LinearFunction F) (f2 : LinearFunction F) → LinearFunction F\n LinearFunction.xCoeff (composeLinearFunctions {_+_ = _+_} {_*_ = _*_} record { xCoeff = xCoeff1 ; xCoeffNonzero = xCoeffNonzero1 ; constant = constant1 } record { xCoeff = xCoeff2 ; xCoeffNonzero = xCoeffNonzero2 ; constant = constant2 }) = xCoeff1 * xCoeff2\n LinearFunction.xCoeffNonzero (composeLinearFunctions {S = S} {R = R} {F = F} record { xCoeff = xCoeff1 ; xCoeffNonzero = xCoeffNonzero1 ; constant = constant1 } record { xCoeff = xCoeff2 ; xCoeffNonzero = xCoeffNonzero2 ; constant = constant2 }) pr = xCoeffNonzero2 bad\n where\n open Setoid S\n open Ring R\n open Equivalence eq\n bad : Setoid._∼_ S xCoeff2 0R\n bad with Field.allInvertible F xCoeff1 xCoeffNonzero1\n ... | xinv , pr' = transitive (symmetric identIsIdent) (transitive (*WellDefined (symmetric pr') reflexive) (transitive (symmetric *Associative) (transitive (*WellDefined reflexive pr) (Ring.timesZero R))))\n LinearFunction.constant (composeLinearFunctions {_+_ = _+_} {_*_ = _*_} record { xCoeff = xCoeff1 ; xCoeffNonzero = xCoeffNonzero1 ; constant = constant1 } record { xCoeff = xCoeff2 ; xCoeffNonzero = xCoeffNonzero2 ; constant = constant2 }) = (xCoeff1 * constant2) + constant1\n\n compositionIsCorrect : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} {F : Field R} (f1 : LinearFunction F) (f2 : LinearFunction F) → {r : A} → Setoid._∼_ S (interpretLinearFunction (composeLinearFunctions f1 f2) r) (((interpretLinearFunction f1) ∘ (interpretLinearFunction f2)) r)\n compositionIsCorrect {S = S} {_+_ = _+_} {_*_ = _*_} {R = R} record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant } record { xCoeff = xCoeff' ; xCoeffNonzero = xCoeffNonzero' ; constant = constant' } {r} = ans\n where\n open Setoid S\n open Ring R\n open Equivalence eq\n ans : (((xCoeff * xCoeff') * r) + ((xCoeff * constant') + constant)) ∼ (xCoeff * ((xCoeff' * r) + constant')) + constant\n ans = transitive (Group.+Associative additiveGroup) (Group.+WellDefined additiveGroup (transitive (Group.+WellDefined additiveGroup (symmetric (Ring.*Associative R)) reflexive) (symmetric (Ring.*DistributesOver+ R))) (reflexive {constant}))\n\n linearFunctionsSetoid : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (I : Field R) → Setoid (LinearFunction I)\n Setoid._∼_ (linearFunctionsSetoid {S = S} I) f1 f2 = ((LinearFunction.xCoeff f1) ∼ (LinearFunction.xCoeff f2)) && ((LinearFunction.constant f1) ∼ (LinearFunction.constant f2))\n where\n open Setoid S\n Equivalence.reflexive (Setoid.eq (linearFunctionsSetoid {S = S} I)) = Equivalence.reflexive (Setoid.eq S) ,, Equivalence.reflexive (Setoid.eq S)\n Equivalence.symmetric (Setoid.eq (linearFunctionsSetoid {S = S} I)) (fst ,, snd) = Equivalence.symmetric (Setoid.eq S) fst ,, Equivalence.symmetric (Setoid.eq S) snd\n Equivalence.transitive (Setoid.eq (linearFunctionsSetoid {S = S} I)) (fst1 ,, snd1) (fst2 ,, snd2) = Equivalence.transitive (Setoid.eq S) fst1 fst2 ,, Equivalence.transitive (Setoid.eq S) snd1 snd2\n\n linearFunctionsGroup : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (F : Field R) → Group (linearFunctionsSetoid F) (composeLinearFunctions)\n Group.+WellDefined (linearFunctionsGroup {R = R} F) {record { xCoeff = xCoeffM ; xCoeffNonzero = xCoeffNonzeroM ; constant = constantM }} {record { xCoeff = xCoeffN ; xCoeffNonzero = xCoeffNonzeroN ; constant = constantN }} {record { xCoeff = xCoeffX ; xCoeffNonzero = xCoeffNonzeroX ; constant = constantX }} {record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant }} (fst1 ,, snd1) (fst2 ,, snd2) = *WellDefined fst1 fst2 ,, Group.+WellDefined additiveGroup (*WellDefined fst1 snd2) snd1\n where\n open Ring R\n Group.0G (linearFunctionsGroup {S = S} {R = R} F) = record { xCoeff = Ring.1R R ; constant = Ring.0R R ; xCoeffNonzero = λ p → Field.nontrivial F (Equivalence.symmetric (Setoid.eq S) p) }\n Group.inverse (linearFunctionsGroup {S = S} {_*_ = _*_} {R = R} F) record { xCoeff = xCoeff ; constant = c ; xCoeffNonzero = pr } with Field.allInvertible F xCoeff pr\n ... | (inv , pr') = record { xCoeff = inv ; constant = inv * (Group.inverse (Ring.additiveGroup R) c) ; xCoeffNonzero = λ p → Field.nontrivial F (transitive (symmetric (transitive (Ring.*WellDefined R p reflexive) (transitive (Ring.*Commutative R) (Ring.timesZero R)))) pr') }\n where\n open Setoid S\n open Equivalence eq\n Group.+Associative (linearFunctionsGroup {S = S} {_+_ = _+_} {_*_ = _*_} {R = R} F) {record { xCoeff = xA ; xCoeffNonzero = xANonzero ; constant = cA }} {record { xCoeff = xB ; xCoeffNonzero = xBNonzero ; constant = cB }} {record { xCoeff = xC ; xCoeffNonzero = xCNonzero ; constant = cC }} = Ring.*Associative R ,, transitive (Group.+WellDefined additiveGroup (transitive *DistributesOver+ (Group.+WellDefined additiveGroup *Associative reflexive)) reflexive) (symmetric (Group.+Associative additiveGroup))\n where\n open Setoid S\n open Equivalence eq\n open Ring R\n Group.identRight (linearFunctionsGroup {S = S} {_+_ = _+_} {_*_ = _*_} {R = R} F) {record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant }} = transitive (Ring.*Commutative R) (Ring.identIsIdent R) ,, transitive (Group.+WellDefined additiveGroup (Ring.timesZero R) reflexive) (Group.identLeft additiveGroup)\n where\n open Ring R\n open Setoid S\n open Equivalence eq\n Group.identLeft (linearFunctionsGroup {S = S} {R = R} F) {record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant }} = identIsIdent ,, transitive (Group.identRight additiveGroup) identIsIdent\n where\n open Setoid S\n open Ring R\n open Equivalence eq\n Group.invLeft (linearFunctionsGroup F) {record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant }} with Field.allInvertible F xCoeff xCoeffNonzero\n Group.invLeft (linearFunctionsGroup {S = S} {R = R} F) {record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant }} | inv , prInv = prInv ,, transitive (symmetric *DistributesOver+) (transitive (*WellDefined reflexive (Group.invRight additiveGroup)) (Ring.timesZero R))\n where\n open Setoid S\n open Ring R\n open Equivalence eq\n Group.invRight (linearFunctionsGroup {S = S} {R = R} F) {record { xCoeff = xCoeff ; xCoeffNonzero = xCoeffNonzero ; constant = constant }} with Field.allInvertible F xCoeff xCoeffNonzero\n ... | inv , pr = transitive *Commutative pr ,, transitive (Group.+WellDefined additiveGroup *Associative reflexive) (transitive (Group.+WellDefined additiveGroup (*WellDefined (transitive *Commutative pr) reflexive) reflexive) (transitive (Group.+WellDefined additiveGroup identIsIdent reflexive) (Group.invLeft additiveGroup)))\n where\n open Setoid S\n open Ring R\n open Equivalence eq\n\n {-\n Question 3, part 2: prove that linearFunctionsGroup is not abelian\n -}\n\n -- We'll assume the field doesn't have characteristic 2.\n linearFunctionsGroupNotAbelian : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} {F : Field R} → (nonChar2 : Setoid._∼_ S ((Ring.1R R) + (Ring.1R R)) (Ring.0R R) → False) → AbelianGroup (linearFunctionsGroup F) → False\n linearFunctionsGroupNotAbelian {S = S} {_+_ = _+_} {_*_ = _*_} {R = R} {F = F} pr record { commutative = commutative } = ans\n where\n open Ring R\n open Group additiveGroup\n open Equivalence (Setoid.eq S) renaming (symmetric to symmetricS ; transitive to transitiveS ; reflexive to reflexiveS)\n\n f : LinearFunction F\n f = record { xCoeff = 1R ; xCoeffNonzero = λ p → Field.nontrivial F (symmetricS p) ; constant = 1R }\n g : LinearFunction F\n g = record { xCoeff = 1R + 1R ; xCoeffNonzero = pr ; constant = 0R }\n\n gf : LinearFunction F\n gf = record { xCoeff = 1R + 1R ; xCoeffNonzero = pr ; constant = 1R + 1R }\n\n fg : LinearFunction F\n fg = record { xCoeff = 1R + 1R ; xCoeffNonzero = pr ; constant = 1R }\n\n oneWay : Setoid._∼_ (linearFunctionsSetoid F) gf (composeLinearFunctions g f)\n oneWay = symmetricS (transitiveS *Commutative identIsIdent) ,, transitiveS (symmetricS (transitiveS *Commutative identIsIdent)) (symmetricS (Group.identRight additiveGroup))\n\n otherWay : Setoid._∼_ (linearFunctionsSetoid F) fg (composeLinearFunctions f g)\n otherWay = symmetricS identIsIdent ,, transitiveS (symmetricS (Group.identLeft additiveGroup)) (Group.+WellDefined additiveGroup (symmetricS identIsIdent) (reflexiveS {1R}))\n\n open Equivalence (Setoid.eq (linearFunctionsSetoid F))\n bad : Setoid._∼_ (linearFunctionsSetoid F) gf fg\n bad = transitive {gf} {composeLinearFunctions g f} {fg} oneWay (transitive {composeLinearFunctions g f} {composeLinearFunctions f g} {fg} (commutative {g} {f}) (symmetric {fg} {composeLinearFunctions f g} otherWay))\n\n ans : False\n ans with bad\n ans | _ ,, contr = Field.nontrivial F (symmetricS (transitiveS {1R} {1R + (1R + Group.inverse additiveGroup 1R)} (transitiveS (symmetricS (Group.identRight additiveGroup)) (Group.+WellDefined additiveGroup reflexiveS (symmetricS (Group.invRight additiveGroup)))) (transitiveS (Group.+Associative additiveGroup) (transitiveS (Group.+WellDefined additiveGroup contr reflexiveS) (Group.invRight additiveGroup)))))\n", "meta": {"hexsha": "d0c3c7276059d96ef7b60d7a2b98b32c02e1bc6b", "size": 11927, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Examples/ExampleSheet1.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Examples/ExampleSheet1.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Examples/ExampleSheet1.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 77.4480519481, "max_line_length": 515, "alphanum_fraction": 0.6831558648, "num_tokens": 3761, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278726384089, "lm_q2_score": 0.7853085758631159, "lm_q1q2_score": 0.6929781759635879}} {"text": "-- Solver for Category\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Experiment.Categories.Solver.Category {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\nopen import Relation.Binary using (Rel)\n\nimport Categories.Morphism.Reasoning as MR\n\nopen Category 𝒞\nopen HomReasoning\nopen MR 𝒞\n\nprivate\n variable\n A B C D E : Obj\n\ninfixr 9 _:∘_\n\ndata Expr : Rel Obj (o ⊔ ℓ) where\n :id : Expr A A\n _:∘_ : Expr B C → Expr A B → Expr A C\n ∥_∥ : A ⇒ B → Expr A B\n\n-- Semantics\n⟦_⟧ : Expr A B → A ⇒ B\n⟦ :id ⟧ = id\n⟦ e₁ :∘ e₂ ⟧ = ⟦ e₁ ⟧ ∘ ⟦ e₂ ⟧\n⟦ ∥ f ∥ ⟧ = f\n\n⟦_⟧N∘_ : Expr B C → A ⇒ B → A ⇒ C\n⟦ :id ⟧N∘ g = g\n⟦ e₁ :∘ e₂ ⟧N∘ g = ⟦ e₁ ⟧N∘ (⟦ e₂ ⟧N∘ g)\n⟦ ∥ f ∥ ⟧N∘ g = f ∘ g\n\n⟦_⟧N : Expr A B → A ⇒ B\n⟦ e ⟧N = ⟦ e ⟧N∘ id\n\n⟦e⟧N∘f≈⟦e⟧∘f : (e : Expr B C) (g : A ⇒ B) → ⟦ e ⟧N∘ g ≈ ⟦ e ⟧ ∘ g\n⟦e⟧N∘f≈⟦e⟧∘f :id g = ⟺ identityˡ\n⟦e⟧N∘f≈⟦e⟧∘f (e₁ :∘ e₂) g = begin\n ⟦ e₁ ⟧N∘ (⟦ e₂ ⟧N∘ g) ≈⟨ ⟦e⟧N∘f≈⟦e⟧∘f e₁ (⟦ e₂ ⟧N∘ g) ⟩\n ⟦ e₁ ⟧ ∘ (⟦ e₂ ⟧N∘ g) ≈⟨ pushʳ (⟦e⟧N∘f≈⟦e⟧∘f e₂ g) ⟩\n (⟦ e₁ ⟧ ∘ ⟦ e₂ ⟧) ∘ g ∎\n⟦e⟧N∘f≈⟦e⟧∘f ∥ f ∥ g = refl\n\n⟦e⟧N≈⟦e⟧ : (e : Expr A B) → ⟦ e ⟧N ≈ ⟦ e ⟧\n⟦e⟧N≈⟦e⟧ e = ⟦e⟧N∘f≈⟦e⟧∘f e id ○ identityʳ\n\nsolve : (e₁ e₂ : Expr A B) → ⟦ e₁ ⟧N ≈ ⟦ e₂ ⟧N → ⟦ e₁ ⟧ ≈ ⟦ e₂ ⟧\nsolve e₁ e₂ eq = begin\n ⟦ e₁ ⟧ ≈˘⟨ ⟦e⟧N≈⟦e⟧ e₁ ⟩\n ⟦ e₁ ⟧N ≈⟨ eq ⟩\n ⟦ e₂ ⟧N ≈⟨ ⟦e⟧N≈⟦e⟧ e₂ ⟩\n ⟦ e₂ ⟧ ∎\n\n∥-∥ : ∀ {f : A ⇒ B} → Expr A B\n∥-∥ {f = f} = ∥ f ∥\n", "meta": {"hexsha": "bbc5b4639e88df0c25ba71d9e378a8c556c8784d", "size": 1391, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Experiment/Categories/Solver/Category.agda", "max_stars_repo_name": "rei1024/agda-misc", "max_stars_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:49:42.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-21T00:03:43.000Z", "max_issues_repo_path": "Experiment/Categories/Solver/Category.agda", "max_issues_repo_name": "rei1024/agda-misc", "max_issues_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Experiment/Categories/Solver/Category.agda", "max_forks_repo_name": "rei1024/agda-misc", "max_forks_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.0793650794, "max_line_length": 79, "alphanum_fraction": 0.4543493889, "num_tokens": 898, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278664544912, "lm_q2_score": 0.785308580887758, "lm_q1q2_score": 0.6929781755411886}} {"text": "module Dave.Algebra.Naturals.Bin where\n open import Dave.Algebra.Naturals.Definition\n open import Dave.Algebra.Naturals.Addition\n open import Dave.Algebra.Naturals.Multiplication\n open import Dave.Embedding\n \n data Bin : Set where\n ⟨⟩ : Bin\n _t : Bin → Bin\n _f : Bin → Bin\n\n inc : Bin → Bin\n inc ⟨⟩ = ⟨⟩ t\n inc (b t) = (inc b) f\n inc (b f) = b t\n\n to : ℕ → Bin\n to zero = ⟨⟩ f\n to (suc n) = inc (to n)\n\n from : Bin → ℕ\n from ⟨⟩ = zero\n from (b t) = 1 + 2 * (from b)\n from (b f) = 2 * (from b)\n\n from6 = from (⟨⟩ t t f)\n from23 = from (⟨⟩ t f t t t)\n from23WithZeros = from (⟨⟩ f f f t f t t t)\n\n Bin-ℕ-Suc-Homomorph : ∀ (b : Bin) → from (inc b) ≡ suc (from b)\n Bin-ℕ-Suc-Homomorph ⟨⟩ = refl\n Bin-ℕ-Suc-Homomorph (b t) = begin\n from (inc (b t)) ≡⟨⟩ \n from ((inc b) f) ≡⟨⟩ \n 2 * (from (inc b)) ≡⟨ cong (λ a → 2 * a) (Bin-ℕ-Suc-Homomorph b) ⟩\n 2 * suc (from b) ≡⟨⟩\n 2 * (1 + (from b)) ≡⟨ *-distrib1ₗ-+ₗ 2 (from b) ⟩\n 2 + 2 * (from b) ≡⟨⟩\n suc (1 + 2 * (from b)) ≡⟨⟩\n suc (from (b t)) ∎\n Bin-ℕ-Suc-Homomorph (b f) = begin\n from (inc (b f)) ≡⟨⟩ \n from (b t) ≡⟨⟩\n 1 + 2 * (from b) ≡⟨⟩\n suc (2 * from b) ≡⟨⟩\n suc (from (b f)) ∎\n\n to-inverse-from : ∀ (n : ℕ) → from (to n) ≡ n\n to-inverse-from zero = refl\n to-inverse-from (suc n) = begin\n from (to (suc n)) ≡⟨⟩ \n from (inc (to n)) ≡⟨ Bin-ℕ-Suc-Homomorph (to n) ⟩\n suc (from (to n)) ≡⟨ cong (λ a → suc a) (to-inverse-from n) ⟩\n suc n ∎\n\n ℕ≲Bin : ℕ ≲ Bin\n ℕ≲Bin = record \n {\n to = to;\n from = from;\n from∘to = to-inverse-from\n }", "meta": {"hexsha": "a99553e83823367de27c7bb40db9d43090c0f6fb", "size": 1580, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Dave/Algebra/Naturals/Bin.agda", "max_stars_repo_name": "DavidStahl97/formal-proofs", "max_stars_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Dave/Algebra/Naturals/Bin.agda", "max_issues_repo_name": "DavidStahl97/formal-proofs", "max_issues_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Dave/Algebra/Naturals/Bin.agda", "max_forks_repo_name": "DavidStahl97/formal-proofs", "max_forks_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.4838709677, "max_line_length": 70, "alphanum_fraction": 0.5082278481, "num_tokens": 724, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278664544912, "lm_q2_score": 0.785308580887758, "lm_q1q2_score": 0.6929781755411886}} {"text": "{-# OPTIONS --without-K #-}\n\n-- This module implements the dependent Σ-type.\nmodule hott.core.sigma where\n\nopen import hott.core.universe\n\nrecord Σ {ℓ₀ ℓ₁}\n {A : Type ℓ₀}\n (B : A → Type ℓ₁) : Type (ℓ₀ ⊔ ℓ₁) where\n constructor _,_\n field\n proj₁ : A\n proj₂ : B proj₁\n\n\n-- The product type is just the non-dependent Σ-type.\n_×_ : ∀{ℓ₀ ℓ₁} (A : Type ℓ₀)\n (B : Type ℓ₁) → Type (ℓ₀ ⊔ ℓ₁)\nA × B = Σ λ (_ : A) → B\n\n-- Since the , constructor is infixr, we can write (a , (b , c)) as\n-- just (a , b , c). The convention that we follow for tuples is that\n-- of a list. We assign the paring function the least precedence\n-- because we would like to write all other stuff inside the tuple\n-- naturally e.g. (p ≡ q , q ≡ r) etc. We ensure that no other\n-- operator has 0 precedence.\ninfixr 0 _,_\ninfixr 0 _×_\n\n-- The projection to the first component.\nfst : ∀{ℓ₀ ℓ₁} {A : Type ℓ₀} {B : A → Type ℓ₁}\n → Σ B → A\nfst = Σ.proj₁\n\n-- The projection to the second component.\nsnd : ∀{ℓ₀ ℓ₁} {A : Type ℓ₀} {B : A → Type ℓ₁}\n → (σ : Σ B) → B (fst σ)\nsnd = Σ.proj₂\n", "meta": {"hexsha": "4c7a3600d00485d0d260c567534221ffb985ae5e", "size": 1079, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/hott/core/sigma.agda", "max_stars_repo_name": "piyush-kurur/hott", "max_stars_repo_head_hexsha": "876ecdcfddca1abf499e8f00db321c6dc3d5b2bc", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/hott/core/sigma.agda", "max_issues_repo_name": "piyush-kurur/hott", "max_issues_repo_head_hexsha": "876ecdcfddca1abf499e8f00db321c6dc3d5b2bc", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/hott/core/sigma.agda", "max_forks_repo_name": "piyush-kurur/hott", "max_forks_repo_head_hexsha": "876ecdcfddca1abf499e8f00db321c6dc3d5b2bc", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.975, "max_line_length": 69, "alphanum_fraction": 0.608897127, "num_tokens": 393, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.849971175657575, "lm_q2_score": 0.8152324803738429, "lm_q1q2_score": 0.6929241097775961}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Some derivable properties\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Algebra\n\nmodule Algebra.Properties.Group {g₁ g₂} (G : Group g₁ g₂) where\n\nopen Group G\nopen import Algebra.FunctionProperties _≈_\nopen import Relation.Binary.Reasoning.Setoid setoid\nopen import Function\nopen import Data.Product\n\n⁻¹-involutive : ∀ x → x ⁻¹ ⁻¹ ≈ x\n⁻¹-involutive x = begin\n x ⁻¹ ⁻¹ ≈⟨ sym $ identityʳ _ ⟩\n x ⁻¹ ⁻¹ ∙ ε ≈⟨ ∙-congˡ $ sym (inverseˡ _) ⟩\n x ⁻¹ ⁻¹ ∙ (x ⁻¹ ∙ x) ≈⟨ sym $ assoc _ _ _ ⟩\n x ⁻¹ ⁻¹ ∙ x ⁻¹ ∙ x ≈⟨ ∙-congʳ $ inverseˡ _ ⟩\n ε ∙ x ≈⟨ identityˡ _ ⟩\n x ∎\n\nprivate\n\n left-helper : ∀ x y → x ≈ (x ∙ y) ∙ y ⁻¹\n left-helper x y = begin\n x ≈⟨ sym (identityʳ x) ⟩\n x ∙ ε ≈⟨ ∙-congˡ $ sym (inverseʳ y) ⟩\n x ∙ (y ∙ y ⁻¹) ≈⟨ sym (assoc x y (y ⁻¹)) ⟩\n (x ∙ y) ∙ y ⁻¹ ∎\n\n right-helper : ∀ x y → y ≈ x ⁻¹ ∙ (x ∙ y)\n right-helper x y = begin\n y ≈⟨ sym (identityˡ y) ⟩\n ε ∙ y ≈⟨ ∙-congʳ $ sym (inverseˡ x) ⟩\n (x ⁻¹ ∙ x) ∙ y ≈⟨ assoc (x ⁻¹) x y ⟩\n x ⁻¹ ∙ (x ∙ y) ∎\n\nleft-identity-unique : ∀ x y → x ∙ y ≈ y → x ≈ ε\nleft-identity-unique x y eq = begin\n x ≈⟨ left-helper x y ⟩\n (x ∙ y) ∙ y ⁻¹ ≈⟨ ∙-congʳ eq ⟩\n y ∙ y ⁻¹ ≈⟨ inverseʳ y ⟩\n ε ∎\n\nright-identity-unique : ∀ x y → x ∙ y ≈ x → y ≈ ε\nright-identity-unique x y eq = begin\n y ≈⟨ right-helper x y ⟩\n x ⁻¹ ∙ (x ∙ y) ≈⟨ refl ⟨ ∙-cong ⟩ eq ⟩\n x ⁻¹ ∙ x ≈⟨ inverseˡ x ⟩\n ε ∎\n\nidentity-unique : ∀ {x} → Identity x _∙_ → x ≈ ε\nidentity-unique {x} id = left-identity-unique x x (proj₂ id x)\n\nleft-inverse-unique : ∀ x y → x ∙ y ≈ ε → x ≈ y ⁻¹\nleft-inverse-unique x y eq = begin\n x ≈⟨ left-helper x y ⟩\n (x ∙ y) ∙ y ⁻¹ ≈⟨ ∙-congʳ eq ⟩\n ε ∙ y ⁻¹ ≈⟨ identityˡ (y ⁻¹) ⟩\n y ⁻¹ ∎\n\nright-inverse-unique : ∀ x y → x ∙ y ≈ ε → y ≈ x ⁻¹\nright-inverse-unique x y eq = begin\n y ≈⟨ sym (⁻¹-involutive y) ⟩\n y ⁻¹ ⁻¹ ≈⟨ ⁻¹-cong (sym (left-inverse-unique x y eq)) ⟩\n x ⁻¹ ∎\n", "meta": {"hexsha": "b8f9b423bae2f44ce9794d5287f56c425ffa9b3e", "size": 2231, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/Group.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/Group.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/Group.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.5616438356, "max_line_length": 72, "alphanum_fraction": 0.4527117884, "num_tokens": 965, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240825770433, "lm_q2_score": 0.8006920092299292, "lm_q1q2_score": 0.692778009112735}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nopen import LogicalFormulae\nopen import Functions.Definition\n\nmodule Orders.Total.Definition {a : _} (carrier : Set a) where\n\nopen import Orders.Partial.Definition carrier\n\nrecord TotalOrder {b : _} : Set (a ⊔ lsuc b) where\n field\n order : PartialOrder {b}\n _<_ : Rel carrier\n _<_ = PartialOrder._<_ order\n _≤_ : Rel carrier\n _≤_ a b = (a < b) || (a ≡ b)\n field\n totality : (a b : carrier) → ((a < b) || (b < a)) || (a ≡ b)\n\n min : carrier → carrier → carrier\n min a b with totality a b\n min a b | inl (inl a from → aend Ω ( ω-run Ω x n S ) ≡ true\n\nopen Buchi\n\n-- after sometimes, always p\n--\n-- not p\n-- ------------>\n-- <> [] p * <> [] p \n-- <-----------\n-- p\n\n \n--\n-- accept as Muller automaton\n--\nrecord Muller { Q Σ : Set } (Ω : Automaton Q Σ ) ( S : ℕ → Σ ) : Set where\n field\n next : (n : ℕ ) → ℕ \n infinite : (x : Q) → (n : ℕ ) → aend Ω ( ω-run Ω x (n + (next n)) S ) ≡ true \n\n-- always sometimes p\n--\n-- not p\n-- ------------>\n-- [] <> p * [] <> p \n-- <-----------\n-- p\n\ndata States3 : Set where\n ts* : States3\n ts : States3\n\ntransition3 : States3 → Bool → States3\ntransition3 ts* true = ts*\ntransition3 ts* false = ts\ntransition3 ts true = ts*\ntransition3 ts false = ts\n\nmark1 : States3 → Bool\nmark1 ts* = true\nmark1 ts = false\n\nωa1 : Automaton States3 Bool\nωa1 = record {\n δ = transition3\n ; aend = mark1\n } \n\ntrue-seq : ℕ → Bool\ntrue-seq _ = true\n\nfalse-seq : ℕ → Bool\nfalse-seq _ = false\n\nflip-seq : ℕ → Bool\nflip-seq zero = false\nflip-seq (suc n) = not ( flip-seq n )\n\nlemma0 : Muller ωa1 flip-seq \nlemma0 = record {\n next = λ n → suc (suc n)\n ; infinite = lemma01\n } where\n lemma01 : (x : States3) (n : ℕ) →\n aend ωa1 (ω-run ωa1 x (n + suc (suc n)) flip-seq) ≡ true\n lemma01 = {!!}\n\nlemma1 : Buchi ωa1 true-seq \nlemma1 = record {\n from = zero\n ; stay = {!!}\n } where\n lem1 : ( n : ℕ ) → n > zero → aend ωa1 (ω-run ωa1 {!!} n true-seq ) ≡ true\n lem1 zero ()\n lem1 (suc n) (s≤s z≤n) with ω-run ωa1 {!!} n true-seq \n lem1 (suc n) (s≤s z≤n) | ts* = {!!}\n lem1 (suc n) (s≤s z≤n) | ts = {!!}\n\nωa2 : Automaton States3 Bool\nωa2 = record {\n δ = transition3\n ; aend = λ x → not ( mark1 x )\n } \n\nflip-dec : (n : ℕ ) → Dec ( flip-seq n ≡ true )\nflip-dec n with flip-seq n\nflip-dec n | false = no λ () \nflip-dec n | true = yes refl\n\nflip-dec1 : (n : ℕ ) → flip-seq (suc n) ≡ ( not ( flip-seq n ) )\nflip-dec1 n = let open ≡-Reasoning in\n flip-seq (suc n )\n ≡⟨⟩\n ( not ( flip-seq n ) )\n ∎\n\nflip-dec2 : (n : ℕ ) → not flip-seq (suc n) ≡ flip-seq n \nflip-dec2 n = {!!}\n\n\nrecord flipProperty : Set where\n field\n flipP : (n : ℕ) → ω-run ωa2 {!!} {!!} ≡ ω-run ωa2 {!!} {!!}\n\nlemma2 : Muller ωa2 flip-seq \nlemma2 = record {\n next = next\n ; infinite = {!!}\n } where\n next : ℕ → ℕ\n next = {!!}\n infinite' : (n m : ℕ) → n ≥″ m → aend ωa2 {!!} ≡ true → aend ωa2 {!!} ≡ true\n infinite' = {!!}\n infinite : (n : ℕ) → aend ωa2 {!!} ≡ true\n infinite = {!!}\n\nlemma3 : Buchi ωa1 false-seq → ⊥\nlemma3 = {!!}\n\nlemma4 : Muller ωa1 flip-seq → ⊥\nlemma4 = {!!}\n\n\n\n\n\n\n\n", "meta": {"hexsha": "a4ae5705057e62a2779c9aed04c33525fe1f98aa", "size": 3674, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/omega-automaton.agda", "max_stars_repo_name": "shinji-kono/automaton-in-agda", "max_stars_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/omega-automaton.agda", "max_issues_repo_name": "shinji-kono/automaton-in-agda", "max_issues_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/omega-automaton.agda", "max_forks_repo_name": "shinji-kono/automaton-in-agda", "max_forks_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.5512820513, "max_line_length": 87, "alphanum_fraction": 0.4888405008, "num_tokens": 1316, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972684083609, "lm_q2_score": 0.7956580952177053, "lm_q1q2_score": 0.6926977642835337}} {"text": "module Numeral.Natural.Relation.Proofs where\n\nopen import Data\nopen import Functional\nopen import Numeral.Natural\nopen import Numeral.Natural.Relation\nopen import Numeral.Natural.Relation.Order\nopen import Numeral.Natural.Relation.Order.Proofs\nopen import Logic.Propositional\nopen import Logic.Propositional.Theorems\nimport Lvl\nopen import Relator.Equals\nopen import Type\n\nprivate variable n : ℕ\n\nPositive-non-zero : Positive(n) ↔ (n ≢ 𝟎)\nPositive-non-zero {𝟎} = [↔]-intro (apply [≡]-intro) \\()\nPositive-non-zero {𝐒 n} = [↔]-intro (const <>) (const \\())\n\nPositive-greater-than-zero : Positive(n) ↔ (n > 𝟎)\nPositive-greater-than-zero = [↔]-transitivity Positive-non-zero ([↔]-intro [>]-to-[≢] [≢]-to-[<]-of-0ᵣ)\n", "meta": {"hexsha": "86982095a116a7730cdb31eb2c06bbf48f9b48ba", "size": 717, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Relation/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Relation/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Relation/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.1739130435, "max_line_length": 103, "alphanum_fraction": 0.7280334728, "num_tokens": 221, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9473810496235896, "lm_q2_score": 0.7310585786300049, "lm_q1q2_score": 0.6925910435588235}} {"text": "{-# OPTIONS --without-K --exact-split #-}\n\nmodule 05-identity-types where\n\nimport 04-inductive-types\nopen 04-inductive-types public\n\n-- Section 5.1\n\n-- Definition 5.1.1\n\n{- We introduce the identity type. -}\n\ndata Id {i : Level} {A : UU i} (x : A) : A → UU i where\n refl : Id x x\n\n{- In the following definition we give a construction of path induction.\n However, in the development of this library we will mostly use Agda's\n built-in methods to give constructions by path induction. -}\n\nind-Id :\n {i j : Level} {A : UU i} (x : A) (B : (y : A) (p : Id x y) → UU j) →\n (B x refl) → (y : A) (p : Id x y) → B y p\nind-Id x B b y refl = b\n\n-- Section 5.2 The groupoid structure of types\n\n-- Definition 5.2.1\n\n_∙_ :\n {i : Level} {A : UU i} {x y z : A} → Id x y → Id y z → Id x z\nrefl ∙ q = q\n\nconcat :\n {i : Level} {A : UU i} {x y : A} → Id x y → (z : A) → Id y z → Id x z\nconcat p z q = p ∙ q\n\n-- Definition 5.2.2\n\ninv :\n {i : Level} {A : UU i} {x y : A} → Id x y → Id y x\ninv refl = refl\n\n-- Definition 5.2.3\n\nassoc :\n {i : Level} {A : UU i} {x y z w : A} (p : Id x y) (q : Id y z)\n (r : Id z w) → Id ((p ∙ q) ∙ r) (p ∙ (q ∙ r))\nassoc refl q r = refl\n\n-- Definition 5.2.4\n\nleft-unit :\n {i : Level} {A : UU i} {x y : A} {p : Id x y} → Id (refl ∙ p) p\nleft-unit = refl\n\nright-unit :\n {i : Level} {A : UU i} {x y : A} {p : Id x y} → Id (p ∙ refl) p\nright-unit {p = refl} = refl\n\n-- Definition 5.2.5\n\nleft-inv :\n {i : Level} {A : UU i} {x y : A} (p : Id x y) →\n Id ((inv p) ∙ p) refl\nleft-inv refl = refl\n\nright-inv :\n {i : Level} {A : UU i} {x y : A} (p : Id x y) →\n Id (p ∙ (inv p)) refl\nright-inv refl = refl\n\n-- Section 5.3 The action on paths of functions\n\n-- Definition 5.3.1\n\nap :\n {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y : A} (p : Id x y) →\n Id (f x) (f y)\nap f refl = refl\n\nap-id :\n {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (ap id p) p\nap-id refl = refl\n\nap-comp :\n {i j k : Level} {A : UU i} {B : UU j} {C : UU k} (g : B → C)\n (f : A → B) {x y : A} (p : Id x y) → Id (ap (g ∘ f) p) (ap g (ap f p))\nap-comp g f refl = refl\n\n-- Definition 5.3.2\n\nap-refl :\n {i j : Level} {A : UU i} {B : UU j} (f : A → B) (x : A) →\n Id (ap f (refl {_} {_} {x})) refl\nap-refl f x = refl\n\nap-concat :\n {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y z : A}\n (p : Id x y) (q : Id y z) → Id (ap f (p ∙ q)) ((ap f p) ∙ (ap f q))\nap-concat f refl q = refl\n\nap-inv :\n {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y : A}\n (p : Id x y) → Id (ap f (inv p)) (inv (ap f p))\nap-inv f refl = refl\n\n-- Section 5.4 Transport\n\n-- Definition 5.4.1\n\ntr :\n {i j : Level} {A : UU i} (B : A → UU j) {x y : A} (p : Id x y) → B x → B y\ntr B refl b = b\n\n-- Definition 5.4.2\n\napd :\n {i j : Level} {A : UU i} {B : A → UU j} (f : (x : A) → B x) {x y : A}\n (p : Id x y) → Id (tr B p (f x)) (f y)\napd f refl = refl\n\npath-over :\n {i j : Level} {A : UU i} (B : A → UU j) {x x' : A} (p : Id x x') →\n B x → B x' → UU j\npath-over B p y y' = Id (tr B p y) y'\n\nrefl-path-over :\n {i j : Level} {A : UU i} (B : A → UU j) (x : A) (y : B x) →\n path-over B refl y y\nrefl-path-over B x y = refl\n\n-- Exercises\n\n-- Exercise 5.1\n\n-- Exercise 5.2\n\ndistributive-inv-concat :\n {i : Level} {A : UU i} {x y : A} (p : Id x y) {z : A}\n (q : Id y z) → Id (inv (p ∙ q)) ((inv q) ∙ (inv p))\ndistributive-inv-concat refl refl = refl\n\n-- Exercise 5.3\n\ninv-con :\n {i : Level} {A : UU i} {x y : A} (p : Id x y) {z : A} (q : Id y z)\n (r : Id x z) → (Id (p ∙ q) r) → Id q ((inv p) ∙ r)\ninv-con refl q r = id \n\ncon-inv :\n {i : Level} {A : UU i} {x y : A} (p : Id x y) {z : A} (q : Id y z)\n (r : Id x z) → (Id (p ∙ q) r) → Id p (r ∙ (inv q))\ncon-inv p refl r =\n ( λ α → α ∙ (inv right-unit)) ∘ (concat (inv right-unit) r)\n\n-- Exercise 5.4\n\nlift :\n {i j : Level} {A : UU i} {B : A → UU j} {x y : A} (p : Id x y)\n (b : B x) → Id (pair x b) (pair y (tr B p b))\nlift refl b = refl\n\n-- Exercise 5.5\n\n-- Exercise 5.5(a)\n\nabstract\n right-unit-law-add-ℕ :\n (x : ℕ) → Id (add-ℕ x zero-ℕ) x\n right-unit-law-add-ℕ x = refl\n \n left-unit-law-add-ℕ :\n (x : ℕ) → Id (add-ℕ zero-ℕ x) x\n left-unit-law-add-ℕ zero-ℕ = refl\n left-unit-law-add-ℕ (succ-ℕ x) = ap succ-ℕ (left-unit-law-add-ℕ x)\n \n left-successor-law-add-ℕ :\n (x y : ℕ) → Id (add-ℕ (succ-ℕ x) y) (succ-ℕ (add-ℕ x y))\n left-successor-law-add-ℕ x zero-ℕ = refl\n left-successor-law-add-ℕ x (succ-ℕ y) =\n ap succ-ℕ (left-successor-law-add-ℕ x y)\n\n right-successor-law-add-ℕ :\n (x y : ℕ) → Id (add-ℕ x (succ-ℕ y)) (succ-ℕ (add-ℕ x y))\n right-successor-law-add-ℕ x y = refl\n\n-- Exercise 5.5(b)\n\nabstract\n associative-add-ℕ :\n (x y z : ℕ) → Id (add-ℕ (add-ℕ x y) z) (add-ℕ x (add-ℕ y z))\n associative-add-ℕ x y zero-ℕ = refl \n associative-add-ℕ x y (succ-ℕ z) = ap succ-ℕ (associative-add-ℕ x y z)\n\nabstract\n commutative-add-ℕ : (x y : ℕ) → Id (add-ℕ x y) (add-ℕ y x)\n commutative-add-ℕ zero-ℕ y = left-unit-law-add-ℕ y\n commutative-add-ℕ (succ-ℕ x) y =\n (left-successor-law-add-ℕ x y) ∙ (ap succ-ℕ (commutative-add-ℕ x y))\n\n-- Exercise 5.5(c)\n\nabstract\n left-zero-law-mul-ℕ :\n (x : ℕ) → Id (mul-ℕ zero-ℕ x) zero-ℕ\n left-zero-law-mul-ℕ x = refl\n\n right-zero-law-mul-ℕ :\n (x : ℕ) → Id (mul-ℕ x zero-ℕ) zero-ℕ\n right-zero-law-mul-ℕ zero-ℕ = refl\n right-zero-law-mul-ℕ (succ-ℕ x) =\n ( right-unit-law-add-ℕ (mul-ℕ x zero-ℕ)) ∙ (right-zero-law-mul-ℕ x)\n\nabstract\n right-unit-law-mul-ℕ :\n (x : ℕ) → Id (mul-ℕ x one-ℕ) x\n right-unit-law-mul-ℕ zero-ℕ = refl\n right-unit-law-mul-ℕ (succ-ℕ x) = ap succ-ℕ (right-unit-law-mul-ℕ x)\n\n left-unit-law-mul-ℕ :\n (x : ℕ) → Id (mul-ℕ one-ℕ x) x\n left-unit-law-mul-ℕ zero-ℕ = refl\n left-unit-law-mul-ℕ (succ-ℕ x) = ap succ-ℕ (left-unit-law-mul-ℕ x)\n\nabstract\n left-successor-law-mul-ℕ :\n (x y : ℕ) → Id (mul-ℕ (succ-ℕ x) y) (add-ℕ (mul-ℕ x y) y)\n left-successor-law-mul-ℕ x y = refl\n\n right-successor-law-mul-ℕ :\n (x y : ℕ) → Id (mul-ℕ x (succ-ℕ y)) (add-ℕ x (mul-ℕ x y))\n right-successor-law-mul-ℕ zero-ℕ y = refl\n right-successor-law-mul-ℕ (succ-ℕ x) y =\n ( ( ap (λ t → succ-ℕ (add-ℕ t y)) (right-successor-law-mul-ℕ x y)) ∙\n ( ap succ-ℕ (associative-add-ℕ x (mul-ℕ x y) y))) ∙\n ( inv (left-successor-law-add-ℕ x (add-ℕ (mul-ℕ x y) y)))\n\n-- Exercise 5.5(d)\n\nabstract\n commutative-mul-ℕ :\n (x y : ℕ) → Id (mul-ℕ x y) (mul-ℕ y x)\n commutative-mul-ℕ zero-ℕ y = inv (right-zero-law-mul-ℕ y)\n commutative-mul-ℕ (succ-ℕ x) y =\n ( commutative-add-ℕ (mul-ℕ x y) y) ∙ \n ( ( ap (add-ℕ y) (commutative-mul-ℕ x y)) ∙\n ( inv (right-successor-law-mul-ℕ y x)))\n\n-- Exercise 5.5(e)\n\nabstract\n left-distributive-mul-add-ℕ :\n (x y z : ℕ) → Id (mul-ℕ x (add-ℕ y z)) (add-ℕ (mul-ℕ x y) (mul-ℕ x z))\n left-distributive-mul-add-ℕ zero-ℕ y z = refl\n left-distributive-mul-add-ℕ (succ-ℕ x) y z =\n ( left-successor-law-mul-ℕ x (add-ℕ y z)) ∙ \n ( ( ap (λ t → add-ℕ t (add-ℕ y z)) (left-distributive-mul-add-ℕ x y z)) ∙ \n ( ( associative-add-ℕ (mul-ℕ x y) (mul-ℕ x z) (add-ℕ y z)) ∙\n ( ( ap ( add-ℕ (mul-ℕ x y)) \n ( ( inv (associative-add-ℕ (mul-ℕ x z) y z)) ∙\n ( ( ap (λ t → add-ℕ t z) (commutative-add-ℕ (mul-ℕ x z) y)) ∙\n ( associative-add-ℕ y (mul-ℕ x z) z)))) ∙ \n ( inv (associative-add-ℕ (mul-ℕ x y) y (add-ℕ (mul-ℕ x z) z))))))\n\nabstract\n right-distributive-mul-add-ℕ :\n (x y z : ℕ) → Id (mul-ℕ (add-ℕ x y) z) (add-ℕ (mul-ℕ x z) (mul-ℕ y z))\n right-distributive-mul-add-ℕ x y z =\n ( commutative-mul-ℕ (add-ℕ x y) z) ∙ \n ( ( left-distributive-mul-add-ℕ z x y) ∙ \n ( ( ap (λ t → add-ℕ t (mul-ℕ z y)) (commutative-mul-ℕ z x)) ∙ \n ( ap (λ t → add-ℕ (mul-ℕ x z) t) (commutative-mul-ℕ z y))))\n\n-- Exercise 5.5(f)\n\nabstract\n associative-mul-ℕ :\n (x y z : ℕ) → Id (mul-ℕ (mul-ℕ x y) z) (mul-ℕ x (mul-ℕ y z))\n associative-mul-ℕ zero-ℕ y z = refl\n associative-mul-ℕ (succ-ℕ x) y z =\n ( right-distributive-mul-add-ℕ (mul-ℕ x y) y z) ∙ \n ( ap (λ t → add-ℕ t (mul-ℕ y z)) (associative-mul-ℕ x y z))\n\n-- Exercise 5.6\n\nMac-Lane-pentagon :\n {i : Level} {A : UU i} {a b c d e : A}\n (p : Id a b) (q : Id b c) (r : Id c d) (s : Id d e) →\n let α₁ = (ap (λ t → t ∙ s) (assoc p q r))\n α₂ = (assoc p (q ∙ r) s)\n α₃ = (ap (λ t → p ∙ t) (assoc q r s))\n α₄ = (assoc (p ∙ q) r s)\n α₅ = (assoc p q (r ∙ s))\n in\n Id ((α₁ ∙ α₂) ∙ α₃) (α₄ ∙ α₅)\nMac-Lane-pentagon refl refl refl refl = refl\n\n\n{- The following code is an experiment that shows that constructions in an\n abstract environment do remember the specific definitions of previous\n definitions in abstract environments. -}\n\nabstract\n abstract-concat :\n {l : Level} {A : UU l} {x y z : A} → Id x y → Id y z → Id x z\n abstract-concat refl q = q\n\n abstract-left-unit-law :\n {l : Level} {A : UU l} {x y : A} (q : Id x y) → Id (abstract-concat refl q) q\n abstract-left-unit-law q = refl\n\n{- We just make some random definition to make sure that we are not in the \n same abstract envirnoment anymore. -}\none : ℕ\none = succ-ℕ zero-ℕ\n\nabstract\n abstract-right-unit-law :\n {l : Level} {A : UU l} {x y : A} (p : Id x y) →\n Id (abstract-concat p refl) p\n abstract-right-unit-law refl = refl\n\n {- The term refl should not be accepted if the definition of abstract-concat\n were forgotten. A definition that would work under all circumstances is\n abstract-left-unit refl. -}\n\n-- The ring axioms for ℤ\n\nabstract\n left-inverse-pred-ℤ :\n (k : ℤ) → Id (pred-ℤ (succ-ℤ k)) k\n left-inverse-pred-ℤ (inl zero-ℕ) = refl\n left-inverse-pred-ℤ (inl (succ-ℕ x)) = refl\n left-inverse-pred-ℤ (inr (inl star)) = refl\n left-inverse-pred-ℤ (inr (inr zero-ℕ)) = refl\n left-inverse-pred-ℤ (inr (inr (succ-ℕ x))) = refl\n\n right-inverse-pred-ℤ :\n (k : ℤ) → Id (succ-ℤ (pred-ℤ k)) k\n right-inverse-pred-ℤ (inl zero-ℕ) = refl\n right-inverse-pred-ℤ (inl (succ-ℕ x)) = refl\n right-inverse-pred-ℤ (inr (inl star)) = refl\n right-inverse-pred-ℤ (inr (inr zero-ℕ)) = refl\n right-inverse-pred-ℤ (inr (inr (succ-ℕ x))) = refl\n\n{- Exercise 6.12 (a) simply asks to prove the unit laws. The left unit law\n holds by judgmental equality. -}\n\nabstract\n left-unit-law-add-ℤ :\n (k : ℤ) → Id (add-ℤ zero-ℤ k) k\n left-unit-law-add-ℤ k = refl\n\n right-unit-law-add-ℤ :\n (k : ℤ) → Id (add-ℤ k zero-ℤ) k\n right-unit-law-add-ℤ (inl zero-ℕ) = refl\n right-unit-law-add-ℤ (inl (succ-ℕ x)) =\n ap pred-ℤ (right-unit-law-add-ℤ (inl x))\n right-unit-law-add-ℤ (inr (inl star)) = refl\n right-unit-law-add-ℤ (inr (inr zero-ℕ)) = refl\n right-unit-law-add-ℤ (inr (inr (succ-ℕ x))) =\n ap succ-ℤ (right-unit-law-add-ℤ (inr (inr x)))\n\n{- Exercise 6.12 (b) asks to show the left and right predecessor and successor \n laws. These are helpful to give proofs of associativity and commutativity. \n -}\n\nabstract\n left-predecessor-law-add-ℤ :\n (x y : ℤ) → Id (add-ℤ (pred-ℤ x) y) (pred-ℤ (add-ℤ x y))\n left-predecessor-law-add-ℤ (inl n) y = refl\n left-predecessor-law-add-ℤ (inr (inl star)) y = refl\n left-predecessor-law-add-ℤ (inr (inr zero-ℕ)) y =\n ( ap (λ t → add-ℤ t y) (left-inverse-pred-ℤ zero-ℤ)) ∙ \n ( inv (left-inverse-pred-ℤ y))\n left-predecessor-law-add-ℤ (inr (inr (succ-ℕ x))) y =\n ( ap (λ t → (add-ℤ t y)) (left-inverse-pred-ℤ (inr (inr x)))) ∙\n ( inv (left-inverse-pred-ℤ (add-ℤ (inr (inr x)) y)))\n\n right-predecessor-law-add-ℤ :\n (x y : ℤ) → Id (add-ℤ x (pred-ℤ y)) (pred-ℤ (add-ℤ x y))\n right-predecessor-law-add-ℤ (inl zero-ℕ) n = refl\n right-predecessor-law-add-ℤ (inl (succ-ℕ m)) n =\n ap pred-ℤ (right-predecessor-law-add-ℤ (inl m) n)\n right-predecessor-law-add-ℤ (inr (inl star)) n = refl\n right-predecessor-law-add-ℤ (inr (inr zero-ℕ)) n =\n (right-inverse-pred-ℤ n) ∙ (inv (left-inverse-pred-ℤ n))\n right-predecessor-law-add-ℤ (inr (inr (succ-ℕ x))) n =\n ( ap succ-ℤ (right-predecessor-law-add-ℤ (inr (inr x)) n)) ∙\n ( ( right-inverse-pred-ℤ (add-ℤ (inr (inr x)) n)) ∙ \n ( inv (left-inverse-pred-ℤ (add-ℤ (inr (inr x)) n))))\n\nabstract\n left-successor-law-add-ℤ :\n (x y : ℤ) → Id (add-ℤ (succ-ℤ x) y) (succ-ℤ (add-ℤ x y))\n left-successor-law-add-ℤ (inl zero-ℕ) y =\n ( ap (λ t → add-ℤ t y) (right-inverse-pred-ℤ zero-ℤ)) ∙\n ( inv (right-inverse-pred-ℤ y))\n left-successor-law-add-ℤ (inl (succ-ℕ x)) y =\n ( inv (right-inverse-pred-ℤ (add-ℤ (inl x) y))) ∙\n ( ap succ-ℤ (inv (left-predecessor-law-add-ℤ (inl x) y)))\n left-successor-law-add-ℤ (inr (inl star)) y = refl\n left-successor-law-add-ℤ (inr (inr x)) y = refl\n\n right-successor-law-add-ℤ :\n (x y : ℤ) → Id (add-ℤ x (succ-ℤ y)) (succ-ℤ (add-ℤ x y))\n right-successor-law-add-ℤ (inl zero-ℕ) y =\n (left-inverse-pred-ℤ y) ∙ (inv (right-inverse-pred-ℤ y))\n right-successor-law-add-ℤ (inl (succ-ℕ x)) y =\n ( ap pred-ℤ (right-successor-law-add-ℤ (inl x) y)) ∙\n ( ( left-inverse-pred-ℤ (add-ℤ (inl x) y)) ∙\n ( inv (right-inverse-pred-ℤ (add-ℤ (inl x) y))))\n right-successor-law-add-ℤ (inr (inl star)) y = refl\n right-successor-law-add-ℤ (inr (inr zero-ℕ)) y = refl\n right-successor-law-add-ℤ (inr (inr (succ-ℕ x))) y =\n ap succ-ℤ (right-successor-law-add-ℤ (inr (inr x)) y)\n\n{- Exercise 6.12 (c) asks to prove associativity and commutativity. Note that \n we avoid an unwieldy amount of cases by only using induction on the first \n argument. The resulting proof term is fairly short, and we don't have to \n present ℤ as a certain quotient of ℕ × ℕ. -}\n\nabstract\n associative-add-ℤ :\n (x y z : ℤ) → Id (add-ℤ (add-ℤ x y) z) (add-ℤ x (add-ℤ y z))\n associative-add-ℤ (inl zero-ℕ) y z =\n ( ap (λ t → add-ℤ t z) (left-predecessor-law-add-ℤ zero-ℤ y)) ∙\n ( ( left-predecessor-law-add-ℤ y z) ∙\n ( inv (left-predecessor-law-add-ℤ zero-ℤ (add-ℤ y z))))\n associative-add-ℤ (inl (succ-ℕ x)) y z =\n ( ap (λ t → add-ℤ t z) (left-predecessor-law-add-ℤ (inl x) y)) ∙\n ( ( left-predecessor-law-add-ℤ (add-ℤ (inl x) y) z) ∙\n ( ( ap pred-ℤ (associative-add-ℤ (inl x) y z)) ∙ \n ( inv (left-predecessor-law-add-ℤ (inl x) (add-ℤ y z)))))\n associative-add-ℤ (inr (inl star)) y z = refl\n associative-add-ℤ (inr (inr zero-ℕ)) y z =\n ( ap (λ t → add-ℤ t z) (left-successor-law-add-ℤ zero-ℤ y)) ∙ \n ( ( left-successor-law-add-ℤ y z) ∙ \n ( inv (left-successor-law-add-ℤ zero-ℤ (add-ℤ y z))))\n associative-add-ℤ (inr (inr (succ-ℕ x))) y z =\n ( ap (λ t → add-ℤ t z) (left-successor-law-add-ℤ (inr (inr x)) y)) ∙\n ( ( left-successor-law-add-ℤ (add-ℤ (inr (inr x)) y) z) ∙\n ( ( ap succ-ℤ (associative-add-ℤ (inr (inr x)) y z)) ∙\n ( inv (left-successor-law-add-ℤ (inr (inr x)) (add-ℤ y z)))))\n\nabstract\n commutative-add-ℤ :\n (x y : ℤ) → Id (add-ℤ x y) (add-ℤ y x)\n commutative-add-ℤ (inl zero-ℕ) y =\n ( left-predecessor-law-add-ℤ zero-ℤ y) ∙\n ( inv\n ( ( right-predecessor-law-add-ℤ y zero-ℤ) ∙\n ( ap pred-ℤ (right-unit-law-add-ℤ y))))\n commutative-add-ℤ (inl (succ-ℕ x)) y =\n ( ap pred-ℤ (commutative-add-ℤ (inl x) y)) ∙ \n ( inv (right-predecessor-law-add-ℤ y (inl x)))\n commutative-add-ℤ (inr (inl star)) y = inv (right-unit-law-add-ℤ y)\n commutative-add-ℤ (inr (inr zero-ℕ)) y =\n inv\n ( ( right-successor-law-add-ℤ y zero-ℤ) ∙\n ( ap succ-ℤ (right-unit-law-add-ℤ y)))\n commutative-add-ℤ (inr (inr (succ-ℕ x))) y =\n ( ap succ-ℤ (commutative-add-ℤ (inr (inr x)) y)) ∙ \n ( inv (right-successor-law-add-ℤ y (inr (inr x))))\n\n{- Exercise 6.12 (d) finally asks to show the inverse laws, completing the \n verification of the group laws. Combined with associativity and \n commutativity we conclude that (add-ℤ x) and (λ x → add-ℤ x y) are \n equivalences, for every x : ℤ and y : ℤ, respectively. -}\n\nabstract\n left-inverse-law-add-ℤ :\n (x : ℤ) → Id (add-ℤ (neg-ℤ x) x) zero-ℤ\n left-inverse-law-add-ℤ (inl zero-ℕ) = refl\n left-inverse-law-add-ℤ (inl (succ-ℕ x)) =\n ( ap succ-ℤ (right-predecessor-law-add-ℤ (inr (inr x)) (inl x))) ∙ \n ( ( right-inverse-pred-ℤ (add-ℤ (inr (inr x)) (inl x))) ∙\n ( left-inverse-law-add-ℤ (inl x))) \n left-inverse-law-add-ℤ (inr (inl star)) = refl\n left-inverse-law-add-ℤ (inr (inr x)) =\n ( commutative-add-ℤ (inl x) (inr (inr x))) ∙ \n ( left-inverse-law-add-ℤ (inl x))\n \n right-inverse-law-add-ℤ :\n (x : ℤ) → Id (add-ℤ x (neg-ℤ x)) zero-ℤ\n right-inverse-law-add-ℤ x =\n ( commutative-add-ℤ x (neg-ℤ x)) ∙ (left-inverse-law-add-ℤ x)\n\n-- Similar for multiplication on ℤ\n\nneg-neg-ℤ : (k : ℤ) → Id (neg-ℤ (neg-ℤ k)) k\nneg-neg-ℤ (inl n) = refl\nneg-neg-ℤ (inr (inl star)) = refl\nneg-neg-ℤ (inr (inr n)) = refl\n\nneg-pred-ℤ :\n (k : ℤ) → Id (neg-ℤ (pred-ℤ k)) (succ-ℤ (neg-ℤ k))\nneg-pred-ℤ (inl x) = refl\nneg-pred-ℤ (inr (inl star)) = refl\nneg-pred-ℤ (inr (inr zero-ℕ)) = refl\nneg-pred-ℤ (inr (inr (succ-ℕ x))) = refl\n\npred-neg-ℤ :\n (k : ℤ) → Id (pred-ℤ (neg-ℤ k)) (neg-ℤ (succ-ℤ k))\npred-neg-ℤ (inl zero-ℕ) = refl\npred-neg-ℤ (inl (succ-ℕ x)) = refl\npred-neg-ℤ (inr (inl star)) = refl\npred-neg-ℤ (inr (inr x)) = refl\n\nright-negative-law-add-ℤ :\n (k l : ℤ) → Id (add-ℤ k (neg-ℤ l)) (neg-ℤ (add-ℤ (neg-ℤ k) l))\nright-negative-law-add-ℤ (inl zero-ℕ) l =\n ( left-predecessor-law-add-ℤ zero-ℤ (neg-ℤ l)) ∙\n ( pred-neg-ℤ l)\nright-negative-law-add-ℤ (inl (succ-ℕ x)) l =\n ( left-predecessor-law-add-ℤ (inl x) (neg-ℤ l)) ∙\n ( ( ap pred-ℤ (right-negative-law-add-ℤ (inl x) l)) ∙\n ( pred-neg-ℤ (add-ℤ (inr (inr x)) l)))\nright-negative-law-add-ℤ (inr (inl star)) l = refl\nright-negative-law-add-ℤ (inr (inr zero-ℕ)) l = inv (neg-pred-ℤ l)\nright-negative-law-add-ℤ (inr (inr (succ-ℕ n))) l =\n ( left-successor-law-add-ℤ (in-pos n) (neg-ℤ l)) ∙\n ( ( ap succ-ℤ (right-negative-law-add-ℤ (inr (inr n)) l)) ∙\n ( inv (neg-pred-ℤ (add-ℤ (inl n) l))))\n\ndistributive-neg-add-ℤ :\n (k l : ℤ) → Id (neg-ℤ (add-ℤ k l)) (add-ℤ (neg-ℤ k) (neg-ℤ l))\ndistributive-neg-add-ℤ (inl zero-ℕ) l =\n ( ap neg-ℤ (left-predecessor-law-add-ℤ zero-ℤ l)) ∙\n ( neg-pred-ℤ l)\ndistributive-neg-add-ℤ (inl (succ-ℕ n)) l =\n ( neg-pred-ℤ (add-ℤ (inl n) l)) ∙\n ( ( ap succ-ℤ (distributive-neg-add-ℤ (inl n) l)) ∙\n ( ap (λ t → add-ℤ t (neg-ℤ l)) (inv (neg-pred-ℤ (inl n)))))\ndistributive-neg-add-ℤ (inr (inl star)) l = refl\ndistributive-neg-add-ℤ (inr (inr zero-ℕ)) l = inv (pred-neg-ℤ l)\ndistributive-neg-add-ℤ (inr (inr (succ-ℕ n))) l =\n ( inv (pred-neg-ℤ (add-ℤ (in-pos n) l))) ∙\n ( ap pred-ℤ (distributive-neg-add-ℤ (inr (inr n)) l))\n\nleft-zero-law-mul-ℤ : (k : ℤ) → Id (mul-ℤ zero-ℤ k) zero-ℤ\nleft-zero-law-mul-ℤ k = refl\n\nright-zero-law-mul-ℤ : (k : ℤ) → Id (mul-ℤ k zero-ℤ) zero-ℤ\nright-zero-law-mul-ℤ (inl zero-ℕ) = refl\nright-zero-law-mul-ℤ (inl (succ-ℕ n)) =\n right-zero-law-mul-ℤ (inl n)\nright-zero-law-mul-ℤ (inr (inl star)) = refl\nright-zero-law-mul-ℤ (inr (inr zero-ℕ)) = refl\nright-zero-law-mul-ℤ (inr (inr (succ-ℕ n))) =\n right-zero-law-mul-ℤ (inr (inr n))\n\nleft-unit-law-mul-ℤ : (k : ℤ) → Id (mul-ℤ one-ℤ k) k\nleft-unit-law-mul-ℤ k = refl\n\nright-unit-law-mul-ℤ : (k : ℤ) → Id (mul-ℤ k one-ℤ) k\nright-unit-law-mul-ℤ (inl zero-ℕ) = refl\nright-unit-law-mul-ℤ (inl (succ-ℕ n)) =\n ap (add-ℤ (neg-one-ℤ)) (right-unit-law-mul-ℤ (inl n))\nright-unit-law-mul-ℤ (inr (inl star)) = refl\nright-unit-law-mul-ℤ (inr (inr zero-ℕ)) = refl\nright-unit-law-mul-ℤ (inr (inr (succ-ℕ n))) =\n ap (add-ℤ one-ℤ) (right-unit-law-mul-ℤ (inr (inr n)))\n\nleft-neg-unit-law-mul-ℤ : (k : ℤ) → Id (mul-ℤ neg-one-ℤ k) (neg-ℤ k)\nleft-neg-unit-law-mul-ℤ k = refl\n\nright-neg-unit-law-mul-ℤ : (k : ℤ) → Id (mul-ℤ k neg-one-ℤ) (neg-ℤ k)\nright-neg-unit-law-mul-ℤ (inl zero-ℕ) = refl\nright-neg-unit-law-mul-ℤ (inl (succ-ℕ n)) =\n ap (add-ℤ one-ℤ) (right-neg-unit-law-mul-ℤ (inl n))\nright-neg-unit-law-mul-ℤ (inr (inl star)) = refl\nright-neg-unit-law-mul-ℤ (inr (inr zero-ℕ)) = refl\nright-neg-unit-law-mul-ℤ (inr (inr (succ-ℕ n))) =\n ap (add-ℤ neg-one-ℤ) (right-neg-unit-law-mul-ℤ (inr (inr n)))\n\nleft-successor-law-mul-ℤ :\n (k l : ℤ) → Id (mul-ℤ (succ-ℤ k) l) (add-ℤ l (mul-ℤ k l))\nleft-successor-law-mul-ℤ (inl zero-ℕ) l =\n inv (right-inverse-law-add-ℤ l)\nleft-successor-law-mul-ℤ (inl (succ-ℕ n)) l =\n ( ( inv (left-unit-law-add-ℤ (mul-ℤ (inl n) l))) ∙\n ( ap\n ( λ x → add-ℤ x (mul-ℤ (inl n) l))\n ( inv (right-inverse-law-add-ℤ l)))) ∙\n ( associative-add-ℤ l (neg-ℤ l) (mul-ℤ (inl n) l))\nleft-successor-law-mul-ℤ (inr (inl star)) l =\n inv (right-unit-law-add-ℤ l)\nleft-successor-law-mul-ℤ (inr (inr n)) l = refl\n\nleft-predecessor-law-mul-ℤ :\n (k l : ℤ) → Id (mul-ℤ (pred-ℤ k) l) (add-ℤ (neg-ℤ l) (mul-ℤ k l))\nleft-predecessor-law-mul-ℤ (inl n) l = refl\nleft-predecessor-law-mul-ℤ (inr (inl star)) l =\n ( left-neg-unit-law-mul-ℤ l) ∙\n ( inv (right-unit-law-add-ℤ (neg-ℤ l)))\nleft-predecessor-law-mul-ℤ (inr (inr zero-ℕ)) l =\n inv (left-inverse-law-add-ℤ l)\nleft-predecessor-law-mul-ℤ (inr (inr (succ-ℕ x))) l =\n ( ap\n ( λ t → add-ℤ t (mul-ℤ (in-pos x) l))\n ( inv (left-inverse-law-add-ℤ l))) ∙\n ( associative-add-ℤ (neg-ℤ l) l (mul-ℤ (in-pos x) l))\n\nright-successor-law-mul-ℤ :\n (k l : ℤ) → Id (mul-ℤ k (succ-ℤ l)) (add-ℤ k (mul-ℤ k l))\nright-successor-law-mul-ℤ (inl zero-ℕ) l = inv (pred-neg-ℤ l)\nright-successor-law-mul-ℤ (inl (succ-ℕ n)) l =\n ( left-predecessor-law-mul-ℤ (inl n) (succ-ℤ l)) ∙\n ( ( ap (add-ℤ (neg-ℤ (succ-ℤ l))) (right-successor-law-mul-ℤ (inl n) l)) ∙\n ( ( inv (associative-add-ℤ (neg-ℤ (succ-ℤ l)) (inl n) (mul-ℤ (inl n) l))) ∙\n ( ( ap\n ( λ t → add-ℤ t (mul-ℤ (inl n) l))\n { x = add-ℤ (neg-ℤ (succ-ℤ l)) (inl n)}\n { y = add-ℤ (inl (succ-ℕ n)) (neg-ℤ l)}\n ( ( right-successor-law-add-ℤ (neg-ℤ (succ-ℤ l)) (inl (succ-ℕ n))) ∙\n ( ( ap succ-ℤ\n ( commutative-add-ℤ (neg-ℤ (succ-ℤ l)) (inl (succ-ℕ n)))) ∙\n ( ( inv\n ( right-successor-law-add-ℤ\n ( inl (succ-ℕ n))\n ( neg-ℤ (succ-ℤ l)))) ∙\n ( ap\n ( add-ℤ (inl (succ-ℕ n)))\n ( ( ap succ-ℤ (inv (pred-neg-ℤ l))) ∙\n ( right-inverse-pred-ℤ (neg-ℤ l)))))))) ∙\n ( associative-add-ℤ (inl (succ-ℕ n)) (neg-ℤ l) (mul-ℤ (inl n) l)))))\nright-successor-law-mul-ℤ (inr (inl star)) l = refl\nright-successor-law-mul-ℤ (inr (inr zero-ℕ)) l = refl\nright-successor-law-mul-ℤ (inr (inr (succ-ℕ n))) l =\n ( left-successor-law-mul-ℤ (in-pos n) (succ-ℤ l)) ∙\n ( ( ap (add-ℤ (succ-ℤ l)) (right-successor-law-mul-ℤ (inr (inr n)) l)) ∙\n ( ( inv (associative-add-ℤ (succ-ℤ l) (in-pos n) (mul-ℤ (in-pos n) l))) ∙\n ( ( ap\n ( λ t → add-ℤ t (mul-ℤ (in-pos n) l))\n { x = add-ℤ (succ-ℤ l) (in-pos n)}\n { y = add-ℤ (in-pos (succ-ℕ n)) l}\n ( ( left-successor-law-add-ℤ l (in-pos n)) ∙\n ( ( ap succ-ℤ (commutative-add-ℤ l (in-pos n))) ∙\n ( inv (left-successor-law-add-ℤ (in-pos n) l))))) ∙\n ( associative-add-ℤ (inr (inr (succ-ℕ n))) l (mul-ℤ (inr (inr n)) l)))))\n\nright-predecessor-law-mul-ℤ :\n (k l : ℤ) → Id (mul-ℤ k (pred-ℤ l)) (add-ℤ (neg-ℤ k) (mul-ℤ k l))\nright-predecessor-law-mul-ℤ (inl zero-ℕ) l =\n ( left-neg-unit-law-mul-ℤ (pred-ℤ l)) ∙\n ( neg-pred-ℤ l)\nright-predecessor-law-mul-ℤ (inl (succ-ℕ n)) l =\n ( left-predecessor-law-mul-ℤ (inl n) (pred-ℤ l)) ∙\n ( ( ap (add-ℤ (neg-ℤ (pred-ℤ l))) (right-predecessor-law-mul-ℤ (inl n) l)) ∙\n ( ( inv\n ( associative-add-ℤ (neg-ℤ (pred-ℤ l)) (in-pos n) (mul-ℤ (inl n) l))) ∙\n ( ( ap\n ( λ t → add-ℤ t (mul-ℤ (inl n) l))\n { x = add-ℤ (neg-ℤ (pred-ℤ l)) (inr (inr n))}\n { y = add-ℤ (neg-ℤ (inl (succ-ℕ n))) (neg-ℤ l)}\n ( ( ap (λ t → add-ℤ t (in-pos n)) (neg-pred-ℤ l)) ∙\n ( ( left-successor-law-add-ℤ (neg-ℤ l) (in-pos n)) ∙\n ( ( ap succ-ℤ (commutative-add-ℤ (neg-ℤ l) (in-pos n))) ∙\n ( inv (left-successor-law-add-ℤ (in-pos n) (neg-ℤ l))))))) ∙\n ( associative-add-ℤ (in-pos (succ-ℕ n)) (neg-ℤ l) (mul-ℤ (inl n) l)))))\nright-predecessor-law-mul-ℤ (inr (inl star)) l = refl\nright-predecessor-law-mul-ℤ (inr (inr zero-ℕ)) l = refl\nright-predecessor-law-mul-ℤ (inr (inr (succ-ℕ n))) l =\n ( left-successor-law-mul-ℤ (in-pos n) (pred-ℤ l)) ∙\n ( ( ap (add-ℤ (pred-ℤ l)) (right-predecessor-law-mul-ℤ (inr (inr n)) l)) ∙\n ( ( inv (associative-add-ℤ (pred-ℤ l) (inl n) (mul-ℤ (inr (inr n)) l))) ∙\n ( ( ap\n ( λ t → add-ℤ t (mul-ℤ (in-pos n) l))\n { x = add-ℤ (pred-ℤ l) (inl n)}\n { y = add-ℤ (neg-ℤ (in-pos (succ-ℕ n))) l}\n ( ( left-predecessor-law-add-ℤ l (inl n)) ∙\n ( ( ap pred-ℤ (commutative-add-ℤ l (inl n))) ∙\n ( inv (left-predecessor-law-add-ℤ (inl n) l))))) ∙\n ( associative-add-ℤ (inl (succ-ℕ n)) l (mul-ℤ (inr (inr n)) l)))))\n\nright-distributive-mul-add-ℤ :\n (k l m : ℤ) → Id (mul-ℤ (add-ℤ k l) m) (add-ℤ (mul-ℤ k m) (mul-ℤ l m))\nright-distributive-mul-add-ℤ (inl zero-ℕ) l m =\n ( left-predecessor-law-mul-ℤ l m) ∙\n ( ap\n ( λ t → add-ℤ t (mul-ℤ l m))\n ( inv\n ( ( left-predecessor-law-mul-ℤ zero-ℤ m) ∙\n ( right-unit-law-add-ℤ (neg-ℤ m)))))\nright-distributive-mul-add-ℤ (inl (succ-ℕ x)) l m =\n ( left-predecessor-law-mul-ℤ (add-ℤ (inl x) l) m) ∙\n ( ( ap (add-ℤ (neg-ℤ m)) (right-distributive-mul-add-ℤ (inl x) l m)) ∙\n ( inv (associative-add-ℤ (neg-ℤ m) (mul-ℤ (inl x) m) (mul-ℤ l m))))\nright-distributive-mul-add-ℤ (inr (inl star)) l m = refl\nright-distributive-mul-add-ℤ (inr (inr zero-ℕ)) l m =\n left-successor-law-mul-ℤ l m\nright-distributive-mul-add-ℤ (inr (inr (succ-ℕ n))) l m =\n ( left-successor-law-mul-ℤ (add-ℤ (in-pos n) l) m) ∙\n ( ( ap (add-ℤ m) (right-distributive-mul-add-ℤ (inr (inr n)) l m)) ∙\n ( inv (associative-add-ℤ m (mul-ℤ (in-pos n) m) (mul-ℤ l m))))\n\nleft-negative-law-mul-ℤ :\n (k l : ℤ) → Id (mul-ℤ (neg-ℤ k) l) (neg-ℤ (mul-ℤ k l))\nleft-negative-law-mul-ℤ (inl zero-ℕ) l =\n ( left-unit-law-mul-ℤ l) ∙\n ( inv (neg-neg-ℤ l))\nleft-negative-law-mul-ℤ (inl (succ-ℕ n)) l =\n ( ap (λ t → mul-ℤ t l) (neg-pred-ℤ (inl n))) ∙\n ( ( left-successor-law-mul-ℤ (neg-ℤ (inl n)) l) ∙\n ( ( ap (add-ℤ l) (left-negative-law-mul-ℤ (inl n) l)) ∙\n ( right-negative-law-add-ℤ l (mul-ℤ (inl n) l))))\nleft-negative-law-mul-ℤ (inr (inl star)) l = refl\nleft-negative-law-mul-ℤ (inr (inr zero-ℕ)) l = refl\nleft-negative-law-mul-ℤ (inr (inr (succ-ℕ n))) l =\n ( left-predecessor-law-mul-ℤ (inl n) l) ∙\n ( ( ap (add-ℤ (neg-ℤ l)) (left-negative-law-mul-ℤ (inr (inr n)) l)) ∙\n ( inv (distributive-neg-add-ℤ l (mul-ℤ (in-pos n) l))))\n\nassociative-mul-ℤ :\n (k l m : ℤ) → Id (mul-ℤ (mul-ℤ k l) m) (mul-ℤ k (mul-ℤ l m))\nassociative-mul-ℤ (inl zero-ℕ) l m =\n left-negative-law-mul-ℤ l m\nassociative-mul-ℤ (inl (succ-ℕ n)) l m =\n ( right-distributive-mul-add-ℤ (neg-ℤ l) (mul-ℤ (inl n) l) m) ∙\n ( ( ap (add-ℤ (mul-ℤ (neg-ℤ l) m)) (associative-mul-ℤ (inl n) l m)) ∙\n ( ap\n ( λ t → add-ℤ t (mul-ℤ (inl n) (mul-ℤ l m)))\n ( left-negative-law-mul-ℤ l m)))\nassociative-mul-ℤ (inr (inl star)) l m = refl\nassociative-mul-ℤ (inr (inr zero-ℕ)) l m = refl\nassociative-mul-ℤ (inr (inr (succ-ℕ n))) l m =\n ( right-distributive-mul-add-ℤ l (mul-ℤ (in-pos n) l) m) ∙\n ( ap (add-ℤ (mul-ℤ l m)) (associative-mul-ℤ (inr (inr n)) l m))\n\ncommutative-mul-ℤ :\n (k l : ℤ) → Id (mul-ℤ k l) (mul-ℤ l k)\ncommutative-mul-ℤ (inl zero-ℕ) l = inv (right-neg-unit-law-mul-ℤ l)\ncommutative-mul-ℤ (inl (succ-ℕ n)) l =\n ( ap (add-ℤ (neg-ℤ l)) (commutative-mul-ℤ (inl n) l)) ∙\n ( inv (right-predecessor-law-mul-ℤ l (inl n)))\ncommutative-mul-ℤ (inr (inl star)) l = inv (right-zero-law-mul-ℤ l)\ncommutative-mul-ℤ (inr (inr zero-ℕ)) l = inv (right-unit-law-mul-ℤ l)\ncommutative-mul-ℤ (inr (inr (succ-ℕ n))) l =\n ( ap (add-ℤ l) (commutative-mul-ℤ (inr (inr n)) l)) ∙\n ( inv (right-successor-law-mul-ℤ l (in-pos n)))\n", "meta": {"hexsha": "38ab03b1d54a573dbe12eac1de6edf820fed992d", "size": 27492, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/05-identity-types.agda", "max_stars_repo_name": "hemangandhi/HoTT-Intro", "max_stars_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Agda/05-identity-types.agda", "max_issues_repo_name": "hemangandhi/HoTT-Intro", "max_issues_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/05-identity-types.agda", "max_forks_repo_name": "hemangandhi/HoTT-Intro", "max_forks_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.001345895, "max_line_length": 81, "alphanum_fraction": 0.5621999127, "num_tokens": 12417, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8596637577007394, "lm_q2_score": 0.8056321983146848, "lm_q1q2_score": 0.6925728029279092}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Explaining how to use the inspect idiom and elaborating on the way\n-- it is implemented in the standard library.\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule README.Inspect where\n\nopen import Data.Nat.Base\nopen import Data.Nat.Properties\nopen import Data.Product\nopen import Relation.Binary.PropositionalEquality\n\n------------------------------------------------------------------------\n-- Using inspect\n\n-- We start with the definition of a (silly) predicate: `Plus m n p` states\n-- that `m + n` is equal to `p` in a rather convoluted way. Crucially, it\n-- distinguishes two cases: whether `p` is 0 or not.\n\nPlus-eq : (m n p : ℕ) → Set\nPlus-eq m n zero = m ≡ 0 × n ≡ 0\nPlus-eq m n p@(suc _) = m + n ≡ p\n\n-- A sensible lemma to prove of this predicate is that whenever `p` is literally\n-- `m + n` then `Plus m n p` holds. That is to say `∀ m n → Plus m n (m + n)`.\n-- To be able to prove `Plus-eq m n (m + n)`, we need `m + n` to have either\n-- the shape `zero` or `suc _` so that `Plus-eq` may reduce.\n\n-- We could follow the way `_+_` computes by mimicking the same splitting\n-- strategy, thus forcing `m + n` to reduce:\n\nplus-eq-+ : ∀ m n → Plus-eq m n (m + n)\nplus-eq-+ zero zero = refl , refl\nplus-eq-+ zero (suc n) = refl\nplus-eq-+ (suc m) n = refl\n\n-- Or we could attempt to compute `m + n` first and check whether the result\n-- is `zero` or `suc p`. By using `with m + n` and naming the result `p`,\n-- the goal will become `Plus-eq m n p`. We can further refine this definition\n-- by distinguishing two cases like so:\n\n-- plus-eq-with : ∀ m n → Plus-eq m n (m + n)\n-- plus-eq-with m n with m + n\n-- ... | zero = {!!}\n-- ... | suc p = {!!}\n\n-- The problem however is that we have abolutely lost the connection between the\n-- computation `m + n` and its result `p`. Which makes the two goals unprovable:\n\n-- 1. `m ≡ 0 × n ≡ 0`, with no assumption whatsoever\n-- 2. `m + n ≡ suc p`, with no assumption either\n\n-- By using the `with` construct, we have generated an auxiliary function that\n-- looks like this:\n-- `plus-eq-with-aux : ∀ m n p → Plus-eq m n p`\n-- when we would have wanted a more precise type of the form:\n-- `plus-eq-aux : ∀ m n p → m + n ≡ p → Plus-eq m n p`.\n\n-- This is where we can use `inspect`. By using `with f x | inspect f x`,\n-- we get both a `y` which is the result of `f x` and a proof that `f x ≡ y`.\n-- Splitting on the result of `m + n`, we get two cases:\n\n-- 1. `m ≡ 0 × n ≡ 0` under the assumption that `m + n ≡ zero`\n-- 2. `m + n ≡ suc p` under the assumption that `m + n ≡ suc p`\n\n-- The first one can be discharged using lemmas from Data.Nat.Properties and\n-- the second one is trivial.\n\nplus-eq-with : ∀ m n → Plus-eq m n (m + n)\nplus-eq-with m n with m + n | inspect (m +_) n\n... | zero | [ m+n≡0 ] = m+n≡0⇒m≡0 m m+n≡0 , m+n≡0⇒n≡0 m m+n≡0\n... | suc p | [ m+n≡1+p ] = m+n≡1+p\n\n\n------------------------------------------------------------------------\n-- Understanding the implementation of inspect\n\n-- So why is it that we have to go through the record type `Reveal_·_is_`\n-- and the ̀inspect` function? The fact is: we don't have to if we write\n-- our own auxiliary lemma:\n\nplus-eq-aux : ∀ m n → Plus-eq m n (m + n)\nplus-eq-aux m n = aux m n (m + n) refl where\n\n aux : ∀ m n p → m + n ≡ p → Plus-eq m n p\n aux m n zero m+n≡0 = m+n≡0⇒m≡0 m m+n≡0 , m+n≡0⇒n≡0 m m+n≡0\n aux m n (suc p) m+n≡1+p = m+n≡1+p\n\n-- The problem is that when we write ̀with f x | pr`, `with` decides to call `y`\n-- the result `f x` and to replace *all* of the occurences of `f x` in the type\n-- of `pr` with `y`. That is to say that if we were to write:\n\n-- plus-eq-naïve : ∀ m n → Plus-eq m n (m + n)\n-- plus-eq-naïve m n with m + n | refl {x = m + n}\n-- ... | p | eq = {!!}\n\n-- then `with` would abstract `m + n` as `p` on *both* sides of the equality\n-- proven by `refl` thus giving us the following goal with an extra, useless,\n-- assumption:\n\n-- 1. `Plus-eq m n p` under the assumption that `p ≡ p`\n\n-- So how does `inspect` work? The standard library uses a more general version\n-- of the following type and function:\n\nrecord MyReveal_·_is_ (f : ℕ → ℕ) (x y : ℕ) : Set where\n constructor [_]\n field eq : f x ≡ y\n\nmy-inspect : ∀ f n → MyReveal f · n is (f n)\nmy-inspect f n = [ refl ]\n\n-- Given that `inspect` has the type `∀ f n → Reveal f · n is (f n)`, when we\n-- write `with f n | inspect f n`, the only `f n` that can be abstracted in the\n-- type of `inspect f n` is the third argument to `Reveal_·_is_`.\n\n-- That is to say that the auxiliary definition generated looks like this:\n\nplus-eq-reveal : ∀ m n → Plus-eq m n (m + n)\nplus-eq-reveal m n = aux m n (m + n) (my-inspect (m +_) n) where\n\n aux : ∀ m n p → MyReveal (m +_) · n is p → Plus-eq m n p\n aux m n zero [ m+n≡0 ] = m+n≡0⇒m≡0 m m+n≡0 , m+n≡0⇒n≡0 m m+n≡0\n aux m n (suc p) [ m+n≡1+p ] = m+n≡1+p\n\n-- At the cost of having to unwrap the constructor `[_]` around the equality\n-- we care about, we can keep relying on `with` and avoid having to roll out\n-- handwritten auxiliary definitions.\n", "meta": {"hexsha": "22f11e5d4db856fbe41b387b626c1fe95a4db081", "size": 5186, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/README/Inspect.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/README/Inspect.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/README/Inspect.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 38.992481203, "max_line_length": 80, "alphanum_fraction": 0.5906286155, "num_tokens": 1706, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8289388083214156, "lm_q2_score": 0.8354835289107309, "lm_q1q2_score": 0.6925647208274323}} {"text": "module Prelude.Nat where\n\nopen import Prelude.Bool\n\ndata Nat : Set where\n Z : Nat\n S : Nat -> Nat\n\n{-# BUILTIN NATURAL Nat #-}\n\ninfixl 30 _+_\n\n_+_ : Nat -> Nat -> Nat\nZ + m = m\nS n + m = S (n + m)\n\n{-# BUILTIN NATPLUS _+_ #-}\n\n_*_ : Nat -> Nat -> Nat\nZ * m = Z\nS n * m = (n * m) + m\n\n{-# BUILTIN NATTIMES _*_ #-}\n\n_-_ : Nat -> Nat -> Nat\nn - Z = n\n(S n) - (S m) = n - m\nZ - _ = Z\n\n{-# BUILTIN NATMINUS _-_ #-}\n\n_<_ : Nat -> Nat -> Bool\n_ < Z = false\nZ < S _ = true\nS n < S m = n < m\n\n-- {-# BUILTIN NATLESS _<_ #-}\n\nNid : Nat -> Bool -> Bool\nNid Z true = true\nNid Z false = false\nNid (S n) m = (Nid n ( m))\n\n-- {-# BUILTIN NATEQUALS __ #-}\n", "meta": {"hexsha": "943ae290a83b17a53b60723a9caeb04ca91bbbbb", "size": 682, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/epic/Prelude/Nat.agda", "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/epic/Prelude/Nat.agda", "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/epic/Prelude/Nat.agda", "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 15.1555555556, "max_line_length": 31, "alphanum_fraction": 0.4765395894, "num_tokens": 262, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9207896715436483, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6924454107889774}} {"text": "{-\nThis second-order equational theory was created from the following second-order syntax description:\n\nsyntax GroupAction | GA\n\ntype\n * : 0-ary\n X : 0-ary\n\nterm\n unit : * | ε\n add : * * -> * | _⊕_ l20\n neg : * -> * | ⊖_ r40\n act : * X -> X | _⊙_ r30\n\ntheory\n (εU⊕ᴸ) a |> add (unit, a) = a\n (εU⊕ᴿ) a |> add (a, unit) = a\n (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c))\n (⊖N⊕ᴸ) a |> add (neg (a), a) = unit\n (⊖N⊕ᴿ) a |> add (a, neg (a)) = unit\n (εU⊙) x : X |> act (unit, x) = x\n (⊕A⊙) g h x : X |> act (add(g, h), x) = act (g, act(h, x))\n-}\n\nmodule GroupAction.Equality where\n\nopen import SOAS.Common\nopen import SOAS.Context\nopen import SOAS.Variable\nopen import SOAS.Families.Core\nopen import SOAS.Families.Build\nopen import SOAS.ContextMaps.Inductive\n\nopen import GroupAction.Signature\nopen import GroupAction.Syntax\n\nopen import SOAS.Metatheory.SecondOrder.Metasubstitution GA:Syn\nopen import SOAS.Metatheory.SecondOrder.Equality GA:Syn\n\nprivate\n variable\n α β γ τ : GAT\n Γ Δ Π : Ctx\n\ninfix 1 _▹_⊢_≋ₐ_\n\n-- Axioms of equality\ndata _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ GA) α Γ → (𝔐 ▷ GA) α Γ → Set where\n εU⊕ᴸ : ⁅ * ⁆̣ ▹ ∅ ⊢ ε ⊕ 𝔞 ≋ₐ 𝔞\n εU⊕ᴿ : ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ ε ≋ₐ 𝔞\n ⊕A : ⁅ * ⁆ ⁅ * ⁆ ⁅ * ⁆̣ ▹ ∅ ⊢ (𝔞 ⊕ 𝔟) ⊕ 𝔠 ≋ₐ 𝔞 ⊕ (𝔟 ⊕ 𝔠)\n ⊖N⊕ᴸ : ⁅ * ⁆̣ ▹ ∅ ⊢ (⊖ 𝔞) ⊕ 𝔞 ≋ₐ ε\n ⊖N⊕ᴿ : ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ (⊖ 𝔞) ≋ₐ ε\n εU⊙ : ⁅ X ⁆̣ ▹ ∅ ⊢ ε ⊙ 𝔞 ≋ₐ 𝔞\n ⊕A⊙ : ⁅ * ⁆ ⁅ * ⁆ ⁅ X ⁆̣ ▹ ∅ ⊢ (𝔞 ⊕ 𝔟) ⊙ 𝔠 ≋ₐ 𝔞 ⊙ (𝔟 ⊙ 𝔠)\n\nopen EqLogic _▹_⊢_≋ₐ_\nopen ≋-Reasoning\n", "meta": {"hexsha": "7b7f18189796e68119f61d1b7b1cc1146d8f943f", "size": 1562, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/GroupAction/Equality.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/GroupAction/Equality.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/GroupAction/Equality.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 26.0333333333, "max_line_length": 99, "alphanum_fraction": 0.4967989757, "num_tokens": 847, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9136765257642906, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.6923789333877406}} {"text": "\nmodule Lookup where\n\ndata Bool : Set where\n false : Bool\n true : Bool\n\ndata IsTrue : Bool -> Set where\n isTrue : IsTrue true\n\ndata List (A : Set) : Set where\n [] : List A\n _::_ : A -> List A -> List A\n\ndata _×_ (A B : Set) : Set where\n _,_ : A -> B -> A × B\n\nmodule Map\n (Key : Set)\n (_==_ : Key -> Key -> Bool)\n (Code : Set)\n (Val : Code -> Set) where\n\n infixr 40 _⟼_,_\n infix 20 _∈_\n\n data Map : List Code -> Set where\n ε : Map []\n _⟼_,_ : forall {c cs} ->\n Key -> Val c -> Map cs -> Map (c :: cs)\n\n _∈_ : forall {cs} -> Key -> Map cs -> Bool\n k ∈ ε = false\n k ∈ (k' ⟼ _ , m) with k == k'\n ... | true = true\n ... | false = k ∈ m\n\n Lookup : forall {cs} -> (k : Key)(m : Map cs) -> IsTrue (k ∈ m) -> Set\n Lookup k ε ()\n Lookup k (_⟼_,_ {c} k' _ m) p with k == k'\n ... | true = Val c\n ... | false = Lookup k m p\n\n lookup : {cs : List Code}(k : Key)(m : Map cs)(p : IsTrue (k ∈ m)) ->\n Lookup k m p\n lookup k ε ()\n lookup k (k' ⟼ v , m) p with k == k'\n ... | true = v\n ... | false = lookup k m p", "meta": {"hexsha": "7a95d920f432f11566f575675375514294ca1677", "size": 1099, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/Lookup.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/Lookup.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/Lookup.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.4285714286, "max_line_length": 72, "alphanum_fraction": 0.4595086442, "num_tokens": 407, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9136765210631689, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.692378924827465}} {"text": "module Dave.Structures.Monoid where\n open import Dave.Structures.Semigroup public\n\n record Identity {A : Set} (_·_ : op₂ A) (e : A) : Set where\n field\n left : left-identity _·_ e\n right : right-identity _·_ e\n\n record IsMonoid {A : Set} (_·_ : op₂ A) (e : A) : Set where\n field\n semigroup : IsSemigroup _·_\n identity : Identity _·_ e\n \n record Monoid : Set₁ where\n field\n Carrier : Set\n _·_ : op₂ Carrier\n e : Carrier\n isMonoid : IsMonoid _·_ e \n\n record IsCommutativeMonoid {A : Set} (_·_ : op₂ A) (e : A) : Set where\n field\n isSemigroup : IsSemigroup _·_\n leftIdentity : left-identity _·_ e\n comm : commutative _·_ \n\n rightIdentity : right-identity _·_ e\n rightIdentity m = begin\n m · e ≡⟨ comm m e ⟩\n e · m ≡⟨ leftIdentity m ⟩\n m ∎\n\n identity : Identity _·_ e\n Identity.left identity = leftIdentity\n Identity.right identity = rightIdentity\n\n isMonoid : IsMonoid _·_ e\n IsMonoid.semigroup isMonoid = isSemigroup\n IsMonoid.identity isMonoid = identity\n\n swap021 : ∀ (m n p : A) → (m · n) · p ≡ (m · p) · n\n swap021 m n p = begin\n (m · n) · p ≡⟨ IsSemigroup.assoc isSemigroup m n p ⟩\n m · (n · p) ≡⟨ cong (λ a → m · a) (comm n p) ⟩\n m · (p · n) ≡⟨ sym (IsSemigroup.assoc isSemigroup m p n) ⟩\n (m · p) · n ∎\n\n swap102 : ∀ (m n p : A) → (m · n) · p ≡ (n · m) · p\n swap102 m n p = begin\n (m · n) · p ≡⟨ cong (λ a → a · p) (comm m n) ⟩\n (n · m) · p ∎\n\n swap120 : ∀ (m n p : A) → (m · n) · p ≡ (n · m) · p\n swap120 m n p = begin \n (m · n) · p ≡⟨ cong (λ a → a · p) (comm m n) ⟩ \n (n · m) · p ∎\n\n swap210 : ∀ (m n p : A) → (m · n) · p ≡ (p · n) · m\n swap210 m n p = begin\n (m · n) · p ≡⟨ comm (m · n) p ⟩\n p · (m · n) ≡⟨ cong (λ a → p · a) (comm m n) ⟩\n p · (n · m) ≡⟨ sym (IsSemigroup.assoc isSemigroup p n m) ⟩\n (p · n) · m ∎\n\n swap201 : ∀ (m n p : A) → (m · n) · p ≡ (p · m) · n\n swap201 m n p = begin\n (m · n) · p ≡⟨ comm (m · n) p ⟩\n p · (m · n) ≡⟨ sym (IsSemigroup.assoc isSemigroup p m n) ⟩\n (p · m) · n ∎\n\n record CommutativeMonoid : Set₁ where\n field\n Carrier : Set\n _·_ : op₂ Carrier\n e : Carrier\n isCommutativeMonoid : IsCommutativeMonoid _·_ e ", "meta": {"hexsha": "38ecb7e232fb7aba6f33c6cae7a4c27925ec76ee", "size": 2614, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Dave/Structures/Monoid.agda", "max_stars_repo_name": "DavidStahl97/formal-proofs", "max_stars_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Dave/Structures/Monoid.agda", "max_issues_repo_name": "DavidStahl97/formal-proofs", "max_issues_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Dave/Structures/Monoid.agda", "max_forks_repo_name": "DavidStahl97/formal-proofs", "max_forks_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.3947368421, "max_line_length": 74, "alphanum_fraction": 0.4506503443, "num_tokens": 920, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.913676530465412, "lm_q2_score": 0.757794360334681, "lm_q1q2_score": 0.6923789219568475}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Properties of functions, such as associativity and commutativity\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Level\nopen import Relation.Binary\nopen import Data.Sum\n\n-- The properties are parameterised by the following \"equality\" relation\n\nmodule Algebra.FunctionProperties\n {a ℓ} {A : Set a} (_≈_ : Rel A ℓ) where\n\nopen import Data.Product\n\n------------------------------------------------------------------------\n-- Unary and binary operations\n\nopen import Algebra.FunctionProperties.Core public\n\n------------------------------------------------------------------------\n-- Properties of operations\n\nAssociative : Op₂ A → Set _\nAssociative _∙_ = ∀ x y z → ((x ∙ y) ∙ z) ≈ (x ∙ (y ∙ z))\n\nCommutative : Op₂ A → Set _\nCommutative _∙_ = ∀ x y → (x ∙ y) ≈ (y ∙ x)\n\nLeftIdentity : A → Op₂ A → Set _\nLeftIdentity e _∙_ = ∀ x → (e ∙ x) ≈ x\n\nRightIdentity : A → Op₂ A → Set _\nRightIdentity e _∙_ = ∀ x → (x ∙ e) ≈ x\n\nIdentity : A → Op₂ A → Set _\nIdentity e ∙ = (LeftIdentity e ∙) × (RightIdentity e ∙)\n\nLeftZero : A → Op₂ A → Set _\nLeftZero z _∙_ = ∀ x → (z ∙ x) ≈ z\n\nRightZero : A → Op₂ A → Set _\nRightZero z _∙_ = ∀ x → (x ∙ z) ≈ z\n\nZero : A → Op₂ A → Set _\nZero z ∙ = (LeftZero z ∙) × (RightZero z ∙)\n\nLeftInverse : A → Op₁ A → Op₂ A → Set _\nLeftInverse e _⁻¹ _∙_ = ∀ x → ((x ⁻¹) ∙ x) ≈ e\n\nRightInverse : A → Op₁ A → Op₂ A → Set _\nRightInverse e _⁻¹ _∙_ = ∀ x → (x ∙ (x ⁻¹)) ≈ e\n\nInverse : A → Op₁ A → Op₂ A → Set _\nInverse e ⁻¹ ∙ = (LeftInverse e ⁻¹) ∙ × (RightInverse e ⁻¹ ∙)\n\nLeftConical : A → Op₂ A → Set _\nLeftConical e _∙_ = ∀ x y → (x ∙ y) ≈ e → x ≈ e\n\nRightConical : A → Op₂ A → Set _\nRightConical e _∙_ = ∀ x y → (x ∙ y) ≈ e → y ≈ e\n\nConical : A → Op₂ A → Set _\nConical e ∙ = (LeftConical e ∙) × (RightConical e ∙)\n\n_DistributesOverˡ_ : Op₂ A → Op₂ A → Set _\n_*_ DistributesOverˡ _+_ =\n ∀ x y z → (x * (y + z)) ≈ ((x * y) + (x * z))\n\n_DistributesOverʳ_ : Op₂ A → Op₂ A → Set _\n_*_ DistributesOverʳ _+_ =\n ∀ x y z → ((y + z) * x) ≈ ((y * x) + (z * x))\n\n_DistributesOver_ : Op₂ A → Op₂ A → Set _\n* DistributesOver + = (* DistributesOverˡ +) × (* DistributesOverʳ +)\n\n_IdempotentOn_ : Op₂ A → A → Set _\n_∙_ IdempotentOn x = (x ∙ x) ≈ x\n\nIdempotent : Op₂ A → Set _\nIdempotent ∙ = ∀ x → ∙ IdempotentOn x\n\nIdempotentFun : Op₁ A → Set _\nIdempotentFun f = ∀ x → f (f x) ≈ f x\n\nSelective : Op₂ A → Set _\nSelective _∙_ = ∀ x y → (x ∙ y) ≈ x ⊎ (x ∙ y) ≈ y\n\n_Absorbs_ : Op₂ A → Op₂ A → Set _\n_∙_ Absorbs _∘_ = ∀ x y → (x ∙ (x ∘ y)) ≈ x\n\nAbsorptive : Op₂ A → Op₂ A → Set _\nAbsorptive ∙ ∘ = (∙ Absorbs ∘) × (∘ Absorbs ∙)\n\nInvolutive : Op₁ A → Set _\nInvolutive f = ∀ x → f (f x) ≈ x\n\nLeftCancellative : Op₂ A → Set _\nLeftCancellative _•_ = ∀ x {y z} → (x • y) ≈ (x • z) → y ≈ z\n\nRightCancellative : Op₂ A → Set _\nRightCancellative _•_ = ∀ {x} y z → (y • x) ≈ (z • x) → y ≈ z\n\nCancellative : Op₂ A → Set _\nCancellative _•_ = (LeftCancellative _•_) × (RightCancellative _•_)\n\nCongruent₁ : Op₁ A → Set _\nCongruent₁ f = f Preserves _≈_ ⟶ _≈_\n\nCongruent₂ : Op₂ A → Set _\nCongruent₂ ∙ = ∙ Preserves₂ _≈_ ⟶ _≈_ ⟶ _≈_\n\nLeftCongruent : Op₂ A → Set _\nLeftCongruent _∙_ = ∀ {x} → (x ∙_) Preserves _≈_ ⟶ _≈_\n\nRightCongruent : Op₂ A → Set _\nRightCongruent _∙_ = ∀ {x} → (_∙ x) Preserves _≈_ ⟶ _≈_\n", "meta": {"hexsha": "84957b40c4a25a39e2458f4c62c9e0e86b2210f9", "size": 3361, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Algebra/FunctionProperties.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Algebra/FunctionProperties.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Algebra/FunctionProperties.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.5491803279, "max_line_length": 72, "alphanum_fraction": 0.5397203213, "num_tokens": 1299, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869948899666, "lm_q2_score": 0.7905303236047049, "lm_q1q2_score": 0.6923361764791574}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Functor.Representable where\n\n-- A Presheaf (into Setoids) is representation if it is naturally isomorphic to a Hom functor\n-- over a particular object A of the base category.\nopen import Level\n\nopen import Categories.Category using (Category)\nopen import Categories.Category.Instance.Setoids\nopen import Categories.Functor using (Functor)\nopen import Categories.Functor.Hom\nopen import Categories.Functor.Presheaf\nopen import Categories.NaturalTransformation.NaturalIsomorphism\n\nrecord Representable {o ℓ e} {C : Category o ℓ e} (F : Presheaf C (Setoids ℓ e)) : Set (o ⊔ suc ℓ ⊔ suc e ) where\n open Category C\n open Hom C\n field\n A : Obj\n Iso : NaturalIsomorphism F Hom[-, A ]\n", "meta": {"hexsha": "56f3630c38ec838d02f31100b9ead771c8ecacd4", "size": 740, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Representable.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Functor/Representable.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Functor/Representable.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.2380952381, "max_line_length": 113, "alphanum_fraction": 0.7581081081, "num_tokens": 195, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.939024825960626, "lm_q2_score": 0.737158174177441, "lm_q1q2_score": 0.6922098262124243}} {"text": "{-# OPTIONS --sized-types #-}\nopen import Relation.Binary.Core\n\nmodule Quicksort.Correctness.Permutation {A : Set}\n (_≤_ : A → A → Set)\n (tot≤ : Total _≤_) where\n\nopen import Bound.Total A\nopen import Bound.Total.Order _≤_\nopen import Data.List\nopen import Data.Product\nopen import Data.Sum\nopen import List.Permutation.Base A\nopen import List.Permutation.Base.Concatenation A\nopen import List.Permutation.Base.Equivalence A\nopen import List.Permutation.Pair A\nopen import List.Permutation.Pair.Properties A\nopen import Quicksort _≤_ tot≤\nopen import SBList _≤_\nopen import SBList.Properties _≤_\nopen import Size\nopen import SOList.Total _≤_\n\nlemma-deal : {ι : Size}{b t : Bound}{x : A} → (b≤x : LeB b (val x)) → (x≤t : LeB (val x) t) → (xs : SBList {ι} b t) → unbound xs ≈ unbound× (deal b≤x x≤t xs)\nlemma-deal _ _ (nil _) = ≈[]r []\nlemma-deal {x = x} b≤x x≤t (cons y b≤y y≤t ys) \n with tot≤ x y \n... | inj₁ x≤y = ≈xr (lemma-deal b≤x x≤t ys)\n... | inj₂ y≤x = ≈xl (lemma-deal b≤x x≤t ys)\n\nlemma-quickSort : {ι : Size}{b t : Bound}(xs : SBList {ι} b t) → unbound xs ∼ forget (quickSort xs)\nlemma-quickSort (nil _) = ∼[]\nlemma-quickSort (cons x b≤x x≤t xs) = trans∼ (lemma≈∼ (≈xr (lemma-deal b≤x x≤t xs))) (lemma++∼ (lemma-quickSort ys) (∼x /head /head (lemma-quickSort zs)))\n where yszs = deal b≤x x≤t xs\n ys = proj₁ yszs\n zs = proj₂ yszs\n\ntheorem-quickSort∼ : (xs : List A) → xs ∼ forget (quickSort (bound xs))\ntheorem-quickSort∼ xs = trans∼ (lemma-unbound-bound xs) (lemma-quickSort (bound xs))\n\n", "meta": {"hexsha": "0a7022d3189a91bcc395fad9c50eb33b314a7558", "size": 1592, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Quicksort/Correctness/Permutation.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/Quicksort/Correctness/Permutation.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Quicksort/Correctness/Permutation.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.8292682927, "max_line_length": 157, "alphanum_fraction": 0.6344221106, "num_tokens": 571, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942171172603, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.6921886212343535}} {"text": "-- imports\nopen import Data.Nat as ℕ using (ℕ; suc; zero; _+_; _∸_)\nopen import Data.Vec as Vec using (Vec; _∷_; []; tabulate; foldr)\nopen import Data.Fin as Fin using (Fin; suc; zero)\nopen import Function using (_∘_; const; id)\nopen import Data.List as List using (List; _∷_; [])\nopen import Data.Maybe using (Maybe; just; nothing)\n\n-- Without square cutoff optimization\nmodule Simple where\n primes : ∀ n → List (Fin n)\n primes zero = []\n primes (suc zero) = []\n primes (suc (suc zero)) = []\n primes (suc (suc (suc m))) = sieve (tabulate (just ∘ suc))\n where\n sieve : ∀ {n} → Vec (Maybe (Fin (2 + m))) n → List (Fin (3 + m))\n sieve [] = []\n sieve (nothing ∷ xs) = sieve xs\n sieve (just x ∷ xs) = suc x ∷ sieve (foldr B remove (const []) xs x)\n where\n B = λ n → ∀ {i} → Fin i → Vec (Maybe (Fin (2 + m))) n\n\n remove : ∀ {n} → Maybe (Fin (2 + m)) → B n → B (suc n)\n remove _ ys zero = nothing ∷ ys x\n remove y ys (suc z) = y ∷ ys z\n\n-- With square cutoff optimization\nmodule SquareOpt where\n primes : ∀ n → List (Fin n)\n primes zero = []\n primes (suc zero) = []\n primes (suc (suc zero)) = []\n primes (suc (suc (suc m))) = sieve 1 m (Vec.tabulate (just ∘ Fin.suc ∘ Fin.suc))\n where\n sieve : ∀ {n} → ℕ → ℕ → Vec (Maybe (Fin (3 + m))) n → List (Fin (3 + m))\n sieve _ zero = List.mapMaybe id ∘ Vec.toList\n sieve _ (suc _) [] = []\n sieve i (suc l) (nothing ∷ xs) = sieve (suc i) (l ∸ i ∸ i) xs\n sieve i (suc l) (just x ∷ xs) = x ∷ sieve (suc i) (l ∸ i ∸ i) (Vec.foldr B remove (const []) xs i)\n where\n B = λ n → ℕ → Vec (Maybe (Fin (3 + m))) n\n\n remove : ∀ {i} → Maybe (Fin (3 + m)) → B i → B (suc i)\n remove _ ys zero = nothing ∷ ys i\n remove y ys (suc j) = y ∷ ys j\n", "meta": {"hexsha": "aa17f521e88209f8484cf153212f8f1c7e1d13bb", "size": 1810, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Task/Sieve-of-Eratosthenes/Agda/sieve-of-eratosthenes.agda", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-05-05T13:42:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-05T13:42:20.000Z", "max_issues_repo_path": "Task/Sieve-of-Eratosthenes/Agda/sieve-of-eratosthenes.agda", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Sieve-of-Eratosthenes/Agda/sieve-of-eratosthenes.agda", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.5106382979, "max_line_length": 103, "alphanum_fraction": 0.5342541436, "num_tokens": 640, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942171172604, "lm_q2_score": 0.7662936324115011, "lm_q1q2_score": 0.6921886067710886}} {"text": "{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- We can use a propositional equality parametrized on Set instead of\n-- using two \"different\" equalities on D and M.\n\nmodule LogicalFramework.SetEquality where\n\n-- We add 3 to the fixities of the Agda standard library 0.8.1 (see\n-- Relation/Binary/Core.agda).\ninfix 7 _≡D_ _≡M_\n\n------------------------------------------------------------------------------\n-- Domain universe D\npostulate\n D : Set\n\n-- Propositional equality on D.\ndata _≡D_ (x : D) : D → Set where\n refl : x ≡D x\n\n≡D-thm : ∀ {d e} → d ≡D e → e ≡D d\n≡D-thm refl = refl\n\n------------------------------------------------------------------------------\n-- Domain universe M\n\ndata M : Set where\n zero : M\n succ : M → M\n\n-- Propositional equality on M.\ndata _≡M_ (n : M) : M → Set where\n refl : n ≡M n\n\n≡M-thm : ∀ {m n} → m ≡M n → n ≡M m\n≡M-thm refl = refl\n\n------------------------------------------------------------------------------\n-- Propositional equality on Set.\n\ndata _≡_ {A : Set}(a : A) : A → Set where\n refl : a ≡ a\n\n≡-thm₁ : ∀ {d e : D} → d ≡ e → e ≡ d\n≡-thm₁ refl = refl\n\n≡-thm₂ : ∀ {m n : M} → m ≡ n → n ≡ m\n≡-thm₂ refl = refl\n", "meta": {"hexsha": "1126e2c20fa17217dfd892fb5ad2bdb5037a2d7b", "size": 1286, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/thesis/report/LogicalFramework/SetEquality.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/thesis/report/LogicalFramework/SetEquality.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/thesis/report/LogicalFramework/SetEquality.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 24.7307692308, "max_line_length": 78, "alphanum_fraction": 0.4688958009, "num_tokens": 394, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891305219504, "lm_q2_score": 0.8418256452674008, "lm_q1q2_score": 0.6921398953334841}} {"text": "module Numeral.Natural.TotalOper where\n\nimport Lvl\nopen import Logic.Propositional\nopen import Logic.Predicate\nopen import Numeral.Natural hiding (𝐏)\nopen import Numeral.Natural.Relation.Divisibility\nopen import Numeral.Natural.Relation.Divisibility.Proofs\nopen import Numeral.Natural.Relation\nopen import Numeral.Natural.Relation.Order\nopen import Numeral.Natural.Relation.Order.Proofs\nopen import Relator.Equals\nopen import Relator.Equals.Proofs\n\n-- Total predecessor function (Truncated predecessor)\n𝐏 : (n : ℕ) → ⦃ _ : Positive(n) ⦄ → ℕ\n𝐏(𝐒(n)) = n\n\n-- Total subtraction (Truncated subtraction)\n_−_ : (a : ℕ) → (b : ℕ) → ⦃ _ : a ≥ b ⦄ → ℕ\n_−_ a 𝟎 = a\n_−_ 𝟎 (𝐒(b)) ⦃ 0≥𝐒b ⦄ with ([<]-to-[≱] ([<]-minimum{b})) (0≥𝐒b)\n... | ()\n_−_ (𝐒(a)) (𝐒(b)) ⦃ 𝐒b≤𝐒a ⦄ = _−_ a b ⦃ [≤]-without-[𝐒] {b} (𝐒b≤𝐒a) ⦄\n\n-- Total division (Whole number division)\n_/₀_ : (a : ℕ) → (b : ℕ) → ⦃ _ : (b ∣ a) ⦄ → ℕ\n_/₀_ _ _ ⦃ div ⦄ = divides-quotient div\n", "meta": {"hexsha": "b1f244e4b17a32e4720101f0113a2af3587bb988", "size": 928, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/TotalOper.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/TotalOper.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/TotalOper.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.0, "max_line_length": 69, "alphanum_fraction": 0.6659482759, "num_tokens": 386, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9465966671870766, "lm_q2_score": 0.7310585727705127, "lm_q1q2_score": 0.6920176085031082}} {"text": "module Numeral.Sign.Oper where\n\nopen import Data.Boolean\nopen import Numeral.Sign\n\n-- Negation\n−_ : (+|−) → (+|−)\n− (➕) = (➖)\n− (➖) = (➕)\n\n-- Addition\n_+_ : (+|−) → (+|−) → (+|0|−)\n(➕) + (➕) = (➕)\n(➖) + (➖) = (➖)\n(➕) + (➖) = (𝟎)\n(➖) + (➕) = (𝟎)\n\n-- Multiplication\n_⨯_ : (+|−) → (+|−) → (+|−)\n(➕) ⨯ (➕) = (➕)\n(➖) ⨯ (➖) = (➕)\n(➕) ⨯ (➖) = (➖)\n(➖) ⨯ (➕) = (➖)\n\n_⋚_ : (+|−) → (+|−) → (+|0|−)\n➕ ⋚ ➕ = 𝟎\n➕ ⋚ ➖ = ➕\n➖ ⋚ ➕ = ➖\n➖ ⋚ ➖ = 𝟎\n", "meta": {"hexsha": "8dc6076a83f760bab98bfa72a7a48a51a7264021", "size": 427, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Sign/Oper.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Sign/Oper.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Sign/Oper.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 14.2333333333, "max_line_length": 30, "alphanum_fraction": 0.2599531616, "num_tokens": 293, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9715639694252316, "lm_q2_score": 0.7122321964553657, "lm_q1q2_score": 0.6919791399406265}} {"text": "module Dave.Isomorphism where\n open import Dave.Equality\n open import Dave.Functions\n\n infix 0 _≃_\n record _≃_ (A B : Set) : Set where\n field\n to : A → B\n from : B → A\n from∘to : ∀ (x : A) → from (to x) ≡ x\n to∘from : ∀ (x : B) → to (from x) ≡ x\n open _≃_\n\n {- Another way to define Isomporphism throug data -}\n data _≃′_ (A B : Set) : Set where\n mk-≃′ : ∀ (to : A → B) →\n ∀ (from : B → A) →\n ∀ (from∘to : (∀ (x : A) → from (to x) ≡ x)) →\n ∀ (to∘from : (∀ (y : B) → to (from y) ≡ y)) →\n A ≃′ B\n\n to′ : ∀ {A B : Set} → (A ≃′ B) → (A → B)\n to′ (mk-≃′ f g g∘f f∘g) = f\n\n from′ : ∀ {A B : Set} → (A ≃′ B) → (B → A)\n from′ (mk-≃′ f g g∘f f∘g) = g\n\n from∘to′ : ∀ {A B : Set} → (A≃B : A ≃′ B) → (∀ (x : A) → from′ A≃B (to′ A≃B x) ≡ x)\n from∘to′ (mk-≃′ f g g∘f f∘g) = g∘f\n\n to∘from′ : ∀ {A B : Set} → (A≃B : A ≃′ B) → (∀ (y : B) → to′ A≃B (from′ A≃B y) ≡ y)\n to∘from′ (mk-≃′ f g g∘f f∘g) = f∘g\n\n ≃-refl : ∀ {A : Set} → A ≃ A\n ≃-refl = record \n { \n to = λ x → x; \n from = λ y → y; \n from∘to = λ x → refl; \n to∘from = λ y → refl\n }\n\n ≃-sym : ∀ {A B : Set} → A ≃ B → B ≃ A\n ≃-sym A≃B = record \n {\n to = from A≃B ;\n from = to A≃B ;\n from∘to = to∘from A≃B ;\n to∘from = from∘to A≃B\n }\n\n ≃-trans : ∀ {A B C : Set} → A ≃ B → B ≃ C → A ≃ C\n ≃-trans A≃B B≃C = record \n {\n to = (to B≃C) ∘ (to A≃B);\n from = (from A≃B) ∘ (from B≃C);\n from∘to = λ x → begin\n (from A≃B ∘ from B≃C) ((to B≃C ∘ to A≃B) x) ≡⟨⟩\n from A≃B (from B≃C (to B≃C (to A≃B x))) ≡⟨ cong (from A≃B) (from∘to B≃C (to A≃B x)) ⟩\n from A≃B (to A≃B x) ≡⟨ from∘to A≃B x ⟩\n x ∎;\n to∘from = λ x → begin\n (to B≃C ∘ to A≃B) ((from A≃B ∘ from B≃C) x) ≡⟨⟩\n to B≃C (to A≃B (from A≃B (from B≃C x))) ≡⟨ cong (to B≃C) (to∘from A≃B (from B≃C x)) ⟩\n to B≃C (from B≃C x) ≡⟨ to∘from B≃C x ⟩\n x ∎\n }\n \n module ≃-Reasoning where\n\n infix 1 ≃-begin_\n infixr 2 _≃⟨_⟩_\n infix 3 _≃-∎\n\n ≃-begin_ : ∀ {A B : Set}\n → A ≃ B\n -----\n → A ≃ B\n ≃-begin A≃B = A≃B\n\n _≃⟨_⟩_ : ∀ (A : Set) {B C : Set}\n → A ≃ B\n → B ≃ C\n -----\n → A ≃ C\n A ≃⟨ A≃B ⟩ B≃C = ≃-trans A≃B B≃C\n\n _≃-∎ : ∀ (A : Set)\n -----\n → A ≃ A\n A ≃-∎ = ≃-refl\n\n open ≃-Reasoning public \n ", "meta": {"hexsha": "9ec28f5b3fa4a13b10af04e6bfdfd1cfcfff9909", "size": 2714, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Dave/Isomorphism.agda", "max_stars_repo_name": "DavidStahl97/formal-proofs", "max_stars_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Dave/Isomorphism.agda", "max_issues_repo_name": "DavidStahl97/formal-proofs", "max_issues_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Dave/Isomorphism.agda", "max_forks_repo_name": "DavidStahl97/formal-proofs", "max_forks_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.8723404255, "max_line_length": 101, "alphanum_fraction": 0.3356669123, "num_tokens": 1243, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8615382165412808, "lm_q2_score": 0.803173791645582, "lm_q1q2_score": 0.691964916027033}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Properties of the `Reflects` construct\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Relation.Nullary.Reflects where\n\nopen import Agda.Builtin.Equality\nopen import Data.Bool.Base\nopen import Data.Empty\nopen import Level\nopen import Relation.Nullary\n\nprivate\n variable\n p : Level\n P : Set p\n\n------------------------------------------------------------------------\n-- `Reflects P b` is equivalent to `if b then P else ¬ P`.\n\n-- These lemmas are intended to be used mostly when `b` is a value, so\n-- that the `if` expressions have already been evaluated away.\n-- In this case, `of` works like the relevant constructor (`ofⁿ` or\n-- `ofʸ`), and `invert` strips off the constructor to just give either\n-- the proof of `P` or the proof of `¬ P`.\n\nof : ∀ {b} → if b then P else ¬ P → Reflects P b\nof {b = false} ¬p = ofⁿ ¬p\nof {b = true } p = ofʸ p\n\ninvert : ∀ {b} → Reflects P b → if b then P else ¬ P\ninvert (ofʸ p) = p\ninvert (ofⁿ ¬p) = ¬p\n\n------------------------------------------------------------------------\n-- Other lemmas\n\n-- `Reflects` is deterministic.\ndet : ∀ {b b′} → Reflects P b → Reflects P b′ → b ≡ b′\ndet (ofʸ p) (ofʸ p′) = refl\ndet (ofʸ p) (ofⁿ ¬p′) = ⊥-elim (¬p′ p)\ndet (ofⁿ ¬p) (ofʸ p′) = ⊥-elim (¬p p′)\ndet (ofⁿ ¬p) (ofⁿ ¬p′) = refl\n", "meta": {"hexsha": "6a5f73f61d99ea1b1a890651b14c61aa082c5861", "size": 1442, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Relation/Nullary/Reflects.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Relation/Nullary/Reflects.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Relation/Nullary/Reflects.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 30.0416666667, "max_line_length": 72, "alphanum_fraction": 0.5062413315, "num_tokens": 419, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.86153820232079, "lm_q2_score": 0.8031737940012418, "lm_q1q2_score": 0.6919649066349984}} {"text": "{-# OPTIONS --without-K #-}\n\nmodule Test where\n\nopen import Level\n\ninfixl 4 _≡_\ndata _≡_ {a} {A : Set a} (x : A) : A → Set a where\n refl : x ≡ x\n\n\nJ : {a b : Level} (A : Set a) (C : (x y : A) → x ≡ y → Set b)\n → ((x : A) → C x x refl)\n → (x y : A) (P : x ≡ y)\n → C x y P\nJ A C b x .x refl = b x\n\n-- K : (A : Set) (x : A) (C : x ≡ x → Set)\n-- → C refl\n-- → (loop : x ≡ x)\n-- → C loop\n-- K A x C b p = {! p !}\n\n-- Lemma 2.1.1 (inversion of paths)\ninfix 6 ¬_\n¬_ : {a : Level} {A : Set a} {x y : A} → x ≡ y → y ≡ x\n¬_ {a} {A} {x} {y} p = J A D d x y p\n\n where\n D : (x y : A) (p : x ≡ y) → Set a\n D x y p = y ≡ x\n\n d : (x : A) → D x x refl\n d x = refl\n\n\n-- Lemma 2.1.2 (concatenation of paths)\ninfixl 5 _∙_\n_∙_ : {a : Level} {A : Set a} {x y z : A} → x ≡ y → y ≡ z → x ≡ z\n_∙_ {a} {A} {x} {y} {z} p q = J {a} {a} A D d x y p z q\n\n where\n -- the predicate\n D : (x y : A) (p : x ≡ y) → Set a\n D x y p = (z : A) (q : y ≡ z) → x ≡ z\n\n -- base case\n d : (x : A) → D x x refl\n d x z q = J A E e x z q\n where\n -- the predicate\n E : (x z : A) (q : x ≡ z) → Set a\n E x z q = x ≡ z\n\n -- base case\n e : (x : A) → E x x refl\n e x = refl\n\n\n-- Lemma 2.1.4.i (identity of path concatenation)\n∙-identityʳ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → p ≡ p ∙ refl\n∙-identityʳ {a} {A} {x} {y} p = J A D d x y p\n\n where\n -- the predicate\n D : (x y : A) (p : x ≡ y) → Set a\n D x y p = p ≡ p ∙ refl\n\n -- base case\n d : (x : A) → D x x refl\n d x = refl\n\n∙-identityˡ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → p ≡ refl ∙ p\n∙-identityˡ {a} {A} {x} {y} p = J A D d x y p\n where\n -- the predicate\n D : (x y : A) (p : x ≡ y) → Set a\n D x y p = p ≡ refl ∙ p\n\n -- base case\n d : (x : A) → D x x refl\n d x = refl\n\n-- Lemma 2.1.4.ii (identity of path inversion)\n¬-identityʳ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → ¬ p ∙ p ≡ refl\n¬-identityʳ {a} {A} {x} {y} p = J A D d x y p\n where\n -- the predicate\n D : (x y : A) (p : x ≡ y) → Set a\n D x y p = ¬ p ∙ p ≡ refl\n\n -- base case\n d : (x : A) → D x x refl\n d x = refl\n\n¬-identityˡ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → p ∙ ¬ p ≡ refl\n¬-identityˡ {a} {A} {x} {y} p = J A D d x y p\n where\n -- the predicate\n D : (x y : A) (p : x ≡ y) → Set a\n D x y p = p ∙ ¬ p ≡ refl\n\n -- base case\n d : (x : A) → D x x refl\n d x = refl\n\n-- Lemma 2.1.4.iii (involution of path inversion)\ninvolution : {A : Set} {x y : A} (p : x ≡ y) → ¬ ¬ p ≡ p\ninvolution {A} {x} {y} p = J A D d x y p\n where\n -- the predicate\n D : (x y : A) (p : x ≡ y) → Set\n D x y p = ¬ ¬ p ≡ p\n\n -- base case\n d : (x : A) → D x x refl\n d x = refl\n\n-- Lemma 2.1.4.iv (associativity of path concatenation)\n∙-assoc : {a : Level} {A : Set a} {w x y z : A}\n → (p : w ≡ x) (q : x ≡ y) (r : y ≡ z)\n → p ∙ (q ∙ r) ≡ (p ∙ q) ∙ r\n∙-assoc {a} {A} {w} {x} {y} {z} p q r = J A D d w x p y q z r\n where\n -- the predicate\n D : (w x : A) (p : w ≡ x) → Set a\n D w x p = (y : A) (q : x ≡ y)\n → (z : A) (r : y ≡ z)\n → p ∙ (q ∙ r) ≡ (p ∙ q) ∙ r\n\n -- base case\n d : (x : A) → D x x refl\n d x y q z r = J A E e x y q z r\n where\n -- the predicate\n E : (x y : A) (q : x ≡ y) → Set a\n E x y q = (z : A) (r : y ≡ z)\n → refl ∙ (q ∙ r) ≡ refl ∙ q ∙ r\n\n -- base case\n e : (x : A) → E x x refl\n e x z r = J A F f x z r\n where\n -- the predicate\n F : (y z : A) (r : y ≡ z) → Set a\n F y z r = refl ∙ (refl ∙ r) ≡ refl ∙ refl ∙ r\n\n -- base case\n f : (x : A) → F x x refl\n f x = {! !}\n", "meta": {"hexsha": "4bed8fc67385a11db50395a6b5339a5e395ff724", "size": 3720, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/Test.agda", "max_stars_repo_name": "erydo/agda-mode", "max_stars_repo_head_hexsha": "67d4db3b1050e6acfbdfdc05f8a656fd4c1f0b07", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 58, "max_stars_repo_stars_event_min_datetime": "2015-01-10T10:24:09.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-11T01:42:34.000Z", "max_issues_repo_path": "test/asset/Test.agda", "max_issues_repo_name": "erydo/agda-mode", "max_issues_repo_head_hexsha": "67d4db3b1050e6acfbdfdc05f8a656fd4c1f0b07", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 126, "max_issues_repo_issues_event_min_datetime": "2015-02-02T05:47:54.000Z", "max_issues_repo_issues_event_max_datetime": "2020-12-23T23:00:13.000Z", "max_forks_repo_path": "test/asset/Test.agda", "max_forks_repo_name": "erydo/agda-mode", "max_forks_repo_head_hexsha": "67d4db3b1050e6acfbdfdc05f8a656fd4c1f0b07", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 18, "max_forks_repo_forks_event_min_datetime": "2015-05-24T04:15:44.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-21T10:12:31.000Z", "avg_line_length": 24.6357615894, "max_line_length": 76, "alphanum_fraction": 0.397311828, "num_tokens": 1728, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.893309411735131, "lm_q2_score": 0.7745833789613196, "lm_q1q2_score": 0.6919426225997465}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- A definition for the permutation relation using setoid equality\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.List.Relation.Binary.Permutation.Homogeneous where\n\nopen import Data.List.Base using (List; _∷_)\nopen import Data.List.Relation.Binary.Pointwise as Pointwise\n using (Pointwise)\nopen import Level using (Level; _⊔_)\nopen import Relation.Binary\n\nprivate\n variable\n a r s : Level\n A : Set a\n\ndata Permutation {A : Set a} (R : Rel A r) : Rel (List A) (a ⊔ r) where\n refl : ∀ {xs ys} → Pointwise R xs ys → Permutation R xs ys\n prep : ∀ {xs ys x y} (eq : R x y) → Permutation R xs ys → Permutation R (x ∷ xs) (y ∷ ys)\n swap : ∀ {xs ys x y x' y'} (eq₁ : R x x') (eq₂ : R y y') → Permutation R xs ys → Permutation R (x ∷ y ∷ xs) (y' ∷ x' ∷ ys)\n trans : ∀ {xs ys zs} → Permutation R xs ys → Permutation R ys zs → Permutation R xs zs\n\n------------------------------------------------------------------------\n-- The Permutation relation is an equivalence\n\nmodule _ {R : Rel A r} where\n\n sym : Symmetric R → Symmetric (Permutation R)\n sym R-sym (refl xs∼ys) = refl (Pointwise.symmetric R-sym xs∼ys)\n sym R-sym (prep x∼x' xs↭ys) = prep (R-sym x∼x') (sym R-sym xs↭ys)\n sym R-sym (swap x∼x' y∼y' xs↭ys) = swap (R-sym y∼y') (R-sym x∼x') (sym R-sym xs↭ys)\n sym R-sym (trans xs↭ys ys↭zs) = trans (sym R-sym ys↭zs) (sym R-sym xs↭ys)\n\n isEquivalence : Reflexive R → Symmetric R → IsEquivalence (Permutation R)\n isEquivalence R-refl R-sym = record\n { refl = refl (Pointwise.refl R-refl)\n ; sym = sym R-sym\n ; trans = trans\n }\n\n setoid : Reflexive R → Symmetric R → Setoid _ _\n setoid R-refl R-sym = record\n { isEquivalence = isEquivalence R-refl R-sym\n }\n\nmap : ∀ {R : Rel A r} {S : Rel A s} →\n (R ⇒ S) → (Permutation R ⇒ Permutation S)\nmap R⇒S (refl xs∼ys) = refl (Pointwise.map R⇒S xs∼ys)\nmap R⇒S (prep e xs∼ys) = prep (R⇒S e) (map R⇒S xs∼ys)\nmap R⇒S (swap e₁ e₂ xs∼ys) = swap (R⇒S e₁) (R⇒S e₂) (map R⇒S xs∼ys)\nmap R⇒S (trans xs∼ys ys∼zs) = trans (map R⇒S xs∼ys) (map R⇒S ys∼zs)\n", "meta": {"hexsha": "fb1f0d29f01e70f4b5bf592ed117835230dd51ee", "size": 2239, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/List/Relation/Binary/Permutation/Homogeneous.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/List/Relation/Binary/Permutation/Homogeneous.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/List/Relation/Binary/Permutation/Homogeneous.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 39.2807017544, "max_line_length": 125, "alphanum_fraction": 0.5573916927, "num_tokens": 798, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094003735663, "lm_q2_score": 0.7745833841649232, "lm_q1q2_score": 0.6919426184476953}} {"text": "module FMSB where\n\ndata Nat : Set where\n ze : Nat\n su : Nat -> Nat\n\ndata Lam (X : Nat -> Set)(n : Nat) : Set where\n var : X n -> Lam X n\n app : Lam X n -> Lam X n -> Lam X n\n lam : Lam X (su n) -> Lam X n\n\n_->>_ : {I : Set}(X Y : I -> Set) -> Set\nX ->> Y = {i : _} -> X i -> Y i\n\nfmsub : {X Y : Nat -> Set} -> (X ->> Lam Y) -> Lam X ->> Lam Y\nfmsub sb (var x) = sb x\nfmsub sb (app f s) = app (fmsub sb f) (fmsub sb s)\nfmsub sb (lam b) = lam (fmsub sb b)\n\ndata Fin : Nat -> Set where\n ze : {n : Nat} -> Fin (su n)\n su : {n : Nat} -> Fin n -> Fin (su n)\n\nD : (Nat -> Set) -> Nat -> Set\nD F n = F (su n)\n\nweak : {F : Nat -> Set} -> (Fin ->> F) -> (F ->> D F) ->\n {m n : Nat}-> (Fin m -> F n) -> D Fin m -> D F n\nweak v w f ze = v ze\nweak v w f (su x) = w (f x)\n\n_+_ : Nat -> Nat -> Nat\nze + y = y\nsu x + y = su (x + y)\n\n_!+_ : (Nat -> Set) -> Nat -> (Nat -> Set)\nF !+ n = \\ m -> F (m + n)\n\nweaks : {F : Nat -> Set} -> (Fin ->> F) -> (F ->> D F) ->\n {m n : Nat}-> (Fin m -> F n) -> (Fin !+ m) ->> (F !+ n)\nweaks v w f {ze} = f\nweaks v w f {su i} = weak v w (weaks v w f {i})\n\njing : {m n : Nat} -> Lam Fin (m + n) -> Lam (Fin !+ n) m\njing (var x) = var x\njing (app f s) = app (jing f) (jing s)\njing (lam t) = lam (jing t)\n\ngnij : {m n : Nat} -> Lam (Fin !+ n) m -> Lam Fin (m + n)\ngnij (var x) = var x\ngnij (app f s) = app (gnij f) (gnij s)\ngnij (lam t) = lam (gnij t)\n\nren : {m n : Nat} -> (Fin m -> Fin n) -> Lam Fin m -> Lam Fin n\nren f t = gnij (fmsub (\\ {i} x -> var (weaks (\\ z -> z) su f {i} x)) {ze} (jing t))\n\nsub : {m n : Nat} -> (Fin m -> Lam Fin n) -> Lam Fin m -> Lam Fin n\nsub {m}{n} f t = gnij {ze} (fmsub (\\ {i} x -> jing {i} (weaks {Lam Fin} var (ren su) f {i} x)) (jing {ze} t))", "meta": {"hexsha": "e7e88d2808911e6ef956b69c8a3561d1fc94befa", "size": 1730, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "models/FMSB.agda", "max_stars_repo_name": "mietek/epigram", "max_stars_repo_head_hexsha": "8c46f766bddcec2218ddcaa79996e087699a75f2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 48, "max_stars_repo_stars_event_min_datetime": "2016-01-09T17:36:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-11T01:55:28.000Z", "max_issues_repo_path": "models/FMSB.agda", "max_issues_repo_name": "mietek/epigram", "max_issues_repo_head_hexsha": "8c46f766bddcec2218ddcaa79996e087699a75f2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "models/FMSB.agda", "max_forks_repo_name": "mietek/epigram", "max_forks_repo_head_hexsha": "8c46f766bddcec2218ddcaa79996e087699a75f2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 12, "max_forks_repo_forks_event_min_datetime": "2016-08-14T21:36:35.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-11T01:57:40.000Z", "avg_line_length": 29.8275862069, "max_line_length": 109, "alphanum_fraction": 0.450867052, "num_tokens": 756, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.927363293639213, "lm_q2_score": 0.7461389873857264, "lm_q1q2_score": 0.6919419088546545}} {"text": "{-\n\nℤ is a Commutative Ring (using QuoInt)\n\n-}\n{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.CommRing.Instances.QuoInt where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Algebra.CommRing\nopen import Cubical.Data.Nat using (ℕ ; zero ; suc)\nopen import Cubical.Data.Bool using (not)\nopen import Cubical.Data.Int.MoreInts.QuoInt\n renaming (ℤ to ℤType ; _+_ to _+ℤ_; _·_ to _·ℤ_; -_ to -ℤ_)\n\nopen CommRingStr\n\n-- The missing additive inversion\n\n+InvL' : ∀ n s → signed (not s) n +ℤ signed s n ≡ signed s zero\n+InvL' zero _ = refl\n+InvL' (suc n) spos = predℤ-+ʳ (neg n) (pos (suc n)) ∙ (λ i → neg n +ℤ predSucℤ (pos n) i) ∙ +InvL' n spos\n+InvL' (suc n) sneg = sucℤ-+ʳ (pos n) (neg (suc n)) ∙ (λ i → pos n +ℤ sucPredℤ (neg n) i) ∙ +InvL' n sneg\n\n+InvL : (n : ℤType) → (-ℤ n) +ℤ n ≡ 0\n+InvL (signed spos n) = +InvL' n spos\n+InvL (signed sneg n) = +InvL' n sneg ∙ sym posneg\n+InvL (posneg i) j =\n hcomp (λ k → λ\n { (i = i0) → 0\n ; (i = i1) → compPath-filler refl (sym posneg) k j\n ; (j = i0) → posneg i\n ; (j = i1) → posneg (i ∧ ~ k) })\n (posneg i)\n\n+InvR : (n : ℤType) → n +ℤ (-ℤ n) ≡ 0\n+InvR n = +-comm n (-ℤ n) ∙ +InvL n\n\n\nℤCommRing : CommRing ℓ-zero\nℤCommRing .fst = ℤType\nℤCommRing .snd .0r = 0\nℤCommRing .snd .1r = 1\nℤCommRing .snd ._+_ = _+ℤ_\nℤCommRing .snd ._·_ = _·ℤ_\nℤCommRing .snd .-_ = -ℤ_\nℤCommRing .snd .isCommRing = isCommRingℤ\n where\n abstract\n isCommRingℤ : IsCommRing 0 1 _+ℤ_ _·ℤ_ -ℤ_\n isCommRingℤ = makeIsCommRing\n isSetℤ +-assoc (+-zeroʳ _)\n +InvR +-comm ·-assoc\n ·-identityʳ (λ x y z → sym (·-distribˡ x y z)) ·-comm\n", "meta": {"hexsha": "3da9aa5ebc152ee0fe46e891f2595730d9228fdc", "size": 1588, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommRing/Instances/QuoInt.agda", "max_stars_repo_name": "gmagaf/cubical", "max_stars_repo_head_hexsha": "1d9b9691d375659fa8ebd9cbf8b63678955b196b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommRing/Instances/QuoInt.agda", "max_issues_repo_name": "gmagaf/cubical", "max_issues_repo_head_hexsha": "1d9b9691d375659fa8ebd9cbf8b63678955b196b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommRing/Instances/QuoInt.agda", "max_forks_repo_name": "gmagaf/cubical", "max_forks_repo_head_hexsha": "1d9b9691d375659fa8ebd9cbf8b63678955b196b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.3571428571, "max_line_length": 106, "alphanum_fraction": 0.6139798489, "num_tokens": 705, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473647220786, "lm_q2_score": 0.793105953629227, "lm_q1q2_score": 0.6918638885938473}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\n-- Biproducts, a-la Karvonen.\n--\n-- This definition has advantages over more traditional ones,\n-- namely that that we don't require either enrichment in CMon/Ab, or Zero Objects.\n--\n-- See https://arxiv.org/abs/1801.06488\nmodule Categories.Object.Biproduct {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\n\nopen import Categories.Object.Coproduct 𝒞\nopen import Categories.Object.Product 𝒞\n\nopen import Categories.Morphism 𝒞\n\nopen Category 𝒞\nopen HomReasoning\n\nprivate\n variable\n A B C D : Obj\n f g h : A ⇒ B\n\nrecord IsBiproduct {A B A⊕B : Obj} (π₁ : A⊕B ⇒ A) (π₂ : A⊕B ⇒ B) (i₁ : A ⇒ A⊕B) (i₂ : B ⇒ A⊕B) : Set (o ⊔ ℓ ⊔ e) where\n field\n isCoproduct : IsCoproduct i₁ i₂\n isProduct : IsProduct π₁ π₂\n\n π₁∘i₁≈id : π₁ ∘ i₁ ≈ id\n π₂∘i₂≈id : π₂ ∘ i₂ ≈ id\n permute : i₁ ∘ π₁ ∘ i₂ ∘ π₂ ≈ i₂ ∘ π₂ ∘ i₁ ∘ π₁\n\n open IsCoproduct isCoproduct public renaming (unique to []-unique)\n open IsProduct isProduct public renaming (unique to ⟨⟩-unique)\n\nrecord Biproduct (A B : Obj) : Set (o ⊔ ℓ ⊔ e) where\n field\n A⊕B : Obj\n\n π₁ : A⊕B ⇒ A\n π₂ : A⊕B ⇒ B\n\n i₁ : A ⇒ A⊕B\n i₂ : B ⇒ A⊕B\n\n isBiproduct : IsBiproduct π₁ π₂ i₁ i₂\n\n open IsBiproduct isBiproduct public\n\nIsBiproduct⇒Biproduct : {π₁ : C ⇒ A} {π₂ : C ⇒ B} {i₁ : A ⇒ C} {i₂ : B ⇒ C} → IsBiproduct π₁ π₂ i₁ i₂ → Biproduct A B\nIsBiproduct⇒Biproduct isBiproduct = record\n { isBiproduct = isBiproduct\n }\n\nBiproduct⇒IsBiproduct : (b : Biproduct A B) → IsBiproduct (Biproduct.π₁ b) (Biproduct.π₂ b) (Biproduct.i₁ b) (Biproduct.i₂ b)\nBiproduct⇒IsBiproduct biproduct = Biproduct.isBiproduct biproduct\n\nBiproduct⇒Product : Biproduct A B → Product A B\nBiproduct⇒Product b = record\n { ⟨_,_⟩ = ⟨_,_⟩\n ; project₁ = project₁\n ; project₂ = project₂\n ; unique = ⟨⟩-unique\n }\n where\n open Biproduct b\n\nBiproduct⇒Coproduct : Biproduct A B → Coproduct A B\nBiproduct⇒Coproduct b = record\n { [_,_] = [_,_]\n ; inject₁ = inject₁\n ; inject₂ = inject₂\n ; unique = []-unique\n }\n where\n open Biproduct b\n", "meta": {"hexsha": "2c5923f90425b9467e31efcbef4322c4f97747c8", "size": 2062, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Object/Biproduct.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Object/Biproduct.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Object/Biproduct.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 25.4567901235, "max_line_length": 125, "alphanum_fraction": 0.6503394762, "num_tokens": 841, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898279984214, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6917085284978096}} {"text": "{-# OPTIONS --without-K #-}\n\nmodule Lecture8 where\n\nimport Lecture7\nopen Lecture7 public\n\n-- Section 8.1 Propositions\n\nis-prop : {i : Level} (A : UU i) → UU i\nis-prop A = (x y : A) → is-contr (Id x y)\n\nis-prop-empty : is-prop empty\nis-prop-empty ()\n\nis-prop-unit : is-prop unit\nis-prop-unit = is-prop-is-contr is-contr-unit\n\nis-prop' : {i : Level} (A : UU i) → UU i\nis-prop' A = (x y : A) → Id x y\n\nis-prop-is-prop' : {i : Level} {A : UU i} → is-prop' A → is-prop A\nis-prop-is-prop' {i} {A} H x y =\n dpair\n (concat _ (inv (H x x)) (H x y))\n (ind-Id\n (λ z p → Id (concat _ (inv (H x x)) (H x z)) p)\n (left-inv (H x x)) y)\n\nis-prop'-is-prop : {i : Level} {A : UU i} → is-prop A → is-prop' A\nis-prop'-is-prop H x y = pr1 (H x y)\n\nis-contr-is-prop-inh : {i : Level} {A : UU i} → is-prop A → A → is-contr A\nis-contr-is-prop-inh H a = dpair a (is-prop'-is-prop H a)\n\nis-subtype : {i j : Level} {A : UU i} (B : A → UU j) → UU (i ⊔ j)\nis-subtype B = (x : _) → is-prop (B x)\n\n-- Section 8.2 Sets\n\nis-set : {i : Level} → UU i → UU i\nis-set A = (x y : A) → is-prop (Id x y)\n\naxiom-K : {i : Level} → UU i → UU i\naxiom-K A = (x : A) (p : Id x x) → Id refl p\n\nis-set-axiom-K : {i : Level} (A : UU i) → axiom-K A → is-set A\nis-set-axiom-K A H x y =\n is-prop-is-prop' (ind-Id (λ z p → (q : Id x z) → Id p q) (H x) y)\n\naxiom-K-is-set : {i : Level} (A : UU i) → is-set A → axiom-K A\naxiom-K-is-set A H x p =\n concat\n (center (is-contr-is-prop-inh (H x x) refl))\n (inv (contraction (is-contr-is-prop-inh (H x x) refl) refl))\n (contraction (is-contr-is-prop-inh (H x x) refl) p)\n\nis-equiv-prop-in-id : {i j : Level} {A : UU i}\n (R : A → A → UU j)\n (p : (x y : A) → is-prop (R x y))\n (ρ : (x : A) → R x x)\n (i : (x y : A) → R x y → Id x y)\n → (x y : A) → is-equiv (i x y)\nis-equiv-prop-in-id R p ρ i x =\n id-fundamental-retr x (i x)\n (λ y → dpair\n (ind-Id (λ z p → R x z) (ρ x) y)\n ((λ r → is-prop'-is-prop (p x y) _ r)))\n\nis-prop-is-equiv : {i j : Level} {A : UU i} (B : UU j)\n (f : A → B) (E : is-equiv f) → is-prop B → is-prop A\nis-prop-is-equiv B f E H x y =\n is-contr-is-equiv (ap f {x} {y}) (is-emb-is-equiv f E x y) (H (f x) (f y))\n\nis-prop-is-equiv' : {i j : Level} (A : UU i) {B : UU j}\n (f : A → B) (E : is-equiv f) → is-prop A → is-prop B\nis-prop-is-equiv' A f E H =\n is-prop-is-equiv _ (inv-is-equiv E) (is-equiv-inv-is-equiv E) H\n\nis-set-prop-in-id : {i j : Level} {A : UU i}\n (R : A → A → UU j)\n (p : (x y : A) → is-prop (R x y))\n (ρ : (x : A) → R x x)\n (i : (x y : A) → R x y → Id x y)\n → is-set A\nis-set-prop-in-id R p ρ i x y = is-prop-is-equiv' (R x y) (i x y) (is-equiv-prop-in-id R p ρ i x y) (p x y)\n\nis-prop-EqN : (n m : ℕ) → is-prop (EqN n m)\nis-prop-EqN Nzero Nzero = is-prop-unit\nis-prop-EqN Nzero (Nsucc m) = is-prop-empty\nis-prop-EqN (Nsucc n) Nzero = is-prop-empty\nis-prop-EqN (Nsucc n) (Nsucc m) = is-prop-EqN n m\n\nis-set-nat : is-set ℕ\nis-set-nat =\n is-set-prop-in-id\n EqN\n is-prop-EqN\n reflexive-EqN\n (least-reflexive-EqN (λ n → refl))\n", "meta": {"hexsha": "bff45f66b9f888d6dd70f5a037ec022b4b10bde6", "size": 3019, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Lecture8.agda", "max_stars_repo_name": "glangmead/hott_cmu80818", "max_stars_repo_head_hexsha": "af64d808630f4f1498a75201b6ca4d74d662516b", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-05-03T20:32:19.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-04T02:52:25.000Z", "max_issues_repo_path": "Lecture8.agda", "max_issues_repo_name": "glangmead/hott_cmu80818", "max_issues_repo_head_hexsha": "af64d808630f4f1498a75201b6ca4d74d662516b", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-02-22T21:01:16.000Z", "max_issues_repo_issues_event_max_datetime": "2018-03-25T14:44:31.000Z", "max_forks_repo_path": "Lecture8.agda", "max_forks_repo_name": "glangmead/hott_cmu80818", "max_forks_repo_head_hexsha": "af64d808630f4f1498a75201b6ca4d74d662516b", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-02-22T19:58:46.000Z", "max_forks_repo_forks_event_max_datetime": "2018-06-25T15:05:21.000Z", "avg_line_length": 29.8910891089, "max_line_length": 107, "alphanum_fraction": 0.5342828751, "num_tokens": 1277, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970811069351, "lm_q2_score": 0.7853085758631159, "lm_q1q2_score": 0.6916975013884765}} {"text": "module Nats.Add.Assoc where\n\nopen import Equality\nopen import Nats\nopen import Function\n\n------------------------------------------------------------------------\n-- internal stuffs\n\nprivate\n\n a+/b+c/=/a+b/+c : ∀ a b c → a + b + c ≡ a + (b + c)\n a+/b+c/=/a+b/+c zero b c = refl\n a+/b+c/=/a+b/+c (suc a) b c = cong suc $ a+/b+c/=/a+b/+c a b c\n\n------------------------------------------------------------------------\n-- public aliases\n\nnat-add-assoc : ∀ a b c → a + b + c ≡ a + (b + c)\nnat-add-assoc = a+/b+c/=/a+b/+c\n\n", "meta": {"hexsha": "1bcdde20205ceafbcfc62c9537988f47d2de6403", "size": 523, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Nats/Add/Assoc.agda", "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_issues_repo_path": "src/Nats/Add/Assoc.agda", "max_issues_repo_name": "ice1k/Theorems", "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Nats/Add/Assoc.agda", "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.7727272727, "max_line_length": 72, "alphanum_fraction": 0.3881453155, "num_tokens": 162, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8991213772699436, "lm_q2_score": 0.7690802423634961, "lm_q1q2_score": 0.6914964867449687}} {"text": "data Nat : Set where\n zero : Nat\n suc : Nat → Nat\n\ndata Zero : Nat → Set where\n instance\n isZero : Zero zero\n\ndata NonZero : Nat → Set where\n instance\n isSuc : ∀ {n : Nat} → NonZero (suc n)\n\npred : ∀ t {{_ : NonZero t}} → Nat\npred ._ {{isSuc {n}}} = n\n\ntest : Nat\ntest = pred (suc zero)\n\ndata Test (x : Nat) : Set where\n here : {{_ : Zero x}} → Test x\n there : {{nz : NonZero x}} → Test (pred x) → Test x\n\nbroken : Test (suc zero)\nbroken = there here\n", "meta": {"hexsha": "0c7b7066667296b14c0e9e56bc715f0a26e89dfc", "size": 465, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue1377.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue1377.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue1377.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 18.6, "max_line_length": 53, "alphanum_fraction": 0.5784946237, "num_tokens": 162, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9230391600697869, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6914368423532656}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Algebra.Structures.Bundles.Field\n\nmodule Algebra.Linear.Structures.FiniteDimensional\n {k ℓᵏ} (K : Field k ℓᵏ)\n where\n\nopen import Algebra.Linear.Core\nopen import Algebra.FunctionProperties\nopen import Relation.Binary using (Rel)\n\nopen import Algebra.Linear.Morphism.Bundles K\n\nopen import Algebra.Linear.Structures.VectorSpace K\n\nopen import Function.Equality\n\nopen import Level using (_⊔_; suc)\nopen import Data.Nat using (ℕ)\nimport Algebra.Linear.Construct.Vector K as Vec\n\nprivate\n K' : Set k\n K' = Field.Carrier K\n\nrecord IsFiniteDimensional\n {v ℓ} {V : Set v}\n (_≈_ : Rel V ℓ)\n (_+_ : Op₂ V) (_∙_ : K' → V → V) (-_ : Op₁ V) (0# : V)\n (n : ℕ) : Set (suc (v ⊔ k ⊔ ℓ ⊔ ℓᵏ))\n where\n field\n isVectorSpace : IsVectorSpace _≈_ _+_ _∙_ -_ 0#\n embed : LinearIsomorphism (record { isVectorSpace = isVectorSpace })\n (record { isVectorSpace = Vec.isVectorSpace {n} })\n\n open IsVectorSpace isVectorSpace public\n\nmodule Vector {n} where\n open Vec\n\n isFiniteDimensional : IsFiniteDimensional (Vec._≈_) (Vec._+_) (Vec._∙_) (Vec.-_) (Vec.0#) n\n isFiniteDimensional = record\n { isVectorSpace = Vec.isVectorSpace\n ; embed = Vec.embed\n }\n", "meta": {"hexsha": "240817300a344126e5810b1bc0f2a669573b3557", "size": 1275, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Algebra/Linear/Structures/FiniteDimensional.agda", "max_stars_repo_name": "felko/linear-algebra", "max_stars_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-11-02T14:11:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T06:18:08.000Z", "max_issues_repo_path": "src/Algebra/Linear/Structures/FiniteDimensional.agda", "max_issues_repo_name": "felko/linear-algebra", "max_issues_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Algebra/Linear/Structures/FiniteDimensional.agda", "max_forks_repo_name": "felko/linear-algebra", "max_forks_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.5625, "max_line_length": 93, "alphanum_fraction": 0.6533333333, "num_tokens": 390, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9230391621868804, "lm_q2_score": 0.7490872131147275, "lm_q1q2_score": 0.6914368335983232}} {"text": "module Cat where\n\nopen import Agda.Builtin.Equality\n\n{- A category is very much like a graph. It has vertices\n named objects and vertices named arrows. Each arrow goes\n from an object to an object (possibly the same!). -}\nrecord Cat (obj : Set) (arr : obj -> obj -> Set) : Set where\n constructor MkCat\n field\n {- For each object, there is an arrow called `id` which\n goes from the object to itself. -}\n id : {o : obj} -> arr o o\n\n {- Given an arrow `f` from object `a` to `b` and an arrow\n `g` from `b` to `c`. We can compose these arrow. The\n result is an arrow from `a` to `c`. -}\n compose : {a b c : obj} -> arr a b -> arr b c -> arr a c\n\n -- Here comes some properties of `id` and `compose`\n\n {- For any arrow `f`, compose id f = f -}\n neutralLeft : {a b : obj} -> (f : arr a b) -> compose id f ≡ f\n \n {- For any arrow `f`, compose f id = f -}\n neutralRight : {a b : obj} -> (f : arr a b) -> compose f id ≡ f\n \n {- For any arrows `f`, `g` and `h`,\n composing f with g, and then the result with h\n gives exatctly the same result as\n composing f with the result of the composition of g and h\n\n Which means, like string concatenation than we can commpose\n the way we preserve the order of each element in the sequence.\n -}\n associativity : {a b c d : obj} ->\n (f : arr a b) -> (g : arr b c) -> (h : arr c d) ->\n compose f (compose g h) ≡ compose (compose f g) h\n\nopen import Agda.Builtin.Nat\n\n{- `LE n m` encode the property that `n ≤ m`\n i.e. `n` is less or equal to `m` -}\ndata LE : Nat -> Nat -> Set where\n LERefl : {n : Nat} -> LE n n\n LENext : {n m : Nat} -> LE n m -> LE n (suc m)\n\n{- Taking naturals as objects and `LE` as arrows,\n this actually forms a category! -}\nnatPoset : Cat Nat LE\nnatPoset = ???", "meta": {"hexsha": "a1bae4e34fbe4c3ef5b48eb39e1a23ea0b4514a5", "size": 1856, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/Cat.agda", "max_stars_repo_name": "chrilves/big4-tutorial", "max_stars_repo_head_hexsha": "277e034f7152623a17527c4ae55acc7aa8ce1f89", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-02-02T14:13:39.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-22T18:44:11.000Z", "max_issues_repo_path": "Agda/Cat.agda", "max_issues_repo_name": "chrilves/big4-tutorial", "max_issues_repo_head_hexsha": "277e034f7152623a17527c4ae55acc7aa8ce1f89", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-08-24T14:31:45.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-24T14:31:45.000Z", "max_forks_repo_path": "Agda/Cat.agda", "max_forks_repo_name": "chrilves/big4-tutorial", "max_forks_repo_head_hexsha": "277e034f7152623a17527c4ae55acc7aa8ce1f89", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.3921568627, "max_line_length": 70, "alphanum_fraction": 0.5845905172, "num_tokens": 561, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9230391706552536, "lm_q2_score": 0.749087201911703, "lm_q1q2_score": 0.6914368296010428}} {"text": "------------------------------------------------------------------------\n-- Indices\n------------------------------------------------------------------------\n\nmodule Parallel.Index where\n\nopen import Data.Product.Record\nimport Data.Product as Prod; open Prod using () renaming (_,_ to pair)\n\nopen import Data.Bool using (Bool; true; false; _∨_; _∧_; if_then_else_)\nopen import Data.Bool.Properties as Bool\n\nopen import Data.Nat using (ℕ; zero; suc; _⊔_)\nopen import Data.Nat.Properties\n\nopen import Algebra\nimport Algebra.Props.BooleanAlgebra as BAlg\nimport Algebra.Props.DistributiveLattice as DL\nprivate\n module NR = CommutativeSemiringWithoutOne\n ⊔-⊓-0-commutativeSemiringWithoutOne\n module NL = DL distributiveLattice\n module BR = CommutativeSemiring Bool.commutativeSemiring-∨-∧\n module BA = BAlg Bool.booleanAlgebra\n\nimport Relation.Binary.PropositionalEquality as PropEq\nopen PropEq hiding (setoid)\nopen ≡-Reasoning\nopen import Data.Function\nopen import Relation.Nullary\n\n------------------------------------------------------------------------\n-- The index type\n\n-- Does the parser accept the empty string?\n\nEmpty : Set\nEmpty = Bool\n\n-- The maximum \"distance\" to the next parser which is guaranteed to\n-- either consume a token or fail.\n\nDistance : Set\nDistance = ℕ\n\n-- Parser indices. Note that it is important that the record type used\n-- here has η-equality, since otherwise it would be harder to infer\n-- the types.\n\nIndex : Set\nIndex = Empty × Distance\n\nimport Algebra.FunctionProperties as P; open P (PropEq.setoid Index)\n\n------------------------------------------------------------------------\n-- The basic operations on indices\n\ninfixl 50 _·I_\ninfixl 40 _∣I_\n\n0I : Index\n0I = (false , zero)\n\n1I : Index\n1I = (true , zero)\n\n_·I_ : Index -> Index -> Index\ni₁ ·I i₂ = ( proj₁ i₁ ∧ proj₁ i₂\n , (if proj₁ i₁ then proj₂ i₁ ⊔ proj₂ i₂\n else proj₂ i₁)\n )\n\n_∣I_ : Index -> Index -> Index\ni₁ ∣I i₂ = (proj₁ i₁ ∨ proj₁ i₂ , proj₂ i₁ ⊔ proj₂ i₂)\n\n------------------------------------------------------------------------\n-- These operations satisfy some algebraic properties\n\nprivate\n\n -- TODO: General code for taking the product of two commutative\n -- monoids. However, I don't want to define this operation for both\n -- Data.Product and Data.Product.Record. Hence I'll probably wait\n -- (at least) until pattern matching on records is possible, since I\n -- plan to merge Data.Product and Data.Product.Record then.\n\n ∣-assoc : Associative _∣I_\n ∣-assoc i₁ i₂ i₃ =\n cong₂ _,_ (BR.+-assoc (proj₁ i₁) (proj₁ i₂) (proj₁ i₃))\n (NR.+-assoc (proj₂ i₁) (proj₂ i₂) (proj₂ i₃))\n\n ∣-comm : Commutative _∣I_\n ∣-comm i₁ i₂ =\n cong₂ _,_ (BR.+-comm (proj₁ i₁) (proj₁ i₂))\n (NR.+-comm (proj₂ i₁) (proj₂ i₂))\n\n ∣-identity : Identity 0I _∣I_\n ∣-identity = pair\n (\\i -> cong₂ _,_ (Prod.proj₁ BR.+-identity (proj₁ i))\n (Prod.proj₁ NR.+-identity (proj₂ i)))\n (\\i -> cong₂ _,_ (Prod.proj₂ BR.+-identity (proj₁ i))\n (Prod.proj₂ NR.+-identity (proj₂ i)))\n\n ·-assoc : Associative _·I_\n ·-assoc i₁ i₂ i₃ with proj₁ i₁ | proj₁ i₂\n ·-assoc i₁ i₂ i₃ | false | e₂ = refl\n ·-assoc i₁ i₂ i₃ | true | false = refl\n ·-assoc i₁ i₂ i₃ | true | true =\n cong (_,_ (proj₁ i₃)) (NR.+-assoc (proj₂ i₁) (proj₂ i₂) (proj₂ i₃))\n\n ·-identity : Identity 1I _·I_\n ·-identity = pair (\\_ -> refl) (\\x -> helper (proj₁ x) (proj₂ x))\n where\n helper : forall e d ->\n _≡_ {a = Index} (e ∧ true , (if e then d ⊔ zero else d))\n (e , d)\n helper false d = refl\n helper true d = cong (_,_ true) (Prod.proj₂ NR.+-identity d)\n\n ·-∣-distrib : _·I_ DistributesOver _∣I_\n ·-∣-distrib = pair\n (\\i₁ i₂ i₃ ->\n cong₂ _,_\n (Prod.proj₁ BR.distrib (proj₁ i₁) (proj₁ i₂) (proj₁ i₃))\n (distribˡ₂ (proj₂ i₁) (proj₂ i₂) (proj₂ i₃) (proj₁ i₁)))\n (\\i₁ i₂ i₃ ->\n cong₂ _,_\n (Prod.proj₂ BR.distrib (proj₁ i₁) (proj₁ i₂) (proj₁ i₃))\n (distribʳ₂ (proj₂ i₁) (proj₂ i₂) (proj₂ i₃)\n (proj₁ i₂) (proj₁ i₃)))\n where\n lemma : forall d₁ d₂ d₃ -> d₁ ⊔ (d₂ ⊔ d₃) ≡ d₁ ⊔ d₂ ⊔ (d₁ ⊔ d₃)\n lemma d₁ d₂ d₃ = begin\n d₁ ⊔ (d₂ ⊔ d₃) ≡⟨ sym (NL.∧-idempotent d₁)\n ⟨ NR.+-pres-≈ ⟩\n byDef {x = d₂ ⊔ d₃} ⟩\n d₁ ⊔ d₁ ⊔ (d₂ ⊔ d₃) ≡⟨ NR.+-assoc d₁ d₁ (d₂ ⊔ d₃) ⟩\n d₁ ⊔ (d₁ ⊔ (d₂ ⊔ d₃)) ≡⟨ byDef {x = d₁} ⟨ NR.+-pres-≈ ⟩\n sym (NR.+-assoc d₁ d₂ d₃) ⟩\n d₁ ⊔ (d₁ ⊔ d₂ ⊔ d₃) ≡⟨ byDef {x = d₁} ⟨ NR.+-pres-≈ ⟩\n (NR.+-comm d₁ d₂ ⟨ NR.+-pres-≈ ⟩\n byDef {x = d₃}) ⟩\n d₁ ⊔ (d₂ ⊔ d₁ ⊔ d₃) ≡⟨ byDef {x = d₁} ⟨ NR.+-pres-≈ ⟩\n NR.+-assoc d₂ d₁ d₃ ⟩\n d₁ ⊔ (d₂ ⊔ (d₁ ⊔ d₃)) ≡⟨ sym $ NR.+-assoc d₁ d₂ (d₁ ⊔ d₃) ⟩\n d₁ ⊔ d₂ ⊔ (d₁ ⊔ d₃) ∎\n\n distribˡ₂ : forall d₁ d₂ d₃ e₁ ->\n (if e₁ then d₁ ⊔ (d₂ ⊔ d₃) else d₁) ≡\n (if e₁ then d₁ ⊔ d₂ else d₁) ⊔\n (if e₁ then d₁ ⊔ d₃ else d₁)\n distribˡ₂ d₁ d₂ d₃ true = lemma d₁ d₂ d₃\n distribˡ₂ d₁ d₂ d₃ false = sym (NL.∧-idempotent d₁)\n\n distribʳ₂ : forall d₁ d₂ d₃ e₂ e₃ ->\n (if e₂ ∨ e₃ then d₂ ⊔ d₃ ⊔ d₁ else d₂ ⊔ d₃)\n ≡\n (if e₂ then d₂ ⊔ d₁ else d₂) ⊔\n (if e₃ then d₃ ⊔ d₁ else d₃)\n distribʳ₂ d₁ d₂ d₃ true true = begin\n d₂ ⊔ d₃ ⊔ d₁ ≡⟨ NR.+-comm (d₂ ⊔ d₃) d₁ ⟩\n d₁ ⊔ (d₂ ⊔ d₃) ≡⟨ lemma d₁ d₂ d₃ ⟩\n d₁ ⊔ d₂ ⊔ (d₁ ⊔ d₃) ≡⟨ NR.+-comm d₁ d₂ ⟨ NR.+-pres-≈ ⟩\n NR.+-comm d₁ d₃ ⟩\n d₂ ⊔ d₁ ⊔ (d₃ ⊔ d₁) ∎\n distribʳ₂ d₁ d₂ d₃ true false = begin\n d₂ ⊔ d₃ ⊔ d₁ ≡⟨ NR.+-assoc d₂ d₃ d₁ ⟩\n d₂ ⊔ (d₃ ⊔ d₁) ≡⟨ byDef {x = d₂} ⟨ NR.+-pres-≈ ⟩\n NR.+-comm d₃ d₁ ⟩\n d₂ ⊔ (d₁ ⊔ d₃) ≡⟨ sym $ NR.+-assoc d₂ d₁ d₃ ⟩\n d₂ ⊔ d₁ ⊔ d₃ ∎\n distribʳ₂ d₁ d₂ d₃ false true = NR.+-assoc d₂ d₃ d₁\n distribʳ₂ d₁ d₂ d₃ false false = refl\n\n·-idempotent : Idempotent _·I_\n·-idempotent i = cong₂ _,_ (BA.∧-idempotent (proj₁ i))\n (lemma (proj₁ i) (proj₂ i))\n where\n lemma : forall b x -> (if b then x ⊔ x else x) ≡ x\n lemma true x = NL.∧-idempotent x\n lemma false x = refl\n\n∣-idempotent : Idempotent _∣I_\n∣-idempotent i = cong₂ _,_ (BA.∨-idempotent (proj₁ i))\n (NL.∧-idempotent (proj₂ i))\n\n-- Not quite a semiring, but the proper name is too long...\n\nindexSemiring : SemiringWithoutAnnihilatingZero\nindexSemiring = record\n { setoid = PropEq.setoid Index\n ; _+_ = _∣I_\n ; _*_ = _·I_\n ; 0# = 0I\n ; 1# = 1I\n ; isSemiringWithoutAnnihilatingZero = record\n { +-isCommutativeMonoid = record\n { isMonoid = record\n { isSemigroup = record\n { assoc = ∣-assoc\n ; ∙-pres-≈ = cong₂ _∣I_\n }\n ; identity = ∣-identity\n }\n ; comm = ∣-comm\n }\n ; *-isMonoid = record\n { isSemigroup = record\n { assoc = ·-assoc\n ; ∙-pres-≈ = cong₂ _·I_\n }\n ; identity = ·-identity\n }\n ; distrib = ·-∣-distrib\n }\n }\n\nmodule IndexSemiring =\n SemiringWithoutAnnihilatingZero indexSemiring\n\nnearSemiring : NearSemiring\nnearSemiring = record\n { setoid = setoid\n ; _+_ = _+_\n ; _*_ = _*_\n ; 0# = 0#\n ; isNearSemiring = record\n { +-isMonoid = +-isMonoid\n ; *-isSemigroup = *-isSemigroup\n ; distribʳ = Prod.proj₂ distrib\n ; zeroˡ = \\_ -> PropEq.refl\n }\n }\n where open IndexSemiring\n\nprivate\n\n lemma : suc zero ≢ zero\n lemma ()\n\n -- The indices very nearly form a semiring (∣I, ·I, 0I, 1I). The\n -- only missing piece is that 0I is not a right zero for ·I:\n\n notRightZero : ¬ RightZero 0I _·I_\n notRightZero zeroʳ = lemma $ cong proj₂ $\n zeroʳ (false , suc zero)\n\n -- It might also be worth noting that ·I is not commutative:\n\n notCommutative : ¬ Commutative _·I_\n notCommutative comm = lemma $ cong proj₂ $\n comm (true , suc zero) (false , zero)\n\n -- Note that we don't want these properties to be true. The second\n -- one implies the first, and the first implies that\n -- p = p ⊛> symbol\n -- is an OK definition, even though it is left recursive.\n", "meta": {"hexsha": "c9e19765b18902344da98d9d16030c105dea8a02", "size": 8399, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "misc/Parallel/Index.agda", "max_stars_repo_name": "yurrriq/parser-combinators", "max_stars_repo_head_hexsha": "b396d35cc2cb7e8aea50b982429ee385f001aa88", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2016-12-13T05:23:14.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-22T05:35:31.000Z", "max_issues_repo_path": "misc/Parallel/Index.agda", "max_issues_repo_name": "nad/parser-combinators", "max_issues_repo_head_hexsha": "76774f54f466cfe943debf2da731074fe0c33644", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2018-01-22T22:21:41.000Z", "max_issues_repo_issues_event_max_datetime": "2018-01-24T16:39:37.000Z", "max_forks_repo_path": "misc/Parallel/Index.agda", "max_forks_repo_name": "nad/parser-combinators", "max_forks_repo_head_hexsha": "76774f54f466cfe943debf2da731074fe0c33644", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.5542635659, "max_line_length": 72, "alphanum_fraction": 0.5313727825, "num_tokens": 3021, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767970940974, "lm_q2_score": 0.787931185683219, "lm_q1q2_score": 0.6913913331438655}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.AbGroup.Properties where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Algebra.AbGroup.Base\n\n\nprivate variable\n ℓ : Level\n\nmodule AbGroupTheory (A'@(A , Ar) : AbGroup ℓ) where\n\n open AbGroupStr Ar\n\n comm-4 : (a b c d : A) → ((a + b) + (c + d) ≡ (a + c) + (b + d))\n comm-4 a b c d = ((a + b) + (c + d) ≡⟨ +Assoc (a + b) c d ⟩\n (((a + b) + c) + d) ≡⟨ cong (λ X → X + d) (sym (+Assoc a b c)) ⟩\n ((a + (b + c)) + d) ≡⟨ cong (λ X → (a + X) + d) (+Comm b c) ⟩\n ((a + (c + b)) + d) ≡⟨ cong (λ X → X + d) (+Assoc a c b) ⟩\n (((a + c) + b) + d) ≡⟨ sym (+Assoc (a + c) b d) ⟩\n ((a + c) + (b + d)) ∎)\n", "meta": {"hexsha": "8c0c455789adf8fe62511b8eed1069ed304b41c8", "size": 746, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/AbGroup/Properties.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/AbGroup/Properties.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/AbGroup/Properties.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.4347826087, "max_line_length": 83, "alphanum_fraction": 0.4262734584, "num_tokens": 298, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9496693674025231, "lm_q2_score": 0.7279754371026367, "lm_q1q2_score": 0.6913359728378362}} {"text": "{-# OPTIONS --cubical --safe --postfix-projections #-}\n\nmodule Data.Binary.Isomorphism where\n\nopen import Data.Binary.Definition\nopen import Data.Binary.Conversion\nopen import Data.Binary.Increment\nopen import Prelude\nimport Data.Nat as ℕ\n\ninc-suc : ∀ x → ⟦ inc x ⇓⟧ ≡ suc ⟦ x ⇓⟧\ninc-suc 0ᵇ i = 1\ninc-suc (1ᵇ x) i = 2 ℕ.+ ⟦ x ⇓⟧ ℕ.* 2\ninc-suc (2ᵇ x) i = suc (inc-suc x i ℕ.* 2)\n\ninc-2*-1ᵇ : ∀ n → inc ⟦ n ℕ.* 2 ⇑⟧ ≡ 1ᵇ ⟦ n ⇑⟧\ninc-2*-1ᵇ zero i = 1ᵇ 0ᵇ\ninc-2*-1ᵇ (suc n) i = inc (inc (inc-2*-1ᵇ n i))\n\n𝔹-rightInv : ∀ x → ⟦ ⟦ x ⇑⟧ ⇓⟧ ≡ x\n𝔹-rightInv zero = refl\n𝔹-rightInv (suc x) = inc-suc ⟦ x ⇑⟧ ; cong suc (𝔹-rightInv x)\n\n𝔹-leftInv : ∀ x → ⟦ ⟦ x ⇓⟧ ⇑⟧ ≡ x\n𝔹-leftInv 0ᵇ = refl\n𝔹-leftInv (1ᵇ x) = inc-2*-1ᵇ ⟦ x ⇓⟧ ; cong 1ᵇ_ (𝔹-leftInv x)\n𝔹-leftInv (2ᵇ x) = cong inc (inc-2*-1ᵇ ⟦ x ⇓⟧) ; cong 2ᵇ_ (𝔹-leftInv x)\n\n𝔹⇔ℕ : 𝔹 ⇔ ℕ\n𝔹⇔ℕ .fun = ⟦_⇓⟧\n𝔹⇔ℕ .inv = ⟦_⇑⟧\n𝔹⇔ℕ .rightInv = 𝔹-rightInv\n𝔹⇔ℕ .leftInv = 𝔹-leftInv\n", "meta": {"hexsha": "f5b3696f145cc2f107a7a9b206925aa37cc3ba8e", "size": 927, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Binary/Isomorphism.agda", "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_issues_repo_path": "Data/Binary/Isomorphism.agda", "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Binary/Isomorphism.agda", "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "avg_line_length": 27.2647058824, "max_line_length": 71, "alphanum_fraction": 0.5685005394, "num_tokens": 538, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9086179043564153, "lm_q2_score": 0.7606506526772884, "lm_q1q2_score": 0.6911408019829773}} {"text": "module Cats.Category.Mon where\n\nopen import Data.Unit using (⊤)\nopen import Relation.Binary using (Setoid ; _Preserves₂_⟶_⟶_ ; IsEquivalence)\nopen import Level\n\nopen import Cats.Category\nopen import Cats.Category.Setoids using (Setoids)\nopen import Cats.Util.Conv\n\nimport Cats.Util.Function as Fun\n\n\nrecord Monoid l l≈ : Set (suc (l ⊔ l≈)) where\n infixr 9 _⊕_\n\n field\n Universe : Setoid l l≈\n\n open Setoid Universe public\n\n field\n _⊕_ : Carrier → Carrier → Carrier\n unit : Carrier\n\n ⊕-resp : _⊕_ Preserves₂ _≈_ ⟶ _≈_ ⟶ _≈_\n assoc : ∀ {a b c} → (a ⊕ b) ⊕ c ≈ a ⊕ (b ⊕ c)\n id-l : ∀ {a} → unit ⊕ a ≈ a\n id-r : ∀ {a} → a ⊕ unit ≈ a\n\n module ≈ = IsEquivalence isEquivalence\n\n\nmodule _ (l l≈ : Level) where\n\n infixr 9 _∘_\n infixr 4 _≈_\n\n\n module Setoids = Category (Setoids l l≈)\n\n\n Obj : Set (suc (l ⊔ l≈))\n Obj = Monoid l l≈\n\n\n record _⇒_ (M N : Obj) : Set (l ⊔ l≈) where\n private\n module M = Monoid M\n module N = Monoid N\n\n field\n arr : M.Universe Setoids.⇒ N.Universe\n unit : (arr ⃗) M.unit N.≈ N.unit\n commute : ∀ {n m} → (arr ⃗) (n M.⊕ m) N.≈ (arr ⃗) n N.⊕ (arr ⃗) m\n\n open Cats.Category.Setoids._⇒_ arr public using (resp)\n\n open _⇒_ using (unit ; commute ; resp)\n\n\n instance\n HasArrow-⇒ : ∀ M N → HasArrow (M ⇒ N) _ _ _\n HasArrow-⇒ M N = record { Cat = Setoids l l≈ ; _⃗ = _⇒_.arr }\n\n\n id : ∀ {M} → M ⇒ M\n id {M} = record\n { arr = Setoids.id\n ; unit = refl\n ; commute = refl\n }\n where\n open Monoid M using (refl)\n\n\n _≈_ : ∀ {M N} (f g : M ⇒ N) → Set (l≈ ⊔ l)\n _≈_ = Setoids._≈_ Fun.on _⃗\n\n\n _∘_ : ∀ {M N O} → (N ⇒ O) → (M ⇒ N) → (M ⇒ O)\n _∘_ {M} {N} {O} f g = record\n { arr = f ⃗ Setoids.∘ g ⃗\n ; unit = trans (resp f (unit g)) (unit f)\n ; commute = trans (resp f (commute g)) (commute f)\n }\n where\n open Monoid O using (trans)\n\n\n Mon : Category (suc (l≈ ⊔ l)) (l≈ ⊔ l) (l≈ ⊔ l)\n Mon = record\n { Obj = Obj\n ; _⇒_ = _⇒_\n ; _≈_ = _≈_\n ; id = id\n ; _∘_ = _∘_\n ; equiv = Fun.on-isEquivalence _⃗ Setoids.equiv\n ; ∘-resp = Setoids.∘-resp\n ; id-r = Setoids.id-r\n ; id-l = Setoids.id-l\n ; assoc = λ { {f = f} {g} {h} → Setoids.assoc {f = f ⃗} {g ⃗} {h ⃗} }\n }\n\n\nmonoidAsCategory : ∀ {l l≈} → Monoid l l≈ → Category zero l l≈\nmonoidAsCategory M = record\n { Obj = ⊤\n ; _⇒_ = λ _ _ → M.Carrier\n ; _≈_ = M._≈_\n ; id = M.unit\n ; _∘_ = M._⊕_\n ; equiv = M.isEquivalence\n ; ∘-resp = M.⊕-resp\n ; id-r = M.id-r\n ; id-l = M.id-l\n ; assoc = M.assoc\n }\n where\n module M = Monoid M\n", "meta": {"hexsha": "822b26ef57992d9d5d2f882d1160219f0d767303", "size": 2592, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cats/Category/Mon.agda", "max_stars_repo_name": "alessio-b-zak/cats", "max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cats/Category/Mon.agda", "max_issues_repo_name": "alessio-b-zak/cats", "max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cats/Category/Mon.agda", "max_forks_repo_name": "alessio-b-zak/cats", "max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.4214876033, "max_line_length": 77, "alphanum_fraction": 0.5185185185, "num_tokens": 1094, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178969328287, "lm_q2_score": 0.760650658103136, "lm_q1q2_score": 0.6911408012662436}} {"text": "------------------------------------------------------------------------------\n-- Group theory congruence proofs using pattern matching\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule LogicalFramework.GroupCongruence where\n\nopen import GroupTheory.Base\n\n·-cong : ∀ {a b c d} → a ≡ b → c ≡ d → a · c ≡ b · d\n·-cong refl refl = refl\n\n·-leftCong : ∀ {a b c} → a ≡ b → a · c ≡ b · c\n·-leftCong refl = refl\n\n·-rightCong : ∀ {a b c} → b ≡ c → a · b ≡ a · c\n·-rightCong refl = refl\n\n⁻¹-cong : ∀ {a b} → a ≡ b → a ⁻¹ ≡ b ⁻¹\n⁻¹-cong refl = refl\n", "meta": {"hexsha": "95828cf7d3eb48616e557e204832d091ab7a8dcb", "size": 748, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/thesis/report/LogicalFramework/GroupCongruence.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/thesis/report/LogicalFramework/GroupCongruence.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/thesis/report/LogicalFramework/GroupCongruence.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 29.92, "max_line_length": 78, "alphanum_fraction": 0.4278074866, "num_tokens": 208, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9019206765295399, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.6911360809923746}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n-- Define Strong Monad; use the Wikipedia definition\n-- https://en.wikipedia.org/wiki/Strong_monad\n-- At the nLab, https://ncatlab.org/nlab/show/strong+monad\n-- there are two further definitions; the 2-categorical version is too complicated\n-- and the Moggi definition is a special case of the one here\n\nmodule Categories.Monad.Strong where\n\nopen import Level\nopen import Data.Product using (_,_)\n\nopen import Categories.Category\nopen import Categories.Functor renaming (id to idF)\nopen import Categories.Category.Monoidal\nopen import Categories.Category.Product\nopen import Categories.NaturalTransformation hiding (id)\n-- open import Categories.NaturalTransformation.NaturalIsomorphism\nopen import Categories.Monad\n\nprivate\n variable\n o ℓ e : Level\n\nrecord Strength {C : Category o ℓ e} (V : Monoidal C) (m : Monad C) : Set (o ⊔ ℓ ⊔ e) where\n open Category C\n open Monoidal V\n open Monad m using (F)\n module M = Monad m\n open NaturalTransformation M.η using (η)\n open NaturalTransformation M.μ renaming (η to μ)\n open Functor F\n field\n strengthen : NaturalTransformation (⊗ ∘F (idF ⁂ F)) (F ∘F ⊗)\n\n private\n module t = NaturalTransformation strengthen\n\n field\n -- strengthening with 1 is irrelevant\n identityˡ : {A : Obj} → F₁ (unitorˡ.from) ∘ t.η (unit , A) ≈ unitorˡ.from\n -- commutes with unit (of monad)\n η-comm : {A B : Obj} → t.η (A , B) ∘ (id ⊗₁ η B) ≈ η (A ⊗₀ B)\n -- strength commutes with multiplication\n μ-η-comm : {A B : Obj} → μ (A ⊗₀ B) ∘ F₁ (t.η (A , B)) ∘ t.η (A , F₀ B)\n ≈ t.η (A , B) ∘ id ⊗₁ μ B\n -- consecutive applications of strength commute (i.e. strength is associative)\n strength-assoc : {A B C : Obj} → F₁ associator.from ∘ t.η (A ⊗₀ B , C)\n ≈ t.η (A , B ⊗₀ C) ∘ id ⊗₁ t.η (B , C) ∘ associator.from\n\nrecord StrongMonad {C : Category o ℓ e} (V : Monoidal C) : Set (o ⊔ ℓ ⊔ e) where\n field\n m : Monad C\n strength : Strength V m\n", "meta": {"hexsha": "1ead12ae2237f7f87bf9f5f966716193a23102c9", "size": 1951, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Monad/Strong.agda", "max_stars_repo_name": "rei1024/agda-categories", "max_stars_repo_head_hexsha": "89d163f72caa7deeac9413f27bc1b4ed7f9e025b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Categories/Monad/Strong.agda", "max_issues_repo_name": "rei1024/agda-categories", "max_issues_repo_head_hexsha": "89d163f72caa7deeac9413f27bc1b4ed7f9e025b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Monad/Strong.agda", "max_forks_repo_name": "rei1024/agda-categories", "max_forks_repo_head_hexsha": "89d163f72caa7deeac9413f27bc1b4ed7f9e025b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.8392857143, "max_line_length": 91, "alphanum_fraction": 0.6724756535, "num_tokens": 619, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206765295399, "lm_q2_score": 0.7662936324115011, "lm_q1q2_score": 0.6911360713648595}} {"text": "------------------------------------------------------------------------------\n-- Mendelson's substitution\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOT.FOL.MendelsonSubstI where\n\n-- First-order logic with equality.\nopen import Common.FOL.FOL-Eq public\n\n------------------------------------------------------------------------------\n\n-- Mendelson's [2015] substitution (p. 93).\n\n-- (A7) x = y ⇒ (A(x,x) ⇒ B(x,y)) (substitutivity of equality)\n\n-- Using pattern matching.\nmendelsonSubst : (A : D → D → Set) → ∀ {x y} → x ≡ y → A x x → A x y\nmendelsonSubst A refl Axx = Axx\n\n-- From `subst` to Mendelson substitution.\nsubst→mendelsonSubst : (A : D → D → Set) → ∀ {x y} → x ≡ y → A x x → A x y\nsubst→mendelsonSubst A {x} = subst (λ z → A x z)\n\n-- From Mendelson substitution to `subst`.\nmendelsonSubst→subst : (A : D → Set) → ∀ {x y} → x ≡ y → A x → A y\nmendelsonSubst→subst A = mendelsonSubst (λ _ → A)\n\n------------------------------------------------------------------------------\n-- References\n\n-- Mendelson, Elliott (2015). Introduction to Mathematical Logic. CRC\n-- Press, 6th edition.\n", "meta": {"hexsha": "9c192fd154f9a075b76810416a8de6d9e9600b5c", "size": 1308, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/FOL/MendelsonSubstI.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/FOL/MendelsonSubstI.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/FOL/MendelsonSubstI.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 34.4210526316, "max_line_length": 78, "alphanum_fraction": 0.4640672783, "num_tokens": 329, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772417253256, "lm_q2_score": 0.7905303211371898, "lm_q1q2_score": 0.6909845625998308}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Label where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Foundations.Prelude using (isProp; transport)\n\nopen import Cubical.Data.Nat using (ℕ; zero; suc; isSetℕ)\nopen import Cubical.Data.Nat.Order using (_<_; _≤_; ≤-refl; <-weaken; ≤<-trans; m≤n-isProp; <-asym)\nopen import Cubical.Data.Maybe using (Maybe; nothing; just)\nopen import Cubical.Data.Empty using () renaming (rec to ⊥-elim)\n\nLabel : Set\nLabel = ℕ\n\ndata Record (A : Set) : Label -> Set where\n nil : forall {l} -> Record A l\n cons : forall {l} -> Record A l -> (l' : Label) -> A -> .(l < l') -> Record A l'\n\ndata _∈_ {A : Set} (l₁ : Label) {l : Label} : Record A l -> Set where\n here : forall {l'} {r : Record A l'} {x lt} -> l₁ ≡ l -> l₁ ∈ cons r l x lt\n there : forall {l'} {r : Record A l'} {x lt} -> l₁ ∈ r -> l₁ ∈ cons r l x lt\n\nfind : forall {A} {l} -> (l₁ : Label) -> (r : Record A l) -> l₁ ∈ r -> A\nfind l₁ (cons _ _ x _) (here e) = x\nfind l₁ (cons r _ _ _) (there l₁∈r) = find l₁ r l₁∈r\n\n∈-implies-≤ : forall {A} {l l'} {r : Record A l'} -> l ∈ r -> l ≤ l'\n∈-implies-≤ {l = l} (here e) = transport (λ i -> l ≤ e i) ≤-refl\n∈-implies-≤ (there {lt = lt} l∈r) = <-weaken (≤<-trans (∈-implies-≤ l∈r) lt)\n\nl∈r-isProp : forall {A} l {l'} (r : Record A l') -> isProp (l ∈ r)\nl∈r-isProp l {l'} (cons _ _ _ _) (here {lt = a} e1) (here {lt = b} e2) = λ i -> here {lt = m≤n-isProp a b i} (isSetℕ l l' e1 e2 i)\nl∈r-isProp l (cons {l = l₁} r _ _ _) (here {lt = k} e) (there y) = ⊥-elim (<-asym k (transport (λ i -> e i ≤ l₁) (∈-implies-≤ y)))\nl∈r-isProp l (cons {l = l₁} r _ _ _) (there {lt = k} x) (here e) = ⊥-elim (<-asym k (transport (λ i -> e i ≤ l₁) (∈-implies-≤ x)))\nl∈r-isProp l (cons r _ _ _) (there {lt = k1} x) (there {lt = k2} y) = let a = l∈r-isProp l r x y in λ i → there {lt = m≤n-isProp k1 k2 i} (a i)\n", "meta": {"hexsha": "43a0924a6494fafb41bfbea1c1a6c8905ccff775", "size": 1830, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Label.agda", "max_stars_repo_name": "elpinal/subtyping-agda", "max_stars_repo_head_hexsha": "fca08c53394f72c63d1bd7260fabfd70f73040b3", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2022-01-16T07:11:04.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T17:17:26.000Z", "max_issues_repo_path": "Label.agda", "max_issues_repo_name": "elpinal/subtyping-agda", "max_issues_repo_head_hexsha": "fca08c53394f72c63d1bd7260fabfd70f73040b3", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Label.agda", "max_forks_repo_name": "elpinal/subtyping-agda", "max_forks_repo_head_hexsha": "fca08c53394f72c63d1bd7260fabfd70f73040b3", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-24T10:47:09.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T10:47:09.000Z", "avg_line_length": 50.8333333333, "max_line_length": 143, "alphanum_fraction": 0.5628415301, "num_tokens": 774, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711756575749, "lm_q2_score": 0.8128673178375735, "lm_q1q2_score": 0.6909137897960219}} {"text": "----------------------------------------------------------------\n-- This file contains the definition natural transformations. --\n----------------------------------------------------------------\nmodule Category.NatTrans where\n\nopen import Level\n\nopen import Category.Category public\nopen import Category.Funct public \nopen import Category.CatEq public\n\nrecord NatTrans {l₁ l₂ : Level} \n {ℂ₁ : Cat {l₁}}\n {ℂ₂ : Cat {l₂}} \n (F G : Functor ℂ₁ ℂ₂) : Set (l₁ ⊔ l₂) where\n field\n -- The family of components.\n η : (A : Obj ℂ₁) → el (Hom ℂ₂ (omap F A) (omap G A))\n\n -- The natural transformation law.\n η-ax : ∀{A B}{f : el (Hom ℂ₁ A B)} → comm-square {ℂ = ℂ₂} (appT (fmap F) f) (η B) (η A) (appT (fmap G) f)\n\nopen NatTrans public\n", "meta": {"hexsha": "a3967c348d0dcb957b06f0f7fde81a109675ce1d", "size": 781, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "setoid-cats/Category/NatTrans.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "setoid-cats/Category/NatTrans.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "setoid-cats/Category/NatTrans.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.5416666667, "max_line_length": 109, "alphanum_fraction": 0.5044814341, "num_tokens": 218, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9334308147331957, "lm_q2_score": 0.740174367770488, "lm_q1q2_score": 0.6909015631526346}} {"text": "-- Agda program using the Iowa Agda library\n\nopen import bool\n\nmodule TO-PROVE-evendoublecoin\n (Choice : Set)\n (choose : Choice → 𝔹)\n (lchoice : Choice → Choice)\n (rchoice : Choice → Choice)\n where\n\nopen import eq\nopen import nat\nopen import list\nopen import maybe\n\n---------------------------------------------------------------------------\n-- Translated Curry operations:\n\nadd : ℕ → ℕ → ℕ\nadd zero x = x\nadd (suc y) z = suc (add y z)\n\ncoin : Choice → ℕ → ℕ\ncoin c1 x = if choose c1 then x else suc x\n\ndouble : ℕ → ℕ\ndouble x = add x x\n\neven : ℕ → 𝔹\neven zero = tt\neven (suc zero) = ff\neven (suc (suc x)) = even x\n\n---------------------------------------------------------------------------\n\nevendoublecoin : (c1 : Choice) → (x : ℕ) → (even (double (coin c1 x))) ≡ tt\nevendoublecoin c1 x = ?\n\n---------------------------------------------------------------------------\n", "meta": {"hexsha": "0047a030ccf42e0edd72a3ef6b9ef1dd6159349a", "size": 875, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "docs/src/tooldocs/verify/TO-PROVE-evendoublecoin.agda", "max_stars_repo_name": "DouglasRMiles/pakcs_lib", "max_stars_repo_head_hexsha": "c34d76595b23e5152e6a5883ad3b0ec1d840f6d9", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-06T18:32:48.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-21T22:25:28.000Z", "max_issues_repo_path": "docs/src/tooldocs/verify/TO-PROVE-evendoublecoin.agda", "max_issues_repo_name": "DouglasRMiles/pakcs_lib", "max_issues_repo_head_hexsha": "c34d76595b23e5152e6a5883ad3b0ec1d840f6d9", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-02-21T22:25:13.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-24T12:41:30.000Z", "max_forks_repo_path": "docs/src/tooldocs/verify/TO-PROVE-evendoublecoin.agda", "max_forks_repo_name": "DouglasRMiles/pakcs_lib", "max_forks_repo_head_hexsha": "c34d76595b23e5152e6a5883ad3b0ec1d840f6d9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-10-09T16:02:18.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-09T16:02:18.000Z", "avg_line_length": 21.3414634146, "max_line_length": 75, "alphanum_fraction": 0.4765714286, "num_tokens": 230, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9489172630429474, "lm_q2_score": 0.7279754548076478, "lm_q1q2_score": 0.690788476138518}} {"text": "data _≡_ {ℓ} {A : Set ℓ} (x : A) : A → Set ℓ where\n refl : x ≡ x\n\ndata ℕ : Set where\n zero : ℕ\n succ : ℕ → ℕ\n\nrecord Stream (A : Set) : Set where\n constructor stream\n field\n start : A\n next : A → A\n\nopen Stream\n\nℕ-stream : Stream ℕ\nstart ℕ-stream = zero\nnext ℕ-stream n = succ n\n\n0th : {A : Set} → Stream A → A\n0th s = start s\n\n3rd : {A : Set} → Stream A → A\n3rd s = next s (next s (next s (start s)))\n\n_ : 0th ℕ-stream ≡ zero\n_ = refl\n\n_ : 3rd ℕ-stream ≡ succ (succ (succ zero))\n_ = refl\n", "meta": {"hexsha": "095a76751c32a4690458a4cd5757a5ea9a306342", "size": 500, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Stream.agda", "max_stars_repo_name": "anqurvanillapy/fpl", "max_stars_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-08-24T22:47:47.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-24T22:47:47.000Z", "max_issues_repo_path": "agda/Stream.agda", "max_issues_repo_name": "anqurvanillapy/fpl", "max_issues_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Stream.agda", "max_forks_repo_name": "anqurvanillapy/fpl", "max_forks_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.1290322581, "max_line_length": 50, "alphanum_fraction": 0.572, "num_tokens": 195, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8856314828740729, "lm_q2_score": 0.7799928900257127, "lm_q1q2_score": 0.6907862598247057}} {"text": "open import Agda.Builtin.Bool\nopen import Agda.Builtin.Equality\nopen import Agda.Builtin.Sigma\nopen import Agda.Primitive\n\ninfixr 2 _×_\n\n_×_ : ∀ {a b} → Set a → Set b → Set (a ⊔ b)\nA × B = Σ A λ _ → B\n\n∃-notation exists-notation :\n ∀ {a b} {A : Set a} → (A → Set b) → Set (a ⊔ b)\n∃-notation = Σ _\nexists-notation = Σ _\n\nΣ-notation : ∀ {a b} (A : Set a) → (A → Set b) → Set (a ⊔ b)\nΣ-notation = Σ\n\ninfixr 2 ∃-notation exists-notation Σ-notation\n\nsyntax ∃-notation (λ x → B) = ∃ x × B\nsyntax exists-notation (λ x → B) = exists x × B\nsyntax Σ-notation A (λ x → B) = [ x ∶ A ] × B\n\n_ : ∃ b × b ≡ true × Bool\n_ = true , refl , false\n\n_ : exists b × b ≡ true\n_ = true , refl\n\n_ : [ b ∶ Bool ] × b ≡ true\n_ = true , refl\n\n_ : [ b₁ ∶ Bool ] × [ b₂ ∶ Bool ] × b₁ ≡ b₂\n_ = true , true , refl\n\n_ : [ b₁ ∶ Bool ] × ∃ b₂ × b₁ ≡ b₂\n_ = true , true , refl\n\n_ : [ f ∶ (Bool → Bool) ] × f ≡ λ x → x\n_ = (λ x → x) , refl\n\ndata List (A : Set) : Set where\n [] : List A\n cons : A → List A → List A\n\ninfixr 5 cons\n\nsyntax [] = [ ]\nsyntax cons x xs = x consed to xs\n\n_ : List Bool\n_ = true consed to false consed to [ ]\n\nf : List Bool → Bool\nf [ ] = true\nf (true consed to [ ]) = false\nf (false consed to x consed to [ ]) = x\nf _ = true\n", "meta": {"hexsha": "9a2382e2c0157592d060a3449e53d9f8cbc12a1b", "size": 1314, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue5201.agda", "max_stars_repo_name": "cagix/agda", "max_stars_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue5201.agda", "max_issues_repo_name": "cagix/agda", "max_issues_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue5201.agda", "max_forks_repo_name": "cagix/agda", "max_forks_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 21.9, "max_line_length": 60, "alphanum_fraction": 0.5129375951, "num_tokens": 510, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314617436728, "lm_q2_score": 0.7799928900257127, "lm_q1q2_score": 0.6907862433431438}} {"text": "module Acme.Data.Nat where\n\nopen import Acme.Type\n\nℕ : Type\nisZ : Type\nisS : Type\n\nℕ cs = isZ cs || isS cs\n\nisZ [] = false\nisZ (c ∷ cs) = c == 'Z' && isNil cs\n\nisS [] = false\nisS (c ∷ cs) = c == 'S' && ℕ cs\n\nzero = ℕ ∋ \"Z\"\n\nsuc : Elt ℕ → Elt ℕ\nsuc [ n ] = [ 'S' ∷ n ]\n\none = ℕ ∋ \"SZ\"\ntwo = suc (suc zero)\nthree = ℕ ∋ \"SSSZ\"\nfour = suc three\n\nmodule _ (P : Elt ℕ → Set)\n (P0 : P zero)\n (PS : ∀ n → P n → P (suc n))\n where\n\n induction : ∀ n → P n\n induction [ ccs@(c ∷ cs) ] = checkZ (c ≟ 'Z') cs refl where\n\n checkS : ∀ {b} → Reflects c 'S' b → ∀ cs →\n {{@0 _ : IsTrue (b && ℕ cs)}} →\n ∀ {ccs} → c ∷ cs ≡ ccs .value → P ccs\n checkS true cs refl = PS [ cs ] (induction [ cs ])\n\n checkZ : ∀ {b} → Reflects c 'Z' b → ∀ cs →\n {{@0 _ : IsTrue (b && isNil cs || isS (c ∷ cs))}} →\n ∀ {ccs} → c ∷ cs ≡ ccs .value → P ccs\n checkZ true [] refl = P0\n checkZ false cs eq = checkS (c ≟ 'S') cs eq\n\n_ : ∀ {P P0 PS} → induction P P0 PS zero ≡ P0\n_ = refl\n\n_ : ∀ {P P0 PS n} →\n induction P P0 PS (suc n) ≡ PS n (induction P P0 PS n)\n_ = refl\n\n_+_ : Elt ℕ → Elt ℕ → Elt ℕ\nm + n = induction (λ _ → Elt ℕ) n (λ _ → suc) m\n\n_ : three + one ≡ four\n_ = refl\n\n_*_ : Elt ℕ → Elt ℕ → Elt ℕ\nm * n = induction (λ _ → Elt ℕ) zero (λ _ → n +_) m\n\n_ : two * three ≡ four + two\n_ = refl\n\n\nzero-+ : ∀ m → zero + m ≡ m\nzero-+ m = refl\n\n+-zero : ∀ m → m + zero ≡ m\n+-zero =\n induction\n (λ m → m + zero ≡ m)\n refl\n (λ n → cong suc)\n\nsuc-+ : ∀ m n → suc m + n ≡ suc (m + n)\nsuc-+ m n = refl\n\n+-suc : ∀ m n → m + suc n ≡ suc (m + n)\n+-suc m n =\n induction\n (λ m → (m + suc n) ≡ suc (m + n))\n refl\n (λ n → cong suc)\n m\n\n+-comm : ∀ m n → m + n ≡ n + m\n+-comm m n =\n induction\n (λ m → m + n ≡ n + m)\n (sym (+-zero n))\n (λ m ih → trans (cong suc ih) (sym (+-suc n m)))\n m\n\n+-assoc : ∀ m n p → (m + n) + p ≡ m + (n + p)\n+-assoc m n p =\n induction\n (λ m → ((m + n) + p) ≡ (m + (n + p)))\n refl\n (λ m → cong suc)\n m\n", "meta": {"hexsha": "c05693975d6fefc20321fecce10129ab45e847d0", "size": 2025, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Acme/Data/Nat.agda", "max_stars_repo_name": "gallais/STRINaGda", "max_stars_repo_head_hexsha": "9e83fe708271b4437ae4e259175397d96d10aaf6", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-02-14T22:26:17.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-01T20:56:37.000Z", "max_issues_repo_path": "src/Acme/Data/Nat.agda", "max_issues_repo_name": "gallais/STRINaGda", "max_issues_repo_head_hexsha": "9e83fe708271b4437ae4e259175397d96d10aaf6", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Acme/Data/Nat.agda", "max_forks_repo_name": "gallais/STRINaGda", "max_forks_repo_head_hexsha": "9e83fe708271b4437ae4e259175397d96d10aaf6", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.8529411765, "max_line_length": 64, "alphanum_fraction": 0.4464197531, "num_tokens": 871, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110368115781, "lm_q2_score": 0.774583389368527, "lm_q1q2_score": 0.6907820155697724}} {"text": "\nmodule Oscar.Property.Associativity where\n\nopen import Oscar.Level\n\nrecord Associativity\n {𝔬} {⋆ : Set 𝔬}\n {𝔪} {_⇒_ : ⋆ → ⋆ → Set 𝔪}\n (_∙_ : ∀ {y z} → y ⇒ z → ∀ {x} → x ⇒ y → x ⇒ z)\n {𝔮} (_≤_ : ∀ {x y} → x ⇒ y → x ⇒ y → Set 𝔮)\n : Set (𝔬 ⊔ 𝔪 ⊔ 𝔮) where\n field\n associativity : ∀ {w x} (f : w ⇒ x) {y} (g : x ⇒ y) {z} (h : y ⇒ z) → ((h ∙ g) ∙ f) ≤ (h ∙ (g ∙ f))\n\nopen Associativity ⦃ … ⦄ public\n\nassociation : ∀\n {𝔬} {⋆ : Set 𝔬}\n {𝔪} {_⇒_ : ⋆ → ⋆ → Set 𝔪}\n (_∙_ : ∀ {y z} → y ⇒ z → ∀ {x} → x ⇒ y → x ⇒ z)\n {𝔮} (_≤_ : ∀ {x y} → x ⇒ y → x ⇒ y → Set 𝔮)\n ⦃ _ : Associativity _∙_ _≤_ ⦄\n → ∀ {w x} (f : w ⇒ x) {y} (g : x ⇒ y) {z} (h : y ⇒ z) → ((h ∙ g) ∙ f) ≤ (h ∙ (g ∙ f))\nassociation _∙_ _≤_ = associativity {_∙_ = _∙_} {_≤_ = _≤_}\n", "meta": {"hexsha": "c9836f2c5e23a421a45a0f5e02c58c939af50b7c", "size": 742, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Property/Associativity.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Property/Associativity.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Property/Associativity.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.68, "max_line_length": 103, "alphanum_fraction": 0.4083557951, "num_tokens": 423, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9294404077216355, "lm_q2_score": 0.7431680086124812, "lm_q1q2_score": 0.6907303769304605}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Definition\nopen import Groups.Lemmas\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.Definition\nopen import Rings.Homomorphisms.Definition\nopen import Groups.Homomorphisms.Lemmas\nopen import Rings.Subrings.Definition\nopen import Rings.Cosets\nopen import Rings.Isomorphisms.Definition\nopen import Groups.Isomorphisms.Definition\n\n\nmodule Rings.Ideals.FirstIsomorphismTheorem {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_+A_ _*A_ : A → A → A} {_+B_ _*B_ : B → B → B} {R1 : Ring S _+A_ _*A_} {R2 : Ring T _+B_ _*B_} {f : A → B} (hom : RingHom R1 R2 f) where\n\nopen import Rings.Quotients.Definition R1 R2 hom\nopen import Rings.Homomorphisms.Image hom\nopen import Rings.Homomorphisms.Kernel hom\nopen Setoid T\nopen Equivalence eq\nopen import Groups.FirstIsomorphismTheorem (RingHom.groupHom hom)\n\nringFirstIsomorphismTheorem : RingsIsomorphic (cosetRing R1 ringKernelIsIdeal) (subringIsRing R2 imageGroupSubring)\nRingsIsomorphic.f ringFirstIsomorphismTheorem = GroupsIsomorphic.isomorphism groupFirstIsomorphismTheorem\nRingHom.preserves1 (RingIso.ringHom (RingsIsomorphic.iso ringFirstIsomorphismTheorem)) = RingHom.preserves1 hom\nRingHom.ringHom (RingIso.ringHom (RingsIsomorphic.iso ringFirstIsomorphismTheorem)) = RingHom.ringHom hom\nGroupHom.groupHom (RingHom.groupHom (RingIso.ringHom (RingsIsomorphic.iso ringFirstIsomorphismTheorem))) = GroupHom.groupHom (RingHom.groupHom hom)\nGroupHom.wellDefined (RingHom.groupHom (RingIso.ringHom (RingsIsomorphic.iso ringFirstIsomorphismTheorem))) {x} {y} x=y = transferToRight (Ring.additiveGroup R2) t\n where\n t : f x +B Group.inverse (Ring.additiveGroup R2) (f y) ∼ Ring.0R R2\n t = transitive (Ring.groupIsAbelian R2) (transitive (Group.+WellDefined (Ring.additiveGroup R2) (symmetric (homRespectsInverse (RingHom.groupHom hom))) reflexive) (transitive (symmetric (GroupHom.groupHom (RingHom.groupHom hom))) x=y))\nRingIso.bijective (RingsIsomorphic.iso ringFirstIsomorphismTheorem) = GroupIso.bij (GroupsIsomorphic.proof groupFirstIsomorphismTheorem)\n\nringFirstIsomorphismTheorem' : RingsIsomorphic quotientByRingHom (subringIsRing R2 imageGroupSubring)\nRingsIsomorphic.f ringFirstIsomorphismTheorem' a = f a , (a , reflexive)\nRingHom.preserves1 (RingIso.ringHom (RingsIsomorphic.iso ringFirstIsomorphismTheorem')) = RingHom.preserves1 hom\nRingHom.ringHom (RingIso.ringHom (RingsIsomorphic.iso ringFirstIsomorphismTheorem')) {r} {s} = RingHom.ringHom hom\nRingHom.groupHom (RingIso.ringHom (RingsIsomorphic.iso ringFirstIsomorphismTheorem')) = GroupIso.groupHom (GroupsIsomorphic.proof (groupFirstIsomorphismTheorem'))\nRingIso.bijective (RingsIsomorphic.iso ringFirstIsomorphismTheorem') = GroupIso.bij (GroupsIsomorphic.proof groupFirstIsomorphismTheorem')\n", "meta": {"hexsha": "349123ca2825c2d18b3b229dc363b12af3f67e68", "size": 2925, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Ideals/FirstIsomorphismTheorem.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Ideals/FirstIsomorphismTheorem.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Ideals/FirstIsomorphismTheorem.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 66.4772727273, "max_line_length": 265, "alphanum_fraction": 0.8075213675, "num_tokens": 885, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9184802507195635, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6907086972911628}} {"text": "module Function.Domains.Id where\n\nimport Lvl\nopen import Functional using (_∘_)\nopen import Type\nopen import Type.Dependent\n\nprivate variable ℓₒ₁ ℓₒ₂ ℓₑ₁ ℓₑ₂ : Lvl.Level\n\nmodule _ {X : Type{ℓₒ₁}} {Y : Type{ℓₒ₂}} where\n data Image (f : X → Y) : Y → Type{ℓₒ₁ Lvl.⊔ ℓₒ₂} where\n intro : (x : X) → Image f (f(x))\n\n -- The image/range of a function.\n -- Represents the \"set\" of values of a function.\n -- Note: An element of Y and a proof that this element is the value of the function f is included so that (⊶ f) does not become injective when f is not.\n -- Note: A construction of this implies that X is non-empty.\n ⊶ : (X → Y) → Type{ℓₒ₁ Lvl.⊔ ℓₒ₂}\n ⊶ = Σ(Y) ∘ Image\n\n -- Represents the \"set\" of objects pointing to the value y of the function f.\n -- ∃(Fiber f(y)) is also called \"the fiber of the element y under the map f\".\n -- Fiber(f) is similar to the inverse image or the preimage of f when their argument is a singleton set.\n data Fiber (f : X → Y) : Y → X → Type{ℓₒ₁ Lvl.⊔ ℓₒ₂} where\n intro : (x : X) → Fiber f (f(x)) x\n", "meta": {"hexsha": "0ab6656c7984b6699d37421d34dc89fc10eb50aa", "size": 1046, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Function/Domains/Id.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Function/Domains/Id.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Function/Domains/Id.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.2307692308, "max_line_length": 154, "alphanum_fraction": 0.6567877629, "num_tokens": 374, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802484881361, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6907086956131013}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Algebra\nopen import Relation.Unary\nopen import Relation.Binary hiding (Decidable)\n\nmodule Data.FingerTree.Split.StoredPredicate\n {r m}\n (ℳ : Monoid r m)\n {s}\n {ℙ : Pred (Monoid.Carrier ℳ) s}\n (ℙ-resp : ℙ Respects (Monoid._≈_ ℳ))\n (ℙ? : Decidable ℙ)\n where\n\nopen Monoid ℳ renaming (Carrier to 𝓡)\nopen import Level using (_⊔_)\nopen import Relation.Nullary\n\ninfixl 2 _≈ℙ_[_]\nrecord ⟪ℙ⟫ (x : 𝓡) : Set (s ⊔ r ⊔ m) where\n constructor _≈ℙ_[_]\n field\n result : Dec (ℙ x)\n stored : 𝓡\n equiv : stored ≈ x\nopen ⟪ℙ⟫ public\n\n⟪ℙ?⟫ : ∀ x → ⟪ℙ⟫ x\nresult (⟪ℙ?⟫ x) = ℙ? x\nstored (⟪ℙ?⟫ x) = x\nequiv (⟪ℙ?⟫ x) = refl\n", "meta": {"hexsha": "74221fdc9e9f87229373438931aa2d5564d0725c", "size": 664, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Data/FingerTree/Split/StoredPredicate.agda", "max_stars_repo_name": "oisdk/agda-indexed-fingertree", "max_stars_repo_head_hexsha": "39c3d96937384b052b782ffddf4fdec68c5d139f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-02-26T07:04:54.000Z", "max_stars_repo_stars_event_max_datetime": "2019-02-26T07:04:54.000Z", "max_issues_repo_path": "src/Data/FingerTree/Split/StoredPredicate.agda", "max_issues_repo_name": "oisdk/agda-indexed-fingertree", "max_issues_repo_head_hexsha": "39c3d96937384b052b782ffddf4fdec68c5d139f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Data/FingerTree/Split/StoredPredicate.agda", "max_forks_repo_name": "oisdk/agda-indexed-fingertree", "max_forks_repo_head_hexsha": "39c3d96937384b052b782ffddf4fdec68c5d139f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.1212121212, "max_line_length": 46, "alphanum_fraction": 0.6189759036, "num_tokens": 287, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.918480252950991, "lm_q2_score": 0.7520125682019722, "lm_q1q2_score": 0.6907086938644718}} {"text": "{- small library for MGS 2021 -}\n\n{- products and sums -}\n\ninfix 10 _×_\nrecord _×_ (A B : Set) : Set where\n constructor _,_\n field\n proj₁ : A\n proj₂ : B\n\nopen _×_ public\n\nvariable\n A B C M : Set\n\ncurry : (A × B → C) → (A → B → C)\ncurry f a b = f (a , b) -- C-c C-,\nuncurry : (A → B → C) → (A × B → C)\nuncurry f (a , b) = f a b\n\ninfix 5 _⊎_\ndata _⊎_(A B : Set) : Set where\n inj₁ : A → A ⊎ B\n inj₂ : B → A ⊎ B\n\ncase : (A → C) → (B → C) → (A ⊎ B → C)\ncase f g (inj₁ a) = f a\ncase f g (inj₂ b) = g b\n\nuncase : (A ⊎ B → C) → (A → C) × (B → C)\nuncase f = (λ a → f (inj₁ a)) , λ b → f (inj₂ b)\n\n--case' : (A → C) × (B → C) → (A ⊎ B → C)\n--case' = uncurry case\n\nrecord ⊤ : Set where\n constructor tt\n\nopen ⊤ public\n\ndata ⊥ : Set where\n\ncase⊥ : ⊥ → A\ncase⊥ ()\n\ndata Bool : Set where\n true : Bool\n false : Bool\n\nif_then_else_ : Bool → A → A → A\nif true then x else y = x\nif false then x else y = y\n\n{- bool logic -}\n\n_&_ : Bool → Bool → Bool\ntrue & y = y\nfalse & y = false\n\n{- ∣ = \\mid -}\n\n_∣_ : Bool → Bool → Bool\ntrue ∣ y = true\nfalse ∣ y = y\n\n!_ : Bool → Bool\n! true = false\n! false = true\n\n_⇒b_ : Bool → Bool → Bool\ntrue ⇒b y = y\nfalse ⇒b y = true\n\n{- prop logic -}\n\nprop = Set\n\nvariable\n P Q R : prop\n\ninfix 3 _∧_\n_∧_ : prop → prop → prop\nP ∧ Q = P × Q\n\ninfix 2 _∨_\n_∨_ : prop → prop → prop\nP ∨ Q = P ⊎ Q\n\ninfixr 1 _⇒_\n_⇒_ : prop → prop → prop\nP ⇒ Q = P → Q\n\nFalse : prop\nFalse = ⊥\n\nTrue : prop\nTrue = ⊤\n\n¬_ : prop → prop\n¬ P = P ⇒ False\n\ninfix 0 _⇔_\n_⇔_ : prop → prop → prop\nP ⇔ Q = (P ⇒ Q) ∧ (Q ⇒ P)\n\nefq : False ⇒ P\nefq = case⊥\n\n{- classical principles -}\n\nTND : prop → prop\nTND P = P ∨ ¬ P\n\nRAA : prop → prop\nRAA P = ¬ ¬ P ⇒ P\n\ntnd⇒raa : TND P ⇒ RAA P\ntnd⇒raa (inj₁ p) nnp = p\ntnd⇒raa (inj₂ np) nnp = efq (nnp np)\n\nnnpnp : ¬ ¬ (P ∨ ¬ P)\nnnpnp h = h (inj₂ (λ p → h (inj₁ p)))\n\nraa⇒tnd : RAA (P ∨ ¬ P) ⇒ TND P\nraa⇒tnd raa = raa nnpnp\n\n{- natural numbers -}\n\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n\n{-# BUILTIN NATURAL ℕ #-}\n\ninfixl 6 _+_ \n\n_+_ : ℕ → ℕ → ℕ\nzero + n = n\nsuc m + n = suc (m + n)\n\ninfixl 7 _*_ \n\n_*_ : ℕ → ℕ → ℕ\nzero * n = zero\nsuc m * n = n + m * n\n\n{- Lists -}\n\ninfixr 5 _∷_\n\ndata List (A : Set) : Set where\n [] : List A\n _∷_ : A → List A → List A -- \\::\n\n_++_ : List A → List A → List A\n[] ++ ys = ys\n(x ∷ xs) ++ ys = x ∷ (xs ++ ys)\n\n{- Streams -}\n\nrecord Stream (A : Set) : Set where\n constructor _∷_\n coinductive\n field\n head : A\n tail : Stream A\n\nopen Stream public\n\nmapS : (A → B) → Stream A → Stream B\nhead (mapS f as) = f (head as)\ntail (mapS f as) = mapS f (tail as)\n\n{- conatural numbers -}\n\ndata Maybe (A : Set) : Set where\n nothing : Maybe A\n just : A → Maybe A\n\nrecord ℕ∞ : Set where\n coinductive\n field\n pred∞ : Maybe ℕ∞\n\nopen ℕ∞ public\n\nzero∞ : ℕ∞\npred∞ zero∞ = nothing\n\nsuc∞ : ℕ∞ → ℕ∞\npred∞ (suc∞ n) = just n\n\n∞ : ℕ∞\npred∞ ∞ = just ∞\n\n_+∞_ : ℕ∞ → ℕ∞ → ℕ∞\npred∞ (m +∞ n) with pred∞ m\n... | nothing = pred∞ n\n... | just m' = just (m' +∞ n)\n\n{- Vectors and Fin -}\n\nvariable i j k m n : ℕ\n\ndata Vec (A : Set) : ℕ → Set where\n [] : Vec A 0\n _∷_ : {n : ℕ} → A → Vec A n → Vec A (suc n)\n\n_++v_ : Vec A m → Vec A n → Vec A (m + n)\n[] ++v ys = ys\n(x ∷ xs) ++v ys = x ∷ (xs ++v ys)\n\ndata Fin : ℕ → Set where\n zero : Fin (suc n)\n suc : Fin n → Fin (suc n)\n\n_!!v_ : Vec A n → Fin n → A\n(x ∷ xs) !!v zero = x\n(x ∷ xs) !!v suc i = xs !!v i\n", "meta": {"hexsha": "b61f6d7895659303a226e46cc7d9e7865e165b0d", "size": 3294, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type Theory/mylib.agda", "max_stars_repo_name": "FoxySeta/mgs-2021", "max_stars_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Type Theory/mylib.agda", "max_issues_repo_name": "FoxySeta/mgs-2021", "max_issues_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-07-14T20:34:53.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-14T20:35:48.000Z", "max_forks_repo_path": "Type Theory/mylib.agda", "max_forks_repo_name": "FoxySeta/mgs-2021", "max_forks_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 14.9049773756, "max_line_length": 48, "alphanum_fraction": 0.5115361263, "num_tokens": 1486, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8354835289107307, "lm_q2_score": 0.8267117983401363, "lm_q1q2_score": 0.6907040906693535}} {"text": "{-# OPTIONS --without-K --rewriting #-}\n\nopen import HoTT\nopen import homotopy.SuspProduct\nopen import homotopy.SuspSmash\nopen import homotopy.JoinSusp\nopen import cohomology.Theory\n\nmodule cohomology.SphereProduct {i} (CT : CohomologyTheory i)\n (n : ℤ) (m : ℕ) (X : Ptd i) where\n\n open CohomologyTheory CT\n open import cohomology.Wedge CT\n\n private\n space-eq : ⊙Susp (⊙Sphere m ⊙× X)\n ⊙≃ ⊙Sphere (S m) ⊙∨ (⊙Susp X ⊙∨ ⊙Susp^ (S m) X)\n space-eq =\n ⊙∨-emap (⊙ide (⊙Sphere (S m)))\n (⊙∨-emap (⊙ide (⊙Susp X))\n (⊙*-Sphere-l m X ⊙∘e SuspSmash.⊙eq (⊙Sphere m) X))\n ⊙∘e SuspProduct.⊙eq (⊙Sphere m) X\n\n C-Sphere× : C n (⊙Sphere m ⊙× X)\n ≃ᴳ C n (⊙Lift (⊙Sphere m)) ×ᴳ (C n X ×ᴳ C n (⊙Susp^ m X))\n C-Sphere× =\n C n (⊙Sphere m ⊙× X)\n ≃ᴳ⟨ C-Susp n (⊙Sphere m ⊙× X) ⁻¹ᴳ ⟩\n C (succ n) (⊙Susp (⊙Sphere m ⊙× X))\n ≃ᴳ⟨ C-emap (succ n) (space-eq ⊙⁻¹) ⟩\n C (succ n) (⊙Sphere (S m) ⊙∨ (⊙Susp X ⊙∨ ⊙Susp^ (S m) X))\n ≃ᴳ⟨ C-emap (succ n) (⊙∨-emap (⊙Susp-emap (⊙lower-equiv {X = ⊙Sphere m})) (⊙ide _)) ⟩\n C (succ n) (⊙Susp (⊙Lift {j = i} (⊙Sphere m)) ⊙∨ (⊙Susp X ⊙∨ ⊙Susp^ (S m) X))\n ≃ᴳ⟨ C-Wedge (succ n) (⊙Susp (⊙Lift (⊙Sphere m))) (⊙Susp X ⊙∨ ⊙Susp^ (S m) X) ⟩\n C (succ n) (⊙Susp (⊙Lift (⊙Sphere m))) ×ᴳ C (succ n) (⊙Susp X ⊙∨ ⊙Susp^ (S m) X)\n ≃ᴳ⟨ ×ᴳ-emap (C-Susp n (⊙Lift (⊙Sphere m)))\n ( ×ᴳ-emap (C-Susp n X) (C-Susp n (⊙Susp^ m X))\n ∘eᴳ C-Wedge (succ n) (⊙Susp X) (⊙Susp^ (S m) X)) ⟩\n C n (⊙Lift (⊙Sphere m)) ×ᴳ (C n X ×ᴳ C n (⊙Susp^ m X))\n ≃ᴳ∎\n", "meta": {"hexsha": "1ee81bd289a3cc52c5ff0e053ebfd403cba5feda", "size": 1555, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "theorems/cohomology/SphereProduct.agda", "max_stars_repo_name": "timjb/HoTT-Agda", "max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "theorems/cohomology/SphereProduct.agda", "max_issues_repo_name": "timjb/HoTT-Agda", "max_issues_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "theorems/cohomology/SphereProduct.agda", "max_forks_repo_name": "timjb/HoTT-Agda", "max_forks_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-12-26T21:31:57.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-26T21:31:57.000Z", "avg_line_length": 37.9268292683, "max_line_length": 90, "alphanum_fraction": 0.5067524116, "num_tokens": 831, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9149009619539554, "lm_q2_score": 0.7549149868676284, "lm_q1q2_score": 0.6906724476786508}} {"text": "module PLRTree.Heap.Correctness {A : Set}(_≤_ : A → A → Set) where\n\nopen import BTree.Heap _≤_\nopen import PLRTree {A}\nopen import PLRTree.Heap _≤_ renaming (Heap to Heap')\n\nlemma-heap'-heap : {t : PLRTree} → Heap' t → Heap (forget t)\nlemma-heap'-heap leaf = leaf\nlemma-heap'-heap (node {t} {x} (lf≤* .x) (lf≤* .x) _ _) = single x\nlemma-heap'-heap (node {t} {x} (lf≤* .x) (nd≤* x≤y _ _) _ h'r) = right x≤y (lemma-heap'-heap h'r)\nlemma-heap'-heap (node {t} {x} (nd≤* x≤y _ _) (lf≤* .x) h'l _) = left x≤y (lemma-heap'-heap h'l)\nlemma-heap'-heap (node (nd≤* x≤y _ _) (nd≤* x≤y' _ _) h'l h'r) = both x≤y x≤y' (lemma-heap'-heap h'l) (lemma-heap'-heap h'r) \n", "meta": {"hexsha": "ca2977cb7e67b292511f108c576c3eed97da1a3e", "size": 653, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/PLRTree/Heap/Correctness.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/PLRTree/Heap/Correctness.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/PLRTree/Heap/Correctness.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 50.2307692308, "max_line_length": 125, "alphanum_fraction": 0.6003062787, "num_tokens": 296, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9407897459384732, "lm_q2_score": 0.7341195327172402, "lm_q1q2_score": 0.6906521286735231}} {"text": "open import Level\nopen import Data.Product\nopen import Relation.Nullary\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl; cong)\n\n\nmodule AlgProg where\n\n-- 1.1 Datatypes\n\nprivate\n variable\n l : Level\n\ndata Bool : Set where\n false : Bool\n true : Bool\n\ndata Char : Set where\n ca : Char\n cb : Char\n cc : Char\n\ndata Either : Set where\n bool : Bool → Either\n char : Char → Either\n\ndata Both : Set where\n tuple : Bool × Char → Both\n\nnot : Bool → Bool\nnot false = true\nnot true = false\n\nswitch : Both → Both\nswitch (tuple (b , c)) = tuple (not b , c)\n\nand : (Bool × Bool) → Bool\nand (false , _) = false\nand (true , b) = b\n\ncand : Bool → Bool → Bool\ncand false _ = false\ncand true b = b\n\ncurry' : {A B C : Set} → (B → (C → A)) → ((B × C) → A)\ncurry' f (b , c) = f b c\n\ndata maybe (A : Set l) : Set l where\n nothing : maybe A\n just : (x : A) → maybe A\n\n\n-- 1.2 Natural Numbers\n\ndata Nat : Set where\n zero' : Nat\n 1+ : Nat → Nat\n\n{-# BUILTIN NATURAL Nat #-}\n\n{-\nplus : Nat × Nat → Nat\nplus (n , zero') = n\nplus (n , succ m) = succ (plus (n , m))\n\nmult : Nat × Nat → Nat\nmult (n , zero') = zero'\nmult (n , succ m) = plus (n , mult (n , m))\n\n-}\n_+_ : Nat → Nat → Nat\nn + 0 = n\nn + (1+ m) = 1+ (n + m)\n\n_*_ : Nat → Nat → Nat\nn * 0 = 0\nn * (1+ m) = n + (n * m)\n\nfact : Nat → Nat\nfact 0 = 1\nfact (1+ n) = (1+ n) * (fact n)\n\nfib : Nat → Nat\nfib 0 = 0\nfib (1+ 0) = 1\nfib (1+ (1+ n)) = (fib n) + (fib (1+ n))\n\nfoldn : {A : Set} → A → (A → A) → (Nat → A)\nfoldn c h 0 = c\nfoldn c h (1+ n) = h (foldn c h n)\n\nfoldn1+is+ : (m n : Nat) → (m + n) ≡ ((foldn m 1+) n)\nfoldn1+is+ m 0 = refl\nfoldn1+is+ m (1+ n) = cong 1+ (foldn1+is+ m n)\n\n\nfoldn+is* : (m n : Nat) → m * n ≡ (foldn 0 (λ x → m + x)) n\nfoldn+is* m 0 = refl\nfoldn+is* m (1+ n) = cong (λ x → m + x) (foldn+is* m n)\n\nexpn : Nat → Nat → Nat\nexpn m = foldn 1 (λ n → m * n)\n\n\noutl : {A B : Set} → (A × B) → A\noutl (fst , snd) = fst\n\noutr : {A B : Set} → (A × B) → B\noutr (fst , snd) = snd\n\nf1 : (Nat × Nat) → Nat × Nat\nf1 (m , n) = (1+ m , (1+ m) * n)\n\nrec-× : {A B C D : Set} → (f : A → B) → (g : C → D) → ((A × C) -> (B × D))\nrec-× f g (a , c) = (f a , g c)\n\noutrFoldnIsFact : (n : Nat) → (foldn (0 , 1) f1 n) ≡ (n , fact n)\noutrFoldnIsFact zero' = refl\noutrFoldnIsFact (1+ n) rewrite (outrFoldnIsFact n) = refl\n\n-- 1.3 Lists\n\ndata listr (A : Set l) : Set l where\n nil : listr A\n cons : A → listr A → listr A\n\ndata listl (A : Set l) : Set l where\n nil : listl A\n snoc : listl A → A → listl A\n\nsnocr : {A : Set} → listr A → A → listr A\nsnocr nil a = cons a nil\nsnocr (cons a0 as) a1 = cons a0 (snocr as a1)\n\nconvert : {A : Set} → listl A → listr A\nconvert nil = nil\nconvert (snoc xs x) = snocr (convert xs) x\n\n_++_ : {A : Set} → listl A → listl A → listl A\nxs ++ nil = xs\nxs ++ snoc ys x = snoc (xs ++ ys) x\n\n++-assoc : {A : Set} → (xs ys zs : listl A) → (xs ++ (ys ++ zs)) ≡ ((xs ++ ys) ++ zs)\n++-assoc xs ys nil = refl\n++-assoc xs ys (snoc zs x) = cong (λ y → snoc y x) (++-assoc xs ys zs)\n\nlistrF : {A B : Set} → (A → B) → listr A → listr B\nlistrF f nil = nil\nlistrF f (cons x as) = cons (f x) (listrF f as)\n\nfoldr : {A B : Set} → B → (A → B → B) → (listr A → B)\nfoldr c h nil = c\nfoldr c h (cons a as) = h a (foldr c h as)\n\n", "meta": {"hexsha": "d691dadfa72daf790e942a03a2dbefb29f7686b4", "size": 3179, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "AlgProg.agda", "max_stars_repo_name": "polymonyrks/algprog", "max_stars_repo_head_hexsha": "a95902da2286ff588f4a97f6b23700fd325a564f", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "AlgProg.agda", "max_issues_repo_name": "polymonyrks/algprog", "max_issues_repo_head_hexsha": "a95902da2286ff588f4a97f6b23700fd325a564f", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "AlgProg.agda", "max_forks_repo_name": "polymonyrks/algprog", "max_forks_repo_head_hexsha": "a95902da2286ff588f4a97f6b23700fd325a564f", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.3782051282, "max_line_length": 85, "alphanum_fraction": 0.5363321799, "num_tokens": 1346, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278633625321, "lm_q2_score": 0.7826624738835052, "lm_q1q2_score": 0.690643174563055}} {"text": "-- Andreas, 2014-01-24, Issue 1411\n-- First split might not succeed in the unifier,\n-- so try later splits also.\n\n-- {-# OPTIONS -v tc.lhs:10 #-}\n\nopen import Common.Prelude\nopen import Common.Equality\n\ndata Fin : Nat → Set where\n fzero : (n : Nat) → Fin (suc n)\n fsuc : (n : Nat) → (i : Fin n) → Fin (suc n)\n\ndata _≅_ {A : Set} (a : A) : {B : Set} (b : B) → Set where\n refl : a ≅ a\n\nworks : ∀ n m (i : Fin n) (j : Fin m) → n ≡ m → fsuc n i ≅ fsuc m j → i ≅ j\nworks n .n i .i refl refl = refl\n\nfails : ∀ n m (i : Fin n) (j : Fin m) → fsuc n i ≅ fsuc m j → n ≡ m → i ≅ j\nfails n .n i .i refl refl = refl\n\n-- Refuse to solve heterogeneous constraint i : Fin n =?= j : Fin m\n-- when checking that the pattern refl has type fsuc n i ≅ fsuc m j\n\n-- Should work now.\n", "meta": {"hexsha": "d09d3232bc18b670ae836d934afdd717a2a86644", "size": 765, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue1411-2.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue1411-2.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue1411-2.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 28.3333333333, "max_line_length": 75, "alphanum_fraction": 0.5816993464, "num_tokens": 289, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240825770432, "lm_q2_score": 0.798186784940666, "lm_q1q2_score": 0.6906104287254073}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Groups.Definition\nopen import Groups.Lemmas\nopen import Groups.Abelian.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.Definition\nopen import Modules.Definition\n\n\nmodule Modules.Lemmas {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\n\nopen Group G'\nopen Ring R\nopen Setoid T\nopen Equivalence eq\nopen Module mod\n\nmoduleTimesZero : {x : M} → (0R · x) ∼ 0G\nmoduleTimesZero {x} = equalsDoubleImpliesZero G' (symmetric x=2x)\n where\n x=2x : (0R · x) ∼ (0R · x) + (0R · x)\n x=2x = transitive (dotWellDefined (Equivalence.symmetric (Setoid.eq S) (Group.identLeft additiveGroup)) reflexive) dotDistributesRight\n\nmoduleTimes-1 : {x : M} → ((Group.inverse additiveGroup 1R) · x) ∼ inverse x\nmoduleTimes-1 {x} = transitive (transferToRight' G' j) (inverseWellDefined G' dotIdentity)\n where\n i : ((1R · x) + ((Group.inverse additiveGroup 1R) · x)) ∼ 0G\n i = transitive (symmetric (transitive (dotWellDefined (Equivalence.symmetric (Setoid.eq S) (Group.invRight additiveGroup {1R})) reflexive) dotDistributesRight)) (moduleTimesZero)\n j : (((Group.inverse additiveGroup 1R) · x) + (1R · x)) ∼ 0G\n j = transitive (AbelianGroup.commutative G) i\n", "meta": {"hexsha": "d5650150e75cd6ebcfc537c0f88b0298d9fa537a", "size": 1466, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Modules/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Modules/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Modules/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 44.4242424242, "max_line_length": 276, "alphanum_fraction": 0.6718963165, "num_tokens": 510, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797075998823, "lm_q2_score": 0.757794360334681, "lm_q1q2_score": 0.6904868436705944}} {"text": "{-# OPTIONS --without-K --exact-split --safe #-}\n\nmodule Fragment.Algebra.Free.Atoms where\n\nopen import Level using (Level; _⊔_)\n\nopen import Data.Nat using (ℕ)\nopen import Data.Fin using (Fin)\n\nopen import Relation.Binary using (Setoid; IsEquivalence)\nopen import Relation.Binary.PropositionalEquality as PE using (_≡_)\n\nprivate\n variable\n a ℓ : Level\n\nmodule _ (A : Set a) where\n\n data BT (n : ℕ) : Set a where\n sta : A → BT n\n dyn : Fin n → BT n\n\nmodule _ (S : Setoid a ℓ) (n : ℕ) where\n\n open Setoid S renaming (Carrier to A)\n\n data _≍_ : BT A n → BT A n → Set (a ⊔ ℓ) where\n sta : ∀ {x y} → x ≈ y → sta x ≍ sta y\n dyn : ∀ {x y} → x ≡ y → dyn x ≍ dyn y\n\n private\n\n ≍-refl : ∀ {x} → x ≍ x\n ≍-refl {sta _} = sta refl\n ≍-refl {dyn _} = dyn PE.refl\n\n ≍-sym : ∀ {x y} → x ≍ y → y ≍ x\n ≍-sym (sta x≈y) = sta (sym x≈y)\n ≍-sym (dyn x≡y) = dyn (PE.sym x≡y)\n\n ≍-trans : ∀ {x y z} → x ≍ y → y ≍ z → x ≍ z\n ≍-trans (sta x≈y) (sta y≈z) = sta (trans x≈y y≈z)\n ≍-trans (dyn x≡y) (dyn y≡z) = dyn (PE.trans x≡y y≡z)\n\n ≍-isEquivalence : IsEquivalence _≍_\n ≍-isEquivalence = record { refl = ≍-refl\n ; sym = ≍-sym\n ; trans = ≍-trans\n }\n\n Atoms : Setoid a (a ⊔ ℓ)\n Atoms = record { Carrier = BT (Setoid.Carrier S) n\n ; _≈_ = _≍_\n ; isEquivalence = ≍-isEquivalence\n }\n", "meta": {"hexsha": "192fbbd2aad22b623b06e3d848908e48559c5bef", "size": 1456, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Fragment/Algebra/Free/Atoms.agda", "max_stars_repo_name": "yallop/agda-fragment", "max_stars_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 18, "max_stars_repo_stars_event_min_datetime": "2021-06-15T15:45:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T17:26:09.000Z", "max_issues_repo_path": "src/Fragment/Algebra/Free/Atoms.agda", "max_issues_repo_name": "yallop/agda-fragment", "max_issues_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-06-16T09:44:31.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-16T10:24:15.000Z", "max_forks_repo_path": "src/Fragment/Algebra/Free/Atoms.agda", "max_forks_repo_name": "yallop/agda-fragment", "max_forks_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2021-06-15T15:34:50.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-16T08:04:31.000Z", "avg_line_length": 26.0, "max_line_length": 67, "alphanum_fraction": 0.5020604396, "num_tokens": 552, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467770088163, "lm_q2_score": 0.7853085909370422, "lm_q1q2_score": 0.6904015166796356}} {"text": "{-# OPTIONS --without-K #-}\n\nmodule T where\n\nopen import Level\nopen import Relation.Binary.PropositionalEquality \n using (_≡_; refl; sym; trans; cong; subst; module ≡-Reasoning)\nopen import Data.Nat using (ℕ; _+_)\nopen import Data.Fin using (Fin) \n\ndata Exp : Set where\n ONE : Exp\n PLUS : Exp → Exp → Exp\n\nval : Exp → ℕ\nval ONE = 1\nval (PLUS e₁ e₂) = val e₁ + val e₂\n\ndata eqExp : Exp → Exp → Set where\n idExp : {e : Exp} → eqExp e e\n transExp : {e₁ e₂ e₃ : Exp} → (eqExp e₁ e₂) → (eqExp e₂ e₃) → (eqExp e₁ e₃)\n\nval≡ : {e₁ e₂ : Exp} → (eqExp e₁ e₂) → (val e₁ ≡ val e₂)\nval≡ idExp = refl\nval≡ (transExp α₁ α₂) = trans (val≡ α₁) (val≡ α₂)\n\ntrans-assoc : {A : Set} {x y z w : A} → (p : x ≡ y) (q : y ≡ z) (r : z ≡ w) → \n trans (trans p q) r ≡ trans p (trans q r)\ntrans-assoc refl refl refl = refl \n\nsubst-trans : (P : ℕ → Set) (p : (n : ℕ) → P n) {e₁ e₂ e₃ : Exp} → \n (α : eqExp e₁ e₂) (β : eqExp e₂ e₃) (v : P (val e₁)) → \n subst P (trans (val≡ α) (val≡ β)) v ≡\n subst P (val≡ β) (subst P (val≡ α) v)\nsubst-trans P p idExp β v = refl\nsubst-trans P p (transExp α₁ α₂) β v = \n begin (subst P (trans (trans (val≡ α₁) (val≡ α₂)) (val≡ β)) v\n ≡⟨ cong (λ x → subst P x v) \n (trans-assoc (val≡ α₁) (val≡ α₂) (val≡ β)) ⟩\n subst P (trans (val≡ α₁) (trans (val≡ α₂) (val≡ β))) v\n ≡⟨ refl ⟩ \n subst P (trans (val≡ α₁) (val≡ (transExp α₂ β))) v\n ≡⟨ subst-trans P p α₁ (transExp α₂ β) v ⟩ \n subst P (val≡ (transExp α₂ β)) (subst P (val≡ α₁) v)\n ≡⟨ refl ⟩ \n subst P (trans (val≡ α₂) (val≡ β)) (subst P (val≡ α₁) v)\n ≡⟨ subst-trans P p α₂ β (subst P (val≡ α₁) v) ⟩ \n subst P (val≡ β) (subst P (val≡ α₂) (subst P (val≡ α₁) v))\n ≡⟨ cong (λ x → subst P (val≡ β) x) (sym (subst-trans P p α₁ α₂ v)) ⟩ \n subst P (val≡ β) (subst P (trans (val≡ α₁) (val≡ α₂)) v)\n ≡⟨ refl ⟩ \n subst P (val≡ β) (subst P (val≡ (transExp α₁ α₂)) v) ∎)\n where open ≡-Reasoning\n\npr : {P : ℕ → Set} {p : (n : ℕ) → P n} {e₁ e₂ : Exp} {α : eqExp e₁ e₂} → \n subst P (val≡ α) (p (val e₁)) ≡ p (val e₂)\npr {P} {p} {e} {.e} {idExp} = refl\npr {P} {p} {e₁} {e₃} {transExp {e₂ = e₂} α β} = \n begin (subst P (val≡ (transExp α β)) (p (val e₁))\n ≡⟨ refl ⟩\n subst P (trans (val≡ α) (val≡ β)) (p (val e₁))\n ≡⟨ subst-trans P p α β (p (val e₁)) ⟩ \n subst P (val≡ β) (subst P (val≡ α) (p (val e₁)))\n ≡⟨ cong (λ x → subst P (val≡ β) x) (pr {P} {p} {e₁} {e₂} {α}) ⟩ \n subst P (val≡ β) (p (val e₂))\n ≡⟨ pr {P} {p} {e₂} {e₃} {β} ⟩ \n p (val e₃) ∎)\n where open ≡-Reasoning\n", "meta": {"hexsha": "748581ee2fbf589898800b2383dba06650a18c59", "size": 2673, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Univalence/Obsolete/T.agda", "max_stars_repo_name": "JacquesCarette/pi-dual", "max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 14, "max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z", "max_issues_repo_path": "Univalence/Obsolete/T.agda", "max_issues_repo_name": "JacquesCarette/pi-dual", "max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z", "max_forks_repo_path": "Univalence/Obsolete/T.agda", "max_forks_repo_name": "JacquesCarette/pi-dual", "max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z", "avg_line_length": 38.7391304348, "max_line_length": 78, "alphanum_fraction": 0.4915824916, "num_tokens": 1186, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467706759584, "lm_q2_score": 0.7853085758631159, "lm_q1q2_score": 0.6904014984541942}} {"text": "------------------------------------------------------------------------------\n-- Agda-Prop Library.\n------------------------------------------------------------------------------\n\nopen import Data.Nat using ( ℕ )\n\nmodule Data.PropFormula.Dec ( n : ℕ ) where\n\n------------------------------------------------------------------------------\n\nopen import Data.PropFormula.Syntax n\n\nopen import Data.Bool.Base using ( Bool; false; true; not; T )\nopen import Data.Fin using ( Fin; suc; zero )\nopen import Data.Empty hiding (⊥)\n\nopen import Function using ( _$_; _∘_ )\nopen import Relation.Binary.PropositionalEquality using ( _≡_; refl; cong )\n\n------------------------------------------------------------------------------\n\ndata ⊥₂ : Set where\n\n⊥₂-elim : ∀ {Whatever : Set} → ⊥₂ → Whatever\n⊥₂-elim ()\n\ninfix 3 ¬₂_\n\n¬₂_ : Set → Set\n¬₂ P = P → ⊥₂\n\n-- Decidable relations.\n\ndata Dec (P : Set) : Set where\n yes : ( p : P) → Dec P\n no : (¬p : ¬₂ P) → Dec P\n\n⌊_⌋ : {P : Set} → Dec P → Bool\n⌊ yes _ ⌋ = true\n⌊ no _ ⌋ = false\n\nREL : Set → Set → Set₁\nREL A B = A → B → Set\n\nDecidable : {A : Set} {B : Set} → REL A B → Set\nDecidable _∼_ = ∀ x y → Dec (x ∼ y)\n", "meta": {"hexsha": "9133c2629dadaad37b2a512ce2027e4f0044ecd5", "size": 1171, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Data/PropFormula/Dec.agda", "max_stars_repo_name": "jonaprieto/agda-prop", "max_stars_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 13, "max_stars_repo_stars_event_min_datetime": "2017-05-01T16:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T03:33:12.000Z", "max_issues_repo_path": "src/Data/PropFormula/Dec.agda", "max_issues_repo_name": "jonaprieto/agda-prop", "max_issues_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2017-03-08T14:33:10.000Z", "max_issues_repo_issues_event_max_datetime": "2017-12-18T16:34:21.000Z", "max_forks_repo_path": "src/Data/PropFormula/Dec.agda", "max_forks_repo_name": "jonaprieto/agda-prop", "max_forks_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2017-03-30T16:41:56.000Z", "max_forks_repo_forks_event_max_datetime": "2017-12-01T17:01:25.000Z", "avg_line_length": 24.914893617, "max_line_length": 78, "alphanum_fraction": 0.4286934244, "num_tokens": 325, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9252299570920386, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6903501537294846}} {"text": "\nmodule Adjoint where\n\nimport Category\nimport Functor\n\nopen Category\nopen Functor using (Functor)\n\nmodule Adj where\n\n open Functor.Projections using (Map; map)\n\n data _⊢_ {ℂ ⅅ : Cat}(F : Functor ℂ ⅅ)(G : Functor ⅅ ℂ) : Set1 where\n adjunction :\n (_* : {X : Obj ℂ}{Y : Obj ⅅ} -> Map F X ─→ Y -> X ─→ Map G Y)\n (_# : {X : Obj ℂ}{Y : Obj ⅅ} -> X ─→ Map G Y -> Map F X ─→ Y)\n (inv₁ : {X : Obj ℂ}{Y : Obj ⅅ}(g : X ─→ Map G Y) -> g # * == g)\n (inv₂ : {X : Obj ℂ}{Y : Obj ⅅ}(f : Map F X ─→ Y) -> f * # == f)\n (nat₁ : {X₁ X₂ : Obj ℂ}{Y₁ Y₂ : Obj ⅅ}\n\t (f : Y₁ ─→ Y₂)(g : X₂ ─→ X₁)(h : Map F X₁ ─→ Y₁) ->\n\t (f ∘ h ∘ map F g) * == map G f ∘ (h *) ∘ g\n )\n (nat₂ : {X₁ X₂ : Obj ℂ}{Y₁ Y₂ : Obj ⅅ}\n\t (f : Y₁ ─→ Y₂)(g : X₂ ─→ X₁)(h : X₁ ─→ Map G Y₁) ->\n\t (map G f ∘ h ∘ g) # == f ∘ (h #) ∘ map F g\n )\n -> F ⊢ G\n\nopen Adj public\n\n", "meta": {"hexsha": "e04b61d135edd98d941c446f2d74ded99f4e0e95", "size": 886, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/cat/Adjoint.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/cat/Adjoint.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/cat/Adjoint.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 27.6875, "max_line_length": 69, "alphanum_fraction": 0.4401805869, "num_tokens": 412, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9441768588653855, "lm_q2_score": 0.7310585669110203, "lm_q1q2_score": 0.6902485813526774}} {"text": "------------------------------------------------------------------------------\n-- Proving properties without using pattern matching on refl\n------------------------------------------------------------------------------\n\n{-# OPTIONS --no-pattern-matching #-}\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n\nmodule FOT.GroupTheory.NoPatternMatchingOnRefl where\n\nopen import GroupTheory.Base\n\n------------------------------------------------------------------------------\n-- From GroupTheory.PropertiesI\n\n-- Congruence properties\n\n-- The propositional equality is compatible with the binary operation.\n\n·-leftCong : ∀ {a b c} → a ≡ b → a · c ≡ b · c\n·-leftCong {a} {c = c} h = subst (λ t → a · c ≡ t · c) h refl\n\n·-rightCong : ∀ {a b c} → b ≡ c → a · b ≡ a · c\n·-rightCong {a} {b} h = subst (λ t → a · b ≡ a · t) h refl\n\n-- The propositional equality is compatible with the inverse function.\n⁻¹-cong : ∀ {a b} → a ≡ b → a ⁻¹ ≡ b ⁻¹\n⁻¹-cong {a} h = subst (λ t → a ⁻¹ ≡ t ⁻¹) h refl\n", "meta": {"hexsha": "8621f7745b4c7ac52f76072c7354449096c37ae7", "size": 1060, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/GroupTheory/NoPatternMatchingOnRefl.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/GroupTheory/NoPatternMatchingOnRefl.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/GroupTheory/NoPatternMatchingOnRefl.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 35.3333333333, "max_line_length": 78, "alphanum_fraction": 0.4726415094, "num_tokens": 275, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9073122188543453, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6901476265306985}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Lists made up entirely of unique elements (setoid equality)\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary using (Rel; Setoid)\n\nmodule Data.List.Relation.Unary.Unique.Setoid {a ℓ} (S : Setoid a ℓ) where\n\nopen Setoid S renaming (Carrier to A)\n\nopen import Data.List.Base\nimport Data.List.Relation.Unary.AllPairs as AllPairsM\nopen import Level using (_⊔_)\nopen import Relation.Unary using (Pred)\nopen import Relation.Nullary using (¬_)\n\n\n------------------------------------------------------------------------\n-- Definition\n\nprivate\n\n Distinct : Rel A ℓ\n Distinct x y = ¬ (x ≈ y)\n\nopen import Data.List.Relation.Unary.AllPairs.Core Distinct\n renaming (AllPairs to Unique)\n public\n\nopen import Data.List.Relation.Unary.AllPairs {R = Distinct}\n using (head; tail)\n public\n", "meta": {"hexsha": "8622bda3d6aa2e326f7f5d4883bc2bb294554302", "size": 986, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/List/Relation/Unary/Unique/Setoid.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/List/Relation/Unary/Unique/Setoid.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/List/Relation/Unary/Unique/Setoid.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 26.6486486486, "max_line_length": 74, "alphanum_fraction": 0.5628803245, "num_tokens": 208, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9073122113355092, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.690147620811491}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Some derivable properties\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Algebra\n\nmodule Algebra.Properties.Ring {r₁ r₂} (R : Ring r₁ r₂) where\n\nimport Algebra.Properties.AbelianGroup as AGP\nopen import Function\nimport Relation.Binary.Reasoning.Setoid as EqR\n\nopen Ring R\nopen EqR setoid\n\nopen AGP +-abelianGroup public\n renaming ( ⁻¹-involutive to -‿involutive\n ; left-identity-unique to +-left-identity-unique\n ; right-identity-unique to +-right-identity-unique\n ; identity-unique to +-identity-unique\n ; left-inverse-unique to +-left-inverse-unique\n ; right-inverse-unique to +-right-inverse-unique\n ; ⁻¹-∙-comm to -‿+-comm\n )\n\n-‿*-distribˡ : ∀ x y → - x * y ≈ - (x * y)\n-‿*-distribˡ x y = begin\n - x * y ≈⟨ sym $ +-identityʳ _ ⟩\n - x * y + 0# ≈⟨ +-congˡ $ sym (-‿inverseʳ _) ⟩\n - x * y + (x * y + - (x * y)) ≈⟨ sym $ +-assoc _ _ _ ⟩\n - x * y + x * y + - (x * y) ≈⟨ +-congʳ $ sym (distribʳ _ _ _) ⟩\n (- x + x) * y + - (x * y) ≈⟨ +-congʳ $ *-congʳ $ -‿inverseˡ _ ⟩\n 0# * y + - (x * y) ≈⟨ +-congʳ $ zeroˡ _ ⟩\n 0# + - (x * y) ≈⟨ +-identityˡ _ ⟩\n - (x * y) ∎\n\n-‿*-distribʳ : ∀ x y → x * - y ≈ - (x * y)\n-‿*-distribʳ x y = begin\n x * - y ≈⟨ sym $ +-identityˡ _ ⟩\n 0# + x * - y ≈⟨ +-congʳ $ sym (-‿inverseˡ _) ⟩\n - (x * y) + x * y + x * - y ≈⟨ +-assoc _ _ _ ⟩\n - (x * y) + (x * y + x * - y) ≈⟨ +-congˡ $ sym (distribˡ _ _ _) ⟩\n - (x * y) + x * (y + - y) ≈⟨ +-congˡ $ *-congˡ $ -‿inverseʳ _ ⟩\n - (x * y) + x * 0# ≈⟨ +-congˡ $ zeroʳ _ ⟩\n - (x * y) + 0# ≈⟨ +-identityʳ _ ⟩\n - (x * y) ∎\n", "meta": {"hexsha": "5ba6b3b505e41168156aa3592c5dd07ac506118c", "size": 1951, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/Ring.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/Ring.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/Ring.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.2549019608, "max_line_length": 72, "alphanum_fraction": 0.4161968221, "num_tokens": 742, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869916479466, "lm_q2_score": 0.7879312056025699, "lm_q1q2_score": 0.6900599001802143}} {"text": "{-# OPTIONS --safe --experimental-lossy-unification #-}\nmodule Cubical.Algebra.CommRing.Instances.MultivariatePoly-notationZ where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.FinData\n\nopen import Cubical.Relation.Nullary\n\nopen import Cubical.Algebra.Ring\nopen import Cubical.Algebra.CommRing\nopen import Cubical.Algebra.CommRing.FGIdeal\nopen import Cubical.Algebra.CommRing.QuotientRing\nopen import Cubical.Algebra.CommRing.Instances.Int\n\nopen import Cubical.Algebra.Polynomials.Multivariate.Base\nopen import Cubical.Algebra.CommRing.Instances.MultivariatePoly\nopen import Cubical.Algebra.CommRing.Instances.MultivariatePoly-Quotient\n\n\n\n-- Notations for ℤ polynomial rings\n\nℤ[X] : CommRing ℓ-zero\nℤ[X] = PolyCommRing ℤCommRing 1\n\nℤ[x] : Type ℓ-zero\nℤ[x] = fst ℤ[X]\n\nℤ[X,Y] : CommRing ℓ-zero\nℤ[X,Y] = PolyCommRing ℤCommRing 2\n\nℤ[x,y] : Type ℓ-zero\nℤ[x,y] = fst ℤ[X,Y]\n\nℤ[X,Y,Z] : CommRing ℓ-zero\nℤ[X,Y,Z] = PolyCommRing ℤCommRing 3\n\nℤ[x,y,z] : Type ℓ-zero\nℤ[x,y,z] = fst ℤ[X,Y,Z]\n\nℤ[X1,···,Xn] : (n : ℕ) → CommRing ℓ-zero\nℤ[X1,···,Xn] n = A[X1,···,Xn] ℤCommRing n\n\nℤ[x1,···,xn] : (n : ℕ) → Type ℓ-zero\nℤ[x1,···,xn] n = fst (ℤ[X1,···,Xn] n)\n\n\n\n-- Notation for quotiented ℤ polynomial ring\n\n : FinVec ℤ[x] 1\n = ℤCommRing 1 0 1\n\n : FinVec ℤ[x] 1\n = ℤCommRing 1 0 2\n\n : FinVec ℤ[x] 1\n = ℤCommRing 1 0 3\n\n : (k : ℕ) → FinVec ℤ[x] 1\n k = ℤCommRing 1 0 k\n\nℤ[X]/X : CommRing ℓ-zero\nℤ[X]/X = A[X1,···,Xn]/ ℤCommRing 1 0 1\n\nℤ[x]/x : Type ℓ-zero\nℤ[x]/x = fst ℤ[X]/X\n\nℤ[X]/X² : CommRing ℓ-zero\nℤ[X]/X² = A[X1,···,Xn]/ ℤCommRing 1 0 2\n\nℤ[x]/x² : Type ℓ-zero\nℤ[x]/x² = fst ℤ[X]/X²\n\nℤ[X]/X³ : CommRing ℓ-zero\nℤ[X]/X³ = A[X1,···,Xn]/ ℤCommRing 1 0 3\n\nℤ[x]/x³ : Type ℓ-zero\nℤ[x]/x³ = fst ℤ[X]/X³\n\nℤ[X1,···,Xn]/ : (n : ℕ) → CommRing ℓ-zero\nℤ[X1,···,Xn]/ n = A[X1,···,Xn]/ ℤCommRing n\n\nℤ[x1,···,xn]/ : (n : ℕ) → Type ℓ-zero\nℤ[x1,···,xn]/ n = fst (ℤ[X1,···,Xn]/ n)\n\n\n-- Warning there is two possible definitions of ℤ[X]\n-- they only holds up to a path\n\nℤ'[X]/X : CommRing ℓ-zero\nℤ'[X]/X = A[X1,···,Xn]/ ℤCommRing 1\n\nequivℤ[X] : ℤ'[X]/X ≡ ℤ[X]/X\nequivℤ[X] = cong (λ X → (A[X1,···,Xn] ℤCommRing 1) / (genIdeal ((A[X1,···,Xn] ℤCommRing 1)) X))\n (funExt (λ {zero → refl }))\n", "meta": {"hexsha": "17040f67ba73ef45b4170ce9c3385a87fcf8dfcb", "size": 2366, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommRing/Instances/MultivariatePoly-notationZ.agda", "max_stars_repo_name": "guilhermehas/cubical", "max_stars_repo_head_hexsha": "ce3120d3f8d692847b2744162bcd7a01f0b687eb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z", "max_issues_repo_path": "Cubical/Algebra/CommRing/Instances/MultivariatePoly-notationZ.agda", "max_issues_repo_name": "guilhermehas/cubical", "max_issues_repo_head_hexsha": "ce3120d3f8d692847b2744162bcd7a01f0b687eb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommRing/Instances/MultivariatePoly-notationZ.agda", "max_forks_repo_name": "guilhermehas/cubical", "max_forks_repo_head_hexsha": "ce3120d3f8d692847b2744162bcd7a01f0b687eb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.898989899, "max_line_length": 95, "alphanum_fraction": 0.6280642434, "num_tokens": 1113, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8539127455162773, "lm_q2_score": 0.8080672181749421, "lm_q1q2_score": 0.6900188968334654}} {"text": "------------------------------------------------------------------------------\n-- Propositional equality\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- This module is re-exported by (some) \"base\" modules.\n\nmodule Common.FOL.Relation.Binary.PropositionalEquality where\n\nopen import Common.FOL.FOL using ( D )\n\ninfix 4 _≡_\n\n------------------------------------------------------------------------------\n-- The identity type on the universe of discourse.\ndata _≡_ (x : D) : D → Set where\n refl : x ≡ x\n\n-- Elimination rule.\nsubst : (A : D → Set) → ∀ {x y} → x ≡ y → A x → A y\nsubst A refl Ax = Ax\n\n-- Identity properties\n\nsym : ∀ {x y} → x ≡ y → y ≡ x\nsym refl = refl\n\ntrans : ∀ {x y z} → x ≡ y → y ≡ z → x ≡ z\ntrans refl h = h\n\ntrans₂ : ∀ {w x y z} → w ≡ x → x ≡ y → y ≡ z → w ≡ z\ntrans₂ refl refl h = h\n\nsubst₂ : (A : D → D → Set) → ∀ {x x' y y'} →\n x ≡ y → x' ≡ y' →\n A x x' →\n A y y'\nsubst₂ A refl refl Axs = Axs\n\nsubst₃ : (A : D → D → D → Set) → ∀ {x₁ x₂ x₃ y₁ y₂ y₃} →\n x₁ ≡ y₁ → x₂ ≡ y₂ → x₃ ≡ y₃ →\n A x₁ x₂ x₃ →\n A y₁ y₂ y₃\nsubst₃ A refl refl refl Axs = Axs\n\nsubst₄ : (A : D → D → D → D → Set) → ∀ {x₁ x₂ x₃ x₄ y₁ y₂ y₃ y₄} →\n x₁ ≡ y₁ → x₂ ≡ y₂ → x₃ ≡ y₃ → x₄ ≡ y₄ →\n A x₁ x₂ x₃ x₄ →\n A y₁ y₂ y₃ y₄\nsubst₄ A refl refl refl refl Axs = Axs\n", "meta": {"hexsha": "dc1da6ee49fe5d10a624dc6567741de258045539", "size": 1525, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/Common/FOL/Relation/Binary/PropositionalEquality.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/Common/FOL/Relation/Binary/PropositionalEquality.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/Common/FOL/Relation/Binary/PropositionalEquality.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 27.7272727273, "max_line_length": 78, "alphanum_fraction": 0.4281967213, "num_tokens": 532, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357598021707, "lm_q2_score": 0.7956580952177051, "lm_q1q2_score": 0.6898640211298309}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- A bunch of properties\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Bool.Properties where\n\nopen import Algebra\nopen import Data.Bool.Base\nopen import Data.Empty\nopen import Data.Product\nopen import Data.Sum\nopen import Function\nopen import Function.Equality using (_⟨$⟩_)\nopen import Function.Equivalence\n using (_⇔_; equivalence; module Equivalence)\nopen import Level using (0ℓ)\nopen import Relation.Binary.Core using (Decidable)\nopen import Relation.Binary.PropositionalEquality hiding ([_])\nopen import Relation.Nullary using (yes; no)\nopen import Relation.Nullary.Decidable using (True)\nopen import Relation.Unary as U using (Irrelevant)\n\nopen import Algebra.FunctionProperties (_≡_ {A = Bool})\nopen import Algebra.Structures (_≡_ {A = Bool})\nopen ≡-Reasoning\n\n------------------------------------------------------------------------\n-- Queries\n\ninfix 4 _≟_\n\n_≟_ : Decidable {A = Bool} _≡_\ntrue ≟ true = yes refl\nfalse ≟ false = yes refl\ntrue ≟ false = no λ()\nfalse ≟ true = no λ()\n\n------------------------------------------------------------------------\n-- Properties of _∨_\n\n∨-assoc : Associative _∨_\n∨-assoc true y z = refl\n∨-assoc false y z = refl\n\n∨-comm : Commutative _∨_\n∨-comm true true = refl\n∨-comm true false = refl\n∨-comm false true = refl\n∨-comm false false = refl\n\n∨-identityˡ : LeftIdentity false _∨_\n∨-identityˡ _ = refl\n\n∨-identityʳ : RightIdentity false _∨_\n∨-identityʳ false = refl\n∨-identityʳ true = refl\n\n∨-identity : Identity false _∨_\n∨-identity = ∨-identityˡ , ∨-identityʳ\n\n∨-zeroˡ : LeftZero true _∨_\n∨-zeroˡ _ = refl\n\n∨-zeroʳ : RightZero true _∨_\n∨-zeroʳ false = refl\n∨-zeroʳ true = refl\n\n∨-zero : Zero true _∨_\n∨-zero = ∨-zeroˡ , ∨-zeroʳ\n\n∨-inverseˡ : LeftInverse true not _∨_\n∨-inverseˡ false = refl\n∨-inverseˡ true = refl\n\n∨-inverseʳ : RightInverse true not _∨_\n∨-inverseʳ x = ∨-comm x (not x) ⟨ trans ⟩ ∨-inverseˡ x\n\n∨-inverse : Inverse true not _∨_\n∨-inverse = ∨-inverseˡ , ∨-inverseʳ\n\n∨-idem : Idempotent _∨_\n∨-idem false = refl\n∨-idem true = refl\n\n∨-sel : Selective _∨_\n∨-sel false y = inj₂ refl\n∨-sel true y = inj₁ refl\n\n∨-isMagma : IsMagma _∨_\n∨-isMagma = record\n { isEquivalence = isEquivalence\n ; ∙-cong = cong₂ _∨_\n }\n\n∨-magma : Magma 0ℓ 0ℓ\n∨-magma = record\n { isMagma = ∨-isMagma\n }\n\n∨-isSemigroup : IsSemigroup _∨_\n∨-isSemigroup = record\n { isMagma = ∨-isMagma\n ; assoc = ∨-assoc\n }\n\n∨-semigroup : Semigroup 0ℓ 0ℓ\n∨-semigroup = record\n { isSemigroup = ∨-isSemigroup\n }\n\n∨-isBand : IsBand _∨_\n∨-isBand = record\n { isSemigroup = ∨-isSemigroup\n ; idem = ∨-idem\n }\n\n∨-band : Band 0ℓ 0ℓ\n∨-band = record\n { isBand = ∨-isBand\n }\n\n∨-isSemilattice : IsSemilattice _∨_\n∨-isSemilattice = record\n { isBand = ∨-isBand\n ; comm = ∨-comm\n }\n\n∨-semilattice : Semilattice 0ℓ 0ℓ\n∨-semilattice = record\n { isSemilattice = ∨-isSemilattice\n }\n\n∨-isCommutativeMonoid : IsCommutativeMonoid _∨_ false\n∨-isCommutativeMonoid = record\n { isSemigroup = ∨-isSemigroup\n ; identityˡ = ∨-identityˡ\n ; comm = ∨-comm\n }\n\n∨-commutativeMonoid : CommutativeMonoid 0ℓ 0ℓ\n∨-commutativeMonoid = record\n { isCommutativeMonoid = ∨-isCommutativeMonoid\n }\n\n∨-isIdempotentCommutativeMonoid :\n IsIdempotentCommutativeMonoid _∨_ false\n∨-isIdempotentCommutativeMonoid = record\n { isCommutativeMonoid = ∨-isCommutativeMonoid\n ; idem = ∨-idem\n }\n\n∨-idempotentCommutativeMonoid : IdempotentCommutativeMonoid 0ℓ 0ℓ\n∨-idempotentCommutativeMonoid = record\n { isIdempotentCommutativeMonoid = ∨-isIdempotentCommutativeMonoid\n }\n\n------------------------------------------------------------------------\n-- Properties of _∧_\n\n∧-assoc : Associative _∧_\n∧-assoc true y z = refl\n∧-assoc false y z = refl\n\n∧-comm : Commutative _∧_\n∧-comm true true = refl\n∧-comm true false = refl\n∧-comm false true = refl\n∧-comm false false = refl\n\n∧-identityˡ : LeftIdentity true _∧_\n∧-identityˡ _ = refl\n\n∧-identityʳ : RightIdentity true _∧_\n∧-identityʳ false = refl\n∧-identityʳ true = refl\n\n∧-identity : Identity true _∧_\n∧-identity = ∧-identityˡ , ∧-identityʳ\n\n∧-zeroˡ : LeftZero false _∧_\n∧-zeroˡ _ = refl\n\n∧-zeroʳ : RightZero false _∧_\n∧-zeroʳ false = refl\n∧-zeroʳ true = refl\n\n∧-zero : Zero false _∧_\n∧-zero = ∧-zeroˡ , ∧-zeroʳ\n\n∧-inverseˡ : LeftInverse false not _∧_\n∧-inverseˡ false = refl\n∧-inverseˡ true = refl\n\n∧-inverseʳ : RightInverse false not _∧_\n∧-inverseʳ x = ∧-comm x (not x) ⟨ trans ⟩ ∧-inverseˡ x\n\n∧-inverse : Inverse false not _∧_\n∧-inverse = ∧-inverseˡ , ∧-inverseʳ\n\n∧-idem : Idempotent _∧_\n∧-idem false = refl\n∧-idem true = refl\n\n∧-sel : Selective _∧_\n∧-sel false y = inj₁ refl\n∧-sel true y = inj₂ refl\n\n∧-distribˡ-∨ : _∧_ DistributesOverˡ _∨_\n∧-distribˡ-∨ true y z = refl\n∧-distribˡ-∨ false y z = refl\n\n∧-distribʳ-∨ : _∧_ DistributesOverʳ _∨_\n∧-distribʳ-∨ x y z = begin\n (y ∨ z) ∧ x ≡⟨ ∧-comm (y ∨ z) x ⟩\n x ∧ (y ∨ z) ≡⟨ ∧-distribˡ-∨ x y z ⟩\n x ∧ y ∨ x ∧ z ≡⟨ cong₂ _∨_ (∧-comm x y) (∧-comm x z) ⟩\n y ∧ x ∨ z ∧ x ∎\n\n∧-distrib-∨ : _∧_ DistributesOver _∨_\n∧-distrib-∨ = ∧-distribˡ-∨ , ∧-distribʳ-∨\n\n∨-distribˡ-∧ : _∨_ DistributesOverˡ _∧_\n∨-distribˡ-∧ true y z = refl\n∨-distribˡ-∧ false y z = refl\n\n∨-distribʳ-∧ : _∨_ DistributesOverʳ _∧_\n∨-distribʳ-∧ x y z = begin\n (y ∧ z) ∨ x ≡⟨ ∨-comm (y ∧ z) x ⟩\n x ∨ (y ∧ z) ≡⟨ ∨-distribˡ-∧ x y z ⟩\n (x ∨ y) ∧ (x ∨ z) ≡⟨ cong₂ _∧_ (∨-comm x y) (∨-comm x z) ⟩\n (y ∨ x) ∧ (z ∨ x) ∎\n\n∨-distrib-∧ : _∨_ DistributesOver _∧_\n∨-distrib-∧ = ∨-distribˡ-∧ , ∨-distribʳ-∧\n\n∧-abs-∨ : _∧_ Absorbs _∨_\n∧-abs-∨ true y = refl\n∧-abs-∨ false y = refl\n\n∨-abs-∧ : _∨_ Absorbs _∧_\n∨-abs-∧ true y = refl\n∨-abs-∧ false y = refl\n\n∨-∧-absorptive : Absorptive _∨_ _∧_\n∨-∧-absorptive = ∨-abs-∧ , ∧-abs-∨\n\n∧-isMagma : IsMagma _∧_\n∧-isMagma = record\n { isEquivalence = isEquivalence\n ; ∙-cong = cong₂ _∧_\n }\n\n∧-magma : Magma 0ℓ 0ℓ\n∧-magma = record\n { isMagma = ∧-isMagma\n }\n\n∧-isSemigroup : IsSemigroup _∧_\n∧-isSemigroup = record\n { isMagma = ∧-isMagma\n ; assoc = ∧-assoc\n }\n\n∧-semigroup : Semigroup 0ℓ 0ℓ\n∧-semigroup = record\n { isSemigroup = ∧-isSemigroup\n }\n\n∧-isBand : IsBand _∧_\n∧-isBand = record\n { isSemigroup = ∧-isSemigroup\n ; idem = ∧-idem\n }\n\n∧-band : Band 0ℓ 0ℓ\n∧-band = record\n { isBand = ∧-isBand\n }\n\n∧-isSemilattice : IsSemilattice _∧_\n∧-isSemilattice = record\n { isBand = ∧-isBand\n ; comm = ∧-comm\n }\n\n∧-semilattice : Semilattice 0ℓ 0ℓ\n∧-semilattice = record\n { isSemilattice = ∧-isSemilattice\n }\n\n∧-isCommutativeMonoid : IsCommutativeMonoid _∧_ true\n∧-isCommutativeMonoid = record\n { isSemigroup = ∧-isSemigroup\n ; identityˡ = ∧-identityˡ\n ; comm = ∧-comm\n }\n\n∧-commutativeMonoid : CommutativeMonoid 0ℓ 0ℓ\n∧-commutativeMonoid = record\n { isCommutativeMonoid = ∧-isCommutativeMonoid\n }\n\n∧-isIdempotentCommutativeMonoid :\n IsIdempotentCommutativeMonoid _∧_ true\n∧-isIdempotentCommutativeMonoid = record\n { isCommutativeMonoid = ∧-isCommutativeMonoid\n ; idem = ∧-idem\n }\n\n∧-idempotentCommutativeMonoid : IdempotentCommutativeMonoid 0ℓ 0ℓ\n∧-idempotentCommutativeMonoid = record\n { isIdempotentCommutativeMonoid = ∧-isIdempotentCommutativeMonoid\n }\n\n∨-∧-isCommutativeSemiring\n : IsCommutativeSemiring _∨_ _∧_ false true\n∨-∧-isCommutativeSemiring = record\n { +-isCommutativeMonoid = ∨-isCommutativeMonoid\n ; *-isCommutativeMonoid = ∧-isCommutativeMonoid\n ; distribʳ = ∧-distribʳ-∨\n ; zeroˡ = ∧-zeroˡ\n }\n\n∨-∧-commutativeSemiring : CommutativeSemiring 0ℓ 0ℓ\n∨-∧-commutativeSemiring = record\n { _+_ = _∨_\n ; _*_ = _∧_\n ; 0# = false\n ; 1# = true\n ; isCommutativeSemiring = ∨-∧-isCommutativeSemiring\n }\n\n∧-∨-isCommutativeSemiring\n : IsCommutativeSemiring _∧_ _∨_ true false\n∧-∨-isCommutativeSemiring = record\n { +-isCommutativeMonoid = ∧-isCommutativeMonoid\n ; *-isCommutativeMonoid = ∨-isCommutativeMonoid\n ; distribʳ = ∨-distribʳ-∧\n ; zeroˡ = ∨-zeroˡ\n }\n\n∧-∨-commutativeSemiring : CommutativeSemiring 0ℓ 0ℓ\n∧-∨-commutativeSemiring = record\n { _+_ = _∧_\n ; _*_ = _∨_\n ; 0# = true\n ; 1# = false\n ; isCommutativeSemiring = ∧-∨-isCommutativeSemiring\n }\n\n∨-∧-isLattice : IsLattice _∨_ _∧_\n∨-∧-isLattice = record\n { isEquivalence = isEquivalence\n ; ∨-comm = ∨-comm\n ; ∨-assoc = ∨-assoc\n ; ∨-cong = cong₂ _∨_\n ; ∧-comm = ∧-comm\n ; ∧-assoc = ∧-assoc\n ; ∧-cong = cong₂ _∧_\n ; absorptive = ∨-∧-absorptive\n }\n\n∨-∧-lattice : Lattice 0ℓ 0ℓ\n∨-∧-lattice = record\n { isLattice = ∨-∧-isLattice\n }\n\n∨-∧-isDistributiveLattice : IsDistributiveLattice _∨_ _∧_\n∨-∧-isDistributiveLattice = record\n { isLattice = ∨-∧-isLattice\n ; ∨-∧-distribʳ = ∨-distribʳ-∧\n }\n\n∨-∧-distributiveLattice : DistributiveLattice 0ℓ 0ℓ\n∨-∧-distributiveLattice = record\n { isDistributiveLattice = ∨-∧-isDistributiveLattice\n }\n\n∨-∧-isBooleanAlgebra : IsBooleanAlgebra _∨_ _∧_ not true false\n∨-∧-isBooleanAlgebra = record\n { isDistributiveLattice = ∨-∧-isDistributiveLattice\n ; ∨-complementʳ = ∨-inverseʳ\n ; ∧-complementʳ = ∧-inverseʳ\n ; ¬-cong = cong not\n }\n\n∨-∧-booleanAlgebra : BooleanAlgebra 0ℓ 0ℓ\n∨-∧-booleanAlgebra = record\n { isBooleanAlgebra = ∨-∧-isBooleanAlgebra\n }\n\n------------------------------------------------------------------------\n-- Properties of _xor_\n\nxor-is-ok : ∀ x y → x xor y ≡ (x ∨ y) ∧ not (x ∧ y)\nxor-is-ok true y = refl\nxor-is-ok false y = sym (∧-identityʳ _)\n\nxor-∧-commutativeRing : CommutativeRing 0ℓ 0ℓ\nxor-∧-commutativeRing = commutativeRing\n where\n import Algebra.Properties.BooleanAlgebra as BA\n open BA ∨-∧-booleanAlgebra\n open XorRing _xor_ xor-is-ok\n\n------------------------------------------------------------------------\n-- Miscellaneous other properties\n\nnot-involutive : Involutive not\nnot-involutive true = refl\nnot-involutive false = refl\n\nnot-¬ : ∀ {x y} → x ≡ y → x ≢ not y\nnot-¬ {true} refl ()\nnot-¬ {false} refl ()\n\n¬-not : ∀ {x y} → x ≢ y → x ≡ not y\n¬-not {true} {true} x≢y = ⊥-elim (x≢y refl)\n¬-not {true} {false} _ = refl\n¬-not {false} {true} _ = refl\n¬-not {false} {false} x≢y = ⊥-elim (x≢y refl)\n\n⇔→≡ : {b₁ b₂ b : Bool} → b₁ ≡ b ⇔ b₂ ≡ b → b₁ ≡ b₂\n⇔→≡ {true } {true } hyp = refl\n⇔→≡ {true } {false} {true } hyp = sym (Equivalence.to hyp ⟨$⟩ refl)\n⇔→≡ {true } {false} {false} hyp = Equivalence.from hyp ⟨$⟩ refl\n⇔→≡ {false} {true } {true } hyp = Equivalence.from hyp ⟨$⟩ refl\n⇔→≡ {false} {true } {false} hyp = sym (Equivalence.to hyp ⟨$⟩ refl)\n⇔→≡ {false} {false} hyp = refl\n\nT-≡ : ∀ {b} → T b ⇔ b ≡ true\nT-≡ {false} = equivalence (λ ()) (λ ())\nT-≡ {true} = equivalence (const refl) (const _)\n\nT-not-≡ : ∀ {b} → T (not b) ⇔ b ≡ false\nT-not-≡ {false} = equivalence (const refl) (const _)\nT-not-≡ {true} = equivalence (λ ()) (λ ())\n\nT-∧ : ∀ {b₁ b₂} → T (b₁ ∧ b₂) ⇔ (T b₁ × T b₂)\nT-∧ {true} {true} = equivalence (const (_ , _)) (const _)\nT-∧ {true} {false} = equivalence (λ ()) proj₂\nT-∧ {false} {_} = equivalence (λ ()) proj₁\n\nT-∨ : ∀ {b₁ b₂} → T (b₁ ∨ b₂) ⇔ (T b₁ ⊎ T b₂)\nT-∨ {true} {b₂} = equivalence inj₁ (const _)\nT-∨ {false} {true} = equivalence inj₂ (const _)\nT-∨ {false} {false} = equivalence inj₁ [ id , id ]\n\nT-irrelevant : Irrelevant T\nT-irrelevant {true} _ _ = refl\nT-irrelevant {false} () ()\n\nT? : U.Decidable T\nT? true = yes _\nT? false = no (λ ())\n\nT?-diag : ∀ b → T b → True (T? b)\nT?-diag true _ = _\nT?-diag false ()\n\npush-function-into-if :\n ∀ {a b} {A : Set a} {B : Set b} (f : A → B) x {y z} →\n f (if x then y else z) ≡ (if x then f y else f z)\npush-function-into-if _ true = refl\npush-function-into-if _ false = refl\n\n------------------------------------------------------------------------\n-- DEPRECATED NAMES\n------------------------------------------------------------------------\n-- Please use the new names as continuing support for the old names is\n-- not guaranteed.\n\n-- Version 0.15\n\n∧-∨-distˡ = ∧-distribˡ-∨\n{-# WARNING_ON_USAGE ∧-∨-distˡ\n\"Warning: ∧-∨-distˡ was deprecated in v0.15.\nPlease use ∧-distribˡ-∨ instead.\"\n#-}\n∧-∨-distʳ = ∧-distribʳ-∨\n{-# WARNING_ON_USAGE ∧-∨-distʳ\n\"Warning: ∧-∨-distʳ was deprecated in v0.15.\nPlease use ∧-distribʳ-∨ instead.\"\n#-}\ndistrib-∧-∨ = ∧-distrib-∨\n{-# WARNING_ON_USAGE distrib-∧-∨\n\"Warning: distrib-∧-∨ was deprecated in v0.15.\nPlease use ∧-distrib-∨ instead.\"\n#-}\n∨-∧-distˡ = ∨-distribˡ-∧\n{-# WARNING_ON_USAGE ∨-∧-distˡ\n\"Warning: ∨-∧-distˡ was deprecated in v0.15.\nPlease use ∨-distribˡ-∧ instead.\"\n#-}\n∨-∧-distʳ = ∨-distribʳ-∧\n{-# WARNING_ON_USAGE ∨-∧-distʳ\n\"Warning: ∨-∧-distʳ was deprecated in v0.15.\nPlease use ∨-distribʳ-∧ instead.\"\n#-}\n∨-∧-distrib = ∨-distrib-∧\n{-# WARNING_ON_USAGE ∨-∧-distrib\n\"Warning: ∨-∧-distrib was deprecated in v0.15.\nPlease use ∨-distrib-∧ instead.\"\n#-}\n∨-∧-abs = ∨-abs-∧\n{-# WARNING_ON_USAGE ∨-∧-abs\n\"Warning: ∨-∧-abs was deprecated in v0.15.\nPlease use ∨-abs-∧ instead.\"\n#-}\n∧-∨-abs = ∧-abs-∨\n{-# WARNING_ON_USAGE ∧-∨-abs\n\"Warning: ∧-∨-abs was deprecated in v0.15.\nPlease use ∧-abs-∨ instead.\"\n#-}\nnot-∧-inverseˡ = ∧-inverseˡ\n{-# WARNING_ON_USAGE not-∧-inverseˡ\n\"Warning: not-∧-inverseˡ was deprecated in v0.15.\nPlease use ∧-inverseˡ instead.\"\n#-}\nnot-∧-inverseʳ = ∧-inverseʳ\n{-# WARNING_ON_USAGE not-∧-inverseʳ\n\"Warning: not-∧-inverseʳ was deprecated in v0.15.\nPlease use ∧-inverseʳ instead.\"\n#-}\nnot-∧-inverse = ∧-inverse\n{-# WARNING_ON_USAGE not-∧-inverse\n\"Warning: not-∧-inverse was deprecated in v0.15.\nPlease use ∧-inverse instead.\"\n#-}\nnot-∨-inverseˡ = ∨-inverseˡ\n{-# WARNING_ON_USAGE not-∨-inverseˡ\n\"Warning: not-∨-inverseˡ was deprecated in v0.15.\nPlease use ∨-inverseˡ instead.\"\n#-}\nnot-∨-inverseʳ = ∨-inverseʳ\n{-# WARNING_ON_USAGE not-∨-inverseʳ\n\"Warning: not-∨-inverseʳ was deprecated in v0.15.\nPlease use ∨-inverseʳ instead.\"\n#-}\nnot-∨-inverse = ∨-inverse\n{-# WARNING_ON_USAGE not-∨-inverse\n\"Warning: not-∨-inverse was deprecated in v0.15.\nPlease use ∨-inverse instead.\"\n#-}\nisCommutativeSemiring-∨-∧ = ∨-∧-isCommutativeSemiring\n{-# WARNING_ON_USAGE isCommutativeSemiring-∨-∧\n\"Warning: isCommutativeSemiring-∨-∧ was deprecated in v0.15.\nPlease use ∨-∧-isCommutativeSemiring instead.\"\n#-}\ncommutativeSemiring-∨-∧ = ∨-∧-commutativeSemiring\n{-# WARNING_ON_USAGE commutativeSemiring-∨-∧\n\"Warning: commutativeSemiring-∨-∧ was deprecated in v0.15.\nPlease use ∨-∧-commutativeSemiring instead.\"\n#-}\nisCommutativeSemiring-∧-∨ = ∧-∨-isCommutativeSemiring\n{-# WARNING_ON_USAGE isCommutativeSemiring-∧-∨\n\"Warning: isCommutativeSemiring-∧-∨ was deprecated in v0.15.\nPlease use ∧-∨-isCommutativeSemiring instead.\"\n#-}\ncommutativeSemiring-∧-∨ = ∧-∨-commutativeSemiring\n{-# WARNING_ON_USAGE commutativeSemiring-∧-∨\n\"Warning: commutativeSemiring-∧-∨ was deprecated in v0.15.\nPlease use ∧-∨-commutativeSemiring instead.\"\n#-}\nisBooleanAlgebra = ∨-∧-isBooleanAlgebra\n{-# WARNING_ON_USAGE isBooleanAlgebra\n\"Warning: isBooleanAlgebra was deprecated in v0.15.\nPlease use ∨-∧-isBooleanAlgebra instead.\"\n#-}\nbooleanAlgebra = ∨-∧-booleanAlgebra\n{-# WARNING_ON_USAGE booleanAlgebra\n\"Warning: booleanAlgebra was deprecated in v0.15.\nPlease use ∨-∧-booleanAlgebra instead.\"\n#-}\ncommutativeRing-xor-∧ = xor-∧-commutativeRing\n{-# WARNING_ON_USAGE commutativeRing-xor-∧\n\"Warning: commutativeRing-xor-∧ was deprecated in v0.15.\nPlease use xor-∧-commutativeRing instead.\"\n#-}\nproof-irrelevance = T-irrelevant\n{-# WARNING_ON_USAGE proof-irrelevance\n\"Warning: proof-irrelevance was deprecated in v0.15.\nPlease use T-irrelevant instead.\"\n#-}\n\n-- Version 1.0\n\nT-irrelevance = T-irrelevant\n{-# WARNING_ON_USAGE T-irrelevance\n\"Warning: T-irrelevance was deprecated in v1.0.\nPlease use T-irrelevant instead.\"\n#-}\n", "meta": {"hexsha": "dbe74a96bc24e03eedbe07963368af5c998822b1", "size": 15746, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Bool/Properties.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Bool/Properties.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Bool/Properties.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.3752093802, "max_line_length": 72, "alphanum_fraction": 0.6190143529, "num_tokens": 6447, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357494949104, "lm_q2_score": 0.7956580952177053, "lm_q1q2_score": 0.6898640129287759}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Least common multiple\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Nat.LCM where\n\nopen import Algebra\nopen import Data.Nat.Base\nopen import Data.Nat.Coprimality using (Coprime)\nopen import Data.Nat.Divisibility\nopen import Data.Nat.DivMod\nopen import Data.Nat.Properties\nopen import Data.Nat.Solver\nopen import Data.Nat.GCD\nopen import Data.Product\nopen import Data.Sum.Base using (_⊎_; inj₁; inj₂)\nopen import Function\nopen import Relation.Binary.PropositionalEquality as P\n using (_≡_; refl; sym; trans; cong; cong₂; module ≡-Reasoning)\nopen import Relation.Binary\nopen import Relation.Nullary.Decidable using (False; fromWitnessFalse)\n\nopen +-*-Solver\n\nprivate\n gcd≢0′ : ∀ m n → False (gcd (suc m) n ≟ 0)\n gcd≢0′ m n = fromWitnessFalse (gcd[m,n]≢0 (suc m) n (inj₁ (λ())))\n\n------------------------------------------------------------------------\n-- Definition\n\nlcm : ℕ → ℕ → ℕ\nlcm zero n = zero\nlcm m@(suc m-1) n = m * (n / gcd m n) {gcd≢0′ m-1 n}\n\n------------------------------------------------------------------------\n-- Core properties\n\nprivate\n rearrange : ∀ m-1 n → lcm (suc m-1) n ≡ ((suc m-1) * n / gcd (suc m-1) n) {gcd≢0′ m-1 n}\n rearrange m-1 n = sym (*-/-assoc m {n} {gcd m n} {gcd≢0′ m-1 n} (gcd[m,n]∣n m n))\n where m = suc m-1\n\nm∣lcm[m,n] : ∀ m n → m ∣ lcm m n\nm∣lcm[m,n] zero n = 0 ∣0\nm∣lcm[m,n] m@(suc _) n = m∣m*n (n / gcd m n)\n\nn∣lcm[m,n] : ∀ m n → n ∣ lcm m n\nn∣lcm[m,n] zero n = n ∣0\nn∣lcm[m,n] m@(suc m-1) n = begin\n n ∣⟨ m∣m*n (m / gcd m n) ⟩\n n * (m / gcd m n) ≡⟨ sym (*-/-assoc n {≢0 = gcd≢0′ m-1 n} (gcd[m,n]∣m m n)) ⟩\n n * m / gcd m n ≡⟨ cong (λ v → (v / gcd m n) {gcd≢0′ m-1 n}) (*-comm n m) ⟩\n m * n / gcd m n ≡⟨ sym (rearrange m-1 n) ⟩\n m * (n / gcd m n) ∎\n where open ∣-Reasoning\n\nlcm-least : ∀ {m n c} → m ∣ c → n ∣ c → lcm m n ∣ c\nlcm-least {zero} {n} {c} 0∣c _ = 0∣c\nlcm-least {m@(suc m-1)} {n} {c} m∣c n∣c = P.subst (_∣ c) (sym (rearrange m-1 n))\n (m∣n*o⇒m/n∣o {n≢0 = gcd≢0′ m-1 n} gcd[m,n]∣m*n mn∣c*gcd)\n where\n open ∣-Reasoning\n gcd[m,n]∣m*n : gcd m n ∣ m * n\n gcd[m,n]∣m*n = ∣-trans (gcd[m,n]∣m m n) (m∣m*n n)\n\n mn∣c*gcd : m * n ∣ c * gcd m n\n mn∣c*gcd = begin\n m * n ∣⟨ gcd-greatest (P.subst (_∣ c * m) (*-comm n m) (*-monoˡ-∣ m n∣c)) (*-monoˡ-∣ n m∣c) ⟩\n gcd (c * m) (c * n) ≡⟨ sym (c*gcd[m,n]≡gcd[cm,cn] c m n) ⟩\n c * gcd m n ∎\n\n------------------------------------------------------------------------\n-- Other properties\n\n-- Note that all other properties of `gcd` should be inferable from the\n-- 3 core properties above.\n\ngcd*lcm : ∀ m n → gcd m n * lcm m n ≡ m * n\ngcd*lcm zero n = *-zeroʳ (gcd 0 n)\ngcd*lcm m@(suc m-1) n = trans (cong (gcd m n *_) (rearrange m-1 n)) (m*[n/m]≡n {gcd m n} (begin\n gcd m n ∣⟨ gcd[m,n]∣m m n ⟩\n m ∣⟨ m∣m*n n ⟩\n m * n ∎))\n where open ∣-Reasoning\n\nlcm[0,n]≡0 : ∀ n → lcm 0 n ≡ 0\nlcm[0,n]≡0 n = 0∣⇒≡0 (m∣lcm[m,n] 0 n)\n\nlcm[n,0]≡0 : ∀ n → lcm n 0 ≡ 0\nlcm[n,0]≡0 n = 0∣⇒≡0 (n∣lcm[m,n] n 0)\n\nlcm-comm : ∀ m n → lcm m n ≡ lcm n m\nlcm-comm m n = ∣-antisym\n (lcm-least (n∣lcm[m,n] n m) (m∣lcm[m,n] n m))\n (lcm-least (n∣lcm[m,n] m n) (m∣lcm[m,n] m n))\n\n------------------------------------------------------------------------\n-- Least common multiple (lcm).\n\nmodule LCM where\n\n -- Specification of the least common multiple (lcm) of two natural\n -- numbers.\n\n record LCM (i j lcm : ℕ) : Set where\n field\n -- The lcm is a common multiple.\n commonMultiple : i ∣ lcm × j ∣ lcm\n\n -- The lcm divides all common multiples, i.e. the lcm is the least\n -- common multiple according to the partial order _∣_.\n least : ∀ {m} → i ∣ m × j ∣ m → lcm ∣ m\n\n open LCM public\n\n -- The lcm is unique.\n\n unique : ∀ {d₁ d₂ m n} → LCM m n d₁ → LCM m n d₂ → d₁ ≡ d₂\n unique d₁ d₂ = ∣-antisym (LCM.least d₁ (LCM.commonMultiple d₂))\n (LCM.least d₂ (LCM.commonMultiple d₁))\n\nopen LCM public using (LCM) hiding (module LCM)\n\n------------------------------------------------------------------------\n-- Calculating the LCM\n\nlcm-LCM : ∀ m n → LCM m n (lcm m n)\nlcm-LCM m n = record\n { commonMultiple = m∣lcm[m,n] m n , n∣lcm[m,n] m n\n ; least = uncurry′ lcm-least\n }\n\nmkLCM : ∀ m n → ∃ λ d → LCM m n d\nmkLCM m n = lcm m n , lcm-LCM m n\n\nGCD*LCM : ∀ {m n g l} → GCD m n g → LCM m n l → m * n ≡ g * l\nGCD*LCM {m} {n} {g} {l} gc lc = sym (begin\n g * l ≡⟨ cong₂ _*_ (GCD.unique gc (gcd-GCD m n)) (LCM.unique lc (lcm-LCM m n)) ⟩\n gcd m n * lcm m n ≡⟨ gcd*lcm m n ⟩\n m * n ∎)\n where open ≡-Reasoning\n", "meta": {"hexsha": "4d2d3b1f2a0ea6f201f3f92a1a240558df37774b", "size": 4739, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/Nat/LCM.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/Nat/LCM.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/Nat/LCM.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 32.2380952381, "max_line_length": 111, "alphanum_fraction": 0.4918759232, "num_tokens": 1910, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8615382094310357, "lm_q2_score": 0.8006919949619792, "lm_q1q2_score": 0.6898267476453074}} {"text": "module ListMember where\n\nopen import Prelude\n\ndata Member {A : Set} (x : A) : List A -> Set where\n here : {xs : List A} -> Member x (cons x xs)\n there : forall {y} -> {xs : List A} -> Member x xs -> Member x (cons y xs)\n\nempty-no-member' : forall {A} -> {x : A} -> Member x nil -> Empty\nempty-no-member' p = {!!}\n\nempty-no-member : forall {A} -> {x : A} -> Not (Member x nil)\nempty-no-member = is-absurd empty-no-member'\n\nneither-here-nor-there' : forall {A} -> {x y : A} {ys : List A} -> (x == y -> Empty) -> (Member x ys -> Empty) -> Member x (cons y ys) -> Empty\nneither-here-nor-there' not-here not-there member = {!!}\n\nneither-here-nor-there : forall {A} -> {x y : A} {ys : List A} -> Not (x == y) -> Not (Member x ys) -> Not (Member x (cons y ys))\nneither-here-nor-there (is-absurd not-here) (is-absurd not-there) = is-absurd (neither-here-nor-there' not-here not-there)\n\nmember : forall {A} -> ((x y : A) -> Dec (x == y)) -> (v : A) -> (vs : List A) -> Dec (Member v vs)\nmember eq? x nil = no empty-no-member\nmember eq? x (cons y ys) with eq? x y\nmember eq? x (cons y ys) | yes p = {!!}\nmember eq? x (cons y ys) | no pf with member eq? x ys\nmember eq? x (cons y ys) | no pf | member = {!!}\n", "meta": {"hexsha": "4e35fd84d204159bae2f6cc8b924311e27314951", "size": 1199, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "data/test-files/ListMember.agda", "max_stars_repo_name": "carlostome/martin", "max_stars_repo_head_hexsha": "baf979ef78b5ec0f4783240b03f9547490bc5d42", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "data/test-files/ListMember.agda", "max_issues_repo_name": "carlostome/martin", "max_issues_repo_head_hexsha": "baf979ef78b5ec0f4783240b03f9547490bc5d42", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "data/test-files/ListMember.agda", "max_forks_repo_name": "carlostome/martin", "max_forks_repo_head_hexsha": "baf979ef78b5ec0f4783240b03f9547490bc5d42", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 44.4074074074, "max_line_length": 143, "alphanum_fraction": 0.58882402, "num_tokens": 418, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9173026618464796, "lm_q2_score": 0.7520125848754472, "lm_q1q2_score": 0.6898231458482994}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Cubical.Data.Unit.Properties where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Unit.Base\n\nisPropUnit : isProp Unit\nisPropUnit _ _ i = tt\n\nisContrUnit : isContr Unit\nisContrUnit = tt , λ {tt → refl}\n\nisOfHLevelUnit : (n : ℕ) → isOfHLevel n Unit\nisOfHLevelUnit 0 = isContrUnit\nisOfHLevelUnit 1 = isPropUnit\nisOfHLevelUnit (suc n) = hLevelSuc n Unit (isOfHLevelUnit n)\n", "meta": {"hexsha": "4fe856fcdb0ac7a02624bd64b2437961c3ad0df0", "size": 547, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/Unit/Properties.agda", "max_stars_repo_name": "limemloh/cubical", "max_stars_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/Unit/Properties.agda", "max_issues_repo_name": "limemloh/cubical", "max_issues_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/Unit/Properties.agda", "max_forks_repo_name": "limemloh/cubical", "max_forks_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.8636363636, "max_line_length": 60, "alphanum_fraction": 0.7568555759, "num_tokens": 168, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9136765140114859, "lm_q2_score": 0.7549149758396752, "lm_q1q2_score": 0.6897480835002595}} {"text": "open import Relation.Binary.Core\n\nmodule Heapsort.Impl2 {A : Set}\n (_≤_ : A → A → Set) \n (tot≤ : Total _≤_) \n (trans≤ : Transitive _≤_) where\n\nopen import BBHeap _≤_ hiding (flatten)\nopen import BBHeap.Compound _≤_\nopen import BBHeap.Drop _≤_ tot≤ trans≤\nopen import BBHeap.Drop.Properties _≤_ tot≤ trans≤\nopen import BBHeap.Heapify _≤_ tot≤ trans≤\nopen import BBHeap.Order _≤_ \nopen import BBHeap.Order.Properties _≤_ \nopen import Bound.Lower A \nopen import Bound.Lower.Order _≤_ \nopen import Data.List hiding (drop)\nopen import OList _≤_\n\nflatten : {b : Bound}(h : BBHeap b) → Acc h → OList b\nflatten leaf _ = onil\nflatten (left b≤x l⋘r) (acc rs) = :< b≤x (flatten (drop (cl b≤x l⋘r)) (rs (drop (cl b≤x l⋘r)) (lemma-drop≤′ (cl b≤x l⋘r))))\nflatten (right b≤x l⋙r) (acc rs) = :< b≤x (flatten (drop (cr b≤x l⋙r)) (rs (drop (cr b≤x l⋙r)) (lemma-drop≤′ (cr b≤x l⋙r))))\n\nheapsort : List A → OList bot\nheapsort xs = flatten (heapify xs) (≺-wf (heapify xs))\n", "meta": {"hexsha": "9352cea12f91e7d6f260cf1e7b97cae5ae6a2a1e", "size": 1004, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Heapsort/Impl2.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/Heapsort/Impl2.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Heapsort/Impl2.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.1851851852, "max_line_length": 124, "alphanum_fraction": 0.6344621514, "num_tokens": 393, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9433475794701961, "lm_q2_score": 0.7310585903489891, "lm_q1q2_score": 0.6896423516566126}} {"text": "{-# OPTIONS --guardedness #-}\n\nrecord _≈_ {A : Set} (xs : Stream A) (ys : Stream A) : Set where\n coinductive\n field\n hd-≈ : hd xs ≡ hd ys\n tl-≈ : tl xs ≈ tl ys\n\neven : ∀ {A} → Stream A → Stream A\nhd (even x) = hd x\ntl (even x) = even (tl (tl x))\n\nodd : ∀ {A} → Stream A → Stream A\nodd x = even (tl x)\n\nsplit : ∀ {A} → Stream A → Stream A × Stream A\nsplit xs = even xs , odd xs\n\nmerge : ∀ {A} → Stream A × Stream A → Stream A\nhd (merge (fst , snd)) = hd fst\ntl (merge (fst , snd)) = merge (snd , tl fst)\n\nmerge-split-id : ∀ {A} (xs : Stream A) → merge (split xs) ≈ xs\nhd-≈ (merge-split-id _) = refl\ntl-≈ (merge-split-id xs) = merge-split-id (tl xs)\n", "meta": {"hexsha": "cad1b63ab301b12085191353102b8441c1f1fa31", "size": 657, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/coinduction.agda", "max_stars_repo_name": "seanwestfall/agda_explorations", "max_stars_repo_head_hexsha": "9fd9fbf9f265bf526a2ec83e9442dedc7106b80c", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/coinduction.agda", "max_issues_repo_name": "seanwestfall/agda_explorations", "max_issues_repo_head_hexsha": "9fd9fbf9f265bf526a2ec83e9442dedc7106b80c", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/coinduction.agda", "max_forks_repo_name": "seanwestfall/agda_explorations", "max_forks_repo_head_hexsha": "9fd9fbf9f265bf526a2ec83e9442dedc7106b80c", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.2692307692, "max_line_length": 64, "alphanum_fraction": 0.5616438356, "num_tokens": 246, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9433475715065794, "lm_q2_score": 0.7310585786300049, "lm_q1q2_score": 0.6896423347796669}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Setoids.Setoids\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import Groups.Definition\n\nmodule Groups.Actions.Definition where\n\nrecord GroupAction {m n o p : _} {A : Set m} {S : Setoid {m} {o} A} {_·_ : A → A → A} {B : Set n} (G : Group S _·_) (X : Setoid {n} {p} B) : Set (m ⊔ n ⊔ o ⊔ p) where\n open Group G\n open Setoid S renaming (_∼_ to _∼G_)\n open Setoid X renaming (_∼_ to _∼X_)\n field\n action : A → B → B\n actionWellDefined1 : {g h : A} → {x : B} → (g ∼G h) → action g x ∼X action h x\n actionWellDefined2 : {g : A} → {x y : B} → (x ∼X y) → action g x ∼X action g y\n identityAction : {x : B} → action 0G x ∼X x\n associativeAction : {x : B} → {g h : A} → action (g · h) x ∼X action g (action h x)\n", "meta": {"hexsha": "c7dbb810b893f1c03fa888c485c388bb8421bf8c", "size": 803, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Actions/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Actions/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Actions/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 42.2631578947, "max_line_length": 166, "alphanum_fraction": 0.5890410959, "num_tokens": 313, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9433475778774728, "lm_q2_score": 0.7310585727705127, "lm_q1q2_score": 0.6896423339096254}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Lists defined in terms of Data.Star\n------------------------------------------------------------------------\n\nmodule Data.Star.List where\n\nopen import Data.Star\nopen import Data.Unit\nopen import Relation.Binary.Simple\nopen import Data.Star.Nat\n\n-- Lists.\n\nList : Set → Set\nList a = Star (Const a) tt tt\n\n-- Nil and cons.\n\n[] : ∀ {a} → List a\n[] = ε\n\ninfixr 5 _∷_\n\n_∷_ : ∀ {a} → a → List a → List a\n_∷_ = _◅_\n\n-- The sum of the elements in a list containing natural numbers.\n\nsum : List ℕ → ℕ\nsum = fold (Star Always) _+_ zero\n", "meta": {"hexsha": "54aeb1a40dbd71ccb4b4954a5d1740b296c10f9f", "size": 634, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Data/Star/List.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Data/Star/List.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Data/Star/List.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.2121212121, "max_line_length": 72, "alphanum_fraction": 0.5063091483, "num_tokens": 160, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8872045907347108, "lm_q2_score": 0.7772998508568416, "lm_q1q2_score": 0.689623996057596}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Adjoint where\n\n-- Adjoints\n\nopen import Level\n\nopen import Data.Product using (_,_; _×_)\nopen import Function using (_$_) renaming (_∘_ to _∙_)\nopen import Function.Equality using (Π; _⟶_)\nimport Function.Inverse as FI\nopen import Relation.Binary using (Rel; IsEquivalence; Setoid)\n\n-- be explicit in imports to 'see' where the information comes from\nopen import Categories.Category.Core using (Category)\nopen import Categories.Category.Product using (Product; _⁂_)\nopen import Categories.Category.Instance.Setoids\nopen import Categories.Morphism\nopen import Categories.Functor using (Functor; _∘F_) renaming (id to idF)\nopen import Categories.Functor.Bifunctor using (Bifunctor)\nopen import Categories.Functor.Hom using (Hom[_][-,-])\nopen import Categories.Functor.Construction.LiftSetoids\nopen import Categories.NaturalTransformation using (NaturalTransformation; ntHelper; _∘ₕ_; _∘ᵥ_; _∘ˡ_; _∘ʳ_)\n renaming (id to idN)\nopen import Categories.NaturalTransformation.NaturalIsomorphism\n using (NaturalIsomorphism; unitorˡ; unitorʳ; associator; _≃_)\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n variable\n o o′ o″ ℓ ℓ′ ℓ″ e e′ e″ : Level\n C D E : Category o ℓ e\n\nrecord Adjoint (L : Functor C D) (R : Functor D C) : Set (levelOfTerm L ⊔ levelOfTerm R) where\n private\n module C = Category C\n module D = Category D\n module L = Functor L\n module R = Functor R\n\n field\n unit : NaturalTransformation idF (R ∘F L)\n counit : NaturalTransformation (L ∘F R) idF\n\n module unit = NaturalTransformation unit\n module counit = NaturalTransformation counit\n\n field\n zig : ∀ {A : C.Obj} → counit.η (L.F₀ A) D.∘ L.F₁ (unit.η A) D.≈ D.id\n zag : ∀ {B : D.Obj} → R.F₁ (counit.η B) C.∘ unit.η (R.F₀ B) C.≈ C.id\n\n private\n variable\n A : C.Obj\n B : D.Obj\n\n Ladjunct : L.F₀ A D.⇒ B → A C.⇒ R.F₀ B\n Ladjunct f = R.F₁ f C.∘ unit.η _\n\n Radjunct : A C.⇒ R.F₀ B → L.F₀ A D.⇒ B\n Radjunct f = counit.η _ D.∘ L.F₁ f\n\n RLadjunct≈id : ∀ {f : L.F₀ A D.⇒ B} → Radjunct (Ladjunct f) D.≈ f\n RLadjunct≈id {f = f} = begin\n Radjunct (Ladjunct f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩\n counit.η _ D.∘ L.F₁ (R.F₁ f) D.∘ L.F₁ (unit.η _) ≈⟨ pullˡ (counit.commute f) ⟩\n (f D.∘ counit.η _) D.∘ L.F₁ (unit.η _) ≈⟨ pullʳ zig ⟩\n f D.∘ D.id ≈⟨ D.identityʳ ⟩\n f ∎\n where open D.HomReasoning\n open MR D\n\n LRadjunct≈id : ∀ {f : A C.⇒ R.F₀ B} → Ladjunct (Radjunct f) C.≈ f\n LRadjunct≈id {f = f} = begin\n Ladjunct (Radjunct f) ≈⟨ R.homomorphism ⟩∘⟨refl ⟩\n (R.F₁ (counit.η _) C.∘ R.F₁ (L.F₁ f)) C.∘ unit.η _ ≈˘⟨ pushʳ (unit.commute f) ⟩\n R.F₁ (counit.η _) C.∘ unit.η _ C.∘ f ≈⟨ pullˡ zag ⟩\n C.id C.∘ f ≈⟨ C.identityˡ ⟩\n f ∎\n where open C.HomReasoning\n open MR C\n\n Hom[L-,-] : Bifunctor C.op D (Setoids _ _)\n Hom[L-,-] = Hom[ D ][-,-] ∘F (L.op ⁂ idF)\n\n Hom[-,R-] : Bifunctor C.op D (Setoids _ _)\n Hom[-,R-] = Hom[ C ][-,-] ∘F (idF ⁂ R)\n\n module Hom[L-,-] = Functor Hom[L-,-]\n module Hom[-,R-] = Functor Hom[-,R-]\n\n -- Inverse is more 'categorical' than bijection defined via injection/surjection\n Hom-inverse : ∀ A B → FI.Inverse (Hom[L-,-].F₀ (A , B)) (Hom[-,R-].F₀ (A , B))\n Hom-inverse A B = record\n { to = record\n { _⟨$⟩_ = Ladjunct {A} {B}\n ; cong = C.∘-resp-≈ˡ ∙ R.F-resp-≈\n }\n ; from = record\n { _⟨$⟩_ = Radjunct {A} {B}\n ; cong = D.∘-resp-≈ʳ ∙ L.F-resp-≈\n }\n ; inverse-of = record\n { left-inverse-of = λ _ → RLadjunct≈id\n ; right-inverse-of = λ _ → LRadjunct≈id\n }\n }\n\n module Hom-inverse {A} {B} = FI.Inverse (Hom-inverse A B)\n\n op : Adjoint R.op L.op\n op = record\n { unit = counit.op\n ; counit = unit.op\n ; zig = zag\n ; zag = zig\n }\n\n -- naturality condition on the two hom functors.\n -- these conditions are separated out because a complication due to the\n -- universe level in Agda.\n module _ where\n open C\n open HomReasoning\n open MR C\n\n Ladjunct-comm : ∀ {X Y A B} {h i : L.F₀ X D.⇒ Y} {f : A ⇒ X} {g : Y D.⇒ B} →\n h D.≈ i →\n R.F₁ (g D.∘ h D.∘ L.F₁ f) ∘ unit.η A ≈ R.F₁ g ∘ (R.F₁ i ∘ unit.η X) ∘ f\n Ladjunct-comm {X} {Y} {A} {B} {h} {i} {f} {g} eq = begin\n R.F₁ (g D.∘ h D.∘ L.F₁ f) ∘ unit.η A ≈⟨ R.homomorphism ⟩∘⟨refl ⟩\n (R.F₁ g ∘ R.F₁ (h D.∘ L.F₁ f)) ∘ unit.η A ≈⟨ (refl⟩∘⟨ R.homomorphism) ⟩∘⟨refl ⟩\n (R.F₁ g ∘ R.F₁ h ∘ R.F₁ (L.F₁ f)) ∘ unit.η A ≈⟨ pullʳ assoc ⟩\n R.F₁ g ∘ R.F₁ h ∘ R.F₁ (L.F₁ f) ∘ unit.η A ≈˘⟨ refl⟩∘⟨ ⟺ (R.F-resp-≈ eq) ⟩∘⟨ unit.commute f ⟩\n R.F₁ g ∘ R.F₁ i ∘ unit.η X ∘ f ≈⟨ refl⟩∘⟨ sym-assoc ⟩\n R.F₁ g ∘ (R.F₁ i ∘ unit.η X) ∘ f ∎\n\n Ladjunct-comm′ : ∀ {X A B} {f : A ⇒ X} {g : L.F₀ X D.⇒ B} →\n Ladjunct (g D.∘ L.F₁ f) ≈ Ladjunct g ∘ f\n Ladjunct-comm′ = ∘-resp-≈ˡ R.homomorphism ○ (pullʳ (⟺ (unit.commute _))) ○ sym-assoc\n\n Ladjunct-resp-≈ : ∀ {A B} {f g : L.F₀ A D.⇒ B} → f D.≈ g → Ladjunct f ≈ Ladjunct g\n Ladjunct-resp-≈ eq = ∘-resp-≈ˡ (R.F-resp-≈ eq)\n\n module _ where\n open D\n open HomReasoning\n open MR D\n\n Radjunct-comm : ∀ {X Y A B} {h i : X C.⇒ R.F₀ Y} {f : A C.⇒ X} {g : Y ⇒ B} →\n h C.≈ i →\n counit.η B ∘ L.F₁ (R.F₁ g C.∘ h C.∘ f) ≈ g ∘ (counit.η Y ∘ L.F₁ i) ∘ L.F₁ f\n Radjunct-comm {X} {Y} {A} {B} {h} {i} {f} {g} eq = begin\n counit.η B ∘ L.F₁ (R.F₁ g C.∘ h C.∘ f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩\n counit.η B ∘ L.F₁ (R.F₁ g) ∘ L.F₁ (h C.∘ f) ≈⟨ pullˡ (counit.commute g) ⟩\n (g ∘ counit.η Y) ∘ L.F₁ (h C.∘ f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩\n (g ∘ counit.η Y) ∘ L.F₁ h ∘ L.F₁ f ≈⟨ refl⟩∘⟨ L.F-resp-≈ eq ⟩∘⟨refl ⟩\n (g ∘ counit.η Y) ∘ L.F₁ i ∘ L.F₁ f ≈⟨ pullʳ sym-assoc ⟩\n g ∘ (counit.η Y ∘ L.F₁ i) ∘ L.F₁ f ∎\n\n Radjunct-comm′ : ∀ {Y A B} {f : A C.⇒ R.F₀ Y} {g : Y ⇒ B} →\n Radjunct (R.F₁ g C.∘ f) ≈ g ∘ Radjunct f\n Radjunct-comm′ = ∘-resp-≈ʳ L.homomorphism ○ pullˡ (counit.commute _) ○ assoc\n\n Radjunct-resp-≈ : ∀ {A B} {f g : A C.⇒ R.F₀ B} → f C.≈ g → Radjunct f ≈ Radjunct g\n Radjunct-resp-≈ eq = ∘-resp-≈ʳ (L.F-resp-≈ eq)\n\n -- a complication: the two hom functors do not live in the same Setoids,\n -- so they need to be mapped to the same Setoids first before establishing\n -- natural isomorphism!\n module _ where\n private\n levelℓ : Category o ℓ e → Level\n levelℓ {ℓ = ℓ} _ = ℓ\n\n levele : Category o ℓ e → Level\n levele {e = e} _ = e\n\n\n Hom[L-,-]′ : Bifunctor C.op D (Setoids _ _)\n Hom[L-,-]′ = LiftSetoids (levelℓ C) (levele C) ∘F Hom[ D ][-,-] ∘F (L.op ⁂ idF)\n\n Hom[-,R-]′ : Bifunctor C.op D (Setoids _ _)\n Hom[-,R-]′ = LiftSetoids (levelℓ D) (levele D) ∘F Hom[ C ][-,-] ∘F (idF ⁂ R)\n\n Hom-NI : NaturalIsomorphism Hom[L-,-]′ Hom[-,R-]′\n Hom-NI = record\n { F⇒G = ntHelper record\n { η = λ _ → record\n { _⟨$⟩_ = λ f → lift (Ladjunct (lower f))\n ; cong = λ eq → lift (Ladjunct-resp-≈ (lower eq))\n }\n ; commute = λ _ eq → lift $ Ladjunct-comm (lower eq)\n }\n ; F⇐G = ntHelper record\n { η = λ _ → record\n { _⟨$⟩_ = λ f → lift (Radjunct (lower f))\n ; cong = λ eq → lift (Radjunct-resp-≈ (lower eq))\n }\n ; commute = λ _ eq → lift $ Radjunct-comm (lower eq)\n }\n ; iso = λ X → record\n { isoˡ = λ eq → let open D.HomReasoning in lift (RLadjunct≈id ○ lower eq)\n ; isoʳ = λ eq → let open C.HomReasoning in lift (LRadjunct≈id ○ lower eq)\n }\n }\n\n module Hom-NI = NaturalIsomorphism Hom-NI\n\ninfix 5 _⊣_\n_⊣_ = Adjoint\n\n⊣-id : idF {C = C} ⊣ idF {C = C}\n⊣-id {C = C} = record\n { unit = F⇐G unitorˡ\n ; counit = F⇒G unitorʳ\n ; zig = identityˡ\n ; zag = identityʳ\n }\n where open Category C\n open NaturalIsomorphism\n", "meta": {"hexsha": "5d0ea0981e2e0b0b89ddca997ef613a3647f49e5", "size": 8130, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Adjoint.agda", "max_stars_repo_name": "laMudri/agda-categories", "max_stars_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Adjoint.agda", "max_issues_repo_name": "laMudri/agda-categories", "max_issues_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Adjoint.agda", "max_forks_repo_name": "laMudri/agda-categories", "max_forks_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.6216216216, "max_line_length": 108, "alphanum_fraction": 0.5292742927, "num_tokens": 3351, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473779969194, "lm_q2_score": 0.7905303211371899, "lm_q1q2_score": 0.6896170528710903}} {"text": "------------------------------------------------------------------------------\n-- The division program is correct\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- This module proves the correctness of the division program using\n-- repeated subtraction (Dybjer 1985).\n\n-- Peter Dybjer. Program verification in a logical theory of\n-- constructions. In Jean-Pierre Jouannaud, editor. Functional\n-- Programming Languages and Computer Architecture, volume 201 of\n-- LNCS, 1985, pages 334-349. Appears in revised form as Programming\n-- Methodology Group Report 26, June 1986.\n\nmodule LTC-PCF.Program.Division.CorrectnessProof where\n\nopen import LTC-PCF.Base\nopen import LTC-PCF.Data.Nat\nopen import LTC-PCF.Data.Nat.Inequalities\nopen import LTC-PCF.Data.Nat.Inequalities.Properties\nopen import LTC-PCF.Data.Nat.Properties\n\nimport LTC-PCF.Data.Nat.Induction.NonAcc.WF\nopen module WFInd = LTC-PCF.Data.Nat.Induction.NonAcc.WF.WFInd\n\nopen import LTC-PCF.Program.Division.Division\nopen import LTC-PCF.Program.Division.Specification\nopen import LTC-PCF.Program.Division.Result\nopen import LTC-PCF.Program.Division.Totality\n\n------------------------------------------------------------------------------\n-- The division program is correct when the dividend is less than the\n-- divisor.\ndiv-x zero →\n i ≮ j →\n divSpec i j (div i j)\ndiv-x≮y-correct {i} {j} Ni Nj ah j>0 i≮j =\n div-x≮y-N ih i≮j , div-x≮y-resultCorrect Ni Nj ih i≮j\n\n where\n -- The inductive hypothesis on i ∸ j.\n ih : divSpec (i ∸ j) j (div (i ∸ j) j)\n ih = ah {i ∸ j}\n (∸-N Ni Nj)\n (x≥y→y>0→x∸y0)\n\n------------------------------------------------------------------------------\n-- The division program is correct.\n\n-- We do the well-founded induction on i and we keep j fixed.\ndivCorrect : ∀ {i j} → N i → N j → j > zero → divSpec i j (div i j)\ndivCorrect {j = j} Ni Nj j>0 = <-wfind A ih Ni\n where\n A : D → Set\n A d = divSpec d j (div d j)\n\n -- The inductive step doesn't use the variable i (nor Ni). To make\n -- this clear we write down the inductive step using the variables m\n -- and n.\n ih : ∀ {n} → N n → (∀ {m} → N m → m < n → A m) → A n\n ih {n} Nn ah =\n case (div-x0) (x X -> X\nid x = x\n\n-- standard composition: f << g is \"f after g\"\n_<<_ : {X Y Z : Set} -> (Y -> Z) -> (X -> Y) -> (X -> Z)\n(f << g) x = f (g x)\n\n-- diagrammatic composition: f >> g is \"f then g\"\n_>>_ : {X Y Z : Set} -> (X -> Y) -> (Y -> Z) -> (X -> Z)\n -- ^^^^^^^^ dominoes!\n(f >> g) x = g (f x)\ninfixr 5 _>>_\n\n-- infix application\n_$_ : {S : Set}{T : S -> Set}(f : (x : S) -> T x)(s : S) -> T s\nf $ s = f s\ninfixl 2 _$_\n\n\n------------------------------------------------------------------------------\n-- some basic \"logical\" types\n------------------------------------------------------------------------------\n\ndata Zero : Set where\n -- to give a value in a data, choose one constructor\n -- there are no constructors\n -- so that's impossible\n\nrecord One : Set where\n -- to give a value in a record type, fill all its fields\n -- there are no fields\n -- so that's trivial\n -- (can we have a constructor, for convenience?)\n constructor <>\n\ndata _+_ (S : Set)(T : Set) : Set where -- \"where\" wants an indented block\n -- to offer a choice of constructors, list them with their types\n inl : S -> S + T -- constructors can pack up stuff\n inr : T -> S + T\n -- in Haskell, this was called \"Either S T\"\n\nrecord Sg (S : Set)(T : S -> Set) : Set where -- Sg is short for \"Sigma\"\n constructor _,_\n field -- introduces a bunch of fields, listed with their types\n fst : S \n snd : T fst\n-- make _*_ from Sg ?\nopen Sg public\n\n_*_ : Set -> Set -> Set\nS * T = Sg S \\ _ -> T\n\ninfixr 4 _,_ _*_\n\n\n------------------------------------------------------------------------------\n-- natural numbers and addition\n------------------------------------------------------------------------------\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat -- recursive data type\n \n{-# BUILTIN NATURAL Nat #-}\n-- ^^^^^^^^^^^^^^^^^^^ this pragma lets us use decimal notation\n\n_+N_ : Nat -> Nat -> Nat\nzero +N y = y\nsuc x +N y = suc (x +N y) -- there are other choices\n\n\n------------------------------------------------------------------------------\n-- equality\n------------------------------------------------------------------------------\n\ndata _==_ {X : Set} : X -> X -> Set where\n refl : (x : X) -> x == x -- the relation that's \"only reflexive\"\n\n{-# BUILTIN EQUALITY _==_ #-} -- we'll see what that's for, later\n\n_=$=_ : {X Y : Set}{f f' : X -> Y}{x x' : X} ->\n f == f' -> x == x' -> f x == f' x'\nrefl f =$= refl x = refl (f x)\n\n_=$_ : {S : Set}{T : S -> Set}{f g : (x : S) -> T x} -> (f == g) -> (x : S) -> f x == g x\nrefl f =$ x = refl (f x)\n\ninfixl 2 _=$=_ _=$_\n\nsym : {X : Set}{x y : X} -> x == y -> y == x\nsym (refl x) = refl x\n\n_[QED] : {X : Set}(x : X) -> x == x\nx [QED] = refl x\n_=[_>=_ : {X : Set}(x : X){y z : X} -> x == y -> y == z -> x == z\nx =[ refl .x >= q = q\n_=<_]=_ : {X : Set}(x : X){y z : X} -> y == x -> y == z -> x == z\nx =< refl .x ]= q = q\ninfixr 1 _=[_>=_ _=<_]=_\ninfixr 2 _[QED]\n\n\n------------------------------------------------------------------------------\n-- greater-than-or-equals\n------------------------------------------------------------------------------\n\n_>=_ : Nat -> Nat -> Set\nx >= zero = One\nzero >= suc y = Zero\nsuc x >= suc y = x >= y\n\nrefl->= : (n : Nat) -> n >= n\nrefl->= zero = record {}\nrefl->= (suc n) = refl->= n\n\ntrans->= : (x y z : Nat) -> x >= y -> y >= z -> x >= z\ntrans->= x y zero x>=y y>=z = record {}\ntrans->= x zero (suc z) x>=y ()\ntrans->= zero (suc y) (suc z) () y>=z\ntrans->= (suc x) (suc y) (suc z) x>=y y>=z = trans->= x y z x>=y y>=z\n\nsuc->= : (x : Nat) -> suc x >= x\nsuc->= zero = <>\nsuc->= (suc x) = suc->= x\n\n\n----------------------------------------------------------------------------\n-- Two -- the type of Boolean values\n----------------------------------------------------------------------------\n\ndata Two : Set where tt ff : Two\n{-# BUILTIN BOOL Two #-}\n{-# BUILTIN TRUE tt #-}\n{-# BUILTIN FALSE ff #-}\n\n-- nondependent conditional with traditional syntax\nif_then_else_ : forall {l}{X : Set l} -> Two -> X -> X -> X\nif tt then t else e = t\nif ff then t else e = e\n\n-- dependent conditional cooked for partial application\ncaseTwo : forall {l}{P : Two -> Set l} -> P tt -> P ff -> (b : Two) -> P b\ncaseTwo t f tt = t\ncaseTwo t f ff = f\n\n\n----------------------------------------------------------------------------\n-- lists\n----------------------------------------------------------------------------\n\ndata List (X : Set) : Set where\n [] : List X\n _,-_ : (x : X)(xs : List X) -> List X\ninfixr 4 _,-_\n{-# COMPILE GHC List = data [] ([] | (:)) #-}\n{-# BUILTIN LIST List #-}\n\n\n----------------------------------------------------------------------------\n-- chars and strings\n----------------------------------------------------------------------------\n\npostulate -- this means that we just suppose the following things exist...\n Char : Set\n String : Set\n{-# BUILTIN CHAR Char #-}\n{-# BUILTIN STRING String #-}\n\nprimitive -- these are baked in; they even work!\n primCharEquality : Char -> Char -> Two\n primStringAppend : String -> String -> String\n primStringToList : String -> List Char\n primStringFromList : List Char -> String\n\n\n", "meta": {"hexsha": "d85d9c84f525250cfe9d8d6969f9d0e5e735e612", "size": 5900, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "CS410-Prelude.agda", "max_stars_repo_name": "poscat0x04/CS410", "max_stars_repo_head_hexsha": "5b20aeffeaf714769e121bc9f7aa7c25106d0a1b", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "CS410-Prelude.agda", "max_issues_repo_name": "poscat0x04/CS410", "max_issues_repo_head_hexsha": "5b20aeffeaf714769e121bc9f7aa7c25106d0a1b", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "CS410-Prelude.agda", "max_forks_repo_name": "poscat0x04/CS410", "max_forks_repo_head_hexsha": "5b20aeffeaf714769e121bc9f7aa7c25106d0a1b", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.890052356, "max_line_length": 89, "alphanum_fraction": 0.3876271186, "num_tokens": 1548, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942261220292, "lm_q2_score": 0.7745833945721304, "lm_q1q2_score": 0.6896071238375693}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- An inductive definition for the permutation relation\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.List.Relation.Binary.Permutation.Inductive\n {a} {A : Set a} where\n\nopen import Data.List using (List; []; _∷_)\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl)\nimport Relation.Binary.Reasoning.Setoid as EqReasoning\n\n------------------------------------------------------------------------\n-- An inductive definition of permutation\n\ninfix 3 _↭_\n\ndata _↭_ : Rel (List A) a where\n refl : ∀ {xs} → xs ↭ xs\n prep : ∀ {xs ys} x → xs ↭ ys → x ∷ xs ↭ x ∷ ys\n swap : ∀ {xs ys} x y → xs ↭ ys → x ∷ y ∷ xs ↭ y ∷ x ∷ ys\n trans : ∀ {xs ys zs} → xs ↭ ys → ys ↭ zs → xs ↭ zs\n\n------------------------------------------------------------------------\n-- _↭_ is an equivalence\n\n↭-reflexive : _≡_ ⇒ _↭_\n↭-reflexive refl = refl\n\n↭-refl : Reflexive _↭_\n↭-refl = refl\n\n↭-sym : ∀ {xs ys} → xs ↭ ys → ys ↭ xs\n↭-sym refl = refl\n↭-sym (prep x xs↭ys) = prep x (↭-sym xs↭ys)\n↭-sym (swap x y xs↭ys) = swap y x (↭-sym xs↭ys)\n↭-sym (trans xs↭ys ys↭zs) = trans (↭-sym ys↭zs) (↭-sym xs↭ys)\n\n↭-trans : Transitive _↭_\n↭-trans = trans\n\n↭-isEquivalence : IsEquivalence _↭_\n↭-isEquivalence = record\n { refl = refl\n ; sym = ↭-sym\n ; trans = trans\n }\n\n↭-setoid : Setoid _ _\n↭-setoid = record\n { isEquivalence = ↭-isEquivalence\n }\n\n------------------------------------------------------------------------\n-- A reasoning API to chain permutation proofs and allow \"zooming in\"\n-- to localised reasoning.\n\nmodule PermutationReasoning where\n\n open EqReasoning ↭-setoid\n using (_IsRelatedTo_; relTo)\n\n open EqReasoning ↭-setoid public\n using (begin_ ; _∎ ; _≡⟨⟩_; _≡⟨_⟩_)\n renaming (_≈⟨_⟩_ to _↭⟨_⟩_; _≈˘⟨_⟩_ to _↭˘⟨_⟩_)\n\n infixr 2 _∷_<⟨_⟩_ _∷_∷_<<⟨_⟩_\n\n -- Skip reasoning on the first element\n _∷_<⟨_⟩_ : ∀ x xs {ys zs : List A} → xs ↭ ys →\n (x ∷ ys) IsRelatedTo zs → (x ∷ xs) IsRelatedTo zs\n x ∷ xs <⟨ xs↭ys ⟩ rel = relTo (trans (prep x xs↭ys) (begin rel))\n\n -- Skip reasoning about the first two elements\n _∷_∷_<<⟨_⟩_ : ∀ x y xs {ys zs : List A} → xs ↭ ys →\n (y ∷ x ∷ ys) IsRelatedTo zs → (x ∷ y ∷ xs) IsRelatedTo zs\n x ∷ y ∷ xs <<⟨ xs↭ys ⟩ rel = relTo (trans (swap x y xs↭ys) (begin rel))\n", "meta": {"hexsha": "023bb4e7884f41416bac27da821cf72e814edaf5", "size": 2477, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Permutation/Inductive.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Permutation/Inductive.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Permutation/Inductive.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.2073170732, "max_line_length": 75, "alphanum_fraction": 0.5062575696, "num_tokens": 870, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.890294223211224, "lm_q2_score": 0.774583389368527, "lm_q1q2_score": 0.6896071169501697}} {"text": "module foldl where\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl; sym; trans; cong)\nopen Eq.≡-Reasoning\n\nopen import lists using (List; []; _∷_; [_,_,_])\n\nfoldl : ∀ {A B : Set} → (B → A → B) → B → List A → B\nfoldl _⊗_ e [] = e\nfoldl _⊗_ e (x ∷ xs) = foldl _⊗_ (e ⊗ x) xs\n\ntest-foldl : ∀ {A B : Set} → (_⊗_ : B → A → B) → (e : B) → (x y z : A)\n → foldl _⊗_ e [ x , y , z ] ≡ ((e ⊗ x) ⊗ y) ⊗ z\ntest-foldl _⊗_ e x y z = refl\n", "meta": {"hexsha": "62658bed86df99bfffa5a1b82a5a5e8a2bea0d1b", "size": 460, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "part1/lists/foldl.agda", "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_issues_repo_path": "part1/lists/foldl.agda", "max_issues_repo_name": "akiomik/plfa-solutions", "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "part1/lists/foldl.agda", "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.75, "max_line_length": 70, "alphanum_fraction": 0.5304347826, "num_tokens": 211, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8902942261220292, "lm_q2_score": 0.7745833841649232, "lm_q1q2_score": 0.6896071145720928}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Data.Bool.Properties where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Foundations.Isomorphism\nopen import Cubical.Foundations.Univalence\n\nopen import Cubical.Data.Bool.Base\nopen import Cubical.Data.Empty\n\nopen import Cubical.Relation.Nullary\nopen import Cubical.Relation.Nullary.DecidableEq\n\nnotnot : ∀ x → not (not x) ≡ x\nnotnot true = refl\nnotnot false = refl\n\nnotIsEquiv : isEquiv not\nnotIsEquiv = isoToIsEquiv (iso not not notnot notnot)\n\nnotEquiv : Bool ≃ Bool\nnotEquiv = (not , notIsEquiv)\n\nnotEq : Bool ≡ Bool\nnotEq = ua notEquiv\n\nprivate\n -- This computes to false as expected\n nfalse : Bool\n nfalse = transp (λ i → notEq i) i0 true\n\n -- Sanity check\n nfalsepath : nfalse ≡ false\n nfalsepath = refl\n\nisSetBool : isSet Bool\nisSetBool = Discrete→isSet _≟_\n\ntrue≢false : ¬ true ≡ false\ntrue≢false p = subst (λ b → if b then Bool else ⊥) p true\n\nfalse≢true : ¬ false ≡ true\nfalse≢true p = subst (λ b → if b then ⊥ else Bool) p true\n\nnot≢const : ∀ x → ¬ not x ≡ x\nnot≢const false = true≢false\nnot≢const true = false≢true\n\nzeroˡ : ∀ x → true or x ≡ true\nzeroˡ false = refl\nzeroˡ true = refl\n\nzeroʳ : ∀ x → x or true ≡ true\nzeroʳ false = refl\nzeroʳ true = refl\n\nor-identityˡ : ∀ x → false or x ≡ x\nor-identityˡ false = refl\nor-identityˡ true = refl\n\nor-identityʳ : ∀ x → x or false ≡ x\nor-identityʳ false = refl\nor-identityʳ true = refl\n\nor-comm : ∀ x y → x or y ≡ y or x\nor-comm false y =\n false or y ≡⟨ or-identityˡ y ⟩\n y ≡⟨ sym (or-identityʳ y) ⟩\n y or false ∎\nor-comm true y =\n true or y ≡⟨ zeroˡ y ⟩\n true ≡⟨ sym (zeroʳ y) ⟩\n y or true ∎\n\nor-assoc : ∀ x y z → x or (y or z) ≡ (x or y) or z\nor-assoc false y z =\n false or (y or z) ≡⟨ or-identityˡ _ ⟩\n y or z ≡[ i ]⟨ or-identityˡ y (~ i) or z ⟩\n ((false or y) or z) ∎\nor-assoc true y z =\n true or (y or z) ≡⟨ zeroˡ _ ⟩\n true ≡⟨ sym (zeroˡ _) ⟩\n true or z ≡[ i ]⟨ zeroˡ y (~ i) or z ⟩\n (true or y) or z ∎\n\nor-idem : ∀ x → x or x ≡ x\nor-idem false = refl\nor-idem true = refl\n\n⊕-comm : ∀ x y → x ⊕ y ≡ y ⊕ x\n⊕-comm false false = refl\n⊕-comm false true = refl\n⊕-comm true false = refl\n⊕-comm true true = refl\n\n⊕-assoc : ∀ x y z → x ⊕ (y ⊕ z) ≡ (x ⊕ y) ⊕ z\n⊕-assoc false y z = refl\n⊕-assoc true false z = refl\n⊕-assoc true true z = notnot z\n\nnot-⊕ˡ : ∀ x y → not (x ⊕ y) ≡ not x ⊕ y\nnot-⊕ˡ false y = refl\nnot-⊕ˡ true y = notnot y\n\n⊕-invol : ∀ x y → x ⊕ (x ⊕ y) ≡ y\n⊕-invol false x = refl\n⊕-invol true x = notnot x\n\nisEquiv-⊕ : ∀ x → isEquiv (x ⊕_)\nisEquiv-⊕ x = isoToIsEquiv (iso _ (x ⊕_) (⊕-invol x) (⊕-invol x))\n", "meta": {"hexsha": "fa87e2dede478aada74163d50c9f722ac1bf214f", "size": 2719, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/Bool/Properties.agda", "max_stars_repo_name": "ayberkt/cubical", "max_stars_repo_head_hexsha": "f25b8479fe8160fa4ddbb32e288ba26be6cc242f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/Bool/Properties.agda", "max_issues_repo_name": "ayberkt/cubical", "max_issues_repo_head_hexsha": "f25b8479fe8160fa4ddbb32e288ba26be6cc242f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/Data/Bool/Properties.agda", "max_forks_repo_name": "ayberkt/cubical", "max_forks_repo_head_hexsha": "f25b8479fe8160fa4ddbb32e288ba26be6cc242f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.850877193, "max_line_length": 65, "alphanum_fraction": 0.6222876057, "num_tokens": 1118, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942232112239, "lm_q2_score": 0.7745833737577159, "lm_q1q2_score": 0.6896071030519547}} {"text": "module ProjectingRecordMeta where\n\ndata _==_ {A : Set}(a : A) : A -> Set where\n refl : a == a\n\n-- Andreas, Feb/Apr 2011\nrecord Prod (A B : Set) : Set where\n constructor _,_ \n field\n fst : A\n snd : B \n\nopen Prod public\n\ntestProj : {A B : Set}(y z : Prod A B) ->\n let X : Prod A B\n X = _ -- Solution: fst y , snd z\n in (C : Set) -> (fst X == fst y -> snd X == snd z -> C) -> C\ntestProj y z C k = k refl refl\n-- ok, Agda handles projections properly during unification\n\ntestProj' : {A B : Set}(y z : Prod A B) ->\n let X : Prod A B\n X = _ -- Solution: fst y , snd z\n in Prod (fst X == fst y) (snd X == snd z)\ntestProj' y z = refl , refl\n", "meta": {"hexsha": "da9713b6fe45e93a8c39cfd834fd12bcafcfde7f", "size": 668, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/ProjectingRecordMeta.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/succeed/ProjectingRecordMeta.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/ProjectingRecordMeta.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.7407407407, "max_line_length": 62, "alphanum_fraction": 0.5538922156, "num_tokens": 232, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942203004186, "lm_q2_score": 0.7745833737577158, "lm_q1q2_score": 0.6896071007972933}} {"text": "-- {-# OPTIONS -v tc.conv:30 -v tc.conv.level:60 -v tc.meta.assign:15 #-}\n\nmodule UniversePolymorphism where\n\nopen import Common.Level renaming (_⊔_ to max)\n\ndata Nat : Set where\n zero : Nat\n suc : Nat → Nat\n\ninfixr 40 _∷_\n\ndata Vec {i}(A : Set i) : Nat → Set i where\n [] : Vec {i} A zero\n _∷_ : ∀ {n} → A → Vec {i} A n → Vec {i} A (suc n)\n\nmap : ∀ {n a b}{A : Set a}{B : Set b} → (A → B) → Vec A n → Vec B n\nmap f [] = []\nmap f (x ∷ xs) = f x ∷ map f xs\n\nvec : ∀ {n a}{A : Set a} → A → Vec A n\nvec {zero} _ = []\nvec {suc n} x = x ∷ vec x\n\n_<*>_ : ∀ {n a b}{A : Set a}{B : Set b} → Vec (A → B) n → Vec A n → Vec B n\n[] <*> [] = []\n(f ∷ fs) <*> (x ∷ xs) = f x ∷ (fs <*> xs)\n\nflip : ∀ {a b c}{A : Set a}{B : Set b}{C : Set c} →\n (A → B → C) → B → A → C\nflip f x y = f y x\n\nmodule Zip where\n\n Fun : ∀ {n a} → Vec (Set a) n → Set a → Set a\n Fun [] B = B\n Fun (A ∷ As) B = A → Fun As B\n\n app : ∀ {n m a}(As : Vec (Set a) n)(B : Set a) →\n Vec (Fun As B) m → Fun (map (flip Vec m) As) (Vec B m)\n app [] B bs = bs\n app (A ∷ As) B fs = λ as → app As B (fs <*> as)\n\n zipWith : ∀ {n m a}(As : Vec (Set a) n)(B : Set a) →\n Fun As B → Fun (map (flip Vec m) As) (Vec B m)\n zipWith As B f = app As B (vec f)\n\n zipWith₃ : ∀ {n a}{A B C D : Set a} → (A → B → C → D) → Vec A n → Vec B n → Vec C n → Vec D n\n zipWith₃ = zipWith (_ ∷ _ ∷ _ ∷ []) _\n\ndata Σ {a b}(A : Set a)(B : A → Set b) : Set (max a b) where\n _,_ : (x : A)(y : B x) → Σ A B\n\nfst : ∀ {a b}{A : Set a}{B : A → Set b} → Σ A B → A\nfst (x , y) = x\n\nsnd : ∀ {a b}{A : Set a}{B : A → Set b}(p : Σ A B) → B (fst p)\nsnd (x , y) = y\n\n-- Normal Σ\nList : ∀ {a} → Set a → Set a\nList A = Σ _ (Vec A)\n\nnil : ∀ {a}{A : Set a} → List A\nnil = _ , []\n\ncons : ∀ {a}{A : Set a} → A → List A → List A\ncons x (_ , xs) = _ , x ∷ xs\n\nAnyList : ∀ {i} → Set (lsuc i)\nAnyList {i} = Σ (Set i) (List {i})\n", "meta": {"hexsha": "cb3b80d4ad61c060046c8bc301109651d467d5b3", "size": 1895, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/UniversePolymorphism.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z", "max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z", "max_issues_repo_path": "test/succeed/UniversePolymorphism.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/UniversePolymorphism.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 26.3194444444, "max_line_length": 95, "alphanum_fraction": 0.4511873351, "num_tokens": 836, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9099070109242131, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.6895224162388744}} {"text": "{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- Thm: (∃x)A(x), (∀x)(A(x) ⇒ B(x)) ⊢ (∃x)B(x)\n\n-- From: Elliott Mendelson. Introduction to mathematical logic. Chapman &\n-- Hall, 4th edition, 1997, p. 155.\n\n-- Rule A4: (∀x)A(x) ⇒ A(t) (with some conditions)\n-- Rule E4: A(t) ⇒ (∃x)A(x) (with some conditions)\n-- Rule C: From (∃x)A(x) to A(t) (with some conditions)\n\n-- 1. (∃x)A(x) Hyp\n-- 2. (∀x)(A(x) ⇒ B(x)) Hyp\n-- 3. A(b) 1, rule C\n-- 4. A(b) ⇒ B(b) 2, rule A4\n-- 5. B(b) 4,3 MP\n-- 6. (∃x)B(x) 5, rule E4\n\nmodule FOT.Common.FOL.Existential.Witness where\n\npostulate\n D : Set\n A B : D → Set\n\nmodule Witness where\n\n infixr 7 _,_\n\n data ∃ (A : D → Set) : Set where\n _,_ : ∀ x → A x → ∃ A\n\n ∃-elim : {A : D → Set}{B : Set} → ∃ A → (∀ x → A x → B) → B\n ∃-elim (x , Ax) h = h x Ax\n\n -- A proof using the existential elimination.\n prf₁ : ∃ A → (∀ {x} → A x → B x) → ∃ B\n prf₁ h₁ h₂ = ∃-elim h₁ (λ x Ax → x , (h₂ Ax))\n\n -- A proof using pattern matching.\n prf₂ : ∃ A → (∀ {x} → A x → B x) → ∃ B\n prf₂ (x , Ax) h = x , h Ax\n\nmodule NonWitness₁ where\n\n data ∃ (A : D → Set) : Set where\n ∃-intro : ∀ {x} → A x → ∃ A\n\n ∃-elim : {A : D → Set}{B : Set} → ∃ A → (∀ {x} → A x → B) → B\n ∃-elim (∃-intro Ax) h = h Ax\n\n -- A proof using the existential elimination.\n prf₁ : ∃ A → (∀ {x} → A x → B x) → ∃ B\n prf₁ h₁ h₂ = ∃-elim h₁ (λ Ax → ∃-intro (h₂ Ax))\n\n -- A proof using pattern matching.\n prf₂ : ∃ A → (∀ {x} → A x → B x) → ∃ B\n prf₂ (∃-intro Ax) h = ∃-intro (h Ax)\n\nmodule NonWitness₂ where\n\n -- We add 3 to the fixities of the Agda standard library 0.8.1 (see\n -- Relation/Nullary/Core.agda).\n infix 6 ¬_\n\n -- The empty type.\n data ⊥ : Set where\n\n ⊥-elim : {A : Set} → ⊥ → A\n ⊥-elim ()\n\n ¬_ : Set → Set\n ¬ A = A → ⊥\n\n ∃ : (D → Set) → Set\n ∃ A = ¬ (∀ x → ¬ (A x))\n\n prf : ∃ A → (∀ x → A x → B x) → ∃ B\n prf h₁ h₂ h₃ = h₁ (λ x Ax → h₃ x (h₂ x Ax))\n", "meta": {"hexsha": "be10016b3d14858f640d69e218528028b2ce00c8", "size": 2051, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/Common/FOL/Existential/Witness.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/Common/FOL/Existential/Witness.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/Common/FOL/Existential/Witness.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 25.012195122, "max_line_length": 73, "alphanum_fraction": 0.4797659678, "num_tokens": 873, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.855851143290548, "lm_q2_score": 0.8056321843145405, "lm_q1q2_score": 0.689501226017261}} {"text": "open import Agda.Primitive\n\nmodule Experimental.Equality where\n\n data _≡_ {ℓ} {A : Set ℓ} : A → A → Set ℓ where\n refl : ∀ {x : A} → x ≡ x\n\n sym : ∀ {ℓ} {A : Set ℓ} {x y : A} → x ≡ y → y ≡ x\n sym refl = refl\n\n tran : ∀ {ℓ} {A : Set ℓ} {x y z : A} → x ≡ y → y ≡ z → x ≡ z\n tran refl q = q\n\n ap : ∀ {ℓ k} {A : Set ℓ} {B : Set k} {x y : A} {f : A → B} → x ≡ y → f x ≡ f y\n ap refl = refl\n\n transport : ∀ {ℓ k} {A : Set ℓ} (B : A → Set k) {x y : A} → x ≡ y → B x → B y\n transport _ refl u = u\n", "meta": {"hexsha": "a3c8de24b935ed91a7b6fa65d7a526c956adf58b", "size": 500, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Experimental/Equality.agda", "max_stars_repo_name": "cilinder/formaltt", "max_stars_repo_head_hexsha": "0a9d25e6e3965913d9b49a47c88cdfb94b55ffeb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2021-02-16T14:07:06.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-19T15:50:08.000Z", "max_issues_repo_path": "src/Experimental/Equality.agda", "max_issues_repo_name": "andrejbauer/formaltt", "max_issues_repo_head_hexsha": "2aaf850bb1a262681c5a232cdefae312f921b9d4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-04-30T14:18:25.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-14T16:15:17.000Z", "max_forks_repo_path": "src/Experimental/Equality.agda", "max_forks_repo_name": "andrejbauer/formaltt", "max_forks_repo_head_hexsha": "2aaf850bb1a262681c5a232cdefae312f921b9d4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2021-02-16T13:43:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-24T02:51:43.000Z", "avg_line_length": 26.3157894737, "max_line_length": 80, "alphanum_fraction": 0.45, "num_tokens": 242, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9314625088705931, "lm_q2_score": 0.7401743620390163, "lm_q1q2_score": 0.6894446682665528}} {"text": "{-# OPTIONS --cubical --no-import-sorts #-}\n\n\nopen import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc)\nopen import Function.Base using (_∋_)\nimport Cubical.Algebra.Group as Std\n-- import Cubical.Structures.Group.Properties\nopen import MorePropAlgebra.Bundles\n\nmodule MorePropAlgebra.Properties.Group {ℓ} (assumptions : Group {ℓ}) where\nopen Group assumptions renaming (Carrier to G)\n\nimport MorePropAlgebra.Properties.Monoid\nmodule Monoid'Properties = MorePropAlgebra.Properties.Monoid (record { Group assumptions }) -- how does this even work without renaming?\nmodule Monoid' = Monoid (record { Group assumptions })\n( Monoid') = Monoid ∋ (record { Group assumptions })\n\nstdIsGroup : Std.IsGroup 0g _+_ (-_)\nstdIsGroup .Std.IsGroup.isMonoid = Monoid'Properties.stdIsMonoid\nstdIsGroup .Std.IsGroup.inverse = is-inverse\n\nstdGroup : Std.Group {ℓ}\nstdGroup = record { Group assumptions ; isGroup = stdIsGroup }\n\nmodule GroupLemmas' = Std.GroupLemmas stdGroup\n\n-- module GroupLemmas (G : Group {ℓ}) where\n-- open Group G public\n-- abstract\n-- simplL : (a : Carrier) {b c : Carrier} → a + b ≡ a + c → b ≡ c\n-- simplR : {a b : Carrier} (c : Carrier) → a + c ≡ b + c → a ≡ b\n-- invInvo : (a : Carrier) → - (- a) ≡ a\n-- invId : - 0g ≡ 0g\n-- idUniqueL : {e : Carrier} (x : Carrier) → e + x ≡ x → e ≡ 0g\n-- idUniqueR : (x : Carrier) {e : Carrier} → x + e ≡ x → e ≡ 0g\n-- invUniqueL : {g h : Carrier} → g + h ≡ 0g → g ≡ - h\n-- invUniqueR : {g h : Carrier} → g + h ≡ 0g → h ≡ - g\n-- invDistr : (a b : Carrier) → - (a + b) ≡ - b - a\n\n-- private\n-- simplR = GroupLemmas.simplR G\n\nabstract\n invUniqueL : {g h : G} → g + h ≡ 0g → g ≡ - h\n invUniqueL {g} {h} p = GroupLemmas'.simplR h (p ∙ sym (is-invl h))\n\n -- ported from `Algebra.Properties.Group`\n private\n right-helper : ∀ x y → y ≡ - x + (x + y)\n right-helper x y = (\n y ≡⟨ sym (snd (is-identity y)) ⟩\n 0g + y ≡⟨ cong₂ _+_ (sym (snd (is-inverse x))) refl ⟩\n ((- x) + x) + y ≡⟨ sym (is-assoc (- x) x y) ⟩\n (- x) + (x + y) ∎)\n\n -- alternative:\n -- follows from uniqueness of -\n -- (a + -a) ≡ 0\n -- ∃! b . a + b = 0\n -- show that a is an additive inverse of - a then it must be THE additive inverse of - a and has to be called - - a which is a by uniqueness\n -involutive : ∀ x → - - x ≡ x\n -involutive x = (\n (- (- x)) ≡⟨ sym (fst (is-identity _)) ⟩\n (- (- x)) + 0g ≡⟨ cong₂ _+_ refl (sym (snd (is-inverse _))) ⟩\n (- (- x)) + (- x + x) ≡⟨ sym (right-helper (- x) x) ⟩\n x ∎)\n", "meta": {"hexsha": "1e1d3ac31ffed8cfe39f198c7bfbb81363dc8ba2", "size": 2678, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/MorePropAlgebra/Properties/Group.agda", "max_stars_repo_name": "mchristianl/synthetic-reals", "max_stars_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-07-31T18:15:26.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-19T12:15:21.000Z", "max_issues_repo_path": "agda/MorePropAlgebra/Properties/Group.agda", "max_issues_repo_name": "mchristianl/synthetic-reals", "max_issues_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/MorePropAlgebra/Properties/Group.agda", "max_forks_repo_name": "mchristianl/synthetic-reals", "max_forks_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.9701492537, "max_line_length": 144, "alphanum_fraction": 0.5589992532, "num_tokens": 936, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970748488297, "lm_q2_score": 0.7826624789529375, "lm_q1q2_score": 0.6893668220556811}} {"text": "-- Product of two categories\n{-# OPTIONS --safe #-}\n\nmodule Cubical.Categories.Constructions.BinProduct where\n\nopen import Cubical.Categories.Category.Base\nopen import Cubical.Categories.Functor.Base\nopen import Cubical.Data.Sigma renaming (_×_ to _×'_)\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Prelude\n\nprivate\n variable\n ℓC ℓC' ℓD ℓD' ℓE ℓE' : Level\n\n\nopen Category\n\n_×_ : (C : Category ℓC ℓC') → (D : Category ℓD ℓD')\n → Category (ℓ-max ℓC ℓD) (ℓ-max ℓC' ℓD')\n\n(C × D) .ob = (ob C) ×' (ob D)\n(C × D) .Hom[_,_] (c , d) (c' , d') = (C [ c , c' ]) ×' (D [ d , d' ])\n(C × D) .id = (id C , id D)\n(C × D) ._⋆_ _ _ = (_ ⋆⟨ C ⟩ _ , _ ⋆⟨ D ⟩ _)\n(C × D) .⋆IdL _ = ≡-× (⋆IdL C _) (⋆IdL D _)\n(C × D) .⋆IdR _ = ≡-× (⋆IdR C _) (⋆IdR D _)\n(C × D) .⋆Assoc _ _ _ = ≡-× (⋆Assoc C _ _ _) (⋆Assoc D _ _ _)\n(C × D) .isSetHom = isSet× (isSetHom C) (isSetHom D)\n\ninfixr 5 _×_\n\n\n-- Some useful functors\nmodule _ (C : Category ℓC ℓC')\n (D : Category ℓD ℓD') where\n open Functor\n\n module _ (E : Category ℓE ℓE') where\n -- Associativity of product\n ×C-assoc : Functor (C × (D × E)) ((C × D) × E)\n ×C-assoc .F-ob (c , (d , e)) = ((c , d), e)\n ×C-assoc .F-hom (f , (g , h)) = ((f , g), h)\n ×C-assoc .F-id = refl\n ×C-assoc .F-seq _ _ = refl\n\n -- Left/right injections into product\n linj : (d : ob D) → Functor C (C × D)\n linj d .F-ob c = (c , d)\n linj d .F-hom f = (f , id D)\n linj d .F-id = refl\n linj d .F-seq f g = ≡-× refl (sym (⋆IdL D _))\n\n rinj : (c : ob C) → Functor D (C × D)\n rinj c .F-ob d = (c , d)\n rinj c .F-hom f = (id C , f)\n rinj c .F-id = refl\n rinj c .F-seq f g = ≡-× (sym (⋆IdL C _)) refl\n\n{-\n TODO:\n - define inverse to `assoc`, prove isomorphism\n - prove product is commutative up to isomorphism\n-}\n", "meta": {"hexsha": "c6498dc2d3cbf8e3e56210c732a65a17ff6259bc", "size": 1777, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Categories/Constructions/BinProduct.agda", "max_stars_repo_name": "FernandoLarrain/cubical", "max_stars_repo_head_hexsha": "9acdecfa6437ec455568be4e5ff04849cc2bc13b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-03-05T00:28:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T00:28:39.000Z", "max_issues_repo_path": "Cubical/Categories/Constructions/BinProduct.agda", "max_issues_repo_name": "Seanpm2001-web/cubical", "max_issues_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Categories/Constructions/BinProduct.agda", "max_forks_repo_name": "Seanpm2001-web/cubical", "max_forks_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.3384615385, "max_line_length": 70, "alphanum_fraction": 0.5498030388, "num_tokens": 771, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970748488296, "lm_q2_score": 0.7826624688140726, "lm_q1q2_score": 0.6893668131253985}} {"text": "----------------------------------------------------------------------\n-- Copyright: 2013, Jan Stolarek, Lodz University of Technology --\n-- --\n-- License: See LICENSE file in root of the repo --\n-- Repo address: https://github.com/jstolarek/dep-typed-wbl-heaps --\n-- --\n-- Definition of datatypes that represent ordering and functions --\n-- that operate on them. These datatypes are based on ideas --\n-- introduced in \"Why Dependent Types Matter\". --\n----------------------------------------------------------------------\n\nmodule Basics.Ordering where\n\nopen import Basics.Nat hiding (_≥_)\n\n-- The ≥ type is a proof of greater-equal relation between two natural\n-- numbers. It proves that: a) any number natural is greater or equal\n-- to zero and b) any two natural numbers are in ≥ relation if their\n-- predecessors are also in that relation.\ndata _≥_ : Nat → Nat → Set where\n ge0 : { y : Nat} → y ≥ zero\n geS : {x y : Nat} → x ≥ y → suc x ≥ suc y\n\ninfixl 4 _≥_\n\n-- Order datatype tells whether two numbers are in ≥ relation or\n-- not. In that sense it is an equivalent of Bool datatype. Unlike\n-- Bool however, Order supplies a proof of WHY the numbers are (or are\n-- not) in the ≥ relation.\ndata Order : Nat → Nat → Set where\n ge : {x : Nat} {y : Nat} → x ≥ y → Order x y\n le : {x : Nat} {y : Nat} → y ≥ x → Order x y\n\n-- order function takes two natural numbers and compares them,\n-- returning the result of comparison together with a proof of the\n-- result (result and its proof are encoded by Order datatype).\norder : (a : Nat) → (b : Nat) → Order a b\norder a zero = ge ge0\norder zero (suc b) = le ge0\norder (suc a) (suc b) with order a b\norder (suc a) (suc b) | ge a≥b = ge (geS a≥b)\norder (suc a) (suc b) | le b≥a = le (geS b≥a)\n", "meta": {"hexsha": "161d2ff2064ebad178566cf83d93d21b78bb4a4a", "size": 1953, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Basics/Ordering.agda", "max_stars_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_stars_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-05-02T21:48:43.000Z", "max_stars_repo_stars_event_max_datetime": "2018-05-02T21:48:43.000Z", "max_issues_repo_path": "src/Basics/Ordering.agda", "max_issues_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_issues_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Basics/Ordering.agda", "max_forks_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_forks_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.4186046512, "max_line_length": 70, "alphanum_fraction": 0.5514592934, "num_tokens": 493, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8962513842182775, "lm_q2_score": 0.76908023177796, "lm_q1q2_score": 0.6892892223059104}} {"text": "module List where\n\ndata Bool : Set where\n true : Bool\n false : Bool\n\nif_then_else_ : {A : Set} -> Bool -> A -> A -> A\nif true then x else y = x\nif false then x else y = y\n\nboolElim : (P : Bool -> Set) -> P true -> P false -> (b : Bool) -> P b\nboolElim P t f true = t\nboolElim P t f false = f\n\ndata False : Set where\ndata True : Set where\n tt : True\n\ndata Or (A B : Set) : Set where\n inl : (a : A) -> Or A B\n inr : (b : B) -> Or A B\n\norElim : {A B : Set}\n -> (C : Or A B -> Set)\n -> (cl : (a : A) -> C(inl a))\n -> (cr : (b : B) -> C(inr b))\n -> (ab : Or A B)\n -> C ab\norElim {A} {B} C cl cr (inl a) = cl a\norElim {A} {B} C cl cr (inr b) = cr b\n\ndata Rel(A : Set) : Set1 where\n rel : (A -> A -> Set) -> Rel A\n\n_is_than_ : {A : Set} -> A -> Rel A -> A -> Set\nx is rel f than y = f x y\n\ndata Acc {A : Set} (less : Rel A) (x : A) : Set where\n acc : ((y : A) -> y is less than x -> Acc less y) -> Acc less x\n\ndata WO {A : Set} (less : Rel A) : Set where\n wo : ((x : A) -> Acc less x) -> WO less\n\ndata Nat : Set where\n Z : Nat\n S : Nat -> Nat\n\neqNat : Nat -> Nat -> Set\neqNat Z Z = True\neqNat (S m) (S n) = eqNat m n\neqNat _ _ = False\n\nsubstEqNat : (P : Nat -> Set) -> (a b : Nat) -> (e : eqNat a b) -> (P a) -> P b\nsubstEqNat P Z Z e pa = pa\nsubstEqNat P (S x) (S x') e pa = substEqNat (\\n -> P(S n)) x x' e pa\n\nltNat : Nat -> Nat -> Set\nltNat Z Z = False\nltNat Z (S n) = True\nltNat (S m) (S n) = ltNat m n\nltNat (S m) Z = False\n\nltZ-elim : (n : Nat) -> ltNat n Z -> {whatever : Set} -> whatever\nltZ-elim Z ()\nltZ-elim (S _) ()\n\ntransNat : (x y z : Nat) -> ltNat x y -> ltNat y z -> ltNat x z\ntransNat x y Z x ltNat x (S x)\nltNat-S-Lemma Z = tt\nltNat-S-Lemma (S x) = ltNat-S-Lemma x\n\nltNat-S-Lemma2 : (y z : Nat) -> ltNat y (S z) -> Or (eqNat z y) (ltNat y z)\nltNat-S-Lemma2 Z Z h = inl tt\nltNat-S-Lemma2 Z (S x) h = inr tt\nltNat-S-Lemma2 (S x) (S x') h = ltNat-S-Lemma2 x x' h\n\nltNatRel : Rel Nat\nltNatRel = rel ltNat\n\nless = ltNatRel\n\nacc-Lemma1 : (x y : Nat) -> Acc less x -> eqNat x y -> Acc less y\nacc-Lemma1 x y a e = substEqNat (Acc less ) x y e a\n\nacc-Lemma2 : (x y : Nat) -> Acc less x -> ltNat y x -> Acc less y\nacc-Lemma2 x y (acc h) l = h y l\n\n-- postulate woltNat' : (n : Nat) -> Acc less n\nwoltNat' : (n : Nat) -> Acc less n\nwoltNat' Z = acc (\\y y ltZ-elim y y orElim (\\w -> Acc less y) (\\e -> substEqNat (Acc less ) x y e (woltNat' x ) ) (acc-Lemma2 x y (woltNat' x)) (ltNat-S-Lemma2 y x y Nat -> Bool\npostulate gt : Nat -> Nat -> Bool\n\ndata List (A : Set) : Set where\n nil : List A\n cons : (x : A) -> (xs : List A) -> List A\n\n_++_ : {A : Set} -> List A -> List A -> List A\nnil ++ ys = ys\n(cons x xs) ++ ys = cons x (xs ++ ys)\n\nlength : {A : Set} -> List A -> Nat\nlength nil = Z\nlength (cons x xs) = S (length xs)\n\nfilter : {A : Set} -> (A -> Bool) -> List A -> List A\nfilter p nil = nil\nfilter p (cons x xs) = if p x then cons x rest else rest\n where rest = filter p xs\n\nfilterLemma\n : {A : Set} -> (p : A -> Bool) -> (xs : List A)\n -> length (filter p xs) is less than S (length xs)\nfilterLemma p nil = tt\nfilterLemma p (cons x xs) =\n boolElim (\\px -> length (if px then cons x (filter p xs)\n else (filter p xs))\n is less than S (S (length xs)))\n (filterLemma p xs)\n (transNat (length (filter p xs)) (S (length xs)) (S (S (length xs)))\n (filterLemma p xs) (ltNat-S-Lemma (length xs )))\n (p x)\n\nqs : List Nat -> List Nat\nqs nil = nil\nqs (cons x xs) = qs (filter (le x) xs)\n ++ cons x nil\n ++ qs (filter (gt x) xs)\n\ndata Measure : Set1 where\n μ : {M : Set} -> {rel : Rel M} -> (ord : WO rel) -> Measure\n\ndown1-measure : Measure\ndown1-measure = μ woltNat\n\nqs-2-1-hint = \\(x : Nat) -> \\(xs : List Nat) -> filterLemma (le x) xs\nqs-2-2-hint = \\(x : Nat) -> \\(xs : List Nat) -> filterLemma (gt x) xs\n", "meta": {"hexsha": "ccbe545b191eed0d457cbf80f0c6550f50ca6c4c", "size": 4281, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/Termination/List.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/Termination/List.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/outdated-and-incorrect/Termination/List.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 28.9256756757, "max_line_length": 171, "alphanum_fraction": 0.5255781359, "num_tokens": 1659, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8962513731336202, "lm_q2_score": 0.7690802317779601, "lm_q1q2_score": 0.6892892137809197}} {"text": "-- This is an implementation of the equality type for Sets. Agda's\n-- standard equality is more powerful. The main idea here is to\n-- illustrate the equality type.\nmodule Equality where\n\nopen import Level\n-- The equality of two elements of type A. The type a ≡ b is a family\n-- of types which captures the statement of equality in A. Not all of\n-- the types are inhabited as in general not all elements are equal\n-- here. The only type that are inhabited are a ≡ a by the element\n-- that we call definition. This is called refl (for reflection in\n-- agda).\ndata _≡_ {ℓ} {A : Set ℓ} : (a b : A) → Set ℓ where\n refl : {x : A} → x ≡ x\n\n-- ≡ is a symmetric relation.\nsym : ∀{ℓ} {A : Set ℓ} {a b : A} → a ≡ b → b ≡ a\nsym refl = refl\n\n-- ≡ is a transitive relation.\ntrans : ∀ {ℓ} {A : Set ℓ} {a b c : A} → a ≡ b → b ≡ c → a ≡ c\ntrans pAB refl = pAB\n-- trans refl pBC = pBC -- alternate proof of transitivity.\n\n-- Congruence. If we apply f to equals the result are also equal.\ncong : ∀{ℓ₀ ℓ₁} {A : Set ℓ₀} {B : Set ℓ₁}\n {a₀ a₁ : A} → (f : A → B) → a₀ ≡ a₁ → f a₀ ≡ f a₁\ncong f refl = refl\n\n-- Pretty way of doing equational reasoning. If we want to prove a₀ ≡\n-- b through an intermediate set of equations use this. The general\n-- form will look like.\n--\n-- begin a ≈ a₀ by p₀\n-- ≈ a₁ by p₁\n-- ...\n-- ≈ b by p\n-- ∎\n\nbegin : ∀{ℓ} {A : Set ℓ} (a : A) → a ≡ a\n_≈_by_ : ∀{ℓ} {A : Set ℓ} {a b : A} → a ≡ b → (c : A) → b ≡ c → a ≡ c\n_∎ : ∀{ℓ} {A : Set ℓ} (a : A) → A\n\nbegin a = refl\naEb ≈ c by bEc = trans aEb bEc\nx ∎ = x\n\ninfixl 1 _≈_by_\ninfixl 1 _≡_\n", "meta": {"hexsha": "b2abf91ccddbac58a0b6ed8b5c3b5d66df0c9109", "size": 1579, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Equality.agda", "max_stars_repo_name": "piyush-kurur/sample-code", "max_stars_repo_head_hexsha": "1062c0b81f8dbb664fcc9376ba13695f0ee7ebc8", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2017-06-19T12:34:08.000Z", "max_stars_repo_stars_event_max_datetime": "2017-06-20T02:19:33.000Z", "max_issues_repo_path": "agda/Equality.agda", "max_issues_repo_name": "piyush-kurur/sample-code", "max_issues_repo_head_hexsha": "1062c0b81f8dbb664fcc9376ba13695f0ee7ebc8", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2017-11-01T05:48:28.000Z", "max_issues_repo_issues_event_max_datetime": "2017-11-01T05:48:28.000Z", "max_forks_repo_path": "agda/Equality.agda", "max_forks_repo_name": "piyush-kurur/sample-code", "max_forks_repo_head_hexsha": "1062c0b81f8dbb664fcc9376ba13695f0ee7ebc8", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.58, "max_line_length": 70, "alphanum_fraction": 0.5946801773, "num_tokens": 597, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8633916134888613, "lm_q2_score": 0.7981867849406659, "lm_q1q2_score": 0.6891477761154082}} {"text": "-- Minimal implicational modal logic, PHOAS approach, initial encoding\n\nmodule Pi.BoxMp where\n\nopen import Lib using (Nat; suc)\n\n\n-- Types\n\ninfixr 0 _=>_\ndata Ty : Set where\n UNIT : Ty\n _=>_ : Ty -> Ty -> Ty\n BOX : Ty -> Ty\n\n\n-- Context and truth judgement with modal depth\n\nCx : Set1\nCx = Ty -> Nat -> Set\n\nisTrue : Ty -> Nat -> Cx -> Set\nisTrue a d tc = tc a d\n\n\n-- Terms\n\nmodule BoxMp where\n infixl 1 _$_\n data Tm (d : Nat) (tc : Cx) : Ty -> Set where\n var : forall {a} -> isTrue a d tc -> Tm d tc a\n lam' : forall {a b} -> (isTrue a d tc -> Tm d tc b) -> Tm d tc (a => b)\n _$_ : forall {a b} -> Tm d tc (a => b) -> Tm d tc a -> Tm d tc b\n box : forall {a} -> Tm (suc d) tc a -> Tm d tc (BOX a)\n unbox' : forall {>d a b} -> Tm d tc (BOX a) -> (isTrue a >d tc -> Tm d tc b) -> Tm d tc b\n\n lam'' : forall {d tc a b} -> (Tm d tc a -> Tm d tc b) -> Tm d tc (a => b)\n lam'' f = lam' \\x -> f (var x)\n\n unbox'' : forall {d >d tc a b} -> Tm d tc (BOX a) -> (Tm >d tc a -> Tm d tc b) -> Tm d tc b\n unbox'' x f = unbox' x \\y -> f (var y)\n\n syntax lam'' (\\a -> b) = lam a => b\n syntax unbox'' x' (\\x -> y) = unbox x' as x => y\n\n Thm : Ty -> Set1\n Thm a = forall {d tc} -> Tm d tc a\nopen BoxMp public\n\n\n-- Example theorems\n\nrNec : forall {a} -> Thm a -> Thm (BOX a)\nrNec x =\n box x\n\naK : forall {a b} -> Thm (BOX (a => b) => BOX a => BOX b)\naK =\n lam f' =>\n lam x' =>\n unbox f' as f =>\n unbox x' as x =>\n box (f $ x)\n\naT : forall {a} -> Thm (BOX a => a)\naT =\n lam x' =>\n unbox x' as x => x\n\na4 : forall {a} -> Thm (BOX a => BOX (BOX a))\na4 =\n lam x' =>\n unbox x' as x => box (box x)\n\nt1 : forall {a} -> Thm (a => BOX (a => a))\nt1 =\n lam _ => box (lam y => y)\n", "meta": {"hexsha": "d90755fbc3eac74420341856d6f68f94083eddbf", "size": 1796, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Pi/BoxMp.agda", "max_stars_repo_name": "mietek/formal-logic", "max_stars_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_stars_repo_licenses": ["X11"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2015-08-31T09:49:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-13T12:37:44.000Z", "max_issues_repo_path": "src/Pi/BoxMp.agda", "max_issues_repo_name": "mietek/formal-logic", "max_issues_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_issues_repo_licenses": ["X11"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Pi/BoxMp.agda", "max_forks_repo_name": "mietek/formal-logic", "max_forks_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_forks_repo_licenses": ["X11"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.0256410256, "max_line_length": 94, "alphanum_fraction": 0.4766146993, "num_tokens": 706, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767778695834, "lm_q2_score": 0.785308580887758, "lm_q1q2_score": 0.6890900431907251}} {"text": "------------------------------------------------------------------------------\n-- Definition of FOTC Conat using Agda's co-inductive combinators\n------------------------------------------------------------------------------\n\n{-# OPTIONS --allow-unsolved-metas #-}\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOT.FOTC.Data.Conat.TypeSL where\n\nopen import Codata.Musical.Notation\nopen import FOTC.Base\n\n------------------------------------------------------------------------------\n\ndata Conat : D → Set where\n cozero : Conat zero\n cosucc : ∀ {n} → ∞ (Conat n) → Conat (succ₁ n)\n\nConat-out : ∀ {n} → Conat n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ Conat n')\nConat-out cozero = inj₁ refl\nConat-out (cosucc {n} Cn) = inj₂ (n , refl , ♭ Cn)\n\nConat-in : ∀ {n} →\n n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ Conat n') →\n Conat n\nConat-in (inj₁ n≡0) = subst Conat (sym n≡0) cozero\nConat-in (inj₂ (n' , prf , Cn')) = subst Conat (sym prf) (cosucc (♯ Cn'))\n\n-- TODO (2019-01-04): Agda doesn't accept this definition which was\n-- accepted by a previous version.\n{-# TERMINATING #-}\nConat-coind : (A : D → Set) →\n (∀ {n} → A n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n')) →\n ∀ {n} → A n → Conat n\nConat-coind A h An with h An\n... | inj₁ refl = cozero\n... | inj₂ (n' , refl , An') = cosucc (♯ (Conat-coind A h An'))\n\n-- TODO (07 January 2014): We couldn't prove Conat-stronger-coind.\nConat-stronger-coind :\n ∀ (A : D → Set) {n} →\n (A n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n')) →\n A n → Conat n\nConat-stronger-coind A h An with h An\n... | inj₁ n≡0 = subst Conat (sym n≡0) cozero\n... | inj₂ (n' , prf , An') =\n subst Conat (sym prf) (cosucc (♯ (Conat-coind A {!!} An')))\n\npostulate\n ∞D : D\n ∞-eq : ∞D ≡ succ₁ ∞D\n\n-- TODO (06 January 2014): Agda doesn't accept the proof of Conat ∞D.\n{-# TERMINATING #-}\n∞-Conat : Conat ∞D\n∞-Conat = subst Conat (sym ∞-eq) (cosucc (♯ ∞-Conat))\n", "meta": {"hexsha": "93424e880b9f1c1a3c0a31b35c99eed7b23ac696", "size": 2070, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/FOTC/Data/Conat/TypeSL.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/FOTC/Data/Conat/TypeSL.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/FOTC/Data/Conat/TypeSL.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 34.5, "max_line_length": 78, "alphanum_fraction": 0.4855072464, "num_tokens": 704, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267864276108, "lm_q2_score": 0.7931059487389966, "lm_q1q2_score": 0.6890716927395238}} {"text": "{-# OPTIONS --cubical --no-import-sorts #-}\n\nmodule Number.Prelude.Int where\n\nopen import Cubical.Data.Int public using\n ( Int\n ; fromNatInt\n ; fromNegInt\n ; sucInt\n ; predInt\n ; sucInt+\n ; predInt+\n ; _+pos_\n ; _+negsuc_\n ) renaming\n ( isSetInt to isSetℤ\n ; _-_ to infix 7 _-ᶻ_\n ; _+_ to infix 5 _+ᶻ_\n ; pos to posᶻ\n ; negsuc to negsucᶻ\n )\nopen import Number.Instances.Int public using\n ( +negsuc-identityˡ\n ; negsuc+negsuc≡+ⁿ\n ; sneg\n ; spos\n ) renaming\n ( _·_ to _·ᶻ_\n ; -_ to -ᶻ_\n ; _<_ to _<ᶻ_\n ; min to minᶻ\n ; max to maxᶻ\n ; is-min to is-minᶻ\n ; is-max to is-maxᶻ\n ; ·-reflects-< to ·ᶻ-reflects-<ᶻ\n ; is-LinearlyOrderedCommRing to is-LinearlyOrderedCommRingᶻ\n )\n\n-- Int≅Builtin\n-- Int≡Builtin\n-- Sign\n-- spos\n-- sneg\n-- _·ˢ_\n-- sign\n-- signed\n-- -_\n-- -involutive\n-- _·_\n-- _·'_\n-- _·''_\n-- ·''-nullifiesʳ\n-- _<_\n-- min\n-- max\n-- <-irrefl\n-- <-trans\n-- <-asym\n-- <-cotrans\n-- +-identityʳ\n-- +-identityˡ\n-- -1·≡-\n-- negsuc≡-pos\n-- negsuc-reflects-≡\n-- pos-reflects-≡\n-- possuc+negsuc≡0\n-- sucInt[negsuc+pos]≡0\n-- +-inverseʳ\n-- +-inverseˡ\n-- +-inverse\n-- pos+pos≡+ⁿ\n-- negsuc+negsuc≡+ⁿ\n-- +negsuc-identityˡ\n-- pos+negsuc≡⊎\n-- negsuc+pos≡⊎\n-- pos+negsuc≡negsuc+pos\n-- predInt-\n-- pos+negsuc-swap\n-- negsuc+pos-swap\n-- +negsuc-assoc\n-- sucInt[negsuc+pos]≡pos\n-- +pos-inverse\n-- +pos-assoc\n-- Trichotomy\n-- _≟_\n-- MinTrichtotomy\n-- MaxTrichtotomy\n-- min-trichotomy\n-- max-trichotomy\n-- is-min\n-- is-max\n-- sucInt-reflects-<\n-- predInt-reflects-<\n-- sucInt-preserves-<\n-- predInt-preserves-<\n-- +-preserves-<\n-- +-reflects-<\n-- +-reflects-<ˡ\n-- +-<-ext\n-- ·≡·'\n-- ·'-nullifiesʳ\n-- ·'-nullifiesˡ\n-- -distrˡ\n-- ·-comm\n-- -distrʳ\n-- ·'-assoc\n-- ·'-assoc≡\n-- ·-assoc\n-- ·-nullifiesˡ\n-- ·-nullifiesʳ\n-- ·-identityˡ\n-- ·-identityʳ\n-- ·-preserves-<\n-- ·-reflects-<\n-- ·-sucInt\n-- ·-sucIntˡ\n-- ·-predInt\n-- ·-predIntˡ\n-- -distrib\n-- ·-distribˡ\n-- ·-distribʳ\n\n-- ·-Semigroup .IsSemigroup.is-assoc\n-- +-Monoid .IsMonoid.is-identity\n-- ·-Monoid .IsMonoid.is-identity\n-- is-Semiring .IsSemiring.is-dist\n-- <-StrictLinearOrder .IsStrictLinearOrder.is-tricho\n", "meta": {"hexsha": "c7bb4b6f07d71ba1311d519f8375b5b1b183c435", "size": 2152, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Number/Prelude/Int.agda", "max_stars_repo_name": "mchristianl/synthetic-reals", "max_stars_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-07-31T18:15:26.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-19T12:15:21.000Z", "max_issues_repo_path": "agda/Number/Prelude/Int.agda", "max_issues_repo_name": "mchristianl/synthetic-reals", "max_issues_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Number/Prelude/Int.agda", "max_forks_repo_name": "mchristianl/synthetic-reals", "max_forks_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.8125, "max_line_length": 61, "alphanum_fraction": 0.5896840149, "num_tokens": 951, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213853793453, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.6889910019788337}} {"text": "open import Empty\n\nmodule Boolean where\n\n data Bool : Set where\n true : Bool\n false : Bool\n\n {-# BUILTIN BOOL Bool #-}\n {-# BUILTIN TRUE true #-}\n {-# BUILTIN FALSE false #-}\n\n T : Bool → Set\n T true = ⊤\n T false = ⊥\n\n not : Bool → Bool\n not true = false\n not false = true\n\n and : Bool → Bool → Bool\n and true true = true\n and _ _ = false\n\n or : Bool → Bool → Bool\n or false false = false\n or _ _ = true\n\n xor : Bool → Bool → Bool\n xor false true = true\n xor true false = true\n xor _ _ = false\n\n infixr 6 _∧_\n infixr 5 _∨_\n\n ¬_ : Set → Set\n ¬ A = A → ⊥\n\n data _∨_ A B : Set where\n Inl : A → A ∨ B\n Inr : B → A ∨ B\n\n data _∧_ A B : Set where\n Conj : A → B → A ∧ B\n\n _⇔_ : (P : Set) → (Q : Set) → Set\n a ⇔ b = (a → b) ∧ (b → a)\n\n ∧-symmetry : ∀ { A B : Set } → A ∧ B → B ∧ A\n ∧-symmetry (Conj x y) = Conj y x\n\n ∨-symmetry : ∀ { A B : Set } → A ∨ B → B ∨ A\n ∨-symmetry (Inl x) = Inr x\n ∨-symmetry (Inr y) = Inl y\n\n and_over : { A B C : Set } → A ∧ ( B ∨ C ) → ( A ∧ B ) ∨ ( A ∧ C )\n and_over (Conj x (Inl y)) = Inl (Conj x y)\n and_over (Conj x (Inr y)) = Inr (Conj x y)\n\n and_over' : { A B C : Set } → ( A ∧ B ) ∨ ( A ∧ C ) → A ∧ ( B ∨ C )\n and_over' (Inl (Conj x y)) = Conj x (Inl y)\n and_over' (Inr (Conj x y)) = Conj x (Inr y)\n\n or_over : { A B C : Set } → A ∨ ( B ∧ C ) → ( A ∨ B ) ∧ ( A ∨ C )\n or_over (Inl x) = Conj (Inl x) (Inl x)\n or_over (Inr (Conj x y)) = Conj (Inr x) (Inr y)\n\n or_over' : { A B C : Set } → ( A ∨ B ) ∧ ( A ∨ C ) → A ∨ ( B ∧ C )\n or_over' (Conj (Inl x) _) = Inl x\n or_over' (Conj _ (Inl y)) = Inl y\n or_over' (Conj (Inr x) (Inr y)) = Inr (Conj x y)\n\n or_over_negated : { A B : Set } → ( A ∨ ( ¬ A ∧ B ) ) → ( A ∨ B )\n or_over_negated (Inl x) = Inl x\n or_over_negated (Inr (Conj _ y)) = Inr y\n\n private\n proof₁ : { P Q : Set } → (P ∧ Q) → P\n proof₁ (Conj p q) = p\n\n proof₂ : { P Q : Set } → (P ∧ Q) → Q\n proof₂ (Conj p q) = q\n\n deMorgan₁ : { A B : Set } → ¬ A ∧ ¬ B → ¬ (A ∨ B)\n deMorgan₁ (Conj ¬x ¬y) (Inl x) = ¬x x\n deMorgan₁ (Conj ¬x ¬y) (Inr y) = ¬y y\n -- above is clearer if you re-write the type annotation as:\n --deMorgan₁ : { A B : Set } → (A → ⊥) ∧ (B → ⊥) → (A ∨ B) → ⊥\n\n deMorgan₂ : { A B : Set } → ¬ (A ∨ B) → ¬ A ∧ ¬ B\n deMorgan₂ z = Conj (λ x → z (Inl x)) (λ y → z (Inr y))\n\n deMorgan₃ : { A B : Set } → ¬ A ∨ ¬ B → ¬ (A ∧ B)\n deMorgan₃ (Inl ¬x) (Conj x _) = ¬x x\n deMorgan₃ (Inr ¬y) (Conj _ y) = ¬y y\n\n -- NOT provable.\n -- deMorgan₄ : { A B : Set } → ¬ (A ∧ B) → ¬ A ∨ ¬ B\n", "meta": {"hexsha": "707d01c977f7c2c10301cf683b895f577a6c891b", "size": 2501, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Boolean.agda", "max_stars_repo_name": "cantsin/agda-experiments", "max_stars_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Boolean.agda", "max_issues_repo_name": "cantsin/agda-experiments", "max_issues_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Boolean.agda", "max_forks_repo_name": "cantsin/agda-experiments", "max_forks_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.01, "max_line_length": 69, "alphanum_fraction": 0.4746101559, "num_tokens": 1132, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213772699435, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.6889910005634674}} {"text": "module Vec where\n\nopen import Basics\nopen import Ix\nopen import All\nopen import Cutting\nopen import Tensor\n\ndata Vec (X : Set) : Nat -> Set where\n [] : Vec X zero\n _,-_ : forall {n} -> X -> Vec X n -> Vec X (suc n)\n\n_+V_ : forall {X n m} -> Vec X n -> Vec X m -> Vec X (n +N m)\n[] +V ys = ys\n(x ,- xs) +V ys = x ,- (xs +V ys)\n\nrecord Applicative (F : Set -> Set) : Set1 where\n field\n pure : {X : Set} -> X -> F X\n _<*>_ : {S T : Set} -> F (S -> T) -> F S -> F T\n infixl 2 _<*>_\n\nVecAppl : (n : Nat) -> Applicative \\ X -> Vec X n\nApplicative.pure (VecAppl zero) x = []\nApplicative.pure (VecAppl (suc n)) x = x ,- Applicative.pure (VecAppl n) x\nApplicative._<*>_ (VecAppl .zero) [] [] = []\nApplicative._<*>_ (VecAppl .(suc _)) (f ,- fs) (s ,- ss) =\n f s ,- Applicative._<*>_ (VecAppl _) fs ss\n\nmodule VTRAVERSE {F}(A : Applicative F) where\n\n open Applicative A\n\n vtraverse : forall {n S T} -> (S -> F T) -> Vec S n -> F (Vec T n)\n vtraverse f [] = pure []\n vtraverse f (s ,- ss) = pure _,-_ <*> f s <*> vtraverse f ss\n\nMatrix : Set -> Nat * Nat -> Set\nMatrix X (i , j) = Vec (Vec X i) j\n\nxpose : forall {X ij} -> Matrix X ij -> Matrix X (swap ij)\nxpose = vtraverse id where\n open VTRAVERSE (VecAppl _)\n\nmodule VECALL {I : Set}{P : I -> Set}{n : Nat}where\n\n open Applicative (VecAppl n)\n \n vecAll : {is : List I} ->\n All (\\ i -> Vec (P i) n) is -> Vec (All P is) n\n vecAll {[]} pss = pure <>\n vecAll {i ,- is} (ps , pss) = pure _,_ <*> ps <*> vecAll pss\n\n VecLiftAlg : (C : I |> I) ->\n Algebra (Cutting C) P ->\n Algebra (Cutting C) (\\ i -> Vec (P i) n)\n VecLiftAlg C alg i (c 8>< pss) = pure (alg i << (c 8><_)) <*> vecAll pss\n\nopen VECALL\n\nNatCutVecAlg : {X : Set} -> Algebra (Cutting NatCut) (Vec X)\nNatCutVecAlg {X} .(m +N n) (m , n , refl .(m +N n) 8>< xm , xn , <>) = xm +V xn\n\nopen RECTANGLE\n\nNatCut2DMatAlg : {X : Set} -> Algebra (Cutting RectCut) (Matrix X)\nNatCut2DMatAlg _ (inl c 8>< ms) = VecLiftAlg NatCut NatCutVecAlg _ (c 8>< ms) \nNatCut2DMatAlg _ (inr c 8>< ms) = NatCutVecAlg _ (c 8>< ms)\n\n", "meta": {"hexsha": "36021a5fee36b8b7a58c08dfb540065f391b5421", "size": 2092, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Vec.agda", "max_stars_repo_name": "pigworker/InteriorDesign", "max_stars_repo_head_hexsha": "454cdd18f56db0b0d1643a1fcf36951b5ece395c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2018-06-18T15:25:39.000Z", "max_stars_repo_stars_event_max_datetime": "2018-07-31T02:00:13.000Z", "max_issues_repo_path": "Vec.agda", "max_issues_repo_name": "pigworker/InteriorDesign", "max_issues_repo_head_hexsha": "454cdd18f56db0b0d1643a1fcf36951b5ece395c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Vec.agda", "max_forks_repo_name": "pigworker/InteriorDesign", "max_forks_repo_head_hexsha": "454cdd18f56db0b0d1643a1fcf36951b5ece395c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.8857142857, "max_line_length": 79, "alphanum_fraction": 0.5501912046, "num_tokens": 802, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213799730774, "lm_q2_score": 0.7662936324115011, "lm_q1q2_score": 0.688990988238411}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\nmodule _ where\n\nopen import Agda.Primitive\nopen import Agda.Builtin.Nat\n\nmodule Test₁ where\n\n record ⊤ {a} : Set a where\n constructor tt\n\n data G : (A : Set) → ⊤ {_} → Set where\n d : (x : ⊤) → G ⊤ x\n\n test : (g : G ⊤ tt) → Set\n test (d x) = ⊤\n\nmodule Test₂ where\n\n postulate A : Set\n a : A\n\n record R {a} : Set a where\n constructor mkR\n field x : A\n\n data G : (A : Set) → R {_} → Set where\n d : (x : R) → G R x\n\n test : (g : G R (mkR a)) → R\n test (d x) = x\n\nmodule Test₃ where\n\n postulate A : Set\n a : A\n\n record R {a} : Set a where\n constructor mkR\n field x y : A\n\n data G : (A : Set) → R {_} → Set where\n d : (x : R) → G R x\n\n -- Forced: mkR x y\n test₁ : ∀ x y → (g : G R (mkR x y)) → Set\n test₁ x y (d (mkR x y)) = A\n\n -- .(mkR x y) turns into z with x = .(R.x z) and y = .(R.y z)\n test₂ : ∀ x y → (g : G R (mkR x y)) → Set\n test₂ x y (d .(mkR x y)) = A\n\n test₃ : ∀ x y → (g : G R (mkR x y)) → Set\n test₃ .(R.x z) .(R.y z) (d z) = A\n", "meta": {"hexsha": "ce675b80ccbcb81ecafd50282e61d10f9c08f463", "size": 1042, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2888.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue2888.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue2888.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 18.9454545455, "max_line_length": 63, "alphanum_fraction": 0.4923224568, "num_tokens": 435, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8354835207180245, "lm_q2_score": 0.8244619328462579, "lm_q1q2_score": 0.688824358352379}} {"text": "{-# OPTIONS --universe-polymorphism #-}\nmodule Categories.Bicategory where\n\nopen import Level\n-- open import Data.Product using (curry; _,_)\n-- open import Function using () renaming (_∘_ to _·_)\n\nopen import Categories.Support.PropositionalEquality\n\nopen import Categories.Category\nopen import Categories.Categories\nopen import Categories.Object.Terminal\nopen import Categories.Terminal\nopen import Categories.Functor using (Functor) renaming (_∘_ to _∘F_; _≡_ to _≡F_; id to idF)\nopen import Categories.Functor.Constant using (Constant)\nopen import Categories.Bifunctor using (Bifunctor; reduce-×)\nopen import Categories.Product using (assocʳ; πˡ; πʳ)\nopen import Categories.NaturalIsomorphism\nopen import Categories.Bicategory.Helpers using (module BicategoryHelperFunctors)\n\nrecord Bicategory (o ℓ t e : Level) : Set (suc (o ⊔ ℓ ⊔ t ⊔ e)) where\n open Terminal (One {ℓ} {t} {e})\n field\n Obj : Set o\n _⇒_ : (A B : Obj) → Category ℓ t e\n id : {A : Obj} → Functor ⊤ (A ⇒ A)\n —∘— : {A B C : Obj} → Bifunctor (B ⇒ C) (A ⇒ B) (A ⇒ C)\n\n _∘_ : {A B C : Obj} {L R : Category ℓ t e} → Functor L (B ⇒ C) → Functor R (A ⇒ B) → Bifunctor L R (A ⇒ C)\n _∘_ {A} {B} {C} F G = reduce-× {D₁ = B ⇒ C} {D₂ = A ⇒ B} —∘— F G\n\n field\n λᵤ : {A B : Obj} → NaturalIsomorphism (id ∘ idF {C = A ⇒ B}) (πʳ {C = ⊤} {A ⇒ B})\n ρᵤ : {A B : Obj} → NaturalIsomorphism (idF {C = A ⇒ B} ∘ id) (πˡ {C = A ⇒ B} {⊤})\n α : {A B C D : Obj} → NaturalIsomorphism (idF ∘ —∘—) (((—∘— ∘ idF) ∘F assocʳ (C ⇒ D) (B ⇒ C) (A ⇒ B)))\n\n private module BHF = BicategoryHelperFunctors(Obj)(_⇒_)(—∘—)(id)\n private module EQ = BHF.Coherence(λᵤ)(ρᵤ)(α)\n\n private module _⇒_ (A B : Obj) = Category (A ⇒ B)\n open _⇒_ public using () renaming (Obj to _⇒₁_)\n\n field\n .triangle : {A B C : Obj} (f : A ⇒₁ B) (g : B ⇒₁ C) → EQ.Triangle f g\n .pentagon : {A B C D E : Obj} (f : A ⇒₁ B) (g : B ⇒₁ C) (h : C ⇒₁ D) (i : D ⇒₁ E) \n → EQ.Pentagon f g h i\n\n -- do note that most of the \"convenience\" definitions in the Helpers module should really \n -- be here (but usable in both places). Clean that up later.\n", "meta": {"hexsha": "5e308edefbf35f5bdbba869cef999860b2576509", "size": 2086, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Bicategory.agda", "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 98, "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_issues_repo_path": "Categories/Bicategory.agda", "max_issues_repo_name": "copumpkin/categories", "max_issues_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 19, "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_forks_repo_path": "Categories/Bicategory.agda", "max_forks_repo_name": "copumpkin/categories", "max_forks_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 23, "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "avg_line_length": 41.72, "max_line_length": 108, "alphanum_fraction": 0.6212847555, "num_tokens": 787, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772351648677, "lm_q2_score": 0.7879311956428946, "lm_q1q2_score": 0.6887127209876898}} {"text": "\nmodule Prelude.Eq where\n\nopen import Prelude.Level\n\ninfix 4 _==_\n\ndata _==_ {l : Level}{A : Set l} (x : A) : A → Set l where\n refl : x == x\n\n\ncong : {A : Set}{B : Set}{x y : A}(f : A → B) → x == y → f x == f y\ncong f refl = refl\n\n{-# BUILTIN EQUALITY _==_ #-}\n", "meta": {"hexsha": "4055bc492c585724649056843cd4c117d1a5a2c4", "size": 263, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/epic/Prelude/Eq.agda", "max_stars_repo_name": "pthariensflame/agda", "max_stars_repo_head_hexsha": "222c4c64b2ccf8e0fc2498492731c15e8fef32d4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/epic/Prelude/Eq.agda", "max_issues_repo_name": "pthariensflame/agda", "max_issues_repo_head_hexsha": "222c4c64b2ccf8e0fc2498492731c15e8fef32d4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/epic/Prelude/Eq.agda", "max_forks_repo_name": "pthariensflame/agda", "max_forks_repo_head_hexsha": "222c4c64b2ccf8e0fc2498492731c15e8fef32d4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.4375, "max_line_length": 67, "alphanum_fraction": 0.5285171103, "num_tokens": 103, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.901920681802153, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6886018014235314}} {"text": "module Categories.Functor.Construction.Product where\n\nopen import Categories.Category\nopen import Categories.Category.Cartesian\nopen import Categories.Category.BinaryProducts\nopen import Categories.Functor.Bifunctor\n\nopen import Data.Product using (_,_)\n\nmodule _ {o ℓ e} (𝒞 : Category o ℓ e) (cartesian : Cartesian 𝒞) where\n open Cartesian cartesian\n open BinaryProducts products\n\n open Category 𝒞\n\n Product : Bifunctor 𝒞 𝒞 𝒞\n Product = record\n { F₀ = λ (x , y) → x × y\n ; F₁ = λ (f , g) → f ⁂ g\n ; identity = Equiv.trans (⟨⟩-cong₂ identityˡ identityˡ) η\n ; homomorphism = Equiv.sym ⁂∘⁂\n ; F-resp-≈ = λ (x , y) → ⁂-cong₂ x y\n }\n", "meta": {"hexsha": "9eb90f241ad0820219201e5fae999c8fc79b59c9", "size": 712, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Functor/Construction/Product.agda", "max_stars_repo_name": "elpinal/exsub-ccc", "max_stars_repo_head_hexsha": "7541ab22debdfe9d529ac7a210e5bd102c788ad9", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2022-02-05T06:16:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T13:30:48.000Z", "max_issues_repo_path": "Categories/Functor/Construction/Product.agda", "max_issues_repo_name": "elpinal/exsub-ccc", "max_issues_repo_head_hexsha": "7541ab22debdfe9d529ac7a210e5bd102c788ad9", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Functor/Construction/Product.agda", "max_forks_repo_name": "elpinal/exsub-ccc", "max_forks_repo_head_hexsha": "7541ab22debdfe9d529ac7a210e5bd102c788ad9", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.6666666667, "max_line_length": 71, "alphanum_fraction": 0.6292134831, "num_tokens": 219, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9086179068309441, "lm_q2_score": 0.7577943712746407, "lm_q1q2_score": 0.6885455354358353}} {"text": "open import Type\n\nmodule Relator.Sets {ℓ ℓₑ ℓₛ} {E : Type{ℓₑ}} {S : Type{ℓₛ}} (_∈_ : E → S → Type{ℓ}) where\n\nopen import Functional\nopen import Logic.Propositional\nopen import Logic.Predicate\n\n_∉_ : E → S → Type\n_∉_ = (¬_) ∘₂ (_∈_)\n\n_∋_ : S → E → Type\n_∋_ = swap(_∈_)\n\n_∌_ : S → E → Type\n_∌_ = (¬_) ∘₂ (_∋_)\n\n_⊆_ : S → S → Type\n_⊆_ L₁ L₂ = ∀ₗ(x ↦ ((_→ᶠ_) on₂ (x ∈_)) L₁ L₂)\n\n_⊇_ : S → S → Type\n_⊇_ L₁ L₂ = ∀ₗ(x ↦ ((_←_) on₂ (x ∈_)) L₁ L₂)\n\n_≡_ : S → S → Type\n_≡_ L₁ L₂ = ∀ₗ(x ↦ ((_↔_) on₂ (x ∈_)) L₁ L₂)\n\n_⊈_ : S → S → Type\n_⊈_ = (¬_) ∘₂ (_⊆_)\n\n_⊉_ : S → S → Type\n_⊉_ = (¬_) ∘₂ (_⊇_)\n\n_≢_ : S → S → Type\n_≢_ = (¬_) ∘₂ (_≡_)\n", "meta": {"hexsha": "d4a4951b497e6933fca4914a22846d57f4aa9722", "size": 624, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Relator/Sets.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Relator/Sets.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Relator/Sets.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.8285714286, "max_line_length": 89, "alphanum_fraction": 0.4871794872, "num_tokens": 366, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9458012732322216, "lm_q2_score": 0.7279754489059774, "lm_q1q2_score": 0.6885201064570715}} {"text": "module Adjunctions where\n\nopen import Library\nopen import Categories\nopen import Functors\n\nopen Cat\nopen Fun\n\nrecord Adj {a b c d}(C : Cat {a}{b})(D : Cat {c}{d}) : Set (a ⊔ b ⊔ c ⊔ d)\n where\n constructor adjunction\n field L : Fun C D\n R : Fun D C\n left : {X : Obj C}{Y : Obj D} → \n Hom D (OMap L X) Y → Hom C X (OMap R Y)\n right : {X : Obj C}{Y : Obj D} → \n Hom C X (OMap R Y) → Hom D (OMap L X) Y\n lawa : {X : Obj C}{Y : Obj D}(f : Hom D (OMap L X) Y) → \n right (left f) ≅ f\n lawb : {X : Obj C}{Y : Obj D}(f : Hom C X (OMap R Y)) →\n left (right f) ≅ f\n natleft : {X X' : Obj C}{Y Y' : Obj D}\n (f : Hom C X' X)(g : Hom D Y Y')\n (h : Hom D (OMap L X) Y) → \n comp C (HMap R g) (comp C (left h) f) \n ≅ \n left (comp D g (comp D h (HMap L f))) \n natright : {X X' : Obj C}{Y Y' : Obj D}\n (f : Hom C X' X)(g : Hom D Y Y')\n (h : Hom C X (OMap R Y)) → \n right (comp C (HMap R g) (comp C h f)) \n ≅ \n comp D g (comp D (right h) (HMap L f)) \n", "meta": {"hexsha": "3b010400be8aca1a90510163d675f5cbb010dc66", "size": 1265, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Adjunctions.agda", "max_stars_repo_name": "jmchapman/Relative-Monads", "max_stars_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-30T01:25:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-13T18:02:18.000Z", "max_issues_repo_path": "Adjunctions.agda", "max_issues_repo_name": "jmchapman/Relative-Monads", "max_issues_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2019-01-13T13:12:33.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-29T09:50:26.000Z", "max_forks_repo_path": "Adjunctions.agda", "max_forks_repo_name": "jmchapman/Relative-Monads", "max_forks_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-04T21:33:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-04T21:33:13.000Z", "avg_line_length": 36.1428571429, "max_line_length": 74, "alphanum_fraction": 0.390513834, "num_tokens": 426, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.953966093674472, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.6885185528574849}} {"text": "module #6 where\n\nopen import Level\nopen import Data.Bool\nopen import Relation.Binary.PropositionalEquality\n\n{-\nExercise 1.6. Show that if we define A × B :≡ ∏(x:2) rec2(U, A, B, x), then we can give a \ndefinition of indA×B for which the definitional equalities stated in §1.5 hold propositionally (i.e. using equality \ntypes). (This requires the function extensionality axiom, which is introduced in §2.9.)\n-}\n\nrec₂ : ∀{c}{C : Set c} → C → C → Bool → C\nrec₂ c₀ c₁ true = c₁\nrec₂ c₀ c₁ false = c₀\n\nind₂ : ∀{c}(C : Bool → Set c) → C false → C true → (x : Bool) → C x\nind₂ C c₀ c₁ true = c₁\nind₂ C c₀ c₁ false = c₀\n\n_×_ : ∀ {i} → Set i → Set i → Set i\nA × B = (b : Bool) → if b then A else B\n\nmodule ProductTwo {a}{A B : Set a} where\n\n _,_ : A → B → A × B\n _,_ x y true = x\n _,_ x y false = y\n\n proj₁ : A × B → A\n proj₁ x = x true\n\n proj₂ : A × B → B\n proj₂ x = x false\n\n postulate\n extensionality : ∀ {a b} {A : Set a} {B : A → Set b} (f g : (a : A) → B a) → (∀ x → f x ≡ g x) → f ≡ g\n\n indₓ₂ : ∀{c}{C : A × B -> Set c} → (f : (x : A)(y : B) → C (x , y)) → (x : A × B) → C (proj₁ x , proj₂ x)\n indₓ₂ f x = f (proj₁ x) (proj₂ x)\n\n indₓ₂-β : ∀{c}{C : A × B -> Set c} → (f : (x : A)(y : B) → C (x , y)) → (x : A × B) → indₓ₂ {C = C} f x ≡ f (proj₁ x) (proj₂ x)\n indₓ₂-β f x = refl\n\n", "meta": {"hexsha": "b72a8d0874fdb73cce0fdb715f55eaa80b9ebfbb", "size": 1292, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Chapter1/#6.agda", "max_stars_repo_name": "CodaFi/HoTT-Exercises", "max_stars_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Chapter1/#6.agda", "max_issues_repo_name": "CodaFi/HoTT-Exercises", "max_issues_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter1/#6.agda", "max_forks_repo_name": "CodaFi/HoTT-Exercises", "max_forks_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.7111111111, "max_line_length": 129, "alphanum_fraction": 0.5472136223, "num_tokens": 549, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8397339756938818, "lm_q2_score": 0.8198933359135361, "lm_q1q2_score": 0.6884922906115929}} {"text": "{-# OPTIONS --cubical --safe #-}\n\nmodule Algebra.Construct.Free.Semilattice.Extensionality where\n\nopen import Prelude\n\nopen import Algebra.Construct.Free.Semilattice.Definition\nopen import Algebra.Construct.Free.Semilattice.Eliminators\nopen import Algebra.Construct.Free.Semilattice.Relation.Unary\nopen import Algebra.Construct.Free.Semilattice.Union\n\nopen import HITs.PropositionalTruncation.Sugar\nimport HITs.PropositionalTruncation as PropTrunc\nopen import HITs.PropositionalTruncation.Properties\n\nopen import Path.Reasoning\n\ninfix 4 _↭_\n_↭_ : 𝒦 A → 𝒦 A → Type _\nxs ↭ ys = ∀ x → x ∈ xs ↔ x ∈ ys\n\nin-cons : (x : A) (xs : 𝒦 A) → x ∈ xs → xs ≡ x ∷ xs\nin-cons = λ x → ∥ in-cons′ x ∥⇓\n where\n in-cons′ : ∀ x → xs ∈𝒦 A ⇒∥ (x ∈ xs → xs ≡ x ∷ xs) ∥\n ∥ in-cons′ y ∥-prop {xs} p q i y∈xs = trunc xs (y ∷ xs) (p y∈xs) (q y∈xs) i\n ∥ in-cons′ y ∥[] ()\n ∥ in-cons′ y ∥ x ∷ xs ⟨ Pxs ⟩ = PropTrunc.rec (trunc _ _)\n λ { (inl x≡y) → sym (dup x xs) ; cong (_∷ x ∷ xs) x≡y\n ; (inr y∈xs) → cong (x ∷_) (Pxs y∈xs) ; com x y xs\n }\n\nsubset-ext : ∀ xs ys → (∀ (x : A) → x ∈ xs → x ∈ ys) → xs ∪ ys ≡ ys\nsubset-ext = ∥ subset-ext′ ∥⇓\n where\n subset-ext′ : xs ∈𝒦 A ⇒∥ (∀ ys → (∀ x → x ∈ xs → x ∈ ys) → xs ∪ ys ≡ ys) ∥\n ∥ subset-ext′ ∥-prop {xs} p q i ys perm = trunc (xs ∪ ys) ys (p ys perm) (q ys perm) i\n ∥ subset-ext′ ∥[] _ _ = refl\n ∥ subset-ext′ ∥ x ∷ xs ⟨ Pxs ⟩ ys perm =\n (x ∷ xs) ∪ ys ≡⟨ cons-distrib-∪ x xs ys ⟩\n xs ∪ (x ∷ ys) ≡⟨ Pxs (x ∷ ys) (λ y y∈xs → ∣ inr (perm y ∣ inr y∈xs ∣) ∣) ⟩\n x ∷ ys ≡˘⟨ in-cons x ys (perm x ∣ inl refl ∣) ⟩\n ys ∎\n\nextensional : (xs ys : 𝒦 A) → (xs ↭ ys) → xs ≡ ys\nextensional xs ys xs↭ys =\n xs ≡˘⟨ subset-ext ys xs (inv ∘ xs↭ys) ⟩\n ys ∪ xs ≡⟨ ∪-comm ys xs ⟩\n xs ∪ ys ≡⟨ subset-ext xs ys (fun ∘ xs↭ys) ⟩\n ys ∎\n", "meta": {"hexsha": "97cc45e226a852c351bb389034b1e4cc7617eb5e", "size": 1762, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Algebra/Construct/Free/Semilattice/Extensionality.agda", "max_stars_repo_name": "oisdk/combinatorics-paper", "max_stars_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_issues_repo_path": "agda/Algebra/Construct/Free/Semilattice/Extensionality.agda", "max_issues_repo_name": "oisdk/combinatorics-paper", "max_issues_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Algebra/Construct/Free/Semilattice/Extensionality.agda", "max_forks_repo_name": "oisdk/combinatorics-paper", "max_forks_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-01-05T14:05:30.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-05T14:05:30.000Z", "avg_line_length": 34.5490196078, "max_line_length": 88, "alphanum_fraction": 0.5737797957, "num_tokens": 792, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519528170040852, "lm_q2_score": 0.8080672135527632, "lm_q1q2_score": 0.6884351389149184}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Results concerning uniqueness of identity proofs\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Axiom.UniquenessOfIdentityProofs where\n\nopen import Data.Empty\nopen import Relation.Nullary\nopen import Relation.Binary.Core\nopen import Relation.Binary.PropositionalEquality.Core\n\n------------------------------------------------------------------------\n-- Definition\n--\n-- Uniqueness of Identity Proofs (UIP) states that all proofs of\n-- equality are themselves equal. In other words, the equality relation\n-- is irrelevant. Here we define UIP relative to a given type.\n\nUIP : ∀ {a} (A : Set a) → Set a\nUIP A = Irrelevant {A = A} _≡_\n\n------------------------------------------------------------------------\n-- Properties\n\n-- UIP always holds when using axiom K\n-- (see `Axiom.UniquenessOfIdentityProofs.WithK`).\n\n-- The existence of a constant function over proofs of equality for\n-- elements in A is enough to prove UIP for A. Indeed, we can relate any\n-- proof to its image via this function which we then know is equal to\n-- the image of any other proof.\n\nmodule Constant⇒UIP\n {a} {A : Set a} (f : _≡_ {A = A} ⇒ _≡_)\n (f-constant : ∀ {a b} (p q : a ≡ b) → f p ≡ f q)\n where\n\n ≡-canonical : ∀ {a b} (p : a ≡ b) → trans (sym (f refl)) (f p) ≡ p\n ≡-canonical refl = trans-symˡ (f refl)\n\n ≡-irrelevant : UIP A\n ≡-irrelevant p q = begin\n p ≡⟨ sym (≡-canonical p) ⟩\n trans (sym (f refl)) (f p) ≡⟨ cong (trans _) (f-constant p q) ⟩\n trans (sym (f refl)) (f q) ≡⟨ ≡-canonical q ⟩\n q ∎ where open ≡-Reasoning\n\n-- If equality is decidable for a given type, then we can prove UIP for\n-- that type. Indeed, the decision procedure allows us to define a\n-- function over proofs of equality which is constant: it returns the\n-- proof produced by the decision procedure.\n\nmodule Decidable⇒UIP\n {a} {A : Set a} (_≟_ : Decidable (_≡_ {A = A}))\n where\n\n ≡-normalise : _≡_ {A = A} ⇒ _≡_\n ≡-normalise {a} {b} a≡b with a ≟ b\n ... | yes p = p\n ... | no ¬p = ⊥-elim (¬p a≡b)\n\n ≡-normalise-constant : ∀ {a b} (p q : a ≡ b) → ≡-normalise p ≡ ≡-normalise q\n ≡-normalise-constant {a} {b} p q with a ≟ b\n ... | yes _ = refl\n ... | no ¬p = ⊥-elim (¬p p)\n\n ≡-irrelevant : UIP A\n ≡-irrelevant = Constant⇒UIP.≡-irrelevant ≡-normalise ≡-normalise-constant\n", "meta": {"hexsha": "ab0bdc23664b35bd7deb2a33a4420a100692d39b", "size": 2482, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Axiom/UniquenessOfIdentityProofs.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Axiom/UniquenessOfIdentityProofs.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Axiom/UniquenessOfIdentityProofs.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.0, "max_line_length": 78, "alphanum_fraction": 0.5584206285, "num_tokens": 753, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240756264639, "lm_q2_score": 0.7956581097540519, "lm_q1q2_score": 0.6884225525266491}} {"text": "module plfa-code.Negation where\n\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl)\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Data.Empty using (⊥; ⊥-elim)\nopen import Data.Sum using (_⊎_; inj₁; inj₂)\nopen import Data.Product using (_×_) renaming (_,_ to ⟨_,_⟩)\nopen import plfa-code.Isomorphism using (_≃_; extensionality)\n\n¬_ : Set → Set\n¬ A = A → ⊥\n\n¬-elim : ∀ {A : Set}\n → ¬ A\n → A\n ---\n → ⊥\n¬-elim ¬x x = ¬x x\n\ninfix 3 ¬_\n\n¬¬-intro : ∀ {A : Set}\n → A\n -----\n → ¬ ¬ A\n¬¬-intro x = λ ¬x → ¬x x\n\n¬¬-intro′ : ∀ {A : Set}\n → A\n -----\n → ¬ ¬ A\n¬¬-intro′ x ¬x = ¬x x\n\n¬¬¬-elim : ∀ {A : Set}\n → ¬ ¬ ¬ A\n -------\n → ¬ A\n¬¬¬-elim ¬¬¬x = λ x → ¬¬¬x (¬¬-intro x)\n\ncontraposition : ∀ {A B : Set}\n → (A → B)\n ------------\n → (¬ B → ¬ A)\ncontraposition f ¬y x = ¬y (f x)\n\n_≢_ : ∀ {A : Set} → A → A → Set\nx ≢ y = ¬ (x ≡ y)\n\n_ : 1 ≢ 2\n_ = λ ()\n\npeano : ∀ {m : ℕ} → zero ≢ suc m\npeano = λ ()\n\nid : ⊥ → ⊥\nid x = x\n\nid′ : ⊥ → ⊥\nid′ ()\n\nid≡id′ : id ≡ id′\nid≡id′ = extensionality (λ ())\n\nassimilation : ∀ {A : Set} (¬x ¬x′ : ¬ A) → ¬x ≡ ¬x′\nassimilation ¬x ¬x′ = extensionality (λ x → ⊥-elim (¬x′ x))\n\nopen Data.Nat using (_<_; _≤_; z≤n; s≤s)\nopen Relation.Binary.PropositionalEquality using (cong)\nopen import Function\nopen Data.Product using (proj₁; proj₂)\n\n---------- practice ----------\n\n<-irreflexive : ∀ {n : ℕ} → ¬ (n < n)\n<-irreflexive {suc n} (s≤s n * | _⊕_ l20\n\ntheory\n (εU⊕ᴸ) a |> add (unit, a) = a\n (εU⊕ᴿ) a |> add (a, unit) = a\n (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c))\n-}\n\nmodule Monoid.Signature where\n\nopen import SOAS.Context\n\nopen import SOAS.Common\n\n\nopen import SOAS.Syntax.Signature *T public\nopen import SOAS.Syntax.Build *T public\n\n-- Operator symbols\ndata Mₒ : Set where\n unitₒ addₒ : Mₒ\n\n-- Term signature\nM:Sig : Signature Mₒ\nM:Sig = sig λ\n { unitₒ → ⟼₀ *\n ; addₒ → (⊢₀ *) , (⊢₀ *) ⟼₂ *\n }\n\nopen Signature M:Sig public\n", "meta": {"hexsha": "4e3f5bfd55d65e62c09cf80586d0f514dc3c5d16", "size": 684, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/Monoid/Signature.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/Monoid/Signature.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/Monoid/Signature.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 16.6829268293, "max_line_length": 91, "alphanum_fraction": 0.6096491228, "num_tokens": 269, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9263037262250327, "lm_q2_score": 0.7431680143008301, "lm_q1q2_score": 0.6883993008581173}} {"text": "{-# OPTIONS --safe #-}\n\nmodule Cubical.Algebra.CommRing.Instances.UnivariatePoly where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Algebra.CommRing\nopen import Cubical.Algebra.Polynomials.Univariate.Base\nopen import Cubical.Algebra.Polynomials.Univariate.Properties\n\nprivate\n variable\n ℓ : Level\n\n\nUnivariatePoly : (CommRing ℓ) → CommRing ℓ\nUnivariatePoly R = (PolyMod.Poly R) , str\n where\n open CommRingStr --(snd R)\n str : CommRingStr (PolyMod.Poly R)\n 0r str = PolyModTheory.0P R\n 1r str = PolyModTheory.1P R\n _+_ str = PolyModTheory._Poly+_ R\n _·_ str = PolyModTheory._Poly*_ R\n - str = PolyModTheory.Poly- R\n isCommRing str = makeIsCommRing (PolyMod.isSetPoly R)\n (PolyModTheory.Poly+Assoc R)\n (PolyModTheory.Poly+Rid R)\n (PolyModTheory.Poly+Inverses R)\n (PolyModTheory.Poly+Comm R)\n (PolyModTheory.Poly*Associative R)\n (PolyModTheory.Poly*Rid R)\n (PolyModTheory.Poly*LDistrPoly+ R)\n (PolyModTheory.Poly*Commutative R)\n", "meta": {"hexsha": "227a3fffe974f902edba3ffe9546b418a9e9022c", "size": 1285, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommRing/Instances/UnivariatePoly.agda", "max_stars_repo_name": "howsiyu/cubical", "max_stars_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommRing/Instances/UnivariatePoly.agda", "max_issues_repo_name": "howsiyu/cubical", "max_issues_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommRing/Instances/UnivariatePoly.agda", "max_forks_repo_name": "howsiyu/cubical", "max_forks_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.7941176471, "max_line_length": 72, "alphanum_fraction": 0.5657587549, "num_tokens": 315, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9263037384317887, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.68839929939151}} {"text": "module Data.Boolean.Stmt.Proofs where\n\nimport Lvl\nopen import Data.Boolean\nopen import Data.Boolean.Proofs hiding (bivalence ; disjointness)\nimport Data.Boolean.Operators\nopen Data.Boolean.Operators.Programming\nopen import Data.Boolean.Stmt\nopen import Functional\nopen import Logic.Propositional as Logic using (⊥ ; _∨_ ; _∧_ ; ¬_ ; _↔_ ; [⊤]-intro ; [↔]-intro ; [⊥]-elim)\nopen import Relator.Equals\nopen import Type\n\n-- A boolean operation is either true or false\nbivalence : ∀{a} → (IsTrue(a) ∨ IsFalse(a))\nbivalence {𝑇} = Logic.[∨]-introₗ [⊤]-intro\nbivalence {𝐹} = Logic.[∨]-introᵣ [⊤]-intro\n\n-- A boolean operation is not both true and false at the same time\ndisjointness : ∀{a} → IsTrue(a) → IsFalse(a) → ⊥\ndisjointness {𝑇} [⊤]-intro ()\ndisjointness {𝐹} () [⊤]-intro\n\nmodule IsTrue where\n [𝑇]-intro : IsTrue(𝑇)\n [𝑇]-intro = [⊤]-intro\n\n [𝐹]-elim : ¬ IsTrue(𝐹)\n [𝐹]-elim ()\n\n [∧]-intro : ∀{a b} → IsTrue(a) → IsTrue(b) → IsTrue(a && b)\n [∧]-intro {𝑇} {b} ta tb = tb\n [∧]-intro {𝐹} {b} ta tb = ta\n\n [∨]-introₗ : ∀{a b} → IsTrue(a) → IsTrue(a || b)\n [∨]-introₗ {_}{𝑇} _ = [⊤]-intro\n [∨]-introₗ {_}{𝐹} = id\n\n [∨]-introᵣ : ∀{a b} → IsTrue(b) → IsTrue(a || b)\n [∨]-introᵣ {𝑇}{_} _ = [⊤]-intro\n [∨]-introᵣ {𝐹}{_} = id\n\n [∧]-elimₗ : ∀{a b} → IsTrue(a && b) → IsTrue(a)\n [∧]-elimₗ {𝑇}{𝑇} [⊤]-intro = [⊤]-intro\n [∧]-elimₗ {𝑇}{𝐹} ()\n [∧]-elimₗ {𝐹}{𝑇} ()\n [∧]-elimₗ {𝐹}{𝐹} ()\n\n [∧]-elimᵣ : ∀{a b} → IsTrue(a && b) → IsTrue(b)\n [∧]-elimᵣ {𝑇}{𝑇} [⊤]-intro = [⊤]-intro\n [∧]-elimᵣ {𝑇}{𝐹} ()\n [∧]-elimᵣ {𝐹}{𝑇} ()\n [∧]-elimᵣ {𝐹}{𝐹} ()\n\n [∨]-elim : ∀{ℓ₂}{φ : Type{ℓ₂}}{a b} → (IsTrue(a) → φ) → (IsTrue(b) → φ) → IsTrue(a || b) → φ\n [∨]-elim {_}{_}{𝑇}{𝑇} f _ [⊤]-intro = f [⊤]-intro\n [∨]-elim {_}{_}{𝑇}{𝐹} f _ [⊤]-intro = f [⊤]-intro\n [∨]-elim {_}{_}{𝐹}{𝑇} _ f [⊤]-intro = f [⊤]-intro\n [∨]-elim {_}{_}{𝐹}{𝐹} _ f ()\n\n [¬]-intro : ∀{a} → IsFalse(a) → IsTrue(! a)\n [¬]-intro {𝐹} fa = [⊤]-intro\n\n [¬]-elim : ∀{a} → IsTrue(! a) → IsFalse(a)\n [¬]-elim {𝑇} ()\n [¬]-elim {𝐹} [⊤]-intro = [⊤]-intro\n\n [→?]-intro : ∀{a b} → (IsTrue a → IsTrue b) → IsTrue (a →? b)\n [→?]-intro {𝑇} {𝑇} _ = [⊤]-intro\n [→?]-intro {𝑇} {𝐹} tab = tab [⊤]-intro\n [→?]-intro {𝐹} {𝑇} _ = [⊤]-intro\n [→?]-intro {𝐹} {𝐹} _ = [⊤]-intro\n\n [→?]-elim : ∀{a b} → IsTrue (a →? b) → (IsTrue a → IsTrue b)\n [→?]-elim {𝑇} {𝑇} tab ta = [⊤]-intro\n\n [←?]-intro : ∀{a b} → (IsTrue b → IsTrue a) → IsTrue (a ←? b)\n [←?]-intro {𝑇} {𝑇} tba = [⊤]-intro\n [←?]-intro {𝑇} {𝐹} tba = [⊤]-intro\n [←?]-intro {𝐹} {𝑇} tba = tba [⊤]-intro\n [←?]-intro {𝐹} {𝐹} tba = [⊤]-intro\n\n [←?]-elim : ∀{a b} → IsTrue (a ←? b) → (IsTrue b → IsTrue a)\n [←?]-elim {𝑇} {𝑇} tab tb = [⊤]-intro\n\n [==]-intro : ∀{a b} → (IsTrue b → IsTrue a) → (IsTrue a → IsTrue b) → IsTrue(a == b)\n [==]-intro {𝑇} {𝑇} ba ab = [⊤]-intro\n [==]-intro {𝑇} {𝐹} ba ab = ab [⊤]-intro\n [==]-intro {𝐹} {𝑇} ba ab = ba [⊤]-intro\n [==]-intro {𝐹} {𝐹} ba ab = [⊤]-intro\n\n [==]-elimₗ : ∀{a b} → IsTrue(a == b) → (IsTrue b → IsTrue a)\n [==]-elimₗ {𝑇} {𝑇} tab tb = [⊤]-intro\n\n [==]-elimᵣ : ∀{a b} → IsTrue(a == b) → (IsTrue a → IsTrue b)\n [==]-elimᵣ {𝑇} {𝑇} tab ta = [⊤]-intro\n\n [!]-intro : ∀{a b} → (IsTrue a → IsTrue b) → (IsTrue a → IsTrue(not b)) → IsTrue(not a)\n [!]-intro {𝑇} {𝑇} tab tanb = tanb [⊤]-intro\n [!]-intro {𝑇} {𝐹} tab tanb = tab [⊤]-intro\n [!]-intro {𝐹} {𝑇} tab tanb = [⊤]-intro\n [!]-intro {𝐹} {𝐹} tab tanb = [⊤]-intro\n\n [!]-elim : ∀{a b} → IsTrue a → IsTrue(not a) → IsTrue b\n [!]-elim {𝑇} {𝑇} ta tnb = [⊤]-intro\n [!]-elim {𝑇} {𝐹} ta tnb = tnb\n [!]-elim {𝐹} {𝑇} ta tnb = [⊤]-intro\n [!]-elim {𝐹} {𝐹} ta tnb = ta\n\n is-𝑇 : ∀{a} → IsTrue(a) ↔ (a ≡ 𝑇)\n is-𝑇 {a} = [↔]-intro (l{a}) (r{a}) where\n r : ∀ {a} → IsTrue(a) → (a ≡ 𝑇)\n r {𝑇} _ = [≡]-intro\n r {𝐹} ()\n\n l : ∀ {a} → IsTrue(a) ← (a ≡ 𝑇)\n l [≡]-intro = [⊤]-intro\n\n preserves-[&&][∧] : ∀{a b} → IsTrue(a && b) ↔ IsTrue(a) ∧ IsTrue(b)\n preserves-[&&][∧] = [↔]-intro\n (\\{(Logic.[∧]-intro l r) → [∧]-intro l r})\n (proof ↦ Logic.[∧]-intro ([∧]-elimₗ proof) ([∧]-elimᵣ proof))\n\n preserves-[||][∨] : ∀{a b} → IsTrue(a || b) ↔ IsTrue(a) ∨ IsTrue(b)\n preserves-[||][∨] = [↔]-intro\n (Logic.[∨]-elim [∨]-introₗ [∨]-introᵣ)\n ([∨]-elim Logic.[∨]-introₗ Logic.[∨]-introᵣ)\n\n preserves-[!][¬] : ∀{a} → IsTrue(! a) ↔ (¬ IsTrue(a))\n preserves-[!][¬] {a} = [↔]-intro (l{a}) (r{a}) where\n l : ∀{a} → IsTrue(! a) ← (¬ IsTrue(a))\n l {𝐹} _ = [⊤]-intro\n l {𝑇} f = [⊥]-elim (f [⊤]-intro)\n\n r : ∀{a} → IsTrue(! a) → (¬ IsTrue(a))\n r {𝑇} () _\n r {𝐹} _ ()\n\nmodule IsFalse where\n [∧]-introₗ : ∀{a b} → IsFalse(a) → IsFalse(a && b)\n [∧]-introₗ {_}{𝑇} = id\n [∧]-introₗ {_}{𝐹} _ = [⊤]-intro\n\n [∧]-introᵣ : ∀{a b} → IsFalse(b) → IsFalse(a && b)\n [∧]-introᵣ {𝑇}{_} = id\n [∧]-introᵣ {𝐹}{_} _ = [⊤]-intro\n\n [∨]-intro : ∀{a b} → IsFalse(a) → IsFalse(b) → IsFalse(a || b)\n [∨]-intro {𝑇} fa fb = fa\n [∨]-intro {𝐹} fa fb = fb\n\n [¬]-intro : ∀{a} → IsTrue(a) → IsFalse(! a)\n [¬]-intro = id\n\n [¬]-elim : ∀{a} → IsFalse(! a) → IsTrue(a)\n [¬]-elim = id\n\n is-𝐹 : ∀{a} → IsFalse(a) ↔ (a ≡ 𝐹)\n is-𝐹 {a} = [↔]-intro (l{a}) (r{a}) where\n r : ∀{a} → IsFalse(a) → (a ≡ 𝐹)\n r {𝑇} ()\n r {𝐹} _ = [≡]-intro\n\n l : ∀{a} → IsFalse(a) ← (a ≡ 𝐹)\n l [≡]-intro = [⊤]-intro\n\ntrue-false-opposites : ∀{a} → IsTrue(a) ↔ (¬ IsFalse(a))\ntrue-false-opposites {𝑇} = [↔]-intro (const [⊤]-intro) (const id)\ntrue-false-opposites {𝐹} = [↔]-intro (_$ [⊤]-intro) const\n\nfalse-true-opposites : ∀{a} → IsFalse(a) ↔ (¬ IsTrue(a))\nfalse-true-opposites {𝑇} = [↔]-intro (_$ [⊤]-intro) const\nfalse-true-opposites {𝐹} = [↔]-intro (const [⊤]-intro) (const id)\n", "meta": {"hexsha": "7f760ff3dda5927620e252eff32d212356536a95", "size": 5584, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Boolean/Stmt/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/Boolean/Stmt/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Boolean/Stmt/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.091954023, "max_line_length": 108, "alphanum_fraction": 0.4745702006, "num_tokens": 2965, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110425624792, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.6883385498225134}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Adjoint.Instance.01-Truncation where\n\n-- The adjunction between (0,1)-truncation and the inclusion functor\n-- from Posets to Categories.\n\nopen import Data.Product using (_,_)\nimport Function\nopen import Relation.Binary using (Poset)\nopen import Relation.Binary.OrderMorphism using (_⇒-Poset_)\n\nopen import Categories.Adjoint using (_⊣_)\nopen import Categories.Category.Construction.Thin using (Thin)\nopen import Categories.Category using (Category)\nopen import Categories.Category.Instance.Cats using (Cats)\nopen import Categories.Category.Instance.Posets using (Posets)\nopen import Categories.Functor renaming (id to idF)\nopen import Categories.Functor.Instance.01-Truncation using (Trunc)\nopen import Categories.NaturalTransformation\n using (NaturalTransformation; ntHelper)\nopen import Categories.NaturalTransformation.NaturalIsomorphism using (refl)\n\nopen _⇒-Poset_\n\n-- The inclusion functor from Posets to Categories\n\nInclusion : ∀ {c ℓ₁ ℓ₂} e → Functor (Posets c ℓ₁ ℓ₂) (Cats c ℓ₂ e)\nInclusion {c} {ℓ₁} e = record\n { F₀ = Thin e\n ; F₁ = λ f → record { F₀ = fun f ; F₁ = monotone f }\n ; identity = refl\n ; homomorphism = refl\n ; F-resp-≈ = λ {A B f g} f≗g →\n let open Poset B\n in record\n { F⇒G = record { η = λ _ → reflexive f≗g }\n ; F⇐G = record { η = λ _ → reflexive (Eq.sym f≗g) }\n }\n }\n\n-- Trunc is left-adjoint to the inclusion functor from Setoids to Groupoids\n\nTruncAdj : ∀ {o ℓ e} → Trunc ⊣ Inclusion {o} {ℓ} e\nTruncAdj {o} {ℓ} {e} = record\n { unit = unit\n ; counit = counit\n ; zig = λ {C} → id C , id C\n ; zag = refl\n }\n where\n open Category\n\n unit : NaturalTransformation idF (Inclusion e ∘F Trunc)\n unit = record\n { η = λ _ → record { F₀ = Function.id ; F₁ = Function.id }\n ; commute = λ _ → refl\n ; sym-commute = λ _ → refl\n }\n\n counit : NaturalTransformation (Trunc ∘F Inclusion e) idF\n counit = ntHelper record\n { η = λ _ → record { fun = Function.id ; monotone = Function.id }\n ; commute = λ {_ D} _ → Poset.Eq.refl D\n }\n", "meta": {"hexsha": "b0b1bf1f6ef849ac42e48537a8163a2872c19b12", "size": 2138, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Adjoint/Instance/01-Truncation.agda", "max_stars_repo_name": "bblfish/agda-categories", "max_stars_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "src/Categories/Adjoint/Instance/01-Truncation.agda", "max_issues_repo_name": "bblfish/agda-categories", "max_issues_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Adjoint/Instance/01-Truncation.agda", "max_forks_repo_name": "bblfish/agda-categories", "max_forks_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 32.3939393939, "max_line_length": 77, "alphanum_fraction": 0.6557530402, "num_tokens": 651, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278602705731, "lm_q2_score": 0.7799928951399098, "lm_q1q2_score": 0.6882874614845601}} {"text": "{-# OPTIONS --without-K #-}\nopen import Type\nopen import Type.Identities\nopen import Level.NP\nopen import Explore.Core\nopen import Explore.Properties\nopen import Explore.Explorable\nopen import Data.One\nopen import Data.Fin\nopen import Function.NP\nopen import Data.Product\nopen import HoTT\nopen import Relation.Binary.PropositionalEquality.NP using (refl; _≡_; !_)\nimport Explore.Monad\n\nmodule Explore.One where\n\n\nmodule _ {ℓ} where\n open Explore.Monad {₀} ℓ\n\n 𝟙ᵉ : Explore ℓ 𝟙\n 𝟙ᵉ = return _\n {- or\n 𝟙ᵉ _ f = f _\n -}\n\n 𝟙ⁱ : ∀ {p} → ExploreInd p 𝟙ᵉ\n 𝟙ⁱ = return-ind _\n {- or\n 𝟙ⁱ _ _ Pf = Pf _\n -}\n\nmodule _ {ℓ₁ ℓ₂ ℓᵣ} {R : 𝟙 → 𝟙 → ★₀} {r : R _ _} where\n ⟦𝟙ᵉ⟧ : ⟦Explore⟧ {ℓ₁} {ℓ₂} ℓᵣ R 𝟙ᵉ 𝟙ᵉ\n ⟦𝟙ᵉ⟧ _ _ _∙ᵣ_ fᵣ = fᵣ r\n\nmodule 𝟙ⁱ = FromExploreInd 𝟙ⁱ\nopen 𝟙ⁱ public using ()\n renaming (sum to 𝟙ˢ\n ;product to 𝟙ᵖ\n ;reify to 𝟙ʳ\n ;unfocus to 𝟙ᵘ\n )\n\nopen Adequacy _≡_\nmodule _ {{_ : UA}} where\n Σᵉ𝟙-ok : ∀ {ℓ} → Adequate-Σ {ℓ} (Σᵉ 𝟙ᵉ)\n Σᵉ𝟙-ok _ = ! Σ𝟙-snd\n\n Πᵉ𝟙-ok : ∀ {ℓ} → Adequate-Π {ℓ} (Πᵉ 𝟙ᵉ)\n Πᵉ𝟙-ok _ = ! Π𝟙-uniq _\n\n 𝟙ˢ-ok : Adequate-sum 𝟙ˢ\n 𝟙ˢ-ok _ = ! 𝟙×-snd\n\n\n 𝟙ᵖ-ok : Adequate-product 𝟙ᵖ\n 𝟙ᵖ-ok _ = ! Π𝟙-uniq _\n\n adequate-sum𝟙 = 𝟙ˢ-ok\n adequate-product𝟙 = 𝟙ᵖ-ok\n\nmodule _ {ℓ} where\n 𝟙ˡ : Lookup {ℓ} 𝟙ᵉ\n 𝟙ˡ = const\n\n 𝟙ᶠ : Focus {ℓ} 𝟙ᵉ\n 𝟙ᶠ = proj₂\n\nexplore𝟙 = 𝟙ᵉ\nexplore𝟙-ind = 𝟙ⁱ\nlookup𝟙 = 𝟙ˡ\nreify𝟙 = 𝟙ʳ\nfocus𝟙 = 𝟙ᶠ\nunfocus𝟙 = 𝟙ᵘ\nsum𝟙 = 𝟙ˢ\nproduct𝟙 = 𝟙ᵖ\n", "meta": {"hexsha": "adeb8680a09774c9acdd5609415caae51c95fa21", "size": 1560, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "lib/Explore/One.agda", "max_stars_repo_name": "crypto-agda/explore", "max_stars_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-06-05T09:25:32.000Z", "max_stars_repo_stars_event_max_datetime": "2017-06-28T19:19:29.000Z", "max_issues_repo_path": "lib/Explore/One.agda", "max_issues_repo_name": "crypto-agda/explore", "max_issues_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-03-16T14:24:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-03-16T14:24:04.000Z", "max_forks_repo_path": "lib/Explore/One.agda", "max_forks_repo_name": "crypto-agda/explore", "max_forks_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.746835443, "max_line_length": 74, "alphanum_fraction": 0.5673076923, "num_tokens": 851, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9046505351008904, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6881230150608544}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\n\nopen import bool\nopen import bool-thms2\nopen import eq\nopen import maybe\nopen import product\nopen import product-thms\nopen import bool-relations using (transitive ; total)\n\nmodule z05-01-hc-sorted-list\n (A : Set) -- type of elements\n (_≤A_ : A → A → 𝔹) -- ordering function\n (≤A-trans : transitive _≤A_) -- proof of transitivity of given ordering\n (≤A-total : total _≤A_) -- proof of totality of given ordering\n where\n\nopen import bool-relations _≤A_ hiding (transitive ; total)\nopen import minmax _≤A_ ≤A-trans ≤A-total\n\ndata slist : A → A → Set where\n snil : ∀ {l u : A}\n → l ≤A u ≡ tt\n → slist l u\n scons : ∀ {l u : A}\n → (d : A) -- value stored at head\n → slist l u -- elements to the right ≥ stored value\n → d ≤A l ≡ tt\n → slist (min d l) (max d u)\n\nslist-insert : ∀ {l u : A}\n → (d : A) -- insert 'd'\n → slist l u -- into this 'bst'\n → d ≤A l ≡ tt\n → slist (min d l) (max d u) -- type might change\nslist-insert d (snil l≤Au) d≤Al≡tt = scons d (snil l≤Au) d≤Al≡tt\n\nslist-insert d (scons d' xs d'≤Al≡tt) d≤Al≡tt with keep (d ≤A d')\n\nslist-insert d L@(scons d' xs d'≤Al≡tt) d≤Al≡tt | tt , p = scons d L d≤Al≡tt\n\nslist-insert d L@(scons d' xs d'≤Al≡tt) d≤Al≡tt | ff , p = {!!}\n", "meta": {"hexsha": "57bdbdb0f1ec97ea65754e1b80c1e52f1140e7e1", "size": 1400, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/book/2015-Verified_Functional_programming_in_Agda-Stump/ial/z05-01-hc-sorted-list.agda", "max_stars_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_stars_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2015-01-29T14:37:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T06:55:03.000Z", "max_issues_repo_path": "agda/book/2015-Verified_Functional_programming_in_Agda-Stump/ial/z05-01-hc-sorted-list.agda", "max_issues_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_issues_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/book/2015-Verified_Functional_programming_in_Agda-Stump/ial/z05-01-hc-sorted-list.agda", "max_forks_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_forks_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2015-04-13T21:40:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-21T15:58:10.000Z", "avg_line_length": 32.5581395349, "max_line_length": 76, "alphanum_fraction": 0.5492857143, "num_tokens": 501, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9046505376715777, "lm_q2_score": 0.7606506418255927, "lm_q1q2_score": 0.6881230121077531}} {"text": "module Definitions where\n\ndata _∨_ (A B : Set) : Set where\n inl : A → A ∨ B\n inr : B → A ∨ B\n\ndata _∧_ (A B : Set) : Set where\n _,_ : A → B → A ∧ B\n\ndata ⊥ : Set where\n\n¬_ : Set → Set\n¬ A = A → ⊥\n", "meta": {"hexsha": "5bd6195a619d6550acefca50f0b9beafe63cb1c6", "size": 199, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "problems/DeMorgan/Definitions.agda", "max_stars_repo_name": "danr/agder", "max_stars_repo_head_hexsha": "ece25bed081a24f02e9f85056d05933eae2afabf", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-05-17T12:07:03.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-17T12:07:03.000Z", "max_issues_repo_path": "problems/DeMorgan/Definitions.agda", "max_issues_repo_name": "danr/agder", "max_issues_repo_head_hexsha": "ece25bed081a24f02e9f85056d05933eae2afabf", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "problems/DeMorgan/Definitions.agda", "max_forks_repo_name": "danr/agder", "max_forks_repo_head_hexsha": "ece25bed081a24f02e9f85056d05933eae2afabf", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 14.2142857143, "max_line_length": 32, "alphanum_fraction": 0.4974874372, "num_tokens": 90, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9372107896491797, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.6880247360511941}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Algebra.Structures.Bundles.Field where\n\nopen import Algebra\nopen import Level using (suc; _⊔_)\nopen import Relation.Binary using (Rel)\n\nopen import Algebra.Structures.Field\n\nrecord Field c ℓ : Set (suc (c ⊔ ℓ)) where\n field\n Carrier : Set c\n _≈_ : Rel Carrier ℓ\n _+_ : Carrier -> Carrier -> Carrier\n _*_ : Carrier -> Carrier -> Carrier\n 0# : Carrier\n 1# : Carrier\n -_ : Carrier -> Carrier\n _⁻¹ : MultiplicativeInverse _≈_ 0#\n isField : IsField _≈_ _+_ _*_ 0# 1# -_ _⁻¹\n\n open IsField isField public\n", "meta": {"hexsha": "ceda0ac96b70bdd0299f6bf9007aa140ec189057", "size": 603, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Algebra/Structures/Bundles/Field.agda", "max_stars_repo_name": "felko/linear-algebra", "max_stars_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-11-02T14:11:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T06:18:08.000Z", "max_issues_repo_path": "src/Algebra/Structures/Bundles/Field.agda", "max_issues_repo_name": "felko/linear-algebra", "max_issues_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Algebra/Structures/Bundles/Field.agda", "max_forks_repo_name": "felko/linear-algebra", "max_forks_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.125, "max_line_length": 46, "alphanum_fraction": 0.6169154229, "num_tokens": 188, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9372107878954105, "lm_q2_score": 0.7341195152660687, "lm_q1q2_score": 0.6880247293119091}} {"text": "{-# OPTIONS --safe --warning=error --without-K --guardedness #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nopen import Setoids.Setoids\nopen import Rings.Definition\nopen import Rings.Orders.Partial.Definition\nopen import Sets.EquivalenceRelations\nopen import Sequences\nopen import Setoids.Orders.Partial.Definition\nopen import Functions.Definition\nopen import LogicalFormulae\nopen import Numbers.Naturals.Semiring\nopen import Groups.Definition\n\nmodule Rings.Orders.Partial.Bounded {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {m} {o} A} {pOrder : SetoidPartialOrder S _<_} {R : Ring S _+_ _*_} (pRing : PartiallyOrderedRing R pOrder) where\n\nopen Group (Ring.additiveGroup R)\nopen import Groups.Lemmas (Ring.additiveGroup R)\nopen Setoid S\nopen Equivalence eq\nopen SetoidPartialOrder pOrder\n\nBoundedAbove : Sequence A → Set (m ⊔ o)\nBoundedAbove x = Sg A (λ K → (n : ℕ) → index x n < K)\n\nBoundedBelow : Sequence A → Set (m ⊔ o)\nBoundedBelow x = Sg A (λ K → (n : ℕ) → K < index x n)\n\nBounded : Sequence A → Set (m ⊔ o)\nBounded x = Sg A (λ K → (n : ℕ) → ((Group.inverse (Ring.additiveGroup R) K) < index x n) && (index x n < K))\n\nboundNonzero : {s : Sequence A} → (b : Bounded s) → underlying b ∼ 0G → False\nboundNonzero {s} (a , b) isEq with b 0\n... | bad1 ,, bad2 = irreflexive ( (t : Tree A) -> Vec A (#nodes t) × (Vec A (#nodes t) -> Tree A) \n inorderTreeF empty = ([] , λ _ -> empty)\n inorderTreeF {A} (node t₁ x t₂) with inorderTreeF t₁ | inorderTreeF t₂ \n ... | (g₁ , p₁) | (g₂ , p₂) =\n (g₁ ++ (x ∷ g₂) , λ v -> node (p₁ (take n₁ v)) (head (drop n₁ v)) (righttree v))\n where\n n = #nodes (node t₁ x t₂)\n n₁ = #nodes t₁\n n₂ = #nodes t₂\n righttree : Vec A n -> Tree A\n righttree v rewrite +-suc n₁ n₂ = p₂ (drop (1 + n₁) v)\n \n inorderF : {A : Set} -> TraversalF (Tree A) (Tree A) A A\n inorderF = record{ extract = (#nodes , inorderTreeF) }\n\n module tests where\n tree1 : Tree ℕ\n tree1 = node (node empty 1 empty) 3 empty\n\n open Traversal\n \n", "meta": {"hexsha": "b1a9f57fec50138ad4f3f0c252e3e2e31f71179d", "size": 1044, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/main/agda/inorderF.agda", "max_stars_repo_name": "hablapps/safeoptics", "max_stars_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/main/agda/inorderF.agda", "max_issues_repo_name": "hablapps/safeoptics", "max_issues_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/agda/inorderF.agda", "max_forks_repo_name": "hablapps/safeoptics", "max_forks_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.0, "max_line_length": 94, "alphanum_fraction": 0.5708812261, "num_tokens": 354, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797051879431, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.687863210151782}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n-- Formalization of internal relations\n-- (=congruences: https://ncatlab.org/nlab/show/congruence)\n\nopen import Categories.Category\nmodule Categories.Object.InternalRelation {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level hiding (zero)\nopen import Data.Unit\nopen import Data.Fin using (Fin; zero) renaming (suc to nzero)\n\nimport Categories.Morphism as Mor\nimport Categories.Morphism.Reasoning as MR\nopen import Categories.Morphism.Notation\n\nopen import Categories.Diagram.Pullback\nopen import Categories.Diagram.KernelPair\nopen import Categories.Category.Cartesian\n\nopen import Categories.Category.BinaryProducts 𝒞 using (BinaryProducts; module BinaryProducts)\n\nprivate\n module 𝒞 = Category 𝒞\n\nopen Category 𝒞\nopen Mor 𝒞\n\n-- A relation is a span, \"which is (-1)-truncated as a morphism into the cartesian product.\"\n-- (https://ncatlab.org/nlab/show/span#correspondences)\nisRelation : {X Y R : 𝒞.Obj} (f : R ⇒ X) (g : R ⇒ Y) → Set (o ⊔ ℓ ⊔ e)\nisRelation{X}{Y}{R} f g = JointMono\n (Fin 2)\n (λ{zero → X; (nzero _) → Y})\n (λ{zero → f; (nzero _) → g}) \n\nrecord Relation (X Y : 𝒞.Obj) : Set (suc (o ⊔ ℓ ⊔ e)) where\n open Mor 𝒞\n \n field\n dom : 𝒞.Obj\n p₁ : dom ⇒ X \n p₂ : dom ⇒ Y \n\n field\n relation : isRelation p₁ p₂\n\nrecord isEqSpan {X R : 𝒞.Obj} (f : R ⇒ X) (g : R ⇒ X) : Set (suc (o ⊔ ℓ ⊔ e)) where\n field\n R×R : Pullback 𝒞 f g\n\n module R×R = Pullback R×R renaming (P to dom)\n\n field\n refl : X ⇒ R\n sym : R ⇒ R\n trans : R×R.dom ⇒ R\n \n is-refl₁ : f ∘ refl ≈ id\n is-refl₂ : g ∘ refl ≈ id\n\n is-sym₁ : f ∘ sym ≈ g\n is-sym₂ : g ∘ sym ≈ f\n\n is-trans₁ : f ∘ trans ≈ f ∘ R×R.p₁\n is-trans₂ : g ∘ trans ≈ g ∘ R×R.p₂\n\n-- Internal equivalence\nrecord Equivalence (X : 𝒞.Obj) : Set (suc (o ⊔ ℓ ⊔ e)) where\n open Mor 𝒞\n open BinaryProducts \n\n field\n R : Relation X X\n \n open Relation R\n module R = Relation R\n\n field\n eqspan : isEqSpan R.p₁ R.p₂\n\nmodule _ where\n open Pullback hiding (P)\n \n KP⇒EqSpan : {X Y : 𝒞.Obj} (f : X ⇒ Y) → (kp : KernelPair 𝒞 f) → (p : Pullback 𝒞 (p₁ kp) (p₂ kp)) → isEqSpan (p₁ kp) (p₂ kp)\n KP⇒EqSpan f kp p = record\n { R×R = p\n ; refl = universal kp {_} {id}{id} 𝒞.Equiv.refl\n ; sym = universal kp {_} {p₂ kp}{p₁ kp} (𝒞.Equiv.sym (commute kp))\n ; trans = universal kp {_}{p₁ kp ∘ p₁ p}{p₂ kp ∘ p₂ p} (∘-resp-≈ʳ (commute p))\n ; is-refl₁ = p₁∘universal≈h₁ kp\n ; is-refl₂ = p₂∘universal≈h₂ kp\n ; is-sym₁ = p₁∘universal≈h₁ kp\n ; is-sym₂ = p₂∘universal≈h₂ kp\n ; is-trans₁ = p₁∘universal≈h₁ kp\n ; is-trans₂ = p₂∘universal≈h₂ kp\n }\n \n KP⇒Relation : {X Y : 𝒞.Obj} (f : X ⇒ Y) → (kp : KernelPair 𝒞 f) → (p : Pullback 𝒞 (p₁ kp) (p₂ kp)) → isRelation (p₁ kp) (p₂ kp)\n KP⇒Relation f kp _ _ _ eq = unique-diagram kp (eq zero) (eq (nzero zero))\n", "meta": {"hexsha": "b2768a33119075d85acce1067d94d294d17c6310", "size": 2845, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Object/InternalRelation.agda", "max_stars_repo_name": "Akshobhya1234/agda-categories", "max_stars_repo_head_hexsha": "c202a616d4f376b11e8320e641c98db2ddc9d233", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Object/InternalRelation.agda", "max_issues_repo_name": "Akshobhya1234/agda-categories", "max_issues_repo_head_hexsha": "c202a616d4f376b11e8320e641c98db2ddc9d233", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Object/InternalRelation.agda", "max_forks_repo_name": "Akshobhya1234/agda-categories", "max_forks_repo_head_hexsha": "c202a616d4f376b11e8320e641c98db2ddc9d233", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.1683168317, "max_line_length": 129, "alphanum_fraction": 0.6087873462, "num_tokens": 1081, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797003640646, "lm_q2_score": 0.7549149758396752, "lm_q1q2_score": 0.6878632014859403}} {"text": "-- Andreas, 2011-04-07\n\nmodule IrrelevantFamilyIndex where\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\n-- irrelevant index\ndata Fin : .Nat -> Set where\n zero : .(n : Nat) -> Fin (suc n)\n suc : .(n : Nat) -> Fin n -> Fin (suc n)\n\nt : Fin zero\nt = zero zero\n\n-- the following is ok, since Fin _ is really just Nat\ntoNat : Fin zero -> Nat\ntoNat (zero _) = zero\ntoNat (suc _ i) = suc (toNat i)\n\ndata Pos : Nat -> Set where\n pos : (n : Nat) -> Pos (suc n)\n\nf : (n : Nat) -> Fin n -> Pos n\nf .(suc n) (zero n) = pos n\nf .(suc n) (suc n i) = pos n\n-- cannot infer value of dot pattern\n\n{-\nf : (n : Nat) -> Fin n -> Pos n\nf .(suc _) (zero _) = pos _\nf .(suc _) (suc _ _) = pos _\n\nf' : (n : Nat) -> Fin n -> Pos n\nf' _ (zero _) = pos _\nf' _ (suc _ _) = pos _\n-}\n\n\n", "meta": {"hexsha": "4ed3df28736257727b9e37c92ef3bba3df79094a", "size": 775, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/fail/IrrelevantFamilyIndex.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/fail/IrrelevantFamilyIndex.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/fail/IrrelevantFamilyIndex.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.9024390244, "max_line_length": 54, "alphanum_fraction": 0.5496774194, "num_tokens": 301, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9324533051062237, "lm_q2_score": 0.7371581568543044, "lm_q1q2_score": 0.6873655597448082}} {"text": "\n-- This module introduces parameterised datatypes.\n\nmodule DataParameterised where\n\n-- First some of our old friends.\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\ndata Bool : Set where\n false : Bool\n true : Bool\n\n-- A datatype can be parameterised over a telescope, (A : Set) in the case of\n-- lists. The parameters are bound in the types of the constructors.\n\ndata List (A : Set) : Set where\n nil : List A\n cons : A -> List A -> List A\n\n-- When using the constructors the parameters to the datatype becomes implicit\n-- arguments. In this case, the types of the constructors are :\n\n-- nil : {A : Set} -> List A\n-- cons : {A : Set} -> A -> List A -> List A\n\n-- So, we can write\n\n--nilNat = nil {Nat} -- the type of this will be List Nat\n\n-- When pattern matching on elements of a parameterised datatype you cannot\n-- refer to the parameters--it wouldn't make sense to pattern match on the\n-- element type of the list. So you can say\n\nnull : {A : Set} -> List A -> Bool\nnull nil = true\nnull (cons _ _) = false\n\n-- but not\n\n-- null (nil {A}) = true\n-- null (cons {A} _ _) = false\n\n", "meta": {"hexsha": "2a1775d909d718deb571c84eb55e72f4eedd5956", "size": 1112, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "tests/covered/DataParameterised.agda", "max_stars_repo_name": "andrejtokarcik/agda-semantics", "max_stars_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-08-10T15:33:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-06T17:24:25.000Z", "max_issues_repo_path": "tests/covered/DataParameterised.agda", "max_issues_repo_name": "andrejtokarcik/agda-semantics", "max_issues_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/covered/DataParameterised.agda", "max_forks_repo_name": "andrejtokarcik/agda-semantics", "max_forks_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.1739130435, "max_line_length": 78, "alphanum_fraction": 0.6564748201, "num_tokens": 308, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9324533088603709, "lm_q2_score": 0.7371581510799253, "lm_q1q2_score": 0.6873655571278696}} {"text": "----------------------------------------------------------------------\n-- This file contains constructions of new categories from existing --\n-- categories. --\n----------------------------------------------------------------------\nmodule Category.CategoryCons where\n\nopen import Level\nopen import Data.Product\n\nopen import Setoid.Total\nopen import Category.Category\n\nopen SetoidFun\n\n-- The product of two categories.\n_●_ : {l₁ l₂ : Level} → (ℂ₁ : Cat {l₁}) → (ℂ₂ : Cat {l₂}) → Cat {l₁ ⊔ l₂}\nℂ₁ ● ℂ₂ = record {\n Obj = (Obj ℂ₁) × (Obj ℂ₂);\n Hom = λ A B → (Hom ℂ₁ (proj₁ A) (proj₁ B)) ●ₛ ((Hom ℂ₂ (proj₂ A) (proj₂ B)));\n comp = λ {A} {B} {C} → (comp ℂ₁) ●b (comp ℂ₂);\n id = λ {A} → (id ℂ₁) , (id ℂ₂);\n assocPf = λ {A} {B} {C} {D} {f} {g} {h} → (assocPf ℂ₁) , (assocPf ℂ₂);\n idPf = λ {A} {B} {f} → (idPf ℂ₁) , (idPf ℂ₂) }\n", "meta": {"hexsha": "a0deb4f31d0034fe9edc3d0fe643432f9dbd2c56", "size": 937, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "setoid-cats/Category/CategoryCons.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "setoid-cats/Category/CategoryCons.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "setoid-cats/Category/CategoryCons.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.0416666667, "max_line_length": 89, "alphanum_fraction": 0.4268943436, "num_tokens": 294, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171068, "lm_q2_score": 0.7745833841649233, "lm_q1q2_score": 0.6872139366480625}} {"text": "{-# OPTIONS --without-K #-}\n\nmodule SubstLemmas where\n\nopen import Level using (Level)\nopen import Relation.Binary.PropositionalEquality\n using (_≡_; refl; sym; trans; subst; cong₂)\nopen import Data.Nat using (ℕ; _+_; _*_)\n\n------------------------------------------------------------------------------\n-- Lemmas about subst (and a couple about trans)\n\nsubst-dist : \n {a b : Level} {A : Set a} {B : A → Set b} \n (f : {x : A} → B x → B x → B x) → \n {x₁ x₂ : A} → (x₂≡x₁ : x₂ ≡ x₁) → (v₁ v₂ : B x₂) → \n subst B x₂≡x₁ (f v₁ v₂) ≡ f (subst B x₂≡x₁ v₁) (subst B x₂≡x₁ v₂)\nsubst-dist f refl v₁ v₂ = refl \n\nsubst-trans : \n {a b : Level} {A : Set a} {B : A → Set b} {x₁ x₂ x₃ : A} → \n (x₂≡x₁ : x₂ ≡ x₁) → (x₃≡x₂ : x₃ ≡ x₂) → (v : B x₃) → \n subst B x₂≡x₁ (subst B x₃≡x₂ v) ≡ subst B (trans x₃≡x₂ x₂≡x₁) v\nsubst-trans refl refl v = refl\n\nsubst₂+ : {b : Level} {B : ℕ → Set b} {x₁ x₂ x₃ x₄ : ℕ} → \n (x₂≡x₁ : x₂ ≡ x₁) → (x₄≡x₃ : x₄ ≡ x₃) → (v₁ : B x₂) → (v₂ : B x₄) → \n (f : {x₁ x₂ : ℕ} → B x₁ → B x₂ → B (x₁ + x₂)) → \n subst B (cong₂ _+_ x₂≡x₁ x₄≡x₃) (f v₁ v₂) ≡ \n f (subst B x₂≡x₁ v₁) (subst B x₄≡x₃ v₂)\nsubst₂+ refl refl v₁ v₂ f = refl\n\nsubst₂* : {b : Level} {B : ℕ → Set b} {x₁ x₂ x₃ x₄ : ℕ} → \n (x₂≡x₁ : x₂ ≡ x₁) → (x₄≡x₃ : x₄ ≡ x₃) → (v₁ : B x₂) → (v₂ : B x₄) → \n (f : {x₁ x₂ : ℕ} → B x₁ → B x₂ → B (x₁ * x₂)) → \n subst B (cong₂ _*_ x₂≡x₁ x₄≡x₃) (f v₁ v₂) ≡ \n f (subst B x₂≡x₁ v₁) (subst B x₄≡x₃ v₂)\nsubst₂* refl refl v₁ v₂ f = refl\n\ntrans-syml : {A : Set} {x y : A} → (p : x ≡ y) → trans (sym p) p ≡ refl\ntrans-syml refl = refl\n\ntrans-symr : {A : Set} {x y : A} → (p : x ≡ y) → trans p (sym p) ≡ refl\ntrans-symr refl = refl\n\nsubst-subst :\n {a b : Level} {A : Set a} {B : A → Set b}\n {x y : A} → (eq : x ≡ y) → (eq' : y ≡ x) → (irr : sym eq ≡ eq') → (v : B y) →\n subst B eq (subst B eq' v) ≡ v\nsubst-subst refl .refl refl v = refl\n", "meta": {"hexsha": "0b9f1c284565ff4bae82b4696351fe1a6c9b4c95", "size": 1845, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Univalence/Obsolete/SubstLemmas.agda", "max_stars_repo_name": "JacquesCarette/pi-dual", "max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 14, "max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z", "max_issues_repo_path": "Univalence/Obsolete/SubstLemmas.agda", "max_issues_repo_name": "JacquesCarette/pi-dual", "max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z", "max_forks_repo_path": "Univalence/Obsolete/SubstLemmas.agda", "max_forks_repo_name": "JacquesCarette/pi-dual", "max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z", "avg_line_length": 36.1764705882, "max_line_length": 79, "alphanum_fraction": 0.4991869919, "num_tokens": 928, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045907347107, "lm_q2_score": 0.7745833789613196, "lm_q1q2_score": 0.6872139297212868}} {"text": "{-# OPTIONS --universe-polymorphism #-}\nmodule Categories.Monoidal.Traced where\n\nopen import Level\n\nopen import Data.Product\nopen import Data.Fin\n\nopen import Categories.Category\nopen import Categories.Monoidal\nopen import Categories.Functor hiding (id; _∘_; identityʳ; assoc)\nopen import Categories.Monoidal.Braided\nopen import Categories.Monoidal.Helpers\nopen import Categories.Monoidal.Braided.Helpers\nopen import Categories.Monoidal.Symmetric\nopen import Categories.NaturalIsomorphism\nopen import Categories.NaturalTransformation hiding (id)\n \n------------------------------------------------------------------------------\n-- Helpers\n\nunary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A : Category.Obj C) →\n Fin 1 → Category.Obj C\nunary C A zero = A\nunary C A (suc ())\n\nbinary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A B : Category.Obj C) →\n Fin 2 → Category.Obj C\nbinary C A B zero = A\nbinary C A B (suc zero) = B\nbinary C A B (suc (suc ()))\n\nternary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A X Y : Category.Obj C) →\n Fin 3 → Category.Obj C\nternary C A X Y zero = A\nternary C A X Y (suc zero) = X\nternary C A X Y (suc (suc zero)) = Y\nternary C A X Y (suc (suc (suc ())))\n\n------------------------------------------------------------------------------\n-- Def from http://ncatlab.org/nlab/show/traced+monoidal+category\n-- \n-- A symmetric monoidal category (C,⊗,1,b) (where b is the symmetry) is\n-- said to be traced if it is equipped with a natural family of functions\n-- \n-- TrXA,B:C(A⊗X,B⊗X)→C(A,B)\n-- satisfying three axioms:\n-- \n-- Vanishing: Tr1A,B(f)=f (for all f:A→B) and\n-- TrX⊗YA,B=TrXA,B(TrYA⊗X,B⊗X(f)) (for all f:A⊗X⊗Y→B⊗X⊗Y)\n-- \n-- Superposing: TrXC⊗A,C⊗B(idC⊗f)=idC⊗TrXA,B(f) (for all f:A⊗X→B⊗X)\n-- \n-- Yanking: TrXX,X(bX,X)=idX\n\nrecord Traced {o ℓ e} {C : Category o ℓ e} {M : Monoidal C} {B : Braided M}\n (S : Symmetric B) : Set (o ⊔ ℓ ⊔ e) where\n\n private module C = Category C\n open C using (Obj; id; _∘_)\n\n private module M = Monoidal M\n open M using (⊗; identityʳ; assoc) renaming (id to 𝟙)\n\n private module F = Functor ⊗\n open F using () renaming (F₀ to ⊗ₒ; F₁ to ⊗ₘ)\n\n private module NIʳ = NaturalIsomorphism identityʳ\n open NaturalTransformation NIʳ.F⇒G renaming (η to ηidr⇒)\n open NaturalTransformation NIʳ.F⇐G renaming (η to ηidr⇐)\n\n private module NIassoc = NaturalIsomorphism assoc\n open NaturalTransformation NIassoc.F⇒G renaming (η to ηassoc⇒)\n open NaturalTransformation NIassoc.F⇐G renaming (η to ηassoc⇐)\n\n private module B = Braided B\n open B using (braid)\n\n private module NIbraid = NaturalIsomorphism braid\n open NaturalTransformation NIbraid.F⇒G renaming (η to ηbraid⇒)\n\n field\n trace : ∀ {X A B} → C [ ⊗ₒ (A , X) , ⊗ₒ (B , X) ] → C [ A , B ]\n\n vanish_id : ∀ {A B f} →\n C [\n trace {𝟙} {A} {B} f\n ≡\n (ηidr⇒ (unary C B) ∘ f ∘ ηidr⇐ (unary C A))\n ]\n \n vanish_⊗ : ∀ {X Y A B f} →\n C [\n trace {⊗ₒ (X , Y)} {A} {B} f\n ≡\n trace {X} {A} {B}\n (trace {Y} {⊗ₒ (A , X)} {⊗ₒ (B , X)}\n ((ηassoc⇐ (ternary C B X Y)) ∘ f ∘ (ηassoc⇒ (ternary C A X Y))))\n ]\n\n superpose : ∀ {X Y A B} {f : C [ ⊗ₒ (A , X) , ⊗ₒ (B , X) ]} → \n C [\n trace {X} {⊗ₒ (Y , A)} {⊗ₒ (Y , B)}\n (ηassoc⇐ (ternary C Y B X) ∘ ⊗ₘ (id , f) ∘ ηassoc⇒ (ternary C Y A X))\n ≡\n ⊗ₘ (id , (trace {X} {A} {B} f))\n ]\n\n yank : ∀ {X} →\n C [\n trace {X} {X} {X} (ηbraid⇒ (binary C X X)) \n ≡\n id\n ]\n\n------------------------------------------------------------------------------\n", "meta": {"hexsha": "1cba3acd85a88fcc3a852119c172041325616fe8", "size": 3809, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Monoidal/Traced.agda", "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 98, "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_issues_repo_path": "Categories/Monoidal/Traced.agda", "max_issues_repo_name": "copumpkin/categories", "max_issues_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 19, "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_forks_repo_path": "Categories/Monoidal/Traced.agda", "max_forks_repo_name": "copumpkin/categories", "max_forks_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 23, "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "avg_line_length": 32.5555555556, "max_line_length": 91, "alphanum_fraction": 0.5153583618, "num_tokens": 1315, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171067, "lm_q2_score": 0.7745833737577158, "lm_q1q2_score": 0.6872139274147401}} {"text": "{-# OPTIONS --rewriting #-}\n\nmodule RewritingNat where\n\nopen import Common.Equality\n\n{-# BUILTIN REWRITE _≡_ #-}\n\ndata Nat : Set where\n zero : Nat\n suc : Nat → Nat\n\n_+_ : Nat → Nat → Nat\nzero + n = n\n(suc m) + n = suc (m + n)\n\nplus0T : Set\nplus0T = ∀{x} → (x + zero) ≡ x\n\nplusSucT : Set\nplusSucT = ∀{x y} → (x + (suc y)) ≡ suc (x + y)\n\npostulate\n plus0p : plus0T\n {-# REWRITE plus0p #-}\n\n plusSucp : plusSucT\n\n{-# REWRITE plusSucp #-}\n\nplus0 : plus0T\nplus0 = refl\n\ndata Vec (A : Set) : Nat → Set where\n [] : Vec A zero\n _∷_ : ∀ {n} (x : A) (xs : Vec A n) → Vec A (suc n)\n\nreverseAcc : ∀{A n m} → Vec A n → Vec A m → Vec A (n + m)\nreverseAcc [] acc = acc\nreverseAcc (x ∷ xs) acc = reverseAcc xs (x ∷ acc)\n", "meta": {"hexsha": "69ee32dfbbcaf12c56df267c218099b782a593e9", "size": 712, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/RewritingNat.agda", "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Succeed/RewritingNat.agda", "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/RewritingNat.agda", "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.3658536585, "max_line_length": 57, "alphanum_fraction": 0.5646067416, "num_tokens": 281, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9136765328159726, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6870962410268674}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import LogicalFormulae\nopen import Sets.EquivalenceRelations\nopen import Setoids.Setoids\n\nmodule Setoids.Subset {a b : _} {A : Set a} (S : Setoid {a} {b} A) where\n\nopen Setoid S\nopen Equivalence eq\n\nsubset : {c : _} (pred : A → Set c) → Set (a ⊔ b ⊔ c)\nsubset pred = ({x y : A} → x ∼ y → pred x → pred y)\n\nsubsetSetoid : {c : _} {pred : A → Set c} → (subs : subset pred) → Setoid (Sg A pred)\nSetoid._∼_ (subsetSetoid subs) (x , predX) (y , predY) = Setoid._∼_ S x y\nEquivalence.reflexive (Setoid.eq (subsetSetoid subs)) {a , b} = reflexive\nEquivalence.symmetric (Setoid.eq (subsetSetoid subs)) {a , prA} {b , prB} x = symmetric x\nEquivalence.transitive (Setoid.eq (subsetSetoid subs)) {a , prA} {b , prB} {c , prC} x y = transitive x y\n", "meta": {"hexsha": "20b11bf6c3192be0fbbf5256593cad4815ac6fd5", "size": 852, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Setoids/Subset.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Setoids/Subset.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Setoids/Subset.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 40.5714285714, "max_line_length": 105, "alphanum_fraction": 0.6596244131, "num_tokens": 305, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9032942014971871, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6870913190273086}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category using (Category; _[_≈_])\n\n-- Karoubi Envelopes. These are the free completions of categories under split idempotents\nmodule Categories.Category.Construction.KaroubiEnvelope {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\n\nopen import Categories.Morphism.Idempotent.Bundles 𝒞\nopen import Categories.Morphism.Reasoning 𝒞\n\nprivate\n module 𝒞 = Category 𝒞\n open 𝒞.HomReasoning\n open 𝒞.Equiv\n \n open Idempotent\n open Idempotent⇒\n\nKaroubiEnvelope : Category (o ⊔ ℓ ⊔ e) (ℓ ⊔ e) e\nKaroubiEnvelope = record\n { Obj = Idempotent\n ; _⇒_ = Idempotent⇒\n ; _≈_ = λ f g → 𝒞 [ Idempotent⇒.hom f ≈ Idempotent⇒.hom g ]\n ; id = id\n ; _∘_ = _∘_\n ; assoc = 𝒞.assoc\n ; sym-assoc = 𝒞.sym-assoc\n ; identityˡ = λ {I} {J} {f} → absorbˡ f\n ; identityʳ = λ {I} {J} {f} → absorbʳ f\n ; identity² = λ {I} → idempotent I\n ; equiv = record\n { refl = refl\n ; sym = sym\n ; trans = trans\n }\n ; ∘-resp-≈ = 𝒞.∘-resp-≈\n }\n", "meta": {"hexsha": "ca10eeaab69a1c343b8c5fa2383e903cafa434de", "size": 987, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Construction/KaroubiEnvelope.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Construction/KaroubiEnvelope.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Construction/KaroubiEnvelope.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 24.675, "max_line_length": 90, "alphanum_fraction": 0.6474164134, "num_tokens": 390, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9207896802383028, "lm_q2_score": 0.7461389986757758, "lm_q1q2_score": 0.687037090003995}} {"text": "module BBSTree {A : Set}(_≤_ : A → A → Set) where\n\nopen import Bound.Total A\nopen import Bound.Total.Order _≤_\nopen import Data.List\nopen import List.Order.Simple _≤_\n\ndata BBSTree : Bound → Bound → Set where\n bslf : {b t : Bound} \n → LeB b t \n → BBSTree b t\n bsnd : {x : A}{b t : Bound} \n → LeB b (val x) \n → LeB (val x) t \n → BBSTree b (val x) \n → BBSTree (val x) t \n → BBSTree b t\n\nflatten : {b t : Bound} → BBSTree b t → List A\nflatten (bslf _) = [] \nflatten (bsnd {x = x} b≤x x≤t l r) = flatten l ++ (x ∷ flatten r)\n", "meta": {"hexsha": "b7b70eda6385471ab9ed3bbfde55c4dd39ddae8e", "size": 650, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/BBSTree.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/BBSTree.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/BBSTree.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.5454545455, "max_line_length": 65, "alphanum_fraction": 0.4830769231, "num_tokens": 213, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9559813488829418, "lm_q2_score": 0.7185943985973772, "lm_q1q2_score": 0.686962842470847}} {"text": "\nopen import Agda.Builtin.Nat\n\nrecord _×_ (A B : Set) : Set where\n constructor _,_\n field fst : A\n snd : B\n\nopen _×_\n\nΔ : ∀ {A} → A → A × A\nΔ x = x , x\n\nfoo : Nat → Nat\nfoo n = let x , y = Δ n in x + y\n\nbar : Nat → Nat\nbar n = let _!_ : Nat → Nat → Nat\n x ! y = 2 * x + y\n in n ! n\n", "meta": {"hexsha": "44ed0696bdcd9ee52ee58882417bee83a65e76cf", "size": 309, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue917.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue917.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue917.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 14.7142857143, "max_line_length": 34, "alphanum_fraction": 0.4724919094, "num_tokens": 124, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099069987088003, "lm_q2_score": 0.7549149868676284, "lm_q1q2_score": 0.6869024299810171}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Structures.Group.Base where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Data.Sigma\nopen import Cubical.Structures.Monoid hiding (⟨_⟩)\n\nprivate\n variable\n ℓ : Level\n\nrecord IsGroup {G : Type ℓ}\n (0g : G) (_+_ : G → G → G) (-_ : G → G) : Type ℓ where\n\n constructor isgroup\n\n field\n isMonoid : IsMonoid 0g _+_\n inverse : (x : G) → (x + (- x) ≡ 0g) × ((- x) + x ≡ 0g)\n\n open IsMonoid isMonoid public\n\n infixl 6 _-_\n\n _-_ : G → G → G\n x - y = x + (- y)\n\n invl : (x : G) → (- x) + x ≡ 0g\n invl x = inverse x .snd\n\n invr : (x : G) → x + (- x) ≡ 0g\n invr x = inverse x .fst\n\nrecord Group : Type (ℓ-suc ℓ) where\n\n constructor group\n\n field\n Carrier : Type ℓ\n 0g : Carrier\n _+_ : Carrier → Carrier → Carrier\n -_ : Carrier → Carrier\n isGroup : IsGroup 0g _+_ -_\n\n infix 8 -_\n infixr 7 _+_\n\n open IsGroup isGroup public\n\n-- Extractor for the carrier type\n⟨_⟩ : Group → Type ℓ\n⟨_⟩ = Group.Carrier\n\nmakeIsGroup : {G : Type ℓ} {0g : G} {_+_ : G → G → G} { -_ : G → G}\n (is-setG : isSet G)\n (assoc : (x y z : G) → x + (y + z) ≡ (x + y) + z)\n (rid : (x : G) → x + 0g ≡ x)\n (lid : (x : G) → 0g + x ≡ x)\n (rinv : (x : G) → x + (- x) ≡ 0g)\n (linv : (x : G) → (- x) + x ≡ 0g)\n → IsGroup 0g _+_ -_\nmakeIsGroup is-setG assoc rid lid rinv linv =\n isgroup (makeIsMonoid is-setG assoc rid lid) λ x → rinv x , linv x\n\nmakeGroup : {G : Type ℓ} (0g : G) (_+_ : G → G → G) (-_ : G → G)\n (is-setG : isSet G)\n (assoc : (x y z : G) → x + (y + z) ≡ (x + y) + z)\n (rid : (x : G) → x + 0g ≡ x)\n (lid : (x : G) → 0g + x ≡ x)\n (rinv : (x : G) → x + (- x) ≡ 0g)\n (linv : (x : G) → (- x) + x ≡ 0g)\n → Group\nmakeGroup 0g _+_ -_ is-setG assoc rid lid rinv linv =\n group _ 0g _+_ -_ (makeIsGroup is-setG assoc rid lid rinv linv)\n\nmakeGroup-right : ∀ {ℓ} {A : Type ℓ}\n → (id : A)\n → (comp : A → A → A)\n → (inv : A → A)\n → (set : isSet A)\n → (assoc : ∀ a b c → comp a (comp b c) ≡ comp (comp a b) c)\n → (rUnit : ∀ a → comp a id ≡ a)\n → (rCancel : ∀ a → comp a (inv a) ≡ id)\n → Group\nmakeGroup-right {A = A} id comp inv set assoc rUnit rCancel =\n makeGroup id comp inv set assoc rUnit lUnit rCancel lCancel\n where\n _⨀_ = comp\n abstract\n lCancel : ∀ a → comp (inv a) a ≡ id\n lCancel a =\n inv a ⨀ a\n ≡⟨ sym (rUnit (comp (inv a) a)) ⟩\n (inv a ⨀ a) ⨀ id\n ≡⟨ cong (comp (comp (inv a) a)) (sym (rCancel (inv a))) ⟩\n (inv a ⨀ a) ⨀ (inv a ⨀ (inv (inv a)))\n ≡⟨ assoc _ _ _ ⟩\n ((inv a ⨀ a) ⨀ (inv a)) ⨀ (inv (inv a))\n ≡⟨ cong (λ □ → □ ⨀ _) (sym (assoc _ _ _)) ⟩\n (inv a ⨀ (a ⨀ inv a)) ⨀ (inv (inv a))\n ≡⟨ cong (λ □ → (inv a ⨀ □) ⨀ (inv (inv a))) (rCancel a) ⟩\n (inv a ⨀ id) ⨀ (inv (inv a))\n ≡⟨ cong (λ □ → □ ⨀ (inv (inv a))) (rUnit (inv a)) ⟩\n inv a ⨀ (inv (inv a))\n ≡⟨ rCancel (inv a) ⟩\n id\n ∎\n\n lUnit : ∀ a → comp id a ≡ a\n lUnit a =\n id ⨀ a\n ≡⟨ cong (λ b → comp b a) (sym (rCancel a)) ⟩\n (a ⨀ inv a) ⨀ a\n ≡⟨ sym (assoc _ _ _) ⟩\n a ⨀ (inv a ⨀ a)\n ≡⟨ cong (comp a) (lCancel a) ⟩\n a ⨀ id\n ≡⟨ rUnit a ⟩\n a\n ∎\n\nmakeGroup-left : ∀ {ℓ} {A : Type ℓ}\n → (id : A)\n → (comp : A → A → A)\n → (inv : A → A)\n → (set : isSet A)\n → (assoc : ∀ a b c → comp a (comp b c) ≡ comp (comp a b) c)\n → (lUnit : ∀ a → comp id a ≡ a)\n → (lCancel : ∀ a → comp (inv a) a ≡ id)\n → Group\nmakeGroup-left {A = A} id comp inv set assoc lUnit lCancel =\n makeGroup id comp inv set assoc rUnit lUnit rCancel lCancel\n where\n abstract\n rCancel : ∀ a → comp a (inv a) ≡ id\n rCancel a =\n comp a (inv a)\n ≡⟨ sym (lUnit (comp a (inv a))) ⟩\n comp id (comp a (inv a))\n ≡⟨ cong (λ b → comp b (comp a (inv a))) (sym (lCancel (inv a))) ⟩\n comp (comp (inv (inv a)) (inv a)) (comp a (inv a))\n ≡⟨ sym (assoc (inv (inv a)) (inv a) (comp a (inv a))) ⟩\n comp (inv (inv a)) (comp (inv a) (comp a (inv a)))\n ≡⟨ cong (comp (inv (inv a))) (assoc (inv a) a (inv a)) ⟩\n comp (inv (inv a)) (comp (comp (inv a) a) (inv a))\n ≡⟨ cong (λ b → comp (inv (inv a)) (comp b (inv a))) (lCancel a) ⟩\n comp (inv (inv a)) (comp id (inv a))\n ≡⟨ cong (comp (inv (inv a))) (lUnit (inv a)) ⟩\n comp (inv (inv a)) (inv a)\n ≡⟨ lCancel (inv a) ⟩\n id\n ∎\n\n rUnit : ∀ a → comp a id ≡ a\n rUnit a =\n comp a id\n ≡⟨ cong (comp a) (sym (lCancel a)) ⟩\n comp a (comp (inv a) a)\n ≡⟨ assoc a (inv a) a ⟩\n comp (comp a (inv a)) a\n ≡⟨ cong (λ b → comp b a) (rCancel a) ⟩\n comp id a\n ≡⟨ lUnit a ⟩\n a\n ∎\n", "meta": {"hexsha": "e996e9b35833411d5e92c42d8669c30d9788140f", "size": 4961, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Structures/Group/Base.agda", "max_stars_repo_name": "RobertHarper/cubical", "max_stars_repo_head_hexsha": "d13941587a58895b65f714f1ccc9c1f5986b109c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Structures/Group/Base.agda", "max_issues_repo_name": "RobertHarper/cubical", "max_issues_repo_head_hexsha": "d13941587a58895b65f714f1ccc9c1f5986b109c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Structures/Group/Base.agda", "max_forks_repo_name": "RobertHarper/cubical", "max_forks_repo_head_hexsha": "d13941587a58895b65f714f1ccc9c1f5986b109c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 29.8855421687, "max_line_length": 75, "alphanum_fraction": 0.4484982866, "num_tokens": 2019, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267830311354, "lm_q2_score": 0.7905303211371898, "lm_q1q2_score": 0.686833915802195}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n----------------------------------------------------------------------\n-- Gaps\n----------------------------------------------------------------------\n-- Polynomials can be represented as lists of their coefficients,\n-- stored in increasing powers of x:\n--\n-- 3 + 2x² + 4x⁵ + 2x⁷\n-- ≡⟨ making the missing xs explicit ⟩\n-- 3x⁰ + 0x¹ + 2x² + 0x³ + 0x⁴ + 4x⁵ + 0x⁶ + 2x⁷\n-- ≡⟨ in list notation ⟩\n-- [3,0,2,0,0,4,0,2]\n--\n-- This approach is wasteful with space. Instead, we will pair each\n-- coefficient with the size of the preceding gap, meaning that the\n-- above expression is instead written as:\n--\n-- [(3,0),(2,1),(4,2),(2,1)]\n--\n-- Which can be thought of as a representation of the expression:\n--\n-- x⁰ * (3 + x * x¹ * (2 + x * x² * (4 + x * x¹ * (2 + x * 0))))\n--\n-- To add multiple variables to a polynomial, you can *nest* them,\n-- making the coefficients of the outer polynomial polynomials\n-- themselves. However, this is *also* wasteful, in a similar way to\n-- above: the constant polynomial, for instance, will be represented\n-- as many nestings of constant polynomials around a final variable.\n-- However, this approach presents a difficulty: the polynomial will\n-- have the kind ℕ → Set (...). In other words, it's indexed by the\n-- number of variables it contains. The gap we store, then, has to\n-- be accomanied with some information about how it relates to that\n-- index.\n--\n-- The first approach I tried was to forget about storing the gaps,\n-- and instead store the number of variables in the nested coefficient,\n-- along with a proof that the number was smaller than the outer. The\n-- proof was _≤_ from Data.Nat:\n--\n-- data _≤_ : Rel ℕ 0ℓ where\n-- z≤n : ∀ {n} → zero ≤ n\n-- s≤s : ∀ {m n} (m≤n : m ≤ n) → suc m ≤ suc n\n--\n-- While this worked, this will actually give you a worse complexity\n-- than the naive encoding without gaps.\n--\n-- For any of the binary operations, you need to be able to \"line up\"\n-- the two arguments in terms of the gaps. For addition, for instance,\n-- the argument with fewer variables should be added to the constant\n-- term of the argument with more. To do this, you need to compare the\n-- gaps.\n--\n-- To see why that's a problem, consider the following sequence of\n-- nestings:\n--\n-- (5 ≤ 6), (4 ≤ 5), (3 ≤ 4), (1 ≤ 3), (0 ≤ 1)\n--\n-- The outer polynomial has 6 variables, but it has a gap to its inner\n-- polynomial of 5, and so on. What we compare in this case is the\n-- number of variables in the tail: like repeatedly taking the length of\n-- the tail of a list, it's quadratic.\n--\n-- The second approach was to try and mimic the powers structure\n-- (which only compared the gaps, which is linear), and store the gaps\n-- in a proof like the following:\n--\n-- record _≤″_ (m n : ℕ) : Set where\n-- constructor less-than-or-equal\n-- field\n-- {k} : ℕ\n-- proof : m + k ≡ n\n--\n-- Here, k is the size of the gap. The problem of this approach was\n-- twofold: it was difficult to show that comparisons on the k\n-- corresponded to comparisons on the m, and working with ≡ instead of\n-- some inductive structure was messy. However, it had the advantage\n-- of being erasable: both proofs of the correspondence and the\n-- equality proof itself. That said, I'm not very familiar with the\n-- soundness of erasure, and in particular how it interacts with axiom\n-- K (which I'd managed to avoid up until this point, but started to\n-- creep in).\n--\n-- I may have had more luck if I swapped the arguments too +:\n--\n-- record _≤″_ (m n : ℕ) : Set where\n-- constructor less-than-or-equal\n-- field\n-- {k} : ℕ\n-- proof : k + m ≡ n\n--\n-- But I did not try it. The solution I ended up with was superior,\n-- regardless:\n--\n-- infix 4 _≤_\n-- data _≤_ (m : ℕ) : ℕ → Set where\n-- m≤m : m ≤ m\n-- ≤-s : ∀ {n} → (m≤n : m ≤ n) → m ≤ suc n\n--\n-- (This is a rewritten version of _≤′_ from Data.Nat.Base).\n--\n-- While this structure stores the same information as ≤, it does so\n-- by induction on the *gap*. This became apparent when I realised you\n-- could use it to write a comparison function which was linear in the\n-- size of the gap (even though it was comparing the length of the\n-- tail):\n\n-- data Ordering : ℕ → ℕ → Set where\n-- less : ∀ {n m} → n ≤ m → Ordering n (suc m)\n-- greater : ∀ {n m} → m ≤ n → Ordering (suc n) m\n-- equal : ∀ {n} → Ordering n n\n\n-- ≤-compare : ∀ {i j n}\n-- → (i≤n : i ≤ n)\n-- → (j≤n : j ≤ n)\n-- → Ordering i j\n-- ≤-compare m≤m m≤m = equal\n-- ≤-compare m≤m (≤-s m≤n) = greater m≤n\n-- ≤-compare (≤-s m≤n) m≤m = less m≤n\n-- ≤-compare (≤-s i≤n) (≤-s j≤n) = ≤-compare i≤n j≤n\n--\n-- A few things to note here:\n--\n-- 1. The ≤-compare function is one of those reassuring ones for which\n-- Agda can completely fill in the type for me.\n-- 2. This function looks somewhat similar to the one for comparing ℕ\n-- in Data.Nat, and as a result, the \"matching\" logic for degree\n-- and number of variables began too look similar.\n--\n-- While this approach allowed me too write all the functions I\n-- needed, I hit another roadblock when it came time to prove the\n-- ring homomorphism. The first thing I realised I needed to prove was\n-- basically the following:\n--\n-- ∀ {i j n}\n-- → (i≤n : i ≤ n)\n-- → (j≤n : j ≤ n)\n-- → ∀ xs Ρ\n-- → Σ⟦ xs ⟧ (drop-1 i≤n Ρ) ≈ Σ⟦ xs ⟧ (drop-1 j≤n Ρ)\n--\n-- In effect, if the inequalities are over the same numbers, then\n-- they'll behave the same way when used in evaluation.\n--\n-- The above is really just a consequence of ≤ being irrelevant:\n--\n-- ∀ {i n}\n-- → (x : i ≤ n)\n-- → (y : i ≤ n)\n-- → x ≡ y\n--\n-- Trying to prove this convinced me that it might not even be possible\n-- without K. On top of that, I also noticed that I would need to\n-- prove things like:\n--\n-- ∀ {i j n}\n-- → (i≤j : i ≤ j)\n-- → (j≤n : j ≤ n)\n-- → (x : FlatPoly i)\n-- → (Ρ : Vec Carrier n)\n-- → ⟦ x Π (i≤j ⟨ ≤′-trans ⟩ j≤n) ⟧ Ρ ≈ ⟦ x Π i≤j ⟧ (drop j≤n Ρ)\n--\n-- Effectively, I needed to prove that transitivity was a\n-- homomorphism.\n--\n-- I realised that I had not run into these difficulties with the\n-- comparison function I was using for the exponent gaps: why? Well\n-- that function provides a proof about its *arguments* whereas the\n-- one I wrote above only provides a proof about the i and j.\n--\n-- data Ordering : Rel ℕ 0ℓ where\n-- less : ∀ m k → Ordering m (suc (m + k))\n-- equal : ∀ m → Ordering m m\n-- greater : ∀ m k → Ordering (suc (m + k)) m\n--\n-- If I tried to mimick the above as closely as possible, I would also\n-- need an analogue to +: of course this was ≤′-trans, so I was going\n-- to get my transitivity proof as well as everything else. The result\n-- is as follows.\n\nmodule Polynomial.NormalForm.InjectionIndex where\n\nopen import Data.Nat as ℕ using (ℕ; suc; zero)\nopen import Data.Nat using (_≤′_; ≤′-refl; ≤′-step; _<′_) public\nopen import Data.Nat.Properties using (≤′-trans) public\nopen import Function\n\ndata InjectionOrdering {n : ℕ} : ∀ {i j}\n → (i≤n : i ≤′ n)\n → (j≤n : j ≤′ n)\n → Set\n where\n inj-lt : ∀ {i j-1}\n → (i≤j-1 : i ≤′ j-1)\n → (j≤n : suc j-1 ≤′ n)\n → InjectionOrdering (≤′-step i≤j-1 ⟨ ≤′-trans ⟩ j≤n) j≤n\n inj-gt : ∀ {i-1 j}\n → (i≤n : suc i-1 ≤′ n)\n → (j≤i-1 : j ≤′ i-1)\n → InjectionOrdering i≤n (≤′-step j≤i-1 ⟨ ≤′-trans ⟩ i≤n)\n inj-eq : ∀ {i} → (i≤n : i ≤′ n) → InjectionOrdering i≤n i≤n\n\ninj-compare : ∀ {i j n}\n → (x : i ≤′ n)\n → (y : j ≤′ n)\n → InjectionOrdering x y\ninj-compare ≤′-refl ≤′-refl = inj-eq ≤′-refl\ninj-compare ≤′-refl (≤′-step y) = inj-gt ≤′-refl y\ninj-compare (≤′-step x) ≤′-refl = inj-lt x ≤′-refl\ninj-compare (≤′-step x) (≤′-step y) = case inj-compare x y of\n λ { (inj-lt i≤j-1 .y) → inj-lt i≤j-1 (≤′-step y)\n ; (inj-gt .x j≤i-1) → inj-gt (≤′-step x) j≤i-1\n ; (inj-eq .x) → inj-eq (≤′-step x)\n }\n\nopen import Data.Fin as Fin using (Fin)\n\nspace : ∀ {n} → Fin n → ℕ\nspace f = suc (go f)\n where\n go : ∀ {n} → Fin n → ℕ\n go {suc n} Fin.zero = n\n go (Fin.suc x) = go x\n\nFin⇒≤ : ∀ {n} (x : Fin n) → space x ≤′ n\nFin⇒≤ Fin.zero = ≤′-refl\nFin⇒≤ (Fin.suc x) = ≤′-step (Fin⇒≤ x)\n", "meta": {"hexsha": "f02f0c23dc9b55143fc6015fb3c2e5f7757e61c5", "size": 8215, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Polynomial/NormalForm/InjectionIndex.agda", "max_stars_repo_name": "mckeankylej/agda-ring-solver", "max_stars_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-01-25T16:40:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T00:57:55.000Z", "max_issues_repo_path": "src/Polynomial/NormalForm/InjectionIndex.agda", "max_issues_repo_name": "mckeankylej/agda-ring-solver", "max_issues_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2019-04-17T20:48:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T01:55:42.000Z", "max_forks_repo_path": "src/Polynomial/NormalForm/InjectionIndex.agda", "max_forks_repo_name": "mckeankylej/agda-ring-solver", "max_forks_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2019-04-16T02:23:16.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-20T07:07:11.000Z", "avg_line_length": 36.1894273128, "max_line_length": 72, "alphanum_fraction": 0.5974437005, "num_tokens": 2751, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8577681195338728, "lm_q2_score": 0.8006919925839875, "lm_q1q2_score": 0.6868080648045966}} {"text": "{- The following code gives the basic idea of division by repeated\n subtraction. We have to ask Agda not to check termination of this\n function, because it is not structurally terminating. The versions\n in nat-division.agda and nat-division-wf.agda correct this problem,\n and can be judged by Agda to be terminating. -}\n\nmodule nat-division-basic where\n\nopen import bool\nopen import eq\nopen import nat\nopen import product\nopen import sum\n\n{-# NON_TERMINATING #-}\ndiv : (x d : ℕ) → d =ℕ 0 ≡ ff → ℕ × ℕ\ndiv 0 _ _ = 0 , 0\ndiv x d p with (x < d)\ndiv x d p | tt = 0 , x \ndiv x d p | ff with div (x ∸ d) d p\ndiv x d p | ff | q , r = suc q , r \n\ntest-div : ℕ × ℕ\ntest-div = div 17 3 refl\n", "meta": {"hexsha": "79c8e4a959dcde61fe31c771bb3538a92966c3d8", "size": 691, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "nat-division-basic.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "nat-division-basic.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "nat-division-basic.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.64, "max_line_length": 70, "alphanum_fraction": 0.6743849493, "num_tokens": 217, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9241418158002492, "lm_q2_score": 0.7431680086124811, "lm_q1q2_score": 0.6867926329237936}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Category.Instance.Rels where\n\nopen import Data.Product\nopen import Function hiding (_⇔_)\nopen import Level\nopen import Relation.Binary\nopen import Relation.Binary.Construct.Composition\nopen import Relation.Binary.PropositionalEquality\n\nopen import Categories.Category.Core\n\n-- the category whose objects are sets and whose morphisms are binary relations.\nRels : ∀ o ℓ → Category (suc o) (suc (o ⊔ ℓ)) (o ⊔ ℓ)\nRels o ℓ = record\n { Obj = Set o\n ; _⇒_ = λ A B → REL A B (o ⊔ ℓ)\n ; _≈_ = λ L R → L ⇔ R\n ; id = λ x y → Lift ℓ (x ≡ y)\n ; _∘_ = λ L R → R ; L\n ; assoc = (λ { (b , fxb , c , gbc , hcy) → c , ((b , (fxb , gbc)) , hcy)})\n , λ { (c , (b , fxb , gbc) , hcy) → b , fxb , c , gbc , hcy}\n ; sym-assoc = (λ { (c , (b , fxb , gbc) , hcy) → b , fxb , c , gbc , hcy})\n , (λ { (b , fxb , c , gbc , hcy) → c , ((b , (fxb , gbc)) , hcy)})\n ; identityˡ = (λ { (b , fxb , lift refl) → fxb}) , λ {_} {y} fxy → y , fxy , lift refl\n ; identityʳ = (λ { (a , lift refl , fxy) → fxy}) , λ {x} {_} fxy → x , lift refl , fxy\n ; identity² = (λ { (_ , lift p , lift q) → lift (trans p q)}) , λ { (lift refl) → _ , lift refl , lift refl }\n ; equiv = record\n { refl = id , id\n ; sym = swap\n ; trans = λ { (p₁ , p₂) (q₁ , q₂) → (q₁ ∘′ p₁) , p₂ ∘′ q₂}\n }\n ; ∘-resp-≈ = λ f⇔h g⇔i →\n (λ { (b , gxb , fky) → b , proj₁ g⇔i gxb , proj₁ f⇔h fky }) ,\n λ { (b , ixb , hby) → b , proj₂ g⇔i ixb , proj₂ f⇔h hby }\n }\n", "meta": {"hexsha": "667d1f7883820cbd27eeba3359532dcc3b165c6c", "size": 1493, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Instance/Rels.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Instance/Rels.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Instance/Rels.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 40.3513513514, "max_line_length": 111, "alphanum_fraction": 0.5210984595, "num_tokens": 612, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8962513731336204, "lm_q2_score": 0.766293653760418, "lm_q1q2_score": 0.6867917394063537}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Math.NumberTheory.Summation.Generic where\n\n-- agda-stdlib\nopen import Algebra\nopen import Data.Nat\n\nmodule MonoidSummation {c e} (M : Monoid c e) where\n open Monoid M renaming (Carrier to A)\n\n -- Σ< n f = Σₖ₌₀ⁿ⁻¹[f k]\n Σ< : ℕ → (ℕ → A) → A\n Σ< 0 f = ε\n Σ< (suc n) f = Σ< n f ∙ f n\n\n -- Σ≤ n f = Σₖ₌₀ⁿ[f k]\n Σ≤ : ℕ → (ℕ → A) → A\n Σ≤ n f = Σ< (suc n) f\n\n -- Σ N\n nrec : N α (α,N).α -> α\n\ntheory\n (zeβ) z : α s : (α,N).α |> nrec (ze, z, r m. s[r,m]) = z\n (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]\n-}\n\nmodule Naturals.Signature where\n\nopen import SOAS.Context\n\n-- Type declaration\ndata NatT : Set where\n N : NatT\n\n\n\nopen import SOAS.Syntax.Signature NatT public\nopen import SOAS.Syntax.Build NatT public\n\n-- Operator symbols\ndata Natₒ : Set where\n zeₒ suₒ : Natₒ\n nrecₒ : {α : NatT} → Natₒ\n\n-- Term signature\nNat:Sig : Signature Natₒ\nNat:Sig = sig λ\n { zeₒ → ⟼₀ N\n ; suₒ → (⊢₀ N) ⟼₁ N\n ; (nrecₒ {α}) → (⊢₀ N) , (⊢₀ α) , (α , N ⊢₂ α) ⟼₃ α\n }\n\nopen Signature Nat:Sig public\n", "meta": {"hexsha": "53c6bca83b03ef1e847ec765684a85da51c7ef0c", "size": 881, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/Naturals/Signature.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/Naturals/Signature.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/Naturals/Signature.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 19.152173913, "max_line_length": 100, "alphanum_fraction": 0.5664018161, "num_tokens": 359, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898229217591, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.6865539832864713}} {"text": "open import Relation.Binary.Core\n\nmodule BBHeap.Heapify {A : Set}\n (_≤_ : A → A → Set) \n (tot≤ : Total _≤_) \n (trans≤ : Transitive _≤_) where\n\nopen import BBHeap _≤_\nopen import BBHeap.Insert _≤_ tot≤ trans≤\nopen import Bound.Lower A \nopen import Bound.Lower.Order _≤_ \nopen import Data.List\n\nheapify : List A → BBHeap bot\nheapify [] = leaf\nheapify (x ∷ xs) = insert {x = x} lebx (heapify xs) \n", "meta": {"hexsha": "a76a6019d73c9694ef6854940aa6663bf71205bc", "size": 446, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/BBHeap/Heapify.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/BBHeap/Heapify.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/BBHeap/Heapify.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.2352941176, "max_line_length": 52, "alphanum_fraction": 0.6031390135, "num_tokens": 142, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9511422269175634, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.6864804461932951}} {"text": "\nmodule Prelude where\n\n id : {a : Set} -> a -> a\n id x = x\n\n infixr 0 _$_\n\n _$_ : {a b : Set} -> (a -> b) -> a -> b\n f $ x = f x\n\n data Bool : Set where\n True : Bool\n False : Bool\n\n _&&_ : Bool -> Bool -> Bool\n True && b = b\n False && _ = False\n\n data Pair (a b : Set) : Set where\n pair : a -> b -> Pair a b\n\n fst : {a b : Set} -> Pair a b -> a\n fst (pair x y) = x\n\n snd : {a b : Set} -> Pair a b -> b\n snd (pair x y) = y\n\n data Either (a b : Set) : Set where\n left : a -> Either a b\n right : b -> Either a b\n\n data Maybe (a : Set) : Set where\n Nothing : Maybe a\n Just : a -> Maybe a\n\n data Unit : Set where\n unit : Unit\n\n data Absurd : Set where\n\n absurdElim : {whatever : Set} -> Absurd -> whatever\n absurdElim ()\n\n-- data Pi {a : Set} (f : a -> Set) : Set where\n-- pi : ((x : a) -> f x) -> Pi f\n-- \n-- apply : {a : Set} -> {f : a -> Set} -> Pi f -> (x : a) -> f x\n-- apply (pi f) x = f x\n\n T : Bool -> Set\n T True = Unit\n T False = Absurd\n\n andT : {x y : Bool} -> T x -> T y -> T (x && y)\n andT {True} {True} _ _ = unit\n andT {True} {False} _ ()\n andT {False} {_} () _\n\n T' : {a : Set} -> (a -> a -> Bool) -> (a -> a -> Set)\n T' f x y = T (f x y)\n\n data Not (a : Set) : Set where\n not : (a -> Absurd) -> Not a\n\n -- Not : Set -> Set\n -- Not a = a -> Absurd\n\n contrapositive : {a b : Set} -> (a -> b) -> Not b -> Not a\n contrapositive p (not nb) = not (\\a -> nb (p a))\n\n private\n notDistribOut' : {a b : Set} -> Not a -> Not b -> Either a b -> Absurd\n notDistribOut' (not na) _ (left a) = na a\n notDistribOut' _ (not nb) (right b) = nb b\n\n notDistribOut : {a b : Set} -> Not a -> Not b -> Not (Either a b)\n notDistribOut na nb = not (notDistribOut' na nb)\n\n notDistribIn : {a b : Set} -> Not (Either a b) -> Pair (Not a) (Not b)\n notDistribIn (not nab) = pair (not (\\a -> nab (left a)))\n (not (\\b -> nab (right b)))\n\n data _<->_ (a b : Set) : Set where\n iff : (a -> b) -> (b -> a) -> a <-> b\n\n iffLeft : {a b : Set} -> (a <-> b) -> (a -> b)\n iffLeft (iff l _) = l\n\n iffRight : {a b : Set} -> (a <-> b) -> (b -> a)\n iffRight (iff _ r) = r\n\n Dec : (A : Set) -> Set\n Dec A = Either A (Not A)\n ", "meta": {"hexsha": "2b8658986bd497c6aa7ace23ee959160d482b898", "size": 2248, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/AIM4/bag/Prelude.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/AIM4/bag/Prelude.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/AIM4/bag/Prelude.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.6631578947, "max_line_length": 74, "alphanum_fraction": 0.4653024911, "num_tokens": 865, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213853793452, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6864645792015718}} {"text": "module Utilities.VecSplit where\n\n-- Standard libraries imports ----------------------------------------\nopen import Data.Nat using (ℕ ; _+_)\nopen import Data.Vec using (Vec ; _++_)\n\nopen import Relation.Binary.PropositionalEquality\n using (_≡_)\nopen import Relation.Binary.HeterogeneousEquality\n using (_≅_)\n----------------------------------------------------------------------\n\nrecord Split {A : Set} {n : ℕ} (xs : Vec A n) : Set where\n field\n {m₁} {m₂} : ℕ\n n≡m₁+m₂ : n ≡ m₁ + m₂\n ys : Vec A m₁\n zs : Vec A m₂\n xs≅ys++zs : xs ≅ ys ++ zs\n", "meta": {"hexsha": "de0ff2a4d2084e6696abca917f71bb941368b53a", "size": 558, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Utilities/VecSplit.agda", "max_stars_repo_name": "armkeh/agda-computability", "max_stars_repo_head_hexsha": "f6a6845a54aed7ecc6841ff5ad89643b553cbd77", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Utilities/VecSplit.agda", "max_issues_repo_name": "armkeh/agda-computability", "max_issues_repo_head_hexsha": "f6a6845a54aed7ecc6841ff5ad89643b553cbd77", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Utilities/VecSplit.agda", "max_forks_repo_name": "armkeh/agda-computability", "max_forks_repo_head_hexsha": "f6a6845a54aed7ecc6841ff5ad89643b553cbd77", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.9, "max_line_length": 70, "alphanum_fraction": 0.5161290323, "num_tokens": 158, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8991213718636752, "lm_q2_score": 0.7634837581726991, "lm_q1q2_score": 0.6864645640438717}} {"text": "{-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-}\n\nmodule Cubical.HITs.InfNat.Properties where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Data.Maybe\nopen import Cubical.Data.Nat\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Isomorphism\n\nopen import Cubical.HITs.InfNat.Base\nimport Cubical.Data.InfNat as Coprod\n\nℕ+∞→Cℕ+∞ : ℕ+∞ → Coprod.ℕ+∞\nℕ+∞→Cℕ+∞ zero = Coprod.zero\nℕ+∞→Cℕ+∞ (suc n) = Coprod.suc (ℕ+∞→Cℕ+∞ n)\nℕ+∞→Cℕ+∞ ∞ = Coprod.∞\nℕ+∞→Cℕ+∞ (suc-inf i) = Coprod.∞\n\nℕ→ℕ+∞ : ℕ → ℕ+∞\nℕ→ℕ+∞ zero = zero\nℕ→ℕ+∞ (suc n) = suc (ℕ→ℕ+∞ n)\n\nCℕ+∞→ℕ+∞ : Coprod.ℕ+∞ → ℕ+∞\nCℕ+∞→ℕ+∞ Coprod.∞ = ∞\nCℕ+∞→ℕ+∞ (Coprod.fin n) = ℕ→ℕ+∞ n\n\nℕ→ℕ+∞→Cℕ+∞ : ∀ n → ℕ+∞→Cℕ+∞ (ℕ→ℕ+∞ n) ≡ Coprod.fin n\nℕ→ℕ+∞→Cℕ+∞ zero = refl\nℕ→ℕ+∞→Cℕ+∞ (suc n) = cong Coprod.suc (ℕ→ℕ+∞→Cℕ+∞ n)\n\nCℕ+∞→ℕ+∞→Cℕ+∞ : ∀ n → ℕ+∞→Cℕ+∞ (Cℕ+∞→ℕ+∞ n) ≡ n\nCℕ+∞→ℕ+∞→Cℕ+∞ Coprod.∞ = refl\nCℕ+∞→ℕ+∞→Cℕ+∞ (Coprod.fin n) = ℕ→ℕ+∞→Cℕ+∞ n\n\nsuc-hom : ∀ n → Cℕ+∞→ℕ+∞ (Coprod.suc n) ≡ suc (Cℕ+∞→ℕ+∞ n)\nsuc-hom Coprod.∞ = suc-inf\nsuc-hom (Coprod.fin x) = refl\n\nℕ+∞→Cℕ+∞→ℕ+∞ : ∀ n → Cℕ+∞→ℕ+∞ (ℕ+∞→Cℕ+∞ n) ≡ n\nℕ+∞→Cℕ+∞→ℕ+∞ zero = refl\nℕ+∞→Cℕ+∞→ℕ+∞ ∞ = refl\nℕ+∞→Cℕ+∞→ℕ+∞ (suc n) = suc-hom (ℕ+∞→Cℕ+∞ n) ∙ cong suc (ℕ+∞→Cℕ+∞→ℕ+∞ n)\nℕ+∞→Cℕ+∞→ℕ+∞ (suc-inf i) = lemma i\n where\n lemma : (λ i → ∞ ≡ suc-inf i) [ refl ≡ suc-inf ∙ refl ]\n lemma i j = hcomp (λ k → λ\n { (i = i0) → ∞\n ; (i = i1) → compPath-filler suc-inf refl k j\n ; (j = i0) → ∞\n ; (j = i1) → suc-inf i\n }) (suc-inf (i ∧ j))\n\nopen Iso\n\nℕ+∞⇔Cℕ+∞ : Iso ℕ+∞ Coprod.ℕ+∞\nℕ+∞⇔Cℕ+∞ .fun = ℕ+∞→Cℕ+∞\nℕ+∞⇔Cℕ+∞ .inv = Cℕ+∞→ℕ+∞\nℕ+∞⇔Cℕ+∞ .leftInv = ℕ+∞→Cℕ+∞→ℕ+∞\nℕ+∞⇔Cℕ+∞ .rightInv = Cℕ+∞→ℕ+∞→Cℕ+∞\n", "meta": {"hexsha": "c50e2ba4ebea4f418d4b4c7c0d5932f613bf672a", "size": 1639, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/HITs/InfNat/Properties.agda", "max_stars_repo_name": "dan-iel-lee/cubical", "max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/HITs/InfNat/Properties.agda", "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/HITs/InfNat/Properties.agda", "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 26.435483871, "max_line_length": 71, "alphanum_fraction": 0.5222696766, "num_tokens": 1124, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772417253256, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.6864203626775266}} {"text": "------------------------------------------------------------------------\n-- Types with decidable equality have unique identity proofs, and\n-- related results\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\n-- The part up to \"decidable⇒set\" follows a proof by Michael Hedberg\n-- (\"A coherence theorem for Martin-Löf's type theory\", JFP 1998).\n\nopen import Equality\n\nmodule Equality.Decidable-UIP\n {reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where\n\nopen Derived-definitions-and-properties eq\nopen import Logical-equivalence using (module _⇔_)\nopen import H-level eq\nopen import Prelude\n\n-- Weakly constant functions.\n\nConstant : ∀ {a b} {A : Type a} {B : Type b} → (A → B) → Type (a ⊔ b)\nConstant f = ∀ x y → f x ≡ f y\n\n-- Left inverses.\n\n_Left-inverse-of_ : ∀ {a b} {A : Type a} {B : Type b} →\n (B → A) → (A → B) → Type a\ng Left-inverse-of f = ∀ x → g (f x) ≡ x\n\nabstract\n\n -- A set with a constant endofunction with a left inverse is a\n -- proposition.\n\n proposition : ∀ {a} {A : Type a} →\n (f : ∃ λ (f : A → A) → Constant f) →\n (∃ λ g → g Left-inverse-of (proj₁ f)) →\n Is-proposition A\n proposition (f , constant) (g , left-inverse) x y =\n x ≡⟨ sym (left-inverse x) ⟩\n g (f x) ≡⟨ cong g (constant x y) ⟩\n g (f y) ≡⟨ left-inverse y ⟩∎\n y ∎\n\n -- Endofunction families on _≡_ always have left inverses.\n\n left-inverse :\n ∀ {a} {A : Type a} (f : (x y : A) → x ≡ y → x ≡ y) →\n ∀ {x y} → ∃ λ g → g Left-inverse-of f x y\n left-inverse {A = A} f {x} {y} =\n (λ x≡y →\n x ≡⟨ x≡y ⟩\n y ≡⟨ sym (f y y (refl y)) ⟩∎\n y ∎) ,\n elim (λ {x y} x≡y → trans (f x y x≡y) (sym (f y y (refl y))) ≡ x≡y)\n (λ _ → trans-symʳ _)\n\n -- A type A is a set if there is a family of constant endofunctions\n -- on _≡_ {A = A}.\n\n constant⇒set :\n ∀ {a} {A : Type a} →\n ((x y : A) → ∃ λ (f : x ≡ y → x ≡ y) → Constant f) →\n Is-set A\n constant⇒set constant {x} {y} =\n proposition (constant x y)\n (left-inverse (λ x y → proj₁ $ constant x y))\n\n -- If it is known whether or not a type is inhabited, then one can\n -- define a constant endofunction for that type.\n\n decidable⇒constant : ∀ {a} {A : Type a} → Dec A →\n ∃ λ (f : A → A) → Constant f\n decidable⇒constant (yes x) = (const x , λ _ _ → refl x)\n decidable⇒constant (no ¬x) = (id , λ _ → ⊥-elim ∘ ¬x)\n\n -- Types with decidable equality are sets.\n\n decidable⇒set : ∀ {a} {A : Type a} → Decidable-equality A → Is-set A\n decidable⇒set dec =\n constant⇒set (λ x y → decidable⇒constant (dec x y))\n\n -- Non-dependent functions with propositional domains are constant.\n\n propositional-domain⇒constant :\n ∀ {a b} {A : Type a} {B : Type b} →\n Is-proposition A → (f : A → B) → Constant f\n propositional-domain⇒constant A-prop f = λ x y →\n cong f (A-prop x y)\n\n -- If there is a propositional, reflexive relation on A, and related\n -- elements are equal, then A is a set.\n --\n -- (The statement of this lemma is one part of the statement of\n -- Theorem 7.2.2 in \"Homotopy Type Theory: Univalent Foundations of\n -- Mathematics\" (first edition).)\n\n propositional-identity⇒set :\n ∀ {a b} {A : Type a}\n (B : A → A → Type b) →\n (∀ x y → Is-proposition (B x y)) →\n (∀ x → B x x) →\n (∀ x y → B x y → x ≡ y) →\n Is-set A\n propositional-identity⇒set B B-prop B-refl f =\n constant⇒set λ x y →\n (λ eq → f x y (subst (B x) eq (B-refl x))) ,\n (λ _ _ → propositional-domain⇒constant (B-prop x y) (f x y) _ _)\n\n -- The function cong {x = x} {y = y} takes (weakly) constant\n -- functions to constant functions.\n --\n -- This is Lemma 3.1 from van Doorn's \"Constructing the\n -- Propositional Truncation using Non-recursive HITs\".\n\n cong-preserves-Constant :\n ∀ {a b} {A : Type a} {B : Type b} {f : A → B} {x y : A} →\n Constant f → Constant (cong {x = x} {y = y} f)\n cong-preserves-Constant {f = f} {x = x} {y = y} c p q =\n cong f p ≡⟨ lemma p ⟩\n trans (sym (c x x)) (c x y) ≡⟨ sym (lemma q) ⟩∎\n cong f q ∎\n where\n lemma : ∀ p → cong {x = x} {y = y} f p ≡ trans (sym (c x x)) (c x y)\n lemma = elim\n (λ {x y} p → cong {x = x} {y = y} f p ≡ trans (sym (c x x)) (c x y))\n (λ x →\n cong f (refl x) ≡⟨ cong-refl _ ⟩\n refl (f x) ≡⟨ sym $ trans-symˡ _ ⟩∎\n trans (sym (c x x)) (c x x) ∎)\n\n -- The following two results come from \"Generalizations of Hedberg's\n -- Theorem\" by Kraus, Escardó, Coquand and Altenkirch.\n\n -- Proposition 3.\n --\n -- (I proved this result using cong-preserves-Constant.)\n\n cong-constant :\n ∀ {a b} {A : Type a} {B : Type b} {f : A → B} {x} {x≡x : x ≡ x} →\n Constant f →\n cong f x≡x ≡ refl (f x)\n cong-constant {f = f} {x} {x≡x} c =\n cong f x≡x ≡⟨ cong-preserves-Constant c _ _ ⟩\n cong f (refl x) ≡⟨ cong-refl _ ⟩∎\n refl (f x) ∎\n\n -- The \"Fixed Point Lemma\".\n\n fixpoint-lemma :\n ∀ {a} {A : Type a} →\n (f : A → A) →\n Constant f →\n Is-proposition (∃ λ x → f x ≡ x)\n fixpoint-lemma f constant (x , fx≡x) (y , fy≡y) =\n let x≡y = x ≡⟨ sym fx≡x ⟩\n f x ≡⟨ constant x y ⟩\n f y ≡⟨ fy≡y ⟩∎\n y ∎\n\n x≡x = x ≡⟨ sym fx≡x ⟩\n f x ≡⟨ subst (λ z → f z ≡ z) (sym x≡y) fy≡y ⟩∎\n x ∎\n\n lemma =\n subst (λ z → f z ≡ z) x≡x fx≡x ≡⟨ subst-in-terms-of-trans-and-cong ⟩\n\n trans (sym (cong f x≡x)) (trans fx≡x (cong id x≡x)) ≡⟨ cong₂ (λ p q → trans (sym p) (trans _ q))\n (cong-constant constant) (sym $ cong-id _) ⟩\n trans (sym (refl (f x))) (trans fx≡x x≡x) ≡⟨ cong (λ p → trans p (trans fx≡x x≡x)) sym-refl ⟩\n\n trans (refl (f x)) (trans fx≡x x≡x) ≡⟨ trans-reflˡ _ ⟩\n\n trans fx≡x x≡x ≡⟨ sym $ trans-assoc _ _ _ ⟩\n\n trans (trans fx≡x (sym fx≡x))\n (subst (λ z → f z ≡ z) (sym x≡y) fy≡y) ≡⟨ cong (λ p → trans p (subst (λ z → f z ≡ z) (sym x≡y) fy≡y)) $\n trans-symʳ _ ⟩\n trans (refl (f x))\n (subst (λ z → f z ≡ z) (sym x≡y) fy≡y) ≡⟨ trans-reflˡ _ ⟩∎\n\n subst (λ z → f z ≡ z) (sym x≡y) fy≡y ∎\n in\n x , fx≡x ≡⟨ Σ-≡,≡→≡ x≡x lemma ⟩\n x , subst (λ z → f z ≡ z) (sym x≡y) fy≡y ≡⟨ sym $ Σ-≡,≡→≡ (sym x≡y) (refl _) ⟩∎\n y , fy≡y ∎\n", "meta": {"hexsha": "09746c13c7aa0f631161721de917f5d52c832475", "size": 6800, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Equality/Decidable-UIP.agda", "max_stars_repo_name": "nad/equality", "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_issues_repo_path": "src/Equality/Decidable-UIP.agda", "max_issues_repo_name": "nad/equality", "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Equality/Decidable-UIP.agda", "max_forks_repo_name": "nad/equality", "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.9788359788, "max_line_length": 129, "alphanum_fraction": 0.4773529412, "num_tokens": 2487, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772286044094, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.6864203523735585}} {"text": "module PatternSynonyms where\n\n\ndata ℕ : Set where\n zero : ℕ\n suc : (n : ℕ) → ℕ\n\n{-# BUILTIN NATURAL ℕ #-}\n{-# BUILTIN ZERO zero #-}\n{-# BUILTIN SUC suc #-}\n\npattern z = zero\npattern sz = suc z\npattern ss x = suc (suc x)\n\ndata _≡_ {A : Set}(x : A) : A → Set where\n refl : x ≡ x\n\n\ntest : z ≡ zero\ntest = refl\n\ntest′ : sz ≡ suc zero\ntest′ = refl\n\ntest″ : ss z ≡ suc (suc zero)\ntest″ = refl\n\ntest‴ : ss ≡ λ x → suc (suc x)\ntest‴ = refl\n\nf : ℕ → ℕ\nf z = zero\nf sz = suc z\nf (ss 0) = 2\nf (ss (suc n)) = n\n\ntest-f : f zero ≡ zero\ntest-f = refl\n\ntest-f′ : f (suc zero) ≡ suc zero\ntest-f′ = refl\n\n\ntest-f″ : f (suc (suc 0)) ≡ 2\ntest-f″ = refl\n\ntest-f‴ : ∀ {n} → f (suc (suc (suc n))) ≡ n\ntest-f‴ = refl\n\n------------------------------------------------------------------------\n\ndata L (A : Set) : Set where\n nil : L A\n cons : A → L A → L A\n\npattern cc x y xs = cons x (cons y xs)\n\ntest-cc : ∀ {A} → cc ≡ λ (x : A) y xs → cons x (cons y xs)\ntest-cc = refl\n\ncrazyLength : ∀ {A} → L A → ℕ\ncrazyLength nil = 0\ncrazyLength (cons x nil) = 1\ncrazyLength (cc x y xs) = 9000\n\nswap : ∀ {A} → L A → L A\nswap nil = nil\nswap (cons x nil) = cons x nil\nswap (cc x y xs) = cc y x xs\n\ntest-swap : ∀ {xs} → swap (cons 1 (cons 2 xs)) ≡ cons 2 (cons 1 xs)\ntest-swap = refl\n\n------------------------------------------------------------------------\n-- refl and _\n\nrecord ⊤ : Set where\n constructor tt\n\ndata _⊎_ (A B : Set) : Set where\n inj₁ : (x : A) → A ⊎ B\n inj₂ : (y : B) → A ⊎ B\n\ninfixr 4 _,_\nrecord Σ (A : Set)(B : A → Set) : Set where\n constructor _,_\n field\n proj₁ : A\n proj₂ : B proj₁\n\nopen Σ\n\n_×_ : (A B : Set) → Set\nA × B = Σ A λ _ → B\n\ninfixr 5 _+_\ninfixr 6 _*_\n\ndata Sig (O : Set) : Set₁ where\n ε ψ : Sig O\n ρ : (o : O) → Sig O\n ι : (o : O) → Sig O\n _+_ _*_ : (Σ Σ′ : Sig O) → Sig O\n σ π : (A : Set)(φ : A → Sig O) → Sig O\n\n\n⟦_⟧ : ∀ {O} → Sig O → (Set → (O → Set) → (O → Set))\n⟦ ε ⟧ P R o = ⊤\n⟦ ψ ⟧ P R o = P\n⟦ ρ o′ ⟧ P R o = R o′\n⟦ ι o′ ⟧ P R o = o ≡ o′\n⟦ Σ + Σ′ ⟧ P R o = ⟦ Σ ⟧ P R o ⊎ ⟦ Σ′ ⟧ P R o\n⟦ Σ * Σ′ ⟧ P R o = ⟦ Σ ⟧ P R o × ⟦ Σ′ ⟧ P R o\n⟦ σ A φ ⟧ P R o = Σ A λ x → ⟦ φ x ⟧ P R o\n⟦ π A φ ⟧ P R o = (x : A) → ⟦ φ x ⟧ P R o\n\n\n′List : Sig ⊤\n′List = ε + ψ * ρ _\n\ndata μ {O}(Σ : Sig O)(P : Set)(o : O) : Set where\n ⟨_⟩ : ⟦ Σ ⟧ P (μ Σ P) o → μ Σ P o\n\nList : Set → Set\nList A = μ ′List A _\n\ninfixr 5 _∷_\npattern [] = ⟨ inj₁ _ ⟩\npattern _∷_ x xs = ⟨ inj₂ (x , xs) ⟩\n\nlength : ∀ {A} → List A → ℕ\nlength [] = zero\nlength (x ∷ xs) = suc (length xs)\n\ntest-list : List ℕ\ntest-list = 1 ∷ 2 ∷ []\n\ntest-length : length test-list ≡ 2\ntest-length = refl\n\n\n\n\n′Vec : Sig ℕ\n′Vec = ι 0\n + σ ℕ λ m → ψ * ρ m * ι (suc m)\n\nVec : Set → ℕ → Set\nVec A n = μ ′Vec A n\n\npattern []V = ⟨ inj₁ refl ⟩\npattern _∷V_ x xs = ⟨ inj₂ (_ , x , xs , refl) ⟩\n\nnilV : ∀ {A} → Vec A zero\nnilV = []V\n\nconsV : ∀ {A n} → A → Vec A n → Vec A (suc n)\nconsV x xs = x ∷V xs\n\nlengthV : ∀ {A n} → Vec A n → ℕ\nlengthV []V = 0\nlengthV (x ∷V xs) = suc (lengthV xs)\n\ntest-lengthV : lengthV (consV 1 (consV 2 (consV 3 nilV))) ≡ 3\ntest-lengthV = refl\n\n------------------------------------------------------------------------\n-- .-patterns\n\npattern zr = (.zero , refl)\npattern underscore² = _ , _\n\ndot : (p : Σ ℕ λ n → n ≡ zero) → ⊤ × ⊤\ndot zr = underscore²\n\n------------------------------------------------------------------------\n-- Implicit arguments\n\n{-\npattern hiddenUnit = {_} -- XXX: We get lhs error msgs, can we refine\n -- that?\n\nimp : {p : ⊤} → ⊤\nimp hiddenUnit = _\n-}\n\ndata Box (A : Set) : Set where\n box : {x : A} → Box A\n\npattern [_] y = box {x = y}\n\nb : Box ℕ\nb = [ 1 ]\n\ntest-box : b ≡ box {x = 1}\ntest-box = refl\n\n\n------------------------------------------------------------------------\n-- Anonymous λs\n\ng : ℕ → ℕ\ng = λ { z → z\n ; sz → sz\n ; (ss n) → n\n }\n\ntest-g : g zero ≡ zero\ntest-g = refl\n\ntest-g′ : g sz ≡ suc zero\ntest-g′ = refl\n\ntest-g″ : ∀ {n} → g (suc (suc n)) ≡ n\ntest-g″ = refl\n\n------------------------------------------------------------------------\n-- λs\n\npostulate\n X Y : Set\n h : X → Y\n\np : (x : X)(y : Y) → h x ≡ y → ⊤\np x .((λ x → x) (h x)) refl = _\n\npattern app x = x , .((λ x → x) (h x))\n\np′ : (p : X × Y) → h (proj₁ p) ≡ proj₂ p → ⊤\np′ (app x) refl = _\n\n------------------------------------------------------------------------\n-- records\n\nrecord Rec : Set where\n constructor rr\n field\n r : ℕ\n\n\nrrr : (x : Rec) → x ≡ record { r = 0 } → ⊤\nrrr .(record { r = 0}) refl = _\n\nrrr′ : (x : Rec) → x ≡ record { r = 0 } → ⊤\nrrr′ .(rr 0) refl = _\n\nrrrr : (a : Rec × ℕ) → proj₁ a ≡ record { r = proj₂ a } → ⊤\nrrrr (.(rr 0) , 0) refl = _\nrrrr (.(rr (suc n)) , suc n) refl = _\n\npattern pair x = (.(record { r = x }) , x)\n\nrrrr′ : (a : Rec × ℕ) → proj₁ a ≡ record { r = proj₂ a } → ⊤\nrrrr′ (pair 0) refl = _\nrrrr′ (pair (suc n)) refl = _\n\n------------------------------------------------------------------------\n-- lets\n\npp : (x : X)(y : Y) → h x ≡ y → ⊤\npp x .(let i = (λ x → x) in i (h x)) refl = _\n\npattern llet x = x , .(let i = (λ x → x) in i (h x))\n\npp′ : (p : X × Y) → h (proj₁ p) ≡ proj₂ p → ⊤\npp′ (llet x) refl = _\n\n------------------------------------------------------------------------\n-- absurd patterns\n\npattern absurd = ()\n\ndata ⊥ : Set where\n\n⊥-elim : ∀ {A : Set} → ⊥ → A\n⊥-elim absurd\n\n------------------------------------------------------------------------\n-- ambiguous constructors\n\ndata ℕ2 : Set where\n zero : ℕ2\n suc : ℕ2 -> ℕ2\n\n-- This needs a type signature, because it is ambiguous:\namb : ℕ2\namb = suc (suc zero)\n\n-- This isn't ambiguous, because the overloading is resolved when the\n-- pattern synonym is scope-checked:\nunamb = ss z\n\n------------------------------------------------------------------------\n-- underscore\n\npattern trivial = ._\n\ntrivf : (a : ⊤) -> a ≡ tt -> ⊤\ntrivf trivial refl = trivial\n\n------------------------------------------------------------------------\n-- let open\n\npattern nuts = .(let open Σ in z)\n\nfoo : (n : ℕ) -> n ≡ z -> ℕ\nfoo nuts refl = nuts\n\n------------------------------------------------------------------------\n-- pattern synonym inside unparamterised module\n\nmodule M where\n pattern sss x = suc (suc (suc x))\n\n a : ℕ\n a = sss 2\n\nmb : ℕ\nmb = M.sss 0\n\nmf : ℕ -> ℕ -> ℕ\nmf (M.sss _) = M.sss\nmf _ = \\ _ -> 0\n\n\n\n\n{-\nmodule M (A : Set)(a : A) where\n pattern peep x = x , .a\n\n pop : (z : A × A) -> proj₂ z ≡ a -> ⊤\n pop (peep x) refl = _\n\n peep' = peep\n\n\npop' : (z : ⊤ × ⊤) -> proj₂ z ≡ tt -> ⊤\npop' (M.peep tt) refl = _\n\npeep' = M.peep\n-}", "meta": {"hexsha": "ca2d9b609d1bbd5e5cc08aa5fa9f46326c07dd03", "size": 6580, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/PatternSynonyms.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/succeed/PatternSynonyms.agda", "max_issues_repo_name": "asr/agda-kanso", "max_issues_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/PatternSynonyms.agda", "max_forks_repo_name": "asr/agda-kanso", "max_forks_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.1836734694, "max_line_length": 72, "alphanum_fraction": 0.4215805471, "num_tokens": 2475, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8418256353465631, "lm_q2_score": 0.8152324871074607, "lm_q1q2_score": 0.6862836064143969}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Bundles where\n\nopen import Algebra.Core\nopen import Quasigroup.Structures\nopen import Relation.Binary\nopen import Level\nopen import Algebra.Bundles\nopen import Algebra.Structures\nopen import Structures\n\nrecord InverseSemigroup c ℓ : Set (suc (c ⊔ ℓ)) where\n infixl 7 _∙_\n infix 4 _≈_\n field\n Carrier : Set c\n _≈_ : Rel Carrier ℓ\n _∙_ : Op₂ Carrier\n isInverseSemigroup : IsInverseSemigroup _≈_ _∙_\n\n open IsInverseSemigroup isInverseSemigroup public\n\n magma : Magma c ℓ\n magma = record { isMagma = isMagma }\n\n open Magma magma public\n using (_≉_; rawMagma)\n\nrecord Rng c ℓ : Set (suc (c ⊔ ℓ)) where\n infix 8 -_\n infixl 7 _*_\n infixl 6 _+_\n infix 4 _≈_\n field\n Carrier : Set c\n _≈_ : Rel Carrier ℓ\n _+_ : Op₂ Carrier\n _*_ : Op₂ Carrier\n -_ : Op₁ Carrier\n 0# : Carrier\n isRng : IsRng _≈_ _+_ _*_ -_ 0#\n\n open IsRng isRng public\n\n +-abelianGroup : AbelianGroup _ _\n +-abelianGroup = record { isAbelianGroup = +-isAbelianGroup }\n\n *-semigroup : Semigroup _ _\n *-semigroup = record { isSemigroup = *-isSemigroup }\n\n open AbelianGroup +-abelianGroup public\n using () renaming (group to +-group; invertibleMagma to +-invertibleMagma; invertibleUnitalMagma to +-invertibleUnitalMagma)\n\n open Semigroup *-semigroup public\n using () renaming\n ( rawMagma to *-rawMagma\n ; magma to *-magma\n )\n\nrecord NonAssociativeRing c ℓ : Set (suc (c ⊔ ℓ)) where\n infix 8 -_\n infixl 7 _*_\n infixl 6 _+_\n infix 4 _≈_\n field\n Carrier : Set c\n _≈_ : Rel Carrier ℓ\n _+_ : Op₂ Carrier\n _*_ : Op₂ Carrier\n -_ : Op₁ Carrier\n 0# : Carrier\n 1# : Carrier\n isNonAssociativeRing : IsNonAssociativeRing _≈_ _+_ _*_ -_ 0# 1#\n\n open IsNonAssociativeRing isNonAssociativeRing public\n\n +-abelianGroup : AbelianGroup _ _\n +-abelianGroup = record { isAbelianGroup = +-isAbelianGroup }\n\n *-unitalmagma : UnitalMagma _ _\n *-unitalmagma = record { isUnitalMagma = *-isUnitalMagma }\n\n open AbelianGroup +-abelianGroup public\n using () renaming (group to +-group; invertibleMagma to +-invertibleMagma; invertibleUnitalMagma to +-invertibleUnitalMagma)\n\n open UnitalMagma *-unitalmagma public\n using () renaming\n ( rawMagma to *-rawMagma\n ; magma to *-magma\n )\n", "meta": {"hexsha": "07e27c6b43aefd8a93352755ff0a9a5c5446306a", "size": 2475, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Bundles.agda", "max_stars_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_stars_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-15T06:16:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-17T09:14:03.000Z", "max_issues_repo_path": "src/Bundles.agda", "max_issues_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_issues_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-10-04T05:30:30.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-09T08:24:56.000Z", "max_forks_repo_path": "src/Bundles.agda", "max_forks_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_forks_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.902173913, "max_line_length": 128, "alphanum_fraction": 0.6274747475, "num_tokens": 797, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096112990285, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6862460058988037}} {"text": "module Rationals.Add.Comm where\n\nopen import Equality\nopen import Function\n\nopen import Nats using (zero; ℕ)\n renaming (suc to s; _+_ to _:+:_; _*_ to _:*:_)\nopen import Rationals\nopen import Rationals.Properties\nopen import Nats.Add.Comm\nopen import Nats.Multiply.Distrib\nopen import Nats.Multiply.Comm\n\n------------------------------------------------------------------------\n-- internal stuffs\n\nprivate\n\n a/c+b/c=a*b/c : ∀ a b c → a ÷ c + b ÷ c ≡ (a :+: b) ÷ c\n a/c+b/c=a*b/c a b c\n rewrite (a :+: b) ÷ c ↑ c\n | sym $ nat-multiply-distrib a b c\n = refl\n\n a+b=b+a : ∀ x y → x + y ≡ y + x\n a+b=b+a (a ÷ c) (b ÷ d)\n rewrite a ÷ c ↑ d\n | b ÷ d ↑ c\n | a/c+b/c=a*b/c (a :*: d) (b :*: c) $ d :*: c\n | nat-add-comm (a :*: d) $ b :*: c\n | nat-multiply-comm c d\n = refl\n\n------------------------------------------------------------------------\n-- public aliases\n\nrational-add-comm : ∀ x y → x + y ≡ y + x\nrational-add-comm = a+b=b+a\n", "meta": {"hexsha": "09d99b99e8b689037045bc7f1db4c62df5ecae1d", "size": 1019, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Rationals/Add/Comm.agda", "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_issues_repo_path": "src/Rationals/Add/Comm.agda", "max_issues_repo_name": "ice1k/Theorems", "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Rationals/Add/Comm.agda", "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.1282051282, "max_line_length": 72, "alphanum_fraction": 0.4474975466, "num_tokens": 315, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.916109606718245, "lm_q2_score": 0.7490872075132152, "lm_q1q2_score": 0.6862459870726}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Bisimilarity for Colists\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe --sized-types #-}\n\nmodule Codata.Colist.Bisimilarity where\n\nopen import Level using (_⊔_)\nopen import Size\nopen import Codata.Thunk\nopen import Codata.Colist\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as Eq using (_≡_)\n\ndata Bisim {a b r} {A : Set a} {B : Set b} (R : A → B → Set r) (i : Size) :\n (xs : Colist A ∞) (ys : Colist B ∞) → Set (r ⊔ a ⊔ b) where\n [] : Bisim R i [] []\n _∷_ : ∀ {x y xs ys} → R x y → Thunk^R (Bisim R) i xs ys → Bisim R i (x ∷ xs) (y ∷ ys)\n\n\nmodule _ {a r} {A : Set a} {R : A → A → Set r} where\n\n reflexive : Reflexive R → ∀ {i} → Reflexive (Bisim R i)\n reflexive refl^R {i} {[]} = []\n reflexive refl^R {i} {r ∷ rs} = refl^R ∷ λ where .force → reflexive refl^R\n\nmodule _ {a b} {A : Set a} {B : Set b}\n {r} {P : A → B → Set r} {Q : B → A → Set r} where\n\n symmetric : Sym P Q → ∀ {i} → Sym (Bisim P i) (Bisim Q i)\n symmetric sym^PQ [] = []\n symmetric sym^PQ (p ∷ ps) = sym^PQ p ∷ λ where .force → symmetric sym^PQ (ps .force)\n\nmodule _ {a b c} {A : Set a} {B : Set b} {C : Set c}\n {r} {P : A → B → Set r} {Q : B → C → Set r} {R : A → C → Set r} where\n\n transitive : Trans P Q R → ∀ {i} → Trans (Bisim P i) (Bisim Q i) (Bisim R i)\n transitive trans^PQR [] [] = []\n transitive trans^PQR (p ∷ ps) (q ∷ qs) =\n trans^PQR p q ∷ λ where .force → transitive trans^PQR (ps .force) (qs .force)\n\n-- Pointwise Equality as a Bisimilarity\n------------------------------------------------------------------------\n\nmodule _ {ℓ} {A : Set ℓ} where\n\n infix 1 _⊢_≈_\n _⊢_≈_ : ∀ i → Colist A ∞ → Colist A ∞ → Set ℓ\n _⊢_≈_ = Bisim _≡_\n\n refl : ∀ {i} → Reflexive (i ⊢_≈_)\n refl = reflexive Eq.refl\n\n sym : ∀ {i} → Symmetric (i ⊢_≈_)\n sym = symmetric Eq.sym\n\n trans : ∀ {i} → Transitive (i ⊢_≈_)\n trans = transitive Eq.trans\n", "meta": {"hexsha": "5506f1102f04f4047da401bf24e5b2c215c92136", "size": 2050, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Codata/Colist/Bisimilarity.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Codata/Colist/Bisimilarity.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Codata/Colist/Bisimilarity.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.064516129, "max_line_length": 87, "alphanum_fraction": 0.5053658537, "num_tokens": 729, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240825770432, "lm_q2_score": 0.7931059536292271, "lm_q1q2_score": 0.686214371115239}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Functor.Construction.Diagonal where\n\n-- A variety of Diagonal functors\n\nopen import Level\nopen import Data.Product using (_,_)\n\nopen import Categories.Category\nopen import Categories.Functor\nopen import Categories.Category.Product\nopen import Categories.Category.Construction.Functors\nopen import Categories.Functor.Construction.Constant\nopen import Categories.NaturalTransformation using (ntHelper)\n\nimport Categories.Functor.Power as Power\n\nprivate\n variable\n o ℓ e o′ ℓ′ e′ : Level\n\nΔ : (C : Category o ℓ e) → Functor C (Product C C)\nΔ C = record\n { F₀ = λ x → x , x\n ; F₁ = λ f → f , f\n ; identity = refl , refl\n ; homomorphism = refl , refl\n ; F-resp-≈ = λ x → x , x\n }\n where\n open Category C\n open Equiv\n\nΔ′ : (I : Set) → (C : Category o ℓ e) → Functor C (Power.Exp C I)\nΔ′ I C = record\n { F₀ = λ x _ → x\n ; F₁ = λ f _ → f\n ; identity = λ _ → refl\n ; homomorphism = λ _ → refl\n ; F-resp-≈ = λ x _ → x\n }\n where open Category.Equiv C\n\nΔF : {C : Category o ℓ e} (I : Category o′ ℓ′ e′) → Functor C (Functors I C)\nΔF {C = C} I = record\n { F₀ = const\n ; F₁ = λ f → ntHelper record { η = λ _ → f; commute = λ _ → C.identityʳ ○ ⟺ C.identityˡ }\n ; identity = refl\n ; homomorphism = refl\n ; F-resp-≈ = λ x → x\n }\n where\n module C = Category C\n open C.Equiv\n open C.HomReasoning using (_○_; ⟺)\n", "meta": {"hexsha": "b0a02cc9d1a5ebeb3175fc7a7f4c93c65c4dfcc2", "size": 1465, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Construction/Diagonal.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Functor/Construction/Diagonal.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Functor/Construction/Diagonal.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 26.1607142857, "max_line_length": 101, "alphanum_fraction": 0.6020477816, "num_tokens": 483, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206844384595, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6860465523875765}} {"text": "module Test2 where\n open import MiniHoTT\n\n A : Set\n A = ℕ\n\n\n-- a, b : A\n\n {-\n [ a, b ] : List A\n [ a, b ] := inr ( a , ?)\n -- inr ((a, inr ( b, inl(unit))\n -}\n\n T : {A : Set} → (X : Set) → Set\n T {A} X = 𝟙 lzero + A × X -- This is an example of a polynomial functor.\n\n\n data\n List (A : Set)\n : Set\n where\n [] : List A\n cons : A → List A → List A\n\n data Vec (A : Set) : ℕ → Set\n where\n nil : ∀ n → Vec A n\n cons : ∀ n → A → Vec A n → Vec A (succ n)\n\n data Fin : ℕ → Set\n where\n cero : ∀ {n} → Fin n\n succ : ∀ {n} → Fin n → Fin (succ n)\n\n at : ∀ {n : ℕ} {A : Set}\n → Vec A (succ n)\n → Fin (succ n)\n → A\n at v n = {! !}\n\n go' : ∀ {n} {A : Set}\n → (Fin 0n → A) → Fin n → Vec A n\n go' pick cero = nil _\n go' pick (succ n) = cons {! !} (pick {! n !})\n (go' {! pick !} {! !})\n\n record\n Algebra\n (A : Set)\n (T : Set → Set)\n : Set (lsuc lzero)\n where\n constructor algebra\n field\n X : Set\n μ : T X → X\n\n -- Objects: (X, μ)\n -- morphisms f : (X, μ) ­--> (Y, ν)\n -- this is given by α : X → Y, that makes the diagram commutes.\n -- Initial object: Object (X, μ) + initiallity condition:\n -- Any other (Y, ν), there exists unique α : X → Y such that...\n\n\n list-is-an-algebra : (A : Set) → Algebra A (λ X → 𝟙 lzero + A × X)\n list-is-an-algebra A =\n algebra (List A) λ { (inl x) → []\n ; (inr (a , xs)) → cons a xs\n }\n\n\n\n\n -- where (T X -> X) is the type of list with elements of type A.\n -- elements? is TA a set?\n -- Yes, assuming A is a set. Let's find that.\n\n list-of-nats-is-set\n : A is-set\n → isSet (T A)\n list-of-nats-is-set A-is-set\n = +-set\n (prop-is-set 𝟙-is-prop)\n (∑-set\n A-is-set\n λ _ → A-is-set)\n\n -- T(X) = 1+X + (X ×X) a\n\n\n", "meta": {"hexsha": "66b84c6c7dec8d8d9c2c7d27167368305d2ebb55", "size": 1892, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Test2.agda", "max_stars_repo_name": "jonaprieto/mini-hott", "max_stars_repo_head_hexsha": "9e81415f0276ee42b4a57816c1dcd3aaa6d9ea60", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-05-12T14:19:04.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-17T10:28:06.000Z", "max_issues_repo_path": "src/Test2.agda", "max_issues_repo_name": "jonaprieto/mini-hott", "max_issues_repo_head_hexsha": "9e81415f0276ee42b4a57816c1dcd3aaa6d9ea60", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Test2.agda", "max_forks_repo_name": "jonaprieto/mini-hott", "max_forks_repo_head_hexsha": "9e81415f0276ee42b4a57816c1dcd3aaa6d9ea60", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-04-26T15:16:01.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-26T15:16:01.000Z", "avg_line_length": 20.3440860215, "max_line_length": 75, "alphanum_fraction": 0.4397463002, "num_tokens": 694, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314798554444, "lm_q2_score": 0.7745833789613196, "lm_q1q2_score": 0.685995424180944}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Basic definitions for morphisms between algebraic structures\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary.Core\n\nmodule Algebra.Morphism.Definitions\n {a} (A : Set a) -- The domain of the morphism\n {b} (B : Set b) -- The codomain of the morphism\n {ℓ} (_≈_ : Rel B ℓ) -- The equality relation over the codomain\n where\n\nopen import Algebra.Core\nopen import Function.Core\n\n------------------------------------------------------------------------\n-- Basic definitions\n\nHomomorphic₀ : (A → B) → A → B → Set _\nHomomorphic₀ ⟦_⟧ ∙ ∘ = ⟦ ∙ ⟧ ≈ ∘\n\nHomomorphic₁ : (A → B) → Op₁ A → Op₁ B → Set _\nHomomorphic₁ ⟦_⟧ ∙_ ∘_ = ∀ x → ⟦ ∙ x ⟧ ≈ (∘ ⟦ x ⟧)\n\nHomomorphic₂ : (A → B) → Op₂ A → Op₂ B → Set _\nHomomorphic₂ ⟦_⟧ _∙_ _∘_ = ∀ x y → ⟦ x ∙ y ⟧ ≈ (⟦ x ⟧ ∘ ⟦ y ⟧)\n\n\n\n------------------------------------------------------------------------\n-- DEPRECATED NAMES\n------------------------------------------------------------------------\n-- Please use the new names as continuing support for the old names is\n-- not guaranteed.\n\n-- Version 1.3\n\nMorphism : Set _\nMorphism = A → B\n\n{-# WARNING_ON_USAGE Morphism\n\"Warning: Morphism was deprecated in v1.3.\nPlease use the standard function notation (e.g. A → B) instead.\"\n#-}\n", "meta": {"hexsha": "e953d033cc65645cd0b57b77624f4f6472195d27", "size": 1412, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Algebra/Morphism/Definitions.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Algebra/Morphism/Definitions.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Algebra/Morphism/Definitions.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 28.8163265306, "max_line_length": 72, "alphanum_fraction": 0.4695467422, "num_tokens": 375, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8856314647623015, "lm_q2_score": 0.7745833893685269, "lm_q1q2_score": 0.6859954217069966}} {"text": "-- Classical propositional logic, de Bruijn approach, initial encoding\n\nmodule Bi.Cp where\n\nopen import Lib using (List; _,_; LMem; lzero; lsuc)\n\n\n-- Types\n\ninfixl 2 _&&_\ninfixl 1 _||_\ninfixr 0 _=>_\ndata Ty : Set where\n UNIT : Ty\n _=>_ : Ty -> Ty -> Ty\n _&&_ : Ty -> Ty -> Ty\n _||_ : Ty -> Ty -> Ty\n FALSE : Ty\n\ninfixr 0 _<=>_\n_<=>_ : Ty -> Ty -> Ty\na <=> b = (a => b) && (b => a)\n\nNOT : Ty -> Ty\nNOT a = a => FALSE\n\nTRUE : Ty\nTRUE = FALSE => FALSE\n\n\n-- Context and truth judgement\n\nCx : Set\nCx = List Ty\n\nisTrue : Ty -> Cx -> Set\nisTrue a tc = LMem a tc\n\n\n-- Terms\n\nmodule Cp where\n infixl 1 _$_\n infixr 0 lam=>_\n infixr 0 abort=>_\n data Tm (tc : Cx) : Ty -> Set where\n var : forall {a} -> isTrue a tc -> Tm tc a\n lam=>_ : forall {a b} -> Tm (tc , a) b -> Tm tc (a => b)\n _$_ : forall {a b} -> Tm tc (a => b) -> Tm tc a -> Tm tc b\n pair' : forall {a b} -> Tm tc a -> Tm tc b -> Tm tc (a && b)\n fst : forall {a b} -> Tm tc (a && b) -> Tm tc a\n snd : forall {a b} -> Tm tc (a && b) -> Tm tc b\n left : forall {a b} -> Tm tc a -> Tm tc (a || b)\n right : forall {a b} -> Tm tc b -> Tm tc (a || b)\n case' : forall {a b c} -> Tm tc (a || b) -> Tm (tc , a) c -> Tm (tc , b) c -> Tm tc c\n abort=>_ : forall {a} -> Tm (tc , NOT a) FALSE -> Tm tc a\n\n syntax pair' x y = [ x , y ]\n syntax case' xy x y = case xy => x => y\n\n v0 : forall {tc a} -> Tm (tc , a) a\n v0 = var lzero\n\n v1 : forall {tc a b} -> Tm (tc , a , b) a\n v1 = var (lsuc lzero)\n\n v2 : forall {tc a b c} -> Tm (tc , a , b , c) a\n v2 = var (lsuc (lsuc lzero))\n\n Thm : Ty -> Set\n Thm a = forall {tc} -> Tm tc a\nopen Cp public\n", "meta": {"hexsha": "022960ac658c10958a378be65d198aa42fa36850", "size": 1809, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Bi/Cp.agda", "max_stars_repo_name": "mietek/formal-logic", "max_stars_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_stars_repo_licenses": ["X11"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2015-08-31T09:49:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-13T12:37:44.000Z", "max_issues_repo_path": "src/Bi/Cp.agda", "max_issues_repo_name": "mietek/formal-logic", "max_issues_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_issues_repo_licenses": ["X11"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Bi/Cp.agda", "max_forks_repo_name": "mietek/formal-logic", "max_forks_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_forks_repo_licenses": ["X11"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.7808219178, "max_line_length": 92, "alphanum_fraction": 0.4543946932, "num_tokens": 701, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314738181875, "lm_q2_score": 0.7745833789613197, "lm_q1q2_score": 0.6859954195045852}} {"text": "module Type.Identity.Proofs where\n\nimport Lvl\nopen import Structure.Function\nopen import Structure.Relator.Properties\nopen import Structure.Relator\nopen import Structure.Type.Identity\nopen import Type.Identity\nopen import Type\n\nprivate variable ℓ ℓ₁ ℓ₂ ℓₑ ℓₑ₁ ℓₑ₂ ℓₚ : Lvl.Level\nprivate variable T A B : Type{ℓ}\nprivate variable P : T → Type{ℓ}\nprivate variable _▫_ : A → B → Type{ℓ}\n\ninstance\n Id-reflexivity : Reflexivity(Id{T = T})\n Reflexivity.proof Id-reflexivity = intro\n\ninstance\n Id-identityEliminator : IdentityEliminator{ℓₚ = ℓₚ}(Id{T = T})\n IdentityEliminator.elim Id-identityEliminator = elim\n\ninstance\n Id-identityEliminationOfIntro : IdentityEliminationOfIntro{ℓₘ = ℓ}(Id{T = T})(Id)\n IdentityEliminationOfIntro.proof Id-identityEliminationOfIntro P p = intro\n\ninstance\n Id-identityType : IdentityType(Id)\n Id-identityType = intro\n\n{-\nopen import Logic.Propositional\nopen import Logic.Propositional.Equiv\nopen import Relator.Equals.Proofs\nopen import Structure.Setoid\n\nte : ⦃ equiv-A : Equiv{ℓₑ}(A)⦄ → ∀{f : A → Type{ℓ}} → Function ⦃ equiv-A ⦄ ⦃ [↔]-equiv ⦄ (f)\n\ntest : ⦃ equiv-A : Equiv{ℓₑ}(A)⦄ → ∀{P : A → Type{ℓ}} → UnaryRelator ⦃ equiv-A ⦄ (P)\nUnaryRelator.substitution test eq p = [↔]-to-[→] (Function.congruence te eq) p\n-}\n", "meta": {"hexsha": "99b594fab5f1fd6459489b1400ef433a4a74a8d9", "size": 1257, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type/Identity/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Type/Identity/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Type/Identity/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.2325581395, "max_line_length": 92, "alphanum_fraction": 0.7326968974, "num_tokens": 424, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8856314677809303, "lm_q2_score": 0.7745833841649232, "lm_q1q2_score": 0.6859954194367012}} {"text": "\nmodule Oscar.Class.TermSubstitution.Internal {𝔣} (FunctionName : Set 𝔣) where\n\nopen import Oscar.Data.Term.Core FunctionName\nopen import Oscar.Data.Nat.Core\nopen import Oscar.Data.Fin.Core\nopen import Oscar.Data.Vec.Core\nopen import Oscar.Data.Equality.Core\nopen import Oscar.Data.Product.Core\nopen import Oscar.Function\nopen import Oscar.Level\n\n_⊸_ : (m n : ℕ) → Set 𝔣\nm ⊸ n = Fin m → Term n\n\n⊸-Property : {ℓ : Level} → ℕ → Set (lsuc ℓ ⊔ 𝔣)\n⊸-Property {ℓ} m = ∀ {n} → m ⊸ n → Set ℓ\n\n_≐_ : {m n : ℕ} → m ⊸ n → m ⊸ n → Set 𝔣\nf ≐ g = ∀ x → f x ≡ g x\n\n⊸-Extensional : {ℓ : Level} {m : ℕ} → ⊸-Property {ℓ} m → Set (ℓ ⊔ 𝔣)\n⊸-Extensional P = ∀ {m f g} → f ≐ g → P {m} f → P g\n\n⊸-ExtentionalProperty : {ℓ : Level} → ℕ → Set (lsuc ℓ ⊔ 𝔣)\n⊸-ExtentionalProperty {ℓ} m = Σ (⊸-Property {ℓ} m) ⊸-Extensional\n\nmutual\n\n _◃Term_ : ∀ {m n} → (f : m ⊸ n) → Term m → Term n\n f ◃Term i x = f x\n f ◃Term leaf = leaf\n f ◃Term (s fork t) = (f ◃Term s) fork (f ◃Term t)\n f ◃Term (function fn ts) = function fn (f ◃VecTerm ts) where\n\n _◃VecTerm_ : ∀ {N m n} → m ⊸ n → Vec (Term m) N → Vec (Term n) N\n f ◃VecTerm [] = []\n f ◃VecTerm (t ∷ ts) = f ◃Term t ∷ f ◃VecTerm ts\n\n_◇_ : ∀ {l m n} → m ⊸ n → l ⊸ m → l ⊸ n\n_◇_ f g = (f ◃Term_) ∘ g\n\nrecord Substitution {a} (A : ℕ → Set a) : Set (a ⊔ 𝔣) where\n field\n _◃_ : ∀ {m n} → m ⊸ n → A m → A n\n ◃-extentionality : ∀ {m n} {f g : m ⊸ n} → f ≐ g → (t : A m) → f ◃ t ≡ g ◃ t\n ◃-identity : ∀ {n} → (t : A n) → i ◃ t ≡ t\n\n field\n ◃-associativity : ∀ {l m n} → {f : m ⊸ n} {g : _} (t : A l) → (f ◇ g) ◃ t ≡ f ◃ (g ◃ t)\n\n ⊸-Unifies : ∀ {m} (s t : A m) → ⊸-Property m\n ⊸-Unifies s t f = f ◃ s ≡ f ◃ t\n\nopen Substitution ⦃ … ⦄ public\n\n{-# DISPLAY Substitution._◃_ _ = _◃_ #-}\n", "meta": {"hexsha": "463f66a2d97dc6de6f247a33a2ecec5a70a4a355", "size": 1711, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Class/termsubinternal.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Class/termsubinternal.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Class/termsubinternal.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.5, "max_line_length": 91, "alphanum_fraction": 0.5347749854, "num_tokens": 805, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8887587846530938, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6859826797530416}} {"text": "\nmodule Data.Rational where\n\nimport Data.Bool as Bool\nimport Data.Nat as Nat\nimport Data.Integer as Int\n\nopen Int renaming\n ( _*_ to _*'_\n ; _+_ to _+'_\n ; -_ to -'_\n ; _-_ to _-'_\n ; !_! to !_!'\n ; _==_ to _=='_\n ; _≤_ to _≤'_\n ; _≥_ to _≥'_\n ; _>_ to _>'_\n ; _<_ to _<'_\n )\nopen Nat using (Nat; zero; suc)\nopen Bool\n\ninfix 40 _==_ _<_ _>_ _≤_ _≥_\ninfixl 60 _+_ _-_\ninfixl 70 _%'_ _%_ _/_ _*_\ninfixr 80 _^_\ninfix 90 -_\n\ndata Rational : Set where\n _%'_ : Int -> Int -> Rational\n\nnumerator : Rational -> Int\nnumerator (n %' d) = n\n\ndenominator : Rational -> Int\ndenominator (n %' d) = d\n\n_%_ : Int -> Int -> Rational\nneg n % neg m = pos (suc n) % pos (suc m)\npos 0 % neg m = pos 0 %' pos 1\npos (suc n) % neg m = neg n % pos (suc m)\nx % y = div x z %' div y z\n where\n z = gcd x y\n\nfromInt : Int -> Rational\nfromInt x = x %' pos 1\n\nfromNat : Nat -> Rational\nfromNat x = fromInt (pos x)\n\n_+_ : Rational -> Rational -> Rational\n(a %' b) + (c %' d) = (a *' d +' c *' b) % (b *' d)\n\n-_ : Rational -> Rational\n- (a %' b) = -' a %' b\n\n_-_ : Rational -> Rational -> Rational\na - b = a + (- b)\n\n_/_ : Rational -> Rational -> Rational\n(a %' b) / (c %' d) = (a *' d) % (b *' c)\n\n_*_ : Rational -> Rational -> Rational\n(a %' b) * (c %' d) = (a *' c) % (b *' d)\n\nrecip : Rational -> Rational\nrecip (a %' b) = b %' a\n\n_^_ : Rational -> Int -> Rational\nq ^ neg n = recip q ^ pos (suc n)\nq ^ pos zero = fromNat 1\nq ^ pos (suc n) = q * q ^ pos n\n\n!_! : Rational -> Rational\n! a %' b ! = pos ! a !' %' pos ! b !' \n\nround : Rational -> Int\nround (a %' b) = div (a +' div b (pos 2)) b\n\n_==_ : Rational -> Rational -> Bool\n(a %' b) == (c %' d) = a *' d ==' b *' c\n\n_<_ : Rational -> Rational -> Bool\n(a %' b) < (c %' d) = a *' d <' b *' c\n\n_>_ : Rational -> Rational -> Bool\n(a %' b) > (c %' d) = a *' d >' b *' c\n\n_≤_ : Rational -> Rational -> Bool\n(a %' b) ≤ (c %' d) = a *' d ≤' b *' c\n\n_≥_ : Rational -> Rational -> Bool\n(a %' b) ≥ (c %' d) = a *' d ≥' b *' c\n\nmax : Rational -> Rational -> Rational\nmax a b = if a < b then b else a\n\nmin : Rational -> Rational -> Rational\nmin a b = if a < b then a else b\n\n", "meta": {"hexsha": "bbb24f70f13e83e2368a5f784f16bfe0477cfade", "size": 2262, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Rational.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Rational.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Rational.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.1764705882, "max_line_length": 51, "alphanum_fraction": 0.476127321, "num_tokens": 868, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9343951552333004, "lm_q2_score": 0.734119526900183, "lm_q1q2_score": 0.6859577292976936}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Core definition of divisibility\n------------------------------------------------------------------------\n\n-- The definition of divisibility is split out from\n-- `Data.Nat.Divisibility` to avoid a dependency cycle with\n-- `Data.Nat.DivMod`.\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Nat.Divisibility.Core where\n\nopen import Data.Nat.Base using (ℕ; _*_)\nopen import Data.Nat.Properties\nopen import Level using (0ℓ)\nopen import Relation.Nullary using (¬_)\nopen import Relation.Binary using (Rel)\nopen import Relation.Binary.PropositionalEquality\n using (_≡_; refl; sym)\n\n------------------------------------------------------------------------\n-- Definition\n--\n-- m ∣ n is inhabited iff m divides n. Some sources, like Hardy and\n-- Wright's \"An Introduction to the Theory of Numbers\", require m to\n-- be non-zero. However, some things become a bit nicer if m is\n-- allowed to be zero. For instance, _∣_ becomes a partial order, and\n-- the gcd of 0 and 0 becomes defined.\n\ninfix 4 _∣_ _∤_\n\nrecord _∣_ (m n : ℕ) : Set where\n constructor divides\n field quotient : ℕ\n equality : n ≡ quotient * m\nopen _∣_ using (quotient) public\n\n_∤_ : Rel ℕ 0ℓ\nm ∤ n = ¬ (m ∣ n)\n", "meta": {"hexsha": "72c1f94abb9e994d5305523815d413b81bcce22b", "size": 1281, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/Nat/Divisibility/Core.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/Nat/Divisibility/Core.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/Nat/Divisibility/Core.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 30.5, "max_line_length": 72, "alphanum_fraction": 0.5870413739, "num_tokens": 311, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8824278695464501, "lm_q2_score": 0.7772998714925403, "lm_q1q2_score": 0.6859110695998918}} {"text": "{-# OPTIONS --no-termination-check #-}\n\nmodule Data.Bits where\n\nimport Prelude\nimport Logic.Base\nimport Data.List as List\nimport Data.Nat as Nat\nimport Data.Bool as Bool\n\nopen Prelude\nopen Nat\nopen Bool\nopen List\n\nBit = Bool\n\nshiftL : Nat -> Nat -> Nat\nshiftL n i = n * 2 ^ i\n\nsucBits : List Bit -> List Bit\nsucBits [] = true :: []\nsucBits (false :: xs) = true :: xs\nsucBits (true :: xs) = false :: sucBits xs\n\n-- Least significant bit first. Last bit (when present) is always one.\ntoBits : Nat -> List Bit\ntoBits zero = []\ntoBits (suc n) = sucBits (odd n :: toBits (div n 2))\n\nfromBits : List Bit -> Nat\nfromBits xs = foldr (\\b n -> bitValue b + 2 * n) 0 xs\n where\n bitValue : Bit -> Nat\n bitValue b = if b then 1 else 0\n\nnofBits : Nat -> Nat\nnofBits = length ∘ toBits\n\nmodule Proofs where\n\n open Logic.Base\n\n-- fromBits∘toBits=id : (n : Nat) -> fromBits (toBits n) ≡ n\n-- fromBits∘toBits=id zero = tt\n-- fromBits∘toBits=id (suc n) = ?\n\n", "meta": {"hexsha": "78c540e2cee7068ff0f5517ac621fdd0f6641121", "size": 971, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/lib/Data/Bits.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/lib/Data/Bits.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/lib/Data/Bits.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 20.2291666667, "max_line_length": 70, "alphanum_fraction": 0.6354273944, "num_tokens": 318, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110454379297, "lm_q2_score": 0.7690802370707281, "lm_q1q2_score": 0.6858742502476969}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Category.Monoidal.Instance.Setoids where\n\nopen import Level\nopen import Data.Product\nopen import Data.Product.Relation.Binary.Pointwise.NonDependent\nopen import Function.Equality\nopen import Relation.Binary using (Setoid)\n\nopen import Categories.Category\nopen import Categories.Category.Instance.Setoids\nopen import Categories.Category.Cartesian\nopen import Categories.Category.Instance.SingletonSet\n\nmodule _ {o ℓ} where\n\n Setoids-Cartesian : Cartesian (Setoids o ℓ)\n Setoids-Cartesian = record\n { terminal = SingletonSetoid-⊤\n ; products = record\n { product = λ {A B} →\n let module A = Setoid A\n module B = Setoid B\n in record\n { A×B = ×-setoid A B -- the stdlib doesn't provide projections!\n ; π₁ = record\n { _⟨$⟩_ = proj₁\n ; cong = proj₁\n }\n ; π₂ = record\n { _⟨$⟩_ = proj₂\n ; cong = proj₂\n }\n ; ⟨_,_⟩ = λ f g → record\n { _⟨$⟩_ = λ x → f ⟨$⟩ x , g ⟨$⟩ x\n ; cong = λ eq → cong f eq , cong g eq\n }\n ; project₁ = λ {_ h i} eq → cong h eq\n ; project₂ = λ {_ h i} eq → cong i eq\n ; unique = λ {W h i j} eq₁ eq₂ eq → A.sym (eq₁ (Setoid.sym W eq)) , B.sym (eq₂ (Setoid.sym W eq))\n }\n }\n }\n\n module Setoids-Cartesian = Cartesian Setoids-Cartesian\n open Setoids-Cartesian renaming (monoidal to Setoids-Monoidal) public\n", "meta": {"hexsha": "9642b25bb77fc8a19f3094667e9c4ecd14e1676b", "size": 1512, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Monoidal/Instance/Setoids.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Monoidal/Instance/Setoids.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Monoidal/Instance/Setoids.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.5, "max_line_length": 109, "alphanum_fraction": 0.5767195767, "num_tokens": 420, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110339361276, "lm_q2_score": 0.7690802317779601, "lm_q1q2_score": 0.6858742366817393}} {"text": "------------------------------------------------------------------------\n-- Groups\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Equality\n\nmodule Group\n {e⁺} (eq : ∀ {a p} → Equality-with-J a p e⁺) where\n\nopen Derived-definitions-and-properties eq\n\nopen import Logical-equivalence using (_⇔_)\nopen import Prelude as P hiding (id; _∘_) renaming (_×_ to _⊗_)\n\nimport Bijection eq as B\nopen import Equivalence eq as Eq using (_≃_)\nopen import Function-universe eq as F hiding (id; _∘_)\nopen import Groupoid eq using (Groupoid)\nopen import H-level eq\nopen import H-level.Closure eq\nopen import Integer.Basics eq using (+_; -[1+_])\nopen import Univalence-axiom eq\n\nprivate\n variable\n a g₁ g₂ : Level\n A : Type a\n g x y : A\n k : Kind\n\n------------------------------------------------------------------------\n-- Groups\n\n-- Groups.\n--\n-- Note that the carrier type is required to be a set (following the\n-- HoTT book).\n\nrecord Group g : Type (lsuc g) where\n infix 8 _⁻¹\n infixr 7 _∘_\n\n field\n Carrier : Type g\n Carrier-is-set : Is-set Carrier\n _∘_ : Carrier → Carrier → Carrier\n id : Carrier\n _⁻¹ : Carrier → Carrier\n left-identity : ∀ x → (id ∘ x) ≡ x\n right-identity : ∀ x → (x ∘ id) ≡ x\n assoc : ∀ x y z → (x ∘ (y ∘ z)) ≡ ((x ∘ y) ∘ z)\n left-inverse : ∀ x → ((x ⁻¹) ∘ x) ≡ id\n right-inverse : ∀ x → (x ∘ (x ⁻¹)) ≡ id\n\n -- Groups are groupoids.\n\n groupoid : Groupoid lzero g\n groupoid = record\n { Object = ⊤\n ; _∼_ = λ _ _ → Carrier\n ; id = id\n ; _∘_ = _∘_\n ; _⁻¹ = _⁻¹\n ; left-identity = left-identity\n ; right-identity = right-identity\n ; assoc = assoc\n ; left-inverse = left-inverse\n ; right-inverse = right-inverse\n }\n\n open Groupoid groupoid public\n hiding (Object; _∼_; id; _∘_; _⁻¹; left-identity; right-identity;\n assoc; left-inverse; right-inverse)\n\nprivate\n variable\n G G₁ G₁′ G₂ G₂′ G₃ : Group g\n\n-- The type of groups can be expressed using a nested Σ-type.\n\nGroup-as-Σ :\n Group g ≃\n ∃ λ (A : Set g) →\n let A = ⌞ A ⌟ in\n ∃ λ (_∘_ : A → A → A) →\n ∃ λ (id : A) →\n ∃ λ (_⁻¹ : A → A) →\n (∀ x → (id ∘ x) ≡ x) ⊗\n (∀ x → (x ∘ id) ≡ x) ⊗\n (∀ x y z → (x ∘ (y ∘ z)) ≡ ((x ∘ y) ∘ z)) ⊗\n (∀ x → ((x ⁻¹) ∘ x) ≡ id) ⊗\n (∀ x → (x ∘ (x ⁻¹)) ≡ id)\nGroup-as-Σ =\n Eq.↔→≃\n (λ G → let open Group G in\n (Carrier , Carrier-is-set)\n , _∘_\n , id\n , _⁻¹\n , left-identity\n , right-identity\n , assoc\n , left-inverse\n , right-inverse)\n _\n refl\n refl\n\n------------------------------------------------------------------------\n-- Group homomorphisms and isomorphisms\n\n-- Group homomorphisms (generalised to several kinds of underlying\n-- \"functions\").\n\nrecord Homomorphic (k : Kind) (G₁ : Group g₁) (G₂ : Group g₂) :\n Type (g₁ ⊔ g₂) where\n private\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n field\n related : G₁.Carrier ↝[ k ] G₂.Carrier\n\n to : G₁.Carrier → G₂.Carrier\n to = to-implication related\n\n field\n homomorphic :\n ∀ x y → to (x G₁.∘ y) ≡ to x G₂.∘ to y\n\nopen Homomorphic public using (related; homomorphic)\nopen Homomorphic using (to)\n\n-- The type of (generalised) group homomorphisms can be expressed\n-- using a nested Σ-type.\n\nHomomorphic-as-Σ :\n {G₁ : Group g₁} {G₂ : Group g₂} →\n Homomorphic k G₁ G₂ ≃\n let module G₁ = Group G₁\n module G₂ = Group G₂\n in\n ∃ λ (f : G₁.Carrier ↝[ k ] G₂.Carrier) →\n ∀ x y →\n to-implication f (x G₁.∘ y) ≡\n to-implication f x G₂.∘ to-implication f y\nHomomorphic-as-Σ =\n Eq.↔→≃\n (λ G₁↝G₂ → G₁↝G₂ .related , G₁↝G₂ .homomorphic)\n _\n refl\n refl\n\n-- A variant of Homomorphic.\n\ninfix 4 _↝[_]ᴳ_ _→ᴳ_ _≃ᴳ_\n\n_↝[_]ᴳ_ : Group g₁ → Kind → Group g₂ → Type (g₁ ⊔ g₂)\n_↝[_]ᴳ_ = flip Homomorphic\n\n-- Group homomorphisms.\n\n_→ᴳ_ : Group g₁ → Group g₂ → Type (g₁ ⊔ g₂)\n_→ᴳ_ = _↝[ implication ]ᴳ_\n\n-- Group isomorphisms.\n\n_≃ᴳ_ : Group g₁ → Group g₂ → Type (g₁ ⊔ g₂)\n_≃ᴳ_ = _↝[ equivalence ]ᴳ_\n\n-- \"Functions\" of type G₁ ↝[ k ]ᴳ G₂ can be converted to group\n-- homomorphisms.\n\n↝ᴳ→→ᴳ : G₁ ↝[ k ]ᴳ G₂ → G₁ →ᴳ G₂\n↝ᴳ→→ᴳ f .related = to f\n↝ᴳ→→ᴳ f .homomorphic = f .homomorphic\n\n-- _↝[ k ]ᴳ_ is reflexive.\n\n↝ᴳ-refl : G ↝[ k ]ᴳ G\n↝ᴳ-refl .related = F.id\n↝ᴳ-refl {G = G} {k = k} .homomorphic x y =\n to-implication {k = k} F.id (x ∘ y) ≡⟨ cong (_$ _) $ to-implication-id k ⟩\n\n x ∘ y ≡⟨ sym $ cong₂ (λ f g → f _ ∘ g _)\n (to-implication-id k)\n (to-implication-id k) ⟩∎\n to-implication {k = k} F.id x ∘\n to-implication {k = k} F.id y ∎\n where\n open Group G\n\n-- _↝[ k ]ᴳ_ is transitive.\n\n↝ᴳ-trans : G₁ ↝[ k ]ᴳ G₂ → G₂ ↝[ k ]ᴳ G₃ → G₁ ↝[ k ]ᴳ G₃\n↝ᴳ-trans {G₁ = G₁} {k = k} {G₂ = G₂} {G₃ = G₃}\n G₁↝G₂ G₂↝G₃ = λ where\n .related → G₂↝G₃ .related F.∘ G₁↝G₂ .related\n .homomorphic x y →\n to-implication (G₂↝G₃ .related F.∘ G₁↝G₂ .related) (x G₁.∘ y) ≡⟨ cong (_$ _) $ to-implication-∘ k ⟩\n\n to G₂↝G₃ (to G₁↝G₂ (x G₁.∘ y)) ≡⟨ cong (to G₂↝G₃) $ homomorphic G₁↝G₂ _ _ ⟩\n\n to G₂↝G₃ (to G₁↝G₂ x G₂.∘ to G₁↝G₂ y) ≡⟨ homomorphic G₂↝G₃ _ _ ⟩\n\n to G₂↝G₃ (to G₁↝G₂ x) G₃.∘ to G₂↝G₃ (to G₁↝G₂ y) ≡⟨ sym $ cong₂ (λ f g → f _ G₃.∘ g _)\n (to-implication-∘ k)\n (to-implication-∘ k) ⟩∎\n to-implication (G₂↝G₃ .related F.∘ G₁↝G₂ .related) x G₃.∘\n to-implication (G₂↝G₃ .related F.∘ G₁↝G₂ .related) y ∎\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n module G₃ = Group G₃\n\n-- _≃ᴳ_ is symmetric.\n\n≃ᴳ-sym : G₁ ≃ᴳ G₂ → G₂ ≃ᴳ G₁\n≃ᴳ-sym {G₁ = G₁} {G₂ = G₂} G₁≃G₂ = λ where\n .related → inverse (G₁≃G₂ .related)\n .homomorphic x y → _≃_.injective (G₁≃G₂ .related)\n (to G₁≃G₂ (_≃_.from (G₁≃G₂ .related) (x G₂.∘ y)) ≡⟨ _≃_.right-inverse-of (G₁≃G₂ .related) _ ⟩\n\n x G₂.∘ y ≡⟨ sym $ cong₂ G₂._∘_\n (_≃_.right-inverse-of (G₁≃G₂ .related) _)\n (_≃_.right-inverse-of (G₁≃G₂ .related) _) ⟩\n to G₁≃G₂ (_≃_.from (G₁≃G₂ .related) x) G₂.∘\n to G₁≃G₂ (_≃_.from (G₁≃G₂ .related) y) ≡⟨ sym $ G₁≃G₂ .homomorphic _ _ ⟩∎\n\n to G₁≃G₂\n (_≃_.from (G₁≃G₂ .related) x G₁.∘ _≃_.from (G₁≃G₂ .related) y) ∎)\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n-- Group homomorphisms preserve identity elements.\n\n→ᴳ-id :\n (G₁↝G₂ : G₁ ↝[ k ]ᴳ G₂) →\n to G₁↝G₂ (Group.id G₁) ≡ Group.id G₂\n→ᴳ-id {G₁ = G₁} {G₂ = G₂} G₁↝G₂ =\n G₂.idempotent⇒≡id\n (to G₁↝G₂ G₁.id G₂.∘ to G₁↝G₂ G₁.id ≡⟨ sym $ G₁↝G₂ .homomorphic _ _ ⟩\n to G₁↝G₂ (G₁.id G₁.∘ G₁.id) ≡⟨ cong (to G₁↝G₂) $ G₁.left-identity _ ⟩∎\n to G₁↝G₂ G₁.id ∎)\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n-- Group homomorphisms are homomorphic with respect to the inverse\n-- operators.\n\n→ᴳ-⁻¹ :\n ∀ (G₁↝G₂ : G₁ ↝[ k ]ᴳ G₂) x →\n to G₁↝G₂ (Group._⁻¹ G₁ x) ≡ Group._⁻¹ G₂ (to G₁↝G₂ x)\n→ᴳ-⁻¹ {G₁ = G₁} {G₂ = G₂} G₁↝G₂ x = G₂.⁻¹∘≡id→≡\n (to G₁↝G₂ x G₂.⁻¹ G₂.⁻¹ G₂.∘ to G₁↝G₂ (x G₁.⁻¹) ≡⟨ cong (G₂._∘ to G₁↝G₂ (x G₁.⁻¹)) $ G₂.involutive _ ⟩\n to G₁↝G₂ x G₂.∘ to G₁↝G₂ (x G₁.⁻¹) ≡⟨ sym $ G₁↝G₂ .homomorphic _ _ ⟩\n to G₁↝G₂ (x G₁.∘ x G₁.⁻¹) ≡⟨ cong (to G₁↝G₂) (G₁.right-inverse _) ⟩\n to G₁↝G₂ G₁.id ≡⟨ →ᴳ-id G₁↝G₂ ⟩∎\n G₂.id ∎)\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n-- Group homomorphisms are homomorphic with respect to exponentiation.\n\n→ᴳ-^ :\n ∀ (G₁↝G₂ : G₁ ↝[ k ]ᴳ G₂) x i →\n to G₁↝G₂ (Group._^_ G₁ x i) ≡\n Group._^_ G₂ (to G₁↝G₂ x) i\n→ᴳ-^ {G₁ = G₁} {G₂ = G₂} G₁↝G₂ x = lemma₂\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n lemma₁ : ∀ n → to G₁↝G₂ (y G₁.^+ n) ≡ to G₁↝G₂ y G₂.^+ n\n lemma₁ zero =\n to G₁↝G₂ G₁.id ≡⟨ →ᴳ-id G₁↝G₂ ⟩∎\n G₂.id ∎\n lemma₁ {y = y} (suc n) =\n to G₁↝G₂ (y G₁.∘ y G₁.^+ n) ≡⟨ G₁↝G₂ .homomorphic _ _ ⟩\n to G₁↝G₂ y G₂.∘ to G₁↝G₂ (y G₁.^+ n) ≡⟨ cong (_ G₂.∘_) $ lemma₁ n ⟩∎\n to G₁↝G₂ y G₂.∘ to G₁↝G₂ y G₂.^+ n ∎\n\n lemma₂ : ∀ i → to G₁↝G₂ (x G₁.^ i) ≡ to G₁↝G₂ x G₂.^ i\n lemma₂ (+ n) = lemma₁ n\n lemma₂ -[1+ n ] =\n to G₁↝G₂ ((x G₁.⁻¹) G₁.^+ suc n) ≡⟨ lemma₁ (suc n) ⟩\n to G₁↝G₂ (x G₁.⁻¹) G₂.^+ suc n ≡⟨ cong (G₂._^+ suc n) $ →ᴳ-⁻¹ G₁↝G₂ _ ⟩∎\n (to G₁↝G₂ x G₂.⁻¹) G₂.^+ suc n ∎\n\n-- Group equality can be expressed in terms of equality of pairs of\n-- carrier types and binary operators (assuming extensionality).\n\n≡≃,∘≡,∘ :\n {G₁ G₂ : Group g} →\n Extensionality g g →\n let module G₁ = Group G₁\n module G₂ = Group G₂\n in\n (G₁ ≡ G₂) ≃ ((G₁.Carrier , G₁._∘_) ≡ (G₂.Carrier , G₂._∘_))\n≡≃,∘≡,∘ {g = g} {G₁ = G₁} {G₂ = G₂} ext =\n G₁ ≡ G₂ ↝⟨ inverse $ Eq.≃-≡ Group≃ ⟩\n\n ((G₁.Carrier , G₁._∘_) , _) ≡ ((G₂.Carrier , G₂._∘_) , _) ↔⟨ (inverse $\n ignore-propositional-component $\n The-rest-propositional _) ⟩□\n (G₁.Carrier , G₁._∘_) ≡ (G₂.Carrier , G₂._∘_) □\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n Carrier-∘ = ∃ λ (C : Type g) → (C → C → C)\n\n The-rest : Carrier-∘ → Type g\n The-rest (C , _∘_) =\n ∃ λ ((id , _⁻¹) : C ⊗ (C → C)) →\n Is-set C ⊗\n (∀ x → (id ∘ x) ≡ x) ⊗\n (∀ x → (x ∘ id) ≡ x) ⊗\n (∀ x y z → (x ∘ (y ∘ z)) ≡ ((x ∘ y) ∘ z)) ⊗\n (∀ x → ((x ⁻¹) ∘ x) ≡ id) ⊗\n (∀ x → (x ∘ (x ⁻¹)) ≡ id)\n\n Group≃ : Group g ≃ Σ Carrier-∘ The-rest\n Group≃ = Eq.↔→≃\n (λ G → let open Group G in\n (Carrier , _∘_)\n , (id , _⁻¹)\n , Carrier-is-set , left-identity , right-identity , assoc\n , left-inverse , right-inverse)\n _\n refl\n refl\n\n The-rest-propositional : ∀ C → Is-proposition (The-rest C)\n The-rest-propositional C R₁ R₂ =\n Σ-≡,≡→≡\n (cong₂ _,_ id-unique inverse-unique)\n ((×-closure 1 (H-level-propositional ext 2) $\n ×-closure 1 (Π-closure ext 1 λ _ →\n G₂′.Carrier-is-set) $\n ×-closure 1 (Π-closure ext 1 λ _ →\n G₂′.Carrier-is-set) $\n ×-closure 1 (Π-closure ext 1 λ _ →\n Π-closure ext 1 λ _ →\n Π-closure ext 1 λ _ →\n G₂′.Carrier-is-set) $\n ×-closure 1 (Π-closure ext 1 λ _ →\n G₂′.Carrier-is-set) $\n (Π-closure ext 1 λ _ →\n G₂′.Carrier-is-set))\n _ _)\n where\n module G₁′ = Group (_≃_.from Group≃ (C , R₁))\n module G₂′ = Group (_≃_.from Group≃ (C , R₂))\n\n id-unique : G₁′.id ≡ G₂′.id\n id-unique = G₂′.idempotent⇒≡id (G₁′.left-identity G₁′.id)\n\n inverse-unique : G₁′._⁻¹ ≡ G₂′._⁻¹\n inverse-unique = apply-ext ext λ x → G₂′.⁻¹-unique-right\n (x G₁′.∘ x G₁′.⁻¹ ≡⟨ G₁′.right-inverse _ ⟩\n G₁′.id ≡⟨ id-unique ⟩∎\n G₂′.id ∎)\n\n-- Group isomorphisms are equivalent to equalities (assuming\n-- extensionality and univalence).\n\n≃ᴳ≃≡ :\n {G₁ G₂ : Group g} →\n Extensionality g g →\n Univalence g →\n (G₁ ≃ᴳ G₂) ≃ (G₁ ≡ G₂)\n≃ᴳ≃≡ {G₁ = G₁} {G₂ = G₂} ext univ =\n G₁ ≃ᴳ G₂ ↝⟨ Homomorphic-as-Σ ⟩\n\n (∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →\n ∀ x y →\n _≃_.to eq (x G₁.∘ y) ≡ _≃_.to eq x G₂.∘ _≃_.to eq y) ↝⟨ (∃-cong λ eq → Π-cong ext eq λ _ → Π-cong ext eq λ _ →\n ≡⇒≃ $ sym $ cong (_≡ _≃_.to eq _ G₂.∘ _≃_.to eq _) $ cong (_≃_.to eq) $\n cong₂ G₁._∘_\n (_≃_.left-inverse-of eq _)\n (_≃_.left-inverse-of eq _)) ⟩\n (∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →\n ∀ x y → _≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y) ≡ x G₂.∘ y) ↝⟨ (∃-cong λ _ → ∀-cong ext λ _ →\n Eq.extensionality-isomorphism ext) ⟩\n (∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →\n ∀ x →\n (λ y → _≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y)) ≡ (x G₂.∘_)) ↝⟨ (∃-cong λ _ →\n Eq.extensionality-isomorphism ext) ⟩\n (∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →\n (λ x y → _≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y)) ≡ G₂._∘_) ↝⟨ (∃-cong λ eq → ≡⇒≃ $ cong (_≡ _) $ sym $ lemma eq) ⟩\n\n (∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →\n subst (λ A → A → A → A) (≃⇒≡ univ eq) G₁._∘_ ≡ G₂._∘_) ↝⟨ (Σ-cong (inverse $ ≡≃≃ univ) λ _ → Eq.id) ⟩\n\n (∃ λ (eq : G₁.Carrier ≡ G₂.Carrier) →\n subst (λ A → A → A → A) eq G₁._∘_ ≡ G₂._∘_) ↔⟨ B.Σ-≡,≡↔≡ ⟩\n\n ((G₁.Carrier , G₁._∘_) ≡ (G₂.Carrier , G₂._∘_)) ↝⟨ inverse $ ≡≃,∘≡,∘ ext ⟩□\n\n G₁ ≡ G₂ □\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n lemma : ∀ _ → _\n lemma = λ eq → apply-ext ext λ x → apply-ext ext λ y →\n subst (λ A → A → A → A) (≃⇒≡ univ eq) G₁._∘_ x y ≡⟨ cong (_$ y) subst-→ ⟩\n\n subst (λ A → A → A) (≃⇒≡ univ eq)\n (subst P.id (sym (≃⇒≡ univ eq)) x G₁.∘_) y ≡⟨ subst-→ ⟩\n\n subst P.id (≃⇒≡ univ eq)\n (subst P.id (sym (≃⇒≡ univ eq)) x G₁.∘\n subst P.id (sym (≃⇒≡ univ eq)) y) ≡⟨ cong₂ (λ f g → f (g x G₁.∘ g y))\n (trans (apply-ext ext λ _ → subst-id-in-terms-of-≡⇒↝ equivalence) $\n cong _≃_.to $ _≃_.right-inverse-of (≡≃≃ univ) _)\n (trans (apply-ext ext λ _ → subst-id-in-terms-of-inverse∘≡⇒↝ equivalence) $\n cong _≃_.from $ _≃_.right-inverse-of (≡≃≃ univ) _) ⟩∎\n _≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y) ∎\n\n------------------------------------------------------------------------\n-- Abelian groups\n\n-- The property of being abelian.\n\nAbelian : Group g → Type g\nAbelian G =\n ∀ x y → x ∘ y ≡ y ∘ x\n where\n open Group G\n\n-- If two groups are isomorphic, and one is abelian, then the other\n-- one is abelian.\n\n≃ᴳ→Abelian→Abelian : G₁ ≃ᴳ G₂ → Abelian G₁ → Abelian G₂\n≃ᴳ→Abelian→Abelian {G₁ = G₁} {G₂ = G₂} G₁≃G₂ ∘-comm x y =\n _≃_.injective (G₂≃G₁ .related)\n (to G₂≃G₁ (x G₂.∘ y) ≡⟨ G₂≃G₁ .homomorphic _ _ ⟩\n to G₂≃G₁ x G₁.∘ to G₂≃G₁ y ≡⟨ ∘-comm _ _ ⟩\n to G₂≃G₁ y G₁.∘ to G₂≃G₁ x ≡⟨ sym $ G₂≃G₁ .homomorphic _ _ ⟩∎\n to G₂≃G₁ (y G₂.∘ x) ∎)\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n G₂≃G₁ = ≃ᴳ-sym G₁≃G₂\n\n------------------------------------------------------------------------\n-- A group construction\n\n-- The direct product of two groups.\n\ninfixr 2 _×_\n\n_×_ : Group g₁ → Group g₂ → Group (g₁ ⊔ g₂)\nG₁ × G₂ = λ where\n .Carrier → G₁.Carrier ⊗ G₂.Carrier\n .Carrier-is-set → ×-closure 2 G₁.Carrier-is-set G₂.Carrier-is-set\n ._∘_ → Σ-zip G₁._∘_ G₂._∘_\n .id → G₁.id , G₂.id\n ._⁻¹ → Σ-map G₁._⁻¹ G₂._⁻¹\n .left-identity _ → cong₂ _,_\n (G₁.left-identity _) (G₂.left-identity _)\n .right-identity _ → cong₂ _,_\n (G₁.right-identity _) (G₂.right-identity _)\n .assoc _ _ _ → cong₂ _,_ (G₁.assoc _ _ _) (G₂.assoc _ _ _)\n .left-inverse _ → cong₂ _,_\n (G₁.left-inverse _) (G₂.left-inverse _)\n .right-inverse _ → cong₂ _,_\n (G₁.right-inverse _) (G₂.right-inverse _)\n where\n open Group\n\n module G₁ = Group G₁\n module G₂ = Group G₂\n\n-- The direct product operator preserves group homomorphisms.\n\n↝-× :\n G₁ ↝[ k ]ᴳ G₂ → G₁′ ↝[ k ]ᴳ G₂′ →\n (G₁ × G₁′) ↝[ k ]ᴳ (G₂ × G₂′)\n↝-× {G₁ = G₁} {k = k} {G₂ = G₂} {G₁′ = G₁′} {G₂′ = G₂′}\n G₁↝G₂ G₁′↝G₂′ = λ where\n .related →\n G₁↝G₂ .related ×-cong G₁′↝G₂′ .related\n .homomorphic x@(x₁ , x₂) y@(y₁ , y₂) →\n to-implication (G₁↝G₂ .related ×-cong G₁′↝G₂′ .related)\n (Σ-zip (Group._∘_ G₁) (Group._∘_ G₁′) x y) ≡⟨ cong (_$ _) $ to-implication-×-cong k ⟩\n\n Σ-map (to G₁↝G₂) (to G₁′↝G₂′)\n (Σ-zip (Group._∘_ G₁) (Group._∘_ G₁′) x y) ≡⟨⟩\n\n to G₁↝G₂ (Group._∘_ G₁ x₁ y₁) ,\n to G₁′↝G₂′ (Group._∘_ G₁′ x₂ y₂) ≡⟨ cong₂ _,_\n (G₁↝G₂ .homomorphic _ _)\n (G₁′↝G₂′ .homomorphic _ _) ⟩\n Group._∘_ G₂ (to G₁↝G₂ x₁) (to G₁↝G₂ y₁) ,\n Group._∘_ G₂′ (to G₁′↝G₂′ x₂) (to G₁′↝G₂′ y₂) ≡⟨⟩\n\n Group._∘_ (G₂ × G₂′)\n (to G₁↝G₂ x₁ , to G₁′↝G₂′ x₂)\n (to G₁↝G₂ y₁ , to G₁′↝G₂′ y₂) ≡⟨ sym $ cong₂ (λ f g → Group._∘_ (G₂ × G₂′) (f _) (g _))\n (to-implication-×-cong k)\n (to-implication-×-cong k) ⟩∎\n Group._∘_ (G₂ × G₂′)\n (to-implication (G₁↝G₂ .related ×-cong G₁′↝G₂′ .related) x)\n (to-implication (G₁↝G₂ .related ×-cong G₁′↝G₂′ .related) y) ∎\n\n-- Exponentiation for the direct product of G₁ and G₂ can be expressed\n-- in terms of exponentiation for G₁ and exponentiation for G₂.\n\n^-× :\n ∀ (G₁ : Group g₁) (G₂ : Group g₂) {x y} i →\n Group._^_ (G₁ × G₂) (x , y) i ≡\n (Group._^_ G₁ x i , Group._^_ G₂ y i)\n^-× G₁ G₂ = helper\n where\n module G₁ = Group G₁\n module G₂ = Group G₂\n module G₁₂ = Group (G₁ × G₂)\n\n +-helper : ∀ n → (x , y) G₁₂.^+ n ≡ (x G₁.^+ n , y G₂.^+ n)\n +-helper zero = refl _\n +-helper {x = x} {y = y} (suc n) =\n (x , y) G₁₂.∘ (x , y) G₁₂.^+ n ≡⟨ cong (_ G₁₂.∘_) $ +-helper n ⟩\n (x , y) G₁₂.∘ (x G₁.^+ n , y G₂.^+ n) ≡⟨⟩\n (x G₁.∘ x G₁.^+ n , y G₂.∘ y G₂.^+ n) ∎\n\n helper : ∀ i → (x , y) G₁₂.^ i ≡ (x G₁.^ i , y G₂.^ i)\n helper (+ n) = +-helper n\n helper -[1+ n ] = +-helper (suc n)\n\n------------------------------------------------------------------------\n-- The centre of a group\n\n-- Centre ext G is the centre of the group G, sometimes denoted Z(G).\n\nCentre :\n Extensionality g g →\n Group g → Group g\nCentre ext G = λ where\n .Carrier → ∃ λ (x : Carrier) → ∀ y → x ∘ y ≡ y ∘ x\n .Carrier-is-set → Σ-closure 2 Carrier-is-set λ _ →\n Π-closure ext 2 λ _ →\n mono₁ 2 Carrier-is-set\n ._∘_ → Σ-zip _∘_ λ {x y} hyp₁ hyp₂ z →\n (x ∘ y) ∘ z ≡⟨ sym $ assoc _ _ _ ⟩\n x ∘ (y ∘ z) ≡⟨ cong (x ∘_) $ hyp₂ z ⟩\n x ∘ (z ∘ y) ≡⟨ assoc _ _ _ ⟩\n (x ∘ z) ∘ y ≡⟨ cong (_∘ y) $ hyp₁ z ⟩\n (z ∘ x) ∘ y ≡⟨ sym $ assoc _ _ _ ⟩∎\n z ∘ (x ∘ y) ∎\n .id → id\n , λ x →\n id ∘ x ≡⟨ left-identity _ ⟩\n x ≡⟨ sym $ right-identity _ ⟩∎\n x ∘ id ∎\n ._⁻¹ → Σ-map _⁻¹ λ {x} hyp y →\n x ⁻¹ ∘ y ≡⟨ cong (x ⁻¹ ∘_) $ sym $ involutive _ ⟩\n x ⁻¹ ∘ y ⁻¹ ⁻¹ ≡⟨ sym ∘⁻¹ ⟩\n (y ⁻¹ ∘ x) ⁻¹ ≡⟨ cong _⁻¹ $ sym $ hyp (y ⁻¹) ⟩\n (x ∘ y ⁻¹) ⁻¹ ≡⟨ ∘⁻¹ ⟩\n y ⁻¹ ⁻¹ ∘ x ⁻¹ ≡⟨ cong (_∘ x ⁻¹) $ involutive _ ⟩∎\n y ∘ x ⁻¹ ∎\n .left-identity → λ _ →\n Σ-≡,≡→≡ (left-identity _)\n ((Π-closure ext 1 λ _ → Carrier-is-set) _ _)\n .right-identity → λ _ →\n Σ-≡,≡→≡ (right-identity _)\n ((Π-closure ext 1 λ _ → Carrier-is-set) _ _)\n .assoc → λ _ _ _ →\n Σ-≡,≡→≡ (assoc _ _ _)\n ((Π-closure ext 1 λ _ → Carrier-is-set) _ _)\n .left-inverse → λ _ →\n Σ-≡,≡→≡ (left-inverse _)\n ((Π-closure ext 1 λ _ → Carrier-is-set) _ _)\n .right-inverse → λ _ →\n Σ-≡,≡→≡ (right-inverse _)\n ((Π-closure ext 1 λ _ → Carrier-is-set) _ _)\n where\n open Group G\n\n-- The centre of an abelian group is isomorphic to the group.\n\nAbelian→Centre≃ :\n (ext : Extensionality g g) (G : Group g) →\n Abelian G → Centre ext G ≃ᴳ G\nAbelian→Centre≃ ext G abelian = ≃ᴳ-sym λ where\n .Homomorphic.related → inverse equiv\n .Homomorphic.homomorphic _ _ →\n cong (_ ,_) ((Π-closure ext 1 λ _ → Carrier-is-set) _ _)\n where\n open Group G\n\n equiv =\n (∃ λ (x : Carrier) → ∀ y → x ∘ y ≡ y ∘ x) ↔⟨ (drop-⊤-right λ _ →\n _⇔_.to contractible⇔↔⊤ $\n Π-closure ext 0 λ _ →\n propositional⇒inhabited⇒contractible\n Carrier-is-set\n (abelian _ _)) ⟩□\n Carrier □\n", "meta": {"hexsha": "68a5b529d6bf7f0e484fab197dd411a859882011", "size": 21900, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Group.agda", "max_stars_repo_name": "nad/equality", "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_issues_repo_path": "src/Group.agda", "max_issues_repo_name": "nad/equality", "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Group.agda", "max_forks_repo_name": "nad/equality", "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.960591133, "max_line_length": 147, "alphanum_fraction": 0.4346118721, "num_tokens": 8775, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8539127529517043, "lm_q2_score": 0.8031737963569014, "lm_q1q2_score": 0.6858403475457933}} {"text": "{-# OPTIONS --without-K #-}\nmodule algebra.monoid.core where\n\nopen import level\nopen import algebra.semigroup\nopen import equality.core\nopen import sum\n\nrecord IsMonoid {i} (M : Set i) : Set i where\n field\n instance sgrp : IsSemigroup M\n\n open IsSemigroup sgrp public\n field\n e : M\n lunit : (x : M) → e * x ≡ x\n runit : (x : M) → x * e ≡ x\n\nMonoid : ∀ i → Set (lsuc i)\nMonoid i = Σ (Set i) IsMonoid\n", "meta": {"hexsha": "af2323e90725f2a075d41f50b9971fddf4e1e8cd", "size": 415, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/algebra/monoid/core.agda", "max_stars_repo_name": "pcapriotti/agda-base", "max_stars_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2015-06-12T12:20:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-01T11:25:54.000Z", "max_issues_repo_path": "src/algebra/monoid/core.agda", "max_issues_repo_name": "pcapriotti/agda-base", "max_issues_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-02T14:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-26T11:57:26.000Z", "max_forks_repo_path": "src/algebra/monoid/core.agda", "max_forks_repo_name": "pcapriotti/agda-base", "max_forks_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-02-02T12:17:00.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-04T19:31:00.000Z", "avg_line_length": 19.7619047619, "max_line_length": 45, "alphanum_fraction": 0.6361445783, "num_tokens": 141, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9263037282594921, "lm_q2_score": 0.7401743735019595, "lm_q1q2_score": 0.6856262817369989}} {"text": "module Tactic.Nat.Coprime.Problem where\n\nopen import Prelude\nopen import Prelude.List.Relations.All\nopen import Numeric.Nat.GCD\n\nAtom = Nat\n\ninfixl 7 _⊗_\ninfix 3 _⋈_\ninfix 2 _⊨_\n\ndata Exp : Set where\n atom : (x : Atom) → Exp\n _⊗_ : (a b : Exp) → Exp\n\ndata Formula : Set where\n _⋈_ : (a b : Exp) → Formula\n\ndata Problem : Set where\n _⊨_ : (Γ : List Formula) (φ : Formula) → Problem\n\nEnv = Atom → Nat\n\n⟦_⟧e_ : Exp → Env → Nat\n⟦ atom x ⟧e ρ = ρ x\n⟦ e ⊗ e₁ ⟧e ρ = ⟦ e ⟧e ρ * ⟦ e₁ ⟧e ρ\n\n⟦_⟧f_ : Formula → Env → Set\n⟦ a ⋈ b ⟧f ρ = Coprime (⟦ a ⟧e ρ) (⟦ b ⟧e ρ)\n\n⟦_⟧p'_ : Problem → Env → Set\n⟦ Γ ⊨ φ ⟧p' ρ = All (⟦_⟧f ρ) Γ → ⟦ φ ⟧f ρ\n\n⟦_⟧p_ : Problem → Env → Set\n⟦ Γ ⊨ φ ⟧p ρ = foldr (λ ψ A → ⟦ ψ ⟧f ρ → A) (⟦ φ ⟧f ρ) Γ\n\ncurryProblem : ∀ Q ρ → ⟦ Q ⟧p' ρ → ⟦ Q ⟧p ρ\ncurryProblem ([] ⊨ φ) ρ H = H []\ncurryProblem (x ∷ Γ ⊨ φ) ρ H = λ x → curryProblem (Γ ⊨ φ) ρ (H ∘ (x ∷_))\n", "meta": {"hexsha": "f52fd7b4de1c5a98dc0246b5be0155cb7dc44957", "size": 873, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Tactic/Nat/Coprime/Problem.agda", "max_stars_repo_name": "t-more/agda-prelude", "max_stars_repo_head_hexsha": "da4fca7744d317b8843f2bc80a923972f65548d3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Tactic/Nat/Coprime/Problem.agda", "max_issues_repo_name": "t-more/agda-prelude", "max_issues_repo_head_hexsha": "da4fca7744d317b8843f2bc80a923972f65548d3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Tactic/Nat/Coprime/Problem.agda", "max_forks_repo_name": "t-more/agda-prelude", "max_forks_repo_head_hexsha": "da4fca7744d317b8843f2bc80a923972f65548d3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.2926829268, "max_line_length": 72, "alphanum_fraction": 0.5406643757, "num_tokens": 455, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9046505453836383, "lm_q2_score": 0.7577943822145997, "lm_q1q2_score": 0.6855391011590949}} {"text": "module InductiveAndCoinductiveConstructors where\n\nopen import Common.Coinduction\n\nrecord ⊤ : Set where\n\ndata _×_ (A : Set) (B : Set) : Set where\n _,_ : (x : A) (y : B) → A × B\n\ndata Stream (A : Set) : Set where\n _≺_ : (x : A) (xs : ∞ (Stream A)) → Stream A\n\ndata U : Set where\n stream : (a : U) → U\n _⊗_ : (a b : U) → U\n unit : U\n\nEl : U → Set\nEl (stream a) = Stream (El a)\nEl (a ⊗ b) = El a × El b\nEl unit = ⊤\n\nmutual\n\n data WHNF : U → Set where\n _≺_ : ∀ {a} → El a → Prog (stream a) → WHNF (stream a)\n _,_ : ∀ {a b} → WHNF a → WHNF b → WHNF (a ⊗ b)\n\n data Prog : U → Set where\n ↓_ : ∀ {a} → ∞ (WHNF a) → Prog a\n fst : ∀ {a b} → Prog (a ⊗ b) → Prog a\n snd : ∀ {a b} → Prog (a ⊗ b) → Prog b\n lab : Prog (stream unit) → Prog (stream (stream unit)) →\n Prog (stream unit ⊗ stream (stream unit))\n\nwhnf : ∀ {a} → Prog a → WHNF a\nwhnf (↓ w) = ♭ w\nwhnf (fst p) with whnf p\n... | (x , y) = x\nwhnf (snd p) with whnf p\n... | (x , y) = y\nwhnf (lab xs lss) with whnf xs | whnf lss\n... | _ ≺ xs′ | (x ≺ ls) ≺ lss′ =\n ((_ ≺ fst (lab xs′ lss′)) , (♭ ls ≺ snd (lab xs′ lss′)))\n\n⟦_⟧ : Prog (stream unit) → Stream ⊤\n⟦ p ⟧ with whnf p\n... | x ≺ xs = x ≺ ♯ ⟦ xs ⟧\n\ndata _≈_ : Stream ⊤ → Stream ⊤ → Set where\n cons : ∀ {xs xs′} → ∞ ((♭ xs) ≈ (♭ xs′)) → (_ ≺ xs) ≈ (_ ≺ xs′)\n\nlemma : ∀ xs lss → ⟦ fst (lab xs lss) ⟧ ≈ ⟦ xs ⟧\nlemma xs lss with whnf xs | whnf lss\n... | _ ≺ xs′ | (x ≺ ls) ≺ lss′ = cons (♯ lemma xs′ lss′)\n\nlabel : Prog (stream unit) → Stream ⊤ →\n Prog (stream unit ⊗ stream (stream unit))\nlabel xs ls = lab xs (↓ (♯ (ls ≺ snd (label xs ls))))\n\nshape-preserved : ∀ xs ls → ⟦ fst (label xs ls) ⟧ ≈ ⟦ xs ⟧\nshape-preserved xs ls = lemma xs _\n", "meta": {"hexsha": "29777d5862ca3b41952909c2a7f1d6048660dd7f", "size": 1691, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/InductiveAndCoinductiveConstructors.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/succeed/InductiveAndCoinductiveConstructors.agda", "max_issues_repo_name": "asr/agda-kanso", "max_issues_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/InductiveAndCoinductiveConstructors.agda", "max_forks_repo_name": "asr/agda-kanso", "max_forks_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.8412698413, "max_line_length": 65, "alphanum_fraction": 0.5026611473, "num_tokens": 744, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9046505428129514, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.6855390843657826}} {"text": "-- Copyright: (c) 2016 Ertugrul Söylemez\n-- License: BSD3\n-- Maintainer: Ertugrul Söylemez \n\nmodule Algebra.Group.Group where\n\nopen import Algebra.Category\nopen import Algebra.Group.Monoid\nopen import Algebra.Group.Semigroup\nopen import Core\n\n\n-- A group is a monoid where every element has an inverse.\n\nrecord IsGroup {a r} (S : Semigroup {a} {r}) : Set (a ⊔ r) where\n open Semigroup S\n\n field isMonoid : IsMonoid S\n open IsMonoid isMonoid\n\n field iso : ∀ x → Iso x\n\n inv : A → A\n inv x = Iso.inv (iso x)\n\n field inv-cong : ∀ {x y} → x ≈ y → inv x ≈ inv y\n\n groupoid : Groupoid\n groupoid =\n record {\n category = category;\n iso = iso;\n inv-cong = inv-cong\n }\n\n open Groupoid groupoid public\n using (inv-invol)\n\n\nrecord Group {a r} : Set (lsuc (a ⊔ r)) where\n field semigroup : Semigroup {a} {r}\n open Semigroup semigroup public\n\n field isGroup : IsGroup semigroup\n open IsGroup isGroup public\n\n monoid : Monoid\n monoid =\n record {\n semigroup = semigroup;\n isMonoid = isMonoid\n }\n\n\n-- A group morphism is a function that maps the elements of one group to\n-- another while preserving the compositional structure, the identity\n-- and all inverses.\n\nrecord GroupMorphism\n {ga gr ha hr}\n (G : Group {ga} {gr})\n (H : Group {ha} {hr})\n : Set (ga ⊔ gr ⊔ ha ⊔ hr)\n where\n\n private\n module G = Group G\n module H = Group H\n\n field monoidMorphism : MonoidMorphism G.monoid H.monoid\n open MonoidMorphism monoidMorphism public\n\n field inv-preserving : ∀ x → map (G.inv x) H.≈ H.inv (map x)\n", "meta": {"hexsha": "a1f090286614174154855fa705bab23fc19b63c9", "size": 1607, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Algebra/Group/Group.agda", "max_stars_repo_name": "esoeylemez/agda-simple", "max_stars_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-10-07T17:36:42.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-07T17:36:42.000Z", "max_issues_repo_path": "Algebra/Group/Group.agda", "max_issues_repo_name": "esoeylemez/agda-simple", "max_issues_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Algebra/Group/Group.agda", "max_forks_repo_name": "esoeylemez/agda-simple", "max_forks_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.7162162162, "max_line_length": 72, "alphanum_fraction": 0.6453018046, "num_tokens": 495, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9046505351008904, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6855390834700464}} {"text": "{-# OPTIONS --type-in-type #-}\n\n\nmodule z where\n\n{-\nGeneric Programming with Dependent Types\nStephanie Weirich and Chris Casinghino, University of Pennsylvania, {sweirich,ccasin}@cis.upenn.edu\n\nccasin@cis.upenn.edu\n\n2010 : https://www.seas.upenn.edu/~sweirich/papers/aritygen.pdf\n2012 : https://www.cis.upenn.edu/~sweirich/papers/ssgip-journal.pdf\n\n------------------------------------------------------------------------------\n-- Abstract and Intro\n\n2 types of genericity\n- datatype\n - operate on type structure of data\n - so no need to define for each new type\n- arity\n - enables functions to be applied to a variable number of args.\n\ne.g., generalize arity of map\nrepeat :: a → [a]\nmap :: (a → b) → [a] → [b]\nzipWith :: (a → b → c) → [a] → [b] → [c]\nzipWith3 :: (a → b → c → d) → [a] → [b] → [c] → [d]\n\n\ncode : http://www.seas.upenn.edu/~sweirich/papers/aritygen-lncs.tar.gz\ntested with : Agda version 2.2.10\n\n------------------------------------------------------------------------------\n2 SIMPLE TYPE-GENERIC PROGRAMMING IN AGDA\n\nusing Agda with flags (which implies cannot do proofs)\n{-# OPTIONS --type-in-type #-}\n–no-termination-check\n{-# OPTIONS --no-positivity-check #-}\n-}\n\ndata Bool : Set where\n true : Bool\n false : Bool\n\n¬ : Bool → Bool\n¬ true = false\n¬ false = true\n\n_∧_ : Bool → Bool → Bool\ntrue ∧ true = true\n_ ∧ _ = false\n\nif_then_else : ∀ {A : Set} → Bool → A → A → A\nif true then a1 else a2 = a1\nif false then a1 else a2 = a2\n\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n{-# BUILTIN NATURAL ℕ #-}\n\n_+_ : ℕ → ℕ → ℕ\nzero + m = m\nsuc n + m = suc (n + m)\ninfixl 40 _+_\n\ndata List (A : Set) : Set where\n [] : List A\n _::_ : A → List A → List A\ninfixr 5 _::_ -- https://agda.github.io/agda-stdlib/Data.Vec.Functional.html\n\nreplicate : ∀ {A} → ℕ → A → List A\nreplicate zero _ = []\nreplicate (suc n) x = x :: replicate n x\n\ndata Vec (A : Set) : ℕ → Set where\n [] : Vec A zero\n _::_ : ∀ {n} → A → (Vec A n) → Vec A (suc n)\n\nrepeat : ∀ {n} {A} → A → Vec A n\nrepeat {zero} x = []\nrepeat {suc n} x = x :: repeat x\n\n------------------------------------------------------------------------------\n-- 2.1 BASIC TYPE-GENERIC PROGRAMMING\n\neq-bool : Bool → Bool → Bool\neq-bool true true = true\neq-bool false false = true\neq-bool _ _ = false\n\neq-nat : ℕ → ℕ → Bool\neq-nat zero zero = true\neq-nat (suc n) (suc m) = eq-nat n m\neq-nat _ _ = false\n\n{-\nStructural equality functions, like above, motivate type-generic programming:\n- enables defining functions that observe and use structure of types\n\nIn a dependently typed language, type-generic is accomplished using universes [17, 21].\n\nE.G., universe of natural number, boolean and product types\n-}\n\n-- datatype 'Type', called a \"universe\"\ndata Type : Set where\n TNat : Type\n TBool : Type\n TProd : Type → Type → Type\n\nopen import Data.Product\n\n-- define an interpretation function '⟨_⟩'\n-- maps elements of this universe to Agda types\n⟨_⟩ : Type → Set\n⟨ TNat ⟩ = ℕ\n⟨ TBool ⟩ = Bool\n⟨ TProd t1 t2 ⟩ = ⟨ t1 ⟩ × ⟨ t2 ⟩\n\ngeq : (t : Type) → ⟨ t ⟩ → ⟨ t ⟩ → Bool\ngeq TNat n1 n2 = eq-nat n1 n2\ngeq TBool b1 b2 = eq-bool b1 b2\ngeq (TProd a b) (a1 , b1) (a2 , b2) = geq a a1 a2 ∧ geq b b1 b2\n\ngeqEx : Bool\ngeqEx = geq (TProd TNat TBool) (1 , false) (1 , false)\n\n{-\n------------------------------------------------------------------------------\n-- 3 ARITY-GENERIC PROGRAMMING : generalize over number of arguments\n\ne.g., map-like (above), +, foldl, foldr\n\ne.g., generalize following functions into one definition : maps for vectors\n-}\n\n-- infix zipping application, pronounced “zap” for “zip with apply”\n_⊗_ : {A B : Set} {n : ℕ} → Vec (A → B) n → Vec A n → Vec B n\n[] ⊗ [] = []\n(a :: As) ⊗ (b :: Bs) = a b :: As ⊗ Bs\ninfixl 40 _⊗_\n\nmap0 : {m : ℕ} {A : Set} → A → Vec A m\nmap0 = repeat\n\nmap1 : {m : ℕ} {A B : Set} → (A → B) → Vec A m → Vec B m\nmap1 f x = repeat f ⊗ x\n\nmap2 : {m : ℕ} {A B C : Set} → (A → B → C) → Vec A m → Vec B m → Vec C m\nmap2 f x1 x2 = repeat f ⊗ x1 ⊗ x2\n\n{-\nIntuitively, each map defined by a application of repeat and n copies of _⊗_.\nnvec-map f n v1 v2 ... vn = repeat f ⊗ v1 ⊗ v2 ⊗ ... ⊗ vn\n\n-- recursion on n in accumulator style\n-- after repeating f : have a vector of functions\n-- then zap this vector across n argument vectors\n-- NEEDS type declaration - given below (in Arity section)\nnvec-map n f = g n (repeat f)\n where\n g0 a = a\n g (suc n) f = (λ a → g n (f ⊗ a))\n\n--------------------------------------------------\n3.1 Typing Arity-Generic Vector Map\n\narity-generic map : instances have different types\n\nGiven arity n, generate corresponding type in the sequence\n\nPart of the difficulty is that generic function is curried in both its type and term args.\n\nThis subsection starts with an initial def that takes\n- all of the type args in a vector,\n- curries term arguments\n\nnext subsection, shows how to uncurry type args\n\nℕ for arity\n\nstore types in vector of Agda types, Bool :: N :: [].\n\nvector has type Vec Set 2, so can use standard vector operations (such as _⊗_)\n\n(given in OPTIONS at top of file)\n--type-in-type : gives Set the type Set\n- simplifies presentation by hiding Agda’s infinite hierarchy of Set levels\n- at cost of making Agda’s logic inconsistent\n-}\n\n-- folds arrow type constructor (→) over vector of types\n-- used to construct the type of 1sr arg to nvec-map\narrTy : {n : ℕ} → Vec Set (suc n) → Set\narrTy {0} (A :: []) = A\narrTy {suc n} (A :: As) = A → arrTy As\n\narrTyTest : Set\narrTyTest = arrTy (ℕ :: ℕ :: Bool :: [])\n-- C-c C-n arrTyTest\n-- ℕ → ℕ → Bool\n\n-- Constructs result type of arity-generic map for vectors.\n-- Map Vec constructor onto the vector of types, then placing arrows between them.\n-- There are two indices:\n-- - n : number of types (the arity)\n-- - m : length of vectors to be mapped over\narrTyVec : {n : ℕ} → ℕ → Vec Set (suc n) → Set\narrTyVec m As = arrTy (repeat (λ A → Vec A m) ⊗ As)\n\n{- alternate type sigs of previous mapN examples:\nmap0' : {m : ℕ} {A : Set} → arrTy (A :: []) → arrTyVec m (A :: [])\nmap1' : {m : ℕ} {A B : Set} → arrTy (A :: B :: []) → arrTyVec m (A :: B :: [])\nmap2' : {m : ℕ} {A B C : Set} → arrTy (A :: B :: C :: []) → arrTyVec m (A :: B :: C :: [])\n-}\n\nnvec-map : {m : ℕ}\n → (n : ℕ) → {As : Vec Set (suc n)}\n → arrTy As → arrTyVec m As\nnvec-map n f = g n (repeat f)\n where\n g : {m : ℕ}\n → (n : ℕ) → {As : Vec Set (suc n)}\n → Vec (arrTy As) m → arrTyVec m As\n g 0 {A :: []} a = a\n g (suc n) {A :: As} f = (λ a → g n (f ⊗ a))\n\nnvec-map-Test : Vec ℕ 2 -- 11 :: 15 :: []\nnvec-map-Test = nvec-map 1 { ℕ :: ℕ :: [] } (λ x → 10 + x) (1 :: 5 :: [])\n\n{-\nannoying : must explicitly supply types\nnext section : enable inference\n\n--------------------------------------------------\n3.2 A Curried Vector Map\n\nCurry type args so they are supplied individually (rather than a ector).\nEnables inference (usually).\n-}\n\n-- quantify : creates curried version of a type which depends on a vector\n∀⇒ : {n : ℕ} {A : Set} → (Vec A n → Set)\n → Set\n∀⇒ {zero} B = B []\n∀⇒ {suc n} {A} B = (a : A) → ∀⇒ {n} (λ as → B (a :: as))\n\n-- curry : creates curried version of a corresponding function term\nλ⇒ : {n : ℕ} {A : Set} {B : Vec A n → Set}\n → ((X : Vec A n) → B X)\n → (∀⇒ B)\nλ⇒ {zero} f = f []\nλ⇒ {suc n} {A} f = (λ a → λ⇒ {n} (λ as → f (a :: as))) -- **** HERE\n-- 'a' is implicit in paper\n-- Victor says 'hidden' lambdas are magic.\n-- see: Eliminating the problems of hidden-lambda insertion\n-- https://www.cse.chalmers.se/~abela/MScThesisJohanssonLloyd.pdf\n\n-- uncurry (from 2010 paper)\n/⇒ : (n : ℕ) → {K : Set} {B : Vec K n → Set}\n → (∀⇒ B)\n → (A : Vec K n)\n → B A\n/⇒ (zero) f [] = f\n/⇒ (suc n) f (a :: as) = /⇒ n (f a) as\n\n-- arity-generic map\nnmap : {m : ℕ}\n → (n : ℕ) -- specifies arity\n → ∀⇒ (λ (As : Vec Set (suc n)) → arrTy As → arrTyVec m As)\nnmap {m} n = λ⇒ (λ As → nvec-map {m} n {As})\n\n{-\nnmap 1\nhas type\n{m : N} → {A B : Set} → (A → B) → (Vec A m) → (Vec B m)\nC-c C-d\n(a a₁ : Set) → (a → a₁) → arrTyVec _m_193 (a :: a₁ :: [])\n\n\nnmap 1 (λ x → 10 + x) (10 :: 5 :: [])\nevaluates to\n11 :: 15 :: []\nC-c C-d\n(x : ℕ) → ℕ !=< Set\nwhen checking that the expression λ x → 10 + x has type Set\n\nnmap 2\nhas type\n{m : N} → {ABC : Set} → (A → B → C) → Vec A m → Vec B m → Vec C m\nC-c C-d\n(a a₁ a₂ : Set) → (a → a₁ → a₂) → arrTyVec _m_193 (a :: a₁ :: a₂ :: [])\n\nnmap 2 ( , ) (1 :: 2 :: 3 :: []) (4 :: 5 :: 6 :: [])\nevaluates to\n(1 , 4) :: (2 , 5) :: (3 , 6) :: []\n\nnow : do not need to explicitly specify type of data in vectors\n-}\n", "meta": {"hexsha": "37606314b2a1dc7c8b78d3f4c7cd65e883934c5c", "size": 8672, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/paper/2012-Stephanie_Weirich_and_Casinghino-Generic_Programming_with_Dependent_Types/z.agda", "max_stars_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_stars_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2015-01-29T14:37:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T06:55:03.000Z", "max_issues_repo_path": "agda/paper/2012-Stephanie_Weirich_and_Casinghino-Generic_Programming_with_Dependent_Types/z.agda", "max_issues_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_issues_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/paper/2012-Stephanie_Weirich_and_Casinghino-Generic_Programming_with_Dependent_Types/z.agda", "max_forks_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_forks_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2015-04-13T21:40:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-21T15:58:10.000Z", "avg_line_length": 28.5263157895, "max_line_length": 99, "alphanum_fraction": 0.5513145756, "num_tokens": 2989, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8615381987656672, "lm_q2_score": 0.7956580952177051, "lm_q1q2_score": 0.6854898421871833}} {"text": "open import FRP.LTL.Time using ( Time ; _,_ )\nopen import FRP.LTL.Time.Bound using \n ( Time∞ ; _≼_ ; _≺_ ; fin ; +∞ ; +∞-top ; t≺+∞ ; ≼-refl ; _≼-trans_ \n ; ≡-impl-≼ ; ≺-impl-≼ ; _≺-trans_ ; _≺-transʳ_ ; ≺-impl-⋡ ; t≺t+1 )\nopen import FRP.LTL.Util using ( irrelevant ; ⊥-elim )\nopen import Relation.Unary using ( _∈_ )\nopen import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; sym )\n\nmodule FRP.LTL.Time.Interval where\n\ninfixr 2 _⊑_ _~_\ninfixr 4 _,_ _⌢_∵_\n\n-- Semi-open intervals, with possibly infinite bounds\n\n-- Previous versions of Interval used ≼ rather than ≺ \n-- (that is, empty intervals were supported) but\n-- MSet has been written to avoid requiring empty intervals.\n\ndata Interval : Set where\n [_⟩ : ∀ {s t} → .(s ≺ t) → Interval\n\nlb : Interval → Time∞\nlb ([_⟩ {s} {t} s≺t) = s\n\nub : Interval → Time∞\nub ([_⟩ {s} {t} s≺t) = t\n\n.lb≺ub : ∀ i → (lb i ≺ ub i)\nlb≺ub [ s≺t ⟩ = irrelevant s≺t\n\n-- Semantics of intervals\n\ndata Int∞ (i : Interval) (t : Time∞) : Set where\n _,_ : .(lb i ≼ t) → .(t ≺ ub i) → (t ∈ Int∞ i)\n\nInt : Interval → Time → Set\nInt i t = fin t ∈ Int∞ i\n\n.lb≼ : ∀ {t i} → (t ∈ Int i) → (lb i ≼ fin t)\nlb≼ (s≼t , t≺u) = irrelevant s≼t\n\n.≺ub : ∀ {t i} → (t ∈ Int i) → (fin t ≺ ub i)\n≺ub (s≼t , t≺u) = irrelevant t≺u\n\n-- Ordering on intervals\n\ndata _⊑_ (i j : Interval) : Set where\n _,_ : .(lb j ≼ lb i) → .(ub i ≼ ub j) → (i ⊑ j)\n\n⊑-refl : ∀ {i} → (i ⊑ i)\n⊑-refl = (≼-refl , ≼-refl)\n\n_⊑-trans_ : ∀ {i j k} → (i ⊑ j) → (j ⊑ k) → (i ⊑ k)\n(sj≼si , ui≼uj) ⊑-trans (sk≼sj , uj≼uk) =\n (sk≼sj ≼-trans sj≼si , ui≼uj ≼-trans uj≼uk)\n\n.⊑-impl-≼ : ∀ {i j} → (i ⊑ j) → (ub i ≼ ub j)\n⊑-impl-≼ (lj≼li , ui≼uj) = irrelevant ui≼uj\n\n.⊑-impl-≽ : ∀ {i j} → (i ⊑ j) → (lb j ≼ lb i)\n⊑-impl-≽ (lj≼li , ui≼uj) = irrelevant lj≼li\n\n-- When do two intervals abut?\n\n_~_ : Interval → Interval → Set\ni ~ j = ub i ≡ lb j\n\n-- Concatenation of intervals\n\n_⌢_∵_ : ∀ i j → (i ~ j) → Interval\ni ⌢ j ∵ i~j = [ lb≺ub i ≺-trans ≡-impl-≼ i~j ≺-transʳ lb≺ub j ⟩\n\n⌢-inj₁ : ∀ i j i~j → (i ⊑ (i ⌢ j ∵ i~j))\n⌢-inj₁ [ s≺t ⟩ [ t≺u ⟩ refl = (≼-refl , ≺-impl-≼ t≺u)\n\n⌢-inj₂ : ∀ i j i~j → (j ⊑ (i ⌢ j ∵ i~j))\n⌢-inj₂ [ s≺t ⟩ [ t≺u ⟩ refl = (≺-impl-≼ s≺t , ≼-refl)\n\n-- Up-closure of a time\n\n↑ : Time → Interval\n↑ t = [ t≺+∞ {t} ⟩\n\n-- Singleton interval\n\nsing : Time → Interval\nsing t = [ t≺t+1 {t} ⟩", "meta": {"hexsha": "7914e4de7abcc6836bc7fe5d51882f5113f63d06", "size": 2288, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/FRP/LTL/Time/Interval.agda", "max_stars_repo_name": "agda/agda-frp-ltl", "max_stars_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-02T20:25:05.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-15T02:51:13.000Z", "max_issues_repo_path": "src/FRP/LTL/Time/Interval.agda", "max_issues_repo_name": "agda/agda-frp-ltl", "max_issues_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2015-03-01T07:01:31.000Z", "max_issues_repo_issues_event_max_datetime": "2015-03-02T15:23:53.000Z", "max_forks_repo_path": "src/FRP/LTL/Time/Interval.agda", "max_forks_repo_name": "agda/agda-frp-ltl", "max_forks_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-03-01T07:33:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:04.000Z", "avg_line_length": 26.0, "max_line_length": 76, "alphanum_fraction": 0.5323426573, "num_tokens": 1134, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869916479466, "lm_q2_score": 0.7826624840223698, "lm_q1q2_score": 0.6854456223576604}} {"text": "open import Data.Product renaming (_,_ to _,,_) -- just to avoid clash with other commas\nopen import Algebra.Structures using (IsSemigroup)\nopen import Algebra.FunctionProperties using (LeftIdentity; Commutative)\n\nmodule Preliminaries where\n\nRel : Set -> Set₁\nRel A = A -> A -> Set\n\nEntire : {A B : Set} -> (_R_ : A -> B -> Set) -> Set\nEntire _R_ = ∀ a -> ∃ \\ b -> a R b\n\nfun : {A B : Set} -> {_R_ : A -> B -> Set} -> Entire _R_ -> A -> B\nfun ent a = proj₁ (ent a)\n\ncorrect : {A B : Set} -> {_R_ : A -> B -> Set} -> (ent : Entire _R_) ->\n let f = fun ent in ∀ {a : A} -> a R (f a)\ncorrect ent {a} = proj₂ (ent a)\n\nEntire3 : {A B C D : Set} -> (R : A -> B -> C -> D -> Set) -> Set\nEntire3 R = ∀ x y z -> ∃ (R x y z)\n\nfun3 : {A B C D : Set} -> {R : A -> B -> C -> D -> Set} -> Entire3 R -> A -> B -> C -> D\nfun3 ent a b c = proj₁ (ent a b c)\n\ncorrect3 : {A B C D : Set} -> {R : A -> B -> C -> D -> Set} -> (e : Entire3 R) ->\n ∀ {a : A} {b : B} {c : C} -> R a b c (fun3 e a b c)\ncorrect3 ent {a} {b} {c} = proj₂ (ent a b c)\n\nUniqueSolution : {A : Set} -> Rel A -> (A -> Set) -> Set\nUniqueSolution _≃_ P = ∀ {x y} -> P x -> P y -> x ≃ y\n\nLowerBound : {A : Set} -> Rel A -> (A -> Set) -> (A -> Set)\nLowerBound _≤_ P a = ∀ z -> (P z -> a ≤ z)\n\nLeast : {A : Set} -> Rel A -> (A -> Set) -> (A -> Set)\nLeast _≤_ P a = P a × LowerBound _≤_ P a\n", "meta": {"hexsha": "859673747c960e3e10198ba67960ce69c7cb5728", "size": 1382, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "code/Preliminaries.agda", "max_stars_repo_name": "DSLsofMath/ValiantAgda", "max_stars_repo_head_hexsha": "43729ff822a0b05c6cb74016b04bdc93c627b0b1", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2016-10-23T00:41:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-15T03:04:31.000Z", "max_issues_repo_path": "code/Preliminaries.agda", "max_issues_repo_name": "DSLsofMath/ValiantAgda", "max_issues_repo_head_hexsha": "43729ff822a0b05c6cb74016b04bdc93c627b0b1", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "code/Preliminaries.agda", "max_forks_repo_name": "DSLsofMath/ValiantAgda", "max_forks_repo_head_hexsha": "43729ff822a0b05c6cb74016b04bdc93c627b0b1", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-04-29T04:53:48.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-29T04:53:48.000Z", "avg_line_length": 36.3684210526, "max_line_length": 88, "alphanum_fraction": 0.489146165, "num_tokens": 538, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869851639066, "lm_q2_score": 0.7826624840223698, "lm_q1q2_score": 0.6854456172828455}} {"text": "open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl; sym)\n\nmodule AKS.Nat.Combinatorial where\n\nopen import AKS.Nat.Base using (ℕ; _+_; _∸_; _*_; _≤_)\nopen ℕ\nopen import AKS.Nat.Properties using (*-identityʳ)\nopen import AKS.Nat.Properties using (0≤n; ≤-refl; m≤m+n; *-mono-≤; module ≤-Reasoning)\nopen import AKS.Nat.Properties using (<-irrefl; *-mono-<)\nopen import AKS.Nat.Divisibility using (_/_)\nopen ≤-Reasoning\n\n_C_ : ℕ → ℕ → ℕ\nn C zero = 1\nzero C suc k = 0\nsuc n C suc k = n C k + n C (suc k)\n\n_! : ℕ → ℕ\nzero ! = 1\nsuc n ! = suc n * n !\n\n1≤n! : ∀ n → 1 ≤ n !\n1≤n! zero = ≤-refl\n1≤n! (suc n) = begin\n 1 ≤⟨ 1≤n! n ⟩\n n ! ≤⟨ m≤m+n ⟩\n n ! + n * n ! ≡⟨ refl ⟩\n (1 + n) ! ∎\n\nn≤n! : ∀ n → n ≤ n !\nn≤n! zero = 0≤n\nn≤n! (suc n) = begin\n suc n ≡⟨ sym (*-identityʳ (suc n)) ⟩\n suc n * 1 ≤⟨ *-mono-≤ (≤-refl {suc n}) (1≤n! n) ⟩\n (1 + n) ! ∎\n\n_C′_ : ℕ → ℕ → ℕ\nn C′ k = (n ! / (k ! * (n ∸ k) !)) {≢⇒¬≟ den≢0}\n where\n den≢0 : k ! * (n ∸ k) ! ≢ 0\n den≢0 den≡0 = <-irrefl (sym den≡0) (*-mono-< (1≤n! k) (1≤n! (n ∸ k)))\n\nnC′0≡1 : ∀ {n} → n C′ 0 ≡ 1\nnC′0≡1 {n} = lemma num≡dem\n where\n num≡dem : n ! ≡ (0 ! * (n ∸ 0) !)\n num≡dem = sym (+-identityʳ (n !))\n lemma : ∀ {num dem} .{dem≢0} → num ≡ dem → (num / dem) {dem≢0} ≡ 1\n lemma {num} {_} {dem≢0} refl = n/n≡1 num {dem≢0}\n\n-- 0C′n≡0 : ∀ {k} → 0 C′ k ≡ 0\n-- 0C′n≡0 {k} = {!0/n≡0 (k ! * (0 ∸ k) !) {?}!}\n\n-- lem : ∀ {n k} → n C k ≡ n C′ k\n-- lem {n} {zero} = sym (nC′0≡1 {n})\n-- lem {zero} {suc k} = {!refl!}\n-- lem {suc n} {suc k} with lem {n} {k} | lem {n} {suc k}\n-- ... | p₁ | p₂ = {!!}\n\n", "meta": {"hexsha": "e8fa8d881fb5767d4ec9effdf9e31727d94eb613", "size": 1563, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "proofs/AKS/Nat/Combinatorial.agda", "max_stars_repo_name": "mckeankylej/thesis", "max_stars_repo_head_hexsha": "ddad4c0d5f384a0219b2177461a68dae06952dde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-12-01T22:38:27.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-01T22:38:27.000Z", "max_issues_repo_path": "proofs/AKS/Nat/Combinatorial.agda", "max_issues_repo_name": "mckeankylej/thesis", "max_issues_repo_head_hexsha": "ddad4c0d5f384a0219b2177461a68dae06952dde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "proofs/AKS/Nat/Combinatorial.agda", "max_forks_repo_name": "mckeankylej/thesis", "max_forks_repo_head_hexsha": "ddad4c0d5f384a0219b2177461a68dae06952dde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.05, "max_line_length": 87, "alphanum_fraction": 0.4856046065, "num_tokens": 836, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869851639066, "lm_q2_score": 0.7826624789529375, "lm_q1q2_score": 0.6854456128431027}} {"text": "{-# OPTIONS --without-K --exact-split --safe #-}\n\nmodule 06-universes where\n\nimport 05-identity-types\nopen 05-identity-types public\n\n--------------------------------------------------------------------------------\n\n-- Section 6.3 Observational equality on the natural numbers\n\n-- Definition 6.3.1\n\nEq-ℕ : ℕ → ℕ → UU lzero\nEq-ℕ zero-ℕ zero-ℕ = 𝟙\nEq-ℕ zero-ℕ (succ-ℕ n) = 𝟘\nEq-ℕ (succ-ℕ m) zero-ℕ = 𝟘\nEq-ℕ (succ-ℕ m) (succ-ℕ n) = Eq-ℕ m n\n\n-- Lemma 6.3.2\n\nrefl-Eq-ℕ : (n : ℕ) → Eq-ℕ n n\nrefl-Eq-ℕ zero-ℕ = star\nrefl-Eq-ℕ (succ-ℕ n) = refl-Eq-ℕ n\n\n-- Proposition 6.3.3\n\nEq-ℕ-eq : {x y : ℕ} → Id x y → Eq-ℕ x y\nEq-ℕ-eq {x} {.x} refl = refl-Eq-ℕ x\n\neq-Eq-ℕ : (x y : ℕ) → Eq-ℕ x y → Id x y\neq-Eq-ℕ zero-ℕ zero-ℕ e = refl\neq-Eq-ℕ (succ-ℕ x) (succ-ℕ y) e = ap succ-ℕ (eq-Eq-ℕ x y e)\n\n--------------------------------------------------------------------------------\n\n-- Section 6.4 Peano's seventh and eighth axioms\n\n-- Theorem 6.4.1\n\nis-injective-succ-ℕ : (x y : ℕ) → Id (succ-ℕ x) (succ-ℕ y) → Id x y\nis-injective-succ-ℕ x y e = eq-Eq-ℕ x y (Eq-ℕ-eq e)\n\nPeano-7 :\n (x y : ℕ) →\n ((Id x y) → (Id (succ-ℕ x) (succ-ℕ y))) ×\n ((Id (succ-ℕ x) (succ-ℕ y)) → (Id x y))\nPeano-7 x y = pair (ap succ-ℕ) (is-injective-succ-ℕ x y)\n\n-- Theorem 6.4.2\n\nPeano-8 :\n (x : ℕ) → ¬ (Id zero-ℕ (succ-ℕ x))\nPeano-8 x p = Eq-ℕ-eq p\n\n--------------------------------------------------------------------------------\n\n-- Exercises\n\n-- Exercise 6.1\n\n-- Exercise 6.1 (a)\n\nis-injective-add-ℕ :\n (k m n : ℕ) → Id (add-ℕ m k) (add-ℕ n k) → Id m n\nis-injective-add-ℕ zero-ℕ m n = id\nis-injective-add-ℕ (succ-ℕ k) m n p =\n is-injective-add-ℕ k m n (is-injective-succ-ℕ (add-ℕ m k) (add-ℕ n k) p)\n\n-- Exercise 6.1 (b)\n\nis-injective-mul-ℕ :\n (k m n : ℕ) → Id (mul-ℕ m (succ-ℕ k)) (mul-ℕ n (succ-ℕ k)) → Id m n\nis-injective-mul-ℕ k zero-ℕ zero-ℕ p = refl\nis-injective-mul-ℕ k (succ-ℕ m) (succ-ℕ n) p =\n ap succ-ℕ\n ( is-injective-mul-ℕ k m n\n ( is-injective-add-ℕ\n ( succ-ℕ k)\n ( mul-ℕ m (succ-ℕ k))\n ( mul-ℕ n (succ-ℕ k))\n ( ( inv (left-successor-law-mul-ℕ m (succ-ℕ k))) ∙\n ( ( p) ∙\n ( left-successor-law-mul-ℕ n (succ-ℕ k))))))\n\n-- Exercise 6.1 (c)\n\nneq-add-ℕ :\n (m n : ℕ) → ¬ (Id m (add-ℕ m (succ-ℕ n)))\nneq-add-ℕ (succ-ℕ m) n p =\n neq-add-ℕ m n\n ( ( is-injective-succ-ℕ m (add-ℕ (succ-ℕ m) n) p) ∙\n ( left-successor-law-add-ℕ m n))\n\n-- Exercise 6.1 (d)\n\nneq-mul-ℕ :\n (m n : ℕ) → ¬ (Id (succ-ℕ m) (mul-ℕ (succ-ℕ m) (succ-ℕ (succ-ℕ n))))\nneq-mul-ℕ m n p =\n neq-add-ℕ\n ( succ-ℕ m)\n ( add-ℕ (mul-ℕ m (succ-ℕ n)) n)\n ( ( p) ∙\n ( ( right-successor-law-mul-ℕ (succ-ℕ m) (succ-ℕ n)) ∙\n ( ap (add-ℕ (succ-ℕ m)) (left-successor-law-mul-ℕ m (succ-ℕ n)))))\n\n-- Exercise 6.2\n\n-- Exercise 6.2 (a)\n\nEq-𝟚 : bool → bool → UU lzero\nEq-𝟚 true true = unit\nEq-𝟚 true false = empty\nEq-𝟚 false true = empty\nEq-𝟚 false false = unit\n\n-- Exercise 6.2 (b)\n\nreflexive-Eq-𝟚 : (x : bool) → Eq-𝟚 x x\nreflexive-Eq-𝟚 true = star\nreflexive-Eq-𝟚 false = star\n\nEq-eq-𝟚 :\n {x y : bool} → Id x y → Eq-𝟚 x y\nEq-eq-𝟚 {x = x} refl = reflexive-Eq-𝟚 x\n\neq-Eq-𝟚 :\n {x y : bool} → Eq-𝟚 x y → Id x y\neq-Eq-𝟚 {true} {true} star = refl\neq-Eq-𝟚 {false} {false} star = refl\n\n-- Exercise 6.2 (c)\n\nneq-neg-𝟚 : (b : bool) → ¬ (Id b (neg-𝟚 b))\nneq-neg-𝟚 true = Eq-eq-𝟚\nneq-neg-𝟚 false = Eq-eq-𝟚\n\nneq-false-true-𝟚 :\n ¬ (Id false true)\nneq-false-true-𝟚 = Eq-eq-𝟚\n\n-- Exercise 6.3\n\n-- Exercise 6.3 (a)\n\nleq-ℕ : ℕ → ℕ → UU lzero\nleq-ℕ zero-ℕ m = unit\nleq-ℕ (succ-ℕ n) zero-ℕ = empty\nleq-ℕ (succ-ℕ n) (succ-ℕ m) = leq-ℕ n m\n\n_≤_ = leq-ℕ\n\n-- Some trivialities that will be useful later\n\nleq-zero-ℕ :\n (n : ℕ) → leq-ℕ zero-ℕ n\nleq-zero-ℕ n = star\n\neq-leq-zero-ℕ :\n (x : ℕ) → leq-ℕ x zero-ℕ → Id zero-ℕ x\neq-leq-zero-ℕ zero-ℕ star = refl\n\nsucc-leq-ℕ : (n : ℕ) → leq-ℕ n (succ-ℕ n)\nsucc-leq-ℕ zero-ℕ = star\nsucc-leq-ℕ (succ-ℕ n) = succ-leq-ℕ n\n\nconcatenate-eq-leq-eq-ℕ :\n {x1 x2 x3 x4 : ℕ} → Id x1 x2 → leq-ℕ x2 x3 → Id x3 x4 → leq-ℕ x1 x4\nconcatenate-eq-leq-eq-ℕ refl H refl = H\n\nconcatenate-leq-eq-ℕ :\n (m : ℕ) {n n' : ℕ} → leq-ℕ m n → Id n n' → leq-ℕ m n'\nconcatenate-leq-eq-ℕ m H refl = H\n\nconcatenate-eq-leq-ℕ :\n {m m' : ℕ} (n : ℕ) → Id m' m → leq-ℕ m n → leq-ℕ m' n\nconcatenate-eq-leq-ℕ n refl H = H\n\n-- Exercise 6.3 (b)\n\nreflexive-leq-ℕ : (n : ℕ) → leq-ℕ n n\nreflexive-leq-ℕ zero-ℕ = star\nreflexive-leq-ℕ (succ-ℕ n) = reflexive-leq-ℕ n\n\nleq-eq-ℕ : (m n : ℕ) → Id m n → leq-ℕ m n\nleq-eq-ℕ m .m refl = reflexive-leq-ℕ m\n\ntransitive-leq-ℕ :\n (n m l : ℕ) → (n ≤ m) → (m ≤ l) → (n ≤ l)\ntransitive-leq-ℕ zero-ℕ m l p q = star\ntransitive-leq-ℕ (succ-ℕ n) (succ-ℕ m) (succ-ℕ l) p q =\n transitive-leq-ℕ n m l p q\n\npreserves-leq-succ-ℕ :\n (m n : ℕ) → leq-ℕ m n → leq-ℕ m (succ-ℕ n)\npreserves-leq-succ-ℕ m n p = transitive-leq-ℕ m n (succ-ℕ n) p (succ-leq-ℕ n)\n\nanti-symmetric-leq-ℕ : (m n : ℕ) → leq-ℕ m n → leq-ℕ n m → Id m n\nanti-symmetric-leq-ℕ zero-ℕ zero-ℕ p q = refl\nanti-symmetric-leq-ℕ (succ-ℕ m) (succ-ℕ n) p q =\n ap succ-ℕ (anti-symmetric-leq-ℕ m n p q)\n\n-- Exercise 6.3 (c)\n\ndecide-leq-ℕ :\n (m n : ℕ) → coprod (leq-ℕ m n) (leq-ℕ n m)\ndecide-leq-ℕ zero-ℕ zero-ℕ = inl star\ndecide-leq-ℕ zero-ℕ (succ-ℕ n) = inl star\ndecide-leq-ℕ (succ-ℕ m) zero-ℕ = inr star\ndecide-leq-ℕ (succ-ℕ m) (succ-ℕ n) = decide-leq-ℕ m n\n\n-- Exercise 6.3 (d)\n\npreserves-order-add-ℕ :\n (k m n : ℕ) → leq-ℕ m n → leq-ℕ (add-ℕ m k) (add-ℕ n k)\npreserves-order-add-ℕ zero-ℕ m n = id\npreserves-order-add-ℕ (succ-ℕ k) m n = preserves-order-add-ℕ k m n\n\nreflects-order-add-ℕ :\n (k m n : ℕ) → leq-ℕ (add-ℕ m k) (add-ℕ n k) → leq-ℕ m n\nreflects-order-add-ℕ zero-ℕ m n = id\nreflects-order-add-ℕ (succ-ℕ k) m n = reflects-order-add-ℕ k m n\n\n-- Exercise 6.3 (e)\n\npreserves-order-mul-ℕ :\n (k m n : ℕ) → leq-ℕ m n → leq-ℕ (mul-ℕ m k) (mul-ℕ n k)\npreserves-order-mul-ℕ k zero-ℕ n p = star\npreserves-order-mul-ℕ k (succ-ℕ m) (succ-ℕ n) p =\n preserves-order-add-ℕ k\n ( mul-ℕ m k)\n ( mul-ℕ n k)\n ( preserves-order-mul-ℕ k m n p)\n\nreflects-order-mul-ℕ :\n (k m n : ℕ) → leq-ℕ (mul-ℕ m (succ-ℕ k)) (mul-ℕ n (succ-ℕ k)) → leq-ℕ m n\nreflects-order-mul-ℕ k zero-ℕ n p = star\nreflects-order-mul-ℕ k (succ-ℕ m) (succ-ℕ n) p =\n reflects-order-mul-ℕ k m n\n ( reflects-order-add-ℕ\n ( succ-ℕ k)\n ( mul-ℕ m (succ-ℕ k))\n ( mul-ℕ n (succ-ℕ k))\n ( p))\n\n-- Exercise 6.3 (f)\n\nleq-min-ℕ :\n (k m n : ℕ) → leq-ℕ k m → leq-ℕ k n → leq-ℕ k (min-ℕ m n)\nleq-min-ℕ zero-ℕ zero-ℕ zero-ℕ H K = star\nleq-min-ℕ zero-ℕ zero-ℕ (succ-ℕ n) H K = star\nleq-min-ℕ zero-ℕ (succ-ℕ m) zero-ℕ H K = star\nleq-min-ℕ zero-ℕ (succ-ℕ m) (succ-ℕ n) H K = star\nleq-min-ℕ (succ-ℕ k) (succ-ℕ m) (succ-ℕ n) H K = leq-min-ℕ k m n H K\n\nleq-left-leq-min-ℕ :\n (k m n : ℕ) → leq-ℕ k (min-ℕ m n) → leq-ℕ k m\nleq-left-leq-min-ℕ zero-ℕ zero-ℕ zero-ℕ H = star\nleq-left-leq-min-ℕ zero-ℕ zero-ℕ (succ-ℕ n) H = star\nleq-left-leq-min-ℕ zero-ℕ (succ-ℕ m) zero-ℕ H = star\nleq-left-leq-min-ℕ zero-ℕ (succ-ℕ m) (succ-ℕ n) H = star\nleq-left-leq-min-ℕ (succ-ℕ k) (succ-ℕ m) (succ-ℕ n) H =\n leq-left-leq-min-ℕ k m n H\n\nleq-right-leq-min-ℕ :\n (k m n : ℕ) → leq-ℕ k (min-ℕ m n) → leq-ℕ k n\nleq-right-leq-min-ℕ zero-ℕ zero-ℕ zero-ℕ H = star\nleq-right-leq-min-ℕ zero-ℕ zero-ℕ (succ-ℕ n) H = star\nleq-right-leq-min-ℕ zero-ℕ (succ-ℕ m) zero-ℕ H = star\nleq-right-leq-min-ℕ zero-ℕ (succ-ℕ m) (succ-ℕ n) H = star\nleq-right-leq-min-ℕ (succ-ℕ k) (succ-ℕ m) (succ-ℕ n) H =\n leq-right-leq-min-ℕ k m n H\n\nleq-max-ℕ :\n (k m n : ℕ) → leq-ℕ m k → leq-ℕ n k → leq-ℕ (max-ℕ m n) k\nleq-max-ℕ zero-ℕ zero-ℕ zero-ℕ H K = star\nleq-max-ℕ (succ-ℕ k) zero-ℕ zero-ℕ H K = star\nleq-max-ℕ (succ-ℕ k) zero-ℕ (succ-ℕ n) H K = K\nleq-max-ℕ (succ-ℕ k) (succ-ℕ m) zero-ℕ H K = H\nleq-max-ℕ (succ-ℕ k) (succ-ℕ m) (succ-ℕ n) H K = leq-max-ℕ k m n H K\n\nleq-left-leq-max-ℕ :\n (k m n : ℕ) → leq-ℕ (max-ℕ m n) k → leq-ℕ m k\nleq-left-leq-max-ℕ k zero-ℕ zero-ℕ H = star\nleq-left-leq-max-ℕ k zero-ℕ (succ-ℕ n) H = star\nleq-left-leq-max-ℕ k (succ-ℕ m) zero-ℕ H = H\nleq-left-leq-max-ℕ (succ-ℕ k) (succ-ℕ m) (succ-ℕ n) H =\n leq-left-leq-max-ℕ k m n H\n\nleq-right-leq-max-ℕ :\n (k m n : ℕ) → leq-ℕ (max-ℕ m n) k → leq-ℕ n k\nleq-right-leq-max-ℕ k zero-ℕ zero-ℕ H = star\nleq-right-leq-max-ℕ k zero-ℕ (succ-ℕ n) H = H\nleq-right-leq-max-ℕ k (succ-ℕ m) zero-ℕ H = star\nleq-right-leq-max-ℕ (succ-ℕ k) (succ-ℕ m) (succ-ℕ n) H =\n leq-right-leq-max-ℕ k m n H\n\n-- Exercise 6.4\n\n-- Exercise 6.4 (a)\n\n-- We define a distance function on ℕ --\n\ndist-ℕ : ℕ → ℕ → ℕ\ndist-ℕ zero-ℕ n = n\ndist-ℕ (succ-ℕ m) zero-ℕ = succ-ℕ m\ndist-ℕ (succ-ℕ m) (succ-ℕ n) = dist-ℕ m n\n\ndist-ℕ' : ℕ → ℕ → ℕ\ndist-ℕ' m n = dist-ℕ n m\n\nap-dist-ℕ :\n {m n m' n' : ℕ} → Id m m' → Id n n' → Id (dist-ℕ m n) (dist-ℕ m' n')\nap-dist-ℕ refl refl = refl\n\n{- We show that two natural numbers are equal if and only if their distance is\n zero. -}\n\neq-dist-ℕ :\n (m n : ℕ) → Id zero-ℕ (dist-ℕ m n) → Id m n\neq-dist-ℕ zero-ℕ zero-ℕ p = refl\neq-dist-ℕ (succ-ℕ m) (succ-ℕ n) p = ap succ-ℕ (eq-dist-ℕ m n p)\n\ndist-eq-ℕ' :\n (n : ℕ) → Id zero-ℕ (dist-ℕ n n)\ndist-eq-ℕ' zero-ℕ = refl\ndist-eq-ℕ' (succ-ℕ n) = dist-eq-ℕ' n\n\ndist-eq-ℕ :\n (m n : ℕ) → Id m n → Id zero-ℕ (dist-ℕ m n)\ndist-eq-ℕ m .m refl = dist-eq-ℕ' m\n\n-- The distance function is symmetric --\n\nsymmetric-dist-ℕ :\n (m n : ℕ) → Id (dist-ℕ m n) (dist-ℕ n m)\nsymmetric-dist-ℕ zero-ℕ zero-ℕ = refl\nsymmetric-dist-ℕ zero-ℕ (succ-ℕ n) = refl\nsymmetric-dist-ℕ (succ-ℕ m) zero-ℕ = refl\nsymmetric-dist-ℕ (succ-ℕ m) (succ-ℕ n) = symmetric-dist-ℕ m n\n\n-- We compute the distance from zero --\n\nleft-zero-law-dist-ℕ :\n (n : ℕ) → Id (dist-ℕ zero-ℕ n) n\nleft-zero-law-dist-ℕ zero-ℕ = refl\nleft-zero-law-dist-ℕ (succ-ℕ n) = refl\n\nright-zero-law-dist-ℕ :\n (n : ℕ) → Id (dist-ℕ n zero-ℕ) n\nright-zero-law-dist-ℕ zero-ℕ = refl\nright-zero-law-dist-ℕ (succ-ℕ n) = refl\n\n-- We prove the triangle inequality --\n\nap-add-ℕ :\n {m n m' n' : ℕ} → Id m m' → Id n n' → Id (add-ℕ m n) (add-ℕ m' n')\nap-add-ℕ refl refl = refl\n\ntriangle-inequality-dist-ℕ :\n (m n k : ℕ) → leq-ℕ (dist-ℕ m n) (add-ℕ (dist-ℕ m k) (dist-ℕ k n))\ntriangle-inequality-dist-ℕ zero-ℕ zero-ℕ zero-ℕ = star\ntriangle-inequality-dist-ℕ zero-ℕ zero-ℕ (succ-ℕ k) = star\ntriangle-inequality-dist-ℕ zero-ℕ (succ-ℕ n) zero-ℕ =\n tr ( leq-ℕ (succ-ℕ n))\n ( inv (left-unit-law-add-ℕ (succ-ℕ n)))\n ( reflexive-leq-ℕ (succ-ℕ n))\ntriangle-inequality-dist-ℕ zero-ℕ (succ-ℕ n) (succ-ℕ k) =\n concatenate-eq-leq-eq-ℕ\n ( inv (ap succ-ℕ (left-zero-law-dist-ℕ n)))\n ( triangle-inequality-dist-ℕ zero-ℕ n k)\n ( ( ap (succ-ℕ ∘ (add-ℕ' (dist-ℕ k n))) (left-zero-law-dist-ℕ k)) ∙\n ( inv (left-successor-law-add-ℕ k (dist-ℕ k n))))\ntriangle-inequality-dist-ℕ (succ-ℕ m) zero-ℕ zero-ℕ = reflexive-leq-ℕ (succ-ℕ m)\ntriangle-inequality-dist-ℕ (succ-ℕ m) zero-ℕ (succ-ℕ k) =\n concatenate-eq-leq-eq-ℕ\n ( inv (ap succ-ℕ (right-zero-law-dist-ℕ m)))\n ( triangle-inequality-dist-ℕ m zero-ℕ k)\n ( ap (succ-ℕ ∘ (add-ℕ (dist-ℕ m k))) (right-zero-law-dist-ℕ k))\ntriangle-inequality-dist-ℕ (succ-ℕ m) (succ-ℕ n) zero-ℕ =\n concatenate-leq-eq-ℕ\n ( dist-ℕ m n)\n ( transitive-leq-ℕ\n ( dist-ℕ m n)\n ( succ-ℕ (add-ℕ (dist-ℕ m zero-ℕ) (dist-ℕ zero-ℕ n)))\n ( succ-ℕ (succ-ℕ (add-ℕ (dist-ℕ m zero-ℕ) (dist-ℕ zero-ℕ n)))) \n ( transitive-leq-ℕ\n ( dist-ℕ m n)\n ( add-ℕ (dist-ℕ m zero-ℕ) (dist-ℕ zero-ℕ n))\n ( succ-ℕ (add-ℕ (dist-ℕ m zero-ℕ) (dist-ℕ zero-ℕ n)))\n ( triangle-inequality-dist-ℕ m n zero-ℕ)\n ( succ-leq-ℕ (add-ℕ (dist-ℕ m zero-ℕ) (dist-ℕ zero-ℕ n))))\n ( succ-leq-ℕ (succ-ℕ (add-ℕ (dist-ℕ m zero-ℕ) (dist-ℕ zero-ℕ n)))))\n ( ( ap (succ-ℕ ∘ succ-ℕ)\n ( ap-add-ℕ (right-zero-law-dist-ℕ m) (left-zero-law-dist-ℕ n))) ∙\n ( inv (left-successor-law-add-ℕ m (succ-ℕ n))))\ntriangle-inequality-dist-ℕ (succ-ℕ m) (succ-ℕ n) (succ-ℕ k) =\n triangle-inequality-dist-ℕ m n k\n\n-- We show that dist-ℕ x y is a solution to a simple equation.\n\nleq-dist-ℕ :\n (x y : ℕ) → leq-ℕ x y → Id (add-ℕ x (dist-ℕ x y)) y\nleq-dist-ℕ zero-ℕ zero-ℕ H = refl\nleq-dist-ℕ zero-ℕ (succ-ℕ y) star = left-unit-law-add-ℕ (succ-ℕ y)\nleq-dist-ℕ (succ-ℕ x) (succ-ℕ y) H =\n ( left-successor-law-add-ℕ x (dist-ℕ x y)) ∙\n ( ap succ-ℕ (leq-dist-ℕ x y H))\n\nrewrite-left-add-dist-ℕ :\n (x y z : ℕ) → Id (add-ℕ x y) z → Id x (dist-ℕ y z)\nrewrite-left-add-dist-ℕ zero-ℕ zero-ℕ .zero-ℕ refl = refl\nrewrite-left-add-dist-ℕ zero-ℕ (succ-ℕ y) .(succ-ℕ (add-ℕ zero-ℕ y)) refl =\n ( dist-eq-ℕ' y) ∙\n ( inv (ap (dist-ℕ (succ-ℕ y)) (left-unit-law-add-ℕ (succ-ℕ y))))\nrewrite-left-add-dist-ℕ (succ-ℕ x) zero-ℕ .(succ-ℕ x) refl = refl\nrewrite-left-add-dist-ℕ\n (succ-ℕ x) (succ-ℕ y) .(succ-ℕ (add-ℕ (succ-ℕ x) y)) refl =\n rewrite-left-add-dist-ℕ (succ-ℕ x) y (add-ℕ (succ-ℕ x) y) refl\n\nrewrite-left-dist-add-ℕ :\n (x y z : ℕ) → leq-ℕ y z → Id x (dist-ℕ y z) → Id (add-ℕ x y) z\nrewrite-left-dist-add-ℕ .(dist-ℕ y z) y z H refl =\n ( commutative-add-ℕ (dist-ℕ y z) y) ∙\n ( leq-dist-ℕ y z H)\n\nrewrite-right-add-dist-ℕ :\n (x y z : ℕ) → Id (add-ℕ x y) z → Id y (dist-ℕ x z)\nrewrite-right-add-dist-ℕ x y z p =\n rewrite-left-add-dist-ℕ y x z (commutative-add-ℕ y x ∙ p)\n\nrewrite-right-dist-add-ℕ :\n (x y z : ℕ) → leq-ℕ x z → Id y (dist-ℕ x z) → Id (add-ℕ x y) z\nrewrite-right-dist-add-ℕ x .(dist-ℕ x z) z H refl =\n leq-dist-ℕ x z H\n\n-- We show that dist-ℕ is translation invariant\n\ntranslation-invariant-dist-ℕ :\n (k m n : ℕ) → Id (dist-ℕ (add-ℕ k m) (add-ℕ k n)) (dist-ℕ m n)\ntranslation-invariant-dist-ℕ zero-ℕ m n =\n ap-dist-ℕ (left-unit-law-add-ℕ m) (left-unit-law-add-ℕ n)\ntranslation-invariant-dist-ℕ (succ-ℕ k) m n =\n ( ap-dist-ℕ (left-successor-law-add-ℕ k m) (left-successor-law-add-ℕ k n)) ∙\n ( translation-invariant-dist-ℕ k m n)\n\n-- We show that dist-ℕ is linear with respect to scalar multiplication\n\nlinear-dist-ℕ :\n (m n k : ℕ) → Id (dist-ℕ (mul-ℕ k m) (mul-ℕ k n)) (mul-ℕ k (dist-ℕ m n))\nlinear-dist-ℕ zero-ℕ zero-ℕ zero-ℕ = refl\nlinear-dist-ℕ zero-ℕ zero-ℕ (succ-ℕ k) = linear-dist-ℕ zero-ℕ zero-ℕ k\nlinear-dist-ℕ zero-ℕ (succ-ℕ n) zero-ℕ = refl\nlinear-dist-ℕ zero-ℕ (succ-ℕ n) (succ-ℕ k) =\n ap (dist-ℕ' (mul-ℕ (succ-ℕ k) (succ-ℕ n))) (right-zero-law-mul-ℕ (succ-ℕ k))\nlinear-dist-ℕ (succ-ℕ m) zero-ℕ zero-ℕ = refl\nlinear-dist-ℕ (succ-ℕ m) zero-ℕ (succ-ℕ k) =\n ap (dist-ℕ (mul-ℕ (succ-ℕ k) (succ-ℕ m))) (right-zero-law-mul-ℕ (succ-ℕ k))\nlinear-dist-ℕ (succ-ℕ m) (succ-ℕ n) zero-ℕ = refl\nlinear-dist-ℕ (succ-ℕ m) (succ-ℕ n) (succ-ℕ k) =\n ( ap-dist-ℕ\n ( right-successor-law-mul-ℕ (succ-ℕ k) m)\n ( right-successor-law-mul-ℕ (succ-ℕ k) n)) ∙\n ( ( translation-invariant-dist-ℕ\n ( succ-ℕ k)\n ( mul-ℕ (succ-ℕ k) m)\n ( mul-ℕ (succ-ℕ k) n)) ∙\n ( linear-dist-ℕ m n (succ-ℕ k)))\n\n-- Exercise 6.6\n\n{- In this exercise we were asked to define the relations ≤ and < on the \n integers. As a criterion of correctness, we were then also asked to show \n that the type of all integers l satisfying k ≤ l satisfy the induction \n principle of the natural numbers. -}\n\ndiff-ℤ : ℤ → ℤ → ℤ\ndiff-ℤ k l = add-ℤ (neg-ℤ k) l\n\nis-non-negative-ℤ : ℤ → UU lzero\nis-non-negative-ℤ (inl x) = empty\nis-non-negative-ℤ (inr k) = unit\n\nleq-ℤ : ℤ → ℤ → UU lzero\nleq-ℤ k l = is-non-negative-ℤ (diff-ℤ k l)\n\nreflexive-leq-ℤ : (k : ℤ) → leq-ℤ k k\nreflexive-leq-ℤ k =\n tr is-non-negative-ℤ (inv (left-inverse-law-add-ℤ k)) star\n\nis-non-negative-succ-ℤ :\n (k : ℤ) → is-non-negative-ℤ k → is-non-negative-ℤ (succ-ℤ k)\nis-non-negative-succ-ℤ (inr (inl star)) p = star\nis-non-negative-succ-ℤ (inr (inr x)) p = star\n\nis-non-negative-add-ℤ :\n (k l : ℤ) →\n is-non-negative-ℤ k → is-non-negative-ℤ l → is-non-negative-ℤ (add-ℤ k l)\nis-non-negative-add-ℤ (inr (inl star)) (inr (inl star)) p q = star\nis-non-negative-add-ℤ (inr (inl star)) (inr (inr n)) p q = star\nis-non-negative-add-ℤ (inr (inr zero-ℕ)) (inr (inl star)) p q = star\nis-non-negative-add-ℤ (inr (inr (succ-ℕ n))) (inr (inl star)) star star =\n is-non-negative-succ-ℤ\n ( add-ℤ (inr (inr n)) (inr (inl star)))\n ( is-non-negative-add-ℤ (inr (inr n)) (inr (inl star)) star star)\nis-non-negative-add-ℤ (inr (inr zero-ℕ)) (inr (inr m)) star star = star\nis-non-negative-add-ℤ (inr (inr (succ-ℕ n))) (inr (inr m)) star star =\n is-non-negative-succ-ℤ\n ( add-ℤ (inr (inr n)) (inr (inr m)))\n ( is-non-negative-add-ℤ (inr (inr n)) (inr (inr m)) star star)\n\ntriangle-diff-ℤ :\n (k l m : ℤ) → Id (add-ℤ (diff-ℤ k l) (diff-ℤ l m)) (diff-ℤ k m)\ntriangle-diff-ℤ k l m =\n ( associative-add-ℤ (neg-ℤ k) l (diff-ℤ l m)) ∙\n ( ap\n ( add-ℤ (neg-ℤ k))\n ( ( inv (associative-add-ℤ l (neg-ℤ l) m)) ∙\n ( ( ap (λ x → add-ℤ x m) (right-inverse-law-add-ℤ l)) ∙\n ( left-unit-law-add-ℤ m))))\n\ntransitive-leq-ℤ : (k l m : ℤ) → leq-ℤ k l → leq-ℤ l m → leq-ℤ k m\ntransitive-leq-ℤ k l m p q =\n tr is-non-negative-ℤ\n ( triangle-diff-ℤ k l m)\n ( is-non-negative-add-ℤ\n ( add-ℤ (neg-ℤ k) l)\n ( add-ℤ (neg-ℤ l) m)\n ( p)\n ( q))\n\nsucc-leq-ℤ : (k : ℤ) → leq-ℤ k (succ-ℤ k)\nsucc-leq-ℤ k =\n tr is-non-negative-ℤ\n ( inv\n ( ( right-successor-law-add-ℤ (neg-ℤ k) k) ∙\n ( ap succ-ℤ (left-inverse-law-add-ℤ k))))\n ( star)\n\nleq-ℤ-succ-leq-ℤ : (k l : ℤ) → leq-ℤ k l → leq-ℤ k (succ-ℤ l)\nleq-ℤ-succ-leq-ℤ k l p = transitive-leq-ℤ k l (succ-ℤ l) p (succ-leq-ℤ l)\n\nis-positive-ℤ : ℤ → UU lzero\nis-positive-ℤ k = is-non-negative-ℤ (pred-ℤ k)\n\nle-ℤ : ℤ → ℤ → UU lzero\nle-ℤ (inl zero-ℕ) (inl x) = empty\nle-ℤ (inl zero-ℕ) (inr y) = unit\nle-ℤ (inl (succ-ℕ x)) (inl zero-ℕ) = unit\nle-ℤ (inl (succ-ℕ x)) (inl (succ-ℕ y)) = le-ℤ (inl x) (inl y)\nle-ℤ (inl (succ-ℕ x)) (inr y) = unit\nle-ℤ (inr x) (inl y) = empty\nle-ℤ (inr (inl star)) (inr (inl star)) = empty\nle-ℤ (inr (inl star)) (inr (inr x)) = unit\nle-ℤ (inr (inr x)) (inr (inl star)) = empty\nle-ℤ (inr (inr zero-ℕ)) (inr (inr zero-ℕ)) = empty\nle-ℤ (inr (inr zero-ℕ)) (inr (inr (succ-ℕ y))) = unit\nle-ℤ (inr (inr (succ-ℕ x))) (inr (inr zero-ℕ)) = empty\nle-ℤ (inr (inr (succ-ℕ x))) (inr (inr (succ-ℕ y))) =\n le-ℤ (inr (inr x)) (inr (inr y))\n\n-- Extra material\n\n-- We show that ℕ is an ordered semi-ring\n\nleft-law-leq-add-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (add-ℕ m k) (add-ℕ n k)\nleft-law-leq-add-ℕ zero-ℕ m n = id\nleft-law-leq-add-ℕ (succ-ℕ k) m n H = left-law-leq-add-ℕ k m n H\n\nright-law-leq-add-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (add-ℕ k m) (add-ℕ k n) \nright-law-leq-add-ℕ k m n H =\n concatenate-eq-leq-eq-ℕ\n ( commutative-add-ℕ k m)\n ( left-law-leq-add-ℕ k m n H)\n ( commutative-add-ℕ n k)\n\npreserves-leq-add-ℕ :\n {m m' n n' : ℕ} → leq-ℕ m m' → leq-ℕ n n' → leq-ℕ (add-ℕ m n) (add-ℕ m' n')\npreserves-leq-add-ℕ {m} {m'} {n} {n'} H K =\n transitive-leq-ℕ\n ( add-ℕ m n)\n ( add-ℕ m' n)\n ( add-ℕ m' n')\n ( left-law-leq-add-ℕ n m m' H)\n ( right-law-leq-add-ℕ m' n n' K)\n\n{-\nright-law-leq-mul-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (mul-ℕ k m) (mul-ℕ k n)\nright-law-leq-mul-ℕ zero-ℕ m n H = star\nright-law-leq-mul-ℕ (succ-ℕ k) m n H = {!!}\n-}\n\n{-\n preserves-leq-add-ℕ\n { m = mul-ℕ k m}\n { m' = mul-ℕ k n}\n ( right-law-leq-mul-ℕ k m n H) H\n\nleft-law-leq-mul-ℕ : (k m n : ℕ) → leq-ℕ m n → leq-ℕ (mul-ℕ m k) (mul-ℕ n k)\nleft-law-leq-mul-ℕ k m n H =\n concatenate-eq-leq-eq-ℕ\n ( commutative-mul-ℕ k m)\n ( commutative-mul-ℕ k n)\n ( right-law-leq-mul-ℕ k m n H)\n-}\n\n-- We show that ℤ is an ordered ring\n\n{-\nleq-add-ℤ : (m k l : ℤ) → leq-ℤ k l → leq-ℤ (add-ℤ m k) (add-ℤ m l)\nleq-add-ℤ (inl zero-ℕ) k l H = {!!}\nleq-add-ℤ (inl (succ-ℕ x)) k l H = {!!}\nleq-add-ℤ (inr m) k l H = {!!}\n-}\n\n-- Section 5.5 Identity systems\n\nsucc-fam-Eq-ℕ :\n {i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i) →\n (m n : ℕ) → Eq-ℕ m n → UU i\nsucc-fam-Eq-ℕ R m n e = R (succ-ℕ m) (succ-ℕ n) e\n\nsucc-refl-fam-Eq-ℕ :\n {i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i)\n (ρ : (n : ℕ) → R n n (refl-Eq-ℕ n)) →\n (n : ℕ) → (succ-fam-Eq-ℕ R n n (refl-Eq-ℕ n))\nsucc-refl-fam-Eq-ℕ R ρ n = ρ (succ-ℕ n)\n\npath-ind-Eq-ℕ :\n {i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i)\n ( ρ : (n : ℕ) → R n n (refl-Eq-ℕ n)) →\n ( m n : ℕ) (e : Eq-ℕ m n) → R m n e\npath-ind-Eq-ℕ R ρ zero-ℕ zero-ℕ star = ρ zero-ℕ\npath-ind-Eq-ℕ R ρ zero-ℕ (succ-ℕ n) ()\npath-ind-Eq-ℕ R ρ (succ-ℕ m) zero-ℕ ()\npath-ind-Eq-ℕ R ρ (succ-ℕ m) (succ-ℕ n) e =\n path-ind-Eq-ℕ\n ( λ m n e → R (succ-ℕ m) (succ-ℕ n) e)\n ( λ n → ρ (succ-ℕ n)) m n e\n\ncomp-path-ind-Eq-ℕ :\n {i : Level} (R : (m n : ℕ) → Eq-ℕ m n → UU i)\n ( ρ : (n : ℕ) → R n n (refl-Eq-ℕ n)) →\n ( n : ℕ) → Id (path-ind-Eq-ℕ R ρ n n (refl-Eq-ℕ n)) (ρ n)\ncomp-path-ind-Eq-ℕ R ρ zero-ℕ = refl\ncomp-path-ind-Eq-ℕ R ρ (succ-ℕ n) =\n comp-path-ind-Eq-ℕ\n ( λ m n e → R (succ-ℕ m) (succ-ℕ n) e)\n ( λ n → ρ (succ-ℕ n)) n\n\n\n{-\n-- Graphs\nGph : (i : Level) → UU (lsuc i)\nGph i = Σ (UU i) (λ X → (X → X → (UU i)))\n\n-- Reflexive graphs\nrGph : (i : Level) → UU (lsuc i)\nrGph i = Σ (UU i) (λ X → Σ (X → X → (UU i)) (λ R → (x : X) → R x x))\n-}\n\n-- Exercise 3.7\n\n{- With the construction of the divisibility relation we open the door to basic\n number theory. -}\n \ndivides : (d n : ℕ) → UU lzero\ndivides d n = Σ ℕ (λ m → Eq-ℕ (mul-ℕ d m) n)\n\n-- We prove some lemmas about inequalities --\n\nleq-add-ℕ :\n (m n : ℕ) → leq-ℕ m (add-ℕ m n)\nleq-add-ℕ m zero-ℕ = reflexive-leq-ℕ m\nleq-add-ℕ m (succ-ℕ n) =\n transitive-leq-ℕ m (add-ℕ m n) (succ-ℕ (add-ℕ m n))\n ( leq-add-ℕ m n)\n ( succ-leq-ℕ (add-ℕ m n))\n\nleq-add-ℕ' :\n (m n : ℕ) → leq-ℕ m (add-ℕ n m)\nleq-add-ℕ' m n =\n concatenate-leq-eq-ℕ m (leq-add-ℕ m n) (commutative-add-ℕ m n)\n\nleq-leq-add-ℕ :\n (m n x : ℕ) → leq-ℕ (add-ℕ m x) (add-ℕ n x) → leq-ℕ m n\nleq-leq-add-ℕ m n zero-ℕ H = H\nleq-leq-add-ℕ m n (succ-ℕ x) H = leq-leq-add-ℕ m n x H\n\nleq-leq-add-ℕ' :\n (m n x : ℕ) → leq-ℕ (add-ℕ x m) (add-ℕ x n) → leq-ℕ m n\nleq-leq-add-ℕ' m n x H =\n leq-leq-add-ℕ m n x\n ( concatenate-eq-leq-eq-ℕ\n ( commutative-add-ℕ m x)\n ( H)\n ( commutative-add-ℕ x n))\n\nleq-leq-mul-ℕ :\n (m n x : ℕ) → leq-ℕ (mul-ℕ (succ-ℕ x) m) (mul-ℕ (succ-ℕ x) n) → leq-ℕ m n\nleq-leq-mul-ℕ zero-ℕ zero-ℕ x H = star\nleq-leq-mul-ℕ zero-ℕ (succ-ℕ n) x H = star\nleq-leq-mul-ℕ (succ-ℕ m) zero-ℕ x H =\n ex-falso\n ( concatenate-leq-eq-ℕ\n ( mul-ℕ (succ-ℕ x) (succ-ℕ m))\n ( H)\n ( right-zero-law-mul-ℕ (succ-ℕ x)))\nleq-leq-mul-ℕ (succ-ℕ m) (succ-ℕ n) x H =\n leq-leq-mul-ℕ m n x\n ( leq-leq-add-ℕ' (mul-ℕ (succ-ℕ x) m) (mul-ℕ (succ-ℕ x) n) (succ-ℕ x)\n ( concatenate-eq-leq-eq-ℕ\n ( inv (right-successor-law-mul-ℕ (succ-ℕ x) m))\n ( H)\n ( right-successor-law-mul-ℕ (succ-ℕ x) n)))\n\nleq-leq-mul-ℕ' :\n (m n x : ℕ) → leq-ℕ (mul-ℕ m (succ-ℕ x)) (mul-ℕ n (succ-ℕ x)) → leq-ℕ m n\nleq-leq-mul-ℕ' m n x H =\n leq-leq-mul-ℕ m n x\n ( concatenate-eq-leq-eq-ℕ\n ( commutative-mul-ℕ (succ-ℕ x) m)\n ( H)\n ( commutative-mul-ℕ n (succ-ℕ x)))\n\n{-\nsucc-relation-ℕ :\n {i : Level} (R : ℕ → ℕ → UU i) → ℕ → ℕ → UU i\nsucc-relation-ℕ R m n = R (succ-ℕ m) (succ-ℕ n)\n\nsucc-reflexivity-ℕ :\n {i : Level} (R : ℕ → ℕ → UU i) (ρ : (n : ℕ) → R n n) →\n (n : ℕ) → succ-relation-ℕ R n n\nsucc-reflexivity-ℕ R ρ n = ρ (succ-ℕ n)\n\n{- In the book we suggest that first the order of the variables should be\n swapped, in order to make the inductive hypothesis stronger. Agda's pattern\n matching mechanism allows us to bypass this step and give a more direct\n construction. -}\n\nleast-reflexive-Eq-ℕ :\n {i : Level} (R : ℕ → ℕ → UU i) (ρ : (n : ℕ) → R n n) →\n (m n : ℕ) → Eq-ℕ m n → R m n\nleast-reflexive-Eq-ℕ R ρ zero-ℕ zero-ℕ star = ρ zero-ℕ\nleast-reflexive-Eq-ℕ R ρ zero-ℕ (succ-ℕ n) ()\nleast-reflexive-Eq-ℕ R ρ (succ-ℕ m) zero-ℕ ()\nleast-reflexive-Eq-ℕ R ρ (succ-ℕ m) (succ-ℕ n) e =\n least-reflexive-Eq-ℕ (succ-relation-ℕ R) (succ-reflexivity-ℕ R ρ) m n e\n-}\n\n-- The definition of <\n\nle-ℕ : ℕ → ℕ → UU lzero\nle-ℕ m zero-ℕ = empty\nle-ℕ zero-ℕ (succ-ℕ m) = unit\nle-ℕ (succ-ℕ n) (succ-ℕ m) = le-ℕ n m\n\n_<_ = le-ℕ\n\nanti-reflexive-le-ℕ : (n : ℕ) → ¬ (n < n)\nanti-reflexive-le-ℕ zero-ℕ = ind-empty\nanti-reflexive-le-ℕ (succ-ℕ n) = anti-reflexive-le-ℕ n\n\ntransitive-le-ℕ : (n m l : ℕ) → (le-ℕ n m) → (le-ℕ m l) → (le-ℕ n l)\ntransitive-le-ℕ zero-ℕ (succ-ℕ m) (succ-ℕ l) p q = star\ntransitive-le-ℕ (succ-ℕ n) (succ-ℕ m) (succ-ℕ l) p q =\n transitive-le-ℕ n m l p q\n\nsucc-le-ℕ : (n : ℕ) → le-ℕ n (succ-ℕ n)\nsucc-le-ℕ zero-ℕ = star\nsucc-le-ℕ (succ-ℕ n) = succ-le-ℕ n\n\nanti-symmetric-le-ℕ : (m n : ℕ) → le-ℕ m n → le-ℕ n m → Id m n\nanti-symmetric-le-ℕ (succ-ℕ m) (succ-ℕ n) p q =\n ap succ-ℕ (anti-symmetric-le-ℕ m n p q)\n\n{-\n--------------------------------------------------------------------------------\n\ndata Fin-Tree : UU lzero where\n constr : (n : ℕ) → (Fin n → Fin-Tree) → Fin-Tree\n\nroot-Fin-Tree : Fin-Tree\nroot-Fin-Tree = constr zero-ℕ ex-falso\n\nsucc-Fin-Tree : Fin-Tree → Fin-Tree\nsucc-Fin-Tree t = constr one-ℕ (λ i → t)\n\nmap-assoc-coprod :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} →\n coprod (coprod A B) C → coprod A (coprod B C)\nmap-assoc-coprod (inl (inl x)) = inl x\nmap-assoc-coprod (inl (inr x)) = inr (inl x)\nmap-assoc-coprod (inr x) = inr (inr x)\n\nmap-coprod-Fin :\n (m n : ℕ) → Fin (add-ℕ m n) → coprod (Fin m) (Fin n)\nmap-coprod-Fin m zero-ℕ = inl\nmap-coprod-Fin m (succ-ℕ n) =\n map-assoc-coprod ∘ (functor-coprod (map-coprod-Fin m n) (id {A = unit}))\n\nadd-Fin-Tree : Fin-Tree → Fin-Tree → Fin-Tree\nadd-Fin-Tree (constr n x) (constr m y) =\n constr (add-ℕ n m) ((ind-coprod (λ i → Fin-Tree) x y) ∘ (map-coprod-Fin n m))\n\n--------------------------------------------------------------------------------\n\ndata labeled-Bin-Tree {l1 : Level} (A : UU l1) : UU l1 where\n leaf : A → labeled-Bin-Tree A\n constr : (bool → labeled-Bin-Tree A) → labeled-Bin-Tree A\n\nmul-leaves-labeled-Bin-Tree :\n {l1 : Level} {A : UU l1} (μ : A → (A → A)) →\n labeled-Bin-Tree A → A\nmul-leaves-labeled-Bin-Tree μ (leaf x) = x\nmul-leaves-labeled-Bin-Tree μ (constr f) =\n μ ( mul-leaves-labeled-Bin-Tree μ (f false))\n ( mul-leaves-labeled-Bin-Tree μ (f true))\n\npick-list : {l1 : Level} {A : UU l1} → ℕ → list A → coprod A unit\npick-list zero-ℕ nil = inr star\npick-list zero-ℕ (cons a x) = inl a\npick-list (succ-ℕ n) nil = inr star\npick-list (succ-ℕ n) (cons a x) = pick-list n x\n-}\n", "meta": {"hexsha": "738d12e5cce3f7f297099bf4486a08514a9af6fa", "size": 25776, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/06-universes.agda", "max_stars_repo_name": "UlrikBuchholtz/HoTT-Intro", "max_stars_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Agda/06-universes.agda", "max_issues_repo_name": "UlrikBuchholtz/HoTT-Intro", "max_issues_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/06-universes.agda", "max_forks_repo_name": "UlrikBuchholtz/HoTT-Intro", "max_forks_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.205811138, "max_line_length": 80, "alphanum_fraction": 0.5687461204, "num_tokens": 12543, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952948443462, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6853757870637726}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Pointwise table equality\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Table.Relation.Binary.Equality where\n\nopen import Relation.Binary using (Setoid)\nopen import Data.Table.Base\nopen import Data.Nat using (ℕ)\nopen import Function using (_∘_)\nopen import Relation.Binary.PropositionalEquality\n as P using (_≡_; _→-setoid_)\n\nsetoid : ∀ {c p} → Setoid c p → ℕ → Setoid _ _\nsetoid S n = record\n { Carrier = Table Carrier n\n ; _≈_ = λ t t′ → ∀ i → lookup t i ≈ lookup t′ i\n ; isEquivalence = record\n { refl = λ i → refl\n ; sym = λ p → sym ∘ p\n ; trans = λ p q i → trans (p i) (q i)\n }\n }\n where open Setoid S\n\n≡-setoid : ∀ {a} → Set a → ℕ → Setoid _ _\n≡-setoid A = setoid (P.setoid A)\n\nmodule _ {a} {A : Set a} {n} where\n open Setoid (≡-setoid A n) public\n using () renaming (_≈_ to _≗_)\n", "meta": {"hexsha": "3f162ffdc2a81b89598f01c88a059eab5a64870f", "size": 994, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Table/Relation/Binary/Equality.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Table/Relation/Binary/Equality.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Table/Relation/Binary/Equality.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.6111111111, "max_line_length": 72, "alphanum_fraction": 0.5331991952, "num_tokens": 292, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952975813454, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.685375784322396}} {"text": "{-\n\nComputable stuff constructed from the Combinatorics of Finite Sets\n\n-}\n{-# OPTIONS --safe #-}\n\nmodule Cubical.Experiments.Combinatorics where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Equiv\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Sum\nopen import Cubical.Data.Sigma\n\nopen import Cubical.Data.Fin\nopen import Cubical.Data.FinSet\nopen import Cubical.Data.FinSet.Constructors\n\nopen import Cubical.Functions.Embedding\nopen import Cubical.Functions.Surjection\n\n-- some computable functions\n\n-- this should be addtion\ncard+ : ℕ → ℕ → ℕ\ncard+ m n = card (Fin m ⊎ Fin n , isFinSet⊎ (Fin m , isFinSetFin) (Fin n , isFinSetFin))\n\n-- this should be multiplication\ncard× : ℕ → ℕ → ℕ\ncard× m n = card (Fin m × Fin n , isFinSet× (Fin m , isFinSetFin) (Fin n , isFinSetFin))\n\n-- this should be exponential\ncard→ : ℕ → ℕ → ℕ\ncard→ m n = card ((Fin m → Fin n) , isFinSet→ (Fin m , isFinSetFin) (Fin n , isFinSetFin))\n\n-- this should be factorial or zero\ncard≃ : ℕ → ℕ → ℕ\ncard≃ m n = card ((Fin m ≃ Fin n) , isFinSet≃ (Fin m , isFinSetFin) (Fin n , isFinSetFin))\n\n-- this should be binomial coeffient\ncard↪ : ℕ → ℕ → ℕ\ncard↪ m n = card ((Fin m ↪ Fin n) , isFinSet↪ (Fin m , isFinSetFin) (Fin n , isFinSetFin))\n\n-- this should be something that I don't know the name\ncard↠ : ℕ → ℕ → ℕ\ncard↠ m n = card ((Fin m ↠ Fin n) , isFinSet↠ (Fin m , isFinSetFin) (Fin n , isFinSetFin))\n\n-- explicit numbers\n\ns2 : card≃ 2 2 ≡ 2\ns2 = refl\n\ns3 : card≃ 3 3 ≡ 6\ns3 = refl\n\nc3,2 : card↪ 2 3 ≡ 6\nc3,2 = refl\n", "meta": {"hexsha": "2c45bda19e73160049311386a09fa75fe2d53820", "size": 1522, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Experiments/Combinatorics.agda", "max_stars_repo_name": "FernandoLarrain/cubical", "max_stars_repo_head_hexsha": "9acdecfa6437ec455568be4e5ff04849cc2bc13b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-03-05T00:28:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T00:28:39.000Z", "max_issues_repo_path": "Cubical/Experiments/Combinatorics.agda", "max_issues_repo_name": "Seanpm2001-web/cubical", "max_issues_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Experiments/Combinatorics.agda", "max_forks_repo_name": "Seanpm2001-web/cubical", "max_forks_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.3666666667, "max_line_length": 90, "alphanum_fraction": 0.6846254928, "num_tokens": 530, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952975813453, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6853757843223959}} {"text": "module Data.FixedTree.Properties where\n\nimport Lvl\nopen import Data using (Unit ; <>)\nopen import Data.Boolean\nopen import Data.FixedTree\nopen import Data.Tuple.Raise\nimport Data.Tuple.Raiseᵣ.Functions as Raise\nopen import Functional as Fn\nopen import Logic.Propositional\nopen import Numeral.Finite\nopen import Numeral.Finite.Oper.Comparisons\nopen import Numeral.Natural\nopen import Type\n\nprivate variable ℓ ℓᵢ ℓₗ ℓₙ ℓₒ : Lvl.Level\nprivate variable n : ℕ\nprivate variable N N₁ N₂ L T A B : Type{ℓ}\n\n-- A tree is full when every node has no or all children.\ndata Full {L : Type{ℓₗ}}{N : Type{ℓₙ}}{n} : FixedTree(n) L N → Type{ℓₗ Lvl.⊔ ℓₙ} where\n leaf : ∀{l} → Full(Leaf l)\n single : ∀{a}{l} → Full(Node a (Raise.repeat(n) (Leaf l))) -- TODO: All the leaves should not be forced to all have the same data\n step : ∀{a : N}{ca : N ^ n}{cc : ((FixedTree(n) L N) ^ n) ^ n} → (∀{i : 𝕟(n)} → Full(Node (Raise.index i ca) (Raise.index i cc))) → Full(Node a (Raise.map₂{n} Node ca cc))\n -- step : ∀{a : T}{ca : T ^ n}{cc : (FixedTree(n)(T) ^ n) ^ n} → Raise.reduceOrᵣ{n}(_⨯_) Unit (Raise.map₂(Full ∘₂ Node) ca cc) → Full(Node a (Raise.map₂{n} Node ca cc))\n\n-- A tree is perfect at depth `n` when all leaves are at height `n`.\n-- In other words, a tree is perfect when all leaves are at the same height.\ndata Perfect {L : Type{ℓₗ}}{N : Type{ℓₙ}}{n} : FixedTree(n) L N → ℕ → Type{ℓₗ Lvl.⊔ ℓₙ} where\n leaf : ∀{l} → Perfect(Leaf l)(𝟎)\n step : ∀{a}{c}{h} → (∀{i : 𝕟(n)} → Perfect(Raise.index i c)(h)) → Perfect(Node a c)(𝐒(h))\n\ndata Complete {L : Type{ℓₗ}}{N : Type{ℓₙ}}{n} : FixedTree(n) L N → ℕ → Bool → Type{ℓₗ Lvl.⊔ ℓₙ} where\n perfect-leaf : ∀{l} → Complete(Leaf l)(𝟎)(𝑇)\n imperfect-leaf : ∀{l} → Complete(Leaf l)(𝐒(𝟎))(𝐹)\n step : ∀{a}{c}{h}{t : 𝕟(n)} → (∀{i : 𝕟(n)} → Complete(Raise.index i c)(h)(i ≤? t)) → Complete(Node a c)(𝐒(h))(t ≤? maximum{n})\n\ndata DepthOrdered {L : Type{ℓₗ}}{N : Type{ℓₙ}} (_≤_ : N → N → Type{ℓₒ}) {n} : FixedTree(n) L N → Type{ℓₗ Lvl.⊔ ℓₙ Lvl.⊔ ℓₒ} where\n leaf : ∀{l} → DepthOrdered(_≤_)(Leaf l)\n step : ∀{p}{c : (FixedTree(n) L N) ^ n} → (∀{i : 𝕟(n)} → (\\{(Leaf _) → Unit ; (Node a c) → (p ≤ a) ∧ DepthOrdered(_≤_)(Node a c)}) $ (Raise.index i c)) → DepthOrdered(_≤_)(Node p c)\n\nHeap : ∀{L : Type{ℓₗ}}{N : Type{ℓₙ}} → (N → N → Type{ℓₒ}) → ∀{n} → FixedTree(n) L N → ℕ → Bool → Type\nHeap(_≤_) tree height perfect = DepthOrdered(_≤_)(tree) ∧ Complete(tree)(height)(perfect)\n", "meta": {"hexsha": "1077065d9c430a8b22e67e5e8c48345f8b2a6239", "size": 2414, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/FixedTree/Properties.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/FixedTree/Properties.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/FixedTree/Properties.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 54.8636363636, "max_line_length": 183, "alphanum_fraction": 0.613918807, "num_tokens": 988, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952866333483, "lm_q2_score": 0.7634837581726991, "lm_q1q2_score": 0.6853757711327471}} {"text": "{-# OPTIONS --warning=error --safe --without-K #-}\n\nopen import Functions.Definition\nopen import Groups.Definition\nopen import Rings.Homomorphisms.Definition\nopen import Setoids.Setoids\nopen import Rings.Definition\nopen import Sets.EquivalenceRelations\nopen import Groups.Lemmas\nopen import Rings.Ideals.Definition\n\nmodule Rings.Cosets {a b c : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) {pred : A → Set c} (ideal : Ideal R pred) where\n\nopen Ring R\nopen import Rings.Lemmas R\nopen import Groups.Subgroups.Normal.Lemmas\n\nopen import Groups.Cosets additiveGroup (Ideal.isSubgroup ideal)\n\nopen Setoid S\nopen Equivalence eq\nopen Ideal ideal\nopen Group additiveGroup\n\ncosetRing : Ring cosetSetoid _+_ _*_\nRing.additiveGroup cosetRing = cosetGroup (abelianGroupSubgroupIsNormal (Ideal.isSubgroup ideal) abelianUnderlyingGroup)\nRing.*WellDefined cosetRing {r} {s} {t} {u} r=t s=u = need\n where\n r=t' : pred ((inverse t + r) * u)\n r=t' = accumulatesTimes r=t\n s=u' : pred ((inverse u + s) * r)\n s=u' = accumulatesTimes s=u\n need : pred (inverse (t * u) + (r * s))\n need = isSubset (transitive (+WellDefined (*DistributesOver+') *DistributesOver+') (transitive +Associative (+WellDefined (transitive (symmetric +Associative) (transitive (+WellDefined ringMinusExtracts' (transitive (+WellDefined reflexive (transitive ringMinusExtracts' (inverseWellDefined additiveGroup *Commutative))) invRight)) identRight)) *Commutative))) (closedUnderPlus r=t' s=u')\nRing.1R cosetRing = 1R\nRing.groupIsAbelian cosetRing = isSubset (transitive (symmetric invLeft) (+WellDefined (inverseWellDefined additiveGroup groupIsAbelian) reflexive)) containsIdentity\nRing.*Associative cosetRing = isSubset (transitive (symmetric invLeft) (+WellDefined (inverseWellDefined additiveGroup *Associative) reflexive)) containsIdentity\nRing.*Commutative cosetRing {a} {b} = isSubset (transitive (symmetric invLeft) (+WellDefined (inverseWellDefined additiveGroup *Commutative) reflexive)) containsIdentity\nRing.*DistributesOver+ cosetRing = isSubset (symmetric (transitive (+WellDefined (inverseWellDefined additiveGroup (symmetric *DistributesOver+)) reflexive) invLeft)) containsIdentity\nRing.identIsIdent cosetRing = isSubset (symmetric (transitive (Group.+WellDefined additiveGroup reflexive identIsIdent) invLeft)) containsIdentity\n\ncosetRingHom : RingHom R cosetRing id\nRingHom.preserves1 cosetRingHom = isSubset (symmetric invLeft) (Ideal.containsIdentity ideal)\nRingHom.ringHom cosetRingHom = isSubset (symmetric invLeft) (Ideal.containsIdentity ideal)\nRingHom.groupHom cosetRingHom = cosetGroupHom (abelianGroupSubgroupIsNormal (Ideal.isSubgroup ideal) abelianUnderlyingGroup)\n", "meta": {"hexsha": "ad4da7f550d20f00277bf7289df850162ccfa8f7", "size": 2704, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Cosets.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Cosets.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Cosets.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 58.7826086957, "max_line_length": 392, "alphanum_fraction": 0.7810650888, "num_tokens": 753, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9184802417938533, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6853139279155501}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Semirings.Definition\n\nmodule Semirings.Lemmas {a : _} {A : Set a} {Zero One : A} {_+_ _*_ : A → A → A} (S : Semiring Zero One _+_ _*_) where\n\nopen Semiring S\n\ndoubleIsAddTwo : (a : A) → (a + a) ≡ (One + One) * a\ndoubleIsAddTwo a = transitivity (equalityCommutative (+WellDefined (productOneLeft a) (productOneLeft a))) (equalityCommutative (+DistributesOver*' One One a))\n", "meta": {"hexsha": "8deefe45b11c6f9d853e30aaeb0363cbbc484672", "size": 464, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Semirings/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Semirings/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Semirings/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 38.6666666667, "max_line_length": 159, "alphanum_fraction": 0.6875, "num_tokens": 149, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802462567085, "lm_q2_score": 0.7461389930307512, "lm_q1q2_score": 0.6853139260606168}} {"text": "\nopen import Everything\n\nmodule Test.Transassociativity where\n\ntest-transassociativity-≡ : ∀\n {𝔬} {𝔒 : Ø 𝔬}\n {𝔯} {_∼_ : 𝔒 → 𝔒 → Ø 𝔯}\n ⦃ _ : Transitivity.class _∼_ ⦄\n ⦃ _ : Transassociativity!.class _∼_ Proposequality ⦄\n → ∀ {w x y z} (f : w ∼ x) (g : x ∼ y) (h : y ∼ z) → (h ∙ g) ∙ f ≡ h ∙ g ∙ f\ntest-transassociativity-≡ f g h rewrite transassociativity![ Proposequality ] f g h = ∅ -- transassociativity\n", "meta": {"hexsha": "65944f9c3adb51a92e8349207f006d9dda16c437", "size": 411, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-3/src/Test/Transassociativity.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-3/src/Test/Transassociativity.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-3/src/Test/Transassociativity.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.6153846154, "max_line_length": 109, "alphanum_fraction": 0.6082725061, "num_tokens": 184, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802373309979, "lm_q2_score": 0.7461389817407017, "lm_q1q2_score": 0.6853139090311088}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Propositional equality\n--\n-- This file contains some core definitions which are re-exported by\n-- Relation.Binary.PropositionalEquality.\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Relation.Binary.PropositionalEquality.Core where\n\nopen import Data.Product using (_,_)\nopen import Level\nopen import Relation.Binary.Core\nopen import Relation.Nullary using (¬_)\n\n------------------------------------------------------------------------\n-- Propositional equality\n\nopen import Agda.Builtin.Equality public\n\ninfix 4 _≢_\n_≢_ : ∀ {a} {A : Set a} → Rel A a\nx ≢ y = ¬ x ≡ y\n\n------------------------------------------------------------------------\n-- Some properties\n\nmodule _ {a} {A : Set a} where\n\n sym : Symmetric {A = A} _≡_\n sym refl = refl\n\n trans : Transitive {A = A} _≡_\n trans refl eq = eq\n\n subst : ∀ {p} → Substitutive {A = A} _≡_ p\n subst P refl p = p\n\n cong : ∀ {b} {B : Set b} (f : A → B) {x y} → x ≡ y → f x ≡ f y\n cong f refl = refl\n\n respˡ : ∀ {ℓ} (∼ : Rel A ℓ) → ∼ Respectsˡ _≡_\n respˡ _∼_ refl x∼y = x∼y\n\n respʳ : ∀ {ℓ} (∼ : Rel A ℓ) → ∼ Respectsʳ _≡_\n respʳ _∼_ refl x∼y = x∼y\n\n resp₂ : ∀ {ℓ} (∼ : Rel A ℓ) → ∼ Respects₂ _≡_\n resp₂ _∼_ = respʳ _∼_ , respˡ _∼_\n\n isEquivalence : IsEquivalence {A = A} _≡_\n isEquivalence = record\n { refl = refl\n ; sym = sym\n ; trans = trans\n }\n\n------------------------------------------------------------------------\n-- Various equality rearrangement lemmas\n\nmodule _ {a} {A : Set a} {x y : A} where\n\n trans-reflʳ : (p : x ≡ y) → trans p refl ≡ p\n trans-reflʳ refl = refl\n\n trans-assoc : ∀ {z u} (p : x ≡ y) {q : y ≡ z} {r : z ≡ u} →\n trans (trans p q) r ≡ trans p (trans q r)\n trans-assoc refl = refl\n\n trans-symˡ : (p : x ≡ y) → trans (sym p) p ≡ refl\n trans-symˡ refl = refl\n\n trans-symʳ : (p : x ≡ y) → trans p (sym p) ≡ refl\n trans-symʳ refl = refl\n\n------------------------------------------------------------------------\n-- Convenient syntax for equational reasoning\n\n-- This is a special instance of `Relation.Binary.Reasoning.Setoid`.\n-- Rather than instantiating the latter with (setoid A), we reimplement\n-- equation chains from scratch since then goals are printed much more\n-- readably.\n\nmodule ≡-Reasoning {a} {A : Set a} where\n\n infix 3 _∎\n infixr 2 _≡⟨⟩_ _≡⟨_⟩_ _≡˘⟨_⟩_\n infix 1 begin_\n\n begin_ : ∀{x y : A} → x ≡ y → x ≡ y\n begin_ x≡y = x≡y\n\n _≡⟨⟩_ : ∀ (x {y} : A) → x ≡ y → x ≡ y\n _ ≡⟨⟩ x≡y = x≡y\n\n _≡⟨_⟩_ : ∀ (x {y z} : A) → x ≡ y → y ≡ z → x ≡ z\n _ ≡⟨ x≡y ⟩ y≡z = trans x≡y y≡z\n\n _≡˘⟨_⟩_ : ∀ (x {y z} : A) → y ≡ x → y ≡ z → x ≡ z\n _ ≡˘⟨ y≡x ⟩ y≡z = trans (sym y≡x) y≡z\n\n _∎ : ∀ (x : A) → x ≡ x\n _∎ _ = refl\n", "meta": {"hexsha": "7bfe5c32b033d52d958bc36504c3837a3738d115", "size": 2808, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/PropositionalEquality/Core.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/PropositionalEquality/Core.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/PropositionalEquality/Core.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.2429906542, "max_line_length": 72, "alphanum_fraction": 0.4843304843, "num_tokens": 1025, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8558511616741041, "lm_q2_score": 0.800691997339971, "lm_q1q2_score": 0.6852731760665729}} {"text": "module Human.Equality where\n\ndata _==_ {A : Set} (x : A) : A -> Set where\n refl : x == x\n\n{-# BUILTIN EQUALITY _==_ #-}\n\nsym : {A : Set} (x : A) (y : A) -> x == y -> y == x\nsym x .x refl = refl\n\ncong : {A : Set} {B : Set} (x : A) (y : A) (f : A -> B) -> x == y -> f x == f y\ncong x y f refl = refl\n", "meta": {"hexsha": "1a088d46445671efd86022bcd99bd7065dd0f168", "size": 299, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Human/Equality.agda", "max_stars_repo_name": "MaisaMilena/AgdaCalculator", "max_stars_repo_head_hexsha": "e977a5f2a005682cee123568b49462dd7d7b11ad", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-03-29T02:30:10.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-29T02:30:10.000Z", "max_issues_repo_path": "src/Human/Equality.agda", "max_issues_repo_name": "MaisaMilena/AgdaCalculator", "max_issues_repo_head_hexsha": "e977a5f2a005682cee123568b49462dd7d7b11ad", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Human/Equality.agda", "max_forks_repo_name": "MaisaMilena/AgdaCalculator", "max_forks_repo_head_hexsha": "e977a5f2a005682cee123568b49462dd7d7b11ad", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.0, "max_line_length": 79, "alphanum_fraction": 0.4548494983, "num_tokens": 126, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9372107878954105, "lm_q2_score": 0.731058584489497, "lm_q1q2_score": 0.685155991967105}} {"text": "--------------------------------------------------------------------\n-- This file contains the definition of and facts about functors. --\n--------------------------------------------------------------------\nmodule Category.Funct where\n\nopen import Level\n\nopen import Relation.Relation\n\nopen import Relation.Binary.PropositionalEquality public renaming (_≡_ to _P≡_; sym to prop-sym ; trans to prop-trans; refl to prop-refl)\n\nopen import Setoid.Total\nopen import Category.Category\n\nrecord Functor {l₁ l₂ : Level} (ℂ₁ : Cat {l₁}) (ℂ₂ : Cat {l₂}) : Set (l₁ ⊔ l₂) where\n constructor Funct_,_,_,_\n field\n -- The object map.\n omap : Obj ℂ₁ → Obj ℂ₂\n\n -- The morphism map.\n fmap : {A B : Obj ℂ₁} \n → SetoidFun (Hom ℂ₁ A B) (Hom ℂ₂ (omap A) (omap B))\n\n -- The morphism map must send identities to identities.\n idPF : ∀{A} \n → ⟨ Hom ℂ₂ (omap A) (omap A) ⟩[ appT fmap (id ℂ₁) ≡ id ℂ₂ ] \n -- The morphism map must respect composition.\n compPF : ∀{A B C}{f : el (Hom ℂ₁ A B)}{g : el (Hom ℂ₁ B C)} \n → ⟨ Hom ℂ₂ (omap A) (omap C) ⟩[ appT fmap (f ○[ comp ℂ₁ ] g) ≡ (appT fmap f) ○[ comp ℂ₂ ] (appT fmap g) ]\n\nopen Functor public\n", "meta": {"hexsha": "493af1af717ad117d3487de0512c8cc0b0c4f44d", "size": 1155, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "setoid-cats/Category/Funct.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "setoid-cats/Category/Funct.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "setoid-cats/Category/Funct.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.0, "max_line_length": 137, "alphanum_fraction": 0.5575757576, "num_tokens": 361, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9294404018582426, "lm_q2_score": 0.7371581510799252, "lm_q1q2_score": 0.6851445681728048}} {"text": "\nmodule Membership where\n\nopen import OscarPrelude\nopen import Successor\n\nrecord Membership {ℓ} (m : Set ℓ) (M : Set ℓ) : Set (⊹ ℓ)\n where\n field\n _∈_ : m → M → Set ℓ\n _∉_ : m → M → Set ℓ\n xor-membership : ∀ {x : m} {X : M} → x ∈ X ←⊗→ x ∉ X\n\nopen Membership ⦃ … ⦄ public\n\ndata _∈List_ {ℓ} {A : Set ℓ} (a : A) : List A → Set ℓ\n where\n zero : {as : List A} → a ∈List (a ∷ as)\n suc : {x : A} {as : List A} → a ∈List as → a ∈List (x ∷ as)\n\ninstance MembershipList : ∀ {ℓ} {A : Set ℓ} → Membership A $ List A\nMembership._∈_ MembershipList = _∈List_\nMembership._∉_ MembershipList x X = ¬ x ∈ X\nMembership.xor-membership MembershipList = (λ x x₁ → x₁ x) , (λ x x₁ → x x₁)\n\ninstance SuccessorMembershipList : ∀ {ℓ} {A : Set ℓ} {a : A} {x : A} {as : List A} → Successor (a ∈ as) $ a ∈ (x List.∷ as)\nSuccessor.⊹ SuccessorMembershipList = suc\n\n_⊆_ : ∀ {ℓ} {m M : Set ℓ} ⦃ _ : Membership m M ⦄ → M → M → Set ℓ\n_⊆_ {m = m} M₁ M₂ = ∀ {x : m} → x ∈ M₁ → x ∈ M₂\n", "meta": {"hexsha": "199a9bf8d66d8e653ad68937a51f2eeb93ed04f2", "size": 959, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-1/Membership.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-1/Membership.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-1/Membership.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.935483871, "max_line_length": 123, "alphanum_fraction": 0.5651720542, "num_tokens": 416, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9219218412907381, "lm_q2_score": 0.7431680086124812, "lm_q1q2_score": 0.6851428188883898}} {"text": "{-\nThis second-order signature was created from the following second-order syntax description:\n\nsyntax Monad | M\n\ntype\n T : 1-ary\n\nterm\n ret : α -> T α\n bind : T α α.(T β) -> T β | _>>=_ r10\n\ntheory\n (LU) a : α b : α.(T β) |> bind (ret(a), x. b[x]) = b[a]\n (RU) t : T α |> bind (t, x. ret(x)) = t\n (AS) t : T α b : α.(T β) c : β.(T γ) |> bind (bind (t, x.b[x]), y.c[y]) = bind (t, x. bind (b[x], y.c[y]))\n-}\n\nmodule Monad.Signature where\n\nopen import SOAS.Context\n\n-- Type declaration\ndata MT : Set where\n T : MT → MT\n\n\n\nopen import SOAS.Syntax.Signature MT public\nopen import SOAS.Syntax.Build MT public\n\n-- Operator symbols\ndata Mₒ : Set where\n retₒ : {α : MT} → Mₒ\n bindₒ : {α β : MT} → Mₒ\n\n-- Term signature\nM:Sig : Signature Mₒ\nM:Sig = sig λ\n { (retₒ {α}) → (⊢₀ α) ⟼₁ T α\n ; (bindₒ {α}{β}) → (⊢₀ T α) , (α ⊢₁ T β) ⟼₂ T β\n }\n\nopen Signature M:Sig public\n", "meta": {"hexsha": "bbd3911873bd61cbeccc4a1f6397960581347aaa", "size": 885, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/Monad/Signature.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/Monad/Signature.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/Monad/Signature.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 19.6666666667, "max_line_length": 110, "alphanum_fraction": 0.5604519774, "num_tokens": 358, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9219218305645894, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.685142805672846}} {"text": "import Lvl\nopen import Structure.Operator.Vector\nopen import Structure.Setoid\nopen import Type\n\nmodule Structure.Operator.Vector.Subspace\n {ℓᵥ ℓₛ ℓᵥₑ ℓₛₑ}\n {V : Type{ℓᵥ}} ⦃ equiv-V : Equiv{ℓᵥₑ}(V) ⦄\n {S : Type{ℓₛ}} ⦃ equiv-S : Equiv{ℓₛₑ}(S) ⦄\n {_+ᵥ_ : V → V → V}\n {_⋅ₛᵥ_ : S → V → V}\n {_+ₛ_ _⋅ₛ_ : S → S → S}\n ⦃ vectorSpace : VectorSpace(_+ᵥ_)(_⋅ₛᵥ_)(_+ₛ_)(_⋅ₛ_) ⦄\n where\n\nopen VectorSpace(vectorSpace)\n\nopen import Logic\nopen import Logic.Predicate\nopen import Logic.Predicate.Equiv\nopen import Sets.ExtensionalPredicateSet as PredSet using (PredSet ; _∈_ ; [∋]-binaryRelator)\nopen import Structure.Container.SetLike using (SetElement)\nprivate open module SetLikeFunctionProperties{ℓ} = Structure.Container.SetLike.FunctionProperties{C = PredSet{ℓ}(V)}(_∈_)\nopen import Structure.Operator.Vector\nopen import Structure.Operator.Vector.LinearCombination ⦃ vectorSpace = vectorSpace ⦄\nopen import Syntax.Transitivity\n\nprivate variable ℓ : Lvl.Level\n\n-- A subspace is a subset of V such that it is a vector space under the same operators.\nrecord Subspace (Vₛ : PredSet{ℓ}(V)) : Stmt{ℓᵥ Lvl.⊔ ℓₛ Lvl.⊔ ℓ} where\n constructor intro\n field\n ⦃ add-closure ⦄ : Vₛ closed-under₂ (_+ᵥ_)\n ⦃ mul-closure ⦄ : ∀{s} → (Vₛ closed-under₁ (s ⋅ₛᵥ_))\n\n _+_ : SetElement(_∈_)(Vₛ) → SetElement(_∈_)(Vₛ) → SetElement(_∈_)(Vₛ)\n _+_ = [∃]-map₂(_+ᵥ_) (Vₛ closureUnder₂ (_+ᵥ_))\n\n _⋅_ : S → SetElement(_∈_)(Vₛ) → SetElement(_∈_)(Vₛ)\n _⋅_ s = [∃]-map(s ⋅ₛᵥ_) (Vₛ closureUnder₁ (s ⋅ₛᵥ_))\n\n -- TODO: A proof of this would be easier if a similar \"substructure\" relation was defined on groups and fields, but I am not sure if using PredSet is the correct choice (maybe this is unprovable when using this?). Another alternative is to use a general set structure by Structure.Container.SetLike\n postulate is-vectorSpace : VectorSpace{V = SetElement(_∈_)(Vₛ)}{S = S}(_+_)(_⋅_)(_+ₛ_)(_⋅ₛ_)\n -- is-vectorSpace = {!!}\n\nSubspaceObject : ∀{ℓ} → Stmt\nSubspaceObject{ℓ} = ∃(Subspace{ℓ})\n", "meta": {"hexsha": "6e2027db85cf4c8b4d513b6257bc10471387f874", "size": 1971, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Operator/Vector/Subspace.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Operator/Vector/Subspace.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Operator/Vector/Subspace.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.2244897959, "max_line_length": 300, "alphanum_fraction": 0.6991374937, "num_tokens": 775, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473813156294, "lm_q2_score": 0.785308580887758, "lm_q1q2_score": 0.6850618840621289}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Functor where\n\nopen import Level\nopen import Data.Product using (_×_; Σ)\nopen import Function.Surjection using (Surjective)\nopen import Function.Equality using (_⟶_)\nopen import Relation.Nullary\n\nopen import Categories.Category\nopen import Categories.Functor.Core public\nimport Categories.Morphism as Morphism\n\nprivate\n variable\n o ℓ e o′ ℓ′ e′ : Level\n C D : Category o ℓ e\n\nContravariant : ∀ (C : Category o ℓ e) (D : Category o′ ℓ′ e′) → Set _\nContravariant C D = Functor (Category.op C) D\n\nFaithful : Functor C D → Set _\nFaithful {C = C} {D = D} F = ∀ {X Y} → (f g : C [ X , Y ]) → D [ F₁ f ≈ F₁ g ] → C [ f ≈ g ]\n where open Functor F\n\nFull : Functor C D → Set _\nFull {C = C} {D = D} F = ∀ {X Y} → Surjective {To = D.hom-setoid {F₀ X} {F₀ Y}} G\n where\n module C = Category C\n module D = Category D\n open Functor F\n G : ∀ {X Y} → (C.hom-setoid {X} {Y}) ⟶ D.hom-setoid {F₀ X} {F₀ Y}\n G = record { _⟨$⟩_ = F₁ ; cong = F-resp-≈ }\n\nFullyFaithful : Functor C D → Set _\nFullyFaithful F = Full F × Faithful F\n\n-- Note that this is a constructive version of Essentially Surjective, which is\n-- quite a strong assumption.\nEssentiallySurjective : Functor C D → Set _\nEssentiallySurjective {C = C} {D = D} F = (d : Obj) → Σ C.Obj (λ c → Functor.F₀ F c ≅ d)\n where\n open Morphism D\n open Category D\n module C = Category C\n", "meta": {"hexsha": "c01b9fb28953d24fe548555e21ebe3bd9b33b5ea", "size": 1395, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Functor.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Functor.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.3260869565, "max_line_length": 92, "alphanum_fraction": 0.6451612903, "num_tokens": 466, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297967961707, "lm_q2_score": 0.760650658103136, "lm_q1q2_score": 0.6849885825744906}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category using (Category; module Definitions)\n\n-- Definition of the \"Twisted Arrow\" Category of a Category 𝒞\nmodule Categories.Category.Construction.TwistedArrow {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\nopen import Data.Product using (_,_; _×_; map; zip)\nopen import Function.Base using (_$_; flip)\nopen import Relation.Binary.Core using (Rel)\n\nimport Categories.Morphism as M\nopen M 𝒞\nopen import Categories.Morphism.Reasoning 𝒞\n\nopen Category 𝒞\nopen Definitions 𝒞\nopen HomReasoning\n\nprivate\n variable\n A B C : Obj\n\nrecord Morphism : Set (o ⊔ ℓ) where\n field\n {dom} : Obj\n {cod} : Obj\n arr : dom ⇒ cod\n\nrecord Morphism⇒ (f g : Morphism) : Set (ℓ ⊔ e) where\n constructor mor⇒\n private\n module f = Morphism f\n module g = Morphism g\n\n field\n {dom⇐} : g.dom ⇒ f.dom\n {cod⇒} : f.cod ⇒ g.cod\n square : cod⇒ ∘ f.arr ∘ dom⇐ ≈ g.arr\n\nTwistedArrow : Category (o ⊔ ℓ) (ℓ ⊔ e) e\nTwistedArrow = record\n { Obj = Morphism\n ; _⇒_ = Morphism⇒\n ; _≈_ = λ f g → dom⇐ f ≈ dom⇐ g × cod⇒ f ≈ cod⇒ g\n ; id = mor⇒ (identityˡ ○ identityʳ)\n ; _∘_ = λ {A} {B} {C} m₁ m₂ → mor⇒ {A} {C} (∘′ m₁ m₂ ○ square m₁)\n ; assoc = sym-assoc , assoc\n ; sym-assoc = assoc , sym-assoc\n ; identityˡ = identityʳ , identityˡ\n ; identityʳ = identityˡ , identityʳ\n ; identity² = identity² , identity²\n ; equiv = record\n { refl = refl , refl\n ; sym = map sym sym\n ; trans = zip trans trans\n }\n ; ∘-resp-≈ = zip (flip ∘-resp-≈) ∘-resp-≈\n }\n where\n open Morphism⇒\n open Equiv\n open HomReasoning\n ∘′ : ∀ {A B C} (m₁ : Morphism⇒ B C) (m₂ : Morphism⇒ A B) →\n (cod⇒ m₁ ∘ cod⇒ m₂) ∘ Morphism.arr A ∘ (dom⇐ m₂ ∘ dom⇐ m₁) ≈ cod⇒ m₁ ∘ Morphism.arr B ∘ dom⇐ m₁\n ∘′ {A} {B} {C} m₁ m₂ = begin\n (cod⇒ m₁ ∘ cod⇒ m₂) ∘ Morphism.arr A ∘ (dom⇐ m₂ ∘ dom⇐ m₁) ≈⟨ pullʳ sym-assoc ⟩\n cod⇒ m₁ ∘ (cod⇒ m₂ ∘ Morphism.arr A) ∘ (dom⇐ m₂ ∘ dom⇐ m₁) ≈⟨ refl⟩∘⟨ (pullˡ assoc) ⟩\n cod⇒ m₁ ∘ (cod⇒ m₂ ∘ Morphism.arr A ∘ dom⇐ m₂) ∘ dom⇐ m₁ ≈⟨ (refl⟩∘⟨ square m₂ ⟩∘⟨refl) ⟩\n cod⇒ m₁ ∘ Morphism.arr B ∘ dom⇐ m₁ ∎\n", "meta": {"hexsha": "01211c24734e0fa91fa6df27681fce15b06301fb", "size": 2127, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Construction/TwistedArrow.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Construction/TwistedArrow.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Construction/TwistedArrow.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 29.9577464789, "max_line_length": 99, "alphanum_fraction": 0.5905030559, "num_tokens": 930, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297914570319, "lm_q2_score": 0.7606506581031359, "lm_q1q2_score": 0.6849885785132711}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\n\nmodule InnerProduct where\n\nopen import Algebra.Bundles using (CommutativeRing)\nopen import NormedModule using (NormedModule)\nopen import Level using (_⊔_; suc)\nopen import Relation.Nullary using (¬_)\n\n\nmodule _\n {r ℓr} (CR : CommutativeRing r ℓr)\n m ℓm rel\n where\n\nmodule _\n {r ℓr} {CR : CommutativeRing r ℓr}\n (open CommutativeRing CR renaming (Carrier to S))\n {rel} {_<_ : S → S → Set rel} (STO : IsStrictTotalOrder _≈_ _<_)\n (_† : S → S) \n {m ℓm} (M : Module CR m ℓm)\n (open Module M renaming (Carrierᴹ to A))\n (⟨_,_⟩ : A → A → S)\n where\n\n record IsInnerProduct : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm ⊔ rel)) where\n field\n ⟨,⟩-linear-+ : ∀ x y z → ⟨ x +ᴹ y , z ⟩ ≈ ⟨ x , z ⟩ + ⟨ y , z ⟩\n ⟨,⟩-linear-* : ∀ s x y → ⟨ s *ₗ x , y ⟩ ≈ s * ⟨ x , y ⟩\n ⟨,⟩-cong : ∀ {x y} → x ≈ᴹ y → ⟨ x , x ⟩ ≈ ⟨ y , y ⟩\n †-linear-+ : ∀ x y → (x + y) † ≈ x † + y †\n †-cong : ∀ {s t} → s ≈ t → s † ≈ t †\n †-inv : ∀ s → (s †) † ≈ s\n ⟨,⟩-herm : ∀ x y → ⟨ x , y ⟩ ≈ ⟨ y , x ⟩ †\n\n real : S → Set _\n real s = s ≈ s †\n\n field\n ⟨x,x⟩-real : ∀ x → real ⟨ x , x ⟩\n positive-definite : ∀ {x} → ¬ (x ≈ᴹ 0ᴹ) → 0# < ⟨ x , x ⟩\n\n open IsStrictTotalOrder STO public\n open import Relation.Binary.Construct.StrictToNonStrict _≈_ _<_ public using (_≤_)\n\n\n _-ᴹ_ : A → A → A\n x -ᴹ y = x +ᴹ (-ᴹ y)\n\n ∥_∥² : A → S\n ∥ x ∥² = ⟨ x , x ⟩\n\n -- TODO\n -- is this universally true?\n -- or just common?\n ∥-x∥²≈∥x∥² : ∀ x → ∥ -ᴹ x ∥² ≈ ∥ x ∥²\n ∥-x∥²≈∥x∥² = {! !}\n\n -- ∥a-b∥≤∥a∥-∥b∥ : ∀ a b → ∥ a -ᴹ b ∥² ≤ ∥ a ∥² - ∥ b ∥²\n -- ∥a-b∥≤∥a∥-∥b∥ = {! !}\n\n \n [s+s†]†≈s+s† : ∀ s → (s + s †) † ≈ s + s †\n [s+s†]†≈s+s† s =\n begin\n (s + s †) †\n ≈⟨ †-linear-+ s (s †) ⟩\n (s † + (s †) †) \n ≈⟨ +-cong refl (†-inv _) ⟩\n (s † + s) \n ≈⟨ +-comm _ _ ⟩\n (s + s †)\n ∎\n where open import Relation.Binary.Reasoning.Setoid setoid\n\n\n", "meta": {"hexsha": "e61ccac0e0149e30e2a3cd1b5bc48b17f127af16", "size": 1961, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/InnerProduct.agda", "max_stars_repo_name": "cspollard/diff", "max_stars_repo_head_hexsha": "78c3dec24834ffeca5e74cb75578e9b210a5be62", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/InnerProduct.agda", "max_issues_repo_name": "cspollard/diff", "max_issues_repo_head_hexsha": "78c3dec24834ffeca5e74cb75578e9b210a5be62", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/InnerProduct.agda", "max_forks_repo_name": "cspollard/diff", "max_forks_repo_head_hexsha": "78c3dec24834ffeca5e74cb75578e9b210a5be62", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.4675324675, "max_line_length": 86, "alphanum_fraction": 0.4441611423, "num_tokens": 948, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297834483234, "lm_q2_score": 0.7606506526772884, "lm_q1q2_score": 0.6849885675353043}} {"text": "module Logic.Predicate.Equiv where\n\nimport Lvl\nopen import Logic\nopen import Logic.Predicate\nopen import Structure.Setoid\nopen import Structure.Relator.Equivalence\nopen import Structure.Relator.Properties\nopen import Type\n\nprivate variable ℓ ℓₑ : Lvl.Level\nprivate variable Obj : Type{ℓ}\nprivate variable Pred : Obj → Stmt{ℓ}\n\nmodule _ ⦃ _ : Equiv{ℓₑ}(Obj) ⦄ where\n _≡∃_ : ∃{Obj = Obj}(Pred) → ∃{Obj = Obj}(Pred) → Stmt\n [∃]-intro x ≡∃ [∃]-intro y = x ≡ y\n\n instance\n [≡∃]-reflexivity : Reflexivity(_≡∃_ {Pred = Pred})\n Reflexivity.proof [≡∃]-reflexivity = reflexivity(_≡_)\n\n instance\n [≡∃]-symmetry : Symmetry(_≡∃_ {Pred = Pred})\n Symmetry.proof [≡∃]-symmetry = symmetry(_≡_)\n\n instance\n [≡∃]-transitivity : Transitivity(_≡∃_ {Pred = Pred})\n Transitivity.proof [≡∃]-transitivity = transitivity(_≡_)\n\n instance\n [≡∃]-equivalence : Equivalence(_≡∃_ {Pred = Pred})\n [≡∃]-equivalence = intro\n\n instance\n [≡∃]-equiv : Equiv{ℓₑ}(∃{Obj = Obj} Pred)\n [≡∃]-equiv = intro(_≡∃_) ⦃ [≡∃]-equivalence ⦄\n", "meta": {"hexsha": "5b9ea78ed7996225f4d8b6c4aa99236e312d0289", "size": 1032, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Logic/Predicate/Equiv.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Logic/Predicate/Equiv.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Logic/Predicate/Equiv.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.1578947368, "max_line_length": 60, "alphanum_fraction": 0.6472868217, "num_tokens": 394, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.907312221360624, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.6849435886703957}} {"text": "module Sets.BoolSet.Proofs{ℓ₁} where\n\nopen import Data.Boolean\nopen import Data.Boolean.Proofs\nopen import Functional\nopen import Logic.Propositional\nopen import Sets.BoolSet{ℓ₁}\nopen import Type\n\nmodule _ {ℓ₂}{T : Type{ℓ₂}} where\n [∈]-in-[∪] : ∀{a : T}{S₁ S₂ : BoolSet(T)} → (a ∈ S₁) → (a ∈ (S₁ ∪ S₂))\n [∈]-in-[∪] proof-a = [∨]-introₗ-[𝑇] proof-a\n\n [∈]-in-[∩] : ∀{a : T}{S₁ S₂ : BoolSet(T)} → (a ∈ S₁) → (a ∈ S₂) → (a ∈ (S₁ ∩ S₂))\n [∈]-in-[∩] proof-a₁ proof-a₂ = [∧]-intro-[𝑇] proof-a₁ proof-a₂\n\n [∈]-in-[∖] : ∀{a : T}{S₁ S₂ : BoolSet(T)} → (a ∈ S₁) → (a ∉ S₂) → (a ∈ (S₁ ∖ S₂))\n [∈]-in-[∖] proof-a₁ proof-a₂ = [∧]-intro-[𝑇] proof-a₁ proof-a₂\n\n [∈]-in-[∁] : ∀{a : T}{S : BoolSet(T)} → (a ∉ S) → (a ∈ (∁ S))\n [∈]-in-[∁] = id\n", "meta": {"hexsha": "12d4a8b4fb3fb2172921abbc077b8fe513f52b17", "size": 733, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Sets/BoolSet/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Sets/BoolSet/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Sets/BoolSet/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.3181818182, "max_line_length": 83, "alphanum_fraction": 0.5129604366, "num_tokens": 364, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9489172673767973, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.6848745910676847}} {"text": "import Lvl\nopen import Structure.Setoid\nopen import Type\n\nmodule Structure.Operator.Vector.Subspaces.Image\n {ℓₛ ℓₛₑ}\n {S : Type{ℓₛ}}\n ⦃ equiv-S : Equiv{ℓₛₑ}(S) ⦄\n {_+ₛ_ _⋅ₛ_ : S → S → S}\n where\n\nopen import Logic.Predicate\nopen import Sets.ExtensionalPredicateSet as PredSet using (PredSet ; _∈_ ; [∋]-binaryRelator)\nopen import Structure.Container.SetLike as SetLike using (SetElement)\nopen import Structure.Function.Multi\nopen import Structure.Operator\nopen import Structure.Operator.Properties\nopen import Structure.Operator.Vector\nopen import Structure.Operator.Vector.LinearMap\nopen import Structure.Operator.Vector.Proofs\nopen import Structure.Operator.Vector.Subspace\nopen import Structure.Relator.Properties\nopen import Syntax.Function\nopen import Syntax.Implication\nopen import Syntax.Transitivity\n\nopen VectorSpace ⦃ … ⦄\nopen VectorSpaceVObject ⦃ … ⦄ using (_+ᵥ_; _⋅ₛᵥ_)\nopen VectorSpaceVObject using (Vector)\n\nprivate variable ℓ ℓᵥ ℓᵥₑ : Lvl.Level\nprivate variable V W : VectorSpaceVObject {ℓᵥ = ℓᵥ} {ℓᵥₑ = ℓᵥₑ} ⦃ equiv-S = equiv-S ⦄ (_+ₛ_)(_⋅ₛ_)\nprivate variable F : V →ˡⁱⁿᵉᵃʳᵐᵃᵖ W\n\nimage : (V →ˡⁱⁿᵉᵃʳᵐᵃᵖ W) → PredSet(Vector(W))\nimage {V = V}{W = W} ([∃]-intro f) = PredSet.⊶ f\n\nimage-subspace : Subspace(image(F))\nSetLike.FunctionProperties._closed-under₂_.proof (Subspace.add-closure (image-subspace {_} {_} {V} {_} {_} {W} {F = F@([∃]-intro f)})) {x} {y} xim yim =\n • (\n xim ⇒\n x ∈ image(F) ⇒-[]\n ∃(a ↦ f(a) ≡ x) ⇒-end\n )\n • (\n yim ⇒\n y ∈ image(F) ⇒-[]\n ∃(a ↦ f(a) ≡ y) ⇒-end\n ) ⇒₂-[ [∃]-map₂ (_+ᵥ_) (p ↦ q ↦ (preserving₂(f)(_+ᵥ_)(_+ᵥ_) 🝖 congruence₂(_+ᵥ_) p q)) ]\n ∃(a ↦ f(a) ≡ x +ᵥ y) ⇒-[]\n (x +ᵥ y) ∈ image(F) ⇒-end\n where\n instance _ = V\n instance _ = W\nSetLike.FunctionProperties._closed-under₁_.proof (Subspace.mul-closure (image-subspace {_} {_} {V} {_} {_} {W} {F = F@([∃]-intro f)}) {s}) {v} vim =\n vim ⇒\n v ∈ image(F) ⇒-[]\n ∃(x ↦ f(x) ≡ v) ⇒-[ [∃]-map-proof (congruence₂ᵣ(_⋅ₛᵥ_)(s)) ]\n ∃(x ↦ s ⋅ₛᵥ f(x) ≡ s ⋅ₛᵥ v) ⇒-[ [∃]-map (s ⋅ₛᵥ_) (preserving₁(f)(s ⋅ₛᵥ_)(s ⋅ₛᵥ_) 🝖_) ]\n ∃(x ↦ f(x) ≡ s ⋅ₛᵥ v) ⇒-[]\n (s ⋅ₛᵥ v) ∈ image(F) ⇒-end\n where\n instance _ = V\n instance _ = W\n", "meta": {"hexsha": "f92df6a73514bcefe518a9fb76971fe3b6794db9", "size": 2249, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Operator/Vector/Subspaces/Image.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Operator/Vector/Subspaces/Image.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Operator/Vector/Subspaces/Image.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.6, "max_line_length": 152, "alphanum_fraction": 0.6087149844, "num_tokens": 954, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9252299612154571, "lm_q2_score": 0.7401743505760728, "lm_q1q2_score": 0.684831485676176}} {"text": "{- Name: Bowornmet (Ben) Hudson\n\n--Preorders 2: Electric Boogaloo--\n\n-}\n\nopen import Preliminaries\n\nmodule Preorder-withmax where\n\n {- Doing the same thing as we did in Preorder.agda but this\n time we want to keep our end goal in mind and extend the\n notion of preorders to include information about maximums\n as well. This will make it easier to 'ensure' that functions\n on nats are monotone (because they sometimes aren't - e.g.\n sine, cosine, etc.) so we can give them a reasonable upper bound.\n If we don't monotonize functions on nats then that makes bounding\n more complicated. This also means we have to extend the idea of\n maximums to all our other types...\n -}\n record Preorder-max-str (A : Set) : Set1 where\n constructor preorder-max\n field\n ≤ : A → A → Set\n refl : ∀ x → ≤ x x\n trans : ∀ x y z → ≤ x y → ≤ y z → ≤ x z\n max : A → A → A\n max-l : ∀ l r → ≤ l (max l r)\n max-r : ∀ l r → ≤ r (max l r)\n max-lub : ∀ k l r → ≤ l k → ≤ r k → ≤ (max l r) k\n\n------------------------------------------\n\n -- order on nats\n ≤nat : Nat → Nat → Set\n ≤nat Z Z = Unit\n ≤nat Z (S y) = Unit\n ≤nat (S x) Z = Void\n ≤nat (S x) (S y) = ≤nat x y\n\n -- proof that Nat is reflexive under ≤\n nat-refl : ∀ (x : Nat) → ≤nat x x\n nat-refl Z = <>\n nat-refl (S x) = nat-refl x\n\n -- proof that Nat is transitive under ≤\n nat-trans : ∀ (x y z : Nat) → ≤nat x y → ≤nat y z → ≤nat x z\n nat-trans Z Z Z p q = <>\n nat-trans Z Z (S z) p q = <>\n nat-trans Z (S y) Z p q = <>\n nat-trans Z (S y) (S z) p q = <>\n nat-trans (S x) Z Z p q = p\n nat-trans (S x) Z (S z) () q\n nat-trans (S x) (S y) Z p ()\n nat-trans (S x) (S y) (S z) p q = nat-trans x y z p q\n\n -- nat max\n nat-max : Nat → Nat → Nat\n nat-max Z n = n\n nat-max (S m) Z = S m\n nat-max (S m) (S n) = S (nat-max m n)\n\n -- left max\n nat-max-l : ∀ (l r : Nat) → ≤nat l (nat-max l r)\n nat-max-l Z Z = <>\n nat-max-l Z (S n) = <>\n nat-max-l (S m) Z = nat-refl m\n nat-max-l (S m) (S n) = nat-max-l m n\n\n -- right max\n nat-max-r : ∀ (l r : Nat) → ≤nat r (nat-max l r)\n nat-max-r Z Z = <>\n nat-max-r Z (S n) = nat-refl n\n nat-max-r (S m) Z = <>\n nat-max-r (S m) (S n) = nat-max-r m n\n\n -- rub a dub dub, Nats have a lub\n nat-max-lub : ∀ (k l r : Nat) → ≤nat l k → ≤nat r k → ≤nat (nat-max l r) k\n nat-max-lub Z Z Z p q = <>\n nat-max-lub Z Z (S r) p ()\n nat-max-lub Z (S l) Z () q\n nat-max-lub Z (S l) (S r) () q\n nat-max-lub (S k) Z Z p q = <>\n nat-max-lub (S k) Z (S r) p q = q\n nat-max-lub (S k) (S l) Z p q = p\n nat-max-lub (S k) (S l) (S r) p q = nat-max-lub k l r p q\n\n -- Nat is preorder with max\n nat-p : Preorder-max-str Nat\n nat-p = preorder-max ≤nat nat-refl nat-trans nat-max nat-max-l nat-max-r nat-max-lub\n\n------------------------------------------\n\n--same thing for products\n\n -- relation for products\n ≤axb : ∀ {A B : Set} → Preorder-max-str A → Preorder-max-str B → (A × B) → (A × B) → Set\n ≤axb PA PB (a1 , b1) (a2 , b2) = Preorder-max-str.≤ PA a1 a2 × Preorder-max-str.≤ PB b1 b2\n\n axb-refl : ∀ {A B : Set} → (PA : Preorder-max-str A) → (PB : Preorder-max-str B) → (x : (A × B)) → ≤axb PA PB x x\n axb-refl PA PB (a , b) = Preorder-max-str.refl PA a , Preorder-max-str.refl PB b\n\n axb-trans : ∀ {A B : Set} → (PA : Preorder-max-str A) → (PB : Preorder-max-str B) → (x y z : (A × B)) → ≤axb PA PB x y → ≤axb PA PB y z → ≤axb PA PB x z\n axb-trans PA PB (a1 , b1) (a2 , b2) (a3 , b3) (a1\n nat-lemma3 (S x) = nat-lemma3 x\n\n -- maps to and from the old and new definitions of the ≤ relation\n ≤-map : (x y : Nat) → ≤nat x y → x ≤' y\n ≤-map Z Z f = x≤'x\n ≤-map Z (S y) f = nat-lemma (S y)\n ≤-map (S x) Z ()\n ≤-map (S x) (S y) f = nat-lemma2 x y (≤-map x y f)\n\n ≤-map2 : (x y : Nat) → x ≤' y → ≤nat x y\n ≤-map2 .y y x≤'x = nat-refl y\n ≤-map2 x .(S y) (x≤'y {.x} {y} f) = nat-trans x y (S y) (≤-map2 x y f) (nat-lemma3 y)\n\n -- a function to find the maximum of a whole set and not just a pair of values\n max' : ∀ {A : Set} → (PA : Preorder-max-str A) → Nat → (Nat → A) → A\n max' PA Z f = f Z\n max' PA (S n) f = Preorder-max-str.max PA (f (S n)) (max' PA n f)\n\n -- primitive recursion function corresponding to rec\n natrec : ∀{C : Set} → C → (Nat → C → C) → Nat → C\n natrec base step Z = base\n natrec base step (S n) = step n (natrec base step n)\n\n -- another lemma\n mono-f-lemma : ∀ {A : Set} → (x y : Nat) → x ≤' y → (PA : Preorder-max-str A) → (f : Nat → A) → Preorder-max-str.≤ PA (max' PA x f) (max' PA y f)\n mono-f-lemma .y y x≤'x PA f = Preorder-max-str.refl PA (max' PA y f)\n mono-f-lemma x .(S y) (x≤'y {.x} {y} p) PA f = Preorder-max-str.trans PA (max' PA x f) (max' PA y f) (max' PA (S y) f)\n (mono-f-lemma x y p PA f) (Preorder-max-str.max-r PA (f (S y)) (max' PA y f))\n\n -- make a function monotone by taking the max at every point\n mono-f : ∀ {A : Set} → (PA : Preorder-max-str A) → (f : Nat → A) → Monotone Nat A nat-p PA\n mono-f PA f = monotone (λ x → max' PA x f) (λ x y x₁ → mono-f-lemma x y (≤-map x y x₁) PA f)\n\n -- f ≤ (monotonization of f)\n mono-f-is-monotone : ∀ {A : Set} → (PA : Preorder-max-str A) → (x : Nat) → (f : Nat → A) → Preorder-max-str.≤ PA (f x) (Monotone.f (mono-f PA f) x)\n mono-f-is-monotone PA Z f = Preorder-max-str.refl PA (f Z)\n mono-f-is-monotone PA (S x) f = Preorder-max-str.max-l PA (f (S x)) (max' PA x f)\n\n -- if f is already monotone, then its monotonization is less than or equal to itself\n mono-f-≤-itself : ∀ {A : Set}\n → (PA : Preorder-max-str A)\n → (x : Nat)\n → (f : Monotone Nat A nat-p PA)\n → Preorder-max-str.≤ PA (Monotone.f (mono-f PA (Monotone.f f)) x) (Monotone.f f x)\n mono-f-≤-itself PA Z f = Preorder-max-str.refl PA (Monotone.f (mono-f PA (Monotone.f f)) Z)\n mono-f-≤-itself PA (S x) f = Preorder-max-str.max-lub PA (Monotone.f f (S x)) (Monotone.f f (S x)) (max' PA x (Monotone.f f)) \n (Preorder-max-str.refl PA (Monotone.f f (S x))) \n (Preorder-max-str.trans PA (max' PA x (Monotone.f f)) \n (Monotone.f f x) (Monotone.f f (S x)) (mono-f-≤-itself PA x f)\n (Monotone.is-monotone f x (S x) (≤-map2 x (S x) (x≤'y x≤'x))))\n\n -- monotonize at the end\n mnatrec : ∀ {A : Set} → (PA : Preorder-max-str A) → A → (Nat → A → A) → Nat → A\n mnatrec PA zc sc e = max' PA e (natrec zc sc)\n\n -- still incorrect\n mono-natrec : ∀ {A : Set} → (PA : Preorder-max-str A) → A → (Nat → A → A) → Nat → A\n mono-natrec PA zc sc Z = zc\n mono-natrec PA zc sc (S y') = Preorder-max-str.max PA zc (sc y' (mono-natrec PA zc sc y'))\n\n data N' : Set where\n Z1 : N'\n Sa : N' → N'\n Sb : N' → N'\n\n\n\n------------------------------------------\n\n-- same thing as Preorder.agda but for this module\n\n PREORDER = Σ (λ (A : Set) → Preorder-max-str A)\n\n MONOTONE : (PΓ PA : PREORDER) → Set\n MONOTONE (Γ , PΓ) (A , PA) = Monotone Γ A PΓ PA\n\n -- some operations\n _×p_ : PREORDER → PREORDER → PREORDER\n (A , PA) ×p (B , PB) = A × B , axb-p A B PA PB\n\n _->p_ : PREORDER → PREORDER → PREORDER\n (A , PA) ->p (B , PB) = Monotone A B PA PB , mono-p A B PA PB\n\n -- Unit is a preorder\n unit-p : PREORDER\n unit-p = Unit , preorder-max (λ x x₁ → Unit) (λ x → <>) (λ x y z _ _ → <>) (λ _ _ → <>) (λ l r → <>) (λ l r → <>) (λ k l r _ _ → <>)\n\n -- identity preserves monotonicity\n id : ∀ {Γ} → MONOTONE Γ Γ\n id = λ {Γ} → monotone (λ x → x) (λ x y x₁ → x₁)\n\n -- composition preserves monotonicity\n comp : ∀ {PA PB PC} → MONOTONE PA PB → MONOTONE PB PC → MONOTONE PA PC\n comp (monotone f f-ismono) (monotone g g-ismono) = monotone (λ x → g (f x)) (λ x y x₁ → g-ismono (f x) (f y) (f-ismono x y x₁))\n\n -- proofs that types like pairs etc. with preorders are monotone\n pair' : ∀ {PΓ PA PB} → MONOTONE PΓ PA → MONOTONE PΓ PB → MONOTONE PΓ (PA ×p PB)\n pair' (monotone f f-ismono) (monotone g g-ismono) = monotone (λ x → (f x) , (g x)) (λ x y x₁ → f-ismono x y x₁ , g-ismono x y x₁)\n\n fst' : ∀ {PΓ PA PB} → MONOTONE PΓ (PA ×p PB) → MONOTONE PΓ PA\n fst' (monotone f f-ismono) = \n monotone (λ x → fst (f x)) (λ x y z → fst (f-ismono x y z))\n\n snd' : ∀ {PΓ PA PB} → MONOTONE PΓ (PA ×p PB) → MONOTONE PΓ PB\n snd' (monotone f f-ismono) = \n monotone (λ x → snd (f x)) (λ x y z → snd (f-ismono x y z))\n\n lam' : ∀ {PΓ PA PB} → MONOTONE (PΓ ×p PA) PB → MONOTONE PΓ (PA ->p PB)\n lam' {Γ , preorder-max _ reflΓ _ _ _ _ _} {A , preorder-max _ refla _ _ _ _ _} (monotone f f-ismono) =\n monotone (λ x → monotone (λ p → f (x , p)) (λ a b c → f-ismono (x , a) (x , b) ((reflΓ x) , c))) (λ x y z w → f-ismono (x , w) (y , w) (z , (refla w)))\n\n app' : ∀ {PΓ PA PB} → MONOTONE PΓ (PA ->p PB) → MONOTONE PΓ PA → MONOTONE PΓ PB\n app' {_} {_} {b , preorder-max _ _ transb _ _ _ _} (monotone f f-ismono) (monotone g g-ismono) =\n monotone (λ x → Monotone.f (f x) (g x)) (λ x y z → transb (Monotone.f (f x) (g x)) (Monotone.f (f y) (g x)) (Monotone.f (f y) (g y))\n (f-ismono x y z (g x)) (Monotone.is-monotone (f y) (g x) (g y) (g-ismono x y z)))\n", "meta": {"hexsha": "e9b9c778158f2286af78aff460d9303d8acffe9e", "size": 14306, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "complexity-drafts/Preorder-withmax.agda", "max_stars_repo_name": "benhuds/Agda", "max_stars_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-04-26T20:22:22.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-08T12:27:18.000Z", "max_issues_repo_path": "complexity-drafts/Preorder-withmax.agda", "max_issues_repo_name": "benhuds/Agda", "max_issues_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-03-23T08:39:04.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-12T00:32:45.000Z", "max_forks_repo_path": "complexity-drafts/Preorder-withmax.agda", "max_forks_repo_name": "benhuds/Agda", "max_forks_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 47.3708609272, "max_line_length": 171, "alphanum_fraction": 0.5311757305, "num_tokens": 5593, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171068, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.68478309225726}} {"text": "{-\n Agda file from the exercise session(s).\n-}\n\n{-# OPTIONS --without-K #-}\n\nopen import Agda.Primitive\n\n{-\n Two inductive implementations of the\n Martin-Löf identity type\n aka\n equality type\n aka\n identification type\n aka\n path type.\n-}\n\ndata _≡_ {A : Set} (a : A) : A → Set where\n refl : a ≡ a\n\ninfixr 10 _≡_\n\n-- explcit\ndata _≡'_ {A : Set} : A → A → Set where\n refl : (a : A) → a ≡' a\n\n-- variables can be used later and are understood as Pi-quantified.\nvariable\n A B C : Set\n\n-- sym' for ≡'\nsym' : {a b : A} → a ≡' b → b ≡' a\nsym' {a = x} {.x} (refl .x) = refl x\n\n-- sym for ≡\nsym : {a b : A} → a ≡ b → b ≡ a\nsym refl = refl\n\n_⁻¹ = sym\n\nsymsym : {a b : A} → (p : a ≡ b) → sym (sym p) ≡ p\nsymsym refl = refl\n\nap : (f : A → B) → {a b : A} → a ≡ b → f a ≡ f b\nap f {a} {.a} refl = refl\n\n_∘_ : {A B C : Set} → (g : B → C) → (f : A → B) → A → C\ng ∘ f = λ x → g (f x)\n\ninfixl 26 _∘_\n\nap-g∘f : (f : A → B) (g : B → C) {a b : A} (p : a ≡ b)\n → ap (g ∘ f) p ≡ (ap g ∘ ap f) p\nap-g∘f f g refl = refl\n\ntrans : {a b c : A} → a ≡ b → b ≡ c → a ≡ c\ntrans refl q = q\n\n_∙_ = trans\ninfixr 30 _∙_\n\nsym-refl : {a b : A} → (p : a ≡ b) → (p ⁻¹) ∙ p ≡ refl\nsym-refl refl = refl\n\ntrans2 : {a b c : A} -> a ≡ b -> b ≡ c -> a ≡ c\ntrans2 p refl = p\n\ntrans-trans2 : {a b c : A} -> (p : a ≡ b) -> (q : b ≡ c)\n -> trans p q ≡ trans2 p q\ntrans-trans2 {a = x} {b = .x} {c = .x} refl refl = refl\n\ntrans3 : {a b c : A} -> a ≡ b -> b ≡ c -> a ≡ c\ntrans3 refl refl = refl\n\ntrans-trans3 : {a b c : A} -> (p : a ≡ b) -> (q : b ≡ c)\n -> trans p q ≡ trans3 p q\ntrans-trans3 {a = x} {b = .x} {c = .x} refl refl = refl\n\ntest : {a c : A} → (q : a ≡ c) → trans refl q ≡ q\ntest q = refl\n\ntest2 : {a c : A} → (q : a ≡ c) → trans2 q refl ≡ q\ntest2 q = refl\n\ntest3 : {a c : A} → (q : a ≡ c) → trans3 refl q ≡ q\ntest3 refl = refl\n\n{-\n In test3 above, we have to pattern match (path induct) on q!\n What if we cannot, as in\n test4 : {a : A} → (q : a ≡ a) → trans3 refl q ≡ q\n ?\n-}\n\n-- solution:\ntest4 : {a : A} → (q : a ≡ a) → trans3 refl q ≡ q\ntest4 q = test3 q\n\n-- We can only pattern match on q if we remove the --without-K option:\nuip : {a b : A} → (p q : a ≡ b) → p ≡ q\nuip {a = x} {b = .x} refl q = {!q!}\n\n-- implementation of the J eliminator (aka path induction)\nmodule _ (C : (a b : A) → a ≡ b → Set) where\n\n J-elim : (d : (a : A) → C a a refl) → (a b : A) → (p : a ≡ b) → C a b p\n J-elim d a .a refl = d a\n\n-- implementation of the Paulin-Mohring version of J (based bath induction)\nmodule _ (a₀ : A) (C : (b : A) → a₀ ≡ b → Set) where\n\n J-elim-PM : (d : C a₀ refl) → (b : A) → (p : a₀ ≡ b) → C b p\n J-elim-PM d b refl = d\n\n-- this is \"Axiom K\" (which is disabled in the options)\nmodule _ (a₀ : A) (C : a₀ ≡ a₀ → Set) where\n\n K : (d : C refl) → (p : a₀ ≡ a₀) → C p\n K d p = {!p!}\n\n-- Caveat:\n-- judgmental equality in Agda: = but on paper: ≡\n-- path type in Agda: ≡ but on paper: =\n\nrecord Σ (A : Set) (B : A → Set) : Set where\n constructor _,_\n field\n fst : A\n snd : B fst\n\nopen Σ public\ninfixr 4 _,_\n\n_×_ : (A B : Set) → Set\nA × B = Σ A (λ _ → B)\n\n{-\n Exercise 5\n For a given function f : A -> B, a *pointwise left inverse* is a\n function g : B -> A such that (a : A) -> g (f a) = a.\n\n Show: If f has a pointwise left inverse then, for all a,b : A, the\n function ap_f {a} {b} has a pointwise left inverse. (Does the other\n direction hold as well?)\n\n Solution of the easy part:\n-}\n\nhas-ptw-left-inv : {A B : Set} → (f : A → B) → Set\nhas-ptw-left-inv {A} {B} f = Σ (B → A) λ g → (a : A) → g (f a) ≡ a\n\nptw-left-inv-ap : {A B : Set} → (f : A → B) →\n has-ptw-left-inv f →\n {a₁ a₂ : A} → has-ptw-left-inv (ap f {a₁} {a₂})\nptw-left-inv-ap f (g , g∘f) {a₁} {a₂} =\n (λ q → (g∘f a₁ ⁻¹) ∙ ap g {f a₁} {f a₂} q ∙ g∘f a₂) ,\n λ {refl → sym-refl (g∘f a₁) }\n\n{-\n Exercise 6: a1 a2 : A, b1 b2 : B\n (a1 , b1) ≡ (a2 , b2) is equivalent to (a1 = a2) × (b1 = b2).\n\n Exercise 7:\n eqv2iso : isEqv(f) -> isIso(f) [easy]\n iso2eqv : isIso(f) -> isEqv(f) [hard]\n-}\n\nmodule _ (A B : Set) (g : B → A) (a b : B) where\n\n lemma : (pair1 pair2 : Σ A λ x → x ≡ g a) → pair1 ≡ pair2\n lemma (.(g a) , refl) (.(g a) , refl) = refl\n\n wrong : (pair1 pair2 : Σ A λ x → g a ≡ g b) → pair1 ≡ pair2\n wrong (x1 , p1) (x2 , p2) = {!p1!}\n\nsplit-equality : {x y : A × B} → x ≡ y → (fst x ≡ fst y) × (snd x ≡ snd y)\nsplit-equality = {!!}\n\ncombine-equalities : {x y : A × B} → (fst x ≡ fst y) × (snd x ≡ snd y) → x ≡ y\ncombine-equalities = {!!}\n", "meta": {"hexsha": "9fc55a7140fc88c34132227b51fafd1d5690c867", "size": 4535, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Homotopy Type Theory/exercises.agda", "max_stars_repo_name": "FoxySeta/mgs-2021", "max_stars_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Homotopy Type Theory/exercises.agda", "max_issues_repo_name": "FoxySeta/mgs-2021", "max_issues_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-07-14T20:34:53.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-14T20:35:48.000Z", "max_forks_repo_path": "Homotopy Type Theory/exercises.agda", "max_forks_repo_name": "FoxySeta/mgs-2021", "max_forks_repo_head_hexsha": "f328e596d98a7d052b34144447dd14de0f57e534", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.781420765, "max_line_length": 78, "alphanum_fraction": 0.4974641676, "num_tokens": 1977, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711718571775, "lm_q2_score": 0.8056321959813275, "lm_q1q2_score": 0.6847641417041203}} {"text": "open import Data.Empty using ( ⊥ )\nopen import Data.Nat using ( ℕ ; zero ; suc ; _+_ ; _≤_ ; z≤n ; s≤s )\nopen import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; sym ; cong )\nopen import Relation.Binary.PropositionalEquality.TrustMe using ( trustMe )\nopen import Relation.Nullary using ( ¬_ )\n\nmodule FRP.LTL.Util where\n\ninfixr 5 _trans_ _∋_\n\n-- Irrelevant projections\n\npostulate\n .irrelevant : ∀ {A : Set} → .A → A\n\n-- Irrelevant ≡ can be promoted to relevant ≡\n\n≡-relevant : ∀ {A : Set} {a b : A} → .(a ≡ b) → (a ≡ b)\n≡-relevant a≡b = trustMe\n\n-- A version of ⊥-elim which takes an irrelevant argument\n\n⊥-elim : {A : Set} → .⊥ → A\n⊥-elim ()\n\n-- An infix variant of trans\n\n_trans_ : ∀ {X : Set} {x y z : X} → (x ≡ y) → (y ≡ z) → (x ≡ z)\nrefl trans refl = refl\n\n-- Help the type inference engine out by being explicit about X.\n\n_∋_ : (X : Set) → X → X\nX ∋ x = x\n\n-- Lemmas about addition on ℕ\n-- These are from Data.Nat.Properties,\n-- included here to avoid having to load all of Data.Nat.Properties' dependencies.\n\nm+1+n≡1+m+n : ∀ m n → m + suc n ≡ suc (m + n)\nm+1+n≡1+m+n zero n = refl\nm+1+n≡1+m+n (suc m) n = cong suc (m+1+n≡1+m+n m n)\n\n+-comm : ∀ m n → (m + n ≡ n + m)\n+-comm zero zero = refl\n+-comm zero (suc n) = cong suc (+-comm zero n)\n+-comm (suc m) n = (cong suc (+-comm m n)) trans (sym (m+1+n≡1+m+n n m))\n\n+-assoc : ∀ l m n → ((l + m) + n ≡ l + (m + n))\n+-assoc zero m n = refl\n+-assoc (suc l) m n = cong suc (+-assoc l m n)\n\nm+n≡0-impl-m≡0 : ∀ m n → (m + n ≡ 0) → (m ≡ 0)\nm+n≡0-impl-m≡0 zero n m+n≡0 = refl\nm+n≡0-impl-m≡0 (suc m) n ()\n\n1+n≰n : ∀ n → ¬(suc n ≤ n)\n1+n≰n zero ()\n1+n≰n (suc n) (s≤s m≤n) = 1+n≰n n m≤n\n\n≤0-impl-≡0 : ∀ {n} → (n ≤ 0) → (n ≡ 0)\n≤0-impl-≡0 z≤n = refl\n", "meta": {"hexsha": "00d816bb840fc7b7b056ad7e2983b71a097f6f39", "size": 1732, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/FRP/LTL/Util.agda", "max_stars_repo_name": "agda/agda-frp-ltl", "max_stars_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-02T20:25:05.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-15T02:51:13.000Z", "max_issues_repo_path": "src/FRP/LTL/Util.agda", "max_issues_repo_name": "agda/agda-frp-ltl", "max_issues_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2015-03-01T07:01:31.000Z", "max_issues_repo_issues_event_max_datetime": "2015-03-02T15:23:53.000Z", "max_forks_repo_path": "src/FRP/LTL/Util.agda", "max_forks_repo_name": "agda/agda-frp-ltl", "max_forks_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-03-01T07:33:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:04.000Z", "avg_line_length": 27.4920634921, "max_line_length": 83, "alphanum_fraction": 0.564665127, "num_tokens": 728, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711718571774, "lm_q2_score": 0.8056321936479701, "lm_q1q2_score": 0.6847641397208336}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category using (Category; module Commutation)\n\n-- The \"four middle interchange\" for monoidal categories.\n--\n-- Aka the \"interchange law\" or \"exchange law\" (though those terms are\n-- more comonly used in the more general context of composition in\n-- 2-categories).\n\n-- Section 5.3 of the PhD thesis of Geoff Cruttwell states most (all?)\n-- the properties in the module, starting on p. 57 (starting with Prop. 5.3.4).\n-- It also has nice string-diagrammatic proofs.\n-- See also further comments in https://github.com/agda/agda-categories/pull/294#issuecomment-897697009\n\nmodule Categories.Category.Monoidal.Interchange\n {o ℓ e} {C : Category o ℓ e} where\n\nopen import Level using (_⊔_)\n\nimport Categories.Category.Monoidal.Construction.Product as MonoidalProduct\nopen import Categories.Category.Monoidal.Core using (Monoidal)\nimport Categories.Category.Monoidal.Utilities as MonoidalUtilities\nopen import Categories.Category.Product using (_⁂_)\nopen import Categories.Functor using (_∘F_)\nopen import Categories.NaturalTransformation.NaturalIsomorphism using (_≃_; niHelper)\nopen import Categories.Morphism C using (_≅_; module ≅)\n\nopen Category C using (Obj; id; _⇒_; _∘_; _≈_)\nopen Commutation C\n\nprivate\n variable\n W W₁ W₂ X X₁ X₂ Y Y₁ Y₂ Z Z₁ Z₂ : Obj\n f g h i : X ⇒ Y\n\n-- An abstract definition of an interchange map with the minimal set\n-- of coherence laws required to make the tensor product ⊗ of C a\n-- monoidal functor. (See also Categories.Functor.Monoidal.Tensor.)\n\nrecord HasInterchange (M : Monoidal C) : Set (o ⊔ ℓ ⊔ e) where\n open Monoidal M using (_⊗₀_; _⊗₁_; unit; ⊗)\n open MonoidalUtilities.Shorthands M using (α⇒; λ⇐; λ⇒; ρ⇒)\n\n -- The \"four middle interchange\" for tensor products.\n\n field swapInner : ∀ {W X Y Z} → (W ⊗₀ X) ⊗₀ (Y ⊗₀ Z) ≅ (W ⊗₀ Y) ⊗₀ (X ⊗₀ Z)\n\n module swapInner {W X Y Z} = _≅_ (swapInner {W} {X} {Y} {Z})\n private\n i⇒ = swapInner.from\n i⇐ = swapInner.to\n\n -- Naturality and coherence laws of the interchange.\n\n field\n natural : i⇒ ∘ (f ⊗₁ g) ⊗₁ (h ⊗₁ i) ≈ (f ⊗₁ h) ⊗₁ (g ⊗₁ i) ∘ i⇒\n\n assoc : [ ((X₁ ⊗₀ X₂) ⊗₀ (Y₁ ⊗₀ Y₂)) ⊗₀ (Z₁ ⊗₀ Z₂) ⇒\n (X₁ ⊗₀ (Y₁ ⊗₀ Z₁)) ⊗₀ (X₂ ⊗₀ (Y₂ ⊗₀ Z₂)) ]⟨\n i⇒ ⊗₁ id ⇒⟨ ((X₁ ⊗₀ Y₁) ⊗₀ (X₂ ⊗₀ Y₂)) ⊗₀ (Z₁ ⊗₀ Z₂) ⟩\n i⇒ ⇒⟨ ((X₁ ⊗₀ Y₁) ⊗₀ Z₁) ⊗₀ ((X₂ ⊗₀ Y₂) ⊗₀ Z₂) ⟩\n α⇒ ⊗₁ α⇒\n ≈ α⇒ ⇒⟨ (X₁ ⊗₀ X₂) ⊗₀ ((Y₁ ⊗₀ Y₂) ⊗₀ (Z₁ ⊗₀ Z₂)) ⟩\n id ⊗₁ i⇒ ⇒⟨ (X₁ ⊗₀ X₂) ⊗₀ ((Y₁ ⊗₀ Z₁) ⊗₀ (Y₂ ⊗₀ Z₂)) ⟩\n i⇒\n ⟩\n\n unitˡ : [ unit ⊗₀ (X ⊗₀ Y) ⇒ (X ⊗₀ Y) ]⟨\n λ⇐ ⊗₁ id ⇒⟨ (unit ⊗₀ unit) ⊗₀ (X ⊗₀ Y) ⟩\n i⇒ ⇒⟨ (unit ⊗₀ X) ⊗₀ (unit ⊗₀ Y) ⟩\n λ⇒ ⊗₁ λ⇒\n ≈ λ⇒\n ⟩\n\n unitʳ : [ (X ⊗₀ Y) ⊗₀ unit ⇒ (X ⊗₀ Y) ]⟨\n id ⊗₁ λ⇐ ⇒⟨ (X ⊗₀ Y) ⊗₀ (unit ⊗₀ unit) ⟩\n i⇒ ⇒⟨ (X ⊗₀ unit) ⊗₀ (Y ⊗₀ unit) ⟩\n ρ⇒ ⊗₁ ρ⇒\n ≈ ρ⇒\n ⟩\n\n -- The interchange is a natural isomorphism.\n\n naturalIso : ⊗ ∘F (⊗ ⁂ ⊗) ≃ ⊗ ∘F MonoidalProduct.⊗ M M\n naturalIso = niHelper (record\n { η = λ _ → i⇒\n ; η⁻¹ = λ _ → i⇐\n ; commute = λ _ → natural\n ; iso = λ _ → swapInner.iso\n })\n", "meta": {"hexsha": "ec71ea38969f7b53f30451d0f2b6da54e5fd7c2b", "size": 3249, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Monoidal/Interchange.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Monoidal/Interchange.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Monoidal/Interchange.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 35.3152173913, "max_line_length": 106, "alphanum_fraction": 0.567867036, "num_tokens": 1290, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942173896131, "lm_q2_score": 0.76908023177796, "lm_q1q2_score": 0.6847076830605812}} {"text": "-- Σ type (also used as existential) and\n-- cartesian product (also used as conjunction).\n\n{-# OPTIONS --safe #-}\n\nimport Tools.PropositionalEquality as PE\n\nmodule Tools.Product where\n\ninfixr 4 _,_\ninfixr 2 _×_\n\n-- Dependent pair type (aka dependent sum, Σ type).\n\nrecord Σ (A : Set) (B : A → Set) : Set where\n constructor _,_\n field\n proj₁ : A\n proj₂ : B proj₁\n\nopen Σ public\n\n-- Existential quantification.\n\n∃ : {A : Set} → (A → Set) → Set\n∃ = Σ _\n\n∃₂ : {A : Set} {B : A → Set}\n (C : (x : A) → B x → Set) → Set\n∃₂ C = ∃ λ a → ∃ λ b → C a b\n\n-- Cartesian product.\n\n_×_ : (A B : Set) → Set\nA × B = Σ A (λ x → B)\n\n×-eq : ∀ {A B : Set} {x x' : A} {y y' : B} → x PE.≡ x' × y PE.≡ y' → (x , y) PE.≡ ( x' , y' )\n×-eq ( PE.refl , PE.refl ) = PE.refl\n", "meta": {"hexsha": "fa7a96baecee2cb2b8f60909597419dfaf09d26d", "size": 756, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Tools/Product.agda", "max_stars_repo_name": "CoqHott/logrel-mltt", "max_stars_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-06-21T08:39:01.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T16:13:53.000Z", "max_issues_repo_path": "Tools/Product.agda", "max_issues_repo_name": "CoqHott/logrel-mltt", "max_issues_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Tools/Product.agda", "max_forks_repo_name": "CoqHott/logrel-mltt", "max_forks_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2022-01-26T14:55:51.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-15T19:42:19.000Z", "avg_line_length": 19.3846153846, "max_line_length": 93, "alphanum_fraction": 0.541005291, "num_tokens": 301, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8902942173896131, "lm_q2_score": 0.7690802264851919, "lm_q1q2_score": 0.6847076783484604}} {"text": "module SortedBinaryTree where\n infix 4 _≡_\n data _≡_ {a} {A : Set a} (x : A) : A → Set a where\n refl : x ≡ x\n {-# BUILTIN EQUALITY _≡_ #-}\n {-# BUILTIN REFL refl #-}\n\n open import Sec4\n postulate A : Set -- XXX: E.g., Nat or Bool some base type\n\n -- XXX: Postulates for ≤\n postulate _≤_ : A → A → Prop\n postulate antisym-≤ : (a b : A) → (a ≤ b) → (b ≤ a) → (a ≡ b)\n postulate tot-≤ : (a b : A) → (a ≤ b) ∨ (b ≤ a)\n postulate refl-≤ : (a : A) → (a ≤ a)\n postulate trans-≤ : (a b c : A) → (a ≤ b) → (b ≤ a) → (a ≤ c)\n\n -- XXX: Postulates for ≥\n postulate _≥_ : A → A → Prop\n postulate antisym-≥ : (a b : A) → (a ≥ b) → (b ≥ a) → (a ≡ b)\n postulate tot-≥ : (a b : A) → (a ≥ b) ∨ (b ≥ a)\n postulate refl-≥ : (a : A) → (a ≥ a)\n postulate trans-≥ : (a b c : A) → (a ≥ b) → (b ≥ a) → (a ≥ c)\n\n-- XXX: Definition of a binary tree.\n data SortedBinaryTree (A : Set) : Set where\n Leaf : SortedBinaryTree A\n Node : (a : A) → (l : SortedBinaryTree A) → (r : SortedBinaryTree A) → SortedBinaryTree A\n\n all-leq : (a : A) → (t : SortedBinaryTree A) → Prop\n all-leq a₁ Leaf = ⊤\n all-leq a₁ (Node a₂ l r) = (a₂ ≤ a₁) ∧ ((all-leq a₁ l) ∧ (all-leq a₁ r))\n \n all-geq : (a : A) → (t : SortedBinaryTree A) → Prop\n all-geq a₁ Leaf = ⊤\n all-geq a₁ (Node a₂ l r) = (a₂ ≥ a₁) ∧ ((all-geq a₁ l) ∧ (all-geq a₁ r))\n\n-- XXX: What is a sorted tree. A BTree is sorted, if all elements in the\n-- left substree are ≥ root and all elements in the right subtree are ≤\n-- root.\n ordered : SortedBinaryTree A → Prop\n ordered Leaf = ⊤\n ordered (Node a l r) = ((all-leq a l) ∧ (all-geq a r)) ∧ ((ordered l) ∧ (ordered r))\n\n-- XXX: Insert function for SortedBinaryTree\n insert : (a : A) → SortedBinaryTree A → SortedBinaryTree A\n insert x Leaf = Node x Leaf Leaf\n insert x (Node a t t₁) with (tot-≤ x a)\n insert x (Node a t t₁) | ora x₁ = insert x t\n insert x (Node a t t₁) | orb x₁ = insert x t₁\n\n-- XXX: Prove that the tree obtained after insertion is sorted\n insert-sorted : (a : A)\n → (t : SortedBinaryTree A)\n → (p : ordered t)\n → ordered (insert a t)\n insert-sorted a Leaf _ = and (and ⋆ ⋆) (and ⋆ ⋆)\n insert-sorted a (Node a₁ t t₁) (and (and x x1) (and x2 x3)) with (tot-≤ a a₁)\n insert-sorted a (Node a₁ t t₁) (and (and p1 p2) (and p3 p4)) | ora w = insert-sorted a t p3\n insert-sorted a (Node a₁ t t₁) (and (and p1 p2) (and p3 p4)) | orb w = insert-sorted a t₁ p4\n\n-- XXX: Proof carrying code\n insert' : (a : A)\n → (t : SortedBinaryTree A)\n → (p : ordered t)\n → Exists (SortedBinaryTree A) (λ t' → ordered t')\n insert' a t p = [ insert a t , insert-sorted a t p ]\n\n-- XXX: Write Proof that delete works.\n\n\n-- XXX: Write a version with record and setoid carrying the ≤, etc\n\n\n", "meta": {"hexsha": "32a286eb5cf94a3e1806aaed1f0d332b145f782f", "size": 2783, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "SortedBinaryTree.agda", "max_stars_repo_name": "amal029/agda-tutorial-dybjer", "max_stars_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:52:30.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-08T12:52:30.000Z", "max_issues_repo_path": "SortedBinaryTree.agda", "max_issues_repo_name": "amal029/agda-tutorial-dybjer", "max_issues_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "SortedBinaryTree.agda", "max_forks_repo_name": "amal029/agda-tutorial-dybjer", "max_forks_repo_head_hexsha": "7128bb419cd4aa3eeacae1fae1a9eb2e57ee8166", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.1066666667, "max_line_length": 94, "alphanum_fraction": 0.5594681998, "num_tokens": 1066, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970779778824, "lm_q2_score": 0.7772998714925403, "lm_q1q2_score": 0.684643455523213}} {"text": "module nat-division-wf where\n\nopen import bool\nopen import bool-thms\nopen import eq\nopen import neq\nopen import nat\nopen import nat-thms\nopen import product\nopen import product-thms\nopen import sum\nopen import termination\n\n----------------------------------------------------------------------\n-- syntax\n----------------------------------------------------------------------\n\ninfixl 10 _÷_!_\n\n----------------------------------------------------------------------\n-- operations\n----------------------------------------------------------------------\n\n{- a div-result for dividend x and divisor d consists of the quotient q, remainder r, \n a proof that q * d + r = x, and a proof that the remainder is less than the divisor. -}\ndiv-result : ℕ → ℕ → Set \ndiv-result x d = Σ ℕ (λ q → Σ ℕ (λ r → q * d + r ≡ x ∧ r < d ≡ tt))\n\n-- this uses well-founded recursion. The approach in nat-division.agda is arguably simpler.\ndiv-helper : ∀ (x : ℕ) → ↓𝔹 _>_ x → (d : ℕ) → d =ℕ 0 ≡ ff → div-result x d\ndiv-helper x ↓x 0 () \ndiv-helper 0 (pf↓ fx) (suc d) _ = 0 , 0 , refl , refl\ndiv-helper (suc x) (pf↓ fx) (suc d) _ with keep (x < d) \ndiv-helper (suc x) (pf↓ fx) (suc d) _ | tt , p = 0 , suc x , refl , p\ndiv-helper (suc x) (pf↓ fx) (suc d) _ | ff , p \n with div-helper (x ∸ d) (fx (∸<1 {x} {d})) (suc d) refl\ndiv-helper (suc x) (pf↓ fx) (suc d) _ | ff , p | q , r , u , v = \n suc q , r , lem{q * suc d} (∸eq-swap{x}{d}{q * suc d + r} ( x) d p\n\n_÷_!!_ : ℕ → (d : ℕ) → d =ℕ 0 ≡ ff → ℕ × ℕ\nx ÷ d !! p with x ÷ d ! p\n... | q , r , p' = q , r\n\n-- return quotient only\n_÷_div_ : ℕ → (d : ℕ) → d =ℕ 0 ≡ ff → ℕ \nx ÷ d div p with x ÷ d ! p\n... | q , r , p' = q\n\n", "meta": {"hexsha": "c3e7b3fa845e49382ea1513d858b04ededbc2477", "size": 1953, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "nat-division-wf.agda", "max_stars_repo_name": "rfindler/ial", "max_stars_repo_head_hexsha": "f3f0261904577e930bd7646934f756679a6cbba6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 29, "max_stars_repo_stars_event_min_datetime": "2019-02-06T13:09:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-04T15:05:12.000Z", "max_issues_repo_path": "nat-division-wf.agda", "max_issues_repo_name": "rfindler/ial", "max_issues_repo_head_hexsha": "f3f0261904577e930bd7646934f756679a6cbba6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2018-07-09T22:53:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-22T03:43:34.000Z", "max_forks_repo_path": "nat-division-wf.agda", "max_forks_repo_name": "rfindler/ial", "max_forks_repo_head_hexsha": "f3f0261904577e930bd7646934f756679a6cbba6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 17, "max_forks_repo_forks_event_min_datetime": "2018-12-03T22:38:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-28T20:13:21.000Z", "avg_line_length": 35.5090909091, "max_line_length": 92, "alphanum_fraction": 0.4592933948, "num_tokens": 688, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.880797081106935, "lm_q2_score": 0.7772998560157665, "lm_q1q2_score": 0.684643444323528}} {"text": "------------------------------------------------------------------------------\n-- Inductive PA properties using the induction principle\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule PA.Inductive.PropertiesByInductionATP where\n\nopen import PA.Inductive.Base\nopen import PA.Inductive.PropertiesByInduction\n\n------------------------------------------------------------------------------\n\n+-comm : ∀ m n → m + n ≡ n + m\n+-comm m n = ℕ-ind A A0 is m\n where\n A : ℕ → Set\n A i = i + n ≡ n + i\n {-# ATP definition A #-}\n\n A0 : A zero\n A0 = sym (+-rightIdentity n)\n\n postulate is : ∀ i → A i → A (succ i)\n -- TODO (21 November 2014). See Apia issue 16\n -- {-# ATP prove is x+Sy≡S[x+y] #-}\n", "meta": {"hexsha": "06c7fadd3ef81d1470777d01096fc58874fb5d8b", "size": 903, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/PA/Inductive/PropertiesByInductionATP.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/PA/Inductive/PropertiesByInductionATP.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/PA/Inductive/PropertiesByInductionATP.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 30.1, "max_line_length": 78, "alphanum_fraction": 0.4318936877, "num_tokens": 207, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8688267762381844, "lm_q2_score": 0.787931190663057, "lm_q1q2_score": 0.684575716281298}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Rings.Definition\nopen import Rings.IntegralDomains.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\n\n\nmodule Fields.FieldOfFractions.Multiplication {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (I : IntegralDomain R) where\n\nopen import Fields.FieldOfFractions.Setoid I\n\nfieldOfFractionsTimes : fieldOfFractionsSet → fieldOfFractionsSet → fieldOfFractionsSet\nfieldOfFractionsTimes (record { num = a ; denom = b ; denomNonzero = b!=0 }) (record { num = c ; denom = d ; denomNonzero = d!=0 }) = record { num = a * c ; denom = b * d ; denomNonzero = ans }\n where\n open Setoid S\n open Ring R\n ans : ((b * d) ∼ Ring.0R R) → False\n ans pr with IntegralDomain.intDom I pr\n ans pr | f = exFalso (d!=0 (f b!=0))\n\nfieldOfFractionsTimesWellDefined : {a b c d : fieldOfFractionsSet} → (Setoid._∼_ fieldOfFractionsSetoid a c) → (Setoid._∼_ fieldOfFractionsSetoid b d) → (Setoid._∼_ fieldOfFractionsSetoid (fieldOfFractionsTimes a b) (fieldOfFractionsTimes c d))\nfieldOfFractionsTimesWellDefined {record { num = a ; denom = b }} {record { num = c ; denom = d }} {record { num = e ; denom = f }} {record { num = g ; denom = h }} af=be ch=dg = need\n where\n open Setoid S\n open Equivalence eq\n need : ((a * c) * (f * h)) ∼ ((b * d) * (e * g))\n need = transitive (Ring.*WellDefined R reflexive (Ring.*Commutative R)) (transitive (Ring.*Associative R) (transitive (Ring.*WellDefined R (symmetric (Ring.*Associative R)) reflexive) (transitive (Ring.*WellDefined R (Ring.*WellDefined R reflexive ch=dg) reflexive) (transitive (Ring.*Commutative R) (transitive (Ring.*Associative R) (transitive (Ring.*WellDefined R (Ring.*Commutative R) reflexive) (transitive (Ring.*WellDefined R af=be reflexive) (transitive (Ring.*Associative R) (transitive (Ring.*WellDefined R (transitive (symmetric (Ring.*Associative R)) (transitive (Ring.*WellDefined R reflexive (Ring.*Commutative R)) (Ring.*Associative R))) reflexive) (symmetric (Ring.*Associative R)))))))))))\n", "meta": {"hexsha": "4bf19d54c99babd440f83b3ac712f847c9096ccb", "size": 2138, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Fields/FieldOfFractions/Multiplication.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Fields/FieldOfFractions/Multiplication.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Fields/FieldOfFractions/Multiplication.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 71.2666666667, "max_line_length": 710, "alphanum_fraction": 0.6950420954, "num_tokens": 676, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.893309411735131, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.6845373282892862}} {"text": "{-# OPTIONS --cubical #-}\n\nopen import Agda.Builtin.Cubical.Path\nopen import Agda.Primitive\nopen import Agda.Primitive.Cubical\n\nvariable\n a p : Level\n A : Set a\n P : A → Set p\n eq₁ u v x y : A\n\nrefl : x ≡ x\nrefl {x = x} = λ _ → x\n\nsubst : (P : A → Set p) → x ≡ y → P x → P y\nsubst P x≡y p = primTransp (λ i → P (x≡y i)) i0 p\n\nhcong :\n (f : (x : A) → P x) (x≡y : x ≡ y) →\n PathP (λ i → P (x≡y i)) (f x) (f y)\nhcong f x≡y = λ i → f (x≡y i)\n\ndcong :\n (f : (x : A) → P x) (x≡y : x ≡ y) →\n subst P x≡y (f x) ≡ f y\ndcong {P = P} f x≡y = λ i →\n primTransp (λ j → P (x≡y (primIMax i j))) i (f (x≡y i))\n\n-- This lemma is due to Anders Mörtberg.\n\nlemma₁ :\n {P : I → Set p} {p : P i0} {q : P i1} →\n PathP P p q ≡ (primTransp P i0 p ≡ q)\nlemma₁ {P = P} {p = p} {q = q} = λ i →\n PathP\n (λ j → P (primIMax i j))\n (primTransp (λ j → P (primIMin i j)) (primINeg i) p)\n q\n\ndata 𝕊¹ : Set where\n base : 𝕊¹\n loop : base ≡ base\n\npostulate\n\n Q : 𝕊¹ → Set\n b : Q base\n ℓ : subst Q loop b ≡ b\n\nlemma₂ :\n {eq : x ≡ y} →\n subst Q eq u ≡ v →\n PathP (λ i → Q (eq i)) u v\nlemma₂ = subst (λ A → A → PathP _ _ _) lemma₁ (λ x → x)\n\nlemma₃ : (x : 𝕊¹) → Q x\nlemma₃ base = b\nlemma₃ (loop i) = lemma₂ ℓ i\n\npostulate\n\n lemma₄ :\n (eq₂ : subst Q eq₁ (lemma₃ x) ≡ lemma₃ y) →\n hcong lemma₃ eq₁ ≡ lemma₂ eq₂ →\n dcong lemma₃ eq₁ ≡ eq₂\n\n\nworks : dcong lemma₃ loop ≡ ℓ\nworks = lemma₄ ℓ refl\n\n\n-- \"injectivity\" of lemma₃ was the problem\nshould-work-too : dcong lemma₃ loop ≡ ℓ\nshould-work-too = lemma₄ _ refl\n", "meta": {"hexsha": "ca27958e19d635f165b71b99f10eaea56c5c4050", "size": 1535, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue5576.agda", "max_stars_repo_name": "cagix/agda", "max_stars_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue5576.agda", "max_issues_repo_name": "cagix/agda", "max_issues_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue5576.agda", "max_forks_repo_name": "cagix/agda", "max_forks_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 20.1973684211, "max_line_length": 57, "alphanum_fraction": 0.532247557, "num_tokens": 715, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094088947399, "lm_q2_score": 0.7662936377487304, "lm_q1q2_score": 0.6845373165771182}} {"text": "{-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-}\nmodule Cubical.Data.NatPlusOne.Base where\n\nopen import Cubical.Core.Primitives\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Empty\n\nrecord ℕ₊₁ : Type₀ where\n constructor 1+_\n field\n n : ℕ\n\npattern one = 1+ zero\npattern 2+_ n = 1+ (suc n)\n\n-1+_ : ℕ₊₁ → ℕ\n-1+ (1+ n) = n\n\nℕ₊₁→ℕ : ℕ₊₁ → ℕ\nℕ₊₁→ℕ (1+ n) = suc n\n\nsuc₊₁ : ℕ₊₁ → ℕ₊₁\nsuc₊₁ (1+ n) = 1+ (suc n)\n\n-- Natural number literals for ℕ₊₁\n\nopen import Cubical.Data.Nat.Literals public\n\ninstance\n fromNatℕ₊₁ : HasFromNat ℕ₊₁\n fromNatℕ₊₁ = record { Constraint = λ { zero → ⊥ ; _ → Unit }\n ; fromNat = λ { (suc n) → 1+ n } }\n", "meta": {"hexsha": "a7c959476bf809f5683bf03e62b09340be5ac26c", "size": 675, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/NatPlusOne/Base.agda", "max_stars_repo_name": "dan-iel-lee/cubical", "max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/NatPlusOne/Base.agda", "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/Data/NatPlusOne/Base.agda", "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 20.4545454545, "max_line_length": 67, "alphanum_fraction": 0.6118518519, "num_tokens": 272, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933093946927837, "lm_q2_score": 0.7662936377487305, "lm_q1q2_score": 0.6845373056942498}} {"text": "{-# OPTIONS --safe --without-K #-}\nopen import Algebra.Bundles using (Group)\n\nmodule Categories.Category.Construction.GroupAsCategory o {c ℓ} (G : Group c ℓ) where\n\nopen import Level\n\nopen import Categories.Category.Groupoid\n\nopen Group G\n\n-- A group is a groupoid with a single object\nopen import Categories.Category.Construction.MonoidAsCategory o monoid\n renaming (MonoidAsCategory to GroupAsCategory) public\n\nGroupIsGroupoid : IsGroupoid GroupAsCategory\nGroupIsGroupoid = record\n { iso = record\n { isoˡ = inverseˡ _\n ; isoʳ = inverseʳ _\n }\n }\n\nGroupAsGroupoid : Groupoid o c ℓ\nGroupAsGroupoid = record { isGroupoid = GroupIsGroupoid }\n", "meta": {"hexsha": "e7eafbbb5fca935866ea2e83e165cb4220e01642", "size": 651, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Construction/GroupAsCategory.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2019-05-21T17:07:19.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-22T03:54:24.000Z", "max_issues_repo_path": "src/Categories/Category/Construction/GroupAsCategory.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Construction/GroupAsCategory.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.0384615385, "max_line_length": 85, "alphanum_fraction": 0.757296467, "num_tokens": 173, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9324533051062238, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.684532173776959}} {"text": "------------------------------------------------------------------------\n-- Equivalence relations\n------------------------------------------------------------------------\n\nmodule Eq where\n\ninfix 4 _≡_\n\n------------------------------------------------------------------------\n-- Definition\n\nrecord Equiv {a : Set} (_≈_ : a -> a -> Set) : Set where\n field\n refl : forall x -> x ≈ x\n sym : forall {x y} -> x ≈ y -> y ≈ x\n _`trans`_ : forall {x y z} -> x ≈ y -> y ≈ z -> x ≈ z\n\n------------------------------------------------------------------------\n-- Propositional equality\n\ndata _≡_ {a : Set} (x : a) : a -> Set where\n refl : x ≡ x\n\nsubst : forall {a x y} ->\n (P : a -> Set) -> x ≡ y -> P x -> P y\nsubst _ refl p = p\n\ncong : forall {a b x y} ->\n (f : a -> b) -> x ≡ y -> f x ≡ f y\ncong _ refl = refl\n\nEquiv-≡ : forall {a} -> Equiv {a} _≡_\nEquiv-≡ {a} =\n record { refl = \\_ -> refl\n ; sym = sym\n ; _`trans`_ = _`trans`_\n }\n where\n sym : {x y : a} -> x ≡ y -> y ≡ x\n sym refl = refl\n\n _`trans`_ : {x y z : a} -> x ≡ y -> y ≡ z -> x ≡ z\n refl `trans` refl = refl\n", "meta": {"hexsha": "a4783ca3829bc756767ffacc0c256562a56d3671", "size": 1133, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/AIM6/RegExp/talk/Eq.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/AIM6/RegExp/talk/Eq.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/AIM6/RegExp/talk/Eq.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 25.75, "max_line_length": 72, "alphanum_fraction": 0.3336275375, "num_tokens": 356, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942119105695, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.6845112743317929}} {"text": "------------------------------------------------------------------------------\n-- Definition of mutual inductive predicates\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --without-K #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n\nmodule FOTC.MutualInductivePredicates where\n\nopen import FOTC.Base\n\n------------------------------------------------------------------------------\n-- Using mutual inductive predicates\n\ndata Even : D → Set\ndata Odd : D → Set\n\ndata Even where\n ezero : Even zero\n esucc : ∀ {n} → Odd n → Even (succ₁ n)\n\ndata Odd where\n osucc : ∀ {n} → Even n → Odd (succ₁ n)\n\n-- Non-mutual induction principles\n\nEven-ind : (A : D → Set) →\n A zero →\n (∀ {n} → Odd n → A (succ₁ n)) →\n ∀ {n} → Even n → A n\nEven-ind A A0 h ezero = A0\nEven-ind A A0 h (esucc On) = h On\n\nOdd-ind : (A : D → Set) →\n (∀ {n} → Even n → A (succ₁ n)) →\n ∀ {n} → Odd n → A n\nOdd-ind A h (osucc En) = h En\n\n-- Mutual induction principles (from Coq)\nEven-mutual-ind :\n (A B : D → Set) →\n A zero →\n (∀ {n} → Odd n → B n → A (succ₁ n)) →\n (∀ {n} → Even n → A n → B (succ₁ n)) →\n ∀ {n} → Even n → A n\n\nOdd-mutual-ind :\n (A B : D → Set) →\n A zero →\n (∀ {n} → Odd n → B n → A (succ₁ n)) →\n (∀ {n} → Even n → A n → B (succ₁ n)) →\n ∀ {n} → Odd n → B n\n\nEven-mutual-ind A B A0 h₁ h₂ ezero = A0\nEven-mutual-ind A B A0 h₁ h₂ (esucc On) = h₁ On (Odd-mutual-ind A B A0 h₁ h₂ On)\n\nOdd-mutual-ind A B A0 h₁ h₂ (osucc En) = h₂ En (Even-mutual-ind A B A0 h₁ h₂ En)\n\nmodule DisjointSum where\n -- Using a single inductive predicate on D × D (see\n -- Blanchette (2013)).\n\n _+_ : Set → Set → Set\n _+_ = _∨_\n\n data EvenOdd : D + D → Set where\n eozero : EvenOdd (inj₁ zero)\n eoodd : {n : D} → EvenOdd (inj₁ n) → EvenOdd (inj₂ (succ₁ n))\n eoeven : {n : D} → EvenOdd (inj₂ n) → EvenOdd (inj₁ (succ₁ n))\n\n -- Induction principle\n EvenOdd-ind : (A : D + D → Set) →\n A (inj₁ zero) →\n ({n : D} → A (inj₁ n) → A (inj₂ (succ₁ n))) →\n ({n : D} → A (inj₂ n) → A (inj₁ (succ₁ n))) →\n {n : D + D} → EvenOdd n → A n\n EvenOdd-ind A A0 h₁ h₂ eozero = A0\n EvenOdd-ind A A0 h₁ h₂ (eoodd EOn) = h₁ (EvenOdd-ind A A0 h₁ h₂ EOn)\n EvenOdd-ind A A0 h₁ h₂ (eoeven EOn) = h₂ (EvenOdd-ind A A0 h₁ h₂ EOn)\n\n -------------------------------------------------------------------------\n -- From the single inductive predicate to the mutual inductive predicates\n\n -- Even and Odd from EvenOdd.\n Even' : D → Set\n Even' n = EvenOdd (inj₁ n)\n\n Odd' : D → Set\n Odd' n = EvenOdd (inj₂ n)\n\n -- From Even/Odd to Even'/Odd'\n Even→Even' : ∀ {n} → Even n → Even' n\n Odd→Odd' : ∀ {n} → Odd n → Odd' n\n\n Even→Even' ezero = eozero\n Even→Even' (esucc On) = eoeven (Odd→Odd' On)\n\n Odd→Odd' (osucc En) = eoodd (Even→Even' En)\n\n -- From Even'/Odd' to Even/Odd\n Even'→Even : ∀ {n} → Even' n → Even n\n Odd'→Odd : ∀ {n} → Odd' n → Odd n\n\n -- Requires K.\n Even'→Even eozero = ezero\n Even'→Even (eoeven h) = esucc (Odd'→Odd h)\n\n Odd'→Odd (eoodd h) = osucc (Even'→Even h)\n\n -- TODO (03 December 2012). From EvenOdd-ind to Even-mutual-ind and\n -- Odd-mutual-ind.\n\nmodule FunctionSpace where\n-- Using a single inductive predicate on D → D\n\n data EvenOdd : D → D → Set where\n eozero : EvenOdd zero (succ₁ zero)\n eoodd : ∀ {m n} → EvenOdd m n → EvenOdd m (succ₁ m)\n eoeven : ∀ {m n} → EvenOdd m n → EvenOdd (succ₁ n) n\n\n -- Even and Odd from EvenOdd.\n -- Even' : D → Set\n -- Even' n = EvenOdd zero (succ₁ zero) ∨ EvenOdd (succ₁ n) n\n\n -- Odd' : D → Set\n -- Odd' n = EvenOdd n (succ₁ n)\n\n -- -- From Even/Odd to Even'/Odd'\n -- Even→Even' : ∀ {n} → Even n → Even' n\n -- Odd→Odd' : ∀ {n} → Odd n → Odd' n\n\n -- Even→Even' ezero = inj₁ eozero\n -- Even→Even' (esucc On) = inj₂ (eoeven (Odd→Odd' On))\n\n -- Odd→Odd' (osucc En) = eoodd {!!}\n\n -- -- From Even'/Odd' to Even/Odd\n -- Even'→Even : ∀ {n} → Even' n → Even n\n -- Odd'→Odd : ∀ {n} → Odd' n → Odd n\n\n -- Even'→Even (inj₁ x) = {!!}\n -- Even'→Even (inj₂ x) = {!!}\n\n -- Odd'→Odd h = {!!}\n\n------------------------------------------------------------------------------\n-- References\n--\n-- Blanchette, Jasmin Christian (2013). Relational analysis of\n-- (co)inductive predicates, (co)algebraic datatypes, and\n-- (co)recursive functions. Software Quality Journal 21.1,\n-- pp. 101–126.\n", "meta": {"hexsha": "7bea8ec45c4a19e13615cfa7c6165256f5573458", "size": 4548, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/thesis/report/FOTC/MutualInductivePredicates.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/thesis/report/FOTC/MutualInductivePredicates.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/thesis/report/FOTC/MutualInductivePredicates.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 29.3419354839, "max_line_length": 80, "alphanum_fraction": 0.494942832, "num_tokens": 1595, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.903294209307224, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6845112674179914}} {"text": "module Common.Equality where\n\nopen import Common.Level\n\ninfix 4 _≡_\n\ndata _≡_ {a} {A : Set a} (x : A) : A → Set a where\n refl : x ≡ x\n\n{-# BUILTIN EQUALITY _≡_ #-}\n{-# BUILTIN REFL refl #-}\n\nsubst : ∀ {a p}{A : Set a}(P : A → Set p){x y : A} → x ≡ y → P x → P y\nsubst P refl t = t\n\ncong : ∀ {a b}{A : Set a}{B : Set b}(f : A → B){x y : A} → x ≡ y → f x ≡ f y\ncong f refl = refl\n\nsym : ∀ {a}{A : Set a}{x y : A} → x ≡ y → y ≡ x\nsym refl = refl\n\ntrans : ∀ {a}{A : Set a}{x y z : A} → x ≡ y → y ≡ z → x ≡ z\ntrans refl refl = refl\n", "meta": {"hexsha": "fe2ea1289ad755f54cc5f244699a4943c9a27c74", "size": 533, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Common/Equality.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/Common/Equality.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Common/Equality.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 22.2083333333, "max_line_length": 76, "alphanum_fraction": 0.4896810507, "num_tokens": 235, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9173026573249611, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6844352862190747}} {"text": "{-# OPTIONS --without-K #-}\nmodule Model.Nat where\n\nopen import Model.Size as MS using\n ( Size ; Sizes ; _≤_ ; _<_ ; ≤-IsProp ; nat )\nopen import Model.Type.Core\nopen import Util.HoTT.HLevel\nopen import Util.Prelude\nopen import Util.Relation.Binary.PropositionalEquality using (Σ-≡⁺)\n\nimport Data.Nat.Properties as ℕ\n\nopen Size\n\n\nℕ≤ : Size → Set\nℕ≤ n = ∃[ m ] (nat m ≤ n)\n\n\nℕ≤-IsSet : ∀ {n} → IsSet (ℕ≤ n)\nℕ≤-IsSet = Σ-IsSet ℕ.≡-irrelevant λ m → IsOfHLevel-suc 1 ≤-IsProp\n\n\nabstract\n ℕ≤-≡⁺ : ∀ {n} {m m′} (m≤n : nat m ≤ n) (m′≤n : nat m′ ≤ n)\n → m ≡ m′\n → (m , m≤n) ≡ (m′ , m′≤n)\n ℕ≤-≡⁺ _ _ m≡m′ = Σ-≡⁺ (m≡m′ , ≤-IsProp _ _)\n\n\nNat : ⟦Type⟧ Sizes\nNat = record\n { ObjHSet = λ n → HLevel⁺ (ℕ≤ n) ℕ≤-IsSet\n ; eqHProp = λ { _ (n , _) (m , _) → HLevel⁺ (n ≡ m) ℕ.≡-irrelevant }\n ; eq-refl = λ _ → refl\n }\n\n\ncastℕ≤ : ∀ {n m} → n ≤ m → ℕ≤ n → ℕ≤ m\ncastℕ≤ n≤m (k , k≤n) = k , go\n where abstract go = MS.≤-trans k≤n n≤m\n\n\nzero≤ : ∀ n → ℕ≤ n\nzero≤ n = 0 , MS.0≤n\n\n\nsuc≤ : ∀ n m → m < n → ℕ≤ m → ℕ≤ n\nsuc≤ n m m (increasingBoundedLimit x increasing bounded)\nincreasingBoundedConverges x increasing (K , prBound) with lub (sequenceSubset x) (Sequence.head x , (0 , reflexive)) (K , boundedSequenceBounds K x prBound)\n... | lub , isLub = {!!}\n", "meta": {"hexsha": "55094dce1daafb37c09b4a4c00363810afe6fe3e", "size": 2822, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numbers/ClassicalReals/Sequences.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Numbers/ClassicalReals/Sequences.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Numbers/ClassicalReals/Sequences.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 39.7464788732, "max_line_length": 157, "alphanum_fraction": 0.7643515237, "num_tokens": 768, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099069987088003, "lm_q2_score": 0.752012562644147, "lm_q1q2_score": 0.6842614938668494}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Category.Monoidal.Instance.Setoids where\n\nopen import Level\nopen import Data.Product\nopen import Data.Product.Relation.Binary.Pointwise.NonDependent\nopen import Data.Sum\nopen import Data.Sum.Relation.Binary.Pointwise\nopen import Function.Equality\nopen import Relation.Binary using (Setoid)\n\nopen import Categories.Category\nopen import Categories.Category.Instance.Setoids\nopen import Categories.Category.Cartesian\nopen import Categories.Category.Cocartesian\nopen import Categories.Category.Instance.SingletonSet\nopen import Categories.Category.Instance.EmptySet\n\nmodule _ {o ℓ} where\n\n Setoids-Cartesian : Cartesian (Setoids o ℓ)\n Setoids-Cartesian = record\n { terminal = SingletonSetoid-⊤\n ; products = record\n { product = λ {A B} →\n let module A = Setoid A\n module B = Setoid B\n in record\n { A×B = ×-setoid A B -- the stdlib doesn't provide projections!\n ; π₁ = record\n { _⟨$⟩_ = proj₁\n ; cong = proj₁\n }\n ; π₂ = record\n { _⟨$⟩_ = proj₂\n ; cong = proj₂\n }\n ; ⟨_,_⟩ = λ f g → record\n { _⟨$⟩_ = λ x → f ⟨$⟩ x , g ⟨$⟩ x\n ; cong = λ eq → cong f eq , cong g eq\n }\n ; project₁ = λ {_ h i} eq → cong h eq\n ; project₂ = λ {_ h i} eq → cong i eq\n ; unique = λ {W h i j} eq₁ eq₂ eq → A.sym (eq₁ (Setoid.sym W eq)) , B.sym (eq₂ (Setoid.sym W eq))\n }\n }\n }\n\n module Setoids-Cartesian = Cartesian Setoids-Cartesian\n open Setoids-Cartesian renaming (monoidal to Setoids-Monoidal) public\n\n Setoids-Cocartesian : Cocartesian (Setoids o (o ⊔ ℓ))\n Setoids-Cocartesian = record\n { initial = EmptySetoid-⊥\n ; coproducts = record\n { coproduct = λ {A} {B} → record\n { A+B = ⊎-setoid A B\n ; i₁ = record { _⟨$⟩_ = inj₁ ; cong = inj₁ }\n ; i₂ = record { _⟨$⟩_ = inj₂ ; cong = inj₂ }\n ; [_,_] = λ f g → record\n { _⟨$⟩_ = [ f ⟨$⟩_ , g ⟨$⟩_ ]\n ; cong = λ { (inj₁ x) → Π.cong f x ; (inj₂ x) → Π.cong g x }\n }\n ; inject₁ = λ {_} {f} → Π.cong f\n ; inject₂ = λ {_} {_} {g} → Π.cong g\n ; unique = λ { {C} h≈f h≈g (inj₁ x) → Setoid.sym C (h≈f (Setoid.sym A x))\n ; {C} h≈f h≈g (inj₂ x) → Setoid.sym C (h≈g (Setoid.sym B x)) }\n }\n }\n }\n", "meta": {"hexsha": "d65a387589ef339c3dd16de3ba8947db73c632a1", "size": 2424, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Monoidal/Instance/Setoids.agda", "max_stars_repo_name": "bond15/agda-categories", "max_stars_repo_head_hexsha": "6cbfdf3f1be15ef513435e3b85faae92cb1ac36f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Monoidal/Instance/Setoids.agda", "max_issues_repo_name": "bond15/agda-categories", "max_issues_repo_head_hexsha": "6cbfdf3f1be15ef513435e3b85faae92cb1ac36f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Monoidal/Instance/Setoids.agda", "max_forks_repo_name": "bond15/agda-categories", "max_forks_repo_head_hexsha": "6cbfdf3f1be15ef513435e3b85faae92cb1ac36f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.6666666667, "max_line_length": 109, "alphanum_fraction": 0.5499174917, "num_tokens": 769, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772318846386, "lm_q2_score": 0.7826624688140726, "lm_q1q2_score": 0.6841074442410019}} {"text": "{-# OPTIONS --cubical --safe #-}\n\nmodule Cubical.Homotopy.Loopspace where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Data.Nat\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Pointed\nopen import Cubical.Foundations.GroupoidLaws\n\n{- loop space of a pointed type -}\nΩ : {ℓ : Level} → Pointed ℓ → Pointed ℓ\nΩ (_ , a) = ((a ≡ a) , refl)\n\n{- n-fold loop space of a pointed type -}\nΩ^_ : ∀ {ℓ} → ℕ → Pointed ℓ → Pointed ℓ\n(Ω^ 0) p = p\n(Ω^ (suc n)) p = Ω ((Ω^ n) p)\n\n{- loop space map -}\nΩ→ : ∀ {ℓA ℓB} {A : Pointed ℓA} {B : Pointed ℓB} (f : A →∙ B) → (Ω A →∙ Ω B)\nΩ→ (f , f∙) = (λ p → (sym f∙ ∙ cong f p) ∙ f∙) , cong (λ q → q ∙ f∙) (sym (rUnit (sym f∙))) ∙ lCancel f∙\n", "meta": {"hexsha": "1ede1968ee02968ea84858b0162f60ef74fe6757", "size": 702, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Homotopy/Loopspace.agda", "max_stars_repo_name": "cmester0/cubical", "max_stars_repo_head_hexsha": "c67854d2e11aafa5677e25a09087e176fafd3e43", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-03-23T23:52:11.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-23T23:52:11.000Z", "max_issues_repo_path": "Cubical/Homotopy/Loopspace.agda", "max_issues_repo_name": "cmester0/cubical", "max_issues_repo_head_hexsha": "c67854d2e11aafa5677e25a09087e176fafd3e43", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Homotopy/Loopspace.agda", "max_forks_repo_name": "cmester0/cubical", "max_forks_repo_head_hexsha": "c67854d2e11aafa5677e25a09087e176fafd3e43", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.08, "max_line_length": 104, "alphanum_fraction": 0.6025641026, "num_tokens": 303, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772286044094, "lm_q2_score": 0.7826624688140728, "lm_q1q2_score": 0.6841074416736898}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Category.Construction.Presheaves where\n\n-- The Category of Presheaves over a Category C, i.e.\n-- the Functor Category [ C.op , Setoids ]\n-- Again, the levels are made explicit to show the generality and constraints.\nopen import Level\n\nopen import Categories.Category\nopen import Categories.Category.Construction.Functors\nopen import Categories.Category.Instance.Setoids using (Setoids)\n\nPresheaves : ∀ {o ℓ e o′ ℓ′ : Level} → Category o ℓ e →\n Category (o ⊔ ℓ ⊔ e ⊔ suc (o′ ⊔ ℓ′)) (o ⊔ ℓ ⊔ o′ ⊔ ℓ′) (o ⊔ o′ ⊔ ℓ′)\nPresheaves {o} {ℓ} {e} {o′} {ℓ′} C = Functors (Category.op C) (Setoids o′ ℓ′)\n", "meta": {"hexsha": "5131bbfb2ffe74a32b5345429b462add10aa6a20", "size": 645, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Category/Construction/Presheaves.agda", "max_stars_repo_name": "Taneb/agda-categories", "max_stars_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Categories/Category/Construction/Presheaves.agda", "max_issues_repo_name": "Taneb/agda-categories", "max_issues_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Category/Construction/Presheaves.agda", "max_forks_repo_name": "Taneb/agda-categories", "max_forks_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.3125, "max_line_length": 78, "alphanum_fraction": 0.6868217054, "num_tokens": 209, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9241418241572634, "lm_q2_score": 0.7401743563075446, "lm_q1q2_score": 0.6840260798324825}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.Definition\nopen import Lists.Lists\nopen import Rings.Homomorphisms.Definition\n\nmodule Rings.Polynomial.Evaluation {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) where\n\nopen Ring R\nopen Setoid S\nopen Equivalence eq\nopen Group additiveGroup\nopen import Groups.Polynomials.Definition additiveGroup\nopen import Groups.Polynomials.Addition additiveGroup\nopen import Rings.Polynomial.Ring R\nopen import Rings.Polynomial.Multiplication R\n\ninducedFunction : NaivePoly → A → A\ninducedFunction [] a = 0R\ninducedFunction (x :: p) a = x + (a * inducedFunction p a)\n\ninducedFunctionMult : (as : NaivePoly) (b c : A) → inducedFunction (map (_*_ b) as) c ∼ (inducedFunction as c) * b\ninducedFunctionMult [] b c = symmetric (transitive *Commutative timesZero)\ninducedFunctionMult (x :: as) b c = transitive (transitive (+WellDefined reflexive (transitive (transitive (*WellDefined reflexive (inducedFunctionMult as b c)) *Associative) *Commutative)) (symmetric *DistributesOver+)) *Commutative\n\ninducedFunctionWellDefined : {a b : NaivePoly} → polysEqual a b → (c : A) → inducedFunction a c ∼ inducedFunction b c\ninducedFunctionWellDefined {[]} {[]} a=b c = reflexive\ninducedFunctionWellDefined {[]} {x :: b} (fst ,, snd) c = symmetric (transitive (+WellDefined fst (transitive (*WellDefined reflexive (symmetric (inducedFunctionWellDefined {[]} {b} snd c))) (timesZero {c}))) identRight)\ninducedFunctionWellDefined {a :: as} {[]} (fst ,, snd) c = transitive (+WellDefined fst reflexive) (transitive identLeft (transitive (*WellDefined reflexive (inducedFunctionWellDefined {as} {[]} snd c)) (timesZero {c})))\ninducedFunctionWellDefined {a :: as} {b :: bs} (fst ,, snd) c = +WellDefined fst (*WellDefined reflexive (inducedFunctionWellDefined {as} {bs} snd c))\n\ninducedFunctionGroupHom : {x y : NaivePoly} → (a : A) → inducedFunction (x +P y) a ∼ (inducedFunction x a + inducedFunction y a)\ninducedFunctionGroupHom {[]} {[]} a = symmetric identLeft\ninducedFunctionGroupHom {[]} {x :: y} a rewrite mapId y = symmetric identLeft\ninducedFunctionGroupHom {x :: xs} {[]} a rewrite mapId xs = symmetric identRight\ninducedFunctionGroupHom {x :: xs} {y :: ys} a = transitive (symmetric +Associative) (transitive (+WellDefined reflexive (transitive (transitive (+WellDefined reflexive (transitive (*WellDefined reflexive (transitive (inducedFunctionGroupHom {xs} {ys} a) groupIsAbelian)) *DistributesOver+)) +Associative) groupIsAbelian)) +Associative)\n\ninducedFunctionRingHom : (r s : NaivePoly) (a : A) → inducedFunction (r *P s) a ∼ (inducedFunction r a * inducedFunction s a)\ninducedFunctionRingHom [] s a = symmetric (transitive *Commutative timesZero)\ninducedFunctionRingHom (x :: xs) [] a = symmetric timesZero\ninducedFunctionRingHom (b :: bs) (c :: cs) a = transitive (+WellDefined reflexive (*WellDefined reflexive (inducedFunctionGroupHom {map (_*_ b) cs +P map (_*_ c) bs} {0G :: (bs *P cs)} a))) (transitive (+WellDefined reflexive (*WellDefined reflexive (+WellDefined (inducedFunctionGroupHom {map (_*_ b) cs} {map (_*_ c) bs} a) identLeft))) (transitive (transitive (transitive (+WellDefined reflexive (transitive (transitive (transitive (*WellDefined reflexive (transitive (+WellDefined (transitive groupIsAbelian (+WellDefined (inducedFunctionMult bs c a) (inducedFunctionMult cs b a))) (transitive (transitive (*WellDefined reflexive (transitive (inducedFunctionRingHom bs cs a) *Commutative)) *Associative) *Commutative)) (symmetric +Associative))) *DistributesOver+) (+WellDefined reflexive *DistributesOver+)) (+WellDefined *Associative (+WellDefined (transitive *Associative *Commutative) *Associative)))) +Associative) (+WellDefined (symmetric *DistributesOver+') (symmetric *DistributesOver+'))) (symmetric *DistributesOver+)))\n\ninducedFunctionIsHom : (a : A) → RingHom polyRing R (λ p → inducedFunction p a)\nRingHom.preserves1 (inducedFunctionIsHom a) = transitive (+WellDefined reflexive (timesZero {a})) identRight\nRingHom.ringHom (inducedFunctionIsHom a) {r} {s} = inducedFunctionRingHom r s a\nGroupHom.groupHom (RingHom.groupHom (inducedFunctionIsHom a)) {x} {y} = inducedFunctionGroupHom {x} {y} a\nGroupHom.wellDefined (RingHom.groupHom (inducedFunctionIsHom a)) x=y = inducedFunctionWellDefined x=y a\n", "meta": {"hexsha": "3353c4836432f95f9e9997b76152b1a3aa1ac4fe", "size": 4486, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Polynomial/Evaluation.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Polynomial/Evaluation.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Polynomial/Evaluation.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 84.641509434, "max_line_length": 1033, "alphanum_fraction": 0.7527864467, "num_tokens": 1297, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9241418137109956, "lm_q2_score": 0.7401743620390162, "lm_q1q2_score": 0.6840260773971155}} {"text": "------------------------------------------------------------------------------\n-- The map-iterate property: A property using co-induction\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- The map-iterate property (Gibbons and Hutton, 2005):\n-- map f (iterate f x) = iterate f (f · x)\n\nmodule FOTC.Program.MapIterate.MapIterateATP where\n\nopen import FOTC.Base\nopen import FOTC.Base.List\nopen import FOTC.Data.List\nopen import FOTC.Relation.Binary.Bisimilarity.Type\n\n------------------------------------------------------------------------------\n-- The map-iterate property.\n≈-map-iterate : ∀ f x → map f (iterate f x) ≈ iterate f (f · x)\n≈-map-iterate f x = ≈-coind B h₁ h₂\n where\n -- Based on the relation used by (Giménez and Castéran, 2007).\n B : D → D → Set\n B xs ys = ∃[ y ] xs ≡ map f (iterate f y) ∧ ys ≡ iterate f (f · y)\n {-# ATP definition B #-}\n\n postulate\n h₁ : ∀ {xs} {ys} → B xs ys →\n ∃[ x' ] ∃[ xs' ] ∃[ ys' ] xs ≡ x' ∷ xs' ∧ ys ≡ x' ∷ ys' ∧ B xs' ys'\n {-# ATP prove h₁ #-}\n\n postulate h₂ : B (map f (iterate f x)) (iterate f (f · x))\n {-# ATP prove h₂ #-}\n\n------------------------------------------------------------------------------\n-- References\n--\n-- Giménez, Eduardo and Casterán, Pierre (2007). A Tutorial on\n-- [Co-]Inductive Types in Coq.\n--\n-- Gibbons, Jeremy and Hutton, Graham (2005). Proof Methods for\n-- Corecursive Programs. Fundamenta Informaticae XX, pp. 1–14.\n", "meta": {"hexsha": "330d088cf516533bcb6bb16e51bc6d1bf19917e9", "size": 1619, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/FOTC/Program/MapIterate/MapIterateATP.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/FOTC/Program/MapIterate/MapIterateATP.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/FOTC/Program/MapIterate/MapIterateATP.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 35.1956521739, "max_line_length": 78, "alphanum_fraction": 0.4879555281, "num_tokens": 446, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9059898254600902, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6839453021850155}} {"text": "------------------------------------------------------------------------\n-- Function setoids and related constructions\n------------------------------------------------------------------------\n\nmodule Relation.Binary.FunctionSetoid where\n\nopen import Data.Function\nopen import Relation.Binary\n\ninfixr 0 _↝_ _⟶_ _⇨_ _≡⇨_\n\n-- A logical relation (i.e. a relation which relates functions which\n-- map related things to related things).\n\n_↝_ : ∀ {A B} → (∼₁ : Rel A) (∼₂ : Rel B) → Rel (A → B)\n_∼₁_ ↝ _∼₂_ = λ f g → ∀ {x y} → x ∼₁ y → f x ∼₂ g y\n\n-- Functions which preserve equality.\n\nrecord _⟶_ (From To : Setoid) : Set where\n open Setoid\n infixl 5 _⟨$⟩_\n field\n _⟨$⟩_ : carrier From → carrier To\n pres : _⟨$⟩_ Preserves _≈_ From ⟶ _≈_ To\n\nopen _⟶_ public\n\n↝-isEquivalence : ∀ {A B C} {∼₁ : Rel A} {∼₂ : Rel B}\n (fun : C → (A → B)) →\n (∀ f → fun f Preserves ∼₁ ⟶ ∼₂) →\n IsEquivalence ∼₁ → IsEquivalence ∼₂ →\n IsEquivalence ((∼₁ ↝ ∼₂) on₁ fun)\n↝-isEquivalence _ pres eq₁ eq₂ = record\n { refl = λ {f} x∼₁y → pres f x∼₁y\n ; sym = λ f∼g x∼y → sym eq₂ (f∼g (sym eq₁ x∼y))\n ; trans = λ f∼g g∼h x∼y → trans eq₂ (f∼g (refl eq₁)) (g∼h x∼y)\n } where open IsEquivalence\n\n-- Function setoids.\n\n_⇨_ : Setoid → Setoid → Setoid\nS₁ ⇨ S₂ = record\n { carrier = S₁ ⟶ S₂\n ; _≈_ = (_≈_ S₁ ↝ _≈_ S₂) on₁ _⟨$⟩_\n ; isEquivalence =\n ↝-isEquivalence _⟨$⟩_ pres (isEquivalence S₁) (isEquivalence S₂)\n } where open Setoid; open _⟶_\n\n-- A generalised variant of (_↝_ _≡_).\n\n≡↝ : ∀ {A} {B : A → Set} → (∀ x → Rel (B x)) → Rel ((x : A) → B x)\n≡↝ R = λ f g → ∀ x → R x (f x) (g x)\n\n≡↝-isEquivalence : {A : Set} {B : A → Set} {R : ∀ x → Rel (B x)} →\n (∀ x → IsEquivalence (R x)) → IsEquivalence (≡↝ R)\n≡↝-isEquivalence eq = record\n { refl = λ _ → refl\n ; sym = λ f∼g x → sym (f∼g x)\n ; trans = λ f∼g g∼h x → trans (f∼g x) (g∼h x)\n } where open module Eq {x} = IsEquivalence (eq x)\n\n_≡⇨_ : (A : Set) → (A → Setoid) → Setoid\nA ≡⇨ S = record\n { carrier = (x : A) → carrier (S x)\n ; _≈_ = ≡↝ (λ x → _≈_ (S x))\n ; isEquivalence = ≡↝-isEquivalence (λ x → isEquivalence (S x))\n } where open Setoid\n", "meta": {"hexsha": "c7f9f404c7d6ad394e8c10391f94aa9aa444e723", "size": 2209, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Relation/Binary/FunctionSetoid.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Relation/Binary/FunctionSetoid.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Relation/Binary/FunctionSetoid.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 32.0144927536, "max_line_length": 72, "alphanum_fraction": 0.4993209597, "num_tokens": 896, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898254600902, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6839453021850155}} {"text": "module Metalogic.Classical.Propositional.TruthSemanticsModel {ℓ} (Proposition : Set(ℓ)) where\n\nimport Lvl\nopen import Data.Boolean\nopen import Data\nopen import Data.Tuple as Tuple using (_⨯_ ; _,_)\nopen import Functional\nopen import Metalogic.Classical.Propositional.Syntax{ℓ} (Proposition)\n renaming (\n ⊤ to ⊤ₗ ;\n ⊥ to ⊥ₗ ;\n ¬_ to ¬ₗ_ ;\n _∧_ to _∧ₗ_ ;\n _∨_ to _∨ₗ_ ;\n _⇒_ to _⇒ₗ_ )\nopen import Relator.Equals\nopen import Relator.Equals.Proofs\nopen import Sets.BoolSet\n\n-- A model decides whether a proposition is true or false\n-- Also known as Interpretation, Structure, Model\nrecord Model : Set(ℓ) where\n field\n interpretProp : Proposition → Bool\n\n-- TODO: Can this be called a \"theory\" of propositional logic? So that instances of the type Semantics is the \"models\" of logic?\n-- TODO: Now, all the metalogic depends on booleans, which may not be satisfactory\nmodule _ where\n import Data.Boolean.Operators\n open Data.Boolean.Operators.Logic\n\n satisfaction : Model → Formula → Bool\n satisfaction(𝔐)(• prop) = Model.interpretProp(𝔐) (prop)\n satisfaction(𝔐)(⊤ₗ) = 𝑇\n satisfaction(𝔐)(⊥ₗ) = 𝐹\n satisfaction(𝔐)(¬ₗ φ) = ¬(satisfaction(𝔐)(φ))\n satisfaction(𝔐)(φ₁ ∧ₗ φ₂) = (satisfaction(𝔐)(φ₁)) ∧ (satisfaction(𝔐)(φ₂))\n satisfaction(𝔐)(φ₁ ∨ₗ φ₂) = (satisfaction(𝔐)(φ₁)) ∨ (satisfaction(𝔐)(φ₂))\n satisfaction(𝔐)(φ₁ ⇒ₗ φ₂) = ¬(satisfaction(𝔐)(φ₁)) ∨ (satisfaction(𝔐)(φ₂))\n\n -- Syntactic details with the relation symbol\n record SatisfactionRelation {ℓ₁}{ℓ₂} (Obj : Set(ℓ) → Set(ℓ₁)) : Set(Lvl.𝐒(ℓ Lvl.⊔ ℓ₁ Lvl.⊔ ℓ₂)) where\n field\n _⊧_ : Model → Obj(Formula) → Set(ℓ₂)\n open SatisfactionRelation ⦃ ... ⦄ public\n\n instance\n -- Satisfaction for a single formula\n formula-satisfaction-relation : SatisfactionRelation(id)\n formula-satisfaction-relation = record{_⊧_ = \\𝔐 φ → satisfaction(𝔐)(φ) ≡ 𝑇}\n\n instance\n -- Satisfaction for a list of formulas\n list-satisfaction-relation : SatisfactionRelation(BoolSet{ℓ})\n list-satisfaction-relation = record{_⊧_ = \\𝔐 Γ → (∀{γ} → (γ ∈ Γ) → satisfaction(𝔐)(γ) ≡ 𝑇)}\n\n -- Entailment\n data _⊨_ (Γ : BoolSet{ℓ}(Formula)) (φ : Formula) : Set(ℓ) where\n [⊨]-intro : (∀{𝔐} → (𝔐 ⊧ Γ) → (𝔐 ⊧ φ)) → (Γ ⊨ φ)\n\n _⊭_ : BoolSet{ℓ}(Formula) → Formula → Set(ℓ)\n _⊭_ Γ φ = (_⊨_ Γ φ) → Empty{ℓ}\n\n -- Validity\n valid : Formula → Set(ℓ)\n valid = (∅ ⊨_)\n\n module Theorems where\n [⊤]-entailment : (∅ ⊨ ⊤ₗ)\n [⊤]-entailment = [⊨]-intro(const [≡]-intro)\n -- ∅ ⊨ ⊤ₗ\n -- ∀{𝔐} → (𝔐 ⊧ ∅) → (𝔐 ⊧ ⊤ₗ)\n -- ∀{𝔐} → (𝔐 ⊧ ∅) → (satisfaction(𝔐)(⊤ₗ) ≡ 𝑇)\n -- ∀{𝔐} → (∀{γ} → (γ ∈ ∅) → satisfaction(𝔐)(γ) ≡ 𝑇) → (satisfaction(𝔐)(⊤ₗ) ≡ 𝑇)\n\n -- [∧]-entailment : ∀{φ₁ φ₂} → ([ φ₁ ⊰ φ₂ ] ⊨ (φ₁ ∧ₗ φ₂))\n -- [∧]-entailment{φ₁}{φ₂} = [⊨]-intro ([∈]-proof ↦ congruence₁-op(_∧_) ([∈]-proof (use)) ([∈]-proof (skip use)))\n -- [ φ₁ ⊰ φ₂ ] ⊨ (φ₁ ∧ φ₂)\n -- ∀{𝔐} → (𝔐 ⊧ [ φ₁ ⊰ φ₂ ]) → (𝔐 ⊧ (φ₁ ∧ φ₂))\n -- ∀{𝔐} → (𝔐 ⊧ [ φ₁ ⊰ φ₂ ]) → (satisfaction(𝔐)(φ₁ ∧ₗ φ₂) ≡ 𝑇)\n -- ∀{𝔐} → (𝔐 ⊧ [ φ₁ ⊰ φ₂ ]) → (satisfaction(𝔐)(φ₁) ∧ satisfaction(𝔐)(φ₂) ≡ 𝑇)\n -- ∀{𝔐} → (∀{γ} → (γ ∈ [ φ₁ ⊰ φ₂ ]) → satisfaction(𝔐)(γ) ≡ 𝑇) → (satisfaction(𝔐)(φ₁) ∧ satisfaction(𝔐)(φ₂) ≡ 𝑇)\n", "meta": {"hexsha": "10309dc1d6ce8c224a45e22f9ef04076d939fc21", "size": 3163, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Metalogic/Metalogic/Classical/Propositional/TruthSemanticsModel.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Metalogic/Metalogic/Classical/Propositional/TruthSemanticsModel.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Metalogic/Metalogic/Classical/Propositional/TruthSemanticsModel.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.1084337349, "max_line_length": 128, "alphanum_fraction": 0.5950047423, "num_tokens": 1394, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898178450964, "lm_q2_score": 0.7549149868676283, "lm_q1q2_score": 0.6839452914407358}} {"text": "open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl)\nopen import Data.Fin using (Fin)\nopen import Data.Nat using (ℕ)\nopen import Data.Product using (_×_; _,_)\nopen import Data.Vec using (Vec; lookup; _[_]≔_)\n\nopen import Common\n\ndata Local (n : ℕ) : Set where\n endL : Local n\n sendSingle recvSingle : Fin n -> Label -> Local n -> Local n\n\nprivate\n variable\n n : ℕ\n p p′ q : Fin n\n l l′ : Label\n lSub lSub′ : Local n\n\nendL≢sendSingle : ∀ { lSub } -> endL {n} ≢ sendSingle q l lSub\nendL≢sendSingle ()\n\nendL≢recvSingle : ∀ { lSub } -> endL {n} ≢ recvSingle q l lSub\nendL≢recvSingle ()\n\nsendSingle-injective :\n sendSingle {n} p l lSub ≡ sendSingle p′ l′ lSub′\n -> p ≡ p′ × l ≡ l′ × lSub ≡ lSub′\nsendSingle-injective refl = refl , refl , refl\n\nrecvSingle-injective :\n recvSingle {n} p l lSub ≡ recvSingle p′ l′ lSub′\n -> p ≡ p′ × l ≡ l′ × lSub ≡ lSub′\nrecvSingle-injective refl = refl , refl , refl\n\nConfiguration : ℕ -> Set\nConfiguration n = Vec (Local n) n\n\ndata _-_→l_ {n : ℕ} : (Fin n × Local n) -> Action n -> (Fin n × Local n) -> Set where\n →l-send :\n ∀ { lp lpSub }\n -> (p : Fin n)\n -> lp ≡ sendSingle q l lpSub\n -> (p≢q : p ≢ q)\n -> (p , lp) - (action p q p≢q l) →l (p , lpSub)\n →l-recv :\n ∀ { lp lpSub }\n -> (p : Fin n)\n -> lp ≡ recvSingle q l lpSub\n -> (q≢p : q ≢ p)\n -> (p , lp) - (action q p q≢p l) →l (p , lpSub)\n\ndata _-_→c_ {n : ℕ} : Configuration n -> Action n -> Configuration n -> Set where\n →c-comm :\n ∀ { lp lp′ lq lq′ c′ p≢q-p p≢q-q }\n -> (c : Configuration n)\n -> (p≢q : p ≢ q)\n -> lp ≡ lookup c p\n -> lq ≡ lookup c q\n -> c′ ≡ c [ p ]≔ lp′ [ q ]≔ lq′\n -> (p , lp) - (action p q p≢q-p l) →l (p , lp′)\n -> (q , lq) - (action p q p≢q-q l) →l (q , lq′)\n -> c - (action p q p≢q l) →c c′\n", "meta": {"hexsha": "ef9e873dfb78a911d1adc52aa60bac6ded7ffd17", "size": 1799, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Local.agda", "max_stars_repo_name": "fangyi-zhou/mpst-in-agda", "max_stars_repo_head_hexsha": "3d12eed9d340207d242d70f43c6b34e01d3620de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-08-14T17:36:53.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-14T17:36:53.000Z", "max_issues_repo_path": "Local.agda", "max_issues_repo_name": "fangyi-zhou/mpst-in-agda", "max_issues_repo_head_hexsha": "3d12eed9d340207d242d70f43c6b34e01d3620de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-08-31T10:15:38.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-24T11:30:17.000Z", "max_forks_repo_path": "Local.agda", "max_forks_repo_name": "fangyi-zhou/mpst-in-agda", "max_forks_repo_head_hexsha": "3d12eed9d340207d242d70f43c6b34e01d3620de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.109375, "max_line_length": 85, "alphanum_fraction": 0.5475264036, "num_tokens": 716, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213691605412, "lm_q2_score": 0.7606506635289836, "lm_q1q2_score": 0.6839172660450539}} {"text": "{-# OPTIONS --cubical --safe #-}\n\nopen import Prelude\nopen import Relation.Binary\n\nmodule Relation.Binary.Construct.Decision\n {a ℓ₁ ℓ₂} {A : Type a}\n (ord : TotalOrder A ℓ₁ ℓ₂)\n where\n\nopen TotalOrder ord renaming (refl to ≤-refl)\n\n_<′_ : A → A → Type\nx <′ y = T (does (x ′ : ∀ {x y} → ¬ (x ≤′ y) → y <′ x\n≰⇒>′ {x} {y} p with y ′ {x} {y} p | no _ = p tt\n≰⇒>′ {x} {y} p | yes _ = tt\n\n≮⇒≥′ : ∀ {x y} → ¬ (x <′ y) → y ≤′ x\n≮⇒≥′ {x} {y} p with x dec-ord = ≰⇒>′\nTotalOrder.≮⇒≥ dec-ord = ≮⇒≥′\n", "meta": {"hexsha": "c23babad83f885446f02442818983667a0bf97dc", "size": 2142, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Relation/Binary/Construct/Decision.agda", "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_issues_repo_path": "Relation/Binary/Construct/Decision.agda", "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Relation/Binary/Construct/Decision.agda", "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "avg_line_length": 35.1147540984, "max_line_length": 151, "alphanum_fraction": 0.5877684407, "num_tokens": 942, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213691605412, "lm_q2_score": 0.7606506526772884, "lm_q1q2_score": 0.6839172562880628}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n-- The category of Cats is Monoidal\n\nmodule Categories.Category.Monoidal.Instance.Cats where\n\nopen import Level\n\nopen import Categories.Category.BinaryProducts using (BinaryProducts)\nopen import Categories.Category.Cartesian using (Cartesian)\nopen import Categories.Category.Cartesian.Monoidal using (module CartesianMonoidal)\nopen import Categories.Category.Instance.Cats using (Cats)\nopen import Categories.Category.Instance.One using (One-⊤)\nopen import Categories.Category.Monoidal using (Monoidal)\nopen import Categories.Category.Product using (Product; πˡ; πʳ; _※_)\nopen import Categories.Category.Product.Properties using (project₁; project₂; unique)\n\n-- Cats is a Monoidal Category with Product as Bifunctor\nmodule Product {o ℓ e : Level} where\n private\n C = Cats o ℓ e\n\n Cats-has-all : BinaryProducts C\n Cats-has-all = record { product = λ {A} {B} → record\n { A×B = Product A B\n ; π₁ = πˡ\n ; π₂ = πʳ\n ; ⟨_,_⟩ = _※_\n ; project₁ = λ {_} {h} {i} → project₁ {i = h} {j = i}\n ; project₂ = λ {_} {h} {i} → project₂ {i = h} {j = i}\n ; unique = unique\n } }\n\n Cats-is : Cartesian C\n Cats-is = record { terminal = One-⊤ ; products = Cats-has-all }\n\n Cats-Monoidal : Monoidal C\n Cats-Monoidal = CartesianMonoidal.monoidal Cats-is\n", "meta": {"hexsha": "adeac7d48649b135372e2ff56bc0dc682884b4ac", "size": 1298, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Monoidal/Instance/Cats.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Monoidal/Instance/Cats.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Monoidal/Instance/Cats.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 33.2820512821, "max_line_length": 85, "alphanum_fraction": 0.7026194145, "num_tokens": 360, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9314624993576759, "lm_q2_score": 0.7341195385342971, "lm_q1q2_score": 0.6838048201904601}} {"text": "module List.Permutation.Base (A : Set) where\n\nopen import Data.List\n\ndata _/_⟶_ : List A → A → List A → Set where\n /head : {x : A}{xs : List A} \n → (x ∷ xs) / x ⟶ xs\n /tail : {x y : A}{xs ys : List A} \n → xs / y ⟶ ys \n → (x ∷ xs) / y ⟶ (x ∷ ys)\n \ndata _∼_ : List A → List A → Set where\n ∼[] : [] ∼ []\n ∼x : {x : A}{xs ys xs' ys' : List A} \n → xs / x ⟶ xs' \n → ys / x ⟶ ys' \n → xs' ∼ ys' \n → xs ∼ ys\n\n", "meta": {"hexsha": "969a1f41f70d25abb6d875152664c6cc521cee79", "size": 542, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/List/Permutation/Base.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/List/Permutation/Base.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/List/Permutation/Base.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.1, "max_line_length": 44, "alphanum_fraction": 0.3376383764, "num_tokens": 192, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9353465062370312, "lm_q2_score": 0.7310585903489891, "lm_q1q2_score": 0.683793098337496}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Integers.Definition\n\nmodule Numbers.Integers.Multiplication where\n\ninfix 25 _*Z_\n_*Z_ : ℤ → ℤ → ℤ\nnonneg x *Z nonneg y = nonneg (x *N y)\nnonneg zero *Z negSucc y = nonneg zero\nnonneg (succ x) *Z negSucc y = negSucc ((succ x) *N y +N x)\nnegSucc x *Z nonneg zero = nonneg zero\nnegSucc x *Z nonneg (succ y) = negSucc ((succ y) *N x +N y)\nnegSucc x *Z negSucc y = nonneg ((succ x) *N (succ y))\n\n*ZInherits : (a b : ℕ) → nonneg (a *N b) ≡ (nonneg a) *Z (nonneg b)\n*ZInherits a b = refl\n", "meta": {"hexsha": "6f0ebd50db4b4f813d6c85eaaf8ff489a9775e3e", "size": 619, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numbers/Integers/Multiplication.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Numbers/Integers/Multiplication.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Numbers/Integers/Multiplication.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 30.95, "max_line_length": 67, "alphanum_fraction": 0.6768982229, "num_tokens": 231, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9473810407096792, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.6837658355776229}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Semi-heterogeneous vector equality over setoids\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary\n\nmodule Data.Vec.Relation.Binary.Equality.Setoid\n {a ℓ} (S : Setoid a ℓ) where\n\nopen import Data.Nat.Base using (ℕ; zero; suc; _+_)\nopen import Data.Vec\nopen import Data.Vec.Relation.Binary.Pointwise.Inductive as PW\n using (Pointwise)\nopen import Function\nopen import Level using (_⊔_)\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as P using (_≡_)\n\nopen Setoid S renaming (Carrier to A)\n\n------------------------------------------------------------------------\n-- Definition of equality\n\ninfix 4 _≋_\n\n_≋_ : ∀ {m n} → REL (Vec A m) (Vec A n) (a ⊔ ℓ)\n_≋_ = Pointwise _≈_\n\nopen Pointwise public using ([]; _∷_)\nopen PW public using (length-equal)\n\n------------------------------------------------------------------------\n-- Relational properties\n\n≋-refl : ∀ {n} → Reflexive (_≋_ {n})\n≋-refl = PW.refl refl\n\n≋-sym : ∀ {n m} → Sym _≋_ (_≋_ {m} {n})\n≋-sym = PW.sym sym\n\n≋-trans : ∀ {n m o} → Trans (_≋_ {m}) (_≋_ {n} {o}) (_≋_)\n≋-trans = PW.trans trans\n\n≋-isEquivalence : ∀ n → IsEquivalence (_≋_ {n})\n≋-isEquivalence = PW.isEquivalence isEquivalence\n\n≋-setoid : ℕ → Setoid a (a ⊔ ℓ)\n≋-setoid = PW.setoid S\n\n------------------------------------------------------------------------\n-- map\n\nopen PW public using ( map⁺)\n\n------------------------------------------------------------------------\n-- ++\n\nopen PW public using (++⁺ ; ++⁻ ; ++ˡ⁻; ++ʳ⁻)\n\n++-identityˡ : ∀ {n} (xs : Vec A n) → [] ++ xs ≋ xs\n++-identityˡ _ = ≋-refl\n\n++-identityʳ : ∀ {n} (xs : Vec A n) → xs ++ [] ≋ xs\n++-identityʳ [] = []\n++-identityʳ (x ∷ xs) = refl ∷ ++-identityʳ xs\n\nmap-++-commute : ∀ {b m n} {B : Set b}\n (f : B → A) (xs : Vec B m) {ys : Vec B n} →\n map f (xs ++ ys) ≋ map f xs ++ map f ys\nmap-++-commute f [] = ≋-refl\nmap-++-commute f (x ∷ xs) = refl ∷ map-++-commute f xs\n\n------------------------------------------------------------------------\n-- concat\n\nopen PW public using (concat⁺; concat⁻)\n\n------------------------------------------------------------------------\n-- replicate\n\nreplicate-shiftʳ : ∀ {m} n x (xs : Vec A m) →\n replicate {n = n} x ++ (x ∷ xs) ≋\n replicate {n = 1 + n} x ++ xs\nreplicate-shiftʳ zero x xs = ≋-refl\nreplicate-shiftʳ (suc n) x xs = refl ∷ (replicate-shiftʳ n x xs)\n", "meta": {"hexsha": "5403745b902bf83f1e426b8022140e9fd604c67b", "size": 2596, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Vec/Relation/Binary/Equality/Setoid.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Vec/Relation/Binary/Equality/Setoid.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Vec/Relation/Binary/Equality/Setoid.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.8444444444, "max_line_length": 72, "alphanum_fraction": 0.4499229584, "num_tokens": 770, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972818382005, "lm_q2_score": 0.7853085758631159, "lm_q1q2_score": 0.683687511550657}} {"text": "{- Voevodsky's proof that univalence implies funext -}\n\n{-# OPTIONS --cubical --safe #-}\n\nmodule Cubical.Experiments.FunExtFromUA where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Foundations.Everything\n\nvariable\n ℓ ℓ' : Level\n_∼_ : {X : Type ℓ} {A : X → Type ℓ'} → (f g : (x : X) → A x) → Type (ℓ-max ℓ ℓ')\nf ∼ g = ∀ x → f x ≡ g x\n\nfunext : ∀ ℓ ℓ' → Type (ℓ-suc(ℓ-max ℓ ℓ'))\nfunext ℓ ℓ' = {X : Type ℓ} {Y : Type ℓ'} {f g : X → Y} → f ∼ g → f ≡ g\n\n\nelimEquivFun' : ∀ {ℓ} (P : (A B : Type ℓ) → (A → B) → Type ℓ)\n → (r : (B : Type ℓ) → P B B (λ x → x))\n → (A B : Type ℓ) → (e : A ≃ B) → P A B (e .fst)\nelimEquivFun' P r A B = elimEquivFun B (λ A → P A B) (r B) A\n\npre-comp-is-equiv : (X Y : Type ℓ) (f : X → Y) (Z : Type ℓ)\n → isEquiv f\n → isEquiv (λ (g : Y → Z) → g ∘ f)\npre-comp-is-equiv {ℓ} X Y f Z e = elimEquivFun' P r X Y (f , e)\n where\n P : (X Y : Type ℓ) → (X → Y) → Type ℓ\n P X Y f = isEquiv (λ (g : Y → Z) → g ∘ f)\n r : (B : Type ℓ) → P B B (λ x → x)\n r B = idIsEquiv (B → Z)\n\nleftCancellable : {X : Type ℓ} {Y : Type ℓ'} → (X → Y) → Type (ℓ-max ℓ ℓ')\nleftCancellable f = ∀ {x x'} → f x ≡ f x' → x ≡ x'\n\nequivLC : {X : Type ℓ} {Y : Type ℓ'} (f : X → Y) → isEquiv f → leftCancellable f\nequivLC f e {x} {x'} p i = hcomp (λ j → \\ {(i = i0) → secEq (f , e) x j ;\n (i = i1) → secEq (f , e) x' j})\n (invEq (f , e) (p i))\n\nunivalence-gives-funext : funext ℓ' ℓ\nunivalence-gives-funext {ℓ'} {ℓ} {X} {Y} {f₀} {f₁} = γ\n where\n Δ = Σ[ y₀ ∈ Y ] Σ[ y₁ ∈ Y ] y₀ ≡ y₁\n\n δ : Y → Δ\n δ y = (y , y , refl)\n\n π₀ π₁ : Δ → Y\n π₀ (y₀ , y₁ , p) = y₀\n π₁ (y₀ , y₁ , p) = y₁\n\n δ-is-equiv : isEquiv δ\n δ-is-equiv = isoToIsEquiv (iso δ π₀ ε η)\n where\n η : (y : Y) → π₀ (δ y) ≡ y\n η y = refl\n ε : (d : Δ) → δ (π₀ d) ≡ d\n ε (y₀ , y₁ , p) i = y₀ , p i , λ j → p (i ∧ j)\n\n φ : (Δ → Y) → (Y → Y)\n φ π = π ∘ δ\n\n e : isEquiv φ\n e = pre-comp-is-equiv Y Δ δ Y δ-is-equiv\n\n p : φ π₀ ≡ φ π₁\n p = refl\n\n q : π₀ ≡ π₁\n q = equivLC φ e p\n\n g : (h : f₀ ∼ f₁) (π : Δ → Y) (x : X) → Y\n g = λ h π x → π (f₀ x , f₁ x , h x)\n\n γ : f₀ ∼ f₁ → f₀ ≡ f₁\n γ h = cong (g h) q\n\n γ' : f₀ ∼ f₁ → f₀ ≡ f₁\n γ' h = f₀ ≡⟨ refl ⟩\n (λ x → f₀ x) ≡⟨ refl ⟩\n (λ x → π₀ (f₀ x , f₁ x , h x)) ≡⟨ cong (g h) q ⟩\n (λ x → π₁ (f₀ x , f₁ x , h x)) ≡⟨ refl ⟩\n (λ x → f₁ x) ≡⟨ refl ⟩\n f₁ ∎\n\n{- Experiment testing univalence via funext -}\n\nprivate\n\n data ℕ : Type₀ where\n zero : ℕ\n succ : ℕ → ℕ\n\n f g : ℕ → ℕ\n\n f n = n\n\n g zero = zero\n g (succ n) = succ (g n)\n\n h : (n : ℕ) → f n ≡ g n\n h zero = refl\n h (succ n) = cong succ (h n)\n\n p : f ≡ g\n p = univalence-gives-funext h\n\n five : ℕ\n five = succ (succ (succ (succ (succ zero))))\n\n a : Σ ℕ (λ n → f n ≡ five)\n a = five , refl\n\n b : Σ ℕ (λ n → g n ≡ five)\n b = subst (λ - → Σ ℕ (λ n → - n ≡ five)) p a\n\n c : fst b ≡ five\n c = refl\n\n{- It works, fast. -}\n", "meta": {"hexsha": "2c392b56090230882388bd95e474c6fbbdca4078", "size": 3080, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Experiments/FunExtFromUA.agda", "max_stars_repo_name": "cj-xu/cubical", "max_stars_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Experiments/FunExtFromUA.agda", "max_issues_repo_name": "cj-xu/cubical", "max_issues_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Experiments/FunExtFromUA.agda", "max_forks_repo_name": "cj-xu/cubical", "max_forks_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.0406504065, "max_line_length": 80, "alphanum_fraction": 0.4324675325, "num_tokens": 1394, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972717658209, "lm_q2_score": 0.7853085808877581, "lm_q1q2_score": 0.6836875080151708}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Binary.Operations.Semantics where\n\nopen import Data.Nat as ℕ using (ℕ; suc; zero)\nopen import Data.Binary.Definitions\nopen import Data.Binary.Operations.Unary\nimport Data.List as List\n\n2* : ℕ → ℕ\n2* x = x ℕ.+ x\n{-# INLINE 2* #-}\n\n_∷⇓_ : Bit → ℕ → ℕ\nO ∷⇓ xs = 2* xs\nI ∷⇓ xs = suc (2* xs)\n{-# INLINE _∷⇓_ #-}\n\n⟦_⇓⟧⁺ : 𝔹⁺ → ℕ\n⟦_⇓⟧⁺ = List.foldr _∷⇓_ 1\n{-# INLINE ⟦_⇓⟧⁺ #-}\n\n⟦_⇓⟧ : 𝔹 → ℕ\n⟦ 0ᵇ ⇓⟧ = 0\n⟦ 0< xs ⇓⟧ = ⟦ xs ⇓⟧⁺\n\n⟦_⇑⟧ : ℕ → 𝔹\n⟦ zero ⇑⟧ = 0ᵇ\n⟦ suc n ⇑⟧ = inc ⟦ n ⇑⟧\n", "meta": {"hexsha": "66ef27e5d8b382a8dab401d6bf6f796e23ab647d", "size": 519, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Binary/Operations/Semantics.agda", "max_stars_repo_name": "oisdk/agda-binary", "max_stars_repo_head_hexsha": "92af4d620febd47a9791d466d747278dc4a417aa", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-03-21T21:30:10.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-21T21:30:10.000Z", "max_issues_repo_path": "Data/Binary/Operations/Semantics.agda", "max_issues_repo_name": "oisdk/agda-binary", "max_issues_repo_head_hexsha": "92af4d620febd47a9791d466d747278dc4a417aa", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Binary/Operations/Semantics.agda", "max_forks_repo_name": "oisdk/agda-binary", "max_forks_repo_head_hexsha": "92af4d620febd47a9791d466d747278dc4a417aa", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.3, "max_line_length": 46, "alphanum_fraction": 0.527938343, "num_tokens": 284, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9273632976542185, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.6836134299430076}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Algebra.CommRing.Integers where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Algebra.CommRing\nopen import Cubical.HITs.Ints.BiInvInt\n renaming (\n _+_ to _+ℤ_;\n -_ to _-ℤ_;\n +-assoc to +ℤ-assoc;\n +-comm to +ℤ-comm\n )\n\nBiInvIntAsCommRing : CommRing {ℓ-zero}\nBiInvIntAsCommRing =\n makeCommRing\n zero (suc zero) _+ℤ_ _·_ _-ℤ_\n isSetBiInvInt\n +ℤ-assoc +-zero +-invʳ +ℤ-comm\n ·-assoc ·-identityʳ\n (λ x y z → sym (·-distribˡ x y z))\n ·-comm\n", "meta": {"hexsha": "a759762e226d60a93ff538a4ff2b64fe58f8d7ef", "size": 550, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommRing/Integers.agda", "max_stars_repo_name": "dan-iel-lee/cubical", "max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommRing/Integers.agda", "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/Algebra/CommRing/Integers.agda", "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.9166666667, "max_line_length": 50, "alphanum_fraction": 0.6636363636, "num_tokens": 204, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9273632896242073, "lm_q2_score": 0.7371581626286833, "lm_q1q2_score": 0.6836134186686721}} {"text": "-- In Agda 2.5.3 the error was:\n\n-- μ₂ is not strictly positive, because it occurs\n-- in the third argument to ⟦_⟧\n-- in the type of the constructor fix\n-- in the definition of μ₂.\n\nopen import Data.Nat using (ℕ;zero;suc)\nopen import Data.Fin using (Fin;zero;suc)\nopen import Data.Vec\nopen import Data.Empty\nopen import Data.Product\nopen import Data.Sum\nopen import Data.Unit\n\nΣ# : {n : ℕ} -> (Fin n -> Set) -> Set\nΣ# {zero} f = ⊥\nΣ# {suc zero} f = f zero\nΣ# {suc n} f = f zero ⊎ Σ# {n} λ i -> f (suc i)\n\nmodule Matrices {Ix : Set} {Σ : (Ix -> Set) -> Set} where\n\n Matrix : Set1\n Matrix = (i j : Ix) -> Set\n\n _<+>_ : Matrix -> Matrix -> Matrix\n m <+> n = λ i j -> m i j ⊎ n i j\n {-# INLINE _<+>_ #-}\n\n _<*>_ : Matrix -> Matrix -> Matrix\n m <*> n = λ i j -> Σ λ k -> m i k × n k j\n {-# INLINE _<*>_ #-}\n\ndata Poly {Coeffs : Set1} : Set1 where\n 0p 1p : Poly\n X : Poly\n _+_ _*_ : (D1 D2 : Poly {Coeffs}) -> Poly {Coeffs}\n K : Coeffs -> Poly\n\nmodule Dim {n : ℕ} where\n open Matrices {Fin n} {Σ#}\n\n ⟦_⟧ : Poly {Vec (Vec Set n) n} -> Matrix -> Matrix\n ⟦ 0p ⟧ x i j = ⊥\n ⟦ 1p ⟧ x i j = ⊤\n ⟦ X ⟧ x i j = x i j\n ⟦ D1 + D2 ⟧ x i j = (⟦ D1 ⟧ x <+> ⟦ D2 ⟧ x) i j\n ⟦ D1 * D2 ⟧ x i j = (⟦ D1 ⟧ x <*> ⟦ D2 ⟧ x) i j\n ⟦ K S ⟧ x i j = lookup (lookup S i) j\n\n ⟪_⟫ : Poly {Set} -> Set → Set\n ⟪ 0p ⟫ x = ⊥\n ⟪ 1p ⟫ x = ⊤\n ⟪ X ⟫ x = x\n ⟪ D1 + D2 ⟫ x = (⟪ D1 ⟫ x ⊎ ⟪ D2 ⟫ x)\n ⟪ D1 * D2 ⟫ x = (⟪ D1 ⟫ x × ⟪ D2 ⟫ x)\n ⟪ K S ⟫ x = S\n\n data μ₁ (p : Poly) : Set where\n fix : ⟪ p ⟫ (μ₁ p) -> μ₁ p\n\n data μ₂ (p : Poly) (i j : Fin n) : Set where\n fix : ⟦ p ⟧ (μ₂ p) i j -> μ₂ p i j\n", "meta": {"hexsha": "930dd97be843057ec8c1bc675259340baf6a98eb", "size": 1584, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/LibSucceed/Issue421.agda", "max_stars_repo_name": "jappeace/agda", "max_stars_repo_head_hexsha": "aa5e3a127bf17a8c80d947f3c286758a36dadc36", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/LibSucceed/Issue421.agda", "max_issues_repo_name": "jappeace/agda", "max_issues_repo_head_hexsha": "aa5e3a127bf17a8c80d947f3c286758a36dadc36", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/LibSucceed/Issue421.agda", "max_forks_repo_name": "jappeace/agda", "max_forks_repo_head_hexsha": "aa5e3a127bf17a8c80d947f3c286758a36dadc36", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.75, "max_line_length": 57, "alphanum_fraction": 0.5012626263, "num_tokens": 736, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887587875995482, "lm_q2_score": 0.7690802370707281, "lm_q1q2_score": 0.6835268190657534}} {"text": "module Prelude.List.Relations.All where\n\nopen import Prelude.Equality\nopen import Prelude.Nat\nopen import Prelude.Empty\nopen import Prelude.Unit\nopen import Prelude.Product\nopen import Prelude.Number\nopen import Prelude.List.Base\n\nopen import Prelude.Applicative\n\nopen import Agda.Primitive\n\ninfixr 5 _∷_\ndata All {a b} {A : Set a} (P : A → Set b) : List A → Set (a ⊔ b) where\n [] : All P []\n _∷_ : ∀ {x xs} (p : P x) (ps : All P xs) → All P (x ∷ xs)\n", "meta": {"hexsha": "b6c5668fe5197d89d99a9855db09c7e247944de6", "size": 454, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Prelude/List/Relations/All.agda", "max_stars_repo_name": "t-more/agda-prelude", "max_stars_repo_head_hexsha": "da4fca7744d317b8843f2bc80a923972f65548d3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Prelude/List/Relations/All.agda", "max_issues_repo_name": "t-more/agda-prelude", "max_issues_repo_head_hexsha": "da4fca7744d317b8843f2bc80a923972f65548d3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Prelude/List/Relations/All.agda", "max_forks_repo_name": "t-more/agda-prelude", "max_forks_repo_head_hexsha": "da4fca7744d317b8843f2bc80a923972f65548d3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.8947368421, "max_line_length": 71, "alphanum_fraction": 0.6960352423, "num_tokens": 141, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9124361580958427, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6834942690351681}} {"text": "------------------------------------------------------------------------------\n-- The gcd program is correct\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- This module proves the correctness of the gcd program using\n-- the Euclid's algorithm.\n\nmodule LTC-PCF.Program.GCD.Total.CorrectnessProof where\n\nopen import LTC-PCF.Base\nopen import LTC-PCF.Data.Nat.Type\nopen import LTC-PCF.Program.GCD.Total.CommonDivisor using ( gcdCD )\nopen import LTC-PCF.Program.GCD.Total.Definitions using ( gcdSpec )\nopen import LTC-PCF.Program.GCD.Total.Divisible using ( gcdDivisible )\nopen import LTC-PCF.Program.GCD.Total.GCD using ( gcd )\n\n------------------------------------------------------------------------------\n-- The gcd is correct.\ngcdCorrect : ∀ {m n} → N m → N n → gcdSpec m n (gcd m n)\ngcdCorrect Nm Nn = gcdCD Nm Nn , gcdDivisible Nm Nn\n", "meta": {"hexsha": "e937f8c198b881b716544700e07e70dc2439222f", "size": 1044, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/LTC-PCF/Program/GCD/Total/CorrectnessProof.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/LTC-PCF/Program/GCD/Total/CorrectnessProof.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/LTC-PCF/Program/GCD/Total/CorrectnessProof.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 40.1538461538, "max_line_length": 78, "alphanum_fraction": 0.5335249042, "num_tokens": 220, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.91243616285804, "lm_q2_score": 0.7490872187162397, "lm_q1q2_score": 0.6834942674914471}} {"text": "module map-compose where\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl; cong)\nopen Eq.≡-Reasoning\nopen import Function using (_∘_)\nopen import lists using (List; []; _∷_; map)\n\npostulate\n -- 外延性の公理\n extensionality : ∀ {A B : Set} {f g : A → B}\n → (∀ (x : A) → f x ≡ g x)\n -----------------------\n → f ≡ g\n\n-- 外延性の公理を用いた証明のための補助定理\nlemma : ∀ {A B C : Set} → (f : A → B) → (g : B → C) → (x : List A)\n → map (g ∘ f) x ≡ (map g ∘ map f) x\nlemma f g [] = refl\nlemma f g (x ∷ xs) =\n begin\n map (g ∘ f) (x ∷ xs)\n ≡⟨⟩\n (g ∘ f) x ∷ map (g ∘ f) xs\n ≡⟨ cong ((g ∘ f) x ∷_) (lemma f g xs) ⟩\n (g ∘ f) x ∷ (map g ∘ map f) xs\n ≡⟨⟩\n (map g ∘ map f) (x ∷ xs)\n ∎\n\n-- mapの分配法則の証明\nmap-compose : ∀ {A B C : Set} → (f : A → B) → (g : B → C)\n → map (g ∘ f) ≡ map g ∘ map f\nmap-compose f g = extensionality (lemma f g)\n", "meta": {"hexsha": "0b9e1c7cd0cfa68166517c4b05dbad6e50bd2a9f", "size": 863, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "part1/lists/map-compose.agda", "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_issues_repo_path": "part1/lists/map-compose.agda", "max_issues_repo_name": "akiomik/plfa-solutions", "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "part1/lists/map-compose.agda", "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.6571428571, "max_line_length": 66, "alphanum_fraction": 0.4913093859, "num_tokens": 401, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206791658465, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.6834704090745916}} {"text": "{-# OPTIONS --without-K #-}\n\nopen import HoTT\n\nmodule cohomology.Choice where\n\nunchoose : ∀ {i j} {n : ℕ₋₂} {A : Type i} {B : A → Type j}\n → Trunc n (Π A B) → Π A (Trunc n ∘ B)\nunchoose = Trunc-rec (Π-level (λ _ → Trunc-level)) (λ f → [_] ∘ f)\n\nhas-choice : ∀ {i j} (n : ℕ₋₂) (A : Type i) (B : A → Type j) → Type (lmax i j)\nhas-choice {i} {j} n A B = is-equiv (unchoose {n = n} {A} {B})\n\n{- Binary Choice -}\nmodule _ {k} where\n\n pick-Bool : ∀ {j} {C : Lift {j = k} Bool → Type j}\n → (C (lift true)) → (C (lift false)) → Π (Lift Bool) C\n pick-Bool x y (lift true) = x\n pick-Bool x y (lift false) = y\n\n pick-Bool-η : ∀ {j} {C : Lift Bool → Type j} (f : Π (Lift Bool) C)\n → pick-Bool (f (lift true)) (f (lift false)) == f\n pick-Bool-η {C = C} f = λ= lemma\n where\n lemma : (b : Lift Bool) →\n pick-Bool {C = C} (f (lift true)) (f (lift false)) b == f b\n lemma (lift true) = idp\n lemma (lift false) = idp\n\n module _ {i} {n : ℕ₋₂} {A : Lift {j = k} Bool → Type i} where\n choose-Bool : Π (Lift Bool) (Trunc n ∘ A) → Trunc n (Π (Lift Bool) A)\n choose-Bool f = Trunc-rec Trunc-level\n (λ ft → Trunc-rec Trunc-level\n (λ ff → [ pick-Bool ft ff ] )\n (f (lift false)))\n (f (lift true))\n\n choose-Bool-squash : (f : Π (Lift Bool) A)\n → choose-Bool (λ b → [ f b ]) == [ f ]\n choose-Bool-squash f = ap [_] (pick-Bool-η f)\n\n private\n unc-c : ∀ f → unchoose (choose-Bool f) == f\n unc-c f = transport\n (λ h → unchoose (choose-Bool h) == h)\n (pick-Bool-η f)\n (Trunc-elim\n {P = λ tft →\n unchoose (choose-Bool (pick-Bool tft (f (lift false))))\n == pick-Bool tft (f (lift false))}\n (λ _ → =-preserves-level _ (Π-level (λ _ → Trunc-level)))\n (λ ft → Trunc-elim\n {P = λ tff →\n unchoose (choose-Bool (pick-Bool [ ft ] tff ))\n == pick-Bool [ ft ] tff}\n (λ _ → =-preserves-level _ (Π-level (λ _ → Trunc-level)))\n (λ ff → ! (pick-Bool-η _))\n (f (lift false)))\n (f (lift true)))\n\n c-unc : ∀ tg → choose-Bool (unchoose tg) == tg\n c-unc = Trunc-elim\n {P = λ tg → choose-Bool (unchoose tg) == tg}\n (λ _ → =-preserves-level _ Trunc-level)\n (λ g → ap [_] (pick-Bool-η g))\n\n Bool-has-choice : has-choice n (Lift Bool) A\n Bool-has-choice = is-eq unchoose choose-Bool unc-c c-unc\n\n", "meta": {"hexsha": "89ab9535dc550ed269f57b70d26d206124e7bd27", "size": 2422, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "cohomology/Choice.agda", "max_stars_repo_name": "UlrikBuchholtz/HoTT-Agda", "max_stars_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-30T00:17:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-30T00:17:55.000Z", "max_issues_repo_path": "cohomology/Choice.agda", "max_issues_repo_name": "nicolaikraus/HoTT-Agda", "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "cohomology/Choice.agda", "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.1126760563, "max_line_length": 78, "alphanum_fraction": 0.5037159372, "num_tokens": 888, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110368115781, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.683389133102411}} {"text": "------------------------------------------------------------------------------\n-- FOTC version of a nested recursive function\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- From: Ana Bove and Venanzio Capretta. Nested general recursion and\n-- partiality in type theory. Vol. 2152 of LNCS. 2001.\n\nmodule FOT.FOTC.Program.Nest.PropertiesI where\n\nopen import Common.FOL.Relation.Binary.EqReasoning\n\nopen import FOTC.Base\nopen import FOTC.Data.Nat.Type\nopen import FOTC.Program.Nest.Nest\n\n------------------------------------------------------------------------------\n\nnestCong : ∀ {m n} → m ≡ n → nest m ≡ nest n\nnestCong refl = refl\n\nnest-x≡0 : ∀ {n} → N n → nest n ≡ zero\nnest-x≡0 nzero = nest-0\nnest-x≡0 (nsucc {n} Nn) =\n nest (succ₁ n) ≡⟨ nest-S n ⟩\n nest (nest n) ≡⟨ nestCong (nest-x≡0 Nn) ⟩\n nest zero ≡⟨ nest-0 ⟩\n zero ∎\n\nnest-N : ∀ {n} → N n → N (nest n)\nnest-N Nn = subst N (sym (nest-x≡0 Nn)) nzero\n", "meta": {"hexsha": "d4e9e2fb51d324ee2bfc0dbbb9dfdb6b62cfd0b7", "size": 1135, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/FOTC/Program/Nest/PropertiesI.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/FOTC/Program/Nest/PropertiesI.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/FOTC/Program/Nest/PropertiesI.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 31.5277777778, "max_line_length": 78, "alphanum_fraction": 0.4881057269, "num_tokens": 315, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110425624792, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.6833891327494901}} {"text": "\ntest.id : (A:Set) -> (x:A) -> A\ntest.id A x = x\n\nnat.plus : (x:Nat) -> (y:Nat) -> Nat\nnat.plus (nat.suc x) y = nat.suc (nat.plus x y)\nnat.plus nat.zero y = y\n\n", "meta": {"hexsha": "3239a66da9d0ef50ce7456f32b9fd649ad0659d0", "size": 160, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/core/core.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/core/core.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/core/core.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 17.7777777778, "max_line_length": 47, "alphanum_fraction": 0.5375, "num_tokens": 67, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178969328286, "lm_q2_score": 0.7520125793176222, "lm_q1q2_score": 0.6832920882866098}} {"text": "import Either\nopen import Boolean\n\nmodule Logic where\n\n id : ∀ { A : Set } → A → A\n id x = x\n\n Rel : Set → Set₁\n Rel X = X → X → Set\n\n Decidable : ∀ { X } → Rel X → Set\n Decidable R = ∀ x y → Either (R x y) (¬ (R x y))\n where open Either\n\n modusPonens : { P Q : Set } → ( P → Q ) → P → Q\n modusPonens = id\n", "meta": {"hexsha": "22d3c1804af3a060be5bfa4dbefbbdd9e3377708", "size": 317, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Logic.agda", "max_stars_repo_name": "cantsin/agda-experiments", "max_stars_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Logic.agda", "max_issues_repo_name": "cantsin/agda-experiments", "max_issues_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Logic.agda", "max_forks_repo_name": "cantsin/agda-experiments", "max_forks_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.6111111111, "max_line_length": 50, "alphanum_fraction": 0.5205047319, "num_tokens": 123, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9086178870347122, "lm_q2_score": 0.752012562644147, "lm_q1q2_score": 0.6832920656932839}} {"text": "module 747Decidable where\n\n-- Library\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl; sym) -- added sym\nopen Eq.≡-Reasoning\nopen import Data.Nat using (ℕ; zero; suc; _≤_; z≤n; s≤s)\nopen import Data.Product using (_×_) renaming (_,_ to ⟨_,_⟩)\nopen import Data.Sum using (_⊎_; inj₁; inj₂)\nopen import Relation.Nullary using (¬_)\nopen import Relation.Nullary.Negation using ()\n renaming (contradiction to ¬¬-intro)\nopen import Data.Unit using (⊤; tt)\nopen import Data.Empty using (⊥; ⊥-elim)\n\n\n-- Copied from 747Isomorphism.\n\nrecord _⇔_ (A B : Set) : Set where\n field\n to : A → B\n from : B → A\nopen _⇔_\n\n-- Copied from 747Relations.\n\ninfix 4 _<_\n\ndata _<_ : ℕ → ℕ → Set where\n\n z τ\n(◇ A) n = Σ[ k ∈ ℕ ] (delay A by k at n)\ninfixr 65 ◇_\n\n-- ◇ instances\nF-◇ : Endofunctor ℝeactive\nF-◇ = record\n { omap = ◇_\n ; fmap = fmap-◇\n ; fmap-id = fmap-◇-id\n ; fmap-∘ = fmap-◇-∘\n ; fmap-cong = fmap-◇-cong\n }\n where\n -- Lifting of ◇\n fmap-◇ : {A B : τ} -> A ⇴ B -> ◇ A ⇴ ◇ B\n fmap-◇ f n (k , v) = k , (Functor.fmap (F-delay k) f at n) v\n -- ◇ preserves identities\n fmap-◇-id : ∀ {A : τ} {n : ℕ} {a : (◇ A) n}\n -> (fmap-◇ (id {A}) at n) a ≡ a\n fmap-◇-id {A} {n} {zero , v} = refl\n fmap-◇-id {A} {zero} {suc k , v} = refl\n fmap-◇-id {A} {suc n} {suc k , v}\n rewrite delay-+ {A} 1 k n\n | Functor.fmap-id (F-delay (suc k)) {A} {suc n} {v}\n = refl\n -- ◇ preserves composition\n fmap-◇-∘ : ∀ {A B C : τ} {g : B ⇴ C} {f : A ⇴ B} {n : ℕ} {a : (◇ A) n}\n -> (fmap-◇ (g ∘ f) at n) a ≡ (fmap-◇ g ∘ fmap-◇ f at n) a\n fmap-◇-∘ {n = n} {zero , v} = refl\n fmap-◇-∘ {n = zero} {suc k , v} = refl\n fmap-◇-∘ {A} {B} {C} {g} {f} {suc n} {suc k , v}\n rewrite delay-+ {A} 1 k n\n | Functor.fmap-∘ (F-delay (suc k)) {A} {B} {C} {g} {f} {suc n} {v}\n = refl\n -- ▹ is congruent\n fmap-◇-cong : ∀{A B : τ} {f f′ : A ⇴ B}\n -> ({n : ℕ} {a : A at n} -> f n a ≡ f′ n a)\n -> ({n : ℕ} {a : ◇ A at n} -> (fmap-◇ f at n) a\n ≡ (fmap-◇ f′ at n) a)\n fmap-◇-cong {A} e {n} {zero , a}\n rewrite delay-+-left0 {A} 0 n\n | e {n} {a} = refl\n fmap-◇-cong e {zero} {suc k , a} = refl\n fmap-◇-cong {A} {B} {f} {f′} e {suc n} {suc k , a}\n rewrite delay-+ {A} 1 k n\n | Functor.fmap-cong (F-delay (suc k)) {A} {B} {f} {f′} e {suc n} {a}\n = refl\n", "meta": {"hexsha": "9f4244c8ea7cf3ad87cc6e41389a4f173a616d3d", "size": 2113, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/TemporalOps/Diamond/Functor.agda", "max_stars_repo_name": "DimaSamoz/temporal-type-systems", "max_stars_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-05-31T20:37:04.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-04T09:33:48.000Z", "max_issues_repo_path": "src/TemporalOps/Diamond/Functor.agda", "max_issues_repo_name": "DimaSamoz/temporal-type-systems", "max_issues_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/TemporalOps/Diamond/Functor.agda", "max_forks_repo_name": "DimaSamoz/temporal-type-systems", "max_forks_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.5396825397, "max_line_length": 82, "alphanum_fraction": 0.4533838145, "num_tokens": 921, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9304582477806522, "lm_q2_score": 0.7341195327172401, "lm_q1q2_score": 0.6830675740736344}} {"text": "-- Minimal implicational logic, PHOAS approach, initial encoding\n\nmodule Pi.ArrMp where\n\n\n-- Types\n\ninfixr 0 _=>_\ndata Ty : Set where\n UNIT : Ty\n _=>_ : Ty -> Ty -> Ty\n\n\n-- Context and truth judgement\n\nCx : Set1\nCx = Ty -> Set\n\nisTrue : Ty -> Cx -> Set\nisTrue a tc = tc a\n\n\n-- Terms\n\nmodule ArrMp where\n infixl 1 _$_\n data Tm (tc : Cx) : Ty -> Set where\n var : forall {a} -> isTrue a tc -> Tm tc a\n lam' : forall {a b} -> (isTrue a tc -> Tm tc b) -> Tm tc (a => b)\n _$_ : forall {a b} -> Tm tc (a => b) -> Tm tc a -> Tm tc b\n\n lam'' : forall {tc a b} -> (Tm tc a -> Tm tc b) -> Tm tc (a => b)\n lam'' f = lam' \\x -> f (var x)\n\n syntax lam'' (\\a -> b) = lam a => b\n\n Thm : Ty -> Set1\n Thm a = forall {tc} -> Tm tc a\nopen ArrMp public\n\n\n-- Example theorems\n\naI : forall {a} -> Thm (a => a)\naI =\n lam x => x\n\naK : forall {a b} -> Thm (a => b => a)\naK =\n lam x =>\n lam _ => x\n\naS : forall {a b c} -> Thm ((a => b => c) => (a => b) => a => c)\naS =\n lam f =>\n lam g =>\n lam x => f $ x $ (g $ x)\n\ntSKK : forall {a} -> Thm (a => a)\ntSKK {a = a} =\n aS {b = a => a} $ aK $ aK\n", "meta": {"hexsha": "11c2f0f2753004a2ba0d4fff40915341c0997c04", "size": 1129, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Pi/ArrMp.agda", "max_stars_repo_name": "mietek/formal-logic", "max_stars_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_stars_repo_licenses": ["X11"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2015-08-31T09:49:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-13T12:37:44.000Z", "max_issues_repo_path": "src/Pi/ArrMp.agda", "max_issues_repo_name": "mietek/formal-logic", "max_issues_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_issues_repo_licenses": ["X11"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Pi/ArrMp.agda", "max_forks_repo_name": "mietek/formal-logic", "max_forks_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_forks_repo_licenses": ["X11"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.2096774194, "max_line_length": 70, "alphanum_fraction": 0.4765279008, "num_tokens": 451, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9046505402422644, "lm_q2_score": 0.7549149758396752, "lm_q1q2_score": 0.6829342407303381}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Digits and digit expansions\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Digit where\n\nopen import Data.Nat using (ℕ; zero; suc; pred; _+_; _*_; _≤?_; _≤′_)\nopen import Data.Nat.Properties\nopen import Data.Nat.Solver\nopen import Data.Fin as Fin using (Fin; zero; suc; toℕ)\nopen import Data.Char using (Char)\nopen import Data.List.Base\nopen import Data.Product\nopen import Data.Vec as Vec using (Vec; _∷_; [])\nopen import Data.Nat.DivMod\nopen import Induction.Nat using (<′-rec; <′-Rec)\nopen import Relation.Nullary using (yes; no)\nopen import Relation.Nullary.Decidable\nopen import Relation.Binary using (Decidable)\nopen import Relation.Binary.PropositionalEquality as P using (_≡_; refl)\nopen import Function\n\nopen +-*-Solver\n\n------------------------------------------------------------------------\n-- Digits\n\n-- Digit b is the type of digits in base b.\n\nDigit : ℕ → Set\nDigit b = Fin b\n\n-- Some specific digit kinds.\n\nDecimal = Digit 10\nBit = Digit 2\n\n-- Some named digits.\n\n0b : Bit\n0b = zero\n\n1b : Bit\n1b = suc zero\n\n------------------------------------------------------------------------\n-- Showing digits\n\n-- The characters used to show the first 16 digits.\n\ndigitChars : Vec Char 16\ndigitChars =\n '0' ∷ '1' ∷ '2' ∷ '3' ∷ '4' ∷ '5' ∷ '6' ∷ '7' ∷ '8' ∷ '9' ∷\n 'a' ∷ 'b' ∷ 'c' ∷ 'd' ∷ 'e' ∷ 'f' ∷ []\n\n-- showDigit shows digits in base ≤ 16.\n\nshowDigit : ∀ {base} {base≤16 : True (base ≤? 16)} →\n Digit base → Char\nshowDigit {base≤16 = base≤16} d =\n Vec.lookup digitChars (Fin.inject≤ d (toWitness base≤16))\n\n------------------------------------------------------------------------\n-- Digit expansions\n\nExpansion : ℕ → Set\nExpansion base = List (Fin base)\n\n-- fromDigits takes a digit expansion of a natural number, starting\n-- with the _least_ significant digit, and returns the corresponding\n-- natural number.\n\nfromDigits : ∀ {base} → Expansion base → ℕ\nfromDigits [] = 0\nfromDigits {base} (d ∷ ds) = toℕ d + fromDigits ds * base\n\n-- toDigits b n yields the digits of n, in base b, starting with the\n-- _least_ significant digit.\n--\n-- Note that the list of digits is always non-empty.\n\ntoDigits : (base : ℕ) {base≥2 : True (2 ≤? base)} (n : ℕ) →\n ∃ λ (ds : Expansion base) → fromDigits ds ≡ n\ntoDigits zero {base≥2 = ()} _\ntoDigits (suc zero) {base≥2 = ()} _\ntoDigits (suc (suc k)) n = <′-rec Pred helper n\n where\n base = suc (suc k)\n Pred = λ n → ∃ λ ds → fromDigits ds ≡ n\n\n cons : ∀ {m} (r : Fin base) → Pred m → Pred (toℕ r + m * base)\n cons r (ds , eq) = (r ∷ ds , P.cong (λ i → toℕ r + i * base) eq)\n\n open ≤-Reasoning\n\n lem : ∀ x k r → 2 + x ≤′ r + (1 + x) * (2 + k)\n lem x k r = ≤⇒≤′ $ begin\n 2 + x\n ≤⟨ m≤m+n _ _ ⟩\n 2 + x + (x + (1 + x) * k + r)\n ≡⟨ solve 3 (λ x r k → con 2 :+ x :+ (x :+ (con 1 :+ x) :* k :+ r)\n :=\n r :+ (con 1 :+ x) :* (con 2 :+ k))\n refl x r k ⟩\n r + (1 + x) * (2 + k)\n ∎\n\n helper : ∀ n → <′-Rec Pred n → Pred n\n helper n rec with n divMod base\n helper .(toℕ r + 0 * base) rec | result zero r refl = ([ r ] , refl)\n helper .(toℕ r + suc x * base) rec | result (suc x) r refl =\n cons r (rec (suc x) (lem (pred (suc x)) k (toℕ r)))\n", "meta": {"hexsha": "bd935b910ec1b5a491370b105d4018d7d286f525", "size": 3439, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Digit.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Digit.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Digit.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.3931623932, "max_line_length": 77, "alphanum_fraction": 0.5161384123, "num_tokens": 1084, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976953030553434, "lm_q2_score": 0.7606506526772883, "lm_q1q2_score": 0.6828325181743831}} {"text": "------------------------------------------------------------------------\n-- Spheres\n------------------------------------------------------------------------\n\n{-# OPTIONS --erased-cubical --safe #-}\n\n-- This module follows the HoTT book rather closely.\n\nimport Equality.Path as P\n\nmodule Sphere\n {e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where\n\nopen P.Derived-definitions-and-properties eq hiding (elim)\n\nopen import Logical-equivalence using (_⇔_)\nopen import Prelude\n\nopen import Bijection equality-with-J using (_↔_)\nopen import Equality.Path.Isomorphisms eq\nopen import Equality.Tactic equality-with-J\nimport Equivalence equality-with-J as Equiv\nopen import Function-universe equality-with-J as F hiding (_∘_)\nopen import H-level equality-with-J\nopen import H-level.Closure equality-with-J\nopen import Nat equality-with-J as Nat\nopen import Pointed-type equality-with-J\nopen import Suspension eq as Suspension\n\nprivate\n variable\n a b : Level\n A B : Type a\n C : Pointed-type a\n x : A\n n : ℕ\n\n-- Spheres.\n\n𝕊[_-1] : ℕ → Type\n𝕊[ zero -1] = ⊥\n𝕊[ suc n -1] = Susp 𝕊[ n -1]\n\n-- Spheres with non-negative dimensions.\n\n𝕊 : ℕ → Type\n𝕊 n = 𝕊[ 1 + n -1]\n\n-- The booleans are isomorphic to the 0-dimensional sphere.\n\nBool↔𝕊⁰ : Bool ↔ 𝕊 0\nBool↔𝕊⁰ = Bool↔Susp-⊥\n\n-- Based maps from spheres with non-negative dimensions (using north\n-- as the point) are isomorphic to iterated loop spaces.\n\n𝕊→ᴮ↔ : ∀ n → (𝕊 n , north) →ᴮ C ↔ proj₁ (Ω[ n ] C)\n𝕊→ᴮ↔ {C = C} = lemma zero\n where\n lemma : ∀ m n → (𝕊 n , north) →ᴮ Ω[ m ] C ↔ proj₁ (Ω[ m + n ] C)\n lemma m zero =\n (𝕊 0 , north) →ᴮ Ω[ m ] C ↝⟨ Σ-cong (→-cong ext (inverse Bool↔𝕊⁰) F.id) (λ _ → F.id) ⟩\n (Bool , true) →ᴮ Ω[ m ] C ↝⟨ Bool→ᴮ↔ ext ⟩\n proj₁ (Ω[ m ] C) ↝⟨ ≡⇒↝ _ $ cong (λ n → proj₁ (Ω[ n ] C)) $ sym $ Nat.+-right-identity {n = m} ⟩□\n proj₁ (Ω[ m + 0 ] C) □\n\n lemma m (suc n) =\n (𝕊 (suc n) , north) →ᴮ Ω[ m ] C ↝⟨ Susp→ᴮ↔ ⟩\n (𝕊 n , north) →ᴮ Ω[ suc m ] C ↝⟨ lemma (suc m) n ⟩\n proj₁ (Ω[ suc m + n ] C) ↝⟨ ≡⇒↝ _ $ cong (λ n → proj₁ (Ω[ n ] C)) $ Nat.suc+≡+suc m ⟩□\n proj₁ (Ω[ m + suc n ] C) □\n\n-- A corollary.\n\n+↔∀contractible𝕊→ᴮ :\n H-level (1 + n) A ↔\n (∀ x → Contractible ((𝕊 n , north) →ᴮ (A , x)))\n+↔∀contractible𝕊→ᴮ {n = n} {A = A} =\n H-level (1 + n) A ↔⟨ _↔_.to (Equiv.⇔↔≃ ext (H-level-propositional ext _)\n (Π-closure ext 1 λ _ →\n H-level-propositional ext _))\n (+⇔∀contractible-Ω[] _) ⟩\n (∀ x → Contractible (proj₁ $ Ω[ n ] (A , x))) ↝⟨ (∀-cong ext λ _ → H-level-cong ext 0 (inverse $ 𝕊→ᴮ↔ _)) ⟩□\n (∀ x → Contractible ((𝕊 n , north) →ᴮ (A , x))) □\n", "meta": {"hexsha": "22d96b16ee01b0ecde767f97499e680e7b06fa92", "size": 2846, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Sphere.agda", "max_stars_repo_name": "nad/equality", "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_issues_repo_path": "src/Sphere.agda", "max_issues_repo_name": "nad/equality", "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Sphere.agda", "max_forks_repo_name": "nad/equality", "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.4823529412, "max_line_length": 113, "alphanum_fraction": 0.5042164441, "num_tokens": 1067, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.897695283896349, "lm_q2_score": 0.7606506635289836, "lm_q1q2_score": 0.6828325133425972}} {"text": "------------------------------------------------------------------------\n-- Reasoning about _⇔_\n--\n-- NOTE: we don’t use Relation.Binary.IsEquivalence here, since we’re reasoning\n-- about a heterogeneous equivalence relation (i.e., the types of the operands\n-- of _⇔_, which are themselves types, can be of different levels). In the proof\n-- of Chapter₁₅.problem₁, the fact that _⇔_ is heterogeneous is actually used,\n-- so we cannot use a homogeneous version of _⇔_.\n------------------------------------------------------------------------\n\nmodule Function.Equivalence.Reasoning where\n\nopen import Function using (_⇔_)\nopen import Function.Construct.Composition using (_∘-⇔_) public\nopen import Function.Construct.Identity using (id-⇔) public\nopen import Function.Construct.Symmetry using (sym-⇔) public\nopen import Level using (Level)\n\nprivate\n variable\n a b c : Level\n\ninfix 1 begin_\ninfixr 2 _⇔⟨⟩_ step-⇔ step-⇔˘\ninfix 3 _∎\n\nbegin_ : {A : Set a} {B : Set b} → A ⇔ B → A ⇔ B\nbegin A⇔B = A⇔B\n\n_∎ : (A : Set a) → A ⇔ A\n_∎ = id-⇔\n\n_⇔⟨⟩_ : (A : Set a) {B : Set b} → A ⇔ B → A ⇔ B\nA ⇔⟨⟩ A⇔B = A⇔B\n\nstep-⇔ : (A : Set a) {B : Set b} {C : Set c} → A ⇔ B → B ⇔ C → A ⇔ C\nstep-⇔ A = _∘-⇔_\n\nsyntax step-⇔ A A⇔B B⇔C = A ⇔⟨ A⇔B ⟩ B⇔C\n\nstep-⇔˘ : (A : Set a) {B : Set b} {C : Set c} → B ⇔ A → B ⇔ C → A ⇔ C\nstep-⇔˘ A B⇔A B⇔C = A ⇔⟨ sym-⇔ B⇔A ⟩ B⇔C\n\nsyntax step-⇔˘ A B⇔A B⇔C = A ⇔˘⟨ B⇔A ⟩ B⇔C\n", "meta": {"hexsha": "2b87ade51ba6406dfab2aa6c02926dc0685232ad", "size": 1386, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Function/Equivalence/Reasoning.agda", "max_stars_repo_name": "splintah/combinatory-logic", "max_stars_repo_head_hexsha": "df8bf877e60b3059532c54a247a36a3d83cd55b0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-02-28T23:44:42.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-28T23:44:42.000Z", "max_issues_repo_path": "Function/Equivalence/Reasoning.agda", "max_issues_repo_name": "splintah/combinatory-logic", "max_issues_repo_head_hexsha": "df8bf877e60b3059532c54a247a36a3d83cd55b0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Function/Equivalence/Reasoning.agda", "max_forks_repo_name": "splintah/combinatory-logic", "max_forks_repo_head_hexsha": "df8bf877e60b3059532c54a247a36a3d83cd55b0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.8, "max_line_length": 80, "alphanum_fraction": 0.5526695527, "num_tokens": 571, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8723473779969194, "lm_q2_score": 0.7826624688140726, "lm_q1q2_score": 0.682753552526552}} {"text": "module Formalization.ClassicalPropositionalLogic.Syntax where\n\nimport Lvl\nopen import Functional\nopen import Sets.PredicateSet using (PredSet)\nopen import Type\n\nprivate variable ℓₚ ℓ : Lvl.Level\n\nmodule _ (P : Type{ℓₚ}) where\n -- Formulas.\n -- Inductive definition of the grammatical elements of the language of propositional logic.\n -- Note: It is possible to reduce the number of formula variants to for example {•,¬,∨} or {•,¬,∧} (This is called propositional adequacy/functional completeness).\n data Formula : Type{ℓₚ} where\n •_ : P → Formula -- Propositional constants\n\n ⊤ : Formula -- Tautology (Top / True)\n ⊥ : Formula -- Contradiction (Bottom / False)\n\n ¬_ : Formula → Formula -- Negation (Not)\n\n _∧_ : Formula → Formula → Formula -- Conjunction (And)\n _∨_ : Formula → Formula → Formula -- Disjunction (Or)\n _⟶_ : Formula → Formula → Formula -- Implication\n _⟷_ : Formula → Formula → Formula -- Equivalence\n\n Formulas : Type{ℓₚ Lvl.⊔ Lvl.𝐒(ℓ)}\n Formulas{ℓ} = PredSet{ℓ}(Formula)\n\n infix 1011 •_\n infix 1010 ¬_ ¬¬_\n infixr 1005 _∧_\n infixr 1004 _∨_\n infixr 1000 _⟷_ _⟶_\n\nmodule _ {P : Type{ℓₚ}} where\n -- Double negation\n -- ¬¬_ : Formula(P) → Formula(P)\n -- ¬¬_ : (¬_) ∘ (¬_)\n\n -- Reverse implication\n _⟵_ : Formula(P) → Formula(P) → Formula(P)\n _⟵_ = swap(_⟶_)\n\n -- (Nor)\n _⊽_ : Formula(P) → Formula(P) → Formula(P)\n _⊽_ = (¬_) ∘₂ (_∨_)\n\n -- (Nand)\n _⊼_ : Formula(P) → Formula(P) → Formula(P)\n _⊼_ = (¬_) ∘₂ (_∧_)\n\n -- (Exclusive or / Xor)\n _⊻_ : Formula(P) → Formula(P) → Formula(P)\n _⊻_ = (¬_) ∘₂ (_⟷_)\n\n infixl 1000 _⟵_\n", "meta": {"hexsha": "cd77557cf5ec8446ee245ee6d428fa161204acf1", "size": 1589, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Formalization/ClassicalPropositionalLogic/Syntax.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Formalization/ClassicalPropositionalLogic/Syntax.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Formalization/ClassicalPropositionalLogic/Syntax.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.3965517241, "max_line_length": 165, "alphanum_fraction": 0.6286972939, "num_tokens": 574, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9149009642742805, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6826432893711133}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.CommAlgebra.FGIdeal where\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.FinData\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Vec\n\nopen import Cubical.Algebra.CommRing\nopen import Cubical.Algebra.CommRing.FGIdeal renaming (generatedIdeal to generatedIdealCommRing)\nopen import Cubical.Algebra.CommAlgebra\nopen import Cubical.Algebra.CommAlgebra.Ideal\n\nprivate\n variable\n ℓ : Level\n\nmodule _ {R : CommRing ℓ} (A : CommAlgebra R ℓ) where\n open CommAlgebraStr (snd A)\n\n generatedIdeal : {n : ℕ} → FinVec (fst A) n → IdealsIn A\n generatedIdeal = generatedIdealCommRing (CommAlgebra→CommRing A)\n", "meta": {"hexsha": "5c5c546b70a0ba8698da7a7d734456acb2042a90", "size": 671, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommAlgebra/FGIdeal.agda", "max_stars_repo_name": "marcinjangrzybowski/cubical", "max_stars_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 301, "max_stars_repo_stars_event_min_datetime": "2018-10-17T18:00:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T02:10:47.000Z", "max_issues_repo_path": "Cubical/Algebra/CommAlgebra/FGIdeal.agda", "max_issues_repo_name": "marcinjangrzybowski/cubical", "max_issues_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 584, "max_issues_repo_issues_event_min_datetime": "2018-10-15T09:49:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T12:09:17.000Z", "max_forks_repo_path": "Cubical/Algebra/CommAlgebra/FGIdeal.agda", "max_forks_repo_name": "marcinjangrzybowski/cubical", "max_forks_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 134, "max_forks_repo_forks_event_min_datetime": "2018-11-16T06:11:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T16:22:13.000Z", "avg_line_length": 29.1739130435, "max_line_length": 96, "alphanum_fraction": 0.7868852459, "num_tokens": 188, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9149009549929797, "lm_q2_score": 0.7461390043208003, "lm_q1q2_score": 0.6826432876106112}} {"text": "\n-- The simpler case of index inductive definitions. (no induction-recursion)\nmodule IID where\n\nopen import LF\n\n-- A code for an IID\n-- I - index set\n-- E = I for general IIDs\n-- E = One for restricted IIDs\ndata OP (I : Set)(E : Set) : Set1 where\n ι : E -> OP I E\n σ : (A : Set)(γ : A -> OP I E) -> OP I E\n δ : (A : Set)(i : A -> I)(γ : OP I E) -> OP I E\n\n-- The type of constructor arguments. Parameterised over\n-- U - the inductive type\n-- This is the F of the simple polynomial type μF\nArgs : {I : Set}{E : Set} -> OP I E ->\n (U : I -> Set) -> Set\nArgs (ι e) U = One\nArgs (σ A γ) U = A × \\a -> Args (γ a) U\nArgs (δ A i γ) U = ((a : A) -> U (i a)) × \\_ -> Args γ U\n\n-- Computing the index\nindex : {I : Set}{E : Set}(γ : OP I E)(U : I -> Set) -> Args γ U -> E\nindex (ι e) U _ = e\nindex (σ A γ) U a = index (γ (π₀ a)) U (π₁ a)\nindex (δ A i γ) U a = index γ U (π₁ a)\n\n-- The assumptions of a particular inductive occurrence in a value.\nIndArg : {I : Set}{E : Set}\n (γ : OP I E)(U : I -> Set) ->\n Args γ U -> Set\nIndArg (ι e) U _ = Zero\nIndArg (σ A γ) U a = IndArg (γ (π₀ a)) U (π₁ a)\nIndArg (δ A i γ) U a = A + IndArg γ U (π₁ a)\n\n-- Given the assumptions of an inductive occurence in a value we can compute\n-- its index.\nIndIndex : {I : Set}{E : Set}\n (γ : OP I E)(U : I -> Set) ->\n (a : Args γ U) -> IndArg γ U a -> I\nIndIndex (ι e) U _\t ()\nIndIndex (σ A γ) U arg c = IndIndex (γ (π₀ arg)) U (π₁ arg) c\nIndIndex (δ A i γ) U arg (inl a) = i a\nIndIndex (δ A i γ) U arg (inr a) = IndIndex γ U (π₁ arg) a\n\n-- Given the assumptions of an inductive occurrence in a value we can compute\n-- its value.\nInd : {I : Set}{E : Set}\n (γ : OP I E)(U : I -> Set) ->\n (a : Args γ U)(v : IndArg γ U a) -> U (IndIndex γ U a v)\nInd (ι e) U _\t ()\nInd (σ A γ) U arg c = Ind (γ (π₀ arg)) U (π₁ arg) c\nInd (δ A i γ) U arg (inl a) = (π₀ arg) a\nInd (δ A i γ) U arg (inr a) = Ind γ U (π₁ arg) a\n\n-- The type of induction hypotheses. Basically\n-- forall assumptions, the predicate holds for an inductive occurrence with\n-- those assumptions\nIndHyp : {I : Set}{E : Set}\n (γ : OP I E)(U : I -> Set) ->\n (F : (i : I) -> U i -> Set)(a : Args γ U) -> Set\nIndHyp γ U F a = (v : IndArg γ U a) -> F (IndIndex γ U a v) (Ind γ U a v)\n\nIndHyp₁ : {I : Set}{E : Set}\n (γ : OP I E)(U : I -> Set) ->\n (F : (i : I) -> U i -> Set1)(a : Args γ U) -> Set1\nIndHyp₁ γ U F a = (v : IndArg γ U a) -> F (IndIndex γ U a v) (Ind γ U a v)\n\n-- If we can prove a predicate F for any values, we can construct the inductive\n-- hypotheses for a given value.\n-- Termination note: g will only be applied to values smaller than a\ninduction :\n {I : Set}{E : Set}\n (γ : OP I E)(U : I -> Set)\n (F : (i : I) -> U i -> Set)\n (g : (i : I)(u : U i) -> F i u)\n (a : Args γ U) -> IndHyp γ U F a\ninduction γ U F g a = \\hyp -> g (IndIndex γ U a hyp) (Ind γ U a hyp)\n\ninduction₁ :\n {I : Set}{E : Set}\n (γ : OP I E)(U : I -> Set)\n (F : (i : I) -> U i -> Set1)\n (g : (i : I)(u : U i) -> F i u)\n (a : Args γ U) -> IndHyp₁ γ U F a\ninduction₁ γ U F g a = \\hyp -> g (IndIndex γ U a hyp) (Ind γ U a hyp)\n\n", "meta": {"hexsha": "0e11ca6abdd9f2076214feeb5e3c88ae1064f8a9", "size": 3155, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/iird/IID.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/iird/IID.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/iird/IID.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 34.6703296703, "max_line_length": 79, "alphanum_fraction": 0.5324881141, "num_tokens": 1212, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9149009619539554, "lm_q2_score": 0.7461389873857264, "lm_q1q2_score": 0.6826432773105513}} {"text": "\nmodule Oscar.Class.Symmetry where\n\nopen import Oscar.Class.Extensionality\nopen import Oscar.Function\nopen import Oscar.Level\n\nrecord Symmetry {a} {A : Set a} {ℓ} (_≤_ : A → A → Set ℓ) : Set (a ⊔ ℓ) where\n field\n ⦃ ′extensionality ⦄ : Extensionality _≤_ (λ ⋆ → flip _≤_ ⋆) id id\n\n symmetry : ∀ {x y} → x ≤ y → y ≤ x\n symmetry = extension (λ ⋆ → flip _≤_ ⋆)\n\nopen Symmetry ⦃ … ⦄ public hiding (′extensionality)\n\ninstance\n\n Symmetry⋆ : ∀\n {a} {A : Set a} {ℓ} {_≤_ : A → A → Set ℓ}\n ⦃ _ : Extensionality _≤_ (λ ⋆ → flip _≤_ ⋆) id id ⦄\n → Symmetry _≤_\n Symmetry.′extensionality Symmetry⋆ = it\n", "meta": {"hexsha": "19652ee6937dec5b44356358f243a4a52b180b84", "size": 606, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Class/Symmetry.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Class/Symmetry.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Class/Symmetry.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.25, "max_line_length": 77, "alphanum_fraction": 0.6072607261, "num_tokens": 252, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802462567087, "lm_q2_score": 0.7431680086124812, "lm_q1q2_score": 0.6825851355604995}} {"text": "module DivMod where\n\nopen import IO\nopen import Data.Nat\nopen import Data.Nat.DivMod\nopen import Codata.Musical.Notation\nopen import Data.String.Base\nopen import Data.Fin.Base using (toℕ)\nopen import Level using (0ℓ)\n\ng : ℕ\ng = 7 div 5\n\nk : ℕ\nk = toℕ (7 mod 5)\n\nshowNat : ℕ → String\nshowNat zero = \"Z\"\nshowNat (suc x) = \"S (\" ++ showNat x ++ \")\"\n\nmain = run {0ℓ} (putStrLn (showNat g) >> putStrLn (showNat k))\n", "meta": {"hexsha": "ce0a7319e25eb5213c2f1ce287008b5b443ba50f", "size": 410, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Compiler/with-stdlib/DivMod.agda", "max_stars_repo_name": "guilhermehas/agda", "max_stars_repo_head_hexsha": "cb645fcad38f76a9bf37507583867595b5ce87a1", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Compiler/with-stdlib/DivMod.agda", "max_issues_repo_name": "guilhermehas/agda", "max_issues_repo_head_hexsha": "cb645fcad38f76a9bf37507583867595b5ce87a1", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Compiler/with-stdlib/DivMod.agda", "max_forks_repo_name": "guilhermehas/agda", "max_forks_repo_head_hexsha": "cb645fcad38f76a9bf37507583867595b5ce87a1", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.6363636364, "max_line_length": 62, "alphanum_fraction": 0.6853658537, "num_tokens": 142, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802417938535, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.682585127019212}} {"text": "{-# OPTIONS --universe-polymorphism #-}\n\nopen import Categories.Category\n\nmodule Categories.Object.Initial {o ℓ e} (C : Category o ℓ e) where\n\nopen Category C\n\nopen import Level\n\nrecord Initial : Set (o ⊔ ℓ ⊔ e) where\n field\n ⊥ : Obj\n ! : ∀ {A} → (⊥ ⇒ A)\n .!-unique : ∀ {A} → (f : ⊥ ⇒ A) → ! ≡ f\n \n .!-unique₂ : ∀ {A} → (f g : ⊥ ⇒ A) → f ≡ g\n !-unique₂ f g =\n begin\n f\n ↑⟨ !-unique f ⟩\n !\n ↓⟨ !-unique g ⟩\n g\n ∎\n where\n open HomReasoning\n\n .⊥-id : (f : ⊥ ⇒ ⊥) → f ≡ id\n ⊥-id f = !-unique₂ f id\n", "meta": {"hexsha": "b918cb6f4527bbb018c4e522f8474497e6f1867a", "size": 555, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Object/Initial.agda", "max_stars_repo_name": "p-pavel/categories", "max_stars_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-12-29T21:51:57.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-29T21:51:57.000Z", "max_issues_repo_path": "Categories/Object/Initial.agda", "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Object/Initial.agda", "max_forks_repo_name": "p-pavel/categories", "max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.9032258065, "max_line_length": 67, "alphanum_fraction": 0.4666666667, "num_tokens": 226, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9111797027760039, "lm_q2_score": 0.7490872075132152, "lm_q1q2_score": 0.6825530590951983}} {"text": "{-\n\nThe naive, but incorrect, way to define the integers as a HIT.\n\nThis file mainly contains a proof that IsoInt ≢ Int, and ends with a\n demonstration of how the same proof strategy fails for BiInvInt.\n\n-}\n{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.HITs.Ints.IsoInt.Base where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Function\nopen import Cubical.Foundations.Isomorphism\n\nopen import Cubical.Data.Int\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Empty\n\nopen import Cubical.Relation.Nullary\n\n\ndata IsoInt : Type₀ where\n zero : IsoInt\n suc : IsoInt -> IsoInt\n\n -- suc is an isomorphism:\n pred : IsoInt -> IsoInt\n suc-pred : ∀ z -> suc (pred z) ≡ z\n pred-suc : ∀ z -> pred (suc z) ≡ z\n\n\nsuc-iso : Iso IsoInt IsoInt\nsuc-iso = record { fun = suc ; inv = pred ; rightInv = suc-pred ; leftInv = pred-suc }\n\n\n-- this submodule is adapted from Section 5 of\n-- http://www.cs.ru.nl/~herman/PUBS/HIT-programming.pdf\n\nmodule NonTrivial where\n\n -- these two paths are distinct!\n p₁ p₂ : Path IsoInt (suc (pred (suc zero))) (suc zero)\n p₁ i = suc-pred (suc zero) i\n p₂ i = suc (pred-suc zero i)\n\n -- to prove this we map into S¹, sending p₁ to refl and p₂ to loop\n\n open import Cubical.HITs.S1\n\n toS¹ : IsoInt → S¹\n toS¹ zero = base\n toS¹ (suc x) = toS¹ x\n toS¹ (pred x) = toS¹ x\n toS¹ (suc-pred x i) = refl {x = toS¹ x} i\n toS¹ (pred-suc x i) = rotLoop (toS¹ x) i\n\n p₁≡refl : cong toS¹ p₁ ≡ refl\n p₁≡refl = refl\n\n p₂≡loop : cong toS¹ p₂ ≡ loop\n p₂≡loop = refl\n\n -- this is enough to show that p₁ and p₂ cannot be equal\n p₁≢p₂ : ¬ (p₁ ≡ p₂)\n p₁≢p₂ eq = znots 0≡1\n where -- using winding numbers, p₁ ≡ p₂ implies 0 ≡ 1\n 0≡1 : 0 ≡ 1\n 0≡1 = injPos (cong (winding ∘ cong toS¹) eq)\n\n\n¬isSet-IsoInt : ¬ (isSet IsoInt)\n¬isSet-IsoInt pf = NonTrivial.p₁≢p₂ (pf _ _ NonTrivial.p₁ NonTrivial.p₂)\n\n¬Int≡IsoInt : ¬ (Int ≡ IsoInt)\n¬Int≡IsoInt p = ¬isSet-IsoInt (subst isSet p isSetInt)\n\n\n\nprivate\n\n -- Note: this same proof strategy fails for BiInvInt!\n\n open import Cubical.HITs.Ints.BiInvInt hiding (zero; suc; pred; suc-pred; pred-suc)\n import Cubical.HITs.Ints.BiInvInt as BiI\n\n p₁ p₂ : Path BiInvInt (BiI.suc (BiI.pred (BiI.suc BiI.zero))) (BiI.suc BiI.zero)\n p₁ i = BiI.suc-pred (BiI.suc BiI.zero) i\n p₂ i = BiI.suc (BiI.pred-suc BiI.zero i)\n\n open import Cubical.HITs.S1\n\n toS¹ : BiInvInt → S¹\n toS¹ BiI.zero = base\n toS¹ (BiI.suc x) = toS¹ x\n toS¹ (BiI.predr x) = toS¹ x\n toS¹ (BiI.predl x) = toS¹ x\n toS¹ (BiI.suc-predr x i) = refl {x = toS¹ x} i\n toS¹ (BiI.predl-suc x i) = rotLoop (toS¹ x) i\n\n -- still p₂ maps to loop...\n p₂≡loop : cong toS¹ p₂ ≡ loop\n p₂≡loop = refl\n\n open import Cubical.Foundations.GroupoidLaws\n\n -- ...but now so does p₁!\n p₁≡loop : cong toS¹ p₁ ≡ loop\n p₁≡loop = sym (decodeEncode base (cong toS¹ p₁)) ∙ sym (lUnit loop)\n\n -- if we use BiI.predr instead of BiI.pred (≡ BiI.predl) in p₁ and p₂,\n -- both paths in S¹ are refl\n", "meta": {"hexsha": "ec3304dd859eec06989c5fe724e7d6df0609ad96", "size": 3019, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/HITs/Ints/IsoInt/Base.agda", "max_stars_repo_name": "dan-iel-lee/cubical", "max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/HITs/Ints/IsoInt/Base.agda", "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/HITs/Ints/IsoInt/Base.agda", "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 26.7168141593, "max_line_length": 86, "alphanum_fraction": 0.6528651871, "num_tokens": 1157, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8633916134888613, "lm_q2_score": 0.7905303236047049, "lm_q1q2_score": 0.6825372516089377}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Cubical.Foundations.FunExtEquiv where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Foundations.Univalence\n\nprivate\n variable\n ℓ ℓ₁ ℓ₂ ℓ₃ : Level\n\n-- Function extensionality is an equivalence\nmodule _ {A : Type ℓ} {B : A → Type ℓ₁} {f g : (x : A) → B x} where\n private\n fib : (p : f ≡ g) → fiber funExt p\n fib p = (funExt⁻ p , refl)\n\n funExt-fiber-isContr : (p : f ≡ g) → (fi : fiber funExt p) → fib p ≡ fi\n funExt-fiber-isContr p (h , eq) i = (funExt⁻ (eq (~ i)) , λ j → eq (~ i ∨ j))\n\n funExt-isEquiv : isEquiv funExt\n equiv-proof funExt-isEquiv p = (fib p , funExt-fiber-isContr p)\n\n funExtEquiv : (∀ x → f x ≡ g x) ≃ (f ≡ g)\n funExtEquiv = (funExt {B = B} , funExt-isEquiv)\n\n funExtPath : (∀ x → f x ≡ g x) ≡ (f ≡ g)\n funExtPath = ua funExtEquiv\n\n\n-- Function extensionality for binary functions\nfunExt₂ : {A : Type ℓ} {B : A → Type ℓ₁} {C : (x : A) → B x → Type ℓ₂}\n {f g : (x : A) → (y : B x) → C x y}\n → ((x : A) (y : B x) → f x y ≡ g x y) → f ≡ g\nfunExt₂ p i x y = p x y i\n\n-- Function extensionality for binary functions is an equivalence\nmodule _ {A : Type ℓ} {B : A → Type ℓ₁} {C : (x : A) → B x → Type ℓ₂}\n {f g : (x : A) → (y : B x) → C x y} where\n private\n appl₂ : f ≡ g → ∀ x y → f x y ≡ g x y\n appl₂ eq x y i = eq i x y\n\n fib : (p : f ≡ g) → fiber funExt₂ p\n fib p = (appl₂ p , refl)\n\n funExt₂-fiber-isContr : (p : f ≡ g) → (fi : fiber funExt₂ p) → fib p ≡ fi\n funExt₂-fiber-isContr p (h , eq) i = (appl₂ (eq (~ i)) , λ j → eq (~ i ∨ j))\n\n funExt₂-isEquiv : isEquiv funExt₂\n equiv-proof funExt₂-isEquiv p = (fib p , funExt₂-fiber-isContr p)\n\n funExt₂Equiv : (∀ x y → f x y ≡ g x y) ≃ (f ≡ g)\n funExt₂Equiv = (funExt₂ , funExt₂-isEquiv)\n\n funExt₂Path : (∀ x y → f x y ≡ g x y) ≡ (f ≡ g)\n funExt₂Path = ua funExt₂Equiv\n\n\n-- Function extensionality for ternary functions\nfunExt₃ : {A : Type ℓ} {B : A → Type ℓ₁} {C : (x : A) → B x → Type ℓ₂}\n {D : (x : A) → (y : B x) → C x y → Type ℓ₃}\n {f g : (x : A) → (y : B x) → (z : C x y) → D x y z}\n → ((x : A) (y : B x) (z : C x y) → f x y z ≡ g x y z) → f ≡ g\nfunExt₃ p i x y z = p x y z i\n\n-- Function extensionality for ternary functions is an equivalence\nmodule _ {A : Type ℓ} {B : A → Type ℓ₁} {C : (x : A) → B x → Type ℓ₂}\n {D : (x : A) → (y : B x) → C x y → Type ℓ₃}\n {f g : (x : A) → (y : B x) → (z : C x y) → D x y z} where\n private\n appl₃ : f ≡ g → ∀ x y z → f x y z ≡ g x y z\n appl₃ eq x y z i = eq i x y z\n\n fib : (p : f ≡ g) → fiber funExt₃ p\n fib p = (appl₃ p , refl)\n\n funExt₃-fiber-isContr : (p : f ≡ g) → (fi : fiber funExt₃ p) → fib p ≡ fi\n funExt₃-fiber-isContr p (h , eq) i = (appl₃ (eq (~ i)) , λ j → eq (~ i ∨ j))\n\n funExt₃-isEquiv : isEquiv funExt₃\n equiv-proof funExt₃-isEquiv p = (fib p , funExt₃-fiber-isContr p)\n\n funExt₃Equiv : (∀ x y z → f x y z ≡ g x y z) ≃ (f ≡ g)\n funExt₃Equiv = (funExt₃ , funExt₃-isEquiv)\n\n funExt₃Path : (∀ x y z → f x y z ≡ g x y z) ≡ (f ≡ g)\n funExt₃Path = ua funExt₃Equiv\n\n\n-- Puzzle: Can one generalize this to n-ary functions?\n", "meta": {"hexsha": "4a61b856ef684ab111337fb8759f321e001e06aa", "size": 3174, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Foundations/FunExtEquiv.agda", "max_stars_repo_name": "borsiemir/cubical", "max_stars_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Foundations/FunExtEquiv.agda", "max_issues_repo_name": "borsiemir/cubical", "max_issues_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Foundations/FunExtEquiv.agda", "max_forks_repo_name": "borsiemir/cubical", "max_forks_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.5, "max_line_length": 81, "alphanum_fraction": 0.5437933207, "num_tokens": 1352, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8633916029436189, "lm_q2_score": 0.7905303162021596, "lm_q1q2_score": 0.6825372368813085}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Abelian.Definition\nopen import Groups.Homomorphisms.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.Definition\nopen import Lists.Lists\nopen import Rings.Homomorphisms.Definition\n\n\nmodule Rings.Polynomial.Ring {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) where\n\nopen Ring R\nopen Setoid S\nopen Equivalence eq\nopen import Groups.Polynomials.Group additiveGroup\nopen import Groups.Polynomials.Definition additiveGroup\nopen import Rings.Polynomial.Multiplication R\n\npolyRing : Ring naivePolySetoid _+P_ _*P_\nRing.additiveGroup polyRing = polyGroup\nRing.*WellDefined polyRing {a} {b} {c} {d} = *PwellDefined {a} {b} {c} {d}\nRing.1R polyRing = 1R :: []\nRing.groupIsAbelian polyRing {x} {y} = AbelianGroup.commutative (abelian (record { commutative = Ring.groupIsAbelian R })) {x} {y}\nRing.*Associative polyRing {a} {b} {c} = *Passoc {a} {b} {c}\nRing.*Commutative polyRing {a} {b} = p*Commutative {a} {b}\nRing.*DistributesOver+ polyRing {a} {b} {c} = *Pdistrib {a} {b} {c}\nRing.identIsIdent polyRing {a} = *Pident {a}\n\npolyInjectionIsHom : RingHom R polyRing polyInjection\nRingHom.preserves1 polyInjectionIsHom = reflexive ,, record {}\nRingHom.ringHom polyInjectionIsHom = reflexive ,, (reflexive ,, record {})\nGroupHom.groupHom (RingHom.groupHom polyInjectionIsHom) = reflexive ,, record {}\nGroupHom.wellDefined (RingHom.groupHom polyInjectionIsHom) = SetoidInjection.wellDefined polyInjectionIsInj\n", "meta": {"hexsha": "468bf5331bbe275e2fff218275debea9cd3f405a", "size": 1581, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Polynomial/Ring.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Polynomial/Ring.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Polynomial/Ring.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 42.7297297297, "max_line_length": 130, "alphanum_fraction": 0.7514231499, "num_tokens": 488, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297967961706, "lm_q2_score": 0.7577943767446201, "lm_q1q2_score": 0.6824164161031135}} {"text": "------------------------------------------------------------------------------\n-- Group theory base\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule GroupTheory.Base where\n\ninfix 8 _⁻¹\ninfixl 7 _·_\n\n------------------------------------------------------------------------------\n-- First-order logic with equality.\nopen import Common.FOL.FOL-Eq public renaming ( D to G )\n\n-- Group theory axioms\npostulate\n ε : G -- The identity element.\n _·_ : G → G → G -- The binary operation.\n _⁻¹ : G → G -- The inverse function.\n\n -- We choose a non-redundant set of axioms. See for example (Mac\n -- Lane and Garret 1999, exercises 5-7, p. 50-51, or Hodges 1993,\n -- p. 37).\n assoc : ∀ a b c → a · b · c ≡ a · (b · c)\n leftIdentity : ∀ a → ε · a ≡ a\n leftInverse : ∀ a → a ⁻¹ · a ≡ ε\n{-# ATP axioms assoc leftIdentity leftInverse #-}\n\n------------------------------------------------------------------------------\n-- References\n--\n-- Hodges, W. (1993). Model Theory. Vol. 42. Encyclopedia of\n-- Mathematics and its Applications. Cambridge University Press.\n--\n-- Mac Lane, S. and Birkhof, G. (1999). Algebra. 3rd ed. AMS Chelsea\n-- Publishing.\n", "meta": {"hexsha": "a4febf7d2c3ee1fc42971d5591d8c1863bac4aa6", "size": 1394, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/GroupTheory/Base.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/GroupTheory/Base.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/GroupTheory/Base.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 34.0, "max_line_length": 78, "alphanum_fraction": 0.456241033, "num_tokens": 335, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297887874625, "lm_q2_score": 0.7577943822145998, "lm_q1q2_score": 0.6824164149600392}} {"text": "module regular-star where\n\nopen import Level renaming ( suc to Suc ; zero to Zero )\nopen import Data.List \nopen import Data.Nat hiding ( _≟_ )\nopen import Data.Fin hiding ( _+_ )\nopen import Data.Empty \nopen import Data.Unit \nopen import Data.Product\n-- open import Data.Maybe\nopen import Relation.Nullary\nopen import Relation.Binary.PropositionalEquality hiding ( [_] )\nopen import logic\nopen import nat\nopen import automaton\nopen import regular-language \n\nopen import nfa\nopen import sbconst2\nopen import finiteSet\nopen import finiteSetUtil\nopen import Relation.Binary.PropositionalEquality hiding ( [_] )\nopen import regular-concat\n\nopen Automaton\nopen FiniteSet\n\nopen RegularLanguage\n\nStar-NFA : {Σ : Set} → (A : RegularLanguage Σ ) → NAutomaton (states A ) Σ \nStar-NFA {Σ} A = record { Nδ = δnfa ; Nend = nend } \n module Star-NFA where\n δnfa : states A → Σ → states A → Bool\n δnfa q i q₁ with aend (automaton A) q\n ... | true = equal? (afin A) ( astart A) q₁ \n ... | false = equal? (afin A) (δ (automaton A) q i) q₁\n nend : states A → Bool\n nend q = aend (automaton A) q\n\nStar-NFA-start : {Σ : Set} → (A : RegularLanguage Σ ) → states A → Bool\nStar-NFA-start A q = equal? (afin A) (astart A) q \\/ aend (automaton A) q\n\nSNFA-exist : {Σ : Set} → (A : RegularLanguage Σ ) → (states A → Bool) → Bool\nSNFA-exist A qs = exists (afin A) qs \n\nM-Star : {Σ : Set} → (A : RegularLanguage Σ ) → RegularLanguage Σ\nM-Star {Σ} A = record {\n states = states A → Bool\n ; astart = Star-NFA-start A \n ; afin = fin→ (afin A)\n ; automaton = subset-construction (SNFA-exist A ) (Star-NFA A ) \n } \n \nopen Split\n\nopen _∧_\n\nopen NAutomaton\nopen import Data.List.Properties\n\nclosed-in-star : {Σ : Set} → (A B : RegularLanguage Σ ) → ( x : List Σ ) → isRegular (Star (contain A) ) x ( M-Star A )\nclosed-in-star {Σ} A B x = ≡-Bool-func closed-in-star→ closed-in-star← where\n NFA = (Star-NFA A )\n\n closed-in-star→ : Star (contain A) x ≡ true → contain (M-Star A ) x ≡ true\n closed-in-star→ star = {!!}\n\n open Found\n\n closed-in-star← : contain (M-Star A ) x ≡ true → Star (contain A) x ≡ true\n closed-in-star← C with subset-construction-lemma← (SNFA-exist A ) NFA {!!} x C \n ... | CC = {!!}\n\n\n\n\n", "meta": {"hexsha": "df6c57d9c4a5497b18535f6543357d0c01433d32", "size": 2269, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/regular-star.agda", "max_stars_repo_name": "shinji-kono/automaton-in-agda", "max_stars_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/regular-star.agda", "max_issues_repo_name": "shinji-kono/automaton-in-agda", "max_issues_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/regular-star.agda", "max_forks_repo_name": "shinji-kono/automaton-in-agda", "max_forks_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.4675324675, "max_line_length": 121, "alphanum_fraction": 0.6412516527, "num_tokens": 726, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9005297807787537, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6824163990393255}} {"text": "-- Copyright: (c) 2016 Ertugrul Söylemez\n-- License: BSD3\n-- Maintainer: Ertugrul Söylemez \n\nmodule Data.Int where\n\nopen import Algebra.Group\nopen import Classes\nopen import Core\nopen import Data.Int.Core\nopen import Data.Int.Core public\n using (ℤ; ℤ-Negative; ℤ-Number; negsuc; pos)\n\n\nℤ,+ : Group\nℤ,+ =\n record {\n semigroup = record {\n A = ℤ;\n Eq = PropEq ℤ;\n semigroupOver = record {\n _⋄_ = _+_;\n ⋄-cong = cong2 _+_;\n assoc = Props.+-assoc\n }\n };\n isGroup = record {\n isMonoid = record {\n id = 0;\n left-id = Props.+-left-id;\n right-id = Props.+-right-id\n };\n iso = λ x → record {\n inv = neg x;\n left-inv = Props.+-left-inv x;\n right-inv = Props.+-right-inv x\n };\n inv-cong = cong neg\n }\n }\n\n\nℤ,* : Monoid\nℤ,* =\n record {\n semigroup = record {\n A = ℤ;\n Eq = PropEq ℤ;\n semigroupOver = record {\n _⋄_ = _*_;\n ⋄-cong = cong2 _*_;\n assoc = Props.*-assoc\n }\n };\n isMonoid = record {\n id = 1;\n left-id = Props.*-left-id;\n right-id = Props.*-right-id\n }\n }\n", "meta": {"hexsha": "446148e4acc244e9b8631a240647c68e9f69d182", "size": 1163, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Int.agda", "max_stars_repo_name": "esoeylemez/agda-simple", "max_stars_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-10-07T17:36:42.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-07T17:36:42.000Z", "max_issues_repo_path": "Data/Int.agda", "max_issues_repo_name": "esoeylemez/agda-simple", "max_issues_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Int.agda", "max_forks_repo_name": "esoeylemez/agda-simple", "max_forks_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.0655737705, "max_line_length": 48, "alphanum_fraction": 0.5141874463, "num_tokens": 379, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297807787537, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6824163990393255}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Coprimality\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Integer.Coprimality where\n\nopen import Data.Integer\nopen import Data.Integer.Divisibility\nopen import Data.Integer.Properties\nimport Data.Nat.Coprimality as ℕ\nimport Data.Nat.Divisibility as ℕ\nopen import Function using (_on_)\nopen import Level using (0ℓ)\nopen import Relation.Binary using (Rel; Decidable; Symmetric)\nopen import Relation.Binary.PropositionalEquality using (subst)\n\n------------------------------------------------------------------------\n-- Definition\n\nCoprime : Rel ℤ 0ℓ\nCoprime = ℕ.Coprime on ∣_∣\n\n------------------------------------------------------------------------\n-- Properties of coprimality\n\nsym : Symmetric Coprime\nsym = ℕ.sym\n\ncoprime? : Decidable Coprime\ncoprime? x y = ℕ.coprime? ∣ x ∣ ∣ y ∣\n\ncoprime-divisor : ∀ i j k → Coprime i j → i ∣ j * k → i ∣ k\ncoprime-divisor i j k c eq =\n ℕ.coprime-divisor c (subst (∣ i ∣ ℕ.∣_ ) (abs-*-commute j k) eq)\n", "meta": {"hexsha": "322dc44d586fc12991f465c25e88de8b701330e3", "size": 1124, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Integer/Coprimality.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Integer/Coprimality.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Integer/Coprimality.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.8205128205, "max_line_length": 72, "alphanum_fraction": 0.5338078292, "num_tokens": 275, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9005297861178929, "lm_q2_score": 0.7577943658046609, "lm_q1q2_score": 0.6824163981594156}} {"text": "{-# OPTIONS --without-K #-}\nmodule Fiber where\n\nopen import Equivalence\nopen import NTypes.Contractible\nopen import PathOperations\nopen import Types\n\nfib : ∀ {a b} {A : Set a} {B : Set b}\n (f : A → B) (y : B) →\n Set _\nfib {A = A} f y = Σ A λ x → f x ≡ y\n\nfib→dom : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) →\n Σ B (fib f) → A\nfib→dom f (b , a , p) = a\n\ndom→fib : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) →\n A → Σ B (fib f)\ndom→fib f a = f a , a , refl\n\nfib-dom-eq : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) →\n Σ B (fib f) ≃ A\nfib-dom-eq {A = A} {B = B} f\n = fib→dom f\n , (dom→fib f , λ _ → refl)\n , (dom→fib f , λ {(b , a , p) →\n ap (swap ∘ _,_ a) (π₂ (pp-space-contr (f a)) (b , p))})\n where\n swap : (Σ A λ x → Σ B λ y → f x ≡ y) → Σ B (fib f)\n swap (b , a , p) = a , b , p\n", "meta": {"hexsha": "312ea657da89b7f2ce1dcc552474d1d0661e1f03", "size": 800, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Fiber.agda", "max_stars_repo_name": "vituscze/HoTT-lectures", "max_stars_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Fiber.agda", "max_issues_repo_name": "vituscze/HoTT-lectures", "max_issues_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Fiber.agda", "max_forks_repo_name": "vituscze/HoTT-lectures", "max_forks_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.0, "max_line_length": 61, "alphanum_fraction": 0.47, "num_tokens": 372, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297834483235, "lm_q2_score": 0.7577943658046609, "lm_q1q2_score": 0.6824163961364309}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Lists.Definition\nopen import Lists.Fold.Fold\nopen import Lists.Concat\nopen import Lists.Length\nopen import Numbers.Naturals.Semiring\n\nmodule Lists.Monad where\n\nopen import Lists.Map.Map public\n\nflatten : {a : _} {A : Set a} → (l : List (List A)) → List A\nflatten [] = []\nflatten (l :: ls) = l ++ flatten ls\n\nflatten' : {a : _} {A : Set a} → (l : List (List A)) → List A\nflatten' = fold _++_ []\n\nflatten=flatten' : {a : _} {A : Set a} (l : List (List A)) → flatten l ≡ flatten' l\nflatten=flatten' [] = refl\nflatten=flatten' (l :: ls) = applyEquality (l ++_) (flatten=flatten' ls)\n\nlengthFlatten : {a : _} {A : Set a} (l : List (List A)) → length (flatten l) ≡ (fold _+N_ zero (map length l))\nlengthFlatten [] = refl\nlengthFlatten (l :: ls) rewrite lengthConcat l (flatten ls) | lengthFlatten ls = refl\n\nflattenConcat : {a : _} {A : Set a} (l1 l2 : List (List A)) → flatten (l1 ++ l2) ≡ (flatten l1) ++ (flatten l2)\nflattenConcat [] l2 = refl\nflattenConcat (l1 :: ls) l2 rewrite flattenConcat ls l2 | concatAssoc l1 (flatten ls) (flatten l2) = refl\n\npure : {a : _} {A : Set a} → A → List A\npure a = [ a ]\n\nbind : {a b : _} {A : Set a} {B : Set b} → (f : A → List B) → List A → List B\nbind f l = flatten (map f l)\n\nprivate\n leftIdentLemma : {a : _} {A : Set a} (xs : List A) → flatten (map pure xs) ≡ xs\n leftIdentLemma [] = refl\n leftIdentLemma (x :: xs) rewrite leftIdentLemma xs = refl\n\nleftIdent : {a b : _} {A : Set a} {B : Set b} → (f : A → List B) → {x : A} → bind pure (f x) ≡ f x\nleftIdent f {x} with f x\nleftIdent f {x} | [] = refl\nleftIdent f {x} | y :: ys rewrite leftIdentLemma ys = refl\n\nrightIdent : {a b : _} {A : Set a} {B : Set b} → (f : A → List B) → {x : A} → bind f (pure x) ≡ f x\nrightIdent f {x} with f x\nrightIdent f {x} | [] = refl\nrightIdent f {x} | y :: ys rewrite appendEmptyList ys = refl\n\nassociative : {a b c : _} {A : Set a} {B : Set b} {C : Set c} → (f : A → List B) (g : B → List C) → {x : List A} → bind g (bind f x) ≡ bind (λ a → bind g (f a)) x\nassociative f g {[]} = refl\nassociative f g {x :: xs} rewrite mapConcat (f x) (flatten (map f xs)) g | flattenConcat (map g (f x)) (map g (flatten (map f xs))) = applyEquality (flatten (map g (f x)) ++_) (associative f g {xs})\n", "meta": {"hexsha": "ddeb258d84f00dade5bceaa75aec56c6f23a0813", "size": 2301, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Lists/Monad.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Lists/Monad.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Lists/Monad.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 40.3684210526, "max_line_length": 198, "alphanum_fraction": 0.603215993, "num_tokens": 822, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392756357326, "lm_q2_score": 0.7718434978390747, "lm_q1q2_score": 0.6823399667338057}} {"text": "-- Minimal implicational logic, vector-based de Bruijn approach, initial encoding\n\nmodule Vi.ArrMp where\n\nopen import Lib using (Nat; suc; _+_; Fin; fin; Vec; _,_; proj; VMem; mem)\n\n\n-- Types\n\ninfixr 0 _=>_\ndata Ty : Set where\n UNIT : Ty\n _=>_ : Ty -> Ty -> Ty\n\n\n-- Context and truth judgement\n\nCx : Nat -> Set\nCx n = Vec Ty n\n\nisTrue : forall {tn} -> Ty -> Fin tn -> Cx tn -> Set\nisTrue a i tc = VMem a i tc\n\n\n-- Terms\n\nmodule ArrMp where\n infixr 0 lam=>_\n infixl 1 _$_\n data Tm {tn} (tc : Cx tn) : Ty -> Set where\n var : forall {a i} -> isTrue a i tc -> Tm tc a\n lam=>_ : forall {a b} -> Tm (tc , a) b -> Tm tc (a => b)\n _$_ : forall {a b} -> Tm tc (a => b) -> Tm tc a -> Tm tc b\n\n v : forall {tn} (k : Nat) {tc : Cx (suc (k + tn))} -> Tm tc (proj tc (fin k))\n v i = var (mem i)\n\n Thm : Ty -> Set\n Thm a = forall {tn} {tc : Cx tn} -> Tm tc a\nopen ArrMp public\n\n\n-- Example theorems\n\naI : forall {a} -> Thm (a => a)\naI =\n lam=> v 0\n\naK : forall {a b} -> Thm (a => b => a)\naK =\n lam=>\n lam=> v 1\n\naS : forall {a b c} -> Thm ((a => b => c) => (a => b) => a => c)\naS =\n lam=>\n lam=>\n lam=> v 2 $ v 0 $ (v 1 $ v 0)\n\ntSKK : forall {a} -> Thm (a => a)\ntSKK {a = a} =\n aS {b = a => a} $ aK $ aK\n", "meta": {"hexsha": "cd38259a8e109561abc33509c35736ba8452f82d", "size": 1264, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Vi/ArrMp.agda", "max_stars_repo_name": "mietek/formal-logic", "max_stars_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_stars_repo_licenses": ["X11"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2015-08-31T09:49:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-13T12:37:44.000Z", "max_issues_repo_path": "src/Vi/ArrMp.agda", "max_issues_repo_name": "mietek/formal-logic", "max_issues_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_issues_repo_licenses": ["X11"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Vi/ArrMp.agda", "max_forks_repo_name": "mietek/formal-logic", "max_forks_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_forks_repo_licenses": ["X11"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.0634920635, "max_line_length": 81, "alphanum_fraction": 0.496835443, "num_tokens": 507, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392725805822, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6823399550964386}} {"text": "------------------------------------------------------------------------------\n-- Axiomatic Peano arithmetic using Agsy\n------------------------------------------------------------------------------\n\n{-# OPTIONS --allow-unsolved-metas #-}\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOT.Agsy.AxiomaticPA where\n\nopen import Common.FOL.FOL public renaming ( D to ℕ )\n\ninfixl 10 _*_\ninfix 7 _≐_\ninfixl 9 _+_\n\n------------------------------------------------------------------------------\n\n-- Non-logical constants\npostulate\n zero : ℕ\n succ : ℕ → ℕ\n _+_ : ℕ → ℕ → ℕ\n _*_ : ℕ → ℕ → ℕ\n _≐_ : ℕ → ℕ → Set\n\n-- Proper axioms\n-- (From Elliott Mendelson. Introduction to mathematical\n-- logic. Chapman & Hall, 4th edition, 1997, p. 155)\n\n-- N.B. We make the recursion in the first argument for _+_ and _*_.\n\n-- S₁. m = n → m = o → n = o\n-- S₂. m = n → succ m = succ n\n-- S₃. 0 ≠ succ n\n-- S₄. succ m = succ n → m = n\n-- S₅. 0 + n = n\n-- S₆. succ m + n = succ (m + n)\n-- S₇. 0 * n = 0\n-- S₈. succ m * n = (m * n) + m\n-- S₉. P(0) → (∀n.P(n) → P(succ n)) → ∀n.P(n), for any wf P(n) of PA.\n\npostulate\n S₁ : {m n o : ℕ} → m ≐ n → m ≐ o → n ≐ o\n S₂ : ∀ {m n} → m ≐ n → succ m ≐ succ n\n S₃ : ∀ {n} → ¬ (zero ≐ succ n)\n S₄ : ∀ {m n} → succ m ≐ succ n → m ≐ n\n S₅ : ∀ n → zero + n ≐ n\n S₆ : ∀ m n → succ m + n ≐ succ (m + n)\n S₇ : ∀ n → zero * n ≐ zero\n S₈ : ∀ m n → succ m * n ≐ n + m * n\n S₉ : (A : ℕ → Set) → A zero → (∀ n → A n → A (succ n)) → ∀ n → A n\n\n-- Properties\n\nrefl : ∀ {n} → n ≐ n\nrefl {n} = S₁ (S₅ n) (S₅ n) -- Via Agsy {-m}\n\nsym : ∀ {m n} → m ≐ n → n ≐ m\nsym h = S₁ h refl -- Via Agsy {-m}\n\ntrans : ∀ {m n o} → m ≐ n → n ≐ o → m ≐ o\ntrans h₁ h₂ = S₁ (sym h₁) h₂ -- Via Agsy {-m}\n\n+-rightIdentity : ∀ n → n + zero ≐ n\n+-rightIdentity n = {!-t 20 -m!} -- Agsy fails\n", "meta": {"hexsha": "956fd17f16c6c5c558ae5887efed46d9af8e917b", "size": 1931, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/Agsy/AxiomaticPA.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/Agsy/AxiomaticPA.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/Agsy/AxiomaticPA.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 27.9855072464, "max_line_length": 78, "alphanum_fraction": 0.4303469705, "num_tokens": 738, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872046026642944, "lm_q2_score": 0.7690802370707281, "lm_q1q2_score": 0.6823315261472966}} {"text": "import Lvl\nopen import Structure.Setoid\nopen import Type\n\nmodule Structure.Operator.Vector.Subspaces.Kernel\n {ℓₛ ℓₛₑ}\n {S : Type{ℓₛ}}\n ⦃ equiv-S : Equiv{ℓₛₑ}(S) ⦄\n {_+ₛ_ _⋅ₛ_ : S → S → S}\n where\n\nopen import Logic.Predicate\nopen import Sets.ExtensionalPredicateSet as PredSet using (PredSet ; _∈_ ; [∋]-binaryRelator)\nopen import Structure.Container.SetLike as SetLike using (SetElement)\nopen import Structure.Function.Multi\nopen import Structure.Operator\nopen import Structure.Operator.Properties\nopen import Structure.Operator.Vector\nopen import Structure.Operator.Vector.LinearMap\nopen import Structure.Operator.Vector.Proofs\nopen import Structure.Operator.Vector.Subspace\nopen import Structure.Relator.Properties\nopen import Syntax.Implication\nopen import Syntax.Transitivity\n\nopen VectorSpace ⦃ … ⦄\nopen VectorSpaceVObject ⦃ … ⦄ using (_+ᵥ_; _⋅ₛᵥ_)\nopen VectorSpaceVObject using (Vector)\n\nprivate variable ℓ ℓᵥ ℓᵥₑ : Lvl.Level\nprivate variable V W : VectorSpaceVObject {ℓᵥ = ℓᵥ} {ℓᵥₑ = ℓᵥₑ} ⦃ equiv-S = equiv-S ⦄ (_+ₛ_)(_⋅ₛ_)\nprivate variable F : V →ˡⁱⁿᵉᵃʳᵐᵃᵖ W\n\nkernel : (V →ˡⁱⁿᵉᵃʳᵐᵃᵖ W) → PredSet(Vector(V))\nkernel {V = V}{W = W} ([∃]-intro f) = PredSet.unapply f(𝟎ᵥ)\n\nkernel-subspace : Subspace(kernel(F))\nSetLike.FunctionProperties._closed-under₂_.proof (Subspace.add-closure (kernel-subspace {_} {_} {V} {_} {_} {W} {F = F@([∃]-intro f)})) {x} {y} xkern ykern =\n • (\n xkern ⇒\n x ∈ kernel(F) ⇒-[]\n f(x) ≡ 𝟎ᵥ ⇒-end\n )\n • (\n ykern ⇒\n y ∈ kernel(F) ⇒-[]\n f(y) ≡ 𝟎ᵥ ⇒-end\n ) ⇒₂-[ congruence₂{A₁ = Vector(W)}{A₂ = Vector(W)}(_+ᵥ_) ]\n f(x) +ᵥ f(y) ≡ 𝟎ᵥ +ᵥ 𝟎ᵥ ⇒-[ _🝖 identityᵣ(_+ᵥ_)(𝟎ᵥ) ]\n f(x) +ᵥ f(y) ≡ 𝟎ᵥ ⇒-[ preserving₂(f)(_+ᵥ_)(_+ᵥ_) 🝖_ ]\n f(x +ᵥ y) ≡ 𝟎ᵥ ⇒-[]\n (x +ᵥ y) ∈ kernel(F) ⇒-end\n where\n instance _ = V\n instance _ = W\nSetLike.FunctionProperties._closed-under₁_.proof (Subspace.mul-closure (kernel-subspace {_}{_}{V}{_}{_}{W} {F = F@([∃]-intro f)}) {s}) {v} vkern =\n vkern ⇒\n v ∈ kernel(F) ⇒-[]\n f(v) ≡ 𝟎ᵥ ⇒-[ congruence₂ᵣ(_⋅ₛᵥ_)(s) ]\n s ⋅ₛᵥ f(v) ≡ s ⋅ₛᵥ 𝟎ᵥ ⇒-[ _🝖 [⋅ₛᵥ]-absorberᵣ ]\n s ⋅ₛᵥ f(v) ≡ 𝟎ᵥ ⇒-[ preserving₁(f)(s ⋅ₛᵥ_)(s ⋅ₛᵥ_) 🝖_ ]\n f(s ⋅ₛᵥ v) ≡ 𝟎ᵥ ⇒-[]\n (s ⋅ₛᵥ v) ∈ kernel(F) ⇒-end\n where\n instance _ = V\n instance _ = W\n", "meta": {"hexsha": "c6620bd8f3dfb5674c2bf6c64647c2b59b2b6d92", "size": 2304, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Operator/Vector/Subspaces/Kernel.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Operator/Vector/Subspaces/Kernel.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Operator/Vector/Subspaces/Kernel.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.3880597015, "max_line_length": 157, "alphanum_fraction": 0.6171875, "num_tokens": 1044, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9294404096760998, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.6823203484267227}} {"text": "------------------------------------------------------------------------------\n-- Conversion functions i, j and k.\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOT.FOTC.IJK where\n\nopen import FOTC.Base\nopen import FOTC.Data.Nat.Type\n\n------------------------------------------------------------------------------\n\ndata ℕ : Set where\n z : ℕ\n s : ℕ → ℕ\n\n-- Conversion functions from/to ℕ and N.\ni : ℕ → D\ni z = zero\ni (s n) = succ₁ (i n)\n\nj : (n : ℕ) → N (i n)\nj z = nzero\nj (s n) = nsucc (j n)\n\nk : {n : D} → N n → ℕ\nk nzero = z\nk (nsucc Nn) = s (k Nn)\n\n_+_ : ℕ → ℕ → ℕ\nz + n = n\ns m + n = s (m + n)\n", "meta": {"hexsha": "a236e49035f2c0b2adbc159511b989ee167c106d", "size": 831, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/FOTC/IJK.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/FOTC/IJK.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/FOTC/IJK.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 22.4594594595, "max_line_length": 78, "alphanum_fraction": 0.3586040915, "num_tokens": 218, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.907312221360624, "lm_q2_score": 0.7520125682019722, "lm_q1q2_score": 0.6823101937464391}} {"text": "{-# OPTIONS --without-K #-}\n\n\nopen import M-types.Base.Core\nopen import M-types.Base.Sum\nopen import M-types.Base.Prod\nopen import M-types.Base.Eq\n\n\nmodule M-types.Base.Equi where\n Qinv : {X : Ty ℓ₀} {Y : Ty ℓ₁} →\n ∏[ f ∈ (X → Y)] Ty (ℓ-max ℓ₀ ℓ₁)\n Qinv {_} {_} {X} {Y} f = ∑[ g ∈ (Y → X) ]\n (∏[ x ∈ X ] g (f x) ≡ x) ×\n (∏[ y ∈ Y ] f (g y) ≡ y)\n\n IsEqui : {X : Ty ℓ₀} {Y : Ty ℓ₁} →\n ∏[ f ∈ (X → Y) ] Ty (ℓ-max ℓ₀ ℓ₁)\n IsEqui {_} {_} {X} {Y} f =\n (∑[ g ∈ (Y → X) ] ∏[ x ∈ X ] g (f x) ≡ x) ×\n (∑[ g ∈ (Y → X) ] ∏[ y ∈ Y ] f (g y) ≡ y)\n\n infixr 8 _≃_\n _≃_ : ∏[ X ∈ Ty ℓ₀ ] ∏[ Y ∈ Ty ℓ₁ ] Ty (ℓ-max ℓ₀ ℓ₁)\n X ≃ Y = ∑[ f ∈ (X → Y) ] IsEqui f\n\n\n Qinv→IsEqui : {X : Ty ℓ₀} {Y : Ty ℓ₁} {f : X → Y} →\n Qinv f → IsEqui f\n Qinv→IsEqui (g , hom₀ , hom₁) = ((g , hom₀) , (g , hom₁))\n\n IsEqui→Qinv : {X : Ty ℓ₀} {Y : Ty ℓ₁} {f : X → Y} →\n IsEqui f → Qinv f\n IsEqui→Qinv {_} {_} {_} {_} {f} ((g₀ , hom₀) , (g₁ , hom₁)) =\n (\n g₀ ,\n hom₀ ,\n λ y → ap f (ap g₀ (hom₁ y)⁻¹ · hom₀ (g₁ y)) · hom₁ y\n )\n\n\n inv : {X : Ty ℓ₀} {Y : Ty ℓ₁} →\n ∏[ equi ∈ X ≃ Y ] (Y → X)\n inv (fun , isEqui) = pr₀ (IsEqui→Qinv isEqui)\n\n hom₀ : {X : Ty ℓ₀} {Y : Ty ℓ₁} →\n ∏[ equi ∈ X ≃ Y ] ∏[ x ∈ X ] inv equi (fun equi x) ≡ x\n hom₀ (fun , isEqui) = pr₀ (pr₁ (IsEqui→Qinv isEqui))\n\n hom₁ : {X : Ty ℓ₀} {Y : Ty ℓ₁} →\n ∏[ equi ∈ X ≃ Y ] ∏[ y ∈ Y ] fun equi (inv equi y) ≡ y\n hom₁ (fun , isEqui) = pr₁ (pr₁ (IsEqui→Qinv isEqui))\n", "meta": {"hexsha": "2e43e1a375be7de453cce857b8f8936ce2732597", "size": 1554, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Base/Equi.agda", "max_stars_repo_name": "DDOtten/M-types", "max_stars_repo_head_hexsha": "5b70f4b3dc3e50365ad7a3a80b0cd14efbfa4369", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Base/Equi.agda", "max_issues_repo_name": "DDOtten/M-types", "max_issues_repo_head_hexsha": "5b70f4b3dc3e50365ad7a3a80b0cd14efbfa4369", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Base/Equi.agda", "max_forks_repo_name": "DDOtten/M-types", "max_forks_repo_head_hexsha": "5b70f4b3dc3e50365ad7a3a80b0cd14efbfa4369", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.320754717, "max_line_length": 65, "alphanum_fraction": 0.4131274131, "num_tokens": 758, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.907312213841788, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6823101931348625}} {"text": "------------------------------------------------------------------------------\n-- Proving properties without using pattern matching on refl\n------------------------------------------------------------------------------\n\n{-# OPTIONS --no-pattern-matching #-}\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n\nmodule FOT.DistributiveLaws.NoPatternMatchingOnRefl where\n\nopen import DistributiveLaws.Base\n\n------------------------------------------------------------------------------\n-- From DistributiveLaws.PropertiesI\n\n-- Congruence properties\n\n·-leftCong : ∀ {a b c} → a ≡ b → a · c ≡ b · c\n·-leftCong {a} {c = c} h = subst (λ t → a · c ≡ t · c) h refl\n\n·-rightCong : ∀ {a b c} → b ≡ c → a · b ≡ a · c\n·-rightCong {a} {b} h = subst (λ t → a · b ≡ a · t) h refl\n", "meta": {"hexsha": "3f2d4932dcebd8f4053627bb8f173b6b708cb560", "size": 842, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/DistributiveLaws/NoPatternMatchingOnRefl.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/DistributiveLaws/NoPatternMatchingOnRefl.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/DistributiveLaws/NoPatternMatchingOnRefl.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 35.0833333333, "max_line_length": 78, "alphanum_fraction": 0.432304038, "num_tokens": 201, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8688267864276107, "lm_q2_score": 0.7853085758631159, "lm_q1q2_score": 0.6822971263211944}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Bisimilarity for Colists\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe --sized-types #-}\n\nmodule Codata.Colist.Bisimilarity where\n\nopen import Level using (Level; _⊔_)\nopen import Size\nopen import Codata.Thunk\nopen import Codata.Colist\nopen import Data.List.Base using (List; []; _∷_)\nopen import Data.List.Relation.Binary.Pointwise using (Pointwise; []; _∷_)\nopen import Data.List.NonEmpty as List⁺ using (List⁺; _∷_)\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as Eq using (_≡_)\n\nprivate\n variable\n a b c p q r : Level\n A : Set a\n B : Set b\n C : Set c\n i : Size\n\ndata Bisim {A : Set a} {B : Set b} (R : REL A B r) (i : Size) :\n REL (Colist A ∞) (Colist B ∞) (r ⊔ a ⊔ b) where\n [] : Bisim R i [] []\n _∷_ : ∀ {x y xs ys} → R x y → Thunk^R (Bisim R) i xs ys →\n Bisim R i (x ∷ xs) (y ∷ ys)\n\nmodule _ {R : Rel A r} where\n\n reflexive : Reflexive R → Reflexive (Bisim R i)\n reflexive refl^R {[]} = []\n reflexive refl^R {r ∷ rs} = refl^R ∷ λ where .force → reflexive refl^R\n\nmodule _ {P : REL A B p} {Q : REL B A q} where\n\n symmetric : Sym P Q → Sym (Bisim P i) (Bisim Q i)\n symmetric sym^PQ [] = []\n symmetric sym^PQ (p ∷ ps) = sym^PQ p ∷ λ where .force → symmetric sym^PQ (ps .force)\n\nmodule _ {P : REL A B p} {Q : REL B C q} {R : REL A C r} where\n\n transitive : Trans P Q R → Trans (Bisim P i) (Bisim Q i) (Bisim R i)\n transitive trans^PQR [] [] = []\n transitive trans^PQR (p ∷ ps) (q ∷ qs) =\n trans^PQR p q ∷ λ where .force → transitive trans^PQR (ps .force) (qs .force)\n\n------------------------------------------------------------------------\n-- Congruence rules\n\nmodule _ {R : REL A B r} where\n\n ++⁺ : ∀ {as bs xs ys} → Pointwise R as bs →\n Bisim R i xs ys → Bisim R i (fromList as ++ xs) (fromList bs ++ ys)\n ++⁺ [] rs = rs\n ++⁺ (r ∷ pw) rs = r ∷ λ where .force → ++⁺ pw rs\n\n ⁺++⁺ : ∀ {as bs xs ys} → Pointwise R (List⁺.toList as) (List⁺.toList bs) →\n Thunk^R (Bisim R) i xs ys → Bisim R i (as ⁺++ xs) (bs ⁺++ ys)\n ⁺++⁺ (r ∷ pw) rs = r ∷ λ where .force → ++⁺ pw (rs .force)\n\n------------------------------------------------------------------------\n-- Pointwise Equality as a Bisimilarity\n\nmodule _ {A : Set a} where\n\n infix 1 _⊢_≈_\n _⊢_≈_ : ∀ i → Colist A ∞ → Colist A ∞ → Set a\n _⊢_≈_ = Bisim _≡_\n\n refl : Reflexive (i ⊢_≈_)\n refl = reflexive Eq.refl\n\n fromEq : ∀ {as bs} → as ≡ bs → i ⊢ as ≈ bs\n fromEq Eq.refl = refl\n\n sym : Symmetric (i ⊢_≈_)\n sym = symmetric Eq.sym\n\n trans : Transitive (i ⊢_≈_)\n trans = transitive Eq.trans\n\nisEquivalence : {R : Rel A r} → IsEquivalence R → IsEquivalence (Bisim R i)\nisEquivalence equiv^R = record\n { refl = reflexive equiv^R.refl\n ; sym = symmetric equiv^R.sym\n ; trans = transitive equiv^R.trans\n } where module equiv^R = IsEquivalence equiv^R\n\nsetoid : Setoid a r → Size → Setoid a (a ⊔ r)\nsetoid S i = record\n { isEquivalence = isEquivalence {i = i} (Setoid.isEquivalence S)\n }\n\nmodule ≈-Reasoning {a} {A : Set a} {i} where\n\n open import Relation.Binary.Reasoning.Setoid (setoid (Eq.setoid A) i) public\n", "meta": {"hexsha": "543062a96a9ccb50f043f0fd1e1cb732a0c79b93", "size": 3258, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Codata/Colist/Bisimilarity.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Codata/Colist/Bisimilarity.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Codata/Colist/Bisimilarity.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 31.3269230769, "max_line_length": 85, "alphanum_fraction": 0.5472682627, "num_tokens": 1124, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267694452331, "lm_q2_score": 0.7853085909370422, "lm_q1q2_score": 0.6822971260814185}} {"text": "module map-is-foldr where\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; cong)\nopen Eq.≡-Reasoning\nopen import lists using (List; []; _∷_; map; foldr)\n\npostulate\n -- 外延性の公理\n extensionality : ∀ {A B : Set} {f g : A → B}\n → (∀ (x : A) → f x ≡ g x)\n -----------------------\n → f ≡ g\n\n-- 外延性の公理を利用した証明のための補題\nlemma : ∀ {A B : Set} → (f : A → B) → (xs : List A)\n → map f xs ≡ foldr (λ x xs → f x ∷ xs) [] xs\nlemma f [] =\n begin\n map f []\n ≡⟨⟩\n []\n ≡⟨⟩\n foldr (λ x xs → f x ∷ xs) [] []\n ∎\nlemma f (x ∷ xs) =\n begin\n map f (x ∷ xs)\n ≡⟨⟩\n f x ∷ map f xs\n ≡⟨ cong (f x ∷_) (lemma f xs) ⟩\n f x ∷ foldr (λ x xs → f x ∷ xs) [] xs\n ≡⟨⟩\n foldr (λ x xs → f x ∷ xs) [] (x ∷ xs)\n ∎\n\n-- mapが畳み込みで表現できることの証明\nmap-is-foldr : ∀ {A B : Set} → (f : A → B)\n → map f ≡ foldr (λ x xs → f x ∷ xs) []\nmap-is-foldr f = extensionality (lemma f)\n", "meta": {"hexsha": "1d396f4e6e39820424ea6917f7d8c62aac654572", "size": 883, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "part1/lists/map-is-foldr.agda", "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_issues_repo_path": "part1/lists/map-is-foldr.agda", "max_issues_repo_name": "akiomik/plfa-solutions", "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "part1/lists/map-is-foldr.agda", "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.5365853659, "max_line_length": 51, "alphanum_fraction": 0.4847112118, "num_tokens": 416, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267660487572, "lm_q2_score": 0.785308580887758, "lm_q1q2_score": 0.6822971146830497}} {"text": "open import Relation.Binary.Core using (Rel)\n\nmodule GGT.Definitions\n {a b ℓ₁ ℓ₂}\n {G : Set a} -- The underlying group carrier\n {Ω : Set b} -- The underlying space\n (_≈_ : Rel G ℓ₁) -- The underlying group equality\n (_≋_ : Rel Ω ℓ₂) -- The underlying space equality\n where\n\nopen import Level\nopen import Algebra.Core\nopen import Relation.Unary\nopen import Algebra.Bundles using (Group)\nopen import Algebra.Definitions _≋_ using (Congruent₁)\n\nActAssoc : Opᵣ G Ω → Op₂ G → Set _\nActAssoc _·_ _∙_ = ∀ (o : Ω) (g : G) (h : G) → (o · (g ∙ h)) ≋ ((o · g) · h)\n\nActLeftIdentity : G → Opᵣ G Ω → Set _\nActLeftIdentity ε _·_ = ∀ (o : Ω) → (o · ε) ≋ o\n\n·-≋-Congruence : Opᵣ G Ω → Set _\n·-≋-Congruence _·_ = ∀ (g : G) → Congruent₁ (_· g)\n-- ∀ (o1 o2 : Ω) (g : G) → o1 ≋ o2 → (o1 · g) ≋ (o2 · g)\n\n≈-Ext : Opᵣ G Ω → Set _\n≈-Ext _·_ = ∀ {g h : G} → ∀ {o : Ω} → g ≈ h → (o · g) ≋ (o · h)\n", "meta": {"hexsha": "7243b15d1e3c55e77a0f3a8c3d3e6d7d4c61e5ca", "size": 888, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/ggt/Definitions.agda", "max_stars_repo_name": "zampino/ggt", "max_stars_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-04-17T11:10:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-28T05:48:39.000Z", "max_issues_repo_path": "src/ggt/Definitions.agda", "max_issues_repo_name": "zampino/ggt", "max_issues_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/ggt/Definitions.agda", "max_forks_repo_name": "zampino/ggt", "max_forks_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.6206896552, "max_line_length": 76, "alphanum_fraction": 0.5731981982, "num_tokens": 381, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9372107914029486, "lm_q2_score": 0.727975460709318, "lm_q1q2_score": 0.682266457653306}} {"text": "-- This file is ported from a part of Martin Escardó's HoTT lecture notes\n-- (https://www.cs.bham.ac.uk/~mhe/HoTT-UF-in-Agda-Lecture-Notes/HoTT-UF-Agda.html).\n\n{-# OPTIONS --without-K --safe #-}\nmodule Util.HoTT.Section where\n\nopen import Util.HoTT.HLevel.Core\nopen import Util.Prelude\nopen import Util.Relation.Binary.PropositionalEquality using\n ( Σ-≡⁺ ; subst-subst-sym )\n\n\nprivate\n variable\n α β γ : Level\n A B C : Set α\n\n\ninfix 4 _◁_\n\n\nrecord HasSection {A : Set α} {B : Set β} (f : A → B) : Set (α ⊔ℓ β) where\n field\n section : B → A\n isSection : ∀ x → f (section x) ≡ x\n\nopen HasSection public\n\n\nrecord _◁_ (A : Set α) (B : Set β) : Set (α ⊔ℓ β) where\n field\n retraction : B → A\n hasSection : HasSection retraction\n\n open HasSection hasSection public renaming (isSection to retraction∘section)\n\nopen _◁_ public\n\n\n◁-refl : A ◁ A\n◁-refl = record\n { retraction = id\n ; hasSection = record\n { section = id\n ; isSection = λ _ → refl\n }\n }\n\n\n◁-trans : A ◁ B → B ◁ C → A ◁ C\n◁-trans A◁B B◁C = record\n { retraction = A◁B .retraction ∘ B◁C .retraction\n ; hasSection = record\n { section = B◁C .section ∘ A◁B .section\n ; isSection = λ x\n → trans (cong (A◁B .retraction) (B◁C .retraction∘section _))\n (A◁B .retraction∘section _)\n }\n }\n\n\nΣ-◁ : {A : Set α} {B : A → Set β} {C : A → Set γ}\n → (∀ a → B a ◁ C a)\n → Σ A B ◁ Σ A C\nΣ-◁ B◁C = record\n { retraction = λ { (a , c) → a , B◁C a .retraction c }\n ; hasSection = record\n { section = λ { (a , b) → a , B◁C a .section b }\n ; isSection = λ { (a , b) → cong (a ,_) (B◁C a .retraction∘section b) }\n }\n }\n\n\n◁-pres-IsContr : A ◁ B → IsContr B → IsContr A\n◁-pres-IsContr A◁B (b , canon)\n = A◁B .retraction b\n , λ a\n → trans (cong (A◁B .retraction) (canon (A◁B .section a)))\n (A◁B .retraction∘section a)\n\n\nΣ-◁-reindexing : {A : Set α} {B : Set β} {P : A → Set γ}\n → (r : A ◁ B)\n → Σ A P ◁ Σ B (P ∘ r .retraction)\nΣ-◁-reindexing {P = P} r = record\n { retraction = λ { (b , x) → r .retraction b , x }\n ; hasSection = record\n { section = λ where\n (a , x) → r .section a , subst P (sym (r .retraction∘section a)) x\n ; isSection = λ where\n (a , x) → Σ-≡⁺\n ( r .retraction∘section a\n , subst-subst-sym (r .retraction∘section a)\n )\n }\n }\n", "meta": {"hexsha": "f97dbaf2a07d4d48c5664659fbd36266001d7749", "size": 2318, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Util/HoTT/Section.agda", "max_stars_repo_name": "JLimperg/msc-thesis-code", "max_stars_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2021-04-13T21:31:17.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-26T06:37:31.000Z", "max_issues_repo_path": "src/Util/HoTT/Section.agda", "max_issues_repo_name": "JLimperg/msc-thesis-code", "max_issues_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Util/HoTT/Section.agda", "max_forks_repo_name": "JLimperg/msc-thesis-code", "max_forks_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.8969072165, "max_line_length": 84, "alphanum_fraction": 0.5599654875, "num_tokens": 924, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8807970842359876, "lm_q2_score": 0.7745833945721304, "lm_q1q2_score": 0.6822507954367459}} {"text": "{-\n\n Agda Implementors' Meeting VI\n\n Göteborg\n May 24 - 3zero, 2zerozero7\n\n\n Hello Agda!\n\n Ulf Norell\n\n-}\n\n-- Records are labeled sigma types.\n\nmodule R where\n\n{-\n\n A very simple record.\n\n-}\n\ndata Nat : Set where\n zero : Nat\n succ : Nat\n\nrecord Point : Set where\n field x : Nat\n y : Nat\n\n-- A record can be seen as a one constructor datatype. In this case:\ndata Point' : Set where\n mkPoint : (x : Nat)(y : Nat) -> Point'\n\n-- There are a few differences, though:\n\n-- To construct a record you use the syntax record { ..; x = e; .. }\norigin : Point\norigin = record { x = zero; y = zero }\n\n-- instead of\norigin' : Point'\norigin' = mkPoint zero zero\n\n-- What's more interesting is that you get projection functions\n-- for free when you declare a record. More precisely, you get a module\n-- parameterised over a record, containing functions corresponding to the\n-- fields. In the Point example you get:\n{-\n module Point (p : Point) where\n x : Nat\n y : Nat\n-}\n\n-- So Point.x : Point -> Nat is the projection function for the field x.\ngetX : Point -> Nat\ngetX = Point.x\n-- getX = x\n", "meta": {"hexsha": "f8c46544d94fdcabbdd0b66e74896c3666dad60d", "size": 1160, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "tests/beyond/R.agda", "max_stars_repo_name": "andrejtokarcik/agda-semantics", "max_stars_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-08-10T15:33:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-06T17:24:25.000Z", "max_issues_repo_path": "tests/beyond/R.agda", "max_issues_repo_name": "andrejtokarcik/agda-semantics", "max_issues_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/beyond/R.agda", "max_forks_repo_name": "andrejtokarcik/agda-semantics", "max_forks_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.0163934426, "max_line_length": 73, "alphanum_fraction": 0.6232758621, "num_tokens": 307, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942348544447, "lm_q2_score": 0.7662936324115011, "lm_q1q2_score": 0.6822268031416304}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category.Core\n\n-- slice category (https://ncatlab.org/nlab/show/over+category)\n-- TODO: Forgetful Functor from Slice to 𝒞\nmodule Categories.Category.Slice {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen Category 𝒞\nopen HomReasoning\n\nopen import Level\nopen import Function using (_$_)\nopen import Relation.Binary using (Rel)\n\nopen import Categories.Morphism.Reasoning 𝒞\n\nrecord SliceObj (X : Obj) : Set (o ⊔ ℓ) where\n constructor sliceobj\n field\n {Y} : Obj\n arr : Y ⇒ X\n\nprivate\n variable\n A : Obj\n X Y Z : SliceObj A\n\nrecord Slice⇒ {A : Obj} (X Y : SliceObj A) : Set (ℓ ⊔ e) where\n constructor slicearr\n module X = SliceObj X\n module Y = SliceObj Y\n field\n {h} : X.Y ⇒ Y.Y\n △ : Y.arr ∘ h ≈ X.arr\n\nSlice : Obj → Category _ _ _\nSlice A = record\n { Obj = SliceObj A\n ; _⇒_ = Slice⇒\n ; _≈_ = λ where\n (slicearr {f} _) (slicearr {g} _) → f ≈ g\n ; id = slicearr identityʳ\n ; _∘_ = _∘′_\n ; assoc = assoc\n ; sym-assoc = sym-assoc\n ; identityˡ = identityˡ\n ; identityʳ = identityʳ\n ; identity² = identity²\n ; equiv = record -- must be expanded to get levels to work out\n { refl = refl\n ; sym = sym\n ; trans = trans\n }\n ; ∘-resp-≈ = ∘-resp-≈\n }\n where _∘′_ : Slice⇒ Y Z → Slice⇒ X Y → Slice⇒ X Z\n _∘′_ {Y = sliceobj y} {Z = sliceobj z} {X = sliceobj x} (slicearr {g} △) (slicearr {f} △′) = slicearr $ begin\n z ∘ g ∘ f ≈⟨ pullˡ △ ⟩\n y ∘ f ≈⟨ △′ ⟩\n x ∎\n", "meta": {"hexsha": "de8ee293971ea29368e0569a4205ea3401d8cf5b", "size": 1543, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Slice.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Slice.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Slice.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.2950819672, "max_line_length": 117, "alphanum_fraction": 0.569669475, "num_tokens": 581, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767746654974, "lm_q2_score": 0.7772998508568417, "lm_q1q2_score": 0.6820625660778337}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Functions.Definition\nopen import LogicalFormulae\nopen import Numbers.Naturals.Definition\nopen import Sets.FinSet.Definition\nopen import Sets.FinSet.Lemmas\n\nmodule Sets.Cardinality.Finite.Lemmas where\n\nfinsetInjectIntoℕ : {n : ℕ} → Injection (toNat {n})\nfinsetInjectIntoℕ {zero} {()}\nfinsetInjectIntoℕ {succ n} = ans\n where\n ans : {n : ℕ} → {x y : FinSet (succ n)} → (toNat x ≡ toNat y) → x ≡ y\n ans {zero} {fzero} {fzero} _ = refl\n ans {zero} {fzero} {fsucc ()}\n ans {zero} {fsucc ()} {y}\n ans {succ n} {fzero} {fzero} pr = refl\n ans {succ n} {fzero} {fsucc y} ()\n ans {succ n} {fsucc x} {fzero} ()\n ans {succ n} {fsucc x} {fsucc y} pr with succInjective pr\n ... | pr' = applyEquality fsucc (ans {n} {x} {y} pr')\n", "meta": {"hexsha": "e734dc7070a272880b05f77c9a19771f5f72fdc1", "size": 805, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Sets/Cardinality/Finite/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Sets/Cardinality/Finite/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Sets/Cardinality/Finite/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 33.5416666667, "max_line_length": 73, "alphanum_fraction": 0.6385093168, "num_tokens": 286, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.89330940889474, "lm_q2_score": 0.7634837581726991, "lm_q1q2_score": 0.6820272247139885}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Properties satisfied by posets\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary\n\nmodule Relation.Binary.Properties.Poset\n {p₁ p₂ p₃} (P : Poset p₁ p₂ p₃) where\n\nopen Poset P renaming (Carrier to A)\n\nopen import Function using (flip)\nimport Relation.Binary.Construct.NonStrictToStrict _≈_ _≤_ as ToStrict\nimport Relation.Binary.Properties.Preorder preorder as PreorderProperties\nopen import Relation.Nullary using (¬_)\n\nprivate\n _≉_ : Rel A p₂\n x ≉ y = ¬ (x ≈ y)\n\n------------------------------------------------------------------------\n-- The _≥_ relation is also a poset.\n\ninfix 4 _≥_\n\n_≥_ : Rel A p₃\nx ≥ y = y ≤ x\n\nopen PreorderProperties public\n using ()\n renaming\n ( invIsPreorder to ≥-isPreorder\n ; invPreorder to ≥-preorder\n )\n\n≥-isPartialOrder : IsPartialOrder _≈_ _≥_\n≥-isPartialOrder = record\n { isPreorder = PreorderProperties.invIsPreorder\n ; antisym = flip antisym\n }\n\n≥-poset : Poset p₁ p₂ p₃\n≥-poset = record\n { isPartialOrder = ≥-isPartialOrder\n }\n\nopen Poset ≥-poset public\n using ()\n renaming\n ( refl to ≥-refl\n ; reflexive to ≥-reflexive\n ; trans to ≥-trans\n ; antisym to ≥-antisym\n )\n\n------------------------------------------------------------------------\n-- Partial orders can be turned into strict partial orders\n\ninfix 4 _<_\n\n_<_ : Rel A _\n_<_ = ToStrict._<_\n\n<-isStrictPartialOrder : IsStrictPartialOrder _≈_ _<_\n<-isStrictPartialOrder = ToStrict.<-isStrictPartialOrder isPartialOrder\n\n<-strictPartialOrder : StrictPartialOrder _ _ _\n<-strictPartialOrder = record\n { isStrictPartialOrder = <-isStrictPartialOrder\n }\n\nopen StrictPartialOrder <-strictPartialOrder public\n using ( <-resp-≈; <-respʳ-≈; <-respˡ-≈)\n renaming\n ( irrefl to <-irrefl\n ; asym to <-asym\n ; trans to <-trans\n )\n\n<⇒≉ : ∀ {x y} → x < y → x ≉ y\n<⇒≉ = ToStrict.<⇒≉\n\n≤∧≉⇒< : ∀ {x y} → x ≤ y → x ≉ y → x < y\n≤∧≉⇒< = ToStrict.≤∧≉⇒<\n\n<⇒≱ : ∀ {x y} → x < y → ¬ (y ≤ x)\n<⇒≱ = ToStrict.<⇒≱ antisym\n\n≤⇒≯ : ∀ {x y} → x ≤ y → ¬ (y < x)\n≤⇒≯ = ToStrict.≤⇒≯ antisym\n\n\n------------------------------------------------------------------------\n-- DEPRECATED NAMES\n------------------------------------------------------------------------\n-- Please use the new names as continuing support for the old names is\n-- not guaranteed.\n\n-- Version 1.2\n\ninvIsPartialOrder = ≥-isPartialOrder\n{-# WARNING_ON_USAGE invIsPartialOrder\n\"Warning: invIsPartialOrder was deprecated in v1.2.\nPlease use ≥-isPartialOrder instead.\"\n#-}\n\ninvPoset = ≥-poset\n{-# WARNING_ON_USAGE invPoset\n\"Warning: invPoset was deprecated in v1.2.\nPlease use ≥-poset instead.\"\n#-}\n\nstrictPartialOrder = <-strictPartialOrder\n{-# WARNING_ON_USAGE strictPartialOrder\n\"Warning: strictPartialOrder was deprecated in v1.2.\nPlease use <-strictPartialOrder instead.\"\n#-}\n", "meta": {"hexsha": "9383902ed2c0b58b3d68bad820e6c6bbf3aaee77", "size": 2948, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Relation/Binary/Properties/Poset.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Relation/Binary/Properties/Poset.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Relation/Binary/Properties/Poset.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 24.1639344262, "max_line_length": 73, "alphanum_fraction": 0.5766621438, "num_tokens": 896, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094060543488, "lm_q2_score": 0.7634837527911057, "lm_q1q2_score": 0.6820272177379679}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Algebra.Magma.Properties where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\n\nopen import Cubical.Algebra\nopen import Cubical.Algebra.Magma.Morphism\n\nopen import Cubical.Algebra.Magma.MorphismProperties public\n using (MagmaPath; uaMagma; carac-uaMagma; Magma≡; caracMagma≡)\n\nprivate\n variable\n ℓ : Level\n\nisPropIsMagma : {M : Type ℓ} {_•_ : Op₂ M} → isProp (IsMagma M _•_)\nisPropIsMagma (ismagma x) (ismagma y) = cong ismagma (isPropIsSet x y)\n", "meta": {"hexsha": "026e13ca1f05f51643b49a5b86adbb381c2498e1", "size": 586, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Magma/Properties.agda", "max_stars_repo_name": "bijan2005/univalent-foundations", "max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/Magma/Properties.agda", "max_issues_repo_name": "bijan2005/univalent-foundations", "max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/Magma/Properties.agda", "max_forks_repo_name": "bijan2005/univalent-foundations", "max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.3, "max_line_length": 70, "alphanum_fraction": 0.7662116041, "num_tokens": 185, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9032941988938414, "lm_q2_score": 0.7549149868676283, "lm_q1q2_score": 0.6819103282955491}} {"text": "-- This is the preferred version of the integers in the library. Other\n-- versions can be found in the MoreInts directory.\n{-# OPTIONS --safe #-}\nmodule Cubical.Data.Int.Base where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Data.Bool\nopen import Cubical.Data.Nat hiding (_+_ ; _·_) renaming (isEven to isEvenℕ ; isOdd to isOddℕ)\n\ninfix 8 -_\ninfixl 7 _·_\ninfixl 6 _+_ _-_\n\ndata ℤ : Type₀ where\n pos : (n : ℕ) → ℤ\n negsuc : (n : ℕ) → ℤ\n\nneg : (n : ℕ) → ℤ\nneg zero = pos zero\nneg (suc n) = negsuc n\n\nsucℤ : ℤ → ℤ\nsucℤ (pos n) = pos (suc n)\nsucℤ (negsuc zero) = pos zero\nsucℤ (negsuc (suc n)) = negsuc n\n\npredℤ : ℤ → ℤ\npredℤ (pos zero) = negsuc zero\npredℤ (pos (suc n)) = pos n\npredℤ (negsuc n) = negsuc (suc n)\n\nisEven : ℤ → Bool\nisEven (pos n) = isEvenℕ n\nisEven (negsuc n) = isOddℕ n\n\nisOdd : ℤ → Bool\nisOdd (pos n) = isOddℕ n\nisOdd (negsuc n) = isEvenℕ n\n\nabs : ℤ → ℕ\nabs (pos n) = n\nabs (negsuc n) = suc n\n\n_ℕ-_ : ℕ → ℕ → ℤ\na ℕ- 0 = pos a\n0 ℕ- suc b = negsuc b\nsuc a ℕ- suc b = a ℕ- b\n\n_+pos_ : ℤ → ℕ → ℤ\nz +pos 0 = z\nz +pos (suc n) = sucℤ (z +pos n)\n\n_+negsuc_ : ℤ → ℕ → ℤ\nz +negsuc 0 = predℤ z\nz +negsuc (suc n) = predℤ (z +negsuc n)\n\n_+_ : ℤ → ℤ → ℤ\nm + pos n = m +pos n\nm + negsuc n = m +negsuc n\n\n-_ : ℤ → ℤ\n- pos zero = pos zero\n- pos (suc n) = negsuc n\n- negsuc n = pos (suc n)\n\n_-_ : ℤ → ℤ → ℤ\nm - n = m + (- n)\n\n_·_ : ℤ → ℤ → ℤ\npos zero · m = pos zero\npos (suc n) · m = m + pos n · m\nnegsuc zero · m = - m\nnegsuc (suc n) · m = - m + negsuc n · m\n\n-- Natural number and negative integer literals for ℤ\n\nopen import Cubical.Data.Nat.Literals public\n\ninstance\n fromNatℤ : HasFromNat ℤ\n fromNatℤ = record { Constraint = λ _ → Unit ; fromNat = λ n → pos n }\n\ninstance\n fromNegℤ : HasFromNeg ℤ\n fromNegℤ = record { Constraint = λ _ → Unit ; fromNeg = λ n → neg n }\n", "meta": {"hexsha": "b7d9c48b52077693f63820b4c4ac31da9cc040d6", "size": 1815, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/Int/Base.agda", "max_stars_repo_name": "marcinjangrzybowski/cubical", "max_stars_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 301, "max_stars_repo_stars_event_min_datetime": "2018-10-17T18:00:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T02:10:47.000Z", "max_issues_repo_path": "Cubical/Data/Int/Base.agda", "max_issues_repo_name": "marcinjangrzybowski/cubical", "max_issues_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 584, "max_issues_repo_issues_event_min_datetime": "2018-10-15T09:49:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T12:09:17.000Z", "max_forks_repo_path": "Cubical/Data/Int/Base.agda", "max_forks_repo_name": "marcinjangrzybowski/cubical", "max_forks_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 134, "max_forks_repo_forks_event_min_datetime": "2018-11-16T06:11:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T16:22:13.000Z", "avg_line_length": 21.1046511628, "max_line_length": 94, "alphanum_fraction": 0.6027548209, "num_tokens": 791, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772384450968, "lm_q2_score": 0.7799929002541068, "lm_q1q2_score": 0.6817740402608915}} {"text": "module SystemF.Substitutions.Types where\n\nopen import Prelude\nopen import SystemF.Syntax.Type\nopen import Data.Fin.Substitution\nopen import Data.Star hiding (map)\nopen import Data.Vec\n\nmodule TypeSubst where\n module TypeApp {T} (l : Lift T Type) where\n open Lift l hiding (var)\n\n infixl 8 _/_\n\n _/_ : ∀ {m n} → Type m → Sub T m n → Type n\n tc c / σ = tc c\n tvar x / σ = lift (lookup x σ)\n (a →' b) / σ = (a / σ) →' (b / σ)\n (a ⟶ b) / σ = (a / σ) ⟶ (b / σ)\n ∀' a / σ = ∀' (a / σ ↑)\n\n open Application (record { _/_ = _/_ }) using (_/✶_)\n\n →'-/✶-↑✶ : ∀ k {m n a b} (ρs : Subs T m n) →\n (a →' b) /✶ ρs ↑✶ k ≡ (a /✶ ρs ↑✶ k) →' (b /✶ ρs ↑✶ k)\n →'-/✶-↑✶ k ε = refl\n →'-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (→'-/✶-↑✶ k ρs) refl\n\n\n ⟶-/✶-↑✶ : ∀ k {m n a b} (ρs : Subs T m n) →\n (a ⟶ b) /✶ ρs ↑✶ k ≡ (a /✶ ρs ↑✶ k) ⟶ (b /✶ ρs ↑✶ k)\n ⟶-/✶-↑✶ k ε = refl\n ⟶-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (⟶-/✶-↑✶ k ρs) refl\n\n ∀'-/✶-↑✶ : ∀ k {m n a} (ρs : Subs T m n) →\n (∀' a) /✶ ρs ↑✶ k ≡ ∀' (a /✶ ρs ↑✶ (1 + k))\n ∀'-/✶-↑✶ k ε = refl\n ∀'-/✶-↑✶ k (ρ ◅ ρs) = cong₂ _/_ (∀'-/✶-↑✶ k ρs) refl\n\n tc-/✶-↑✶ : ∀ k {c m n} (ρs : Subs T m n) →\n (tc c) /✶ ρs ↑✶ k ≡ tc c\n tc-/✶-↑✶ k ε = refl\n tc-/✶-↑✶ k (r ◅ ρs) = cong₂ _/_ (tc-/✶-↑✶ k ρs) refl \n\n typeSubst : TermSubst Type\n typeSubst = record { var = tvar; app = TypeApp._/_ }\n\n open TermSubst typeSubst public hiding (var)\n\n infix 8 _[/_]\n\n -- Shorthand for single-variable type substitutions\n _[/_] : ∀ {n} → Type (suc n) → Type n → Type n\n a [/ b ] = a / sub b\n\nopen TypeSubst public using ()\n renaming (_/_ to _tp/tp_; _[/_] to _tp[/tp_]; weaken to tp-weaken)\n", "meta": {"hexsha": "dffe39e28ee907893bd8a46b90aea9b52002346f", "size": 1735, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/SystemF/Substitutions/Types.agda", "max_stars_repo_name": "metaborg/ts.agda", "max_stars_repo_head_hexsha": "7fe638b87de26df47b6437f5ab0a8b955384958d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-04-05T17:57:11.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-07T04:08:41.000Z", "max_issues_repo_path": "src/SystemF/Substitutions/Types.agda", "max_issues_repo_name": "metaborg/ts.agda", "max_issues_repo_head_hexsha": "7fe638b87de26df47b6437f5ab0a8b955384958d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/SystemF/Substitutions/Types.agda", "max_forks_repo_name": "metaborg/ts.agda", "max_forks_repo_head_hexsha": "7fe638b87de26df47b6437f5ab0a8b955384958d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.9137931034, "max_line_length": 69, "alphanum_fraction": 0.4414985591, "num_tokens": 829, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240930029117, "lm_q2_score": 0.787931190663057, "lm_q1q2_score": 0.6817370497901477}} {"text": "{-# OPTIONS --universe-polymorphism #-}\n\nmodule Issue293a where\n\nopen import Agda.Primitive\n using (Level; _⊔_) renaming (lzero to zero; lsuc to suc)\n\n------------------------------------------------------------------------\n\nrecord RawMonoid c ℓ : Set (suc (c ⊔ ℓ)) where\n infixl 7 _∙_\n infix 4 _≈_\n field\n Carrier : Set c\n _≈_ : Carrier → Carrier → Set ℓ\n _∙_ : Carrier → Carrier → Carrier\n ε : Carrier\n\nmodule M (rm : RawMonoid zero zero) where\n\n open RawMonoid rm\n\n thm : ∀ x → x ∙ ε ≈ x\n thm = {!!}\n\n -- Previous agda2-goal-and-context:\n\n -- rm : RawMonoid zero zero\n -- ------------------------\n -- Goal: (x : RawMonoid.Carrier rm) →\n -- RawMonoid._≈_ rm (RawMonoid._∙_ rm x (RawMonoid.ε rm)) x\n\n -- Current agda2-goal-and-context:\n\n -- rm : RawMonoid zero zero\n -- ------------------------\n -- Goal: (x : Carrier) → x ∙ ε ≈ x\n\n------------------------------------------------------------------------\n\nrecord RawMonoid′ : Set₁ where\n infixl 7 _∙_\n infix 4 _≈_\n field\n Carrier : Set\n _≈_ : Carrier → Carrier → Set\n _∙_ : Carrier → Carrier → Carrier\n ε : Carrier\n\n\nmodule M′ (rm : RawMonoid′) where\n\n open RawMonoid′ rm\n\n thm′ : ∀ x → x ∙ ε ≈ x\n thm′ = {!!}\n\n -- Previous and current agda2-goal-and-context:\n\n -- rm : RawMonoid′\n -- ---------------\n -- Goal: (x : Carrier) → x ∙ ε ≈ x\n\n------------------------------------------------------------------------\n\n-- UP isn't relevant.\n\nrecord RawMonoid″ (Carrier : Set) : Set₁ where\n infixl 7 _∙_\n infix 4 _≈_\n field\n _≈_ : Carrier → Carrier → Set\n _∙_ : Carrier → Carrier → Carrier\n ε : Carrier\n\ndata Bool : Set where\n true false : Bool\n\ndata List (A : Set) : Set where\n [] : List A\n _∷_ : (x : A)(xs : List A) → List A\n\nmodule M″ (rm : RawMonoid″ (List Bool)) where\n\n open RawMonoid″ rm\n\n thm″ : ∀ x → x ∙ ε ≈ x\n thm″ = {!!}\n\n -- Previous agda2-goal-and-context:\n\n -- rm : RawMonoid″ (List Bool)\n -- ---------------------------\n -- Goal: (x : List Bool) →\n -- RawMonoid″._≈_ rm (RawMonoid″._∙_ rm x (RawMonoid″.ε rm)) x\n\n -- Current agda2-goal-and-context:\n\n -- rm : RawMonoid″ (List Bool)\n -- ---------------------------\n -- Goal: (x : List Bool) → x ∙ ε ≈ x\n", "meta": {"hexsha": "f02756b86292d976cb2261ecefc08fa9e768e4e7", "size": 2270, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/interaction/Issue293a.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/interaction/Issue293a.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/interaction/Issue293a.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 22.2549019608, "max_line_length": 72, "alphanum_fraction": 0.472246696, "num_tokens": 730, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240791017536, "lm_q2_score": 0.7879311956428947, "lm_q1q2_score": 0.6817370431456672}} {"text": "{-# OPTIONS --safe #-}\n\nmodule Confluence where\n\nopen import Relation.Binary.PropositionalEquality\n using (_≡_; refl)\n\ncong : ∀ {A B : Set} {x y : A} (f : A → B) → x ≡ y → f x ≡ f y\ncong f refl = refl\n\ndata ℕ : Set where\n Z : ℕ\n S : ℕ → ℕ\n\nadd : ℕ → ℕ → ℕ\nadd n Z = n\nadd n (S m) = S (add n m)\n\n_ : ∀ {a : ℕ} → add a Z ≡ a\n_ = refl\n\nthm : ∀ {a : ℕ} → add Z a ≡ a\nthm {a = Z} = refl\nthm {a = (S m)} = cong S thm\n-- Confluence checking is not supported;\n-- Check out Jesper Cockx's Phd thesis for overlapping patterns.\n", "meta": {"hexsha": "fde0b93c08bd4c978581745191f18acfc78435b1", "size": 520, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Confluence.agda", "max_stars_repo_name": "anqurvanillapy/fpl", "max_stars_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-08-24T22:47:47.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-24T22:47:47.000Z", "max_issues_repo_path": "agda/Confluence.agda", "max_issues_repo_name": "anqurvanillapy/fpl", "max_issues_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Confluence.agda", "max_forks_repo_name": "anqurvanillapy/fpl", "max_forks_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.2592592593, "max_line_length": 64, "alphanum_fraction": 0.5673076923, "num_tokens": 200, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8962513842182777, "lm_q2_score": 0.7606506418255927, "lm_q1q2_score": 0.6817341906427088}} {"text": "{-\n\nSmith Normal Form\n\nReferrences:\n Guillaume Cano, Cyril Cohen, Maxime Dénès, Anders Mörtberg, Vincent Siles,\n \"Formalized linear algebra over Elementary Divisor Rings in Coq\"\n (https://arxiv.org/abs/1601.07472)\n\n-}\n{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.IntegerMatrix.Smith where\n\nopen import Cubical.Algebra.IntegerMatrix.Smith.NormalForm public\nopen import Cubical.Algebra.IntegerMatrix.Smith.Normalization public using (smith)\n", "meta": {"hexsha": "e78674098b10eaea0529a93a5528a0a5333a64d6", "size": 443, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/IntegerMatrix/Smith.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z", "max_issues_repo_path": "Cubical/Algebra/IntegerMatrix/Smith.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/IntegerMatrix/Smith.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.6875, "max_line_length": 82, "alphanum_fraction": 0.7855530474, "num_tokens": 115, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099070060380482, "lm_q2_score": 0.7490872187162397, "lm_q1q2_score": 0.6815997084434623}} {"text": "module Type.Category.ExtensionalFunctionsCategory{ℓ} where\n\nopen import Data\nopen import Functional\nopen import Function.Equals\nopen import Function.Equals.Proofs\nopen import Logic.Propositional\nimport Relator.Equals as Eq\nopen import Relator.Equals.Proofs.Equiv\nopen import Structure.Category\nopen import Structure.Categorical.Properties\nopen import Type\nopen import Type.Properties.Singleton\n\n-- The set category but the equality on the morphisms/functions is pointwise/extensional.\ntypeExtensionalFnCategory : Category{Obj = Type{ℓ}}(_→ᶠ_) ⦃ [⊜]-equiv ⦃ [≡]-equiv ⦄ ⦄\nCategory._∘_ typeExtensionalFnCategory = _∘_\nCategory.id typeExtensionalFnCategory = id\nCategory.binaryOperator typeExtensionalFnCategory = [⊜][∘]-binaryOperator\nMorphism.Associativity.proof (Category.associativity typeExtensionalFnCategory) {x = _} {_} {_} {x = f} {g} {h} = [⊜]-associativity {x = f}{y = g}{z = h}\nCategory.identity typeExtensionalFnCategory = [∧]-intro (Morphism.intro (Dependent.intro Eq.[≡]-intro)) (Morphism.intro (Dependent.intro Eq.[≡]-intro))\n\ntypeExtensionalFnCategoryObject : CategoryObject\ntypeExtensionalFnCategoryObject = intro typeExtensionalFnCategory\n\nEmpty-initialObject : Object.Initial{Obj = Type{ℓ}}(_→ᶠ_) ⦃ [⊜]-equiv ⦃ [≡]-equiv ⦄ ⦄ (Empty)\nIsUnit.unit Empty-initialObject = empty\n_⊜_.proof (IsUnit.uniqueness Empty-initialObject {f}) {}\n\nUnit-terminalObject : Object.Terminal{Obj = Type{ℓ}}(_→ᶠ_) ⦃ [⊜]-equiv ⦃ [≡]-equiv ⦄ ⦄ (Unit)\nIsUnit.unit Unit-terminalObject = const <>\n_⊜_.proof (IsUnit.uniqueness Unit-terminalObject {f}) {_} = Eq.[≡]-intro\n", "meta": {"hexsha": "82fba45e0a7d8c3b0d17bcd5aa63dc7496256611", "size": 1564, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type/Category/ExtensionalFunctionsCategory.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Type/Category/ExtensionalFunctionsCategory.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Type/Category/ExtensionalFunctionsCategory.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 47.3939393939, "max_line_length": 153, "alphanum_fraction": 0.7621483376, "num_tokens": 474, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099070035949656, "lm_q2_score": 0.7490872187162396, "lm_q1q2_score": 0.6815997066133802}} {"text": "module VaryingClauseArity where\n\n-- see also thread https://lists.chalmers.se/pipermail/agda-dev/2015-January/000041.html\n\nopen import Common.IO\nopen import Common.Unit\nopen import Common.Nat\n\n\nSum : Nat → Set\nSum 0 = Nat\nSum (suc n) = Nat → Sum n\n\nsum : (acc : Nat) (n : Nat) → Sum n\nsum acc 0 = acc\nsum acc (suc n) 0 = sum acc n\nsum acc (suc n) m = sum (m + acc) n\n\n-- expected:\n-- 10\n-- 20\n-- 33\nmain : IO Unit\nmain = printNat (sum 10 0) ,,\n putStr \"\\n\" ,,\n printNat (sum 20 1 0) ,,\n putStr \"\\n\" ,,\n printNat (sum 30 1 3)\n", "meta": {"hexsha": "009d6b4dc46f522149063631357749d6e88e2b7e", "size": 543, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Compiler/simple/VaryingClauseArity.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Compiler/simple/VaryingClauseArity.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Compiler/simple/VaryingClauseArity.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 18.724137931, "max_line_length": 88, "alphanum_fraction": 0.6187845304, "num_tokens": 207, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099069962657177, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6815997062199894}} {"text": "{-# OPTIONS --safe --warning=error --without-K --guardedness #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nopen import LogicalFormulae\nopen import Setoids.Subset\nopen import Setoids.Setoids\nopen import Setoids.Orders.Partial.Definition\nopen import Setoids.Orders.Total.Definition\nopen import Sets.EquivalenceRelations\nopen import Rings.Orders.Total.Definition\nopen import Rings.Orders.Partial.Definition\nopen import Rings.Definition\nopen import Fields.Fields\nopen import Groups.Definition\nopen import Sequences\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Naturals.Order\nopen import Semirings.Definition\nopen import Functions.Definition\nopen import Fields.Orders.Total.Definition\nopen import Numbers.Primes.PrimeNumbers\n\nmodule Fields.Orders.Limits.Lemmas {a b c : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {_} {c} A} {R : Ring S _+_ _*_} {pOrder : SetoidPartialOrder S _<_} {F : Field R} {pRing : PartiallyOrderedRing R pOrder} (oF : TotallyOrderedField F pRing) where\n\nopen Ring R\nopen TotallyOrderedField oF\nopen TotallyOrderedRing oRing\nopen PartiallyOrderedRing pRing\nopen import Rings.Orders.Total.Lemmas oRing\nopen import Rings.Orders.Total.AbsoluteValue oRing\nopen import Rings.Orders.Partial.Lemmas pRing\nopen SetoidTotalOrder total\nopen SetoidPartialOrder pOrder\nopen Group additiveGroup\nopen import Groups.Lemmas additiveGroup\nopen Setoid S\nopen Equivalence eq\nopen Field F\nopen import Fields.CauchyCompletion.Definition (TotallyOrderedField.oRing oF) F\nopen import Fields.Orders.Limits.Definition oF\nopen import Fields.Lemmas F\nopen import Fields.Orders.Total.Lemmas oF\nopen import Rings.Characteristic R\nopen import Rings.InitialRing R\nopen import Rings.Orders.Total.Cauchy oRing\n\nprivate\n 2!=3 : 2 ≡ 3 → False\n 2!=3 ()\n\nconvergentSequenceCauchy : (nontrivial : 0R ∼ 1R → False) → {a : Sequence A} → {r : A} → a ~> r → cauchy a\nconvergentSequenceCauchy _ {a} {r} a->r e 0r e/2 (halvePositive' prE/2 0 A\n\nmodule Stream where\n\ndata Bool : Set where\n true : Bool\n false : Bool\n\nif_then_else_ : forall {A} -> Bool -> A -> A -> A\nif true then t else e = t\nif false then t else e = e\n\ndata Nat : Set where\n zero : Nat\n succ : Nat -> Nat\n\nStream : Set -> Set\nStream A = Nat -> A\n\n_::_ : forall {A} -> A -> Stream A -> Stream A\n_::_ a as zero = a\n_::_ a as (succ n) = as n\n\nmap : forall {A B} -> (A -> B) -> Stream A -> Stream B\nmap f as n = f (as n)\n\nhead : forall {A} -> Stream A -> A\nhead as = as zero\n\ntail : forall {A} -> Stream A -> Stream A\ntail as n = as (succ n)\n\n-- construct the stream a :: f a :: f (f a) :: ...\n\niterate : forall {A} -> (A -> A) -> A -> Stream A\niterate f a zero = a\niterate f a (succ n) = iterate f (f a) n\n\nzipWith : forall {A B C} -> (A -> B -> C) -> Stream A -> Stream B -> Stream C\nzipWith f as bs n = f (as n) (bs n)\n\n-- merge with with\nmerge : forall {A} -> (A -> A -> Bool) -> Stream A -> Stream A -> Stream A\nmerge le as bs with le (head as) (head bs)\nmerge le as bs | true = head as :: merge le (tail as) bs\nmerge le as bs | false = head bs :: merge le as (tail bs)\n\n{-\n-- without with\nmerge' : forall {A} -> (A -> A -> Bool) -> Stream A -> Stream A -> Stream A\nmerge' le as bs = if le (head as) (head bs)\n then (head as :: merge' le (tail as) bs)\n else (head bs :: merge' le as (tail bs))\n-}\n\n-- BOTH VARIANTS OF MERGE ARE NOT STRUCTURALLY RECURSIVE\n\n", "meta": {"hexsha": "24fd31458eb682dddd4148b0694f7905a77dd1f0", "size": 1467, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/Termination/Stream.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/Termination/Stream.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/outdated-and-incorrect/Termination/Stream.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 25.2931034483, "max_line_length": 77, "alphanum_fraction": 0.5582822086, "num_tokens": 480, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.899121388082479, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.68134913189972}} {"text": "-- Kleene's three-valued logic \n\nmodule bool-kleene where\n\nopen import bool\nopen import eq\n\ndata 𝔹ₖ : Set where\n tt : 𝔹ₖ\n ff : 𝔹ₖ\n uu : 𝔹ₖ\n\ninfix 7 ~ₖ_\ninfixr 6 _&&ₖ_\ninfixr 5 _||ₖ_ \n--infixr 4 _impₖ_ \n\n~ₖ_ : 𝔹ₖ → 𝔹ₖ\n~ₖ tt = ff\n~ₖ ff = tt\n~ₖ uu = uu\n\n-- and\n_&&ₖ_ : 𝔹ₖ → 𝔹ₖ → 𝔹ₖ\ntt &&ₖ b = b\nff &&ₖ b = ff\nuu &&ₖ ff = ff\nuu &&ₖ b = uu\n\n-- or\n_||ₖ_ : 𝔹ₖ → 𝔹ₖ → 𝔹ₖ\nff ||ₖ b = b\ntt ||ₖ b = tt\nuu ||ₖ tt = tt\nuu ||ₖ b = uu\n\n-- implication\n_impₖ_ : 𝔹ₖ → 𝔹ₖ → 𝔹ₖ \ntt impₖ b2 = b2\nff impₖ b2 = tt\nuu impₖ tt = tt\nuu impₖ b = uu\n\nknownₖ : 𝔹ₖ → 𝔹\nknownₖ tt = tt\nknownₖ ff = tt\nknownₖ uu = ff\n\nto-𝔹 : (b : 𝔹ₖ) → knownₖ b ≡ tt → 𝔹\nto-𝔹 tt p = tt\nto-𝔹 ff p = ff\nto-𝔹 uu () ", "meta": {"hexsha": "24e7f6080b8e119a71121ea8f5e6950d428d20c1", "size": 665, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "bool-kleene.agda", "max_stars_repo_name": "rfindler/ial", "max_stars_repo_head_hexsha": "f3f0261904577e930bd7646934f756679a6cbba6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 29, "max_stars_repo_stars_event_min_datetime": "2019-02-06T13:09:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-04T15:05:12.000Z", "max_issues_repo_path": "bool-kleene.agda", "max_issues_repo_name": "rfindler/ial", "max_issues_repo_head_hexsha": "f3f0261904577e930bd7646934f756679a6cbba6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2018-07-09T22:53:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-22T03:43:34.000Z", "max_forks_repo_path": "bool-kleene.agda", "max_forks_repo_name": "rfindler/ial", "max_forks_repo_head_hexsha": "f3f0261904577e930bd7646934f756679a6cbba6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 17, "max_forks_repo_forks_event_min_datetime": "2018-12-03T22:38:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-28T20:13:21.000Z", "avg_line_length": 12.7884615385, "max_line_length": 35, "alphanum_fraction": 0.5518796992, "num_tokens": 411, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9481545318852121, "lm_q2_score": 0.718594386544335, "lm_q1q2_score": 0.6813385241892852}} {"text": "open import Relation.Binary.Core\n\nmodule Bound.Lower.Order.Properties {A : Set} \n (_≤_ : A → A → Set) \n (trans≤ : Transitive _≤_) where\n\nopen import Bound.Lower A\nopen import Bound.Lower.Order _≤_\n\ntransLeB : {a b c : Bound} → LeB a b → LeB b c → LeB a c\ntransLeB lebx _ = lebx\ntransLeB (lexy x≤y) (lexy y≤z) = lexy (trans≤ x≤y y≤z) \n", "meta": {"hexsha": "c9e9fde2dc34d823f29f6dbae4acc1f137e98c98", "size": 367, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Bound/Lower/Order/Properties.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/Bound/Lower/Order/Properties.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Bound/Lower/Order/Properties.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.2307692308, "max_line_length": 56, "alphanum_fraction": 0.6021798365, "num_tokens": 136, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9399133531922388, "lm_q2_score": 0.7248702880639791, "lm_q1q2_score": 0.6813152630836387}} {"text": "module Inductive.Examples.List where\n\nopen import Inductive\nopen import Tuple hiding (_++_)\n\nopen import Data.Fin\nopen import Data.Product hiding (map)\nopen import Data.List hiding (List; map; foldr; _++_)\nopen import Data.Vec hiding (map; foldr; _++_)\n\nList : Set → Set\nList A = Inductive (([] , []) ∷ (((A ∷ []) , ([] ∷ [])) ∷ []))\n\nnil : {A : Set} → List A\nnil = construct zero [] []\n\ncons : {A : Set} → A → List A → List A\ncons x xs = construct (suc zero) (x ∷ []) ((λ _ → xs) ∷ [])\n\nmap : {A B : Set} → (A → B) → List A → List B\nmap f = rec (nil ∷ ((λ a as ras → cons (f a) ras) ∷ []))\n\nfoldr : {A B : Set} → (A → B → B) → B → List A → B\nfoldr f b = rec (b ∷ (λ a as ras → f a ras) ∷ [])\n\n_++_ : {A : Set} → List A → List A → List A\nxs ++ ys = rec (ys ∷ (λ a as ras → cons a ras) ∷ []) xs\n", "meta": {"hexsha": "6df063436cdecda97b1a4fa91484753c5b33d1d1", "size": 794, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Inductive/Examples/List.agda", "max_stars_repo_name": "mr-ohman/general-induction", "max_stars_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Inductive/Examples/List.agda", "max_issues_repo_name": "mr-ohman/general-induction", "max_issues_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Inductive/Examples/List.agda", "max_forks_repo_name": "mr-ohman/general-induction", "max_forks_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.3571428571, "max_line_length": 62, "alphanum_fraction": 0.5390428212, "num_tokens": 293, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9241418137109956, "lm_q2_score": 0.7371581741774411, "lm_q1q2_score": 0.6812386920762264}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Properties related to negation\n------------------------------------------------------------------------\n\nmodule Relation.Nullary.Negation where\n\nopen import Relation.Nullary\nopen import Relation.Unary\nopen import Data.Bool\nopen import Data.Empty\nopen import Function\nopen import Data.Product as Prod\nopen import Data.Fin using (Fin)\nopen import Data.Fin.Dec\nopen import Data.Sum as Sum\nopen import Category.Monad\nopen import Level\n\ncontradiction : ∀ {p w} {P : Set p} {Whatever : Set w} →\n P → ¬ P → Whatever\ncontradiction p ¬p = ⊥-elim (¬p p)\n\ncontraposition : ∀ {p q} {P : Set p} {Q : Set q} →\n (P → Q) → ¬ Q → ¬ P\ncontraposition f ¬q p = contradiction (f p) ¬q\n\n-- Note also the following use of flip:\n\nprivate\n note : ∀ {p q} {P : Set p} {Q : Set q} →\n (P → ¬ Q) → Q → ¬ P\n note = flip\n\n-- If we can decide P, then we can decide its negation.\n\n¬? : ∀ {p} {P : Set p} → Dec P → Dec (¬ P)\n¬? (yes p) = no (λ ¬p → ¬p p)\n¬? (no ¬p) = yes ¬p\n\n------------------------------------------------------------------------\n-- Quantifier juggling\n\n∃⟶¬∀¬ : ∀ {a p} {A : Set a} {P : A → Set p} →\n ∃ P → ¬ (∀ x → ¬ P x)\n∃⟶¬∀¬ = flip uncurry\n\n∀⟶¬∃¬ : ∀ {a p} {A : Set a} {P : A → Set p} →\n (∀ x → P x) → ¬ ∃ λ x → ¬ P x\n∀⟶¬∃¬ ∀xPx (x , ¬Px) = ¬Px (∀xPx x)\n\n¬∃⟶∀¬ : ∀ {a p} {A : Set a} {P : A → Set p} →\n ¬ ∃ (λ x → P x) → ∀ x → ¬ P x\n¬∃⟶∀¬ = curry\n\n∀¬⟶¬∃ : ∀ {a p} {A : Set a} {P : A → Set p} →\n (∀ x → ¬ P x) → ¬ ∃ (λ x → P x)\n∀¬⟶¬∃ = uncurry\n\n∃¬⟶¬∀ : ∀ {a p} {A : Set a} {P : A → Set p} →\n ∃ (λ x → ¬ P x) → ¬ (∀ x → P x)\n∃¬⟶¬∀ = flip ∀⟶¬∃¬\n\n-- When P is a decidable predicate over a finite set the following\n-- lemma can be proved.\n\n¬∀⟶∃¬ : ∀ n {p} (P : Fin n → Set p) → Decidable P →\n ¬ (∀ i → P i) → ∃ λ i → ¬ P i\n¬∀⟶∃¬ n P dec ¬P = Prod.map id proj₁ $ ¬∀⟶∃¬-smallest n P dec ¬P\n\n------------------------------------------------------------------------\n-- Double-negation\n\n¬¬-map : ∀ {p q} {P : Set p} {Q : Set q} →\n (P → Q) → ¬ ¬ P → ¬ ¬ Q\n¬¬-map f = contraposition (contraposition f)\n\n-- Stability under double-negation.\n\nStable : ∀ {ℓ} → Set ℓ → Set ℓ\nStable P = ¬ ¬ P → P\n\n-- Everything is stable in the double-negation monad.\n\nstable : ∀ {p} {P : Set p} → ¬ ¬ Stable P\nstable ¬[¬¬p→p] = ¬[¬¬p→p] (λ ¬¬p → ⊥-elim (¬¬p (¬[¬¬p→p] ∘ const)))\n\n-- Negated predicates are stable.\n\nnegated-stable : ∀ {p} {P : Set p} → Stable (¬ P)\nnegated-stable ¬¬¬P P = ¬¬¬P (λ ¬P → ¬P P)\n\n-- Decidable predicates are stable.\n\ndecidable-stable : ∀ {p} {P : Set p} → Dec P → Stable P\ndecidable-stable (yes p) ¬¬p = p\ndecidable-stable (no ¬p) ¬¬p = ⊥-elim (¬¬p ¬p)\n\n¬-drop-Dec : ∀ {p} {P : Set p} → Dec (¬ ¬ P) → Dec (¬ P)\n¬-drop-Dec (yes ¬¬p) = no ¬¬p\n¬-drop-Dec (no ¬¬¬p) = yes (negated-stable ¬¬¬p)\n\n-- Double-negation is a monad (if we assume that all elements of ¬ ¬ P\n-- are equal).\n\n¬¬-Monad : ∀ {p} → RawMonad (λ (P : Set p) → ¬ ¬ P)\n¬¬-Monad = record\n { return = contradiction\n ; _>>=_ = λ x f → negated-stable (¬¬-map f x)\n }\n\n¬¬-push : ∀ {p q} {P : Set p} {Q : P → Set q} →\n ¬ ¬ ((x : P) → Q x) → (x : P) → ¬ ¬ Q x\n¬¬-push ¬¬P⟶Q P ¬Q = ¬¬P⟶Q (λ P⟶Q → ¬Q (P⟶Q P))\n\n-- A double-negation-translated variant of excluded middle (or: every\n-- nullary relation is decidable in the double-negation monad).\n\nexcluded-middle : ∀ {p} {P : Set p} → ¬ ¬ Dec P\nexcluded-middle ¬h = ¬h (no (λ p → ¬h (yes p)))\n\n-- If Whatever is instantiated with ¬ ¬ something, then this function\n-- is call with current continuation in the double-negation monad, or,\n-- if you will, a double-negation translation of Peirce's law.\n--\n-- In order to prove ¬ ¬ P one can assume ¬ P and prove ⊥. However,\n-- sometimes it is nice to avoid leaving the double-negation monad; in\n-- that case this function can be used (with Whatever instantiated to\n-- ⊥).\n\ncall/cc : ∀ {w p} {Whatever : Set w} {P : Set p} →\n ((P → Whatever) → ¬ ¬ P) → ¬ ¬ P\ncall/cc hyp ¬p = hyp (λ p → ⊥-elim (¬p p)) ¬p\n\n-- The \"independence of premise\" rule, in the double-negation monad.\n-- It is assumed that the index set (Q) is inhabited.\n\nindependence-of-premise\n : ∀ {p q r} {P : Set p} {Q : Set q} {R : Q → Set r} →\n Q → (P → Σ Q R) → ¬ ¬ (Σ[ x ∈ Q ] (P → R x))\nindependence-of-premise {P = P} q f = ¬¬-map helper excluded-middle\n where\n helper : Dec P → _\n helper (yes p) = Prod.map id const (f p)\n helper (no ¬p) = (q , ⊥-elim ∘′ ¬p)\n\n-- The independence of premise rule for binary sums.\n\nindependence-of-premise-⊎\n : ∀ {p q r} {P : Set p} {Q : Set q} {R : Set r} →\n (P → Q ⊎ R) → ¬ ¬ ((P → Q) ⊎ (P → R))\nindependence-of-premise-⊎ {P = P} f = ¬¬-map helper excluded-middle\n where\n helper : Dec P → _\n helper (yes p) = Sum.map const const (f p)\n helper (no ¬p) = inj₁ (⊥-elim ∘′ ¬p)\n\nprivate\n\n -- Note that independence-of-premise-⊎ is a consequence of\n -- independence-of-premise (for simplicity it is assumed that Q and\n -- R have the same type here):\n\n corollary : ∀ {p ℓ} {P : Set p} {Q R : Set ℓ} →\n (P → Q ⊎ R) → ¬ ¬ ((P → Q) ⊎ (P → R))\n corollary {P = P} {Q} {R} f =\n ¬¬-map helper (independence-of-premise\n true ([ _,_ true , _,_ false ] ∘′ f))\n where\n helper : ∃ (λ b → P → if b then Q else R) → (P → Q) ⊎ (P → R)\n helper (true , f) = inj₁ f\n helper (false , f) = inj₂ f\n\n-- The classical statements of excluded middle and double-negation\n-- elimination.\n\nExcluded-Middle : (ℓ : Level) → Set (suc ℓ)\nExcluded-Middle p = {P : Set p} → Dec P\n\nDouble-Negation-Elimination : (ℓ : Level) → Set (suc ℓ)\nDouble-Negation-Elimination p = {P : Set p} → Stable P\n\nprivate\n\n -- The two statements above are equivalent. The proofs are so\n -- simple, given the definitions above, that they are not exported.\n\n em⇒dne : ∀ {ℓ} → Excluded-Middle ℓ → Double-Negation-Elimination ℓ\n em⇒dne em = decidable-stable em\n\n dne⇒em : ∀ {ℓ} → Double-Negation-Elimination ℓ → Excluded-Middle ℓ\n dne⇒em dne = dne excluded-middle\n", "meta": {"hexsha": "ba2ce61e6e5c027971ea61e05b1a6fa33298ccf2", "size": 6029, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Relation/Nullary/Negation.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Relation/Nullary/Negation.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Relation/Nullary/Negation.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.0773195876, "max_line_length": 72, "alphanum_fraction": 0.5249626804, "num_tokens": 2246, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8354835207180245, "lm_q2_score": 0.8152324871074608, "lm_q1q2_score": 0.6811133085322528}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Cubical.HITs.Interval.Base where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Foundations.Prelude\n\ndata Interval : Type₀ where\n zero : Interval\n one : Interval\n seg : zero ≡ one\n\nisContrInterval : isContr Interval\nisContrInterval = (zero , (λ x → rem x))\n where\n rem : (x : Interval) → zero ≡ x\n rem zero = refl\n rem one = seg\n rem (seg i) j = seg (i ∧ j)\n\nfunExtInterval : ∀ {ℓ} (A B : Type ℓ) (f g : A → B) → ((x : A) → f x ≡ g x) → f ≡ g\nfunExtInterval A B f g p = λ i x → hmtpy x (seg i)\n where\n hmtpy : A → Interval → B\n hmtpy x zero = f x\n hmtpy x one = g x\n hmtpy x (seg i) = p x i\n\nintervalElim : (A : Interval → Type₀) (x : A zero) (y : A one)\n (p : PathP (λ i → A (seg i)) x y) → (x : Interval) → A x\nintervalElim A x y p zero = x\nintervalElim A x y p one = y\nintervalElim A x y p (seg i) = p i\n\n-- Note that this is not definitional (it is not proved by refl)\nintervalEta : ∀ {A : Type₀} (f : Interval → A) → intervalElim _ (f zero) (f one) (λ i → f (seg i)) ≡ f\nintervalEta f i zero = f zero\nintervalEta f i one = f one\nintervalEta f i (seg j) = f (seg j)\n", "meta": {"hexsha": "a454a7fb92c6843782421ae0fa0e7741b6cbf6a8", "size": 1182, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/HITs/Interval/Base.agda", "max_stars_repo_name": "limemloh/cubical", "max_stars_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/HITs/Interval/Base.agda", "max_issues_repo_name": "limemloh/cubical", "max_issues_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/HITs/Interval/Base.agda", "max_forks_repo_name": "limemloh/cubical", "max_forks_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.55, "max_line_length": 102, "alphanum_fraction": 0.5922165821, "num_tokens": 427, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278571786139, "lm_q2_score": 0.7718434978390747, "lm_q1q2_score": 0.6810962038753808}} {"text": "{-# OPTIONS --no-exact-split --safe #-}\nmodule Cubical.Data.Nat.Base where\n\nopen import Cubical.Core.Primitives\n\nopen import Agda.Builtin.Nat public\n using (zero; suc; _+_)\n renaming (Nat to ℕ; _-_ to _∸_; _*_ to _·_)\n\nopen import Cubical.Data.Nat.Literals public\nopen import Cubical.Data.Bool.Base\nopen import Cubical.Data.Sum.Base hiding (elim)\nopen import Cubical.Data.Empty.Base hiding (elim)\nopen import Cubical.Data.Unit.Base\n\npredℕ : ℕ → ℕ\npredℕ zero = zero\npredℕ (suc n) = n\n\ncaseNat : ∀ {ℓ} → {A : Type ℓ} → (a0 aS : A) → ℕ → A\ncaseNat a0 aS zero = a0\ncaseNat a0 aS (suc n) = aS\n\ndoubleℕ : ℕ → ℕ\ndoubleℕ zero = zero\ndoubleℕ (suc x) = suc (suc (doubleℕ x))\n\n-- doublesℕ n m = 2^n · m\ndoublesℕ : ℕ → ℕ → ℕ\ndoublesℕ zero m = m\ndoublesℕ (suc n) m = doublesℕ n (doubleℕ m)\n\n-- iterate\niter : ∀ {ℓ} {A : Type ℓ} → ℕ → (A → A) → A → A\niter zero f z = z\niter (suc n) f z = f (iter n f z)\n\nelim : ∀ {ℓ} {A : ℕ → Type ℓ}\n → A zero\n → ((n : ℕ) → A n → A (suc n))\n → (n : ℕ) → A n\nelim a₀ _ zero = a₀\nelim a₀ f (suc n) = f n (elim a₀ f n)\n\nisEven isOdd : ℕ → Bool\nisEven zero = true\nisEven (suc n) = isOdd n\nisOdd zero = false\nisOdd (suc n) = isEven n\n\n--Typed version\nprivate\n toType : Bool → Type\n toType false = ⊥\n toType true = Unit\n\nisEvenT : ℕ → Type\nisEvenT n = toType (isEven n)\n\nisOddT : ℕ → Type\nisOddT n = isEvenT (suc n)\n\nisZero : ℕ → Bool\nisZero zero = true\nisZero (suc n) = false\n\n-- exponential\n\n_^_ : ℕ → ℕ → ℕ\nm ^ 0 = 1\nm ^ (suc n) = m · m ^ n\n", "meta": {"hexsha": "427cdb8a2ebf676e931124bc70302c05497da6e7", "size": 1472, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/Nat/Base.agda", "max_stars_repo_name": "howsiyu/cubical", "max_stars_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/Nat/Base.agda", "max_issues_repo_name": "howsiyu/cubical", "max_issues_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/Nat/Base.agda", "max_forks_repo_name": "howsiyu/cubical", "max_forks_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.4444444444, "max_line_length": 52, "alphanum_fraction": 0.6168478261, "num_tokens": 591, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.86153820232079, "lm_q2_score": 0.7905303260722198, "lm_q1q2_score": 0.6810720760043283}} {"text": "module ReasoningEx where\n\nopen import Prelude\nopen import T\nopen import Contexts\nopen import Eq\nopen import Eq.Theory\nopen import Eq.ObsTheory\n\n---- some example programs\n-- boy, de bruijn indexes are unreadable\nw = weaken-closed\n\nplus-rec : ∀{Γ} → TExp Γ nat → TExp Γ nat → TExp Γ nat\nplus-rec n m = rec n m (suc (var Z))\n\nt-plus1 : TCExp (nat ⇒ nat ⇒ nat)\nt-plus1 = Λ (Λ (plus-rec (var Z) (var (S Z))))\nt-plus2 : TCExp (nat ⇒ nat ⇒ nat)\nt-plus2 = Λ (Λ (plus-rec (var (S Z)) (var Z)))\n\nplus-adds : ∀{Γ} → (n : Nat) (m : Nat) →\n Γ ⊢ plus-rec (t-numeral n) (t-numeral m) ≅ t-numeral (n +n m) :: nat\nplus-adds Z m = obs-contains-def def-rec-z\nplus-adds {Γ} (S n) m with\n (def-rec-s {Γ} {e = (t-numeral n)} {e0 = t-numeral m} {es = suc (var Z)})\n-- If I don't name the def eq thing above and use it directly, agda uses all my core.\n... | bullshit-workaround with obs-contains-def bullshit-workaround\n... | step-eq with obs-congruence (plus-adds {Γ} n m) (suc ∘)\n... | reccase = obs-trans step-eq reccase\n\n\nhelp : (n : Nat) → ObservEq (nat :: []) nat\n (rec (t-numeral n) (var Z) (suc (var Z)))\n (rec (var Z) (t-numeral n) (suc (var Z)))\nhelp n = {!!}\n\nplus-commutes : [] ⊢ t-plus1 ≅ t-plus2 :: nat ⇒ nat ⇒ nat\nplus-commutes with\n def-cong (def-beta {e = Λ (plus-rec (var Z) (var (S Z)))} {e' = var (S Z)}) (∘ $e var Z) |\n def-cong (def-beta {e = Λ (plus-rec (var (S Z)) (var Z))} {e' = var (S Z)}) (∘ $e var Z)\n... | beq1 | beq2 with def-beta {e = plus-rec (var Z) (var (S (S Z)))} {e' = var Z} |\n def-beta {e = plus-rec (var (S (S Z))) (var Z)} {e' = var Z}\n... | beq1' | beq2' with obs-contains-def (def-trans beq1 beq1') | obs-contains-def (def-trans beq2 beq2')\n... | oeq1 | oeq2 with function-induction-obs help\n... | main-eq with obs-trans oeq1 (obs-trans main-eq (obs-sym oeq2))\n... | lol = function-ext-obs (function-ext-obs lol)\n", "meta": {"hexsha": "fceb0f0a964fccbe6fc9af70214038f99fdf8d87", "size": 1906, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "ReasoningEx.agda", "max_stars_repo_name": "msullivan/godels-t", "max_stars_repo_head_hexsha": "7412725cf27873b2b23f7e411a236a97dd99ef91", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2016-12-25T01:52:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-22T00:28:03.000Z", "max_issues_repo_path": "ReasoningEx.agda", "max_issues_repo_name": "msullivan/godels-t", "max_issues_repo_head_hexsha": "7412725cf27873b2b23f7e411a236a97dd99ef91", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ReasoningEx.agda", "max_forks_repo_name": "msullivan/godels-t", "max_forks_repo_head_hexsha": "7412725cf27873b2b23f7e411a236a97dd99ef91", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-04-26T11:39:14.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-04T22:37:18.000Z", "avg_line_length": 39.7083333333, "max_line_length": 106, "alphanum_fraction": 0.5844700944, "num_tokens": 703, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8615382094310357, "lm_q2_score": 0.7905303087996143, "lm_q1q2_score": 0.6810720667441834}} {"text": "module Prelude where\n open import Agda.Primitive using (Level; lzero; lsuc) renaming (_⊔_ to lmax)\n\n -- empty type\n data ⊥ : Set where\n\n -- from false, derive whatever\n abort : ∀ {C : Set} → ⊥ → C\n abort ()\n\n -- unit\n data ⊤ : Set where\n <> : ⊤\n\n -- sums\n data _+_ (A B : Set) : Set where\n Inl : A → A + B\n Inr : B → A + B\n\n -- pairs\n infixr 1 _,_\n record Σ {l1 l2 : Level} (A : Set l1) (B : A → Set l2) : Set (lmax l1 l2) where\n constructor _,_\n field\n π1 : A\n π2 : B π1\n open Σ public\n\n -- Sigma types, or dependent pairs, with nice notation.\n syntax Σ A (\\ x -> B) = Σ[ x ∈ A ] B\n\n _×_ : {l1 : Level} {l2 : Level} → (Set l1) → (Set l2) → Set (lmax l1 l2)\n A × B = Σ A λ _ → B\n\n infixr 1 _×_\n infixr 1 _+_\n\n -- equality\n data _==_ {l : Level} {A : Set l} (M : A) : A → Set l where\n refl : M == M\n\n infixr 9 _==_\n\n -- disequality\n _≠_ : {l : Level} {A : Set l} → (a b : A) → Set l\n a ≠ b = (a == b) → ⊥\n\n {-# BUILTIN EQUALITY _==_ #-}\n\n -- transitivity of equality\n _·_ : {l : Level} {α : Set l} {x y z : α} → x == y → y == z → x == z\n refl · refl = refl\n\n -- symmetry of equality\n ! : {l : Level} {α : Set l} {x y : α} → x == y → y == x\n ! refl = refl\n\n -- ap, in the sense of HoTT, that all functions respect equality in their\n -- arguments. named in a slightly non-standard way to avoid naming\n -- clashes with hazelnut constructors.\n ap1 : {l1 l2 : Level} {α : Set l1} {β : Set l2} {x y : α} (F : α → β)\n → x == y → F x == F y\n ap1 F refl = refl\n\n -- transport, in the sense of HoTT, that fibrations respect equality\n tr : {l1 l2 : Level} {α : Set l1} {x y : α}\n (B : α → Set l2)\n → x == y\n → B x\n → B y\n tr B refl x₁ = x₁\n\n -- options\n data Maybe (A : Set) : Set where\n Some : A → Maybe A\n None : Maybe A\n\n -- the some constructor is injective. perhaps unsurprisingly.\n someinj : {A : Set} {x y : A} → Some x == Some y → x == y\n someinj refl = refl\n\n -- some isn't none.\n somenotnone : {A : Set} {x : A} → Some x == None → ⊥\n somenotnone ()\n\n -- function extensionality, used to reason about contexts as finite\n -- functions.\n postulate\n funext : {A : Set} {B : A → Set} {f g : (x : A) → (B x)} →\n ((x : A) → f x == g x) → f == g\n\n -- non-equality is commutative\n flip : {A : Set} {x y : A} → (x == y → ⊥) → (y == x → ⊥)\n flip neq eq = neq (! eq)\n\n -- two types are said to be equivalent, or isomorphic, if there is a pair\n -- of functions between them where both round-trips are stable up to ==\n _≃_ : Set → Set → Set\n _≃_ A B = Σ[ f ∈ (A → B) ] Σ[ g ∈ (B → A) ]\n (((a : A) → g (f a) == a) × (((b : B) → f (g b) == b)))\n", "meta": {"hexsha": "dfeefa1af3e66f5827393f529a82a468873ff2d8", "size": 2735, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Prelude.agda", "max_stars_repo_name": "hazelgrove/hazelnut-agda", "max_stars_repo_head_hexsha": "a3640d7b0f76cdac193afd382694197729ed6d57", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Prelude.agda", "max_issues_repo_name": "hazelgrove/hazelnut-agda", "max_issues_repo_head_hexsha": "a3640d7b0f76cdac193afd382694197729ed6d57", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Prelude.agda", "max_forks_repo_name": "hazelgrove/hazelnut-agda", "max_forks_repo_head_hexsha": "a3640d7b0f76cdac193afd382694197729ed6d57", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.0792079208, "max_line_length": 81, "alphanum_fraction": 0.5038391225, "num_tokens": 1030, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.847967769904032, "lm_q2_score": 0.8031738034238806, "lm_q1q2_score": 0.6810654989346874}} {"text": "{-\n\nThis is a HoTT-UF core library based on cubical type theory, where the\ncubical machinery is hidden, using the HoTT Book terminology and\nnotation.\n\nThe point is that function extensionality, propositional truncation\nand univalence compute (an example is given below).\n\nFor the moment, this requires the development version of Agda.\n\n-}\n\n{-# OPTIONS --cubical --exact-split --safe #-}\n\nmodule Cubical.Foundations.HoTT-UF where\n\nopen import Cubical.Core.Primitives hiding ( _≡_ )\nopen import Cubical.Core.Id public\n\nopen import Cubical.Foundations.Id public\n using ( _≡_ -- The identity type.\n ; refl -- Unfortunately, pattern matching on refl is not available.\n ; J -- Until it is, you have to use the induction principle J.\n\n ; transport -- As in the HoTT Book.\n ; ap\n ; _∙_\n ; _⁻¹\n\n ; _≡⟨_⟩_ -- Standard equational reasoning.\n ; _∎\n\n ; funExt -- Function extensionality\n -- (can also be derived from univalence).\n\n ; Σ -- Sum type. Needed to define contractible types, equivalences\n ; _,_ -- and univalence.\n ; pr₁ -- The eta rule is available.\n ; pr₂\n\n ; isProp -- The usual notions of proposition, contractible type, set.\n ; isContr\n ; isSet\n\n ; isEquiv -- A map with contractible fibers\n -- (Voevodsky's version of the notion).\n ; _≃_ -- The type of equivalences between two given types.\n ; EquivContr -- A formulation of univalence.\n\n ; ∥_∥ -- Propositional truncation.\n ; ∣_∣ -- Map into the propositional truncation.\n ; ∥∥-isProp -- A truncated type is a proposition.\n ; ∥∥-recursion -- Non-dependent elimination.\n ; ∥∥-induction -- Dependent elimination.\n )\n\n{-\n\nHere is an illustration of how function extensionality computes.\n\n-}\n\nprivate\n\n data ℕ : Type₀ where\n zero : ℕ\n succ : ℕ → ℕ\n\n f g : ℕ → ℕ\n\n f n = n\n\n g zero = zero\n g (succ n) = succ (g n)\n\n h : (n : ℕ) → f n ≡ g n\n h zero = refl\n h (succ n) = ap succ (h n)\n\n p : f ≡ g\n p = funExt h\n\n five : ℕ\n five = succ (succ (succ (succ (succ zero))))\n\n a : Σ ℕ (λ n → f n ≡ five)\n a = five , refl\n\n b : Σ ℕ (λ n → g n ≡ five)\n b = transport (λ - → Σ ℕ (λ n → - n ≡ five)) p a\n\n c : pr₁ b ≡ five\n c = refl\n\n{-\n\nIf we had funExt as a postulate, then the definition of c would not\ntype check. Moreover, the term pr₁ b would not evaluate to five, as it\ndoes with the cubical type theory implementation of funext.\n\nTODO. A similar computational example with univalence.\n\n-}\n", "meta": {"hexsha": "51eadf7e64687bae04ead5286611318deffb8517", "size": 2820, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Foundations/HoTT-UF.agda", "max_stars_repo_name": "limemloh/cubical", "max_stars_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Foundations/HoTT-UF.agda", "max_issues_repo_name": "limemloh/cubical", "max_issues_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Foundations/HoTT-UF.agda", "max_forks_repo_name": "limemloh/cubical", "max_forks_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.8571428571, "max_line_length": 90, "alphanum_fraction": 0.5609929078, "num_tokens": 745, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677506936878, "lm_q2_score": 0.8031737987125612, "lm_q1q2_score": 0.6810654795103953}} {"text": "-- Issue #2814 reported by tomjack on 2017-10-18\n\n{-# OPTIONS --cubical --rewriting #-}\n\n-- prelude stolen from Saizan/cubical-demo\n\nopen import Agda.Primitive.Cubical public\n\npostulate\n Path' : ∀ {ℓ} {A : Set ℓ} → A → A → Set ℓ\n PathP : ∀ {ℓ} (A : I → Set ℓ) → A i0 → A i1 → Set ℓ\n\n{-# BUILTIN PATHP PathP #-}\n\ninfix 4 _≡_\n_≡_ : ∀ {ℓ} {A : Set ℓ} → A → A → Set ℓ\n_≡_ {A = A} = PathP (λ _ → A)\n\nPath = _≡_\n\nrefl : ∀ {ℓ} {A : Set ℓ} {x : A} → x ≡ x\nrefl {x = x} = λ _ → x\n\npostulate\n Rewrite : ∀ {ℓ} {A : Set ℓ} → A → A → Set\n\n{-# BUILTIN REWRITE Rewrite #-}\n\n\n\nmodule Good where\n postulate\n Unit : Set\n unit : Unit\n\n module UnitElim (P : Unit → Set) (unit* : P unit) where\n postulate\n Unit-elim : (x : Unit) → P x\n unit-β : Rewrite (Unit-elim unit) unit*\n open UnitElim public\n {-# REWRITE unit-β #-}\n\n test₁ : {C : Set} {c₀ : C} → Path {A = C} (Unit-elim (λ _ → C) c₀ unit) c₀\n test₁ = refl\n\n test₂ : {C : Set} {c₀ : C} → Path {A = Path c₀ c₀} (λ j → Unit-elim (λ _ → C) c₀ unit) refl\n test₂ = refl\n\n\n-- same code, but with a dummy module parameter\nmodule Bad (Dummy : Set) where\n postulate\n Unit : Set\n unit : Unit\n\n module UnitElim (P : Unit → Set) (unit* : P unit) where\n postulate\n Unit-elim : (x : Unit) → P x\n unit-β : Rewrite (Unit-elim unit) unit*\n open UnitElim public\n {-# REWRITE unit-β #-}\n\n test₁ : {C : Set} {c₀ : C} → Path {A = C} (Unit-elim (λ _ → C) c₀ unit) c₀\n test₁ = refl\n test₂ : {C : Set} {c₀ : C} → Path {A = Path c₀ c₀} (λ j → Unit-elim (λ _ → C) c₀ unit) refl\n test₂ = refl\n\n\n-- WAS:\n-- Unit-elim (λ _ → .C) .c₀ unit != .c₀ of type .C\n-- when checking that the expression refl has type\n-- Path (λ j → Unit-elim (λ _ → .C) .c₀ unit) refl\n\n-- SHOULD: succeed\n", "meta": {"hexsha": "2dab48ecf836001a7bce9650c569059da7262f07", "size": 1762, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2814.agda", "max_stars_repo_name": "alhassy/agda", "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Succeed/Issue2814.agda", "max_issues_repo_name": "alhassy/agda", "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/Issue2814.agda", "max_forks_repo_name": "alhassy/agda", "max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.4933333333, "max_line_length": 93, "alphanum_fraction": 0.5539160045, "num_tokens": 697, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887588023318196, "lm_q2_score": 0.7662936430859598, "lm_q1q2_score": 0.6810502204635644}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Category.Construction.Properties.EilenbergMoore where\n\nopen import Level\nimport Relation.Binary.PropositionalEquality as ≡\n\nopen import Categories.Adjoint\nopen import Categories.Adjoint.Properties\nopen import Categories.Category\nopen import Categories.Functor using (Functor; _∘F_)\nopen import Categories.Functor.Equivalence\nopen import Categories.Monad\n\nopen import Categories.NaturalTransformation renaming (id to idN)\nopen import Categories.Morphism.HeterogeneousIdentity\n\nopen import Categories.Adjoint.Construction.EilenbergMoore\nopen import Categories.Category.Construction.EilenbergMoore\n\nprivate\n variable\n o ℓ e : Level\n 𝒞 𝒟 : Category o ℓ e\n\nmodule _ {F : Functor 𝒞 𝒟} {G : Functor 𝒟 𝒞} (F⊣G : Adjoint F G) where\n private\n T : Monad 𝒞\n T = adjoint⇒monad F⊣G\n\n 𝒞ᵀ : Category _ _ _\n 𝒞ᵀ = EilenbergMoore T\n\n module 𝒞 = Category 𝒞\n module 𝒟 = Category 𝒟\n module 𝒞ᵀ = Category 𝒞ᵀ\n\n open 𝒞.HomReasoning\n\n module T = Monad T\n module F = Functor F\n module G = Functor G\n\n open Adjoint F⊣G\n open NaturalTransformation\n\n -- Maclane's Comparison Functor\n ComparisonF : Functor 𝒟 𝒞ᵀ\n ComparisonF = record\n { F₀ = λ X → record\n { A = G.F₀ X\n ; action = G.F₁ (counit.η X)\n ; commute = commute (G ∘ˡ counit) (counit.η X)\n ; identity = zag\n }\n ; F₁ = λ {A} {B} f → record\n { arr = G.F₁ f\n ; commute = begin\n 𝒞 [ G.F₁ f ∘ G.F₁ (counit.η A) ] ≈˘⟨ G.homomorphism ⟩\n G.F₁ (𝒟 [ f ∘ (counit.η A) ]) ≈˘⟨ G.F-resp-≈ (counit.commute f) ⟩\n G.F₁ (𝒟 [ counit.η B ∘ F.F₁ (G.F₁ f) ]) ≈⟨ G.homomorphism ⟩\n 𝒞 [ G.F₁ (counit.η B) ∘ G.F₁ (F.F₁ (G.F₁ f)) ] ∎\n }\n ; identity = G.identity\n ; homomorphism = G.homomorphism\n ; F-resp-≈ = G.F-resp-≈\n }\n\n private\n K = ComparisonF \n module K = Functor K\n module Gᵀ = Functor (Forgetful T)\n module Fᵀ = Functor (Free T)\n\n Comparison∘F≡Free : (ComparisonF ∘F F) ≡F Free T\n Comparison∘F≡Free = record\n { eq₀ = λ X → ≡.refl\n ; eq₁ = λ {A} {B} f → begin\n Module⇒.arr (𝒞ᵀ [ (hid 𝒞ᵀ ≡.refl) ∘ K.F₁ (F.F₁ f) ]) ≈⟨ hid-refl 𝒞ᵀ {A = K.F₀ (F.F₀ B)} ⟩∘⟨refl ⟩\n Module⇒.arr (𝒞ᵀ [ 𝒞ᵀ.id ∘ K.F₁ (F.F₁ f) ]) ≈⟨ 𝒞.identityˡ {f = Module⇒.arr (K.F₁ (F.F₁ f))} ⟩\n Module⇒.arr (K.F₁ (F.F₁ f)) ≈⟨ refl ⟩\n Module⇒.arr (Fᵀ.F₁ f) ≈˘⟨ 𝒞ᵀ.identityʳ {f = Fᵀ.F₁ f} ⟩\n Module⇒.arr (𝒞ᵀ [ Fᵀ.F₁ f ∘ 𝒞ᵀ.id ]) ≈˘⟨ refl⟩∘⟨ hid-refl 𝒞ᵀ {A = Fᵀ.F₀ A} ⟩\n Module⇒.arr (𝒞ᵀ [ Fᵀ.F₁ f ∘ (hid 𝒞ᵀ ≡.refl) ]) ∎\n }\n\n Forgetful∘ComparisonF≡G : (Forgetful T ∘F ComparisonF) ≡F G\n Forgetful∘ComparisonF≡G = record\n { eq₀ = λ X → ≡.refl\n ; eq₁ = λ f → begin\n 𝒞 [ (hid 𝒞 ≡.refl) ∘ (Gᵀ.F₁ (K.F₁ f)) ] ≈⟨ hid-refl 𝒞 ⟩∘⟨refl ⟩\n 𝒞 [ 𝒞.id ∘ (Gᵀ.F₁ (K.F₁ f)) ] ≈⟨ 𝒞.identityˡ ⟩\n (Gᵀ.F₁ (K.F₁ f)) ≈⟨ refl ⟩\n G.F₁ f ≈˘⟨ 𝒞.identityʳ ⟩\n 𝒞 [ G.F₁ f ∘ 𝒞.id ] ≈˘⟨ refl⟩∘⟨ hid-refl 𝒞 ⟩\n 𝒞 [ G.F₁ f ∘ (hid 𝒞 ≡.refl) ] ∎\n }\n", "meta": {"hexsha": "0e036e3b65998f1899638ae78af17c9f2af3a975", "size": 3188, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Construction/Properties/EilenbergMoore.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Construction/Properties/EilenbergMoore.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Construction/Properties/EilenbergMoore.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.8659793814, "max_line_length": 109, "alphanum_fraction": 0.5461104141, "num_tokens": 1362, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467548438126, "lm_q2_score": 0.7745833841649233, "lm_q1q2_score": 0.6809724685445305}} {"text": "{-# OPTIONS --exact-split #-}\n\nmodule ExactSplitParity where\n\ndata Bool : Set where\n true false : Bool\n\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n\nparity : ℕ → ℕ → Bool\nparity zero zero = true\nparity zero (suc zero) = false\nparity zero (suc (suc n)) = parity zero n\nparity (suc zero) zero = false\nparity (suc (suc m)) zero = parity m zero\nparity (suc m) (suc n) = parity m n\n", "meta": {"hexsha": "906b4b79abb4f93731d0172ac8acb87ff8b08c14", "size": 451, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Fail/ExactSplitParity.agda", "max_stars_repo_name": "alhassy/agda", "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/Fail/ExactSplitParity.agda", "max_issues_repo_name": "alhassy/agda", "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Fail/ExactSplitParity.agda", "max_forks_repo_name": "alhassy/agda", "max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 23.7368421053, "max_line_length": 50, "alphanum_fraction": 0.5498891353, "num_tokens": 134, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9353465116437761, "lm_q2_score": 0.7279754430043072, "lm_q1q2_score": 0.6809092911764113}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n-- Definitions for the types of a polynomial stored in sparse horner\n-- normal form.\n--\n-- These definitions ensure that the polynomial is actually in fully\n-- canonical form, with no trailing zeroes, etc.\n\nopen import Polynomial.Parameters\n\nmodule Polynomial.NormalForm.Definition\n {a ℓ}\n (coeffs : RawCoeff a ℓ)\n where\n\nopen import Polynomial.NormalForm.InjectionIndex\n\nopen import Relation.Nullary using (¬_)\nopen import Level using (_⊔_)\nopen import Data.Empty using (⊥)\nopen import Data.Unit using (⊤)\nopen import Data.Nat using (ℕ; suc; zero)\nopen import Data.Bool using (T)\nopen import Data.List.Kleene public\n\ninfixl 6 _Δ_\nrecord PowInd {c} (C : Set c) : Set c where\n inductive\n constructor _Δ_\n field\n coeff : C\n pow : ℕ\nopen PowInd public\n\nopen RawCoeff coeffs\n\nmutual\n -- A Polynomial is indexed by the number of variables it contains.\n infixl 6 _Π_\n record Poly (n : ℕ) : Set a where\n inductive\n constructor _Π_\n field\n {i} : ℕ\n flat : FlatPoly i\n i≤n : i ≤′ n\n\n data FlatPoly : ℕ → Set a where\n Κ : Carrier → FlatPoly zero\n Σ : ∀ {n} → (xs : Coeff n +) → .{xn : Norm xs} → FlatPoly (suc n)\n\n -- A list of coefficients, paired with the exponent *gap* from the\n -- preceding coefficient. In other words, to represent the\n -- polynomial:\n --\n -- 3 + 2x² + 4x⁵ + 2x⁷\n --\n -- We write:\n --\n -- [(3,0),(2,1),(4,2),(2,1)]\n --\n -- Which can be thought of as a representation of the expression:\n --\n -- x⁰ * (3 + x * x¹ * (2 + x * x² * (4 + x * x¹ * (2 + x * 0))))\n --\n -- This is sparse Horner normal form.\n\n Coeff : ℕ → Set a\n Coeff n = PowInd (NonZero n)\n\n -- We disallow zeroes in the coefficient list. This condition alone\n -- is enough to ensure a unique representation for any polynomial.\n infixl 6 _≠0\n record NonZero (i : ℕ) : Set a where\n inductive\n constructor _≠0\n field\n poly : Poly i\n .{poly≠0} : ¬ Zero poly\n\n -- This predicate is used (in its negation) to ensure that no\n -- coefficient is zero, preventing any trailing zeroes.\n Zero : ∀ {n} → Poly n → Set\n Zero (Κ x Π _) = T (Zero-C x)\n Zero (Σ _ Π _) = ⊥\n\n -- This predicate is used to ensure that all polynomials are in\n -- normal form: if a particular level is constant, than it can\n -- be collapsed into the level below it.\n Norm : ∀ {i} → Coeff i + → Set\n Norm (_ Δ zero & []) = ⊥\n Norm (_ Δ zero & ∹ _) = ⊤\n Norm (_ Δ suc _ & _) = ⊤\nopen NonZero public\nopen Poly public\n", "meta": {"hexsha": "95dfdbf1394d6f4aeca74f3b9f8aff753615ec07", "size": 2536, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Polynomial/NormalForm/Definition.agda", "max_stars_repo_name": "mckeankylej/agda-ring-solver", "max_stars_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-01-25T16:40:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T00:57:55.000Z", "max_issues_repo_path": "src/Polynomial/NormalForm/Definition.agda", "max_issues_repo_name": "mckeankylej/agda-ring-solver", "max_issues_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2019-04-17T20:48:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T01:55:42.000Z", "max_forks_repo_path": "src/Polynomial/NormalForm/Definition.agda", "max_forks_repo_name": "mckeankylej/agda-ring-solver", "max_forks_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2019-04-16T02:23:16.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-20T07:07:11.000Z", "avg_line_length": 26.4166666667, "max_line_length": 69, "alphanum_fraction": 0.6253943218, "num_tokens": 796, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357598021707, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.6808906264657262}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Convenient syntax for reasoning with a setoid\n------------------------------------------------------------------------\n\n-- Example use:\n\n-- n*0≡0 : ∀ n → n * 0 ≡ 0\n-- n*0≡0 zero = refl\n-- n*0≡0 (suc n) = begin\n-- suc n * 0 ≈⟨ refl ⟩\n-- n * 0 + 0 ≈⟨ ... ⟩\n-- n * 0 ≈⟨ n*0≡0 n ⟩\n-- 0 ∎\n\n-- Module `≡-Reasoning` in `Relation.Binary.PropositionalEquality`\n-- is recommended for equational reasoning when the underlying equality is\n-- `_≡_`.\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary\n\nmodule Relation.Binary.Reasoning.Setoid {s₁ s₂} (S : Setoid s₁ s₂) where\n\nopen Setoid S\n\n------------------------------------------------------------------------\n-- Reasoning combinators\n\nopen import Relation.Binary.Reasoning.PartialSetoid partialSetoid public\nopen import Relation.Binary.Reasoning.Base.Single _≈_ refl trans public\n using (_∎)\n", "meta": {"hexsha": "9bdd00a09cc574b1cba4221a5db6bba17e9e40fe", "size": 980, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Relation/Binary/Reasoning/Setoid.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Relation/Binary/Reasoning/Setoid.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Relation/Binary/Reasoning/Setoid.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 28.0, "max_line_length": 74, "alphanum_fraction": 0.506122449, "num_tokens": 262, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8670357598021708, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.6808906264657262}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\nopen import Categories.Category.Monoidal\n\nmodule Categories.Category.Monoidal.Symmetric {o ℓ e} {C : Category o ℓ e} (M : Monoidal C) where\n\nopen import Level\n\nopen import Data.Product using (Σ; _,_)\n\nopen import Categories.Functor.Bifunctor\nopen import Categories.Functor.Properties\nopen import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)\n\nopen import Categories.Morphism C\nopen import Categories.Morphism.Properties C\nopen import Categories.Category.Monoidal.Braided M\nopen Category C\nopen Commutation\n\nprivate\n variable\n X Y Z : Obj\n\n-- symmetric monoidal category\n-- commutative braided monoidal category\n--\n-- the reason why we define symmetric categories via braided monoidal categories could\n-- be not obvious, but it is the right definition: it requires again a redundant\n-- hexagon proof which allows achieves definitional equality of the opposite.\nrecord Symmetric : Set (levelOfTerm M) where\n field\n braided : Braided\n\n module braided = Braided braided\n open braided public\n\n private\n B : ∀ {X Y} → X ⊗₀ Y ⇒ Y ⊗₀ X\n B {X} {Y} = braiding.⇒.η (X , Y)\n\n field\n commutative : B {X} {Y} ∘ B {Y} {X} ≈ id\n\n braided-iso : X ⊗₀ Y ≅ Y ⊗₀ X\n braided-iso = record\n { from = B\n ; to = B\n ; iso = record\n { isoˡ = commutative\n ; isoʳ = commutative\n }\n }\n\n module braided-iso {X Y} = _≅_ (braided-iso {X} {Y})\n\nprivate\n record Symmetric′ : Set (levelOfTerm M) where\n open Monoidal M\n \n field\n braiding : NaturalIsomorphism ⊗ (flip-bifunctor ⊗)\n \n module braiding = NaturalIsomorphism braiding\n \n private\n B : ∀ {X Y} → X ⊗₀ Y ⇒ Y ⊗₀ X\n B {X} {Y} = braiding.⇒.η (X , Y)\n \n field\n commutative : B {X} {Y} ∘ B {Y} {X} ≈ id\n hexagon : [ (X ⊗₀ Y) ⊗₀ Z ⇒ Y ⊗₀ Z ⊗₀ X ]⟨\n B ⊗₁ id ⇒⟨ (Y ⊗₀ X) ⊗₀ Z ⟩\n associator.from ⇒⟨ Y ⊗₀ X ⊗₀ Z ⟩\n id ⊗₁ B\n ≈ associator.from ⇒⟨ X ⊗₀ Y ⊗₀ Z ⟩\n B ⇒⟨ (Y ⊗₀ Z) ⊗₀ X ⟩\n associator.from\n ⟩\n \n braided-iso : X ⊗₀ Y ≅ Y ⊗₀ X\n braided-iso = record\n { from = B\n ; to = B\n ; iso = record\n { isoˡ = commutative\n ; isoʳ = commutative\n }\n }\n \n module braided-iso {X Y} = _≅_ (braided-iso {X} {Y})\n \n -- we don't define [Symmetric] from [Braided] because we want to avoid asking\n -- [hexagon₂], which can readily be proven using the [hexagon] and [commutative].\n braided : Braided\n braided = record\n { braiding = braiding\n ; hexagon₁ = hexagon\n ; hexagon₂ = λ {X Y Z} →\n Iso-≈ hexagon\n (Iso-∘ (Iso-∘ ([ -⊗ Y ]-resp-Iso braided-iso.iso) associator.iso)\n ([ X ⊗- ]-resp-Iso braided-iso.iso))\n (Iso-∘ (Iso-∘ associator.iso braided-iso.iso)\n associator.iso)\n }\n \n\nsymmetricHelper : Symmetric′ → Symmetric\nsymmetricHelper S = record\n { braided = braided\n ; commutative = commutative\n }\n where open Symmetric′ S\n", "meta": {"hexsha": "1eec886a840b27e77fec8ef6de42632bfafdf811", "size": 3271, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Monoidal/Symmetric.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Monoidal/Symmetric.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Monoidal/Symmetric.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.4434782609, "max_line_length": 97, "alphanum_fraction": 0.5625191073, "num_tokens": 1015, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110396870287, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6808832537588834}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Rings.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.IntegralDomains.Definition\nopen import Rings.IntegralDomains.Lemmas\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Fields.FieldOfFractions.Setoid {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (I : IntegralDomain R) where\n\nrecord fieldOfFractionsSet : Set (a ⊔ b) where\n field\n num : A\n denom : A\n .denomNonzero : (Setoid._∼_ S denom (Ring.0R R) → False)\n\nfieldOfFractionsSetoid : Setoid fieldOfFractionsSet\nSetoid._∼_ fieldOfFractionsSetoid (record { num = a ; denom = b ; denomNonzero = b!=0 }) (record { num = c ; denom = d ; denomNonzero = d!=0 }) = Setoid._∼_ S (a * d) (b * c)\nEquivalence.reflexive (Setoid.eq fieldOfFractionsSetoid) {record { num = a ; denom = b ; denomNonzero = b!=0 }} = Ring.*Commutative R\nEquivalence.symmetric (Setoid.eq fieldOfFractionsSetoid) {record { num = a ; denom = b ; denomNonzero = b!=0 }} {record { num = c ; denom = d ; denomNonzero = d!=0 }} ad=bc = transitive (Ring.*Commutative R) (transitive (symmetric ad=bc) (Ring.*Commutative R))\n where\n open Equivalence (Setoid.eq S)\nEquivalence.transitive (Setoid.eq fieldOfFractionsSetoid) {record { num = a ; denom = b ; denomNonzero = b!=0 }} {record { num = c ; denom = d ; denomNonzero = d!=0 }} {record { num = e ; denom = f ; denomNonzero = f!=0 }} ad=bc cf=de = p5\n where\n open Setoid S\n open Ring R\n open Equivalence eq\n p : (a * d) * f ∼ (b * c) * f\n p = Ring.*WellDefined R ad=bc reflexive\n p2 : (a * f) * d ∼ b * (d * e)\n p2 = transitive (transitive (symmetric *Associative) (transitive (*WellDefined reflexive *Commutative) *Associative)) (transitive p (transitive (symmetric *Associative) (*WellDefined reflexive cf=de)))\n p3 : (a * f) * d ∼ (b * e) * d\n p3 = transitive p2 (transitive (*WellDefined reflexive *Commutative) *Associative)\n p4 : ((d ∼ 0R) → False) → ((a * f) ∼ (b * e))\n p4 = cancelIntDom I (transitive *Commutative (transitive p3 *Commutative))\n p5 : (a * f) ∼ (b * e)\n p5 = p4 λ t → exFalso (d!=0 t)\n", "meta": {"hexsha": "fd670c6985f95fedf712bbbc341f0d34610c3cea", "size": 2238, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Fields/FieldOfFractions/Setoid.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Fields/FieldOfFractions/Setoid.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Fields/FieldOfFractions/Setoid.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 54.5853658537, "max_line_length": 260, "alphanum_fraction": 0.6523681859, "num_tokens": 774, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110569397307, "lm_q2_score": 0.7634837527911056, "lm_q1q2_score": 0.680883252532948}} {"text": "module Natural where\n\nopen import Agda.Builtin.Equality\n\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n\n-- seven = suc (suc (suc (suc (suc (suc (suc zero))))))\n\n{-# BUILTIN NATURAL ℕ #-}\n\n_+_ : ℕ → ℕ → ℕ\ninfixl 6 _+_\nzero + b = b\n(suc a) + b = suc (a + b)\n\n{-# BUILTIN NATPLUS _+_ #-}\n\n+-id : ∀ (a : ℕ) → a + zero ≡ zero + a\n+-id zero = refl\n+-id (suc a) rewrite +-id a = refl\n\n+-comm : ∀ (a b : ℕ) → a + b ≡ b + a\n+-comm zero b rewrite +-id b = refl\n+-comm (suc a) zero rewrite +-id (suc a) = refl\n+-comm (suc a) (suc b)\n rewrite +-comm a (suc b)\n | +-comm b (suc a)\n | +-comm a b = refl\n\n+-asso : ∀ (a b c : ℕ) → a + b + c ≡ a + (b + c)\n+-asso zero b c = refl\n+-asso (suc a) zero c\n rewrite +-id (suc a)\n | +-id a = refl\n+-asso (suc a) (suc b) zero\n rewrite +-id (suc a + suc b)\n | +-id b = refl\n+-asso (suc a) (suc b) (suc c)\n rewrite (+-comm a (suc b))\n | +-comm (b + a) (suc c)\n | +-comm b a\n | +-comm c (a + b)\n | +-comm b (suc c)\n | +-comm a (suc (suc (c + b)))\n | +-comm c b\n | +-comm (b + c) a \n | +-asso a b c = refl\n\n+-rear : ∀ (a b c d : ℕ) → a + b + (c + d) ≡ a + (b + c) + d\n+-rear zero b c d rewrite +-asso b c d = refl\n+-rear (suc a) b c d\n rewrite (+-asso (suc a) b (c + d))\n | +-asso a (b + c) d\n | +-asso b c d = refl\n\n+-swap : ∀ (a b c : ℕ) → a + (b + c) ≡ b + (a + c)\n+-swap a b c\n rewrite (+-comm a (b + c))\n | +-comm b (a + c)\n | +-asso a c b\n | +-comm c b\n | +-comm a (b + c) = refl\n\n_*_ : ℕ → ℕ → ℕ\ninfixl 7 _*_\nzero * b = zero\nsuc a * b = b + a * b\n\n{-# BUILTIN NATTIMES _*_ #-}\n\n*-id : ∀ (a : ℕ) → a * (suc zero) ≡ (suc zero) * a\n*-id zero = refl\n*-id (suc a)\n rewrite +-comm (suc zero) a\n | *-id a = refl\n\n*-z : ∀ (a : ℕ) → a * zero ≡ zero * a\n*-z zero = refl\n*-z (suc a) rewrite *-z a = refl\n\n*-comm : ∀ (a b : ℕ) → a * b ≡ b * a\n*-comm zero b rewrite *-z b = refl\n*-comm (suc a) zero rewrite *-z a = refl\n*-comm (suc a) (suc b)\n rewrite (*-comm a (suc b))\n | (*-comm b (suc a))\n | (*-comm a b )\n | (+-comm b (a + b * a))\n | (+-comm a (b + b * a))\n | (+-comm a (b * a))\n | (+-comm b (b * a))\n | (+-asso (b * a) a b)\n | (+-asso (b * a) b a)\n | (+-comm a b) = refl\n\n*-+-dist-r : ∀ (a b c : ℕ) → (a + b) * c ≡ a * c + b * c\n*-+-dist-r zero b c = refl\n*-+-dist-r (suc a) zero c\n rewrite (+-comm (suc a) zero)\n | +-comm a zero\n | +-asso c (a * c) zero\n | +-comm (a * c) zero = refl\n*-+-dist-r (suc a) (suc b) c\n rewrite (+-comm a (suc b))\n | +-rear c (a * c) c (b * c)\n | +-comm (a * c) c\n | +-asso c (c + a * c) (b * c)\n | +-asso c (a * c) (b * c)\n | +-comm (a * c) (b * c)\n | *-+-dist-r b a c = refl\n\n*-+-dist-l : ∀ (a b c : ℕ) → a * (b + c) ≡ a * b + a * c\n*-+-dist-l a zero c rewrite (*-z a) = refl\n*-+-dist-l a (suc b) zero\n rewrite (+-comm (suc b) zero)\n | *-z a\n | +-comm (a * suc b) zero = refl\n*-+-dist-l a (suc b) (suc c)\n rewrite (+-comm b (suc c))\n | *-comm a (suc (suc (c + b)))\n | *-comm a (suc b)\n | *-comm a (suc c)\n | +-rear a (b * a) a (c * a)\n | +-comm (b * a) a\n | +-asso a (a + b * a) (c * a)\n | +-asso a (b * a) (c * a)\n | +-comm (b * a) (c * a)\n | *-comm (c + b) a\n | *-comm c a\n | *-comm b a\n | *-+-dist-l a c b = refl\n\n*-asso : ∀ (a b c : ℕ) → a * b * c ≡ a * (b * c)\n*-asso zero b c = refl\n*-asso (suc a) zero c rewrite (*-asso a zero c) = refl\n*-asso (suc a) (suc b) c\n rewrite (*-+-dist-r (suc b) (a * suc b) c)\n | *-asso a (suc b) c = refl\n\n_^_ : ℕ → ℕ → ℕ\nm ^ zero = suc zero\nm ^ (suc n) = m * (m ^ n)\n\n^-dist-+-*-l : ∀ (a b c : ℕ) → a ^ (b + c) ≡ (a ^ b) * (a ^ c)\n^-dist-+-*-l a zero c\n rewrite (+-comm zero (a ^ c))\n | +-asso (a ^ c) zero zero = refl\n^-dist-+-*-l a (suc b) c\n rewrite *-asso a (a ^ b) (a ^ c)\n | ^-dist-+-*-l a b c = refl\n\n^-dist-*-r : ∀ (a b c : ℕ) → (a * b) ^ c ≡ (a ^ c) * (b ^ c)\n^-dist-*-r a b zero rewrite (+-comm (suc zero) zero) = refl\n^-dist-*-r a b (suc c)\n rewrite (*-asso a (a ^ c) (b * (b ^ c)))\n | *-comm (a ^ c) (b * (b ^ c))\n | *-asso b (b ^ c) (a ^ c)\n | *-comm (b ^ c) (a ^ c)\n | *-asso a b ((a * b) ^ c)\n | ^-dist-*-r a b c = refl\n\n^-asso-* : ∀ (a b c : ℕ) → (a ^ b) ^ c ≡ a ^ (b * c)\n^-asso-* a b zero rewrite (*-comm b zero) = refl\n^-asso-* a b (suc c)\n rewrite (*-comm b (suc c))\n | ^-dist-+-*-l a b (c * b)\n | *-comm c b\n | ^-asso-* a b c = refl\n\ndata Bin : Set where\n ⟨⟩ : Bin\n _O : Bin → Bin\n _I : Bin → Bin\n\ninc : Bin → Bin\ninc ⟨⟩ = ⟨⟩ I \ninc (n O) = n I \ninc (n I) = (inc n) O\n\nto : ℕ → Bin\nto zero = ⟨⟩ O\nto (suc n) = inc (to n)\n\nfrom : Bin → ℕ\nfrom ⟨⟩ = zero \nfrom (n O) = 2 * (from n)\nfrom (n I) = suc (2 * (from n))\n\nthm₁ : ∀ (b : Bin) → from (inc b) ≡ suc (from b)\nthm₁ ⟨⟩ = refl\nthm₁ (a O) = refl\nthm₁ (a I)\n rewrite thm₁ a\n | +-comm (suc (from a)) zero\n | +-comm (from a) zero\n | +-comm (from a) (suc (from a)) = refl\n\n-- thm₂ : ∀ (b : Bin) → to (from b) = b\n-- 这是错误的,因为 Bin 中的 (⟨⟩ O) 和 (⟨⟩)\n-- 都和 自然数 的 0 对应\n-- from 并非单射\n\nthm₃ : ∀ (n : ℕ) → from (to n) ≡ n\nthm₃ zero = refl\nthm₃ (suc n)\n rewrite thm₁ (to (suc n))\n | thm₁ (to n)\n | thm₃ n = refl", "meta": {"hexsha": "2356b644c5eb0850b67836a08224f03bf39b0819", "size": 5125, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Natural.agda", "max_stars_repo_name": "kands-code/agda-exercise", "max_stars_repo_head_hexsha": "b3c9c4f678feac75af6f30d0dd941ab58b9f40dd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Natural.agda", "max_issues_repo_name": "kands-code/agda-exercise", "max_issues_repo_head_hexsha": "b3c9c4f678feac75af6f30d0dd941ab58b9f40dd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Natural.agda", "max_forks_repo_name": "kands-code/agda-exercise", "max_forks_repo_head_hexsha": "b3c9c4f678feac75af6f30d0dd941ab58b9f40dd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.4047619048, "max_line_length": 63, "alphanum_fraction": 0.431804878, "num_tokens": 2299, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110454379297, "lm_q2_score": 0.763483758172699, "lm_q1q2_score": 0.6808832485508741}} {"text": "{-# OPTIONS --without-K #-}\nmodule sets.fin.ordering where\n\nopen import equality.core\nopen import function.isomorphism\nopen import sets.core\nopen import sets.fin.core\nopen import sets.fin.properties\nimport sets.nat.ordering as N\n\n_<_ : ∀ {n} → Fin n → Fin n → Set\ni < j = toℕ i N.< toℕ j\ninfixr 4 _<_\n\nord-from-ℕ : ∀ {n} {i j : Fin n}\n → Ordering N._<_ (toℕ i) (toℕ j)\n → Ordering _<_ i j\nord-from-ℕ (lt p) = lt p\nord-from-ℕ (eq p) = eq (toℕ-inj p)\nord-from-ℕ (gt p) = gt p\n\ncompare : ∀ {n} → (i j : Fin n) → Ordering _<_ i j\ncompare i j = ord-from-ℕ (N.compare (toℕ i) (toℕ j))\n", "meta": {"hexsha": "ef23abb101720050c395af64ea8bd4cda2e668f6", "size": 599, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/sets/fin/ordering.agda", "max_stars_repo_name": "pcapriotti/agda-base", "max_stars_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2015-06-12T12:20:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-01T11:25:54.000Z", "max_issues_repo_path": "src/sets/fin/ordering.agda", "max_issues_repo_name": "pcapriotti/agda-base", "max_issues_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-02T14:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-26T11:57:26.000Z", "max_forks_repo_path": "src/sets/fin/ordering.agda", "max_forks_repo_name": "pcapriotti/agda-base", "max_forks_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-02-02T12:17:00.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-04T19:31:00.000Z", "avg_line_length": 24.9583333333, "max_line_length": 52, "alphanum_fraction": 0.6160267112, "num_tokens": 223, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.901920681802153, "lm_q2_score": 0.7549149868676283, "lm_q1q2_score": 0.6808734396583147}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category.Core\n\nmodule Categories.Object.Product.Limit {o ℓ e} (C : Category o ℓ e) where\n\nopen import Level\nopen import Data.Nat.Base using (ℕ)\nopen import Data.Fin.Base using (Fin)\nopen import Data.Fin.Patterns\n\nopen import Categories.Category.Lift\nopen import Categories.Category.Finite.Fin\nopen import Categories.Category.Finite.Fin.Construction.Discrete\nopen import Categories.Object.Product C\nopen import Categories.Diagram.Limit\nopen import Categories.Functor.Core\n\nimport Categories.Category.Construction.Cones as Co\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n module C = Category C\n open C\n open MR C\n open HomReasoning\n\nmodule _ {o′ ℓ′ e′} {F : Functor (liftC o′ ℓ′ e′ (Discrete 2)) C} where\n private\n module F = Functor F\n open F\n\n limit⇒product : Limit F → Product (F₀ (lift 0F)) (F₀ (lift 1F))\n limit⇒product L = record\n { A×B = apex\n ; π₁ = proj (lift 0F)\n ; π₂ = proj (lift 1F)\n ; ⟨_,_⟩ = λ f g → rep record\n { apex = record\n { ψ = λ { (lift 0F) → f\n ; (lift 1F) → g }\n ; commute = λ { {lift 0F} {lift 0F} (lift 0F) → elimˡ identity\n ; {lift 1F} {lift 1F} (lift 0F) → elimˡ identity }\n }\n }\n ; project₁ = commute\n ; project₂ = commute\n ; unique = λ {_} {h} eq eq′ → terminal.!-unique record\n { arr = h\n ; commute = λ { {lift 0F} → eq\n ; {lift 1F} → eq′ }\n }\n }\n where open Limit L\n\nmodule _ o′ ℓ′ e′ A B where\n open Equiv\n\n product⇒limit-F : Functor (liftC o′ ℓ′ e′ (Discrete 2)) C\n product⇒limit-F = record\n { F₀ = λ { (lift 0F) → A\n ; (lift 1F) → B }\n ; F₁ = λ { {lift 0F} {lift 0F} _ → C.id\n ; {lift 1F} {lift 1F} _ → C.id }\n ; identity = λ { {lift 0F} → refl\n ; {lift 1F} → refl }\n ; homomorphism = λ { {lift 0F} {lift 0F} {lift 0F} → sym identity²\n ; {lift 1F} {lift 1F} {lift 1F} → sym identity² }\n ; F-resp-≈ = λ { {lift 0F} {lift 0F} _ → refl\n ; {lift 1F} {lift 1F} _ → refl }\n }\n\nmodule _ o′ ℓ′ e′ {A B} (p : Product A B) where\n open Product p\n private\n F = product⇒limit-F o′ ℓ′ e′ A B\n open Functor F\n\n product⇒limit : Limit F\n product⇒limit = record\n { terminal = record\n { ⊤ = record\n { N = A×B\n ; apex = record\n { ψ = λ { (lift 0F) → π₁\n ; (lift 1F) → π₂ }\n ; commute = λ { {lift 0F} {lift 0F} (lift 0F) → identityˡ\n ; {lift 1F} {lift 1F} (lift 0F) → identityˡ }\n }\n }\n ; ! = λ {K} →\n let open Co.Cone F K\n in record\n { arr = ⟨ ψ (lift 0F) , ψ (lift 1F) ⟩\n ; commute = λ { {lift 0F} → project₁\n ; {lift 1F} → project₂ }\n }\n ; !-unique = λ {K} f →\n let module K = Co.Cone F K\n module f = Co.Cone⇒ F f\n in begin\n ⟨ K.ψ (lift 0F) , K.ψ (lift 1F) ⟩ ≈˘⟨ ⟨⟩-cong₂ f.commute f.commute ⟩\n ⟨ π₁ ∘ f.arr , π₂ ∘ f.arr ⟩ ≈⟨ g-η ⟩\n f.arr ∎\n }\n }\n", "meta": {"hexsha": "60fe46a373f8672b70af4a3838e02a2c3bce15da", "size": 3266, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Object/Product/Limit.agda", "max_stars_repo_name": "laMudri/agda-categories", "max_stars_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Object/Product/Limit.agda", "max_issues_repo_name": "laMudri/agda-categories", "max_issues_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Object/Product/Limit.agda", "max_forks_repo_name": "laMudri/agda-categories", "max_forks_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.523364486, "max_line_length": 78, "alphanum_fraction": 0.4947948561, "num_tokens": 1131, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096204605945, "lm_q2_score": 0.7431680086124811, "lm_q1q2_score": 0.6808233623084359}} {"text": "\nmodule Examples where\n\nopen import Prelude\nopen import Star\nopen import Modal\n\nEl : Set -> Rel True\nEl A _ _ = A\n\nList : Set -> Set\nList A = Star (El A) _ _\n\nNat = List True\n\nzero : Nat\nzero = ε\n\nsuc : Nat -> Nat\nsuc n = _ • n\n\n-- Vectors\n\nVec : Set -> Nat -> Set\nVec A = All (\\_ -> A)\n\ninfixr 40 _::_\n_::_ : {A : Set}{n : Nat} -> A -> Vec A n -> Vec A (suc n)\nx :: xs = check x • xs\n\n-- Fin\n\nFin : Nat -> Set\nFin = Any (\\_ -> True)\n\n-- Turning a vector to a list\n\nvecToList : {A : Set}{n : Nat} -> Vec A n -> List A\nvecToList {A} = map ! uncheck\n\nlistToVec : {A : Set}(xs : List A) -> Vec A (length xs)\nlistToVec ε = ε\nlistToVec (x • xs) = x :: listToVec xs\n\n-- span\n\ntest : Vec Nat (suc (suc (suc zero)))\ntest = zero :: suc zero :: suc (suc zero) :: ε\n", "meta": {"hexsha": "3dc38d2517537eaed7978fe2fde624ec9018db94", "size": 762, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/AIM6/Path/Examples.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/AIM6/Path/Examples.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/AIM6/Path/Examples.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 15.5510204082, "max_line_length": 58, "alphanum_fraction": 0.562992126, "num_tokens": 275, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.912436167620237, "lm_q2_score": 0.746138993030751, "lm_q1q2_score": 0.6808042033130013}} {"text": "------------------------------------------------------------------------\n-- Regular expressions\n------------------------------------------------------------------------\n\nopen import Setoids\n\nmodule RegExps (S : Setoid) where\n\ninfix 8 _⋆\ninfixl 7 _⊙_\ninfixl 6 _∣_\ninfix 1 _∈‿⟦_⟧\n\nopen import Prelude\nprivate open module S' = Setoid S\n\n------------------------------------------------------------------------\n-- Regular expressions\n\ndata RegExp : Set where\n ∅ : RegExp -- Matches nothing.\n ε : RegExp -- Matches the empty string.\n • : RegExp -- Matches any single character.\n sym : carrier -> RegExp -- Matches the given character.\n _⋆ : RegExp -> RegExp -- Kleene star.\n _∣_ : RegExp -> RegExp -> RegExp -- Choice.\n _⊙_ : RegExp -> RegExp -> RegExp -- Sequencing.\n\n------------------------------------------------------------------------\n-- Size of a regular expression\n\nsize : RegExp -> ℕ\nsize (re ⋆) = 1 + size re\nsize (re₁ ∣ re₂) = 1 + size re₁ + size re₂\nsize (re₁ ⊙ re₂) = 1 + size re₁ + size re₂\nsize _ = 1\n\n------------------------------------------------------------------------\n-- Semantics of regular expressions\n\n-- The type xs ∈‿⟦ re ⟧ is inhabited iff xs matches the regular\n-- expression re.\n\ndata _∈‿⟦_⟧ : [ carrier ] -> RegExp -> Set where\n matches-ε : [] ∈‿⟦ ε ⟧\n matches-• : forall {x} -> x ∷ [] ∈‿⟦ • ⟧\n matches-sym : forall {x y} -> x ≈ y -> x ∷ [] ∈‿⟦ sym y ⟧\n matches-⋆ : forall {xs re}\n -> xs ∈‿⟦ ε ∣ re ⊙ re ⋆ ⟧ -> xs ∈‿⟦ re ⋆ ⟧\n matches-∣ˡ : forall {xs re₁ re₂}\n -> xs ∈‿⟦ re₁ ⟧ -> xs ∈‿⟦ re₁ ∣ re₂ ⟧\n matches-∣ʳ : forall {xs re₁ re₂}\n -> xs ∈‿⟦ re₂ ⟧ -> xs ∈‿⟦ re₁ ∣ re₂ ⟧\n matches-⊙ : forall {xs₁ xs₂ re₁ re₂}\n -> xs₁ ∈‿⟦ re₁ ⟧ -> xs₂ ∈‿⟦ re₂ ⟧\n -> xs₁ ++ xs₂ ∈‿⟦ re₁ ⊙ re₂ ⟧\n\n------------------------------------------------------------------------\n-- Is the regular expression bypassable?\n\nbypassable : (re : RegExp) -> Maybe ([] ∈‿⟦ re ⟧)\nbypassable ∅ = nothing\nbypassable ε = just matches-ε\nbypassable • = nothing\nbypassable (sym _) = nothing\nbypassable (re ⋆) = just (matches-⋆ (matches-∣ˡ matches-ε))\nbypassable (re₁ ∣ re₂) with bypassable re₁ | bypassable re₂\nbypassable (re₁ ∣ re₂) | just m | _ = just (matches-∣ˡ m)\nbypassable (re₁ ∣ re₂) | nothing | just m = just (matches-∣ʳ m)\nbypassable (re₁ ∣ re₂) | nothing | nothing = nothing\nbypassable (re₁ ⊙ re₂) with bypassable re₁ | bypassable re₂\nbypassable (re₁ ⊙ re₂) | just m₁ | just m₂ = just (matches-⊙ m₁ m₂)\nbypassable (re₁ ⊙ re₂) | _ | _ = nothing\n", "meta": {"hexsha": "b172a677c92a1c1d046935e926cf5c676c32a64f", "size": 2697, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/AIM6/RegExp/talk/RegExps.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/AIM6/RegExp/talk/RegExps.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/AIM6/RegExp/talk/RegExps.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 36.4459459459, "max_line_length": 72, "alphanum_fraction": 0.4553207267, "num_tokens": 867, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9124361557147438, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6808041995805731}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary.Core\n\nmodule Quasigroup.Definitions\n {a ℓ} {A : Set a} -- The underlying set\n (_≈_ : Rel A ℓ) -- The underlying equality\n where\n\nopen import Algebra.Core\nopen import Data.Product\n\nLatinSquareProperty₁ : Op₂ A → Set _\nLatinSquareProperty₁ _*_ = ∀ a b x → (a * x) ≈ b\n\nLatinSquareProperty₂ : Op₂ A → Set _\nLatinSquareProperty₂ _*_ = ∀ a b y → (y * a) ≈ b\n\nLatinSquareProperty : Op₂ A → Set _\nLatinSquareProperty _*_ = (LatinSquareProperty₁ _*_) × (LatinSquareProperty₂ _*_)\n", "meta": {"hexsha": "0e86dd3238ac4b966fbf1dd30a54a86c104cb686", "size": 546, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Quasigroup/Definitions.agda", "max_stars_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_stars_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-15T06:16:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-17T09:14:03.000Z", "max_issues_repo_path": "src/Quasigroup/Definitions.agda", "max_issues_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_issues_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-10-04T05:30:30.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-09T08:24:56.000Z", "max_forks_repo_path": "src/Quasigroup/Definitions.agda", "max_forks_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_forks_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.0, "max_line_length": 81, "alphanum_fraction": 0.6886446886, "num_tokens": 168, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9124361604769413, "lm_q2_score": 0.7461389817407017, "lm_q1q2_score": 0.6808041876816605}} {"text": "\nmodule Lib.Prelude where\n\ninfixr 90 _∘_\ninfixr 1 _,_\n\nid : {A : Set} -> A -> A\nid x = x\n\n_∘_ : {A : Set}{B : A -> Set}{C : {x : A} -> B x -> Set}\n (f : {x : A}(y : B x) -> C y)(g : (x : A) -> B x)(x : A) ->\n C (g x)\n(f ∘ g) x = f (g x)\n\ndata Unit : Set where\n unit : Unit\n\n{-# COMPILED_DATA Unit () () #-}\n\npostulate String : Set\n\n{-# BUILTIN STRING String #-}\n\ndata _×_ (A B : Set) : Set where\n _,_ : A -> B -> A × B\n\n{-# COMPILED_DATA _×_ (,) (,) #-}\n\nfst : {A B : Set} -> A × B -> A\nfst (x , y) = x\n\nsnd : {A B : Set} -> A × B -> B\nsnd (x , y) = y\n\n", "meta": {"hexsha": "2df62dfa469f25a8ff7b72b33a66b030c0198e87", "size": 565, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/simple-lib/Lib/Prelude.agda", "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "examples/simple-lib/Lib/Prelude.agda", "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/simple-lib/Lib/Prelude.agda", "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.1428571429, "max_line_length": 65, "alphanum_fraction": 0.4371681416, "num_tokens": 240, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9273632956467157, "lm_q2_score": 0.7341195269001831, "lm_q1q2_score": 0.6807955038647616}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Functor.Construction.Constant where\n\nopen import Level\n\nopen import Categories.Category\nopen import Categories.Category.Instance.One\nopen import Categories.Category.Product\nopen import Categories.Functor renaming (id to idF)\nopen import Categories.NaturalTransformation using (NaturalTransformation; ntHelper)\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n variable\n o ℓ e : Level\n C D : Category o ℓ e\n\nconst : (d : Category.Obj D) → Functor C D\nconst {D = D} d = record\n { F₀ = λ _ → d\n ; F₁ = λ _ → id\n ; identity = refl\n ; homomorphism = sym identity²\n ; F-resp-≈ = λ _ → refl\n }\n where open Category D\n open Equiv\n\nconst! : (d : Category.Obj D) → Functor (One {0ℓ} {0ℓ} {0ℓ}) D\nconst! = const\n\nconstˡ : (c : Category.Obj C) → Functor D (Product C D)\nconstˡ c = const c ※ idF\n\nconstʳ : (c : Category.Obj C) → Functor D (Product D C)\nconstʳ c = idF ※ (const c)\n\nconstNat : ∀ {A B} → Category._⇒_ D A B → NaturalTransformation (const {D = D} {C = C} A) (const B)\nconstNat {D = D} f = ntHelper record\n { η = λ _ → f\n ; commute = λ _ → MR.id-comm D\n }\n", "meta": {"hexsha": "288d40ce30e85626b9fd10d6b73f5123bf9178e8", "size": 1169, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Construction/Constant.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Functor/Construction/Constant.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Functor/Construction/Constant.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.1860465116, "max_line_length": 99, "alphanum_fraction": 0.6467065868, "num_tokens": 365, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869916479467, "lm_q2_score": 0.7772998508568416, "lm_q1q2_score": 0.6807490979903109}} {"text": "open import Agda.Builtin.Nat\n\nvariable {n} : Nat\n\ndata Vec (A : Set) : Nat → Set where\n [] : Vec A 0\n _∷_ : A → Vec A n → Vec A (suc n)\n\ncons : ∀ {m A} → A → Vec A m → Vec A (suc m)\ncons = _∷_\n\nmodule _ (A : Set) where\n data Vec' : Nat → Set where\n [] : Vec' 0\n _∷_ : A → Vec' n → Vec' (suc n)\n\ncons' : ∀ {m A} → A → Vec' A m → Vec' A (suc m)\ncons' = _∷_\n", "meta": {"hexsha": "196c50a0c92252037d743d7b8c031a7399ad4499", "size": 366, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue3108.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue3108.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue3108.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 19.2631578947, "max_line_length": 47, "alphanum_fraction": 0.5, "num_tokens": 162, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8757869786798663, "lm_q2_score": 0.7772998508568416, "lm_q1q2_score": 0.680749087910224}} {"text": "module Structure.LinearAlgebra where\n\nimport Lvl\nopen import Data\nopen import Data.Tuple\nopen import Functional hiding (id)\nopen import Function.Equals\nopen import Function.Proofs\nopen import Logic\nopen import Logic.Propositional\nopen import Logic.Propositional.Theorems\nopen import Logic.Predicate\nopen import Numeral.CoordinateVector as Vec using () renaming (Vector to Vec)\nopen import Numeral.Finite\nopen import Numeral.Natural\nopen import Numeral.Natural.Relation.Order\nopen import Numeral.Natural.Relation.Order.Proofs\n-- open import Relator.Equals\n-- open import Relator.Equals.Proofs\nopen import Structure.Setoid\nopen import Structure.Setoid.Uniqueness\nopen import Structure.Setoid.Uniqueness.Proofs\nopen import Structure.Function.Domain\nimport Structure.Function.Linear as Linear\nopen import Structure.Operator.Field\nopen import Structure.Operator.Group\nopen import Structure.Operator.Properties hiding (commutativity)\nopen import Structure.Operator.Vector\nopen import Syntax.Number\nopen import Type\n\n-- Finite dimensional linear algebra\n-- TODO: Apparently, most of linear algebra will not work in constructive logic\n\nmodule _\n {ℓᵥ ℓₛ : Lvl.Level}\n {V : Type{ℓᵥ}}\n ⦃ equiv-V : Equiv(V) ⦄\n {S : Type{ℓₛ}}\n ⦃ equiv-S : Equiv(S) ⦄\n {_+ᵥ_ : V → V → V}\n {_⋅ₛᵥ_ : S → V → V}\n {_+ₛ_ _⋅ₛ_ : S → S → S}\n ⦃ vectorSpace : VectorSpace(_+ᵥ_)(_⋅ₛᵥ_)(_+ₛ_)(_⋅ₛ_) ⦄\n where\n\n module _ where\n open VectorSpace(vectorSpace)\n\n -- A list of scalars\n Scalars : ℕ → Type\n Scalars(n) = Vec(n)(S) -- TODO: Prove that this type is a group if its underlying type (S) is a group. THen proceed to prove that injective-kernelᵣ holds with LinearCombination(_) being a homomorphism, which one can deduce that LinearlyIndependent is equivalent to Injective.\n\n -- A list of vectors\n Vectors : ℕ → Type\n Vectors(n) = Vec(n)(V)\n\n module _ where\n -- TODO: Make this a record instead, and then define an \"eval\"-function and prove LinearCombination-addition for this eval function (homomorphism)\n -- A specific linear combination of vectors (specific as specified by scalars).\n -- Linear combination of 0 scalars and vectors are the zero vector.\n -- Linear combination of 1 scalar and vector is just scalar on vector multiplication.\n -- Example: LinearCombination {4} sf vf = (sf[0] ⋅ₛᵥ vf[0]) +ᵥ (sf[1] ⋅ₛᵥ vf[1]) +ᵥ (sf[2] ⋅ₛᵥ vf[2]) +ᵥ (sf[3] ⋅ₛᵥ vf[3])\n LinearCombination : ∀{n} → Vectors(n) → Scalars(n) → V\n LinearCombination {0} _ _ = 𝟎ᵥ\n LinearCombination {1} vf sf = Vec.proj(sf)(0) ⋅ₛᵥ Vec.proj(vf)(0)\n LinearCombination {𝐒(𝐒(n))} vf sf = (Vec.proj(sf)(0) ⋅ₛᵥ Vec.proj(vf)(0)) +ᵥ (LinearCombination {𝐒(n)} (Vec.tail vf) (Vec.tail sf))\n\n postulate LinearCombination-addition : ∀{n}{sf₁ sf₂}{vf} → (LinearCombination{n}(vf)(sf₁) +ᵥ LinearCombination{n}(vf)(sf₂) ≡ LinearCombination{n}(vf)(sf₁ ⦗ Vec.map₂ (_+ₛ_) ⦘ sf₂))\n postulate LinearCombination-subtraction : ∀{n}{sf₁ sf₂}{vf} → (LinearCombination{n}(vf)(sf₁) −ᵥ LinearCombination{n}(vf)(sf₂) ≡ LinearCombination{n}(vf)(sf₁ ⦗ Vec.map₂ (_−ₛ_) ⦘ sf₂))\n\n -- Spanning(vf) ⇔ (VSP = Span(vf))\n -- A set of vectors is spanning the vector space when every vector in the vector space can be represented as a linear combination of the set of vectors.\n Spanning : ∀{n} → Vectors(n) → Stmt\n Spanning(vf) = (∀{v} → ∃(sf ↦ LinearCombination(vf)(sf) ≡ v))\n\n -- Basis(vf) ⇔ (vf is a basis)\n -- A set of vectors is a basis when every vector in the vector space can be represented as a unique linear combination of the set of vectors.\n -- A set of vectors is a basis when they span the vector space and is linearly independent.\n Basis : ∀{n} → Vectors(n) → Stmt\n Basis(vf) = (∀{v} → ∃!(sf ↦ LinearCombination(vf)(sf) ≡ v)) -- TODO: Should be some kind of set equality. Could be impossible to prove the uniqueness otherwise because one can just permute for commutative scalars\n\n -- A set of vectors is linearly independent when there is no vector that can be represented as a linear combination by the others.\n LinearlyIndependent : ∀{n} → Vectors(n) → Stmt\n LinearlyIndependent{n}(vf) = ∀{sf} → (LinearCombination(vf)(sf) ≡ 𝟎ᵥ) → (∀{i} → Vec.proj(sf)(i) ≡ 𝟎ₛ) -- sf ⊜ fill(𝟎ₛ)\n\n postulate independent-injective : ∀{n}{vf} → LinearlyIndependent{n}(vf) ↔ (∀{sf₁ sf₂} → (LinearCombination(vf)(sf₁) ≡ LinearCombination(vf)(sf₂)) → (∀{i}→ Vec.proj(sf₁)(i) ≡ Vec.proj(sf₂)(i))) -- TODO: Vec.proj(sf₁) ⊜ Vec.proj(sf₂)\n -- TODO: Is there some axioms that make this happen? I remember this pattern from somewhere, that injectivity is equivalent to stuff being the identity of something. Maybe it is usually expressed using a kernel? See the note written above\n -- TODO: Express this as injectivity when `Injective` is general over setoids\n\n basis-span-independent : ∀{n}{vf : Vectors(n)} → Basis(vf) ↔ (Spanning(vf) ∧ LinearlyIndependent(vf))\n basis-span-independent{n}{vf} = [↔]-intro (uncurry l) (([↔]-to-[←] [→][∧]-distributivityₗ) ([∧]-intro r₁ r₂)) where\n l : Spanning(vf) → LinearlyIndependent(vf) → Basis(vf)\n l spanning indep {v} = [∃!]-intro existence uniqueness where\n existence : ∃(sf ↦ LinearCombination(vf)(sf) ≡ v)\n existence = spanning\n\n postulate uniqueness : Unique(sf ↦ LinearCombination(vf)(sf) ≡ v)\n -- uniqueness = ([↔]-elimₗ Uniqueness-Injectivity) (([↔]-elimᵣ independent-injective) indep)\n -- TODO: `Injective` over setoids is blocking this proof. It is at the moment proving something incorrect\n\n r₁ : Basis(vf) → Spanning(vf)\n r₁(proof) {v} = [∃!]-existence(proof{v})\n\n postulate r₂ : Basis(vf) → LinearlyIndependent(vf)\n -- TODO: `Injective` over setoids is blocking this proof. It is at the moment proving something incorrect\n\n -- Cardinality of a set of linearly independent vectors is always less than the cardinality of a set of spanning vectors\n postulate independent-less-than-spanning : ∀{n₁ n₂} → ∀{vf₁} → LinearlyIndependent{n₁}(vf₁) → ∀{vf₂} → Spanning{n₂}(vf₂) → (n₁ ≤ n₂)\n\n -- Existence of a subset of spanning vectors which is a basis\n -- TODO: postulate basis-from-spanning : ∀{n}{vf} → ⦃ _ : Spanning{n}(vf) ⦄ → ∃(m ↦ (m ≤ n) ∧ ∃(f ↦ Basis{n}(vf ∘ f) ∧ Injective(f)))\n\n -- Existence of a finite set of vectors which spans the vector space\n -- A \"finite dimensional vector space\" is sometimes defined as a vector space which satisfies this proposition.\n postulate span-existence : ∃(n ↦ ∃(vf ↦ Spanning{n}(vf)))\n -- TODO: Usually, this exists because one can take the whole set\n\n -- Existence of a basis\n postulate basis-existence : ∃(n ↦ ∃(vf ↦ Basis{n}(vf)))\n\n -- A set of linearly independent vectors is smaller than a set of basis vectors\n postulate independent-lesser-than-basis-number : ∀{m n} → {vfₘ : Vectors(m)} → LinearlyIndependent(vfₘ) → {vfₙ : Vectors(n)} → Basis(vfₙ) → (m ≤ n)\n\n -- Every set of basis vectors are equal in size\n postulate basis-equal-number : ∀{m n} → {vfₘ : Vectors(m)} → Basis(vfₘ) → {vfₙ : Vectors(n)} → Basis(vfₙ) → (m ≡ n)\n\n -- The dimension of the vector space\n dim : ℕ\n dim = [∃]-witness(basis-existence)\n\n -- Existence of a superset of linearly independent vectors which is a basis\n -- TODO: basis-from-linearly-independent : ∀{n}{vf} → ⦃ _ : Spanning{n}(vf) ⦄ → ∃(m ↦ (m ≥ n) ∧ ∃(f ↦ Basis{n}(vf ∘ f) ∧ Injective(f)))\n\n postulate basis-from-dim-spanning : ∀{vf} → Spanning{dim}(vf) → Basis{dim}(vf)\n\n postulate basis-from-dim-independent : ∀{vf} → LinearlyIndependent{dim}(vf) → Basis{dim}(vf)\n\n -- TODO: Move to some algebraic structure?\n -- Nilpotent(f) = ∃(n ↦ ∀{v} → (f ^ n ≡ 𝟎ᵥ))\n\n module _ where\n private LinearMap = Linear.LinearMap(_+ᵥ_)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_)\n\n postulate linear-map-id : LinearMap(Function.id)\n\n -- v is a eigenvector for the eigenvalue 𝜆 of the linear transformation f\n Eigenvector : (V → V) → S → V → Stmt\n Eigenvector(f)(𝜆)(v) = ((v ≢ 𝟎ᵥ) → (f(v) ≡ 𝜆 ⋅ₛᵥ v))\n\n -- 𝜆 is a eigenvalue of the linear transformation f\n -- Multiplication by an eigenvalue can replace a linear transformation for certain vectors.\n Eigenvalue : (V → V) → S → Stmt\n Eigenvalue(f)(𝜆) = (∀{v : V} → Eigenvector(f)(𝜆)(v))\n\n -- Two linear mappings are similiar when there is a basis in which they are equal.\n -- Similiar : (f : V → V) → ⦃ _ : LinearMap(f) ⦄ → (g : V → V) → ⦃ _ : LinearMap(g) ⦄ → Stmt\n -- Similiar(f)(g) = (∀{v} → ∃(b ↦ Bijective(b) ∧ (f(v) ≡ (b ∘ g ∘ (inv(b)))(v))))\n\n record DotProductSpace (_∙_ : V → V → S) (_≤_ : S → S → Stmt) : Stmt where\n field\n commutativity : Commutativity(_∙_)\n linearmapₗ : ∀{v₂} → Linear.LinearMap(_+ᵥ_)(_⋅ₛᵥ_)(_+ₛ_)(_⋅ₛ_) (_∙ v₂)\n positive : ∀{v} → (𝟎ₛ ≤ (v ∙ v))\n injective-zero : ∀{v} → ((v ∙ v) ≡ 𝟎ₛ) → (v ≡ 𝟎ᵥ)\n\n postulate [⋅ₛᵥ]-commuting : ∀{s}{v₁ v₂} → ((s ⋅ₛᵥ v₁) ∙ v₂) ≡ (v₁ ∙ (s ⋅ₛᵥ v₂))\n postulate almost-injectivity-zeroₗ : ∀{v₁} → (∀{v₂} → ((v₁ ∙ v₂) ≡ 𝟎ₛ)) → (v₁ ≡ 𝟎ᵥ)\n postulate injectivityₗ : ∀{v₁ v₂} → (∀{v₃} → ((v₁ ∙ v₃) ≡ (v₂ ∙ v₃))) → (v₁ ≡ v₂)\n\n module Norm (√ : S → S) where\n -- The length of a vector\n norm : V → S\n norm(v) = √(v ∙ v)\n\n -- The positive part of a scalar\n abs : S → S\n abs(s) = √(s ⋅ₛ s)\n\n postulate homogeneity : ∀{s}{v} → norm(s ⋅ₛᵥ v) ≡ abs(s) ⋅ₛ norm(v)\n postulate triangle-inequality : ∀{v₁ v₂} → (norm(v₁ +ᵥ v₂) ≤ (norm(v₁) +ₛ norm(v₂)))\n postulate positivity : ∀{v} → (𝟎ₛ ≤ norm(v))\n postulate injectivity-zero : ∀{v} → (norm(v) ≡ 𝟎ₛ) → (v ≡ 𝟎ᵥ)\n postulate mult-inequality : ∀{v₁ v₂} → (abs(v₁ ∙ v₂) ≤ (norm(v₁) ⋅ₛ norm(v₂)))\n\n -- Two vectors are orthogonal when they are perpendicular.\n Orthogonal : V → V → Stmt\n Orthogonal(v₁)(v₂) = (v₁ ∙ v₂ ≡ 𝟎ₛ)\n\n {-\n OrthogonalAll : ∀{n} → Vectors(n) → Stmt\n OrthogonalAll{0} (vf) = ⊤\n OrthogonalAll{1} (vf) = Orthogonal(vf(0))(vf(1))\n OrthogonalAll{𝐒(𝐒(n))} (vf) = (OrthogonalAll{n} (vf)) ∧ Orthogonal(vf(n))(vf(𝐒(n)))\n -}\n\n postulate hypotenuse-length : ∀{v₁ v₂} → ⦃ _ : Orthogonal(v₁)(v₂) ⦄ → ((v₁ +ᵥ v₂) ∙ (v₁ +ᵥ v₂) ≡ (v₁ ∙ v₁) +ₛ (v₂ ∙ v₂))\n\n -- Transforms a vector to an unit vector in the same direction.\n normalize : (v : V) → ⦃ _ : v ≢ 𝟎ᵥ ⦄ → V\n normalize(v) ⦃ proof ⦄ = (⅟ₛ (norm(v)) ⦃ contrapositiveᵣ (injectivity-zero) (proof) ⦄) ⋅ₛᵥ v\n\n postulate norm-of-normalize : ∀{v} → ⦃ nonzero : (v ≢ 𝟎ᵥ) ⦄ → (norm(normalize(v) ⦃ nonzero ⦄) ≡ 𝟏ₛ)\n\n-- -- TODO: Is it okay for VSP₂ to have a different scalar field compared to VSP? Some stuff will not be compatible (like addition for the same scalar type)?\n-- module _ {V₂} ⦃ lang₂ ⦄ (VSP₂ : VectorSpace(V₂)(S) ⦃ lang₂ ⦄) where\n-- open Language ⦃ ... ⦄\n-- open VectorSpace ⦃ ... ⦄\n--\n-- private _+ᵥ₁_ = _+ᵥ_ ⦃ lang ⦄\n-- private _⋅ₛᵥ₁_ = _⋅ₛᵥ_ ⦃ lang ⦄\n-- private _+ᵥ₂_ = _+ᵥ_ ⦃ lang₂ ⦄\n-- private _⋅ₛᵥ₂_ = _⋅ₛᵥ_ ⦃ lang₂ ⦄\n--\n-- private LinearMap₁₂ = Linear.LinearMap(_+ᵥ₁_)(_⋅ₛᵥ₁_)(_+ᵥ₂_)(_⋅ₛᵥ₂_)\n-- private LinearMap₂₁ = Linear.LinearMap(_+ᵥ₂_)(_⋅ₛᵥ₂_)(_+ᵥ₁_)(_⋅ₛᵥ₁_)\n--\n-- module _ where\n-- -- Kernel(f)(v) ⇔ (v ∈ Kernel(f))\n-- Kernel : (f : V → V₂) → ⦃ _ : LinearMap₁₂(f) ⦄ → V → Stmt\n-- Kernel(f)(v) = (f(v) ≡ 𝟎ᵥ ⦃ lang₂ ⦄ ⦃ VSP₂ ⦄)\n--\n-- -- TODO: Move away the module for two vector spaces from one so that dim is not bound to V\n-- -- rank : (V → V₂) → ℕ\n-- -- rank(_) = dim ⦃ VSP₂ ⦄\n--\n-- module _ where\n-- postulate linear-map-const-zero : LinearMap₁₂(const(𝟎ᵥ ⦃ lang₂ ⦄ ⦃ VSP₂ ⦄))\n--\n-- -- The inverse of an invertible linear mapping is a linear mapping\n-- postulate linear-inverse : ∀{f} → ⦃ _ : Bijective(f) ⦄ → LinearMap₁₂(f) → LinearMap₂₁(inv(f))\n--\n-- -- Injectivity for only the zero vector implies injectivity\n-- postulate injective-zero : ∀{f} → ⦃ _ : LinearMap₁₂(f) ⦄ → (∀{v} → (f(v) ≡ 𝟎ᵥ ⦃ lang₂ ⦄ ⦃ VSP₂ ⦄) → (v ≡ 𝟎ᵥ ⦃ lang ⦄ ⦃ VSP ⦄)) → Injective(f)\n--\n-- -- module _ {_∙₁_ : V → V → S}{_≤₁_} {_∙₂_ : V₂ → V₂ → S}{_≤₂_} (DPSP₁ : DotProductSpace(_∙₁_)(_≤₁_)) (DPSP₂ : DotProductSpace(_∙₂_)(_≤₂_)) where\n-- -- Adjoint : (f : V → V₂) → ⦃ _ : LinearMap₁₂(f) ⦄ → (g : V₂ → V) → ⦃ _ : LinearMap₂₁(g) ⦄ → Stmt\n-- -- Adjoint(f)(g) = (∀{v₁ : V}{v₂ : V₂} → (f(v₁) ∙₂ v₂ ≡ v₁ ∙₁ g(v₂)))\n", "meta": {"hexsha": "bc1bca8792ca3dc6eb2cc115a3094cc1c02f8b1b", "size": 12495, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Structure/LinearAlgebra.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Structure/LinearAlgebra.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Structure/LinearAlgebra.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 52.280334728, "max_line_length": 279, "alphanum_fraction": 0.6170468187, "num_tokens": 4593, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9196425399873764, "lm_q2_score": 0.7401743563075447, "lm_q1q2_score": 0.6806958250681918}} {"text": "\n{-\n FP Lunch, Nottingham\n July 27, 2007\n Conor McBride\n-}\n\nmodule Binary where\n\ndata Bit : Set where\n O : Bit\n I : Bit\n\ninfixl 80 _<<_\n\ndata Pos : Set where\n < Bit -> Pos\n\nbsuc : Pos -> Pos\nbsuc < Set where\n pI : Peano < Peano n -> Peano (bsuc n)\n\npdouble : {n : Pos} -> Peano n -> Peano (n << O)\npdouble pI = psuc pI\npdouble (psuc p) = psuc (psuc (pdouble p))\n\npeano : (n : Pos) -> Peano n\npeano < Pos -> Pos\n_+_ n m = peano n <+> m\n where\n _<+>_ : {n : Pos} -> Peano n -> Pos -> Pos\n pI <+> m = bsuc m\n psuc p <+> m = bsuc (p <+> m)\n\ninfixl 60 _+_\ninfix 40 _==_\n\ndata _==_ {A : Set}(x : A) : A -> Set where\n refl : x == x\n\n{-\ntest : (< (< (<_ : {n : Pos} -> Peano n -> Pos -> Pos\n pI <+> m = bsuc m\n psuc p <+> m = bsuc (p <+> m)\n-}\n\nt1 : Pos\nt1 = (< Set k\n M n = Matrix n n\n\n K' : Set k\n K' = F.Carrier\n\nUpperTriangular : ℕ -> Set (k ⊔ ℓ)\nUpperTriangular n = ∃ λ (A : M n) -> ∀ {i j} -> j ≤ i -> (A ⟪ i , j ⟫) F.≈ F.0#\n\nLowerTriangular : ℕ -> Set (k ⊔ ℓ)\nLowerTriangular n = ∃ λ (A : M n) -> ∀ {i j} -> i ≤ j -> (A ⟪ i , j ⟫) F.≈ F.0#\n\nInvertible : ℕ -> Set (k ⊔ ℓ)\nInvertible n = ∃₂ λ (A B : M n) -> (A * B) ≈ I n × (B * A) ≈ I n\n\ntrace : ∀ {n} -> M n n -> K'\ntrace A = vsum (V.tabulate λ i → A ⟪ i , i ⟫)\n\ndet : ∀ {n} -> M n -> K'\ndet A = {!!}\n", "meta": {"hexsha": "72d7c578d34587d27563735bf548e88e83941230", "size": 907, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Algebra/Linear/Construct/Matrix/Square.agda", "max_stars_repo_name": "felko/linear-algebra", "max_stars_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-11-02T14:11:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T06:18:08.000Z", "max_issues_repo_path": "src/Algebra/Linear/Construct/Matrix/Square.agda", "max_issues_repo_name": "felko/linear-algebra", "max_issues_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Algebra/Linear/Construct/Matrix/Square.agda", "max_forks_repo_name": "felko/linear-algebra", "max_forks_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.675, "max_line_length": 79, "alphanum_fraction": 0.5700110254, "num_tokens": 348, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9230391685381605, "lm_q2_score": 0.7371581568543044, "lm_q1q2_score": 0.68042585218392}} {"text": "{-\n\nPart 3: Transport and composition\n\n- Cubical transport\n- Subst as a special case of cubical transport\n- Path induction from subst?\n- Homogeneous composition (hcomp)\n- Binary composition of paths as special case of hcomp\n\n-}\n\n{-# OPTIONS --cubical #-}\nmodule Part2 where\n\nopen import Part1 public\n\n-- Transport is more complex as ≡ isn't inductively defined (so we\n-- can't define it by pattern-matching on p)\ntransport : {A B : Type ℓ} → A ≡ B → A → B\ntransport p a = transp (λ i → p i) i0 a\n\n-- This lets us define subst (which is called \"transport\" in the HoTT book)\nsubst : {A : Type ℓ} (P : A → Type ℓ') {x y : A} (p : x ≡ y) → P x → P y\nsubst P p pa = transport (λ i → P (p i)) pa\n\n-- The transp operation reduces differently for different types\n-- formers. For paths it reduces to another primitive operation called\n-- hcomp.\n\n-- We can also define the J eliminator (aka path induction)\n-- TODO: rewrite using subst?\n-- TODO: talk about ∧\nJ : {A : Type ℓ} {B : A → Type ℓ'} {x : A}\n (P : (z : A) → x ≡ z → Type ℓ'')\n (d : P x refl) {y : A} (p : x ≡ y) → P y p\nJ P d p = transport (λ i → P (p i) (λ j → p (i ∧ j))) d\n\n-- So J is provable, but it doesn't satisfy computation rule\n-- definitionally. This is almost never a problem in practice as the\n-- cubical primitives satisfy many new definitional equalities.\n", "meta": {"hexsha": "e71c40173be7240e87528ec79ef18fa7351fd6ea", "size": 1327, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "04-cubical-type-theory/material/Part2.agda", "max_stars_repo_name": "tomdjong/EPIT-2020", "max_stars_repo_head_hexsha": "54b18e4adf890b3533bbefda373912423be7f490", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "04-cubical-type-theory/material/Part2.agda", "max_issues_repo_name": "tomdjong/EPIT-2020", "max_issues_repo_head_hexsha": "54b18e4adf890b3533bbefda373912423be7f490", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "04-cubical-type-theory/material/Part2.agda", "max_forks_repo_name": "tomdjong/EPIT-2020", "max_forks_repo_head_hexsha": "54b18e4adf890b3533bbefda373912423be7f490", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.5952380952, "max_line_length": 75, "alphanum_fraction": 0.6571213263, "num_tokens": 410, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.857768108626046, "lm_q2_score": 0.7931059609645724, "lm_q1q2_score": 0.680301000076624}} {"text": "{-# OPTIONS --show-implicit #-}\n-- {-# OPTIONS -v tc.data:25 #-}\n-- {-# OPTIONS -v tc.conv.coerce:0 -v tc.with:25 #-}\n\nmodule FilterSub where\n\nopen import Common.Level\nopen import Common.Equality\n\n_∘_ : ∀ {a b c}\n {A : Set a} {B : A → Set b} {C : {x : A} → B x → Set c} →\n (∀ {x} (y : B x) → C y) → (g : (x : A) → B x) →\n ((x : A) → C (g x))\nf ∘ g = λ x → f (g x)\n\ndata Bool : Set where\n true false : Bool\n\nif_then_else_ : ∀ {a}{A : Set a} → Bool → A → A → A\nif true then t else e = t\nif false then t else e = e\n\ndata Maybe {a} (A : Set a) : Set a where\n nothing : Maybe A\n just : A → Maybe A\n\ninfixr 5 _∷_\n\ndata List {a} (A : Set a) : Set a where\n [] : List A\n _∷_ : (x : A) (xs : List A) → List A\n\ndata Any {a p} {A : Set a}\n (P : A → Set p) : List A → Set (a ⊔ p) where\n here : ∀ {x xs} (px : P x) → Any P (x ∷ xs)\n there : ∀ {x xs} (pxs : Any P xs) → Any P (x ∷ xs)\n\ninfix 4 _⊆_ _∈_\n\n_∈_ : ∀ {a}{A : Set a} → A → List A → Set _\nx ∈ xs = Any (_≡_ x) xs\n\n_⊆_ : ∀ {a}{A : Set a} → List A → List A → Set _\nxs ⊆ ys = ∀ {x} → x ∈ xs → x ∈ ys\n\nfilter : ∀ {a} {A : Set a} → (A → Bool) → List A → List A\nfilter p [] = []\nfilter p (x ∷ xs) with p x\n... | true = x ∷ filter p xs\n... | false = filter p xs\n\nfilter-⊆ : ∀ {a} {A : Set a} (p : A → Bool) →\n (xs : List A) → filter p xs ⊆ xs\nfilter-⊆ _ [] = λ ()\nfilter-⊆ p (x ∷ xs) with p x | filter-⊆ p xs\n... | false | hyp = there ∘ hyp\n... | true | hyp =\n λ { (here eq) → here eq\n ; (there ∈filter) → there (hyp ∈filter)\n }\n", "meta": {"hexsha": "a2cd1ff53db0e1277f6757bcebfa86a79f743a04", "size": 1550, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/FilterSub.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z", "max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z", "max_issues_repo_path": "test/succeed/FilterSub.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/FilterSub.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 25.4098360656, "max_line_length": 65, "alphanum_fraction": 0.4683870968, "num_tokens": 651, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8577680977182186, "lm_q2_score": 0.793105953629227, "lm_q1q2_score": 0.6803009851335358}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category\n\nmodule Categories.Category.CartesianClosed {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\nopen import Function using (_$_; flip)\nopen import Data.Product using (Σ; _,_; uncurry)\n\nopen import Categories.Functor renaming (id to idF)\nopen import Categories.Functor.Bifunctor\nopen import Categories.NaturalTransformation hiding (id)\nopen import Categories.NaturalTransformation.Properties\nopen import Categories.Category.Cartesian 𝒞\nopen import Categories.Category.Monoidal.Closed\nopen import Categories.Object.Product 𝒞\n hiding (repack≡id; repack∘; repack-cancel; up-to-iso; transport-by-iso)\nopen import Categories.Object.Exponential 𝒞 hiding (repack)\nopen import Categories.Morphism 𝒞\nopen import Categories.Morphism.Reasoning 𝒞\n\nprivate\n module 𝒞 = Category 𝒞\n open Category 𝒞\n open HomReasoning\n variable\n A B C : Obj\n f g h i : A ⇒ B\n\n-- Cartesian closed category\n-- is a category with all products and exponentials\nrecord CartesianClosed : Set (levelOfTerm 𝒞) where\n infixr 9 _^_\n -- an alternative notation for exponential, which emphasizes its internal hom natural\n infixr 5 _⇨_\n \n field\n cartesian : Cartesian\n exp : Exponential A B\n\n module exp {A B} = Exponential (exp {A} {B})\n\n _^_ : Obj → Obj → Obj\n B ^ A = exp.B^A {A} {B}\n\n _⇨_ : Obj → Obj → Obj\n _⇨_ = flip _^_\n\n module cartesian = Cartesian cartesian\n\n open cartesian public\n\n B^A×A : ∀ B A → Product (B ^ A) A\n B^A×A B A = exp.product {A} {B}\n\n eval : Product.A×B (B^A×A B A) ⇒ B\n eval = exp.eval\n\n λg : C × A ⇒ B → C ⇒ B ^ A\n λg f = exp.λg product f\n\n λ-cong : f ≈ g → λg f ≈ λg g\n λ-cong eq = exp.λ-cong product eq\n\n _×id : (f : C ⇒ B ^ A) → C × A ⇒ [[ B^A×A B A ]]\n f ×id = [ product ⇒ exp.product ] f ×id\n\n β : eval ∘ λg f ×id ≈ f\n β = exp.β product\n\n η-exp : λg (eval ∘ f ×id) ≈ f\n η-exp = exp.η product\n\n λ-unique : eval ∘ f ×id ≈ g → f ≈ λg g\n λ-unique = exp.λ-unique product\n\n λ-unique₂ : eval ∘ f ×id ≈ eval ∘ g ×id → f ≈ g\n λ-unique₂ = exp.λ-unique′ product\n\n -- the annoying detail is that B^A×A is NOT the same as B ^ A × A, but they are isomorphic.\n -- make some infra so that the latter (which is more intuitive) can be used.\n \n B^A×A-iso : Product.A×B (B^A×A B A) ≅ B ^ A × A\n B^A×A-iso {B = B} {A = A} = record\n { from = repack exp.product product\n ; to = repack product exp.product\n ; iso = record\n { isoˡ = begin\n repack product exp.product ∘ repack exp.product product\n ≈⟨ [ exp.product ]⟨⟩∘ ⟩\n [ exp.product ]⟨ π₁ ∘ repack exp.product product , π₂ ∘ repack exp.product product ⟩\n ≈⟨ Product.⟨⟩-cong₂ exp.product project₁ project₂ ⟩\n [ exp.product ]⟨ [ exp.product ]π₁ , [ exp.product ]π₂ ⟩\n ≈⟨ Product.η exp.product ⟩\n id\n ∎\n ; isoʳ = begin\n repack exp.product product ∘ repack product exp.product\n ≈⟨ ⟨⟩∘ ⟩\n ⟨ [ exp.product ]π₁ ∘ repack product exp.product , [ exp.product ]π₂ ∘ repack product exp.product ⟩\n ≈⟨ ⟨⟩-cong₂ (Product.project₁ exp.product) (Product.project₂ exp.product) ⟩\n ⟨ π₁ , π₂ ⟩\n ≈⟨ η ⟩\n id\n ∎\n }\n }\n\n eval′ : B ^ A × A ⇒ B\n eval′ = eval ∘ to\n where open _≅_ B^A×A-iso\n\n λ-unique′ : eval′ ∘ (f ⁂ id) ≈ g → f ≈ λg g\n λ-unique′ eq = exp.λ-unique product (⟺ (pullʳ [ product ⇒ product ⇒ exp.product ]repack∘×) ○ eq)\n\n λ-unique₂′ : eval′ ∘ (f ⁂ id) ≈ eval′ ∘ (g ⁂ id) → f ≈ g\n λ-unique₂′ eq = (λ-unique′ eq) ○ ⟺ (λ-unique′ refl) \n\n β′ : eval′ ∘ (λg f ⁂ id) ≈ f\n β′ {f = f} = begin\n eval′ ∘ (λg f ⁂ id) ≈⟨ pullʳ [ product ⇒ product ⇒ exp.product ]repack∘× ⟩\n eval ∘ λg f ×id ≈⟨ β ⟩\n f ∎\n\n η-exp′ : λg (eval′ ∘ (f ⁂ id)) ≈ f\n η-exp′ = sym (λ-unique′ refl)\n\n η-id′ : λg (eval′ {B = B} {A = A}) ≈ id\n η-id′ = sym (λ-unique′ (elimʳ (id×id product)))\n\n ⊤^A≅⊤ : ⊤ ^ A ≅ ⊤\n ⊤^A≅⊤ = record\n { from = !\n ; to = λg !\n ; iso = record\n { isoˡ = λ-unique₂ !-unique₂\n ; isoʳ = ⊤-id _\n }\n }\n\n A^⊤≅A : A ^ ⊤ ≅ A\n A^⊤≅A = record\n { from = let open _≅_ A×⊤≅A in eval′ ∘ to\n ; to = let open _≅_ A×⊤≅A in λg from\n ; iso = record\n { isoˡ = λ-unique₂′ $ begin\n eval′ ∘ ((λg π₁ ∘ eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈˘⟨ refl⟩∘⟨ first∘first ⟩\n eval′ ∘ ((λg π₁ ⁂ id) ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id)) ≈⟨ pullˡ β′ ⟩\n π₁ ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈⟨ helper ⟩\n eval′ ∘ (id ⁂ id) ∎\n ; isoʳ = firstid ! $ begin\n ((eval′ ∘ ⟨ id , ! ⟩) ∘ λg π₁) ⁂ id ≈˘⟨ first∘first ⟩\n (eval′ ∘ ⟨ id , ! ⟩ ⁂ id) ∘ (λg π₁ ⁂ id) ≈⟨ helper′ ⟩∘⟨refl ⟩\n (⟨ id , ! ⟩ ∘ eval′) ∘ (λg π₁ ⁂ id) ≈⟨ pullʳ β′ ⟩\n ⟨ id , ! ⟩ ∘ π₁ ≈⟨ ⟨⟩∘ ⟩\n ⟨ id ∘ π₁ , ! ∘ π₁ ⟩ ≈⟨ ⟨⟩-cong₂ identityˡ !-unique₂ ⟩\n ⟨ π₁ , π₂ ⟩ ≈⟨ η ⟩\n id ∎\n }\n }\n where helper = begin\n π₁ ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈⟨ project₁ ⟩\n (eval′ ∘ ⟨ id , ! ⟩) ∘ π₁ ≈⟨ pullʳ ⟨⟩∘ ⟩\n eval′ ∘ ⟨ id ∘ π₁ , ! ∘ π₁ ⟩ ≈⟨ refl⟩∘⟨ ⟨⟩-congˡ !-unique₂ ⟩\n eval′ ∘ (id ⁂ id) ∎\n helper′ = let open _≅_ A×⊤≅A in begin\n (eval′ ∘ ⟨ id , ! ⟩) ⁂ id ≈⟨ introˡ isoˡ ⟩\n (⟨ id , ! ⟩ ∘ π₁) ∘ ((eval′ ∘ ⟨ id , ! ⟩) ⁂ id) ≈⟨ pullʳ helper ⟩\n ⟨ id , ! ⟩ ∘ (eval′ ∘ (id ⁂ id)) ≈⟨ refl⟩∘⟨ elimʳ (id×id product) ⟩\n ⟨ id , ! ⟩ ∘ eval′ ∎\n\n -- we use -⇨- to represent the bifunctor.\n -- -^- would generate a bifunctor of type Bifunctor 𝒞 𝒞.op 𝒞 which is not very typical.\n -⇨- : Bifunctor 𝒞.op 𝒞 𝒞\n -⇨- = record\n { F₀ = uncurry _⇨_\n ; F₁ = λ where\n (f , g) → λg (g ∘ eval′ ∘ second f) \n ; identity = λ-cong (identityˡ ○ (elimʳ (id×id product))) ○ η-id′ \n ; homomorphism = λ-unique₂′ helper\n ; F-resp-≈ = λ where\n (eq₁ , eq₂) → λ-cong (∘-resp-≈ eq₂ (∘-resp-≈ʳ (⁂-cong₂ refl eq₁)))\n }\n where helper : eval′ ∘ first (λg ((g ∘ f) ∘ eval′ ∘ second (h ∘ i)))\n ≈ eval′ ∘ first (λg (g ∘ eval′ ∘ second i) ∘ λg (f ∘ eval′ ∘ second h))\n helper {g = g} {f = f} {h = h} {i = i} = begin\n eval′ ∘ first (λg ((g ∘ f) ∘ eval′ ∘ second (h ∘ i))) ≈⟨ β′ ⟩\n (g ∘ f) ∘ eval′ ∘ second (h ∘ i) ≈˘⟨ refl⟩∘⟨ pullʳ second∘second ⟩\n (g ∘ f) ∘ (eval′ ∘ second h) ∘ second i ≈˘⟨ pullˡ refl ⟩\n g ∘ f ∘ (eval′ ∘ second h) ∘ second i ≈˘⟨ refl⟩∘⟨ assoc ⟩\n g ∘ (f ∘ eval′ ∘ second h) ∘ second i ≈˘⟨ refl⟩∘⟨ pullˡ β′ ⟩\n g ∘ eval′ ∘ first (λg (f ∘ eval′ ∘ second h)) ∘ second i ≈⟨ refl⟩∘⟨ pushʳ first↔second ⟩\n g ∘ (eval′ ∘ second i) ∘ first (λg (f ∘ eval′ ∘ second h)) ≈˘⟨ assoc ⟩\n (g ∘ eval′ ∘ second i) ∘ first (λg (f ∘ eval′ ∘ second h)) ≈˘⟨ pullˡ β′ ⟩\n eval′ ∘ first (λg (g ∘ eval′ ∘ second i)) ∘ first (λg (f ∘ eval′ ∘ second h)) ≈⟨ refl⟩∘⟨ first∘first ⟩\n eval′ ∘ first (λg (g ∘ eval′ ∘ second i) ∘ λg (f ∘ eval′ ∘ second h)) ∎\n\n _⇨- : Obj → Endofunctor 𝒞\n _⇨- = appˡ -⇨-\n\n -⇨_ : Obj → Functor 𝒞.op 𝒞\n -⇨_ = appʳ -⇨-\n\n module _ where\n private\n A⇨[-×A] : Obj → Endofunctor 𝒞\n A⇨[-×A] A = A ⇨- ∘F -× A\n\n module A⇨[-×A] {A} = Functor (A⇨[-×A] A)\n\n [A⇨-]×A : Obj → Endofunctor 𝒞\n [A⇨-]×A A = -× A ∘F A ⇨-\n\n module [A⇨-]×A {A} = Functor ([A⇨-]×A A)\n\n closedMonoidal : Closed monoidal\n closedMonoidal = record\n { [-,-] = -⇨-\n ; adjoint = λ {A} → record\n { unit = ntHelper record\n { η = λ _ → λg id\n ; commute = λ f → λ-unique₂′ $ begin\n eval′ ∘ first (λg id ∘ f) ≈˘⟨ refl⟩∘⟨ first∘first ⟩\n eval′ ∘ first (λg id) ∘ first f ≈⟨ cancelˡ β′ ⟩\n first f ≈˘⟨ cancelʳ β′ ⟩\n (first f ∘ eval′) ∘ first (λg id) ≈˘⟨ ∘-resp-≈ʳ (elimʳ (id×id product)) ⟩∘⟨refl ⟩\n (first f ∘ eval′ ∘ first id) ∘ first (λg id) ≈˘⟨ pullˡ β′ ⟩\n eval′ ∘ first (A⇨[-×A].F₁ f) ∘ first (λg id) ≈⟨ refl⟩∘⟨ first∘first ⟩\n eval′ ∘ first (A⇨[-×A].F₁ f ∘ λg id) ∎\n }\n ; counit = ntHelper record\n { η = λ _ → eval′\n ; commute = λ f → begin\n eval′ ∘ [A⇨-]×A.F₁ f ≈⟨ β′ ⟩\n f ∘ eval′ ∘ first id ≈⟨ refl⟩∘⟨ elimʳ (id×id product) ⟩\n f ∘ eval′ ∎\n }\n ; zig = β′\n ; zag = λ-unique₂′ $ begin\n eval′ ∘ first (λg (eval′ ∘ eval′ ∘ second id) ∘ λg id)\n ≈˘⟨ refl⟩∘⟨ first∘first ⟩\n eval′ ∘ first (λg (eval′ ∘ eval′ ∘ second id)) ∘ first (λg id)\n ≈⟨ pullˡ β′ ⟩\n (eval′ ∘ eval′ ∘ second id) ∘ first (λg id)\n ≈⟨ ∘-resp-≈ʳ (elimʳ (id×id product)) ⟩∘⟨refl ⟩\n (eval′ ∘ eval′) ∘ first (λg id) ≈⟨ cancelʳ β′ ⟩\n eval′ ≈˘⟨ elimʳ (id×id product) ⟩\n eval′ ∘ first id ∎\n }\n ; mate = λ {X Y} f → record\n { commute₁ = λ-unique₂′ $ begin\n eval′ ∘ first (λg (second f ∘ eval′ ∘ second id) ∘ λg id) ≈˘⟨ refl⟩∘⟨ first∘first ⟩\n eval′ ∘ first (λg (second f ∘ eval′ ∘ second id)) ∘ first (λg id) ≈⟨ pullˡ β′ ⟩\n (second f ∘ eval′ ∘ second id) ∘ first (λg id) ≈⟨ ∘-resp-≈ʳ (elimʳ (id×id product)) ⟩∘⟨refl ⟩\n (second f ∘ eval′) ∘ first (λg id) ≈⟨ cancelʳ β′ ⟩\n second f ≈˘⟨ cancelˡ β′ ⟩\n eval′ ∘ first (λg id) ∘ second f ≈⟨ pushʳ first↔second ⟩\n (eval′ ∘ second f) ∘ first (λg id) ≈˘⟨ identityˡ ⟩∘⟨refl ⟩\n (id ∘ eval′ ∘ second f) ∘ first (λg id) ≈˘⟨ pullˡ β′ ⟩\n eval′ ∘ first (λg (id ∘ eval′ ∘ second f)) ∘ first (λg id) ≈⟨ refl⟩∘⟨ first∘first ⟩\n eval′ ∘ first (λg (id ∘ eval′ ∘ second f) ∘ λg id) ∎\n ; commute₂ = begin\n eval′ ∘ first (λg (id ∘ eval′ ∘ second f)) ≈⟨ β′ ⟩\n id ∘ eval′ ∘ second f ≈⟨ identityˡ ⟩\n eval′ ∘ second f ∎\n }\n }\n \n module closedMonoidal = Closed closedMonoidal\n", "meta": {"hexsha": "7a72a7511d2a49bc82eefc9f96045c0773841917", "size": 11006, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Category/CartesianClosed.agda", "max_stars_repo_name": "Taneb/agda-categories", "max_stars_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Categories/Category/CartesianClosed.agda", "max_issues_repo_name": "Taneb/agda-categories", "max_issues_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Category/CartesianClosed.agda", "max_forks_repo_name": "Taneb/agda-categories", "max_forks_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.762962963, "max_line_length": 123, "alphanum_fraction": 0.437216064, "num_tokens": 4325, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391595913457, "lm_q2_score": 0.7879312031126512, "lm_q1q2_score": 0.6802931789254422}} {"text": "\n-- Operator example\n\nmodule Operators where\n\ndata True : Set where\n tt : True\n\ndata False : Set where\n\ndata Bool : Set where\n false : Bool\n true : Bool\n\n-- An operator is declared with '_' where the arguments go\nif_then_else_ : Bool -> {A : Set} -> A -> A -> A\nif true then x else y = x\nif false then x else y = y\n\n-- The actual name of the operator is obtained by removing all the spaces from\n-- the declared version.\ninfix 1 if_then_else_\n\n-- This name can be used in normal applications, for instance, if a hidden argument\n-- needs to be supplied.\n_&&_ : Bool -> Bool -> Bool\nx && y = if_then_else_ x {Bool} y false\n\n-- Operators can be prefix...\n¬_ : Bool -> Bool\n¬ true = false\n¬ false = true\n\n-- ...or postfix...\n_valid : Bool -> Set\ntrue valid = True\nfalse valid = False\n\n-- ...or roundfix\n⟦_⟧ : Bool -> Set\n⟦ x ⟧ = x valid\n\n", "meta": {"hexsha": "74c0d523ba336c2b48e0211b132b6e51536aa9e2", "size": 840, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Operators.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Operators.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Operators.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 19.5348837209, "max_line_length": 83, "alphanum_fraction": 0.6583333333, "num_tokens": 242, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976953030553434, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.6802684428646467}} {"text": "{-\n\nAn simpler definition of truncation ∥ A ∥ n from n ≥ -1\n\nNote that this uses the HoTT book's indexing, so it will be off\n from `∥_∥_` in HITs.Truncation.Base by -2\n\n-}\n{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.HITs.Truncation.FromNegOne.Base where\n\nopen import Cubical.Data.NatMinusOne renaming (suc₋₁ to suc)\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.HITs.Sn\n\ndata ∥_∥_ {ℓ} (A : Type ℓ) (n : ℕ₋₁) : Type ℓ where\n ∣_∣ : A → ∥ A ∥ n\n hub : (f : S (suc n) → ∥ A ∥ n) → ∥ A ∥ n\n spoke : (f : S (suc n) → ∥ A ∥ n) (x : S (suc n)) → hub f ≡ f x\n", "meta": {"hexsha": "802529d5837b5a0a95b567aa732ce815ad177837", "size": 631, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/HITs/Truncation/FromNegOne/Base.agda", "max_stars_repo_name": "bijan2005/univalent-foundations", "max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/HITs/Truncation/FromNegOne/Base.agda", "max_issues_repo_name": "bijan2005/univalent-foundations", "max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/HITs/Truncation/FromNegOne/Base.agda", "max_forks_repo_name": "bijan2005/univalent-foundations", "max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 30.0476190476, "max_line_length": 65, "alphanum_fraction": 0.6402535658, "num_tokens": 251, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8976952838963489, "lm_q2_score": 0.757794360334681, "lm_q1q2_score": 0.6802684234356935}} {"text": "\n-- This module is used to illustrate how to import a parameterised module.\nmodule examples.syntax.ModuleB\n\t(A : Set)\n\t((==) : A -> A -> Prop)\n\t(refl : (x : A) -> x == x)\n where\n\n infix 5 /\\\n\n module SubModule where\n postulate dummy : A\n\n data True : Prop where\n tt : True\n\n data False : Prop where\n\n data (/\\) (P, Q : Prop) : Prop where\n andI : P -> Q -> P /\\ Q\n\n data List : Set where\n nil\t : List\n cons : A -> List -> List\n\n eqList : List -> List -> Prop\n eqList nil nil\t = True\n eqList (cons x xs) nil = False\n eqList nil (cons y ys) = False\n eqList (cons x xs) (cons y ys) = x == y /\\ eqList xs ys\n\n reflEqList : (xs : List) -> eqList xs xs\n reflEqList nil\t = tt\n reflEqList (cons x xs) = andI (refl x) (reflEqList xs)\n\n", "meta": {"hexsha": "73af9221e18dc0c4eaedfcb0c5fb943a65db9e05", "size": 793, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/syntax/ModuleB.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/syntax/ModuleB.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/syntax/ModuleB.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 22.0277777778, "max_line_length": 74, "alphanum_fraction": 0.5561160151, "num_tokens": 269, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9304582497090321, "lm_q2_score": 0.7310585786300049, "lm_q1q2_score": 0.6802194855068472}} {"text": "{-# OPTIONS --warning=error --safe --without-K #-}\n\nopen import LogicalFormulae\nopen import Numbers.Naturals.Definition\nopen import Maybe\n\nmodule Numbers.Naturals.Subtraction where\n\n_-N'_ : (a b : ℕ) → Maybe ℕ\nzero -N' zero = yes 0\nzero -N' succ b = no\nsucc a -N' zero = yes (succ a)\nsucc a -N' succ b = a -N' b\n\nsubtractZero : (a : ℕ) → a -N' 0 ≡ yes a\nsubtractZero zero = refl\nsubtractZero (succ a) = refl\n", "meta": {"hexsha": "a2531e434f3a04d76ddaba9372275d7af90a49cb", "size": 408, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numbers/Naturals/Subtraction.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Numbers/Naturals/Subtraction.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Numbers/Naturals/Subtraction.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 22.6666666667, "max_line_length": 50, "alphanum_fraction": 0.6715686275, "num_tokens": 134, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9263037343628702, "lm_q2_score": 0.7341195327172402, "lm_q1q2_score": 0.6800176646247048}} {"text": "module Miscellaneous.associative-side where\n\nprivate variable T : Set\nprivate variable _▫_ : T → T → T\nprivate variable id : T\n\ndata _≡_ {ℓ}{T : Set(ℓ)} : T → T → Set(ℓ) where\n [≡]-intro : ∀{x : T} → (x ≡ x)\n\nAssociativity : (T → T → T) → Set\nAssociativity(_▫_) = ∀{a b c} → ((a ▫ (b ▫ c)) ≡ ((a ▫ b) ▫ c))\n\nIdentityₗ : (T → T → T) → T → Set\nIdentityₗ(_▫_)(id) = ∀{a} → ((id ▫ a) ≡ a)\n\nIdentityᵣ : (T → T → T) → T → Set\nIdentityᵣ(_▫_)(id) = ∀{a} → ((a ▫ id) ≡ a)\n\nright-op₂-associativity : Associativity{T}(\\x y → y)\nright-op₂-associativity = [≡]-intro\n\nright-op₂-identityₗ : Identityₗ{T}(\\x y → y)(id)\nright-op₂-identityₗ {a = a} = [≡]-intro\n\nright-op₂-when-identityᵣₗ : (∀{a} → (id ≡ a)) → Identityᵣ{T}(\\x y → y)(id) \nright-op₂-when-identityᵣₗ p = p\n\nright-op₂-when-identityᵣᵣ : Identityᵣ{T}(\\x y → y)(id) → (∀{a} → (id ≡ a))\nright-op₂-when-identityᵣᵣ p = p\n", "meta": {"hexsha": "b4aabc510d9cebf0ea571f56561e42aefe4e8328", "size": 861, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Miscellaneous/associative-side.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Miscellaneous/associative-side.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Miscellaneous/associative-side.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.7, "max_line_length": 75, "alphanum_fraction": 0.5679442509, "num_tokens": 401, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.926303724190573, "lm_q2_score": 0.7341195385342971, "lm_q1q2_score": 0.6800176625453843}} {"text": "{- SAMPLE PROGRAMS IN SOURCE LANGUAGE -}\n\n{-# OPTIONS --no-termination-check #-}\n\nopen import Preliminaries\nopen import Source\n\nmodule Samples where\n\n {- dbl (n : nat) : nat = 2 * n -}\n dbl : ∀ {Γ} → Γ |- (nat ->s nat)\n dbl = lam (rec (var i0) z (suc (suc (force (var (iS i0))))))\n \n {- add (m n : nat) : nat = m + n -}\n add : ∀ {Γ} → Γ |- (nat ->s (nat ->s nat))\n add = lam (lam (rec (var (iS i0)) (var i0) (suc (force (var (iS i0))))))\n\n {- mult (m n : nat) : nat = m * n -}\n mult : ∀ {Γ} → Γ |- (nat ->s (nat ->s nat))\n mult = lam (lam (rec (var (iS i0)) z (app (app add (var (iS (iS i0)))) (force (var (iS i0))))))\n\n -- hack : instead of having bool case analysis just do natural number recursion and return 1/0\n\n {- iszero (n : nat) : nat = z -> 1 | _ -> 0 -}\n isz : ∀ {Γ} → Γ |- (nat ->s nat)\n isz = lam (rec (var i0) (suc z) z)\n\n {- leq (m n : nat) : nat = m ≤ n -}\n leq : ∀ {Γ} → Γ |- (nat ->s (nat ->s nat))\n leq = lam (lam (rec (var (iS i0))\n (app isz (var (iS i0)))\n (rec (var (iS (iS (iS i0)))) (suc z) (force (var (iS i0))))))\n\n {- len (l : list τ) : nat = [] -> z | x :: xs -> 1 + len xs -}\n len : ∀ {Γ τ} → Γ |- (list τ ->s nat)\n len = lam (listrec (var i0) z (suc (force (var (iS (iS i0))))))\n\n {- insert (l : list nat) (el : nat) : list nat = [] -> [el] | x :: xs -> (leq el x -> el :: x :: xs | x :: (insert el xs)) -}\n insert : ∀ {Γ} → Γ |- (list nat ->s (nat ->s list nat))\n insert = lam (lam (listrec (var (iS i0))\n (var i0 ::s nil)\n (rec (app (app leq (var (iS (iS (iS i0))))) (var i0))\n (var i0 ::s force (var (iS (iS i0))))\n (var (iS (iS (iS (iS (iS i0))))) ::s var (iS (iS (iS (iS (iS (iS i0))))))))))\n\n {- insertion sort (l : list nat) : list nat = [] -> [] | x :: xs -> insert x (isort xs) -}\n isort : ∀ {Γ} → Γ |- (list nat ->s list nat)\n isort = lam (listrec (var i0) nil (app (app insert (force (var (iS (iS i0))))) (var i0)))\n\n {- halve (l : list nat) : (list nat * list nat) = splits a list in half -}\n halve : ∀ {Γ} → Γ |- (list nat ->s (list nat ×s list nat))\n halve = lam (listrec (var i0)\n (prod nil nil)\n (listrec (var (iS i0))\n (prod (var i0 ::s nil) nil)\n (prod (var (iS (iS (iS i0))) ::s split (force (var (iS (iS i0)))) (var i0)) (var i0 ::s split (force (var (iS (iS i0)))) (var (iS i0))))))\n\n {- merge (l1 l2 : list nat) : list nat =\n match l1 with\n [] -> l2\n x :: xs ->\n match l2 with\n [] -> x :: xs\n y :: ys ->\n x <= y -> x :: merge xs l2\n _ -> y :: merge l1 ys -}\n merge : ∀ {Γ} → Γ |- ((list nat ×s list nat) ->s list nat)\n merge = lam (listrec (split (var i0) (var i0))\n (split (var i0) (var (iS i0)))\n (listrec (split (var (iS (iS (iS i0)))) (var (iS i0)))\n (split (var (iS (iS (iS i0)))) (var i0))\n (rec (app (app leq (var (iS (iS (iS i0))))) (var i0))\n (var (iS (iS (iS i0))) ::s force (var (iS (iS (iS (iS (iS i0)))))))\n (var i0 ::s app merge (prod (split (var (iS (iS (iS (iS (iS (iS (iS (iS i0))))))))) (var (iS i0))) (var (iS (iS (iS i0))))))))) \n\n {- mergesort (l : list nat) : list nat -}\n msort : ∀ {Γ} → Γ |- (list nat ->s list nat)\n msort = lam (listrec (var i0)\n nil\n (listrec (var (iS i0))\n (var i0 ::s nil)\n (app merge (prod\n (app msort (split (app halve (var (iS (iS (iS (iS (iS (iS i0)))))))) (var i0)))\n (app msort (split (app halve (var (iS (iS (iS (iS (iS (iS i0)))))))) (var (iS i0))))))))\n", "meta": {"hexsha": "aa5c2a0e53734ab7a099052b110e34e6903dfeac", "size": 3637, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "complexity/Samples.agda", "max_stars_repo_name": "benhuds/Agda", "max_stars_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-04-26T20:22:22.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-08T12:27:18.000Z", "max_issues_repo_path": "complexity/Samples.agda", "max_issues_repo_name": "benhuds/Agda", "max_issues_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-03-23T08:39:04.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-12T00:32:45.000Z", "max_forks_repo_path": "complexity/Samples.agda", "max_forks_repo_name": "benhuds/Agda", "max_forks_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.7882352941, "max_line_length": 152, "alphanum_fraction": 0.4533956558, "num_tokens": 1439, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519527944504227, "lm_q2_score": 0.7981867777396212, "lm_q1q2_score": 0.6800174557886487}} {"text": "module +-example where\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_)\nopen Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _∎)\nopen import Naturals using (suc; _+_)\n\n+-example : 3 + 4 ≡ 7\n+-example =\n begin\n 3 + 4\n ≡⟨⟩\n suc (2 + 4)\n ≡⟨⟩\n suc (suc (1 + 4))\n ≡⟨⟩\n suc (suc (suc (0 + 4)))\n ≡⟨⟩\n suc (suc (suc 4))\n ≡⟨⟩\n 7\n ∎\n", "meta": {"hexsha": "b0fdc0360a4b1b33a257476e75b678f581bde003", "size": 360, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "part1/naturals/+-example.agda", "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_issues_repo_path": "part1/naturals/+-example.agda", "max_issues_repo_name": "akiomik/plfa-solutions", "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "part1/naturals/+-example.agda", "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 15.652173913, "max_line_length": 50, "alphanum_fraction": 0.5333333333, "num_tokens": 170, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9149009480320036, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.6799251104223393}} {"text": "------------------------------------------------------------------------\n-- Definitions of functions that generate list\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe --exact-split #-}\n\nmodule Math.Combinatorics.ListFunction where\n\nopen import Data.List\nopen import Data.List.NonEmpty as NE using (List⁺)\nopen import Data.Nat\nopen import Data.Product as Prod using (_×_; _,_)\nopen import Function\nopen import Relation.Binary.PropositionalEquality hiding ([_])\n\nmodule _ {a} {A : Set a} where\n -- applyEach (_+ 10) (upTo 3)\n -- >>> (10 ∷ 1 ∷ 2 ∷ []) ∷ (0 ∷ 11 ∷ 2 ∷ []) ∷ (0 ∷ 1 ∷ 12 ∷ []) ∷ []\n applyEach : (A → A) → List A → List (List A)\n applyEach f [] = []\n applyEach f (x ∷ xs) = (f x ∷ xs) ∷ map (x ∷_) (applyEach f xs)\n\nmodule _ {a} {A : Set a} where\n -- Combinations\n -- combinations 2 (upTo 3)\n -- >>> (0 ∷ 1 ∷ []) ∷ (0 ∷ 2 ∷ []) ∷\n -- >>> (0 ∷ 3 ∷ []) ∷ (1 ∷ 2 ∷ []) ∷ (1 ∷ 3 ∷ []) ∷ (2 ∷ 3 ∷ []) ∷ []\n combinations : ℕ → List A → List (List A)\n combinations 0 xs = [ [] ]\n combinations (suc k) [] = []\n combinations (suc k) (x ∷ xs) =\n map (x ∷_) (combinations k xs) ++ combinations (suc k) xs\n\n -- combinationsWithComplement 2 (upTo 2)\n -- >>> (0 ∷ 1 ∷ [] , 2 ∷ []) ∷\n -- >>> (0 ∷ 2 ∷ [] , 1 ∷ []) ∷ (1 ∷ 2 ∷ [] , 0 ∷ []) ∷ []\n combinationsWithComplement : ℕ → List A → List (List A × List A)\n combinationsWithComplement 0 xs = [ [] , xs ]\n combinationsWithComplement (suc k) [] = []\n combinationsWithComplement (suc k) (x ∷ xs) =\n map (Prod.map₁ (x ∷_)) (combinationsWithComplement k xs) ++\n map (Prod.map₂ (x ∷_)) (combinationsWithComplement (suc k) xs)\n\n -- split list into two list (include empty list and order is preserved)\n -- splits₂ (upTo 3)\n -- >>> ([] , 0 ∷ 1 ∷ 2 ∷ []) ∷\n -- >>> (0 ∷ [] , 1 ∷ 2 ∷ []) ∷\n -- >>> (0 ∷ 1 ∷ [] , 2 ∷ []) ∷ (0 ∷ 1 ∷ 2 ∷ [] , []) ∷ []\n splits₂ : List A → List (List A × List A)\n splits₂ [] = ([] , []) ∷ []\n splits₂ (x ∷ xs) = ([] , x ∷ xs) ∷ map (Prod.map₁ (x ∷_)) (splits₂ xs)\n\n splits : ℕ → List A → List (List (List A))\n splits 0 xs = []\n splits 1 xs = [ xs ∷ [] ]\n splits (suc (suc k)) xs = concatMap f (splits (suc k) xs)\n where\n f : List (List A) → List (List (List A))\n f [] = []\n f (ys ∷ yss) = map (λ { (as , bs) → as ∷ bs ∷ yss }) (splits₂ ys)\n\n splits⁺₂Acc : A → List A → List (List⁺ A × List⁺ A)\n splits⁺₂Acc x [] = []\n splits⁺₂Acc x (y ∷ xs) = (x NE.∷ [] , y NE.∷ xs) ∷\n map (Prod.map₁ (x NE.∷⁺_)) (splits⁺₂Acc y xs)\n\n -- split list into two list (exclude empty list and order is preserved)\n splits⁺₂ : List⁺ A → List (List⁺ A × List⁺ A)\n splits⁺₂ (x NE.∷ xs) = splits⁺₂Acc x xs\n\n splits⁺ : ℕ → List⁺ A → List (List (List⁺ A))\n splits⁺ 0 xs = []\n splits⁺ 1 xs = [ xs ∷ [] ]\n splits⁺ (suc (suc k)) xs = concatMap f (splits⁺ (suc k) xs)\n where\n f : List (List⁺ A) → List (List (List⁺ A))\n f [] = []\n f (ys ∷ yss) =\n map (λ { (as , bs) → as ∷ bs ∷ yss }) (splits⁺₂ ys)\n\n splits⁺AllAcc : A → List A → List⁺ (List⁺ (List⁺ A))\n splits⁺AllAcc x [] = ((x NE.∷ []) NE.∷ []) NE.∷ []\n splits⁺AllAcc x (y ∷ xs) =\n NE.map (λ zs → (x NE.∷ []) NE.∷⁺ zs) yss NE.⁺++⁺\n NE.map (λ { (z NE.∷ zs) → (x NE.∷⁺ z) NE.∷ zs} ) yss\n where yss = splits⁺AllAcc y xs\n\n splits⁺All : List⁺ A → List⁺ (List⁺ (List⁺ A))\n splits⁺All (x NE.∷ xs) = splits⁺AllAcc x xs\n\n -- Partition of set\n -- Generalization of `combinationsWithComplement`\n -- partitions 2 (upTo 3)\n -- >>> ((0 ∷ []) ∷ (1 ∷ 2 ∷ []) ∷ []) ∷\n -- >>> ((0 ∷ 1 ∷ []) ∷ (2 ∷ []) ∷ []) ∷\n -- >>> ((1 ∷ []) ∷ (0 ∷ 2 ∷ []) ∷ []) ∷ []\n partitions : ℕ → List A → List (List (List A))\n partitions 0 [] = [ [] ]\n partitions 0 (x ∷ xs) = []\n partitions (suc k) [] = []\n partitions (suc k) (x ∷ xs) =\n map ([ x ] ∷_) (partitions k xs) ++\n concatMap (applyEach (x ∷_)) (partitions (suc k) xs)\n\n partitionsAll : List A → List (List (List A))\n partitionsAll [] = [ [] ]\n partitionsAll (x ∷ xs) =\n map ([ x ] ∷_) yss ++ concatMap (applyEach (x ∷_)) yss\n where yss = partitionsAll xs\n\nmodule _ {a} {A : Set a} where\n -- insertEverywhere 100 (upTo 2)\n -- >>> (100 ∷ 0 ∷ 1 ∷ []) ∷ (0 ∷ 100 ∷ 1 ∷ []) ∷ (0 ∷ 1 ∷ 100 ∷ []) ∷ []\n insertEverywhere : A → List A → List (List A)\n insertEverywhere x [] = [ [ x ] ]\n insertEverywhere x (y ∷ ys) = (x ∷ y ∷ ys) ∷ map (y ∷_) (insertEverywhere x ys)\n\nmodule _ {a} {A : Set a} where\n -- permutations (upTo 2)\n -- >>> (0 ∷ 1 ∷ []) ∷ (1 ∷ 0 ∷ []) ∷ []\n permutations : List A → List (List A)\n permutations [] = [ [] ]\n permutations (x ∷ xs) = concatMap (insertEverywhere x) (permutations xs)\n", "meta": {"hexsha": "db1158e8d122b90dbc42429e625d296c35268865", "size": 4781, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Math/Combinatorics/ListFunction.agda", "max_stars_repo_name": "rei1024/agda-combinatorics", "max_stars_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-06-25T08:24:15.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-25T07:25:27.000Z", "max_issues_repo_path": "Math/Combinatorics/ListFunction.agda", "max_issues_repo_name": "rei1024/agda-combinatorics", "max_issues_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Math/Combinatorics/ListFunction.agda", "max_forks_repo_name": "rei1024/agda-combinatorics", "max_forks_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.5564516129, "max_line_length": 81, "alphanum_fraction": 0.4768876804, "num_tokens": 1859, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438950986284991, "lm_q2_score": 0.8056321913146127, "lm_q1q2_score": 0.679869057547739}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.DirectSum.Definition\nopen import Setoids.Setoids\nopen import Rings.Definition\n\n\nmodule Rings.DirectSum {a b c d : _} {A : Set a} {S : Setoid {a} {b} A} {_+1_ : A → A → A} {_*1_ : A → A → A} {C : Set c} {T : Setoid {c} {d} C} {_+2_ : C → C → C} {_*2_ : C → C → C} (R1 : Ring S _+1_ _*1_) (R2 : Ring T _+2_ _*2_) where\n\nopen import Setoids.Product S T\n\npairPlus : A && C → A && C → A && C\npairPlus (a ,, b) (c ,, d) = (a +1 c) ,, (b +2 d)\n\npairTimes : A && C → A && C → A && C\npairTimes (a ,, b) (c ,, d) = (a *1 c) ,, (b *2 d)\n\ndirectSumRing : Ring productSetoid pairPlus pairTimes\nRing.additiveGroup directSumRing = directSumGroup (Ring.additiveGroup R1) (Ring.additiveGroup R2)\nRing.*WellDefined directSumRing r=t s=u = productLift (Ring.*WellDefined R1 (_&&_.fst r=t) (_&&_.fst s=u)) (Ring.*WellDefined R2 (_&&_.snd r=t) (_&&_.snd s=u))\nRing.1R directSumRing = Ring.1R R1 ,, Ring.1R R2\nRing.groupIsAbelian directSumRing = productLift (Ring.groupIsAbelian R1) (Ring.groupIsAbelian R2)\nRing.*Associative directSumRing = productLift (Ring.*Associative R1) (Ring.*Associative R2)\nRing.*Commutative directSumRing = productLift (Ring.*Commutative R1) (Ring.*Commutative R2)\nRing.*DistributesOver+ directSumRing = productLift (Ring.*DistributesOver+ R1) (Ring.*DistributesOver+ R2)\nRing.identIsIdent directSumRing = productLift (Ring.identIsIdent R1) (Ring.identIsIdent R2)\n", "meta": {"hexsha": "edcc63954904aa07fed01286450fa5446055269b", "size": 1468, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/DirectSum.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/DirectSum.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/DirectSum.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 52.4285714286, "max_line_length": 236, "alphanum_fraction": 0.6811989101, "num_tokens": 522, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797124237605, "lm_q2_score": 0.7461389930307512, "lm_q1q2_score": 0.679866713097914}} {"text": "-- Minimal implicational modal logic, PHOAS approach, final encoding\n\nmodule Pf.BoxMp where\n\nopen import Lib using (Nat; suc)\n\n\n-- Types\n\ninfixr 0 _=>_\ndata Ty : Set where\n UNIT : Ty\n _=>_ : Ty -> Ty -> Ty\n BOX : Ty -> Ty\n\n\n-- Context and truth judgement with modal depth\n\nCx : Set1\nCx = Ty -> Nat -> Set\n\nisTrue : Ty -> Nat -> Cx -> Set\nisTrue a d tc = tc a d\n\n\n-- Terms\n\nTmRepr : Set1\nTmRepr = Nat -> Cx -> Ty -> Set\n\nmodule ArrMp where\n record Tm (tr : TmRepr) : Set1 where\n infixl 1 _$_\n field\n var : forall {d tc a} -> isTrue a d tc -> tr d tc a\n lam' : forall {d tc a b} -> (isTrue a d tc -> tr d tc b) -> tr d tc (a => b)\n _$_ : forall {d tc a b} -> tr d tc (a => b) -> tr d tc a -> tr d tc b\n\n lam'' : forall {d tc a b} -> (tr d tc a -> tr d tc b) -> tr d tc (a => b)\n lam'' f = lam' \\x -> f (var x)\n\n syntax lam'' (\\a -> b) = lam a => b\n open Tm {{...}} public\n\nmodule BoxMp where\n record Tm (tr : TmRepr) : Set1 where\n field\n box : forall {d tc a} -> tr (suc d) tc a -> tr d tc (BOX a)\n unbox' : forall {d >d tc a b} -> tr d tc (BOX a) -> (isTrue a >d tc -> tr d tc b) -> tr d tc b\n\n isArrMp : ArrMp.Tm tr\n open ArrMp.Tm isArrMp public\n\n unbox'' : forall {d >d tc a b} -> tr d tc (BOX a) -> (tr >d tc a -> tr d tc b) -> tr d tc b\n unbox'' x' f = unbox' x' \\x -> f (var x)\n\n syntax unbox'' x' (\\x -> y) = unbox x' as x => y\n open Tm {{...}} public\n\n Thm : Ty -> Set1\n Thm a = forall {tr d tc} {{_ : Tm tr}} -> tr d tc a\nopen BoxMp public\n\n\n-- Example theorems\n\nrNec : forall {a} -> Thm a -> Thm (BOX a)\nrNec x =\n box x\n\naK : forall {a b} -> Thm (BOX (a => b) => BOX a => BOX b)\naK =\n lam f' =>\n lam x' =>\n unbox f' as f =>\n unbox x' as x =>\n box (f $ x)\n\naT : forall {a} -> Thm (BOX a => a)\naT =\n lam x' =>\n unbox x' as x => x\n\na4 : forall {a} -> Thm (BOX a => BOX (BOX a))\na4 =\n lam x' =>\n unbox x' as x => box (box x)\n\nt1 : forall {a} -> Thm (a => BOX (a => a))\nt1 =\n lam _ => box (lam y => y)\n", "meta": {"hexsha": "b471dbd66bed8a75646de20157efe49d4f80cdfd", "size": 2066, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Pf/BoxMp.agda", "max_stars_repo_name": "mietek/formal-logic", "max_stars_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_stars_repo_licenses": ["X11"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2015-08-31T09:49:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-13T12:37:44.000Z", "max_issues_repo_path": "src/Pf/BoxMp.agda", "max_issues_repo_name": "mietek/formal-logic", "max_issues_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_issues_repo_licenses": ["X11"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Pf/BoxMp.agda", "max_forks_repo_name": "mietek/formal-logic", "max_forks_repo_head_hexsha": "2dd761bfa96ccda089888e8defa6814776fa2922", "max_forks_repo_licenses": ["X11"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.4565217391, "max_line_length": 100, "alphanum_fraction": 0.4927395934, "num_tokens": 787, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872046026642944, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.6798592471382535}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Category.Instance.PointedSets where\n\n-- Category of Pointed Sets\n\nopen import Level\nopen import Relation.Binary\nopen import Function using (_∘′_; _$_) renaming (id to idf)\nopen import Relation.Binary.PropositionalEquality as ≡ using (_≡_; refl)\nopen import Data.Product\n\nopen import Categories.Category\nopen import Categories.Category.Instance.Sets\nopen import Categories.Functor using (Functor)\n\nPointedSets : ∀ o → Category (suc o) o o\nPointedSets o = record\n { Obj = Σ (Set o) idf\n ; _⇒_ = λ c d → Σ (proj₁ c → proj₁ d) (λ f → f (proj₂ c) ≡ proj₂ d)\n ; _≈_ = λ f g → ∀ x → proj₁ f x ≡ proj₁ g x\n ; id = idf , refl\n ; _∘_ = λ { (f , f-pres-pt) (g , g-pres-pt) → f ∘′ g , ≡.trans (≡.cong f g-pres-pt) f-pres-pt}\n ; assoc = λ _ → refl\n ; sym-assoc = λ _ → refl\n ; identityˡ = λ _ → refl\n ; identityʳ = λ _ → refl\n ; identity² = λ _ → refl\n ; equiv = record { refl = λ _ → refl ; sym = λ pf x → ≡.sym $ pf x ; trans = λ i≡j j≡k x → ≡.trans (i≡j x) (j≡k x) }\n ; ∘-resp-≈ = λ {_} {_} {_} {_} {h} {g} f≡h g≡i x → ≡.trans (f≡h (proj₁ g x)) (≡.cong (proj₁ h) $ g≡i x)\n }\n\nUnderlying : {o : Level} → Functor (PointedSets o) (Sets o)\nUnderlying = record\n { F₀ = proj₁\n ; F₁ = proj₁\n ; identity = refl\n ; homomorphism = refl\n ; F-resp-≈ = λ f≈g {x} → f≈g x\n }\n", "meta": {"hexsha": "bc66570a57ea866509b7163462373ece6732fd44", "size": 1391, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Instance/PointedSets.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Instance/PointedSets.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Instance/PointedSets.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 34.775, "max_line_length": 122, "alphanum_fraction": 0.5722501797, "num_tokens": 531, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045847699186, "lm_q2_score": 0.766293653760418, "lm_q1q2_score": 0.6798592428963355}} {"text": "------------------------------------------------------------------------\n-- Homotopy groups of pointed types\n------------------------------------------------------------------------\n\n{-# OPTIONS --erased-cubical --safe #-}\n\nimport Equality.Path as P\n\nmodule Pointed-type.Homotopy-group\n {e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where\n\nopen P.Derived-definitions-and-properties eq\n\nopen import Logical-equivalence using (_⇔_)\nopen import Prelude\n\nopen import Equality.Groupoid equality-with-J\nopen import Equality.Path.Isomorphisms eq\nopen import Equivalence equality-with-J as Eq using (_≃_)\nopen import Function-universe equality-with-J\nopen import Group equality-with-J as G using (Group; Abelian; _≃ᴳ_)\nopen import H-level equality-with-J\nopen import H-level.Closure equality-with-J\nopen import H-level.Truncation eq as T\nopen import Pointed-type equality-with-J as PT\n using (Pointed-type; _≃ᴮ_; Ω; Ω[_])\n\nprivate\n variable\n a p q : Level\n P : Pointed-type p\n n : ℕ\n\n-- Homotopy-group-[1+ n ] P is the (1+n)-th homotopy group of the\n-- pointed type P.\n--\n-- This definition is taken from the HoTT book.\n\nHomotopy-group-[1+_] : ℕ → Pointed-type a → Group a\nHomotopy-group-[1+ n ] P = λ where\n .Group.Carrier → Carrier\n .Group.Carrier-is-set → Carrier-is-set\n .Group._∘_ → _∘′_\n .Group.id → id′\n .Group._⁻¹ → _⁻¹\n .Group.left-identity → left-identity\n .Group.right-identity → right-identity\n .Group.assoc → assoc\n .Group.left-inverse → left-inverse\n .Group.right-inverse → right-inverse\n where\n Carrier = ∥ proj₁ (Ω[ 1 + n ] P) ∥[1+ 1 ]\n _∘′_ = ∥∥-zip trans\n id′ = ∣ refl _ ∣\n _⁻¹ = ∥∥-map sym\n\n abstract\n\n Carrier-is-set : Is-set Carrier\n Carrier-is-set = truncation-has-correct-h-level 1\n\n left-identity : (x : Carrier) → (id′ ∘′ x) ≡ x\n left-identity = T.elim λ where\n .T.∣∣ʳ _ → cong ∣_∣ $ trans-reflˡ _\n .T.h-levelʳ _ → mono₁ 2 $ truncation-has-correct-h-level 1\n\n right-identity : (x : Carrier) → (x ∘′ id′) ≡ x\n right-identity = T.elim λ where\n .T.∣∣ʳ _ → cong ∣_∣ $ trans-reflʳ _\n .T.h-levelʳ _ → mono₁ 2 $ truncation-has-correct-h-level 1\n\n assoc : (x y z : Carrier) → (x ∘′ (y ∘′ z)) ≡ ((x ∘′ y) ∘′ z)\n assoc = T.elim λ where\n .T.h-levelʳ _ → Π-closure ext 2 λ _ →\n Π-closure ext 2 λ _ →\n mono₁ 2 $ truncation-has-correct-h-level 1\n .T.∣∣ʳ _ → T.elim λ where\n .T.h-levelʳ _ → Π-closure ext 2 λ _ →\n mono₁ 2 $ truncation-has-correct-h-level 1\n .T.∣∣ʳ _ → T.elim λ where\n .T.h-levelʳ _ → mono₁ 2 $ truncation-has-correct-h-level 1\n .T.∣∣ʳ _ → cong ∣_∣ $ sym $ trans-assoc _ _ _\n\n left-inverse : (x : Carrier) → ((x ⁻¹) ∘′ x) ≡ id′\n left-inverse = T.elim λ where\n .T.∣∣ʳ _ → cong ∣_∣ $ trans-symˡ _\n .T.h-levelʳ _ → mono₁ 2 $ truncation-has-correct-h-level 1\n\n right-inverse : (x : Carrier) → (x ∘′ (x ⁻¹)) ≡ id′\n right-inverse = T.elim λ where\n .T.∣∣ʳ _ → cong ∣_∣ $ trans-symʳ _\n .T.h-levelʳ _ → mono₁ 2 $ truncation-has-correct-h-level 1\n\n-- The fundamental group of a pointed type.\n--\n-- This definition is taken from the HoTT book.\n\nFundamental-group : Pointed-type a → Group a\nFundamental-group = Homotopy-group-[1+ 0 ]\n\n-- The n-th homotopy group of a pointed type is abelian when n is at\n-- least two.\n--\n-- (This result is stated in the HoTT book.)\n\nabelian : ∀ n → Abelian (Homotopy-group-[1+ suc n ] P)\nabelian n = T.elim λ where\n .T.h-levelʳ _ → Π-closure ext 2 λ _ →\n mono₁ 2 $ truncation-has-correct-h-level 1\n .T.∣∣ʳ p → T.elim λ where\n .T.h-levelʳ _ → mono₁ 2 $ truncation-has-correct-h-level 1\n .T.∣∣ʳ q → cong ∣_∣ $ Ω[2+n]-commutative n p q\n\n-- If there is a based equivalence between P and Q, then their\n-- homotopy groups are isomorphic.\n\n≃ᴮ→≃ᴳ :\n ∀ (P : Pointed-type p) (Q : Pointed-type q) n →\n P ≃ᴮ Q → Homotopy-group-[1+ n ] P ≃ᴳ Homotopy-group-[1+ n ] Q\n≃ᴮ→≃ᴳ P Q n P≃Q = λ where\n .G.Homomorphic.related →\n ∥∥-cong (proj₁ (PT.Ω[ suc n ]-cong-≃ᴮ P≃Q))\n .G.Homomorphic.homomorphic → T.elim λ where\n .T.h-levelʳ _ → Π-closure ext 2 λ _ →\n mono₁ 2 $ truncation-has-correct-h-level 1\n .T.∣∣ʳ _ → T.elim λ where\n .T.h-levelʳ _ → mono₁ 2 $ truncation-has-correct-h-level 1\n .T.∣∣ʳ _ → cong ∣_∣ (PT.Ω[1+ n ]-cong-≃ᴮ-trans P≃Q)\n\n-- Homotopy-group-[1+ n ] commutes with PT._×_/G._×_.\n\nHomotopy-group-[1+_]-× :\n ∀ n (P : Pointed-type p) (Q : Pointed-type q) →\n Homotopy-group-[1+ n ] (P PT.× Q) ≃ᴳ\n (Homotopy-group-[1+ n ] P G.× Homotopy-group-[1+ n ] Q)\nHomotopy-group-[1+ n ]-× P Q = λ where\n .G.Homomorphic.related →\n ∥ proj₁ (Ω[ 1 + n ] (P PT.× Q)) ∥[1+ 1 ] ↝⟨ T.∥∥-cong (proj₁ PT.Ω[ 1 + n ]-×) ⟩\n ∥ proj₁ (Ω[ 1 + n ] P) × proj₁ (Ω[ 1 + n ] Q) ∥[1+ 1 ] ↝⟨ inverse T.∥∥×∥∥≃∥×∥ ⟩□\n ∥ proj₁ (Ω[ 1 + n ] P) ∥[1+ 1 ] × ∥ proj₁ (Ω[ 1 + n ] Q) ∥[1+ 1 ] □\n .G.Homomorphic.homomorphic → T.elim λ where\n .T.h-levelʳ _ → Π-closure ext 2 λ _ → s\n .T.∣∣ʳ p → T.elim λ where\n .T.h-levelʳ _ → s\n .T.∣∣ʳ q →\n Σ-map ∣_∣ ∣_∣ (_≃_.to (proj₁ PT.Ω[ 1 + n ]-×) (trans p q)) ≡⟨ cong (Σ-map ∣_∣ ∣_∣) PT.Ω[1+ n ]-×-trans ⟩∎\n\n (Σ-map ∣_∣ ∣_∣ $ Σ-zip trans trans\n (_≃_.to (proj₁ PT.Ω[ 1 + n ]-×) p)\n (_≃_.to (proj₁ PT.Ω[ 1 + n ]-×) q)) ∎\n where\n s =\n mono₁ 2 $\n ×-closure 2\n (truncation-has-correct-h-level 1)\n (truncation-has-correct-h-level 1)\n\n-- Homotopy-group-[1+ n ]′ P s is the (1+n)-th homotopy group of the\n-- pointed type P.\n--\n-- The definition does not use set truncation. Instead a certain loop\n-- space is required to be a set.\n\nHomotopy-group-[1+_]′ :\n ∀ n (P : Pointed-type a) → Is-set (proj₁ (Ω[ 1 + n ] P)) → Group a\nHomotopy-group-[1+ n ]′ P s = λ where\n .Group.Carrier → Carrier\n .Group.Carrier-is-set → Carrier-is-set\n .Group._∘_ → _∘′_\n .Group.id → id′\n .Group._⁻¹ → _⁻¹\n .Group.left-identity → left-identity\n .Group.right-identity → right-identity\n .Group.assoc → assoc\n .Group.left-inverse → left-inverse\n .Group.right-inverse → right-inverse\n where\n Carrier = proj₁ (Ω[ 1 + n ] P)\n _∘′_ = trans\n id′ = refl _\n _⁻¹ = sym\n\n abstract\n\n Carrier-is-set : Is-set Carrier\n Carrier-is-set = s\n\n left-identity : (x : Carrier) → (id′ ∘′ x) ≡ x\n left-identity _ = trans-reflˡ _\n\n right-identity : (x : Carrier) → (x ∘′ id′) ≡ x\n right-identity _ = trans-reflʳ _\n\n assoc : (x y z : Carrier) → (x ∘′ (y ∘′ z)) ≡ ((x ∘′ y) ∘′ z)\n assoc _ _ _ = sym $ trans-assoc _ _ _\n\n left-inverse : (x : Carrier) → ((x ⁻¹) ∘′ x) ≡ id′\n left-inverse _ = trans-symˡ _\n\n right-inverse : (x : Carrier) → (x ∘′ (x ⁻¹)) ≡ id′\n right-inverse _ = trans-symʳ _\n\n-- The fundamental group of a pointed type.\n--\n-- The definition does not use set truncation. Instead a certain loop\n-- space is required to be a set.\n\nFundamental-group′ :\n (P : Pointed-type a) → Is-set (proj₁ (Ω P)) → Group a\nFundamental-group′ = Homotopy-group-[1+ 0 ]′\n\n-- Homotopy-group-[1+ n ]′ P s is isomorphic to\n-- Homotopy-group-[1+ n ] P.\n\nHomotopy-group-[1+]′≃ᴳHomotopy-group-[1+] :\n {s : Is-set (proj₁ (Ω[ 1 + n ] P))} →\n Homotopy-group-[1+ n ]′ P s ≃ᴳ Homotopy-group-[1+ n ] P\nHomotopy-group-[1+]′≃ᴳHomotopy-group-[1+] {s = s} = λ where\n .G.Homomorphic.related →\n inverse $ Eq.↔⇒≃ $ _⇔_.to T.+⇔∥∥↔ (λ {_ _} → s)\n .G.Homomorphic.homomorphic p q →\n ∣ trans p q ∣ ≡⟨⟩\n ∣ trans p q ∣ ∎\n", "meta": {"hexsha": "ec19c616e0c3f193d4fd7368662db61bbf541586", "size": 7706, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Pointed-type/Homotopy-group.agda", "max_stars_repo_name": "nad/equality", "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_issues_repo_path": "src/Pointed-type/Homotopy-group.agda", "max_issues_repo_name": "nad/equality", "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Pointed-type/Homotopy-group.agda", "max_forks_repo_name": "nad/equality", "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.4017857143, "max_line_length": 116, "alphanum_fraction": 0.5495717623, "num_tokens": 2999, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970873650401, "lm_q2_score": 0.7718435030872968, "lm_q1q2_score": 0.6798375094209204}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Every respectful binary relation induces a preorder. No claim is\n-- made that this preorder is unique.\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary\nopen Setoid using (Carrier)\n\nmodule Relation.Binary.Construct.FromRel\n {s₁ s₂} (S : Setoid s₁ s₂) -- The underlying equality\n {a r} {A : Set a} (_R_ : REL A (Carrier S) r) -- The relation\n where\n\nopen import Data.Product\nopen import Function\nopen import Level using (_⊔_)\n\nopen module Eq = Setoid S using (_≈_) renaming (Carrier to B)\n\n------------------------------------------------------------------------\n-- Definition\n\nResp : Rel B (a ⊔ r)\nResp x y = ∀ {a} → a R x → a R y\n\n------------------------------------------------------------------------\n-- Properties\n\nreflexive : (∀ {a} → (a R_) Respects _≈_) → _≈_ ⇒ Resp\nreflexive resp x≈y = resp x≈y\n\ntrans : Transitive Resp\ntrans x∼y y∼z = y∼z ∘ x∼y\n\nisPreorder : (∀ {a} → (a R_) Respects _≈_) → IsPreorder _≈_ Resp\nisPreorder resp = record\n { isEquivalence = Eq.isEquivalence\n ; reflexive = reflexive resp\n ; trans = trans\n }\n\npreorder : (∀ {a} → (a R_) Respects _≈_) → Preorder _ _ _\npreorder resp = record\n { isPreorder = isPreorder resp\n }\n", "meta": {"hexsha": "c228bd1f7b68348496c193ebdd54c79dd98e88ae", "size": 1386, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/Construct/FromRel.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/Construct/FromRel.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/Construct/FromRel.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 27.72, "max_line_length": 74, "alphanum_fraction": 0.5086580087, "num_tokens": 369, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970904940925, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6798374979682026}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\nopen import Categories.Functor\nopen import Categories.Adjoint\n\n-- Right Adjoint Preserves Limits.\nmodule Categories.Adjoint.RAPL {o o′ ℓ ℓ′ e e′} {C : Category o ℓ e} {D : Category o′ ℓ′ e′}\n {L : Functor C D} {R : Functor D C} (L⊣R : L ⊣ R) where\n\nopen import Categories.Functor.Properties\n\nimport Categories.Morphism.Reasoning as MR\nimport Categories.Diagram.Limit as Lim\nimport Categories.Category.Construction.Cones as Con\n\nprivate\n module C = Category C\n module D = Category D\n module L = Functor L\n module R = Functor R\n\nopen Adjoint L⊣R\n\nmodule _ {o″ ℓ″ e″} {J : Category o″ ℓ″ e″} (F : Functor J D) where\n private\n module F = Functor F\n module LF = Lim F\n module CF = Con F\n\n RF = R ∘F F\n\n module LRF = Lim RF\n module CRF = Con RF\n\n rapl : LF.Limit → LRF.Limit\n rapl lim = record\n { terminal = record\n { ⊤ = ⊤\n ; ! = !\n ; !-unique = !-unique\n }\n }\n where module lim = LF.Limit lim\n open lim\n \n ⊤ : CRF.Cone\n ⊤ = record\n { N = R.F₀ apex\n ; apex = record\n { ψ = λ X → R.F₁ (proj X)\n ; commute = λ f → [ R ]-resp-∘ (limit-commute f)\n }\n }\n \n K′ : CRF.Cone → CF.Cone\n K′ K = record\n { N = L.F₀ K.N\n ; apex = record\n { ψ = λ X → counit.η (F.F₀ X) D.∘ L.F₁ (K.ψ X)\n ; commute = λ {X Y} f → begin\n F.F₁ f D.∘ counit.η (F.F₀ X) D.∘ L.F₁ (K.ψ X)\n ≈˘⟨ pushˡ (counit.commute (F.F₁ f)) ⟩\n (counit.η (F.F₀ Y) D.∘ L.F₁ (R.F₁ (F.F₁ f))) D.∘ L.F₁ (K.ψ X)\n ≈⟨ pullʳ ([ L ]-resp-∘ (K.commute f)) ⟩\n counit.η (F.F₀ Y) D.∘ L.F₁ (K.ψ Y)\n ∎\n }\n }\n where module K = CRF.Cone K\n open D.HomReasoning\n open MR D\n \n module K′ K = CF.Cone (K′ K)\n \n ! : ∀ {K : CRF.Cone} → CRF.Cones [ K , ⊤ ]\n ! {K} = record\n { arr = R.F₁ (rep (K′ K)) C.∘ unit.η K.N\n ; commute = commute′\n }\n where module K = CRF.Cone K\n commute′ : ∀ {X} → R.F₁ (proj X) C.∘ R.F₁ (rep (K′ K)) C.∘ unit.η K.N C.≈ K.ψ X\n commute′ {X} = begin\n R.F₁ (proj X) C.∘ R.F₁ (rep (K′ K)) C.∘ unit.η K.N\n ≈⟨ pullˡ ([ R ]-resp-∘ commute) ⟩\n R.F₁ (K′.ψ K X) C.∘ unit.η K.N\n ≈⟨ LRadjunct≈id ⟩\n K.ψ X\n ∎\n where open C.HomReasoning\n open MR C\n\n module ! {K} = CRF.Cone⇒ (! {K})\n \n !-unique : ∀ {K : CRF.Cone} (f : CRF.Cones [ K , ⊤ ]) → CRF.Cones [ ! ≈ f ]\n !-unique {K} f =\n let open C.HomReasoning\n open MR C\n in begin\n R.F₁ (rep (K′ K)) C.∘ unit.η K.N ≈⟨ R.F-resp-≈ (terminal.!-unique f′) ⟩∘⟨refl ⟩\n Ladjunct (Radjunct f.arr) ≈⟨ LRadjunct≈id ⟩\n f.arr ∎\n where module K = CRF.Cone K\n module f = CRF.Cone⇒ f\n \n f′ : CF.Cones [ K′ K , limit ]\n f′ = record\n { arr = Radjunct f.arr\n ; commute = λ {X} → begin\n proj X D.∘ Radjunct f.arr ≈˘⟨ pushˡ (counit.commute (proj X)) ⟩\n (counit.η (F.F₀ X) D.∘ L.F₁ (R.F₁ (proj X))) D.∘ L.F₁ f.arr ≈˘⟨ pushʳ L.homomorphism ⟩\n Radjunct (R.F₁ (proj X) C.∘ f.arr) ≈⟨ Radjunct-resp-≈ f.commute ⟩\n Radjunct (K.ψ X) ∎\n }\n where open D.HomReasoning\n open MR D\n", "meta": {"hexsha": "b701bf681849447fa3e4e1aad73faef160263503", "size": 4042, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Adjoint/RAPL.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Adjoint/RAPL.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Adjoint/RAPL.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.547008547, "max_line_length": 119, "alphanum_fraction": 0.400544285, "num_tokens": 1326, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.880797071719777, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6798374834773694}} {"text": "module BTA-ken where\n-- specialize two-level typed terms to untyped lambda calculus\n\nopen import Data.Nat hiding (_<_)\nopen import Data.Bool\nopen import Data.Fin hiding (_≤_ ; pred; _+_)\nopen import Data.List\nopen import Data.Product\n\nopen import Function\nopen import Algebra.FunctionProperties using (Commutative; Identity; RightIdentity)\nopen import Relation.Binary.PropositionalEquality as PropEq\n using (_≡_; _≢_; refl; sym; cong; cong₂)\nopen PropEq.≡-Reasoning\nopen import Data.Nat.Properties\n\n-- Binding times\ndata BT : Set where\n S : BT\n D : BT\n\n-- defining a data type [BT],where two members are\n-- [S] standing for \"static\" and [D] standing for dynamic.\n\n-- ``subsumption'' binding times; static can be treated as dynamic,\n-- but not vice versa\n_≼_ : BT → BT → Bool\n_≼_ D S = false\n_≼_ _ _ = true\n\nrecord True : Set where\ndata False : Set where\n\nisTrue : Bool → Set\nisTrue true = True\nisTrue false = False\n\n-- More general purpose definitions (should also be in standard library)\n-- list membership\ninfix 4 _∈_\ndata _∈_ {A : Set} : A → List A → Set where\n hd : ∀ {x xs} → x ∈ (x ∷ xs)\n tl : ∀ {x y xs} → x ∈ xs → x ∈ (y ∷ xs)\n\n\n-- Types of the calculus\nmutual\n -- s ^ BT\n data AType : Set where\n Ann : BT → SType → AType\n\n -- int | t -> t\n data SType : Set where\n SInt : SType\n SFun : AType → AType → SType\n\n-- aux definitions\nATInt : BT → AType\nATInt bt = Ann bt SInt\nATFun : BT → AType → AType → AType\nATFun bt at1 at2 = Ann bt (SFun at1 at2)\n\n-- projection: get the BT from a type\nbtof : AType → BT\nbtof (Ann bt _) = bt\n\n-- well-formedness\ndata wft : AType → Set where\n wf-int : ∀ {bt} → wft (Ann bt SInt)\n wf-fun : ∀ {bt at1 at2} → wft at1 → wft at2\n → isTrue (bt ≼ btof at1) → isTrue (bt ≼ btof at2) → wft (Ann bt (SFun at1 at2))\n\n-- test for dynamic by wellformedness\ndata IsDynamic : AType → Set where\n is-dyn : ∀ σ → IsDynamic (Ann D σ)\n\nlem-IsDynamic-by-wf : ∀ α → isTrue (D ≼ btof α) → IsDynamic α\nlem-IsDynamic-by-wf (Ann S σ) ()\nlem-IsDynamic-by-wf (Ann D σ) _ = is-dyn σ \n\n-- typed annotated expressions\nACtx = List AType\n\ndata AExp (Δ : ACtx) : AType → Set where\n AVar : ∀ {α} → α ∈ Δ → AExp Δ α\n AInt : (bt : BT) → ℕ → AExp Δ (ATInt bt)\n ALam : ∀ {α₁ α₂} (bt : BT) → wft (ATFun bt α₂ α₁) → AExp (α₂ ∷ Δ) α₁ → AExp Δ (ATFun bt α₂ α₁)\n AApp : ∀ {α₁ α₂} (bt : BT) → wft (ATFun bt α₂ α₁) → AExp Δ (ATFun bt α₂ α₁) → AExp Δ α₂ → AExp Δ α₁\n\n\n-- Untyped expression, but correctly scoped\ndata Exp' : ℕ → Set where\n EVar : ∀ {n} → Fin n → Exp' n\n EInt : ∀ {n} → ℕ → Exp' n\n ELam : ∀ {n} → Exp' (suc n) → Exp' n\n EApp : ∀ {n} → Exp' n → Exp' n → Exp' n\n\n---\n\nm+1+n≡1+m+n : ∀ m n → m + suc n ≡ suc (m + n)\nm+1+n≡1+m+n zero n = refl\nm+1+n≡1+m+n (suc m) n = cong suc (m+1+n≡1+m+n m n)\n\nn+0≡n : ∀ n → n + 0 ≡ n\nn+0≡n zero = refl\nn+0≡n (suc n) = cong suc $ n+0≡n n\n\n+-comm : ∀ m n → m + n ≡ n + m\n+-comm zero n = sym (n+0≡n n)\n+-comm (suc m) n =\n begin\n suc m + n\n ≡⟨ refl ⟩\n suc (m + n)\n ≡⟨ cong suc (+-comm m n) ⟩\n suc (n + m)\n ≡⟨ sym (m+1+n≡1+m+n n m) ⟩\n n + suc m\n ∎\n\n≤-refl : ∀ {n} → n ≤ n\n≤-refl {zero} = z≤n\n≤-refl {suc n} = s≤s ≤-refl\n\n≤-trans : ∀ {a b c} → a ≤ b → b ≤ c → a ≤ c\n≤-trans z≤n q = z≤n\n≤-trans (s≤s p) (s≤s q) = s≤s (≤-trans p q)\n\n≤-suc-right : ∀ {m n} → m ≤ n → m ≤ suc n\n≤-suc-right z≤n = z≤n\n≤-suc-right (s≤s p) = s≤s (≤-suc-right p)\n\n≤-suc-left : ∀ {m n} → suc m ≤ n → m ≤ n\n≤-suc-left (s≤s p) = ≤-suc-right p\n\nxlate : ∀ {m} {n} → Exp' (m + suc n) → Exp' (suc (n + m))\nxlate {m} {n} e rewrite m+1+n≡1+m+n m n | +-comm m n = e\n\nshifter1 : ∀ {n} m → Exp' (suc n) → Exp' (suc (n + m))\nshifter1 {n} m (EVar x) = xlate {m} (EVar (raise m x)) \nshifter1 m (EInt x) = EInt x\nshifter1 m (ELam e) = ELam (shifter1 m e)\nshifter1 m (EApp e e₁) = EApp (shifter1 m e) (shifter1 m e₁)\n\nshifter0 : ∀ m → Exp' zero → Exp' m\nshifter0 m (EVar ())\nshifter0 m (EInt x) = EInt x\nshifter0 m (ELam e) = ELam (shifter1 m e)\nshifter0 m (EApp e e₁) = EApp (shifter0 m e) (shifter0 m e₁)\n\nshifter : ∀ m d → Exp' m → Exp' (m + d)\nshifter zero d e = shifter0 d e\nshifter (suc m) d e = shifter1 d e\n\n-- m+n∸m≡n : ∀ {m n} → m ≤ n → m + (n ∸ m) ≡ n\n-- m+n∸m≡n p\n\nhelper : ∀ {m n} → n ≤ m → Exp' (n + (m ∸ n)) → Exp' m\nhelper p e rewrite m+n∸m≡n p = e\n\n\n-- index m = nesting level of dynamic definitions\nImp : (m : ℕ) → AType → Set\nImp m (Ann S SInt) = ℕ\nImp m (Ann S (SFun α₁ α₂)) = ∀ n → m ≤ n → (Imp n α₁ → Imp n α₂)\nImp m (Ann D σ) = Exp' m\n\n-- index = nesting level of dynamic definitions\ndata AEnv1 : ℕ → ACtx → Set where\n [] : AEnv1 0 []\n consS : ∀ {m Δ o} → m ≤ o → (α : AType) → Imp o α → AEnv1 m Δ → AEnv1 o (α ∷ Δ)\n consD : ∀ {m Δ} → (α : AType) → isTrue (D ≼ btof α) → Imp (suc m) α → AEnv1 m Δ → AEnv1 (suc m) (α ∷ Δ)\n\nlift1 : ∀ {m n} α → m ≤ n → Imp m α → Imp n α \nlift1 (Ann S SInt) p v = v\nlift1 (Ann S (SFun x x₁)) p v = λ k n≤k → v k (≤-trans p n≤k)\nlift1 {m} {n} (Ann D σ) p v = helper p (shifter m (n ∸ m) v)\n\nlookup1 : ∀ {α Δ m n} → m  ≤ n → AEnv1 m Δ → α ∈ Δ → Imp n α\nlookup1 {α} p (consS _ .α x env) hd = lift1 α p x\nlookup1 {α} p (consD .α x x₁ env) hd = lift1 α p x₁\nlookup1 p (consS p' .y x env) (tl {_} {y} x₁) = lookup1 (≤-trans p' p) env x₁\nlookup1 p (consD .y x x₁ env) (tl {_} {y} x₂) = lookup1 (≤-suc-left p) env x₂\n\npe1 : ∀ {α Δ} m → AExp Δ α → AEnv1 m Δ → Imp m α\npe1 m (AVar x) env = lookup1 ≤-refl env x\npe1 m (AInt S x) env = x\npe1 m (AInt D x) env = EInt x\npe1 m (ALam S x e) env = λ o p → λ v → pe1 o e (consS p _ v env)\npe1 m (ALam {α₂} {α₁} D (wf-fun w₁ w₂ d≤bt₁ d≤bt₂) e) env \n with lem-IsDynamic-by-wf α₁ d≤bt₁ | lem-IsDynamic-by-wf α₂ d≤bt₂ \npe1 m (ALam {.(Ann D σ₂)} {.(Ann D σ₁)} D (wf-fun _ _ d≤bt₁ d≤bt₂) e) env\n | is-dyn σ₁ | is-dyn σ₂ = ELam (pe1 (suc m) e (consD (Ann D σ₁) d≤bt₁ (EVar zero) env))\npe1 m (AApp S x e e₁) env = (pe1 m e env) m ≤-refl (pe1 m e₁ env)\npe1 m (AApp {α₂} {α₁} D (wf-fun w₁ w₂ d≤bt₁ d≤bt₂) e e₁) env \n with lem-IsDynamic-by-wf α₁ d≤bt₁ | lem-IsDynamic-by-wf α₂ d≤bt₂ \npe1 m (AApp {.(Ann D σ₂)} {.(Ann D σ₁)} D (wf-fun w₁ w₂ d≤bt₁ d≤bt₂) e e₁) env\n | is-dyn σ₁ | is-dyn σ₂ = EApp (pe1 m e env) (pe1 m e₁ env)\n", "meta": {"hexsha": "4755a2cb3f94d9b664e0a8512edebce12187e29c", "size": 6066, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "BTA-ken.agda", "max_stars_repo_name": "luminousfennell/polybta", "max_stars_repo_head_hexsha": "ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-10-15T04:35:29.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-15T04:35:29.000Z", "max_issues_repo_path": "BTA-ken.agda", "max_issues_repo_name": "luminousfennell/polybta", "max_issues_repo_head_hexsha": "ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "BTA-ken.agda", "max_forks_repo_name": "luminousfennell/polybta", "max_forks_repo_head_hexsha": "ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-10-15T09:01:37.000Z", "max_forks_repo_forks_event_max_datetime": "2019-10-15T09:01:37.000Z", "avg_line_length": 30.4824120603, "max_line_length": 105, "alphanum_fraction": 0.5720408836, "num_tokens": 2736, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.880797071719777, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6798374834773694}} {"text": "{-\nThis second-order signature was created from the following second-order syntax description:\n\nsyntax STLC | Λ\n\ntype\n N : 0-ary\n _↣_ : 2-ary | r30\n\nterm\n app : α ↣ β α -> β | _$_ l20\n lam : α.β -> α ↣ β | ƛ_ r10\n\ntheory\n (ƛβ) b : α.β a : α |> app (lam(x.b[x]), a) = b[a]\n (ƛη) f : α ↣ β |> lam (x. app(f, x)) = f\n-}\n\nmodule STLC.Signature where\n\nopen import SOAS.Context\n\n-- Type declaration\ndata ΛT : Set where\n N : ΛT\n _↣_ : ΛT → ΛT → ΛT\ninfixr 30 _↣_\n\n\nopen import SOAS.Syntax.Signature ΛT public\nopen import SOAS.Syntax.Build ΛT public\n\n-- Operator symbols\ndata Λₒ : Set where\n appₒ lamₒ : {α β : ΛT} → Λₒ\n\n-- Term signature\nΛ:Sig : Signature Λₒ\nΛ:Sig = sig λ\n { (appₒ {α}{β}) → (⊢₀ α ↣ β) , (⊢₀ α) ⟼₂ β\n ; (lamₒ {α}{β}) → (α ⊢₁ β) ⟼₁ α ↣ β\n }\n\nopen Signature Λ:Sig public\n", "meta": {"hexsha": "c23fac95f99721d2968ebd2a2a63d35701e5d422", "size": 807, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/STLC/Signature.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/STLC/Signature.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/STLC/Signature.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 17.9333333333, "max_line_length": 91, "alphanum_fraction": 0.5786864932, "num_tokens": 364, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802507195636, "lm_q2_score": 0.740174367770488, "lm_q1q2_score": 0.6798355388860323}} {"text": "{-# OPTIONS --without-K #-}\nmodule sets.finite.infinite where\n\nopen import sum\nopen import equality.core\nopen import function.isomorphism.core\nopen import function.isomorphism.utils\nopen import sets.nat\nopen import sets.empty\nopen import sets.unit\nopen import sets.fin.core\nopen import sets.fin.properties\nopen import sets.fin.universe\nopen import sets.finite.core\n\nℕ-not-finite : ¬ (IsFinite ℕ)\nℕ-not-finite (n , fℕ) = suc-fixpoint (sym (Fin-inj iso-suc))\n where\n iso-suc : Fin n ≅ Fin (suc n)\n iso-suc = sym≅ fℕ\n ·≅ isoℕ\n ·≅ ⊎-ap-iso refl≅ fℕ\n ·≅ sym≅ fin-struct-iso\n", "meta": {"hexsha": "b2db6e2bff37df8b515ba0dc4e808273e1ef3aa9", "size": 606, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/sets/finite/infinite.agda", "max_stars_repo_name": "pcapriotti/agda-base", "max_stars_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2015-06-12T12:20:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-01T11:25:54.000Z", "max_issues_repo_path": "src/sets/finite/infinite.agda", "max_issues_repo_name": "pcapriotti/agda-base", "max_issues_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-02T14:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-26T11:57:26.000Z", "max_forks_repo_path": "src/sets/finite/infinite.agda", "max_forks_repo_name": "pcapriotti/agda-base", "max_forks_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-02-02T12:17:00.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-04T19:31:00.000Z", "avg_line_length": 25.25, "max_line_length": 60, "alphanum_fraction": 0.6897689769, "num_tokens": 187, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802417938535, "lm_q2_score": 0.7401743677704878, "lm_q1q2_score": 0.6798355322794503}} {"text": "\nmodule InferrableFields where\n\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n\ndata Vec A : ℕ → Set where\n [] : Vec A zero\n _∷_ : ∀ {n} → A → Vec A n → Vec A (suc n)\n\nrecord SomeVec A : Set where\n field n : ℕ\n unpack : Vec A n\n\nopen SomeVec using (unpack)\n\npack : ∀ {A n} → Vec A n -> SomeVec A\npack xs = record { unpack = xs }\n\ndata _≡_ {A : Set}(x : A) : A → Set where\n refl : x ≡ x\n\nlemPack : ∀ {A}(xs : SomeVec A) → pack (unpack xs) ≡ xs\nlemPack xs = refl\n", "meta": {"hexsha": "fd83fa80359e7e191d9107ae843c9e9e61e8c429", "size": 476, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/InferrableFields.agda", "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/Succeed/InferrableFields.agda", "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/InferrableFields.agda", "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 18.3076923077, "max_line_length": 55, "alphanum_fraction": 0.5567226891, "num_tokens": 179, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802373309982, "lm_q2_score": 0.7401743620390163, "lm_q1q2_score": 0.6798355237119159}} {"text": "module Type.Size.Finite where\n\nimport Lvl\nopen import Functional\nopen import Logic\nopen import Logic.Predicate\nopen import Numeral.Finite\nopen import Numeral.Finite.Equiv\nopen import Numeral.Natural\nopen import Structure.Setoid\nopen import Type\nopen import Type.Size\n\nprivate variable ℓ ℓₑ : Lvl.Level\n\n-- A finitely enumerable type is a type where its inhabitants are finitely enumerable (alternatively: listable, able to collect to a finite list (a list containing all inhabitants is constructible)).\n-- There is a finite upper bound on the number of inhabitants in the sense that the inverse of a mapping from a type of finite numbers is a function (TODO: Not sure if the implementation actually states this. Maybe Invertible should be used instead of Surjective?).\n-- Also called: Finitely indexed.\nFinitelyEnumerable : (T : Type{ℓ}) → ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → Stmt\nFinitelyEnumerable(T) = ∃(n ↦ 𝕟(n) ≽ T)\n\n-- A finite type have a finite number of inhabitants, and this number is constructable.\nFinite : (T : Type{ℓ}) → ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → Stmt\nFinite(T) = ∃(n ↦ 𝕟(n) ≍ T)\n\n-- Cardinality of a finite type in the form of a number. Number of inhabitants of a type.\n-- The witness of Finite is the exact number of inhabitants of the type (the count).\n#_ : (T : Type{ℓ}) → ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → ⦃ fin : Finite(T) ⦄ → ℕ\n#_ _ ⦃ fin = [∃]-intro(n) ⦄ = n\n\nenum : ∀{T : Type{ℓ}} → ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → ⦃ fin : Finite(T) ⦄ → 𝕟(# T) → T\nenum ⦃ fin = [∃]-intro _ ⦃ [∃]-intro f ⦄ ⦄ = f\n\nmodule Finite where\n import Data.Either as Type\n import Data.Either.Equiv as Either\n import Data.Tuple as Type\n import Data.Tuple.Equiv as Tuple\n open import Numeral.Finite.Sequence\n open import Structure.Function.Domain\n import Numeral.Natural.Oper as ℕ\n\n private variable A B : Type{ℓ}\n private variable ⦃ equiv-A ⦄ : Equiv{ℓₑ}(A)\n private variable ⦃ equiv-B ⦄ : Equiv{ℓₑ}(B)\n private variable ⦃ equiv-A‖B ⦄ : Equiv{ℓₑ}(A Type.‖ B)\n private variable ⦃ equiv-A⨯B ⦄ : Equiv{ℓₑ}(A Type.⨯ B)\n\n _+_ : ⦃ ext : Either.Extensionality ⦃ equiv-A ⦄ ⦃ equiv-B ⦄ (equiv-A‖B) ⦄ → Finite(A) ⦃ equiv-A ⦄ → Finite(B) ⦃ equiv-B ⦄ → Finite(A Type.‖ B) ⦃ equiv-A‖B ⦄\n _+_ ([∃]-intro a ⦃ [∃]-intro af ⦄) ([∃]-intro b ⦃ [∃]-intro bf ⦄) = [∃]-intro (a ℕ.+ b) ⦃ [∃]-intro (interleave af bf) ⦃ interleave-bijective ⦄ ⦄\n\n -- TODO: Below\n _⋅_ : ⦃ ext : Tuple.Extensionality ⦃ equiv-A ⦄ ⦃ equiv-B ⦄ (equiv-A⨯B) ⦄ → Finite(A) ⦃ equiv-A ⦄ → Finite(B) ⦃ equiv-B ⦄ → Finite(A Type.⨯ B) ⦃ equiv-A⨯B ⦄\n _⋅_ ([∃]-intro a ⦃ [∃]-intro af ⦄) ([∃]-intro b ⦃ [∃]-intro bf ⦄) = [∃]-intro (a ℕ.⋅ b) ⦃ [∃]-intro (f af bf) ⦃ p ⦄ ⦄ where\n postulate f : (𝕟(a) → _) → (𝕟(b) → _) → 𝕟(a ℕ.⋅ b) → (_ Type.⨯ _)\n postulate p : Bijective(f af bf)\n\n {-\n _^_ : Finite(A) → Finite(B) → Finite(A ← B)\n _^_ ([∃]-intro a ⦃ [∃]-intro af ⦄) ([∃]-intro b ⦃ [∃]-intro bf ⦄) = [∃]-intro (a ℕ.^ b) ⦃ [∃]-intro (f af bf) ⦃ p ⦄ ⦄ where\n postulate f : (𝕟(a) → _) → (𝕟(b) → _) → 𝕟(a ℕ.^ b) → (_ ← _)\n postulate p : Bijective(f af bf)\n -}\n", "meta": {"hexsha": "74f337aa6ba6c90afeae72e8cd34dc9d588c8daa", "size": 3036, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type/Size/Finite.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Type/Size/Finite.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Type/Size/Finite.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 47.4375, "max_line_length": 265, "alphanum_fraction": 0.6235177866, "num_tokens": 1232, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942348544446, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6797251930973605}} {"text": "{-# OPTIONS --without-K #-}\n\nmodule sets.bool where\n\nopen import sets.empty using (⊥)\nopen import sets.unit using (⊤)\nopen import decidable using (Dec; yes; no)\nopen import equality.core using (_≡_; refl)\nopen import level using (Level)\n\ninfixr 6 _∧_\ninfixr 5 _∨_ _xor_\ninfix 0 if_then_else_\n\ndata Bool : Set where\n true false : Bool\n\nnot : Bool → Bool\nnot true = false\nnot false = true\n\nT : Bool → Set\nT true = ⊤\nT false = ⊥\n\nif_then_else_ : {a : Level} {A : Set a} → Bool → A → A → A\nif true then t else f = t\nif false then t else f = f\n\n_∧_ : Bool → Bool → Bool\ntrue ∧ b = b\nfalse ∧ b = false\n\n_∨_ : Bool → Bool → Bool\ntrue ∨ b = true\nfalse ∨ b = b\n\n_xor_ : Bool → Bool → Bool\ntrue xor b = not b\nfalse xor b = b\n\n_≟_ : (a b : Bool) → Dec (a ≡ b)\ntrue ≟ true = yes refl\nfalse ≟ false = yes refl\ntrue ≟ false = no λ ()\nfalse ≟ true = no λ ()\n", "meta": {"hexsha": "9a1b5459e2707c54360ea125a1f026ea3d839391", "size": 876, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "sets/bool.agda", "max_stars_repo_name": "HoTT/M-types", "max_stars_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 27, "max_stars_repo_stars_event_min_datetime": "2015-04-14T15:47:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-09T07:26:57.000Z", "max_issues_repo_path": "src/sets/bool.agda", "max_issues_repo_name": "pcapriotti/agda-base", "max_issues_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-02T14:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-26T11:57:26.000Z", "max_forks_repo_path": "src/sets/bool.agda", "max_forks_repo_name": "pcapriotti/agda-base", "max_forks_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-02-02T12:17:00.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-04T19:31:00.000Z", "avg_line_length": 18.6382978723, "max_line_length": 58, "alphanum_fraction": 0.6061643836, "num_tokens": 316, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942173896131, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6797251845544465}} {"text": "-- Agda program using the Iowa Agda library\n{-# OPTIONS --termination-depth=2 #-}\n\nmodule PROOF-gamelength\n where\n\nopen import eq\nopen import bool\nopen import nat\nopen import nat-thms\nopen import list\nopen import nondet\nopen import nondet-thms\n\n---------------------------------------------------------------------------\n-- Translated Curry operations:\n\ndata Move : Set where\n L : Move\n R : Move\n\nsolve2 : ℕ → ℕ → ND (𝕃 Move)\nsolve2 zero zero = Val []\nsolve2 (suc x) zero = mapND (_::_ L) (solve2 x zero)\nsolve2 zero (suc y) = mapND (_::_ R) (solve2 zero y)\nsolve2 (suc z) (suc u) = (mapND (_::_ L) (solve2 z (suc u)))\n ?? (mapND (_::_ R) (solve2 (suc z) u))\n\nlen : {a : Set} → 𝕃 a → ℕ\nlen [] = zero\nlen (x :: y) = suc (len y)\n\n---------------------------------------------------------------------------\n\n-- Theorem: the length of every solution is the sum of the input arguments\ngamelength : (x : ℕ) → (y : ℕ)\n → (solve2 x y) satisfy (λ xs → length xs =ℕ x + y) ≡ tt\ngamelength zero zero = refl\ngamelength zero (suc y)\n rewrite\n satisfy-mapND (_::_ R) (solve2 zero y) (λ xs → length xs =ℕ zero + suc y)\n | gamelength zero y = refl\ngamelength (suc x) zero\n rewrite \n satisfy-mapND (_::_ L) (solve2 x zero) (λ xs → length xs =ℕ suc x + zero)\n | gamelength x zero = refl\ngamelength (suc x) (suc y)\n rewrite\n satisfy-mapND (_::_ L) (solve2 x (suc y)) (λ xs → length xs =ℕ suc x + suc y)\n | satisfy-mapND (_::_ R) (solve2 (suc x) y) (λ xs → length xs =ℕ suc x + suc y)\n | gamelength x (suc y)\n | +suc x y\n | gamelength (suc x) y\n = refl\n\n---------------------------------------------------------------------------\n", "meta": {"hexsha": "4bca6e9f711b6b7980bf55d4e6a01c95f84f26fb", "size": 1668, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "currypp/.cpm/packages/verify/examples/PROOF-gamelength.agda", "max_stars_repo_name": "phlummox/curry-tools", "max_stars_repo_head_hexsha": "7905bc4f625a94a725f9f6d8a2de1140bea5e471", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "currypp/.cpm/packages/verify/examples/PROOF-gamelength.agda", "max_issues_repo_name": "phlummox/curry-tools", "max_issues_repo_head_hexsha": "7905bc4f625a94a725f9f6d8a2de1140bea5e471", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "currypp/.cpm/packages/verify/examples/PROOF-gamelength.agda", "max_forks_repo_name": "phlummox/curry-tools", "max_forks_repo_head_hexsha": "7905bc4f625a94a725f9f6d8a2de1140bea5e471", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.2631578947, "max_line_length": 80, "alphanum_fraction": 0.528177458, "num_tokens": 513, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942144788076, "lm_q2_score": 0.7634837635542925, "lm_q1q2_score": 0.6797251775408926}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Morphism.IsoEquiv {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\nopen import Function using (flip; _on_)\nopen import Relation.Binary hiding (_⇒_)\nimport Relation.Binary.Construct.On as On\n\nopen import Categories.Morphism 𝒞\n\nopen Category 𝒞\n\nprivate\n variable\n A B C : Obj\n\n-- Two lemmas to set things up: if they exist, inverses are unique.\n\nto-unique : ∀ {f₁ f₂ : A ⇒ B} {g₁ g₂} →\n Iso f₁ g₁ → Iso f₂ g₂ → f₁ ≈ f₂ → g₁ ≈ g₂\nto-unique {_} {_} {f₁} {f₂} {g₁} {g₂} iso₁ iso₂ hyp = begin\n g₁ ≈˘⟨ identityˡ ⟩\n id ∘ g₁ ≈˘⟨ ∘-resp-≈ˡ Iso₂.isoˡ ⟩\n (g₂ ∘ f₂) ∘ g₁ ≈˘⟨ ∘-resp-≈ˡ (∘-resp-≈ʳ hyp) ⟩\n (g₂ ∘ f₁) ∘ g₁ ≈⟨ assoc ⟩\n g₂ ∘ (f₁ ∘ g₁) ≈⟨ ∘-resp-≈ʳ Iso₁.isoʳ ⟩\n g₂ ∘ id ≈⟨ identityʳ ⟩\n g₂ ∎\n where\n open HomReasoning\n module Iso₁ = Iso iso₁\n module Iso₂ = Iso iso₂\n\nfrom-unique : ∀ {f₁ f₂ : A ⇒ B} {g₁ g₂} →\n Iso f₁ g₁ → Iso f₂ g₂ → g₁ ≈ g₂ → f₁ ≈ f₂\nfrom-unique iso₁ iso₂ hyp = to-unique iso₁⁻¹ iso₂⁻¹ hyp\n where\n iso₁⁻¹ = record { isoˡ = Iso.isoʳ iso₁ ; isoʳ = Iso.isoˡ iso₁ }\n iso₂⁻¹ = record { isoˡ = Iso.isoʳ iso₂ ; isoʳ = Iso.isoˡ iso₂ }\n\n-- Equality of isomorphisms is just equality of the underlying morphism(s).\n--\n-- Only one equation needs to be given; the equation in the other\n-- direction holds automatically (by the above lemmas).\n--\n-- The reason for wrapping the underlying equality in a record at all\n-- is that this helps unification. Concretely, it allows Agda to\n-- infer the isos |i| and |j| being related in function applications\n-- where only the equation |i ≃ j| is passed as an explicit argument.\n\ninfix 4 _≃_\nrecord _≃_ (i j : A ≅ B) : Set e where\n constructor ⌞_⌟\n open _≅_\n field from-≈ : from i ≈ from j\n\n to-≈ : to i ≈ to j\n to-≈ = to-unique (iso i) (iso j) from-≈\n\nopen _≃_\n\n≃-isEquivalence : IsEquivalence (_≃_ {A} {B})\n≃-isEquivalence = record\n { refl = ⌞ refl ⌟\n ; sym = λ where ⌞ eq ⌟ → ⌞ sym eq ⌟\n ; trans = λ where ⌞ eq₁ ⌟ ⌞ eq₂ ⌟ → ⌞ trans eq₁ eq₂ ⌟\n }\n where open Equiv\n\n≃-setoid : ∀ {A B : Obj} → Setoid _ _\n≃-setoid {A} {B} = record\n { Carrier = A ≅ B\n ; _≈_ = _≃_\n ; isEquivalence = ≃-isEquivalence\n }\n\n----------------------------------------------------------------------\n\n-- An alternative, more direct notion of equality on isomorphisms that\n-- involves no wrapping/unwrapping.\n\ninfix 4 _≃′_\n_≃′_ : Rel (A ≅ B) e\n_≃′_ = _≈_ on _≅_.from\n\n≃′-isEquivalence : IsEquivalence (_≃′_ {A} {B})\n≃′-isEquivalence = On.isEquivalence _≅_.from equiv\n\n≃′-setoid : ∀ {A B : Obj} → Setoid _ _\n≃′-setoid {A} {B} = record\n { Carrier = A ≅ B\n ; _≈_ = _≃′_\n ; isEquivalence = ≃′-isEquivalence\n }\n\n-- The two notions of equality are equivalent\n\n≃⇒≃′ : ∀ {i j : A ≅ B} → i ≃ j → i ≃′ j\n≃⇒≃′ eq = from-≈ eq\n\n≃′⇒≃ : ∀ {i j : A ≅ B} → i ≃′ j → i ≃ j\n≃′⇒≃ {_} {_} {i} {j} eq = ⌞ eq ⌟\n", "meta": {"hexsha": "b7b7c6e080a5512827c4570a884754bd71b0ef92", "size": 2983, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Morphism/IsoEquiv.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Morphism/IsoEquiv.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Morphism/IsoEquiv.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.141509434, "max_line_length": 75, "alphanum_fraction": 0.5655380489, "num_tokens": 1229, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767778695834, "lm_q2_score": 0.7745833737577158, "lm_q1q2_score": 0.6796789229962718}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\nopen import Categories.Object.Terminal\n\n-- Various constructors of Product Objects\n\nmodule Categories.Object.Product.Construction {o ℓ e} (C : Category o ℓ e) (T : Terminal C) where\n\nopen import Categories.Object.Exponential C hiding (repack)\nopen import Categories.Object.Product C\nopen Category C\nopen Terminal T\nopen HomReasoning\n\n-- we can get some products\n[⊤×⊤]-product : Product ⊤ ⊤\n[⊤×⊤]-product = record\n { A×B = ⊤\n ; π₁ = !\n ; π₂ = !\n ; ⟨_,_⟩ = λ _ _ → !\n ; project₁ = !-unique₂\n ; project₂ = !-unique₂\n ; unique = λ _ _ → !-unique _\n }\n\n[⊤×_]-product : (X : Obj) → Product ⊤ X\n[⊤×_]-product X = record\n { A×B = X\n ; π₁ = !\n ; π₂ = id\n ; ⟨_,_⟩ = λ _ y → y\n ; project₁ = !-unique₂\n ; project₂ = identityˡ\n ; unique = λ _ id∘h≈j → ⟺ id∘h≈j ○ identityˡ\n }\n\n[_×⊤]-product : (X : Obj) → Product X ⊤\n[_×⊤]-product X = Reversible [⊤× X ]-product\n\n-- and some exponentials too\n[_↑⊤]-exponential : (B : Obj) → Exponential ⊤ B\n[ B ↑⊤]-exponential = record\n { B^A = B\n ; product = [ B ×⊤]-product\n ; eval = id\n ; λg = λ {X} X×⊤ X⇒B → X⇒B ∘ repack [ X ×⊤]-product X×⊤\n ; β = λ p {g} → begin\n id ∘ (g ∘ [ p ]⟨ id , ! ⟩) ∘ [ p ]π₁ ≈⟨ identityˡ ○ assoc ⟩\n g ∘ [ p ]⟨ id , ! ⟩ ∘ [ p ]π₁ ≈⟨ refl⟩∘⟨ [ p ]⟨⟩∘ ⟩\n g ∘ [ p ]⟨ id ∘ [ p ]π₁ , ! ∘ [ p ]π₁ ⟩ ≈⟨ refl⟩∘⟨ ⟨⟩-cong₂ p identityˡ !-unique₂ ⟩\n g ∘ [ p ]⟨ [ p ]π₁ , [ p ]π₂ ⟩ ≈⟨ refl⟩∘⟨ η p ○ identityʳ ⟩\n g ∎\n ; λ-unique = λ {X} p {g} {h} h-comm → begin\n h ≈˘⟨ identityʳ ⟩\n h ∘ id ≈˘⟨ refl⟩∘⟨ project₁ p ⟩\n h ∘ [ p ]π₁ ∘ [ p ]⟨ id , ! ⟩ ≈˘⟨ assoc ⟩\n (h ∘ [ p ]π₁) ∘ [ p ]⟨ id , ! ⟩ ≈˘⟨ identityˡ ⟩∘⟨refl ⟩\n (id ∘ h ∘ [ p ]π₁) ∘ [ p ]⟨ id , ! ⟩ ≈⟨ h-comm ⟩∘⟨refl ⟩\n g ∘ repack [ X ×⊤]-product p ∎\n }\n where open Product\n\n[⊤↑_]-exponential : (A : Obj) → Exponential A ⊤\n[⊤↑ A ]-exponential = record\n { B^A = ⊤\n ; product = [⊤× A ]-product\n ; eval = !\n ; λg = λ _ _ → !\n ; β = λ _ → !-unique₂\n ; λ-unique = λ _ _ → !-unique₂\n }\n", "meta": {"hexsha": "61a855ecd2ce2dc7c15042a91c6380b6bb95d25f", "size": 2194, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Object/Product/Construction.agda", "max_stars_repo_name": "Taneb/agda-categories", "max_stars_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Categories/Object/Product/Construction.agda", "max_issues_repo_name": "Taneb/agda-categories", "max_issues_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Object/Product/Construction.agda", "max_forks_repo_name": "Taneb/agda-categories", "max_forks_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.6486486486, "max_line_length": 97, "alphanum_fraction": 0.4649042844, "num_tokens": 979, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.921921841290738, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.679602215936659}} {"text": "{-\n Define finitely generated ideals of commutative rings and\n show that they are an ideal.\n Parts of this should be reusable for explicit constructions\n of free modules over a finite set.\n-}\n{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.CommRing.FGIdeal where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Powerset\nopen import Cubical.Foundations.HLevels\n\nopen import Cubical.Data.Sigma\nopen import Cubical.Data.FinData hiding (elim)\nopen import Cubical.Data.Nat using (ℕ)\n\nopen import Cubical.HITs.PropositionalTruncation\n\nopen import Cubical.Algebra.CommRing\nopen import Cubical.Algebra.CommRing.Ideal\nopen import Cubical.Algebra.Ring.QuotientRing\nopen import Cubical.Algebra.Ring.Properties\nopen import Cubical.Algebra.Ring.BigOps\nopen import Cubical.Algebra.RingSolver.ReflectionSolving\n\nprivate\n variable\n ℓ : Level\n\nmodule _ (Ring@(R , str) : CommRing ℓ) where\n infixr 5 _holds\n _holds : hProp ℓ → Type ℓ\n P holds = fst P\n open CommRingStr str\n open RingTheory (CommRing→Ring Ring)\n open Sum (CommRing→Ring Ring)\n\n linearCombination : {n : ℕ} → FinVec R n → FinVec R n → R\n linearCombination α V = ∑ (λ i → α i · V i)\n\n sumDist+ : ∀ {n : ℕ} (α β V : FinVec R n)\n → linearCombination (λ i → α i + β i) V ≡ linearCombination α V + linearCombination β V\n sumDist+ α β V = ∑Ext (λ i → ·Ldist+ (α i) (β i) (V i)) ∙ ∑Split (λ i → α i · V i) (λ i → β i · V i)\n\n dist- : ∀ {n : ℕ} (α V : FinVec R n)\n → linearCombination (λ i → - α i) V ≡ - linearCombination α V\n dist- α V = ∑Ext (λ i → -DistL· (α i) (V i)) ∙ ∑Dist- (λ i → α i · V i)\n\n dist0 : ∀ {n : ℕ} (V : FinVec R n)\n → linearCombination (replicateFinVec n 0r) V ≡ 0r\n dist0 {n = n} V = ∑Ext (λ i → 0LeftAnnihilates (V i)) ∙ ∑0r n\n\n isLinearCombination : {n : ℕ} → FinVec R n → R → Type ℓ\n isLinearCombination V x = ∃[ α ∈ FinVec R _ ] x ≡ linearCombination α V\n\n {- If x and y are linear combinations of l, then (x + y) is\n a linear combination. -}\n isLinearCombination+ : {n : ℕ} {x y : R} (V : FinVec R n)\n → isLinearCombination V x\n → isLinearCombination V y\n → isLinearCombination V (x + y)\n isLinearCombination+ V = map2 λ α β → (λ i → α .fst i + β .fst i)\n , cong₂ (_+_) (α .snd) (β .snd) ∙ sym (sumDist+ _ _ V)\n\n {- If x is a linear combinations of l, then -x is\n a linear combination. -}\n isLinearCombination- : {n : ℕ} {x : R} (V : FinVec R n)\n → isLinearCombination V x → isLinearCombination V (- x)\n isLinearCombination- V = map λ α → (λ i → - α .fst i) , cong (-_) (α .snd) ∙ sym (dist- _ V)\n\n {- 0r is the trivial linear Combination -}\n isLinearCombination0 : {n : ℕ} (V : FinVec R n)\n → isLinearCombination V 0r\n isLinearCombination0 V = ∣ _ , sym (dist0 V) ∣\n\n {- Linear combinations are stable under left multiplication -}\n isLinearCombinationL· : {n : ℕ} (V : FinVec R n) (r : R) {x : R}\n → isLinearCombination V x → isLinearCombination V (r · x)\n isLinearCombinationL· V r = map λ α → (λ i → r · α .fst i) , cong (r ·_) (α .snd)\n ∙∙ ∑Mulrdist r (λ i → α .fst i · V i)\n ∙∙ ∑Ext λ i → ·Assoc r (α .fst i) (V i)\n\n generatedIdeal : {n : ℕ} → FinVec R n → IdealsIn Ring\n generatedIdeal V = makeIdeal Ring\n (λ x → isLinearCombination V x , isPropPropTrunc)\n (isLinearCombination+ V)\n (isLinearCombination0 V)\n λ r → isLinearCombinationL· V r\n\n\nopen isCommIdeal\ngenIdeal : {n : ℕ} (R : CommRing ℓ) → FinVec (fst R) n → CommIdeal R\nfst (genIdeal R V) x = isLinearCombination R V x , isPropPropTrunc\n+Closed (snd (genIdeal R V)) = isLinearCombination+ R V\ncontains0 (snd (genIdeal R V)) = isLinearCombination0 R V\n·Closed (snd (genIdeal R V)) r = isLinearCombinationL· R V r\n\nsyntax genIdeal R V = ⟨ V ⟩[ R ]\n\n\nFGIdealIn : (R : CommRing ℓ) → Type (ℓ-suc ℓ)\nFGIdealIn R = Σ[ I ∈ CommIdeal R ] ∃[ n ∈ ℕ ] ∃[ V ∈ FinVec (fst R) n ] I ≡ ⟨ V ⟩[ R ]\n\n", "meta": {"hexsha": "155828212dfb936e09bc1de6b9af34708d70f698", "size": 4222, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommRing/FGIdeal.agda", "max_stars_repo_name": "marcinjangrzybowski/cubical", "max_stars_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 301, "max_stars_repo_stars_event_min_datetime": "2018-10-17T18:00:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T02:10:47.000Z", "max_issues_repo_path": "Cubical/Algebra/CommRing/FGIdeal.agda", "max_issues_repo_name": "marcinjangrzybowski/cubical", "max_issues_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 584, "max_issues_repo_issues_event_min_datetime": "2018-10-15T09:49:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T12:09:17.000Z", "max_forks_repo_path": "Cubical/Algebra/CommRing/FGIdeal.agda", "max_forks_repo_name": "marcinjangrzybowski/cubical", "max_forks_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 134, "max_forks_repo_forks_event_min_datetime": "2018-11-16T06:11:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T16:22:13.000Z", "avg_line_length": 40.2095238095, "max_line_length": 102, "alphanum_fraction": 0.5900047371, "num_tokens": 1374, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094145755219, "lm_q2_score": 0.7606506635289836, "lm_q1q2_score": 0.6794963989335586}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Dodo.Binary.Functional where\n\n-- Stdlib imports\nopen import Level using (Level; _⊔_)\nopen import Relation.Binary using (Rel; REL)\n-- Local imports\nopen import Dodo.Binary.Equality\n\n\n-- # Definitions #\n\nFunctional : ∀ {a b ℓ₁ ℓ₂ : Level} {A : Set a} {B : Set b}\n → Rel B ℓ₁\n → REL A B ℓ₂\n ---------------------\n → Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂)\nFunctional _≈_ r = ∀ x y₁ y₂ → r x y₁ → r x y₂ → y₁ ≈ y₂\n-- The /explicit/ x, y₁, and y₂ are crucial. If they're implicit, Agda will attempt to\n-- instantiate them when absent, which often fails to resolve. Not sure why.\n\n\n-- # Operations #\n\nmodule _ {a ℓ₁ ℓ₂ ℓ₃ : Level} {A : Set a} {≈ : Rel A ℓ₁} {P : Rel A ℓ₂} {Q : Rel A ℓ₃} where\n\n functional-⊆₂ : P ⊆₂ Q → Functional ≈ Q → Functional ≈ P\n functional-⊆₂ P⊆Q funcQ x y₁ y₂ Pxy₁ Pxy₂ = funcQ x y₁ y₂ (⊆₂-apply P⊆Q Pxy₁) (⊆₂-apply P⊆Q Pxy₂)\n", "meta": {"hexsha": "6b8d380808192152c29324c14125393b7e57cd4f", "size": 879, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Dodo/Binary/Functional.agda", "max_stars_repo_name": "sourcedennis/agda-dodo", "max_stars_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Dodo/Binary/Functional.agda", "max_issues_repo_name": "sourcedennis/agda-dodo", "max_issues_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Dodo/Binary/Functional.agda", "max_forks_repo_name": "sourcedennis/agda-dodo", "max_forks_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.3, "max_line_length": 99, "alphanum_fraction": 0.614334471, "num_tokens": 346, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094003735664, "lm_q2_score": 0.7606506526772884, "lm_q1q2_score": 0.6794963784369105}} {"text": "module Logic.Propositional.Theorems where\n\nopen import Data\nopen import Data.Either as Either using (_‖_)\nopen import Data.Tuple as Tuple using (_⨯_ ; _,_)\nopen import Functional\nopen import Logic\nopen import Logic.Propositional\nimport Lvl\nopen import Syntax.Type\nopen import Type\n\n------------------------------------------\n-- Reflexivity\n\nmodule _ {ℓ} {P : Stmt{ℓ}} where\n [↔]-reflexivity : (P ↔ P)\n [↔]-reflexivity = [↔]-intro id id\n\n [→]-reflexivity : (P → P)\n [→]-reflexivity = id\n\n------------------------------------------\n-- Transitivity\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}}{R : Stmt{ℓ₃}} where\n [→]-transitivity : (P → Q) → (Q → R) → (P → R)\n [→]-transitivity = liftᵣ\n\n [↔]-transitivity : (P ↔ Q) → (Q ↔ R) → (P ↔ R)\n [↔]-transitivity ([↔]-intro qp pq) ([↔]-intro rq qr) = [↔]-intro (qp ∘ rq) (qr ∘ pq)\n\n [∧]-transitivity : (P ∧ Q) → (Q ∧ R) → (P ∧ R)\n [∧]-transitivity ([∧]-intro p _) ([∧]-intro _ r) = [∧]-intro p r\n\n------------------------------------------\n-- Symmetry\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [∧]-symmetry : (P ∧ Q) → (Q ∧ P)\n [∧]-symmetry = Tuple.swap\n\n [∨]-symmetry : (P ∨ Q) → (Q ∨ P)\n [∨]-symmetry = Either.swap\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [↔]-symmetry : (P ↔ Q) → (Q ↔ P)\n [↔]-symmetry = [∧]-symmetry\n\n------------------------------------------\n-- Operators that implies other ones\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [∧]-to-[↔] : (P ∧ Q) → (P ↔ Q)\n [∧]-to-[↔] ([∧]-intro p q) = [↔]-intro (const p) (const q)\n\n [∧]-to-[→] : (P ∧ Q) → (P → Q)\n [∧]-to-[→] ([∧]-intro p q) = const q\n\n [∧]-to-[←] : (P ∧ Q) → (P ← Q)\n [∧]-to-[←] ([∧]-intro p q) = const p\n\n [∧]-to-[∨] : (P ∧ Q) → (P ∨ Q)\n [∧]-to-[∨] ([∧]-intro p q) = [∨]-introₗ p\n\n [∨]-to-[←][→] : (P ∨ Q) → (P ← Q)∨(P → Q)\n [∨]-to-[←][→] ([∨]-introₗ p) = [∨]-introₗ (const p)\n [∨]-to-[←][→] ([∨]-introᵣ q) = [∨]-introᵣ (const q)\n\n------------------------------------------\n-- Associativity (with respect to ↔)\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}}{R : Stmt{ℓ₃}} where\n [∧]-associativity : ((P ∧ Q) ∧ R) ↔ (P ∧ (Q ∧ R))\n [∧]-associativity = [↔]-intro l r\n where l : ((P ∧ Q) ∧ R) ← (P ∧ (Q ∧ R))\n l ([∧]-intro p ([∧]-intro q r)) = [∧]-intro ([∧]-intro p q) r\n\n r : ((P ∧ Q) ∧ R) → (P ∧ (Q ∧ R))\n r ([∧]-intro ([∧]-intro p q) r) = [∧]-intro p ([∧]-intro q r)\n\n [∨]-associativity : ((P ∨ Q) ∨ R) ↔ (P ∨ (Q ∨ R))\n [∨]-associativity = [↔]-intro l r\n where l : ((P ∨ Q) ∨ R) ← (P ∨ (Q ∨ R))\n l ([∨]-introₗ p) = [∨]-introₗ([∨]-introₗ p)\n l ([∨]-introᵣ([∨]-introₗ q)) = [∨]-introₗ([∨]-introᵣ q)\n l ([∨]-introᵣ([∨]-introᵣ r)) = [∨]-introᵣ r\n\n r : ((P ∨ Q) ∨ R) → (P ∨ (Q ∨ R))\n r ([∨]-introₗ([∨]-introₗ p)) = [∨]-introₗ p\n r ([∨]-introₗ([∨]-introᵣ q)) = [∨]-introᵣ([∨]-introₗ q)\n r ([∨]-introᵣ r) = [∨]-introᵣ([∨]-introᵣ r)\n\n-- TODO: According to https://math.stackexchange.com/questions/440261/associativity-of-iff , this is unprovable\n{-[↔]-associativity : ∀{P Q R : Stmt} → ((P ↔ Q) ↔ R) ↔ (P ↔ (Q ↔ R))\n[↔]-associativity {P}{Q}{R} = [↔]-intro [↔]-associativityₗ [↔]-associativityᵣ where\n [↔]-associativityₗ : ((P ↔ Q) ↔ R) ← (P ↔ (Q ↔ R))\n [↔]-associativityₗ ([↔]-intro yz2x x2yz) = [↔]-intro z2xy xy2z where\n z2xy : (P ↔ Q) ← R\n z2xy r = [↔]-intro y2x x2y where\n y2x : Q → P\n y2x q = yz2x([∧]-to-[↔]([∧]-intro q r))\n\n x2y : P → Q\n x2y p = [↔]-elimₗ (x2yz(p)) (r)\n\n xy2z : (P ↔ Q) → R -- TODO: How?\n xy2z ([↔]-intro y2x x2y) = ?\n\n [↔]-associativityᵣ : ((P ↔ Q) ↔ R) → (P ↔ (Q ↔ R))\n [↔]-associativityᵣ ([↔]-intro z2xy xy2z) = [↔]-intro yz2x x2yz where\n yz2x : P ← (Q ↔ R)\n yz2x ([↔]-intro z2y y2z) = ?\n\n x2yz : P → (Q ↔ R)\n x2yz p = [↔]-intro z2y y2z where\n z2y : R → Q\n z2y r = [↔]-elimᵣ (z2xy(r)) (p)\n\n y2z : Q → R\n y2z q = xy2z([∧]-to-[↔]([∧]-intro p q))\n-}\n\n------------------------------------------\n-- Distributivity\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}}{R : Stmt{ℓ₃}} where\n [∧][∨]-distributivityₗ : (P ∧ (Q ∨ R)) ↔ (P ∧ Q)∨(P ∧ R)\n [∧][∨]-distributivityₗ = [↔]-intro l r where\n l : (P ∧ (Q ∨ R)) ← (P ∧ Q)∨(P ∧ R)\n l([∨]-introₗ ([∧]-intro p q)) = [∧]-intro p ([∨]-introₗ q)\n l([∨]-introᵣ ([∧]-intro p r)) = [∧]-intro p ([∨]-introᵣ r)\n\n r : (P ∧ (Q ∨ R)) → (P ∧ Q)∨(P ∧ R)\n r([∧]-intro p ([∨]-introₗ q)) = [∨]-introₗ([∧]-intro p q)\n r([∧]-intro p ([∨]-introᵣ r)) = [∨]-introᵣ([∧]-intro p r)\n\n [∧][∨]-distributivityᵣ : ((P ∨ Q) ∧ R) ↔ (P ∧ R)∨(Q ∧ R)\n [∧][∨]-distributivityᵣ = [↔]-intro l r where\n l : ((P ∨ Q) ∧ R) ← (P ∧ R)∨(Q ∧ R)\n l([∨]-introₗ ([∧]-intro p r)) = [∧]-intro ([∨]-introₗ p) r\n l([∨]-introᵣ ([∧]-intro q r)) = [∧]-intro ([∨]-introᵣ q) r\n\n r : ((P ∨ Q) ∧ R) → (P ∧ R)∨(Q ∧ R)\n r([∧]-intro ([∨]-introₗ p) r) = [∨]-introₗ([∧]-intro p r)\n r([∧]-intro ([∨]-introᵣ q) r) = [∨]-introᵣ([∧]-intro q r)\n\n [∨][∧]-distributivityₗ : (P ∨ (Q ∧ R)) ↔ (P ∨ Q)∧(P ∨ R)\n [∨][∧]-distributivityₗ = [↔]-intro l r where\n l : (P ∨ (Q ∧ R)) ← (P ∨ Q)∧(P ∨ R)\n l([∧]-intro ([∨]-introₗ p) ([∨]-introₗ _)) = [∨]-introₗ(p)\n l([∧]-intro ([∨]-introₗ p) ([∨]-introᵣ r)) = [∨]-introₗ(p)\n l([∧]-intro ([∨]-introᵣ q) ([∨]-introₗ p)) = [∨]-introₗ(p)\n l([∧]-intro ([∨]-introᵣ q) ([∨]-introᵣ r)) = [∨]-introᵣ([∧]-intro q r)\n\n r : (P ∨ (Q ∧ R)) → (P ∨ Q)∧(P ∨ R)\n r([∨]-introₗ p) = [∧]-intro ([∨]-introₗ p) ([∨]-introₗ p)\n r([∨]-introᵣ ([∧]-intro q r)) = [∧]-intro ([∨]-introᵣ q) ([∨]-introᵣ r)\n\n [∨][∧]-distributivityᵣ : ((P ∧ Q) ∨ R) ↔ (P ∨ R)∧(Q ∨ R)\n [∨][∧]-distributivityᵣ = [↔]-intro l r where\n l : ((P ∧ Q) ∨ R) ← (P ∨ R)∧(Q ∨ R)\n l([∧]-intro ([∨]-introₗ p) ([∨]-introₗ q)) = [∨]-introₗ([∧]-intro p q)\n l([∧]-intro ([∨]-introₗ p) ([∨]-introᵣ r)) = [∨]-introᵣ(r)\n l([∧]-intro ([∨]-introᵣ r) ([∨]-introₗ q)) = [∨]-introᵣ(r)\n l([∧]-intro ([∨]-introᵣ r) ([∨]-introᵣ _)) = [∨]-introᵣ(r)\n\n r : ((P ∧ Q) ∨ R) → (P ∨ R)∧(Q ∨ R)\n r([∨]-introₗ ([∧]-intro p q)) = [∧]-intro ([∨]-introₗ p) ([∨]-introₗ q)\n r([∨]-introᵣ r) = [∧]-intro ([∨]-introᵣ r) ([∨]-introᵣ r)\n\n------------------------------------------\n-- Identity (with respect to →)\n\nmodule _ {ℓ} {P : Stmt{ℓ}} where\n [∧]-identityₗ : (⊤ ∧ P) → P\n [∧]-identityₗ ([∧]-intro _ p) = p\n\n [∧]-identityᵣ : (P ∧ ⊤) → P\n [∧]-identityᵣ ([∧]-intro p _) = p\n\n [∨]-identityₗ : (⊥ ∨ P) → P\n [∨]-identityₗ ([∨]-introₗ ())\n [∨]-identityₗ ([∨]-introᵣ p) = p\n\n [∨]-identityᵣ : (P ∨ ⊥) → P\n [∨]-identityᵣ ([∨]-introₗ p) = p\n [∨]-identityᵣ ([∨]-introᵣ ())\n\n [→]-identityₗ : (⊤ → P) → P\n [→]-identityₗ f = f([⊤]-intro)\n\n [∧]-nullifierₗ : (⊥ ∧ P) → ⊥\n [∧]-nullifierₗ ([∧]-intro () _)\n\n [∧]-nullifierᵣ : (P ∧ ⊥) → ⊥\n [∧]-nullifierᵣ ([∧]-intro _ ())\n\nmodule _ {ℓ₂}{ℓ₃} {_▫_ : Stmt{Lvl.𝟎} → Stmt{ℓ₂} → Stmt{ℓ₃}} where\n [⊤]-as-nullifierₗ : ∀{P : Stmt} → (⊤ ▫ P) → ⊤\n [⊤]-as-nullifierₗ _ = [⊤]-intro\n\nmodule _ {ℓ₁}{ℓ₃} {_▫_ : Stmt{ℓ₁} → Stmt{Lvl.𝟎} → Stmt{ℓ₃}} where\n [⊤]-as-nullifierᵣ : ∀{P : Stmt} → (P ▫ ⊤) → ⊤\n [⊤]-as-nullifierᵣ _ = [⊤]-intro\n\n------------------------------------------\n-- Other\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [∨]-not-left : (P ∨ Q) → (¬ P) → Q\n [∨]-not-left ([∨]-introₗ p) np = [⊥]-elim(np p)\n [∨]-not-left ([∨]-introᵣ q) = const q\n\n [∨]-not-right : (P ∨ Q) → (¬ Q) → P\n [∨]-not-right ([∨]-introₗ p) = const p\n [∨]-not-right ([∨]-introᵣ q) nq = [⊥]-elim(nq q)\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}}{T : Stmt{ℓ₃}} where\n [→]-lift : (P → Q) → ((T → P) → (T → Q))\n [→]-lift = liftₗ\n\nmodule _ {ℓ₁ ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n contrapositiveᵣ : (P → Q) → ((¬ P) ← (¬ Q))\n contrapositiveᵣ = [→]-transitivity\n\n contrapositive-variant : (P → (¬ Q)) ↔ ((¬ P) ← Q)\n contrapositive-variant = [↔]-intro swap swap\n\n modus-tollens : (P → Q) → (¬ Q) → (¬ P)\n modus-tollens = contrapositiveᵣ\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃}{ℓ₄} {A : Stmt{ℓ₁}}{B : Stmt{ℓ₂}}{C : Stmt{ℓ₃}}{D : Stmt{ℓ₄}} where\n constructive-dilemma : (A → B) → (C → D) → (A ∨ C) → (B ∨ D)\n constructive-dilemma = [∨]-elim2\n\n destructive-dilemma : (A → B) → (C → D) → ((¬ B) ∨ (¬ D)) → ((¬ A) ∨ (¬ C))\n destructive-dilemma l r = [∨]-elim2 (contrapositiveᵣ l) (contrapositiveᵣ r)\n\nmodule _ {ℓ} {P : Stmt{ℓ}} where\n [¬¬]-intro : P → (¬¬ P)\n [¬¬]-intro = apply\n -- P → (P → ⊥) → ⊥\n\n [¬¬¬]-elim : (¬ (¬ (¬ P))) → (¬ P)\n [¬¬¬]-elim = contrapositiveᵣ [¬¬]-intro\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}}{R : Stmt{ℓ₃}} where\n [↔]-move-out-[∧]ᵣ : ((P ∧ R) ↔ (Q ∧ R)) → (R → (P ↔ Q))\n [↔]-move-out-[∧]ᵣ ([↔]-intro qrpr prqr) r =\n ([↔]-intro\n (q ↦ [∧]-elimₗ(qrpr([∧]-intro q r)))\n (p ↦ [∧]-elimₗ(prqr([∧]-intro p r)))\n )\n\n [∧]-unaryOperatorₗ : (P ↔ Q) → ((P ∧ R) ↔ (Q ∧ R))\n [∧]-unaryOperatorₗ ([↔]-intro qp pq) =\n ([↔]-intro\n (qr ↦ [∧]-intro (qp([∧]-elimₗ qr)) ([∧]-elimᵣ qr))\n (pr ↦ [∧]-intro (pq([∧]-elimₗ pr)) ([∧]-elimᵣ pr))\n )\n\n currying : (P → (Q → R)) ↔ ((P ∧ Q) → R)\n currying = [↔]-intro Tuple.curry Tuple.uncurry\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃}{ℓ₄} {A : Stmt{ℓ₁}}{B : Stmt{ℓ₂}}{C : Stmt{ℓ₃}}{D : Stmt{ℓ₄}} where\n [∧]-binaryOperator : (A ↔ C) → (B ↔ D) → ((A ∧ B) ↔ (C ∧ D))\n [∧]-binaryOperator ([↔]-intro ca ac) ([↔]-intro db bd) = [↔]-intro (Tuple.map ca db) (Tuple.map ac bd)\n\n [∨]-binaryOperator : (A ↔ C) → (B ↔ D) → ((A ∨ B) ↔ (C ∨ D))\n [∨]-binaryOperator ([↔]-intro ca ac) ([↔]-intro db bd) = [↔]-intro (Either.map ca db) (Either.map ac bd)\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [↔]-not-left : (P ↔ Q) → (¬ P) → (¬ Q)\n [↔]-not-left pq np q = np([↔]-elimₗ(q)(pq))\n\n [↔]-not-right : (P ↔ Q) → (¬ Q) → (¬ P)\n [↔]-not-right pq nq p = nq([↔]-elimᵣ(p)(pq))\n\n [¬]-unaryOperator : (P ↔ Q) → ((¬ P) ↔ (¬ Q))\n [¬]-unaryOperator pq = [↔]-intro ([↔]-not-right (pq)) ([↔]-not-left (pq))\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [↔]-elim-[∨] : (P ↔ Q) → (P ∨ Q) → (P ∧ Q)\n [↔]-elim-[∨] (p↔q) ([∨]-introₗ p) = [∧]-intro p ([↔]-elimᵣ(p) p↔q)\n [↔]-elim-[∨] (p↔q) ([∨]-introᵣ q) = [∧]-intro ([↔]-elimₗ(q) p↔q) q\n\nmodule _ {ℓ} {P : Stmt{ℓ}} where\n provable-top-equivalence : P → (P ↔ ⊤)\n provable-top-equivalence p = [↔]-intro (const p) (const [⊤]-intro)\n\n unprovable-bottom-equivalence : (¬ P) → (P ↔ ⊥)\n unprovable-bottom-equivalence np = [↔]-intro [⊥]-elim np\n\n------------------------------------------\n-- Negation is almost preserved over the conjunction-dijunction dual (De-morgan's laws).\n\nmodule _ {ℓ₁ ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [¬]-preserves-[∧][∨]ₗ : (¬ (P ∧ Q)) ← ((¬ P) ∨ (¬ Q))\n [¬]-preserves-[∧][∨]ₗ ([∨]-introₗ np) = np ∘ [∧]-elimₗ\n [¬]-preserves-[∧][∨]ₗ ([∨]-introᵣ nq) = nq ∘ [∧]-elimᵣ\n\n [¬]-preserves-[∨][∧] : (¬ (P ∨ Q)) ↔ ((¬ P) ∧ (¬ Q))\n [¬]-preserves-[∨][∧] = [↔]-intro l r where\n l : ¬(P ∨ Q) ← ((¬ P) ∧ (¬ Q))\n l ([∧]-intro np nq) = [∨]-elim np nq\n\n r : (¬ (P ∨ Q)) → ((¬ P) ∧ (¬ Q))\n r f = [∧]-intro (f ∘ [∨]-introₗ) (f ∘ [∨]-introᵣ)\n\n------------------------------------------\n-- Conjunction and implication (Tuples and functions)\n\nmodule _ {ℓ₁}{ℓ₂}{ℓ₃} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}}{R : Stmt{ℓ₃}} where\n [→][∧]-assumption : ((P ∧ Q) → R) ↔ (P → Q → R)\n [→][∧]-assumption = [↔]-intro Tuple.uncurry Tuple.curry\n\n [→][∧]-distributivityₗ : (P → (Q ∧ R)) ↔ ((P → Q) ∧ (P → R))\n [→][∧]-distributivityₗ = [↔]-intro l r\n where l : ((P → Q) ∧ (P → R)) → (P → (Q ∧ R))\n l ([∧]-intro pq pr) p = [∧]-intro (pq(p)) (pr(p))\n\n r : ((P → Q) ∧ (P → R)) ← (P → (Q ∧ R))\n r both = [∧]-intro ([∧]-elimₗ ∘ both) ([∧]-elimᵣ ∘ both)\n\n [→][∨]-distributivityₗₗ : (P → (Q ∨ R)) ← ((P → Q) ∨ (P → R))\n [→][∨]-distributivityₗₗ = l\n where l : ((P → Q) ∨ (P → R)) → (P → (Q ∨ R))\n l ([∨]-introₗ pq) p = [∨]-introₗ (pq(p))\n l ([∨]-introᵣ pr) p = [∨]-introᵣ (pr(p))\n\n [→ₗ][∨][∧]-preserving : ((P ∨ Q) → R) ↔ ((P → R) ∧ (Q → R))\n [→ₗ][∨][∧]-preserving = [↔]-intro l r where\n l : ((P ∨ Q) → R) ← ((P → R) ∧ (Q → R))\n l ([∧]-intro pr qr) ([∨]-introₗ p) = pr p\n l ([∧]-intro pr qr) ([∨]-introᵣ q) = qr q\n\n r : ((P ∨ Q) → R) → ((P → R) ∧ (Q → R))\n r pqr = [∧]-intro (pqr ∘ [∨]-introₗ) (pqr ∘ [∨]-introᵣ)\n\nmodule _ {ℓ} {P : Stmt{ℓ}} where\n non-contradiction : ¬(P ∧ (¬ P))\n non-contradiction(p , np) = np p\n\n------------------------------------------\n-- Redundant formulas in operations\n\nmodule _ {ℓ₁}{ℓ₂} {A : Stmt{ℓ₁}}{B : Stmt{ℓ₂}} where\n [→]-redundancy : (A → A → B) → (A → B)\n [→]-redundancy = _$₂_\n\nmodule _ {ℓ} {A : Stmt{ℓ}} where\n [∧]-redundancy : (A ∧ A) ↔ A\n [∧]-redundancy = [↔]-intro ([∧]-intro $₂_) [∧]-elimₗ\n\n [∨]-redundancy : (A ∨ A) ↔ A\n [∨]-redundancy = [↔]-intro [∨]-introₗ ([∨]-elim id id)\n\n------------------------------------------\n-- Disjunctive forms\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n -- Also called: Material implication\n [→]-disjunctive-formₗ : (P → Q) ← ((¬ P) ∨ Q)\n [→]-disjunctive-formₗ = [∨]-elim ([→]-lift [⊥]-elim) const\n\n [↔]-disjunctive-formₗ : (P ↔ Q) ← ((P ∧ Q) ∨ ((¬ P) ∧ (¬ Q)))\n [↔]-disjunctive-formₗ ([∨]-introₗ pq) = [∧]-to-[↔] pq\n [↔]-disjunctive-formₗ ([∨]-introᵣ npnq) = Tuple.map ([⊥]-elim ∘_) ([⊥]-elim ∘_) (Tuple.swap npnq)\n\n -- TODO: Probably unprovable\n -- [↔]-disjunctive-formᵣ : ∀{P Q : Stmt} → (P ↔ Q) → ((P ∧ Q) ∨ ((¬ P) ∧ (¬ Q)))\n -- [↔]-disjunctive-formᵣ ([↔]-intro qp pq) = \n\n [¬→]-disjunctive-formₗ : ((¬ P) → Q) ← (P ∨ Q)\n [¬→]-disjunctive-formₗ = [∨]-not-left\n\n------------------------------------------\n-- Conjuctive forms\n\n-- TODO: None of them are provable?\n-- [↔]-conjunctive-form : ∀{P Q : Stmt} → (P ↔ Q) ↔ ((P ∨ Q) ∧ ((¬ P) ∨ (¬ Q)))\n-- [↔]-conjunctive-form ([↔]-intro qp pq) = [∨]-elim ([→]-lift [⊥]-elim) (const)\n\nmodule _ {ℓ₁ ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [→][∧]ᵣ : (P → Q) → ¬(P ∧ (¬ Q))\n [→][∧]ᵣ f = Tuple.uncurry([¬¬]-intro ∘ f)\n\n [¬→][∧]ₗ : ¬(P → Q) ← (P ∧ (¬ Q))\n [¬→][∧]ₗ = swap [→][∧]ᵣ\n\n [→¬]-¬[∧] : (P → (¬ Q)) ↔ ¬(P ∧ Q)\n [→¬]-¬[∧] = currying\n\n------------------------------------------\n-- Equivalences (TODO: I remember these being defined somewhere else, but I am not sure. At least some special cases have been used somewhere else)\n\nmodule _ where\n private variable ℓ : Lvl.Level\n private variable A A₁ A₂ B B₁ B₂ : Type{ℓ}\n\n [∧]-map-[↔] : (A₁ ↔ A₂) → (B₁ ↔ B₂) → ((A₁ ∧ B₁) ↔ (A₂ ∧ B₂))\n [∧]-map-[↔] a b = [↔]-intro (Tuple.map ([↔]-to-[←] a) ([↔]-to-[←] b)) (Tuple.map ([↔]-to-[→] a) ([↔]-to-[→] b))\n\n [∧]-mapₗ-[↔] : (A₁ ↔ A₂) → ((A₁ ∧ B) ↔ (A₂ ∧ B))\n [∧]-mapₗ-[↔] a = [∧]-map-[↔] a [↔]-reflexivity\n\n [∧]-mapᵣ-[↔] : (B₁ ↔ B₂) → ((A ∧ B₁) ↔ (A ∧ B₂))\n [∧]-mapᵣ-[↔] b = [∧]-map-[↔] [↔]-reflexivity b\n\n [∨]-map-[↔] : (A₁ ↔ A₂) → (B₁ ↔ B₂) → ((A₁ ∨ B₁) ↔ (A₂ ∨ B₂))\n [∨]-map-[↔] a b = [↔]-intro (Either.map ([↔]-to-[←] a) ([↔]-to-[←] b)) (Either.map ([↔]-to-[→] a) ([↔]-to-[→] b))\n\n [∨]-mapₗ-[↔] : (A₁ ↔ A₂) → ((A₁ ∨ B) ↔ (A₂ ∨ B))\n [∨]-mapₗ-[↔] a = [∨]-map-[↔] a [↔]-reflexivity\n\n [∨]-mapᵣ-[↔] : (B₁ ↔ B₂) → ((A ∨ B₁) ↔ (A ∨ B₂))\n [∨]-mapᵣ-[↔] b = [∨]-map-[↔] [↔]-reflexivity b\n\n [↔]-map-[↔] : (A₁ ↔ A₂) → (B₁ ↔ B₂) → ((A₁ ↔ B₁) ↔ (A₂ ↔ B₂))\n [↔]-map-[↔] a b =\n [↔]-intro\n (Tuple.map\n (b₂a₂ ↦ [↔]-to-[←] a ∘ b₂a₂ ∘ [↔]-to-[→] b)\n (a₂b₂ ↦ [↔]-to-[←] b ∘ a₂b₂ ∘ [↔]-to-[→] a)\n )\n (Tuple.map\n (b₁a₁ ↦ [↔]-to-[→] a ∘ b₁a₁ ∘ [↔]-to-[←] b)\n (a₁b₁ ↦ [↔]-to-[→] b ∘ a₁b₁ ∘ [↔]-to-[←] a)\n )\n\n [↔]-mapₗ-[↔] : (A₁ ↔ A₂) → ((A₁ ↔ B) ↔ (A₂ ↔ B))\n [↔]-mapₗ-[↔] a = [↔]-map-[↔] a [↔]-reflexivity\n\n [↔]-mapᵣ-[↔] : (B₁ ↔ B₂) → ((A ↔ B₁) ↔ (A ↔ B₂))\n [↔]-mapᵣ-[↔] b = [↔]-map-[↔] [↔]-reflexivity b\n\n [→]-map-[↔] : (A₁ ↔ A₂) → (B₁ ↔ B₂) → ((A₁ → B₁) ↔ (A₂ → B₂))\n [→]-map-[↔] a b = [↔]-intro (ab ↦ [↔]-to-[←] b ∘ ab ∘ [↔]-to-[→] a) (ab ↦ [↔]-to-[→] b ∘ ab ∘ [↔]-to-[←] a)\n\n------------------------------------------\n-- Stuff related to classical logic\n\nmodule _ {ℓ} {P : Stmt{ℓ}} where\n [¬¬]-excluded-middle : ¬¬(P ∨ (¬ P))\n [¬¬]-excluded-middle =\n ([¬]-intro(naorna ↦\n ((non-contradiction([∧]-intro\n (([∨]-introᵣ\n (([¬]-intro(a ↦\n ((non-contradiction([∧]-intro\n (([∨]-introₗ a) :of: (P ∨ (¬ P)))\n (naorna :of: ¬(P ∨ (¬ P)))\n )) :of: ⊥)\n )) :of: (¬ P))\n ) :of: (P ∨ (¬ P)))\n (naorna :of: ¬(P ∨ (¬ P)))\n )) :of: ⊥)\n )) :of: ¬¬(P ∨ (¬ P))\n\n -- Note:\n -- ∀{P} → (P ∨ (¬ P)) ← ((¬¬ P) → P)\n -- is not provable because the statement (P ∨ (¬ P)) requires a [¬¬]-elim.\n -- TODO: ...I think? I do not think (∀{P} → ¬¬(P ∨ (¬ P)) → ((¬¬ P) ∨ (¬ P))) is provable.\n [¬¬]-elim-from-excluded-middle : (P ∨ (¬ P)) → ((¬¬ P) → P)\n [¬¬]-elim-from-excluded-middle ([∨]-introₗ p) (nnp) = p\n [¬¬]-elim-from-excluded-middle ([∨]-introᵣ np) (nnp) = [⊥]-elim(nnp(np))\n\n [¬¬]-elim-from-callcc : (∀{Q : Stmt{Lvl.𝟎}} → (((P → Q) → P) → P)) → ((¬¬ P) → P)\n [¬¬]-elim-from-callcc (callcc) (nnp) = callcc{⊥} ([⊥]-elim ∘ nnp)\n\nmodule _ {ℓ} where\n [[¬¬]-elim]-[excluded-middle]-eqₗ : (∀{P : Stmt{ℓ}} → (¬¬ P) → P) ←ᶠ (∀{P : Stmt{ℓ}} → (P ∨ (¬ P)))\n [[¬¬]-elim]-[excluded-middle]-eqₗ or {P} (nnp) with or\n ... | ([∨]-introₗ p ) = p\n ... | ([∨]-introᵣ np) = [⊥]-elim(nnp(np))\n\n [[¬¬]-elim]-[excluded-middle]-eqᵣ : (∀{P : Stmt{ℓ}} → (¬¬ P) → P) → (∀{P : Stmt{ℓ}} → (P ∨ (¬ P)))\n [[¬¬]-elim]-[excluded-middle]-eqᵣ (nnpp) = nnpp([¬¬]-excluded-middle)\n\n -- TODO: https://math.stackexchange.com/questions/910240/equivalence-between-middle-excluded-law-and-double-negation-elimination-in-heyti\n\n [callcc]-[[¬¬]-elim]-eqₗ : (∀{P : Stmt{ℓ}}{Q : Stmt{Lvl.𝟎}} → (((P → Q) → P) → P)) → (∀{P} → (¬¬ P) → P)\n [callcc]-[[¬¬]-elim]-eqₗ (callcc) {P} (nnp) = callcc{P}{⊥} (np ↦ [⊥]-elim(nnp(np)))\n\n [callcc]-[[¬¬]-elim]-eqᵣ : (∀{P : Stmt{ℓ}} → (¬¬ P) → P) → (∀{P Q : Stmt{ℓ}} → (((P → Q) → P) → P))\n [callcc]-[[¬¬]-elim]-eqᵣ (nnpp) {P}{Q} (pqp) = nnpp([¬]-intro(np ↦ np(pqp(p ↦ [⊥]-elim(np p)))))\n\n [callcc]-[excluded-middle]-eqₗ : (∀{P : Stmt{ℓ}} → (P ∨ (¬ P))) → (∀{P Q : Stmt{ℓ}} → (((P → Q) → P) → P))\n [callcc]-[excluded-middle]-eqₗ or {P}{Q} (pqp) with or\n ... | ([∨]-introₗ p ) = p\n ... | ([∨]-introᵣ np) = pqp([⊥]-elim ∘ np)\n\n [callcc]-[excluded-middle]-eqᵣ : (∀{P : Stmt{ℓ}}{Q : Stmt{Lvl.𝟎}} → (((P → Q) → P) → P)) → (∀{P : Stmt{ℓ}} → (P ∨ (¬ P)))\n [callcc]-[excluded-middle]-eqᵣ (callcc) {P} = callcc{P ∨ (¬ P)}{⊥} (nor ↦ [⊥]-elim ([¬¬]-excluded-middle (nor)))\n\n -- TODO: Does not have to be over all propositions P in assumption. Only wem P and wem Q are used.\n weak-excluded-middle-[¬][∧]ₗ : (∀{P : Stmt{ℓ}} → (¬ P) ∨ (¬¬ P)) ↔ (∀{P : Stmt{ℓ}}{Q : Stmt{ℓ}} → ((¬ P) ∨ (¬ Q)) ← (¬ (P ∧ Q)))\n weak-excluded-middle-[¬][∧]ₗ = [↔]-intro l r where\n l : (∀{P : Stmt{ℓ}} → (¬ P) ∨ (¬¬ P)) ← (∀{P : Stmt{ℓ}}{Q : Stmt{ℓ}} → ((¬ P) ∨ (¬ Q)) ← (¬ (P ∧ Q)))\n l [¬][∧]ₗ = [¬][∧]ₗ non-contradiction\n\n r : (∀{P : Stmt{ℓ}} → (¬ P) ∨ (¬¬ P)) → (∀{P : Stmt{ℓ}}{Q : Stmt{ℓ}} → ((¬ P) ∨ (¬ Q)) ← (¬ (P ∧ Q)))\n r wem {P = P} {Q = Q} npq with wem {P = P} | wem {P = Q}\n r wem {P = P} {Q = Q} npq | [∨]-introₗ np | [∨]-introₗ nq = [∨]-introₗ np\n r wem {P = P} {Q = Q} npq | [∨]-introₗ np | [∨]-introᵣ nnq = [∨]-introₗ np\n r wem {P = P} {Q = Q} npq | [∨]-introᵣ nnp | [∨]-introₗ nq = [∨]-introᵣ nq\n r wem {P = P} {Q = Q} npq | [∨]-introᵣ nnp | [∨]-introᵣ nnq = [∨]-introᵣ (q ↦ nnp (p ↦ npq ([∧]-intro p q)))\n\n------------------------------------------\n-- XOR\n\nmodule _ {ℓ₁}{ℓ₂} {P : Stmt{ℓ₁}}{Q : Stmt{ℓ₂}} where\n [⊕][↔]-contradiction : (P ⊕ Q) → (P ↔ Q) → ⊥\n [⊕][↔]-contradiction ([⊕]-introₗ p nq) pq = nq([↔]-elimᵣ p pq)\n [⊕][↔]-contradiction ([⊕]-introᵣ q np) pq = np([↔]-elimₗ q pq)\n\n [⊕][∧]-contradiction : (P ⊕ Q) → (P ∧ Q) → ⊥\n [⊕][∧]-contradiction xor = [⊕][↔]-contradiction xor ∘ [∧]-to-[↔]\n\n [⊕]-not-both : (P ⊕ Q) → P → Q → ⊥\n [⊕]-not-both = Tuple.curry ∘ [⊕][∧]-contradiction\n\n [⊕]-not-left : (P ⊕ Q) → P → (¬ Q)\n [⊕]-not-left = [⊕]-not-both\n\n [⊕]-not-right : (P ⊕ Q) → Q → (¬ P)\n [⊕]-not-right = swap ∘ [⊕]-not-both\n\n [⊕]-to-[∨] : (P ⊕ Q) → (P ∨ Q)\n [⊕]-to-[∨] ([⊕]-introₗ p _) = [∨]-introₗ p\n [⊕]-to-[∨] ([⊕]-introᵣ q _) = [∨]-introᵣ q\n\n [⊕]-to-[¬∨] : (P ⊕ Q) → ((¬ P) ∨ (¬ Q))\n [⊕]-to-[¬∨] ([⊕]-introₗ _ nq) = [∨]-introᵣ nq\n [⊕]-to-[¬∨] ([⊕]-introᵣ _ np) = [∨]-introₗ np\n\n [⊕]-excluded-middleₗ : (P ⊕ Q) → (P ∨ (¬ P))\n [⊕]-excluded-middleₗ ([⊕]-introₗ p nq) = [∨]-introₗ p\n [⊕]-excluded-middleₗ ([⊕]-introᵣ q np) = [∨]-introᵣ np\n\n [⊕]-excluded-middleᵣ : (P ⊕ Q) → (Q ∨ (¬ Q))\n [⊕]-excluded-middleᵣ ([⊕]-introₗ p nq) = [∨]-introᵣ nq\n [⊕]-excluded-middleᵣ ([⊕]-introᵣ q np) = [∨]-introₗ q\n\n [⊕]-or-not-both : (P ∨ Q) → ¬(P ∧ Q) → (P ⊕ Q)\n [⊕]-or-not-both or nand with or\n ... | [∨]-introₗ p = [⊕]-introₗ p (q ↦ nand([↔]-intro p q))\n ... | [∨]-introᵣ q = [⊕]-introᵣ q (p ↦ nand([↔]-intro p q))\n", "meta": {"hexsha": "87cf0c57ccbdac11f56c14856a05204d29334c9e", "size": 20671, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Logic/Propositional/Theorems.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Logic/Propositional/Theorems.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Logic/Propositional/Theorems.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.5836363636, "max_line_length": 147, "alphanum_fraction": 0.4258623192, "num_tokens": 10574, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8539127492339909, "lm_q2_score": 0.7956581024858786, "lm_q1q2_score": 0.6794225977440171}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Decidable.Relations where\n\nDecidableRelation : {a b : _} {A : Set a} (f : A → Set b) → Set (a ⊔ b)\nDecidableRelation {A = A} f = (x : A) → (f x) || (f x → False)\n\norDecidable : {a b c : _} {A : Set a} {f : A → Set b} {g : A → Set c} → DecidableRelation f → DecidableRelation g → DecidableRelation (λ x → (f x) || (g x))\norDecidable fDec gDec x with fDec x\norDecidable fDec gDec x | inl fx = inl (inl fx)\norDecidable fDec gDec x | inr !fx with gDec x\norDecidable fDec gDec x | inr !fx | inl gx = inl (inr gx)\norDecidable {f = f} {g} fDec gDec x | inr !fx | inr !gx = inr t\n where\n t : (f x || g x) → False\n t (inl x) = !fx x\n t (inr x) = !gx x\n\nandDecidable : {a b c : _} {A : Set a} {f : A → Set b} {g : A → Set c} → DecidableRelation f → DecidableRelation g → DecidableRelation (λ x → (f x) && (g x))\nandDecidable fDec gDec x with fDec x\nandDecidable fDec gDec x | inl fx with gDec x\nandDecidable fDec gDec x | inl fx | inl gx = inl (fx ,, gx)\nandDecidable fDec gDec x | inl fx | inr !gx = inr (λ x → !gx (_&&_.snd x))\nandDecidable fDec gDec x | inr !fx = inr (λ x → !fx (_&&_.fst x))\n\nnotDecidable : {a b : _} {A : Set a} {f : A → Set b} → DecidableRelation f → DecidableRelation (λ x → (f x) → False)\nnotDecidable fDec x with fDec x\nnotDecidable fDec x | inl fx = inr (λ x → x fx)\nnotDecidable fDec x | inr !fx = inl !fx\n\ndoubleNegation : {a b : _} {A : Set a} {f : A → Set b} → DecidableRelation f → (x : A) → (((f x) → False) → False) → f x\ndoubleNegation fDec x with fDec x\ndoubleNegation fDec x | inl fx = λ _ → fx\ndoubleNegation fDec x | inr !fx = λ p → exFalso (p !fx)\n", "meta": {"hexsha": "cbd245ea512ae0a440fdcead7e60e43266b0b957", "size": 1735, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Decidable/Relations.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Decidable/Relations.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Decidable/Relations.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 45.6578947368, "max_line_length": 157, "alphanum_fraction": 0.6190201729, "num_tokens": 679, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772351648677, "lm_q2_score": 0.7772998560157665, "lm_q1q2_score": 0.6794201090403109}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.Group.Instances.Int where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Isomorphism\n\nopen import Cubical.Data.Int\n renaming (_+_ to _+ℤ_ ; _-_ to _-ℤ_; -_ to -ℤ_ ; _·_ to _·ℤ_)\n\nopen import Cubical.Algebra.Group.Base\nopen import Cubical.Algebra.Group.Properties\nopen import Cubical.Algebra.Group.Morphisms\nopen import Cubical.Algebra.Group.MorphismProperties\n\n\nopen GroupStr\n\nℤGroup : Group₀\nfst ℤGroup = ℤ\n1g (snd ℤGroup) = 0\n_·_ (snd ℤGroup) = _+ℤ_\ninv (snd ℤGroup) = -ℤ_\nisGroup (snd ℤGroup) = isGroupℤ\n where\n abstract\n isGroupℤ : IsGroup (pos 0) (_+ℤ_) (-ℤ_)\n isGroupℤ = makeIsGroup isSetℤ\n +Assoc (λ _ → refl) (+Comm 0)\n -Cancel -Cancel'\n\nℤHom : (n : ℤ) → GroupHom ℤGroup ℤGroup\nfst (ℤHom n) x = n ·ℤ x\nsnd (ℤHom n) =\n makeIsGroupHom λ x y → ·DistR+ n x y\n\nnegEquivℤ : GroupEquiv ℤGroup ℤGroup\nfst negEquivℤ =\n isoToEquiv\n (iso (GroupStr.inv (snd ℤGroup))\n (GroupStr.inv (snd ℤGroup))\n (GroupTheory.invInv ℤGroup)\n (GroupTheory.invInv ℤGroup))\nsnd negEquivℤ =\n makeIsGroupHom -Dist+\n", "meta": {"hexsha": "131a3ec8758c9d5c4f52cb6816cb762b66d741ca", "size": 1153, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z", "max_issues_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.6222222222, "max_line_length": 63, "alphanum_fraction": 0.6704249783, "num_tokens": 403, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.903294209307224, "lm_q2_score": 0.752012562644147, "lm_q1q2_score": 0.679288593162744}} {"text": "-- Agda program using the Iowa Agda library\n\nopen import bool\n\nmodule PROOF-odddoublecoin\n (Choice : Set)\n (choose : Choice → 𝔹)\n (lchoice : Choice → Choice)\n (rchoice : Choice → Choice)\n where\n\nopen import eq\nopen import nat\nopen import list\nopen import maybe\n\n---------------------------------------------------------------------------\n-- Translated Curry operations:\n\nadd : ℕ → ℕ → ℕ\nadd zero x = x\nadd (suc y) z = suc (add y z)\n\n-- Forward declaration:\nodd : ℕ → 𝔹\n\neven : ℕ → 𝔹\neven zero = tt\neven (suc x) = odd x\n\ncoin : Choice → ℕ → ℕ\ncoin c1 x = if choose c1 then x else suc x\n\ndouble : ℕ → ℕ\ndouble x = add x x\n\nodd zero = ff\nodd (suc x) = even x\n\n---------------------------------------------------------------------------\n\nadd-suc : ∀ (x y : ℕ) → add x (suc y) ≡ suc (add x y)\nadd-suc zero y = refl\nadd-suc (suc x) y rewrite add-suc x y = refl\n\n-- auxiliary property for x+x instead of double:\nodd-add-x-x : ∀ (x : ℕ) → odd (add x x) ≡ ff\nodd-add-x-x zero = refl\nodd-add-x-x (suc x) rewrite add-suc x x | odd-add-x-x x = refl\n\nodddoublecoin : (c1 : Choice) → (x : ℕ) → (odd (double (coin c1 x))) ≡ ff\nodddoublecoin c1 x rewrite odd-add-x-x (coin c1 x) = refl\n\n---------------------------------------------------------------------------\n", "meta": {"hexsha": "5a1419701d7f0deb38a51f8558a08401de1b83ab", "size": 1252, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "currypp/.cpm/packages/verify/examples/PROOF-odddoublecoin.agda", "max_stars_repo_name": "phlummox/curry-tools", "max_stars_repo_head_hexsha": "7905bc4f625a94a725f9f6d8a2de1140bea5e471", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "currypp/.cpm/packages/verify/examples/PROOF-odddoublecoin.agda", "max_issues_repo_name": "phlummox/curry-tools", "max_issues_repo_head_hexsha": "7905bc4f625a94a725f9f6d8a2de1140bea5e471", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "currypp/.cpm/packages/verify/examples/PROOF-odddoublecoin.agda", "max_forks_repo_name": "phlummox/curry-tools", "max_forks_repo_head_hexsha": "7905bc4f625a94a725f9f6d8a2de1140bea5e471", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.7636363636, "max_line_length": 75, "alphanum_fraction": 0.5167731629, "num_tokens": 373, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.92522995296862, "lm_q2_score": 0.734119526900183, "lm_q1q2_score": 0.6792293753472018}} {"text": "{- Example by Andrew Pitts, 2016-05-23 -}\n\n{-# OPTIONS --rewriting --cubical-compatible #-}\n\nopen import Agda.Builtin.Equality public\n\ninfix 6 I─_\npostulate\n 𝕀 : Set\n O : 𝕀\n I : 𝕀\n I─_ : 𝕀 → 𝕀\n\n{-# BUILTIN REWRITE _≡_ #-}\n\npostulate\n I─O≡I : I─ O ≡ I\n\n{-# REWRITE I─O≡I #-}\n\ndata Pth (A : Set) : A → A → Set where\n path : (f : 𝕀 → A) → Pth A (f O) (f I)\n\ninfix 6 _at_\n_at_ : {A : Set}{x y : A} → Pth A x y → 𝕀 → A\npath f at i = f i\n\nrecord Path (A : Set)(x y : A) : Set where\n field\n pth : Pth A x y\n feq : pth at O ≡ x\n seq : pth at I ≡ y\n\nopen Path public\n\n{-# REWRITE feq #-}\n{-# REWRITE seq #-}\n\ninfix 6 _′_\n_′_ : {A : Set}{x y : A} → Path A x y → 𝕀 → A\np ′ i = pth p at i\n\nfun2path : {A : Set}(f : 𝕀 → A) → Path A (f O) (f I)\npth (fun2path f) = path f\nfeq (fun2path f) = refl\nseq (fun2path f) = refl\n\ninv : {A : Set}{x y : A} → Path A x y → Path A y x\ninv p = fun2path (λ i → p ′ (I─ i))\n", "meta": {"hexsha": "84fdfd676197b8c65f8cb94a116143ea845f6a55", "size": 941, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Fail/Issue1994.agda", "max_stars_repo_name": "KDr2/agda", "max_stars_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Fail/Issue1994.agda", "max_issues_repo_name": "KDr2/agda", "max_issues_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z", "max_forks_repo_path": "test/Fail/Issue1994.agda", "max_forks_repo_name": "KDr2/agda", "max_forks_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.82, "max_line_length": 52, "alphanum_fraction": 0.5132837407, "num_tokens": 420, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8962513731336204, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6791742458078251}} {"text": "-- Properties of Fibonacci nunmbers\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Math.NumberTheory.Fibonacci.Nat.Properties where\n\n-- agda-stdlib\nopen import Data.Unit using (tt)\nopen import Data.Sum\nopen import Data.Nat\nopen import Data.Nat.Properties\nopen import Relation.Binary.PropositionalEquality\nopen import Relation.Nullary\nopen import Relation.Nullary.Decidable\nopen import Function.Base\n\n-- agda-misc\nopen import Math.NumberTheory.Fibonacci.Nat\nopen import Math.NumberTheory.Summation.Nat\n\nopen ≤-Reasoning\n\n1≤fib[1+n] : ∀ n → 1 ≤ fib (suc n)\n1≤fib[1+n] zero = ≤-refl\n1≤fib[1+n] (suc n) = begin\n 1 ≤⟨ 1≤fib[1+n] n ⟩\n fib (suc n) ≤⟨ m≤m+n (fib (suc n)) (fib n) ⟩\n fib (suc n) + fib n ≡⟨ fib[1+n]+fib[n]≡fib[2+n] n ⟩\n fib (suc (suc n)) ∎\n\nfib[n] T\n measure : P T T -> T\n applyX : P P.T -> T\n applyI2 : P P.T -> T\n applyDuv : P P (P,P).T -> T\n applyDu : P P.T -> T\n applyDv : P P.T -> T\n\ntheory\n (A) a:P t u:T |> applyX (a, b.measure(b, t, u)) = measure(a, u, t)\n (B) a:P b:P t u:P.T |> measure(a, applyDu(b, b.t[b]), applyDv(b, b.u[b])) = applyDuv(a, b, a b.measure(a, t[b], u[b]))\n (D) t u:T |> new(a.measure(a, t, u)) = t\n (E) b:P t:(P, P).T |> new(a.applyDuv(a, b, a b. t[a,b])) = applyDu(b, b.new(a.t[a,b]))\n-}\n\nmodule QIO.Equality where\n\nopen import SOAS.Common\nopen import SOAS.Context\nopen import SOAS.Variable\nopen import SOAS.Families.Core\nopen import SOAS.Families.Build\nopen import SOAS.ContextMaps.Inductive\n\nopen import QIO.Signature\nopen import QIO.Syntax\n\nopen import SOAS.Metatheory.SecondOrder.Metasubstitution QIO:Syn\nopen import SOAS.Metatheory.SecondOrder.Equality QIO:Syn\n\nprivate\n variable\n α β γ τ : QIOT\n Γ Δ Π : Ctx\n\ninfix 1 _▹_⊢_≋ₐ_\n\n-- Axioms of equality\ndata _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ QIO) α Γ → (𝔐 ▷ QIO) α Γ → Set where\n A : ⁅ P ⁆ ⁅ T ⁆ ⁅ T ⁆̣ ▹ ∅ ⊢ applyX 𝔞 (measure x₀ 𝔟 𝔠) ≋ₐ measure 𝔞 𝔠 𝔟\n B : ⁅ P ⁆ ⁅ P ⁆ ⁅ P ⊩ T ⁆ ⁅ P ⊩ T ⁆̣ ▹ ∅ ⊢ measure 𝔞 (applyDu 𝔟 (𝔠⟨ x₀ ⟩)) (applyDv 𝔟 (𝔡⟨ x₀ ⟩)) ≋ₐ applyDuv 𝔞 𝔟 (measure x₀ (𝔠⟨ x₁ ⟩) (𝔡⟨ x₁ ⟩))\n D : ⁅ T ⁆ ⁅ T ⁆̣ ▹ ∅ ⊢ new (measure x₀ 𝔞 𝔟) ≋ₐ 𝔞\n E : ⁅ P ⁆ ⁅ P · P ⊩ T ⁆̣ ▹ ∅ ⊢ new (applyDuv x₀ 𝔞 (𝔟⟨ x₀ ◂ x₁ ⟩)) ≋ₐ applyDu 𝔞 (new (𝔟⟨ x₀ ◂ x₁ ⟩))\n\nopen EqLogic _▹_⊢_≋ₐ_\nopen ≋-Reasoning\n\n\n", "meta": {"hexsha": "2b06f7a211f561346672c9a21f3927235bd969e2", "size": 1798, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/QIO/Equality.agda", "max_stars_repo_name": "k4rtik/agda-soas", "max_stars_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "out/QIO/Equality.agda", "max_issues_repo_name": "k4rtik/agda-soas", "max_issues_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "out/QIO/Equality.agda", "max_forks_repo_name": "k4rtik/agda-soas", "max_forks_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.4745762712, "max_line_length": 147, "alphanum_fraction": 0.5239154616, "num_tokens": 819, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467801752451, "lm_q2_score": 0.7718435083355187, "lm_q1q2_score": 0.6785637351523363}} {"text": "{-# OPTIONS --cubical #-}\nmodule Multidimensional.Data.DirNum.Base where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.Unit\nopen import Cubical.Data.Prod\nopen import Cubical.Data.Nat\n\nopen import Multidimensional.Data.Dir\n\n\n-- Dependent \"directional numerals\":\n-- for natural n, obtain 2ⁿ \"numerals\".\n-- This is basically a little-endian binary notation.\n-- NOTE: Would an implementation of DirNum with dependent vectors be preferable\n-- over using products?\nDirNum : ℕ → Type₀\nDirNum zero = Unit\nDirNum (suc n) = Dir × (DirNum n)\n\nDirNum→ℕ : ∀ {n} → DirNum n → ℕ\nDirNum→ℕ {zero} tt = zero\nDirNum→ℕ {suc n} (↓ , d) = doublesℕ (suc zero) (DirNum→ℕ d)\nDirNum→ℕ {suc n} (↑ , d) = suc (doublesℕ (suc zero) (DirNum→ℕ d))\n\n-- give the next numeral, cycling back to 0\n-- in case of 2ⁿ - 1\nnext : ∀ {n} → DirNum n → DirNum n\nnext {zero} tt = tt\nnext {suc n} (↓ , ds) = (↑ , ds)\nnext {suc n} (↑ , ds) = (↓ , next ds)\n\nprev : ∀ {n} → DirNum n → DirNum n\nprev {zero} tt = tt\nprev {suc n} (↓ , ds) = (↓ , prev ds)\nprev {suc n} (↑ , ds) = (↓ , ds)\n\nzero-n : (n : ℕ) → DirNum n\nzero-n zero = tt\nzero-n (suc n) = (↓ , zero-n n)\n\none-n : (n : ℕ) → DirNum n\none-n zero = tt\none-n (suc n) = (↑ , zero-n n)\n\n-- numeral for 2ⁿ - 1\nmax-n : (n : ℕ) → DirNum n\nmax-n zero = tt\nmax-n (suc n) = (↑ , max-n n)\n\n-- -- TODO: rename\n-- embed-next : (r : ℕ) → DirNum r → DirNum (suc r)\n-- embed-next zero tt = (↓ , tt)\n-- embed-next (suc r) (d , ds) with zero-n? ds\n-- ... | no _ = (d , embed-next r ds)\n-- ... | yes _ = (d , zero-n (suc r))\n\nsucDoubleDirNum+ : (r : ℕ) → DirNum r → DirNum (suc r)\nsucDoubleDirNum+ r x = (↑ , x)\n\n-- bad name, since this is doubling \"to\" suc r\ndoubleDirNum+ : (r : ℕ) → DirNum r → DirNum (suc r)\ndoubleDirNum+ r x = (↓ , x)\n\ndropLeast : {r : ℕ} → DirNum (suc r) → DirNum r\ndropLeast {zero} d = tt\ndropLeast {suc r} (x , x₁) = x₁\n\ndropMost : {r : ℕ} → DirNum (suc r) → DirNum r\ndropMost {zero} d = tt\ndropMost {suc zero} (x , (x₁ , x₂)) = (x₁ , x₂)\ndropMost {suc (suc r)} (x , x₁) = (x , dropMost x₁)\n\n-- need to prove property about doubleable\n--doubleDirNum : (r : ℕ) (d : DirNum r) → doubleable-n? {r} d ≡ true → DirNum r\n-- bad? is not correct when not \"doubleable\"\n-- possibly should view as operations in residue classes?\ndoubleDirNum : (r : ℕ) (d : DirNum r) → DirNum r\ndoubleDirNum zero d = tt\ndoubleDirNum (suc r) d = doubleDirNum+ r (dropMost {r} d)\n-- doubleDirNum zero d doubleable = ⊥-elim (false≢true doubleable)\n-- doubleDirNum (suc r) d doubleable = doubleDirNum+ r (dropMost {r} d)\n", "meta": {"hexsha": "7fb200287ebc5f2fac5f6a18bdff1573de1896db", "size": 2530, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Multidimensional/Data/DirNum/Base.agda", "max_stars_repo_name": "wrrnhttn/agda-cubical-multidimensional", "max_stars_repo_head_hexsha": "55709dd950e319c4a105ace33ddaf8b955354add", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Multidimensional/Data/DirNum/Base.agda", "max_issues_repo_name": "wrrnhttn/agda-cubical-multidimensional", "max_issues_repo_head_hexsha": "55709dd950e319c4a105ace33ddaf8b955354add", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-06-19T20:40:07.000Z", "max_issues_repo_issues_event_max_datetime": "2019-07-02T16:24:01.000Z", "max_forks_repo_path": "Multidimensional/Data/DirNum/Base.agda", "max_forks_repo_name": "wrrnhttn/agda-cubical-multidimensional", "max_forks_repo_head_hexsha": "55709dd950e319c4a105ace33ddaf8b955354add", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.119047619, "max_line_length": 79, "alphanum_fraction": 0.6166007905, "num_tokens": 957, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.879146780175245, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6785637166965057}} {"text": "------------------------------------------------------------------------------\n-- FOTC terms properties\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOTC.Base.PropertiesI where\n\nopen import Common.FOL.Relation.Binary.EqReasoning\n\nopen import FOTC.Base\n\n------------------------------------------------------------------------------\n-- Congruence properties\n\n·-leftCong : ∀ {a b c} → a ≡ b → a · c ≡ b · c\n·-leftCong refl = refl\n\n·-rightCong : ∀ {a b c} → b ≡ c → a · b ≡ a · c\n·-rightCong refl = refl\n\n·-cong : ∀ {a b c d} → a ≡ b → c ≡ d → a · c ≡ b · d\n·-cong refl refl = refl\n\nsuccCong : ∀ {m n} → m ≡ n → succ₁ m ≡ succ₁ n\nsuccCong refl = refl\n\npredCong : ∀ {m n} → m ≡ n → pred₁ m ≡ pred₁ n\npredCong refl = refl\n\nifCong₁ : ∀ {b b' t t'} → b ≡ b' →\n (if b then t else t') ≡ (if b' then t else t')\nifCong₁ refl = refl\n\nifCong₂ : ∀ {b t₁ t₂ t} → t₁ ≡ t₂ →\n (if b then t₁ else t) ≡ (if b then t₂ else t)\nifCong₂ refl = refl\n\nifCong₃ : ∀ {b t t₁ t₂} → t₁ ≡ t₂ →\n (if b then t else t₁) ≡ (if b then t else t₂)\nifCong₃ refl = refl\n\n------------------------------------------------------------------------------\n-- Injective properties\n\nsuccInjective : ∀ {m n} → succ₁ m ≡ succ₁ n → m ≡ n\nsuccInjective {m} {n} h =\n m ≡⟨ sym (pred-S m) ⟩\n pred₁ (succ₁ m) ≡⟨ predCong h ⟩\n pred₁ (succ₁ n) ≡⟨ pred-S n ⟩\n n ∎\n\n------------------------------------------------------------------------------\n-- Discrimination rules\n\nS≢0 : ∀ {n} → succ₁ n ≢ zero\nS≢0 S≡0 = 0≢S (sym S≡0)\n", "meta": {"hexsha": "533d82fddcb738a650f198678b742d7d1631bf67", "size": 1740, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/FOTC/Base/PropertiesI.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/FOTC/Base/PropertiesI.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/FOTC/Base/PropertiesI.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 28.5245901639, "max_line_length": 78, "alphanum_fraction": 0.4137931034, "num_tokens": 543, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8397339676722393, "lm_q2_score": 0.8080672066194945, "lm_q1q2_score": 0.6785614815604113}} {"text": "module Structure.Function.Ordering where\n\nimport Lvl\nopen import Logic\nopen import Logic.Propositional\nopen import Logic.Predicate\nopen import Type\n\nmodule _ {ℓₒ₁ ℓₒ₂ ℓₗ₁ ℓₗ₂} {T₁ : Type{ℓₒ₁}} {T₂ : Type{ℓₒ₂}} (_≤₁_ : T₁ → T₁ → Type{ℓₗ₁}) (_≤₂_ : T₂ → T₂ → Type{ℓₗ₂}) where\n record Increasing (f : T₁ → T₂) : Stmt{ℓₒ₁ Lvl.⊔ ℓₗ₁ Lvl.⊔ ℓₗ₂} where\n constructor intro\n field proof : ∀{a b : T₁} → (a ≤₁ b) → (f(a) ≤₂ f(b))\n\n record Decreasing (f : T₁ → T₂) : Stmt{ℓₒ₁ Lvl.⊔ ℓₗ₁ Lvl.⊔ ℓₗ₂} where\n constructor intro\n field proof : ∀{a b : T₁} → (a ≤₁ b) → (f(b) ≤₂ f(a))\n\n Monotone : (T₁ → T₂) → Stmt\n Monotone(f) = (Increasing(f) ∨ Decreasing(f))\n\n record UpperBoundPointOf (f : T₁ → T₂) (p : T₁) : Stmt{ℓₒ₁ Lvl.⊔ ℓₗ₂} where\n constructor intro\n field proof : ∀{x} → (f(x) ≤₂ f(p))\n\n UpperBounded : (T₁ → T₂) → Stmt\n UpperBounded(f) = ∃(UpperBoundPointOf(f))\n\n record LowerBoundPointOf (f : T₁ → T₂) (p : T₁) : Stmt{ℓₒ₁ Lvl.⊔ ℓₗ₂} where\n constructor intro\n field proof : ∀{x} → (f(p) ≤₂ f(x))\n\n LowerBounded : (T₁ → T₂) → Stmt\n LowerBounded(f) = ∃(LowerBoundPointOf(f))\n", "meta": {"hexsha": "82121d80e2dfa1db993e10d46958715b5c22a8ba", "size": 1103, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Function/Ordering.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Function/Ordering.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Function/Ordering.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.4411764706, "max_line_length": 124, "alphanum_fraction": 0.6101541251, "num_tokens": 503, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887587964389113, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6785529107971632}} {"text": "{-# OPTIONS --without-K #-}\n\nopen import HoTT hiding (_::_)\n\nmodule algebra.Word {i} (A : Type i) where\n\n data Word : Type i where\n nil : Word\n _::_ : A → Word → Word\n _inv::_ : A → Word → Word\n infixr 60 _::_ _inv::_\n\n -- The following six functions prove things like if [x ∷ v ≡ y ∷ w],\n -- then [x ≡ y].\n -- This is not as easy as it sounds, you cannot directly induct on the equality\n -- (because [x ∷ v] is not a general element of type word), so you have to\n -- extract the head, but it’s not always possible…\n\n Word= : (v w : Word) → Type i\n Word= nil nil = Lift ⊤\n Word= nil (y :: w) = Lift ⊥\n Word= nil (y inv:: w) = Lift ⊥\n Word= (x :: v) nil = Lift ⊥\n Word= (x :: v) (y :: w) = (x == y) × (v == w)\n Word= (x :: v) (y inv:: w) = Lift ⊥\n Word= (x inv:: v) nil = Lift ⊥\n Word= (x inv:: v) (y :: w) = Lift ⊥\n Word= (x inv:: v) (y inv:: w) = (x == y) × (v == w)\n\n Word=-out : {v w : Word} (p : v == w) → Word= v w\n Word=-out {v = nil} idp = lift unit\n Word=-out {v = x :: v} idp = (idp , idp)\n Word=-out {v = x inv:: v} idp = (idp , idp)\n\n Word=-in : {v w : Word} → Word= v w → v == w\n Word=-in {nil} {nil} _ = idp\n Word=-in {nil} {y :: w} (lift ())\n Word=-in {nil} {y inv:: w} (lift ())\n Word=-in {x :: v} {nil} (lift ())\n Word=-in {x :: v} {y :: w} (p , q) = ap2 _::_ p q\n Word=-in {x :: v} {y inv:: w} (lift ())\n Word=-in {x inv:: v} {nil} (lift ())\n Word=-in {x inv:: v} {y :: w} (lift ())\n Word=-in {x inv:: v} {y inv:: w} (p , q) = ap2 _inv::_ p q\n\n Word-fst= : {x y : A} {v w : Word} (p : x :: v == y :: w) → x == y\n Word-fst= p = fst (Word=-out p)\n\n Word-snd= : {x y : A} {v w : Word} (p : x :: v == y :: w) → v == w\n Word-snd= p = snd (Word=-out p)\n\n Word-fst=' : {x y : A} {v w : Word} (p : x inv:: v == y inv:: w) → x == y\n Word-fst=' p = fst (Word=-out p)\n\n Word-snd=' : {x y : A} {v w : Word} (p : x inv:: v == y inv:: w) → v == w\n Word-snd=' p = snd (Word=-out p)\n\n", "meta": {"hexsha": "08a8586acdaa5a6988b1bc3ea81ecb0b3ec3cde9", "size": 2074, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "algebra/Word.agda", "max_stars_repo_name": "UlrikBuchholtz/HoTT-Agda", "max_stars_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-30T00:17:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-30T00:17:55.000Z", "max_issues_repo_path": "algebra/Word.agda", "max_issues_repo_name": "nicolaikraus/HoTT-Agda", "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "algebra/Word.agda", "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.7586206897, "max_line_length": 81, "alphanum_fraction": 0.4459980714, "num_tokens": 831, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9399133531922388, "lm_q2_score": 0.7217432182679956, "lm_q1q2_score": 0.6783760884260296}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n-- The 'Trivial' instance, with a single arrow between objects\n\nmodule Categories.Theory.Lawvere.Instance.Triv where\n\nopen import Data.Nat using (_*_)\nopen import Data.Unit.Polymorphic using (⊤; tt)\nopen import Relation.Binary.PropositionalEquality\n using (_≡_; refl; isEquivalence)\n\nopen import Categories.Theory.Lawvere using (LawvereTheory)\n\nTriv : ∀ {ℓ} → LawvereTheory ℓ ℓ\nTriv = record\n { L = record\n { _⇒_ = λ _ _ → ⊤\n ; _≈_ = _≡_\n ; assoc = refl\n ; sym-assoc = refl\n ; identityˡ = refl\n ; identityʳ = refl\n ; identity² = refl\n ; equiv = isEquivalence\n ; ∘-resp-≈ = λ _ _ → refl\n }\n ; T = record\n { terminal = record { ⊤ = 0 ; ⊤-is-terminal = record { ! = tt ; !-unique = λ _ → refl } }\n ; products = record\n { product = λ {m} {n} → record\n { A×B = m * n\n ; project₁ = refl\n ; project₂ = refl\n ; unique = λ _ _ → refl\n }\n }\n }\n ; I = record\n { F₁ = λ _ → tt\n ; identity = refl\n ; homomorphism = refl\n ; F-resp-≈ = λ _ → refl\n }\n ; CartF = record\n { F-resp-⊤ = record { ! = tt ; !-unique = λ _ → refl }\n ; F-resp-× = record { ⟨_,_⟩ = λ _ _ → tt ; project₁ = refl ; project₂ = refl ; unique = λ _ _ → refl }\n }\n }\n", "meta": {"hexsha": "40c6135f876fe119b213d8d8a1a38275c7d41dc6", "size": 1329, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Theory/Lawvere/Instance/Triv.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Theory/Lawvere/Instance/Triv.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Theory/Lawvere/Instance/Triv.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 27.1224489796, "max_line_length": 106, "alphanum_fraction": 0.5221971407, "num_tokens": 433, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110511888303, "lm_q2_score": 0.7606506581031359, "lm_q1q2_score": 0.6783566629904332}} {"text": "{-# OPTIONS --universe-polymorphism #-}\nmodule Categories.Graphs.Underlying where\n\nopen import Categories.Support.PropositionalEquality\n\nopen import Categories.Category\n hiding (module Heterogeneous)\nopen import Categories.Categories\nopen import Categories.Graphs\nopen import Categories.Functor\n using (Functor; module Functor; ≡⇒≣)\n renaming (id to idF; _≡_ to _≡F_)\nopen import Data.Product\nopen import Graphs.Graph\nopen import Graphs.GraphMorphism\n\nUnderlying₀ : ∀ {o ℓ e} → Category o ℓ e → Graph o ℓ e\nUnderlying₀ C = record\n { Obj = Obj\n ; _↝_ = _⇒_\n ; _≈_ = _≡_\n ; equiv = equiv\n } where open Category C\n\nUnderlying₁ : ∀ {o₁ ℓ₁ e₁ o₂ ℓ₂ e₂}\n {X : Category o₁ ℓ₁ e₁}\n {Y : Category o₂ ℓ₂ e₂}\n → Functor X Y\n → GraphMorphism (Underlying₀ X) (Underlying₀ Y)\nUnderlying₁ G = record\n { F₀ = G₀\n ; F₁ = G₁\n ; F-resp-≈ = G-resp-≡\n }\n where\n open Functor G\n renaming (F₀ to G₀; F₁ to G₁; F-resp-≡ to G-resp-≡)\n\nUnderlying : ∀ {o ℓ e} → Functor (Categories o ℓ e) (Graphs o ℓ e)\nUnderlying {o}{ℓ}{e} = record\n { F₀ = Underlying₀ \n ; F₁ = Underlying₁\n ; identity = (λ x → ≣-refl) , (λ f → Heterogeneous.refl _)\n ; homomorphism = (λ x → ≣-refl) , (λ f → Heterogeneous.refl _)\n ; F-resp-≡ = λ {A B}{F G : Functor A B} → F-resp-≡ {A}{B}{F}{G}\n }\n where\n module Graphs = Category (Graphs o ℓ e)\n module Categories = Category (Categories o ℓ e)\n \n .F-resp-≡ : ∀ {A B : Categories.Obj} {G H : Functor A B}\n → G ≡F H\n → Underlying₁ G ≈ Underlying₁ H\n F-resp-≡ {A}{B}{G}{H} G≡H\n = (≡⇒≣ G H G≡H) , (λ f → convert-~ (G≡H f))\n where\n open Heterogeneous (Underlying₀ B)\n renaming (_~_ to _~₂_)\n open Categories.Category.Heterogeneous B\n renaming (_∼_ to _~₁_)\n \n convert-~ : ∀ {a b c d}{x : B [ a , b ]}{y : B [ c , d ]} → x ~₁ y → x ~₂ y\n convert-~ (≡⇒∼ foo) = ≈⇒~ foo", "meta": {"hexsha": "2876587b16e0edd96ea418d3c616b7c1273d8fde", "size": 1936, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Graphs/Underlying.agda", "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 98, "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_issues_repo_path": "Categories/Graphs/Underlying.agda", "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 19, "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_forks_repo_path": "Categories/Graphs/Underlying.agda", "max_forks_repo_name": "p-pavel/categories", "max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 23, "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "avg_line_length": 30.7301587302, "max_line_length": 83, "alphanum_fraction": 0.5805785124, "num_tokens": 734, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.89181104831338, "lm_q2_score": 0.7606506418255928, "lm_q1q2_score": 0.6783566462867273}} {"text": "------------------------------------------------------------------------\n-- An implementation of tree sort, formally proved to return a\n-- permutation of the input\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Equality\nopen import Prelude hiding (id)\n\nmodule Tree-sort.Partial\n {c⁺}\n (eq : ∀ {a p} → Equality-with-J a p c⁺)\n {A : Type}\n (_≤_ : A → A → Bool) -- A comparison function.\n where\n\nopen Derived-definitions-and-properties eq\n\nopen import Bag-equivalence eq\nopen import Bijection eq using (_↔_)\nopen import Function-universe eq hiding (_∘_)\nopen import List eq\nopen import Tree eq\n\n------------------------------------------------------------------------\n-- Insertion into trees\n\n-- Inserts an element into the tree.\n\ninsert : A → Tree A → Tree A\ninsert x leaf = singleton x\ninsert x (node l y r) =\n if x ≤ y then node (insert x l) y r\n else node l y (insert x r)\n\n-- The insert function inserts.\n\nAny-insert : ∀ (P : A → Type) x t →\n AnyT P (insert x t) ↔ P x ⊎ AnyT P t\nAny-insert P x leaf =\n AnyT P (singleton x) ↔⟨ Any-singleton P ⟩\n P x ↔⟨ inverse ⊎-right-identity ⟩\n P x ⊎ ⊥ ↔⟨⟩\n P x ⊎ AnyT P leaf □\nAny-insert P x (node l y r) with x ≤ y\n... | true =\n AnyT P (insert x l) ⊎ P y ⊎ AnyT P r ↔⟨ Any-insert P x l ⊎-cong id ⟩\n (P x ⊎ AnyT P l) ⊎ P y ⊎ AnyT P r ↔⟨ inverse ⊎-assoc ⟩\n P x ⊎ AnyT P l ⊎ P y ⊎ AnyT P r □\n... | false =\n AnyT P l ⊎ P y ⊎ AnyT P (insert x r) ↔⟨ id ⊎-cong id ⊎-cong Any-insert P x r ⟩\n AnyT P l ⊎ P y ⊎ P x ⊎ AnyT P r ↔⟨ lemma (AnyT P l) (P y) (P x) (AnyT P r) ⟩\n P x ⊎ AnyT P l ⊎ P y ⊎ AnyT P r □\n where\n -- The following lemma is easy to prove automatically (for instance\n -- by using a ring solver).\n\n lemma : (A B C D : Type) → A ⊎ B ⊎ C ⊎ D ↔ C ⊎ A ⊎ B ⊎ D\n lemma A B C D =\n A ⊎ B ⊎ C ⊎ D ↔⟨ id ⊎-cong ⊎-assoc ⟩\n A ⊎ (B ⊎ C) ⊎ D ↔⟨ id ⊎-cong ⊎-comm ⊎-cong id ⟩\n A ⊎ (C ⊎ B) ⊎ D ↔⟨ ⊎-assoc ⟩\n (A ⊎ C ⊎ B) ⊎ D ↔⟨ ⊎-assoc ⊎-cong id ⟩\n ((A ⊎ C) ⊎ B) ⊎ D ↔⟨ (⊎-comm ⊎-cong id) ⊎-cong id ⟩\n ((C ⊎ A) ⊎ B) ⊎ D ↔⟨ inverse ⊎-assoc ⊎-cong id ⟩\n (C ⊎ A ⊎ B) ⊎ D ↔⟨ inverse ⊎-assoc ⟩\n C ⊎ (A ⊎ B) ⊎ D ↔⟨ id ⊎-cong inverse ⊎-assoc ⟩\n C ⊎ A ⊎ B ⊎ D □\n\n------------------------------------------------------------------------\n-- Turning a list into a search tree\n\n-- Converts the list to a search tree.\n\nto-search-tree : List A → Tree A\nto-search-tree = foldr insert leaf\n\n-- No elements are added or removed.\n\nto-search-tree-lemma : ∀ xs z → z ∈T to-search-tree xs ↔ z ∈ xs\nto-search-tree-lemma [] = λ z →\n z ∈T leaf ↔⟨⟩\n z ∈ [] □\nto-search-tree-lemma (x ∷ xs) = λ z →\n z ∈T insert x (to-search-tree xs) ↔⟨ Any-insert (λ x → z ≡ x) _ _ ⟩\n z ≡ x ⊎ z ∈T to-search-tree xs ↔⟨ id ⊎-cong to-search-tree-lemma xs z ⟩\n z ∈ x ∷ xs □\n\n------------------------------------------------------------------------\n-- Sorting\n\n-- Sorts a list.\n\ntree-sort : List A → List A\ntree-sort = flatten ∘ to-search-tree\n\n-- The result is a permutation of the input.\n\ntree-sort-permutes : ∀ xs → tree-sort xs ≈-bag xs\ntree-sort-permutes xs = λ z →\n z ∈ flatten (to-search-tree xs) ↔⟨ flatten-lemma (to-search-tree xs) z ⟩\n z ∈T to-search-tree xs ↔⟨ to-search-tree-lemma xs z ⟩\n z ∈ xs □\n", "meta": {"hexsha": "400a8e4fda12a9bfaa7af56ca1eb8d2858b85f04", "size": 3413, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Tree-sort/Partial.agda", "max_stars_repo_name": "nad/equality", "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_issues_repo_path": "src/Tree-sort/Partial.agda", "max_issues_repo_name": "nad/equality", "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Tree-sort/Partial.agda", "max_forks_repo_name": "nad/equality", "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.5047619048, "max_line_length": 84, "alphanum_fraction": 0.4837386464, "num_tokens": 1201, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206844384594, "lm_q2_score": 0.7520125793176222, "lm_q1q2_score": 0.6782557002444811}} {"text": "{-# OPTIONS --without-K #-}\n\nopen import HoTT\n\nmodule homotopy.HSpace where\n\nrecord HSpaceStructure {i} (A : Type i) : Type i where\n constructor hSpaceStructure\n field\n e : A\n μ : A → A → A\n μe- : (a : A) → μ e a == a\n μ-e : (a : A) → μ a e == a\n\nmodule ConnectedHSpace {i} (A : Type i) (c : is-connected ⟨0⟩ A)\n (hA : HSpaceStructure A) where\n\n open HSpaceStructure hA\n\n {-\n Given that [A] is 0-connected, to prove that each [μ a] is an equivalence we\n only need to prove that one of them is. But for [a] = [e], [μ a] is the \n identity so we’re done.\n -}\n\n μ-is-equiv : (a : A) → is-equiv (μ a)\n μ-is-equiv = prop-over-connected {a = e} c\n (λ a → (is-equiv (μ a) , is-equiv-is-prop (μ a)))\n (transport! is-equiv (λ= μe-) (idf-is-equiv A))\n\n μ'-is-equiv : (a : A) → is-equiv (λ a' → μ a' a)\n μ'-is-equiv = prop-over-connected {a = e} c\n (λ a → (is-equiv (λ a' → μ a' a) , is-equiv-is-prop (λ a' → μ a' a)))\n (transport! is-equiv (λ= μ-e) (idf-is-equiv A))\n\n μ-equiv : A → A ≃ A\n μ-equiv a = (μ a , μ-is-equiv a)\n\n μ'-equiv : A → A ≃ A\n μ'-equiv a = ((λ a' → μ a' a) , μ'-is-equiv a)\n", "meta": {"hexsha": "f8504db895309189e8a312ca86a1fee0a27c5af8", "size": 1124, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "homotopy/HSpace.agda", "max_stars_repo_name": "UlrikBuchholtz/HoTT-Agda", "max_stars_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-30T00:17:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-30T00:17:55.000Z", "max_issues_repo_path": "homotopy/HSpace.agda", "max_issues_repo_name": "nicolaikraus/HoTT-Agda", "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "homotopy/HSpace.agda", "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.4146341463, "max_line_length": 78, "alphanum_fraction": 0.5533807829, "num_tokens": 422, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9124361700013356, "lm_q2_score": 0.7431680086124812, "lm_q1q2_score": 0.678093371445892}} {"text": "{-# OPTIONS --verbose=10 #-}\n\nmodule inorder where\n \n open import Data.Nat\n open import Data.Vec\n open import Agda.Builtin.Sigma\n open import Data.Product\n open import Data.Fin using (fromℕ)\n\n open import trees\n open import optics\n open import lemmas \n\n inorderTree : {A : Set} -> Tree A -> Σ[ n ∈ ℕ ] Vec A n × (Vec A n -> Tree A) \n inorderTree empty = (0 , ([] , λ _ -> empty))\n inorderTree {A} (node t x t₁) with inorderTree t | inorderTree t₁ \n ... | (n₁ , (g₁ , p₁)) | (n₂ , (g₂ , p₂)) =\n (n₁ + (1 + n₂) , (g₁ ++ (x ∷ g₂) ,\n λ v -> node (p₁ (take n₁ v)) (head (drop n₁ v)) (righttree v)))\n where\n righttree : Vec A (n₁ + (1 + n₂)) -> Tree A\n -- righttree v = p₂ (drop 1 (drop n₁ v))\n righttree v rewrite +-suc n₁ n₂ = p₂ (drop (1 + n₁) v)\n \n inorder : {A : Set} -> Traversal (Tree A) (Tree A) A A\n inorder = record{ extract = inorderTree }\n\n module tests where\n tree1 : Tree ℕ\n tree1 = node (node empty 1 empty) 3 empty\n\n open Traversal\n \n inorder1 : Vec ℕ 2\n inorder1 = get inorder tree1 \n \n updatedinorder1 : Tree ℕ\n updatedinorder1 = put inorder tree1 (2 ∷ 3 ∷ [])\n\n", "meta": {"hexsha": "e02c4e68a2dcd67b2c258ec300a99022ce54580b", "size": 1182, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/main/agda/inorder.agda", "max_stars_repo_name": "hablapps/safeoptics", "max_stars_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/main/agda/inorder.agda", "max_issues_repo_name": "hablapps/safeoptics", "max_issues_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/agda/inorder.agda", "max_forks_repo_name": "hablapps/safeoptics", "max_forks_repo_head_hexsha": "90fc9586f4c126ee83b8aa54ad417bb7a5325b1b", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.8292682927, "max_line_length": 80, "alphanum_fraction": 0.5617597293, "num_tokens": 399, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9124361580958427, "lm_q2_score": 0.7431680143008301, "lm_q1q2_score": 0.6780933677883657}} {"text": "------------------------------------------------------------------------------\n-- The gcd program is correct\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- This module proves the correctness of the gcd program using\n-- the Euclid's algorithm.\n\n-- N.B This module does not contain combined proofs, but it imports\n-- modules which contain combined proofs.\n\nmodule FOTC.Program.GCD.Partial.CorrectnessProofATP where\n\nopen import FOTC.Base\nopen import FOTC.Data.Nat.Divisibility.NotBy0.PropertiesATP using ( 0∤x ; x∣S→x≤S )\nopen import FOTC.Data.Nat.Type\nopen import FOTC.Program.GCD.Partial.CommonDivisorATP using ( gcdCD )\nopen import FOTC.Program.GCD.Partial.Definitions using ( x≢0≢y ; gcdSpec )\nopen import FOTC.Program.GCD.Partial.DivisibleATP using ( gcdDivisible )\nopen import FOTC.Program.GCD.Partial.GCD using ( gcd )\n\nimport FOTC.Program.GCD.Partial.GreatestAnyCommonDivisor\nopen module GreatestAnyCommonDivisorATP =\n FOTC.Program.GCD.Partial.GreatestAnyCommonDivisor x∣S→x≤S 0∤x\n using ( gcdGACD )\n\nopen import FOTC.Program.GCD.Partial.TotalityATP using ( gcd-N )\n\n------------------------------------------------------------------------------\n-- The gcd is correct.\npostulate gcdCorrect : ∀ {m n} → N m → N n → x≢0≢y m n → gcdSpec m n (gcd m n)\n{-# ATP prove gcdCorrect gcdCD gcdGACD gcd-N gcdDivisible #-}\n", "meta": {"hexsha": "110bec4a351baac0a38d018e55018f1824f5e6f1", "size": 1527, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/FOTC/Program/GCD/Partial/CorrectnessProofATP.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/FOTC/Program/GCD/Partial/CorrectnessProofATP.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/FOTC/Program/GCD/Partial/CorrectnessProofATP.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 41.2702702703, "max_line_length": 83, "alphanum_fraction": 0.6129666012, "num_tokens": 379, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9161096181702032, "lm_q2_score": 0.7401743677704878, "lm_q1q2_score": 0.6780808574375932}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Monoids.Definition\n\nmodule Semirings.Definition where\n\nrecord Semiring {a : _} {A : Set a} (Zero One : A) (_+_ : A → A → A) (_*_ : A → A → A) : Set a where\n field\n monoid : Monoid Zero _+_\n commutative : (a b : A) → a + b ≡ b + a\n multMonoid : Monoid One _*_\n productZeroLeft : (a : A) → Zero * a ≡ Zero\n productZeroRight : (a : A) → a * Zero ≡ Zero\n +DistributesOver* : (a b c : A) → a * (b + c) ≡ (a * b) + (a * c)\n +DistributesOver*' : (a b c : A) → (a + b) * c ≡ (a * c) + (b * c)\n +Associative = Monoid.associative monoid\n *Associative = Monoid.associative multMonoid\n productOneLeft = Monoid.idLeft multMonoid\n productOneRight = Monoid.idRight multMonoid\n sumZeroLeft = Monoid.idLeft monoid\n sumZeroRight = Monoid.idRight monoid\n +WellDefined : {a b c d : A} → (a ≡ c) → (b ≡ d) → (a + b) ≡ (c + d)\n +WellDefined refl refl = refl\n\n-- (b+c)(a+a) == b(a+a) + c(a+a) == ba+ba+ca+ca == (ba+ca) + (ba+ca)\n-- (b+c)(a+a) ==? (b+c)a+(b+c)a\n", "meta": {"hexsha": "92e5f571d9e5ff16c1b5922b9fa2251725d0e339", "size": 1060, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Semirings/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Semirings/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Semirings/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 37.8571428571, "max_line_length": 100, "alphanum_fraction": 0.5820754717, "num_tokens": 412, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096135894201, "lm_q2_score": 0.740174367770488, "lm_q1q2_score": 0.678080854047015}} {"text": "{-# OPTIONS --without-K --exact-split --safe #-}\n\nmodule Fragment.Setoid.Morphism.Setoid where\n\nopen import Fragment.Setoid.Morphism.Base\n\nopen import Level using (Level; _⊔_)\nopen import Relation.Binary using (Setoid; IsEquivalence; Rel)\n\nprivate\n variable\n a b ℓ₁ ℓ₂ : Level\n\nmodule _ {S : Setoid a ℓ₁} {T : Setoid b ℓ₂} where\n\n open Setoid T\n\n infix 4 _≗_\n\n _≗_ : Rel (S ↝ T) (a ⊔ ℓ₂)\n f ≗ g = ∀ {x} → ∣ f ∣ x ≈ ∣ g ∣ x\n\n ≗-refl : ∀ {f} → f ≗ f\n ≗-refl = refl\n\n ≗-sym : ∀ {f g} → f ≗ g → g ≗ f\n ≗-sym f≗g {x} = sym (f≗g {x})\n\n ≗-trans : ∀ {f g h} → f ≗ g → g ≗ h → f ≗ h\n ≗-trans f≗g g≗h {x} = trans (f≗g {x}) (g≗h {x})\n\n ≗-isEquivalence : IsEquivalence _≗_\n ≗-isEquivalence = record { refl = λ {f} → ≗-refl {f}\n ; sym = λ {f g} → ≗-sym {f} {g}\n ; trans = λ {f g h} → ≗-trans {f} {g} {h}\n }\n\n_↝_/≗ : Setoid a ℓ₁ → Setoid b ℓ₂ → Setoid _ _\nS ↝ T /≗ = record { Carrier = S ↝ T\n ; _≈_ = _≗_\n ; isEquivalence = ≗-isEquivalence\n }\n", "meta": {"hexsha": "4f3bc60c86fecec88c15fed66f3fe5d35ec3250a", "size": 1093, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Fragment/Setoid/Morphism/Setoid.agda", "max_stars_repo_name": "yallop/agda-fragment", "max_stars_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 18, "max_stars_repo_stars_event_min_datetime": "2021-06-15T15:45:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T17:26:09.000Z", "max_issues_repo_path": "src/Fragment/Setoid/Morphism/Setoid.agda", "max_issues_repo_name": "yallop/agda-fragment", "max_issues_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-06-16T09:44:31.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-16T10:24:15.000Z", "max_forks_repo_path": "src/Fragment/Setoid/Morphism/Setoid.agda", "max_forks_repo_name": "yallop/agda-fragment", "max_forks_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2021-06-15T15:34:50.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-16T08:04:31.000Z", "avg_line_length": 25.4186046512, "max_line_length": 68, "alphanum_fraction": 0.4647758463, "num_tokens": 449, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.872347368040789, "lm_q2_score": 0.7772998663336158, "lm_q1q2_score": 0.6780754925745869}} {"text": "module 120-natural-induction-necessary where\n\nopen import 010-false-true\nopen import 020-equivalence\nopen import 100-natural\n\n-- We prove that the induction axiom is necessary.\n\n-- Peano axioms without induction.\n\nrecord NaturalWithoutInduction\n {M : Set}\n (zero : M)\n (suc : M -> M)\n (_==_ : M -> M -> Set)\n : Set1 where\n\n -- axioms\n field\n equiv : Equivalence _==_\n sucn!=zero : ∀ {r} -> suc r == zero -> False\n sucinjective : ∀ {r s} -> suc r == suc s -> r == s\n cong : ∀ {r s} -> r == s -> suc r == suc s\n not-induction :\n ((p : M -> Set) -> p zero -> (∀ n -> p n -> p (suc n)) -> ∀ n -> p n)\n -> False\n\n open Equivalence equiv public\n\n-- Construct a model, and prove it satisfies NaturalWithoutInduction\n-- but not Natural. To do this, we add an extra zero.\n\ndata M : Set where\n zero1 : M\n zero2 : M\n suc : M -> M\n\nthm-M-is-natural-without-induction : NaturalWithoutInduction zero1 suc _≡_\nthm-M-is-natural-without-induction = record {\n equiv = thm-≡-is-equivalence;\n sucn!=zero = sucn!=zero;\n sucinjective = sucinjective;\n cong = cong;\n not-induction = not-induction\n }\n where\n sucn!=zero : ∀ {r} -> suc r ≡ zero1 -> False\n sucn!=zero ()\n sucinjective : ∀ {r s} -> suc r ≡ suc s -> r ≡ s\n sucinjective refl = refl\n cong : ∀ {r s} -> r ≡ s -> suc r ≡ suc s\n cong refl = refl\n -- To prove that induction fails, we test the property \"is a\n -- successor of zero1 but not of zero2\". This holds for zero1 (the\n -- base case), and it also holds for every successor of n if it\n -- holds for n, but it does not hold for zero2 (or for any of its\n -- successors).\n not-induction :\n ((p : M -> Set) -> p zero1 -> (∀ n -> p n -> p (suc n)) -> ∀ n -> p n)\n -> False\n not-induction induction = induction p base hypothesis zero2\n where\n -- Property \"is a successor of zero1 but not a successor of zero2\".\n p : M -> Set\n p zero1 = True -- true for zero1\n p zero2 = False -- false (no proof) for zero2\n p (suc n) = p n -- true for successor of n if and only if true for n\n\n -- Base case is trivial.\n base : p zero1\n base = trivial\n\n -- Induction hypothesis follows by application of \"p n\" itself\n -- due to the recursive definition of p.\n hypothesis : ∀ n -> p n -> p (suc n)\n hypothesis n pn = pn\n\n-- To round this off, we explicitly prove that M is not natural.\n\nthm-M-is-not-natural : (Natural zero1 suc _≡_) -> False\nthm-M-is-not-natural nat =\n (NaturalWithoutInduction.not-induction thm-M-is-natural-without-induction)\n (Natural.induction nat)\n", "meta": {"hexsha": "b72c2a282d8c3756edf72c7976dd465722b9ef4b", "size": 2621, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "120-natural-induction-necessary.agda", "max_stars_repo_name": "mcmtroffaes/agda-proofs", "max_stars_repo_head_hexsha": "76fe404b25210258810641cc6807feecf0ff8d6c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2015-08-09T22:51:55.000Z", "max_stars_repo_stars_event_max_datetime": "2016-08-17T16:15:42.000Z", "max_issues_repo_path": "120-natural-induction-necessary.agda", "max_issues_repo_name": "mcmtroffaes/agda-proofs", "max_issues_repo_head_hexsha": "76fe404b25210258810641cc6807feecf0ff8d6c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "120-natural-induction-necessary.agda", "max_forks_repo_name": "mcmtroffaes/agda-proofs", "max_forks_repo_head_hexsha": "76fe404b25210258810641cc6807feecf0ff8d6c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.2023809524, "max_line_length": 76, "alphanum_fraction": 0.60587562, "num_tokens": 794, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473813156295, "lm_q2_score": 0.7772998508568416, "lm_q1q2_score": 0.6780754893919951}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\n\nmodule Cubical.Structures.Group.Morphism where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Structures.Group.Base\n\nprivate\n variable\n ℓ ℓ' : Level\n\n-- The following definition of GroupHom and GroupEquiv are level-wise heterogeneous.\n-- This allows for example to deduce that G ≡ F from a chain of isomorphisms\n-- G ≃ H ≃ F, even if H does not lie in the same level as G and F.\n\nisGroupHom : (G : Group {ℓ}) (H : Group {ℓ'}) (f : ⟨ G ⟩ → ⟨ H ⟩) → Type _\nisGroupHom G H f = (x y : ⟨ G ⟩) → f (x G.+ y) ≡ (f x H.+ f y) where\n module G = Group G\n module H = Group H\n\nrecord GroupHom (G : Group {ℓ}) (H : Group {ℓ'}) : Type (ℓ-max ℓ ℓ') where\n constructor grouphom\n\n field\n fun : ⟨ G ⟩ → ⟨ H ⟩\n isHom : isGroupHom G H fun\n\nrecord GroupEquiv (G : Group {ℓ}) (H : Group {ℓ'}) : Type (ℓ-max ℓ ℓ') where\n constructor groupequiv\n\n field\n eq : ⟨ G ⟩ ≃ ⟨ H ⟩\n isHom : isGroupHom G H (equivFun eq)\n\n hom : GroupHom G H\n hom = grouphom (equivFun eq) isHom\n", "meta": {"hexsha": "4185131bd28719fa68bd6a2f175542705b7aa9b6", "size": 1072, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Structures/Group/Morphism.agda", "max_stars_repo_name": "RobertHarper/cubical", "max_stars_repo_head_hexsha": "d13941587a58895b65f714f1ccc9c1f5986b109c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Structures/Group/Morphism.agda", "max_issues_repo_name": "RobertHarper/cubical", "max_issues_repo_head_hexsha": "d13941587a58895b65f714f1ccc9c1f5986b109c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Structures/Group/Morphism.agda", "max_forks_repo_name": "RobertHarper/cubical", "max_forks_repo_head_hexsha": "d13941587a58895b65f714f1ccc9c1f5986b109c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 28.2105263158, "max_line_length": 84, "alphanum_fraction": 0.6417910448, "num_tokens": 371, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8947894632969137, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.678066423656738}} {"text": "module Nats.Add.Invert where\n\nopen import Equality\nopen import Nats\nopen import Nats.Add.Comm\nopen import Function\n\n------------------------------------------------------------------------\n-- internal stuffs\n\nprivate\n\n lemma′ : ∀ a b → (suc a ≡ suc b) → (a ≡ b)\n lemma′ _ _ refl = refl\n\n lemma : ∀ a b → (suc (a + suc a) ≡ suc (b + suc b)) → (a + a ≡ b + b)\n lemma a b\n rewrite nat-add-comm a $ suc a\n | nat-add-comm b $ suc b\n = lemma′ (a + a) (b + b) ∘ lemma′ (suc $ a + a) (suc $ b + b)\n\n +-invert : ∀ a b → (a + a ≡ b + b) → a ≡ b\n +-invert zero zero ev = refl\n +-invert zero (suc b) ()\n +-invert (suc a) zero ()\n +-invert (suc a) (suc b) = cong suc ∘ +-invert a b ∘ lemma a b\n\n------------------------------------------------------------------------\n-- public aliases\n\nnat-add-invert : ∀ a b → (a + a ≡ b + b) → a ≡ b\nnat-add-invert = +-invert\n\nnat-add-invert-1 : ∀ a b → (suc a ≡ suc b) → (a ≡ b)\nnat-add-invert-1 = lemma′\n", "meta": {"hexsha": "8a0cfb7f342fcd1675a8f825847c77e3ad1ace32", "size": 961, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Nats/Add/Invert.agda", "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_issues_repo_path": "src/Nats/Add/Invert.agda", "max_issues_repo_name": "ice1k/Theorems", "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Nats/Add/Invert.agda", "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.6944444444, "max_line_length": 73, "alphanum_fraction": 0.452653486, "num_tokens": 322, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8947894661025424, "lm_q2_score": 0.7577943712746406, "lm_q1q2_score": 0.6780664208883475}} {"text": "------------------------------------------------------------------------------\n-- Proving mirror (mirror t) = t using a list of trees\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOT.FOTC.Program.Mirror.MirrorListSL where\n\nopen import Algebra\nopen import Function\nopen import Data.List hiding ( reverse )\nopen import Data.List.Properties\nopen import Data.Product hiding ( map )\n\nopen import Relation.Binary.PropositionalEquality\nopen ≡-Reasoning\n\nmodule LM {A : Set} = Monoid (++-monoid A)\n\n------------------------------------------------------------------------------\n-- Auxiliary functions\n\nreverse : {A : Set} → List A → List A\nreverse [] = []\nreverse (x ∷ xs) = reverse xs ++ x ∷ []\n\n++-rightIdentity : {A : Set}(xs : List A) → xs ++ [] ≡ xs\n++-rightIdentity = proj₂ LM.identity\n\nreverse-++ : {A : Set}(xs ys : List A) →\n reverse (xs ++ ys) ≡ reverse ys ++ reverse xs\nreverse-++ [] ys = sym (++-rightIdentity (reverse ys))\nreverse-++ (x ∷ xs) [] = cong (λ x' → reverse x' ++ x ∷ [])\n (++-rightIdentity xs)\nreverse-++ (x ∷ xs) (y ∷ ys) =\n begin\n reverse (xs ++ y ∷ ys) ++ x ∷ []\n ≡⟨ cong (λ x' → x' ++ x ∷ []) (reverse-++ xs (y ∷ ys)) ⟩\n (reverse (y ∷ ys) ++ reverse xs) ++ x ∷ []\n ≡⟨ LM.assoc (reverse (y ∷ ys)) (reverse xs) (x ∷ []) ⟩\n reverse (y ∷ ys) ++ reverse (x ∷ xs)\n ∎\n\n------------------------------------------------------------------------------\n-- The rose tree type.\ndata Tree (A : Set) : Set where\n tree : A → List (Tree A) → Tree A\n\n------------------------------------------------------------------------------\n-- The mirror function.\n\n{-# TERMINATING #-}\nmirror : {A : Set} → Tree A → Tree A\nmirror (tree a ts) = tree a (reverse (map mirror ts))\n\n-- The proof of the property.\nmirror-involutive : {A : Set} → (t : Tree A) → mirror (mirror t) ≡ t\nhelper : {A : Set} → (ts : List (Tree A)) →\n reverse (map mirror (reverse (map mirror ts))) ≡ ts\n\nmirror-involutive (tree a []) = refl\nmirror-involutive (tree a (t ∷ ts)) =\n begin\n tree a (reverse (map mirror (reverse (map mirror ts) ++ mirror t ∷ [])))\n ≡⟨ cong (tree a) (helper (t ∷ ts)) ⟩\n tree a (t ∷ ts)\n ∎\n\nhelper [] = refl\nhelper (t ∷ ts) =\n begin\n reverse (map mirror (reverse (map mirror ts) ++ mirror t ∷ []))\n ≡⟨ cong reverse\n (map-++-commute mirror (reverse (map mirror ts)) (mirror t ∷ []))\n ⟩\n reverse (map mirror (reverse (map mirror ts)) ++\n (map mirror (mirror t ∷ [])))\n ≡⟨ subst (λ x → (reverse (map mirror (reverse (map mirror ts)) ++\n (map mirror (mirror t ∷ [])))) ≡ x)\n (reverse-++ (map mirror (reverse (map mirror ts)))\n (map mirror (mirror t ∷ [])))\n refl\n ⟩\n reverse (map mirror (mirror t ∷ [])) ++\n reverse (map mirror (reverse (map mirror ts)))\n ≡⟨ refl ⟩\n mirror (mirror t) ∷ reverse (map mirror (reverse (map mirror ts)))\n ≡⟨ cong (flip _∷_ (reverse (map mirror (reverse (map mirror ts)))))\n (mirror-involutive t)\n ⟩\n t ∷ reverse (map mirror (reverse (map mirror ts)))\n ≡⟨ cong (_∷_ t) (helper ts) ⟩\n t ∷ ts\n ∎\n", "meta": {"hexsha": "51117904898c9ca06aded5613817fff7298b3bbf", "size": 3428, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/FOTC/Program/Mirror/MirrorListSL.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/FOTC/Program/Mirror/MirrorListSL.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/FOTC/Program/Mirror/MirrorListSL.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 34.9795918367, "max_line_length": 78, "alphanum_fraction": 0.4708284714, "num_tokens": 939, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.894789454880027, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.6780664074895082}} {"text": "{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule LogicalFramework.Existential where\n\nmodule LF where\n postulate\n D : Set\n\n -- Disjunction.\n _∨_ : Set → Set → Set\n inj₁ : {A B : Set} → A → A ∨ B\n inj₂ : {A B : Set} → B → A ∨ B\n case : {A B C : Set} → (A → C) → (B → C) → A ∨ B → C\n\n -- The existential quantifier type on D.\n ∃ : (A : D → Set) → Set\n _,_ : {A : D → Set}(t : D) → A t → ∃ A\n ∃-proj₁ : {A : D → Set} → ∃ A → D\n ∃-proj₂ : {A : D → Set}(h : ∃ A) → A (∃-proj₁ h)\n ∃-elim : {A : D → Set}{B : Set} → ∃ A → (∀ {x} → A x → B) → B\n\n syntax ∃ (λ x → e) = ∃[ x ] e\n\n module FOL-Examples where\n -- Using the projections.\n ∃∀₁ : {A : D → D → Set} → ∃[ x ](∀ y → A x y) → ∀ y → ∃[ x ] A x y\n ∃∀₁ h y = ∃-proj₁ h , (∃-proj₂ h) y\n\n ∃∨₁ : {A B : D → Set} → ∃[ x ](A x ∨ B x) → (∃[ x ] A x) ∨ (∃[ x ] B x)\n ∃∨₁ h = case (λ Ax → inj₁ (∃-proj₁ h , Ax))\n (λ Bx → inj₂ (∃-proj₁ h , Bx))\n (∃-proj₂ h)\n\n -- Using the elimination.\n ∃∀₂ : {A : D → D → Set} → ∃[ x ](∀ y → A x y) → ∀ y → ∃[ x ] A x y\n ∃∀₂ h y = ∃-elim h (λ {x} ah → x , ah y)\n\n ∃∨₂ : {A B : D → Set} → ∃[ x ](A x ∨ B x) → (∃[ x ] A x) ∨ (∃[ x ] B x)\n ∃∨₂ h = ∃-elim h (λ {x} ah → case (λ Ax → inj₁ (x , Ax))\n (λ Bx → inj₂ (x , Bx))\n ah)\n\n module NonFOL-Examples where\n\n -- Using the projections.\n non-FOL₁ : {A : D → Set} → ∃ A → D\n non-FOL₁ h = ∃-proj₁ h\n\n -- Using the elimination.\n non-FOL₂ : {A : D → Set} → ∃ A → D\n non-FOL₂ h = ∃-elim h (λ {x} _ → x)\n\nmodule Inductive where\n\n open import Common.FOL.FOL\n\n -- The existential proyections.\n ∃-proj₁ : ∀ {A} → ∃ A → D\n ∃-proj₁ (x , _) = x\n\n ∃-proj₂ : ∀ {A} → (h : ∃ A) → A (∃-proj₁ h)\n ∃-proj₂ (_ , Ax) = Ax\n\n -- The existential elimination.\n ∃-elim : {A : D → Set}{B : Set} → ∃ A → (∀ {x} → A x → B) → B\n ∃-elim (_ , Ax) h = h Ax\n\n module FOL-Examples where\n -- Using the projections.\n ∃∀₁ : {A : D → D → Set} → ∃[ x ](∀ y → A x y) → ∀ y → ∃[ x ] A x y\n ∃∀₁ h y = ∃-proj₁ h , (∃-proj₂ h) y\n\n ∃∨₁ : {A B : D → Set} → ∃[ x ](A x ∨ B x) → (∃[ x ] A x) ∨ (∃[ x ] B x)\n ∃∨₁ h = case (λ Ax → inj₁ (∃-proj₁ h , Ax))\n (λ Bx → inj₂ (∃-proj₁ h , Bx))\n (∃-proj₂ h)\n\n -- Using the elimination.\n ∃∀₂ : {A : D → D → Set} → ∃[ x ](∀ y → A x y) → ∀ y → ∃[ x ] A x y\n ∃∀₂ h y = ∃-elim h (λ {x} ah → x , ah y)\n\n ∃∨₂ : {A B : D → Set} → ∃[ x ](A x ∨ B x) → (∃[ x ] A x) ∨ (∃[ x ] B x)\n ∃∨₂ h = ∃-elim h (λ {x} ah → case (λ Ax → inj₁ (x , Ax))\n (λ Bx → inj₂ (x , Bx))\n ah)\n\n -- Using pattern matching.\n ∃∀₃ : {A : D → D → Set} → ∃[ x ](∀ y → A x y) → ∀ y → ∃[ x ] A x y\n ∃∀₃ (x , Ax) y = x , Ax y\n\n ∃∨₃ : {A B : D → Set} → ∃[ x ](A x ∨ B x) → (∃[ x ] A x) ∨ (∃[ x ] B x)\n ∃∨₃ (x , inj₁ Ax) = inj₁ (x , Ax)\n ∃∨₃ (x , inj₂ Bx) = inj₂ (x , Bx)\n\n module NonFOL-Examples where\n\n -- Using the projections.\n non-FOL₁ : {A : D → Set} → ∃ A → D\n non-FOL₁ h = ∃-proj₁ h\n\n -- Using the elimination.\n non-FOL₂ : {A : D → Set} → ∃ A → D\n non-FOL₂ h = ∃-elim h (λ {x} _ → x)\n\n -- Using the pattern matching.\n non-FOL₃ : {A : D → Set} → ∃ A → D\n non-FOL₃ (x , _) = x\n", "meta": {"hexsha": "1a06f1ca47dc9b4943297b138f9ba956e2d743d1", "size": 3469, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/thesis/report/LogicalFramework/Existential.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/thesis/report/LogicalFramework/Existential.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/thesis/report/LogicalFramework/Existential.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 31.2522522523, "max_line_length": 75, "alphanum_fraction": 0.388872874, "num_tokens": 1547, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391617003942, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.6780288498379863}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- The identity function\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Function.Construct.Identity where\n\nopen import Data.Product using (_,_)\nopen import Function using (id)\nopen import Function.Bundles\nimport Function.Definitions as Definitions\nimport Function.Structures as Structures\nopen import Level\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality using (_≡_; setoid)\n\nprivate\n variable\n a ℓ : Level\n A : Set a\n\n------------------------------------------------------------------------\n-- Properties\n\nmodule _ (_≈_ : Rel A ℓ) where\n\n open Definitions _≈_ _≈_\n\n injective : Injective id\n injective = id\n\n surjective : Reflexive _≈_ → Surjective id\n surjective refl x = x , refl\n\n bijective : Reflexive _≈_ → Bijective id\n bijective refl = injective , surjective refl\n\n inverseˡ : Reflexive _≈_ → Inverseˡ id id\n inverseˡ refl x = refl\n\n inverseʳ : Reflexive _≈_ → Inverseʳ id id\n inverseʳ refl x = refl\n\n inverseᵇ : Reflexive _≈_ → Inverseᵇ id id\n inverseᵇ refl = inverseˡ refl , inverseʳ refl\n\n------------------------------------------------------------------------\n-- Structures\n\nmodule _ {_≈_ : Rel A ℓ} (isEq : IsEquivalence _≈_) where\n\n open Structures _≈_ _≈_\n open IsEquivalence isEq\n\n isCongruent : IsCongruent id\n isCongruent = record\n { cong = id\n ; isEquivalence₁ = isEq\n ; isEquivalence₂ = isEq\n }\n\n isInjection : IsInjection id\n isInjection = record\n { isCongruent = isCongruent\n ; injective = injective _≈_\n }\n\n isSurjection : IsSurjection id\n isSurjection = record\n { isCongruent = isCongruent\n ; surjective = surjective _≈_ refl\n }\n\n isBijection : IsBijection id\n isBijection = record\n { isInjection = isInjection\n ; surjective = surjective _≈_ refl\n }\n\n isLeftInverse : IsLeftInverse id id\n isLeftInverse = record\n { isCongruent = isCongruent\n ; cong₂ = id\n ; inverseˡ = inverseˡ _≈_ refl\n }\n\n isRightInverse : IsRightInverse id id\n isRightInverse = record\n { isCongruent = isCongruent\n ; cong₂ = id\n ; inverseʳ = inverseʳ _≈_ refl\n }\n\n isInverse : IsInverse id id\n isInverse = record\n { isLeftInverse = isLeftInverse\n ; inverseʳ = inverseʳ _≈_ refl\n }\n\n------------------------------------------------------------------------\n-- Setoid bundles\n\nmodule _ (S : Setoid a ℓ) where\n\n open Setoid S\n\n injection : Injection S S\n injection = record\n { f = id\n ; cong = id\n ; injective = injective _≈_\n }\n\n surjection : Surjection S S\n surjection = record\n { f = id\n ; cong = id\n ; surjective = surjective _≈_ refl\n }\n\n bijection : Bijection S S\n bijection = record\n { f = id\n ; cong = id\n ; bijective = bijective _≈_ refl\n }\n\n equivalence : Equivalence S S\n equivalence = record\n { f = id\n ; g = id\n ; cong₁ = id\n ; cong₂ = id\n }\n\n leftInverse : LeftInverse S S\n leftInverse = record\n { f = id\n ; g = id\n ; cong₁ = id\n ; cong₂ = id\n ; inverseˡ = inverseˡ _≈_ refl\n }\n\n rightInverse : RightInverse S S\n rightInverse = record\n { f = id\n ; g = id\n ; cong₁ = id\n ; cong₂ = id\n ; inverseʳ = inverseʳ _≈_ refl\n }\n\n inverse : Inverse S S\n inverse = record\n { f = id\n ; f⁻¹ = id\n ; cong₁ = id\n ; cong₂ = id\n ; inverse = inverseᵇ _≈_ refl\n }\n\n------------------------------------------------------------------------\n-- Propositional bundles\n\nmodule _ (A : Set a) where\n\n id-↣ : A ↣ A\n id-↣ = injection (setoid A)\n\n id-↠ : A ↠ A\n id-↠ = surjection (setoid A)\n\n id-⤖ : A ⤖ A\n id-⤖ = bijection (setoid A)\n\n id-⇔ : A ⇔ A\n id-⇔ = equivalence (setoid A)\n\n id-↩ : A ↩ A\n id-↩ = leftInverse (setoid A)\n\n id-↪ : A ↪ A\n id-↪ = rightInverse (setoid A)\n\n id-↔ : A ↔ A\n id-↔ = inverse (setoid A)\n", "meta": {"hexsha": "2207a5789894e6497f96028bb47d708c27d0845e", "size": 4077, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Function/Construct/Identity.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Function/Construct/Identity.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Function/Construct/Identity.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 21.3455497382, "max_line_length": 72, "alphanum_fraction": 0.5405935737, "num_tokens": 1251, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391624034103, "lm_q2_score": 0.7853085708384736, "lm_q1q2_score": 0.6780288423441301}} {"text": "{-# OPTIONS --without-K --exact-split #-}\n\nmodule 04-inductive-types where\n\nimport 03-natural-numbers\nopen 03-natural-numbers public\n\n-- Section 4.2 The unit type\n\n-- Definition 4.2.1\n\ndata unit : UU lzero where\n star : unit\n \n𝟙 = unit\n\nind-unit : {i : Level} {P : unit → UU i} → P star → ((x : unit) → P x)\nind-unit p star = p\n\n-- Section 4.3 The empty type\n\n-- Definition 4.3.1\n\ndata empty : UU lzero where\n\n𝟘 = empty\n\nind-empty : {i : Level} {P : empty → UU i} → ((x : empty) → P x)\nind-empty ()\n\nex-falso : {i : Level} {P : empty → UU i} → ((x : empty) → P x)\nex-falso = ind-empty\n\nex-falso' : {i : Level} {A : UU i} → empty → A\nex-falso' = ex-falso\n\n-- Definition 4.3.2\n\n¬ : {i : Level} → UU i → UU i\n¬ A = A → empty\n\n-- Section 4.4 The booleans\n\n-- Definition 4.4.1\n\ndata bool : UU lzero where\n true false : bool\n\n-- Example 4.4.2\n\nneg-𝟚 : bool → bool\nneg-𝟚 true = false\nneg-𝟚 false = true\n\nconjunction-𝟚 : bool → (bool → bool)\nconjunction-𝟚 true true = true\nconjunction-𝟚 true false = false\nconjunction-𝟚 false true = false\nconjunction-𝟚 false false = false\n\ndisjunction-𝟚 : bool → (bool → bool)\ndisjunction-𝟚 true true = true\ndisjunction-𝟚 true false = true\ndisjunction-𝟚 false true = true\ndisjunction-𝟚 false false = false\n\n-- Section 4.5 Coproducts and the type of integers\n\n-- Definition 4.5.1\n\ndata coprod {i j : Level} (A : UU i) (B : UU j) : UU (i ⊔ j) where\n inl : A → coprod A B\n inr : B → coprod A B\n\nind-coprod : {i j k : Level} {A : UU i} {B : UU j} (C : coprod A B → UU k) →\n ((x : A) → C (inl x)) → ((y : B) → C (inr y)) →\n (t : coprod A B) → C t\nind-coprod C f g (inl x) = f x\nind-coprod C f g (inr x) = g x\n\n-- Definition 4.5.2\n\n-- The type of integers\n\nℤ : UU lzero\nℤ = coprod ℕ (coprod unit ℕ)\n\n-- Inclusion of the negative integers\n\nin-neg : ℕ → ℤ\nin-neg n = inl n\n\n-- Negative one\n\nneg-one-ℤ : ℤ\nneg-one-ℤ = in-neg zero-ℕ\n\n-- Zero\n\nzero-ℤ : ℤ\nzero-ℤ = inr (inl star)\n\n-- One\n\none-ℤ : ℤ\none-ℤ = inr (inr zero-ℕ)\n\n-- Inclusion of the positive integers\n\nin-pos : ℕ → ℤ\nin-pos n = inr (inr n)\n\n\n-- Lemma 4.5.3\n\n{- We prove an induction principle for the integers. -}\n\nind-ℤ : {i : Level} (P : ℤ → UU i) → P neg-one-ℤ → ((n : ℕ) → P (inl n) → P (inl (succ-ℕ n))) → P zero-ℤ → P one-ℤ → ((n : ℕ) → P (inr (inr (n))) → P (inr (inr (succ-ℕ n)))) → (k : ℤ) → P k\nind-ℤ P p-1 p-S p0 p1 pS (inl zero-ℕ) = p-1\nind-ℤ P p-1 p-S p0 p1 pS (inl (succ-ℕ x)) = p-S x (ind-ℤ P p-1 p-S p0 p1 pS (inl x))\nind-ℤ P p-1 p-S p0 p1 pS (inr (inl star)) = p0\nind-ℤ P p-1 p-S p0 p1 pS (inr (inr zero-ℕ)) = p1\nind-ℤ P p-1 p-S p0 p1 pS (inr (inr (succ-ℕ x))) = pS x (ind-ℤ P p-1 p-S p0 p1 pS (inr (inr (x))))\n\n-- Definition 4.5.4\n\nsucc-ℤ : ℤ → ℤ\nsucc-ℤ (inl zero-ℕ) = zero-ℤ\nsucc-ℤ (inl (succ-ℕ x)) = inl x\nsucc-ℤ (inr (inl star)) = one-ℤ\nsucc-ℤ (inr (inr x)) = inr (inr (succ-ℕ x))\n\n-- Section 4.6 Dependent pair types\n\n-- Definition 4.6.1\n\ndata Σ {i j : Level} (A : UU i) (B : A → UU j) : UU (i ⊔ j) where\n pair : (x : A) → (B x → Σ A B)\n\nind-Σ : {i j k : Level} {A : UU i} {B : A → UU j} {C : Σ A B → UU k} →\n ((x : A) (y : B x) → C (pair x y)) → ((t : Σ A B) → C t)\nind-Σ f (pair x y) = f x y\n\n-- Definition 4.6.2\n\npr1 : {i j : Level} {A : UU i} {B : A → UU j} → Σ A B → A\npr1 (pair a b) = a\n\npr2 : {i j : Level} {A : UU i} {B : A → UU j} → (t : Σ A B) → B (pr1 t)\npr2 (pair a b) = b\n\n-- Section 4.7 Cartesian products\n\n-- Definition 4.7.1\n\nprod : {i j : Level} (A : UU i) (B : UU j) → UU (i ⊔ j)\nprod A B = Σ A (λ a → B)\n\npair' :\n {i j : Level} {A : UU i} {B : UU j} → A → B → prod A B\npair' = pair\n\n_×_ : {i j : Level} (A : UU i) (B : UU j) → UU (i ⊔ j)\nA × B = prod A B\n\n-- Exercises\n\n-- Exercise 4.2\n\n{- In this exercise we were asked to show that (A + ¬A) implies (¬¬A → A). In \n other words, we get double negation elimination for the types that are \n decidable. -}\n\nis-decidable : {l : Level} (A : UU l) → UU l\nis-decidable A = coprod A (¬ A)\n\ndouble-negation-elim-is-decidable :\n {i : Level} (A : UU i) → is-decidable A → (¬ (¬ A) → A)\ndouble-negation-elim-is-decidable A (inl x) p = x\ndouble-negation-elim-is-decidable A (inr x) p = ind-empty (p x)\n\nneg-triple-neg : {l : Level} (A : UU l) → (¬ (¬ (¬ A))) → (¬ A)\nneg-triple-neg A f a = f (λ g → g a)\n\n-- Exercise 4.3\n\nexclusive-disjunction-𝟚 : bool → (bool → bool)\nexclusive-disjunction-𝟚 true true = false\nexclusive-disjunction-𝟚 true false = true\nexclusive-disjunction-𝟚 false true = true\nexclusive-disjunction-𝟚 false false = false\n\nimplication-𝟚 : bool → (bool → bool)\nimplication-𝟚 true true = true\nimplication-𝟚 true false = false\nimplication-𝟚 false true = true\nimplication-𝟚 false false = true\n\nbi-implication-𝟚 : bool → (bool → bool)\nbi-implication-𝟚 true true = true\nbi-implication-𝟚 true false = false\nbi-implication-𝟚 false true = false\nbi-implication-𝟚 false false = true\n\npeirce-arrow-𝟚 : bool → (bool → bool)\npeirce-arrow-𝟚 true true = false\npeirce-arrow-𝟚 true false = false\npeirce-arrow-𝟚 false true = false\npeirce-arrow-𝟚 false false = true\n\nsheffer-stroke-𝟚 : bool → (bool → bool)\nsheffer-stroke-𝟚 true true = false\nsheffer-stroke-𝟚 true false = true\nsheffer-stroke-𝟚 false true = true\nsheffer-stroke-𝟚 false false = true\n\n-- Exercise 4.4\n\npred-ℤ : ℤ → ℤ\npred-ℤ (inl x) = inl (succ-ℕ x)\npred-ℤ (inr (inl star)) = inl zero-ℕ\npred-ℤ (inr (inr zero-ℕ)) = inr (inl star)\npred-ℤ (inr (inr (succ-ℕ x))) = inr (inr x)\n\n-- Exercise 4.5\n\n-- Addition on ℤ\n\nadd-ℤ : ℤ → ℤ → ℤ\nadd-ℤ (inl zero-ℕ) l = pred-ℤ l\nadd-ℤ (inl (succ-ℕ x)) l = pred-ℤ (add-ℤ (inl x) l)\nadd-ℤ (inr (inl star)) l = l\nadd-ℤ (inr (inr zero-ℕ)) l = succ-ℤ l\nadd-ℤ (inr (inr (succ-ℕ x))) l = succ-ℤ (add-ℤ (inr (inr x)) l)\n\n-- The negative of an integer\n\nneg-ℤ : ℤ → ℤ\nneg-ℤ (inl x) = inr (inr x)\nneg-ℤ (inr (inl star)) = inr (inl star)\nneg-ℤ (inr (inr x)) = inl x\n\n-- Multiplication on ℤ\n\nmul-ℤ : ℤ → ℤ → ℤ\nmul-ℤ (inl zero-ℕ) l = neg-ℤ l\nmul-ℤ (inl (succ-ℕ x)) l = add-ℤ (neg-ℤ l) (mul-ℤ (inl x) l)\nmul-ℤ (inr (inl star)) l = zero-ℤ\nmul-ℤ (inr (inr zero-ℕ)) l = l\nmul-ℤ (inr (inr (succ-ℕ x))) l = add-ℤ l (mul-ℤ (inr (inr x)) l)\n\n-- Exercise 4.6\n\nFibonacci-ℤ : ℤ → ℤ\nFibonacci-ℤ (inl zero-ℕ) = one-ℤ\nFibonacci-ℤ (inl (succ-ℕ zero-ℕ)) = neg-one-ℤ\nFibonacci-ℤ (inl (succ-ℕ (succ-ℕ x))) =\n add-ℤ (Fibonacci-ℤ (inl x)) (neg-ℤ (Fibonacci-ℤ (inl (succ-ℕ x))))\nFibonacci-ℤ (inr (inl star)) = zero-ℤ\nFibonacci-ℤ (inr (inr zero-ℕ)) = one-ℤ\nFibonacci-ℤ (inr (inr (succ-ℕ zero-ℕ))) = one-ℤ\nFibonacci-ℤ (inr (inr (succ-ℕ (succ-ℕ x)))) =\n add-ℤ (Fibonacci-ℤ (inr (inr x))) (Fibonacci-ℤ (inr (inr (succ-ℕ x))))\n\n-- Exercise 4.7\n\n{- In this exercise we were asked to show that 1 + 1 satisfies the induction \n principle of the booleans. In other words, type theory cannot distinguish \n the booleans from the type 1 + 1. We will see later that they are indeed \n equivalent types. -}\n\nt0 : coprod unit unit\nt0 = inl star\n\nt1 : coprod unit unit\nt1 = inr star\n\nind-coprod-unit-unit : {i : Level} {P : coprod unit unit → UU i} →\n P t0 → P t1 → (x : coprod unit unit) → P x\nind-coprod-unit-unit p0 p1 (inl star) = p0\nind-coprod-unit-unit p0 p1 (inr star) = p1\n\n-- Exercise 4.8\n\n-- Exercise 4.8(a)\n\ndata list {l : Level} (A : UU l) : UU l where\n nil : list A\n cons : A → list A → list A\n\nin-list : {l : Level} {A : UU l} → A → list A\nin-list a = cons a nil\n\n-- Exercise 4.8(b)\n\nfold-list :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (b : B) (μ : A → (B → B)) →\n list A → B\nfold-list b μ nil = b\nfold-list b μ (cons a l) = μ a (fold-list b μ l)\n\n-- Exercise 4.8(c)\n\nlength-list :\n {l : Level} {A : UU l} → list A → ℕ\nlength-list = fold-list zero-ℕ (λ a → succ-ℕ)\n\n-- Exercise 4.8(d)\n\nsum-list-ℕ :\n list ℕ → ℕ\nsum-list-ℕ = fold-list zero-ℕ add-ℕ\n\n-- Exercise 4.8(e)\n\nconcat-list :\n {l : Level} {A : UU l} → list A → (list A → list A)\nconcat-list {l} {A} = fold-list id (λ a f → (cons a) ∘ f)\n\n-- Exercise 4.8(f)\n\nflatten-list :\n {l : Level} {A : UU l} → list (list A) → list A\nflatten-list = fold-list nil concat-list\n\n-- Exercise 4.8 (g)\n\nreverse-list :\n {l : Level} {A : UU l} → list A → list A\nreverse-list nil = nil\nreverse-list (cons a l) = concat-list (reverse-list l) (in-list a)\n", "meta": {"hexsha": "5317aceb5ccc415befd8124af5c1fa3c1a8c50fb", "size": 8032, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/04-inductive-types.agda", "max_stars_repo_name": "hemangandhi/HoTT-Intro", "max_stars_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Agda/04-inductive-types.agda", "max_issues_repo_name": "hemangandhi/HoTT-Intro", "max_issues_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/04-inductive-types.agda", "max_forks_repo_name": "hemangandhi/HoTT-Intro", "max_forks_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.1927710843, "max_line_length": 189, "alphanum_fraction": 0.5957420319, "num_tokens": 3563, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391599428538, "lm_q2_score": 0.7853085708384736, "lm_q1q2_score": 0.6780288230211691}} {"text": "\nmodule Plus where\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\ninfixr 40 _+_\ninfix 10 _==_\n\n_+_ : Nat -> Nat -> Nat\nzero + m = m\nsuc n + m = suc (n + m)\n\ndata _==_ (x, y : Nat) : Set where\n -- ...\n\npostulate\n refl : {n : Nat} -> n == n\n cong : (f : Nat -> Nat){n, m : Nat} -> n == m -> f n == f m\n\nplusZero : {n : Nat} -> n + zero == n\nplusZero {zero} = refl\nplusZero {suc n} = cong suc plusZero\n\n", "meta": {"hexsha": "fda792d5c4bd00fcd8ae80ca74b82de638869124", "size": 415, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/talks/MetaVars/Plus.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "notes/talks/MetaVars/Plus.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "notes/talks/MetaVars/Plus.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 15.9615384615, "max_line_length": 61, "alphanum_fraction": 0.513253012, "num_tokens": 166, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9353465080392795, "lm_q2_score": 0.7248702702332475, "lm_q1q2_score": 0.6780048760441569}} {"text": "module Numeral.Finite.Relation.Order where\n\nimport Lvl\nopen import Data\nopen import Data.Boolean.Stmt\nopen import Functional\nopen import Numeral.Finite\nopen import Numeral.Finite.Oper.Comparisons\nopen import Numeral.Natural\nopen import Type\n\nprivate variable an bn cn n : ℕ\nprivate variable a : 𝕟(an)\nprivate variable b : 𝕟(bn)\nprivate variable c : 𝕟(cn)\n\n_≤_ : 𝕟(an) → 𝕟(bn) → Type\n_≤_ = IsTrue ∘₂ (_≤?_)\n\n_≥_ : 𝕟(an) → 𝕟(bn) → Type\n_≥_ = IsTrue ∘₂ (_≥?_)\n\n_<_ : 𝕟(an) → 𝕟(bn) → Type\n_<_ = IsTrue ∘₂ (__ : 𝕟(an) → 𝕟(bn) → Type\n_>_ = IsTrue ∘₂ (_>?_)\n\n_≡_ : 𝕟(an) → 𝕟(bn) → Type\n_≡_ = IsTrue ∘₂ (_≡?_)\n\n_≢_ : 𝕟(an) → 𝕟(bn) → Type\n_≢_ = IsTrue ∘₂ (_≢?_)\n\n-- TODO: open import Structure.Relator.Properties\n\nimport Numeral.Natural.Relation.Order as ℕ\n\n[≤]-minimum : (𝟎{n} ≤ a)\n[≤]-minimum {a = 𝟎} = <>\n[≤]-minimum {a = 𝐒 _} = <>\n\n-- [≤]-maximum : (bound a ℕ.≤ n) → (a ≤ maximum{n})\n-- [≤]-maximum {_} {𝟎} ℕ.[≤]-with-[𝐒] = <>\n-- [≤]-maximum {𝐒 an} {𝐒 a} {.(𝐒 n)} (ℕ.[≤]-with-[𝐒] {y = n} ⦃ p ⦄) = [≤]-maximum {an}{a}{n} p\n[≤]-maximum : (bound a ℕ.≤ 𝐒(n)) → (a ≤ maximum{n})\n[≤]-maximum {a = 𝟎} {𝟎} (ℕ.succ _) = <>\n[≤]-maximum {a = 𝟎} {𝐒 _} (ℕ.succ _) = <>\n[≤]-maximum {a = 𝐒 a} {𝐒 x} (ℕ.succ p) = [≤]-maximum {a = a} p\n[≤]-maximum {a = 𝐒 {𝟎} ()} {𝟎} (ℕ.succ _)\n[≤]-maximum {a = 𝐒 {𝐒 n} a} {𝟎} (ℕ.succ ())\n\n[≤]-reflexivity-raw : (a ≤ a)\n[≤]-reflexivity-raw {a = 𝟎} = <>\n[≤]-reflexivity-raw {a = 𝐒 a} = [≤]-reflexivity-raw {a = a}\n\n[≤]-asymmetry-raw : (a ≤ b) → (b ≤ a) → (a ≡ b)\n[≤]-asymmetry-raw {a = 𝟎} {b = 𝟎} _ _ = <>\n[≤]-asymmetry-raw {a = 𝐒 a} {b = 𝐒 b} p q = [≤]-asymmetry-raw {a = a}{b = b} p q\n\n[≤]-transitivity-raw : (a ≤ b) → (b ≤ c) → (a ≤ c)\n[≤]-transitivity-raw {a = 𝟎} {b = 𝟎} {c = 𝟎} p q = <>\n[≤]-transitivity-raw {a = 𝟎} {b = 𝟎} {c = 𝐒 c} p q = <>\n[≤]-transitivity-raw {a = 𝟎} {b = 𝐒 b} {c = 𝐒 c} p q = <>\n[≤]-transitivity-raw {a = 𝐒 a} {b = 𝐒 b} {c = 𝐒 c} p q = [≤]-transitivity-raw {a = a} {b = b} {c = c} p q\n", "meta": {"hexsha": "826ef12c1695c995f467bc64ce820bcddf124b85", "size": 2015, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Finite/Relation/Order.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Finite/Relation/Order.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Finite/Relation/Order.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.5303030303, "max_line_length": 105, "alphanum_fraction": 0.4977667494, "num_tokens": 1047, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.927363293639213, "lm_q2_score": 0.7310585727705127, "lm_q1q2_score": 0.6779568858876449}} {"text": "------------------------------------------------------------------------\n-- Code for converting Vec n A → B to and from n-ary functions\n------------------------------------------------------------------------\n\nmodule Data.Vec.N-ary where\n\nopen import Data.Nat\nopen import Data.Vec\nopen import Data.Function\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality\n\n------------------------------------------------------------------------\n-- N-ary functions\n\nN-ary : ℕ → Set → Set → Set\nN-ary zero A B = B\nN-ary (suc n) A B = A → N-ary n A B\n\n------------------------------------------------------------------------\n-- Conversion\n\ncurryⁿ : ∀ {n A B} → (Vec A n → B) → N-ary n A B\ncurryⁿ {zero} f = f []\ncurryⁿ {suc n} f = λ x → curryⁿ (f ∘ _∷_ x)\n\n_$ⁿ_ : ∀ {n A B} → N-ary n A B → (Vec A n → B)\nf $ⁿ [] = f\nf $ⁿ (x ∷ xs) = f x $ⁿ xs\n\n------------------------------------------------------------------------\n-- N-ary function equality\n\nEq : ∀ {A B} n → Rel B → (f g : N-ary n A B) → Set\nEq zero _∼_ f g = f ∼ g\nEq (suc n) _∼_ f g = ∀ x → Eq n _∼_ (f x) (g x)\n\n-- A variant where all the arguments are implicit (hidden).\n\nEqʰ : ∀ {A B} n → Rel B → (f g : N-ary n A B) → Set\nEqʰ zero _∼_ f g = f ∼ g\nEqʰ (suc n) _∼_ f g = ∀ {x} → Eqʰ n _∼_ (f x) (g x)\n\n------------------------------------------------------------------------\n-- Some lemmas\n\n-- The functions curryⁿ and _$ⁿ_ are inverses.\n\nleft-inverse : ∀ {n A B} (f : Vec A n → B) →\n ∀ xs → curryⁿ f $ⁿ xs ≡ f xs\nleft-inverse f [] = refl\nleft-inverse f (x ∷ xs) = left-inverse (f ∘ _∷_ x) xs\n\nright-inverse : ∀ {A B} n (f : N-ary n A B) →\n Eq n _≡_ (curryⁿ (_$ⁿ_ {n} f)) f\nright-inverse zero f = refl\nright-inverse (suc n) f = λ x → right-inverse n (f x)\n\n-- Conversion preserves equality.\n\ncurryⁿ-pres : ∀ {n A B _∼_} (f g : Vec A n → B) →\n (∀ xs → f xs ∼ g xs) →\n Eq n _∼_ (curryⁿ f) (curryⁿ g)\ncurryⁿ-pres {zero} f g hyp = hyp []\ncurryⁿ-pres {suc n} f g hyp = λ x →\n curryⁿ-pres (f ∘ _∷_ x) (g ∘ _∷_ x) (λ xs → hyp (x ∷ xs))\n\ncurryⁿ-pres⁻¹ : ∀ {n A B _∼_} (f g : Vec A n → B) →\n Eq n _∼_ (curryⁿ f) (curryⁿ g) →\n ∀ xs → f xs ∼ g xs\ncurryⁿ-pres⁻¹ f g hyp [] = hyp\ncurryⁿ-pres⁻¹ f g hyp (x ∷ xs) =\n curryⁿ-pres⁻¹ (f ∘ _∷_ x) (g ∘ _∷_ x) (hyp x) xs\n\nappⁿ-pres : ∀ {n A B _∼_} (f g : N-ary n A B) →\n Eq n _∼_ f g →\n (xs : Vec A n) → (f $ⁿ xs) ∼ (g $ⁿ xs)\nappⁿ-pres f g hyp [] = hyp\nappⁿ-pres f g hyp (x ∷ xs) = appⁿ-pres (f x) (g x) (hyp x) xs\n\nappⁿ-pres⁻¹ : ∀ {n A B _∼_} (f g : N-ary n A B) →\n ((xs : Vec A n) → (f $ⁿ xs) ∼ (g $ⁿ xs)) →\n Eq n _∼_ f g\nappⁿ-pres⁻¹ {zero} f g hyp = hyp []\nappⁿ-pres⁻¹ {suc n} f g hyp = λ x →\n appⁿ-pres⁻¹ (f x) (g x) (λ xs → hyp (x ∷ xs))\n\n-- Eq and Eqʰ are equivalent.\n\nEq-to-Eqʰ : ∀ {A B} n {_∼_ : Rel B} {f g : N-ary n A B} →\n Eq n _∼_ f g → Eqʰ n _∼_ f g\nEq-to-Eqʰ zero eq = eq\nEq-to-Eqʰ (suc n) eq = Eq-to-Eqʰ n (eq _)\n\nEqʰ-to-Eq : ∀ {A B} n {_∼_ : Rel B} {f g : N-ary n A B} →\n Eqʰ n _∼_ f g → Eq n _∼_ f g\nEqʰ-to-Eq zero eq = eq\nEqʰ-to-Eq (suc n) eq = λ _ → Eqʰ-to-Eq n eq\n", "meta": {"hexsha": "d4734d612b2f638df646610b23a00a49e4d7bd81", "size": 3184, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Data/Vec/N-ary.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Data/Vec/N-ary.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Data/Vec/N-ary.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 32.1616161616, "max_line_length": 72, "alphanum_fraction": 0.4362437186, "num_tokens": 1273, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438951104066293, "lm_q2_score": 0.8031737892899221, "lm_q1q2_score": 0.6777944335885296}} {"text": "{-# OPTIONS --safe --experimental-lossy-unification #-}\nmodule Cubical.Data.Vec.OperationsNat where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.Nat renaming(_+_ to _+n_; _·_ to _·n_)\nopen import Cubical.Data.Vec.Base\nopen import Cubical.Data.Sigma\n\nprivate variable\n ℓ : Level\n\n_+n-vec_ : {m : ℕ} → Vec ℕ m → Vec ℕ m → Vec ℕ m\n_+n-vec_ {.zero} [] [] = []\n_+n-vec_ {.(suc _)} (k ∷ v) (l ∷ v') = (k +n l) ∷ (v +n-vec v')\n\n+n-vec-lid : {m : ℕ} → (v : Vec ℕ m) → replicate 0 +n-vec v ≡ v\n+n-vec-lid {.zero} [] = refl\n+n-vec-lid {.(suc _)} (k ∷ v) = cong (_∷_ k) (+n-vec-lid v)\n\n+n-vec-rid : {m : ℕ} → (v : Vec ℕ m) → v +n-vec replicate 0 ≡ v\n+n-vec-rid {.zero} [] = refl\n+n-vec-rid {.(suc _)} (k ∷ v) = cong₂ _∷_ (+-zero k) (+n-vec-rid v)\n\n+n-vec-assoc : {m : ℕ} → (v v' v'' : Vec ℕ m) → v +n-vec (v' +n-vec v'') ≡ (v +n-vec v') +n-vec v''\n+n-vec-assoc [] [] [] = refl\n+n-vec-assoc (k ∷ v) (l ∷ v') (p ∷ v'') = cong₂ _∷_ (+-assoc k l p) (+n-vec-assoc v v' v'')\n\n+n-vec-comm : {m : ℕ} → (v v' : Vec ℕ m) → v +n-vec v' ≡ v' +n-vec v\n+n-vec-comm {.zero} [] [] = refl\n+n-vec-comm {.(suc _)} (k ∷ v) (l ∷ v') = cong₂ _∷_ (+-comm k l) (+n-vec-comm v v')\n\nsep-vec : (k l : ℕ) → Vec ℕ (k +n l) → (Vec ℕ k) × (Vec ℕ l )\nsep-vec zero l v = [] , v\nsep-vec (suc k) l (x ∷ v) = (x ∷ fst (sep-vec k l v)) , (snd (sep-vec k l v))\n\nsep-vec-fst : (k l : ℕ) → (v : Vec ℕ k) → (v' : Vec ℕ l) → fst (sep-vec k l (v ++ v')) ≡ v\nsep-vec-fst zero l [] v' = refl\nsep-vec-fst (suc k) l (x ∷ v) v' = cong (λ X → x ∷ X) (sep-vec-fst k l v v')\n\nsep-vec-snd : (k l : ℕ) → (v : Vec ℕ k) → (v' : Vec ℕ l) → snd (sep-vec k l (v ++ v')) ≡ v'\nsep-vec-snd zero l [] v' = refl\nsep-vec-snd (suc k) l (x ∷ v) v' = sep-vec-snd k l v v'\n\nsep-vec-id : (k l : ℕ) → (v : Vec ℕ (k +n l)) → fst (sep-vec k l v) ++ snd (sep-vec k l v) ≡ v\nsep-vec-id zero l v = refl\nsep-vec-id (suc k) l (x ∷ v) = cong (λ X → x ∷ X) (sep-vec-id k l v)\n\nrep-concat : (k l : ℕ) → {B : Type ℓ} → (b : B) →\n replicate {_} {k} {B} b ++ replicate {_} {l} {B} b ≡ replicate {_} {k +n l} {B} b\nrep-concat zero l b = refl\nrep-concat (suc k) l b = cong (λ X → b ∷ X) (rep-concat k l b)\n\n+n-vec-concat : (k l : ℕ) → (v w : Vec ℕ k) → (v' w' : Vec ℕ l)\n → (v +n-vec w) ++ (v' +n-vec w') ≡ (v ++ v') +n-vec (w ++ w')\n+n-vec-concat zero l [] [] v' w' = refl\n+n-vec-concat (suc k) l (x ∷ v) (y ∷ w) v' w' = cong (λ X → x +n y ∷ X) (+n-vec-concat k l v w v' w')\n", "meta": {"hexsha": "59a2f242b5fcfebae54c0ef110956b345a51c167", "size": 2431, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/Vec/OperationsNat.agda", "max_stars_repo_name": "howsiyu/cubical", "max_stars_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/Vec/OperationsNat.agda", "max_issues_repo_name": "howsiyu/cubical", "max_issues_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/Vec/OperationsNat.agda", "max_forks_repo_name": "howsiyu/cubical", "max_forks_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.9137931034, "max_line_length": 101, "alphanum_fraction": 0.4965034965, "num_tokens": 1133, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952866333483, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6776836304698166}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Functions.Definition\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import LogicalFormulae\nopen import Setoids.Subset\nopen import Setoids.Setoids\nopen import Setoids.Orders.Partial.Definition\nopen import Fields.Fields\nopen import Rings.Orders.Total.Definition\nopen import Rings.Orders.Total.Lemmas\nopen import Rings.Orders.Partial.Definition\nopen import Rings.Definition\nopen import Fields.Orders.LeastUpperBounds.Definition\nopen import Fields.Orders.Total.Definition\n\nmodule Numbers.ClassicalReals.RealField where\n\nrecord RealField : Agda.Primitive.Setω where\n field\n a b c : _\n A : Set a\n S : Setoid {_} {b} A\n _+_ : A → A → A\n _*_ : A → A → A\n R : Ring S _+_ _*_\n F : Field R\n _<_ : Rel {_} {c} A\n pOrder : SetoidPartialOrder S _<_\n pOrderedRing : PartiallyOrderedRing R pOrder\n orderedRing : TotallyOrderedRing pOrderedRing\n lub : {d : _} → {pred : A → Set d} → (sub : subset S pred) → (nonempty : Sg A pred) → (boundedAbove : Sg A (UpperBound pOrder sub)) → Sg A (LeastUpperBound pOrder sub)\n open Setoid S\n open Field F\n charNot2 : (Ring.1R R + Ring.1R R) ∼ Ring.0R R → False\n charNot2 = orderedImpliesCharNot2 orderedRing nontrivial\n oField : TotallyOrderedField F pOrderedRing\n oField = record { oRing = orderedRing }\n", "meta": {"hexsha": "65656ab67c7acca4e2e9b935defe61c41d4641ed", "size": 1350, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numbers/ClassicalReals/RealField.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Numbers/ClassicalReals/RealField.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Numbers/ClassicalReals/RealField.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 34.6153846154, "max_line_length": 171, "alphanum_fraction": 0.7214814815, "num_tokens": 400, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9230391664210672, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.6776210707940017}} {"text": "module Utils where\n\nopen import Data.Fin using (Fin)\nimport Data.Fin as F\nopen import Data.Nat\n\ndata Fromℕ (n : ℕ) : ℕ → Set where\n yes : (m : Fin n) → Fromℕ n (F.toℕ m)\n no : (m : ℕ) → Fromℕ n (n + m)\n\nfromℕ : ∀ n m → Fromℕ n m\nfromℕ zero m = no m\nfromℕ (suc n) zero = yes F.zero\nfromℕ (suc n) (suc m) with fromℕ n m\nfromℕ (suc n) (suc .(F.toℕ m)) | yes m = yes (F.suc m)\nfromℕ (suc n) (suc .(n + m)) | no m = no m\n", "meta": {"hexsha": "fddda83d2b6d4d807dfec3b6a272a3786d56cb3c", "size": 431, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Utils.agda", "max_stars_repo_name": "bens/hwlc", "max_stars_repo_head_hexsha": "6f3df71dcd958c6a1d1bf4f175dc16c220d42124", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Utils.agda", "max_issues_repo_name": "bens/hwlc", "max_issues_repo_head_hexsha": "6f3df71dcd958c6a1d1bf4f175dc16c220d42124", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Utils.agda", "max_forks_repo_name": "bens/hwlc", "max_forks_repo_head_hexsha": "6f3df71dcd958c6a1d1bf4f175dc16c220d42124", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.3529411765, "max_line_length": 54, "alphanum_fraction": 0.5707656613, "num_tokens": 196, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9511422158380861, "lm_q2_score": 0.712232184238947, "lm_q1q2_score": 0.6774340979082321}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Functor.Construction.LiftSetoids where\n\nopen import Level\nopen import Relation.Binary\nopen import Function.Equality\nopen import Function using (_$_) renaming (id to idf)\n\nopen import Categories.Category\nopen import Categories.Category.Instance.Setoids\nopen import Categories.Functor\n\nprivate\n variable\n c ℓ : Level\n\n-- Use pattern-matching (instead of explicit calls to lower) to minimize the\n-- number of needed parens, and also make it syntactically apparent that\n-- this is indeed just a Lift.\nLiftedSetoid : ∀ c′ ℓ′ → Setoid c ℓ → Setoid (c ⊔ c′) (ℓ ⊔ ℓ′)\nLiftedSetoid c′ ℓ′ S = record\n { Carrier = Lift c′ Carrier\n ; _≈_ = λ where (lift x) (lift y) → Lift ℓ′ $ x ≈ y\n ; isEquivalence = record\n { refl = lift refl\n ; sym = λ where (lift eq) → lift $ sym eq\n ; trans = λ where (lift eq) (lift eq′) → lift $ trans eq eq′\n }\n }\n where open Setoid S\n\nLiftSetoids : ∀ c′ ℓ′ → Functor (Setoids c ℓ) (Setoids (c ⊔ c′) (ℓ ⊔ ℓ′))\nLiftSetoids c′ ℓ′ = record\n { F₀ = LiftedSetoid c′ ℓ′\n ; F₁ = λ f → record\n { _⟨$⟩_ = λ where (lift x) → lift $ f ⟨$⟩ x\n ; cong = λ where (lift eq) → lift $ cong f eq\n }\n ; identity = idf\n ; homomorphism = λ where {f = f} {g = g} (lift eq) → lift $ cong g $ cong f eq\n ; F-resp-≈ = λ where fx≈gy (lift x≈y) → lift $ fx≈gy x≈y\n }\n", "meta": {"hexsha": "643cd797caa90147d5da2797358c6884b8043522", "size": 1414, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Construction/LiftSetoids.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Functor/Construction/LiftSetoids.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Functor/Construction/LiftSetoids.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 32.1363636364, "max_line_length": 80, "alphanum_fraction": 0.6046676096, "num_tokens": 484, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392756357326, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.6774336818762987}} {"text": "{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule PolynomialFunctors where\n\n-- From: Ulf Norell. Dependently typed programming in Agda. In Koopman\n-- et al., editors. Advanced Functional Programming (AFP 2008), volume\n-- 5832 of LNCS. Springer-Verlag, 2009. pages 230–266.\n\ninfixr 50 _|+|_ _⊕_\ninfixr 60 _|x|_ _×_\n\nrecord True : Set where\n\ndata _⊕_ (A B : Set) : Set where\n inl : A → A ⊕ B\n inr : B → A ⊕ B\n\ndata _×_ (A B : Set) : Set where\n _,_ : A → B → A × B\n\ndata Functor : Set₁ where\n |Id| : Functor\n |K| : Set → Functor\n _|+|_ : Functor → Functor → Functor\n _|x|_ : Functor → Functor → Functor\n\n[_] : Functor → Set → Set\n[ |Id| ] X = X\n[ |K| A ] X = A\n[ F |+| G ] X = [ F ] X ⊕ [ G ] X\n[ F |x| G ] X = [ F ] X × [ G ] X\n\ndata μ_ (F : Functor) : Set where\n <_> : [ F ] (μ F) → μ F\n\nNatF : Functor\nNatF = |K| True |+| |Id|\n\nNAT : Set\nNAT = μ NatF\n\nZ : NAT\nZ = < inl _ >\n\nS : NAT → NAT\nS n = < inr n >\n\n_+_ : NAT → NAT → NAT\nm + < inl _ > = m\nm + < inr n > = S (m + n)\n\nListF : (A : Set) → Functor\nListF = λ A → |K| True |+| |K| A |x| |Id|\n\nLIST : (A : Set) → Set\nLIST = λ A → μ (ListF A)\n\nnil : {A : Set} → LIST A\nnil = < inl _ >\n\ncons : {A : Set} → A → LIST A → LIST A\ncons x xs = < inr (x , xs) >\n", "meta": {"hexsha": "76f7f62ec45662b687177415adccbc1bc9092990", "size": 1349, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/fixed-points/PolynomialFunctors.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/fixed-points/PolynomialFunctors.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/fixed-points/PolynomialFunctors.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 20.4393939394, "max_line_length": 70, "alphanum_fraction": 0.5174203113, "num_tokens": 531, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970842359877, "lm_q2_score": 0.7690802317779601, "lm_q1q2_score": 0.6774036256935649}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Comonad where\n\nopen import Level\n\nopen import Categories.Category using (Category)\nopen import Categories.Functor using (Functor; Endofunctor; _∘F_) renaming (id to idF)\nopen import Categories.NaturalTransformation renaming (id to idN)\nopen import Categories.NaturalTransformation.NaturalIsomorphism hiding (_≃_)\nopen import Categories.NaturalTransformation.Equivalence\nopen NaturalIsomorphism\n\nrecord Comonad {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where\n field\n F : Endofunctor C\n ε : NaturalTransformation F idF\n δ : NaturalTransformation F (F ∘F F)\n\n module F = Functor F\n module ε = NaturalTransformation ε\n module δ = NaturalTransformation δ\n\n open Category C\n open Functor F\n\n field\n assoc : ∀ {X : Obj} → δ.η (F₀ X) ∘ δ.η X ≈ F₁ (δ.η X) ∘ δ.η X\n sym-assoc : ∀ {X : Obj} → F₁ (δ.η X) ∘ δ.η X ≈ δ.η (F₀ X) ∘ δ.η X\n identityˡ : ∀ {X : Obj} → F₁ (ε.η X) ∘ δ.η X ≈ id\n identityʳ : ∀ {X : Obj} → ε.η (F₀ X) ∘ δ.η X ≈ id\n", "meta": {"hexsha": "b682e545dc7af6545389d5c0d524396c2146187a", "size": 1014, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Comonad.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Comonad.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Comonad.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 32.7096774194, "max_line_length": 86, "alphanum_fraction": 0.6696252465, "num_tokens": 348, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9304582554941718, "lm_q2_score": 0.7279754548076477, "lm_q1q2_score": 0.6773507717229001}} {"text": "record SemiRing : Set1 where\n field\n R : Set\n _+_ : R -> R -> R\n zero : R\n _*_ : R -> R -> R\n one : R\n\nmodule Vectors (S : SemiRing) where\n\n open SemiRing S\n open import Data.Nat renaming (ℕ to Nat; zero to z; _*_ to times; _+_ to plus)\n open import Data.Fin renaming (zero to z) hiding (_+_)\n open import RMonads\n open import Functors.Fin \n open import Data.Bool\n open import Function\n open import Relation.Binary.HeterogeneousEquality\n\n Vec : Nat -> Set\n Vec n = Fin n -> R\n\n Matrix : Nat -> Nat -> Set\n Matrix m n = Fin m -> Vec n\n\n -- unit\n delta : forall {n} -> Matrix n n\n delta i j = if feq i j then one else zero \n\n transpose : forall {m n} -> Matrix m n -> Matrix n m\n transpose A = λ j i -> A i j\n\n dot : forall {n} -> Vec n -> Vec n -> R\n dot {z} x y = zero\n dot {suc n} x y = (x z * y z) + dot (x ∘ suc) (y ∘ suc)\n \n mult : forall {m n} -> Matrix m n -> Vec m -> Vec n\n mult A x = λ j -> dot (transpose A j) x\n\n VecRMon : RMonad FinF\n VecRMon = rmonad\n Vec\n delta\n mult\n {!!}\n {!!}\n {!!}\n\n\n\n where\n{-\n lem : forall {n}(x : Vec n)(j : Fin n) -> dot (λ i → if feq i j then one else zero) x ≅ x j\n lem {z} x ()\n lem {suc n} x z = {!lem {n} (x ∘ suc) !}\n lem {suc n} x (suc j) = {!!}\n\n -}\n", "meta": {"hexsha": "1a96ef7860f5ac48f7b28f9e6ae82ec0378ef776", "size": 1281, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Vectors.agda", "max_stars_repo_name": "jmchapman/Relative-Monads", "max_stars_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-30T01:25:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-13T18:02:18.000Z", "max_issues_repo_path": "Vectors.agda", "max_issues_repo_name": "jmchapman/Relative-Monads", "max_issues_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2019-01-13T13:12:33.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-29T09:50:26.000Z", "max_forks_repo_path": "Vectors.agda", "max_forks_repo_name": "jmchapman/Relative-Monads", "max_forks_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-04T21:33:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-04T21:33:13.000Z", "avg_line_length": 21.7118644068, "max_line_length": 95, "alphanum_fraction": 0.5394223263, "num_tokens": 465, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9304582574225517, "lm_q2_score": 0.7279754371026367, "lm_q1q2_score": 0.6773507566529398}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\n\nmodule Avionics.Probability where\n\n--open import Data.Fin using (Fin; fromℕ<)\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Data.Product using (_×_; _,_)\nopen import Data.Vec using (Vec; lookup)\nopen import Relation.Binary.PropositionalEquality using (refl)\nopen import Relation.Unary using (_∈_)\n\nopen import Avionics.Real using (\n ℝ; _+_; _-_; _*_; _÷_; _^_; √_; 1/_; _^2;\n -1/2; π; e; 2ℝ; 1ℝ; 0ℝ;\n ⟨0,∞⟩; [0,∞⟩; [0,1])\n\nrecord Dist (Input : Set) : Set where\n field\n pdf : Input → ℝ\n cdf : Input → ℝ\n pdf→[0,∞⟩ : ∀ x → pdf x ∈ [0,∞⟩\n cdf→[0,1] : ∀ x → cdf x ∈ [0,1]\n --∫pdf≡cdf : ∫ pdf ≡ cdf\n --∫pdf[-∞,∞]≡1ℝ : ∫ pdf [ -∞ , ∞ ] ≡ 1ℝ\n\nrecord NormalDist : Set where\n constructor ND\n field\n μ : ℝ\n σ : ℝ\n --.0<σ : 0ℝ 1 ⇒ m ≥ 0, n ≥ m + b, n ≥ 1 + mb\n\nincr : ∀ {b m n} → m ≤ 1 → 2 ≤ n → PN b m n → PN b m n\nincr m≤1 2≤n [ m1-incr : ∀ {b m n} → 1 < b → 0 ≤ m → m + b ≤ n → m * b + 1 ≤ n → PN b m n → PN b m n\nbase>1-incr {b} {m} {n} 11-incr {b} {m} {n} 11-incr {b} {m} {n} 11-incr {b} {m} 11-incr 1 Nat\nfac 0 = 1\nfac (suc n) = suc n * fac n\n\na = fac 0\nb = fac 10\n", "meta": {"hexsha": "d3429e6c71279e2ad1559dce828faaeec4f218b0", "size": 138, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/agda-ocaml/Golden/Factorial.agda", "max_stars_repo_name": "agda/agda-ocaml", "max_stars_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 48, "max_stars_repo_stars_event_min_datetime": "2017-03-29T14:19:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-15T09:08:14.000Z", "max_issues_repo_path": "test/agda-ocaml/Golden/Factorial.agda", "max_issues_repo_name": "agda/agda-ocaml", "max_issues_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2017-03-29T13:37:52.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-05T21:28:57.000Z", "max_forks_repo_path": "test/agda-ocaml/Golden/Factorial.agda", "max_forks_repo_name": "agda/agda-ocaml", "max_forks_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2018-05-24T10:45:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:48.000Z", "avg_line_length": 12.5454545455, "max_line_length": 29, "alphanum_fraction": 0.652173913, "num_tokens": 54, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9149009596336302, "lm_q2_score": 0.7401743735019594, "lm_q1q2_score": 0.6771862446131636}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Groups.Definition\nopen import Setoids.Setoids\nopen import Setoids.Orders.Partial.Definition\nopen import Functions.Definition\nopen import Rings.Definition\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Rings.Orders.Partial.Definition {n m : _} {A : Set n} {S : Setoid {n} {m} A} {_+_ : A → A → A} {_*_ : A → A → A} (R : Ring S _+_ _*_) where\n\nopen Ring R\nopen Group additiveGroup\nopen Setoid S\nopen import Groups.Orders.Partial.Definition\n\nrecord PartiallyOrderedRing {p : _} {_<_ : Rel {_} {p} A} (pOrder : SetoidPartialOrder S _<_) : Set (lsuc n ⊔ m ⊔ p) where\n field\n orderRespectsAddition : {a b : A} → (a < b) → (c : A) → (a + c) < (b + c)\n orderRespectsMultiplication : {a b : A} → (0R < a) → (0R < b) → (0R < (a * b))\n open SetoidPartialOrder pOrder\n\ntoGroup : {p : _} {_<_ : Rel {_} {p} A} {pOrder : SetoidPartialOrder S _<_} → PartiallyOrderedRing pOrder → PartiallyOrderedGroup additiveGroup pOrder\nPartiallyOrderedGroup.orderRespectsAddition (toGroup p) = PartiallyOrderedRing.orderRespectsAddition p\n", "meta": {"hexsha": "8f44e3781577f686133978bc652c4ff193b0d3b2", "size": 1104, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Orders/Partial/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Orders/Partial/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Orders/Partial/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 42.4615384615, "max_line_length": 150, "alphanum_fraction": 0.6902173913, "num_tokens": 363, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9149009526726544, "lm_q2_score": 0.7401743677704878, "lm_q1q2_score": 0.677186234217099}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\n-- the usual notion requires C to have finite limits.\n-- this definition is a generalization by omitting that requirement as the definition\n-- itself does not involve any limit.\nmodule Categories.Diagram.SubobjectClassifier {o ℓ e} (C : Category o ℓ e) where\n\nopen Category C\n\nopen import Level\n\nopen import Categories.Object.Terminal C\nopen import Categories.Morphism C\nopen import Categories.Diagram.Pullback C\n\nrecord SubobjectClassifier : Set (o ⊔ ℓ ⊔ e) where\n field\n Ω : Obj\n terminal : Terminal\n\n module terminal = Terminal terminal\n open terminal\n\n field\n true : ⊤ ⇒ Ω\n universal : ∀ {X Y} {f : X ⇒ Y} → Mono f → Y ⇒ Ω\n pullback : ∀ {X Y} {f : X ⇒ Y} {mono : Mono f} → Pullback (universal mono) true\n unique : ∀ {X Y} {f : X ⇒ Y} {g} {mono : Mono f} → Pullback g true → universal mono ≈ g\n", "meta": {"hexsha": "0d5cabf334b2c54000a35fb0d1ef0a7d00110d07", "size": 904, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Diagram/SubobjectClassifier.agda", "max_stars_repo_name": "bblfish/agda-categories", "max_stars_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "src/Categories/Diagram/SubobjectClassifier.agda", "max_issues_repo_name": "bblfish/agda-categories", "max_issues_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Diagram/SubobjectClassifier.agda", "max_forks_repo_name": "bblfish/agda-categories", "max_forks_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 29.1612903226, "max_line_length": 94, "alphanum_fraction": 0.6703539823, "num_tokens": 254, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9263037262250327, "lm_q2_score": 0.7310585727705127, "lm_q1q2_score": 0.67718228004608}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Definition\nopen import Groups.Abelian.Definition\nopen import Groups.FiniteGroups.Definition\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Naturals.Order\nopen import Numbers.Naturals.Order.Lemmas\nopen import Setoids.Setoids\nopen import Sets.FinSet.Definition\nopen import Sets.FinSet.Lemmas\nopen import Functions.Definition\nopen import Functions.Lemmas\nopen import Semirings.Definition\nopen import Numbers.Modulo.Definition\nopen import Numbers.Modulo.Addition\nopen import Orders.Total.Definition\nopen import Numbers.Modulo.ModuloFunction\n\nmodule Numbers.Modulo.Group where\n\nopen TotalOrder ℕTotalOrder\nopen Semiring ℕSemiring\n\nprivate\n 0 t\n changeMonth year Month.December = make (suc year) Month.January 1\n changeMonth year month = make year (Month.next month) 1\n\n addOneDay : t → t\n addOneDay (Valid year month day) with (suc day) ≤? Day.value (Month.duration month year)\n ... | yes proof = Valid year month (suc day) {proof} {s≤s z≤n}\n ... | no _ = changeMonth year month\n addOneDay d = d\n-}\n\nmodule Date where\n data t : Set where\n Valid : (year : Year.t) → (month : Month.t) → (day : ℕ)\n → {≤max : day ≤ Day.value (Month.duration month year)}\n → {min≤ : 1 ≤ day}\n --------------------------------------------------------------\n → t\n Invalid : t\n\n 1≤month : ∀ {month year} -> 1 ≤ Day.value (Month.duration month year)\n 1≤month {Month.January} {year} =\n begin\n 1 ≤ Day.value (Month.duration month year)\n\n{-\n make : (year : Year.t) → (month : Month.t) → (day : ℕ) → t\n make year month day with day ≤? Day.value (Month.duration month year) | 1 ≤? day\n ... | yes p1 | yes p2 = Valid year month day {p1} {p2}\n ... | _ | _ = Invalid\n\n changeMonth : (year : Year.t) → (month : Month.t) -> t\n changeMonth year Month.December = Valid (suc year) Month.January 1 {1≤month} {s≤s z≤n}\n changeMonth year month = Valid year (Month.next month) 1 {1≤month} {s≤s z≤n}\n\n addOneDay : t → t\n addOneDay (Valid year month day) with (suc day) ≤? Day.value (Month.duration month year)\n ... | yes proof = Valid year month (suc day) {proof} {s≤s z≤n}\n ... | no _ = changeMonth year month\n addOneDay d = d\n\n -- addDays : t → ℕ → t\n-}", "meta": {"hexsha": "82f0a57744c402218811e80dfd7ca389c2ab678a", "size": 4789, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/exercices/Date.agda", "max_stars_repo_name": "d-plaindoux/colca", "max_stars_repo_head_hexsha": "a81447af3ab2ba898bb7d57be71369abbba12d81", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-03-12T18:31:14.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-04T09:35:36.000Z", "max_issues_repo_path": "src/exercices/Date.agda", "max_issues_repo_name": "d-plaindoux/colca", "max_issues_repo_head_hexsha": "a81447af3ab2ba898bb7d57be71369abbba12d81", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/exercices/Date.agda", "max_forks_repo_name": "d-plaindoux/colca", "max_forks_repo_head_hexsha": "a81447af3ab2ba898bb7d57be71369abbba12d81", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.0974025974, "max_line_length": 92, "alphanum_fraction": 0.5305909376, "num_tokens": 1471, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933093946927838, "lm_q2_score": 0.7577943658046608, "lm_q1q2_score": 0.6769448262185634}} {"text": "{-# OPTIONS --without-K #-}\n\nopen import HoTT\n\nmodule cw.Attached {i j k : ULevel} where\n\n-- The type of attaching maps.\n-- In intended uses, [B] is the type of cells and [C] is the [Sphere]s.\nAttaching : (A : Type i) (B : Type j) (C : Type k) → Type (lmax i (lmax j k))\nAttaching A B C = B → C → A\n\nmodule _ {A : Type i} {B : Type j} {C : Type k} where\n\n -- [Attached] is the type with all the cells attached.\n\n Attached-span : Attaching A B C → Span {i} {j} {lmax j k}\n Attached-span attaching = span A B (B × C) (uncurry attaching) fst\n\n Attached : Attaching A B C → Type (lmax i (lmax j k))\n Attached attaching = Pushout (Attached-span attaching)\n\nmodule _ {A : Type i} {B : Type j} {C : Type k} {attaching : Attaching A B C} where\n\n incl : A → Attached attaching\n incl = left\n\n hub : B → Attached attaching\n hub = right\n\n spoke : ∀ b c → incl (attaching b c) == hub b\n spoke = curry glue\n\n module AttachedElim {l} {P : Attached attaching → Type l}\n (incl* : (a : A) → P (incl a))\n (hub* : (b : B) → P (hub b))\n (spoke* : (b : B) (c : C)\n → incl* (attaching b c) == hub* b [ P ↓ spoke b c ]) where\n\n module P = PushoutElim\n {d = Attached-span attaching} {P = P}\n incl* hub* (uncurry spoke*)\n\n f = P.f\n spoke-β = curry P.glue-β\n\n open AttachedElim public using () renaming (f to Attached-elim)\n\n module AttachedRec {l} {D : Type l}\n (incl* : (a : A) → D)\n (hub* : (b : B) → D)\n (spoke* : (b : B) (c : C) → incl* (attaching b c) == hub* b) where\n\n module P = PushoutRec\n {d = Attached-span attaching} {D = D}\n incl* hub* (uncurry spoke*)\n\n f = P.f\n spoke-β = curry P.glue-β\n\n open AttachedRec public using () renaming (f to Attached-rec)\n\n", "meta": {"hexsha": "474382160fe56d2d606fb5323f84e0c1349a7388", "size": 1717, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "theorems/cw/Attached.agda", "max_stars_repo_name": "cmknapp/HoTT-Agda", "max_stars_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "theorems/cw/Attached.agda", "max_issues_repo_name": "cmknapp/HoTT-Agda", "max_issues_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "theorems/cw/Attached.agda", "max_forks_repo_name": "cmknapp/HoTT-Agda", "max_forks_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.6935483871, "max_line_length": 83, "alphanum_fraction": 0.5841584158, "num_tokens": 578, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677545357568, "lm_q2_score": 0.7981867825403177, "lm_q1q2_score": 0.6768366536908336}} {"text": "{-# OPTIONS --without-K #-}\n\nmodule Formalization where\n\nopen import Agda.Primitive using (lsuc)\n\nopen import Relation.Binary.PropositionalEquality\nopen Relation.Binary.PropositionalEquality.≡-Reasoning\n\nopen import Level\n\n-- Recall Lemma 1.12\n\nind₌ : ∀{a b}{A : Set a} → (C : (x y : A) → (x ≡ y) → Set b) → ((x : A) → C x x refl) → {x y : A} → (p : x ≡ y) → C x y p\nind₌ C c {x}{y} p rewrite p = c y\n\n-- Types are higher groupoids\n-- --------------------------\n\n-- This is the *central* idea of HoTT. A Type isn't just an atomic entity, it's a homotopic space.\n-- An ∞-groupoid consists of\n-- ∘ a collection of objects\n-- ∘ a collection of morphisms between objects, and then morphisms between morphisms, and so on\n-- ∘ equipped with some complex algebraic structure\n--\n-- a morphism at level k is called a k- morphism. Morphisms at each level have\n-- ∘ identity\n-- ∘ composition\n-- ∘ inverse operations\n--\n-- which are weak in the sense that they satisfy the groupoid laws (associativity\n-- of composition, identity is a unit for composition, inverses cancel) only up\n-- to morphisms at the next level, and this weakness gives rise to further structure.\n\n-- Example\n--\n-- Because associativity of composition of morphisms p (q r) = (p q) r is itself a higher-dimensional morphism\n-- we need additional operators to talk about them. For example:\n\n{- Mac Lane's Pentagon\n ---------------------\n\n All the various ways to reassociate p (q (r s))\n\n /- ((p q) r) s -\\\n / \\\n (p (q r)) s (p q) (r s)\n | |\n | |\n p ((q r) s) ----------------- p (q (r s))\n\n-}\n\n-- Moreover, all of this higher groupoid structure comes automagically from the induction principle\n-- on Id.\n\n-- \"Informally, the induction principle for identity types says that if we\n-- construct an object (or prove a statement) which depends on an inhabitant\n-- p : x == y of an identity type,\ndata _==_ {i} {A : Set i} (a : A) : A → Set (lsuc i) where\n idp : a == a -- then it suffices to perform the construction (or the proof) in\n -- the special case when x and y are the same (judgmentally)\n -- and p is the reflexivity element reflx : x = x (judgmentally)\n\n-- Lemma 2.1.1 \"Paths can be reversed\"\n\n-- first proof\n\n_⁻¹ : ∀ {i} {A : Set i}{x y : A} → (x ≡ y) → (y ≡ x)\n_⁻¹ {i} {A} = λ p → ind₌ D d p where\n D : (x y : A) → x ≡ y → Set i\n D = λ x y p → (y ≡ x)\n\n d : (x : A) → D x x refl\n d = λ x → refl\n\n-- second proof\n\ninv-sym : ∀ {i} {A : Set i}{x y : A} → (x ≡ y) → (y ≡ x)\ninv-sym refl = refl\n\n-- Lemma 2.1.2 & 2.1.3 \"paths can be concatenated (strung together)\"\n\n-- First proof. We need the type family D : Π (x, y : A) Π (p : x ≡ y) → Type. From that we\n-- produce an element d : D x x reflₓ (simply identity) then apply the induction\n-- principle above to D and d.\ncomposite : ∀ {i} {A : Set i}{x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)\ncomposite {i} {A} {_}{_}{z} p = ind₌ D d p where\n D : (x y : A) → (p : x ≡ y) → Set i\n D x y _ = y ≡ z → x ≡ z\n\n d : (x₁ : A) → D x₁ x₁ refl\n d _ = λ x → x\n\n-- Second proof. We need the type family D : Π (x, y : A) Π (p : x ≡ y) → Type again. From that\n-- we produce an element d (x) : D x x reflₓ again, but rather than the identity we go a\n-- step further and define E : Π (x z : A) Π (q : x ≡ z) → Type. We then produce an\n-- element e (x) : E x x reflₓ. Induction on D d then unfolds to induction on D then E e.\ncomposite' : ∀ {i} {A : Set i}{x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)\ncomposite' {i} {A} {_}{_}{z} = ind₌ D d where\n D : (x y : A) → (p : x ≡ y) → Set i\n D x y _ = y ≡ z → x ≡ z\n\n d : (x : A) → D x x refl\n d x = ind₌ E e where\n E : (x z : A) → (q : x ≡ z) → Set i\n E x z _ = x ≡ z\n\n e : (x : A) → E x x refl\n e x = refl\n\n\n-- Third proof. Everything is reflexivity you fool. The hell did you do all that work for before?\ncomposite'' : ∀ {i} {A : Set i}{x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)\ncomposite'' refl refl = refl\n\n-- Equality | Homotopy | ∞-Groupoid\n-- reflexivity | constant path | identity morphism\n-- symmetry | inversion of paths | inverse morphism\n-- transitivity | concatenation of paths | composition of morphisms\n\nopen import Function\n\n-- Lemma 2.1.4\n-- These are all propositional equalities living in the type of identity types.\n-- Topologically they are paths of paths, and we can form a homotopy between them.\n\n-- For my next trick, I will need composition of paths\n\n-- Reflexivity right\nlem-1-r : ∀ {i} {A : Set i}{x y : A}{p : x ≡ y} → p ≡ (composite p refl)\nlem-1-r {i} {A} {x}{y} {p} = ind₌ D d p where\n D : (x y : A) → (x ≡ y) → Set i\n D x y p = p ≡ composite p refl\n\n d : (x₁ : A) → D x₁ x₁ refl\n d = λ x → refl\n\n-- Reflexivity left\nlem-1-l : ∀ {i} {A : Set i}{x y : A}{p : x ≡ y} → p ≡ (composite refl p)\nlem-1-l {i} {A} {x}{y} {p} = ind₌ D d p where\n D : (x y : A) → (x ≡ y) → Set i\n D x y p = p ≡ composite refl p\n\n d : (x₁ : A) → D x₁ x₁ refl\n d = λ x → refl\n\nlem-2-l : ∀ {i} {A : Set i}{x y : A}{p : x ≡ y} → composite ((p)⁻¹) p ≡ refl\nlem-2-l {i} {A} {x}{y} {p} = ind₌ D d p where\n D : (x y : A) → (p : x ≡ y) → Set i\n D x y p = composite ((p)⁻¹) p ≡ refl\n\n d : (x₁ : A) → D x₁ x₁ refl\n d = λ x → refl\n\nlem-2-r : ∀ {i} {A : Set i}{x y : A}{p : x ≡ y} → composite p ((p)⁻¹) ≡ refl\nlem-2-r {i} {A} {x}{y} {p} = ind₌ D d p where\n D : (x y : A) → (x ≡ y) → Set i\n D x y p = composite p ((p)⁻¹) ≡ refl\n\n d : (x₁ : A) → D x₁ x₁ refl\n d = λ x → refl\n\n-- Inversion of identity\nlem-3 : ∀ {i} {A : Set i}{x y : A}{p : x ≡ y} → ((p)⁻¹)⁻¹ ≡ p\nlem-3 {i} {A} {x}{y} {p} = ind₌ D d p where\n D : (x y : A) → (x ≡ y) → Set i\n D x y p = ((p)⁻¹)⁻¹ ≡ p\n\n d : (x₁ : A) → D x₁ x₁ refl\n d = λ _ → refl\n\n{-\n-- Transitivity of identity\nlem-4 : ∀ {i} {A : Set i}{x y z w : A}{p : x ≡ y}{q : y ≡ z}{r : z ≡ w} → composite p (composite q r) ≡ composite (composite p q) r\nlem-4 {i} {A} {_}{_}{z} = ind₌ D₁ d₁ where\n D₁ : (x y : A) → (x ≡ y) → Set i\n D₁ x y p = (z w : A)(q : y ≡ z)(r : z ≡ w) → composite p (composite q r) ≡ composite (composite p q) r\n\n d₁ : (x₁ : A) → D₁ x₁ x₁ refl\n d₁ _ = ind₌ D₂ d₂ where\n D₂ : (x z : A) → (q : x ≡ z) → Set i\n D₂ x z q = (w : A)(r : z ≡ w) → composite refl (composite q r) ≡ composite (composite refl q) r\n\n d₂ : (x₂ : A) → D₂ x₂ x₂ refl\n d₂ _ = ind₌ D₃ d₃ where\n D₃ : (x w : A) → (r : x ≡ w) → Set i\n D₃ x w r = (composite refl (composite refl r)) ≡ (composite (composite refl refl) r)\n\n d₃ : (x₃ : A) → D₃ x₃ x₃ refl\n d₃ _ = composite refl (composite refl refl) ≡ composite (composite refl refl) refl\n-}\n\n-- Lemma 2.1.6\n\nopen import Data.Product using (Σ ; _,_ ; proj₁ ; proj₂)\nopen import Data.Nat using (ℕ ; suc)\n\n-- We need pointed sets for this part\nSet• : ∀ i → Set _\nSet• i = Σ (Set i) λ X → X\n\n-- The loop space of a type is\n-- - A base point\n-- - A loop (reflexivity) about that point\nΩ₁ : ∀ {i} → Set• i → Set• i\nΩ₁ (X , x) = ((x ≡ x) , refl)\n\n-- Construct arbitrary n-dimensional loop spaces\nΩⁿ : ∀ {i} → ℕ → Set• i → Set• _\nΩⁿ 0 x = x\nΩⁿ (suc n) x = Ωⁿ n (Ω₁ x)\n\n-- Projects the type from an n-dimensional loop space\nΩ : ∀ {i} → ℕ → {X : Set i} → X → Set i\nΩ n {X} x = proj₁ (Ωⁿ n (X , x))\n\n-- Projects the loop from an n-dimensional loop space\nloop : ∀ {i} n {X : Set i}(x : X) → Ω n x\nloop n {X} x = proj₂ (Ωⁿ n (X , x))\n\n-- Composition operation on n-dimensional loop spaces\n_×_ : ∀ {i} n {A : Set i}{x : A} → Ω n x → Ω n x → Ω n x\n_×_ n {A} {x} x₁ x₂ = loop n x\n\n-- 2.2.1\n\n-- We're type theorists, so we like functor-looking things.\n-- Paths are functor looking things.\n-- We like paths\n-- They respect equality and are all continuous-like\nap : ∀ {i j} {A : Set i}{B : Set j}{x y : A}{f : A → B} → (x ≡ y) → (f x ≡ f y)\nap {i}{j} {A}{B} {x}{y}{f} p = ind₌ D d p where\n D : (x y : A) → (p : x ≡ y) → Set j\n D x y p = f x ≡ f y\n\n d : (x : A) → D x x refl\n d = λ x → refl\n\nap₂ : ∀ {i j k} {A : Set i}{B : Set j}{C : Set k}{x x′ : A}{y y′ : B}(f : A → B → C) → (x ≡ x′) → (y ≡ y′) → (f x y ≡ f x′ y′)\nap₂ f p q = composite (ap {f = λ _ → f _ _} p) (ap {f = f _} q)\n\nap' : ∀ {i j} {A : Set i}{B : Set j}{x y : A} → (f : A → B) → ((x ≡ y) → (f x ≡ f y))\nap' f refl = refl\n\n-- 2.3\n\n-- The dependently typed version of `ap` takes a type family and relates its instantiations with p\ntransport : ∀ {i} {A : Set i}{P : A → Set i}{x y : A} → (p : x ≡ y) → (P x → P y)\ntransport {i} {A}{P} {x}{y} p = ind₌ D d p where\n D : (x y : A) → (p : x ≡ y) → Set i\n D x y p = P x → P y\n\n d : (x : A) → D x x refl\n d = λ x → id\n-- Topologically, we can view transport as a \"path lifting\" operation\n-- That is, we lift the path p to a path in the space ∑[ x ∈ A ] P(x) provided we have a\n-- base point u in the lifted space.\n--\n-- Basically, P respects equality\npath-lifting : ∀ {a p}{A : Set a}{x y : A}{P : A → Set p} → (u : P x) → (p : x ≡ y) → (x , u) ≡ (y , u)\npath-lifting = λ {a} {p} {A} {x} {y} {P} u → cong (λ z → z , u)\n\n-- Look, transport works in the \"upper\" space too!\napd : ∀ {i} {A : Set i}{P : A → Set i}{f : (x : A) → P x}{x y : A} → (p : x ≡ y) → (transport p (f x) ≡ f y)\napd {i} {A}{P} {f}{x}{y} p = ind₌ D d p where\n D : (x y : A) → (p : x ≡ y) → Set i\n D x y p = transport p (f x) ≡ f y\n\n d : (x : A) → D x x refl\n d = λ x → refl\n\n-- By induction, it suffices to assume p is refl. Because of course it does.\napd' : ∀ {i} {A : Set i}{P : A → Set i}{f : (x : A) → P x}{x y : A} → (p : x ≡ y) → (transport p (f x) ≡ f y)\napd' refl = refl\n\n-- We can also fix B and make transport work like fmap with equalities.\ntransportconst : ∀ {i} {A : Set i}{B : Set i}{P : A → B}{x y : A} → (p : x ≡ y) → (b : B) → transport p b ≡ b\ntransportconst {i} {A}{B}{P} {x}{y} p b = ind₌ D d p where\n D : (x y : A) → (x ≡ y) → Set i\n D x y p = transport p b ≡ b\n\n d : (x : A) → D x x refl\n d = λ x → refl\n\n{-\nlem-2-3-8 : ∀ {i} {A : Set i}{B : Set i}{f : A → B}{x y : A} → (p : x ≡ y) → apd p ≡ transportconst (ap p) (f x)\nlem-2-3-8 {i} {A}{B}{f} {x}{y} p = ind₌ D d p where\n D : (x y : A) → (x ≡ y) → Set i\n D x y p = apd p ≡ transportconst (f x) ∘ ap p\n\n d : (x : A) → D x x refl\n d = refl\n-}\n\n{-\nlem-2-3-9 : ∀ {i} {A : Set i}{P : A → Set i}{x y z : A} → (p : x ≡ y) → (q : y ≡ z) → (u : P x) → transport q (transport p u) ≡ transport (p ∘ q) u\nlem-2-3-9 = ?\n-}\n\n-- Homotopies\n\n-- Under Propositions-as-Types two functions are the same if they give the same outputs on the\n-- same inputs. Which looks like this: a type whose terms are proofs of that^\n_∼_ : ∀ {a b} {A : Set a}{P : A → Set b} → (f g : (x : A) → P x) → Set (a ⊔ b)\n_∼_ {a}{b} {A}{P} f g = (x : A) → f x ≡ g x\n\n-- 2.4.2\n\nlem-2-4-2 : ∀ {a} {A : Set a}{B : Set a} → (f : A → B) → f ∼ f\nlem-2-4-2 f = λ _ → refl\n\nlem-2-4-2' : ∀ {a} {A : Set a}{B : Set a} → (f g : A → B) → (f ∼ g) → (g ∼ f)\nlem-2-4-2' f g x x₁ = sym (x x₁)\n\n\n-- For any A and B, a quasi-inverse of f is a triple with\n-- ∘ A way back (an inverse for the homomorphism)\n-- ∘ Homotopies:\n-- ⊚ α : f ∘ g ∼ id\n-- ⊚ β : g ∘ f ∼ id\n-- For now, because I am lazy, the presence of a quasi-inverse will count\n-- as our definition of equivalence for now. Sorry.\nrecord IsEquiv {i j}{A : Set i}{B : Set j}(to : A → B) : Set (i ⊔ j) where\n field\n from : B → A\n iso₁ : (x : A) → from (to x) ≡ x\n iso₂ : (y : B) → to (from y) ≡ y\n\n-- Example 2.4.7: Identity is an equivalence.\nid-is-equiv : ∀ {i} (A : Set i) → IsEquiv (id {i}{A})\nid-is-equiv {i} A = record\n { from = id {i}{A}\n ; iso₁ = λ _ → refl\n ; iso₂ = λ _ → refl\n }\n\n-- Type equivalence is also an equivalence, just on the Universe because:\n-- ∘ id-is-equiv works for it, therefore A ≃ A\n-- ∘ With A ≃ B, we can always make B ≃ A\n-- ∘ With A ≃ B and B ≃ C we have A ≃ C\n_≃_ : ∀ {i j} (A : Set i) (B : Set j) → Set (i ⊔ j)\nA ≃ B = Σ (A → B) IsEquiv\n\nopen import Data.Product renaming (_×_ to _×p_)\n\nsplit-path : ∀ {i j}{A : Set i}{B : Set j}{x y : A ×p B} → x ≡ y → (proj₁ x ≡ proj₁ y) ×p (proj₂ x ≡ proj₂ y)\nsplit-path p = ap {f = proj₁} p , ap {f = proj₂} p\n\npair₌ : ∀ {i j}{A : Set i}{B : Set j}{x y : A ×p B} → (proj₁ x ≡ proj₁ y) ×p (proj₂ x ≡ proj₂ y) → x ≡ y\npair₌ (p , q) = ap₂ _,_ p q\n\ninstance\n split-is-equiv : ∀ {i j}{A : Set i}{B : Set j}{x y : A ×p B} → IsEquiv (pair₌ {x = x}{y = y})\n split-is-equiv {x = x}{y = y} = record\n { from = split-path\n ; iso₁ = λ pq →\n ind₌ (λ _ _ p → ∀ {b₁ b₂} (q : b₁ ≡ b₂) →\n split-path (pair₌ (p , q)) ≡ (p , q))\n (λ _ q → ind₌\n (λ _ _ q →\n split-path (pair₌ (refl , q)) ≡ (refl , q))\n (λ _ → refl) q)\n (proj₁ pq) (proj₂ pq)\n ; iso₂ = ind₌ (λ _ _ p → pair₌ (split-path p) ≡ p) (λ _ → refl)\n }\n\n{-\nhapply : ∀ {i}{A : Set i}{f g : A → Set i} → (f ≡ g) → ((x : A) → f x ≡ g x)\nhapply p x = ap' (λ u → u x)\n-}\n\n-- 2.10\n\n-- This says, when you get down to it, id on universes is a\n-- type family with a total space of pointed types. Turns out\n-- Ω isn't just for horses.\nidtoeqv : ∀ {i} {A : Set i}{B : Set i} → (A ≡ B) → (A ≃ B)\nidtoeqv {_}{A} refl = (id , id-is-equiv A)\n\n-- With idtoeqv in hand, we have to ask Agda nicely to make idtoeqv an equivalence.\n\npostulate -- Just kidding\n ua : ∀ {i} {A : Set i}{B : Set i} → (A ≃ B) ≃ (A ≡ B)\n-- ^This says \"equivalent types may be identified\"\n\n-- 2.12\n\n{-\ndata _⊎_ {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where\n inl : (x : A) → A ⊎ B\n inr : (y : B) → A ⊎ B\n\ncode : ∀ {a b}{{A : Set a}}{{B : Set b}} → A ⊎ B → Set (a ⊔ b)\ncode (inl a) = ?\ncode (inr b) = ⊥\n\ncode-lem : ∀ {a b}{{A : Set a}}{{B : Set b}} → (x : A ⊎ B) → (a₀ : A) → ((inl a₀ ≡ x) ≃ code x)\ncode-lem {{A}} {{B}} x a₀ = ? where\n encode : (x : A ⊎ B) → (p : inl a₀ ≡ x) → code x\n encode x p = transport p refl\n\n decode : (x : A ⊎ B) → (c : code x) → inl a₀ ≡ x\n decode x c = ?\n-}\n\nopen import Data.Nat\nopen import Data.Unit\nopen import Data.Empty\n\ncode : ℕ → ℕ → Set\ncode ℕ.zero ℕ.zero = ⊤\ncode ℕ.zero (ℕ.suc m) = ⊥\ncode (ℕ.suc n) ℕ.zero = ⊥\ncode (ℕ.suc n) (ℕ.suc m) = code n m\n\n-- 2.13\n\nnatcode-lem : ∀ {m n : ℕ} → (m ≡ n) → code m n\nnatcode-lem {x}{y} p = encode {x}{y} p where\n encode : ∀ {m n : ℕ} → (m ≡ n) → code m n\n encode {m}{n} p = transport p (r m) where\n r : (n : ℕ) → code n n\n r ℕ.zero = tt\n r (ℕ.suc n) = r n\n\n decode : ∀ {m n : ℕ} → code m n → (m ≡ n)\n decode {ℕ.zero} {ℕ.zero} tt = refl\n decode {ℕ.zero} {ℕ.suc _} ()\n decode {ℕ.suc _} {ℕ.zero} ()\n decode {ℕ.suc m} {ℕ.suc n} c = cong ℕ.suc (decode c)\n\n enc-dec-quasi : ∀ {n : ℕ} → decode {n}{n} (encode {n}{n} refl) ≡ refl\n enc-dec-quasi {ℕ.zero} = refl\n enc-dec-quasi {ℕ.suc n₁} = {! !}\n", "meta": {"hexsha": "3748ed6d4c6858ea4bbe42c3939f826bca8edf79", "size": 14831, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Chapter2/Formalization.agda", "max_stars_repo_name": "CodaFi/HoTT-Exercises", "max_stars_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Chapter2/Formalization.agda", "max_issues_repo_name": "CodaFi/HoTT-Exercises", "max_issues_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter2/Formalization.agda", "max_forks_repo_name": "CodaFi/HoTT-Exercises", "max_forks_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.0160550459, "max_line_length": 147, "alphanum_fraction": 0.5139235385, "num_tokens": 6057, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972650509008, "lm_q2_score": 0.7772998663336158, "lm_q1q2_score": 0.6767151377544767}} {"text": "{-# OPTIONS --cubical --safe #-}\n\n-- | Quotient integer\nmodule QuoInt where\n\nopen import Cubical.Core.Everything\nopen import Cubical.HITs.Ints.QuoInt renaming (_+ℤ_ to _+_; ℤ to Z)\n\nopen import Cubical.Data.Nat hiding (_+_)\nopen import Cubical.Foundations.Prelude\n\n+-i-zero : ∀ a i → posneg i + a ≡ a\n+-i-zero a i =\n cong (_+ a) (lemma₁ i)\n ∙ -- x ≡ y → y ≡ z → x ≡ z\n lemma₀ a\n where\n lemma₀ : ∀ a → pos 0 + a ≡ a\n lemma₀ (pos zero) = refl\n lemma₀ (pos (suc n)) = cong sucℤ (lemma₀ (pos n))\n lemma₀ (neg zero) = posneg\n lemma₀ (neg (suc n)) = cong predℤ (lemma₀ (neg n))\n lemma₀ (posneg i) j = posneg (i ∧ j)\n\n lemma₁ : ∀ i → posneg i ≡ pos 0\n lemma₁ i j = posneg (i ∧ ~ j)\n", "meta": {"hexsha": "15f59ea5068efed89524500ca4258a9b6471630a", "size": 703, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/QuoInt.agda", "max_stars_repo_name": "anqurvanillapy/fpl", "max_stars_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-08-24T22:47:47.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-24T22:47:47.000Z", "max_issues_repo_path": "agda/QuoInt.agda", "max_issues_repo_name": "anqurvanillapy/fpl", "max_issues_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/QuoInt.agda", "max_forks_repo_name": "anqurvanillapy/fpl", "max_forks_repo_head_hexsha": "9576d5b76e6a868992dbe52930712ac67697bed2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.037037037, "max_line_length": 67, "alphanum_fraction": 0.5974395448, "num_tokens": 268, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032941988938413, "lm_q2_score": 0.749087201911703, "lm_q1q2_score": 0.6766461239524609}} {"text": "open import Data.Boolean\nopen import Type\n\nmodule Data.List.Sorting.HeapSort {ℓ} {T : Type{ℓ}} (_≤?_ : T → T → Bool) where\n\nimport Lvl\nopen import Data.List\nimport Data.List.Functions as List\nopen import Data.BinaryTree\nimport Data.BinaryTree.Heap as Heap\nopen import Functional using (_∘_)\n\nheapSort : List(T) → List(T)\nheapSort = Heap.foldOrdered(_≤?_)(_⊰_) ∅ ∘ List.foldᵣ(Heap.insert(_≤?_)) emptyTree\n\nmodule Proofs where\n \n", "meta": {"hexsha": "c5e1a6672fe134d6db887f9172c526a211eda593", "size": 443, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/List/Sorting/HeapSort.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/List/Sorting/HeapSort.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/List/Sorting/HeapSort.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.6111111111, "max_line_length": 82, "alphanum_fraction": 0.7065462754, "num_tokens": 139, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9334308110294983, "lm_q2_score": 0.724870282120402, "lm_q1q2_score": 0.6766162553308281}} {"text": "module Ints where\n\nopen import Nats public\n using (ℕ; zero; _∸_)\n renaming (suc to nsuc; _+_ to _:+:_; _*_ to _:*:_)\nopen import Agda.Builtin.Int public\n renaming (Int to ℤ; negsuc to -[1+_]; pos to +_)\n\ninfix 8 -_\n-- infixl 7 _*_ _⊓_\ninfixl 6 _+_ _-_ _⊖_\n\n∣_∣ : ℤ → ℕ\n∣ + n ∣ = n\n∣ -[1+ n ] ∣ = nsuc n\n\n-_ : ℤ → ℤ\n- (+ nsuc n) = -[1+ n ]\n- (+ zero) = + zero\n- -[1+ n ] = + nsuc n\n\n_⊖_ : ℕ → ℕ → ℤ\nm ⊖ zero = + m\nzero ⊖ nsuc n = -[1+ n ]\nnsuc m ⊖ nsuc n = m ⊖ n\n\n_+_ : ℤ → ℤ → ℤ\n-[1+ m ] + -[1+ n ] = -[1+ nsuc (m :+: n) ]\n-[1+ m ] + + n = n ⊖ nsuc m\n+ m + -[1+ n ] = m ⊖ nsuc n\n+ m + + n = + (m :+: n)\n\n_-_ : ℤ → ℤ → ℤ\ni - j = i + - j\n\nsuc : ℤ → ℤ\nsuc i = + 1 + i\n\n", "meta": {"hexsha": "fb7e84152b2edac030360c7a2f2abdca512ed45b", "size": 708, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Ints.agda", "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_issues_repo_path": "src/Ints.agda", "max_issues_repo_name": "ice1k/Theorems", "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Ints.agda", "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.1538461538, "max_line_length": 52, "alphanum_fraction": 0.418079096, "num_tokens": 370, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.929440403812707, "lm_q2_score": 0.7279754489059775, "lm_q1q2_score": 0.6766097951969084}} {"text": "module Type.Properties.Homotopy where\n\nopen import Functional\nimport Lvl\nopen import Numeral.Natural\nopen import Structure.Setoid\nopen import Type\nopen import Type.Dependent\nopen import Syntax.Function\n\nprivate variable ℓ ℓ₁ ℓ₂ ℓₑ : Lvl.Level\nprivate variable T A B : Type{ℓ}\nprivate variable n : ℕ\n\nmodule _ {ℓ} ⦃ equiv : ∀{T : Type{ℓ}} → Equiv{ℓ}(T) ⦄ where -- TODO: Maybe the requirements can be relaxed to a tower of equivalences?\n module Names where\n HomotopyLevel : ℕ → (A : Type{ℓ}) → Type\n HomotopyLevel(𝟎) (A) = Σ(A)(x ↦ ∀{y} → (y ≡ x))\n HomotopyLevel(𝐒(𝟎)) (A) = ∀{x y : A} → (x ≡ y)\n HomotopyLevel(𝐒(𝐒(n)))(A) = ∀{x y : A} → HomotopyLevel(𝐒(n))(x ≡ y)\n\n Truncation = HomotopyLevel ∘ 𝐒 ∘ 𝐒\n\n record HomotopyLevel(n : ℕ) (A : Type{ℓ}) : Type{ℓ} where\n constructor intro\n field proof : Names.HomotopyLevel(n)(A)\n\n Truncation = HomotopyLevel ∘ 𝐒 ∘ 𝐒\n\n-- TODO: Where should this be stated?\n-- ExcludedMiddle : (A : Type{ℓ}) ⦃ equiv-A : Equiv{ℓₑ}(A) ⦄ → Stmt\n-- ExcludedMiddle(A) = MereProposition(A) → (IsUnit(A) ∨ IsEmpty(A))\n", "meta": {"hexsha": "89d2a5a463182f3b5743f9be809345b4d28a3cf2", "size": 1069, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type/Properties/Homotopy.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Type/Properties/Homotopy.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Type/Properties/Homotopy.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.3939393939, "max_line_length": 134, "alphanum_fraction": 0.6492048644, "num_tokens": 417, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.896251362048962, "lm_q2_score": 0.7549149868676284, "lm_q1q2_score": 0.6765935852112862}} {"text": "open import Prelude\nopen import Nat\nopen import Agda.Primitive using (Level; lzero; lsuc) renaming (_⊔_ to lmax)\n\nmodule List where\n\n -- definitions\n\n data List (A : Set) : Set where\n [] : List A\n _::_ : A → List A → List A\n\n _++_ : {A : Set} → List A → List A → List A\n [] ++ l₂ = l₂\n (h :: l₁) ++ l₂ = h :: (l₁ ++ l₂)\n\n infixl 50 _++_\n\n ∥_∥ : {A : Set} → List A → Nat\n ∥ [] ∥ = Z\n ∥ a :: as ∥ = 1+ ∥ as ∥\n\n _⟦_⟧ : {A : Set} → List A → Nat → Maybe A\n [] ⟦ i ⟧ = None\n (a :: as) ⟦ Z ⟧ = Some a\n (a :: as) ⟦ 1+ i ⟧ = as ⟦ i ⟧\n\n map : {A B : Set} → (A → B) → List A → List B\n map f [] = []\n map f (a :: as) = f a :: map f as\n\n foldl : {A B : Set} → (B → A → B) → B → List A → B\n foldl f b [] = b\n foldl f b (a :: as) = foldl f (f b a) as\n\n concat : {A : Set} → List (List A) → List A\n concat [] = []\n concat (l1 :: rest) = l1 ++ (concat rest)\n\n -- if the lists aren't the same length,\n -- the extra elements of the longer list are ignored\n zip : {A B : Set} → List A → List B → List (A ∧ B)\n zip [] _ = []\n zip (a :: as) [] = []\n zip (a :: as) (b :: bs) = (a , b) :: zip as bs\n\n unzip : {A B : Set} → List (A ∧ B) → (List A ∧ List B)\n unzip [] = ([] , [])\n unzip ((a , b) :: rest)\n with unzip rest\n ... | (as , bs) = (a :: as , b :: bs)\n\n reverse : {A : Set} → List A → List A\n reverse [] = []\n reverse (a :: as) = reverse as ++ (a :: [])\n\n -- theorems\n\n list-==-dec : {A : Set} →\n (l1 l2 : List A) →\n ((a1 a2 : A) → a1 == a2 ∨ a1 ≠ a2) →\n l1 == l2 ∨ l1 ≠ l2\n list-==-dec [] [] A-==-dec = Inl refl\n list-==-dec [] (_ :: _) A-==-dec = Inr (λ ())\n list-==-dec (_ :: _) [] A-==-dec = Inr (λ ())\n list-==-dec (h1 :: t1) (h2 :: t2) A-==-dec\n with A-==-dec h1 h2\n ... | Inr ne = Inr (λ where refl → ne refl)\n ... | Inl refl\n with list-==-dec t1 t2 A-==-dec\n ... | Inr ne = Inr (λ where refl → ne refl)\n ... | Inl refl = Inl refl\n\n -- if the items of two lists are equal, then the lists are equal\n ==-per-elem : {A : Set} → {l1 l2 : List A} →\n ((i : Nat) → l1 ⟦ i ⟧ == l2 ⟦ i ⟧) →\n l1 == l2\n ==-per-elem {l1 = []} {[]} items== = refl\n ==-per-elem {l1 = []} {h2 :: t2} items== = abort (somenotnone (! (items== Z)))\n ==-per-elem {l1 = h1 :: t1} {[]} items== = abort (somenotnone (items== Z))\n ==-per-elem {l1 = h1 :: t1} {h2 :: t2} items==\n rewrite someinj (items== Z) | ==-per-elem {l1 = t1} {t2} (λ i → items== (1+ i))\n = refl\n\n -- _++_ theorems\n ++assc : ∀{A a1 a2 a3} → (_++_ {A} a1 a2) ++ a3 == a1 ++ (a2 ++ a3)\n ++assc {A} {[]} {a2} {a3} = refl\n ++assc {A} {x :: a1} {a2} {a3} with a1 ++ a2 ++ a3 | ++assc {A} {a1} {a2} {a3}\n ++assc {A} {x :: a1} {a2} {a3} | _ | refl = refl\n\n l++[]==l : {A : Set} (l : List A) →\n l ++ [] == l\n l++[]==l [] = refl\n l++[]==l (a :: as)\n rewrite l++[]==l as\n = refl\n\n -- ∥_∥ theorem\n ∥-++-comm : ∀{A a1 a2} → ∥ a1 ∥ + (∥_∥ {A} a2) == ∥ a1 ++ a2 ∥\n ∥-++-comm {A} {[]} {a2} = refl\n ∥-++-comm {A} {a :: a1} {a2} = 1+ap (∥-++-comm {A} {a1})\n\n -- _⟦_⟧ and ++ theorem\n ⦇l1++[a]++l2⦈⟦∥l1∥⟧==a : {A : Set} {l1 l2 : List A} {a : A} →\n (h : ∥ l1 ∥ < ∥ l1 ++ (a :: []) ++ l2 ∥) →\n ((l1 ++ (a :: []) ++ l2) ⟦ ∥ l1 ∥ ⟧ == Some a)\n ⦇l1++[a]++l2⦈⟦∥l1∥⟧==a {l1 = []} h = refl\n ⦇l1++[a]++l2⦈⟦∥l1∥⟧==a {l1 = a1 :: l1rest} {l2} {a} h = ⦇l1++[a]++l2⦈⟦∥l1∥⟧==a {l1 = l1rest} {l2} {a} (1+n<1+m→n_ = λ a b -> (a -> b)\n ; id = λ a -> a\n ; _∘_ = λ g f a -> g (f a)\n ; _≈_ = λ f g -> ∀ {a} -> f a ≡ g a\n ; id-left = refl\n ; id-right = refl\n ; ∘-assoc = refl\n ; ≈-equiv = record { refl = refl\n ; sym = λ p → sym p\n ; trans = λ p q → trans p q }\n ; ≈-cong = ≈-cong-𝕊\n }\n where\n ≈-cong-𝕊 : ∀{A B C : Set} {f f′ : A -> B} {g g′ : B -> C}\n -> (∀ {a} -> f a ≡ f′ a)\n -> (∀ {b} -> g b ≡ g′ b)\n -> (∀ {a} -> g (f a) ≡ g′ (f′ a))\n ≈-cong-𝕊 {f′ = f′} fe ge {a′} rewrite fe {a′} | ge {f′ a′} = refl\n\n-- Bicartesian closed structure\n𝕊et-BCCC : BicartesianClosed 𝕊et\n𝕊et-BCCC = record\n { cart = record\n { term = record\n { ⊤ = top\n ; ! = λ {A} _ → top.tt\n ; !-unique = λ m → refl\n }\n ; prod = λ A B → record\n { A⊗B = A × B\n ; π₁ = proj₁\n ; π₂ = proj₂\n ; ⟨_,_⟩ = <_,_>\n ; π₁-comm = refl\n ; π₂-comm = refl\n ; ⊗-unique = λ pr1 pr2 → unique-cart (ext λ x → pr1 {x}) (ext λ x → pr2 {x})\n }\n }\n ; cocart = record\n { init = record\n { ⊥ = bot\n ; ¡ = ⊥-elim\n ; ¡-unique = λ {A} m → λ {}\n }\n ; sum = λ A B → record\n { A⊕B = A ⊎ B\n ; ι₁ = inj₁\n ; ι₂ = inj₂\n ; [_⁏_] = [_,_]\n ; ι₁-comm = λ {S} {i₁} {i₂} {a} → refl\n ; ι₂-comm = λ {S} {i₁} {i₂} {a} → refl\n ; ⊕-unique = λ {S} {i₁} {i₂} {m} pr1 pr2\n -> unique-cocart {m = m} (ext λ x → pr1 {x}) (ext λ x → pr2 {x})\n }\n }\n ; closed = record\n { exp = λ A B → record\n { A⇒B = A -> B\n ; eval = λ fa → proj₁ fa (proj₂ fa)\n ; Λ = λ f a b → f (a , b)\n ; Λ-comm = refl\n ; Λ-unique = λ pr → λ {a} -> unique-closed (ext λ x → pr {x})\n ; Λ-cong = λ pr → ext (λ _ → pr)\n }\n }\n }\n where\n unique-cart : ∀{A B P : Set}{a}\n -> {p₁ : P -> A} {p₂ : P -> B} {m : P -> A × B}\n -> proj₁ F.∘ m ≡ p₁ -> proj₂ F.∘ m ≡ p₂\n -> < p₁ , p₂ > a ≡ m a\n unique-cart refl refl = refl\n unique-cocart : ∀{A B S : Set}{a}\n -> {i₁ : A -> S} {i₂ : B -> S} {m : A ⊎ B -> S}\n -> m F.∘ inj₁ ≡ i₁ -> m F.∘ inj₂ ≡ i₂\n -> [ i₁ , i₂ ] a ≡ m a\n unique-cocart {a = inj₁ x} refl refl = refl\n unique-cocart {a = inj₂ y} refl refl = refl\n open Category 𝕊et\n unique-closed : ∀{A B E : Set}{a}\n -> {e : E × A -> B} {m : E -> (A -> B)}\n -> (λ fa → proj₁ fa (proj₂ fa)) ∘ < m ∘ proj₁ , proj₂ > ≡ e\n -> (λ b → e (a , b)) ≡ m a\n unique-closed refl = refl\n", "meta": {"hexsha": "2009ff54798b7f4277f8f910ede7df1b769279ea", "size": 3280, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/CategoryTheory/Instances/Sets.agda", "max_stars_repo_name": "DimaSamoz/temporal-type-systems", "max_stars_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-05-31T20:37:04.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-04T09:33:48.000Z", "max_issues_repo_path": "src/CategoryTheory/Instances/Sets.agda", "max_issues_repo_name": "DimaSamoz/temporal-type-systems", "max_issues_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/CategoryTheory/Instances/Sets.agda", "max_forks_repo_name": "DimaSamoz/temporal-type-systems", "max_forks_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.1568627451, "max_line_length": 88, "alphanum_fraction": 0.3865853659, "num_tokens": 1224, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278726384089, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.6761988692846796}} {"text": "{-# OPTIONS --without-K #-}\n\nopen import HoTT\n\nmodule homotopy.ConstantToSetFactorization\n {i j} {A : Type i} {B : Type j} (B-is-set : is-set B)\n (f : A → B) (f-is-const : ∀ a₁ a₂ → f a₁ == f a₂) where\n\n private\n Skel = SetQuotient {A = A} (λ _ _ → Unit)\n\n abstract\n Skel-has-all-paths : has-all-paths Skel\n Skel-has-all-paths =\n SetQuot-elim (λ _ → Π-is-set λ _ → =-preserves-set SetQuotient-is-set)\n (λ a₁ →\n SetQuot-elim {P = λ s₂ → q[ a₁ ] == s₂}\n (λ _ → =-preserves-set SetQuotient-is-set)\n (λ _ → quot-rel _)\n (λ _ → prop-has-all-paths-↓ (SetQuotient-is-set _ _)))\n (λ {a₁ a₂} _ → ↓-cst→app-in λ s₂ →\n prop-has-all-paths-↓ (SetQuotient-is-set _ _))\n\n Skel-is-prop : is-prop Skel\n Skel-is-prop = all-paths-is-prop Skel-has-all-paths\n\n Skel-lift : Skel → B\n Skel-lift = SetQuot-rec B-is-set f (λ {a₁ a₂} _ → f-is-const a₁ a₂)\n\n cst-extend : Trunc -1 A → B\n cst-extend = Skel-lift ∘ Trunc-rec Skel-is-prop q[_]\n\n -- The beta rule.\n -- This is definitionally true, so you don't need it.\n cst-extend-β : cst-extend ∘ [_] == f\n cst-extend-β = idp\n", "meta": {"hexsha": "663835c3d65c7058b2fe00ec31debf0017331ca0", "size": 1172, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "theorems/homotopy/ConstantToSetFactorization.agda", "max_stars_repo_name": "cmknapp/HoTT-Agda", "max_stars_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "theorems/homotopy/ConstantToSetFactorization.agda", "max_issues_repo_name": "cmknapp/HoTT-Agda", "max_issues_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "theorems/homotopy/ConstantToSetFactorization.agda", "max_forks_repo_name": "cmknapp/HoTT-Agda", "max_forks_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.6756756757, "max_line_length": 78, "alphanum_fraction": 0.5588737201, "num_tokens": 428, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278757303677, "lm_q2_score": 0.7662936377487305, "lm_q1q2_score": 0.6761988669443082}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Tools.Fin where\n\nopen import Tools.Nat\nopen import Tools.Nullary\nopen import Tools.PropositionalEquality\n\nopen import Data.Fin.Properties using (suc-injective)\n\nopen import Data.Fin public using (Fin) renaming (zero to x0 ; suc to _+1)\n\n\n-- Decidability of equality\n\n_≟ⱽ_ : {n : Nat} → (x y : Fin n) → Dec (x ≡ y)\nx0 ≟ⱽ x0 = yes refl\nx0 ≟ⱽ (y +1) = no (λ ())\n(x +1) ≟ⱽ x0 = no (λ ())\n(x +1) ≟ⱽ (y +1) = map (cong _+1) suc-injective (x ≟ⱽ y)\n", "meta": {"hexsha": "5dd499f7481c8b25ddec89886babd5341e1f15fb", "size": 484, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Tools/Fin.agda", "max_stars_repo_name": "fhlkfy/logrel-mltt", "max_stars_repo_head_hexsha": "ea83fc4f618d1527d64ecac82d7d17e2f18ac391", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 30, "max_stars_repo_stars_event_min_datetime": "2017-05-20T03:05:21.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:01:07.000Z", "max_issues_repo_path": "Tools/Fin.agda", "max_issues_repo_name": "fhlkfy/logrel-mltt", "max_issues_repo_head_hexsha": "ea83fc4f618d1527d64ecac82d7d17e2f18ac391", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2017-06-22T12:49:23.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-22T10:37:24.000Z", "max_forks_repo_path": "Tools/Fin.agda", "max_forks_repo_name": "fhlkfy/logrel-mltt", "max_forks_repo_head_hexsha": "ea83fc4f618d1527d64ecac82d7d17e2f18ac391", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:18:20.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-27T15:58:33.000Z", "avg_line_length": 23.0476190476, "max_line_length": 74, "alphanum_fraction": 0.6384297521, "num_tokens": 187, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8824278540866548, "lm_q2_score": 0.766293653760418, "lm_q1q2_score": 0.6761988644880277}} {"text": "module _ where\n\nopen import Common.Prelude\n\ndata Vec (A : Set) : Nat → Set where\n [] : Vec A 0\n _∷_ : ∀ {@0 n} → A → Vec A n → Vec A (suc n)\n\nsum : ∀ {@0 n} → Vec Nat n → Nat\nsum (x ∷ xs) = x + sum xs\nsum [] = 0\n\nfoldl : ∀ {A} {B : Nat → Set} → (∀ {@0 n} → B n → A → B (suc n)) → B 0 → ∀ {@0 n} → Vec A n → B n\nfoldl {B = B} f z (x ∷ xs) = foldl {B = λ n → B (suc n)} f (f z x) xs\nfoldl f z [] = z\n\nreverse : ∀ {A} {@0 n} → Vec A n → Vec A n\nreverse = foldl {B = Vec _} (λ xs x → x ∷ xs) []\n\ndownFrom : ∀ n → Vec Nat n\ndownFrom zero = []\ndownFrom (suc n) = n ∷ downFrom n\n\nmain : IO Unit\nmain = printNat (sum (reverse (downFrom 100000)))\n", "meta": {"hexsha": "594d7c8583c31d61c0025526a41773954111726f", "size": 640, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Compiler/simple/VecReverseErased.agda", "max_stars_repo_name": "phadej/agda", "max_stars_repo_head_hexsha": "2fa8ede09451d43647f918dbfb24ff7b27c52edc", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Compiler/simple/VecReverseErased.agda", "max_issues_repo_name": "phadej/agda", "max_issues_repo_head_hexsha": "2fa8ede09451d43647f918dbfb24ff7b27c52edc", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Compiler/simple/VecReverseErased.agda", "max_forks_repo_name": "phadej/agda", "max_forks_repo_head_hexsha": "2fa8ede09451d43647f918dbfb24ff7b27c52edc", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.6153846154, "max_line_length": 97, "alphanum_fraction": 0.50625, "num_tokens": 276, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9173026550642018, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.676197145078393}} {"text": "{-# OPTIONS --allow-unsolved-metas #-} \n\nmodule fin where\n\nopen import Data.Fin hiding (_<_ ; _≤_ )\nopen import Data.Fin.Properties hiding ( <-trans )\nopen import Data.Nat\nopen import logic\nopen import nat\nopen import Relation.Binary.PropositionalEquality\n\n\n-- toℕ 0 → Data.Nat.pred (toℕ f) < n\npred Naturals.Nat\nplusTwo n = Naturals._+_ n 2\n\n-- To bring everything from a module into scope you can open\n-- the module.\nopen Naturals\n\nz : Nat\nz = zero\n\n-- There's also a short-hand to import and open at the same time\nopen import Bool\n\n_&&_ : Bool -> Bool -> Bool\nx && y = if x then y else false\n\n-- Sometimes it's nice to be able to control what is brought\n-- into scope when you open a module. There are three modifiers\n-- that affect this: using, hiding and renaming.\n\nmodule DifferentWaysOfOpeningNat where\n\n -- nothing but Nat\n open Naturals using (Nat)\n\n -- everything but zero\n open Naturals hiding (zero)\n\n -- everything, but zero and suc under different names\n open Naturals renaming (zero to ZZ; suc to S_S)\n\n two : Nat\n two = S S ZZ S S\n\n -- you can combine using or hiding with renaming, but not using\n -- with hiding (for obvious reasons).\n\n-- To re-export something opened use the public modifier.\nmodule A where\n open Naturals public using (Nat)\n\nN = A.Nat -- now Nat is a visible name in module A\n\n{-\n\n Parameterised modules\n\n-}\n\n-- A very useful feature is parameterised modules.\n\ndata Vec (A : Set) : Nat -> Set where\n [] : Vec A 0\n _::_ : {n : Nat} -> A -> Vec A n -> Vec A (suc n)\n\ninfixr 40 _::_\n\nmodule Sort {A : Set}(_≤_ : A -> A -> Bool) where\n\n insert : {n : Nat} -> A -> Vec A n -> Vec A (suc n)\n insert x [] = x :: []\n insert x (y :: ys) = if x ≤ y\n then x :: y :: ys\n else y :: insert x ys\n\n sort : {n : Nat} -> Vec A n -> Vec A n\n sort [] = []\n sort (x :: xs) = insert x (sort xs)\n\n_≤_ : Nat -> Nat -> Bool\nzero ≤ m = true\nsuc n ≤ zero = false\nsuc n ≤ suc m = n ≤ m\n\n-- When used directly, functions from parameterised modules\n-- take the parameters as extra arguments.\ntest = Sort.sort _≤_ (6 :: 2 :: 0 :: 4 :: [])\n\n-- But, you can also apply the entire module to its arguments.\n-- Let's open the new module while we're at it.\nopen module SortNat = Sort _≤_\n\ntest' = sort (3 :: 2 :: 4 :: 0 :: [])\n\n{-\n\n Local definitions\n\n-}\n\ndata _==_ {A : Set}(x : A) : A -> Set where\n refl : x == x\n\nsubst : {A : Set}(C : A -> Set){x y : A} -> x == y -> C x -> C y\nsubst C refl cx = cx\n\ncong : {A B : Set}(f : A -> B){x y : A} -> x == y -> f x == f y\ncong f refl = refl\n\nlem₁ : (n : Nat) -> n + 0 == n\nlem₁ zero = refl\nlem₁ (suc n) = cong suc (lem₁ n)\n\nlem₂ : (n m : Nat) -> n + suc m == suc n + m\nlem₂ zero m = refl\nlem₂ (suc n) m = cong suc (lem₂ n m)\n\n-- You can define things locally to a function clause\nreverse : {A : Set}{n : Nat} -> Vec A n -> Vec A n\nreverse {A} = \\xs -> subst (Vec A) (lem₁ _) (rev xs [])\n where\n rev : {n m : Nat} -> Vec A n -> Vec A m -> Vec A (n + m)\n rev [] ys = ys\n rev (_::_ {n} x xs) ys = subst (Vec A) (lem₂ n _)\n (rev xs (x :: ys))\n\n-- More precisely, each clause can have one local module. In the\n-- example above we didn't bother naming the module. We could've\n-- said\nreverse' : {A : Set}{n : Nat} -> Vec A n -> Vec A n\nreverse' {A}{n} = \\xs -> subst (Vec A) (lem₁ n) (rev xs [])\n module Rev where\n rev : {m p : Nat} -> Vec A m -> Vec A p -> Vec A (m + p)\n rev [] ys = ys\n rev (_::_ {n} x xs) ys = subst (Vec A) (lem₂ n _)\n (rev xs (x :: ys))\n\n-- Now we can access the local function from inside the module Rev.\n-- Variables bound in the left hand side of the clause become\n-- parameters to the module, so since the implicit n argument to\n-- reverse' is bound implicitly there's an extra argument of type\n-- Nat which isn't used.\n\ntest'' = Rev.rev {_}{0} (4 :: 3 :: 2 :: []) (5 :: 6 :: [])\n\n{-\n\n What's next?\n\n-}\n\n-- The final thing on the agenda is records.\n\n-- Move on to: Records.agda\n", "meta": {"hexsha": "98d108a614a0f2773dab87f23c4a059415f0404e", "size": 4225, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/AIM6/HelloAgda/Modules.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/AIM6/HelloAgda/Modules.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/AIM6/HelloAgda/Modules.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 24.2816091954, "max_line_length": 67, "alphanum_fraction": 0.5789349112, "num_tokens": 1280, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891479496523, "lm_q2_score": 0.8221891261650248, "lm_q1q2_score": 0.6759949770950909}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Rational numbers in non-reduced form.\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Rational.Unnormalised where\n\nopen import Data.Integer.Base as ℤ using (ℤ; ∣_∣; +_; +0; +[1+_]; -[1+_])\nopen import Data.Nat as ℕ using (ℕ; zero; suc)\nopen import Level using (0ℓ)\nopen import Relation.Nullary using (¬_)\nopen import Relation.Nullary.Decidable using (False)\nopen import Relation.Binary using (Rel)\nopen import Relation.Binary.PropositionalEquality using (_≡_)\n\n------------------------------------------------------------------------\n-- Definition\n\n-- Here we define rationals that are not necessarily in reduced form.\n-- Consequently there are multiple ways of representing a given rational\n-- number, and the performance of the arithmetic operations may suffer\n-- due to blowup of the numerator and denominator.\n\n-- Nonetheless they are much easier to reason about. In general proofs\n-- are first proved for these unnormalised rationals and then translated\n-- into the normalised rationals.\n\nrecord ℚᵘ : Set where\n constructor mkℚᵘ\n field\n numerator : ℤ\n denominator-1 : ℕ\n\n denominatorℕ : ℕ\n denominatorℕ = suc denominator-1\n\n denominator : ℤ\n denominator = + denominatorℕ\n\nopen ℚᵘ public using ()\n renaming\n ( numerator to ↥_\n ; denominator to ↧_\n ; denominatorℕ to ↧ₙ_\n )\n\n------------------------------------------------------------------------\n-- Equality of rational numbers (does not coincide with _≡_)\n\ninfix 4 _≃_\ndata _≃_ : Rel ℚᵘ 0ℓ where\n *≡* : ∀ {p q} → (↥ p ℤ.* ↧ q) ≡ (↥ q ℤ.* ↧ p) → p ≃ q\n\n------------------------------------------------------------------------\n-- Ordering of rationals\n\ninfix 4 _≤_ _<_ _≥_ _>_ _≰_ _≱_ _≮_ _≯_\n\ndata _≤_ : Rel ℚᵘ 0ℓ where\n *≤* : ∀ {p q} → (↥ p ℤ.* ↧ q) ℤ.≤ (↥ q ℤ.* ↧ p) → p ≤ q\n\ndata _<_ : Rel ℚᵘ 0ℓ where\n *<* : ∀ {p q} → (↥ p ℤ.* ↧ q) ℤ.< (↥ q ℤ.* ↧ p) → p < q\n\n_≥_ : Rel ℚᵘ 0ℓ\nx ≥ y = y ≤ x\n\n_>_ : Rel ℚᵘ 0ℓ\nx > y = y < x\n\n_≰_ : Rel ℚᵘ 0ℓ\nx ≰ y = ¬ (x ≤ y)\n\n_≱_ : Rel ℚᵘ 0ℓ\nx ≱ y = ¬ (x ≥ y)\n\n_≮_ : Rel ℚᵘ 0ℓ\nx ≮ y = ¬ (x < y)\n\n_≯_ : Rel ℚᵘ 0ℓ\nx ≯ y = ¬ (x > y)\n\n------------------------------------------------------------------------\n-- Constructing rationals\n\ninfix 4 _≢0\n_≢0 : ℕ → Set\nn ≢0 = False (n ℕ.≟ 0)\n\n-- An alternative constructor for ℚᵘ. See the constants section below\n-- for examples of how to use this operator.\n\ninfixl 7 _/_\n\n_/_ : (n : ℤ) (d : ℕ) .{d≢0 : d ≢0} → ℚᵘ\nn / suc d = mkℚᵘ n d\n\n------------------------------------------------------------------------------\n-- Operations on rationals\n\ninfix 8 -_ 1/_\ninfixl 7 _*_ _÷_\ninfixl 6 _-_ _+_\n\n-- negation\n\n-_ : ℚᵘ → ℚᵘ\n- mkℚᵘ n d = mkℚᵘ (ℤ.- n) d\n\n-- addition\n\n_+_ : ℚᵘ → ℚᵘ → ℚᵘ\np + q = (↥ p ℤ.* ↧ q ℤ.+ ↥ q ℤ.* ↧ p) / (↧ₙ p ℕ.* ↧ₙ q)\n\n-- multiplication\n\n_*_ : ℚᵘ → ℚᵘ → ℚᵘ\np * q = (↥ p ℤ.* ↥ q) / (↧ₙ p ℕ.* ↧ₙ q)\n\n-- subtraction\n\n_-_ : ℚᵘ → ℚᵘ → ℚᵘ\np - q = p + (- q)\n\n-- reciprocal: requires a proof that the numerator is not zero\n\n1/_ : (p : ℚᵘ) → .{n≢0 : ∣ ↥ p ∣ ≢0} → ℚᵘ\n1/ mkℚᵘ +[1+ n ] d = mkℚᵘ +[1+ d ] n\n1/ mkℚᵘ -[1+ n ] d = mkℚᵘ -[1+ d ] n\n\n-- division: requires a proof that the denominator is not zero\n\n_÷_ : (p q : ℚᵘ) → .{n≢0 : ∣ ↥ q ∣ ≢0} → ℚᵘ\n(p ÷ q) {n≢0} = p * (1/_ q {n≢0})\n\n------------------------------------------------------------------------------\n-- Some constants\n\n0ℚᵘ : ℚᵘ\n0ℚᵘ = + 0 / 1\n\n1ℚᵘ : ℚᵘ\n1ℚᵘ = + 1 / 1\n\n½ : ℚᵘ\n½ = + 1 / 2\n\n-½ : ℚᵘ\n-½ = - ½\n", "meta": {"hexsha": "40ad40eb688b3637da6ae18defa11ff71fb56478", "size": 3515, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/Rational/Unnormalised.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/Rational/Unnormalised.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/Rational/Unnormalised.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 22.9738562092, "max_line_length": 78, "alphanum_fraction": 0.4890469417, "num_tokens": 1375, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869819218864, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.6759704828921906}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.Group.Instances.Int where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Data.Int renaming (ℤ to ℤType ; _+_ to _+ℤ_ ; _-_ to _-ℤ_; -_ to -ℤ_ ; _·_ to _·ℤ_)\nopen import Cubical.Algebra.Group.Base\n\nopen GroupStr\n\nℤ : Group₀\nfst ℤ = ℤType\n1g (snd ℤ) = 0\n_·_ (snd ℤ) = _+ℤ_\ninv (snd ℤ) = _-ℤ_ 0\nisGroup (snd ℤ) = isGroupℤ\n where\n abstract\n isGroupℤ : IsGroup (pos 0) _+ℤ_ (_-ℤ_ (pos 0))\n isGroupℤ = makeIsGroup isSetℤ +Assoc (λ _ → refl) (+Comm 0)\n (λ x → +Comm x (pos 0 -ℤ x) ∙ minusPlus x 0)\n (λ x → minusPlus x 0)\n", "meta": {"hexsha": "03db1b2f073187f5d725615ee2c629ba930b67f0", "size": 634, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_stars_repo_name": "marcinjangrzybowski/cubical", "max_stars_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 301, "max_stars_repo_stars_event_min_datetime": "2018-10-17T18:00:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T02:10:47.000Z", "max_issues_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_issues_repo_name": "marcinjangrzybowski/cubical", "max_issues_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 584, "max_issues_repo_issues_event_min_datetime": "2018-10-15T09:49:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T12:09:17.000Z", "max_forks_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_forks_repo_name": "marcinjangrzybowski/cubical", "max_forks_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 134, "max_forks_repo_forks_event_min_datetime": "2018-11-16T06:11:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T16:22:13.000Z", "avg_line_length": 28.8181818182, "max_line_length": 103, "alphanum_fraction": 0.6009463722, "num_tokens": 251, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9207896693699844, "lm_q2_score": 0.734119526900183, "lm_q1q2_score": 0.6759696764524689}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import LogicalFormulae\nopen import Sets.EquivalenceRelations\nopen import Setoids.Setoids\nopen import Setoids.Subset\n\nmodule Setoids.Intersection.Lemmas {a b : _} {A : Set a} (S : Setoid {a} {b} A) {c d : _} {pred1 : A → Set c} {pred2 : A → Set d} (s1 : subset S pred1) (s2 : subset S pred2) where\n\nopen import Setoids.Intersection.Definition S\nopen import Setoids.Equality S\n\nintersectionCommutative : intersection s1 s2 =S intersection s2 s1\nintersectionCommutative i = (λ t → _&&_.snd t ,, _&&_.fst t) ,, λ t → _&&_.snd t ,, _&&_.fst t\n\nintersectionAssociative : {e : _} {pred3 : A → Set e} (s3 : subset S pred3) → intersection (intersection s1 s2) s3 =S intersection s1 (intersection s2 s3)\nintersectionAssociative s3 x = (λ pr → _&&_.fst (_&&_.fst pr) ,, (_&&_.snd (_&&_.fst pr) ,, _&&_.snd pr)) ,, λ z → (_&&_.fst z ,, _&&_.fst (_&&_.snd z)) ,, _&&_.snd (_&&_.snd z)\n", "meta": {"hexsha": "a3966c3e69cd8a78d21b745a0459625a0d042196", "size": 988, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Setoids/Intersection/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Setoids/Intersection/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Setoids/Intersection/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 52.0, "max_line_length": 179, "alphanum_fraction": 0.6680161943, "num_tokens": 332, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9207896758909756, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.6759696758833698}} {"text": "-- Andreas, 2011-04-14\n-- {-# OPTIONS -v tc.cover:20 -v tc.lhs.unify:20 #-}\n\n-- Jesper, 2016-06-23: should also work --cubical-compatible\n{-# OPTIONS --cubical-compatible #-}\n\nmodule Issue291-1775 where\n\n-- Example by Ulf\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\ndata _≡_ {A : Set}(a : A) : A -> Set where\n refl : a ≡ a\n\n-- since 'n' occurs stronly rigid in 'suc n', the type 'n ≡ suc n' is empty\nh : (n : Nat) -> n ≡ suc n -> Nat\nh n ()\n\n-- Example by jdanbr...@gmail.com\n\ndata Type : Set where\n ₁ : Type\n _×_ : Type → Type → Type\n _+_ : Type → Type → Type\n\ndata Fun : Type → Type → Set where\n _∙_ : ∀ {s t u} → Fun t u → Fun s t → Fun s u\n π₁ : ∀ {s t} → Fun (s × t) s\n π₂ : ∀ {s t} → Fun (s × t) t\n ι₁ : ∀ {s t} → Fun s (s + t)\n ι₂ : ∀ {s t} → Fun t (s + t)\n\ndata Val : (t : Type) → Fun ₁ t → Set where\n Valι₁ : ∀ {s t V} → Val s V → Val (s + t) (ι₁ ∙ V)\n Valι₂ : ∀ {s t V} → Val t V → Val (s + t) (ι₂ ∙ V)\n\ndata ⊥ : Set where\n\n-- should succeed:\n¬Valπ₁ : ∀ {s t : Type} {M : Fun ₁ (s × t)} → Val s (π₁ ∙ M) → ⊥\n¬Valπ₁ ()\n{- OLD ERROR:\nVal .s (π₁ ∙ .M) should be empty, but it isn't obvious that it is.\nwhen checking that the clause ¬Valπ₁ () has type\n{s t : Type} {M : Fun ₁ (s × t)} → Val s (π₁ ∙ M) → ⊥\n-}\n", "meta": {"hexsha": "940e64d8ab3c81ec6422fb2be1e5a4561d13f9d0", "size": 1252, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue291-1775.agda", "max_stars_repo_name": "KDr2/agda", "max_stars_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Succeed/Issue291-1775.agda", "max_issues_repo_name": "KDr2/agda", "max_issues_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z", "max_forks_repo_path": "test/Succeed/Issue291-1775.agda", "max_forks_repo_name": "KDr2/agda", "max_forks_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.04, "max_line_length": 75, "alphanum_fraction": 0.5247603834, "num_tokens": 528, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8267117940706733, "lm_q2_score": 0.8175744761936437, "lm_q1q2_score": 0.6758984620004381}} {"text": "{-# OPTIONS --safe --warning=error --without-K --guardedness #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nopen import Setoids.Setoids\nopen import Rings.Definition\nopen import Rings.Orders.Partial.Definition\nopen import Rings.Orders.Total.Definition\nopen import Sets.EquivalenceRelations\nopen import Sequences\nopen import Setoids.Orders.Partial.Definition\nopen import Setoids.Orders.Total.Definition\nopen import Functions.Definition\nopen import LogicalFormulae\nopen import Numbers.Naturals.Semiring\nopen import Groups.Definition\n\nmodule Rings.Orders.Total.Bounded {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {m} {o} A} {pOrder : SetoidPartialOrder S _<_} {R : Ring S _+_ _*_} {pRing : PartiallyOrderedRing R pOrder} (tRing : TotallyOrderedRing pRing) where\n\nopen import Rings.Orders.Partial.Bounded pRing\nopen Ring R\nopen Group additiveGroup\nopen import Groups.Lemmas (Ring.additiveGroup R)\nopen Setoid S\nopen Equivalence eq\nopen SetoidPartialOrder pOrder\nopen import Rings.Orders.Total.Lemmas tRing\nopen PartiallyOrderedRing pRing\n\nboundGreaterThanZero : {s : Sequence A} → (b : Bounded s) → 0G < underlying b\nboundGreaterThanZero {s} (a , b) with b 0\n... | (l ,, r) = halvePositive a ( Nat\n\nNonZero : Nat -> Set\nNonZero zero = False\nNonZero (suc _) = True\n\ndivHelp : Nat -> Nat -> Nat -> Nat\ndivHelp zero zero c = suc zero\ndivHelp zero (suc y) c = zero\ndivHelp (suc x) zero c = suc (divHelp x c c)\ndivHelp (suc x) (suc y) c = divHelp x y c\n\ndiv : (x y : Nat) -> NonZero y -> Nat\ndiv x zero ()\ndiv zero (suc y) _ = zero\ndiv (suc x) (suc y) _ = divHelp (suc x) (suc y) y\n\nn1 = suc zero\nn2 = suc n1\nn3 = suc n2\nn4 = suc n3\nn5 = suc n4\nn6 = suc n5\nn7 = suc n6\nn8 = suc n7\nn9 = suc n8\nn10 = suc n9\nn11 = suc n10\nn12 = suc n11\n\n", "meta": {"hexsha": "bfe89d433c05b71adb417752b14eb8052bbdd009", "size": 695, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Div.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Div.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Div.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 16.9512195122, "max_line_length": 49, "alphanum_fraction": 0.5928057554, "num_tokens": 287, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9241418220680099, "lm_q2_score": 0.7310585727705126, "lm_q1q2_score": 0.6756018014785803}} {"text": "module AnonymousDecl where\n\n_ : Set₁\n_ = Set\n\n_ : Set → Set\n_ = λ x → x\n\n_∋_ : ∀ {ℓ} (A : Set ℓ) → A → A\nA ∋ a = a\n\n_ = Set₁\n_ = (Set → Set) ∋ λ x → x\n\ndata Bool : Set where t f : Bool\n\nnot : Bool → Bool\nnot t = f\nnot f = t\n\ndata _≡_ {A : Set} (a : A) : A → Set where\n refl : a ≡ a\n\n_ : ∀ x → not (not x) ≡ x\n_ = λ { t → refl; f → refl }\n", "meta": {"hexsha": "d5001dca11123c0cd56d6f678639fe0cd1645c4a", "size": 339, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/AnonymousDecl.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/AnonymousDecl.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/AnonymousDecl.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 13.0384615385, "max_line_length": 42, "alphanum_fraction": 0.4837758112, "num_tokens": 156, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8947894520743981, "lm_q2_score": 0.7549149758396752, "lm_q1q2_score": 0.6754899575943404}} {"text": "module _ where\n\nopen import Agda.Primitive.Cubical\nopen import Agda.Builtin.Nat\n\npostulate\n PathP : ∀ {ℓ} (A : I → Set ℓ) → A i0 → A i1 → Set ℓ\n\n{-# BUILTIN PATHP PathP #-}\n\npostulate\n A : Set\n a : A\n b : A\n p : PathP (\\ _ → A) a b\n\n\ntest1 : ∀ {p : PathP (\\ _ → A) a a} {P : A → Set} → P (p i0) → P a\ntest1 x = x\n\ntest2 : ∀ {P : A → Set} → P (p i0) → P a\ntest2 x = x\n\nq : (x : Nat) → PathP (\\ _ → Nat) x x\nq zero i = zero\nq (suc n) i = suc (q n i)\n\ntest3 : ∀ {P : Nat → Set}{n : Nat} → P (q n i0) → P n\ntest3 x = x\n", "meta": {"hexsha": "98031f4dd9d11d34d51f11a16756e2081095730f", "size": 531, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2986.agda", "max_stars_repo_name": "alhassy/agda", "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-03-17T01:45:59.000Z", "max_stars_repo_stars_event_max_datetime": "2016-03-17T01:45:59.000Z", "max_issues_repo_path": "test/Succeed/Issue2986.agda", "max_issues_repo_name": "alhassy/agda", "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/Issue2986.agda", "max_forks_repo_name": "alhassy/agda", "max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 17.7, "max_line_length": 66, "alphanum_fraction": 0.4990583804, "num_tokens": 238, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9441768635777511, "lm_q2_score": 0.7154239897159439, "lm_q1q2_score": 0.6754867787382812}} {"text": "\nmodule Oscar.Category.CategoryAction where\n\nopen import Oscar.Category.Action\nopen import Oscar.Category.Category\nopen import Oscar.Category.SemigroupoidAction\nopen import Oscar.Category.Setoid\nopen import Oscar.Level\n\nmodule _ {𝔊𝔬 𝔊𝔪 𝔊𝔮} (category : Category 𝔊𝔬 𝔊𝔪 𝔊𝔮) where\n open Category category\n\n module _ {𝔄𝔬 𝔄𝔮} (action : Action ⋆ 𝔄𝔬 𝔄𝔮) where\n open Action action\n\n record IsCategoryAction\n (_◂_ : ∀ {x y} → x ↦ y → ↥ x → ↥ y)\n : Set (𝔊𝔬 ⊔ 𝔊𝔪 ⊔ 𝔊𝔮 ⊔ 𝔄𝔬 ⊔ 𝔄𝔮) where\n field ⦃ isSemigroupoidAction ⦄ : IsSemigroupoidAction semigroupoid action _◂_\n field identity : ∀ {x} → (s : ↥ x) → ε ◂ s ≋ s\n\nopen IsCategoryAction ⦃ … ⦄ public\n\nrecord CategoryAction 𝔊𝔬 𝔊𝔪 𝔊𝔮 𝔄𝔬 𝔄𝔮 : Set (lsuc (𝔊𝔬 ⊔ 𝔊𝔪 ⊔ 𝔊𝔮 ⊔ 𝔄𝔬 ⊔ 𝔄𝔮)) where\n constructor [_/_]\n field category : Category 𝔊𝔬 𝔊𝔪 𝔊𝔮\n open Category category public\n\n field action : Action ⋆ 𝔄𝔬 𝔄𝔮\n open Action action public\n\n field _◂_ : ∀ {x y} → x ↦ y → ↥ x → ↥ y\n field ⦃ isCategoryAction ⦄ : IsCategoryAction category action _◂_\n\n semgroupoidAction : SemigroupoidAction _ _ _ _ _\n SemigroupoidAction.semigroupoid semgroupoidAction = semigroupoid\n SemigroupoidAction.action semgroupoidAction = action\n SemigroupoidAction._◂_ semgroupoidAction = _◂_\n", "meta": {"hexsha": "fcc96a7ad7f9366d0b9be158e0a6baad39862552", "size": 1230, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Category/CategoryAction.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Category/CategoryAction.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Category/CategoryAction.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.5384615385, "max_line_length": 83, "alphanum_fraction": 0.7040650407, "num_tokens": 519, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.952574122783325, "lm_q2_score": 0.709019146082187, "lm_q1q2_score": 0.6753932911158214}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\n\nmodule Avionics.Probability where\n\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Relation.Unary using (_∈_)\n\nopen import Avionics.Real using (\n ℝ; _+_; _-_; _*_; _÷_; _^_; √_; 1/_; _^2;\n -1/2; π; e; 2ℝ;\n ⟨0,∞⟩; [0,∞⟩; [0,1])\n\n--postulate\n-- Vec : Set → ℕ → Set\n-- Mat : Set → ℕ → ℕ → Set\n\nrecord Dist (Input : Set) : Set where\n field\n pdf : Input → ℝ\n cdf : Input → ℝ\n pdf→[0,∞⟩ : ∀ x → pdf x ∈ [0,∞⟩\n cdf→[0,1] : ∀ x → cdf x ∈ [0,1]\n --∫pdf≡cdf : ∫ pdf ≡ cdf\n --∫pdf[-∞,∞]≡1ℝ : ∫ pdf [ -∞ , ∞ ] ≡ 1ℝ\n\nrecord NormalDist : Set where\n constructor ND\n field\n μ : ℝ\n σ : ℝ\n\n dist : Dist ℝ\n dist = record\n {\n pdf = pdf\n ; cdf = ?\n ; pdf→[0,∞⟩ = ?\n ; cdf→[0,1] = ?\n }\n where\n √2π = (√ (2ℝ * π))\n 1/⟨σ√2π⟩ = (1/ (σ * √2π))\n\n pdf : ℝ → ℝ\n pdf x = 1/⟨σ√2π⟩ * e ^ (-1/2 * (⟨x-μ⟩÷σ ^2))\n where\n ⟨x-μ⟩÷σ = ((x - μ) ÷ σ)\n\n--MultiNormal : ∀ {n : ℕ} → Vec ℝ n → Mat ℝ n n → Dist (Vec ℝ n)\n--MultiNormal {n} means cov = record\n-- {\n-- pdf = ?\n-- ; cdf = ?\n-- }\n\n--Things to prove using this approach\n--_ : ∀ (mean1 std1 mean2 std2 x)\n-- → Dist.pdf (Normal mean1 std1) x + Dist.pdf (Normal mean2 std2) x ≡ Dist.pdf (Normal (mean1 + mean2) (...))\n", "meta": {"hexsha": "39a88769e3a876207b8d1af3b0f2fd860796400b", "size": 1283, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Avionics/Probability.agda", "max_stars_repo_name": "RPI-WCL/safety-envelopes-sentinels", "max_stars_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/Avionics/Probability.agda", "max_issues_repo_name": "RPI-WCL/safety-envelopes-sentinels", "max_issues_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Avionics/Probability.agda", "max_forks_repo_name": "RPI-WCL/safety-envelopes-sentinels", "max_forks_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.7457627119, "max_line_length": 111, "alphanum_fraction": 0.4731098987, "num_tokens": 568, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9124361533336451, "lm_q2_score": 0.7401743505760728, "lm_q1q2_score": 0.6753618372358609}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Primality\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Nat.Primality where\n\nopen import Data.Empty using (⊥)\nopen import Data.Fin using (Fin; toℕ)\nopen import Data.Fin.Properties using (all?)\nopen import Data.Nat using (ℕ; suc; _+_)\nopen import Data.Nat.Divisibility using (_∤_; _∣?_)\nopen import Relation.Nullary using (yes; no)\nopen import Relation.Nullary.Decidable using (from-yes)\nopen import Relation.Nullary.Negation using (¬?)\nopen import Relation.Unary using (Decidable)\n\n-- Definition of primality.\n\nPrime : ℕ → Set\nPrime 0 = ⊥\nPrime 1 = ⊥\nPrime (suc (suc n)) = (i : Fin n) → 2 + toℕ i ∤ 2 + n\n\n-- Decision procedure for primality.\n\nprime? : Decidable Prime\nprime? 0 = no λ()\nprime? 1 = no λ()\nprime? (suc (suc n)) = all? (λ _ → ¬? (_ ∣? _))\n\nprivate\n\n -- Example: 2 is prime.\n\n 2-is-prime : Prime 2\n 2-is-prime = from-yes (prime? 2)\n", "meta": {"hexsha": "613d1950e259aa3f9b28b1a41b643c22ec4a7ee2", "size": 1080, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Nat/Primality.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Nat/Primality.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Nat/Primality.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.3414634146, "max_line_length": 72, "alphanum_fraction": 0.55, "num_tokens": 299, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.916109606718245, "lm_q2_score": 0.7371581741774411, "lm_q1q2_score": 0.6753176850348351}} {"text": "module Cats.Category.Op where\n\nopen import Relation.Binary using (Rel ; _Preserves₂_⟶_⟶_)\nopen import Relation.Binary.PropositionalEquality as ≡\nopen import Level\n\nopen import Cats.Category\nopen import Cats.Category.Cat using (Cat)\n\n\nmodule _ {lo la l≈} (C : Category lo la l≈) where\n\n infixr 9 _∘_\n infixr 4 _≈_\n\n private\n module C = Category C\n module ≈ = C.≈\n\n Obj : Set lo\n Obj = C.Obj\n\n _⇒_ : Obj → Obj → Set la\n A ⇒ B = B C.⇒ A\n\n id : ∀ {A} → A ⇒ A\n id = C.id\n\n _∘_ : ∀ {A B C : Obj} → (B ⇒ C) → (A ⇒ B) → A ⇒ C\n f ∘ g = g C.∘ f\n\n _≈_ : ∀ {A B} → Rel (A ⇒ B) l≈\n _≈_ = C._≈_\n\n ∘-resp : ∀ {A B C} → _∘_ {A} {B} {C} Preserves₂ _≈_ ⟶ _≈_ ⟶ _≈_\n ∘-resp {x = f} {g} {h} {i} f≈g h≈i = C.∘-resp h≈i f≈g\n\n assoc : ∀ {A B C D} {f : C ⇒ D} {g : B ⇒ C} {h : A ⇒ B}\n → (f ∘ g) ∘ h ≈ f ∘ (g ∘ h)\n assoc = C.unassoc\n\n _ᵒᵖ : Category lo la l≈\n _ᵒᵖ = record\n { Obj = Obj\n ; _⇒_ = _⇒_\n ; _≈_ = _≈_\n ; id = id\n ; _∘_ = λ f g → g C.∘ f\n ; equiv = C.equiv\n ; ∘-resp = ∘-resp\n ; id-r = C.id-l\n ; id-l = C.id-r\n ; assoc = assoc\n }\n\n\nmodule _ {lo la l≈ : Level} where\n\n private module Cat = Category (Cat lo la l≈)\n\n op-involution : {C : Category lo la l≈} → ((C ᵒᵖ) ᵒᵖ) Cat.≅ C\n op-involution {C} = record\n { forth = record\n { fobj = λ x → x\n ; fmap = λ f → f\n ; fmap-resp = λ eq → eq\n ; fmap-id = C.≈.reflexive ≡.refl\n ; fmap-∘ = C.≈.reflexive ≡.refl\n }\n ; back = record\n { fobj = λ x → x\n ; fmap = λ f → f\n ; fmap-resp = λ eq → eq\n ; fmap-id = C.≈.reflexive ≡.refl\n ; fmap-∘ = C.≈.reflexive ≡.refl\n }\n -- TODO This sort of natural iso comes up all the time. Can we abstract it\n -- out?\n ; back-forth = record\n { iso = Coo.≅.refl\n ; forth-natural = C.≈.trans C.id-l (C.≈.sym C.id-r)\n }\n ; forth-back = record\n { iso = C.≅.refl\n ; forth-natural = C.≈.trans C.id-l (C.≈.sym C.id-r)\n }\n }\n where\n module C = Category C\n module Coo = Category ((C ᵒᵖ)ᵒᵖ)\n module ≈ = C.≈\n", "meta": {"hexsha": "8d846c0220b7c21e6ab0830352e5ced3d7e2554f", "size": 2153, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cats/Category/Op.agda", "max_stars_repo_name": "alessio-b-zak/cats", "max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cats/Category/Op.agda", "max_issues_repo_name": "alessio-b-zak/cats", "max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cats/Category/Op.agda", "max_forks_repo_name": "alessio-b-zak/cats", "max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.402173913, "max_line_length": 80, "alphanum_fraction": 0.4649326521, "num_tokens": 919, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178895092415, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.6752557423677227}} {"text": "open import Data.Product using ( ∃ ; _×_ )\nopen import FRP.LTL.RSet.Core using ( RSet ; _[_,_⟩ )\nopen import FRP.LTL.Time using ( _≤_ )\n\nmodule FRP.LTL.RSet.Until where\n\ninfixr 2 _U_\n\n_U_ : RSet → RSet → RSet\n(A U B) t = ∃ λ u → (t ≤ u) × (A [ t , u ⟩) × B u\n\n", "meta": {"hexsha": "2e07aa388942b496fb4f19d56850f4e3228f1c7c", "size": 260, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/FRP/LTL/RSet/Until.agda", "max_stars_repo_name": "agda/agda-frp-ltl", "max_stars_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-02T20:25:05.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-15T02:51:13.000Z", "max_issues_repo_path": "src/FRP/LTL/RSet/Until.agda", "max_issues_repo_name": "agda/agda-frp-ltl", "max_issues_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2015-03-01T07:01:31.000Z", "max_issues_repo_issues_event_max_datetime": "2015-03-02T15:23:53.000Z", "max_forks_repo_path": "src/FRP/LTL/RSet/Until.agda", "max_forks_repo_name": "agda/agda-frp-ltl", "max_forks_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-03-01T07:33:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:04.000Z", "avg_line_length": 21.6666666667, "max_line_length": 53, "alphanum_fraction": 0.5961538462, "num_tokens": 109, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9314625107731764, "lm_q2_score": 0.724870282120402, "lm_q1q2_score": 0.6751894929687304}} {"text": "{-# OPTIONS --without-K #-}\n\nopen import Base\nopen import HLevel\n\nmodule Homotopy.Extensions.ToPropToConstSet {i}\n {A B : Set i} ⦃ B-is-set : is-set B ⦄\n (f : A → B) (f-is-const : ∀ a₁ a₂ → f a₁ ≡ f a₂) where\n\n open import Homotopy.Truncation\n open import Homotopy.Skeleton\n\n private\n skel : Set i\n skel = π₀ (skeleton₁ f)\n\n abstract\n skel-has-all-paths : has-all-paths skel\n skel-has-all-paths =\n π₀-extend ⦃ λ _ → Π-is-set λ _ → ≡-is-set $ π₀-is-set _ ⦄\n (skeleton₁-rec (λ s₁ → ∀ s₂ → proj s₁ ≡ s₂)\n (λ a₁ → π₀-extend ⦃ λ _ → ≡-is-set $ π₀-is-set _ ⦄\n (skeleton₁-rec (λ s₂ → proj (point a₁) ≡ proj s₂)\n (λ a₂ → ap proj $ link a₁ a₂ $ f-is-const a₁ a₂)\n (λ _ _ _ → prop-has-all-paths (π₀-is-set _ _ _) _ _)))\n (λ _ _ _ → funext λ _ → prop-has-all-paths (π₀-is-set _ _ _) _ _))\n\n skel-is-prop : is-prop skel\n skel-is-prop = all-paths-is-prop skel-has-all-paths\n\n cst-extend : [ A ] → B\n cst-extend = π₀-extend-nondep ⦃ B-is-set ⦄ skeleton₁-lifted\n ◯ []-extend-nondep ⦃ skel-is-prop ⦄ (proj ◯ point)\n", "meta": {"hexsha": "078738bc799da772183f340caa1b4beeb27e7a73", "size": 1123, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Homotopy/Extensions/ToPropToConstSet.agda", "max_stars_repo_name": "timjb/HoTT-Agda", "max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 294, "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z", "max_issues_repo_path": "old/Homotopy/Extensions/ToPropToConstSet.agda", "max_issues_repo_name": "nicolaikraus/HoTT-Agda", "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 31, "max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z", "max_forks_repo_path": "old/Homotopy/Extensions/ToPropToConstSet.agda", "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 50, "max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z", "avg_line_length": 33.0294117647, "max_line_length": 78, "alphanum_fraction": 0.5574354408, "num_tokens": 423, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9196425245706048, "lm_q2_score": 0.7341195327172402, "lm_q1q2_score": 0.6751275404046755}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Category.Core where\n\nopen import Level\nopen import Function using (flip)\n\nopen import Relation.Binary hiding (_⇒_)\nimport Relation.Binary.PropositionalEquality as ≡\nimport Relation.Binary.Reasoning.Setoid as SetoidR\n\n-- Basic definition of a |Category| with a Hom setoid.\n-- Also comes with some reasoning combinators (see HomReasoning)\nrecord Category (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where\n eta-equality\n infix 4 _≈_ _⇒_\n infixr 9 _∘_\n\n field\n Obj : Set o\n _⇒_ : Rel Obj ℓ\n _≈_ : ∀ {A B} → Rel (A ⇒ B) e\n\n id : ∀ {A} → (A ⇒ A)\n _∘_ : ∀ {A B C} → (B ⇒ C) → (A ⇒ B) → (A ⇒ C)\n\n field\n assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → (h ∘ g) ∘ f ≈ h ∘ (g ∘ f)\n -- We add a symmetric proof of associativity so that the opposite category of the\n -- opposite category is definitionally equal to the original category. See how\n -- `op` is implemented.\n sym-assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → h ∘ (g ∘ f) ≈ (h ∘ g) ∘ f\n identityˡ : ∀ {A B} {f : A ⇒ B} → id ∘ f ≈ f\n identityʳ : ∀ {A B} {f : A ⇒ B} → f ∘ id ≈ f\n -- We add a proof of \"neutral\" identity proof, in order to ensure the opposite of\n -- constant functor is definitionally equal to itself.\n identity² : ∀ {A} → id ∘ id {A} ≈ id {A}\n equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B})\n ∘-resp-≈ : ∀ {A B C} {f h : B ⇒ C} {g i : A ⇒ B} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i\n\n module Equiv {A B : Obj} = IsEquivalence (equiv {A} {B})\n\n open Equiv\n\n dom : ∀ {A B} → (A ⇒ B) → Obj\n dom {A} _ = A\n\n cod : ∀ {A B} → (A ⇒ B) → Obj\n cod {B = B} _ = B\n\n ∘-resp-≈ˡ : ∀ {A B C} {f h : B ⇒ C} {g : A ⇒ B} → f ≈ h → f ∘ g ≈ h ∘ g\n ∘-resp-≈ˡ pf = ∘-resp-≈ pf refl\n\n ∘-resp-≈ʳ : ∀ {A B C} {f h : A ⇒ B} {g : B ⇒ C} → f ≈ h → g ∘ f ≈ g ∘ h\n ∘-resp-≈ʳ pf = ∘-resp-≈ refl pf\n\n hom-setoid : ∀ {A B} → Setoid _ _\n hom-setoid {A} {B} = record\n { Carrier = A ⇒ B\n ; _≈_ = _≈_\n ; isEquivalence = equiv\n }\n\n -- Reasoning combinators. _≈⟨_⟩_ and _≈˘⟨_⟩_ from SetoidR.\n -- Also some useful combinators for doing reasoning on _∘_ chains\n module HomReasoning {A B : Obj} where\n open SetoidR (hom-setoid {A} {B}) public\n open Equiv {A = A} {B = B} public\n\n infixr 4 _⟩∘⟨_ refl⟩∘⟨_\n infixl 5 _⟩∘⟨refl\n _⟩∘⟨_ : ∀ {M} {f h : M ⇒ B} {g i : A ⇒ M} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i\n _⟩∘⟨_ = ∘-resp-≈\n\n refl⟩∘⟨_ : ∀ {M} {f : M ⇒ B} {g i : A ⇒ M} → g ≈ i → f ∘ g ≈ f ∘ i\n refl⟩∘⟨_ = Equiv.refl ⟩∘⟨_\n\n _⟩∘⟨refl : ∀ {M} {f h : M ⇒ B} {g : A ⇒ M} → f ≈ h → f ∘ g ≈ h ∘ g\n _⟩∘⟨refl = _⟩∘⟨ Equiv.refl\n\n -- convenient inline versions\n infix 2 ⟺\n infixr 3 _○_\n ⟺ : {f g : A ⇒ B} → f ≈ g → g ≈ f\n ⟺ = Equiv.sym\n _○_ : {f g h : A ⇒ B} → f ≈ g → g ≈ h → f ≈ h\n _○_ = Equiv.trans\n\n -- for reasoning in the Strict cases\n ≡⇒≈ : {f g : A ⇒ B} → f ≡.≡ g → f ≈ g\n ≡⇒≈ ≡.refl = Equiv.refl\n\n subst₂≈ : {C D : Obj} {f g : A ⇒ B} → f ≈ g → (eq₁ : A ≡.≡ C) (eq₂ : B ≡.≡ D) →\n ≡.subst₂ (_⇒_) eq₁ eq₂ f ≈ ≡.subst₂ (_⇒_) eq₁ eq₂ g\n subst₂≈ f≈g ≡.refl ≡.refl = f≈g\n\n -- Combinators for commutative diagram\n -- The idea is to use the combinators to write commutations in a more readable way.\n -- It starts with [_⇒_]⟨_≈_⟩, and within the third and fourth places, use _⇒⟨_⟩_ to\n -- connect morphisms with the intermediate object specified.\n module Commutation where\n infix 1 [_⇒_]⟨_≈_⟩\n [_⇒_]⟨_≈_⟩ : ∀ (A B : Obj) → A ⇒ B → A ⇒ B → Set _\n [ A ⇒ B ]⟨ f ≈ g ⟩ = f ≈ g\n\n infixl 2 connect\n connect : ∀ {A C : Obj} (B : Obj) → A ⇒ B → B ⇒ C → A ⇒ C\n connect B f g = g ∘ f\n\n syntax connect B f g = f ⇒⟨ B ⟩ g\n\n op : Category o ℓ e\n op = record\n { Obj = Obj\n ; _⇒_ = flip _⇒_\n ; _≈_ = _≈_\n ; _∘_ = flip _∘_\n ; id = id\n ; assoc = sym-assoc\n ; sym-assoc = assoc\n ; identityˡ = identityʳ\n ; identityʳ = identityˡ\n ; identity² = identity²\n ; equiv = equiv\n ; ∘-resp-≈ = flip ∘-resp-≈\n }\n\n -- Q: Should this really be defined here?\n CommutativeSquare : ∀ {A B C D} → (f : A ⇒ B) (g : A ⇒ C) (h : B ⇒ D) (i : C ⇒ D) → Set _\n CommutativeSquare f g h i = h ∘ f ≈ i ∘ g\n\n-- Since we add extra proofs in the definition of `Category` (i.e. `sym-assoc` and\n-- `identity²`), we might still want to construct a `Category` in its originally\n-- easier manner. Thus, this redundant definition is here to ease the construction.\nrecord CategoryHelper (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where\n infix 4 _≈_ _⇒_\n infixr 9 _∘_\n\n field\n Obj : Set o\n _⇒_ : Rel Obj ℓ\n _≈_ : ∀ {A B} → Rel (A ⇒ B) e\n\n id : ∀ {A} → (A ⇒ A)\n _∘_ : ∀ {A B C} → (B ⇒ C) → (A ⇒ B) → (A ⇒ C)\n\n field\n assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → (h ∘ g) ∘ f ≈ h ∘ (g ∘ f)\n identityˡ : ∀ {A B} {f : A ⇒ B} → id ∘ f ≈ f\n identityʳ : ∀ {A B} {f : A ⇒ B} → f ∘ id ≈ f\n equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B})\n ∘-resp-≈ : ∀ {A B C} {f h : B ⇒ C} {g i : A ⇒ B} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i\n\ncategoryHelper : ∀ {o ℓ e} → CategoryHelper o ℓ e → Category o ℓ e\ncategoryHelper C = record\n { Obj = Obj\n ; _⇒_ = _⇒_\n ; _≈_ = _≈_\n ; id = id\n ; _∘_ = _∘_\n ; assoc = assoc\n ; sym-assoc = sym assoc\n ; identityˡ = identityˡ\n ; identityʳ = identityʳ\n ; identity² = identityˡ\n ; equiv = equiv\n ; ∘-resp-≈ = ∘-resp-≈\n }\n where open CategoryHelper C\n module _ {A B} where\n open IsEquivalence (equiv {A} {B}) public\n", "meta": {"hexsha": "a0db2e6a25850c8eab204567f0e94b71ccdc8fc1", "size": 5543, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Core.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Core.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Core.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.4152046784, "max_line_length": 91, "alphanum_fraction": 0.4986469421, "num_tokens": 2440, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.808067204308405, "lm_q2_score": 0.8354835330070839, "lm_q1q2_score": 0.6751268427627433}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Fin.Indexed.Properties where\n\nopen import Agda.Builtin.Nat using (_<_)\nopen import Data.Nat.Base\nopen import Data.Fin.Indexed.Base\nopen import Data.Bool\nopen import Data.Maybe.Base\n\nprivate variable n m k : ℕ\n\nweaken : ∀ {n} → Fin n → Fin (suc n)\nweaken {suc n} f0 = f0\nweaken {suc n} (fs x) = fs (weaken x)\n\n-- x \\\\ y | x < y = just x\n-- | x ≡ y = nothing\n-- | x > y = just (x - 1)\n_\\\\_ : Fin (suc n) → Fin (suc n) → Maybe (Fin n)\nf0 \\\\ f0 = nothing\nfs i \\\\ f0 = just i\n_\\\\_ {suc n} (fs i) (fs j) = mapMaybe fs (i \\\\ j)\n_\\\\_ {suc n} (f0 ) (fs j) = just f0\n\ninsert : Fin (suc n) → Fin n → Fin (suc n)\ninsert f0 j = fs j\ninsert (fs i) f0 = f0\ninsert (fs i) (fs j) = fs (insert i j)\n\nweakens : ∀ n → Fin m → Fin (n + m)\nweakens zero x = x\nweakens (suc n) x = weaken (weakens n x)\n\n_∔_ : Fin n → Fin m → Fin (n + m)\nf0 ∔ m = weakens _ m\nfs n ∔ m = fs (n ∔ m)\n\nunder : (Fin m → Fin k) → Fin (n + m) → Fin (n + k)\nunder {n = zero } f x = f x\nunder {n = suc n} f (fs x) = fs (under f x)\nunder {n = suc n} f f0 = f0\n", "meta": {"hexsha": "0d55825f0121970649e1051364ee2871d2d06eaa", "size": 1105, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Fin/Indexed/Properties.agda", "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_issues_repo_path": "Data/Fin/Indexed/Properties.agda", "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Fin/Indexed/Properties.agda", "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "avg_line_length": 25.6976744186, "max_line_length": 51, "alphanum_fraction": 0.542081448, "num_tokens": 445, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976953003183443, "lm_q2_score": 0.7520125793176222, "lm_q1q2_score": 0.6750781582337056}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Functor.Hom.Properties.Covariant {o ℓ e} (C : Category o ℓ e) where\n\nopen import Level\nopen import Function.Equality using (Π)\nopen import Relation.Binary using (Setoid)\n\nopen import Categories.Category.Construction.Cones\nopen import Categories.Category.Instance.Setoids\nopen import Categories.Diagram.Cone.Properties\nopen import Categories.Diagram.Limit\nopen import Categories.Functor\nopen import Categories.Functor.Limits\nopen import Categories.Functor.Hom\n\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n variable\n o′ ℓ′ e′ : Level\n J : Category o′ ℓ′ e′\n module C = Category C\n\nopen Category C\nopen Hom C\nopen Π\n\n-- Hom functor preserves limits in C\nmodule _ (W : Obj) {F : Functor J C} (lim : Limit F) where\n private\n module F = Functor F\n module lim = Limit lim\n open lim\n HomF : Functor J (Setoids ℓ e)\n HomF = Hom[ W ,-] ∘F F\n open HomReasoning\n open MR C\n\n ⊤ : Cone HomF\n ⊤ = F-map-Coneˡ Hom[ W ,-] limit\n\n module _ (K : Cone HomF) where\n private\n module K = Cone _ K\n\n KW : Setoid.Carrier (Cone.N K) → Cone F\n KW x = record\n { N = W\n ; apex = record\n { ψ = λ X → K.ψ X ⟨$⟩ x\n ; commute = λ f → ⟺ (∘-resp-≈ʳ identityʳ) ○ K.commute f (Setoid.refl K.N)\n }\n }\n\n ! : Cones HomF [ K , ⊤ ]\n ! = record\n { arr = record\n { _⟨$⟩_ = λ x → rep (KW x)\n ; cong = λ {x y} eq → ψ-≈⇒rep-≈ F W (Cone.apex (KW x)) (Cone.apex (KW y)) lim\n (λ A → cong (K.ψ A) eq)\n }\n ; commute = λ {X} {x y} eq → begin\n proj X ∘ rep (KW x) ∘ C.id ≈⟨ refl⟩∘⟨ C.identityʳ ⟩\n proj X ∘ rep (KW x) ≈⟨ lim.commute ⟩\n K.ψ X ⟨$⟩ x ≈⟨ cong (K.ψ X) eq ⟩\n K.ψ X ⟨$⟩ y ∎\n }\n\n !-unique : ∀ {K : Cone HomF} (f : Cones HomF [ K , ⊤ ]) → Cones HomF [ ! K ≈ f ]\n !-unique {K} f {x} {y} x≈y = begin\n rep (KW K x) ≈⟨ terminal.!-unique f′ ⟩\n f.arr ⟨$⟩ x ≈⟨ cong f.arr x≈y ⟩\n f.arr ⟨$⟩ y ∎\n where module K = Cone _ K\n module f = Cone⇒ _ f\n\n f′ : Cones F [ KW K x , limit ]\n f′ = record\n { arr = f.arr ⟨$⟩ x\n ; commute = ⟺ (∘-resp-≈ʳ C.identityʳ) ○ f.commute (Setoid.refl K.N)\n }\n\n hom-resp-limit : Limit HomF\n hom-resp-limit = record\n { terminal = record\n { ⊤ = ⊤\n ; ⊤-is-terminal = record\n { ! = ! _\n ; !-unique = !-unique\n }\n }\n }\n\nHom-Continuous : ∀ X o′ ℓ′ e′ → Continuous o′ ℓ′ e′ Hom[ X ,-]\nHom-Continuous X _ _ _ L = terminal.⊤-is-terminal\n where open Limit (hom-resp-limit X L)\n", "meta": {"hexsha": "0fb807ccd7231ef28588997ec70dd2010d517e48", "size": 2799, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Hom/Properties/Covariant.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Functor/Hom/Properties/Covariant.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Functor/Hom/Properties/Covariant.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 27.99, "max_line_length": 88, "alphanum_fraction": 0.513397642, "num_tokens": 953, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.904650527388829, "lm_q2_score": 0.7461389873857265, "lm_q1q2_score": 0.6749950284438643}} {"text": "-- Andreas, 2012-09-24 Ensure that size successor is monotone\n{-# OPTIONS --sized-types #-}\nmodule SizeSucMonotone where\n\nopen import Common.Size\n\ndata Bool : Set where\n true false : Bool\n\n-- T should be monotone in its second arg\nT : Bool → Size → Set\nT true i = Size< i\nT false i = Size< (↑ i)\n\ntest : {x : Bool}{i : Size}{j : Size< i} → T x j → T x i\ntest h = h\n\n", "meta": {"hexsha": "50929eca1d6b85e2437e0e55941884f581f6690c", "size": 368, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/SizeSucMonotone.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z", "max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z", "max_issues_repo_path": "test/succeed/SizeSucMonotone.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/SizeSucMonotone.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 20.4444444444, "max_line_length": 61, "alphanum_fraction": 0.6467391304, "num_tokens": 119, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8807970717197771, "lm_q2_score": 0.7662936324115011, "lm_q1q2_score": 0.6749491875055613}} {"text": "-- {-# OPTIONS -v tc.pos:100 #-}\n-- Records are allowed in mutual blocks.\nmodule RecordInMutual where\n\nimport Common.Level\nopen import Common.Equality\n\nmutual\n record A : Set where\n field p : D\n record B : Set where\n field q : A\n data D : Set where\n c : B -> D\n\nopen A\nopen B\n\n-- A and B are guarded via D, so we have eta for A and for B:\n\netaA : {a : A} → a ≡ record { p = p a }\netaA = refl\n\netaB : {b : B} → b ≡ record { q = q b }\netaB = refl\n", "meta": {"hexsha": "f464297f9e540f24eecdc6b0e76cc3532745eac2", "size": 457, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/RecordInMutual.agda", "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/succeed/RecordInMutual.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/RecordInMutual.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 17.5769230769, "max_line_length": 61, "alphanum_fraction": 0.6083150985, "num_tokens": 152, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8652240825770432, "lm_q2_score": 0.7799929053683038, "lm_q1q2_score": 0.6748686459638931}} {"text": "\nmodule Haskell.Prim.Maybe where\n\n--------------------------------------------------\n-- Maybe\n\ndata Maybe {ℓ} (a : Set ℓ) : Set ℓ where\n Nothing : Maybe a\n Just : a -> Maybe a\n\nmaybe : ∀ {ℓ₁ ℓ₂} {a : Set ℓ₁} {b : Set ℓ₂} → b → (a → b) → Maybe a → b\nmaybe n j Nothing = n\nmaybe n j (Just x) = j x\n", "meta": {"hexsha": "e3e7c665e16c138907eb64e55ed7f82157ee0ad6", "size": 302, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "lib/Haskell/Prim/Maybe.agda", "max_stars_repo_name": "dxts/agda2hs", "max_stars_repo_head_hexsha": "8c8f24a079ed9677dbe6893cf786e7ed52dfe8b6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 55, "max_stars_repo_stars_event_min_datetime": "2020-10-20T13:36:25.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T21:57:56.000Z", "max_issues_repo_path": "lib/Haskell/Prim/Maybe.agda", "max_issues_repo_name": "seanpm2001/agda2hs", "max_issues_repo_head_hexsha": "160478a51bc78b0fdab07b968464420439f9fed6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 63, "max_issues_repo_issues_event_min_datetime": "2020-10-22T05:19:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-25T15:47:30.000Z", "max_forks_repo_path": "lib/Haskell/Prim/Maybe.agda", "max_forks_repo_name": "seanpm2001/agda2hs", "max_forks_repo_head_hexsha": "160478a51bc78b0fdab07b968464420439f9fed6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 18, "max_forks_repo_forks_event_min_datetime": "2020-10-21T22:19:09.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:42:52.000Z", "avg_line_length": 21.5714285714, "max_line_length": 71, "alphanum_fraction": 0.4635761589, "num_tokens": 107, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8872045937171068, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6748527484553687}} {"text": "module Formalization.PredicateLogic.Signature where\n\nimport Lvl\nopen import Numeral.Natural\nopen import Type\n\n-- A signature consists of a countable family of constant/function and relation symbols.\n-- `Prop(n)` should be interpreted as the indices for relations of arity `n`.\n-- `Obj(n)` should be interpreted as the indices for functions of arity `n` (constants if `n = 0`).\nrecord Signature : Typeω where\n constructor intro\n field\n {ℓₚ} : Lvl.Level\n Prop : ℕ → Type{ℓₚ}\n {ℓₒ} : Lvl.Level\n Obj : ℕ → Type{ℓₒ}\n", "meta": {"hexsha": "e4ba5089826763fdbf23f22bacfc843f0854b3f4", "size": 530, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Formalization/PredicateLogic/Signature.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Formalization/PredicateLogic/Signature.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Formalization/PredicateLogic/Signature.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.1764705882, "max_line_length": 99, "alphanum_fraction": 0.7113207547, "num_tokens": 149, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8872045877523147, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6748527439182457}} {"text": "{-# OPTIONS --without-K --rewriting #-}\n\nmodule Bool where\n open import Basics\n open import lib.Basics\n open import lib.types.Bool public\n\n _≤b_ : Bool → Bool → PropT₀\n true ≤b true = True\n true ≤b false = False\n false ≤b true = True\n false ≤b false = True\n\n ≤b-refl : (b : Bool) → (b ≤b b) holds\n ≤b-refl true = unit\n ≤b-refl false = unit\n\n ≤b-trans : {a b c : Bool} → (a ≤b b) holds → (b ≤b c) holds → (a ≤b c) holds\n ≤b-trans {a} {b} {c} = ≤b-trans' a b c\n where\n ≤b-trans' : (a b c : Bool) → (a ≤b b) holds → (b ≤b c) holds → (a ≤b c) holds\n ≤b-trans' true true true = λ _ _ → unit\n ≤b-trans' true true false = λ _ z → z\n ≤b-trans' true false true = λ _ _ → unit\n ≤b-trans' true false false = λ z _ → z\n ≤b-trans' false true true = λ _ _ → unit\n ≤b-trans' false true false = λ _ _ → unit\n ≤b-trans' false false true = λ _ _ → unit\n ≤b-trans' false false false = λ _ _ → unit\n\n Bool-to-PropT₀ : Bool → PropT₀\n Bool-to-PropT₀ true = True\n Bool-to-PropT₀ false = False\n\n Dec-Prop-to-Bool : {i : ULevel} (P : PropT i) → Dec (P holds) → Bool\n Dec-Prop-to-Bool _ (inl _) = true\n Dec-Prop-to-Bool _ (inr _) = false\n\n Dec-Prop-to-Bool-true-id : {i : ULevel} (P : PropT i) (d : Dec (P holds))\n → P holds → (Dec-Prop-to-Bool P d) == true\n Dec-Prop-to-Bool-true-id P (inl _) p = refl\n Dec-Prop-to-Bool-true-id P (inr d) p = quodlibet (d p)\n\n Dec-Prop-to-Bool-false-id : {i : ULevel} (P : PropT i) (d : Dec (P holds))\n → ¬ (P holds) → (Dec-Prop-to-Bool P d) == false\n Dec-Prop-to-Bool-false-id P (inl x) np = quodlibet (np x)\n Dec-Prop-to-Bool-false-id P (inr _) np = refl\n\n _holds-b : Bool → Type₀\n b holds-b = (Bool-to-PropT₀ b) holds\n", "meta": {"hexsha": "5f01fc864b8a1fcbf43875934c6c53bde28d95c0", "size": 1763, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "cohesion/david_jaz_261/Bool.agda", "max_stars_repo_name": "glangmead/formalization", "max_stars_repo_head_hexsha": "497e720a1ddaa2ec713c060f999f4b3ee2fe5e8a", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2021-10-06T17:39:22.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-13T05:51:12.000Z", "max_issues_repo_path": "cohesion/david_jaz_261/Bool.agda", "max_issues_repo_name": "glangmead/formalization", "max_issues_repo_head_hexsha": "497e720a1ddaa2ec713c060f999f4b3ee2fe5e8a", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "cohesion/david_jaz_261/Bool.agda", "max_forks_repo_name": "glangmead/formalization", "max_forks_repo_head_hexsha": "497e720a1ddaa2ec713c060f999f4b3ee2fe5e8a", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.568627451, "max_line_length": 83, "alphanum_fraction": 0.5598411798, "num_tokens": 655, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772253241802, "lm_q2_score": 0.7718435083355187, "lm_q1q2_score": 0.674650832150391}} {"text": "module Data.Tuple where\n\nimport Lvl\nopen import Type\nopen import Syntax.Function\n\ninfixr 200 _⨯_ _,_\n\nprivate variable ℓ ℓ₁ ℓ₂ ℓ₃ ℓ₄ : Lvl.Level\nprivate variable A B C A₁ A₂ B₁ B₂ : Type{ℓ}\n\n-- Definition of a 2-tuple\nrecord _⨯_ (A : Type{ℓ₁}) (B : Type{ℓ₂}) : Type{ℓ₁ Lvl.⊔ ℓ₂} where\n constructor _,_\n field\n left : A\n right : B\nopen _⨯_ public\n\nelim : ∀{P : (A ⨯ B) → Type{ℓ}} → ((a : A) → (b : B) → P(a , b)) → ((p : (A ⨯ B)) → P(p))\nelim f(a , b) = f a b\n\nmap : (A₁ → A₂) → (B₁ → B₂) → (A₁ ⨯ B₁) → (A₂ ⨯ B₂)\nmap f g (x , y) = (f(x) , g(y))\n\n-- Curries a function taking a 2-tuple, transforming it to a function returning a function instead\ncurry : ((A ⨯ B) → C) → (A → B → C)\ncurry f x y = f(x , y)\n\n-- Uncurries a function taking a function, transforming it to a function taking a 2-tuple instead\nuncurry : (A → B → C) → ((A ⨯ B) → C)\nuncurry = elim\n\nmapLeft : (A₁ → A₂) → (A₁ ⨯ B) → (A₂ ⨯ B)\nmapLeft f = map f (x ↦ x)\n\nmapRight : let _ = A in (B₁ → B₂) → (A ⨯ B₁) → (A ⨯ B₂)\nmapRight f = map (x ↦ x) f\n\nassociateLeft : (A ⨯ (B ⨯ C)) → ((A ⨯ B) ⨯ C)\nassociateLeft (x , (y , z)) = ((x , y) , z)\n\nassociateRight : ((A ⨯ B) ⨯ C) → (A ⨯ (B ⨯ C))\nassociateRight ((x , y) , z) = (x , (y , z))\n\n-- Swaps the left and right elements of a 2-tuple\nswap : (A ⨯ B) → (B ⨯ A)\nswap(x , y) = (y , x)\n\nrepeat : A → (A ⨯ A)\nrepeat x = (x , x)\n", "meta": {"hexsha": "5fea516e2bf5fd069af1ab4d36e6e88241ff60a4", "size": 1345, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Tuple.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/Tuple.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Tuple.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.8653846154, "max_line_length": 98, "alphanum_fraction": 0.5412639405, "num_tokens": 613, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772417253256, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.6746508310474542}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\n\n-- Andreas, 2014-05-17 reported by Fabien Renaud\n\nopen import Common.Equality\n\ndata Nat : Set where\n zero : Nat\n suc : Nat → Nat\n\n{-# BUILTIN NATURAL Nat #-}\n\ndata List {a} (A : Set a) : Set a where\n [] : List A\n _∷_ : A → List A → List A\n\nlength : ∀{a}{A : Set a} → List A → Nat\nlength [] = zero\nlength (x ∷ xs) = suc (length xs)\n\nfoldr : ∀{a b}{A : Set a}{B : Set b} → (A → B → B) → B → List A → B\nfoldr c n [] = n\nfoldr c n (x ∷ xs) = c x (foldr c n xs)\n\nlength-cons : ∀{b} {B : Set b} (L : List B) x → length (x ∷ L) ≡ suc (length L)\nlength-cons [] _ = refl\nlength-cons (x ∷ L) _ = refl\n\nsuc-foldr-eq : ∀{b} {c} {B : Set b} {C : Set c} (LL : List B) (LA : List C)\n\n → suc (foldr (λ _ → suc) 0 LL) ≡\n suc (foldr (λ _ → suc) 0 LA)\n\n → length LL ≡\n length LA\n\nsuc-foldr-eq [] [] Eq = refl\nsuc-foldr-eq [] (x ∷ LA) ()\nsuc-foldr-eq (x ∷ LL) [] ()\nsuc-foldr-eq (x ∷ LL) (y ∷ LA) Eq rewrite length-cons LL x = {!!}\n\n-- WAS:\n-- Failed to infer the value of dotted pattern\n-- when checking that the pattern ._ has type Nat\n\n-- NOW: unsolved meta\n", "meta": {"hexsha": "fb793932d4f9672abe5a6ff865895bbda6678870", "size": 1099, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue1110.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue1110.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue1110.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 23.3829787234, "max_line_length": 79, "alphanum_fraction": 0.5541401274, "num_tokens": 428, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772220439509, "lm_q2_score": 0.7718435030872968, "lm_q1q2_score": 0.674650825031216}} {"text": "------------------------------------------------------------------------\n-- Some defined operations (multiplication by natural number and\n-- exponentiation)\n------------------------------------------------------------------------\n\nopen import Algebra\n\nmodule Algebra.Operations (s : Semiring) where\n\nopen Semiring s hiding (zero)\nopen import Data.Nat using (zero; suc; ℕ)\nopen import Data.Function\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as PropEq using (_≡_)\nimport Relation.Binary.EqReasoning as EqR\nopen EqR setoid\n\n------------------------------------------------------------------------\n-- Operations\n\n-- Multiplication by natural number.\n\ninfixr 7 _×_\n\n_×_ : ℕ → carrier → carrier\nzero × x = 0#\nsuc n × x = x + n × x\n\n-- Exponentiation.\n\ninfixr 8 _^_\n\n_^_ : carrier → ℕ → carrier\nx ^ zero = 1#\nx ^ suc n = x * x ^ n\n\n------------------------------------------------------------------------\n-- Some properties\n\n×-pres-≈ : _×_ Preserves₂ _≡_ ⟶ _≈_ ⟶ _≈_\n×-pres-≈ {n} {n'} {x} {x'} n≡n' x≈x' = begin\n n × x ≈⟨ reflexive $ PropEq.cong (λ n → n × x) n≡n' ⟩\n n' × x ≈⟨ ×-pres-≈ʳ n' x≈x' ⟩\n n' × x' ∎\n where\n ×-pres-≈ʳ : ∀ n → (_×_ n) Preserves _≈_ ⟶ _≈_\n ×-pres-≈ʳ zero x≈x' = refl\n ×-pres-≈ʳ (suc n) x≈x' = x≈x' ⟨ +-pres-≈ ⟩ ×-pres-≈ʳ n x≈x'\n\n^-pres-≈ : _^_ Preserves₂ _≈_ ⟶ _≡_ ⟶ _≈_\n^-pres-≈ {x} {x'} {n} {n'} x≈x' n≡n' = begin\n x ^ n ≈⟨ reflexive $ PropEq.cong (_^_ x) n≡n' ⟩\n x ^ n' ≈⟨ ^-pres-≈ˡ n' x≈x' ⟩\n x' ^ n' ∎\n where\n ^-pres-≈ˡ : ∀ n → (λ x → x ^ n) Preserves _≈_ ⟶ _≈_\n ^-pres-≈ˡ zero x≈x' = refl\n ^-pres-≈ˡ (suc n) x≈x' = x≈x' ⟨ *-pres-≈ ⟩ ^-pres-≈ˡ n x≈x'\n", "meta": {"hexsha": "8a9b418ac18ec3ca2bdec9c11ee8aff9ad349d41", "size": 1643, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Algebra/Operations.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Algebra/Operations.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Algebra/Operations.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 27.8474576271, "max_line_length": 72, "alphanum_fraction": 0.4662203287, "num_tokens": 657, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297914570319, "lm_q2_score": 0.7490872075132152, "lm_q1q2_score": 0.6745753467650061}} {"text": "module my-vector where\n\nopen import nat\nopen import bool\nopen import eq\n\ndata 𝕍 {ℓ}(A : Set ℓ) : ℕ → Set ℓ where\n [] : 𝕍 A 0\n _::_ : {n : ℕ} (x : A) (xs : 𝕍 A n) → 𝕍 A (suc n)\n\ninfixr 6 _::_ _++𝕍_\n\n_++𝕍_ : ∀ {ℓ} {A : Set ℓ}{n m : ℕ} →\n 𝕍 A n → 𝕍 A m → 𝕍 A (n + m)\n[] ++𝕍 ys = ys\n(x :: xs) ++𝕍 ys = x :: (xs ++𝕍 ys)\n\ntest-vector : 𝕍 𝔹 4\ntest-vector = ff :: tt :: ff :: ff :: []\n\ntest-vector-append : 𝕍 𝔹 8\ntest-vector-append = test-vector ++𝕍 test-vector\n\nhead𝕍 : ∀{ℓ}{A : Set ℓ}{n : ℕ} → 𝕍 A (suc n) → A\nhead𝕍 (x :: _) = x\n\ntail𝕍 : ∀{ℓ}{A : Set ℓ}{n : ℕ} → 𝕍 A n → 𝕍 A (pred n)\ntail𝕍 [] = []\ntail𝕍 (_ :: xs) = xs\n\nmap𝕍 : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'}{n : ℕ} →\n (A → B) → 𝕍 A n → 𝕍 B n\nmap𝕍 f [] = []\nmap𝕍 f (x :: xs) = f x :: map𝕍 f xs\n\nconcat𝕍 : ∀{ℓ}{A : Set ℓ}{n m : ℕ} →\n 𝕍 (𝕍 A n) m → 𝕍 A (m * n)\nconcat𝕍 [] = []\nconcat𝕍 (xs :: xs₁) = xs ++𝕍 (concat𝕍 xs₁)\n\nnth𝕍 : ∀{ℓ}{A : Set ℓ}{m : ℕ} →\n (n : ℕ) → n < m ≡ tt → 𝕍 A m → A\nnth𝕍 zero () []\nnth𝕍 zero _ (x :: _) = x\nnth𝕍 (suc _) () []\nnth𝕍 (suc n₁) p (_ :: xs) = nth𝕍 n₁ p xs\n\nrepeat𝕍 : ∀{ℓ}{A : Set ℓ} → (a : A)(n : ℕ) → 𝕍 A n\nrepeat𝕍 a zero = []\nrepeat𝕍 a (suc n) = a :: (repeat𝕍 a n)\n", "meta": {"hexsha": "5f94e896505d9932c95b5ea250f2cd466a11403b", "size": 1170, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "my-vector.agda", "max_stars_repo_name": "logicshan/IAL", "max_stars_repo_head_hexsha": "2ad96390a9be5c238e73709a21533c7354cedd0c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "my-vector.agda", "max_issues_repo_name": "logicshan/IAL", "max_issues_repo_head_hexsha": "2ad96390a9be5c238e73709a21533c7354cedd0c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "my-vector.agda", "max_forks_repo_name": "logicshan/IAL", "max_forks_repo_head_hexsha": "2ad96390a9be5c238e73709a21533c7354cedd0c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.9411764706, "max_line_length": 53, "alphanum_fraction": 0.4564102564, "num_tokens": 636, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297887874625, "lm_q2_score": 0.7490872075132153, "lm_q1q2_score": 0.6745753447652659}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Natural numbers defined in terms of Data.Star\n------------------------------------------------------------------------\n\nmodule Data.Star.Nat where\n\nopen import Data.Star\nopen import Data.Unit\nopen import Function\nopen import Relation.Binary\nopen import Relation.Binary.Simple\n\n-- Natural numbers.\n\nℕ : Set\nℕ = Star Always tt tt\n\n-- Zero and successor.\n\nzero : ℕ\nzero = ε\n\nsuc : ℕ → ℕ\nsuc = _◅_ _\n\n-- The length of a star-list.\n\nlength : ∀ {i t} {I : Set i} {T : Rel I t} {i j} → Star T i j → ℕ\nlength = gmap (const _) (const _)\n\n-- Arithmetic.\n\ninfixl 7 _*_\ninfixl 6 _+_ _∸_\n\n_+_ : ℕ → ℕ → ℕ\n_+_ = _◅◅_\n\n_*_ : ℕ → ℕ → ℕ\n_*_ m = const m ⋆\n\n_∸_ : ℕ → ℕ → ℕ\nm ∸ ε = m\nε ∸ (_ ◅ n) = zero\n(_ ◅ m) ∸ (_ ◅ n) = m ∸ n\n\n-- Some constants.\n\n0# = zero\n1# = suc 0#\n2# = suc 1#\n3# = suc 2#\n4# = suc 3#\n5# = suc 4#\n", "meta": {"hexsha": "a54a46517f45ced9a77944675dc4b650a226128b", "size": 927, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Data/Star/Nat.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Data/Star/Nat.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Data/Star/Nat.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.2631578947, "max_line_length": 72, "alphanum_fraction": 0.4832793959, "num_tokens": 306, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9149009457116781, "lm_q2_score": 0.7371581741774411, "lm_q1q2_score": 0.6744267106940348}} {"text": "module LearnYouAgda where\n data ℕ : Set where\n zero : ℕ\n-- one : ℕ\n suc : ℕ -> ℕ\n\n-- define arithmetic operations\n _+_ : ℕ → ℕ → ℕ\n zero + zero = zero\n zero + n = n\n (suc n) + n′ = suc (n + n′)\n", "meta": {"hexsha": "282bced96335fab548efc5ff71fed830e2b8e221", "size": 213, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/LearnYouAgda.agda", "max_stars_repo_name": "supeterlau/bedev", "max_stars_repo_head_hexsha": "c134875eae37d265936199fda278416e2a3c1224", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/LearnYouAgda.agda", "max_issues_repo_name": "supeterlau/bedev", "max_issues_repo_head_hexsha": "c134875eae37d265936199fda278416e2a3c1224", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/LearnYouAgda.agda", "max_forks_repo_name": "supeterlau/bedev", "max_forks_repo_head_hexsha": "c134875eae37d265936199fda278416e2a3c1224", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.75, "max_line_length": 31, "alphanum_fraction": 0.5117370892, "num_tokens": 81, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9343951661947456, "lm_q2_score": 0.7217432003123989, "lm_q1q2_score": 0.6743933576058315}} {"text": "module Numeral.Rational where\n\nopen import Data.Tuple\nopen import Logic\nimport Lvl\nopen import Numeral.Natural\nopen import Numeral.Natural.Oper\nopen import Numeral.Integer\nopen import Numeral.Integer.Oper\nopen import Relator.Equals\nopen import Type\nopen import Type.Quotient\n\n-- Equivalence relation of quotient equality.\n-- Essentially (if one would already work in the rationals):\n-- (a₁ , a₂) quot-≡_ (b₁ , b₂)\n-- ⇔ a₁ ⋅ b₂ ≡ a₂ ⋅ b₁\n-- ⇔ a₁ / a₂ ≡ b₁ / b₂\n_quot-≡_ : (ℤ ⨯ ℕ₊) → (ℤ ⨯ ℕ₊) → Stmt{Lvl.𝟎}\n(a₁ , a₂) quot-≡ (b₁ , b₂) = (a₁ ⋅ b₂ ≡ a₂ ⋅ b₁)\n\nℤ : Type{Lvl.𝟎}\nℤ = (ℤ ⨯ ℕ₊) / (_quot-≡_)\n", "meta": {"hexsha": "7d4d1e54c96f17fe5863e9ad63bbf4b9ce12e071", "size": 608, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Mathematical/Numeral/Rational.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Mathematical/Numeral/Rational.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Mathematical/Numeral/Rational.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.3333333333, "max_line_length": 60, "alphanum_fraction": 0.6578947368, "num_tokens": 255, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9511422227627597, "lm_q2_score": 0.7090191337850933, "lm_q1q2_score": 0.6743780348896802}} {"text": "{-\nThis second-order signature was created from the following second-order syntax description:\n\nsyntax Lens | L\n\ntype\n S : 0-ary\n A : 0-ary\n\nterm\n get : S -> A\n put : S A -> S\n\ntheory\n (PG) s : S a : A |> get (put (s, a)) = a\n (GP) s : S |> put (s, get(s)) = s\n (PP) s : S a b : A |> put (put(s, a), b) = put (s, a)\n-}\n\nmodule Lens.Signature where\n\nopen import SOAS.Context\n\n-- Type declaration\ndata LT : Set where\n S : LT\n A : LT\n\n\n\nopen import SOAS.Syntax.Signature LT public\nopen import SOAS.Syntax.Build LT public\n\n-- Operator symbols\ndata Lₒ : Set where\n getₒ putₒ : Lₒ\n\n-- Term signature\nL:Sig : Signature Lₒ\nL:Sig = sig λ\n { getₒ → (⊢₀ S) ⟼₁ A\n ; putₒ → (⊢₀ S) , (⊢₀ A) ⟼₂ S\n }\n\nopen Signature L:Sig public\n", "meta": {"hexsha": "bbc6478ef3e8cec4c59571ed096da0d9774213a8", "size": 754, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/Lens/Signature.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/Lens/Signature.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/Lens/Signature.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 16.3913043478, "max_line_length": 91, "alphanum_fraction": 0.5822281167, "num_tokens": 291, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094117351309, "lm_q2_score": 0.754914997895581, "lm_q1q2_score": 0.674372672680129}} {"text": "module Logics.Not where\n\nopen import Function\nopen import Relation.Nullary\n\n------------------------------------------------------------------------\n-- internal stuffs\n\nprivate\n\n a=¬∘¬a : ∀ {a} {A : Set a} → A → ¬ (¬ A)\n a=¬∘¬a a z = z a\n\n /p→q/→¬/p→¬q/ : ∀ {p q} {P : Set p} {Q : Set q} → (P → Q) → (¬ Q → ¬ P)\n /p→q/→¬/p→¬q/ p→q ¬q p = ¬q $ p→q p\n\n------------------------------------------------------------------------\n-- public aliases\n\nnot-not : ∀ {ℓ} {A : Set ℓ} → A → ¬ (¬ A)\nnot-not = a=¬∘¬a\n\ncontrapositive : ∀ {p q} {P : Set p} {Q : Set q} → (P → Q) → (¬ Q → ¬ P)\ncontrapositive = /p→q/→¬/p→¬q/\n", "meta": {"hexsha": "4683a4734a32ba1164c951266e7c8df161b02a83", "size": 610, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Logics/Not.agda", "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_issues_repo_path": "src/Logics/Not.agda", "max_issues_repo_name": "ice1k/Theorems", "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Logics/Not.agda", "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.4, "max_line_length": 73, "alphanum_fraction": 0.3524590164, "num_tokens": 233, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8933094145755219, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.6743726600473217}} {"text": "\nmodule LC.Example where \n\nopen import LC.Base\nopen import LC.Subst\nopen import LC.Reduction\nopen import LC.Reasoning\n\ntest-1 : ((ƛ var 0) ∙ var 0) β→* ((var 0) [ var 0 ])\ntest-1 = \n begin \n (ƛ var 0) ∙ var 0 \n →⟨ β-ƛ-∙ ⟩ \n (var 0) [ var 0 ] \n ∎\n\ntest-0 : ƛ (ƛ var 0 ∙ var 1) ∙ (ƛ var 0 ∙ var 1) β→* ƛ var 0 ∙ var 0\ntest-0 = \n begin\n ƛ (ƛ var 0 ∙ var 1) ∙ (ƛ var 0 ∙ var 1)\n →⟨ β-ƛ β-ƛ-∙ ⟩ \n ƛ (var 0 ∙ var 1) [ ƛ var 0 ∙ var 1 ]\n →⟨⟩ \n ƛ (var 0 ∙ var 1) [ ƛ var 0 ∙ var 1 / 0 ]\n →⟨⟩ \n ƛ (var 0) [ ƛ var 0 ∙ var 1 / 0 ] ∙ (var 1) [ ƛ var 0 ∙ var 1 / 0 ]\n →⟨⟩ \n ƛ lift 0 0 (ƛ var 0 ∙ var 1) ∙ var 0\n →⟨⟩ \n ƛ (ƛ lift 0 0 (var 0 ∙ var 1)) ∙ var 0\n →⟨⟩ \n ƛ (ƛ lift 0 0 (var 0) ∙ lift 0 0 (var 1)) ∙ var 0\n →⟨⟩ \n ƛ ((ƛ var 0 ∙ var 1) ∙ var 0)\n →⟨ β-ƛ β-ƛ-∙ ⟩ \n ƛ (var 0 ∙ var 1) [ var 0 / 0 ]\n →⟨⟩ \n ƛ var 0 ∙ var 0\n ∎ \n \nZ : Term \nZ = ƛ ƛ var 0\n\nSZ : Term \nSZ = ƛ ƛ var 1 ∙ var 0\n\nPLUS : Term \nPLUS = ƛ ƛ ƛ ƛ var 3 ∙ var 1 ∙ (var 2 ∙ var 1 ∙ var 0)\n\ntest-2 : PLUS ∙ Z ∙ SZ β→* SZ\ntest-2 = \n begin\n PLUS ∙ Z ∙ SZ\n →⟨ β-∙-l β-ƛ-∙ ⟩ \n (ƛ ƛ ƛ var 3 ∙ var 1 ∙ (var 2 ∙ var 1 ∙ var 0)) [ ƛ ƛ var 0 / 0 ] ∙ SZ\n →⟨⟩ \n (ƛ ((ƛ ƛ var 3 ∙ var 1 ∙ (var 2 ∙ var 1 ∙ var 0)) [ ƛ ƛ var 0 / 1 ])) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ var 3 ∙ var 1 ∙ (var 2 ∙ var 1 ∙ var 0)) [ ƛ ƛ var 0 / 2 ])) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ ((var 3 ∙ var 1 ∙ (var 2 ∙ var 1 ∙ var 0)) [ ƛ ƛ var 0 / 3 ])))) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ (var 3) [ ƛ ƛ var 0 / 3 ] ∙ (var 1) [ ƛ ƛ var 0 / 3 ] ∙ (var 2 ∙ var 1 ∙ var 0) [ ƛ ƛ var 0 / 3 ]))) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ (lift 0 3 (ƛ (ƛ var 0))) ∙ var 1 ∙ (var 2 ∙ var 1 ∙ var 0)))) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ (ƛ (ƛ (var 0))) ∙ var 1 ∙ (var 2 ∙ var 1 ∙ var 0)))) ∙ SZ\n →⟨ β-∙-l (β-ƛ (β-ƛ (β-ƛ (β-∙-l β-ƛ-∙)))) ⟩ \n (ƛ (ƛ (ƛ (ƛ var 0) [ var 1 / 0 ] ∙ (var 2 ∙ var 1 ∙ var 0)))) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ (ƛ (var 0) [ var 1 / 1 ]) ∙ (var 2 ∙ var 1 ∙ var 0)))) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ (ƛ var 0) ∙ (var 2 ∙ var 1 ∙ var 0)))) ∙ SZ\n →⟨ β-∙-l (β-ƛ (β-ƛ (β-ƛ β-ƛ-∙))) ⟩ \n (ƛ (ƛ (ƛ (var 0) [ var 2 ∙ var 1 ∙ var 0 / 0 ]))) ∙ SZ\n →⟨⟩ \n (ƛ (ƛ (ƛ (var 2 ∙ var 1 ∙ var 0)))) ∙ SZ\n →⟨ β-ƛ-∙ ⟩ \n (ƛ (ƛ (var 2 ∙ var 1 ∙ var 0))) [ SZ / 0 ]\n →⟨⟩ \n ƛ (ƛ (var 2 ∙ var 1 ∙ var 0) [ SZ / 2 ])\n →⟨⟩ \n ƛ (ƛ lift 0 2 SZ ∙ var 1 ∙ var 0)\n →⟨⟩ \n ƛ (ƛ (ƛ ƛ var 1 ∙ var 0) ∙ var 1 ∙ var 0)\n →⟨ β-ƛ (β-ƛ (β-∙-l β-ƛ-∙)) ⟩ \n ƛ (ƛ (ƛ var 1 ∙ var 0) [ var 1 / 0 ] ∙ var 0)\n →⟨⟩ \n ƛ (ƛ (ƛ ((var 1 ∙ var 0) [ var 1 / 1 ])) ∙ var 0)\n →⟨⟩ \n ƛ (ƛ (ƛ ((var 1) [ var 1 / 1 ] ∙ (var 0) [ var 1 / 1 ])) ∙ var 0)\n →⟨⟩ \n ƛ (ƛ (ƛ (lift 0 1 (var 1) ∙ var 0)) ∙ var 0)\n →⟨⟩ \n ƛ (ƛ (ƛ (var 2 ∙ var 0)) ∙ var 0)\n →⟨ β-ƛ (β-ƛ β-ƛ-∙) ⟩ \n ƛ (ƛ (var 2 ∙ var 0) [ var 0 / 0 ])\n →⟨⟩ \n ƛ (ƛ (var 2) [ var 0 / 0 ] ∙ var 0)\n →⟨⟩ \n ƛ (ƛ var 1 ∙ var 0)\n ∎", "meta": {"hexsha": "74ebfbf7d64a059137fc9bc743320303ba8bc907", "size": 2868, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "LC/Example.agda", "max_stars_repo_name": "banacorn/bidirectional", "max_stars_repo_head_hexsha": "0c9a6e79c23192b28ddb07315b200a94ee900ca6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-08-25T07:34:40.000Z", "max_stars_repo_stars_event_max_datetime": "2020-08-25T14:05:01.000Z", "max_issues_repo_path": "LC/Example.agda", "max_issues_repo_name": "banacorn/bidirectional", "max_issues_repo_head_hexsha": "0c9a6e79c23192b28ddb07315b200a94ee900ca6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "LC/Example.agda", "max_forks_repo_name": "banacorn/bidirectional", "max_forks_repo_head_hexsha": "0c9a6e79c23192b28ddb07315b200a94ee900ca6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.1176470588, "max_line_length": 118, "alphanum_fraction": 0.379707113, "num_tokens": 1876, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094003735664, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6743726591774268}} {"text": "open import Type\n\nmodule Relator.Congruence {ℓ₁}{ℓ₂} {X : Type{ℓ₁}}{Y : Type{ℓ₂}} where\n\nimport Lvl\nopen import Functional\nopen import Logic\nopen import Logic.Propositional\nopen import Relator.Equals\n\n-- The congruence relation with respect to a relation\ninfixl 15 _≅_of_\ndata _≅_of_ (x₁ : X) (x₂ : X) (f : X → Y) : Stmt{ℓ₂} where\n [≅]-intro : (f(x₁) ≡ f(x₂)) → (x₁ ≅ x₂ of f)\n\n[≅]-elim : ∀{x₁ x₂ : X}{f : X → Y} → (x₁ ≅ x₂ of f) → (f(x₁) ≡ f(x₂))\n[≅]-elim ([≅]-intro eq) = eq\n", "meta": {"hexsha": "225634cdec11e75b259a960e5712d51288b6aafb", "size": 483, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Relator/Congruence.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Relator/Congruence.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Relator/Congruence.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.8333333333, "max_line_length": 69, "alphanum_fraction": 0.6128364389, "num_tokens": 212, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.893309411735131, "lm_q2_score": 0.7549149758396752, "lm_q1q2_score": 0.6743726529773808}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Instantiates the ring solver, using the natural numbers as the\n-- coefficient \"ring\"\n------------------------------------------------------------------------\n\nopen import Algebra\nimport Algebra.Operations\nopen import Relation.Nullary\n\nmodule Algebra.RingSolver.Natural-coefficients\n {r₁ r₂}\n (R : CommutativeSemiring r₁ r₂)\n (dec : let open CommutativeSemiring R\n open Algebra.Operations semiring in\n ∀ m n → Dec (m × 1# ≈ n × 1#)) where\n\nimport Algebra.RingSolver\nopen import Algebra.RingSolver.AlmostCommutativeRing\nopen import Data.Nat as ℕ\nopen import Data.Product using (module Σ)\nopen import Function\nimport Relation.Binary.EqReasoning\nimport Relation.Nullary.Decidable as Dec\n\nopen CommutativeSemiring R\nopen Algebra.Operations semiring\nopen Relation.Binary.EqReasoning setoid\n\nprivate\n\n -- The coefficient \"ring\".\n\n ℕ-ring : RawRing _\n ℕ-ring = record\n { Carrier = ℕ\n ; _+_ = ℕ._+_\n ; _*_ = ℕ._*_\n ; -_ = id\n ; 0# = 0\n ; 1# = 1\n }\n\n -- There is a homomorphism from ℕ to R.\n --\n -- Note that _×′_ is used rather than _×_. If _×_ were used, then\n -- Function.Related.TypeIsomorphisms.test would fail to type-check.\n\n homomorphism :\n ℕ-ring -Raw-AlmostCommutative⟶ fromCommutativeSemiring R\n homomorphism = record\n { ⟦_⟧ = λ n → n ×′ 1#\n ; +-homo = ×′-homo-+ 1#\n ; *-homo = ×′1-homo-*\n ; -‿homo = λ _ → refl\n ; 0-homo = refl\n ; 1-homo = refl\n }\n\n -- Equality of certain expressions can be decided.\n\n dec′ : ∀ m n → Dec (m ×′ 1# ≈ n ×′ 1#)\n dec′ m n = Dec.map′ to from (dec m n)\n where\n to : m × 1# ≈ n × 1# → m ×′ 1# ≈ n ×′ 1#\n to m≈n = begin\n m ×′ 1# ≈⟨ sym $ ×≈×′ m 1# ⟩\n m × 1# ≈⟨ m≈n ⟩\n n × 1# ≈⟨ ×≈×′ n 1# ⟩\n n ×′ 1# ∎\n\n from : m ×′ 1# ≈ n ×′ 1# → m × 1# ≈ n × 1#\n from m≈n = begin\n m × 1# ≈⟨ ×≈×′ m 1# ⟩\n m ×′ 1# ≈⟨ m≈n ⟩\n n ×′ 1# ≈⟨ sym $ ×≈×′ n 1# ⟩\n n × 1# ∎\n\n-- The instantiation.\n\nopen Algebra.RingSolver _ _ homomorphism dec′ public\n", "meta": {"hexsha": "971b68a4cd2e88a8435ae9dc038ecaf1aacbff0e", "size": 2166, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Algebra/RingSolver/Natural-coefficients.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Algebra/RingSolver/Natural-coefficients.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Algebra/RingSolver/Natural-coefficients.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.0963855422, "max_line_length": 72, "alphanum_fraction": 0.52677747, "num_tokens": 762, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094032139577, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.6743726514703067}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\n\nmodule x05-842Isomorphism-hc where\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl; cong; cong-app; sym; subst) -- added last\nopen Eq.≡-Reasoning\nopen import Data.Nat using (ℕ; zero; suc; _+_; _*_; _^_)\nopen import Data.Nat.Properties using (+-comm; +-suc; +-identityʳ) -- added last\n------------------------------------------------------------------------------\nopen import x02-842Induction-hc-2 hiding (+-suc; +-identityʳ)\n\n------------------------------------------------------------------------------\n-- Function composition.\n\n_∘_ : ∀ {A B C : Set} → (B → C) → (A → B) → (A → C)\n(g ∘ f) x = g (f x)\n\n_∘′_ : ∀ {A B C : Set} → (B → C) → (A → B) → (A → C)\ng ∘′ f = λ x → g (f x)\n\n------------------------------------------------------------------------------\n-- EXTENSIONALITY\n\npostulate\n extensionality : ∀ {A B : Set} {f g : A → B}\n → (∀ (x : A) → f x ≡ g x)\n -----------------------\n → f ≡ g\n\n-- def of + that matches on right\n_+′_ : ℕ → ℕ → ℕ\nm +′ zero = m\nm +′ suc n = suc (m +′ n)\n\nsame-app : ∀ (m n : ℕ) → m +′ n ≡ m + n\nsame-app m zero -- (m +′ zero) ≡ m + zero\n -- m ≡ m + zero\n rewrite +-identityʳ m -- m ≡ m\n = refl\nsame-app m (suc n) -- (m +′ suc n) ≡ m + suc n\n -- suc (m +′ n) ≡ m + suc n\n rewrite\n +-suc m n -- suc (m +′ n) ≡ suc (m + n)\n | same-app m n -- suc (m + n) ≡ suc (m + n)\n = refl\n\n-- requires extensionality\n+′-same-as-+ : _+′_ ≡ _+_\n+′-same-as-+ = extensionality λ m → extensionality λ n → same-app m n\n\n------------------------------------------------------------------------------\n-- ISOMORPHISM\n\ninfix 0 _≃_\nrecord _≃_ (A B : Set) : Set where\n constructor mk-≃ -- added, not in PLFA\n field\n to : A → B\n from : B → A\n from∘to : ∀ (x : A) → from (to x) ≡ x\n to∘from : ∀ (y : B) → to (from y) ≡ y\nopen _≃_\n\n-- RECORD def equivalent to DATA def and functions:\n\ndata _≃′_ (A B : Set): Set where\n mk-≃′ : ∀ (to : A → B) →\n ∀ (from : B → A) →\n ∀ (from∘to : (∀ (x : A) → from (to x) ≡ x)) →\n ∀ (to∘from : (∀ (y : B) → to (from y) ≡ y)) →\n A ≃′ B\n\nto′ : ∀ {A B : Set} → (A ≃′ B) → (A → B)\nto′ (mk-≃′ f g g∘f f∘g) = f\n\nfrom′ : ∀ {A B : Set} → (A ≃′ B) → (B → A)\nfrom′ (mk-≃′ f g g∘f f∘g) = g\n\nfrom∘to′ : ∀ {A B : Set} → (A≃B : A ≃′ B)\n → (∀ (x : A)\n → from′ A≃B (to′ A≃B x) ≡ x)\nfrom∘to′ (mk-≃′ f g g∘f f∘g) = g∘f\n\nto∘from′ : ∀ {A B : Set} → (A≃B : A ≃′ B)\n → (∀ (y : B)\n → to′ A≃B (from′ A≃B y) ≡ y)\nto∘from′ (mk-≃′ f g g∘f f∘g) = f∘g\n\n-- End of equivalent formulation (records are faster!)\n\n------------------------------------------------------------------------------\n-- PROPERTIES OF ISOMORPHISM : AN EQUIVALENCE RELATION (i.e., reflexive, symmetric and transitive)\n\n-- reflexive\n≃-refl : ∀ {A : Set}\n -----\n → A ≃ A\n\n-- in empty hole, split on result, get COPATTERNS (not in PLFA)\n\nto ≃-refl x = x\nfrom ≃-refl x = x\nfrom∘to ≃-refl x = refl\nto∘from ≃-refl x = refl\n\n-- symmetric\n≃-sym : ∀ {A B : Set}\n → A ≃ B\n -----\n → B ≃ A\n\nto (≃-sym A≃B) = from A≃B\nfrom (≃-sym A≃B) = to A≃B\nfrom∘to (≃-sym A≃B) = to∘from A≃B\nto∘from (≃-sym A≃B) = from∘to A≃B\n\n-- transitive\n≃-trans : ∀ {A B C : Set}\n → A ≃ B\n → B ≃ C\n -----\n → A ≃ C\n\nto (≃-trans A≃B B≃C) = to B≃C ∘ to A≃B\nfrom (≃-trans A≃B B≃C) = from A≃B ∘ from B≃C\nfrom∘to (≃-trans A≃B B≃C) x rewrite from∘to B≃C (to A≃B x) = from∘to A≃B x\nto∘from (≃-trans A≃B B≃C) x rewrite to∘from A≃B (from B≃C x) = to∘from B≃C x\n\n\n-- syntax for isomorphic equational reasoning\nmodule ≃-Reasoning where\n\n infix 1 ≃-begin_\n infixr 2 _≃⟨_⟩_\n infix 3 _≃-∎\n\n ≃-begin_ : ∀ {A B : Set}\n → A ≃ B\n -----\n → A ≃ B\n ≃-begin A≃B = A≃B\n\n _≃⟨_⟩_ : ∀ (A : Set) {B C : Set}\n → A ≃ B\n → B ≃ C\n -----\n → A ≃ C\n A ≃⟨ A≃B ⟩ B≃C = ≃-trans A≃B B≃C\n\n _≃-∎ : ∀ (A : Set)\n -----\n → A ≃ A\n A ≃-∎ = ≃-refl\n\nopen ≃-Reasoning\n\n------------------------------------------------------------------------------\n-- EMBEDDING (weaker than isomorphism)\n\ninfix 0 _≲_\nrecord _≲_ (A B : Set) : Set where\n field\n to : A → B\n from : B → A\n from∘to : ∀ (x : A) → from (to x) ≡ x\nopen _≲_\n\n≲-refl : ∀ {A : Set} → A ≲ A\nto ≲-refl x = x\nfrom ≲-refl x = x\nfrom∘to ≲-refl x = refl\n\n≲-trans : ∀ {A B C : Set} → A ≲ B → B ≲ C → A ≲ C\nto (≲-trans A≲B B≲C) = to B≲C ∘ to A≲B\nfrom (≲-trans A≲B B≲C) = from A≲B ∘ from B≲C\nfrom∘to (≲-trans A≲B B≲C) x rewrite from∘to B≲C (to A≲B x) = from∘to A≲B x\n\n≲-antisym : ∀ {A B : Set}\n → (A≲B : A ≲ B)\n → (B≲A : B ≲ A)\n → (to A≲B ≡ from B≲A)\n → (from A≲B ≡ to B≲A)\n -------------------\n → A ≃ B\n\nto (≲-antisym A≲B B≲A to≡from from≡to) = to A≲B\nfrom (≲-antisym A≲B B≲A to≡from from≡to) = from A≲B\nfrom∘to (≲-antisym A≲B B≲A to≡from from≡to) x = from∘to A≲B x\nto∘from (≲-antisym A≲B B≲A to≡from from≡to) y\n rewrite from≡to | to≡from = from∘to B≲A y\n\n-- equational reasoning for embedding\nmodule ≲-Reasoning where\n\n infix 1 ≲-begin_\n infixr 2 _≲⟨_⟩_\n infix 3 _≲-∎\n\n ≲-begin_ : ∀ {A B : Set}\n → A ≲ B\n -----\n → A ≲ B\n ≲-begin A≲B = A≲B\n\n _≲⟨_⟩_ : ∀ (A : Set) {B C : Set}\n → A ≲ B\n → B ≲ C\n -----\n → A ≲ C\n A ≲⟨ A≲B ⟩ B≲C = ≲-trans A≲B B≲C\n\n _≲-∎ : ∀ (A : Set)\n -----\n → A ≲ A\n A ≲-∎ = ≲-refl\n\nopen ≲-Reasoning\n\n------------------------------------------------------------------------------\n-- isomorphism implies embedding\n\n≃-implies-≲ : ∀ {A B : Set}\n → A ≃ B\n -----\n → A ≲ B\n\nto (≃-implies-≲ a≃b) = to a≃b\nfrom (≃-implies-≲ a≃b) = from a≃b\nfrom∘to (≃-implies-≲ a≃b) = from∘to a≃b\n\n------------------------------------------------------------------------------\n-- PROPOSITIONAL EQUIVALENCE (weaker than embedding) - aka IFF\n-- an equivalence relation\n\nrecord _⇔_ (A B : Set) : Set where\n field\n to : A → B\n from : B → A\nopen _⇔_ -- added\n\n⇔-refl : ∀ {A : Set}\n -----\n → A ⇔ A\n\n_⇔_.to ⇔-refl x = x\n_⇔_.from ⇔-refl x = x\n\n⇔-sym : ∀ {A B : Set}\n → A ⇔ B\n -----\n → B ⇔ A\n\n_⇔_.to (⇔-sym A⇔B) = from A⇔B\n_⇔_.from (⇔-sym A⇔B) = to A⇔B\n\n⇔-trans : ∀ {A B C : Set}\n → A ⇔ B\n → B ⇔ C\n -----\n → A ⇔ C\n\nto (⇔-trans A⇔B B⇔C) = to B⇔C ∘ to A⇔B\nfrom (⇔-trans A⇔B B⇔C) = from A⇔B ∘ from B⇔C\n\n{-\n------------------------------------------------------------------------------\n-- 842 extended exercise: Canonical bitstrings.\n-- Modified and extended from Bin-predicates exercise in PLFA Relations.\n\ncannot prove\n ∀ {n : Bin-ℕ} → tob (fromb n) ≡ n\nbecause of possibility of leading zeroes in Bin-ℕ value (e.g., 'bits x0 x0 x1')\n\nIt s true for Bin-ℕ without leading zeroes\n-}\n-- Predicate that states:\n-- value of type One n is evidence that n has a leading one.\ndata One : Bin-ℕ → Set where\n [bitsx1] : One (bits x1)\n _[x0] : ∀ {b : Bin-ℕ} → One b → One (b x0)\n _[x1] : ∀ {b : Bin-ℕ} → One b → One (b x1)\n\n-- proof that 'bits x1 x0 x0' has leading one\n_ : One (bits x1 x0 x0)\n_ = [bitsx1] [x0] [x0]\n\n-- There is no value of type One (bits x0 x0 x1).\n-- Can't state and prove yet, because negation not covered until Connectives chapter.\n\n-- Canonical binary representation is either zero or has a leading one.\ndata Can : Bin-ℕ → Set where\n [zero] : Can bits\n [pos] : ∀ {b : Bin-ℕ} → One b → Can b\n\n_ : Can bits\n_ = [zero]\n\n_ : Can (bits x1 x0)\n_ = [pos] ([bitsx1] [x0])\n\n-- PLFA Relations Bin-predicates exercise gives three properties of canonicity.\n-- First : increment of a canonical number is canonical.\n-- Most of the work is done in the following lemma.\n\n-- IncCanOne : increment of a canonical number has a leading one.\none-inc : ∀ {b : Bin-ℕ} → Can b → One (inc b)\none-inc [zero] = [bitsx1] -- note: 'n' is bound to 'bits'\none-inc ([pos] [bitsx1]) = [bitsx1] [x0]\none-inc ([pos] (b [x0])) = b [x1]\none-inc ([pos] (b [x1])) = one-inc ([pos] b) [x0]\n\n-- OneInc : 1st canonicity property is now a corollary.\ncan-inc : ∀ {b : Bin-ℕ} → Can b → Can (inc b)\ncan-inc cb = [pos] (one-inc cb)\n\n-- CanToB : 2nd canonicity property : converting unary to binary produces a canonical number.\nto-can : ∀ (n : ℕ) → Can (tob n)\nto-can zero = [zero]\nto-can (suc n) = can-inc (to-can n)\n\n-- OneDblbX0 : relates binary double to the x0 constructor, for numbers with a leading one.\ndblb-x0 : ∀ {b : Bin-ℕ} → One b → dblb b ≡ b x0\ndblb-x0 [bitsx1] = refl\ndblb-x0 (on [x0]) rewrite dblb-x0 on = refl\ndblb-x0 (on [x1]) rewrite dblb-x0 on = refl\n\ndblb-x1 : ∀ {b : Bin-ℕ} → One b → inc (dblb b) ≡ b x1\ndblb-x1 [bitsx1] = refl\ndblb-x1 (on [x0]) -- inc (dblb (b x0)) ≡ ((b x0) x1)\n -- (dblb b x1) ≡ ((b x0) x1)\n rewrite sym (dblb-x0 on) -- (dblb b x1) ≡ (dblb b x1)\n = refl\ndblb-x1 (on [x1]) -- inc (dblb (b x1)) ≡ ((b x1) x1)\n -- (inc (dblb b) x1) ≡ ((b x1) x1)\n rewrite dblb-x1 on -- ((b x1) x1) ≡ ((b x1) x1)\n = refl\n\n-- To prove 3rd property, use lemmas from 842Induction\n-- 'one-to∘from' below and some new ones you define.\n\none-bits-to-nat : ∀ {b : Bin-ℕ} → One b → ℕ\none-bits-to-nat {b} _ = fromb b\n\none-to∘from : ∀ {b : Bin-ℕ} → One b → tob (fromb b) ≡ b\none-to∘from [bitsx1] = refl\none-to∘from {b} (on [x0]) -- tob (fromb (b x0)) ≡ (b x0)\n -- tob (dbl (fromb b )) ≡ (b x0)\n rewrite\n sym (dblb-x0 on) -- tob (dbl (fromb b )) ≡ dblb b\n | to∘dbl (one-bits-to-nat on) -- dblb (tob (fromb b₁)) ≡ dblb b₁\n | one-to∘from on -- dblb lhs ≡ dblb lhs\n = refl\none-to∘from {b} (on [x1]) -- tob (fromb (b₁ x1)) ≡ (b₁ x1)\n -- inc (tob (dbl (fromb b₁))) ≡ (b₁ x1)\n rewrite\n to∘dbl (one-bits-to-nat on) -- inc (dblb (tob (fromb b₁))) ≡ (b₁ x1)\n | one-to∘from on -- inc (dblb lhs) ≡ (lhs x1)\n | dblb-x1 on -- (lhs x1) ≡ (lhs x1)\n = refl\n\n-- 3rd canonicity property :\n-- converting a canonical number from binary and back to unary produces the same number.\n-- CanToFrom\ncan-to∘from : ∀ {b : Bin-ℕ} → Can b → tob (fromb b) ≡ b\ncan-to∘from [zero] = refl\ncan-to∘from ([pos] b) = one-to∘from b\n\n-- Proofs of positivity are unique.\none-unique : ∀ {b : Bin-ℕ} → (ox oy : One b) → ox ≡ oy\none-unique [bitsx1] [bitsx1] = refl\none-unique (ox [x0]) (oy [x0])\n with one-unique ox oy\n... | refl = refl\none-unique (ox [x1]) (oy [x1])\n with one-unique ox oy\n... | refl = refl\n\n-- Proofs of canonicity are unique.\ncan-unique : ∀ {b : Bin-ℕ} → (cx cy : Can b) → cx ≡ cy\ncan-unique [zero] [zero] = refl\ncan-unique ([pos] ox) ([pos] oy)\n with one-unique ox oy\n... | refl = refl\n\n------------------------------------------------------------------------------\n-- There is NOT an isomorphism between ℕ (unary) and canonical binary representations.\n-- Because Can is not a set, but a family of sets, it does not fit into framework for isomorphism.\n\n-- It is possible to roll all the values into one set which is isomorphic to ℕ.\n-- A CanR VALUE wraps a Bin-ℕ and proof it has a canonical representation.\ndata CanR : Set where\n wrap : ∀ (b : Bin-ℕ) → Can b → CanR\n\n-- IsoNCanR : Prove an isomorphism between ℕ and CanR.\niso-ℕ-CanR : ℕ ≃ CanR\nto iso-ℕ-CanR n = wrap (tob n) (to-can n) -- -- Goal: CanR; n : ℕ\nfrom iso-ℕ-CanR (wrap b cb) = fromb b -- Goal: ℕ; cb : Can b, b : Bin-ℕ\n -- Constraints\n -- fromb (tob n) = ?0 (b = (tob n)) (cb = (to-can n)) : ℕ\nfrom∘to iso-ℕ-CanR n = from∘tob n -- Goal: fromb (tob n) ≡ n; n : ℕ\nto∘from iso-ℕ-CanR (wrap b cb) -- Goal: to iso-ℕ-CanR (from iso-ℕ-CanR (wrap b cb)) ≡ wrap b cb\n -- Goal: wrap (tob (fromb b)) (to-can (fromb b)) ≡ wrap b cb\n -- cb : Can b, b : Bin-ℕ\n with to-can (fromb b) | can-to∘from cb\n... | tcfb | ctfcb -- Goal: wrap (tob (fromb b)) tcfb ≡ wrap b cb\n -- ctfcb : tob (fromb b) ≡ b, tcfb : Can (tob (fromb b))\n rewrite\n ctfcb -- Goal: wrap b tcfb ≡ wrap b cb\n | can-unique cb tcfb -- Goal: wrap b tcfb ≡ wrap b tcfb\n = refl\n\n------------------------------------------------------------------------------\n-- BIJECTIVE BINARY NUMBERING -- TODO\n-- Isomorphism between ℕ and some binary encoding (without awkward non-canonical values).\n-- Via using digits 1 and 2 (instead of 0 and 1) where the multiplier/base is still 2.\n-- e.g., , 1, 2, 11, 12, 21, 22, 111, ...\n\ndata Bij-ℕ : Set where\n bits : Bij-ℕ\n _x1 : Bij-ℕ → Bij-ℕ\n _x2 : Bij-ℕ → Bij-ℕ\n\n--------------------------------------------------\nincBij-ℕ : Bij-ℕ → Bij-ℕ\nincBij-ℕ bits = bits x1\nincBij-ℕ (bj x1) = bj x2\nincBij-ℕ (bj x2) = (incBij-ℕ bj) x1\n\n_ : incBij-ℕ bits ≡ bits x1\n_ = refl\n_ : incBij-ℕ (bits x1) ≡ bits x2\n_ = refl\n_ : incBij-ℕ (bits x2) ≡ bits x1 x1\n_ = refl\n_ : incBij-ℕ (bits x1 x1) ≡ bits x1 x2\n_ = refl\n_ : incBij-ℕ (bits x1 x2) ≡ bits x2 x1\n_ = refl\n_ : incBij-ℕ (bits x2 x1) ≡ bits x2 x2\n_ = refl\n_ : incBij-ℕ (bits x2 x2) ≡ bits x1 x1 x1\n_ = refl\n\n--------------------------------------------------\ntoBij-ℕ : ℕ → Bij-ℕ\ntoBij-ℕ zero = bits\ntoBij-ℕ (suc n) = incBij-ℕ (toBij-ℕ n)\n\n_ : toBij-ℕ 0 ≡ bits\n_ = refl\n_ : toBij-ℕ 1 ≡ bits x1\n_ = refl\n_ : toBij-ℕ 2 ≡ bits x2\n_ = refl\n_ : toBij-ℕ 3 ≡ bits x1 x1\n_ = refl\n_ : toBij-ℕ 4 ≡ bits x1 x2\n_ = refl\n_ : toBij-ℕ 5 ≡ bits x2 x1\n_ = refl\n_ : toBij-ℕ 6 ≡ bits x2 x2\n_ = refl\n_ : toBij-ℕ 7 ≡ bits x1 x1 x1\n_ = refl\n_ : toBij-ℕ 8 ≡ bits x1 x1 x2\n_ = refl\n_ : toBij-ℕ 9 ≡ bits x1 x2 x1\n_ = refl\n_ : toBij-ℕ 10 ≡ bits x1 x2 x2\n_ = refl\n_ : toBij-ℕ 11 ≡ bits x2 x1 x1\n_ = refl\n_ : toBij-ℕ 12 ≡ bits x2 x1 x2\n_ = refl\n_ : toBij-ℕ 14 ≡ bits x2 x2 x2\n_ = refl\n_ : toBij-ℕ 16 ≡ bits x1 x1 x1 x2\n_ = refl\n_ : toBij-ℕ 18 ≡ bits x1 x1 x2 x2\n_ = refl\n_ : toBij-ℕ 20 ≡ bits x1 x2 x1 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 0 ≡ bits\n_ = refl\n_ : toBij-ℕ 0 ≡ bits\n_ = refl\n-------------------------\n_ : toBij-ℕ 1 ≡ bits x1\n_ = refl\n_ : toBij-ℕ 2 ≡ bits x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 2 ≡ bits x2\n_ = refl\n_ : toBij-ℕ 4 ≡ bits x1 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 3 ≡ bits x1 x1\n_ = refl\n_ : toBij-ℕ 6 ≡ bits x2 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 4 ≡ bits x1 x2\n_ = refl\n_ : toBij-ℕ 8 ≡ bits x1 x1 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 5 ≡ bits x2 x1\n_ = refl\n_ : toBij-ℕ 10 ≡ bits x1 x2 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 6 ≡ bits x2 x2\n_ = refl\n_ : toBij-ℕ 12 ≡ bits x2 x1 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 7 ≡ bits x1 x1 x1\n_ = refl\n_ : toBij-ℕ 14 ≡ bits x2 x2 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 8 ≡ bits x1 x1 x2\n_ = refl\n_ : toBij-ℕ 16 ≡ bits x1 x1 x1 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 9 ≡ bits x1 x2 x1\n_ = refl\n_ : toBij-ℕ 18 ≡ bits x1 x1 x2 x2\n_ = refl\n-------------------------\n_ : toBij-ℕ 10 ≡ bits x1 x2 x2\n_ = refl\n_ : toBij-ℕ 20 ≡ bits x1 x2 x1 x2\n_ = refl\n-------------------------\n\n--------------------------------------------------\nfromBij-ℕ : Bij-ℕ → ℕ\nfromBij-ℕ bj = fbj bj 0\n where\n fbj : Bij-ℕ → ℕ → ℕ\n fbj bits _ = zero\n fbj (bj x1) n = (1 * (2 ^ n)) + fbj bj (n + 1)\n fbj (bj x2) n = (2 * (2 ^ n)) + fbj bj (n + 1)\n\n_ : fromBij-ℕ (bits) ≡ 0\n_ = refl\n_ : fromBij-ℕ (bits x1) ≡ 1\n_ = refl\n_ : fromBij-ℕ (bits x2) ≡ 2\n_ = refl\n_ : fromBij-ℕ (bits x1 x1) ≡ 3\n_ = refl\n_ : fromBij-ℕ (bits x1 x2) ≡ 4\n_ = refl\n_ : fromBij-ℕ (bits x2 x1) ≡ 5\n_ = refl\n_ : fromBij-ℕ (bits x2 x2) ≡ 6\n_ = refl\n_ : fromBij-ℕ (bits x1 x1 x1) ≡ 7\n_ = refl\n_ : fromBij-ℕ (bits x1 x1 x2) ≡ 8\n_ = refl\n_ : fromBij-ℕ (bits x1 x2 x1) ≡ 9\n_ = refl\n_ : fromBij-ℕ (bits x1 x2 x2) ≡ 10\n_ = refl\n_ : fromBij-ℕ (bits x1 x2 x1 x2) ≡ 20\n_ = refl\n\n--------------------------------------------------\ndoubleBij-ℕ : Bij-ℕ → Bij-ℕ\ndoubleBij-ℕ bits = bits\ndoubleBij-ℕ (bj x1) = {!!}\ndoubleBij-ℕ (bj x2) = {!!}\n\n--------------------------------------------------\nxxx : ∀ {n : ℕ} → fromBij-ℕ (toBij-ℕ n) ≡ n\nxxx {zero} = refl\nxxx {suc n} = {! !}\n\n--------------------------------------------------\n-- Prove the isomorphism between ℕ and Bij-ℕ.\n-- Largely follows outline of above.\n\niso-ℕ-Bij-ℕ : ℕ ≃ Bij-ℕ\nto iso-ℕ-Bij-ℕ n = toBij-ℕ n\nfrom iso-ℕ-Bij-ℕ bjn = fromBij-ℕ bjn\nfrom∘to iso-ℕ-Bij-ℕ n = {!!}\nto∘from iso-ℕ-Bij-ℕ bjn = {!!}\n", "meta": {"hexsha": "3c919c1e0edac9d92ac0442de79f018e11ee5323", "size": 17191, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/book/Programming_Language_Foundations_in_Agda/x05-842Isomorphism-hc.agda", "max_stars_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_stars_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2015-01-29T14:37:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T06:55:03.000Z", "max_issues_repo_path": "agda/book/Programming_Language_Foundations_in_Agda/x05-842Isomorphism-hc.agda", "max_issues_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_issues_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/book/Programming_Language_Foundations_in_Agda/x05-842Isomorphism-hc.agda", "max_forks_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_forks_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2015-04-13T21:40:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-21T15:58:10.000Z", "avg_line_length": 28.8924369748, "max_line_length": 109, "alphanum_fraction": 0.4582630446, "num_tokens": 7121, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.855851143290548, "lm_q2_score": 0.7879312006227324, "lm_q1q2_score": 0.6743518188872597}} {"text": "module Numeral.Natural.Relation.Order.Proofs where\n\nimport Lvl\nopen import Data.Tuple as Tuple using (_⨯_ ; _,_)\nopen import Functional\nopen import Logic\nopen import Logic.Propositional\nopen import Logic.Propositional.Theorems\nopen import Logic.Predicate\nopen import Numeral.Natural\nopen import Numeral.Natural.Oper\nopen import Numeral.Natural.Oper.Proofs\nopen import Numeral.Natural.Induction\nopen import Numeral.Natural.Relation.Order\nopen import Relator.Equals\nopen import Relator.Equals.Proofs\nopen import Structure.Relator\nimport Structure.Relator.Names as Names\nopen import Structure.Function\nopen import Structure.Function.Domain\nopen import Structure.Operator.Properties\nopen import Structure.Relator.Ordering\nopen import Structure.Relator.Properties\nopen import Structure.Relator.Properties.Proofs\nopen import Syntax.Transitivity\nopen import Type.Properties.MereProposition\nopen import Type\n\n-- TODO: A method for pattern matching: https://stackoverflow.com/questions/20682013/agda-why-am-i-unable-to-pattern-match-on-refl\n\ninstance\n [≤]-succ-injectivity : ∀{x y} → Injective(succ{x}{y})\n Injective.proof [≤]-succ-injectivity [≡]-intro = [≡]-intro\n\ninstance\n [≤]-mereProposition : ∀{x y} → MereProposition(x ≤ y)\n MereProposition.uniqueness [≤]-mereProposition {min} {min} = [≡]-intro\n MereProposition.uniqueness [≤]-mereProposition {succ x} {succ y} = congruence₁(succ) (MereProposition.uniqueness [≤]-mereProposition {x}{y})\n\ninstance\n [≤]-minimum = \\{y} → _≤_.min {y}\n [≤]-with-[𝐒] = \\{x}{y} ⦃ xy ⦄ → _≤_.succ {x}{y} xy\n[<]-minimum = \\{y} → succ([≤]-minimum {y})\n\n[≡]-to-[≤] : ∀{x y : ℕ} → (x ≡ y) → (x ≤ y)\n[≡]-to-[≤] {𝟎} {_} _ = [≤]-minimum\n[≡]-to-[≤] {𝐒(x)}{𝐒(y)} [≡]-intro = succ([≡]-to-[≤] {x}{y} [≡]-intro)\n\n[≡]-to-[≥] : ∀{x y : ℕ} → (x ≡ y) → (x ≥ y)\n[≡]-to-[≥] = [≡]-to-[≤] ∘ symmetry(_≡_)\n\n[≰]-to-[≢] : ∀{x y : ℕ} → (x ≰ y) → (x ≢ y)\n[≰]-to-[≢] = contrapositiveᵣ [≡]-to-[≤]\n\n[≱]-to-[≢] : ∀{x y : ℕ} → (x ≱ y) → (x ≢ y)\n[≱]-to-[≢] = contrapositiveᵣ [≡]-to-[≥]\n\n[≤][0]ᵣ : ∀{x : ℕ} → (x ≤ 0) → (x ≡ 0)\n[≤][0]ᵣ {𝟎} (_) = [≡]-intro\n[≤][0]ᵣ {𝐒(_)} ()\n\n[≤][0]ᵣ-negation : ∀{x : ℕ} → (𝐒(x) ≰ 0)\n[≤][0]ᵣ-negation ()\n\n[≤]-successor : ∀{x y : ℕ} → (x ≤ y) → (x ≤ 𝐒(y))\n[≤]-successor {𝟎} {_} (_) = [≤]-minimum\n[≤]-successor {𝐒(x)}{𝟎} ()\n[≤]-successor {𝐒(x)}{𝐒(y)} (succ proof) = succ([≤]-successor {x}{y} (proof))\n\n[≤]-predecessor : ∀{x y : ℕ} → (𝐒(x) ≤ y) → (x ≤ y)\n[≤]-predecessor {x} {𝟎} ()\n[≤]-predecessor {𝟎} {𝐒(y)} (_) = [≤]-minimum\n[≤]-predecessor {𝐒(x)}{𝐒(y)} (succ proof) = succ([≤]-predecessor {x}{y} (proof))\n\n[≤]-without-[𝐒] : ∀{x y : ℕ} → (𝐒(x) ≤ 𝐒(y)) → (x ≤ y)\n[≤]-without-[𝐒] (succ proof) = proof\n\n[≤][𝐒]ₗ : ∀{x : ℕ} → ¬(𝐒(x) ≤ x)\n[≤][𝐒]ₗ {𝟎} (1≤0) = [≤][0]ᵣ-negation{0}(1≤0)\n[≤][𝐒]ₗ {𝐒(n)} (SSn≤Sn) = [≤][𝐒]ₗ {n} ([≤]-without-[𝐒] {𝐒(n)}{n} (SSn≤Sn))\n\ninstance\n [≤]-reflexivity : Reflexivity (_≤_)\n Reflexivity.proof([≤]-reflexivity) = [≡]-to-[≤] [≡]-intro\n\ninstance\n [≤]-transitivity : Transitivity (_≤_)\n Transitivity.proof([≤]-transitivity) = proof where\n proof : Names.Transitivity (_≤_)\n proof {𝟎} {_} {_} (_)(_) = [≤]-minimum\n proof {𝐒(a)}{𝐒(b)}{𝐒(c)} (succ proofₗ) (succ proofᵣ ) =\n succ(proof {a}{b}{c} (proofₗ) (proofᵣ))\n\ninstance\n [≤]-antisymmetry : Antisymmetry (_≤_) (_≡_)\n Antisymmetry.proof([≤]-antisymmetry) = proof where\n proof : Names.Antisymmetry (_≤_) (_≡_)\n proof {𝟎} {𝟎} (_) (_) = [≡]-intro\n proof {𝐒(_)} {𝟎} ()\n proof {𝟎} {𝐒(_)} (_) ()\n proof {𝐒(a)} {𝐒(b)} (succ proofₗ) (succ proofᵣ) =\n [≡]-with(𝐒) (proof {a}{b} proofₗ proofᵣ)\n\ninstance\n [≤]-totality : ConverseTotal(_≤_)\n ConverseTotal.proof([≤]-totality) = proof where\n proof : Names.ConverseTotal(_≤_)\n proof {𝟎} {𝟎} = [∨]-introₗ ([≡]-to-[≤] [≡]-intro)\n proof {𝐒(a)}{𝟎} = [∨]-introᵣ ([≤]-minimum)\n proof {𝟎} {𝐒(b)} = [∨]-introₗ ([≤]-minimum)\n proof {𝐒(a)}{𝐒(b)} = [∨]-elim ([∨]-introₗ ∘ (proof ↦ [≤]-with-[𝐒] {a}{b} ⦃ proof ⦄)) ([∨]-introᵣ ∘ (proof ↦ [≤]-with-[𝐒] {b}{a} ⦃ proof ⦄)) (proof {a}{b})\n\ninstance\n [≤]-weakPartialOrder : Weak.PartialOrder (_≤_) (_≡_)\n [≤]-weakPartialOrder = record{}\n\ninstance\n [≤]-weakTotalOrder : Weak.TotalOrder (_≤_) (_≡_)\n [≤]-weakTotalOrder = record{}\n\ninstance\n [≥]-reflexivity : Reflexivity (_≥_)\n Reflexivity.proof([≥]-reflexivity) = Reflexivity.proof([≤]-reflexivity)\n\ninstance\n [≥]-transitivity : Transitivity (_≥_)\n Transitivity.proof([≥]-transitivity) = swap(Transitivity.proof([≤]-transitivity))\n\ninstance\n [≥]-antisymmetry : Antisymmetry (_≥_) (_≡_)\n Antisymmetry.proof([≥]-antisymmetry) = swap(Antisymmetry.proof([≤]-antisymmetry))\n\ninstance\n [≥]-totality : ConverseTotal(_≥_)\n ConverseTotal.proof([≥]-totality) = ConverseTotal.proof([≤]-totality)\n\ninstance\n [≥]-weakPartialOrder : Weak.PartialOrder (_≥_) (_≡_)\n [≥]-weakPartialOrder = record{}\n\ninstance\n [≥]-weakTotalOrder : Weak.TotalOrder (_≥_) (_≡_)\n [≥]-weakTotalOrder = record{}\n\n[≥]-to-[≮] : ∀{a b : ℕ} → (a ≮ b) ← (a ≥ b)\n[≥]-to-[≮] {a}{b} (b≤a) (𝐒a≤b) = [≤][𝐒]ₗ (transitivity(_≤_) {𝐒(a)}{b}{a} (𝐒a≤b) (b≤a))\n\n[≤]-to-[≯] : ∀{a b : ℕ} → (a ≯ b) ← (a ≤ b)\n[≤]-to-[≯] {a}{b} (a≤b) (𝐒b≤a) = [≥]-to-[≮] {b}{a} (a≤b) (𝐒b≤a)\n\n[>]-to-[≰] : ∀{a b : ℕ} → (a ≰ b) ← (a > b)\n[>]-to-[≰] {a}{b} (𝐒b≤a) (a≤b) = [≤]-to-[≯] (a≤b) (𝐒b≤a)\n\n[<]-to-[≱] : ∀{a b : ℕ} → (a ≱ b) ← (a < b)\n[<]-to-[≱] {a}{b} (𝐒a≤b) (b≤a) = [≥]-to-[≮] (b≤a) (𝐒a≤b)\n\n[<]-to-[≢] : ∀{a b : ℕ} → (a < b) → (a ≢ b)\n[<]-to-[≢] = [≱]-to-[≢] ∘ [<]-to-[≱]\n\n[>]-to-[≢] : ∀{a b : ℕ} → (a > b) → (a ≢ b)\n[>]-to-[≢] = [≰]-to-[≢] ∘ [>]-to-[≰]\n\n[<][0]ᵣ : ∀{x : ℕ} → (x ≮ 0)\n[<][0]ᵣ = [≤][0]ᵣ-negation\n\ninstance\n [<]-irreflexivity : Irreflexivity (_<_)\n Irreflexivity.proof([<]-irreflexivity) = [≤][𝐒]ₗ\n\ninstance\n [<]-transitivity : Transitivity (_<_)\n Transitivity.proof([<]-transitivity) {x}{y}{z} (l) (r) = Transitivity.proof([≤]-transitivity) {𝐒(x)} {𝐒(y)} {z} ([≤]-successor (l)) (r)\n\ninstance\n [<]-asymmetry : Asymmetry (_<_)\n Asymmetry.proof([<]-asymmetry) (l) (r) = Irreflexivity.proof([<]-irreflexivity) (Transitivity.proof([<]-transitivity) (l) (r))\n\ninstance\n [<]-converseTrichotomy : ConverseTrichotomy(_<_)(_≡_)\n ConverseTrichotomy.proof [<]-converseTrichotomy = p where\n p : Names.ConverseTrichotomy(_<_)(_≡_)\n p {𝟎} {𝟎} = [∨]-introₗ ([∨]-introᵣ [≡]-intro)\n p {𝟎} {𝐒 y} = [∨]-introₗ ([∨]-introₗ [≤]-with-[𝐒])\n p {𝐒 x} {𝟎} = [∨]-introᵣ [≤]-with-[𝐒]\n p {𝐒 x} {𝐒 y} with p {x} {y}\n ... | [∨]-introₗ ([∨]-introₗ (succ xy)) = [∨]-introₗ ([∨]-introₗ (succ (succ xy)))\n ... | [∨]-introₗ ([∨]-introᵣ [≡]-intro) = [∨]-introₗ ([∨]-introᵣ [≡]-intro)\n ... | [∨]-introᵣ (succ xy) = [∨]-introᵣ (succ (succ xy))\n\ninstance\n [<]-strictPartialOrder : Strict.PartialOrder (_<_)\n [<]-strictPartialOrder = record{}\n\ninstance\n [<]-strictTotalOrder : Strict.TotalOrder (_<_)(_≡_)\n [<]-strictTotalOrder = record{}\n\ninstance\n [>]-irreflexivity : Irreflexivity (_>_)\n Irreflexivity.proof([>]-irreflexivity) = Irreflexivity.proof([<]-irreflexivity)\n\ninstance\n [>]-transitivity : Transitivity (_>_)\n Transitivity.proof([>]-transitivity) = swap(Transitivity.proof([<]-transitivity))\n\ninstance\n [>]-asymmetry : Asymmetry (_>_)\n Asymmetry.proof([>]-asymmetry) = swap(Asymmetry.proof([<]-asymmetry))\n\ninstance\n [>]-strictOrder : Strict.PartialOrder (_>_)\n [>]-strictOrder = record{}\n\n[<]-of-[𝐒] : ∀{x : ℕ} → (x < 𝐒(x))\n[<]-of-[𝐒] = reflexivity(_≤_)\n\n[<]-of-[𝟎][𝐒] : ∀{x : ℕ} → (𝟎 < 𝐒(x))\n[<]-of-[𝟎][𝐒] {𝟎} = [<]-of-[𝐒]\n[<]-of-[𝟎][𝐒] {𝐒 x} = succ([≤]-minimum)\n\ninstance\n [≤]-of-[𝐒] : ∀{x : ℕ} → (x ≤ 𝐒(x))\n [≤]-of-[𝐒] = [≤]-successor(reflexivity(_≤_))\n\n[<][≢]-equivalence : ∀{x} → (x > 0) ↔ (x ≢ 0)\n[<][≢]-equivalence {x} = [↔]-intro (l{x}) (r{x}) where\n l : ∀{x} → (x > 0) ← (x ≢ 0)\n l{𝟎} (x≢𝟎) = [⊥]-elim((x≢𝟎)([≡]-intro))\n l{𝐒(x)} (𝐒x≢𝟎) = succ([≤]-minimum)\n\n r : ∀{x} → (x > 0) → (x ≢ 0)\n r{𝟎} ()\n r{𝐒(x)} (𝟏≤𝐒x) (𝐒x≡𝟎) with [≡]-substitutionᵣ (𝐒x≡𝟎) {expr ↦ 1 ≤ expr} (𝟏≤𝐒x)\n ... | ()\n\n[≤]-to-[<][≡] : ∀{a b : ℕ} → (a ≤ b) → (a < b)∨(a ≡ b)\n[≤]-to-[<][≡] {𝟎} {𝟎} ([≤]-minimum) = [∨]-introᵣ([≡]-intro)\n[≤]-to-[<][≡] {𝟎} {𝐒(b)} ([≤]-minimum) = [∨]-introₗ([<]-minimum)\n[≤]-to-[<][≡] {𝐒(a)}{𝐒(b)} (succ(a≤b)) with [≤]-to-[<][≡] {a}{b} (a≤b)\n... | [∨]-introₗ(a][≥]-sub : (_>_) ⊆₂ (_≥_)\n [>][≥]-sub = intro(sub₂(_<_)(_≤_))\n\n[≰]-to-[≮] : ∀{x y : ℕ} → (x ≰ y) → (x ≮ y)\n[≰]-to-[≮] = contrapositiveᵣ (sub₂(_<_)(_≤_))\n\n[≥]-to-[>][≡] : ∀{a b : ℕ} → (a ≥ b) → (a > b)∨(a ≡ b)\n[≥]-to-[>][≡] {a}{b} (proof) with [≤]-to-[<][≡] {b}{a} (proof)\n... | [∨]-introₗ(a y)\n[<]-trichotomy {x}{y} with converseTotal(_≤_) ⦃ [≤]-totality ⦄\n[<]-trichotomy {x}{y} | [∨]-introₗ x≤y with [≤]-to-[<][≡] {x}{y} x≤y\n[<]-trichotomy {x}{y} | [∨]-introₗ x≤y | [∨]-introₗ x][≡] {x}{y} y≤x\n[<]-trichotomy {x}{y} | [∨]-introᵣ y≤x | [∨]-introₗ y]-dichotomy : ∀{x y} → (x ≤ y) ∨ (x > y)\n[≤][>]-dichotomy {x}{y} with [<]-trichotomy {x}{y}\n[≤][>]-dichotomy {x} {y} | [∨]-introₗ ([∨]-introₗ x]-dichotomy {x} {y} | [∨]-introₗ ([∨]-introᵣ x≡y) = [∨]-introₗ(sub₂(_≡_)(_≤_) x≡y)\n[≤][>]-dichotomy {x} {y} | [∨]-introᵣ x>y = [∨]-introᵣ(x>y)\n\n[<][≥]-dichotomy : ∀{x y} → (x < y) ∨ (x ≥ y)\n[<][≥]-dichotomy {x}{y} = [∨]-symmetry([≤][>]-dichotomy {y}{x})\n\n[≯][≢]-to-[≱] : ∀{a b : ℕ} → (a ≯ b) → (a ≢ b) → (a ≱ b)\n[≯][≢]-to-[≱] (a≯b) (a≢b) (a≥b) with [≥]-to-[>][≡] (a≥b)\n... | [∨]-introₗ (a>b) = a≯b a>b\n... | [∨]-introᵣ (a≡b) = a≢b a≡b\n\n[>][≡]-to-[≥] : ∀{a b : ℕ} → (a > b)∨(a ≡ b) → (a ≥ b)\n[>][≡]-to-[≥] {a}{b} ([∨]-introₗ(a][≡]-to-[≥] {a}{b} ([∨]-introᵣ(b≡a)) = [<][≡]-to-[≤] {b}{a} ([∨]-introᵣ(symmetry(_≡_)(b≡a)))\n\n[>]-to-[≥] : ∀{a b : ℕ} → (a > b) → (a ≥ b)\n[>]-to-[≥] {a}{b} (a]-to-[≥]\n\n[≮][≯]-to-[≡] : ∀{a b : ℕ} → (a ≮ b) → (a ≯ b) → (a ≡ b)\n[≮][≯]-to-[≡] {a}{b} (a≮b) (a≯b) with [<]-trichotomy {a}{b}\n... | [∨]-introₗ ([∨]-introₗ a][≥]-subtransitivityₗ : Subtransitivityₗ(_≥_)(_>_)\n [>][≥]-subtransitivityₗ = subrelation-transitivity-to-subtransitivityₗ\n\ninstance\n [>][≥]-subtransitivityᵣ : Subtransitivityᵣ(_≥_)(_>_)\n [>][≥]-subtransitivityᵣ = subrelation-transitivity-to-subtransitivityᵣ\n\ninstance\n [>][≡]-subtransitivityₗ : Subtransitivityₗ(_>_)(_≡_)\n Subtransitivityₗ.proof [>][≡]-subtransitivityₗ = substitute₂ₗ(_>_) ∘ symmetry(_≡_)\n\ninstance\n [>][≡]-subtransitivityᵣ : Subtransitivityᵣ(_>_)(_≡_)\n Subtransitivityᵣ.proof [>][≡]-subtransitivityᵣ = swap(substitute₂ᵣ(_>_))\n\ninstance\n [<][≡]-subtransitivityₗ : Subtransitivityₗ(_<_)(_≡_)\n Subtransitivityₗ.proof [<][≡]-subtransitivityₗ = substitute₂ₗ(_<_) ∘ symmetry(_≡_)\n\ninstance\n [<][≡]-subtransitivityᵣ : Subtransitivityᵣ(_<_)(_≡_)\n Subtransitivityᵣ.proof [<][≡]-subtransitivityᵣ = swap(substitute₂ᵣ(_<_))\n", "meta": {"hexsha": "6cbf217dc44fcd80a9bbfbb074eb9473d06b5251", "size": 13764, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Relation/Order/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Relation/Order/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Relation/Order/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.5092838196, "max_line_length": 158, "alphanum_fraction": 0.5120604475, "num_tokens": 7136, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.855851143290548, "lm_q2_score": 0.7879311956428946, "lm_q1q2_score": 0.6743518146252598}} {"text": "module Monoids where\n\nopen import Library\n\nrecord Monoid {a} : Set (lsuc a) where\n field S : Set a\n ε : S\n _•_ : S → S → S\n lid : ∀{m} → ε • m ≅ m\n rid : ∀{m} → m • ε ≅ m\n ass : ∀{m n o} → (m • n) • o ≅ m • (n • o)\n\n infix 10 _•_\n\nNat+Mon : Monoid \nNat+Mon = record { \n S = ℕ; \n ε = zero; \n _•_ = _+_;\n lid = refl; \n rid = ≡-to-≅ $ +-right-identity _; \n ass = λ{m} → ≡-to-≅ $ +-assoc m _ _}\n\n", "meta": {"hexsha": "5787ae7ce08ba043b2f52b427e10f11763e3581f", "size": 443, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Monoids.agda", "max_stars_repo_name": "jmchapman/Relative-Monads", "max_stars_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-30T01:25:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-13T18:02:18.000Z", "max_issues_repo_path": "Monoids.agda", "max_issues_repo_name": "jmchapman/Relative-Monads", "max_issues_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2019-01-13T13:12:33.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-29T09:50:26.000Z", "max_forks_repo_path": "Monoids.agda", "max_forks_repo_name": "jmchapman/Relative-Monads", "max_forks_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-04T21:33:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-04T21:33:13.000Z", "avg_line_length": 18.4583333333, "max_line_length": 50, "alphanum_fraction": 0.4266365688, "num_tokens": 194, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9263037241905732, "lm_q2_score": 0.727975443004307, "lm_q1q2_score": 0.674326363974172}} {"text": "module Numeral.Natural.Oper where\n\nopen import Numeral.Natural\n\ninfixl 10010 _+_\ninfix 10010 _−₀_ _𝄩_\ninfixl 10020 _⋅_\n-- infix 10020 _/₀_\ninfixl 10030 _^_\n\n-- TODO: It would require a great amount of work, but consider changing the induction to being on the left side instead of the right on _+_ and _⋅_. It will then mirror how lists (a similar structure) uses induction in its definition. The advantage of having it on the right side as it is now is that induction using the full operator name is easier: ℕ-induction(_+_ a) vs ℕ-induction(a ↦ _+_ a b)\n\n-- Addition\n_+_ : ℕ → ℕ → ℕ\nx + 𝟎 = x\nx + 𝐒(y) = 𝐒(x + y)\n{-# BUILTIN NATPLUS _+_ #-}\n\n-- Multiplication\n_⋅_ : ℕ → ℕ → ℕ\n_ ⋅ 𝟎 = 𝟎\nx ⋅ 𝐒(y) = x + (x ⋅ y)\n{-# BUILTIN NATTIMES _⋅_ #-}\n\n-- Exponentiation\n_^_ : ℕ → ℕ → ℕ\nx ^ 𝟎 = 𝐒(𝟎)\nx ^ 𝐒(y) = x ⋅ (x ^ y)\n\n-- Factorial\n_! : ℕ → ℕ\n𝟎 ! = 𝐒(𝟎)\n𝐒(x) ! = 𝐒(x) ⋅ (x !)\n\n-- Distance (Absolute subtraction) (Interval length)\n_𝄩_ : ℕ → ℕ → ℕ\n𝟎 𝄩 𝟎 = 𝟎\n𝐒(x) 𝄩 𝟎 = 𝐒(x)\n𝟎 𝄩 𝐒(x) = 𝐒(x)\n𝐒(x) 𝄩 𝐒(y) = x 𝄩 y\n\n\n\n-- Closed total subtraction (monus)\n_−₀_ : ℕ → ℕ → ℕ\nx −₀ 𝟎 = x\n𝟎 −₀ 𝐒(_) = 𝟎\n𝐒(x) −₀ 𝐒(y) = x −₀ y\n{-# BUILTIN NATMINUS _−₀_ #-}\n\n-- Closed total ceiled division (rounding up)\n{-# TERMINATING #-}\n_⌈/₀⌉_ : ℕ → ℕ → ℕ\n𝟎 ⌈/₀⌉ y = 𝟎\n{-# CATCHALL #-}\nx ⌈/₀⌉ 𝟎 = 𝟎\n{-# CATCHALL #-}\nx ⌈/₀⌉ y = 𝐒((x −₀ y) ⌈/₀⌉ y)\n\n-- Hyperoperation: (a ↑[n]↑ b) where (n=0)⇒(_ ↦ 𝐒) , (n=1)⇒(+) , (n=2)⇒(⋅) , (n=3)⇒(^)\n_↑[_]↑_ : ℕ → ℕ → ℕ → ℕ\n_ ↑[ 0 ]↑ b = 𝐒(b)\na ↑[ 1 ]↑ 0 = a\n_ ↑[ 2 ]↑ 0 = 0\n_ ↑[ 𝐒(𝐒(𝐒(n))) ]↑ 0 = 1\n{-# CATCHALL #-}\na ↑[ 𝐒(n) ]↑ (𝐒(b)) = a ↑[ n ]↑ (a ↑[ n ]↑ b)\n", "meta": {"hexsha": "164d83523a0a18417516f9bc78279691ff24fd52", "size": 1616, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Oper.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Oper.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Oper.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.7647058824, "max_line_length": 397, "alphanum_fraction": 0.5266089109, "num_tokens": 826, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9073122188543453, "lm_q2_score": 0.7431680143008301, "lm_q1q2_score": 0.674285420036864}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.CommRing.Instances.Int where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Algebra.CommRing\nopen import Cubical.Data.Int as Int\n renaming ( ℤ to ℤ ; _+_ to _+ℤ_; _·_ to _·ℤ_; -_ to -ℤ_)\n\nopen CommRingStr using (0r ; 1r ; _+_ ; _·_ ; -_ ; isCommRing)\n\nℤCommRing : CommRing ℓ-zero\nfst ℤCommRing = ℤ\n0r (snd ℤCommRing) = 0\n1r (snd ℤCommRing) = 1\n_+_ (snd ℤCommRing) = _+ℤ_\n_·_ (snd ℤCommRing) = _·ℤ_\n- snd ℤCommRing = -ℤ_\nisCommRing (snd ℤCommRing) = isCommRingℤ\n where\n abstract\n isCommRingℤ : IsCommRing 0 1 _+ℤ_ _·ℤ_ -ℤ_\n isCommRingℤ = makeIsCommRing isSetℤ Int.+Assoc (λ _ → refl)\n -Cancel Int.+Comm Int.·Assoc\n Int.·Rid ·DistR+ Int.·Comm\n", "meta": {"hexsha": "c20c263cb10b5e7cee9b0502525e673a1971d726", "size": 775, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommRing/Instances/Int.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommRing/Instances/Int.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommRing/Instances/Int.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.8076923077, "max_line_length": 63, "alphanum_fraction": 0.64, "num_tokens": 295, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9073122238669025, "lm_q2_score": 0.7431680029241322, "lm_q1q2_score": 0.6742854134398191}} {"text": "\nmodule UniDB.Morph.Star where\n\nopen import UniDB.Spec\n\ninfixl 4 _▻_\ndata Star (Ξ : MOR) : MOR where\n ε : {γ : Dom} → Star Ξ γ γ\n _▻_ : {γ₁ γ₂ γ₃ : Dom} (ξs : Star Ξ γ₁ γ₂) (ξ : Ξ γ₂ γ₃) → Star Ξ γ₁ γ₃\n\nmodule _ {Ξ : MOR} where\n instance\n iIdmStar : Idm (Star Ξ)\n idm {{iIdmStar}} _ = ε\n\n iCompStar : Comp (Star Ξ)\n _⊙_ {{iCompStar}} ξs ε = ξs\n _⊙_ {{iCompStar}} ξs (ζs ▻ ζ) = (ξs ⊙ ζs) ▻ ζ\n\nmodule _ {Ξ : MOR} {{upΞ : Up Ξ}} where\n\n instance\n iUpStar : Up (Star Ξ)\n _↑₁ {{iUpStar}} ε = ε\n _↑₁ {{iUpStar}} (ξs ▻ ξ) = (ξs ↑₁) ▻ (ξ ↑₁)\n _↑_ {{iUpStar}} ξ 0 = ξ\n _↑_ {{iUpStar}} ξ (suc δ⁺) = ξ ↑ δ⁺ ↑₁\n ↑-zero {{iUpStar}} ξ = refl\n ↑-suc {{iUpStar}} ξ δ⁺ = refl\n\n iUpIdmStar : UpIdm (Star Ξ)\n idm-↑₁ {{iUpIdmStar}} = refl\n\n iUpCompStar : UpComp (Star Ξ)\n ⊙-↑₁ {{iUpCompStar}} ξs ε = refl\n ⊙-↑₁ {{iUpCompStar}} ξs (ζs ▻ ζ) =\n cong₂ _▻_ (⊙-↑₁ {Star Ξ} ξs ζs ) (refl {x = ζ ↑₁})\n", "meta": {"hexsha": "33556e85288fc45adcbbac19b6658684bf633f64", "size": 949, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "UniDB/Morph/Star.agda", "max_stars_repo_name": "skeuchel/unidb-agda", "max_stars_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "UniDB/Morph/Star.agda", "max_issues_repo_name": "skeuchel/unidb-agda", "max_issues_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "UniDB/Morph/Star.agda", "max_forks_repo_name": "skeuchel/unidb-agda", "max_forks_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.9736842105, "max_line_length": 73, "alphanum_fraction": 0.5089567966, "num_tokens": 498, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9184802395624259, "lm_q2_score": 0.7341195385342971, "lm_q1q2_score": 0.6742742896204388}} {"text": "module Logic.Predicate.Multi where\n\nopen import Data.Tuple.RaiseTypeᵣ\nopen import Function.Multi\nopen import Function.Multi.Functions\nopen import Numeral.Natural\nopen import Logic.Predicate\nopen import Logic\n\n-- Universal quantification of multiple variables.\n-- Example:\n-- ∀₊(3) P = ∀{x}{y}{z} → P(x)(y)(z)\n∀₊ : (n : ℕ) → ∀{ℓ}{ℓ𝓈}{As : Types{n}(ℓ𝓈)} → (As ⇉ Stmt{ℓ}) → Stmt\n∀₊(n) = quantifier₊(n) ∀ₗ\n\n-- Existential quantification of multiple variables.\n-- Example:\n-- ∃₊(3) P = ∃(x ↦ ∃(y ↦ ∃(z ↦ P(x)(y)(z))))\n∃₊ : (n : ℕ) → ∀{ℓ}{ℓ𝓈}{As : Types{n}(ℓ𝓈)} → (As ⇉ Stmt{ℓ}) → Stmt\n∃₊(n) = quantifier₊(n) ∃\n", "meta": {"hexsha": "7b2ac8cf654da3d667e10f18473bde98c392eca3", "size": 609, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Logic/Predicate/Multi.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Logic/Predicate/Multi.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Logic/Predicate/Multi.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.0, "max_line_length": 66, "alphanum_fraction": 0.6108374384, "num_tokens": 259, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9553191309994467, "lm_q2_score": 0.7057850216484837, "lm_q1q2_score": 0.674249933553655}} {"text": "module Type.Isomorphism where\n\nopen import Functional\nimport Lvl\nopen import Structure.Setoid\nopen import Structure.Function.Domain hiding (inverseₗ ; inverseᵣ)\nopen import Type\n\nprivate variable ℓ ℓ₁ ℓ₂ ℓₑ ℓₑ₁ ℓₑ₂ : Lvl.Level\n\nmodule _\n (A : Type{ℓ₁})\n (B : Type{ℓ₂})\n ⦃ equiv-A : Equiv{ℓₑ₁}(A) ⦄\n ⦃ equiv-B : Equiv{ℓₑ₂}(B) ⦄\n where\n\n record _≅_ : Type{ℓ₁ Lvl.⊔ ℓₑ₁ Lvl.⊔ ℓ₂ Lvl.⊔ ℓₑ₂} where\n field\n left : A ← B\n right : A → B\n ⦃ inverseₗ ⦄ : Inverseₗ(right)(left)\n ⦃ inverseᵣ ⦄ : Inverseᵣ(right)(left)\n", "meta": {"hexsha": "f2367e36e3ec4096350749a7fd1703e20463dcef", "size": 540, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type/Isomorphism.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Type/Isomorphism.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Type/Isomorphism.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.5, "max_line_length": 66, "alphanum_fraction": 0.6388888889, "num_tokens": 244, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9465966747198242, "lm_q2_score": 0.7122321903471563, "lm_q1q2_score": 0.6741966230110351}} {"text": "------------------------------------------------------------------------\n-- Lists\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Equality\n\nmodule List\n {reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where\n\nopen import Prelude\n\nopen import Bijection eq as Bijection using (_↔_)\nopen Derived-definitions-and-properties eq\nopen import Equality.Decision-procedures eq\nimport Equivalence eq as Eq\nopen import Function-universe eq hiding (_∘_)\nopen import H-level eq as H-level\nopen import H-level.Closure eq\nopen import Monad eq hiding (map)\nopen import Nat eq\nopen import Nat.Solver eq\n\nprivate\n variable\n a ℓ : Level\n A B C : Type a\n x y : A\n f : A → B\n n : ℕ\n xs ys zs : List A\n ns : List ℕ\n\n------------------------------------------------------------------------\n-- Some functions\n\n-- The tail of a list. Returns [] if the list is empty.\n\ntail : List A → List A\ntail [] = []\ntail (_ ∷ xs) = xs\n\n-- The function take n returns the first n elements of a list (or the\n-- entire list, if the list does not contain n elements).\n\ntake : ℕ → List A → List A\ntake zero xs = []\ntake (suc n) (x ∷ xs) = x ∷ take n xs\ntake (suc n) xs@[] = xs\n\n-- The function drop n removes the first n elements from a list (or\n-- all elements, if the list does not contain n elements).\n\ndrop : ℕ → List A → List A\ndrop zero xs = xs\ndrop (suc n) (x ∷ xs) = drop n xs\ndrop (suc n) xs@[] = xs\n\n-- Right fold.\n\nfoldr : (A → B → B) → B → List A → B\nfoldr _⊕_ ε [] = ε\nfoldr _⊕_ ε (x ∷ xs) = x ⊕ foldr _⊕_ ε xs\n\n-- Left fold.\n\nfoldl : (B → A → B) → B → List A → B\nfoldl _⊕_ ε [] = ε\nfoldl _⊕_ ε (x ∷ xs) = foldl _⊕_ (ε ⊕ x) xs\n\n-- The length of a list.\n\nlength : List A → ℕ\nlength = foldr (const suc) 0\n\n-- The sum of all the elements in a list of natural numbers.\n\nsum : List ℕ → ℕ\nsum = foldr _+_ 0\n\n-- Appends two lists.\n\ninfixr 5 _++_\n\n_++_ : List A → List A → List A\nxs ++ ys = foldr _∷_ ys xs\n\n-- Maps a function over a list.\n\nmap : (A → B) → List A → List B\nmap f = foldr (λ x ys → f x ∷ ys) []\n\n-- Concatenates a list of lists.\n\nconcat : List (List A) → List A\nconcat = foldr _++_ []\n\n-- \"Zips\" two lists, using the given function to combine elementsw.\n\nzip-with : (A → B → C) → List A → List B → List C\nzip-with f [] _ = []\nzip-with f _ [] = []\nzip-with f (x ∷ xs) (y ∷ ys) = f x y ∷ zip-with f xs ys\n\n-- \"Zips\" two lists.\n\nzip : List A → List B → List (A × B)\nzip = zip-with _,_\n\n-- Reverses a list.\n\nreverse : List A → List A\nreverse = foldl (λ xs x → x ∷ xs) []\n\n-- Replicates the given value the given number of times.\n\nreplicate : ℕ → A → List A\nreplicate zero x = []\nreplicate (suc n) x = x ∷ replicate n x\n\n-- A filter function.\n\nfilter : (A → Bool) → List A → List A\nfilter p = foldr (λ x xs → if p x then x ∷ xs else xs) []\n\n-- Finds the element at the given position.\n\nindex : (xs : List A) → Fin (length xs) → A\nindex [] ()\nindex (x ∷ xs) fzero = x\nindex (x ∷ xs) (fsuc i) = index xs i\n\n-- A lookup function.\n\nlookup : (A → A → Bool) → A → List (A × B) → Maybe B\nlookup _≟_ x [] = nothing\nlookup _≟_ x ((y , z) ∷ ps) =\n if x ≟ y then just z else lookup _≟_ x ps\n\n-- The list nats-< consists of the first n natural numbers in\n-- strictly descending order.\n\nnats-< : ℕ → List ℕ\nnats-< zero = []\nnats-< (suc n) = n ∷ nats-< n\n\n-- A list that includes every tail of the given list (including the\n-- list itself) exactly once. Longer tails precede shorter ones.\n\ntails : List A → List (List A)\ntails [] = [] ∷ []\ntails xxs@(_ ∷ xs) = xxs ∷ tails xs\n\n------------------------------------------------------------------------\n-- Some properties\n\n-- If you take the first n elements from xs and append what you get if\n-- you drop the first n elements from xs, then you get xs (even if n\n-- is larger than the length of xs).\n\ntake++drop : ∀ n → take n xs ++ drop n xs ≡ xs\ntake++drop zero = refl _\ntake++drop {xs = []} (suc n) = refl _\ntake++drop {xs = x ∷ xs} (suc n) = cong (x ∷_) (take++drop n)\n\n-- The map function commutes with take n.\n\nmap-take : map f (take n xs) ≡ take n (map f xs)\nmap-take {n = zero} = refl _\nmap-take {n = suc n} {xs = []} = refl _\nmap-take {n = suc n} {xs = x ∷ xs} = cong (_ ∷_) map-take\n\n-- The map function commutes with drop n.\n\nmap-drop : ∀ n → map f (drop n xs) ≡ drop n (map f xs)\nmap-drop zero = refl _\nmap-drop {xs = []} (suc n) = refl _\nmap-drop {xs = x ∷ xs} (suc n) = map-drop n\n\n-- The function foldr _∷_ [] is pointwise equal to the identity\n-- function.\n\nfoldr-∷-[] : (xs : List A) → foldr _∷_ [] xs ≡ xs\nfoldr-∷-[] [] = refl _\nfoldr-∷-[] (x ∷ xs) = cong (x ∷_) (foldr-∷-[] xs)\n\n-- The empty list is a right identity for the append function.\n\n++-right-identity : (xs : List A) → xs ++ [] ≡ xs\n++-right-identity [] = refl _\n++-right-identity (x ∷ xs) = cong (x ∷_) (++-right-identity xs)\n\n-- The append function is associative.\n\n++-associative : (xs ys zs : List A) →\n xs ++ (ys ++ zs) ≡ (xs ++ ys) ++ zs\n++-associative [] ys zs = refl _\n++-associative (x ∷ xs) ys zs = cong (x ∷_) (++-associative xs ys zs)\n\n-- The map function commutes with _++_.\n\nmap-++ : (f : A → B) (xs ys : List A) →\n map f (xs ++ ys) ≡ map f xs ++ map f ys\nmap-++ f [] ys = refl _\nmap-++ f (x ∷ xs) ys = cong (f x ∷_) (map-++ f xs ys)\n\n-- The concat function commutes with _++_.\n\nconcat-++ : (xss yss : List (List A)) →\n concat (xss ++ yss) ≡ concat xss ++ concat yss\nconcat-++ [] yss = refl _\nconcat-++ (xs ∷ xss) yss =\n concat ((xs ∷ xss) ++ yss) ≡⟨⟩\n xs ++ concat (xss ++ yss) ≡⟨ cong (xs ++_) (concat-++ xss yss) ⟩\n xs ++ (concat xss ++ concat yss) ≡⟨ ++-associative xs _ _ ⟩\n (xs ++ concat xss) ++ concat yss ≡⟨ refl _ ⟩∎\n concat (xs ∷ xss) ++ concat yss ∎\n\n-- A lemma relating foldr and _++_.\n\nfoldr-++ :\n {c : A → B → B} {n : B} →\n ∀ xs → foldr c n (xs ++ ys) ≡ foldr c (foldr c n ys) xs\nfoldr-++ [] = refl _\nfoldr-++ {ys = ys} {c = c} {n = n} (x ∷ xs) =\n foldr c n (x ∷ xs ++ ys) ≡⟨⟩\n c x (foldr c n (xs ++ ys)) ≡⟨ cong (c x) (foldr-++ xs) ⟩\n c x (foldr c (foldr c n ys) xs) ≡⟨⟩\n foldr c (foldr c n ys) (x ∷ xs) ∎\n\n-- A fusion lemma for foldr and map.\n\nfoldr∘map :\n (_⊕_ : B → C → C) (ε : C) (f : A → B) (xs : List A) →\n (foldr _⊕_ ε ∘ map f) xs ≡ foldr (_⊕_ ∘ f) ε xs\nfoldr∘map _⊕_ ε f [] = ε ∎\nfoldr∘map _⊕_ ε f (x ∷ xs) = cong (f x ⊕_) (foldr∘map _⊕_ ε f xs)\n\n-- A fusion lemma for length and map.\n\nlength∘map :\n (f : A → B) (xs : List A) →\n (length ∘ map f) xs ≡ length xs\nlength∘map = foldr∘map _ _\n\n-- A lemma relating index, map and length∘map.\n\nindex∘map :\n ∀ xs {i} →\n index (map f xs) i ≡\n f (index xs (subst Fin (length∘map f xs) i))\nindex∘map {f = f} (x ∷ xs) {i} =\n index (f x ∷ map f xs) i ≡⟨ lemma i ⟩\n f (index (x ∷ xs) (subst (λ n → ⊤ ⊎ Fin n) p i)) ≡⟨⟩\n f (index (x ∷ xs) (subst (Fin ∘ suc) p i)) ≡⟨ cong (f ∘ index (_ ∷ xs)) (subst-∘ Fin suc _) ⟩\n f (index (x ∷ xs) (subst Fin (cong suc p) i)) ≡⟨⟩\n f (index (x ∷ xs) (subst Fin (length∘map f (x ∷ xs)) i)) ∎\n where\n p = length∘map f xs\n\n lemma :\n ∀ i →\n index (f x ∷ map f xs) i ≡\n f (index (x ∷ xs) (subst (λ n → ⊤ ⊎ Fin n) p i))\n lemma fzero =\n index (f x ∷ map f xs) fzero ≡⟨⟩\n f x ≡⟨⟩\n f (index (x ∷ xs) fzero) ≡⟨⟩\n f (index (x ∷ xs) (inj₁ (subst (λ _ → ⊤) p tt))) ≡⟨ cong (f ∘ index (_ ∷ xs)) $ sym $ push-subst-inj₁ _ Fin ⟩∎\n f (index (x ∷ xs) (subst (λ n → ⊤ ⊎ Fin n) p fzero)) ∎\n lemma (fsuc i) =\n index (f x ∷ map f xs) (fsuc i) ≡⟨⟩\n index (map f xs) i ≡⟨ index∘map xs ⟩\n f (index xs (subst Fin p i)) ≡⟨⟩\n f (index (x ∷ xs) (fsuc (subst Fin p i))) ≡⟨ cong (f ∘ index (_ ∷ xs)) $ sym $ push-subst-inj₂ _ Fin ⟩∎\n f (index (x ∷ xs) (subst (λ n → ⊤ ⊎ Fin n) p (fsuc i))) ∎\n\n-- The length function is homomorphic with respect to _++_/_+_.\n\nlength-++ : ∀ xs → length (xs ++ ys) ≡ length xs + length ys\nlength-++ [] = refl _\nlength-++ (_ ∷ xs) = cong suc (length-++ xs)\n\n-- The sum function is homomorphic with respect to _++_/_+_.\n\nsum-++ : ∀ ms → sum (ms ++ ns) ≡ sum ms + sum ns\nsum-++ [] = refl _\nsum-++ {ns = ns} (m ∷ ms) =\n sum (m ∷ ms ++ ns) ≡⟨⟩\n m + sum (ms ++ ns) ≡⟨ cong (m +_) $ sum-++ ms ⟩\n m + (sum ms + sum ns) ≡⟨ +-assoc m ⟩\n (m + sum ms) + sum ns ≡⟨⟩\n sum (m ∷ ms) + sum ns ∎\n\n-- Some lemmas related to reverse.\n\n++-reverse : ∀ xs → reverse xs ++ ys ≡ foldl (flip _∷_) ys xs\n++-reverse xs = lemma xs\n where\n lemma :\n ∀ xs →\n foldl (flip _∷_) ys xs ++ zs ≡\n foldl (flip _∷_) (ys ++ zs) xs\n lemma [] = refl _\n lemma {ys = ys} {zs = zs} (x ∷ xs) =\n foldl (flip _∷_) ys (x ∷ xs) ++ zs ≡⟨⟩\n foldl (flip _∷_) (x ∷ ys) xs ++ zs ≡⟨ lemma xs ⟩\n foldl (flip _∷_) (x ∷ ys ++ zs) xs ≡⟨⟩\n foldl (flip _∷_) (ys ++ zs) (x ∷ xs) ∎\n\nreverse-∷ : ∀ xs → reverse (x ∷ xs) ≡ reverse xs ++ x ∷ []\nreverse-∷ {x = x} xs =\n reverse (x ∷ xs) ≡⟨⟩\n foldl (flip _∷_) (x ∷ []) xs ≡⟨ sym $ ++-reverse xs ⟩∎\n reverse xs ++ x ∷ [] ∎\n\nreverse-++ : ∀ xs → reverse (xs ++ ys) ≡ reverse ys ++ reverse xs\nreverse-++ {ys = ys} [] =\n reverse ys ≡⟨ sym $ ++-right-identity _ ⟩∎\n reverse ys ++ [] ∎\nreverse-++ {ys = ys} (x ∷ xs) =\n reverse (x ∷ xs ++ ys) ≡⟨ reverse-∷ (xs ++ _) ⟩\n reverse (xs ++ ys) ++ x ∷ [] ≡⟨ cong (_++ _) $ reverse-++ xs ⟩\n (reverse ys ++ reverse xs) ++ x ∷ [] ≡⟨ sym $ ++-associative (reverse ys) _ _ ⟩\n reverse ys ++ (reverse xs ++ x ∷ []) ≡⟨ cong (reverse ys ++_) $ sym $ reverse-∷ xs ⟩∎\n reverse ys ++ reverse (x ∷ xs) ∎\n\nreverse-reverse : (xs : List A) → reverse (reverse xs) ≡ xs\nreverse-reverse [] = refl _\nreverse-reverse (x ∷ xs) =\n reverse (reverse (x ∷ xs)) ≡⟨ cong reverse (reverse-∷ xs) ⟩\n reverse (reverse xs ++ x ∷ []) ≡⟨ reverse-++ (reverse xs) ⟩\n reverse (x ∷ []) ++ reverse (reverse xs) ≡⟨⟩\n x ∷ reverse (reverse xs) ≡⟨ cong (x ∷_) (reverse-reverse xs) ⟩∎\n x ∷ xs ∎\n\nmap-reverse : ∀ xs → map f (reverse xs) ≡ reverse (map f xs)\nmap-reverse [] = refl _\nmap-reverse {f = f} (x ∷ xs) =\n map f (reverse (x ∷ xs)) ≡⟨ cong (map f) $ reverse-∷ xs ⟩\n map f (reverse xs ++ x ∷ []) ≡⟨ map-++ _ (reverse xs) _ ⟩\n map f (reverse xs) ++ f x ∷ [] ≡⟨ cong (_++ _) $ map-reverse xs ⟩\n reverse (map f xs) ++ f x ∷ [] ≡⟨ sym $ reverse-∷ (map f xs) ⟩\n reverse (f x ∷ map f xs) ≡⟨⟩\n reverse (map f (x ∷ xs)) ∎\n\nfoldr-reverse :\n {c : A → B → B} {n : B} →\n ∀ xs → foldr c n (reverse xs) ≡ foldl (flip c) n xs\nfoldr-reverse [] = refl _\nfoldr-reverse {c = c} {n = n} (x ∷ xs) =\n foldr c n (reverse (x ∷ xs)) ≡⟨ cong (foldr c n) (reverse-++ {ys = xs} (x ∷ [])) ⟩\n foldr c n (reverse xs ++ x ∷ []) ≡⟨ foldr-++ (reverse xs) ⟩\n foldr c (c x n) (reverse xs) ≡⟨ foldr-reverse xs ⟩\n foldl (flip c) (c x n) xs ≡⟨⟩\n foldl (flip c) n (x ∷ xs) ∎\n\nfoldl-reverse :\n {c : B → A → B} {n : B} →\n ∀ xs → foldl c n (reverse xs) ≡ foldr (flip c) n xs\nfoldl-reverse {c = c} {n = n} xs =\n foldl c n (reverse xs) ≡⟨ sym (foldr-reverse (reverse xs)) ⟩\n foldr (flip c) n (reverse (reverse xs)) ≡⟨ cong (foldr (flip c) n) (reverse-reverse xs) ⟩∎\n foldr (flip c) n xs ∎\n\nlength-reverse : (xs : List A) → length (reverse xs) ≡ length xs\nlength-reverse [] = refl _\nlength-reverse (x ∷ xs) =\n length (reverse (x ∷ xs)) ≡⟨ cong length (reverse-∷ xs) ⟩\n length (reverse xs ++ x ∷ []) ≡⟨ length-++ (reverse xs) ⟩\n length (reverse xs) + 1 ≡⟨ cong (_+ 1) (length-reverse xs) ⟩\n length xs + 1 ≡⟨ +-comm (length xs) ⟩∎\n length (x ∷ xs) ∎\n\nsum-reverse : ∀ ns → sum (reverse ns) ≡ sum ns\nsum-reverse [] = refl _\nsum-reverse (n ∷ ns) =\n sum (reverse (n ∷ ns)) ≡⟨ cong sum (reverse-∷ ns) ⟩\n sum (reverse ns ++ n ∷ []) ≡⟨ sum-++ (reverse ns) ⟩\n sum (reverse ns) + sum (n ∷ []) ≡⟨ cong₂ _+_ (sum-reverse ns) +-right-identity ⟩\n sum ns + n ≡⟨ +-comm (sum ns) ⟩∎\n sum (n ∷ ns) ∎\n\n-- The functions filter and map commute (kind of).\n\nfilter∘map :\n (p : B → Bool) (f : A → B) (xs : List A) →\n (filter p ∘ map f) xs ≡ (map f ∘ filter (p ∘ f)) xs\nfilter∘map p f [] = refl _\nfilter∘map p f (x ∷ xs) with p (f x)\n... | true = cong (_ ∷_) (filter∘map p f xs)\n... | false = filter∘map p f xs\n\n-- The length of replicate n x is n.\n\nlength-replicate : ∀ n → length (replicate n x) ≡ n\nlength-replicate zero = refl _\nlength-replicate {x = x} (suc n) =\n length (replicate (suc n) x) ≡⟨⟩\n suc (length (replicate n x)) ≡⟨ cong suc $ length-replicate n ⟩∎\n suc n ∎\n\n-- The sum of replicate m n is m * n.\n\nsum-replicate : ∀ m → sum (replicate m n) ≡ m * n\nsum-replicate zero = refl _\nsum-replicate {n = n} (suc m) =\n sum (replicate (suc m) n) ≡⟨⟩\n n + sum (replicate m n) ≡⟨ cong (n +_) $ sum-replicate m ⟩\n n + m * n ≡⟨⟩\n suc m * n ∎\n\n-- The length of nats-< n is n.\n\nlength∘nats-< : ∀ n → length (nats-< n) ≡ n\nlength∘nats-< zero = 0 ∎\nlength∘nats-< (suc n) = cong suc (length∘nats-< n)\n\n-- The sum of nats-< n can be expressed without referring to lists.\n\nsum-nats-< : ∀ n → sum (nats-< n) ≡ ⌊ n * pred n /2⌋\nsum-nats-< zero = refl _\nsum-nats-< (suc zero) = refl _\nsum-nats-< (suc (suc n)) =\n sum (suc n ∷ nats-< (suc n)) ≡⟨⟩\n suc n + sum (nats-< (suc n)) ≡⟨ cong (suc n +_) (sum-nats-< (suc n)) ⟩\n suc n + ⌊ suc n * n /2⌋ ≡⟨ sym $ ⌊2*+/2⌋≡ (suc n) ⟩\n ⌊ 2 * suc n + suc n * n /2⌋ ≡⟨ cong ⌊_/2⌋ (solve 1 (λ n → con 2 :* (con 1 :+ n) :+ (con 1 :+ n) :* n :=\n con 1 :+ n :+ (con 1 :+ n :+ n :* (con 1 :+ n)))\n (refl _) n) ⟩\n ⌊ suc n + (suc n + n * suc n) /2⌋ ≡⟨⟩\n ⌊ suc (suc n) * suc n /2⌋ ∎\n\n-- If xs ++ ys is equal to [], then both lists are.\n\n++≡[]→≡[]×≡[] : ∀ xs → xs ++ ys ≡ [] → xs ≡ [] × ys ≡ []\n++≡[]→≡[]×≡[] {ys = []} [] _ = refl _ , refl _\n++≡[]→≡[]×≡[] {ys = _ ∷ _} [] ∷≡[] = ⊥-elim (List.[]≢∷ (sym ∷≡[]))\n++≡[]→≡[]×≡[] (_ ∷ _) ∷≡[] = ⊥-elim (List.[]≢∷ (sym ∷≡[]))\n\n-- Empty lists are not equal to non-empty lists.\n\n[]≢++∷ : ∀ xs → [] ≢ xs ++ y ∷ ys\n[]≢++∷ {y = y} {ys = ys} xs =\n [] ≡ xs ++ y ∷ ys ↝⟨ sym ∘ proj₂ ∘ ++≡[]→≡[]×≡[] xs ∘ sym ⟩\n [] ≡ y ∷ ys ↝⟨ List.[]≢∷ ⟩□\n ⊥ □\n\n------------------------------------------------------------------------\n-- The list monad\n\ninstance\n\n -- The list monad.\n\n raw-monad : Raw-monad (List {a = ℓ})\n Raw-monad.return raw-monad x = x ∷ []\n Raw-monad._>>=_ raw-monad xs f = concat (map f xs)\n\n monad : Monad (List {a = ℓ})\n Monad.raw-monad monad = raw-monad\n Monad.left-identity monad x f = foldr-∷-[] (f x)\n Monad.right-identity monad xs = lemma xs\n where\n lemma : ∀ xs → concat (map (_∷ []) xs) ≡ xs\n lemma [] = refl _\n lemma (x ∷ xs) =\n concat (map (_∷ []) (x ∷ xs)) ≡⟨⟩\n x ∷ concat (map (_∷ []) xs) ≡⟨ cong (x ∷_) (lemma xs) ⟩∎\n x ∷ xs ∎\n Monad.associativity monad xs f g = lemma xs\n where\n lemma : ∀ xs → concat (map (concat ∘ map g ∘ f) xs) ≡\n concat (map g (concat (map f xs)))\n lemma [] = refl _\n lemma (x ∷ xs) =\n concat (map (concat ∘ map g ∘ f) (x ∷ xs)) ≡⟨⟩\n concat (map g (f x)) ++ concat (map (concat ∘ map g ∘ f) xs) ≡⟨ cong (concat (map g (f x)) ++_) (lemma xs) ⟩\n concat (map g (f x)) ++ concat (map g (concat (map f xs))) ≡⟨ sym $ concat-++ (map g (f x)) _ ⟩\n concat (map g (f x) ++ map g (concat (map f xs))) ≡⟨ cong concat (sym $ map-++ g (f x) _) ⟩\n concat (map g (f x ++ concat (map f xs))) ≡⟨ refl _ ⟩∎\n concat (map g (concat (map f (x ∷ xs)))) ∎\n\n------------------------------------------------------------------------\n-- Some isomorphisms\n\n-- An unfolding lemma for List.\n\nList↔Maybe[×List] : List A ↔ Maybe (A × List A)\nList↔Maybe[×List] = record\n { surjection = record\n { logical-equivalence = record\n { to = λ { [] → inj₁ tt; (x ∷ xs) → inj₂ (x , xs) }\n ; from = [ (λ _ → []) , uncurry _∷_ ]\n }\n ; right-inverse-of = [ (λ _ → refl _) , (λ _ → refl _) ]\n }\n ; left-inverse-of = λ { [] → refl _; (_ ∷ _) → refl _ }\n }\n\n-- Some isomorphisms related to list equality.\n\n[]≡[]↔⊤ : [] ≡ ([] ⦂ List A) ↔ ⊤\n[]≡[]↔⊤ =\n [] ≡ [] ↔⟨ inverse $ Eq.≃-≡ (Eq.↔⇒≃ List↔Maybe[×List]) ⟩\n nothing ≡ nothing ↝⟨ inverse Bijection.≡↔inj₁≡inj₁ ⟩\n tt ≡ tt ↝⟨ tt≡tt↔⊤ ⟩□\n ⊤ □\n\n[]≡∷↔⊥ : [] ≡ x ∷ xs ↔ ⊥ {ℓ = ℓ}\n[]≡∷↔⊥ {x = x} {xs = xs} =\n [] ≡ x ∷ xs ↔⟨ inverse $ Eq.≃-≡ (Eq.↔⇒≃ List↔Maybe[×List]) ⟩\n nothing ≡ just (x , xs) ↝⟨ Bijection.≡↔⊎ ⟩\n ⊥ ↝⟨ ⊥↔⊥ ⟩□\n ⊥ □\n\n∷≡[]↔⊥ : x ∷ xs ≡ [] ↔ ⊥ {ℓ = ℓ}\n∷≡[]↔⊥ {x = x} {xs = xs} =\n x ∷ xs ≡ [] ↝⟨ ≡-comm ⟩\n [] ≡ x ∷ xs ↝⟨ []≡∷↔⊥ ⟩□\n ⊥ □\n\n∷≡∷↔≡×≡ : x ∷ xs ≡ y ∷ ys ↔ x ≡ y × xs ≡ ys\n∷≡∷↔≡×≡ {x = x} {xs = xs} {y = y} {ys = ys} =\n x ∷ xs ≡ y ∷ ys ↔⟨ inverse $ Eq.≃-≡ (Eq.↔⇒≃ List↔Maybe[×List]) ⟩\n just (x , xs) ≡ just (y , ys) ↝⟨ inverse Bijection.≡↔inj₂≡inj₂ ⟩\n (x , xs) ≡ (y , ys) ↝⟨ inverse ≡×≡↔≡ ⟩□\n x ≡ y × xs ≡ ys □\n\n------------------------------------------------------------------------\n-- H-levels\n\n-- If A is inhabited, then List A is not a proposition.\n\n¬-List-propositional : A → ¬ Is-proposition (List A)\n¬-List-propositional x h = List.[]≢∷ $ h [] (x ∷ [])\n\n-- H-levels greater than or equal to two are closed under List.\n\nH-level-List : ∀ n → H-level (2 + n) A → H-level (2 + n) (List A)\nH-level-List n _ {[]} {[]} =\n $⟨ ⊤-contractible ⟩\n Contractible ⊤ ↝⟨ H-level-cong _ 0 (inverse []≡[]↔⊤) ⟩\n Contractible ([] ≡ []) ↝⟨ H-level.mono (zero≤ (1 + n)) ⟩□\n H-level (1 + n) ([] ≡ []) □\n\nH-level-List n h {[]} {y ∷ ys} =\n $⟨ ⊥-propositional ⟩\n Is-proposition ⊥₀ ↝⟨ H-level-cong _ 1 (inverse []≡∷↔⊥) ⟩\n Is-proposition ([] ≡ y ∷ ys) ↝⟨ H-level.mono (suc≤suc (zero≤ n)) ⟩□\n H-level (1 + n) ([] ≡ y ∷ ys) □\n\nH-level-List n h {x ∷ xs} {[]} =\n $⟨ ⊥-propositional ⟩\n Is-proposition ⊥₀ ↝⟨ H-level-cong _ 1 (inverse ∷≡[]↔⊥) ⟩\n Is-proposition (x ∷ xs ≡ []) ↝⟨ H-level.mono (suc≤suc (zero≤ n)) ⟩□\n H-level (1 + n) (x ∷ xs ≡ []) □\n\nH-level-List n h {x ∷ xs} {y ∷ ys} =\n H-level-cong _ (1 + n) (inverse ∷≡∷↔≡×≡)\n (×-closure (1 + n) h (H-level-List n h))\n", "meta": {"hexsha": "449106820ce15260e69dd6df0c2d6218f11ddef0", "size": 19303, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/List.agda", "max_stars_repo_name": "nad/equality", "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_issues_repo_path": "src/List.agda", "max_issues_repo_name": "nad/equality", "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/List.agda", "max_forks_repo_name": "nad/equality", "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.2859680284, "max_line_length": 122, "alphanum_fraction": 0.4643319691, "num_tokens": 7564, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619177503205, "lm_q2_score": 0.8175744673038222, "lm_q1q2_score": 0.674059013217006}} {"text": "module reductionSystems1 where\n\n\ndata ℕ : Set where \n Z : ℕ \n S : ℕ -> ℕ\n\n_+_ : ℕ -> ℕ -> ℕ\nn + Z = n\nn + S m = S (n + m)\n\n_*_ : ℕ -> ℕ -> ℕ\nn * Z = Z\nn * S m = (n * m) + n\n\n\n{-\n{-# BUILTIN NATURAL ℕ #-}\n{-# BUILTIN ZERO Z #-}\n{-# BUILTIN SUC S #-}\n{-# BUILTIN NATPLUS _+_ #-}\n{-# BUILTIN NATTIMES _*_ #-}\n-}\n", "meta": {"hexsha": "926028ea6a62dfd06c1efff264f60fed042511e4", "size": 329, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "tests/covered/reductionSystems1.agda", "max_stars_repo_name": "andrejtokarcik/agda-semantics", "max_stars_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-08-10T15:33:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-06T17:24:25.000Z", "max_issues_repo_path": "tests/covered/reductionSystems1.agda", "max_issues_repo_name": "andrejtokarcik/agda-semantics", "max_issues_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/covered/reductionSystems1.agda", "max_forks_repo_name": "andrejtokarcik/agda-semantics", "max_forks_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 13.7083333333, "max_line_length": 30, "alphanum_fraction": 0.4407294833, "num_tokens": 128, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9032942067038785, "lm_q2_score": 0.7461389930307512, "lm_q1q2_score": 0.6739830298005431}} {"text": "-- intrinsically-typed λ-calculus\n\nmodule IntrinsicallyTypedLC where\n\nopen import Data.List\nopen import Data.List.Relation.Unary.All\nopen import Data.Unit\nopen import Data.Nat\n\n-- definitions\n\ndata Ty : Set where\n Tunit : Ty\n Tfun : Ty → Ty → Ty\n\nTEnv = List Ty\n\ndata _∈_ : Ty → TEnv → Set where\n here : ∀ {t Φ} → t ∈ (t ∷ Φ)\n there : ∀ {t t' Φ} → t ∈ Φ → t ∈ (t' ∷ Φ)\n\ndata Exp : TEnv → Ty → Set where\n Var : ∀ {Φ t} → (x : t ∈ Φ) → Exp Φ t\n Abs : ∀ {Φ t t'} → Exp (t ∷ Φ) t' → Exp Φ (Tfun t t')\n App : ∀ {Φ t t'} → Exp Φ (Tfun t t') → Exp Φ t → Exp Φ t'\n\n-- big-step semantics\n\nVal : Ty → Set\nVal Tunit = ⊤\nVal (Tfun t t₁) = Val t → Val t₁\n\naccess : ∀ {t Φ} → t ∈ Φ → All Val Φ → Val t\naccess here (px ∷ ρ) = px\naccess (there x) (px ∷ ρ) = access x ρ\n\neval : ∀ {Φ t} → Exp Φ t → All Val Φ → Val t\neval (Var x) ρ = access x ρ\neval (Abs e) ρ = λ x → eval e (x ∷ ρ)\neval (App e e₁) ρ = (eval e ρ) (eval e₁ ρ)\n", "meta": {"hexsha": "480791f2155ffa24680d8d47635b2f8f149745d6", "size": 915, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/lc/IntrinsicallyTypedLC.agda", "max_stars_repo_name": "kcaliban/ldlc", "max_stars_repo_head_hexsha": "a87fb6402639c3d2bb393cc5466426c28e7a0398", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/lc/IntrinsicallyTypedLC.agda", "max_issues_repo_name": "kcaliban/ldlc", "max_issues_repo_head_hexsha": "a87fb6402639c3d2bb393cc5466426c28e7a0398", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/lc/IntrinsicallyTypedLC.agda", "max_forks_repo_name": "kcaliban/ldlc", "max_forks_repo_head_hexsha": "a87fb6402639c3d2bb393cc5466426c28e7a0398", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-14T17:52:29.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-14T17:52:29.000Z", "avg_line_length": 22.3170731707, "max_line_length": 59, "alphanum_fraction": 0.5595628415, "num_tokens": 396, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9219218284193597, "lm_q2_score": 0.7310585727705127, "lm_q1q2_score": 0.6739788560902386}} {"text": "module Data.HVec where\n\nopen import Data.Fin using (Fin; zero; suc)\nopen import Data.Nat using (ℕ; zero; suc; _+_)\n\nopen import Function using (const)\n\nopen import Data.Vec as V using (Vec; []; _∷_; _[_]≔_)\n\nopen import Level as L using (Level; suc)\n\n\n-- ------------------------------------------------------------------------\n-- Hetrogenous Vectors\n\ninfixr 5 _∷_\n\ndata HVec { ℓ } : ( n : ℕ ) → Vec (Set ℓ) n → Set ℓ where\n [] : HVec 0 []\n _∷_ : ∀ { n } { A : Set ℓ } { As }\n → A\n → HVec n As\n -- ----------------------\n → HVec (1 + n) (A ∷ As) \n\n-- -- ------------------------------------------------------------------------\n\nprivate\n variable\n ℓ : Level\n A : Set ℓ\n n : ℕ\n As : Vec (Set ℓ) n\n\n\nlength : HVec n As → ℕ\nlength { n = n } _ = n\n\nhead : HVec (1 + n) As → (V.head As)\nhead (x ∷ xs) = x\n\ntail : HVec (1 + n) As → HVec n (V.tail As)\ntail (x ∷ xs) = xs\n\nlookup : HVec n As → (i : Fin n) → (V.lookup As i)\nlookup (x ∷ xs) zero = x\nlookup (x ∷ xs) (suc i) = lookup xs i\n\ninsert : HVec n As → (i : Fin (1 + n)) → A → HVec (1 + n) (V.insert As i A)\ninsert xs zero v = v ∷ xs\ninsert (x ∷ xs) (suc i) v = x ∷ insert xs i v\n\nremove : HVec (1 + n) As → (i : Fin (1 + n)) → HVec n (V.remove As i)\nremove (x ∷ xs) zero = xs\nremove (x₁ ∷ x₂ ∷ xs) (suc i) = x₁ ∷ remove (x₂ ∷ xs) i\n\nupdateAt : ∀ { ℓ n } { A : Set ℓ } { As : Vec (Set ℓ) n } (i : Fin n) → (V.lookup As i → A) → HVec n As → HVec n (As [ i ]≔ A)\nupdateAt zero f (x ∷ xs) = f x ∷ xs\nupdateAt (suc i) f (x ∷ xs) = x ∷ updateAt i f xs\n\ninfixl 6 _[_]$=_\n\n_[_]$=_ : HVec n As → (i : Fin n) → (V.lookup As i → A) → HVec n (As [ i ]≔ A)\nxs [ i ]$= f = updateAt i f xs\n\ninfixl 6 _[_]&=_\n\n_[_]&=_ : HVec n As → (i : Fin n) → A → HVec n (As [ i ]≔ A)\nxs [ i ]&= y = xs [ i ]$= const y\n\n-- -- ------------------------------------------------------------------------\n\n", "meta": {"hexsha": "c1f74ba2ce75b170a72564863c2ddb87f382f532", "size": 1845, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Data/HVec.agda", "max_stars_repo_name": "johnyob/agda-sigma", "max_stars_repo_head_hexsha": "bb895fa8a3ccbefbd2c4a135c79744ba06895be7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Data/HVec.agda", "max_issues_repo_name": "johnyob/agda-sigma", "max_issues_repo_head_hexsha": "bb895fa8a3ccbefbd2c4a135c79744ba06895be7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Data/HVec.agda", "max_forks_repo_name": "johnyob/agda-sigma", "max_forks_repo_head_hexsha": "bb895fa8a3ccbefbd2c4a135c79744ba06895be7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.2739726027, "max_line_length": 126, "alphanum_fraction": 0.4444444444, "num_tokens": 705, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8267118111485245, "lm_q2_score": 0.8152324915965392, "lm_q1q2_score": 0.6739623296348992}} {"text": "\nmodule Issue450 where\n\nopen import Common.Level\nopen import Common.Coinduction\n\ndata _≡_ {A : Set}(x : A) : A → Set where\n refl : x ≡ x\n\ndata Wrap (A : Set) : Set where\n con : A -> Wrap A\n\nout : forall {A} -> Wrap A -> A\nout (con x) = x\n\nout' : forall {A} -> ∞ (Wrap A) -> A\nout' y = out (♭ y)\n\ninn : forall {A} -> A -> ∞ (Wrap A)\ninn y = ♯ (con y)\n\nprf : (A : Set)(x : A) → out' (inn x) ≡ x\nprf A x = refl\n\ntest : forall {A : Set}{x : A} -> out (con x) ≡ x\ntest = refl\n\n-- these work\ntest1 : forall {A}{x : A} -> out' (inn x) ≡ x\ntest1 {A} {x} = test\n\ntest2 : forall {A}{x : A} -> out' (inn x) ≡ x\ntest2 {A} {x} = test {A}\n\n-- but the following ones won't typecheck\n\ntest3 : forall {A}{x : A} -> out' (inn x) ≡ x\ntest3 {A} {x} = test {A} {x}\n\ntest4 : forall {A}{x : A} -> out' (inn x) ≡ x\ntest4 {A} {x} = refl\n", "meta": {"hexsha": "731d4f62d17502b2854eea6208f48efb4f79585c", "size": 815, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue450.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/Succeed/Issue450.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z", "max_forks_repo_path": "test/Succeed/Issue450.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 19.4047619048, "max_line_length": 49, "alphanum_fraction": 0.5263803681, "num_tokens": 346, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278633625322, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6737193509340668}} {"text": "------------------------------------------------------------------------------\n-- A proof that was rejected using the --without-K option\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule ListsSL where\n\nopen import Data.List\nopen import Data.Nat\nopen import Data.Nat.Properties\nopen import Data.Product\nopen import Relation.Binary.PropositionalEquality\n\nopen import Relation.Binary\nmodule NDTO = DecTotalOrder ≤-decTotalOrder\n\n------------------------------------------------------------------------------\n\nLTC : {A : Set} → List A → List A → Set\nLTC xs ys = ∃ (λ x → ys ≡ x ∷ xs)\n\nLTL : {A : Set} → List A → List A → Set\nLTL xs ys = (length xs) < (length ys)\n\nhelper : {A : Set}(y : A)(xs : List A) → (length xs) < (length (y ∷ xs))\nhelper y [] = s≤s z≤n\nhelper y (x ∷ xs) = s≤s NDTO.refl\n\n-- 25 April 2014. The proof is accepted using Cockx's --without-K\n-- implementation.\nfoo : {A : Set}(xs ys : List A) → LTC xs ys → LTL xs ys\nfoo xs .(x ∷ xs) (x , refl) = helper x xs\n\nfoo' : {A : Set}(xs ys : List A) → LTC xs ys → LTL xs ys\nfoo' xs ys (x , h) =\n subst (λ ys' → length xs < length ys') (sym h) (helper x xs)\n", "meta": {"hexsha": "780070022417806ca1abf277cef96a16bf3fa1f4", "size": 1331, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/k-axiom/ListsSL.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/k-axiom/ListsSL.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/k-axiom/ListsSL.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 32.4634146341, "max_line_length": 78, "alphanum_fraction": 0.498121713, "num_tokens": 356, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278602705731, "lm_q2_score": 0.7634837635542925, "lm_q1q2_score": 0.6737193438245385}} {"text": "------------------------------------------------------------------------\n-- Streams\n------------------------------------------------------------------------\n\nmodule Data.Stream where\n\nopen import Coinduction\nopen import Data.Colist using (Colist; []; _∷_)\nopen import Data.Vec using (Vec; []; _∷_)\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Relation.Binary\n\n------------------------------------------------------------------------\n-- The type\n\ninfixr 5 _∷_\n\ndata Stream (A : Set) : Set where\n _∷_ : (x : A) (xs : ∞ (Stream A)) → Stream A\n\n------------------------------------------------------------------------\n-- Some operations\n\nhead : forall {A} -> Stream A -> A\nhead (x ∷ xs) = x\n\ntail : forall {A} -> Stream A -> Stream A\ntail (x ∷ xs) = ♭ xs\n\nmap : ∀ {A B} → (A → B) → Stream A → Stream B\nmap f (x ∷ xs) = f x ∷ ♯ map f (♭ xs)\n\nzipWith : forall {A B C} ->\n (A -> B -> C) -> Stream A -> Stream B -> Stream C\nzipWith _∙_ (x ∷ xs) (y ∷ ys) = (x ∙ y) ∷ ♯ zipWith _∙_ (♭ xs) (♭ ys)\n\ntake : ∀ {A} (n : ℕ) → Stream A → Vec A n\ntake zero xs = []\ntake (suc n) (x ∷ xs) = x ∷ take n (♭ xs)\n\ndrop : ∀ {A} -> ℕ -> Stream A -> Stream A\ndrop zero xs = xs\ndrop (suc n) (x ∷ xs) = drop n (♭ xs)\n\nrepeat : forall {A} -> A -> Stream A\nrepeat x = x ∷ ♯ repeat x\n\niterate : ∀ {A} → (A → A) → A → Stream A\niterate f x = x ∷ ♯ iterate f (f x)\n\n-- Interleaves the two streams.\n\ninfixr 5 _⋎_\n\n_⋎_ : ∀ {A} → Stream A → Stream A → Stream A\n(x ∷ xs) ⋎ ys = x ∷ ♯ (ys ⋎ ♭ xs)\n\ntoColist : ∀ {A} → Stream A → Colist A\ntoColist (x ∷ xs) = x ∷ ♯ toColist (♭ xs)\n\nlookup : ∀ {A} → ℕ → Stream A → A\nlookup zero (x ∷ xs) = x\nlookup (suc n) (x ∷ xs) = lookup n (♭ xs)\n\ninfixr 5 _++_\n\n_++_ : ∀ {A} → Colist A → Stream A → Stream A\n[] ++ ys = ys\n(x ∷ xs) ++ ys = x ∷ ♯ (♭ xs ++ ys)\n\n------------------------------------------------------------------------\n-- Equality and other relations\n\n-- xs ≈ ys means that xs and ys are equal.\n\ninfix 4 _≈_\n\ndata _≈_ {A} : (xs ys : Stream A) → Set where\n _∷_ : ∀ x {xs ys} (xs≈ : ∞ (♭ xs ≈ ♭ ys)) → x ∷ xs ≈ x ∷ ys\n\n-- x ∈ xs means that x is a member of xs.\n\ninfix 4 _∈_\n\ndata _∈_ {A : Set} : A → Stream A → Set where\n here : ∀ {x xs} → x ∈ x ∷ xs\n there : ∀ {x y xs} (x∈xs : x ∈ ♭ xs) → x ∈ y ∷ xs\n\n-- xs ⊑ ys means that xs is a prefix of ys.\n\ninfix 4 _⊑_\n\ndata _⊑_ {A : Set} : Colist A → Stream A → Set where\n [] : ∀ {ys} → [] ⊑ ys\n _∷_ : ∀ x {xs ys} (p : ∞ (♭ xs ⊑ ♭ ys)) → x ∷ xs ⊑ x ∷ ys\n\n------------------------------------------------------------------------\n-- Some proofs\n\nsetoid : Set → Setoid\nsetoid A = record\n { carrier = Stream A\n ; _≈_ = _≈_ {A}\n ; isEquivalence = record\n { refl = refl\n ; sym = sym\n ; trans = trans\n }\n }\n where\n refl : Reflexive _≈_\n refl {x ∷ xs} = x ∷ ♯ refl\n\n sym : Symmetric _≈_\n sym (x ∷ xs≈) = x ∷ ♯ sym (♭ xs≈)\n\n trans : Transitive _≈_\n trans (x ∷ xs≈) (.x ∷ ys≈) = x ∷ ♯ trans (♭ xs≈) (♭ ys≈)\n\nmap-cong : ∀ {A B} (f : A → B) {xs ys : Stream A} →\n xs ≈ ys → map f xs ≈ map f ys\nmap-cong f (x ∷ xs≈) = f x ∷ ♯ map-cong f (♭ xs≈)\n", "meta": {"hexsha": "33709622c1db5afb7469bca1b0b36e24631aa170", "size": 3141, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Data/Stream.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Data/Stream.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Data/Stream.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 25.5365853659, "max_line_length": 72, "alphanum_fraction": 0.4231136581, "num_tokens": 1167, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278602705731, "lm_q2_score": 0.7634837527911057, "lm_q1q2_score": 0.6737193343268025}} {"text": "{-# OPTIONS --safe --without-K #-}\nopen import Algebra.Bundles using (Monoid)\n\nmodule Categories.Category.Construction.MonoidAsCategory o {c ℓ} (M : Monoid c ℓ) where\n\nopen import Data.Unit.Polymorphic\nopen import Level\n\nopen import Categories.Category.Core\n\nopen Monoid M\n\n-- A monoid is a category with one object\nMonoidAsCategory : Category o c ℓ\nMonoidAsCategory = record\n { Obj = ⊤\n ; assoc = assoc _ _ _\n ; sym-assoc = sym (assoc _ _ _)\n ; identityˡ = identityˡ _\n ; identityʳ = identityʳ _\n ; identity² = identityˡ _\n ; equiv = isEquivalence\n ; ∘-resp-≈ = ∙-cong\n }\n", "meta": {"hexsha": "904e2ea5d36b76424c52f8fdc7343f686cf6d45d", "size": 582, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Construction/MonoidAsCategory.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2019-05-21T17:07:19.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-22T03:54:24.000Z", "max_issues_repo_path": "src/Categories/Category/Construction/MonoidAsCategory.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Construction/MonoidAsCategory.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.28, "max_line_length": 87, "alphanum_fraction": 0.7010309278, "num_tokens": 180, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9334308165850442, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.6736973504190749}} {"text": "module PLRTree.Equality.Correctness {A : Set} where\n\nopen import BTree.Equality {A}\nopen import PLRTree {A} \nopen import PLRTree.Equality {A} renaming (_≃_ to _≃'_)\n\nlemma-≃'-≃ : {l r : PLRTree} → l ≃' r → forget l ≃ forget r\nlemma-≃'-≃ ≃lf = ≃lf\nlemma-≃'-≃ (≃nd x x' l≃'r l'≃'r' l≃'l') = ≃nd x x' (lemma-≃'-≃ l≃'r) (lemma-≃'-≃ l≃'l') (lemma-≃'-≃ l'≃'r')\n", "meta": {"hexsha": "67fc9cbffbad4be918fb6019ad0038cae8c9a270", "size": 355, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/PLRTree/Equality/Correctness.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/PLRTree/Equality/Correctness.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/PLRTree/Equality/Correctness.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.5, "max_line_length": 107, "alphanum_fraction": 0.5690140845, "num_tokens": 182, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9334308165850443, "lm_q2_score": 0.721743200312399, "lm_q1q2_score": 0.6736973448323058}} {"text": "{-\n\nCounting how many structured finite sets with a given cardinal\n\nhttps://github.com/EgbertRijke/OEIS-A000001\n\n-}\n{-# OPTIONS --safe #-}\n\nmodule Cubical.Experiments.CountingFiniteStructure where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Equiv\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Bool\nopen import Cubical.Data.Sigma\n\nopen import Cubical.Data.FinSet\nopen import Cubical.Data.FinSet.Induction\nopen import Cubical.Data.FinSet.Constructors\nopen import Cubical.Data.FinType\nopen import Cubical.Data.FinType.FiniteStructure\n\nprivate\n variable\n ℓ : Level\n\n-- convenient abbreviation\n\nisFinStrCard : (S : FinSet ℓ-zero → FinSet ℓ) (n : ℕ) → isFinType 0 (FinSetWithStrOfCard S n)\nisFinStrCard S n = isFinTypeFinSetWithStrOfCard S n\n\n-- structure that there is no structure\n\nTrivialStr : FinSet ℓ → FinSet ℓ\nTrivialStr _ = 𝟙\n\n-- structure that \"picking an element in that set\"\n\nIdentityStr : FinSet ℓ → FinSet ℓ\nIdentityStr X = X\n\n-- finite semi-groups\n\nFinSemiGroupStr : FinSet ℓ → FinSet ℓ\nFinSemiGroupStr X .fst =\n Σ[ p ∈ (X .fst → X .fst → X .fst) ] ((x y z : X .fst) → p (p x y) z ≡ p x (p y z))\nFinSemiGroupStr X .snd =\n isFinSetΣ (_ , isFinSetΠ2 X (λ _ → X) (λ _ _ → X))\n (λ p → _ , isFinSetΠ3 X (λ _ → X) (λ _ _ → X) (λ _ _ _ → _ , isFinSet≡ X _ _))\n\n-- finite groups\n\nFinGroupStr : FinSet ℓ → FinSet ℓ\nFinGroupStr X .fst =\n Σ[ e ∈ X .fst ]\n Σ[ inv ∈ (X .fst → X .fst) ]\n Σ[ p ∈ (X .fst → X .fst → X .fst) ]\n ((x y z : X .fst) → p (p x y) z ≡ p x (p y z))\n × ((x : X .fst)\n → (p x e ≡ x) × (p e x ≡ x) × (p (inv x) x ≡ e) × (p x (inv x) ≡ e))\nFinGroupStr X .snd =\n isFinSetΣ X (λ _ → _ ,\n isFinSetΣ (_ , isFinSetΠ X (λ _ → X)) (λ _ → _ ,\n isFinSetΣ (_ , isFinSetΠ2 X (λ _ → X) (λ _ _ → X)) (λ _ → _ ,\n isFinSet× (_ , isFinSetΠ3 X (λ _ → X) (λ _ _ → X) (λ _ _ _ → _ , isFinSet≡ X _ _)) (_ ,\n isFinSetΠ X (λ _ → _ ,\n isFinSet× (_ , isFinSet≡ X _ _) (_ ,\n isFinSet× (_ , isFinSet≡ X _ _) (_ ,\n isFinSet× (_ , isFinSet≡ X _ _) (_ , isFinSet≡ X _ _))))))))\n\n-- two rather trivial numbers\n-- but the computation is essentially not that trivial\n-- Time: 5 ms\na2 : ℕ\na2 = card (_ , isFinStrCard TrivialStr 2)\n\n-- this is already hard to compute\n-- Time: 443 ms\nb2 : ℕ\nb2 = card (_ , isFinStrCard IdentityStr 2)\n\n-- the number of finite semi-groups\nnumberOfFinSemiGroups : ℕ → ℕ\nnumberOfFinSemiGroups n = card (_ , isFinStrCard FinSemiGroupStr n)\n\n-- two trivial cases of semi-groups\n-- Time: 29 ms\nn0 : ℕ\nn0 = numberOfFinSemiGroups 0\n\n-- Time: 2,787ms\nn1 : ℕ\nn1 = numberOfFinSemiGroups 1\n\n-- the number of finite semi-groups with cardinal 2\n-- it should be 5\n-- would you like to try?\nn2 : ℕ\nn2 = numberOfFinSemiGroups 2\n\n-- OEIS-A000001\n-- I think you'd better not evaluate this function with n > 1\nnumberOfFinGroups : ℕ → ℕ\nnumberOfFinGroups n = card (_ , isFinStrCard FinGroupStr n)\n\n-- group with one element\n-- Time: 26,925ms\ng1 : ℕ\ng1 = numberOfFinGroups 1\n\n-- Rijke's challenge\n-- seemed to big to do an exhaustive search\ng4 : ℕ\ng4 = numberOfFinGroups 4\n", "meta": {"hexsha": "ba1d56845bdab88c4aa4f2177202e85048557604", "size": 3111, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Experiments/CountingFiniteStructure.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z", "max_issues_repo_path": "Cubical/Experiments/CountingFiniteStructure.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Experiments/CountingFiniteStructure.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.5897435897, "max_line_length": 95, "alphanum_fraction": 0.6448087432, "num_tokens": 1111, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9334308091776496, "lm_q2_score": 0.7217432003123989, "lm_q1q2_score": 0.673697339486069}} {"text": "{-# OPTIONS --without-K --exact-split #-}\n\nmodule 11-function-extensionality where\n\nimport 10-truncation-levels\nopen 10-truncation-levels public\n\n-- Section 9.1 Equivalent forms of Function Extensionality.\n\n-- We first define the types Funext, Ind-htpy, and Weak-Funext. \n\nhtpy-eq :\n {i j : Level} {A : UU i} {B : A → UU j} {f g : (x : A) → B x} →\n (Id f g) → (f ~ g)\nhtpy-eq refl = refl-htpy\n\nFUNEXT :\n {i j : Level} {A : UU i} {B : A → UU j} →\n (f : (x : A) → B x) → UU (i ⊔ j)\nFUNEXT f = is-fiberwise-equiv (λ g → htpy-eq {f = f} {g = g})\n\nev-refl-htpy :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) (C : (g : (x : A) → B x) → (f ~ g) → UU l3) →\n ((g : (x : A) → B x) (H : f ~ g) → C g H) → C f refl-htpy\nev-refl-htpy f C φ = φ f refl-htpy\n\nIND-HTPY :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) → UU _\nIND-HTPY {l1} {l2} {l3} {A} {B} f =\n (C : (g : (x : A) → B x) → (f ~ g) → UU l3) → sec (ev-refl-htpy f C)\n\nWEAK-FUNEXT :\n {i j : Level} (A : UU i) (B : A → UU j) → UU (i ⊔ j)\nWEAK-FUNEXT A B =\n ((x : A) → is-contr (B x)) → is-contr ((x : A) → B x)\n\n-- Our goal is now to show that function extensionality holds if and only if the homotopy induction principle is valid, if and only if the weak function extensionality principle holds. This is Theorem 9.1.1 in the notes.\n\nabstract\n is-contr-total-htpy-Funext :\n {i j : Level} {A : UU i} {B : A → UU j} →\n (f : (x : A) → B x) → FUNEXT f → is-contr (Σ ((x : A) → B x) (λ g → f ~ g))\n is-contr-total-htpy-Funext f funext-f =\n fundamental-theorem-id' f refl-htpy (λ g → htpy-eq {g = g}) funext-f\n\nev-pair :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : Σ A B → UU l3} →\n ((t : Σ A B) → C t) → (x : A) (y : B x) → C (pair x y)\nev-pair f x y = f (pair x y)\n\nsec-ev-pair :\n {l1 l2 l3 : Level} (A : UU l1) (B : A → UU l2)\n (C : Σ A B → UU l3) → sec (ev-pair {A = A} {B = B} {C = C})\nsec-ev-pair A B C =\n pair (λ f → ind-Σ f) (λ f → refl)\n\ntriangle-ev-refl-htpy :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) (C : Σ ((x : A) → B x) (λ g → f ~ g) → UU l3) →\n ev-pt (Σ ((x : A) → B x) (λ g → f ~ g)) (pair f refl-htpy) C ~\n ((ev-refl-htpy f (λ x y → C (pair x y))) ∘ (ev-pair {C = C}))\ntriangle-ev-refl-htpy f C φ = refl\n\nabstract\n IND-HTPY-FUNEXT :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (f : (x : A) → B x) →\n FUNEXT f → IND-HTPY {l3 = l3} f\n IND-HTPY-FUNEXT {l3 = l3} {A = A} {B = B} f funext-f =\n Ind-identity-system l3 f\n ( refl-htpy)\n ( is-contr-total-htpy-Funext f funext-f)\n\nabstract\n FUNEXT-IND-HTPY :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2} (f : (x : A) → B x) →\n IND-HTPY {l3 = l1 ⊔ l2} f → FUNEXT f\n FUNEXT-IND-HTPY f ind-htpy-f =\n fundamental-theorem-id-IND-identity-system f\n ( refl-htpy)\n ( ind-htpy-f)\n ( λ g → htpy-eq)\n\nabstract\n WEAK-FUNEXT-FUNEXT :\n {l1 l2 : Level} →\n ((A : UU l1) (B : A → UU l2) (f : (x : A) → B x) → FUNEXT f) →\n ((A : UU l1) (B : A → UU l2) → WEAK-FUNEXT A B)\n WEAK-FUNEXT-FUNEXT funext A B is-contr-B =\n let pi-center = (λ x → center (is-contr-B x)) in\n pair\n ( pi-center)\n ( λ f → inv-is-equiv (funext A B pi-center f)\n ( λ x → contraction (is-contr-B x) (f x)))\n\nabstract\n FUNEXT-WEAK-FUNEXT :\n {l1 l2 : Level} →\n ((A : UU l1) (B : A → UU l2) → WEAK-FUNEXT A B) →\n ((A : UU l1) (B : A → UU l2) (f : (x : A) → B x) → FUNEXT f)\n FUNEXT-WEAK-FUNEXT weak-funext A B f =\n fundamental-theorem-id f\n ( refl-htpy)\n ( is-contr-retract-of\n ( (x : A) → Σ (B x) (λ b → Id (f x) b))\n ( pair\n ( λ t x → pair (pr1 t x) (pr2 t x))\n ( pair (λ t → pair (λ x → pr1 (t x)) (λ x → pr2 (t x)))\n ( λ t → eq-pair refl refl)))\n ( weak-funext A\n ( λ x → Σ (B x) (λ b → Id (f x) b))\n ( λ x → is-contr-total-path (f x))))\n ( λ g → htpy-eq {g = g})\n\n-- From now on we will be assuming that function extensionality holds\n\npostulate funext : {i j : Level} {A : UU i} {B : A → UU j} (f : (x : A) → B x) → FUNEXT f\n\nequiv-funext : {i j : Level} {A : UU i} {B : A → UU j} {f g : (x : A) → B x} →\n (Id f g) ≃ (f ~ g)\nequiv-funext {f = f} {g} = pair htpy-eq (funext f g) \n\nabstract\n eq-htpy :\n {i j : Level} {A : UU i} {B : A → UU j} {f g : (x : A) → B x} →\n (f ~ g) → Id f g\n eq-htpy = inv-is-equiv (funext _ _)\n \n issec-eq-htpy :\n {i j : Level} {A : UU i} {B : A → UU j} {f g : (x : A) → B x} →\n ((htpy-eq {f = f} {g = g}) ∘ (eq-htpy {f = f} {g = g})) ~ id\n issec-eq-htpy = issec-inv-is-equiv (funext _ _)\n \n isretr-eq-htpy :\n {i j : Level} {A : UU i} {B : A → UU j} {f g : (x : A) → B x} →\n ((eq-htpy {f = f} {g = g}) ∘ (htpy-eq {f = f} {g = g})) ~ id\n isretr-eq-htpy = isretr-inv-is-equiv (funext _ _)\n\n is-equiv-eq-htpy :\n {i j : Level} {A : UU i} {B : A → UU j}\n (f g : (x : A) → B x) → is-equiv (eq-htpy {f = f} {g = g})\n is-equiv-eq-htpy f g = is-equiv-inv-is-equiv (funext _ _)\n\n eq-htpy-refl-htpy :\n {i j : Level} {A : UU i} {B : A → UU j}\n (f : (x : A) → B x) → Id (eq-htpy (refl-htpy {f = f})) refl\n eq-htpy-refl-htpy f = isretr-eq-htpy refl\n\n{-\nThe immediate proof of the following theorem would be\n\n is-contr-total-htpy-Funext f (funext f)\n\nWe give a different proof to ensure that the center of contraction is the \nexpected thing: \n\n pair f refl-htpy\n\n-}\n\nabstract\n is-contr-total-htpy :\n {i j : Level} {A : UU i} {B : A → UU j} (f : (x : A) → B x) →\n is-contr (Σ ((x : A) → B x) (λ g → f ~ g))\n is-contr-total-htpy f =\n pair\n ( pair f refl-htpy)\n ( λ t →\n ( inv (contraction\n ( is-contr-total-htpy-Funext f (funext f))\n ( pair f refl-htpy))) ∙\n ( contraction (is-contr-total-htpy-Funext f (funext f)) t))\n\nabstract\n Ind-htpy :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (f : (x : A) → B x) →\n IND-HTPY {l3 = l3} f\n Ind-htpy f = IND-HTPY-FUNEXT f (funext f)\n \n ind-htpy :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) (C : (g : (x : A) → B x) → (f ~ g) → UU l3) →\n C f refl-htpy → {g : (x : A) → B x} (H : f ~ g) → C g H\n ind-htpy f C t {g} = pr1 (Ind-htpy f C) t g\n \n comp-htpy :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) (C : (g : (x : A) → B x) → (f ~ g) → UU l3) →\n (c : C f refl-htpy) →\n Id (ind-htpy f C c refl-htpy) c\n comp-htpy f C = pr2 (Ind-htpy f C)\n\nabstract\n is-contr-Π :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2} →\n ((x : A) → is-contr (B x)) → is-contr ((x : A) → B x)\n is-contr-Π {A = A} {B = B} = WEAK-FUNEXT-FUNEXT (λ X Y → funext) A B\n \n is-trunc-Π :\n {l1 l2 : Level} (k : 𝕋) {A : UU l1} {B : A → UU l2} →\n ((x : A) → is-trunc k (B x)) → is-trunc k ((x : A) → B x)\n is-trunc-Π neg-two-𝕋 is-trunc-B = is-contr-Π is-trunc-B\n is-trunc-Π (succ-𝕋 k) is-trunc-B f g =\n is-trunc-is-equiv k (f ~ g) htpy-eq\n ( funext f g)\n ( is-trunc-Π k (λ x → is-trunc-B x (f x) (g x)))\n \n is-prop-Π :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2} →\n is-subtype B → is-prop ((x : A) → B x)\n is-prop-Π = is-trunc-Π neg-one-𝕋\n\nΠ-Prop :\n {l1 l2 : Level} (P : UU-Prop l1) →\n (type-Prop P → UU-Prop l2) → UU-Prop (l1 ⊔ l2)\nΠ-Prop P Q =\n pair\n ( (p : type-Prop P) → type-Prop (Q p))\n ( is-prop-Π (λ p → is-prop-type-Prop (Q p)))\n\nabstract\n is-set-Π :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2} →\n ((x : A) → is-set (B x)) → is-set ((x : A) → (B x))\n is-set-Π = is-trunc-Π zero-𝕋\n\nΠ-Set :\n {l1 l2 : Level} (A : UU-Set l1) →\n (type-Set A → UU-Set l2) → UU-Set (l1 ⊔ l2)\nΠ-Set A B =\n pair\n ( (x : type-Set A) → type-Set (B x))\n ( is-set-Π (λ x → is-set-type-Set (B x)))\n\nabstract\n is-trunc-function-type :\n {l1 l2 : Level} (k : 𝕋) (A : UU l1) (B : UU l2) →\n is-trunc k B → is-trunc k (A → B)\n is-trunc-function-type k A B is-trunc-B =\n is-trunc-Π k {B = λ (x : A) → B} (λ x → is-trunc-B)\n \n is-prop-function-type :\n {l1 l2 : Level} (A : UU l1) (B : UU l2) →\n is-prop B → is-prop (A → B)\n is-prop-function-type = is-trunc-function-type neg-one-𝕋\n\n is-set-function-type :\n {l1 l2 : Level} (A : UU l1) (B : UU l2) →\n is-set B → is-set (A → B)\n is-set-function-type = is-trunc-function-type zero-𝕋\n\n{- The type theoretic principle of choice is the assertion that Π distributes\n over Σ. In other words, there is an equivalence\n\n ((x : A) → Σ (B x) (C x)) ≃ Σ ((x : A) → B x) (λ f → (x : A) → C x (f x)).\n\n In the following we construct this equivalence, and we also characterize the\n relevant identity types. \n\n We call the type on the left-hand side Π-total-fam, and we call the type on\n the right-hand side type-choice-∞. -}\n \nΠ-total-fam :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2}\n (C : (x : A) → B x → UU l3) → UU (l1 ⊔ (l2 ⊔ l3))\nΠ-total-fam {A = A} {B} C = (x : A) → Σ (B x) (C x)\n\ntype-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2}\n (C : (x : A) → B x → UU l3) → UU (l1 ⊔ (l2 ⊔ l3))\ntype-choice-∞ {A = A} {B} C = Σ ((x : A) → B x) (λ f → (x : A) → C x (f x))\n\n{- We compute the identity type of Π-total-fam. Note that its characterization\n is again of the form Π-total-fam. -}\n\n{- We compute the identity type of type-choice-∞. Note that its identity \n type is again of the form type-choice-∞. -}\n\nEq-type-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t t' : type-choice-∞ C) → UU (l1 ⊔ (l2 ⊔ l3))\nEq-type-choice-∞ {A = A} {B} C t t' =\n type-choice-∞\n ( λ (x : A) (p : Id ((pr1 t) x) ((pr1 t') x)) →\n Id (tr (C x) p ((pr2 t) x)) ((pr2 t') x))\n\nreflexive-Eq-type-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t : type-choice-∞ C) → Eq-type-choice-∞ C t t\nreflexive-Eq-type-choice-∞ C (pair f g) = pair refl-htpy refl-htpy\n\nEq-type-choice-∞-eq :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t t' : type-choice-∞ C) → Id t t' → Eq-type-choice-∞ C t t'\nEq-type-choice-∞-eq C t .t refl = reflexive-Eq-type-choice-∞ C t\n\nabstract\n is-contr-total-Eq-type-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t : type-choice-∞ C) →\n is-contr (Σ (type-choice-∞ C) (Eq-type-choice-∞ C t))\n is-contr-total-Eq-type-choice-∞ {A = A} {B} C t =\n is-contr-total-Eq-structure\n ( λ f g H → (x : A) → Id (tr (C x) (H x) ((pr2 t) x)) (g x))\n ( is-contr-total-htpy (pr1 t))\n ( pair (pr1 t) refl-htpy)\n ( is-contr-total-htpy (pr2 t))\n \n is-equiv-Eq-type-choice-∞-eq :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t t' : type-choice-∞ C) → is-equiv (Eq-type-choice-∞-eq C t t')\n is-equiv-Eq-type-choice-∞-eq C t =\n fundamental-theorem-id t\n ( reflexive-Eq-type-choice-∞ C t)\n ( is-contr-total-Eq-type-choice-∞ C t)\n ( Eq-type-choice-∞-eq C t)\n \n eq-Eq-type-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n {t t' : type-choice-∞ C} → Eq-type-choice-∞ C t t' → Id t t'\n eq-Eq-type-choice-∞ C {t} {t'} =\n inv-is-equiv (is-equiv-Eq-type-choice-∞-eq C t t')\n\nchoice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : (x : A) → B x → UU l3} →\n Π-total-fam C → type-choice-∞ C\nchoice-∞ φ = pair (λ x → pr1 (φ x)) (λ x → pr2 (φ x))\n\ninv-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : (x : A) → B x → UU l3} →\n type-choice-∞ C → Π-total-fam C\ninv-choice-∞ ψ x = pair ((pr1 ψ) x) ((pr2 ψ) x)\n\nissec-inv-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : (x : A) → B x → UU l3} →\n ( ( choice-∞ {A = A} {B = B} {C = C}) ∘\n ( inv-choice-∞ {A = A} {B = B} {C = C})) ~ id\nissec-inv-choice-∞ {A = A} {C = C} (pair ψ ψ') =\n eq-Eq-type-choice-∞ C (pair refl-htpy refl-htpy)\n\nisretr-inv-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : (x : A) → B x → UU l3} →\n ( ( inv-choice-∞ {A = A} {B = B} {C = C}) ∘\n ( choice-∞ {A = A} {B = B} {C = C})) ~ id\nisretr-inv-choice-∞ φ =\n eq-htpy (λ x → eq-pair refl refl)\n\nabstract\n is-equiv-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : (x : A) → B x → UU l3} →\n is-equiv (choice-∞ {A = A} {B = B} {C = C})\n is-equiv-choice-∞ {A = A} {B = B} {C = C} =\n is-equiv-has-inverse\n ( inv-choice-∞ {A = A} {B = B} {C = C})\n ( issec-inv-choice-∞ {A = A} {B = B} {C = C})\n ( isretr-inv-choice-∞ {A = A} {B = B} {C = C})\n\nequiv-choice-∞ :\n { l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : (x : A) → B x → UU l3} →\n Π-total-fam C ≃ type-choice-∞ C\nequiv-choice-∞ = pair choice-∞ is-equiv-choice-∞\n\nabstract\n is-equiv-inv-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : (x : A) → B x → UU l3} →\n is-equiv (inv-choice-∞ {A = A} {B = B} {C = C})\n is-equiv-inv-choice-∞ {A = A} {B = B} {C = C} =\n is-equiv-has-inverse\n ( choice-∞ {A = A} {B = B} {C = C})\n ( isretr-inv-choice-∞ {A = A} {B = B} {C = C})\n ( issec-inv-choice-∞ {A = A} {B = B} {C = C})\n\nequiv-inv-choice-∞ :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3) →\n (type-choice-∞ C) ≃ (Π-total-fam C)\nequiv-inv-choice-∞ C = pair inv-choice-∞ is-equiv-inv-choice-∞\n\nmapping-into-Σ :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : B → UU l3} →\n (A → Σ B C) → Σ (A → B) (λ f → (x : A) → C (f x))\nmapping-into-Σ {B = B} = choice-∞ {B = λ x → B}\n\nabstract\n is-equiv-mapping-into-Σ :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2}\n {C : B → UU l3} → is-equiv (mapping-into-Σ {A = A} {C = C})\n is-equiv-mapping-into-Σ = is-equiv-choice-∞\n\n{- Next we compute the identity type of products of total spaces. Note again\n that the identity type of a product of total spaces is again a product of\n total spaces. -}\n\nEq-Π-total-fam :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t t' : (a : A) → Σ (B a) (C a)) → UU (l1 ⊔ (l2 ⊔ l3))\nEq-Π-total-fam {A = A} C t t' =\n Π-total-fam (λ x (p : Id (pr1 (t x)) (pr1 (t' x))) →\n Id (tr (C x) p (pr2 (t x))) (pr2 (t' x)))\n\nreflexive-Eq-Π-total-fam :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t : (a : A) → Σ (B a) (C a)) → Eq-Π-total-fam C t t\nreflexive-Eq-Π-total-fam C t a = pair refl refl\n\nEq-Π-total-fam-eq :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t t' : (a : A) → Σ (B a) (C a)) → Id t t' → Eq-Π-total-fam C t t'\nEq-Π-total-fam-eq C t .t refl = reflexive-Eq-Π-total-fam C t\n\nis-contr-total-Eq-Π-total-fam :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t : (a : A) → Σ (B a) (C a)) →\n is-contr (Σ ((a : A) → Σ (B a) (C a)) (Eq-Π-total-fam C t))\nis-contr-total-Eq-Π-total-fam {A = A} {B} C t =\n is-contr-equiv'\n ( (a : A) →\n Σ (Σ (B a) (C a)) (λ t' →\n Σ (Id (pr1 (t a)) (pr1 t')) (λ p →\n Id (tr (C a) p (pr2 (t a))) (pr2 t'))))\n ( equiv-choice-∞\n {- ( λ x t' →\n Σ ( Id (pr1 (t x)) (pr1 t'))\n ( λ p → Id (tr (C x) p (pr2 (t x))) (pr2 t')))-})\n ( is-contr-Π\n ( λ a →\n is-contr-total-Eq-structure\n ( λ b c p → Id (tr (C a) p (pr2 (t a))) c)\n ( is-contr-total-path (pr1 (t a)))\n ( pair (pr1 (t a)) refl)\n ( is-contr-total-path (pr2 (t a)))))\n\nis-equiv-Eq-Π-total-fam-eq :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t t' : (a : A) → Σ (B a) (C a)) → is-equiv (Eq-Π-total-fam-eq C t t')\nis-equiv-Eq-Π-total-fam-eq C t =\n fundamental-theorem-id t\n ( reflexive-Eq-Π-total-fam C t)\n ( is-contr-total-Eq-Π-total-fam C t)\n ( Eq-Π-total-fam-eq C t)\n\neq-Eq-Π-total-fam :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3)\n (t t' : (a : A) → Σ (B a) (C a)) → Eq-Π-total-fam C t t' → Id t t'\neq-Eq-Π-total-fam C t t' = inv-is-equiv (is-equiv-Eq-Π-total-fam-eq C t t')\n\n-- Section 9.2 Universal properties\n\nabstract\n is-equiv-ev-pair :\n {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : Σ A B → UU l3} →\n is-equiv (ev-pair {C = C})\n is-equiv-ev-pair =\n pair\n ( sec-ev-pair _ _ _)\n ( pair ind-Σ\n ( λ f → eq-htpy\n ( ind-Σ\n {C = (λ t → Id (ind-Σ (ev-pair f) t) (f t))}\n (λ x y → refl))))\n\nev-refl :\n {l1 l2 : Level} {A : UU l1} (a : A) {B : (x : A) → Id a x → UU l2} →\n ((x : A) (p : Id a x) → B x p) → B a refl\nev-refl a f = f a refl\n\nabstract\n is-equiv-ev-refl :\n {l1 l2 : Level} {A : UU l1} (a : A)\n {B : (x : A) → Id a x → UU l2} → is-equiv (ev-refl a {B = B})\n is-equiv-ev-refl a =\n is-equiv-has-inverse\n ( ind-Id a _)\n ( λ b → refl)\n ( λ f → eq-htpy\n ( λ x → eq-htpy\n ( ind-Id a\n ( λ x' p' → Id (ind-Id a _ (f a refl) x' p') (f x' p'))\n ( refl) x)))\n\n-- Section 9.3 Composing with equivalences.\n\nprecomp-Π :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (C : B → UU l3) →\n ((b : B) → C b) → ((a : A) → C (f a))\nprecomp-Π f C h a = h (f a)\n\ntr-precompose-fam :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3)\n (f : A → B) {x y : A} (p : Id x y) → tr C (ap f p) ~ tr (λ x → C (f x)) p\ntr-precompose-fam C f refl = refl-htpy\n\nabstract\n is-equiv-precomp-Π-is-half-adjoint-equivalence :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n is-half-adjoint-equivalence f →\n (C : B → UU l3) → is-equiv (precomp-Π f C)\n is-equiv-precomp-Π-is-half-adjoint-equivalence f\n ( pair g (pair issec-g (pair isretr-g coh))) C = \n is-equiv-has-inverse\n (λ s y → tr C (issec-g y) (s (g y)))\n ( λ s → eq-htpy (λ x → \n ( ap (λ t → tr C t (s (g (f x)))) (coh x)) ∙\n ( ( tr-precompose-fam C f (isretr-g x) (s (g (f x)))) ∙\n ( apd s (isretr-g x)))))\n ( λ s → eq-htpy λ y → apd s (issec-g y))\n\nabstract\n is-equiv-precomp-Π-is-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) → is-equiv f →\n (C : B → UU l3) → is-equiv (precomp-Π f C)\n is-equiv-precomp-Π-is-equiv f is-equiv-f =\n is-equiv-precomp-Π-is-half-adjoint-equivalence f\n ( is-half-adjoint-equivalence-is-path-split f\n ( is-path-split-is-equiv f is-equiv-f))\n\nprecomp-Π-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →\n (C : B → UU l3) → ((b : B) → C b) ≃ ((a : A) → C (map-equiv e a))\nprecomp-Π-equiv e C =\n pair\n ( precomp-Π (map-equiv e) C)\n ( is-equiv-precomp-Π-is-equiv (map-equiv e) (is-equiv-map-equiv e) C)\n\nabstract\n ind-is-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2}\n (C : B → UU l3) (f : A → B) (is-equiv-f : is-equiv f) →\n ((x : A) → C (f x)) → ((y : B) → C y)\n ind-is-equiv C f is-equiv-f =\n inv-is-equiv (is-equiv-precomp-Π-is-equiv f is-equiv-f C)\n \n comp-is-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3)\n (f : A → B) (is-equiv-f : is-equiv f) (h : (x : A) → C (f x)) →\n Id (λ x → (ind-is-equiv C f is-equiv-f h) (f x)) h\n comp-is-equiv C f is-equiv-f h =\n issec-inv-is-equiv (is-equiv-precomp-Π-is-equiv f is-equiv-f C) h\n \n htpy-comp-is-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2}\n (C : B → UU l3) (f : A → B) (is-equiv-f : is-equiv f)\n (h : (x : A) → C (f x)) →\n (λ x → (ind-is-equiv C f is-equiv-f h) (f x)) ~ h\n htpy-comp-is-equiv C f is-equiv-f h = htpy-eq (comp-is-equiv C f is-equiv-f h)\n\nprecomp :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (C : UU l3) →\n (B → C) → (A → C)\nprecomp f C = precomp-Π f (λ b → C)\n\nabstract\n is-equiv-precomp-is-equiv-precomp-Π :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n ((C : B → UU l3) → is-equiv (precomp-Π f C)) →\n ((C : UU l3) → is-equiv (precomp f C))\n is-equiv-precomp-is-equiv-precomp-Π f is-equiv-precomp-Π-f C =\n is-equiv-precomp-Π-f (λ y → C)\n\nabstract\n is-equiv-precomp-is-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) → is-equiv f →\n (C : UU l3) → is-equiv (precomp f C)\n is-equiv-precomp-is-equiv f is-equiv-f =\n is-equiv-precomp-is-equiv-precomp-Π f\n ( is-equiv-precomp-Π-is-equiv f is-equiv-f)\n\nequiv-precomp-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) (C : UU l3) →\n (B → C) ≃ (A → C)\nequiv-precomp-equiv e C =\n pair\n ( precomp (map-equiv e) C)\n ( is-equiv-precomp-is-equiv (map-equiv e) (is-equiv-map-equiv e) C)\n\nabstract\n is-equiv-is-equiv-precomp-subuniverse :\n { l1 l2 : Level}\n ( α : Level → Level) (P : (l : Level) → UU l → UU (α l))\n ( A : Σ (UU l1) (P l1)) (B : Σ (UU l2) (P l2)) (f : pr1 A → pr1 B) →\n ( (l : Level) (C : Σ (UU l) (P l)) →\n is-equiv (precomp f (pr1 C))) →\n is-equiv f\n is-equiv-is-equiv-precomp-subuniverse α P A B f is-equiv-precomp-f =\n let retr-f = center (is-contr-map-is-equiv (is-equiv-precomp-f _ A) id) in\n is-equiv-has-inverse\n ( pr1 retr-f)\n ( htpy-eq (ap pr1 (is-prop-is-contr'\n ( is-contr-map-is-equiv (is-equiv-precomp-f _ B) f)\n ( pair\n ( f ∘ (pr1 retr-f))\n ( ap (λ (g : pr1 A → pr1 A) → f ∘ g) (pr2 retr-f)))\n ( pair id refl))))\n ( htpy-eq (pr2 retr-f))\n\nabstract\n is-equiv-is-equiv-precomp :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n ((l : Level) (C : UU l) → is-equiv (precomp f C)) → is-equiv f\n is-equiv-is-equiv-precomp {A = A} {B = B} f is-equiv-precomp-f =\n is-equiv-is-equiv-precomp-subuniverse\n ( const Level Level lzero)\n ( λ l X → unit)\n ( pair A star)\n ( pair B star)\n ( f)\n ( λ l C → is-equiv-precomp-f l (pr1 C))\n\n-- Exercises\n\n-- Exercise 9.1\n\nabstract\n is-equiv-htpy-inv :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n (f g : (x : A) → B x) → is-equiv (htpy-inv {f = f} {g = g})\n is-equiv-htpy-inv f g =\n is-equiv-has-inverse\n ( htpy-inv)\n ( λ H → eq-htpy (λ x → inv-inv (H x)))\n ( λ H → eq-htpy (λ x → inv-inv (H x)))\n\nequiv-htpy-inv :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n (f g : (x : A) → B x) → (f ~ g) ≃ (g ~ f)\nequiv-htpy-inv f g = pair htpy-inv (is-equiv-htpy-inv f g)\n\nabstract\n is-equiv-htpy-concat :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n {f g : (x : A) → B x} (H : f ~ g) →\n (h : (x : A) → B x) → is-equiv (htpy-concat H h)\n is-equiv-htpy-concat {A = A} {B = B} {f} =\n ind-htpy f\n ( λ g H → (h : (x : A) → B x) → is-equiv (htpy-concat H h))\n ( λ h → is-equiv-id (f ~ h))\n\nequiv-htpy-concat :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n {f g : (x : A) → B x} (H : f ~ g) (h : (x : A) → B x) →\n (g ~ h) ≃ (f ~ h)\nequiv-htpy-concat H h =\n pair (htpy-concat H h) (is-equiv-htpy-concat H h)\n\ninv-htpy-concat' :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) {g h : (x : A) → B x} →\n (g ~ h) → (f ~ h) → (f ~ g)\ninv-htpy-concat' f K = htpy-concat' f (htpy-inv K)\n\nissec-inv-htpy-concat' :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) {g h : (x : A) → B x}\n (K : g ~ h) → ((htpy-concat' f K) ∘ (inv-htpy-concat' f K)) ~ id\nissec-inv-htpy-concat' f K L =\n eq-htpy (λ x → issec-inv-concat' (f x) (K x) (L x))\n\nisretr-inv-htpy-concat' :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) {g h : (x : A) → B x}\n (K : g ~ h) → ((inv-htpy-concat' f K) ∘ (htpy-concat' f K)) ~ id\nisretr-inv-htpy-concat' f K L =\n eq-htpy (λ x → isretr-inv-concat' (f x) (K x) (L x))\n\nis-equiv-htpy-concat' :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) {g h : (x : A) → B x} (K : g ~ h) →\n is-equiv (htpy-concat' f K)\nis-equiv-htpy-concat' f K =\n is-equiv-has-inverse\n ( inv-htpy-concat' f K)\n ( issec-inv-htpy-concat' f K)\n ( isretr-inv-htpy-concat' f K)\n\nequiv-htpy-concat' :\n {l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n (f : (x : A) → B x) {g h : (x : A) → B x} (K : g ~ h) →\n (f ~ g) ≃ (f ~ h)\nequiv-htpy-concat' f K =\n pair (htpy-concat' f K) (is-equiv-htpy-concat' f K)\n\n-- Exercise 9.2\n\nabstract\n is-subtype-is-contr :\n {l : Level} → is-subtype {lsuc l} {A = UU l} is-contr\n is-subtype-is-contr A =\n is-prop-is-contr-if-inh\n ( λ is-contr-A →\n is-contr-Σ\n ( is-contr-A)\n ( λ x → is-contr-Π (is-prop-is-contr is-contr-A x)))\n\nabstract\n is-prop-is-trunc :\n {l : Level} (k : 𝕋) (A : UU l) → is-prop (is-trunc k A)\n is-prop-is-trunc neg-two-𝕋 = is-subtype-is-contr\n is-prop-is-trunc (succ-𝕋 k) A =\n is-prop-Π (λ x → is-prop-Π (λ y → is-prop-is-trunc k (Id x y)))\n\nabstract\n is-prop-is-prop :\n {l : Level} (A : UU l) → is-prop (is-prop A)\n is-prop-is-prop = is-prop-is-trunc neg-one-𝕋\n\nabstract\n is-prop-is-set :\n {l : Level} (A : UU l) → is-prop (is-set A)\n is-prop-is-set = is-prop-is-trunc zero-𝕋\n\n-- Exercise 9.3\n\npostcomp :\n {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} (A : UU l3) →\n (X → Y) → (A → X) → (A → Y)\npostcomp A f h = f ∘ h\n\nabstract\n is-equiv-is-equiv-postcomp :\n {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X → Y) →\n ({l3 : Level} (A : UU l3) → is-equiv (postcomp A f)) → is-equiv f\n is-equiv-is-equiv-postcomp {X = X} {Y = Y} f post-comp-equiv-f =\n let sec-f = center (is-contr-map-is-equiv (post-comp-equiv-f Y) id) in\n is-equiv-has-inverse\n ( pr1 sec-f)\n ( htpy-eq (pr2 sec-f))\n ( htpy-eq (ap pr1 (is-prop-is-contr'\n ( is-contr-map-is-equiv (post-comp-equiv-f X) f)\n ( pair ((pr1 sec-f) ∘ f) (ap (λ t → t ∘ f) (pr2 sec-f)))\n ( pair id refl))))\n\n{- The following version of the same theorem works when X and Y are in the same\n universe. The condition of inducing equivalences by postcomposition is \n simplified to that universe. -}\n\nis-equiv-is-equiv-postcomp' :\n {l : Level} {X : UU l} {Y : UU l} (f : X → Y) →\n ((A : UU l) → is-equiv (postcomp A f)) → is-equiv f\nis-equiv-is-equiv-postcomp'\n {l} {X} {Y} f is-equiv-postcomp-f =\n let sec-f = center (is-contr-map-is-equiv (is-equiv-postcomp-f Y) id)\n in\n is-equiv-has-inverse\n ( pr1 sec-f)\n ( htpy-eq (pr2 sec-f))\n ( htpy-eq (ap pr1 (is-prop-is-contr'\n ( is-contr-map-is-equiv (is-equiv-postcomp-f X) f)\n ( pair ((pr1 sec-f) ∘ f) (ap (λ t → t ∘ f) (pr2 sec-f)))\n ( pair id refl))))\n\nabstract\n is-equiv-postcomp-is-equiv :\n {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X → Y) → is-equiv f →\n ({l3 : Level} (A : UU l3) → is-equiv (postcomp A f))\n is-equiv-postcomp-is-equiv {X = X} {Y = Y} f is-equiv-f A =\n is-equiv-has-inverse \n ( postcomp A (inv-is-equiv is-equiv-f))\n ( λ g → eq-htpy (htpy-right-whisk (issec-inv-is-equiv is-equiv-f) g))\n ( λ h → eq-htpy (htpy-right-whisk (isretr-inv-is-equiv is-equiv-f) h))\n\n-- Exercise 9.4\n\nis-contr-sec-is-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →\n is-equiv f → is-contr (sec f)\nis-contr-sec-is-equiv {A = A} {B = B} {f = f} is-equiv-f =\n is-contr-is-equiv'\n ( Σ (B → A) (λ g → Id (f ∘ g) id))\n ( tot (λ g → htpy-eq))\n ( is-equiv-tot-is-fiberwise-equiv\n ( λ g → funext (f ∘ g) id))\n ( is-contr-map-is-equiv (is-equiv-postcomp-is-equiv f is-equiv-f B) id)\n\nis-contr-retr-is-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →\n is-equiv f → is-contr (retr f)\nis-contr-retr-is-equiv {A = A} {B = B} {f = f} is-equiv-f =\n is-contr-is-equiv'\n ( Σ (B → A) (λ h → Id (h ∘ f) id))\n ( tot (λ h → htpy-eq))\n ( is-equiv-tot-is-fiberwise-equiv\n ( λ h → funext (h ∘ f) id))\n ( is-contr-map-is-equiv (is-equiv-precomp-is-equiv f is-equiv-f A) id)\n\nis-contr-is-equiv-is-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2}\n {f : A → B} → is-equiv f → is-contr (is-equiv f)\nis-contr-is-equiv-is-equiv is-equiv-f =\n is-contr-prod\n ( is-contr-sec-is-equiv is-equiv-f)\n ( is-contr-retr-is-equiv is-equiv-f)\n\nabstract\n is-subtype-is-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} →\n is-subtype (is-equiv {A = A} {B = B})\n is-subtype-is-equiv f = is-prop-is-contr-if-inh\n ( λ is-equiv-f → is-contr-prod\n ( is-contr-sec-is-equiv is-equiv-f)\n ( is-contr-retr-is-equiv is-equiv-f))\n\nis-equiv-Prop :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) → UU-Prop (l1 ⊔ l2)\nis-equiv-Prop f =\n pair (is-equiv f) (is-subtype-is-equiv f)\n\nabstract\n is-emb-map-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} →\n is-emb (map-equiv {A = A} {B = B})\n is-emb-map-equiv = is-emb-pr1-is-subtype is-subtype-is-equiv\n\n{- For example, we show that homotopies are equivalent to identifications of\n equivalences. -}\n\nhtpy-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} → A ≃ B → A ≃ B → UU (l1 ⊔ l2)\nhtpy-equiv e e' = (map-equiv e) ~ (map-equiv e')\n\nreflexive-htpy-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → htpy-equiv e e\nreflexive-htpy-equiv e = refl-htpy\n\nhtpy-equiv-eq :\n {l1 l2 : Level} {A : UU l1} {B : UU l2}\n {e e' : A ≃ B} (p : Id e e') → htpy-equiv e e'\nhtpy-equiv-eq {e = e} {.e} refl =\n reflexive-htpy-equiv e\n\nabstract\n is-contr-total-htpy-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →\n is-contr (Σ (A ≃ B) (λ e' → htpy-equiv e e'))\n is-contr-total-htpy-equiv (pair f is-equiv-f) =\n is-contr-total-Eq-substructure\n ( is-contr-total-htpy f)\n ( is-subtype-is-equiv)\n ( f)\n ( refl-htpy)\n ( is-equiv-f)\n\n is-equiv-htpy-equiv-eq :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (e e' : A ≃ B) →\n is-equiv (htpy-equiv-eq {e = e} {e'})\n is-equiv-htpy-equiv-eq e =\n fundamental-theorem-id e\n ( reflexive-htpy-equiv e)\n ( is-contr-total-htpy-equiv e)\n ( λ e' → htpy-equiv-eq {e = e} {e'})\n\neq-htpy-equiv :\n { l1 l2 : Level} {A : UU l1} {B : UU l2} {e e' : A ≃ B} →\n ( htpy-equiv e e') → Id e e'\neq-htpy-equiv {e = e} {e'} = inv-is-equiv (is-equiv-htpy-equiv-eq e e')\n\nabstract\n Ind-htpy-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →\n (P : (e' : A ≃ B) (H : htpy-equiv e e') → UU l3) →\n sec\n ( λ (h : (e' : A ≃ B) (H : htpy-equiv e e') → P e' H) →\n h e (reflexive-htpy-equiv e))\n Ind-htpy-equiv {l3 = l3} e =\n Ind-identity-system l3 e\n ( reflexive-htpy-equiv e)\n ( is-contr-total-htpy-equiv e)\n \n ind-htpy-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →\n (P : (e' : A ≃ B) (H : htpy-equiv e e') → UU l3) →\n P e (reflexive-htpy-equiv e) → (e' : A ≃ B) (H : htpy-equiv e e') → P e' H\n ind-htpy-equiv e P = pr1 (Ind-htpy-equiv e P)\n \n comp-htpy-equiv :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →\n (P : (e' : A ≃ B) (H : htpy-equiv e e') → UU l3)\n (p : P e (reflexive-htpy-equiv e)) →\n Id (ind-htpy-equiv e P p e (reflexive-htpy-equiv e)) p\n comp-htpy-equiv e P = pr2 (Ind-htpy-equiv e P)\n\n-- Exercise 9.5\n\n{- We use that is-equiv is a proposition to show that the type of equivalences\n between k-types is again a k-type. -}\n \nis-contr-equiv-is-contr :\n { l1 l2 : Level} {A : UU l1} {B : UU l2} →\n is-contr A → is-contr B → is-contr (A ≃ B)\nis-contr-equiv-is-contr is-contr-A is-contr-B =\n pair\n ( equiv-is-contr is-contr-A is-contr-B)\n ( λ e → eq-htpy-equiv\n ( λ x →\n is-prop-is-contr' is-contr-B (center is-contr-B) (map-equiv e x)))\n\nis-trunc-is-contr :\n { l : Level} (k : 𝕋) {A : UU l} → is-contr A → is-trunc k A\nis-trunc-is-contr neg-two-𝕋 is-contr-A = is-contr-A\nis-trunc-is-contr (succ-𝕋 k) is-contr-A x y =\n is-trunc-is-contr k (is-prop-is-contr is-contr-A x y)\n\nis-trunc-is-prop :\n { l : Level} (k : 𝕋) {A : UU l} → is-prop A → is-trunc (succ-𝕋 k) A\nis-trunc-is-prop k is-prop-A x y = is-trunc-is-contr k (is-prop-A x y)\n\nis-trunc-equiv-is-trunc :\n { l1 l2 : Level} (k : 𝕋) {A : UU l1} {B : UU l2} →\n is-trunc k A → is-trunc k B → is-trunc k (A ≃ B)\nis-trunc-equiv-is-trunc neg-two-𝕋 is-trunc-A is-trunc-B =\n is-contr-equiv-is-contr is-trunc-A is-trunc-B\nis-trunc-equiv-is-trunc (succ-𝕋 k) is-trunc-A is-trunc-B = \n is-trunc-Σ (succ-𝕋 k)\n ( is-trunc-Π (succ-𝕋 k) (λ x → is-trunc-B))\n ( λ x → is-trunc-is-prop k (is-subtype-is-equiv x))\n\nis-prop-equiv-is-prop :\n { l1 l2 : Level} {A : UU l1} {B : UU l2} →\n is-prop A → is-prop B → is-prop (A ≃ B)\nis-prop-equiv-is-prop = is-trunc-equiv-is-trunc neg-one-𝕋\n\nprop-equiv :\n { l1 l2 : Level} → UU-Prop l1 → UU-Prop l2 → UU-Prop (l1 ⊔ l2)\nprop-equiv P Q =\n pair\n ( type-Prop P ≃ type-Prop Q)\n ( is-prop-equiv-is-prop (is-prop-type-Prop P) (is-prop-type-Prop Q))\n\nis-set-equiv-is-set :\n { l1 l2 : Level} {A : UU l1} {B : UU l2} →\n is-set A → is-set B → is-set (A ≃ B)\nis-set-equiv-is-set = is-trunc-equiv-is-trunc zero-𝕋\n\nset-equiv :\n { l1 l2 : Level} → UU-Set l1 → UU-Set l2 → UU-Set (l1 ⊔ l2)\nset-equiv A B =\n pair\n ( type-Set A ≃ type-Set B)\n ( is-set-equiv-is-set (is-set-type-Set A) (is-set-type-Set B))\n\n{- Now we turn to the exercise. -}\n\n_↔_ :\n {l1 l2 : Level} → UU-Prop l1 → UU-Prop l2 → UU (l1 ⊔ l2)\nP ↔ Q = (pr1 P → pr1 Q) × (pr1 Q → pr1 P)\n\nequiv-iff :\n {l1 l2 : Level} (P : UU-Prop l1) (Q : UU-Prop l2) →\n (P ↔ Q) → (pr1 P ≃ pr1 Q)\nequiv-iff P Q t = pair (pr1 t) (is-equiv-is-prop (pr2 P) (pr2 Q) (pr2 t))\n\niff-equiv :\n {l1 l2 : Level} (P : UU-Prop l1) (Q : UU-Prop l2) →\n (pr1 P ≃ pr1 Q) → (P ↔ Q)\niff-equiv P Q equiv-PQ = pair (pr1 equiv-PQ) (inv-is-equiv (pr2 equiv-PQ))\n\nabstract\n is-prop-iff :\n {l1 l2 : Level} (P : UU-Prop l1) (Q : UU-Prop l2) → is-prop (P ↔ Q)\n is-prop-iff P Q =\n is-prop-prod\n ( is-prop-function-type (pr1 P) (pr1 Q) (pr2 Q))\n ( is-prop-function-type (pr1 Q) (pr1 P) (pr2 P))\n\nabstract\n is-prop-equiv-Prop :\n {l1 l2 : Level} (P : UU-Prop l1) (Q : UU-Prop l2) →\n is-prop ((pr1 P) ≃ (pr1 Q))\n is-prop-equiv-Prop P Q =\n is-prop-equiv-is-prop (pr2 P) (pr2 Q)\n\nabstract\n is-equiv-equiv-iff :\n {l1 l2 : Level} (P : UU-Prop l1) (Q : UU-Prop l2) → is-equiv (equiv-iff P Q)\n is-equiv-equiv-iff P Q =\n is-equiv-is-prop\n ( is-prop-iff P Q)\n ( is-prop-equiv-Prop P Q)\n ( iff-equiv P Q)\n\nabstract\n is-prop-is-contr-endomaps :\n {l : Level} (P : UU l) → is-contr (P → P) → is-prop P\n is-prop-is-contr-endomaps P H =\n is-prop-is-prop'\n ( λ x → htpy-eq (is-prop-is-contr' H (const P P x) id))\n\nabstract\n is-contr-endomaps-is-prop :\n {l : Level} (P : UU l) → is-prop P → is-contr (P → P)\n is-contr-endomaps-is-prop P is-prop-P =\n is-contr-is-prop-inh (is-prop-function-type P P is-prop-P) id\n\n-- Exercise 9.6\n\nabstract\n is-prop-is-path-split :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n is-prop (is-path-split f)\n is-prop-is-path-split f =\n is-prop-is-contr-if-inh (λ is-path-split-f →\n let is-equiv-f = is-equiv-is-path-split f is-path-split-f in\n is-contr-prod\n ( is-contr-sec-is-equiv is-equiv-f)\n ( is-contr-Π\n ( λ x → is-contr-Π\n ( λ y → is-contr-sec-is-equiv (is-emb-is-equiv f is-equiv-f x y)))))\n\nabstract\n is-equiv-is-path-split-is-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n is-equiv (is-path-split-is-equiv f)\n is-equiv-is-path-split-is-equiv f =\n is-equiv-is-prop\n ( is-subtype-is-equiv f)\n ( is-prop-is-path-split f)\n ( is-equiv-is-path-split f)\n\nabstract\n is-prop-is-half-adjoint-equivalence :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n is-prop (is-half-adjoint-equivalence f)\n is-prop-is-half-adjoint-equivalence {l1} {l2} {A} {B} f =\n is-prop-is-contr-if-inh (λ is-hae-f →\n let is-equiv-f = is-equiv-is-half-adjoint-equivalence f is-hae-f in\n is-contr-equiv'\n ( Σ (sec f)\n ( λ sf → Σ (((pr1 sf) ∘ f) ~ id)\n ( λ H → (htpy-right-whisk (pr2 sf) f) ~ (htpy-left-whisk f H))))\n ( equiv-Σ-assoc (B → A)\n ( λ g → ((f ∘ g) ~ id))\n ( λ sf → Σ (((pr1 sf) ∘ f) ~ id)\n ( λ H → (htpy-right-whisk (pr2 sf) f) ~ (htpy-left-whisk f H))))\n ( is-contr-Σ\n ( is-contr-sec-is-equiv is-equiv-f)\n ( λ sf → is-contr-equiv'\n ( (x : A) →\n Σ (Id ((pr1 sf) (f x)) x) (λ p → Id ((pr2 sf) (f x)) (ap f p)))\n ( equiv-choice-∞)\n ( is-contr-Π (λ x →\n is-contr-equiv'\n ( fib (ap f) ((pr2 sf) (f x)))\n ( equiv-tot\n ( λ p → equiv-inv (ap f p) ((pr2 sf) (f x))))\n ( is-contr-map-is-equiv\n ( is-emb-is-equiv f is-equiv-f ((pr1 sf) (f x)) x)\n ( (pr2 sf) (f x))))))))\n{-\n is-contr-is-equiv'\n ( Σ (sec f)\n ( λ sf → Σ (((pr1 sf) ∘ f) ~ id)\n ( λ H → (htpy-right-whisk (pr2 sf) f) ~ (htpy-left-whisk f H))))\n ( Σ-assoc (B → A)\n ( λ g → ((f ∘ g) ~ id))\n ( λ sf → Σ (((pr1 sf) ∘ f) ~ id)\n ( λ H → (htpy-right-whisk (pr2 sf) f) ~ (htpy-left-whisk f H))))\n ( is-equiv-Σ-assoc _ _ _)\n ( is-contr-Σ\n ( is-contr-sec-is-equiv is-equiv-f)\n ( λ sf → is-contr-is-equiv'\n ( (x : A) →\n Σ (Id ((pr1 sf) (f x)) x) (λ p → Id ((pr2 sf) (f x)) (ap f p)))\n ( choice-∞)\n ( is-equiv-choice-∞)\n ( is-contr-Π (λ x →\n is-contr-is-equiv'\n ( fib (ap f) ((pr2 sf) (f x)))\n ( tot (λ p → inv))\n ( is-equiv-tot-is-fiberwise-equiv\n ( λ p → is-equiv-inv (ap f p) ((pr2 sf) (f x))))\n ( is-contr-map-is-equiv\n ( is-emb-is-equiv f is-equiv-f ((pr1 sf) (f x)) x)\n ( (pr2 sf) (f x))))))))\n-}\n\nabstract\n is-equiv-is-half-adjoint-equivalence-is-equiv :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n is-equiv (is-half-adjoint-equivalence-is-equiv f)\n is-equiv-is-half-adjoint-equivalence-is-equiv f =\n is-equiv-is-prop\n ( is-subtype-is-equiv f)\n ( is-prop-is-half-adjoint-equivalence f)\n ( is-equiv-is-half-adjoint-equivalence f)\n\n-- Exercise 9.7\n\nis-invertible-id-htpy-id-id :\n {l : Level} (A : UU l) →\n (id {A = A} ~ id {A = A}) → has-inverse (id {A = A})\nis-invertible-id-htpy-id-id A H = pair id (pair refl-htpy H)\n\ntriangle-is-invertible-id-htpy-id-id :\n {l : Level} (A : UU l) →\n ( is-invertible-id-htpy-id-id A) ~\n ( (Σ-assoc (A → A) (λ g → (id ∘ g) ~ id) (λ s → ((pr1 s) ∘ id) ~ id)) ∘\n ( left-unit-law-Σ-map-gen\n ( λ s → ((pr1 s) ∘ id) ~ id)\n ( is-contr-sec-is-equiv (is-equiv-id A)) (pair id refl-htpy)))\ntriangle-is-invertible-id-htpy-id-id A H = refl\n\nabstract\n is-equiv-invertible-id-htpy-id-id :\n {l : Level} (A : UU l) → is-equiv (is-invertible-id-htpy-id-id A)\n is-equiv-invertible-id-htpy-id-id A =\n is-equiv-comp\n ( is-invertible-id-htpy-id-id A)\n ( Σ-assoc (A → A) (λ g → (id ∘ g) ~ id) (λ s → ((pr1 s) ∘ id) ~ id))\n ( left-unit-law-Σ-map-gen\n ( λ s → ((pr1 s) ∘ id) ~ id)\n ( is-contr-sec-is-equiv (is-equiv-id A))\n ( pair id refl-htpy))\n ( triangle-is-invertible-id-htpy-id-id A)\n ( is-equiv-left-unit-law-Σ-map-gen\n ( λ s → ((pr1 s) ∘ id) ~ id)\n ( is-contr-sec-is-equiv (is-equiv-id A))\n ( pair id refl-htpy))\n ( is-equiv-Σ-assoc _ _ _)\n\n-- Exercise 9.8\n\nabstract\n dependent-universal-property-empty :\n {l : Level} (P : empty → UU l) → is-contr ((x : empty) → P x)\n dependent-universal-property-empty P =\n pair\n ( ind-empty {P = P})\n ( λ f → eq-htpy ind-empty)\n\nabstract\n universal-property-empty :\n {l : Level} (X : UU l) → is-contr (empty → X)\n universal-property-empty X = dependent-universal-property-empty (λ t → X)\n\nabstract\n uniqueness-empty :\n {l : Level} (Y : UU l) → ((l' : Level) (X : UU l') →\n is-contr (Y → X)) → is-equiv (ind-empty {P = λ t → Y})\n uniqueness-empty Y H =\n is-equiv-is-equiv-precomp ind-empty\n ( λ l X → is-equiv-is-contr\n ( λ g → g ∘ ind-empty)\n ( H _ X)\n ( universal-property-empty X))\n\nabstract\n universal-property-empty-is-equiv-ind-empty :\n {l : Level} (X : UU l) → is-equiv (ind-empty {P = λ t → X}) →\n ((l' : Level) (Y : UU l') → is-contr (X → Y))\n universal-property-empty-is-equiv-ind-empty X is-equiv-ind-empty l' Y =\n is-contr-is-equiv\n ( empty → Y)\n ( λ f → f ∘ ind-empty)\n ( is-equiv-precomp-is-equiv ind-empty is-equiv-ind-empty Y)\n ( universal-property-empty Y)\n \n-- Exercise 9.9\n\nev-inl-inr :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (P : coprod A B → UU l3) →\n ((t : coprod A B) → P t) → ((x : A) → P (inl x)) × ((y : B) → P (inr y))\nev-inl-inr P s = pair (λ x → s (inl x)) (λ y → s (inr y))\n\nabstract\n dependent-universal-property-coprod :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2}\n (P : coprod A B → UU l3) → is-equiv (ev-inl-inr P)\n dependent-universal-property-coprod P =\n is-equiv-has-inverse\n ( λ p → ind-coprod P (pr1 p) (pr2 p))\n ( ind-Σ (λ f g → eq-pair-triv (pair refl refl)))\n ( λ s → eq-htpy (ind-coprod _ (λ x → refl) λ y → refl))\n\nabstract\n universal-property-coprod :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (X : UU l3) →\n is-equiv (ev-inl-inr (λ (t : coprod A B) → X))\n universal-property-coprod X = dependent-universal-property-coprod (λ t → X)\n\nabstract\n uniqueness-coprod :\n { l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {Y : UU l3}\n ( i : A → Y) (j : B → Y) →\n ( (l : Level) (X : UU l) →\n is-equiv (λ (s : Y → X) → pair' (s ∘ i) (s ∘ j))) →\n is-equiv (ind-coprod (λ t → Y) i j)\n uniqueness-coprod {Y = Y} i j H =\n is-equiv-is-equiv-precomp\n ( ind-coprod _ i j)\n ( λ l X → is-equiv-right-factor\n ( λ (s : Y → X) → pair (s ∘ i) (s ∘ j))\n ( ev-inl-inr (λ t → X))\n ( precomp (ind-coprod (λ t → Y) i j) X)\n ( λ s → refl)\n ( universal-property-coprod X)\n ( H _ X))\n\nabstract\n universal-property-coprod-is-equiv-ind-coprod :\n { l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (X : UU l3)\n ( i : A → X) (j : B → X) → is-equiv (ind-coprod (λ t → X) i j) →\n ( (l4 : Level) (Y : UU l4) →\n is-equiv (λ (s : X → Y) → pair' (s ∘ i) (s ∘ j)))\n universal-property-coprod-is-equiv-ind-coprod X i j is-equiv-ind-coprod l Y =\n is-equiv-comp\n ( λ s → pair (s ∘ i) (s ∘ j))\n ( ev-inl-inr (λ t → Y))\n ( precomp (ind-coprod (λ t → X) i j) Y)\n ( λ s → refl)\n ( is-equiv-precomp-is-equiv\n ( ind-coprod (λ t → X) i j)\n ( is-equiv-ind-coprod)\n ( Y))\n ( universal-property-coprod Y)\n\n-- Exercise 9.10\n\nev-star :\n {l : Level} (P : unit → UU l) → ((x : unit) → P x) → P star\nev-star P f = f star\n\nabstract\n dependent-universal-property-unit :\n {l : Level} (P : unit → UU l) → is-equiv (ev-star P)\n dependent-universal-property-unit P =\n is-equiv-has-inverse\n ( ind-unit)\n ( λ p → refl)\n ( λ f → eq-htpy (ind-unit refl))\n\nequiv-ev-star :\n {l : Level} (P : unit → UU l) → ((x : unit) → P x) ≃ P star\nequiv-ev-star P = pair (ev-star P) (dependent-universal-property-unit P)\n\nev-star' :\n {l : Level} (Y : UU l) → (unit → Y) → Y\nev-star' Y = ev-star (λ t → Y)\n\nabstract\n universal-property-unit :\n {l : Level} (Y : UU l) → is-equiv (ev-star' Y)\n universal-property-unit Y = dependent-universal-property-unit (λ t → Y)\n\nequiv-ev-star' :\n {l : Level} (Y : UU l) → (unit → Y) ≃ Y\nequiv-ev-star' Y = pair (ev-star' Y) (universal-property-unit Y)\n\nabstract\n is-equiv-ind-unit-universal-property-unit :\n {l1 : Level} (X : UU l1) (x : X) →\n ((l2 : Level) (Y : UU l2) → is-equiv (λ (f : X → Y) → f x)) →\n is-equiv (ind-unit {P = λ t → X} x)\n is-equiv-ind-unit-universal-property-unit X x H =\n is-equiv-is-equiv-precomp\n ( ind-unit x)\n ( λ l Y → is-equiv-right-factor\n ( λ f → f x)\n ( ev-star (λ t → Y))\n ( precomp (ind-unit x) Y)\n ( λ f → refl)\n ( universal-property-unit Y)\n ( H _ Y))\n\nabstract\n universal-property-unit-is-equiv-ind-unit :\n {l1 : Level} (X : UU l1) (x : X) →\n is-equiv (ind-unit {P = λ t → X} x) →\n ((l2 : Level) (Y : UU l2) → is-equiv (λ (f : X → Y) → f x))\n universal-property-unit-is-equiv-ind-unit X x is-equiv-ind-unit l2 Y =\n is-equiv-comp\n ( λ f → f x)\n ( ev-star (λ t → Y))\n ( precomp (ind-unit x) Y)\n ( λ f → refl)\n ( is-equiv-precomp-is-equiv (ind-unit x) is-equiv-ind-unit Y)\n ( universal-property-unit Y)\n \n-- Exercise 9.11\n\nEq-sec :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n sec f → sec f → UU (l1 ⊔ l2)\nEq-sec f sec-f sec-f' =\n Σ ( (pr1 sec-f) ~ (pr1 sec-f'))\n ( λ H → (pr2 sec-f) ~ ((f ·l H) ∙h (pr2 sec-f')))\n\nreflexive-Eq-sec :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n (sec-f : sec f) → Eq-sec f sec-f sec-f\nreflexive-Eq-sec f (pair g G) = pair refl-htpy refl-htpy\n\nEq-sec-eq :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n (sec-f sec-f' : sec f) → Id sec-f sec-f' → Eq-sec f sec-f sec-f'\nEq-sec-eq f sec-f .sec-f refl = reflexive-Eq-sec f sec-f\n\nabstract\n is-contr-total-Eq-sec :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) (sec-f : sec f) →\n is-contr (Σ (sec f) (Eq-sec f sec-f))\n is-contr-total-Eq-sec f (pair g G) =\n is-contr-total-Eq-structure\n ( λ g' G' H → G ~ ((f ·l H) ∙h G'))\n ( is-contr-total-htpy g)\n ( pair g refl-htpy)\n ( is-contr-total-htpy G)\n\nabstract\n is-equiv-Eq-sec-eq :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n (sec-f sec-f' : sec f) → is-equiv (Eq-sec-eq f sec-f sec-f')\n is-equiv-Eq-sec-eq f sec-f =\n fundamental-theorem-id sec-f\n ( reflexive-Eq-sec f sec-f)\n ( is-contr-total-Eq-sec f sec-f)\n ( Eq-sec-eq f sec-f)\n \n eq-Eq-sec :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n {sec-f sec-f' : sec f} → Eq-sec f sec-f sec-f' → Id sec-f sec-f'\n eq-Eq-sec f {sec-f} {sec-f'} =\n inv-is-equiv (is-equiv-Eq-sec-eq f sec-f sec-f')\n\nisretr-section-comp :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}\n (f : A → X) (g : B → X) (h : A → B) (H : f ~ (g ∘ h)) (sec-h : sec h) →\n ((section-comp f g h H sec-h) ∘ (section-comp' f g h H sec-h)) ~ id\nisretr-section-comp f g h H (pair k K) (pair l L) =\n eq-Eq-sec g\n ( pair\n ( K ·r l)\n ( ( htpy-inv\n ( htpy-assoc\n ( htpy-inv (H ·r (k ∘ l)))\n ( H ·r (k ∘ l))\n ( (g ·l (K ·r l)) ∙h L))) ∙h\n ( htpy-ap-concat'\n ( (htpy-inv (H ·r (k ∘ l))) ∙h (H ·r (k ∘ l)))\n ( refl-htpy)\n ( (g ·l (K ·r l)) ∙h L)\n ( htpy-left-inv (H ·r (k ∘ l))))))\n\nsec-left-factor-retract-of-sec-composition :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}\n (f : A → X) (g : B → X) (h : A → B) (H : f ~ (g ∘ h)) →\n sec h → (sec g) retract-of (sec f)\nsec-left-factor-retract-of-sec-composition {X = X} f g h H sec-h =\n pair\n ( section-comp' f g h H sec-h)\n ( pair\n ( section-comp f g h H sec-h)\n ( isretr-section-comp f g h H sec-h))\n\nEq-retr :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n retr f → retr f → UU (l1 ⊔ l2)\nEq-retr f retr-f retr-f' =\n Σ ( (pr1 retr-f) ~ (pr1 retr-f'))\n ( λ H → (pr2 retr-f) ~ ((H ·r f) ∙h (pr2 retr-f')))\n\nreflexive-Eq-retr :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n (retr-f : retr f) → Eq-retr f retr-f retr-f\nreflexive-Eq-retr f (pair h H) = pair refl-htpy refl-htpy\n\nEq-retr-eq :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n (retr-f retr-f' : retr f) → Id retr-f retr-f' → Eq-retr f retr-f retr-f'\nEq-retr-eq f retr-f .retr-f refl = reflexive-Eq-retr f retr-f\n\nabstract\n is-contr-total-Eq-retr :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) (retr-f : retr f) →\n is-contr (Σ (retr f) (Eq-retr f retr-f))\n is-contr-total-Eq-retr f (pair h H) =\n is-contr-total-Eq-structure\n ( λ h' H' K → H ~ ((K ·r f) ∙h H'))\n ( is-contr-total-htpy h)\n ( pair h refl-htpy)\n ( is-contr-total-htpy H)\n\nabstract\n is-equiv-Eq-retr-eq :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n (retr-f retr-f' : retr f) → is-equiv (Eq-retr-eq f retr-f retr-f')\n is-equiv-Eq-retr-eq f retr-f =\n fundamental-theorem-id retr-f\n ( reflexive-Eq-retr f retr-f)\n ( is-contr-total-Eq-retr f retr-f)\n ( Eq-retr-eq f retr-f)\n \n eq-Eq-retr :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n {retr-f retr-f' : retr f} → Eq-retr f retr-f retr-f' → Id retr-f retr-f'\n eq-Eq-retr f {retr-f} {retr-f'} =\n inv-is-equiv (is-equiv-Eq-retr-eq f retr-f retr-f')\n\nisretr-retraction-comp :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}\n (f : A → X) (g : B → X) (h : A → B) (H : f ~ (g ∘ h)) (retr-g : retr g) →\n ((retraction-comp f g h H retr-g) ∘ (retraction-comp' f g h H retr-g)) ~ id\nisretr-retraction-comp f g h H (pair l L) (pair k K) =\n eq-Eq-retr h\n ( pair\n ( k ·l L)\n ( ( htpy-inv\n ( htpy-assoc\n ( htpy-inv ((k ∘ l) ·l H))\n ( (k ∘ l) ·l H)\n ( (k ·l (L ·r h)) ∙h K))) ∙h\n ( htpy-ap-concat'\n ( (htpy-inv ((k ∘ l) ·l H)) ∙h ((k ∘ l) ·l H))\n ( refl-htpy)\n ( (k ·l (L ·r h)) ∙h K)\n ( htpy-left-inv ((k ∘ l) ·l H)))))\n \nsec-right-factor-retract-of-sec-left-factor :\n {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}\n (f : A → X) (g : B → X) (h : A → B) (H : f ~ (g ∘ h)) →\n retr g → (retr h) retract-of (retr f)\nsec-right-factor-retract-of-sec-left-factor f g h H retr-g =\n pair\n ( retraction-comp' f g h H retr-g)\n ( pair\n ( retraction-comp f g h H retr-g)\n ( isretr-retraction-comp f g h H retr-g))\n\n-- Exercise 9.12\n\npostcomp-Π :\n {l1 l2 l3 : Level} {I : UU l1} {A : I → UU l2} {B : I → UU l3}\n (e : (i : I) → A i → B i) →\n ((i : I) → A i) → ((i : I) → B i)\npostcomp-Π e f i = e i (f i)\n\nhtpy-postcomp-Π :\n {l1 l2 l3 : Level} {I : UU l1} {A : I → UU l2} {B : I → UU l3}\n {f f' : (i : I) → A i → B i} (H : (i : I) → (f i) ~ (f' i)) →\n (postcomp-Π f) ~ (postcomp-Π f')\nhtpy-postcomp-Π H h = eq-htpy (λ i → H i (h i))\n\nabstract\n is-equiv-postcomp-Π :\n {l1 l2 l3 : Level} {I : UU l1} {A : I → UU l2} {B : I → UU l3}\n (e : (i : I) → A i → B i) (is-equiv-e : is-fiberwise-equiv e) →\n is-equiv (postcomp-Π e)\n is-equiv-postcomp-Π e is-equiv-e =\n is-equiv-has-inverse\n ( λ g i → inv-is-equiv (is-equiv-e i) (g i))\n ( λ g → eq-htpy (λ i → issec-inv-is-equiv (is-equiv-e i) (g i)))\n ( λ f → eq-htpy (λ i → isretr-inv-is-equiv (is-equiv-e i) (f i)))\n\nequiv-postcomp-Π :\n {l1 l2 l3 : Level} {I : UU l1} {A : I → UU l2} {B : I → UU l3}\n (e : (i : I) → (A i) ≃ (B i)) → ((i : I) → A i) ≃ ((i : I) → B i)\nequiv-postcomp-Π e =\n pair\n ( postcomp-Π (λ i → map-equiv (e i)))\n ( is-equiv-postcomp-Π _ (λ i → is-equiv-map-equiv (e i)))\n\n-- Exercise 9.13\n\nhom-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) → UU (l1 ⊔ (l2 ⊔ l3))\nhom-slice {A = A} {B} f g = Σ (A → B) (λ h → f ~ (g ∘ h))\n\nmap-hom-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) → hom-slice f g → A → B\nmap-hom-slice f g h = pr1 h\n\ntriangle-hom-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) (h : hom-slice f g) →\n f ~ (g ∘ (map-hom-slice f g h))\ntriangle-hom-slice f g h = pr2 h\n \nfiberwise-hom-hom-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n hom-slice f g → (x : X) → (fib f x) → (fib g x)\nfiberwise-hom-hom-slice f g (pair h H) = fib-triangle f g h H\n\nhom-slice-fiberwise-hom :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n ((x : X) → (fib f x) → (fib g x)) → hom-slice f g\nhom-slice-fiberwise-hom f g α =\n pair\n ( λ a → pr1 (α (f a) (pair a refl)))\n ( λ a → inv (pr2 (α (f a) (pair a refl))))\n\nissec-hom-slice-fiberwise-hom-eq-htpy :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) (α : (x : X) → (fib f x) → (fib g x)) (x : X) →\n (fiberwise-hom-hom-slice f g (hom-slice-fiberwise-hom f g α) x) ~ (α x)\nissec-hom-slice-fiberwise-hom-eq-htpy f g α .(f a) (pair a refl) =\n eq-pair refl (inv-inv (pr2 (α (f a) (pair a refl))))\n\nissec-hom-slice-fiberwise-hom :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n ((fiberwise-hom-hom-slice f g) ∘ (hom-slice-fiberwise-hom f g)) ~ id\nissec-hom-slice-fiberwise-hom f g α =\n eq-htpy (λ x → eq-htpy (issec-hom-slice-fiberwise-hom-eq-htpy f g α x))\n\nisretr-hom-slice-fiberwise-hom :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n ((hom-slice-fiberwise-hom f g) ∘ (fiberwise-hom-hom-slice f g)) ~ id\nisretr-hom-slice-fiberwise-hom f g (pair h H) =\n eq-pair refl (eq-htpy (λ a → (inv-inv (H a))))\n\nabstract\n is-equiv-fiberwise-hom-hom-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n is-equiv (fiberwise-hom-hom-slice f g)\n is-equiv-fiberwise-hom-hom-slice f g =\n is-equiv-has-inverse\n ( hom-slice-fiberwise-hom f g)\n ( issec-hom-slice-fiberwise-hom f g)\n ( isretr-hom-slice-fiberwise-hom f g)\n\nabstract\n is-equiv-hom-slice-fiberwise-hom :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n is-equiv (hom-slice-fiberwise-hom f g)\n is-equiv-hom-slice-fiberwise-hom f g =\n is-equiv-has-inverse\n ( fiberwise-hom-hom-slice f g)\n ( isretr-hom-slice-fiberwise-hom f g)\n ( issec-hom-slice-fiberwise-hom f g)\n\nequiv-slice :\n {l1 l2 l3 : Level} (X : UU l1) {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) → UU (l1 ⊔ (l2 ⊔ l3))\nequiv-slice X {A} {B} f g = Σ (A ≃ B) (λ e → f ~ (g ∘ (map-equiv e)))\n\nhom-slice-equiv-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n equiv-slice X f g → hom-slice f g\nhom-slice-equiv-slice f g (pair (pair h is-equiv-h) H) = pair h H\n\n{- We first prove two closely related generic lemmas that establishes \n equivalences of subtypes -}\n\nabstract\n is-equiv-subtype-is-equiv :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2}\n {P : A → UU l3} {Q : B → UU l4}\n (is-subtype-P : is-subtype P) (is-subtype-Q : is-subtype Q)\n (f : A → B) (g : (x : A) → P x → Q (f x)) →\n is-equiv f → ((x : A) → (Q (f x)) → P x) → is-equiv (toto Q f g)\n is-equiv-subtype-is-equiv {Q = Q} is-subtype-P is-subtype-Q f g is-equiv-f h =\n is-equiv-toto-is-fiberwise-equiv-is-equiv-base-map Q f g is-equiv-f\n ( λ x → is-equiv-is-prop (is-subtype-P x) (is-subtype-Q (f x)) (h x))\n\nabstract\n is-equiv-subtype-is-equiv' :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2}\n {P : A → UU l3} {Q : B → UU l4}\n (is-subtype-P : is-subtype P) (is-subtype-Q : is-subtype Q)\n (f : A → B) (g : (x : A) → P x → Q (f x)) →\n (is-equiv-f : is-equiv f) →\n ((y : B) → (Q y) → P (inv-is-equiv is-equiv-f y)) →\n is-equiv (toto Q f g)\n is-equiv-subtype-is-equiv' {P = P} {Q}\n is-subtype-P is-subtype-Q f g is-equiv-f h =\n is-equiv-toto-is-fiberwise-equiv-is-equiv-base-map Q f g is-equiv-f\n ( λ x → is-equiv-is-prop (is-subtype-P x) (is-subtype-Q (f x))\n ( (tr P (isretr-inv-is-equiv is-equiv-f x)) ∘ (h (f x))))\n\nabstract\n is-fiberwise-equiv-fiberwise-equiv-equiv-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X)\n (t : hom-slice f g) → is-equiv (pr1 t) →\n is-fiberwise-equiv (fiberwise-hom-hom-slice f g t)\n is-fiberwise-equiv-fiberwise-equiv-equiv-slice f g (pair h H) =\n is-fiberwise-equiv-is-equiv-triangle f g h H\n\nleft-factor-fiberwise-equiv-equiv-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n Σ (hom-slice f g) (λ hH → is-equiv (pr1 hH)) →\n Σ ((x : X) → (fib f x) → (fib g x)) is-fiberwise-equiv\nleft-factor-fiberwise-equiv-equiv-slice f g =\n toto\n ( is-fiberwise-equiv)\n ( fiberwise-hom-hom-slice f g)\n ( is-fiberwise-equiv-fiberwise-equiv-equiv-slice f g)\n\nswap-equiv-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n equiv-slice X f g →\n Σ (hom-slice f g) (λ hH → is-equiv (pr1 hH))\nswap-equiv-slice {A = A} {B} f g =\n double-structure-swap (A → B) is-equiv (λ h → f ~ (g ∘ h))\n\nabstract\n is-equiv-swap-equiv-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n is-equiv (swap-equiv-slice f g)\n is-equiv-swap-equiv-slice f g =\n is-equiv-double-structure-swap _ is-equiv (λ h → (f ~ (g ∘ h)))\n\nabstract\n fiberwise-equiv-equiv-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n equiv-slice X f g → Σ ((x : X) → (fib f x) → (fib g x)) is-fiberwise-equiv\n fiberwise-equiv-equiv-slice {X = X} {A} {B} f g =\n ( left-factor-fiberwise-equiv-equiv-slice f g) ∘\n ( swap-equiv-slice f g)\n\nabstract\n is-equiv-hom-slice-is-fiberwise-equiv-fiberwise-hom-hom-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n (t : hom-slice f g) →\n ((x : X) → is-equiv (fiberwise-hom-hom-slice f g t x)) →\n is-equiv (pr1 t)\n is-equiv-hom-slice-is-fiberwise-equiv-fiberwise-hom-hom-slice\n f g (pair h H) =\n is-equiv-triangle-is-fiberwise-equiv f g h H\n\nabstract\n is-equiv-fiberwise-equiv-equiv-slice :\n {l1 l2 l3 : Level} {X : UU l1} {A : UU l2} {B : UU l3}\n (f : A → X) (g : B → X) →\n is-equiv (fiberwise-equiv-equiv-slice f g)\n is-equiv-fiberwise-equiv-equiv-slice {X = X} {A} {B} f g =\n is-equiv-comp\n ( fiberwise-equiv-equiv-slice f g)\n ( left-factor-fiberwise-equiv-equiv-slice f g)\n ( swap-equiv-slice f g)\n ( refl-htpy)\n ( is-equiv-swap-equiv-slice f g)\n ( is-equiv-subtype-is-equiv\n ( λ t → is-subtype-is-equiv (pr1 t))\n ( λ α → is-prop-Π (λ x → is-subtype-is-equiv (α x)))\n ( fiberwise-hom-hom-slice f g)\n ( is-fiberwise-equiv-fiberwise-equiv-equiv-slice f g)\n ( is-equiv-fiberwise-hom-hom-slice f g)\n ( is-equiv-hom-slice-is-fiberwise-equiv-fiberwise-hom-hom-slice\n f g))\n\n-- Exercise 9.14\n\nhom-over-morphism :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) → UU (l1 ⊔ (l2 ⊔ l4))\nhom-over-morphism i f g = hom-slice (i ∘ f) g\n\nfiberwise-hom-hom-over-morphism :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) →\n hom-over-morphism i f g → (x : X) → (fib f x) → (fib g (i x))\nfiberwise-hom-hom-over-morphism i f g (pair h H) .(f a) (pair a refl) =\n pair (h a) (inv (H a))\n\nhom-over-morphism-fiberwise-hom :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) →\n ((x : X) → (fib f x) → (fib g (i x))) → hom-over-morphism i f g\nhom-over-morphism-fiberwise-hom i f g α =\n pair\n ( λ a → pr1 (α (f a) (pair a refl)))\n ( λ a → inv (pr2 (α (f a) (pair a refl))))\n\nissec-hom-over-morphism-fiberwise-hom-eq-htpy :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) →\n (α : (x : X) → (fib f x) → (fib g (i x))) (x : X) →\n ( fiberwise-hom-hom-over-morphism i f g\n ( hom-over-morphism-fiberwise-hom i f g α) x) ~ (α x)\nissec-hom-over-morphism-fiberwise-hom-eq-htpy i f g α .(f a) (pair a refl) =\n eq-pair refl (inv-inv (pr2 (α (f a) (pair a refl))))\n\nissec-hom-over-morphism-fiberwise-hom :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) →\n ( ( fiberwise-hom-hom-over-morphism i f g) ∘\n ( hom-over-morphism-fiberwise-hom i f g)) ~ id\nissec-hom-over-morphism-fiberwise-hom i f g α =\n eq-htpy\n ( λ x →\n ( eq-htpy\n ( issec-hom-over-morphism-fiberwise-hom-eq-htpy i f g α x)))\n\nisretr-hom-over-morphism-fiberwise-hom :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) →\n ( ( hom-over-morphism-fiberwise-hom i f g) ∘\n ( fiberwise-hom-hom-over-morphism i f g)) ~ id\nisretr-hom-over-morphism-fiberwise-hom i f g (pair h H) =\n eq-pair refl (eq-htpy (λ a → (inv-inv (H a))))\n\nabstract\n is-equiv-fiberwise-hom-hom-over-morphism :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) →\n is-equiv (fiberwise-hom-hom-over-morphism i f g)\n is-equiv-fiberwise-hom-hom-over-morphism i f g =\n is-equiv-has-inverse\n ( hom-over-morphism-fiberwise-hom i f g)\n ( issec-hom-over-morphism-fiberwise-hom i f g)\n ( isretr-hom-over-morphism-fiberwise-hom i f g)\n\nabstract\n is-equiv-hom-over-morphism-fiberwise-hom :\n {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4}\n (i : X → Y) (f : A → X) (g : B → Y) →\n is-equiv (hom-over-morphism-fiberwise-hom i f g)\n is-equiv-hom-over-morphism-fiberwise-hom i f g =\n is-equiv-has-inverse\n ( fiberwise-hom-hom-over-morphism i f g)\n ( isretr-hom-over-morphism-fiberwise-hom i f g)\n ( issec-hom-over-morphism-fiberwise-hom i f g)\n\n-- Exercise 9.15\n\nset-isomorphism :\n {l1 l2 : Level} (A : UU-Set l1) (B : UU-Set l2) → UU (l1 ⊔ l2)\nset-isomorphism A B =\n Σ ((pr1 A) → (pr1 B)) has-inverse\n\nhas-inverse-is-half-adjoint-equivalence :\n {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →\n is-half-adjoint-equivalence f → has-inverse f\nhas-inverse-is-half-adjoint-equivalence f =\n tot (λ g → tot (λ G → pr1))\n\nset-isomorphism-equiv-fiberwise :\n {l1 l2 : Level} (A : UU-Set l1) (B : UU-Set l2) →\n (f : (pr1 A) → (pr1 B)) → is-equiv f → has-inverse f\nset-isomorphism-equiv-fiberwise A B f =\n ( has-inverse-is-half-adjoint-equivalence f) ∘\n ( is-half-adjoint-equivalence-is-equiv f)\n\nabstract\n is-equiv-has-inverse-is-half-adjoint-equivalence-is-set :\n {l1 l2 : Level} (A : UU-Set l1) (B : UU-Set l2) (f : (pr1 A) → (pr1 B)) →\n is-equiv (has-inverse-is-half-adjoint-equivalence f)\n is-equiv-has-inverse-is-half-adjoint-equivalence-is-set\n (pair A is-set-A) (pair B is-set-B) f =\n is-equiv-tot-is-fiberwise-equiv\n ( λ g → is-equiv-tot-is-fiberwise-equiv\n ( λ G → is-equiv-pr1-is-contr\n ( coherence-is-half-adjoint-equivalence f g G)\n ( λ H → is-contr-Π\n ( λ x → is-set-B _ _ (G (f x)) (ap f (H x))))))\n\nabstract\n is-fiberwise-equiv-set-isomorphism-equiv-fiberwise :\n {l1 l2 : Level} (A : UU-Set l1) (B : UU-Set l2) →\n is-fiberwise-equiv (set-isomorphism-equiv-fiberwise A B)\n is-fiberwise-equiv-set-isomorphism-equiv-fiberwise A B f =\n is-equiv-comp\n ( set-isomorphism-equiv-fiberwise A B f)\n ( has-inverse-is-half-adjoint-equivalence f)\n ( is-half-adjoint-equivalence-is-equiv f)\n ( refl-htpy)\n ( is-equiv-is-half-adjoint-equivalence-is-equiv f)\n ( is-equiv-has-inverse-is-half-adjoint-equivalence-is-set A B f)\n\nset-isomorphism-equiv :\n {l1 l2 : Level} (A : UU-Set l1) (B : UU-Set l2) →\n ((pr1 A) ≃ (pr1 B)) → set-isomorphism A B\nset-isomorphism-equiv A B =\n tot (set-isomorphism-equiv-fiberwise A B)\n\nabstract\n is-equiv-set-isomorphism-equiv :\n {l1 l2 : Level} (A : UU-Set l1) (B : UU-Set l2) →\n is-equiv (set-isomorphism-equiv A B)\n is-equiv-set-isomorphism-equiv A B =\n is-equiv-tot-is-fiberwise-equiv\n ( is-fiberwise-equiv-set-isomorphism-equiv-fiberwise A B)\n\n{- Some lemmas about equivalences on Π-types -}\n\nabstract\n is-equiv-htpy-inv-con :\n { l1 l2 : Level} {A : UU l1} {B : A → UU l2} {f g h : (x : A) → B x}\n ( H : f ~ g) (K : g ~ h) (L : f ~ h) →\n is-equiv (htpy-inv-con H K L)\n is-equiv-htpy-inv-con H K L =\n is-equiv-postcomp-Π _ (λ x → is-equiv-inv-con (H x) (K x) (L x))\n\nequiv-htpy-inv-con :\n { l1 l2 : Level} {A : UU l1} {B : A → UU l2} {f g h : (x : A) → B x}\n ( H : f ~ g) (K : g ~ h) (L : f ~ h) →\n ( (H ∙h K) ~ L) ≃ (K ~ ((htpy-inv H) ∙h L))\nequiv-htpy-inv-con H K L =\n pair\n ( htpy-inv-con H K L)\n ( is-equiv-htpy-inv-con H K L)\n\nabstract\n is-equiv-htpy-con-inv :\n { l1 l2 : Level} {A : UU l1} {B : A → UU l2} {f g h : (x : A) → B x}\n ( H : f ~ g) (K : g ~ h) (L : f ~ h) →\n is-equiv (htpy-con-inv H K L)\n is-equiv-htpy-con-inv H K L =\n is-equiv-postcomp-Π _ (λ x → is-equiv-con-inv (H x) (K x) (L x))\n\nequiv-htpy-con-inv :\n { l1 l2 : Level} {A : UU l1} {B : A → UU l2} {f g h : (x : A) → B x}\n ( H : f ~ g) (K : g ~ h) (L : f ~ h) →\n ( (H ∙h K) ~ L) ≃ (H ~ (L ∙h (htpy-inv K)))\nequiv-htpy-con-inv H K L =\n pair\n ( htpy-con-inv H K L)\n ( is-equiv-htpy-con-inv H K L)\n\nmap-equiv-Π :\n { l1 l2 l3 l4 : Level}\n { A' : UU l1} {B' : A' → UU l2} {A : UU l3} (B : A → UU l4)\n ( e : A' ≃ A) (f : (a' : A') → B' a' ≃ B (map-equiv e a')) →\n ( (a' : A') → B' a') → ( (a : A) → B a)\nmap-equiv-Π {B' = B'} B e f =\n ( postcomp-Π (λ a →\n ( tr B (issec-inv-is-equiv (is-equiv-map-equiv e) a)) ∘\n ( map-equiv (f (inv-is-equiv (is-equiv-map-equiv e) a))))) ∘\n ( precomp-Π (inv-is-equiv (is-equiv-map-equiv e)) B')\n\nid-map-equiv-Π :\n { l1 l2 : Level} {A : UU l1} (B : A → UU l2) →\n ( map-equiv-Π B (equiv-id A) (λ a → equiv-id (B a))) ~ id\nid-map-equiv-Π B = refl-htpy\n\nabstract\n is-equiv-map-equiv-Π :\n { l1 l2 l3 l4 : Level}\n { A' : UU l1} {B' : A' → UU l2} {A : UU l3} (B : A → UU l4)\n ( e : A' ≃ A) (f : (a' : A') → B' a' ≃ B (map-equiv e a')) →\n is-equiv (map-equiv-Π B e f)\n is-equiv-map-equiv-Π {B' = B'} B e f =\n is-equiv-comp'\n ( postcomp-Π (λ a →\n ( tr B (issec-inv-is-equiv (is-equiv-map-equiv e) a)) ∘\n ( map-equiv (f (inv-is-equiv (is-equiv-map-equiv e) a)))))\n ( precomp-Π (inv-is-equiv (is-equiv-map-equiv e)) B')\n ( is-equiv-precomp-Π-is-equiv\n ( inv-is-equiv (is-equiv-map-equiv e))\n ( is-equiv-inv-is-equiv (is-equiv-map-equiv e))\n ( B'))\n ( is-equiv-postcomp-Π _\n ( λ a → is-equiv-comp'\n ( tr B (issec-inv-is-equiv (is-equiv-map-equiv e) a))\n ( map-equiv (f (inv-is-equiv (is-equiv-map-equiv e) a)))\n ( is-equiv-map-equiv (f (inv-is-equiv (is-equiv-map-equiv e) a)))\n ( is-equiv-tr B (issec-inv-is-equiv (is-equiv-map-equiv e) a))))\n\nequiv-Π :\n { l1 l2 l3 l4 : Level}\n { A' : UU l1} {B' : A' → UU l2} {A : UU l3} (B : A → UU l4)\n ( e : A' ≃ A) (f : (a' : A') → B' a' ≃ B (map-equiv e a')) →\n ( (a' : A') → B' a') ≃ ( (a : A) → B a)\nequiv-Π B e f = pair (map-equiv-Π B e f) (is-equiv-map-equiv-Π B e f)\n\nHTPY-map-equiv-Π :\n { l1 l2 l3 l4 : Level}\n { A' : UU l1} (B' : A' → UU l2) {A : UU l3} (B : A → UU l4)\n ( e e' : A' ≃ A) (H : htpy-equiv e e') →\n UU (l1 ⊔ (l2 ⊔ (l3 ⊔ l4)))\nHTPY-map-equiv-Π {A' = A'} B' {A} B e e' H =\n ( f : (a' : A') → B' a' ≃ B (map-equiv e a')) →\n ( f' : (a' : A') → B' a' ≃ B (map-equiv e' a')) →\n ( K : (a' : A') → ((tr B (H a')) ∘ (map-equiv (f a'))) ~ (map-equiv (f' a'))) →\n ( map-equiv-Π B e f) ~ (map-equiv-Π B e' f')\n\nhtpy-map-equiv-Π-refl-htpy :\n { l1 l2 l3 l4 : Level}\n { A' : UU l1} {B' : A' → UU l2} {A : UU l3} (B : A → UU l4)\n ( e : A' ≃ A) →\n HTPY-map-equiv-Π B' B e e (reflexive-htpy-equiv e)\nhtpy-map-equiv-Π-refl-htpy {B' = B'} B e f f' K =\n ( htpy-postcomp-Π\n ( λ a →\n ( tr B (issec-inv-is-equiv (is-equiv-map-equiv e) a)) ·l\n ( K (inv-is-equiv (is-equiv-map-equiv e) a)))) ·r\n ( precomp-Π (inv-is-equiv (is-equiv-map-equiv e)) B')\n\nabstract\n htpy-map-equiv-Π :\n { l1 l2 l3 l4 : Level}\n { A' : UU l1} {B' : A' → UU l2} {A : UU l3} (B : A → UU l4)\n ( e e' : A' ≃ A) (H : htpy-equiv e e') →\n HTPY-map-equiv-Π B' B e e' H\n htpy-map-equiv-Π {B' = B'} B e e' H f f' K =\n ind-htpy-equiv e\n ( HTPY-map-equiv-Π B' B e)\n ( htpy-map-equiv-Π-refl-htpy B e)\n e' H f f' K\n \n comp-htpy-map-equiv-Π :\n { l1 l2 l3 l4 : Level}\n { A' : UU l1} {B' : A' → UU l2} {A : UU l3} (B : A → UU l4)\n ( e : A' ≃ A) →\n Id ( htpy-map-equiv-Π {B' = B'} B e e (reflexive-htpy-equiv e))\n ( ( htpy-map-equiv-Π-refl-htpy B e))\n comp-htpy-map-equiv-Π {B' = B'} B e =\n comp-htpy-equiv e\n ( HTPY-map-equiv-Π B' B e)\n ( htpy-map-equiv-Π-refl-htpy B e)\n\nmap-automorphism-Π :\n { l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n ( e : A ≃ A) (f : (a : A) → B a ≃ B (map-equiv e a)) →\n ( (a : A) → B a) → ((a : A) → B a)\nmap-automorphism-Π {B = B} e f =\n ( postcomp-Π (λ a → (inv-is-equiv (is-equiv-map-equiv (f a))))) ∘\n ( precomp-Π (map-equiv e) B)\n\nabstract\n is-equiv-map-automorphism-Π :\n { l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n ( e : A ≃ A) (f : (a : A) → B a ≃ B (map-equiv e a)) →\n is-equiv (map-automorphism-Π e f)\n is-equiv-map-automorphism-Π {B = B} e f =\n is-equiv-comp' _ _\n ( is-equiv-precomp-Π-is-equiv _ (is-equiv-map-equiv e) B)\n ( is-equiv-postcomp-Π _\n ( λ a → is-equiv-inv-is-equiv (is-equiv-map-equiv (f a))))\n\nautomorphism-Π :\n { l1 l2 : Level} {A : UU l1} {B : A → UU l2}\n ( e : A ≃ A) (f : (a : A) → B a ≃ B (map-equiv e a)) →\n ( (a : A) → B a) ≃ ((a : A) → B a)\nautomorphism-Π e f =\n pair (map-automorphism-Π e f) (is-equiv-map-automorphism-Π e f)\n\n-- is-contr-total-Eq-Π\n\nis-contr-total-Eq-Π :\n { l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} (C : (x : A) → B x → UU l3) →\n ( is-contr-total-C : (x : A) → is-contr (Σ (B x) (C x))) →\n ( f : (x : A) → B x) →\n is-contr (Σ ((x : A) → B x) (λ g → (x : A) → C x (g x)))\nis-contr-total-Eq-Π {A = A} {B} C is-contr-total-C f =\n is-contr-equiv'\n ( (x : A) → Σ (B x) (C x))\n ( equiv-choice-∞)\n ( is-contr-Π is-contr-total-C)\n\n", "meta": {"hexsha": "4c674ab91606e7d477cb87659262326ed5656725", "size": 68912, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/11-function-extensionality.agda", "max_stars_repo_name": "hemangandhi/HoTT-Intro", "max_stars_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Agda/11-function-extensionality.agda", "max_issues_repo_name": "hemangandhi/HoTT-Intro", "max_issues_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/11-function-extensionality.agda", "max_forks_repo_name": "hemangandhi/HoTT-Intro", "max_forks_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.2852022529, "max_line_length": 220, "alphanum_fraction": 0.519982006, "num_tokens": 29506, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.843895106480586, "lm_q2_score": 0.7981867801399694, "lm_q1q2_score": 0.6735859178176155}} {"text": "module Part2_Agda_in_a_Nutshell where\n\n{-\nhttps://serokell.io/blog/agda-in-nutshell\n\nDanya Rogozin\nMonday, November 26th, 2018\n\nTheorem proving in Agda based on a constructive logical framework.\nDependently typed programming and theorem proving in Agda.\nExample use of Agda in the formalisation of algebra.\n\n------------------------------------------------------------------------------\nGeneral\n\ndependently typed : based on variant of Martin-Löf type theory.\n\nMartin-Löf is constructive, so Agda doesn’t have default features for writing classical\n(in contrast to HOL or Isabelle).\n\nAgda : proof-assistant based on propositions-as-types.\n\n------------------------------------------------------------------------------\nTypes in Agda\n\ndatatypes introduced via GADTs\n-}\n\ndata Writers : Set where Wilde Shelley Byron Sartre Camus : Writers\ndata Literature : Set where DorianGrey Alastor ChildeHarold LaNausée L’Étranger : Literature\n\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n\n{-\nParameterized and indexed datatypes\n\nsee: https://agda.readthedocs.io/en/latest/language/data-types.html#indexed-datatypes\n\nparameterized datatype\n- depends on parameter that should remain the same in the types of constructors\n-}\n\ndata List (A : Set) : Set where\n Nil : List A\n Cons : A → List A → List A\n\n-- can have indexes that could differ from constructor to constructor\n\n-- Vec is parameterized by A and indexed by ℕ.\ndata Vec (A : Set) : ℕ → Set where\n Nil : Vec A zero\n -- n is an implicit argument of the constructor.\n -- Cons is an example of a dependent function.\n Cons : {n : ℕ} → A → Vec A n → Vec A (suc n)\n\n-- defines types of finite cardinality\n-- Fin is a datatype indexed by a natural number.\ndata Fin : ℕ → Set where\n -- zero reflects an empty set which is an element of any finite set\n zero : {n : ℕ} → Fin (suc n)\n -- suc applies the finite set i and yields a new finite set, larger than i on one element.\n suc : {n : ℕ} → Fin n → Fin (suc n)\n\n-- Vec and Fin in Agda are examples of dependent types,\n-- types that depend on values (e.g., natural numbers), not only on types.\n\n------------------------------------------------------------------------------\n-- Functions\n\nbookToWriter : Literature → Writers\nbookToWriter DorianGrey = Wilde\nbookToWriter Alastor = Shelley\nbookToWriter ChildeHarold = Byron\nbookToWriter LaNausée = Sartre\nbookToWriter L’Étranger = Camus\n\n-- A dependent function is a function that\n-- takes a term a of type A and\n-- returns some result of type B, where a may appear in B\n\n-- Here types A and B are explicit arguments.\nconst₁ : (A B : Set) → A → B → A\nconst₁ A B x y = x\n\n-- may take them implicitly:\nconst₂ : {A B : Set} → A → B → A\nconst₂ x y = x\n\ndata Ireland : Set where Dublin : Ireland\ndata England : Set where London : England\ndata France : Set where Paris : France\n\nWriterToCountry : Writers → Set\nWriterToCountry Wilde = Ireland\nWriterToCountry Shelley = England\nWriterToCountry Byron = England\nWriterToCountry Sartre = France\nWriterToCountry Camus = France\n\nWriterToCity : (w : Writers) → WriterToCountry w\nWriterToCity Wilde = Dublin\nWriterToCity Shelley = London\nWriterToCity Byron = London\nWriterToCity Sartre = Paris\nWriterToCity Camus = Paris\n\n{-\nWriterToCity is a dependent function, because the type of the result depends on the argument.\nThe type of a dependent function is called a Π-type.\n\nGenerally, given function P: A → Set,\nthen Π-type is a type of the function that assigns\nto every term t : A\nsome object of type P t.\n\nIn Agda : (t : A) → P t for some {A : Set} {P : A → Set} in context.\n\nLogically Π-type encodes intuitionistic universal quantifier.\n\nP is a predicate and\nsome function of a type (t : A) → P t\nis a proof that\nfor each t : A the property P has established.\n\n------------------------------------------------------------------------------\nDependent pairs : Σ-type\n\ninductive predicate on two lists:\n-}\n\ndata IsReverse {A : Set} : (xs ys : List A) → Set where\n ReverseNil : IsReverse [] []\n ReverseCons : (x : A) (xs ys : List A)\n → IsReverse xs ys\n → IsReverse (x ∷ xs) (ys ++ [ x ])\n{-\nIsReverse xs ys denotes that the list ys is equal to reversed xs.\n\nIsReverse is a datatype parameterized over a type A and\nindexed over two lists of elements of type A.\n\nprove theorem : for all list xs there exists list ys such that ys is a reversed list xs,\ni.e., produce a dependent pair, where\n the first projection of this pair is some list ys and\n the second one is a proof that ys is reversed list xs.\n\nUse the dependent pair type to prove existence:\n-}\n\ntheoremReverse₁ : {A : Set} (xs : List A) → Σ (List A) (λ ys → IsReverse xs ys)\ntheoremReverse₁ [] = [] , ReverseNil\ntheoremReverse₁ (z ∷ zs) =\n let ys = proj₁ (theoremReverse₁ zs) in\n let ysProof = proj₂ (theoremReverse₁ zs) in\n ys ++ [ x ] , ReverseCons z zs ys ysProof\n{-\nRead the theoremReverse₁ signature as\n let A be type and\n xs be a list with elements of the type A,\n then there exists list ys, such that ys is the reversed list xs.\n\nproved by induction on xs and build ys for every case.\nBase case: if xs is empty,\n then we present an empty list as the desired list ys and\n ReverseNil is a proof that ys is equal to reversed list xs, because both of them are empty.\nInductive step : xs is a non-empty\n List zs is smaller than z :: zs,\n so apply induction hypothesis to zs and\n show that :: preserves the desired property using the ReverseCons constructor.\n\nGenerally, Σ-type is defined in Agda:\n-}\nrecord Σ {a b} (A : Set a) (B : A → Set b) : Set (a ⊔ b) where\n constructor _,_\n field\n fst : A\n snd : B fst -- apply B to arg from first field\n{-\nDefined for arbitrary universes (see below).\n\nlogical point of view : Σ A B\n there exists some element of a type A, such that this element satisfies property B\ni.e. Σ-type encodes constructive existential quantifier.\n\nTo prove the existence of some object with desired property constructively,\npresent the particular object and prove that object satisfies the property.\n\n------------------------------------------------------------------------------\nUniverses\n\nHierarchy of types : initiated by Bertrand Russell.\n\nBasic types (e.g., Nat, Bool) have a type called Set (i.e., Set₁)\n\nUniverse polymorphism enables defining functions that can be called on types of arbitrary levels. E.g.,\n-}\ns : {A B C : Set} → (A → B → C) → (A → B) → A → C\ns f g x = f x (g x)\n\n-- indicate that types A, B, C are types of arbitrary level a:\ns₁ : {a : Level} {A B C : Set a} → (A → B → C) → (A → B) → A → C\ns₁ f g x = f x (g x)\n\n-- generalize s further, because A, B and C in s₁ belong to the same level above,\n-- but these types may generally belong to different levels :\ns₂ : {a b c : Level} {A : Set a} {B : Set b} {C : Set c}\n → (A → B → C) → (A → B) → A → C\ns₂ f g x = f x (g x)\n\n-- most general version of s : a universe polymorphic dependent function\n\nS : {a b c : Level} {A : Set a} {B : A → Set b} {C : (x : A) → B x → Set c}\n → (f : (x : A) → (y : B x) → C x y) → (g : (x : A) → B x)\n → (x : A) → C x (g x)\nS f g x = f x (g x)\n\n------------------------------------------------------------------------------\n-- Records\n\nrecord Person : Set where\n field\n name : String\n country : String\n age : Int\n\n------------------------------------------------------------------------------\n-- Typeclasses are introduced in Agda as records. E.g.,\n\nrecord Functor {a} (F : Set a → Set a) : Set (suc a) where\n field\n fmap : ∀ {A B} → (A → B) → F A → F B\n\n-- Instances may be declared either\n-- by constructing a record explicitly:\ninstance\n ListFunctor₁ : Functor List\n ListFunctor₁ = record { fmap = map }\n-- or by using copatterns:\ninstance\n ListFunctor₂ : Functor List\n fmap {{ListFunctor₂}} = map\n\n------------------------------------------------------------------------------\n-- Propositional equality\n\n-- The identity type is a datatype that reflects equality of terms in predicate logic.\n\ndata _≡_ {a} {A : Set a} (x : A) : A → Set a where\n refl : x ≡ x\n\n-- examples using propositional equality:\n\n-- proof of distributivity of natural number multiplication over addition\n*-+-distr : ∀ a b c → (b + c) * a ≡ b * a + c * a\n*-+-distr a zero c = refl\n*-+-distr a (suc b) c =\n begin\n (suc b + c) * a ≡⟨ refl ⟩\n a + (b + c) * a ≡⟨ cong (_+_ a) (*-+-distr a b c) ⟩\n a + (b * a + c * a) ≡⟨ sym (+-assoc a (b * a) (c * a)) ⟩\n suc b * a + c * a\n ∎\n\n-- Proved by induction on b.\n-- When b equals zero, the equality holds trivially.\n-- Otherwise, equality is proved using the induction hypothesis.\n\n{-\n------------------------------------------------------------------------------\nAlgebraic example\n\nA ring is an algebraic system\n⟨R, +, ⋅, −, 0⟩\n, where\nR is a non-empty set,\n0 ∈ R,\n+, ⋅ are binary operations on R\n and\n− is a unary operation on R\n such that:\n1. ∀a,b,c ∈ R, (a+b)+c=a+(b+c);\n2. ∀a,b ∈ R, a+b=b+a;\n3. ∀a ∈ R, −a + a = 0;\n4. ∀a ∈ R, a + 0 = a;\n5. ∀a,b,c ∈ R, (a+b)⋅c=(a⋅c)+(b⋅c);\n6. ∀a,b,c ∈ R, a⋅(b+c)=(a⋅b)+(a⋅c).\n-}\n\nrecord Ring (R : Set) : Set₁ where\n constructor mkRing\n infixr 7 _·_\n infixr 6 _+_\n field\n θ : R\n -_ : R → R\n _+_ : R → R → R\n _·_ : R → R → R\n\n +-assoc : (a b c : R) → (a + b) + c ≡ a + (b + c)\n +-commute : (a b : R) → a + b ≡ b + a\n +-inv₁ : (a : R) → - a + a ≡ θ\n +-θ : (a : R) → a + θ ≡ a\n ·-distr-right : (a b c : R) → (a + b) · c ≡ (a · c) + (b · c)\n ·-distr-left : (a b c : R) → a · (b + c) ≡ (a · b) + (a · c)\nopen Ring {{...}} public\n\n", "meta": {"hexsha": "a361115046bf251aa33a9515522f0969206c0987", "size": 9668, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/paper/2018-11-danya-rogozin-serokell-constructive-and-non-cons-proofs-in-agda/src/Part2_Agda_in_a_Nutshell.agda", "max_stars_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_stars_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2015-01-29T14:37:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T06:55:03.000Z", "max_issues_repo_path": "agda/paper/2018-11-danya-rogozin-serokell-constructive-and-non-cons-proofs-in-agda/src/Part2_Agda_in_a_Nutshell.agda", "max_issues_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_issues_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/paper/2018-11-danya-rogozin-serokell-constructive-and-non-cons-proofs-in-agda/src/Part2_Agda_in_a_Nutshell.agda", "max_forks_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_forks_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2015-04-13T21:40:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-21T15:58:10.000Z", "avg_line_length": 31.28802589, "max_line_length": 103, "alphanum_fraction": 0.5987794787, "num_tokens": 2790, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438950868503681, "lm_q2_score": 0.7981867753392728, "lm_q1q2_score": 0.6735858980977509}} {"text": "-- This file defines the Euclidean Domain structure.\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule EuclideanDomain where\n-- We comply to the definition format in stdlib, i.e. define an\n-- IsSomething predicate then define the bundle.\n\n open import Relation.Binary using (Rel; Setoid; IsEquivalence)\n\n module Structures \n {a ℓ} {A : Set a} -- The underlying set\n (_≈_ : Rel A ℓ) -- The underlying equality relation\n where\n\n open import Algebra.Structures _≈_\n open import Algebra.Core\n open import Algebra.Definitions _≈_\n import Algebra.Consequences.Setoid as Consequences\n open import Data.Product using (_,_; proj₁; proj₂)\n open import Level using (_⊔_)\n\n open import Data.Nat using (ℕ ; _<_)\n open import Data.Product using (∃ ; _×_)\n open import Relation.Nullary using (¬_)\n\n -- We only require leftcancellative since we have required the\n -- domain to be commutative. An Euclidean domain is a commutative\n -- domain with a div, mod, and rank function satisfy euc-eq and\n -- euc-rank.\n record IsEuclideanDomain\n (+ * : Op₂ A) (- : Op₁ A) (0# 1# : A) : Set (a ⊔ ℓ) where\n field\n isCommutativeRing : IsCommutativeRing + * - 0# 1#\n *-alc : AlmostLeftCancellative 0# *\n div : ∀ (n d : A) -> ¬ d ≈ 0# -> A\n mod : ∀ (n d : A) -> ¬ d ≈ 0# -> A\n rank : A → ℕ\n euc-eq : ∀ (n d : A) -> (n0 : ¬ d ≈ 0#) ->\n let r = mod n d n0 in let q = div n d n0 in \n n ≈ + r (* q d) \n euc-rank : ∀ (n d : A) -> (n0 : ¬ d ≈ 0#) ->\n let r = mod n d n0 in let q = div n d n0 in \n rank r < rank d\n\n module Bundles where\n\n open Structures\n open import Algebra.Core\n open import Algebra.Structures\n open import Relation.Binary\n open import Function.Base\n import Relation.Nullary as N\n open import Level\n\n record EuclideanDomainBundle c ℓ : Set (suc (c ⊔ ℓ)) where\n infix 8 -_\n infixl 7 _*_\n infixl 6 _+_\n infix 4 _≈_\n field\n Carrier : Set c\n _≈_ : Rel Carrier ℓ\n _+_ : Op₂ Carrier\n _*_ : Op₂ Carrier\n -_ : Op₁ Carrier\n 0# : Carrier\n 1# : Carrier\n isEuclideanDomain : IsEuclideanDomain _≈_ _+_ _*_ -_ 0# 1#\n\n open IsEuclideanDomain isEuclideanDomain public\n\n", "meta": {"hexsha": "7c8fc7167b9f7de8de6de4fd41a4580244548b5f", "size": 2433, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "EuclideanDomain.agda", "max_stars_repo_name": "onestruggler/EucDomain", "max_stars_repo_head_hexsha": "7e268e8354065fde734c9c2d9998d2cfd4a21f71", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "EuclideanDomain.agda", "max_issues_repo_name": "onestruggler/EucDomain", "max_issues_repo_head_hexsha": "7e268e8354065fde734c9c2d9998d2cfd4a21f71", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "EuclideanDomain.agda", "max_forks_repo_name": "onestruggler/EucDomain", "max_forks_repo_head_hexsha": "7e268e8354065fde734c9c2d9998d2cfd4a21f71", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.3287671233, "max_line_length": 70, "alphanum_fraction": 0.5606247431, "num_tokens": 716, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757870046160257, "lm_q2_score": 0.76908023177796, "lm_q1q2_score": 0.6735504724982183}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Kan.Duality where\n\nopen import Level\n\nopen import Categories.Category\nopen import Categories.Functor\nopen import Categories.NaturalTransformation\nopen import Categories.Kan\n\nprivate\n variable\n o ℓ e : Level\n C D E : Category o ℓ e\n F G : Functor C D\n\nmodule _ {F : Functor C D} {G : Functor C E} where\n private\n module F = Functor F\n module G = Functor G\n\n coLan⇒Ran : Lan F.op G.op → Ran F G\n coLan⇒Ran lan = record\n { R = L.op\n ; ε = η.op\n ; δ = λ M α → NaturalTransformation.op (σ (Functor.op M) (NaturalTransformation.op α))\n ; δ-unique = λ δ′ eq → σ-unique (NaturalTransformation.op δ′) eq\n ; commutes = λ M α → commutes (Functor.op M) (NaturalTransformation.op α)\n }\n where open Lan lan\n\n coRan⇒Lan : Ran F.op G.op → Lan F G\n coRan⇒Lan ran = record\n { L = R.op\n ; η = ε.op\n ; σ = λ M α → NaturalTransformation.op (δ (Functor.op M) (NaturalTransformation.op α))\n ; σ-unique = λ σ′ eq → δ-unique (NaturalTransformation.op σ′) eq\n ; commutes = λ M α → commutes (Functor.op M) (NaturalTransformation.op α)\n }\n where open Ran ran\n", "meta": {"hexsha": "9a113827d60576986f2e44e117cd9fb8bc33cbd7", "size": 1190, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Kan/Duality.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Kan/Duality.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Kan/Duality.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.3333333333, "max_line_length": 97, "alphanum_fraction": 0.6243697479, "num_tokens": 372, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869981319863, "lm_q2_score": 0.76908023177796, "lm_q1q2_score": 0.673550467511472}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary using (Rel; Setoid; IsEquivalence)\nmodule Magma.Structures\n {a ℓ} {A : Set a} -- The underlying set\n (_≈_ : Rel A ℓ) -- The underlying equality relation\n where\n\nopen import Algebra.Core\nopen import Level using (_⊔_)\nopen import Data.Product using (_,_; proj₁; proj₂)\nopen import Algebra.Definitions _≈_\nopen import Algebra.Structures _≈_\nopen import Magma.Definitions _≈_\n\nrecord IsIdempotentMagma (∙ : Op₂ A) : Set (a ⊔ ℓ) where\n field\n isMagma : IsMagma ∙\n idem : Idempotent ∙\n\n open IsMagma isMagma public\n\nrecord IsAlternateMagma (∙ : Op₂ A) : Set (a ⊔ ℓ) where\n field\n isMagma : IsMagma ∙\n alter : Alternative ∙\n\n open IsMagma isMagma public\n\nrecord IsFlexibleMagma (∙ : Op₂ A) : Set (a ⊔ ℓ) where\n field\n isMagma : IsMagma ∙\n flex : Flexible ∙\n\n open IsMagma isMagma public\n\nrecord IsMedialMagma (∙ : Op₂ A) : Set (a ⊔ ℓ) where\n field\n isMagma : IsMagma ∙\n medial : Medial ∙\n\n open IsMagma isMagma public\n\nrecord IsSemimedialMagma (∙ : Op₂ A) : Set (a ⊔ ℓ) where\n field\n isMagma : IsMagma ∙\n semiMedial : Semimedial ∙\n\n open IsMagma isMagma public\n\nrecord IsLeftUnitalMagma (∙ : Op₂ A) (ε : A) : Set (a ⊔ ℓ) where\n field\n isMagma : IsMagma ∙\n identity : LeftIdentity ε ∙\n\n open IsMagma isMagma public\n\nrecord IsRightUnitalMagma (∙ : Op₂ A) (ε : A) : Set (a ⊔ ℓ) where\n field\n isMagma : IsMagma ∙\n identity : RightIdentity ε ∙\n\n open IsMagma isMagma public\n\n", "meta": {"hexsha": "d2be6ffa3690bd97e753d966030f77d308e19eb3", "size": 1507, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Magma/Structures.agda", "max_stars_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_stars_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-15T06:16:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-17T09:14:03.000Z", "max_issues_repo_path": "src/Magma/Structures.agda", "max_issues_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_issues_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-10-04T05:30:30.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-09T08:24:56.000Z", "max_forks_repo_path": "src/Magma/Structures.agda", "max_forks_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra", "max_forks_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.1846153846, "max_line_length": 65, "alphanum_fraction": 0.6622428666, "num_tokens": 545, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.925229959153748, "lm_q2_score": 0.727975460709318, "lm_q1q2_score": 0.6735447057770131}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Category.Instance.FinSetoids where\n\n-- Category of Finite Setoids, as a sub-category of Setoids\n\nopen import Level\n\nopen import Data.Fin.Base using (Fin)\nopen import Data.Nat.Base using (ℕ)\nopen import Data.Product using (Σ)\nopen import Function.Bundles using (Inverse)\nopen import Relation.Unary using (Pred)\nopen import Relation.Binary.Bundles using (Setoid; module Setoid)\nimport Relation.Binary.PropositionalEquality as ≡\n\nopen import Categories.Category.Core using (Category)\nopen import Categories.Category.Construction.ObjectRestriction\nopen import Categories.Category.Instance.Setoids\n\n-- The predicate that will be used\nIsFiniteSetoid : {c ℓ : Level} → Pred (Setoid c ℓ) (c ⊔ ℓ)\nIsFiniteSetoid X = Σ ℕ (λ n → Inverse X (≡.setoid (Fin n)))\n\n-- The actual Category\nFinSetoids : (c ℓ : Level) → Category (suc (c ⊔ ℓ)) (c ⊔ ℓ) (c ⊔ ℓ)\nFinSetoids c ℓ = ObjectRestriction (Setoids c ℓ) IsFiniteSetoid\n", "meta": {"hexsha": "8c8099bb401b09ceb3d9029855698ba52aab91ec", "size": 957, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Instance/FinSetoids.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Instance/FinSetoids.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Instance/FinSetoids.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 35.4444444444, "max_line_length": 67, "alphanum_fraction": 0.7544409613, "num_tokens": 264, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9252299509069105, "lm_q2_score": 0.7279754489059775, "lm_q1q2_score": 0.6735446888527138}} {"text": "{-# OPTIONS --universe-polymorphism #-}\n\n-- Free category generated by a directed graph.\n-- The graph is given by a type (Obj) of nodes and a (Obj × Obj)-indexed\n-- Setoid of (directed) edges. Every inhabitant of the node type is \n-- considered to be a (distinct) node of the graph, and (equivalence \n-- classes of) inhabitants of the edge type (for a given pair of \n-- nodes) are considered edges of the graph. \nmodule Categories.Free.Core where\n\nopen import Categories.Category\nopen import Categories.Functor\n using (Functor)\nopen import Categories.Support.Equivalence\nopen import Graphs.Graph\nopen import Graphs.GraphMorphism\nopen import Relation.Binary\n using (module IsEquivalence)\nopen import Relation.Binary.PropositionalEquality\n using ()\n renaming (_≡_ to _≣_; refl to ≣-refl)\nopen import Data.Star\nopen import Categories.Support.StarEquality\nopen import Data.Star.Properties\n using (gmap-◅◅)\nopen import Level using (_⊔_)\n\nEdgeSetoid : ∀ {o ℓ e} → (G : Graph o ℓ e) (A B : Graph.Obj G) → Setoid ℓ e\nEdgeSetoid G A B = Graph.edge-setoid G {A}{B}\n\nmodule PathEquality {o ℓ e} (G : Graph o ℓ e) = StarEquality (EdgeSetoid G)\n\nFree₀ : ∀ {o ℓ e} → Graph o ℓ e → Category o (o ⊔ ℓ) (o ⊔ ℓ ⊔ e)\nFree₀ {o}{ℓ}{e} G = record\n { Obj = Obj\n ; _⇒_ = Star _↝_\n ; id = ε\n ; _∘_ = _▻▻_\n ; _≡_ = _≡_\n ; equiv = equiv\n ; assoc = λ{A}{B}{C}{D} {f}{g}{h} → ▻▻-assoc {A}{B}{C}{D} f g h\n ; identityˡ = IsEquivalence.reflexive equiv f◅◅ε≣f\n ; identityʳ = IsEquivalence.reflexive equiv ≣-refl\n ; ∘-resp-≡ = _▻▻-cong_\n }\n where\n open Graph G\n hiding (equiv)\n \n open PathEquality G\n renaming (_≈_ to _≡_; isEquivalence to equiv)\n \n f◅◅ε≣f : ∀ {A B}{f : Star _↝_ A B} -> (f ◅◅ ε) ≣ f\n f◅◅ε≣f {f = ε} = ≣-refl\n f◅◅ε≣f {f = x ◅ xs} rewrite f◅◅ε≣f {f = xs} = ≣-refl\n\nFree₁ : ∀ {o₁ ℓ₁ e₁ o₂ ℓ₂ e₂}\n {A : Graph o₁ ℓ₁ e₁}\n {B : Graph o₂ ℓ₂ e₂}\n → GraphMorphism A B → Functor (Free₀ A) (Free₀ B)\nFree₁ {o₁}{ℓ₁}{e₁}{o₂}{ℓ₂}{e₂}{A}{B} G = record\n { F₀ = G₀\n ; F₁ = gmap G₀ G₁\n ; identity = refl\n ; homomorphism = λ {X}{Y}{Z}{f}{g} → homomorphism {X}{Y}{Z}{f}{g}\n ; F-resp-≡ = F-resp-≡\n }\n where\n open GraphMorphism G\n renaming (F₀ to G₀; F₁ to G₁; F-resp-≈ to G-resp-≈)\n open Category.Equiv (Free₀ B)\n \n .homomorphism : ∀ {X Y Z}\n {f : Free₀ A [ X , Y ]}\n {g : Free₀ A [ Y , Z ]}\n → Free₀ B [ gmap G₀ G₁ (f ◅◅ g) ≡ gmap G₀ G₁ f ◅◅ gmap G₀ G₁ g ]\n homomorphism {f = f}{g} = reflexive (gmap-◅◅ G₀ G₁ f g)\n \n .F-resp-≡ : ∀ {X Y}\n {f g : Free₀ A [ X , Y ]}\n → Free₀ A [ f ≡ g ]\n → Free₀ B [ gmap G₀ G₁ f ≡ gmap G₀ G₁ g ]\n F-resp-≡ {X}{Y}{f}{g} f≡g \n = gmap-cong G₀ G₁ G₁ (λ x y x≈y → G-resp-≈ x≈y) f g f≡g\n where\n open StarCong₂ (EdgeSetoid A) (EdgeSetoid B)\n", "meta": {"hexsha": "b3141e4bcbe49af77c9c8c9d25f96e6b833061fb", "size": 2845, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Free/Core.agda", "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 98, "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_issues_repo_path": "Categories/Free/Core.agda", "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 19, "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_forks_repo_path": "Categories/Free/Core.agda", "max_forks_repo_name": "p-pavel/categories", "max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 23, "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "avg_line_length": 32.7011494253, "max_line_length": 75, "alphanum_fraction": 0.5782073814, "num_tokens": 1150, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9136765163620469, "lm_q2_score": 0.7371581626286834, "lm_q1q2_score": 0.6735241020384227}} {"text": "open import FRP.JS.Float using ( ℝ ) renaming ( _/?_ to _/?r_ )\nopen import FRP.JS.Int using ( ℤ ; _-_ ) renaming ( float to floatz ; show to showz )\nopen import FRP.JS.Primitive using ( String )\nopen import FRP.JS.Bool using ( Bool ; _∨_ ; not )\nopen import FRP.JS.True using ( True )\nopen import FRP.JS.Maybe using ( Maybe )\n\nmodule FRP.JS.Nat where\n\ninfixr 4 _≤_ _<_ _≟_ _≠_\ninfixl 6 _+_ _∸_\ninfixl 7 _*_ _/_ _/?_\n\nopen import FRP.JS.Primitive public using ( ℕ ; zero ; suc )\n\n_+_ : ℕ → ℕ → ℕ\nzero + n = n\nsuc m + n = suc (m + n)\n\n{-# BUILTIN NATPLUS _+_ #-}\n{-# COMPILED_JS _+_ function (x) { return function (y) { return x+y; }; } #-}\n\n_∸_ : ℕ → ℕ → ℕ\nzero ∸ n = zero\nsuc m ∸ zero = suc m\nsuc m ∸ suc n = m ∸ n\n\n{-# BUILTIN NATMINUS _∸_ #-}\n{-# COMPILED_JS _∸_ function (x) { return function (y) { return Math.max(0,x-y); }; } #-}\n\n_*_ : ℕ → ℕ → ℕ\nzero * n = zero\nsuc m * n = n + m * n\n\n{-# BUILTIN NATTIMES _*_ #-}\n{-# COMPILED_JS _*_ function (x) { return function (y) { return x*y; }; } #-}\n\nprivate\n primitive\n primNatEquality : ℕ → ℕ → Bool\n primNatLess : ℕ → ℕ → Bool\n primNatToInteger : ℕ → ℤ\n primFloatDiv : ℝ → ℝ → ℝ\n\n_≟_ = primNatEquality\n_<_ = primNatLess\n+_ = primNatToInteger\n\n{-# COMPILED_JS _≟_ function (x) { return function (y) { return x === y; }; } #-}\n{-# COMPILED_JS _<_ function (x) { return function (y) { return x < y; }; } #-}\n{-# COMPILED_JS +_ function (x) { return x; } #-}\n\nfloat : ℕ → ℝ\nfloat x = floatz (+ x)\n\nshow : ℕ → String\nshow x = showz (+ x)\n\n-_ : ℕ → ℤ\n-_ x = (+ 0) - (+ x)\n\n_≤_ : ℕ → ℕ → Bool\nx ≤ y = not (y < x)\n\n_≠_ : ℕ → ℕ → Bool\nx ≠ y = not (x ≟ y)\n\n_/_ : (x y : ℕ) → {y≠0 : True (y ≠ 0)} → ℝ\nx / y = primFloatDiv (float x) (float y)\n\n_/?_ : ℕ → ℕ → Maybe ℝ\nx /? y = (float x) /?r (float y)\n\n{-# COMPILED_JS float function (x) { return x; } #-}\n{-# COMPILED_JS show function (x) { return x.toString(); } #-}\n{-# COMPILED_JS -_ function (x) { return -x; } #-}\n{-# COMPILED_JS _≤_ function (x) { return function (y) { return x <= y; }; } #-}\n{-# COMPILED_JS _≠_ function (x) { return function (y) { return x !== y; }; } #-}\n{-# COMPILED_JS _/_ function(x) { return function(y) { return function() { return x / y; }; }; } #-}\n{-# COMPILED_JS _/?_ function(x) { return function(y) { if (y === 0) { return null; } else { return x / y; } }; } #-}\n", "meta": {"hexsha": "753acae46fc3300353821258957b4f1e64695b9e", "size": 2304, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/agda/FRP/JS/Nat.agda", "max_stars_repo_name": "agda/agda-frp-js", "max_stars_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_stars_repo_licenses": ["MIT", "BSD-3-Clause"], "max_stars_count": 63, "max_stars_repo_stars_event_min_datetime": "2015-04-20T21:47:00.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-28T09:46:14.000Z", "max_issues_repo_path": "src/agda/FRP/JS/Nat.agda", "max_issues_repo_name": "agda/agda-frp-js", "max_issues_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_issues_repo_licenses": ["MIT", "BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/agda/FRP/JS/Nat.agda", "max_forks_repo_name": "agda/agda-frp-js", "max_forks_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_forks_repo_licenses": ["MIT", "BSD-3-Clause"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-11-07T21:50:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:38.000Z", "avg_line_length": 28.4444444444, "max_line_length": 118, "alphanum_fraction": 0.56640625, "num_tokens": 855, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9136765187126079, "lm_q2_score": 0.7371581568543043, "lm_q1q2_score": 0.6735240984952433}} {"text": "module Issue1422 where\n\nopen import Common.Level public using (Level ; lzero ; lsuc) renaming (_⊔_ to _l⊔_)\nopen import Common.Equality public\n\n-- # Relations\n\nrelation : ∀ {ℓ} ℓ' → Set ℓ → Set (lsuc ℓ' l⊔ ℓ)\nrelation ℓ' α = α → α → Set ℓ'\n\nreflexive : ∀ {ℓ ℓ'} {α : Set ℓ} → relation ℓ' α → Set (ℓ l⊔ ℓ')\nreflexive _R_ = ∀ {x} → x R x\n\nantisymmetric : ∀ {ℓ ℓ'} {α : Set ℓ} → relation ℓ' α → Set (ℓ l⊔ ℓ')\nantisymmetric _R_ = ∀ {x y} → x R y → y R x → x ≡ y\n\n_⇉_ : ∀ {ℓ₁ ℓ₁' ℓ₂ ℓ₂'} {α : Set ℓ₁} {β : Set ℓ₂} (_R₁_ : relation ℓ₁' α) (_R₂_ : relation ℓ₂' β) → relation (ℓ₁ l⊔ ℓ₁' l⊔ ℓ₂') (α → β)\n(_R₁_ ⇉ _R₂_) f g = ∀ {x y} → x R₁ y → f x R₂ g y\n\nproper : ∀ {ℓ ℓ'} {α : Set ℓ} (_R_ : relation ℓ' α) → α → Set ℓ'\nproper _R_ x = x R x\n\n-- # Dom\n\nrecord Dom {ℓ} ℓ' (D : Set ℓ) : Set (lsuc ℓ l⊔ lsuc ℓ') where\n field\n ⟦_⟧ : D → Set ℓ'\nopen Dom {{...}} public\n\n-- # Partial Order\n\nrecord PartialOrder {ℓ} ℓ' (α : Set ℓ) : Set (ℓ l⊔ lsuc ℓ') where\n infix 4 _⊑_\n field\n _⊑_ : relation ℓ' α\n ⊑-reflexivity : reflexive _⊑_\n ⊑-antisymmetry : antisymmetric _⊑_\n\nopen PartialOrder {{...}} public\n\nmonotonic : ∀ {ℓ₁ ℓ₁' ℓ₂ ℓ₂'} {α : Set ℓ₁} {{αPO : PartialOrder ℓ₁' α}} {β : Set ℓ₂} {{βPO : PartialOrder ℓ₂' β}} → (α → β) → Set (ℓ₁ l⊔ ℓ₁' l⊔ ℓ₂')\nmonotonic = proper (_⊑_ ⇉ _⊑_)\n", "meta": {"hexsha": "cc58a49e996b1bb78803033713eeba785afb28c5", "size": 1280, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue1422.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue1422.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue1422.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 29.7674418605, "max_line_length": 148, "alphanum_fraction": 0.55703125, "num_tokens": 631, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213745668094, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6735203347990129}} {"text": "{-# OPTIONS --without-K #-}\nmodule hott.level.core where\n\nopen import level\nopen import sum\nopen import sets.nat.core\nopen import equality.core\nopen import equality.groupoid\n\nh : ∀ {i} → ℕ → Set i → Set i\nh 0 X = Σ X λ x → (x' : X) → x ≡ x'\nh (suc n) X = (x x' : X) → h n (x ≡ x')\n\ncontr : ∀ {i} → Set i → Set i\ncontr = h 0\n\nprop : ∀ {i} → Set i → Set i\nprop X = (x x' : X) → x ≡ x'\n\nh1⇒prop : ∀ {i} {X : Set i} → h 1 X → prop X\nh1⇒prop h1 x x' = proj₁ (h1 x x')\n\nprop⇒h1 : ∀ {i} {X : Set i} → prop X → h 1 X\nprop⇒h1 {X = X} f x y = p₀ x y , lem x y\n where\n p₀ : (x y : X) → x ≡ y\n p₀ x y = f x y · (f y y)⁻¹\n\n lem : (x y : X)(p : x ≡ y) → p₀ x y ≡ p\n lem x .x refl = left-inverse (f x x)\n\ncontr⇒prop : ∀ {i} {X : Set i} → contr X → prop X\ncontr⇒prop (x , p) = λ x' x'' → sym (p x') · p x''\n\nh↑ : ∀ {i n}{X : Set i} → h n X → h (suc n) X\nh↑ {n = 0} c = prop⇒h1 (contr⇒prop c)\nh↑ {n = suc n} hn = λ x x' → h↑ (hn x x')\n\n-- Prop: the set of propositions\nHProp : ∀ i → Set (lsuc i)\nHProp i = Σ (Set i) (h 1)\n\n-- HSet : sets\nHSet : ∀ i → Set (lsuc i)\nHSet i = Σ (Set i) (h 2)\n\n-- Types by h-level (shifted by 2)\nType : ∀ i → ℕ → Set (lsuc i)\nType i n = Σ (Set i) (h (suc (suc n)))\n\n_⁻¹_ : ∀ {i k} {X : Set i} {Y : Set k} → (X → Y) → Y → Set (i ⊔ k)\nf ⁻¹ y = Σ _ λ x → f x ≡ y\n\n-- singletons are contractible\nsingl-contr : ∀ {i} {A : Set i} → (x : A) → contr (singleton x)\nsingl-contr {A = A} x = (x , refl) , λ { (x' , p) → lem x' p }\n where\n lem : (x' : A)(p : x ≡ x') → (x , refl) ≡ (x' , p)\n lem .x refl = refl\n\nsingl-contr' : ∀ {i} {A : Set i} → (x : A) → contr (singleton' x)\nsingl-contr' {A = A} x = (x , refl) , λ { (x' , p) → lem x' p }\n where\n lem : (x' : A)(p : x' ≡ x) → (x , refl) ≡ (x' , p)\n lem .x refl = refl\n", "meta": {"hexsha": "534f4de794b801411d6c8507a69dfe428fc067ea", "size": 1748, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "hott/level/core.agda", "max_stars_repo_name": "HoTT/M-types", "max_stars_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 27, "max_stars_repo_stars_event_min_datetime": "2015-04-14T15:47:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-09T07:26:57.000Z", "max_issues_repo_path": "hott/level/core.agda", "max_issues_repo_name": "HoTT/M-types", "max_issues_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2015-02-11T11:14:59.000Z", "max_issues_repo_issues_event_max_datetime": "2015-02-11T15:20:34.000Z", "max_forks_repo_path": "hott/level/core.agda", "max_forks_repo_name": "HoTT/M-types", "max_forks_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-04-11T17:19:12.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-26T06:17:38.000Z", "avg_line_length": 26.4848484848, "max_line_length": 66, "alphanum_fraction": 0.4771167048, "num_tokens": 823, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887587905460026, "lm_q2_score": 0.757794360334681, "lm_q1q2_score": 0.6734963991736327}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Examples of decision procedures and how to use them\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule README.Decidability where\n\n-- Reflects and Dec are defined in Relation.Nullary, and operations on them can\n-- be found in Relation.Nullary.Reflects and Relation.Nullary.Decidable.\n\nopen import Relation.Nullary as Nullary\nopen import Relation.Nullary.Reflects\nopen import Relation.Nullary.Decidable\n\nopen import Data.Bool\nopen import Data.List\nopen import Data.List.Properties using (∷-injective)\nopen import Data.Nat\nopen import Data.Nat.Properties using (suc-injective)\nopen import Data.Product\nopen import Data.Unit\nopen import Function\nopen import Relation.Binary.PropositionalEquality\nopen import Relation.Nary\nopen import Relation.Nullary.Product\n\ninfix 4 _≟₀_ _≟₁_ _≟₂_\n\n-- A proof of `Reflects P b` shows that a proposition `P` has the truth value of\n-- the boolean `b`. A proof of `Reflects P true` amounts to a proof of `P`, and\n-- a proof of `Reflects P false` amounts to a refutation of `P`.\n\nex₀ : (n : ℕ) → Reflects (n ≡ n) true\nex₀ n = ofʸ refl\n\nex₁ : (n : ℕ) → Reflects (zero ≡ suc n) false\nex₁ n = ofⁿ λ ()\n\nex₂ : (b : Bool) → Reflects (T b) b\nex₂ false = ofⁿ id\nex₂ true = ofʸ tt\n\n-- A proof of `Dec P` is a proof of `Reflects P b` for some `b`.\n-- `Dec P` is declared as a record, with fields:\n-- does : Bool\n-- proof : Reflects P does\n\nex₃ : (b : Bool) → Dec (T b)\ndoes (ex₃ b) = b\nproof (ex₃ b) = ex₂ b\n\n-- We also have pattern synonyms `yes` and `no`, allowing both fields to be\n-- given at once.\n\nex₄ : (n : ℕ) → Dec (zero ≡ suc n)\nex₄ n = no λ ()\n\n-- It is possible, but not ideal, to define recursive decision procedures using\n-- only the `yes` and `no` patterns. The following procedure decides whether two\n-- given natural numbers are equal.\n\n_≟₀_ : (m n : ℕ) → Dec (m ≡ n)\nzero ≟₀ zero = yes refl\nzero ≟₀ suc n = no λ ()\nsuc m ≟₀ zero = no λ ()\nsuc m ≟₀ suc n with m ≟₀ n\n... | yes p = yes (cong suc p)\n... | no ¬p = no (¬p ∘ suc-injective)\n\n-- In this case, we can see that `does (suc m ≟ suc n)` should be equal to\n-- `does (m ≟ n)`, because a `yes` from `m ≟ n` gives rise to a `yes` from the\n-- result, and similarly for `no`. However, in the above definition, this\n-- equality does not hold definitionally, because we always do a case split\n-- before returning a result. To avoid this, we can return the `does` part\n-- separately, before any pattern matching.\n\n_≟₁_ : (m n : ℕ) → Dec (m ≡ n)\nzero ≟₁ zero = yes refl\nzero ≟₁ suc n = no λ ()\nsuc m ≟₁ zero = no λ ()\ndoes (suc m ≟₁ suc n) = does (m ≟₁ n)\nproof (suc m ≟₁ suc n) with m ≟₁ n\n... | yes p = ofʸ (cong suc p)\n... | no ¬p = ofⁿ (¬p ∘ suc-injective)\n\n-- We now get definitional equalities such as the following.\n\n_ : (m n : ℕ) → does (5 + m ≟₁ 3 + n) ≡ does (2 + m ≟₁ n)\n_ = λ m n → refl\n\n-- Even better, from a maintainability point of view, is to use `map` or `map′`,\n-- both of which capture the pattern of the `does` field remaining the same, but\n-- the `proof` field being updated.\n\n_≟₂_ : (m n : ℕ) → Dec (m ≡ n)\nzero ≟₂ zero = yes refl\nzero ≟₂ suc n = no λ ()\nsuc m ≟₂ zero = no λ ()\nsuc m ≟₂ suc n = map′ (cong suc) suc-injective (m ≟₂ n)\n\n_ : (m n : ℕ) → does (5 + m ≟₂ 3 + n) ≡ does (2 + m ≟₂ n)\n_ = λ m n → refl\n\n-- `map′` can be used in conjunction with combinators such as `_⊎-dec_` and\n-- `_×-dec_` to build complex (simply typed) decision procedures.\n\nmodule ListDecEq₀ {a} {A : Set a} (_≟ᴬ_ : (x y : A) → Dec (x ≡ y)) where\n\n _≟ᴸᴬ_ : (xs ys : List A) → Dec (xs ≡ ys)\n [] ≟ᴸᴬ [] = yes refl\n [] ≟ᴸᴬ (y ∷ ys) = no λ ()\n (x ∷ xs) ≟ᴸᴬ [] = no λ ()\n (x ∷ xs) ≟ᴸᴬ (y ∷ ys) =\n map′ (uncurry (cong₂ _∷_)) ∷-injective (x ≟ᴬ y ×-dec xs ≟ᴸᴬ ys)\n\n-- The final case says that `x ∷ xs ≡ y ∷ ys` exactly when `x ≡ y` *and*\n-- `xs ≡ ys`. The proofs are updated by the first two arguments to `map′`.\n\n-- In the case of ≡-equality tests, the pattern\n-- `map′ (congₙ c) c-injective (x₀ ≟ y₀ ×-dec ... ×-dec xₙ₋₁ ≟ yₙ₋₁)`\n-- is captured by `≟-mapₙ n c c-injective (x₀ ≟ y₀) ... (xₙ₋₁ ≟ yₙ₋₁)`.\n\nmodule ListDecEq₁ {a} {A : Set a} (_≟ᴬ_ : (x y : A) → Dec (x ≡ y)) where\n\n _≟ᴸᴬ_ : (xs ys : List A) → Dec (xs ≡ ys)\n [] ≟ᴸᴬ [] = yes refl\n [] ≟ᴸᴬ (y ∷ ys) = no λ ()\n (x ∷ xs) ≟ᴸᴬ [] = no λ ()\n (x ∷ xs) ≟ᴸᴬ (y ∷ ys) = ≟-mapₙ 2 _∷_ ∷-injective (x ≟ᴬ y) (xs ≟ᴸᴬ ys)\n", "meta": {"hexsha": "2e6faa9d069f6ab3b31a003950a49d022d62d767", "size": 4499, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/README/Decidability.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/README/Decidability.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/README/Decidability.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 33.8270676692, "max_line_length": 80, "alphanum_fraction": 0.5970215603, "num_tokens": 1669, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519527982093666, "lm_q2_score": 0.7905303186696747, "lm_q1q2_score": 0.6734945170599717}} {"text": "module List.Order.Simple {A : Set}(_≤_ : A → A → Set) where\n\nopen import Data.List\n\ndata _*≤_ : List A → A → Set where\n lenx : {x : A} \n → [] *≤ x \n lecx : {x y : A}{ys : List A} \n → y ≤ x \n → ys *≤ x \n → (y ∷ ys) *≤ x\n\ndata _≤*_ : A → List A → Set where\n genx : {x : A} \n → x ≤* [] \n gecx : {x y : A}{ys : List A} \n → x ≤ y \n → x ≤* ys \n → x ≤* (y ∷ ys)\n\n\n\n", "meta": {"hexsha": "66773815ff6b49341cf03d1b112f8548b8e124ac", "size": 506, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/List/Order/Simple.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/List/Order/Simple.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/List/Order/Simple.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.0, "max_line_length": 59, "alphanum_fraction": 0.3063241107, "num_tokens": 174, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9372107931567176, "lm_q2_score": 0.7185944046238981, "lm_q1q2_score": 0.6734744319155428}} {"text": "------------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Additional properties for setoids\n------------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary\n\nmodule Relation.Binary.Properties.Setoid {a ℓ} (S : Setoid a ℓ) where\n\nopen Setoid S\n\nopen import Data.Product using (_,_)\nopen import Function using (_∘_; _$_)\nopen import Relation.Nullary using (¬_)\nopen import Relation.Binary.PropositionalEquality as P using (_≡_)\n\n------------------------------------------------------------------------------\n-- Every setoid is a preorder with respect to propositional equality\n\nisPreorder : IsPreorder _≡_ _≈_\nisPreorder = record\n { isEquivalence = P.isEquivalence\n ; reflexive = reflexive\n ; trans = trans\n }\n\npreorder : Preorder a a ℓ\npreorder = record\n { isPreorder = isPreorder\n }\n\n------------------------------------------------------------------------------\n-- Properties of _≉_\n\n≉-sym : Symmetric _≉_\n≉-sym x≉y = x≉y ∘ sym\n\n≉-respˡ : _≉_ Respectsˡ _≈_\n≉-respˡ x≈x' x≉y = x≉y ∘ trans x≈x'\n\n≉-respʳ : _≉_ Respectsʳ _≈_\n≉-respʳ y≈y' x≉y x≈y' = x≉y $ trans x≈y' (sym y≈y')\n\n≉-resp₂ : _≉_ Respects₂ _≈_\n≉-resp₂ = ≉-respʳ , ≉-respˡ\n", "meta": {"hexsha": "2559f8a8531292cf40ed92db99769aa32f1f182d", "size": 1287, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Relation/Binary/Properties/Setoid.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Relation/Binary/Properties/Setoid.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Relation/Binary/Properties/Setoid.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 26.2653061224, "max_line_length": 78, "alphanum_fraction": 0.5073815074, "num_tokens": 377, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8723473879530491, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6733156500919157}} {"text": "module MLib.Fin.Parts.Nat.Simple.Properties where\n\nopen import MLib.Prelude\nopen import MLib.Fin.Parts.Nat\nimport MLib.Fin.Parts.Nat.Simple as S\n\nmodule P a b = Partsℕ (S.repl a b)\n\nopen Nat using (_*_; _+_; _<_)\nopen Fin using (toℕ; fromℕ≤)\nopen List\n\n\nfromAny : ∀ a b → Any Fin (S.repl a b) → ℕ × ℕ\nfromAny zero b ()\nfromAny (suc a) b (here j) = 0 , Fin.toℕ j\nfromAny (suc a) b (there js) =\n let i , j = fromAny a b js\n in suc i , j\n\nintoPart-prop : ∀ a b {ps : Any Fin (S.repl a b)} → P.intoPart a b ps ≡ S.intoPart a b (fromAny a b ps)\nintoPart-prop zero b {()}\nintoPart-prop (suc a) b {here px} = ≡.sym (Nat.+-identityʳ _)\nintoPart-prop (suc a) b {there ps} =\n let ind = intoPart-prop a b {ps}\n i , j = fromAny a b ps\n open ≡.Reasoning\n open Nat.SemiringSolver\n in begin\n b + Impl.intoPart ps ≡⟨ ≡.cong₂ _+_ ≡.refl ind ⟩\n b + (j + i * b) ≡⟨ solve 3 (λ b j ib → b :+ (j :+ ib) := j :+ (b :+ ib)) ≡.refl b j (i * b) ⟩\n j + (b + i * b) ∎\n\nlem : ∀ a b {k} → k < a * b → k < sum (S.repl a b)\nlem a b p = Nat.≤-trans p (Nat.≤-reflexive (≡.sym (S.sum-replicate-* a b)))\n\nfromPart-prop : ∀ a b {k} → k < a * b → Maybe.map (fromAny a b) (Impl.fromPart (S.repl a b) k) ≡ just (S.fromPart a b k)\nfromPart-prop zero b ()\nfromPart-prop (suc a) b {k} p with Impl.compare′ k b\nfromPart-prop (suc a) .(suc (m + k)) {.m} p | Impl.less m k = ≡.cong just (Σ.≡×≡⇒≡ (≡.refl , Fin.toℕ-fromℕ≤ _))\nfromPart-prop (suc a) b {.(b + k)} p | Impl.gte .b k with Impl.fromPart (S.repl a b) k | fromPart-prop a b {k} (Nat.+-cancelˡ-< b p)\nfromPart-prop (suc a) b {.(b + k)} p | Impl.gte .b k | just x | ind =\n let e1 , e2 = Σ.≡⇒≡×≡ (Maybe.just-injective ind)\n in ≡.cong just (Σ.≡×≡⇒≡ (≡.cong suc e1 , e2))\nfromPart-prop (suc a) b {.(b + k)} p | Impl.gte .b k | nothing | ()\n\nfromPart′-prop : ∀ a b {k} (p : k < a * b) → fromAny a b (P.fromPart a b {k} (lem a b p)) ≡ S.fromPart a b k\nfromPart′-prop a b {k} p with Impl.fromPart (S.repl a b) k | Impl.fromPart-prop (S.repl a b) (lem a b p) | fromPart-prop a b p\nfromPart′-prop a b {k} p | just x | y | z = Maybe.just-injective z\nfromPart′-prop a b {k} p | nothing | () | z\n", "meta": {"hexsha": "50fc40fbd27301798899163254b37bff654c6097", "size": 2139, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/MLib/Fin/Parts/Nat/Simple/Properties.agda", "max_stars_repo_name": "bch29/agda-matrices", "max_stars_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/MLib/Fin/Parts/Nat/Simple/Properties.agda", "max_issues_repo_name": "bch29/agda-matrices", "max_issues_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/MLib/Fin/Parts/Nat/Simple/Properties.agda", "max_forks_repo_name": "bch29/agda-matrices", "max_forks_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.9411764706, "max_line_length": 132, "alphanum_fraction": 0.5759700795, "num_tokens": 917, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8723473746782094, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.6733156444240902}} {"text": "\nmodule Oscar.Class.Functor where\n\nopen import Oscar.Class.Monoid\nopen import Oscar.Data.Equality\nopen import Oscar.Data.Product\nopen import Oscar.Level\nopen import Oscar.Relation\nopen import Oscar.Function\n\nrecord Functor {a} {A : Set a} {b} (_↠_ : A → A → Set b) ⦃ _ : Monoid _↠_ ⦄ {c} (C : A → Set c) : Set (a ⊔ b ⊔ c) where\n field\n _◃_ : ∀ {m n} → m ↠ n → m ⟨ C ⟩→ n\n ◃-identity : ∀ {m} → (x : C m) → ε ◃ x ≡ x\n ◃-associativity : ∀ {l m n} (f : l ↠ m) (g : m ↠ n) → (g ◇ f) ◃_ ≡̇ g ◃_ ∘ f ◃_\n ◃-extensionality : ∀ {m n} {f g : m ↠ n} → f ≡ g → f ◃_ ≡ g ◃_\n\nopen Functor ⦃ … ⦄ public\n\nopen import Data.List\nopen import Oscar.Function\n\ninstance MonoidFunction : ∀ {a} → Monoid {A = Set a} (λ m n → m → n)\nMonoid.ε MonoidFunction = λ x → x\nMonoid._◇_ MonoidFunction g f = g ∘ f\nMonoid.◇-left-identity MonoidFunction _ = refl\nMonoid.◇-right-identity MonoidFunction _ = refl\nMonoid.◇-associativity MonoidFunction _ _ _ = refl\n\ninstance FunctorList : ∀ {a} → Functor _ ⦃ MonoidFunction {a} ⦄ List\nFunctor._◃_ FunctorList {m} {n} f [] = []\nFunctor._◃_ FunctorList {m} {n} f (x ∷ xs) = f x ∷ f ◃ xs\nFunctor.◃-identity FunctorList = {!!}\nFunctor.◃-associativity FunctorList = {!!}\nFunctor.◃-extensionality FunctorList = {!!}\n", "meta": {"hexsha": "154291f85f43b2b0bd636424af885217d8bdab9b", "size": 1233, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Class/Functor.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Class/Functor.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Class/Functor.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.25, "max_line_length": 119, "alphanum_fraction": 0.6196269262, "num_tokens": 492, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9059898254600903, "lm_q2_score": 0.7431680086124811, "lm_q1q2_score": 0.6733026544103446}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.HITs.S1.Properties where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.GroupoidLaws\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Isomorphism\nopen import Cubical.Foundations.Univalence\n\nopen import Cubical.HITs.S1.Base\nopen import Cubical.HITs.PropositionalTruncation as PropTrunc\n\nisConnectedS¹ : (s : S¹) → ∥ base ≡ s ∥\nisConnectedS¹ base = ∣ refl ∣\nisConnectedS¹ (loop i) =\n squash ∣ (λ j → loop (i ∧ j)) ∣ ∣ (λ j → loop (i ∨ ~ j)) ∣ i\n\nisGroupoidS¹ : isGroupoid S¹\nisGroupoidS¹ s t =\n PropTrunc.rec isPropIsSet\n (λ p →\n subst (λ s → isSet (s ≡ t)) p\n (PropTrunc.rec isPropIsSet\n (λ q → subst (λ t → isSet (base ≡ t)) q isSetΩS¹)\n (isConnectedS¹ t)))\n (isConnectedS¹ s)\n\n\ntoPropElim : ∀ {ℓ} {B : S¹ → Type ℓ} → ((s : S¹) → isProp (B s)) → B base → (s : S¹) → B s\ntoPropElim {B = B} isprop b base = b\ntoPropElim {B = B} isprop b (loop i) = hcomp (λ k → λ {(i = i0) → b\n ; (i = i1) → isprop base (subst B (loop) b) b k})\n (transp (λ j → B (loop (i ∧ j))) (~ i) b)\n", "meta": {"hexsha": "c5c56ceae337d70b405a575d3a6bf46538fab515", "size": 1249, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/HITs/S1/Properties.agda", "max_stars_repo_name": "bijan2005/univalent-foundations", "max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/HITs/S1/Properties.agda", "max_issues_repo_name": "bijan2005/univalent-foundations", "max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/HITs/S1/Properties.agda", "max_forks_repo_name": "bijan2005/univalent-foundations", "max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "avg_line_length": 35.6857142857, "max_line_length": 102, "alphanum_fraction": 0.6004803843, "num_tokens": 436, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898178450964, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.6733026435975384}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Algebra.Structures.Bundles.Field\n\nmodule Algebra.Linear.Morphism.VectorSpace\n {k ℓᵏ} (K : Field k ℓᵏ)\n where\n\nopen import Level\nopen import Algebra.FunctionProperties as FP\nimport Algebra.Linear.Morphism.Definitions as LinearMorphismDefinitions\nimport Algebra.Morphism as Morphism\nopen import Relation.Binary using (Rel; Setoid)\nopen import Relation.Binary.Morphism.Structures\nopen import Algebra.Morphism\n\nopen import Algebra.Linear.Core\nopen import Algebra.Linear.Structures.VectorSpace K\nopen import Algebra.Linear.Structures.Bundles\n\nmodule LinearDefinitions {a₁ a₂ ℓ₂} (A : Set a₁) (B : Set a₂) (_≈_ : Rel B ℓ₂) where\n open Morphism.Definitions A B _≈_ public\n open LinearMorphismDefinitions K A B _≈_ public\n\nmodule _\n {a₁ ℓ₁} (From : VectorSpace K a₁ ℓ₁)\n {a₂ ℓ₂} (To : VectorSpace K a₂ ℓ₂)\n where\n\n private\n module F = VectorSpace From\n module T = VectorSpace To\n\n K' : Set k\n K' = Field.Carrier K\n\n open F using () renaming (Carrier to A; _≈_ to _≈₁_; _+_ to _+₁_; _∙_ to _∙₁_)\n open T using () renaming (Carrier to B; _≈_ to _≈₂_; _+_ to _+₂_; _∙_ to _∙₂_)\n\n open import Function\n\n open LinearDefinitions (VectorSpace.Carrier From) (VectorSpace.Carrier To) _≈₂_\n\n record IsLinearMap (⟦_⟧ : Morphism) : Set (k ⊔ a₁ ⊔ a₂ ⊔ ℓ₁ ⊔ ℓ₂) where\n field\n isAbelianGroupMorphism : IsAbelianGroupMorphism F.abelianGroup T.abelianGroup ⟦_⟧\n ∙-homo : ScalarHomomorphism ⟦_⟧ _∙₁_ _∙₂_\n\n open IsAbelianGroupMorphism isAbelianGroupMorphism public\n renaming (∙-homo to +-homo; ε-homo to 0#-homo)\n\n distrib-linear : ∀ (a b : K') (u v : A) -> ⟦ a ∙₁ u +₁ b ∙₁ v ⟧ ≈₂ a ∙₂ ⟦ u ⟧ +₂ b ∙₂ ⟦ v ⟧\n distrib-linear a b u v = T.trans (+-homo (a ∙₁ u) (b ∙₁ v)) (T.+-cong (∙-homo a u) (∙-homo b v))\n\n record IsLinearMonomorphism (⟦_⟧ : Morphism) : Set (k ⊔ a₁ ⊔ a₂ ⊔ ℓ₁ ⊔ ℓ₂) where\n field\n isLinearMap : IsLinearMap ⟦_⟧\n injective : Injective _≈₁_ _≈₂_ ⟦_⟧\n\n open IsLinearMap isLinearMap public\n\n record IsLinearIsomorphism (⟦_⟧ : Morphism) : Set (k ⊔ a₁ ⊔ a₂ ⊔ ℓ₁ ⊔ ℓ₂) where\n field\n isLinearMonomorphism : IsLinearMonomorphism ⟦_⟧\n surjective : Surjective _≈₁_ _≈₂_ ⟦_⟧\n\n open IsLinearMonomorphism isLinearMonomorphism public\n\nmodule _\n {a ℓ} (V : VectorSpace K a ℓ)\n where\n\n open VectorSpace V\n\n open LinearDefinitions Carrier Carrier _≈_\n\n IsLinearEndomorphism : Morphism -> Set (k ⊔ a ⊔ ℓ)\n IsLinearEndomorphism ⟦_⟧ = IsLinearMap V V ⟦_⟧\n\n IsLinearAutomorphism : Morphism -> Set (k ⊔ a ⊔ ℓ)\n IsLinearAutomorphism ⟦_⟧ = IsLinearIsomorphism V V ⟦_⟧\n", "meta": {"hexsha": "b45d42badcf6e0c9c0e82b96bdd5f641e7650820", "size": 2588, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Algebra/Linear/Morphism/VectorSpace.agda", "max_stars_repo_name": "felko/linear-algebra", "max_stars_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-11-02T14:11:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T06:18:08.000Z", "max_issues_repo_path": "src/Algebra/Linear/Morphism/VectorSpace.agda", "max_issues_repo_name": "felko/linear-algebra", "max_issues_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Algebra/Linear/Morphism/VectorSpace.agda", "max_forks_repo_name": "felko/linear-algebra", "max_forks_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.5609756098, "max_line_length": 100, "alphanum_fraction": 0.6839258114, "num_tokens": 953, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.905989810230102, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.6733026379383183}} {"text": "module Pr where\n\ndata FF : Set where\n\nmagic : {X : Set} -> FF -> X\nmagic ()\n\nrecord TT : Set where\n\ndata Id {S : Set}(s : S) : S -> Set where\n refl : Id s s\n\ndata Pr : Set1 where\n tt : Pr\n ff : Pr\n _/\\_ : Pr -> Pr -> Pr\n all : (S : Set) -> (S -> Pr) -> Pr\n _eq_ : {S : Set} -> S -> S -> Pr\n\nrecord Sig (S : Set)(T : S -> Set) : Set where\n field\n fst : S\n snd : T fst\n\nopen module Sig' {S : Set}{T : S -> Set} = Sig {S}{T} public\n\n_,_ : {S : Set}{T : S -> Set}(s : S) -> T s -> Sig S T\ns , t = record {fst = s ; snd = t}\n\n[|_|] : Pr -> Set\n[| tt |] = TT\n[| ff |] = FF\n[| P /\\ Q |] = Sig [| P |] \\_ -> [| Q |]\n[| all S P |] = (x : S) -> [| P x |]\n[| a eq b |] = Id a b\n\n_=>_ : Pr -> Pr -> Pr\nP => Q = all [| P |] \\_ -> Q\n\n∼ : Pr -> Pr\n∼ P = P => ff\n\ndata Decision (P : Pr) : Set where\n yes : [| P |] -> Decision P\n no : [| ∼ P |] -> Decision P\n\ndata Bool : Set where\n true : Bool\n false : Bool\n\nSo : Bool -> Pr\nSo true = tt\nSo false = ff\n\nnot : Bool -> Bool\nnot true = false\nnot false = true\n\nso : (b : Bool) -> Decision (So b)\nso true = yes _\nso false = no magic\n\npotahto : (b : Bool) -> [| So (not b) => ∼ (So b) |]\npotahto true () _\npotahto false _ ()\n\nPEx : (P : Pr) -> ([| P |] -> Pr) -> Pr\nPEx P Q = P /\\ all [| P |] Q\n\nPow : Set -> Set1\nPow X = X -> Pr\n\n_==>_ : {X : Set} -> Pow X -> Pow X -> Pr\n_==>_ {X} P Q = all X \\x -> P x => Q x\n\nDecidable : {X : Set}(P : Pow X) -> Set\nDecidable {X} P = (x : X) -> Decision (P x)\n\ndata _:-_ (S : Set)(P : Pow S) : Set where\n [_/_] : (s : S) -> [| P s |] -> S :- P\n\nwit : {S : Set}{P : S -> Pr} -> S :- P -> S\nwit [ s / p ] = s\n\ncert : {S : Set}{P : S -> Pr}(sp : S :- P) -> [| P (wit sp) |]\ncert [ s / p ] = p\n\n_??_ : {S : Set}{P : S -> Pr}\n (sp : S :- P){M : Set} ->\n ((s : S)(p : [| P s |]) -> M) ->\n M\nsp ?? m = m (wit sp) (cert sp)\n", "meta": {"hexsha": "77eeaee48e09ea7c85ec7e0ee35e95aa46c8aa35", "size": 1819, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "benchmark/Syntacticosmos/Pr.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "benchmark/Syntacticosmos/Pr.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "benchmark/Syntacticosmos/Pr.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 19.5591397849, "max_line_length": 62, "alphanum_fraction": 0.4288070368, "num_tokens": 762, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110540642806, "lm_q2_score": 0.7549149978955811, "lm_q1q2_score": 0.6732415400021924}} {"text": "{-# OPTIONS --type-in-type #-} -- yes, there will be some cheating in this lecture\n\nmodule Lec3 where\n\nopen import Lec1Done\nopen import Lec2Done\n\npostulate\n extensionality : {S : Set}{T : S -> Set}\n {f g : (x : S) -> T x} ->\n ((x : S) -> f x == g x) ->\n f == g\n\nrecord Category : Set where\n field\n\n -- two types of thing\n Obj : Set -- \"objects\"\n _~>_ : Obj -> Obj -> Set -- \"arrows\" or \"morphisms\"\n -- or \"homomorphisms\"\n \n -- two operations\n id~> : {T : Obj} -> T ~> T\n _>~>_ : {R S T : Obj} -> R ~> S -> S ~> T -> R ~> T\n\n -- three laws\n law-id~>>~> : {S T : Obj} (f : S ~> T) ->\n (id~> >~> f) == f\n law->~>id~> : {S T : Obj} (f : S ~> T) ->\n (f >~> id~>) == f\n law->~>>~> : {Q R S T : Obj} (f : Q ~> R)(g : R ~> S)(h : S ~> T) ->\n ((f >~> g) >~> h) == (f >~> (g >~> h))\n\n-- Sets and functions are the classic example of a category.\n{-(-}\nSET : Category\nSET = record\n { Obj = Set\n ; _~>_ = \\ S T -> S -> T\n ; id~> = id\n ; _>~>_ = _>>_\n ; law-id~>>~> = \\ f -> refl f\n ; law->~>id~> = \\ f -> refl f\n ; law->~>>~> = \\ f g h -> refl (\\ x -> h (g (f x)))\n }\n{-)-}\n\nunique->= : (m n : Nat)(p q : m >= n) -> p == q\nunique->= m zero p q = refl <>\nunique->= zero (suc n) () ()\nunique->= (suc m) (suc n) p q = unique->= m n p q\n\n-- A PREORDER is a category where there is at most one arrow between\n-- any two objects. (So arrows are unique.)\n{-(-}\nNAT->= : Category\nNAT->= = record\n { Obj = Nat\n ; _~>_ = _>=_\n ; id~> = \\ {n} -> refl->= n\n ; _>~>_ = \\ {m}{n}{p} m>=n n>=p -> trans->= m n p m>=n n>=p\n ; law-id~>>~> = \\ {S} {T} f -> unique->= S T (trans->= S S T (refl->= S) f) f\n ; law->~>id~> = \\ {S} {T} f -> unique->= S T (trans->= S T T f (refl->= T)) f\n ; law->~>>~> = \\ {Q} {R} {S} {T} f g h ->\n unique->= Q T _ _ {-(trans->= Q S T (trans->= Q R S f g) h)\n (trans->= Q R T f (trans->= R S T g h)) -}\n } where\n{-)-}\n\n-- A MONOID is a category with Obj = One.\n-- The values in the monoid are the *arrows*.\n{-(-}\nONE-Nat : Category\nONE-Nat = record\n { Obj = One\n ; _~>_ = \\ _ _ -> Nat\n ; id~> = zero\n ; _>~>_ = _+N_\n ; law-id~>>~> = zero-+N\n ; law->~>id~> = +N-zero\n ; law->~>>~> = assocLR-+N\n }\n{-)-}\n\n{-(-}\neqUnique : {X : Set}{x y : X}{p q : x == y} -> p == q\neqUnique {p = refl x} {q = refl .x} = refl (refl x)\n\n-- A DISCRETE category is one where the only arrows are the identities.\nDISCRETE : (X : Set) -> Category\nDISCRETE X = record\n { Obj = X\n ; _~>_ = _==_\n ; id~> = \\ {x} -> refl x\n ; _>~>_ = \\ { (refl x) (refl .x) -> refl x }\n ; law-id~>>~> = \\ {S} {T} f ->\n eqUnique\n ; law->~>id~> = \\ {S} {T} f ->\n eqUnique\n ; law->~>>~> = \\ {Q} {R} {S} {T} f g h -> eqUnique\n }\n{-)-}\n\n\n\nmodule FUNCTOR where\n open Category\n \n record _=>_ (C D : Category) : Set where -- \"Functor from C to D\"\n field\n -- two actions\n F-Obj : Obj C -> Obj D\n F-map : {S T : Obj C} -> _~>_ C S T -> _~>_ D (F-Obj S) (F-Obj T)\n\n -- two laws\n F-map-id~> : {T : Obj C} -> F-map (id~> C {T}) == id~> D {F-Obj T}\n F-map->~> : {R S T : Obj C}(f : _~>_ C R S)(g : _~>_ C S T) ->\n F-map (_>~>_ C f g) == _>~>_ D (F-map f) (F-map g)\n\nopen FUNCTOR\n\nmodule FOO (C : Category) where\n open Category C\n X : Set\n X = Obj\n\n\npostulate vmap : {n : Nat}{S T : Set} → (S → T) → Vec S n → Vec T n\n\n{-+}\nVEC : Nat -> SET => SET\nVEC n = record { F-Obj = \\ X -> Vec X n\n ; F-map = vmap\n ; F-map-id~> = extensionality {!!}\n ; F-map->~> = {!!}\n }\n{+-}\n\n{-(-}\nVTAKE : Set -> NAT->= => SET\nVTAKE X = record { F-Obj = Vec X\n ; F-map = \\ {m}{n} m>=n xs -> vTake m n m>=n xs\n ; F-map-id~> = \\ {n} -> extensionality (vTakeIdFact n)\n ; F-map->~> = \\ {m}{n}{p} m>=n n>=p ->\n extensionality (vTakeCpFact m n p m>=n n>=p)\n }\n{-)-}\n\n{-(-}\nADD : Nat -> NAT->= => NAT->=\nADD d = record { F-Obj = (d +N_) -- \\ x -> d +N x\n ; F-map = \\ {m}{n} -> help d m n\n ; F-map-id~> = \\ {T} ->\n unique->= (d +N T) (d +N T) (help d T T (refl->= T))\n (refl->= (d +N T))\n ; F-map->~> = \\ {R} {S} {T} f g ->\n unique->= (d +N R) (d +N T) (help d R T (trans->= R S T f g))\n (trans->= (d +N R) (d +N S) (d +N T) (help d R S f) (help d S T g))\n } where\n help : forall d m n -> m >= n -> (d +N m) >= (d +N n)\n help zero m n m>=n = m>=n\n help (suc d) m n m>=n = help d m n m>=n \n{-)-}\n\n{-(-}\nCATEGORY : Category\nCATEGORY = record\n { Obj = Category\n ; _~>_ = _=>_\n ; id~> = record\n { F-Obj = id\n ; F-map = id\n ; F-map-id~> = {!!}\n ; F-map->~> = {!!}\n }\n ; _>~>_ = \\ F G -> record\n { F-Obj = F-Obj F >> F-Obj G\n ; F-map = F-map F >> F-map G\n ; F-map-id~> = {!!}\n ; F-map->~> = {!!}\n }\n ; law-id~>>~> = {!!}\n ; law->~>id~> = {!!}\n ; law->~>>~> = {!!}\n } where open _=>_\n{-)-}\n", "meta": {"hexsha": "ed40f32d3eceac19fa49073fea343465d251f866", "size": 5856, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/course/2017-conor_mcbride_cs410/CS410-17-master/lectures/Lec3.agda", "max_stars_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_stars_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2015-01-29T14:37:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T06:55:03.000Z", "max_issues_repo_path": "agda/course/2017-conor_mcbride_cs410/CS410-17-master/lectures/Lec3.agda", "max_issues_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_issues_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/course/2017-conor_mcbride_cs410/CS410-17-master/lectures/Lec3.agda", "max_forks_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_forks_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2015-04-13T21:40:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-21T15:58:10.000Z", "avg_line_length": 31.3155080214, "max_line_length": 100, "alphanum_fraction": 0.3471653005, "num_tokens": 2025, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110483133801, "lm_q2_score": 0.7549149868676283, "lm_q1q2_score": 0.6732415258259011}} {"text": "------------------------------------------------------------------------------\n-- Division program\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n-- This module define a division program using repeated subtraction\n-- (Dybjer 1985).\n\n-- Peter Dybjer. Program verification in a logical theory of\n-- constructions. In Jean-Pierre Jouannaud, editor. Functional\n-- Programming Languages and Computer Architecture, volume 201 of\n-- LNCS, 1985, pages 334-349. Appears in revised form as Programming\n-- Methodology Group Report 26, June 1986.\n\nmodule LTC-PCF.Program.Division.Division where\n\nopen import LTC-PCF.Base\nopen import LTC-PCF.Data.Nat\nopen import LTC-PCF.Data.Nat.Inequalities\n\n------------------------------------------------------------------------------\n\ndivh : D → D\ndivh g = lam (λ i → lam (λ j →\n if (lt i j) then zero else (succ₁ (g · (i ∸ j) · j))))\n\ndiv : D → D → D\ndiv i j = fix divh · i · j\n", "meta": {"hexsha": "bfc9eab7ead6a047f2b52af78052003bfc2b1287", "size": 1123, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/LTC-PCF/Program/Division/Division.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/LTC-PCF/Program/Division/Division.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/LTC-PCF/Program/Division/Division.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 34.0303030303, "max_line_length": 78, "alphanum_fraction": 0.5191451469, "num_tokens": 247, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8918110511888302, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.6732415230791963}} {"text": "{-# OPTIONS --universe-polymorphism #-}\nopen import Categories.Category\nopen import Categories.Object.BinaryProducts\n\nmodule Categories.Object.BinaryProducts.N-ary {o ℓ e}\n (C : Category o ℓ e) \n (BP : BinaryProducts C)\n where\n\nopen Category C\nopen BinaryProducts BP\nopen Equiv\n\nimport Categories.Object.Product\nopen Categories.Object.Product C\n\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Data.Vec \nopen import Data.Product.N-ary hiding ([])\n\nProd : {n : ℕ} → Vec Obj (suc n) → Obj\nProd { zero} (A ∷ []) = A\nProd {suc n} (A ∷ As) = A × Prod {n} As\n\nπˡ : {n m : ℕ}\n → (As : Vec Obj (suc n))\n → (Bs : Vec Obj (suc m))\n → Prod (As ++ Bs) ⇒ Prod As\nπˡ { zero} (A ∷ []) Bs = π₁\nπˡ {suc n} (A ∷ As) Bs = ⟨ π₁ , πˡ {n} As Bs ∘ π₂ ⟩\n\nπʳ : {n m : ℕ}\n → (As : Vec Obj (suc n))\n → (Bs : Vec Obj (suc m))\n → Prod (As ++ Bs) ⇒ Prod Bs\nπʳ { zero} (A ∷ []) Bs = π₂\nπʳ {suc n} (A ∷ As) Bs = πʳ {n} As Bs ∘ π₂\n\nglue : {n m : ℕ}{X : Obj}\n → (As : Vec Obj (suc n))\n → (Bs : Vec Obj (suc m))\n → (f : X ⇒ Prod As)\n → (g : X ⇒ Prod Bs)\n → X ⇒ Prod (As ++ Bs)\nglue { zero}{m} (A ∷ []) Bs f g = ⟨ f , g ⟩\nglue {suc n}{m} (A ∷ As) Bs f g = ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n\nopen HomReasoning\n\n.commuteˡ : {n m : ℕ}{X : Obj}\n → (As : Vec Obj (suc n))\n → (Bs : Vec Obj (suc m))\n → {f : X ⇒ Prod As}\n → {g : X ⇒ Prod Bs}\n → πˡ As Bs ∘ glue As Bs f g ≡ f\ncommuteˡ { zero} (A ∷ []) Bs {f}{g} = commute₁\ncommuteˡ {suc n} (A ∷ As) Bs {f}{g} =\n begin\n ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n ↓⟨ ⟨⟩∘ ⟩\n ⟨ π₁ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n , (πˡ As Bs ∘ π₂) ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n ⟩ \n ↓⟨ ⟨⟩-cong₂ commute₁ assoc ⟩\n ⟨ π₁ ∘ f\n , πˡ As Bs ∘ π₂ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n ⟩ \n ↓⟨ ⟨⟩-congʳ (refl ⟩∘⟨ commute₂) ⟩\n ⟨ π₁ ∘ f , πˡ As Bs ∘ glue As Bs (π₂ ∘ f) g ⟩\n ↓⟨ ⟨⟩-congʳ (commuteˡ As Bs) ⟩\n ⟨ π₁ ∘ f , π₂ ∘ f ⟩\n ↓⟨ g-η ⟩\n f\n ∎\n\n.commuteʳ : {n m : ℕ}{X : Obj}\n → (As : Vec Obj (suc n))\n → (Bs : Vec Obj (suc m))\n → {f : X ⇒ Prod As}\n → {g : X ⇒ Prod Bs}\n → πʳ As Bs ∘ glue As Bs f g ≡ g\ncommuteʳ { zero} (A ∷ []) Bs {f}{g} = commute₂\ncommuteʳ {suc n} (A ∷ As) Bs {f}{g} =\n begin\n (πʳ As Bs ∘ π₂) ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n ↓⟨ assoc ⟩\n πʳ As Bs ∘ π₂ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n ↓⟨ refl ⟩∘⟨ commute₂ ⟩\n πʳ As Bs ∘ glue As Bs (π₂ ∘ f) g\n ↓⟨ commuteʳ As Bs ⟩\n g\n ∎\n\n.N-universal : {n m : ℕ}{X : Obj}\n → (As : Vec Obj (suc n))\n → (Bs : Vec Obj (suc m))\n → {f : X ⇒ Prod As}\n → {g : X ⇒ Prod Bs}\n → {h : X ⇒ Prod (As ++ Bs) }\n → πˡ As Bs ∘ h ≡ f \n → πʳ As Bs ∘ h ≡ g \n → glue As Bs f g ≡ h\nN-universal { zero} (A ∷ []) Bs {f}{g}{h} h-commuteˡ h-commuteʳ = universal h-commuteˡ h-commuteʳ\nN-universal {suc n} (A ∷ As) Bs {f}{g}{h} h-commuteˡ h-commuteʳ = \n begin\n ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩\n ↓⟨ ⟨⟩-congʳ (N-universal As Bs π₂∘h-commuteˡ π₂∘h-commuteʳ) ⟩\n ⟨ π₁ ∘ f , π₂ ∘ h ⟩\n ↑⟨ ⟨⟩-congˡ π₁∘h-commuteˡ ⟩\n ⟨ π₁ ∘ h , π₂ ∘ h ⟩\n ↓⟨ g-η ⟩\n h\n ∎ \n where\n -- h-commuteˡ : ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ h ≡ f \n -- h-commuteʳ : (πʳ As Bs ∘ π₂) ∘ h ≡ g \n \n π₁∘h-commuteˡ : π₁ ∘ h ≡ π₁ ∘ f \n π₁∘h-commuteˡ = \n begin\n π₁ ∘ h\n ↑⟨ commute₁ ⟩∘⟨ refl ⟩\n (π₁ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩) ∘ h\n ↓⟨ assoc ⟩\n π₁ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ h\n ↓⟨ refl ⟩∘⟨ h-commuteˡ ⟩\n π₁ ∘ f\n ∎\n \n π₂∘h-commuteˡ : πˡ As Bs ∘ π₂ ∘ h ≡ π₂ ∘ f \n π₂∘h-commuteˡ =\n begin\n πˡ As Bs ∘ π₂ ∘ h\n ↑⟨ assoc ⟩\n (πˡ As Bs ∘ π₂) ∘ h\n ↑⟨ commute₂ ⟩∘⟨ refl ⟩\n (π₂ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩) ∘ h\n ↓⟨ assoc ⟩\n π₂ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ h\n ↓⟨ refl ⟩∘⟨ h-commuteˡ ⟩\n π₂ ∘ f\n ∎\n \n π₂∘h-commuteʳ : πʳ As Bs ∘ π₂ ∘ h ≡ g \n π₂∘h-commuteʳ = trans (sym assoc) h-commuteʳ\n\nisProduct : {n m : ℕ}\n → (As : Vec Obj (suc n))\n → (Bs : Vec Obj (suc m))\n → Product (Prod As) (Prod Bs)\nisProduct {n}{m} As Bs = record\n { A×B = Prod (As ++ Bs)\n ; π₁ = πˡ As Bs\n ; π₂ = πʳ As Bs\n ; ⟨_,_⟩ = glue As Bs\n ; commute₁ = commuteˡ As Bs\n ; commute₂ = commuteʳ As Bs\n ; universal = N-universal As Bs\n }\n", "meta": {"hexsha": "ad1536d6068466fd2e07f1ba9fd74a31365ce2d0", "size": 4152, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Object/BinaryProducts/N-ary.agda", "max_stars_repo_name": "p-pavel/categories", "max_stars_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-12-29T21:51:57.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-29T21:51:57.000Z", "max_issues_repo_path": "Categories/Object/BinaryProducts/N-ary.agda", "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Object/BinaryProducts/N-ary.agda", "max_forks_repo_name": "p-pavel/categories", "max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.95, "max_line_length": 97, "alphanum_fraction": 0.472061657, "num_tokens": 2063, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110396870288, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.6732415143963141}} {"text": "open import Type\n\nmodule Graph {ℓ₁ ℓ₂} (V : Type{ℓ₁}) where\n\n-- A graph is represented by a binary relation which states whether there is an edge from one vertex to another.\n-- In other words, a graph is here defined by only its adjacency relation.\n-- This is by default (without any assumptions) a directed multigraph which is possibly infinite.\n--\n-- An object of type Graph is the adjacency relation.\n-- For (_⟶_ : Graph), (a b : V), an object of type (a ⟶ b) is an edge from vertices a to b, and its existence means that there is an edge from a to b.\nGraph : Type\nGraph = (V → V → Type{ℓ₂})\n\nmodule _ (_⟶_ : Graph) where\n -- Two vertices are adjacent when there is an edge from the first one to the second one.\n Adjacent = _⟶_\n", "meta": {"hexsha": "0e0aec86c63521d6419d820930d962a56bfb94ca", "size": 733, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Graph.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Graph.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Graph.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 43.1176470588, "max_line_length": 150, "alphanum_fraction": 0.7135061392, "num_tokens": 198, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9207896802383028, "lm_q2_score": 0.7310585903489892, "lm_q1q2_score": 0.6731512056429102}} {"text": "open import Data.Fin using (Fin; suc; zero)\nopen import Data.Nat using (ℕ)\nopen import Data.Vec using (Vec; []; _∷_; map)\nopen import Dipsy.Polarity renaming (pos to +; neg to -)\n\nmodule Dipsy.Struct\n (FOp : {n : ℕ} (as : Vec Polarity n) (b : Polarity) → Set)\n (SOp : {n : ℕ} (as : Vec Polarity n) (b : Polarity) → Set)\n where\n\nopen import Dipsy.Form FOp\n\nmutual\n data Struct : (b : Polarity) → Set where\n ·_· : {b : Polarity} → Form → Struct b\n op : {n : ℕ} {as : Vec Polarity n} {b : Polarity}\n → SOp as b → Structs as → Struct b\n\n data Structs : {n : ℕ} (as : Vec Polarity n) → Set where\n [] : Structs []\n _∷_ : {n : ℕ} {a : Polarity} {as : Vec Polarity n}\n → Struct a → Structs as → Structs (a ∷ as)\n\nmutual\n data Context : (b c : Polarity) → Set where\n [] : {b : Polarity} → Context b b\n op : {n : ℕ} {as : Vec Polarity n} {b c : Polarity}\n → SOp as c → (i : Fin n) → Contexts as b i → Context b c\n\n data Contexts : {n : ℕ} (as : Vec Polarity n) (b : Polarity) (i : Fin n) → Set where\n _<∷_ : {n : ℕ} {b c : Polarity} {as : Vec Polarity n}\n → Context b c → Structs as → Contexts (c ∷ as) b zero\n _∷>_ : {n : ℕ} {a b : Polarity} {as : Vec Polarity n} {i : Fin n}\n → Struct a → Contexts as b i → Contexts (a ∷ as) b (suc i)\n", "meta": {"hexsha": "8b826f6a30254f9b2f850215d7f1a5c93a3a03ab", "size": 1296, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Dipsy/Struct.agda", "max_stars_repo_name": "wenkokke/Dipsy", "max_stars_repo_head_hexsha": "06eec3f3325c71c81809ff19dfaf4fd43ba958ed", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-09-10T13:43:29.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-10T13:43:29.000Z", "max_issues_repo_path": "src/Dipsy/Struct.agda", "max_issues_repo_name": "wenkokke/dipsy", "max_issues_repo_head_hexsha": "06eec3f3325c71c81809ff19dfaf4fd43ba958ed", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Dipsy/Struct.agda", "max_forks_repo_name": "wenkokke/dipsy", "max_forks_repo_head_hexsha": "06eec3f3325c71c81809ff19dfaf4fd43ba958ed", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.0285714286, "max_line_length": 86, "alphanum_fraction": 0.5578703704, "num_tokens": 488, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9207896693699845, "lm_q2_score": 0.7310585727705127, "lm_q1q2_score": 0.6731511815114531}} {"text": "-- | Examples for SDE.\n\nmodule SDE-Example where\n\nopen import Size\nimport Level\nopen import Function\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as P hiding ([_])\nopen ≡-Reasoning\n\nopen import Data.Product as Prod renaming (Σ to ⨿)\nopen import Data.Nat as Nat\nopen import Data.Sum as Sum\nopen import Data.Fin hiding (_+_)\n\nopen import Streams\nopen import SDE\n\n-- Example: Basic operations over streams over naturals\n[_] : ∀{i} → ℕ → Stream {i} ℕ\nhd [ n ] = n\ntl [ n ] = [ 0 ]\n\n_⊕_ : ∀ {i} → Stream {i} ℕ → Stream {i} ℕ → Stream {i} ℕ\nhd (x ⊕ y) = hd x + hd y\ntl (x ⊕ y) = tl x ⊕ tl y\n\n_⊗_ : ∀{i} → Stream {i} ℕ → Stream {i} ℕ → Stream {i} ℕ\nhd (x ⊗ y) = hd x * hd y\ntl (_⊗_ {i} x y) {j} = (tl x ⊗ y) ⊕ ([ hd x ] ⊗ (tl y))\n\n_•_ : ∀{i} → Stream {i} ℕ → Stream {i} ℕ → Stream {i} ℕ\nhd (x • y) = hd x\ntl (x • y) = tl y ⊗ (tl x • y)\n\n--------- Example for syntactic SDE.\n-- We define symbols iₙ (n ∈ ℕ), p and c through SDEs for streams\n-- over natural numbers. Here, iₙ is the injection of the number n into streams\n-- and corresponds to [n], p is stream addition, and c is the convolution\n-- product. The SDEs are the usual ones:\n-- (iₙ)(0) = n\n-- (iₙ)' = i₀\n-- (p s t)(0) = s(0) + t(0)\n-- (p s t)' = p s' t'\n-- (c s t)(0) = s(0) * t(0)\n-- (c s t)' = p (c s' t) (c i_{s(0)} t')\n\n-- First, we define the signature, which has ℕ-many symbols for the iₙ of\n-- arity 0 and two symbols (p and c) of arity 2.\nΣ : Sig\nΣ = record { ∥_∥ = ℕ ⊎ Fin 2 ; ar = ar-Σ }\n where\n ar-Σ : ℕ ⊎ Fin 2 → Set\n ar-Σ (inj₁ _) = Fin 0\n ar-Σ (inj₂ zero) = Fin 2\n ar-Σ (inj₂ (suc _)) = Fin 2\n\n-- Short-hand notations for the symbols.\n\n-- | Injections iₙ\ni : ℕ → ∥ Σ ∥\ni n = inj₁ n\n\n-- | Plus\np : ∥ Σ ∥\np = inj₂ (# 0)\n\n-- | Convolution product\nc : ∥ Σ ∥\nc = inj₂ (# 1)\n\n-- | We are going to define the SDEs by means of two variabls, later called x\n-- and y.\nX : Set\nX = Fin 2\n\nopen Terms Σ public\nopen SDE-Impl Σ X public\n\n-- | Short-hand names for variables and the variables denoting the corresponding\n-- derivatives.\nx y x' y' : V\nx = inj₁ (# 0)\ny = inj₁ (# 1)\nx' = inj₂ (# 0)\ny' = inj₂ (# 1)\n\n-- Term constructors\ni₁ : ℕ → T V\ni₁ n = sup (inj₁ (i n , (λ ())))\n\np₁ : T V → T V → T V\np₁ t s = sup (inj₁ (p , α))\n where\n α : Fin 2 → T V\n α zero = t\n α (suc _) = s\n\nc₁ : T V → T V → T V\nc₁ t s = sup (inj₁ (c , α))\n where\n α : Fin 2 → T V\n α zero = t\n α (suc _) = s\n\n-- | SDEs describing iₙ, ⊕ and ⊗\nE : SDE ℕ\nE (inj₁ n) = (λ _ → n) , (λ _ → sup (inj₁ (i 0 , (λ ()))))\nE (inj₂ zero) = out , step\n where\n out : (Fin 2 → ℕ) → ℕ\n out r = r (# 0) + r (# 1)\n\n step : (Fin 2 → ℕ) → T V\n step _ = p₁ (η x') (η y')\nE (inj₂ (suc _)) = out , step\n where\n out : (Fin 2 → ℕ) → ℕ\n out r = r (# 0) * r (# 1)\n\n step : (Fin 2 → ℕ) → T V\n step o = p₁\n (c₁ (η x') (η y))\n (c₁ (i₁ (o (# 0))) (η y'))\n\n-- | Assignment of variables to positions of the symbols of our SDEs\nvars : (f : ∥ Σ ∥) → ar Σ f → X\nvars (inj₁ x) ()\nvars (inj₂ zero) x = x\nvars (inj₂ (suc _)) x = x\n\n-- | Standard variable assignment.\nput : ∀ {i} → Stream {i} ℕ → Stream {i} ℕ → (X → Stream {i} ℕ)\nput s t zero = s\nput s t (suc _) = t\n\n-- | Dummy stream for unused variables\ndummy : Stream ℕ\nhd dummy = 0\ntl dummy = dummy\n\n-- | Define injection [_] from SDE\n[_]' : ℕ → Stream ℕ\n[ n ]' = ⟦ E ⟧ vars (i n) (put dummy dummy)\n\n-- | The addition of the streams s and t can be given by the interpretation\n-- of the symbol p of the SDE above with variable assignment (x ↦ s, y ↦ t).\n_⊕'_ : ∀ {i} → Stream {i} ℕ → Stream {i} ℕ → Stream {i} ℕ\ns ⊕' t = ⟦ E ⟧ vars p (put s t)\n\n_⊗'_ : ∀ {i} → Stream {i} ℕ → Stream {i} ℕ → Stream {i} ℕ\ns ⊗' t = ⟦ E ⟧ vars c (put s t)\n\n------ Correctness for the examples\n\n-- We cheat a bit for now\npostulate\n ext : Extensionality Level.zero Level.zero\n\n-- | The interpretation of the SDE for stream addition has indeed the\n-- same behaviour as the direct implemenentation.\ncorrect-⊕ : ∀ {s t} → (s ⊕ t) ~ (s ⊕' t)\ncorrect-⊕ = ex-bisimulation→bisim is-bisim rel\n where\n -- Bisimulation relating s ⊕ t and the interpretation of p with\n -- variable assignment (x ↦ s, y ↦ t).\n _R_ : Rel (Stream ℕ) _\n x R y = ∃ λ s →\n ∃ λ t →\n x ≡ s ⊕ t ×\n y ≡ ⟦ E ⟧ vars p (put s t)\n\n -- Recall that we have s ⊕' t = ⟦ E ⟧ vars p (put s t), which allows\n -- us to prove the following.\n rel : ∀{s t} → (s ⊕ t) R (s ⊕' t)\n rel {s} {t} = (s , t , refl , refl)\n\n lem : ∀{x y} (z : X) → tl (put x y z) ≡ put (tl x) (tl y) z\n lem zero = refl\n lem (suc z) = refl\n\n is-bisim : Is-Bisim _R_\n is-bisim x y (s , t , x=⊕ , y=E) = hd-≡ , tl-R\n where\n hd-≡ : hd x ≡ hd y\n hd-≡ =\n begin\n hd x\n ≡⟨ cong hd x=⊕ ⟩\n hd (s ⊕ t)\n ≡⟨ refl ⟩\n hd (⟦ E ⟧ vars p (put s t))\n ≡⟨ cong hd (sym y=E) ⟩\n hd y\n ∎\n\n tl-R : (tl x) R (tl y)\n tl-R = (tl s , tl t , u' , v)\n where\n u' : tl x ≡ tl s ⊕ tl t\n u' =\n begin\n tl x\n ≡⟨ cong (λ x → tl x {∞}) x=⊕ ⟩\n tl (s ⊕ t)\n ≡⟨ refl ⟩\n tl s ⊕ tl t\n ∎\n\n -- This uses, for now, extensionality\n v : tl y ≡ ⟦ E ⟧ vars p (put (tl s) (tl t))\n v =\n begin\n tl y\n ≡⟨ cong (λ x₁ → tl x₁ {∞}) y=E ⟩\n tl (⟦ E ⟧ vars p (put s t))\n ≡⟨ refl ⟩\n ⟦ E ⟧₁ vars (p₁ (sup (inj₂ x')) (sup (inj₂ y'))) (put s t)\n ≡⟨ refl ⟩\n ⟦ E ⟧ vars p (λ x → tl ((put s t) x))\n ≡⟨ cong (⟦ E ⟧ vars p) (ext lem) ⟩\n ⟦ E ⟧ vars p (put (tl s) (tl t))\n ∎\n\n-- Conjecture.\ncorrect-⊗ : ∀ {s t} → (s ⊗ t) ~ (s ⊗' t)\ncorrect-⊗ = {!!}\n", "meta": {"hexsha": "9007d8330e47152c049f9e9e35103ec71c7125a7", "size": 5891, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Streams/SDE-Example.agda", "max_stars_repo_name": "hbasold/Sandbox", "max_stars_repo_head_hexsha": "8fc7a6cd878f37f9595124ee8dea62258da28aa4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Streams/SDE-Example.agda", "max_issues_repo_name": "hbasold/Sandbox", "max_issues_repo_head_hexsha": "8fc7a6cd878f37f9595124ee8dea62258da28aa4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Streams/SDE-Example.agda", "max_forks_repo_name": "hbasold/Sandbox", "max_forks_repo_head_hexsha": "8fc7a6cd878f37f9595124ee8dea62258da28aa4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.7248908297, "max_line_length": 80, "alphanum_fraction": 0.4849770837, "num_tokens": 2326, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8459424489603726, "lm_q2_score": 0.7956581097540518, "lm_q1q2_score": 0.6730809699005236}} {"text": "module TakeDropDec where\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl; sym; trans; cong; cong₂; _≢_)\nopen import Data.Empty using (⊥; ⊥-elim)\nopen import Data.List using (List; []; _∷_)\nopen import Data.List.All using (All; []; _∷_)\nopen import Data.Bool using (Bool; true; false; T)\nopen import Data.Unit using (⊤; tt)\nopen import Relation.Nullary using (¬_; Dec; yes; no)\nopen import Relation.Nullary.Decidable using ()\nopen import Function using (_∘_)\n\nmodule TakeDrop {A : Set} {P : A → Set} (P? : ∀ (x : A) → Dec (P x)) where\n\n takeWhile : List A → List A\n takeWhile [] = []\n takeWhile (x ∷ xs) with P? x\n ... | yes _ = x ∷ takeWhile xs\n ... | no _ = []\n\n dropWhile : List A → List A\n dropWhile [] = []\n dropWhile (x ∷ xs) with P? x\n ... | yes _ = dropWhile xs\n ... | no _ = x ∷ xs\n\n Head : (A → Set) → List A → Set\n Head P [] = ⊥\n Head P (x ∷ xs) = P x\n\n takeWhile-lemma : ∀ (xs : List A) → All P (takeWhile xs)\n takeWhile-lemma [] = []\n takeWhile-lemma (x ∷ xs) with P? x\n ... | yes px = px ∷ takeWhile-lemma xs\n ... | no _ = []\n\n dropWhile-lemma : ∀ (xs : List A) → ¬ Head P (dropWhile xs)\n dropWhile-lemma [] = λ()\n dropWhile-lemma (x ∷ xs) with P? x\n ... | yes _ = dropWhile-lemma xs\n ... | no ¬px = ¬px\n\nopen TakeDrop\nopen import Data.Nat using (ℕ; zero; suc; _≟_)\n\n_ : takeWhile (0 ≟_) (0 ∷ 0 ∷ 1 ∷ []) ≡ (0 ∷ 0 ∷ [])\n_ = refl\n\n_ : dropWhile (0 ≟_) (0 ∷ 0 ∷ 1 ∷ []) ≡ (1 ∷ [])\n_ = refl\n\n\n\n", "meta": {"hexsha": "859e35d47ee1eae931ec295ea4df5de675af807a", "size": 1736, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "extra/extra/TakeDropDec.agda", "max_stars_repo_name": "manikdv/plfa.github.io", "max_stars_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 1003, "max_stars_repo_stars_event_min_datetime": "2018-07-05T18:15:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-27T07:03:28.000Z", "max_issues_repo_path": "extra/extra/TakeDropDec.agda", "max_issues_repo_name": "manikdv/plfa.github.io", "max_issues_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": 323, "max_issues_repo_issues_event_min_datetime": "2018-07-05T22:34:34.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T07:42:57.000Z", "max_forks_repo_path": "extra/extra/TakeDropDec.agda", "max_forks_repo_name": "manikdv/plfa.github.io", "max_forks_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": 304, "max_forks_repo_forks_event_min_datetime": "2018-07-16T18:24:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T11:35:02.000Z", "avg_line_length": 31.5636363636, "max_line_length": 74, "alphanum_fraction": 0.4850230415, "num_tokens": 577, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8459424450764199, "lm_q2_score": 0.795658090372256, "lm_q1q2_score": 0.6730809504143414}} {"text": "module Ex2 where\n\n----------------------------------------------------------------------------\n-- EXERCISE 2 -- STRUCTURE WITH VECTORS\n--\n-- VALUE: 15%\n-- DEADLINE: 5pm, Friday 23 October (week 5)\n--\n-- DON'T SUBMIT, COMMIT!\n--\n-- The purpose of this exercise is to introduce you to some useful\n-- mathematical structures and build good tools for working with\n-- vectors\n----------------------------------------------------------------------------\n\n\nopen import CS410-Prelude\nopen import CS410-Monoid\nopen import CS410-Nat\nopen import CS410-Vec\nopen import CS410-Functor\n\n\n\n-- HINT: your tasks are heralded with the eminently searchable tag, \"???\"\n\n\n----------------------------------------------------------------------------\n-- ??? 2.1 replicattion to make a constant vector (score: 1 / 1)\n----------------------------------------------------------------------------\n\nvec : forall {n X} -> X -> Vec X n\nvec {zero} x = []\nvec {suc n} x = x :: vec x\n\n-- HINT: you may need to override default invisibility\n\n-- SUSPICIOUS: no specification? why not?\n\n\n----------------------------------------------------------------------------\n-- ??? 2.2 vectorised application (score: 1 / 1)\n----------------------------------------------------------------------------\n\n-- implement the operator which takes the same number of functions\n-- and arguments and computes the applications in corresponding\n-- positions\n\nvapp : forall {n X Y} -> Vec (X -> Y) n -> Vec X n -> Vec Y n\nvapp [] xs = []\nvapp (x :: fs) (y :: xs) = x y :: vapp fs xs\n\n\n----------------------------------------------------------------------------\n-- ??? 2.3 one-liners (score: 1 / 1)\n----------------------------------------------------------------------------\n\n-- implement map and zip for vectors using vec and vapp\n-- no pattern matching or recursion permitted\n\n\nvmap : forall {n X Y} -> (X -> Y) -> Vec X n -> Vec Y n\nvmap f xs = vapp (vec f) xs\n\nvzip : forall {n X Y} -> Vec X n -> Vec Y n -> Vec (X * Y) n\nvzip xs ys = vapp (vmap _,_ xs) ys\n\n\n----------------------------------------------------------------------------\n-- ??? 2.4 unzipping (score: 2 / 2)\n----------------------------------------------------------------------------\n\n-- implement unzipping as a view, showing that every vector of pairs\n-- is given by zipping two vectors\n\n-- you'll need to complete the view type yourselfiew type yourself\n\ndata Unzippable {X Y n} : Vec (X * Y) n -> Set where\n unzipped : (xs : Vec X n)(ys : Vec Y n) -> Unzippable (vzip xs ys)\n\n \nunzip : forall {X Y n}(xys : Vec (X * Y) n) -> Unzippable xys\nunzip [] = unzipped [] []\nunzip (fst , snd :: []) = unzipped (fst :: []) (snd :: []) -- Conor: redundant line\nunzip (fst , snd :: xys) with unzip xys\nunzip (fst , snd :: .(vapp (vapp (vec _,_) xs) ys)) | unzipped xs ys = \n unzipped (fst :: xs) (snd :: ys)\n\n----------------------------------------------------------------------------\n-- ??? 2.5 vectors are applicative (score: 2 / 2)\n----------------------------------------------------------------------------\n\n-- prove the Applicative laws for vectors\n\nVecApp : forall n -> Applicative \\X -> Vec X n\nVecApp n = record\n { pure = vec\n ; _<*>_ = vapp\n ; identity = \\ {X} v -> VecAppIdentity v\n ; composition = λ u v w → VecAppComposition w v u \n ; homomorphism = λ f x → VecAppHomomorphism n x f\n ; interchange = λ {X} {Y} u y → VecAppInterchange y u\n } where\n -- lemmas go here\n\n -- Goal: vapp (vec (λ x → x)) v == v\n VecAppIdentity : {X : Set} -> {n : Nat} -> (v : Vec X n) -> \n vapp (vec (\\ x -> x)) v == v \n VecAppIdentity [] = refl\n VecAppIdentity (x :: v) rewrite VecAppIdentity v = refl\n\n -- Goal: vapp (vapp (vapp (vec (λ f g x → f (g x))) u) v) w == vapp u (vapp v w)\n\n VecAppComposition : {Z : Set} -> {Y : Set} -> {X : Set} -> {n : Nat} -> \n (w : Vec X n) -> (v : Vec (X → Z) n) -> (u : Vec (Z → Y) n)-> \n vapp (vapp (vapp (vec (λ f g x → f (g x))) u) v) w == vapp u (vapp v w)\n VecAppComposition [] [] [] = refl\n VecAppComposition (x :: w) (x₁ :: v) (x₂ :: u)rewrite VecAppComposition w v u = refl\n\n -- Goal: vec (f x) == vapp (vec f) (vec x)\n VecAppHomomorphism : {X : Set} -> {Y : Set} -> (q : Nat) -> (x : X) -> (f : X → Y) -> \n vec {q} (f x) == vapp (vec f) (vec x)\n VecAppHomomorphism zero x f = refl\n VecAppHomomorphism (suc q) x f rewrite VecAppHomomorphism q x f = refl\n\n -- Goal: vapp u (vec y) == vapp (vec (λ f → f y)) u\n VecAppInterchange : {Y : Set} -> {X : Set} -> {n : Nat} -> (y : X) -> (u : Vec (X → Y) n) -> vapp u (vec y) == vapp (vec (λ f → f y)) u\n\n VecAppInterchange u [] = refl\n VecAppInterchange u (x :: y) rewrite VecAppInterchange u y = refl\n\n----------------------------------------------------------------------------\n-- ??? 2.6 vectors are traversable (score: ? / 1)\n----------------------------------------------------------------------------\n\n-- show that vectors are traversable; make sure your traverse function\n-- acts on the elements of the input once each, left-to-right\n\n VecTrav : forall n -> Traversable \\X -> Vec X n\n VecTrav zero = record { traverse = λ {F} z {A} {B} _ _ → Applicative.pure z [] }\n VecTrav (suc n) = record { traverse = λ x x₁ x₂ → {!!} } \n \n--VecTrav zero = record { traverse = λ {F} z {A} {B} _ _ → Applicative.pure z [] }\n--VecTrav (suc n) = record { traverse = λ {F} x y z → {!!} }\n\n\n----------------------------------------------------------------------------\n-- ??? 2.7 monoids make constant applicatives (score: ? / 1)\n----------------------------------------------------------------------------\n\n-- Show that every monoid gives rise to a degenerate applicative functor\n\nMonCon : forall {X} -> Monoid X -> Applicative \\_ -> X\nMonCon M = record\n { pure = λ x → Monoid.e M\n ; _<*>_ = op\n ; identity = λ v → Monoid.lunit M v\n ; composition = λ u v w → {!!}\n ; homomorphism = λ f x → {!!}\n ; interchange = λ u y → {!!}\n } where open Monoid M\n\n --MonConCoposition : (w : Set) -> (v : Set) -> (u : Set) -> op (op (op e u) v) w == op u (op v w)\n --MonConCoposition x = ?\n\n----------------------------------------------------------------------------\n-- ??? 2.8 vector combine (score: ? / 1)\n----------------------------------------------------------------------------\n\n-- Using your answers to 2.6 and 2.7, rather than any new vector recursion,\n-- show how to compute the result of combining all the elements of a vector\n-- when they belong to some monoid.\n\nvcombine : forall {X} -> Monoid X -> forall {n} -> Vec X n -> X\nvcombine M = {!!}\n\n\n----------------------------------------------------------------------------\n-- ??? 2.9 scalar product (score: ? / 1)\n----------------------------------------------------------------------------\n\n-- Show how to compute the scalar (\"dot\") product of two vectors of numbers.\n-- (Multiply elements in corresponding positions; compute total of products.)\n-- HINT: think zippily, then combine\n\nvdot : forall {n} -> Vec Nat n -> Vec Nat n -> Nat\nvdot xs ys = ?\n\n\n----------------------------------------------------------------------------\n-- MATRICES\n----------------------------------------------------------------------------\n\n-- let's say that an h by w matrix is a column h high of rows w wide\n\nMatrix : Set -> Nat * Nat -> Set\nMatrix X (h , w) = Vec (Vec X w) h\n\n\n----------------------------------------------------------------------------\n-- ??? 2.11 identity matrix (score: ? / 1)\n----------------------------------------------------------------------------\n\n-- show how to construct the identity matrix of a given size, with\n-- 1 on the main diagonal and 0 everywhere else, e.g,\n-- (1 :: 0 :: 0 :: []) ::\n-- (0 :: 1 :: 0 :: []) ::\n-- (0 :: 0 :: 1 :: []) ::\n-- []\n\nidMat : forall {n} -> Matrix Nat (n , n)\nidMat = {!!}\n\n-- HINT: you may need to do recursion on the side, but then you\n-- can make good use of vec and vapp\n\n\n----------------------------------------------------------------------------\n-- ??? 2.10 transposition (score: ? / 1)\n----------------------------------------------------------------------------\n\n-- show how to transpose matrices\n-- HINT: use traverse, and it's a one-liner\n\ntranspose : forall {X m n} -> Matrix X (m , n) -> Matrix X (n , m)\ntranspose = {!!}\n\n\n----------------------------------------------------------------------------\n-- ??? 2.11 multiplication (score: ? / 2)\n----------------------------------------------------------------------------\n\n-- implement matrix multiplication\n-- HINT: transpose and vdot can be useful\n\nmatMult : forall {m n p} ->\n Matrix Nat (m , n) -> Matrix Nat (n , p) -> Matrix Nat (m , p)\nmatMult xmn xnp = {!!}\n", "meta": {"hexsha": "6cc3063cd82d714978a76e6a7e21f55413abfa13", "size": 9207, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Ex2.agda", "max_stars_repo_name": "clarkdm/CS410", "max_stars_repo_head_hexsha": "523a8749f49c914bcd28402116dcbe79a78dbbf4", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Ex2.agda", "max_issues_repo_name": "clarkdm/CS410", "max_issues_repo_head_hexsha": "523a8749f49c914bcd28402116dcbe79a78dbbf4", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Ex2.agda", "max_forks_repo_name": "clarkdm/CS410", "max_forks_repo_head_hexsha": "523a8749f49c914bcd28402116dcbe79a78dbbf4", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.5230125523, "max_line_length": 137, "alphanum_fraction": 0.4154447703, "num_tokens": 2273, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267830311354, "lm_q2_score": 0.7745833893685269, "lm_q1q2_score": 0.6729787943744105}} {"text": "module lambda.system-f where\n\nopen import Data.Nat\nopen import Data.Fin hiding (lift)\nopen import lambda.vec\nopen import lambda.untyped hiding (lift; subst; ↑; subst₁)\n\ninfixr 22 _⇒_\ninfix 20 ∀'_\n\ndata type (n : ℕ) : Set where\n var : Fin n → type n\n ∀'_ : type (suc n) → type n\n _⇒_ : type n → type n → type n\n\ntype₀ : Set\ntype₀ = type 0\n\ncontext : ℕ → ℕ → Set\ncontext n = vec (type n)\n\nlift : ∀ {n} → type n → type (suc n)\nlift (var i) = var (suc i)\nlift (∀' x) = ∀' (lift x)\nlift (x ⇒ y) = lift x ⇒ lift y\n\n↑ : ∀ {n m} → (Fin n → type m) → Fin (suc n) → type (suc m)\n↑ ρ zero = var zero\n↑ ρ (suc i) = lift (ρ i)\n\nsubst : ∀ {n m} → type n → (Fin n → type m) → type m\nsubst (var x) ρ = ρ x\nsubst (∀' x) ρ = ∀' (subst x (↑ ρ))\nsubst (x ⇒ y) ρ = (subst x ρ) ⇒ (subst y ρ)\n\nidˢ : ∀ {n} → Fin n → type n\nidˢ i = var i\n\n_∘ˢ_ : ∀ {n m p} → (Fin m → type p) → (Fin n → type m) → (Fin n → type p)\n(ρ ∘ˢ μ) i = subst (μ i) ρ\n\n1ˢ : ∀ {n} → type n → Fin (suc n) → type n\n1ˢ x zero = x\n1ˢ x (suc i) = var i\n\n_∷ˢ_ : ∀ {n m} → type m → (Fin n → type m) → Fin (suc n) → type m\n(e ∷ˢ ρ) zero = e\n(e ∷ˢ ρ) (suc i) = ρ i\n\nsubst₁ : ∀ {n} → type (suc n) → type n → type n\nsubst₁ x y = subst x (1ˢ y)\n\nlift-c : ∀ {n m} → context n m → context (suc n) m\nlift-c ε = ε\nlift-c (Γ ▸ x) = lift-c Γ ▸ lift x\n\n\ninfix 10 _⊢_∶_\n\ndata _⊢_∶_ {n m : ℕ} (Γ : context n m) : term m → type n → Set where\n ax : ∀ {i} → Γ ⊢ var i ∶ lookup i Γ\n lam : ∀ {B x} → (A : type n) → Γ ▸ A ⊢ x ∶ B → Γ ⊢ lam x ∶ A ⇒ B\n app : ∀ {A B x y} → Γ ⊢ x ∶ A ⇒ B → Γ ⊢ y ∶ A → Γ ⊢ app x y ∶ B\n gen : ∀ {A x} → lift-c Γ ⊢ x ∶ A → Γ ⊢ x ∶ ∀' A\n sub : ∀ {A x} → (B : type n) → Γ ⊢ x ∶ ∀' A → Γ ⊢ x ∶ subst₁ A B\n\n⊢_∶_ : ∀ {n} → term 0 → type n → Set\n⊢ x ∶ t = ε ⊢ x ∶ t\n", "meta": {"hexsha": "72d2bb66d97013cf9c572fff18fad79ade4a5951", "size": 1716, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "lambda/system-f.agda", "max_stars_repo_name": "Lapin0t/lambda", "max_stars_repo_head_hexsha": "09a231d9b3057d57b864070188ed9fe14a07eda2", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lambda/system-f.agda", "max_issues_repo_name": "Lapin0t/lambda", "max_issues_repo_head_hexsha": "09a231d9b3057d57b864070188ed9fe14a07eda2", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lambda/system-f.agda", "max_forks_repo_name": "Lapin0t/lambda", "max_forks_repo_head_hexsha": "09a231d9b3057d57b864070188ed9fe14a07eda2", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.8695652174, "max_line_length": 73, "alphanum_fraction": 0.4976689977, "num_tokens": 826, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267694452331, "lm_q2_score": 0.7745833789613197, "lm_q1q2_score": 0.6729787748089361}} {"text": "module Sets.PredicateSet.Proofs where\n\nimport Lvl\nopen import Functional\nimport Logic.Propositional as Logic\nimport Logic.Propositional.Theorems as Logic\nimport Logic.Predicate\nimport Sets.PredicateSet\nimport Structure.Relator.Properties\nimport Type\n\n-- [⊆][⊇]-equivalence : ∀{A}{B} → (A ⊆ B) ↔ (B ⊇ A)\n\nmodule _ {ℓₗ}{ℓₒ} {T : Set(ℓₒ)} where\n open Sets.PredicateSet\n open Structure.Relator.Properties\n\n private\n Stmt = Logic.Stmt{ℓₗ Lvl.⊔ ℓₒ}\n\n PredSet' : Set(Lvl.𝐒(ℓₗ Lvl.⊔ ℓₒ))\n PredSet' = PredSet{ℓₗ}{ℓₒ} (T)\n\n _⊆'_ : PredSet' → PredSet' → Stmt\n _⊆'_ = _⊆_ {ℓₗ}{ℓₗ} {ℓₒ} {T}\n\n _⊇'_ : PredSet' → PredSet' → Stmt\n _⊇'_ = _⊇_ {ℓₗ}{ℓₗ} {ℓₒ} {T}\n\n _≡'_ : PredSet' → PredSet' → Stmt\n _≡'_ = _≡_ {ℓₗ}{ℓₗ} {ℓₒ} {T}\n\n -- TODO: PredSet' has a greater level than Stmt? Not possible with Reflexivity or even Logic.Predicate\n -- Refl : (PredSet' → PredSet' → Stmt) → Stmt\n -- Refl(_▫_) = Reflexivity{_}{_} {PredSet'} (_▫_)\n\n -- TODO: This is alright...\n -- Refl : (T → T → Stmt) → Stmt\n -- Refl(_▫_) = (∀{x : T} → (x ▫ x))\n\n -- ...but not this\n -- Refl : (PredSet' → PredSet' → Stmt) → Stmt\n -- Refl(_▫_) = (∀{x : PredSet'} → (x ▫ x))\n\n [⊆]-reflexivity : ∀{A} → (A ⊆' A)\n [⊆]-reflexivity = id\n\n [⊆]-transitivity : ∀{A B C} → (A ⊆' B) → (B ⊆' C) → (A ⊆' C)\n [⊆]-transitivity ab bc = bc ∘ ab\n\n [⊆]-antisymmetry : ∀{A B} → (A ⊇' B) → (A ⊆' B) → (A ≡' B)\n [⊆]-antisymmetry = Logic.[∧]-intro\n", "meta": {"hexsha": "d4c1582eb58da6b2ed2df9fdd88180942441ed8f", "size": 1484, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Sets/PredicateSet/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Sets/PredicateSet/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Sets/PredicateSet/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.0, "max_line_length": 106, "alphanum_fraction": 0.5411051213, "num_tokens": 658, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267660487573, "lm_q2_score": 0.7745833789613196, "lm_q1q2_score": 0.6729787721780823}} {"text": "module Experiment.Expr.Expr where\n\nopen import Data.Fin\nopen import Data.Empty\nopen import Level\nopen import Data.Bool\nopen import Data.Nat hiding (_⊔_)\nopen import Data.Product\nopen import Data.List as List hiding (or; and)\n\ndata Expr {v} (V : Set v) : Set v where\n var : V -> Expr V\n or and : Expr V -> Expr V -> Expr V\n neg : Expr V -> Expr V\n\nfoldExpr : ∀ {a v} {V : Set v} {A : Set a} →\n (V → A) → (A → A → A) → (A → A → A) → (A → A) →\n Expr V → A\nfoldExpr v o a n (var v′) = v v′\nfoldExpr v o a n (or e₁ e₂) = o (foldExpr v o a n e₁) (foldExpr v o a n e₂)\nfoldExpr v o a n (and e₁ e₂) = a (foldExpr v o a n e₁) (foldExpr v o a n e₂)\nfoldExpr v o a n (neg e) = n (foldExpr v o a n e)\n\nevalExpr : ∀ {v} {V : Set v} → (V → Bool) → Expr V → Bool\nevalExpr v = foldExpr v _∨_ _∧_ not\n\ndata Sign : Set where\n pos : Sign\n neg : Sign\n\nLiteral : ∀ {a} → Set a → Set a\nLiteral V = Sign × V\n\ndata NNF {v} (V : Set v) : Set v where\n lit : Literal V → NNF V\n and or : NNF V → NNF V → NNF V\n\n\ndata GExpr {v t₁ t₂ tₙ} (T₁ : Set t₁) (T₂ : Set t₂) (Tₙ : Set tₙ) (V : Set v)\n : Set (v ⊔ t₁ ⊔ t₂ ⊔ tₙ) where\n var : (v : V) → GExpr T₁ T₂ Tₙ V\n op₁ : T₁ → (e : GExpr T₁ T₂ Tₙ V) → GExpr T₁ T₂ Tₙ V\n op₂ : T₂ → (e₁ e₂ : GExpr T₁ T₂ Tₙ V) → GExpr T₁ T₂ Tₙ V\n opₙ : Tₙ → (es : List (GExpr T₁ T₂ Tₙ V)) → GExpr T₁ T₂ Tₙ V\n\ndata AndOr : Set where\n and : AndOr\n or : AndOr\n\ndata Neg : Set where\n neg : Neg\n\nExprAndOrNeg : ℕ → Set\nExprAndOrNeg n = GExpr AndOr Neg ⊥ (Fin n)\n\nevalAndOr : AndOr → Bool → Bool → Bool\nevalAndOr and = _∧_\nevalAndOr or = _∨_\n\nmodule _ {v t₁ t₂ tₙ a} {V : Set v} {T₁ : Set t₁}\n {T₂ : Set t₂} {Tₙ : Set tₙ} {A : Set a}\n (var* : V → A) (op₁* : T₁ → A → A) (op₂* : T₂ → A → A → A)\n (opₙ* : Tₙ → List A → A) where\n foldGExpr : GExpr T₁ T₂ Tₙ V → A\n foldGExpr (var v) = var* v\n foldGExpr (op₁ t₁ e) = op₁* t₁ (foldGExpr e)\n foldGExpr (op₂ t₂ e₁ e₂) = op₂* t₂ (foldGExpr e₁) (foldGExpr e₂)\n foldGExpr (opₙ tₙ es) = opₙ* tₙ (List.map foldGExpr es)\n", "meta": {"hexsha": "0f2d77f959590615d58b08897b83a3d0d85d8ed1", "size": 2019, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Experiment/Expr/Expr.agda", "max_stars_repo_name": "rei1024/agda-misc", "max_stars_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:49:42.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-21T00:03:43.000Z", "max_issues_repo_path": "Experiment/Expr/Expr.agda", "max_issues_repo_name": "rei1024/agda-misc", "max_issues_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Experiment/Expr/Expr.agda", "max_forks_repo_name": "rei1024/agda-misc", "max_forks_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.2608695652, "max_line_length": 77, "alphanum_fraction": 0.568598316, "num_tokens": 892, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9019206659843132, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6729581826025242}} {"text": "module Numeral.Natural.Oper.Modulo where\n\nimport Lvl\nopen import Data\nopen import Data.Boolean.Stmt\nopen import Logic.Propositional.Theorems\nopen import Numeral.Natural\nopen import Numeral.Natural.Oper.Comparisons\nopen import Relator.Equals\n\ninfixl 10100 _mod_\n\n-- Modulo is defined using this.\n-- This, unlike (_mod_) is keeping internal state of the previous value.\n-- `r` is the current result. Should be 0 at the start.\n-- `b` is the modulus. This value will not change in the repeated applications of the function.\n-- `a'` is the number to take the modulo of.\n-- 'b'` is the temporary modulus. Should be `b` at the start.\n-- This function works by repeatedly decreasing `a'` and `b'` and at the same time increasing `r` until `b'` is 0.\n-- When `b'` is 0, `r` is resetted to 0, and `b'` is resetted to `b`.\n-- Almost the same algorithm imperatively:\n-- while a'!=0{\n-- a'-= 1;\n-- b'-= 1;\n-- r += 1;\n-- if b'==0{\n-- r := 0;\n-- b':= b;\n-- }\n-- }\n-- return r;\n-- Example execution:\n-- [ 0 , 2 ] 5 mod' 2\n-- = [ 1 , 2 ] 4 mod' 1\n-- = [ 2 , 2 ] 3 mod' 0\n-- = [ 0 , 2 ] 3 mod' 2\n-- = [ 1 , 2 ] 2 mod' 1\n-- = [ 2 , 2 ] 1 mod' 0\n-- = [ 0 , 2 ] 1 mod' 2\n-- = [ 1 , 2 ] 0 mod' 1\n-- = 1\n-- The above is describing the following code:\n-- {-# TERMINATING #-}\n-- [_,_]_mod₀'_ : ℕ → ℕ → ℕ → ℕ → ℕ\n-- [ _ , 𝟎 ] _ mod₀' _ = 𝟎\n-- [ _ , b ] a' mod₀' 𝟎 = [ 𝟎 , b ] a' mod₀' b\n-- [ r , _ ] 𝟎 mod₀' _ = r\n-- [ r , b ] 𝐒(a') mod₀' 𝐒(b') = [ 𝐒(r) , b ] a' mod₀' b'\n-- Then it is transformed to the following code (So that it terminates):\n-- [_,_]_mod₀'_ : ℕ → ℕ → ℕ → ℕ → ℕ\n-- [ _ , 𝟎 ] _ mod₀' _ = 𝟎\n-- [ _ , 𝐒(_) ] 𝟎 mod₀' 𝟎 = 𝟎\n-- [ r , 𝐒(_) ] 𝟎 mod₀' 𝐒(_) = r\n-- [ _ , 𝐒(b) ] 𝐒(a') mod₀' 𝟎 = [ 𝐒(𝟎) , 𝐒(b) ] a' mod₀' b\n-- [ r , 𝐒(b) ] 𝐒(a') mod₀' 𝐒(b') = [ 𝐒(r) , 𝐒(b) ] a' mod₀' b'\n-- And finally removing the forbidden 𝟎 cases of `b` and `b'` by just interpreting (b=0), (b'=0) in this function as 1's:\n-- [ r , _ ] 𝟎 mod' _ = r\n-- [ _ , b ] 𝐒(a') mod' 𝟎 = [ 𝟎 , b ] a' mod' b\n-- [ r , b ] 𝐒(a') mod' 𝐒(b') = [ 𝐒(r) , b ] a' mod' b'\n-- Note: [ r , b ] a mod' b) is like ((a − r) mod b). The other b is actually a state for handling the situation when a is greater than the modulus b.\n-- TODO: If it is possible together with the BUILTIN pragma, swap b and b' to avoid confusion. b' is actually a state (like r) and is not the actual base\n[_,_]_mod'_ : ℕ → ℕ → ℕ → ℕ → ℕ\n[ r , _ ] 𝟎 mod' _ = r\n[ _ , b ] 𝐒(a') mod' 𝟎 = [ 𝟎 , b ] a' mod' b\n[ r , b ] 𝐒(a') mod' 𝐒(b') = [ 𝐒(r) , b ] a' mod' b'\n{-# BUILTIN NATMODSUCAUX [_,_]_mod'_ #-}\n\n-- Difference between the value before and after the floored division operation.\n_mod_ : ℕ → (m : ℕ) → .⦃ pos : IsTrue(positive?(m))⦄ → ℕ\na mod 𝐒(m) = [ 𝟎 , m ] a mod' m\n\n_mod₀_ : ℕ → ℕ → ℕ\n_ mod₀ 𝟎 = 𝟎\na mod₀ 𝐒(m) = [ 𝟎 , m ] a mod' m\n", "meta": {"hexsha": "8612ba2fec94224c1b777a95969580687f396d59", "size": 2926, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Oper/Modulo.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Oper/Modulo.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Oper/Modulo.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.0133333333, "max_line_length": 153, "alphanum_fraction": 0.5256322625, "num_tokens": 1244, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.894789468908171, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6728929314867957}} {"text": "module Logics.And where\n\nopen import Function\n\n------------------------------------------------------------------------\n-- definitions\n\ninfixl 5 _∧_\ninfixl 4 _⇔_\n\ndata _∧_ (P Q : Set) : Set where\n ∧-intro : P → Q → P ∧ Q\n\n_⇔_ : (P Q : Set) → Set\np ⇔ q = (p → q) ∧ (q → p)\n\n------------------------------------------------------------------------\n-- internal stuffs\n\nprivate\n\n ∧-comm′ : ∀ {P Q} → (P ∧ Q) → (Q ∧ P)\n ∧-comm′ (∧-intro p q) = ∧-intro q p\n\n ∧-assoc₀ : ∀ {P Q R} → ((P ∧ Q) ∧ R) → (P ∧ (Q ∧ R))\n ∧-assoc₀ (∧-intro (∧-intro p q) r) = ∧-intro p $ ∧-intro q r\n\n ∧-assoc₁ : ∀ {P Q R} → (P ∧ (Q ∧ R)) → ((P ∧ Q) ∧ R)\n ∧-assoc₁ (∧-intro p (∧-intro q r)) = ∧-intro (∧-intro p q) r\n\n ∧-comm : ∀ {P Q} → (P ∧ Q) ⇔ (Q ∧ P)\n ∧-comm = ∧-intro ∧-comm′ ∧-comm′\n\n ∧-assoc : ∀ {P Q R} → (P ∧ (Q ∧ R)) ⇔ ((P ∧ Q) ∧ R)\n ∧-assoc = ∧-intro ∧-assoc₁ ∧-assoc₀\n\n------------------------------------------------------------------------\n-- public aliases\n\nand-comm : ∀ {P Q} → (P ∧ Q) ⇔ (Q ∧ P)\nand-comm = ∧-comm\n\nand-assoc : ∀ {P Q R} → (P ∧ (Q ∧ R)) ⇔ ((P ∧ Q) ∧ R)\nand-assoc = ∧-assoc\n\n", "meta": {"hexsha": "6c97c3591f3e96fc0336ece9cc7ab262f74172ee", "size": 1086, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Logics/And.agda", "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_issues_repo_path": "src/Logics/And.agda", "max_issues_repo_name": "ice1k/Theorems", "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Logics/And.agda", "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.6086956522, "max_line_length": 72, "alphanum_fraction": 0.3535911602, "num_tokens": 422, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8947894520743981, "lm_q2_score": 0.7520125793176222, "lm_q1q2_score": 0.67289292380067}} {"text": "{-# OPTIONS --prop #-}\n\nmodule Miscellaneous.ClassicalWitness where\n\nopen import Agda.Primitive using (Prop)\n\nopen import Data\nopen import Data.Either\nopen import Functional\nimport Lvl\nopen import Type.Dependent\nopen import Type\n\nprivate variable ℓ ℓ₁ ℓ₂ : Lvl.Level\nprivate variable T A B Obj : Type{ℓ}\nprivate variable P Q R : Prop(ℓ)\nprivate variable Pred : T → Prop(ℓ)\nprivate variable x y z : T\n\nempty-prop : Empty{ℓ} → P\nempty-prop ()\n\ndata Proof(P : Prop(ℓ)) : Type{ℓ} where\n intro : P → Proof(P)\n\ndata ⊥ : Prop(Lvl.𝟎) where\n\n[⊥]-elim : ⊥ → P\n[⊥]-elim ()\n\n[⊥]-elim-type : ⊥ → T\n[⊥]-elim-type ()\n\n¬_ : Prop(ℓ) → Prop(ℓ)\n¬ P = P → ⊥\n\ndata _∧_ (P : Prop(ℓ₁)) (Q : Prop(ℓ₂)) : Prop(ℓ₁ Lvl.⊔ ℓ₂) where\n [∧]-intro : P → Q → (P ∧ Q)\n\ndata _∨_ (P : Prop(ℓ₁)) (Q : Prop(ℓ₂)) : Prop(ℓ₁ Lvl.⊔ ℓ₂) where\n [∨]-introₗ : P → (P ∨ Q)\n [∨]-introᵣ : Q → (P ∨ Q)\n\n[∨]-elim : (P → R) → (Q → R) → (P ∨ Q) → R\n[∨]-elim pr qr ([∨]-introₗ p) = pr p\n[∨]-elim pr qr ([∨]-introᵣ q) = qr q\n\ndata ∃ {Obj : Type{ℓ₁}} (P : Obj → Prop(ℓ₂)) : Prop(ℓ₁ Lvl.⊔ ℓ₂) where\n [∃]-intro : (witness : Obj) → ⦃ proof : P(witness) ⦄ → ∃(P)\n\n[∃]-elim : (∀{x} → Pred(x) → P) → (∃ Pred) → P\n[∃]-elim pr ([∃]-intro _ ⦃ p ⦄) = pr p\n\n∃-empty-type : (∀{x : Obj} → Pred(x) → Empty{ℓ}) → ¬(∃{Obj = Obj} Pred)\n∃-empty-type empty-p ep = [∃]-elim (\\px → empty-prop (empty-p px)) ep\n\ndata Inhabited(T : Type{ℓ}) : Prop(Lvl.𝐒(ℓ)) where\n intro : T → Inhabited(T)\n\nInhabited-elim : (T → P) → (Inhabited(T) → P)\nInhabited-elim f (intro obj) = f(obj)\n\nInhabited-empty-type : (T → Empty{ℓ}) → (¬ Inhabited(T))\nInhabited-empty-type empty-T inhab-T = Inhabited-elim (\\t → empty-prop(empty-T t)) inhab-T\n\n∃-to-Inhabited : (∃{Obj = Obj} Pred) → Inhabited(Obj)\n∃-to-Inhabited = [∃]-elim (\\{x} _ → intro x)\n\ndata _≡_ {T : Type{ℓ}} : T → T → Prop(Lvl.of(T)) where\n refl : ∀{x} → (x ≡ x)\n\nsym : ∀{x y : T} → (x ≡ y) → (y ≡ x)\nsym refl = refl\n\nsubst : (P : T → Prop(ℓ)) → ∀{x y : T} → (x ≡ y) → (P(x) → P(y))\nsubst P refl = (\\x → x)\n\ndata Singleton(T : Type{ℓ}) : Prop(Lvl.𝐒(ℓ)) where\n intro : (x : T) → (∀{y} → (x ≡ y)) → Singleton(T)\n\ndata ∃! {Obj : Type{ℓ₁}} (P : Obj → Prop(ℓ₂)) : Prop(ℓ₁ Lvl.⊔ ℓ₂) where\n [∃!]-intro : (witness : Obj) → ⦃ proof : P(witness) ⦄ → (∀{x} → P(x) → (witness ≡ x)) → ∃!(P)\n\n[∃!]-elim : (∀{x} → Pred(x) → (∀{y} → (Pred(y)) → (x ≡ y)) → P) → (∃! Pred) → P\n[∃!]-elim pr ([∃!]-intro _ ⦃ p ⦄ eq) = pr p eq\n\n∃!-to-∃ : (∃!{Obj = Obj} Pred) → (∃{Obj = Obj} Pred)\n∃!-to-∃ = [∃!]-elim (\\{x} p _ → [∃]-intro x ⦃ p ⦄)\n\n∃!-empty-type : (∀{x : Obj} → Pred(x) → Empty{ℓ}) → ¬(∃!{Obj = Obj} Pred)\n∃!-empty-type empty-p ep = [∃!]-elim (\\px → empty-prop (empty-p px)) ep\n\nmodule WhenExcludedMiddle (excluded-middle : ∀{ℓ}(P : Prop(ℓ)) → (P ∨ (¬ P))) where\n {-[¬¬]-elim-type : ((T → ⊥) → ⊥) → T\n [¬¬]-elim-type {T = T} nnt with excluded-middle(T)\n ... | p = ?-}\n\n {-\n decidable : ∀{ℓ ℓₑ}(T : Type{ℓ}) → (T ‖ (T → Empty{ℓₑ}))\n decidable(T) = {!excluded-middle!}\n -}\n\n {-\n singleton-witness : Singleton(T) → T\n singleton-witness x = {!!}\n -}\n\nmodule WhenDNEType ([¬¬]-elim-type : ∀{ℓ}{T : Type{ℓ}} → ((T → ⊥) → ⊥) → T) where\n inhabited-witness : Inhabited(T) → T\n inhabited-witness p = [¬¬]-elim-type (\\nt → Inhabited-elim nt p)\n\nmodule WhenDecidable {ℓₑ} (decidable : ∀{ℓ}(T : Type{ℓ}) → (T ‖ (T → Empty{ℓₑ}))) where\n excluded-middle : ∀{ℓ}(P : Prop(ℓ)) → (P ∨ (¬ P))\n excluded-middle(P) with decidable(Proof P)\n ... | Left (intro p) = [∨]-introₗ p\n ... | Right np = [∨]-introᵣ (\\p → empty-prop(np(intro p)))\n\n inhabited-witness : Inhabited(T) → T -- TODO: Are there any other ways (with weaker assumptions) of doing this?\n inhabited-witness{T = T} x with decidable(T)\n ... | Left t = t\n ... | Right nt = [⊥]-elim-type (Inhabited-empty-type nt x)\n\n ∃-to-Σ : (∃{Obj = Obj} Pred) → (Σ Obj (\\p → Proof(Pred p)))\n ∃-to-Σ {Obj = Obj}{Pred = Pred} ep with decidable(Σ Obj (\\p → Proof(Pred p)))\n ... | Left s = s\n ... | Right ns = [⊥]-elim-type (∃-empty-type (\\{x} px → ns (intro x (intro px))) ep)\n\n [∃]-witness : (∃{Obj = Obj} Pred) → Obj\n [∃]-witness {Obj = Obj}{Pred = Pred} ep = Σ.left (∃-to-Σ ep)\n -- inhabited-witness(∃-to-Inhabited(∃!-to-∃ ep))\n\n [∃]-proof : (ep : ∃{Obj = Obj} Pred) → Pred([∃]-witness ep)\n [∃]-proof {Obj = Obj}{Pred = Pred} ep with intro p ← Σ.right (∃-to-Σ ep) = p\n -- [∃!]-elim (\\p eq → subst(Pred) {!eq p!} p) ep\n\nmodule WhenInhabitedWitness (inhabited-witness : ∀{ℓ}{T : Type{ℓ}} → Inhabited(T) → T) where\n [∨]-elim-type : (P → T) → (Q → T) → (P ∨ Q) → T\n [∨]-elim-type pt qt pq = inhabited-witness([∨]-elim (\\t → intro(pt t)) (\\t → intro(qt t)) pq)\n\n {-\n [∃]-witness : ∀{P : T → Prop(ℓ)} → (∃ P) → T -- TODO: Not really the witness. See TODO in [∃]-proof below\n [∃]-witness ep = inhabited-witness(∃-to-Inhabited ep)\n\n [∃]-proof : ∀{P : T → Prop(ℓ)} → (ep : ∃ P) → P([∃]-witness ep) -- TODO: Will not work because the witness obtained from `inhabited-witness` (this one is from `decidable`) can obviously be different from the one provided to prove (∃ P) (this one is from `[∃]-intro`). Though, a correct witness _is_ obtainable from (∃! P) as usual in classical logic.\n [∃]-proof{T = T} ep with decidable(T)\n ... | Left t = {!!}\n ... | Right nt = {!!}\n -}\n", "meta": {"hexsha": "25bc3a99b4b5c491d092942be417691c7e3eec19", "size": 5193, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Miscellaneous/ClassicalWitness.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Miscellaneous/ClassicalWitness.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Miscellaneous/ClassicalWitness.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.8523489933, "max_line_length": 352, "alphanum_fraction": 0.5393799345, "num_tokens": 2255, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8596637648915617, "lm_q2_score": 0.7826624789529375, "lm_q1q2_score": 0.6728265732960449}} {"text": "-- {-# OPTIONS -v tc.conv.coerce:10 -v tc.conv.size:40 -v tc.size.solve:40 #-}\n-- Andreas, 2014-06-16 Coercion for sizes\nopen import Common.Size\n\ndata Nat (i : Size) : Set where\n zero : Nat i\n suc : (j : Size< i) → Nat j → Nat i\n\nthree : (i : Size) → Nat (↑ ↑ ↑ i)\nthree i = suc _ (suc _ (suc i zero))\n\n-- Should be ok, but we get the error:\n-- ∞ !=< i of type Size\n-- when checking that the expression _ has type Size< (↑ (↑ (↑ i)))\n\n-- Works now.\n", "meta": {"hexsha": "6dc3863f5be3255533377487767a2bee872201f9", "size": 452, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue1203.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/Succeed/Issue1203.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z", "max_forks_repo_path": "test/Succeed/Issue1203.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 26.5882352941, "max_line_length": 78, "alphanum_fraction": 0.592920354, "num_tokens": 157, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8539127455162773, "lm_q2_score": 0.787931190663057, "lm_q1q2_score": 0.6728244862970003}} {"text": "open import Agda.Primitive\nopen import Semigroup\n\nmodule Monoid where\n\n record Σ {a b} (A : Set a) (B : A → Set b) : Set (a ⊔ b) where\n constructor _,_\n field\n proj₁ : A\n proj₂ : B proj₁\n\n Σ-syntax : ∀ {a b} (A : Set a) → (A → Set b) → Set (a ⊔ b)\n Σ-syntax = Σ\n\n syntax Σ-syntax A (λ x → B) = Σ[ x ∈ A ] B\n\n _×_ : ∀ {a b} (A : Set a) (B : Set b) → Set (a ⊔ b)\n A × B = Σ[ x ∈ A ] B\n\n record Monoid {A : Set} (_∙_ : A → A → A) (ε : A) : Set where\n field\n semigroup : Semigroup _∙_\n identity : (∀ x → ε ∙ x ≡ x) × (∀ x → x ∙ ε ≡ x)\n", "meta": {"hexsha": "862d933cc9ea62dbfd272f756bd252c2d5b8bfb5", "size": 567, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Monoid.agda", "max_stars_repo_name": "cantsin/agda-experiments", "max_stars_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Monoid.agda", "max_issues_repo_name": "cantsin/agda-experiments", "max_issues_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Monoid.agda", "max_forks_repo_name": "cantsin/agda-experiments", "max_forks_repo_head_hexsha": "382fcfae193079783621fc5cf54b6588e22ef759", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.625, "max_line_length": 64, "alphanum_fraction": 0.4832451499, "num_tokens": 245, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9489172587090974, "lm_q2_score": 0.7090191276365462, "lm_q1q2_score": 0.672800486969187}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\n-- we use duality to prove properties about coequalizer\nmodule Categories.Diagram.Coequalizer.Properties {o ℓ e} (C : Category o ℓ e) where\n\nopen Category C\n\nopen import Categories.Diagram.Coequalizer C using (Coequalizer; IsCoequalizer)\nopen import Categories.Morphism C\nimport Categories.Morphism.Reasoning as MR\nopen import Categories.Diagram.Equalizer op\nopen import Categories.Diagram.Equalizer.Properties op\nopen import Categories.Diagram.Duality C\nopen import Categories.Diagram.KernelPair C\nopen import Categories.Diagram.Pullback C\nopen import Categories.Morphism.Regular C\n\n\nimport Relation.Binary.Reasoning.Setoid as SR\n\nopen Pullback hiding (universal; unique)\n\nprivate\n variable\n A B : Obj\n f g : A ⇒ B\n\nmodule _ (coe : Coequalizer f g) where\n open Coequalizer coe\n\n private\n equalizer : Equalizer f g\n equalizer = Coequalizer⇒coEqualizer coe\n\n open Equalizer equalizer\n using (unique′; unique-diagram)\n renaming ( id-equalize to id-coequalize\n ; equalize-resp-≈ to coequalize-resp-≈\n ; equalize-resp-≈′ to coequalize-resp-≈′\n )\n public\n\n-- a regular epi is a coequalizer of its kernel pair\nregular-is-coeq-kp : {A B : Obj} (f : A ⇒ B) → RegularEpi f → (kp : KernelPair f) → IsCoequalizer (p₁ kp) (p₂ kp) f\nregular-is-coeq-kp {A} {B} f record { C = D ; h = h ; g = g ; coequalizer = coeq } kp = record\n { equality = IsPullback.commute (isPullback kp)\n ; coequalize = λ {_}{u} u∘p₁≈u∘p₂ → coequalize (u∘h≈u∘g u u∘p₁≈u∘p₂)\n ; universal = universal\n ; unique = unique\n }\n\n where\n open IsCoequalizer coeq\n pb-univ : D ⇒ P kp\n pb-univ = IsPullback.universal (isPullback kp) equality\n\n u∘h≈u∘g : {X : Obj} → (u : A ⇒ X) → u ∘ (p₁ kp) ≈ u ∘ (p₂ kp) → u ∘ h ≈ u ∘ g\n u∘h≈u∘g {X} u u∘p₁≈u∘p₂ = begin\n u ∘ h ≈˘⟨ refl⟩∘⟨ p₁∘universal≈h₁ kp ⟩\n u ∘ (p₁ kp ∘ pb-univ) ≈⟨ pullˡ u∘p₁≈u∘p₂ ⟩\n (u ∘ p₂ kp) ∘ pb-univ ≈⟨ pullʳ (p₂∘universal≈h₂ kp) ⟩\n u ∘ g ∎\n where\n open Category.HomReasoning C\n open MR C\n\nretract-coequalizer : ∀ {X Y} {f : Y ⇒ X} {g : X ⇒ Y} → f RetractOf g → IsCoequalizer (g ∘ f) id f\nretract-coequalizer f∘g≈id = IscoEqualizer⇒IsCoequalizer (section-equalizer f∘g≈id)\n", "meta": {"hexsha": "6acd0871f842b9a266d199e8c81eb83dfd59cd46", "size": 2327, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Diagram/Coequalizer/Properties.agda", "max_stars_repo_name": "maxsnew/agda-categories", "max_stars_repo_head_hexsha": "8f3c844d929508040dfa21f681fa260056214b73", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Diagram/Coequalizer/Properties.agda", "max_issues_repo_name": "maxsnew/agda-categories", "max_issues_repo_head_hexsha": "8f3c844d929508040dfa21f681fa260056214b73", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Diagram/Coequalizer/Properties.agda", "max_forks_repo_name": "maxsnew/agda-categories", "max_forks_repo_head_hexsha": "8f3c844d929508040dfa21f681fa260056214b73", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.7746478873, "max_line_length": 115, "alphanum_fraction": 0.6467554792, "num_tokens": 848, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240895276223, "lm_q2_score": 0.7772998663336158, "lm_q1q2_score": 0.6725385691384452}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Bisimilarity for Cowriter\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe --sized-types #-}\n\nmodule Codata.Cowriter.Bisimilarity where\n\nopen import Level using (Level; _⊔_)\nopen import Size\nopen import Codata.Thunk\nopen import Codata.Cowriter\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as Eq using (_≡_)\n\nprivate\n variable\n a b c p q pq r s rs v w x : Level\n A : Set a\n B : Set b\n C : Set c\n V : Set v\n W : Set w\n X : Set x\n i : Size\n\ndata Bisim {V : Set v} {W : Set w} {A : Set a} {B : Set b}\n (R : REL V W r) (S : REL A B s) (i : Size) :\n REL (Cowriter V A ∞) (Cowriter W B ∞) (r ⊔ s ⊔ v ⊔ w ⊔ a ⊔ b) where\n [_] : ∀ {a b} → S a b → Bisim R S i [ a ] [ b ]\n _∷_ : ∀ {x y xs ys} → R x y → Thunk^R (Bisim R S) i xs ys →\n Bisim R S i (x ∷ xs) (y ∷ ys)\n\nmodule _ {R : Rel W r} {S : Rel A s}\n (refl^R : Reflexive R) (refl^S : Reflexive S) where\n\n reflexive : Reflexive (Bisim R S i)\n reflexive {x = [ a ]} = [ refl^S ]\n reflexive {x = w ∷ ws} = refl^R ∷ λ where .force → reflexive\n\nmodule _ {R : REL V W r} {S : REL W V s} {P : REL A B p} {Q : REL B A q}\n (sym^RS : Sym R S) (sym^PQ : Sym P Q) where\n\n symmetric : Sym (Bisim R P i) (Bisim S Q i)\n symmetric [ a ] = [ sym^PQ a ]\n symmetric (p ∷ ps) = sym^RS p ∷ λ where .force → symmetric (ps .force)\n\n\nmodule _ {R : REL V W r} {S : REL W X s} {RS : REL V X rs}\n {P : REL A B p} {Q : REL B C q} {PQ : REL A C pq}\n (trans^RS : Trans R S RS) (trans^PQ : Trans P Q PQ) where\n\n transitive : Trans (Bisim R P i) (Bisim S Q i) (Bisim RS PQ i)\n transitive [ p ] [ q ] = [ trans^PQ p q ]\n transitive (p ∷ ps) (q ∷ qs) =\n trans^RS p q ∷ λ where .force → transitive (ps .force) (qs .force)\n\n-- Pointwise Equality as a Bisimilarity\n------------------------------------------------------------------------\n\nmodule _ {W : Set w} {A : Set a} where\n\n infix 1 _⊢_≈_\n _⊢_≈_ : ∀ i → Cowriter W A ∞ → Cowriter W A ∞ → Set (a ⊔ w)\n _⊢_≈_ = Bisim _≡_ _≡_\n\n refl : Reflexive (i ⊢_≈_)\n refl = reflexive Eq.refl Eq.refl\n\n fromEq : ∀ {as bs} → as ≡ bs → i ⊢ as ≈ bs\n fromEq Eq.refl = refl\n\n sym : Symmetric (i ⊢_≈_)\n sym = symmetric Eq.sym Eq.sym\n\n trans : Transitive (i ⊢_≈_)\n trans = transitive Eq.trans Eq.trans\n\nmodule _ {R : Rel W r} {S : Rel A s}\n (equiv^R : IsEquivalence R) (equiv^S : IsEquivalence S) where\n\n private\n module equiv^R = IsEquivalence equiv^R\n module equiv^S = IsEquivalence equiv^S\n\n isEquivalence : IsEquivalence (Bisim R S i)\n isEquivalence = record\n { refl = reflexive equiv^R.refl equiv^S.refl\n ; sym = symmetric equiv^R.sym equiv^S.sym\n ; trans = transitive equiv^R.trans equiv^S.trans\n }\n\nsetoid : Setoid w r → Setoid a s → Size → Setoid (w ⊔ a) (w ⊔ a ⊔ r ⊔ s)\nsetoid R S i = record\n { isEquivalence = isEquivalence (Setoid.isEquivalence R)\n (Setoid.isEquivalence S) {i = i}\n }\n\nmodule ≈-Reasoning {W : Set w} {A : Set a} {i} where\n\n open import Relation.Binary.Reasoning.Setoid\n (setoid (Eq.setoid W) (Eq.setoid A) i) public\n", "meta": {"hexsha": "78fc8cebf820b248feab06b70148f5b3d67f6610", "size": 3267, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Codata/Cowriter/Bisimilarity.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Codata/Cowriter/Bisimilarity.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Codata/Cowriter/Bisimilarity.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 31.1142857143, "max_line_length": 78, "alphanum_fraction": 0.5368839914, "num_tokens": 1158, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240756264638, "lm_q2_score": 0.7772998611746911, "lm_q1q2_score": 0.6725385538694507}} {"text": "{-# OPTIONS --warning=error --safe --without-K #-}\n\nopen import LogicalFormulae\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import Functions.Definition\nopen import Setoids.Setoids\nopen import Setoids.Subset\n\nmodule Graphs.Definition where\n\nrecord Graph {a b : _} (c : _) {V' : Set a} (V : Setoid {a} {b} V') : Set (a ⊔ b ⊔ lsuc c) where\n field\n _<->_ : Rel {a} {c} V'\n noSelfRelation : (x : V') → x <-> x → False\n symmetric : {x y : V'} → x <-> y → y <-> x\n wellDefined : {x y r s : V'} → Setoid._∼_ V x y → Setoid._∼_ V r s → x <-> r → y <-> s\n\nrecord GraphIso {a b c d e m : _} {V1' : Set a} {V2' : Set b} {V1 : Setoid {a} {c} V1'} {V2 : Setoid {b} {d} V2'} (G : Graph e V1) (H : Graph m V2) (f : V1' → V2') : Set (a ⊔ b ⊔ c ⊔ d ⊔ e ⊔ m) where\n field\n bij : SetoidBijection V1 V2 f\n respects : (x y : V1') → Graph._<->_ G x y → Graph._<->_ H (f x) (f y)\n respects' : (x y : V1') → Graph._<->_ H (f x) (f y) → Graph._<->_ G x y\n\nrecord Subgraph {a b c d e : _} {V' : Set a} {V : Setoid {a} {b} V'} (G : Graph c V) {pred : V' → Set d} (sub : subset V pred) (_<->'_ : Rel {_} {e} (Sg V' pred)) : Set (a ⊔ b ⊔ c ⊔ d ⊔ e) where\n field\n inherits : {x y : Sg V' pred} → (x <->' y) → (Graph._<->_ G (underlying x) (underlying y))\n symmetric : {x y : Sg V' pred} → (x <->' y) → (y <->' x)\n wellDefined : {x y r s : Sg V' pred} → Setoid._∼_ (subsetSetoid V sub) x y → Setoid._∼_ (subsetSetoid V sub) r s → x <->' r → y <->' s\n\nsubgraphIsGraph : {a b c d e : _} {V' : Set a} {V : Setoid {a} {b} V'} {G : Graph c V} {pred : V' → Set d} {sub : subset V pred} {rel : Rel {_} {e} (Sg V' pred)} (H : Subgraph G sub rel) → Graph e (subsetSetoid V sub)\nGraph._<->_ (subgraphIsGraph {rel = rel} H) = rel\nGraph.noSelfRelation (subgraphIsGraph {G = G} H) (v , isSub) v=v = Graph.noSelfRelation G v (Subgraph.inherits H v=v)\nGraph.symmetric (subgraphIsGraph H) v1=v2 = Subgraph.symmetric H v1=v2\nGraph.wellDefined (subgraphIsGraph H) = Subgraph.wellDefined H\n", "meta": {"hexsha": "5c4dc2f00dc65d6589cdf27af58589bc738f5de9", "size": 1992, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Graphs/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Graphs/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Graphs/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 56.9142857143, "max_line_length": 217, "alphanum_fraction": 0.5647590361, "num_tokens": 807, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178944582995, "lm_q2_score": 0.7401743505760728, "lm_q1q2_score": 0.6725356599524706}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Experiments.ZCohomologyExperiments where\nopen import Cubical.ZCohomology.Base\nopen import Cubical.ZCohomology.Properties\nopen import Cubical.ZCohomology.GroupStructure\nopen import Cubical.ZCohomology.Groups.Sn\nopen import Cubical.ZCohomology.Groups.WedgeOfSpheres\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.HITs.Truncation\nopen import Cubical.HITs.SetTruncation\nopen import Cubical.HITs.Pushout\nopen import Cubical.HITs.S1\nopen import Cubical.HITs.Sn\nopen import Cubical.HITs.Susp\nopen import Cubical.Data.Int\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Data.Sigma\nopen import Cubical.Foundations.Isomorphism\nopen import Cubical.Algebra.Group hiding (Int)\n\nprivate\n\n ⋁-to : coHom 2 S²⋁S¹⋁S¹ → Int\n ⋁-to = Iso.fun (GroupIso.isom H²-S²⋁S¹⋁S¹)\n ⋁-from : Int → coHom 2 S²⋁S¹⋁S¹\n ⋁-from = Iso.inv (GroupIso.isom H²-S²⋁S¹⋁S¹)\n\n g : S²⋁S¹⋁S¹ → ∥ S₊ 2 ∥ 4\n g (inl x) = ∣ x ∣\n g (inr x) = 0ₖ 2\n g (push a i) = 0ₖ 2\n\n G = ∣ g ∣₂\n\n{-\nThis computes:\n⋁-to (⋁-from 1 +ₕ ⋁-from 1) ≡ 2\n⋁-to = refl\n\nWe have ⋁-from 1 ≡ G and G is much simpler\n\nBut this does not compute:\ntest₀ : ⋁-to (G +ₕ G) ≡ 2\ntest₀ = refl\n\nWith the strange addition it does:\ntest₁ : ⋁-to (G +'ₕ G) ≡ 2\ntest₁ = refl\n-}\n\n-- Similar stuff happens with Sⁿ.\nprivate\n S²-to : coHom 2 (S₊ 2) → Int\n S²-to = Iso.fun (GroupIso.isom (Hⁿ-Sⁿ≅ℤ 1))\n\n S²-from : Int → coHom 2 (S₊ 2)\n S²-from = Iso.inv (GroupIso.isom (Hⁿ-Sⁿ≅ℤ 1))\n\n one : coHom 2 (S₊ 2)\n one = ∣ ∣_∣ ∣₂\n\n{-\nDoes not compute\ntest₂ : S²-to (S²-from 1 +ₕ S²-from 1) ≡ 2\ntest₂ = refl\n\nBut this does\ntest₂ : S²-to (S²-from 1 +'ₕ S²-from 1) ≡ 2\ntest₂ = refl\n\nThis doesn't\ntest₃ : S²-to (one +ₕ one) ≡ 2\ntest₃ = refl\n\nBut this does\ntest₃ : S²-to (one +'ₕ one) ≡ 2\ntest₃ = refl\n-}\n", "meta": {"hexsha": "62ab820d19fa863756eee62ce0fdf6f1295710ac", "size": 1764, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Experiments/ZCohomologyExperiments.agda", "max_stars_repo_name": "marcinjangrzybowski/cubical", "max_stars_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 301, "max_stars_repo_stars_event_min_datetime": "2018-10-17T18:00:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T02:10:47.000Z", "max_issues_repo_path": "Cubical/Experiments/ZCohomologyExperiments.agda", "max_issues_repo_name": "marcinjangrzybowski/cubical", "max_issues_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 584, "max_issues_repo_issues_event_min_datetime": "2018-10-15T09:49:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T12:09:17.000Z", "max_forks_repo_path": "Cubical/Experiments/ZCohomologyExperiments.agda", "max_forks_repo_name": "marcinjangrzybowski/cubical", "max_forks_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 134, "max_forks_repo_forks_event_min_datetime": "2018-11-16T06:11:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T16:22:13.000Z", "avg_line_length": 22.05, "max_line_length": 55, "alphanum_fraction": 0.6853741497, "num_tokens": 779, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096090086368, "lm_q2_score": 0.7341195385342971, "lm_q1q2_score": 0.6725339634122558}} {"text": "\nmodule List where\n\nimport Bool\nopen Bool\n\ninfixr 15 _::_\n\ndata List (A : Set) : Set where\n [] : List A\n _::_ : A -> List A -> List A\n\nmodule Eq {A : Set}(_=A=_ : A -> A -> Bool) where\n\n infix 10 _==_\n\n _==_ : List A -> List A -> Bool\n [] == [] = true\n x :: xs == y :: ys = (x =A= y) && xs == ys\n [] == _ :: _ = false\n _ :: _ == [] = false\n\nmodule Subst {A : Set}(_=A=_ : A -> A -> Bool)\n (substA : {x y : A} -> (P : A -> Set) -> IsTrue (x =A= y) -> P x -> P y)\n where\n\n module EqA = Eq _=A=_\n open EqA\n\n subst : {xs ys : List A} -> (P : List A -> Set) -> IsTrue (xs == ys) -> P xs -> P ys\n subst {[] } {_ :: _ } _ () _\n subst {_ :: _ } {[] } _ () _\n subst {[] } {[] } P eq pxs = pxs\n subst {x :: xs} {y :: ys} P eq pxs =\n substA (\\z -> P (z :: ys)) x==y (\n subst (\\zs -> P (x :: zs)) xs==ys pxs\n )\n where\n x==y : IsTrue (x =A= y)\n x==y = isTrue&&₁ {x =A= y}{xs == ys} eq\n\n xs==ys : IsTrue (xs == ys)\n xs==ys = isTrue&&₂ {x =A= y}{xs == ys} eq\n\n", "meta": {"hexsha": "d2d631172ecc7f7cbbef6ba8020d7ba52661ae48", "size": 1049, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/tactics/ac/List.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "examples/tactics/ac/List.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "examples/tactics/ac/List.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 23.3111111111, "max_line_length": 86, "alphanum_fraction": 0.4070543375, "num_tokens": 418, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096158798117, "lm_q2_score": 0.7341195152660687, "lm_q1q2_score": 0.6725339471402717}} {"text": "-- {-# OPTIONS -v tc.lhs.top:15 #-}\n-- {-# OPTIONS -v term:20 #-}\n\n-- Andreas, 2014-11-08, following a complaint by Francesco Mazzoli\n\nopen import Common.Prelude\n\ndata Subst : (d : Nat) → Set where\n c₁ : ∀ {d} → Subst d → Subst d\n c₂ : ∀ d₁ d₂ → Subst d₁ → Subst d₂ → Subst (suc d₁ + d₂)\n\npostulate\n comp : ∀ {d₁ d₂} → Subst d₁ → Subst d₂ → Subst (d₁ + d₂)\n\nlookup : ∀ d → Nat → Subst d → Set₁\nlookup d zero (c₁ ρ) = Set\nlookup d (suc v) (c₁ ρ) = lookup d v ρ\nlookup .(suc d₁ + d₂) v (c₂ d₁ d₂ ρ σ) = lookup (d₁ + d₂) v (comp ρ σ)\n\n-- The dot pattern here is actually normalized, so it is\n--\n-- suc (d₁ + d₂)\n--\n-- the recursive call it with (d₁ + d₂).\n-- In such simple cases, Agda can now recognize that the pattern is\n-- constructor applied to call argument, which is valid descent.\n\n-- This should termination check now.\n\n-- Note however, that Agda only looks for syntactic equality,\n-- since it is not allowed to normalize terms on the rhs (yet).\n\nhidden : ∀{d} → Nat → Subst d → Set₁\nhidden zero (c₁ ρ) = Set\nhidden (suc v) (c₁ ρ) = hidden v ρ\nhidden v (c₂ d₁ d₂ ρ σ) = hidden v (comp ρ σ)\n\n-- This should also termination check, and looks pretty magical... ;-)\n", "meta": {"hexsha": "a970e2a252d00ef82b803c4835e035f909a6de0b", "size": 1257, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/SubTermination.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/SubTermination.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/SubTermination.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 32.2307692308, "max_line_length": 76, "alphanum_fraction": 0.5982498011, "num_tokens": 423, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677660619633, "lm_q2_score": 0.7931059438487663, "lm_q1q2_score": 0.6725282754559033}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Algebra.Structures.Bundles.Field\n\nmodule Algebra.Structures.Field.Utils\n {k ℓ} (K : Field k ℓ)\n where\n\nopen Field K hiding (zero)\n\nopen import Data.Fin\nimport Data.Nat as Nat\n\nprivate\n K' : Set k\n K' = Carrier\n\nδ : ∀ {n p} -> Fin n -> Fin p -> K'\nδ zero zero = 1#\nδ (suc i) zero = 0#\nδ zero (suc j) = 0#\nδ (suc i) (suc j) = δ i j\n\nδ-comm : ∀ {n p} (i : Fin n) (j : Fin p) -> δ i j ≈ δ j i\nδ-comm zero zero = refl\nδ-comm (suc i) zero = refl\nδ-comm zero (suc j) = refl\nδ-comm (suc i) (suc j) = δ-comm i j\n\nδ-cancelˡ : ∀ {n p} (j : Fin p) -> δ {Nat.suc n} zero (suc j) ≈ 0#\nδ-cancelˡ zero = refl\nδ-cancelˡ (suc j) = refl\n\nδ-cancelʳ : ∀ {n p} (i : Fin n) -> δ {p = Nat.suc p} (suc i) zero ≈ 0#\nδ-cancelʳ {n} {p} i = trans (δ-comm (suc i) (zero {Nat.suc p})) (δ-cancelˡ {p} {n} i)\n", "meta": {"hexsha": "725bba59b62dbd23240415edcd113cefc38a1016", "size": 828, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Algebra/Structures/Field/Utils.agda", "max_stars_repo_name": "felko/linear-algebra", "max_stars_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-11-02T14:11:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T06:18:08.000Z", "max_issues_repo_path": "src/Algebra/Structures/Field/Utils.agda", "max_issues_repo_name": "felko/linear-algebra", "max_issues_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Algebra/Structures/Field/Utils.agda", "max_forks_repo_name": "felko/linear-algebra", "max_forks_repo_head_hexsha": "d87c5a1eb5dd0569238272e67bce1899616b789a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.0, "max_line_length": 85, "alphanum_fraction": 0.5712560386, "num_tokens": 348, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970842359877, "lm_q2_score": 0.7634837743174789, "lm_q1q2_score": 0.6724742822803224}} {"text": "module Inductive.Examples.BinTree where\n\nopen import Inductive\nopen import Tuple\n\nopen import Data.Fin\nopen import Data.Product hiding (map)\nopen import Data.List hiding (map)\nopen import Data.Vec hiding (map)\n\nBinTree : Set → Set\nBinTree A = Inductive (([] , []) ∷ (((A ∷ []) , ([] ∷ ([] ∷ []))) ∷ []))\n\nleaf : {A : Set} → BinTree A\nleaf = construct zero [] []\n\nnode : {A : Set} → A → BinTree A → BinTree A → BinTree A\nnode a lt rt = construct (suc zero) (a ∷ []) ((λ _ → lt) ∷ ((λ _ → rt) ∷ []))\n\nmap : {A B : Set} → (A → B) → BinTree A → BinTree B\nmap f = rec (leaf ∷ ((λ a lt rlt rt rrt → node (f a) rlt rrt) ∷ []))\n\nimport Inductive.Examples.List as List\n\ndfs : {A : Set} → BinTree A → List.List A\ndfs = rec ( List.nil\n ∷ (λ a lt rlt rt rrt → List.cons a (rlt List.++ rrt))\n ∷ [])\n", "meta": {"hexsha": "f9359aa4f2a1ec4827b966aa3f042e67c0c7f9ee", "size": 804, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Inductive/Examples/BinTree.agda", "max_stars_repo_name": "mr-ohman/general-induction", "max_stars_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Inductive/Examples/BinTree.agda", "max_issues_repo_name": "mr-ohman/general-induction", "max_issues_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Inductive/Examples/BinTree.agda", "max_forks_repo_name": "mr-ohman/general-induction", "max_forks_repo_head_hexsha": "dc157acda597a2c758e82b5637e4fd6717ccec3f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.724137931, "max_line_length": 77, "alphanum_fraction": 0.5746268657, "num_tokens": 277, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8840392878563335, "lm_q2_score": 0.7606506581031359, "lm_q1q2_score": 0.6724450660969477}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n{-\n Properties and definitions regarding Morphisms of a category:\n - Monomorphism\n - Epimorphism\n - Isomorphism\n - (object) equivalence ('spelled' _≅_ ). Exported as the module ≅\n-}\nopen import Categories.Category\n\nmodule Categories.Morphism {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\nopen import Relation.Binary hiding (_⇒_)\n\nopen import Categories.Morphism.Reasoning.Core 𝒞\n\nopen Category 𝒞\n\nprivate\n variable\n A B C : Obj\n\nMono : ∀ (f : A ⇒ B) → Set (o ⊔ ℓ ⊔ e)\nMono {A = A} f = ∀ {C} → (g₁ g₂ : C ⇒ A) → f ∘ g₁ ≈ f ∘ g₂ → g₁ ≈ g₂\n\nEpi : ∀ (f : A ⇒ B) → Set (o ⊔ ℓ ⊔ e)\nEpi {B = B} f = ∀ {C} → (g₁ g₂ : B ⇒ C) → g₁ ∘ f ≈ g₂ ∘ f → g₁ ≈ g₂\n\nrecord Iso (from : A ⇒ B) (to : B ⇒ A) : Set e where\n field\n isoˡ : to ∘ from ≈ id\n isoʳ : from ∘ to ≈ id\n\ninfix 4 _≅_\nrecord _≅_ (A B : Obj) : Set (ℓ ⊔ e) where\n field\n from : A ⇒ B\n to : B ⇒ A\n iso : Iso from to\n\n open Iso iso public\n\n-- don't pollute the name space too much\nprivate\n ≅-refl : Reflexive _≅_\n ≅-refl = record\n { from = id\n ; to = id\n ; iso = record\n { isoˡ = identityˡ\n ; isoʳ = identityʳ\n }\n }\n\n ≅-sym : Symmetric _≅_\n ≅-sym A≅B = record\n { from = to\n ; to = from\n ; iso = record\n { isoˡ = isoʳ\n ; isoʳ = isoˡ\n }\n }\n where open _≅_ A≅B\n\n ≅-trans : Transitive _≅_\n ≅-trans A≅B B≅C = record\n { from = from B≅C ∘ from A≅B\n ; to = to A≅B ∘ to B≅C\n ; iso = record\n { isoˡ = begin\n (to A≅B ∘ to B≅C) ∘ from B≅C ∘ from A≅B ≈⟨ cancelInner (isoˡ B≅C) ⟩\n to A≅B ∘ from A≅B ≈⟨ isoˡ A≅B ⟩\n id ∎\n ; isoʳ = begin\n (from B≅C ∘ from A≅B) ∘ to A≅B ∘ to B≅C ≈⟨ cancelInner (isoʳ A≅B) ⟩\n from B≅C ∘ to B≅C ≈⟨ isoʳ B≅C ⟩\n id ∎\n }\n }\n where open _≅_\n open HomReasoning\n open Equiv\n\n≅-isEquivalence : IsEquivalence _≅_\n≅-isEquivalence = record\n { refl = ≅-refl\n ; sym = ≅-sym\n ; trans = ≅-trans\n }\n\n-- But make accessing it easy:\nmodule ≅ = IsEquivalence ≅-isEquivalence\n\n≅-setoid : Setoid _ _\n≅-setoid = record\n { Carrier = Obj\n ; _≈_ = _≅_\n ; isEquivalence = ≅-isEquivalence\n }\n", "meta": {"hexsha": "be2fc2c75a389c8acc24142fbf60a3ad993c98f2", "size": 2305, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Morphism.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Morphism.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Morphism.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.3786407767, "max_line_length": 75, "alphanum_fraction": 0.5002169197, "num_tokens": 943, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392909114836, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6724450588275246}} {"text": "\nopen import Auto.Prelude\n\nmutual\n data Even : ℕ → Set where\n even-0 : Even zero\n even-s : {n : ℕ} → Odd n → Even (succ n)\n\n data Odd : ℕ → Set where\n odd-1 : Odd (succ zero)\n odd-s : {n : ℕ} → Even n → Odd (succ n)\n\ndouble : ℕ → ℕ\ndouble zero = zero\ndouble (succ n) = succ (succ (double n))\n\nh0 : ∀ {n} → Even (double n)\nh0 {n} = {!-c!}\n--h0 {zero} = even-0\n--h0 {succ x} = even-s (odd-s h0)\n\n\n-- ----------------------------\n\nmodule VecMap where\n\n map : {X Y : Set} → {n : ℕ} → (X → Y) → Vec X n → Vec Y n\n map f xs = {!-c!} -- h1\n{-\n map f [] = []\n map f (x ∷ x₁) = f x ∷ map f x₁\n-}\n\n-- ----------------------------\n\ndata Type : Set₁ where\n <_> : Set → Type\n _⇒_ : Type → Type → Type\n\n∥_∥ : Type → Set\n∥ < X > ∥ = X\n∥ a ⇒ b ∥ = ∥ a ∥ → ∥ b ∥\n\ndata Ctx : Set₁ where\n [] : Ctx\n _,_ : Ctx → Type → Ctx\n\ndata _∈_ (a : Type) : Ctx → Set₁ where\n zero : ∀ {Γ} → a ∈ (Γ , a)\n succ : ∀ {b Γ} → a ∈ Γ → a ∈ (Γ , b)\n\ndata Exp (Γ : Ctx) : Type → Set₁ where\n app : ∀ {α β} → Exp Γ (α ⇒ β) → Exp Γ α → Exp Γ β\n var : ∀ {α} → α ∈ Γ → Exp Γ α\n lam : ∀ {a b} → Exp (Γ , a) b → Exp Γ (a ⇒ b)\n\ndata Env : Ctx → Set₁ where\n nil : Env []\n cons : ∀ {Γ a} → ∥ a ∥ → Env Γ → Env (Γ , a)\n\nlookup : ∀ {Γ a} → a ∈ Γ → Env Γ → ∥ a ∥\nlookup x σ = {!-c!} -- h2\n{-\nlookup {._} {< x >} zero (cons x₁ x₂) = x₁\nlookup {._} {< x >} (succ x₁) (cons x₂ x₃) = lookup x₁ x₃\nlookup {._} {x ⇒ x₁} zero (cons x₂ x₃) = x₂\nlookup {._} {x ⇒ x₁} (succ x₂) (cons x₃ x₄) = lookup x₂ x₄\n-}\n\nlookup' : ∀ {Γ a} → a ∈ Γ → Env Γ → ∥ a ∥\nlookup' zero (cons x σ) = x\nlookup' (succ v) (cons x σ) = lookup' v σ\n\neval : ∀ {Γ a} → Env Γ → Exp Γ a → ∥ a ∥\n--eval σ e = {!-c lookup!} -- no solution found\neval σ (app e e₁) = {!!} -- h3\neval σ (var x) = {!lookup'!} -- h4, -c also works, repeats the solution for lookup\neval σ (lam e) x = {!!} -- h5\n{-\neval σ (app e e₁) = eval σ e (eval σ e₁)\neval σ (var x) = lookup x σ\neval σ (lam e) x = eval (cons x σ) e\n-}\n", "meta": {"hexsha": "4069e9e043b72575c92f3b750b21ddb199b24afc", "size": 1914, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/interaction/Auto-IndexedDatatypes.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/interaction/Auto-IndexedDatatypes.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/interaction/Auto-IndexedDatatypes.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 22.7857142857, "max_line_length": 83, "alphanum_fraction": 0.4749216301, "num_tokens": 845, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392786908831, "lm_q2_score": 0.7606506526772884, "lm_q1q2_score": 0.6724450543285795}} {"text": "{-# OPTIONS --without-K #-}\nmodule NTypes where\n\nopen import Equivalence\nopen import FunExt\nopen import GroupoidStructure\nopen import NTypes.Contractible\nopen import PathOperations\nopen import Transport\nopen import Types\n\nisProp : ∀ {a} → Set a → Set _\nisProp A = (x y : A) → x ≡ y\n\nisSet : ∀ {a} → Set a → Set _\nisSet A = (x y : A) (p q : x ≡ y) → p ≡ q\n\nset→id-prop : ∀ {a} {A : Set a} →\n isSet A → {x y : A} → isProp (x ≡ y)\nset→id-prop A-set = A-set _ _\n\nid-prop→set : ∀ {a} {A : Set a} →\n ({x y : A} → isProp (x ≡ y)) → isSet A\nid-prop→set f _ _ = f\n\nprop-eq : ∀ {a b} {A : Set a} {B : Set b} → A ≃ B → isProp A → isProp B\nprop-eq (f , (g , α) , (h , β)) A-prop x y =\n tr id\n ( ap (λ z → z ≡ f (g y)) (α x)\n · ap (λ z → x ≡ z) (α y)\n )\n (ap f (A-prop (g x) (g y)))\n\n-- Levels.\nis-[_-2]-type : ℕ → ∀ {a} → Set a → Set a\nis-[ n -2]-type = ind (λ _ → Set _ → Set _)\n (λ _ r A → (x y : A) → r (x ≡ y))\n isContr\n n\n\n-- isProp and is-(-1)-type.\nprop→-1-type : ∀ {a} {A : Set a} →\n isProp A → is-[ 1 -2]-type A\nprop→-1-type {A = A} A-prop x y\n = A-prop x y\n , path\n where\n split-path : {x y : A} (p : x ≡ y) →\n A-prop x y ≡ p · A-prop y y\n split-path = J\n (λ x y p → A-prop x y ≡ p · A-prop y y)\n (λ _ → refl) _ _\n\n path : {x y : A} (p : x ≡ y) → A-prop x y ≡ p\n path = J\n (λ x y p → A-prop x y ≡ p)\n (λ x → split-path (A-prop x x ⁻¹) · p⁻¹·p (A-prop x x))\n _ _\n\n-1-type→prop : ∀ {a} {A : Set a} →\n is-[ 1 -2]-type A → isProp A\n-1-type→prop A-1 x y = π₁ (A-1 x y)\n\n-- isSet and is-0-type.\nset→0-type : ∀ {a} {A : Set a} →\n isSet A → is-[ 2 -2]-type A\nset→0-type A-set x y = prop→-1-type (A-set x y)\n\n0-type→set : ∀ {a} {A : Set a} →\n is-[ 2 -2]-type A → isSet A\n0-type→set A0 x y = -1-type→prop (A0 x y)\n\n-- Cumulativity.\nn-type-suc : ∀ n {a} {A : Set a} →\n is-[ n -2]-type A → is-[ suc n -2]-type A\nn-type-suc n = ind\n (λ n → ∀ {A} → is-[ n -2]-type A → is-[ suc n -2]-type A)\n (λ _ r h x y → r (h x y))\n (λ h → prop→-1-type λ x y → π₂ h x ⁻¹ · π₂ h y)\n n\n\n-- From lectures.\nprop→set : ∀ {a} {A : Set a} →\n isProp A → isSet A\nprop→set A-prop x y p q = lem p · lem q ⁻¹\n where\n g : _\n g = A-prop x\n\n lem : (p : x ≡ y) → p ≡ g x ⁻¹ · g y\n lem p\n = id·p p ⁻¹\n · ap (λ z → z · p)\n (p⁻¹·p (g x)) ⁻¹\n · p·q·r (g x ⁻¹) (g x) p ⁻¹\n · ap (λ z → g x ⁻¹ · z)\n ( tr-post x p (g x) ⁻¹\n · apd g p\n )\n\nisProp-is-prop : ∀ {a} {A : Set a} →\n isProp (isProp A)\nisProp-is-prop f g =\n funext λ x →\n funext λ y →\n prop→set f _ _ (f x y) (g x y)\n\nisSet-is-prop : ∀ {a} {A : Set a} →\n isProp (isSet A)\nisSet-is-prop f g =\n funext λ x →\n funext λ y →\n funext λ p →\n funext λ q →\n prop→set (f x y) _ _ (f x y p q) (g x y p q)\n", "meta": {"hexsha": "1842fc52187acd383680a1444c5e1e7b97a0e9f3", "size": 2710, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/NTypes.agda", "max_stars_repo_name": "vituscze/HoTT-lectures", "max_stars_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/NTypes.agda", "max_issues_repo_name": "vituscze/HoTT-lectures", "max_issues_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/NTypes.agda", "max_forks_repo_name": "vituscze/HoTT-lectures", "max_forks_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.3620689655, "max_line_length": 71, "alphanum_fraction": 0.4830258303, "num_tokens": 1243, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392725805822, "lm_q2_score": 0.7606506526772883, "lm_q1q2_score": 0.672445049680775}} {"text": "module IndexOnBuiltin where\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\n{-# BUILTIN NATURAL Nat #-}\n{-# BUILTIN ZERO zero #-}\n{-# BUILTIN SUC suc #-}\n\ndata Fin : Nat -> Set where\n fz : {n : Nat} -> Fin (suc n)\n fs : {n : Nat} -> Fin n -> Fin (suc n)\n\nf : Fin 2 -> Fin 1\nf fz = fz\nf (fs i) = i\n\n", "meta": {"hexsha": "d030e1dbec3b9dda2e98e0782c16d5980adc2d8f", "size": 312, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/IndexOnBuiltin.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/succeed/IndexOnBuiltin.agda", "max_issues_repo_name": "np/agda-git-experiment", "max_issues_repo_head_hexsha": "20596e9dd9867166a64470dd24ea68925ff380ce", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/IndexOnBuiltin.agda", "max_forks_repo_name": "np/agda-git-experiment", "max_forks_repo_head_hexsha": "20596e9dd9867166a64470dd24ea68925ff380ce", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.4210526316, "max_line_length": 40, "alphanum_fraction": 0.5384615385, "num_tokens": 111, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9399133464597458, "lm_q2_score": 0.7154239897159439, "lm_q1q2_score": 0.6724365563114956}} {"text": "module x where\n\nopen import Level\n\nprivate\n variable\n a b c d e f ℓ p q r : Level\n A : Set a\n B : Set b\n C : Set c\n D : Set d\n E : Set e\n F : Set f\n\n\n------------------------------------------------------------------------------\n\ninfixr 4 _,_\ninfixr 2 _^_\n\nrecord _^_ (A : Set a) (B : Set b) : Set (a ⊔ b) where\n constructor _,_\n field\n fst : A\n snd : B\nopen _^_\n\nswap : A ^ B → B ^ A\nswap (a , b) = b , a\n\n------------------------------------------------------------------------------\n\ninfixr 1 _v_\n\ndata _v_ (A : Set a) (B : Set b) : Set (a ⊔ b) where\n inl : (x : A) → A v B\n inr : (y : B) → A v B\n\ncases : ∀ {A : Set a} {B : Set b} {C : Set c}\n → (A v B) → (A → C) → (B → C)\n → C\ncases (inl q) f g = f q\ncases (inr r) f g = g r\n\n------------------------------------------------------------------------------\n\ndata ⊥ : Set where\n\n⊥-elim : ∀ {A : Set a} → ⊥ → A\n⊥-elim = λ ()\n\n------------------------------------------------------------------------------\n\n¬_ : Set → Set\n¬ A = A → ⊥\n\n------------------------------------------------------------------------------\n\n-- 4.1\nassoc-^ : (A ^ B) ^ C → A ^ (B ^ C)\nassoc-^ ((a , b) , c) = a , (b , c)\n\n-- 4.2\ne4-2 : (¬ A v B) → (A → B)\ne4-2 (inl ¬a) = λ a → ⊥-elim (¬a a)\ne4-2 (inr b) = λ _ → b\n\n{- not provable\ne4-2' : (A → B) → (¬ A v B)\ne4-2' a→b = {!!}\n-}\n\n-- 4.3\ne4-3 : (A v ¬ A) → (¬ ¬ A → A)\ne4-3 (inl a) = λ _ → a\ne4-3 (inr ¬a) = λ ¬¬a → ⊥-elim (¬¬a ¬a)\n\ne4-3' : (A → ¬ ¬ A)\ne4-3' = λ a ¬¬a → ¬¬a a\n\n-- 4.4 -- this is similar to v elimination by cases\ne4-4 : ((A ^ B) → C) → A → (B → C)\ne4-4 a^b→c a = λ b → a^b→c (a , b)\n\n-- 4.5\ne4-5 : (A → (B → C)) → ((A ^ B) → C)\ne4-5 a→b→c = λ (a , b) → a→b→c a b\n\ne4-5' : ((A ^ B) → C) → (A → (B → C))\ne4-5' a^b→c = λ a → λ b → a^b→c (a , b)\n\n-- 4.6\ne4-6 : A → (B v C) → ((A ^ B) v (A ^ C))\ne4-6 a (inl b) = inl (a , b)\ne4-6 a (inr c) = inr (a , c)\n\n-- 4.7\ne4-7 : (A → C) → (B → D) → ((A ^ B) → (C ^ D))\ne4-7 a→c b→d = λ (a , b) → (a→c a , b→d b)\n\n-- section 4.5.2\n\n-- function composition\n_∘_ : (B → C) → (A → B) → (A → C)\n_∘_ b→c a→b = λ a -> b→c (a→b a)\n\nsrl : (A → B) → (¬ B → ¬ A)\nsrl a→b = λ ¬b a → ¬b (a→b a)\n\n-- section 4.5.3\nidA^A : (A ^ A) → (A ^ A)\nidA^A (a , a') = (a' , a)\n\n-- section 4.5.5 Conjunction and disjunction\n\ns455 : ((A v B) → C) → ((A → C) ^ (B → C))\ns455 = λ avb→c → (avb→c ∘ inl , avb→c ∘ inr)\n\ns455' : ((A → C) ^ (B → C)) → ((A v B) → C)\ns455' (a→c , b→c) = λ { (inl a) → a→c a\n ; (inr b) → b→c b }\n\ndm : ¬ (A v B) → (¬ A ^ ¬ B)\ndm notAvB = (notAvB ∘ inl , notAvB ∘ inr)\n\ndm' : (¬ A v ¬ B) → ¬ (A ^ B)\ndm' (inl ¬a) = λ (a , _) → ¬a a\ndm' (inr ¬b) = λ (_ , b) → ¬b b\n\n-- 4.8\ne4-8a : A → ¬ ¬ A\ne4-8a a = λ ¬a → ¬a a\n\ne4-8b : (B v C) → ¬ (¬ B ^ ¬ C)\ne4-8b (inl b) = λ (¬b , _) → ¬b b\ne4-8b (inr c) = λ ( _ , ¬c) → ¬c c\n\ne4-8c : (A → B) → ((A → C) → (A → (B ^ C)))\ne4-8c a→b = λ a→c → λ a → (a→b a , a→c a)\n\n", "meta": {"hexsha": "9eec16e38a222d7045b941396a99282ab9253940", "size": 2893, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "math-and-functional-programming/1999-Type_Theory_and_Functional_Programming-Simon_Thompson/x.agda", "max_stars_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_stars_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2015-01-29T14:37:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T06:55:03.000Z", "max_issues_repo_path": "math-and-functional-programming/1999-Type_Theory_and_Functional_Programming-Simon_Thompson/x.agda", "max_issues_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_issues_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "math-and-functional-programming/1999-Type_Theory_and_Functional_Programming-Simon_Thompson/x.agda", "max_forks_repo_name": "haroldcarr/learn-haskell-coq-ml-etc", "max_forks_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2015-04-13T21:40:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-21T15:58:10.000Z", "avg_line_length": 20.5177304965, "max_line_length": 78, "alphanum_fraction": 0.3366747321, "num_tokens": 1379, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.839733963661418, "lm_q2_score": 0.8006919925839875, "lm_q1q2_score": 0.6723682606045105}} {"text": "open import Algebra.Bundles using (Group)\n\nmodule GGT.Group.Facts\n {a b ℓ}\n (G : Group a ℓ)\n where\n\nopen import Relation.Unary using (Pred)\nopen import Relation.Binary\nopen import GGT.Group.Structures\nopen import Algebra.Bundles using (Group)\nopen import Algebra.Properties.Group G\nopen Group G\nopen import Relation.Binary.Reasoning.Setoid setoid\n\n⁻¹-anti-homo-- : ∀ (x y : Carrier) → (x - y)⁻¹ ≈ y - x\n⁻¹-anti-homo-- x y = begin\n (x - y)⁻¹ ≡⟨⟩\n (x ∙ y ⁻¹)⁻¹ ≈⟨ ⁻¹-anti-homo-∙ _ _ ⟩\n (y ⁻¹) ⁻¹ ∙ x ⁻¹ ≈⟨ ∙-congʳ (⁻¹-involutive _) ⟩\n y ∙ x ⁻¹ ≡⟨⟩\n y - x ∎\n\nsubgroup⁻¹-closed : {P : Pred Carrier b } →\n IsSubGroup G P →\n ∀ x → P x → P (x ⁻¹)\nsubgroup⁻¹-closed iss x px =\n -- e - x = x ⁻¹ → P e - x → P x ⁻¹\n r (identityˡ (x ⁻¹)) (∙-⁻¹-closed ε∈ px)\n where open IsSubGroup iss\n\n-- -----\n-- (Right) Coset Relation is Equivalenc\ncosetRelRefl : {P : Pred Carrier b } →\n (iss : IsSubGroup G P) → Reflexive (IsSubGroup._∼_ iss)\ncosetRelRefl iss {x} = r (sym (inverseʳ x)) ε∈ where open IsSubGroup iss\n-- (e = x - x) → P e → P x - x\ncosetRelSym : {P : Pred Carrier b } →\n (iss : IsSubGroup G P) → Symmetric (IsSubGroup._∼_ iss)\n\ncosetRelSym iss {x} {y} x∼y = r u≈y-x Pu where\n-- P e → P (x - y) → P (y - x)\n open IsSubGroup iss\n u≈y-x = begin\n ε - (x - y) ≡⟨⟩\n ε ∙ (x - y)⁻¹ ≈⟨ identityˡ ((x - y)⁻¹) ⟩\n (x - y)⁻¹ ≈⟨ ⁻¹-anti-homo-- _ _ ⟩\n y - x ∎\n Pu = ∙-⁻¹-closed ε∈ x∼y\n\ncosetRelTrans : {P : Pred Carrier b } →\n (iss : IsSubGroup G P) → Transitive (IsSubGroup._∼_ iss)\ncosetRelTrans iss {x} {y} {z} x∼y y∼z =\n r x-y-[z-y]≈x-z Pu where\n open IsSubGroup iss\n -- P z - y\n z∼y = cosetRelSym iss y∼z\n x-y-[z-y]≈x-z = begin\n (x - y) - (z - y) ≡⟨⟩\n (x - y) ∙ (z - y) ⁻¹ ≈⟨ ∙-congˡ (⁻¹-anti-homo-- z y) ⟩\n (x - y) ∙ (y - z) ≡⟨⟩\n (x ∙ y ⁻¹) ∙ (y ∙ z ⁻¹) ≈⟨ assoc x (y ⁻¹) (y ∙ z ⁻¹) ⟩\n x ∙ (y ⁻¹ ∙ (y ∙ z ⁻¹)) ≈˘⟨ ∙-congˡ (assoc (y ⁻¹) y (z ⁻¹)) ⟩\n x ∙ ((y ⁻¹ ∙ y) ∙ z ⁻¹) ≈⟨ ∙-congˡ (∙-congʳ (inverseˡ _)) ⟩\n x ∙ (ε ∙ z ⁻¹) ≈⟨ ∙-congˡ (identityˡ _) ⟩\n x ∙ z ⁻¹ ≡⟨⟩\n x - z ∎\n Pu = ∙-⁻¹-closed {x - y} {z - y} x∼y z∼y\n", "meta": {"hexsha": "081b380f3bfceca946ef2c1d473bacfe0a4905a3", "size": 2455, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/ggt/group/Facts.agda", "max_stars_repo_name": "zampino/ggt", "max_stars_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-04-17T11:10:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-28T05:48:39.000Z", "max_issues_repo_path": "src/ggt/group/Facts.agda", "max_issues_repo_name": "zampino/ggt", "max_issues_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/ggt/group/Facts.agda", "max_forks_repo_name": "zampino/ggt", "max_forks_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.5797101449, "max_line_length": 84, "alphanum_fraction": 0.4443991853, "num_tokens": 1062, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8872045877523148, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.6723186476207331}} {"text": "open import Relation.Binary.Core\n\nmodule Order.Total {A : Set}\n (_≤_ : A → A → Set)\n (tot≤ : Total _≤_) where\n\nopen import Data.Sum\n\nrefl≤ : {x : A} → x ≤ x\nrefl≤ {x} \n with tot≤ x x\n... | inj₁ x≤x = x≤x\n... | inj₂ x≤x = x≤x \n", "meta": {"hexsha": "37b39eb2f05ffe9992c0aae3948d6093ede23a3b", "size": 265, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Order/Total.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/Order/Total.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Order/Total.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.9285714286, "max_line_length": 43, "alphanum_fraction": 0.4716981132, "num_tokens": 105, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9314625088705932, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.672276743273255}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Dodo.Binary.Precedes where\n\n-- Stdlib imports\nopen import Level using (Level; _⊔_)\nopen import Data.Product using (_×_; _,_)\nopen import Relation.Nullary using (¬_)\nopen import Relation.Unary using (Pred)\nopen import Relation.Binary using (REL; Rel)\nopen import Relation.Binary.Construct.Closure.Transitive using (TransClosure; [_]; _∷_)\n-- Local imports\nopen import Dodo.Binary.Transitive\nopen import Dodo.Binary.Immediate\n\n\n-- # Definitions #\n\n-- `¬ P x` before `¬ P y`\n-- `P x` before `¬ P y`\n-- `P x` before `P y`\n⊤-Precedes-⊥ : {a ℓ₁ ℓ₂ : Level} {A : Set a} → Pred A ℓ₁ → Rel A ℓ₂ → Set _\n⊤-Precedes-⊥ P R = ∀ {x y} → R x y → (P y → P x)\n\n-- We could generalize `⊤-Precedes-⊥` to `Precedes` below:\n--\n-- Precedes : {a ℓ₁ ℓ₂ ℓ₃ : Level} {A : Set a} → Pred A ℓ₁ → Pred A ℓ₂ → Rel A ℓ₃ → Set _\n-- Precedes P Q R = ∀ {x y} → R x y → (P y → P x) × (Q x → Q y)\n--\n-- However, this is semantically a bit cumbersome, as P and Q are /not/ mutually exclusive.\n-- Which means both P and Q may hold for an element.\n\n\n-- # Helpers #\n\nprivate\n identity : {a : Level} → {A : Set a} → A → A\n identity x = x\n \n contrapositive : ∀ {a b : Level} {A : Set a} {B : Set b}\n → ( A → B ) → ( ¬ B → ¬ A )\n contrapositive f ¬b a = ¬b (f a)\n\n\n-- # Operations #\n\nmodule _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {P : Pred A ℓ₁} (R : Rel A ℓ₂) where\n\n ⊤prec⊥-invert : ⊤-Precedes-⊥ P R → {x y : A} → R x y → ¬ P x → ¬ P y\n ⊤prec⊥-invert ⊤prec⊥ Rxy ¬Px Py = contrapositive ¬Px identity (⊤prec⊥ Rxy Py)\n\n\n-- # Properties #\n\nmodule _ {a ℓ₁ ℓ₂ : Level} {A : Set a} {P : Pred A ℓ₁} {R : Rel A ℓ₂} where\n\n ⊤prec⊥-⁺ : ⊤-Precedes-⊥ P R → ⊤-Precedes-⊥ P (TransClosure R)\n ⊤prec⊥-⁺ Pprec¬P [ x∼y ] Py = Pprec¬P x∼y Py\n ⊤prec⊥-⁺ Pprec¬P (x∼y ∷ y~⁺z) Py = Pprec¬P x∼y (⊤prec⊥-⁺ Pprec¬P y~⁺z Py)\n\n ⊤prec⊥-imm : ⊤-Precedes-⊥ P R → ⊤-Precedes-⊥ P (immediate R)\n ⊤prec⊥-imm Pprec¬P (x~y , ¬∃z) Py = Pprec¬P x~y Py\n", "meta": {"hexsha": "b23413a03f9ce64dde75222d6b2ef2b5f6e83ca1", "size": 1930, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Dodo/Binary/Precedes.agda", "max_stars_repo_name": "sourcedennis/agda-dodo", "max_stars_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Dodo/Binary/Precedes.agda", "max_issues_repo_name": "sourcedennis/agda-dodo", "max_issues_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Dodo/Binary/Precedes.agda", "max_forks_repo_name": "sourcedennis/agda-dodo", "max_forks_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.6349206349, "max_line_length": 91, "alphanum_fraction": 0.5839378238, "num_tokens": 816, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772417253255, "lm_q2_score": 0.7690802317779601, "lm_q1q2_score": 0.6722355276579535}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Some derivable properties\n------------------------------------------------------------------------\n\nopen import Algebra\n\nmodule Algebra.Properties.Ring {r₁ r₂} (R : Ring r₁ r₂) where\n\nimport Algebra.Properties.AbelianGroup as AGP\nopen import Data.Product\nopen import Function\nimport Relation.Binary.EqReasoning as EqR\n\nopen Ring R\nopen EqR setoid\n\nopen AGP +-abelianGroup public\n renaming ( ⁻¹-involutive to -‿involutive\n ; left-identity-unique to +-left-identity-unique\n ; right-identity-unique to +-right-identity-unique\n ; identity-unique to +-identity-unique\n ; left-inverse-unique to +-left-inverse-unique\n ; right-inverse-unique to +-right-inverse-unique\n ; ⁻¹-∙-comm to -‿+-comm\n )\n\n-‿*-distribˡ : ∀ x y → - x * y ≈ - (x * y)\n-‿*-distribˡ x y = begin\n - x * y ≈⟨ sym $ proj₂ +-identity _ ⟩\n - x * y + 0# ≈⟨ refl ⟨ +-cong ⟩ sym (proj₂ -‿inverse _) ⟩\n - x * y + (x * y + - (x * y)) ≈⟨ sym $ +-assoc _ _ _ ⟩\n - x * y + x * y + - (x * y) ≈⟨ sym (proj₂ distrib _ _ _) ⟨ +-cong ⟩ refl ⟩\n (- x + x) * y + - (x * y) ≈⟨ (proj₁ -‿inverse _ ⟨ *-cong ⟩ refl)\n ⟨ +-cong ⟩\n refl ⟩\n 0# * y + - (x * y) ≈⟨ proj₁ zero _ ⟨ +-cong ⟩ refl ⟩\n 0# + - (x * y) ≈⟨ proj₁ +-identity _ ⟩\n - (x * y) ∎\n\n-‿*-distribʳ : ∀ x y → x * - y ≈ - (x * y)\n-‿*-distribʳ x y = begin\n x * - y ≈⟨ sym $ proj₁ +-identity _ ⟩\n 0# + x * - y ≈⟨ sym (proj₁ -‿inverse _) ⟨ +-cong ⟩ refl ⟩\n - (x * y) + x * y + x * - y ≈⟨ +-assoc _ _ _ ⟩\n - (x * y) + (x * y + x * - y) ≈⟨ refl ⟨ +-cong ⟩ sym (proj₁ distrib _ _ _) ⟩\n - (x * y) + x * (y + - y) ≈⟨ refl ⟨ +-cong ⟩ (refl ⟨ *-cong ⟩ proj₂ -‿inverse _) ⟩\n - (x * y) + x * 0# ≈⟨ refl ⟨ +-cong ⟩ proj₂ zero _ ⟩\n - (x * y) + 0# ≈⟨ proj₂ +-identity _ ⟩\n - (x * y) ∎\n", "meta": {"hexsha": "84ef44d4a2af053673ead20175db8a67136ed287", "size": 2133, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Algebra/Properties/Ring.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Algebra/Properties/Ring.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Algebra/Properties/Ring.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.0192307692, "max_line_length": 89, "alphanum_fraction": 0.4163150492, "num_tokens": 755, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772253241802, "lm_q2_score": 0.7690802370707281, "lm_q1q2_score": 0.6722355196704448}} {"text": "{-# OPTIONS --without-K --rewriting #-}\n\nopen import HoTT\nopen import homotopy.CircleHSpace\nopen import homotopy.LoopSpaceCircle\nimport homotopy.Pi2HSusp as Pi2HSusp\nopen import homotopy.IterSuspensionStable\n\n-- This summerizes all [πₙ Sⁿ]\nmodule homotopy.PinSn where\n\n πS-SphereS-iso-ℤ : ∀ n → πS n (⊙Sphere (S n)) ≃ᴳ ℤ-group\n πS-SphereS-iso-ℤ 0 =\n πS 0 ⊙S¹\n ≃ᴳ⟨ unTrunc-iso ΩS¹-group-structure ⟩\n Ω^S-group 0 ⊙S¹\n ≃ᴳ⟨ ΩS¹-iso-ℤ ⟩\n ℤ-group\n ≃ᴳ∎\n πS-SphereS-iso-ℤ 1 =\n πS 1 ⊙S²\n ≃ᴳ⟨ Pi2HSusp.π₂-Susp ⊙S¹-hSpace ⟩\n πS 0 ⊙S¹\n ≃ᴳ⟨ πS-SphereS-iso-ℤ O ⟩\n ℤ-group\n ≃ᴳ∎\n πS-SphereS-iso-ℤ (S (S n)) =\n πS (S (S n)) (⊙Sphere (S (S (S n))))\n ≃ᴳ⟨ Susp^StableSucc.stable\n (S n) (S n) (≤-ap-S $ ≤-ap-S $ *2-increasing n)\n (⊙Sphere (S (S n))) {{Sphere-conn (S (S n))}} ⟩\n πS (S n) (⊙Sphere (S (S n)))\n ≃ᴳ⟨ πS-SphereS-iso-ℤ (S n) ⟩\n ℤ-group\n ≃ᴳ∎\n", "meta": {"hexsha": "81872d48aaf80327f201f61dea01370540aab656", "size": 927, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "theorems/homotopy/PinSn.agda", "max_stars_repo_name": "timjb/HoTT-Agda", "max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "theorems/homotopy/PinSn.agda", "max_issues_repo_name": "timjb/HoTT-Agda", "max_issues_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "theorems/homotopy/PinSn.agda", "max_forks_repo_name": "timjb/HoTT-Agda", "max_forks_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.75, "max_line_length": 58, "alphanum_fraction": 0.5620280475, "num_tokens": 473, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9353465170505205, "lm_q2_score": 0.7185943985973772, "lm_q1q2_score": 0.6721347679000702}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Nat.Base where\n\nopen import Agda.Builtin.Nat public\n using (_+_; _*_; zero; suc)\n renaming (Nat to ℕ; _-_ to _∸_)\n\nopen import Level\n\ndata Ordering : ℕ → ℕ → Type where\n less : ∀ m k → Ordering m (suc (m + k))\n equal : ∀ m → Ordering m m\n greater : ∀ m k → Ordering (suc (m + k)) m\n\ncompare : ∀ m n → Ordering m n\ncompare zero zero = equal zero\ncompare (suc m) zero = greater zero m\ncompare zero (suc n) = less zero n\ncompare (suc m) (suc n) with compare m n\n... | less m k = less (suc m) k\n... | equal m = equal (suc m)\n... | greater n k = greater (suc n) k\n\n", "meta": {"hexsha": "bc62f6e1c86918a82055c60efbaf5009cd63c5f1", "size": 644, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Nat/Base.agda", "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_issues_repo_path": "Data/Nat/Base.agda", "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Nat/Base.agda", "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "avg_line_length": 25.76, "max_line_length": 44, "alphanum_fraction": 0.5854037267, "num_tokens": 219, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9353465080392797, "lm_q2_score": 0.7185944046238981, "lm_q1q2_score": 0.6721347670615283}} {"text": "module plfa-exercises.Practice3 where\n\nimport Relation.Binary.PropositionalEquality as Eq\nopen Eq using (_≡_; refl; sym; trans; cong)\nopen Eq.≡-Reasoning using (_≡⟨⟩_; _≡⟨_⟩_; begin_; _∎)\nopen import Data.Bool using (Bool; true; false; T; _∧_; _∨_; not)\nopen import Data.Nat using (ℕ; zero; suc; _+_; _*_; _∸_; _≤_; s≤s; z≤n)\nopen import Data.Nat.Properties using\n (+-assoc; +-identityˡ; +-identityʳ; *-assoc; *-identityˡ; *-identityʳ; *-distribʳ-+; +-suc; *-suc; *-comm)\nopen import Relation.Nullary using (¬_; Dec; yes; no)\nopen import Data.Product using (_×_; ∃; ∃-syntax) renaming (_,_ to ⟨_,_⟩)\nopen import Function using (_∘_; flip)\nopen import Level using (Level)\nopen import plfa.part1.Isomorphism using (_≃_; _⇔_)\n--import Data.List.All using (All; []; _∷_)\nopen import Data.List using (List; []; _∷_; _++_; length; reverse; map; foldr; downFrom; foldl)\nopen import Axiom.Extensionality.Propositional using (Extensionality)\nimport Data.Nat.Solver as NatSolver\nopen import Data.Sum using (_⊎_; inj₁; inj₂)\n\n-- Exercises from plfa Lists\n\nmap∘compose₀ : ∀ {A B C : Set} (f : A → B) (g : B → C) (xs : List A) → map (g ∘ f) xs ≡ (map g ∘ map f) xs\nmap∘compose₀ f g [] = refl\nmap∘compose₀ f g (x ∷ xs) = cong (g (f x) ∷_) (map∘compose₀ f g xs)\n\nmodule _ (ext : ∀ {ℓ ℓ′} → Extensionality ℓ ℓ′) where\n\n map∘compose : ∀ {A B C : Set}\n (f : A → B) (g : B → C)\n → map (g ∘ f) ≡ (map g ∘ map f)\n map∘compose f g = ext (map∘compose₀ f g)\n\n\nmap-++-distribute : ∀ {A B : Set}\n (f : A → B) (xs ys : List A)\n → map f (xs ++ ys) ≡ map f xs ++ map f ys\nmap-++-distribute f [] ys = refl\nmap-++-distribute f (x ∷ xs) ys = cong (f x ∷_) (map-++-distribute f xs ys)\n\n\ndata Tree (A B : Set) : Set where\n leaf : A → Tree A B\n node : Tree A B → B → Tree A B → Tree A B\n\nmap-Tree : ∀ {A B C D : Set} → (A → C) → (B → D) → Tree A B → Tree C D\nmap-Tree f g (leaf a) = leaf (f a)\nmap-Tree f g (node lt b rt) = node (map-Tree f g lt) (g b) (map-Tree f g rt)\n\n--node (leaf 5) (3 ∷ []) (leaf 0)\n--map-Tree suc (6 ∷_) (node (leaf 5) (3 ∷ []) (leaf 0))\n\nproduct : List ℕ → ℕ\nproduct = foldr _*_ 1\n\n_ : product (1 ∷ 2 ∷ 3 ∷ 4 ∷ []) ≡ 24\n_ = refl\n\nsum : List ℕ → ℕ\nsum = foldr _+_ 0\n\nsum-downFrom : ∀ (n : ℕ) → sum (downFrom n) * 2 ≡ n * (n ∸ 1)\nsum-downFrom zero = refl\nsum-downFrom 1 = refl\nsum-downFrom (suc (suc n))\n rewrite\n-- sum (downFrom (suc (suc n))) * 2 ≡ suc (suc n) * (suc (suc n) ∸ 1)\n-- suc (suc ((n + (n + foldr _+_ 0 (downFrom n))) * 2)) ≡ suc (n + suc (n + n * suc n))\n *-distribʳ-+ 2 n (foldr _+_ 0 (downFrom (suc n)))\n-- suc (suc (n * 2 + (n + foldr _+_ 0 (downFrom n)) * 2)) ≡ suc (n + suc (n + n * suc n))\n | sum-downFrom (suc n)\n-- suc (suc (n * 2 + (n + n * n))) ≡ suc (n + suc (n + n * suc n))\n | +-suc n (n + n * suc n)\n-- suc (suc (n * 2 + (n + n * n))) ≡ suc (suc (n + (n + n * suc n)))\n | *-suc n n\n-- suc (suc (n * 2 + (n + n * n))) ≡ suc (suc (n + (n + (n + n * n))))\n | *-comm n 2\n-- suc (suc (n + (n + 0) + (n + n * n))) ≡ suc (suc (n + (n + (n + n * n))))\n | +-identityʳ n\n-- suc (suc (n + n + (n + n * n))) ≡ suc (suc (n + (n + (n + n * n))))\n | +-assoc n n (n + n * n)\n-- suc (suc (n + (n + (n + n * n)))) ≡ suc (suc (n + (n + (n + n * n))))\n = refl\n\nsum-downFrom` : ∀ (n : ℕ) → sum (downFrom n) * 2 ≡ n * (n ∸ 1)\nsum-downFrom` zero = refl\nsum-downFrom` 1 = refl\nsum-downFrom` (suc (suc n))\n rewrite\n-- sum (downFrom (suc (suc n))) * 2 ≡ suc (suc n) * (suc (suc n) ∸ 1)\n-- suc (suc ((n + (n + foldr _+_ 0 (downFrom n))) * 2)) ≡ suc (n + suc (n + n * suc n))\n *-distribʳ-+ 2 n (foldr _+_ 0 (downFrom (suc n)))\n-- suc (suc (n * 2 + (n + foldr _+_ 0 (downFrom n)) * 2)) ≡ suc (n + suc (n + n * suc n))\n | sum-downFrom` (suc n)\n-- suc (suc (n * 2 + (n + n * n))) ≡ suc (n + suc (n + n * suc n))\n = simplified n\n where\n open NatSolver using (module +-*-Solver)\n open +-*-Solver using (solve; _:+_; _:*_; _:=_; con)\n\n simplified : ∀ n → 2 + (n * 2 + (n + n * n)) ≡ 1 + (n + (1 + (n + n * (1 + n))))\n simplified = solve 1 (λ n → con 2 :+ (n :* con 2 :+ (n :+ n :* n)) := con 1 :+ (n :+ (con 1 :+ (n :+ n :* (con 1 :+ n))))) refl\n\n-- solve 1 (λ n → n :+ con 1 := con 1 :+ n) refl\n--open NatSolver using (module +-*-Solver)\n--open +-*-Solver using (solve; _:+_; _:*_; _:=_; con; Polynomial)\n--\n--lemma : ∀ x y → x + y * 1 + 3 ≡ 2 + 1 + y + x\n--lemma = solve 2 (λ x y → x :+ y :* con 1 :+ con 3 := con 2 :+ con 1 :+ y :+ x) refl\n\nrecord IsMonoid {A : Set} (_⊗_ : A → A → A) (e : A) : Set where\n field\n assoc : ∀ (x y z : A) → (x ⊗ y) ⊗ z ≡ x ⊗ (y ⊗ z)\n identityˡ : ∀ (x : A) → e ⊗ x ≡ x\n identityʳ : ∀ (x : A) → x ⊗ e ≡ x\n\nopen IsMonoid\n\nfoldr-monoid : ∀ {A : Set} (_⊗_ : A → A → A) (e : A) → IsMonoid _⊗_ e →\n ∀ (xs : List A) (y : A) → foldr _⊗_ y xs ≡ foldr _⊗_ e xs ⊗ y\nfoldr-monoid _⊗_ e ⊗-monoid [] y =\n begin\n foldr _⊗_ y []\n ≡⟨⟩\n y\n ≡⟨ sym (identityˡ ⊗-monoid y) ⟩\n (e ⊗ y)\n ≡⟨⟩\n foldr _⊗_ e [] ⊗ y\n ∎\nfoldr-monoid _⊗_ e ⊗-monoid (x ∷ xs) y =\n begin\n foldr _⊗_ y (x ∷ xs)\n ≡⟨⟩\n x ⊗ (foldr _⊗_ y xs)\n ≡⟨ cong (x ⊗_) (foldr-monoid _⊗_ e ⊗-monoid xs y) ⟩\n x ⊗ (foldr _⊗_ e xs ⊗ y)\n ≡⟨ sym (assoc ⊗-monoid x (foldr _⊗_ e xs) y) ⟩\n (x ⊗ foldr _⊗_ e xs) ⊗ y\n ≡⟨⟩\n foldr _⊗_ e (x ∷ xs) ⊗ y\n ∎\n\n--foldl : {A B : Set} (f : B → A → B) → B → List A → B\n--foldl f b [] = b\n--foldl f b (a ∷ as') = foldl f (f b a) as'\n\n_ : foldl _∸_ 20 (4 ∷ 3 ∷ []) ≡ 13\n_ =\n begin\n foldl _∸_ 20 (4 ∷ 3 ∷ []) ≡⟨⟩\n foldl _∸_ (20 ∸ 4) (3 ∷ []) ≡⟨⟩\n foldl _∸_ ((20 ∸ 4) ∸ 3) [] ≡⟨⟩\n (20 ∸ 4) ∸ 3 ≡⟨⟩\n 13\n ∎\n\n_ : foldr _∸_ 20 (4 ∷ 3 ∷ []) ≡ 4\n_ =\n begin\n foldr _∸_ 20 (4 ∷ 3 ∷ []) ≡⟨⟩\n 4 ∸ foldr _∸_ 20 (3 ∷ []) ≡⟨⟩\n 4 ∸ (3 ∸ foldr _∸_ 20 []) ≡⟨⟩\n 4 ∸ (3 ∸ 20) ≡⟨⟩\n 4 ∸ 0 ≡⟨⟩\n 4\n ∎\n\nfoldl-monoid : {A : Set}\n (_⊗_ : A → A → A) (e : A)\n → IsMonoid _⊗_ e\n → ∀ (y : A) (xs : List A)\n → (y ⊗ foldl _⊗_ e xs) ≡ foldl _⊗_ y xs\nfoldl-monoid _⊗_ e monoid-⊗ y [] = identityʳ monoid-⊗ y\nfoldl-monoid _⊗_ e monoid-⊗ y (x ∷ xs) =\n begin\n y ⊗ foldl _⊗_ e (x ∷ xs) ≡⟨⟩\n y ⊗ foldl _⊗_ (e ⊗ x) xs ≡⟨ cong (λ exp → y ⊗ foldl _⊗_ exp xs) (identityˡ monoid-⊗ x) ⟩\n y ⊗ foldl _⊗_ x xs ≡⟨ cong (y ⊗_) (sym (foldl-monoid _⊗_ e monoid-⊗ x xs)) ⟩\n y ⊗ (x ⊗ foldl _⊗_ e xs) ≡⟨ sym (assoc monoid-⊗ y x (foldl _⊗_ e xs)) ⟩\n (y ⊗ x) ⊗ foldl _⊗_ e xs ≡⟨ foldl-monoid _⊗_ e monoid-⊗ (y ⊗ x) xs ⟩\n foldl _⊗_ (y ⊗ x) xs ≡⟨⟩\n foldl _⊗_ y (x ∷ xs)\n ∎\n\nfoldr-monoid-foldl₀ : ∀ {A : Set} {_⊗_ : A → A → A} {e : A}\n → (xs : List A)\n → IsMonoid _⊗_ e\n → foldr _⊗_ e xs ≡ foldl _⊗_ e xs\nfoldr-monoid-foldl₀ [] _ = refl\nfoldr-monoid-foldl₀ {_} {_⊗_} {e} (x ∷ xs) monoid-⊗ =\n begin\n foldr _⊗_ e (x ∷ xs) ≡⟨⟩\n x ⊗ foldr _⊗_ e xs ≡⟨ cong (x ⊗_) (foldr-monoid-foldl₀ xs monoid-⊗) ⟩\n x ⊗ foldl _⊗_ e xs ≡⟨ foldl-monoid _⊗_ e monoid-⊗ x xs ⟩\n foldl _⊗_ x xs ≡⟨ cong (λ exp → foldl _⊗_ exp xs) (sym (identityˡ monoid-⊗ x)) ⟩\n foldl _⊗_ (e ⊗ x) xs ≡⟨⟩\n foldl _⊗_ e (x ∷ xs)\n ∎\n\nmodule _ (ext : ∀ {ℓ ℓ′} → Extensionality ℓ ℓ′) where\n foldr-monoid-foldl : ∀ {A : Set} {_⊗_ : A → A → A} {e : A}\n → IsMonoid _⊗_ e\n → foldr _⊗_ e ≡ foldl _⊗_ e\n foldr-monoid-foldl monoid-⊗ = ext (λ xs → foldr-monoid-foldl₀ xs monoid-⊗)\n\n\ndata All {A : Set} (P : A → Set) : List A → Set where\n [] : All P []\n _∷_ : ∀ {x : A} {xs : List A} → P x → All P xs → All P (x ∷ xs)\n\npattern [_] z = z ∷ []\npattern [_,_] y z = y ∷ z ∷ []\npattern [_,_,_] x y z = x ∷ y ∷ z ∷ []\npattern [_,_,_,_] w x y z = w ∷ x ∷ y ∷ z ∷ []\npattern [_,_,_,_,_] v w x y z = v ∷ w ∷ x ∷ y ∷ z ∷ []\npattern [_,_,_,_,_,_] u v w x y z = u ∷ v ∷ w ∷ x ∷ y ∷ z ∷ []\n\n_ : All (_≤ 2) [ 0 , 1 , 2 ] -- These brackes desugar to ∷ and [] for List definition\n_ = [ z≤n , s≤s z≤n , s≤s (s≤s z≤n) ] -- ∷ and [] from All constructors\n\n++-assoc : ∀ {A : Set} (xs ys zs : List A)\n → (xs ++ ys) ++ zs ≡ xs ++ (ys ++ zs)\n++-assoc [] ys zs = refl\n++-assoc (x ∷ xs) ys zs =\n begin\n ((x ∷ xs) ++ ys) ++ zs ≡⟨⟩\n x ∷ (xs ++ ys) ++ zs ≡⟨ cong (x ∷_) (++-assoc xs ys zs) ⟩\n x ∷ xs ++ ys ++ zs ≡⟨⟩\n (x ∷ xs) ++ ys ++ zs\n ∎\n\nlength-++ : ∀ {A : Set} (xs ys : List A)\n → length (xs ++ ys) ≡ length xs + length ys\nlength-++ [] ys = refl\nlength-++ (x ∷ xs) ys =\n begin\n length ((x ∷ xs) ++ ys) ≡⟨⟩\n suc (length (xs ++ ys)) ≡⟨ cong suc (length-++ xs ys) ⟩\n suc (length xs + length ys) ≡⟨⟩\n suc (length xs) + length ys ≡⟨⟩\n length (x ∷ xs) + length ys\n ∎\n\n++-[] : ∀ {A : Set} (xs : List A) → xs ++ [] ≡ xs\n++-[] [] = refl\n++-[] (x ∷ xs) = cong (x ∷_) (++-[] xs)\n\ndata Any {A : Set} (P : A → Set) : List A → Set where\n here : ∀ {x : A} {xs : List A} → P x → Any P (x ∷ xs)\n there : ∀ {x : A} {xs : List A} → Any P xs → Any P (x ∷ xs)\n\ninfix 4 _∈_ _∉_\n\n_∈_ : ∀ {A : Set} (x : A) (xs : List A) → Set\nx ∈ xs = Any (x ≡_) xs\n\n_∉_ : ∀ {A : Set} (x : A) (xs : List A) → Set\nx ∉ xs = ¬ (x ∈ xs)\n\n_ : 0 ∈ [ 0 , 1 , 0 , 2 ]\n_ = here refl\n--_ = there (there (here refl))\n\n---- Left as exercise for another day\n--reverse-inv : ∀ {A : Set} (x : A) (xs : List A)\n-- → reverse (x ∷ xs) ≡ reverse xs ++ [ x ]\n--reverse-inv _ [] = refl\n--reverse-inv y (x ∷ xs) =\n-- begin\n-- reverse (y ∷ x ∷ xs) ≡⟨⟩\n-- foldl _∷`_ [ x , y ] xs ≡⟨ ? ⟩ -- LEFT FOR LATER\n-- foldl _∷`_ [ x ] xs ++ [ y ] ≡⟨⟩\n-- reverse (x ∷ xs) ++ [ y ]\n-- ∎\n---- λ y x xs → ≡ \n---- λ y x xs → foldl (λ y₁ x₁ → x₁ ∷ y₁) [ x , y ] xs ≡ foldl (λ y₁ x₁ → x₁ ∷ y₁) [ x ] xs ++ [ y ]\n-- where\n-- _∷`_ = flip _∷_\n--\n--reverse-++-distrib : ∀ {A : Set} (xs ys : List A)\n-- → reverse (xs ++ ys) ≡ reverse ys ++ reverse xs\n--reverse-++-distrib [] ys = sym (++-[] (reverse ys))\n--reverse-++-distrib (x ∷ xs) ys =\n-- begin\n-- reverse ((x ∷ xs) ++ ys) ≡⟨⟩\n-- reverse (x ∷ (xs ++ ys)) ≡⟨ reverse-inv x (xs ++ ys) ⟩\n-- reverse (xs ++ ys) ++ [ x ] ≡⟨ cong (_++ [ x ]) (reverse-++-distrib xs ys) ⟩\n-- (reverse ys ++ reverse xs) ++ [ x ] ≡⟨ ++-assoc (reverse ys) (reverse xs) [ x ] ⟩\n-- reverse ys ++ (reverse xs ++ [ x ]) ≡⟨ sym (cong (reverse ys ++_) (reverse-inv x xs)) ⟩\n-- reverse ys ++ reverse (x ∷ xs)\n-- ∎\n-- --foldl _∷`_ [ x ] (xs ++ ys) ≡⟨ ? ⟩\n-- --foldl _∷`_ [] ys ++ foldl _∷`_ [ x ] xs ≡⟨⟩\n\nexercise-823→ : ∀ {A : Set} {z : A} (xs ys : List A)\n → z ∈ (xs ++ ys) → (z ∈ xs) ⊎ (z ∈ ys)\nexercise-823→ [] [] ()\nexercise-823→ [] _ z∈[]++ys = inj₂ z∈[]++ys\nexercise-823→ (_ ∷ _) _ (here refl) = inj₁ (here refl)\nexercise-823→ (x ∷ xs) ys (there z∈xs++ys) with exercise-823→ xs ys z∈xs++ys\n... | inj₁ z∈xs = inj₁ (there z∈xs)\n... | inj₂ z∈ys = inj₂ z∈ys\n\nexercise-823← : ∀ {A : Set} {z : A} (xs ys : List A)\n → (z ∈ xs) ⊎ (z ∈ ys) → z ∈ (xs ++ ys)\nexercise-823← [] _ (inj₁ ())\nexercise-823← [] _ (inj₂ z∈ys) = z∈ys\nexercise-823← (_ ∷ _) [] (inj₂ ())\nexercise-823← (_ ∷ _) _ (inj₁ (here z∈xs)) = here z∈xs\nexercise-823← (x ∷ xs) ys (inj₁ (there z∈xs)) with exercise-823← xs ys (inj₁ z∈xs)\n... | z∈xs++ys = there z∈xs++ys\nexercise-823← (_ ∷ xs) ys (inj₂ z∈y∷ys) with exercise-823← xs ys (inj₂ z∈y∷ys)\n... | z∈xs++y∷ys = there z∈xs++y∷ys\n\nexercise-823 : ∀ {A : Set} {z : A} (xs ys : List A)\n → (z ∈ xs ++ ys) ⇔ (z ∈ xs ⊎ z ∈ ys)\nexercise-823 xs ys = record { to = exercise-823→ xs ys ; from = exercise-823← xs ys }\n", "meta": {"hexsha": "757e5a39f520c735052a6610aeaaaa848280252f", "size": 11714, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "proglangs-learning/Agda/plfa-exercises/Practice3.agda", "max_stars_repo_name": "helq/old_code", "max_stars_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "proglangs-learning/Agda/plfa-exercises/Practice3.agda", "max_issues_repo_name": "helq/old_code", "max_issues_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2020-03-10T19:20:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-07T15:39:48.000Z", "max_forks_repo_path": "proglangs-learning/Agda/plfa-exercises/Practice3.agda", "max_forks_repo_name": "helq/old_code", "max_forks_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.7210031348, "max_line_length": 131, "alphanum_fraction": 0.4609868533, "num_tokens": 5393, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942173896131, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.6720964425199438}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Properties of binary relations\n------------------------------------------------------------------------\n\n-- The contents of this module should be accessed via `Relation.Binary`.\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Relation.Binary.Definitions where\n\nopen import Agda.Builtin.Equality using (_≡_)\n\nopen import Data.Maybe.Base using (Maybe)\nopen import Data.Product using (_×_)\nopen import Data.Sum.Base using (_⊎_)\nopen import Function.Base using (_on_; flip)\nopen import Level\nopen import Relation.Binary.Core\nopen import Relation.Nullary using (Dec; ¬_)\n\nprivate\n variable\n a b c ℓ ℓ₁ ℓ₂ ℓ₃ : Level\n A : Set a\n B : Set b\n C : Set c\n\n------------------------------------------------------------------------\n-- Definitions\n------------------------------------------------------------------------\n\n-- Reflexivity - defined without an underlying equality. It could\n-- alternatively be defined as `_≈_ ⇒ _∼_` for some equality `_≈_`.\n\n-- Confusingly the convention in the library is to use the name \"refl\"\n-- for proofs of Reflexive and `reflexive` for proofs of type `_≈_ ⇒ _∼_`,\n-- e.g. in the definition of `IsEquivalence` later in this file. This\n-- convention is a legacy from the early days of the library.\n\nReflexive : Rel A ℓ → Set _\nReflexive _∼_ = ∀ {x} → x ∼ x\n\n-- Generalised symmetry.\n\nSym : REL A B ℓ₁ → REL B A ℓ₂ → Set _\nSym P Q = P ⇒ flip Q\n\n-- Symmetry.\n\nSymmetric : Rel A ℓ → Set _\nSymmetric _∼_ = Sym _∼_ _∼_\n\n-- Generalised transitivity.\n\nTrans : REL A B ℓ₁ → REL B C ℓ₂ → REL A C ℓ₃ → Set _\nTrans P Q R = ∀ {i j k} → P i j → Q j k → R i k\n\n-- A flipped variant of generalised transitivity.\n\nTransFlip : REL A B ℓ₁ → REL B C ℓ₂ → REL A C ℓ₃ → Set _\nTransFlip P Q R = ∀ {i j k} → Q j k → P i j → R i k\n\n-- Transitivity.\n\nTransitive : Rel A ℓ → Set _\nTransitive _∼_ = Trans _∼_ _∼_ _∼_\n\n-- Generalised antisymmetry\n\nAntisym : REL A B ℓ₁ → REL B A ℓ₂ → REL A B ℓ₃ → Set _\nAntisym R S E = ∀ {i j} → R i j → S j i → E i j\n\n-- Antisymmetry.\n\nAntisymmetric : Rel A ℓ₁ → Rel A ℓ₂ → Set _\nAntisymmetric _≈_ _≤_ = Antisym _≤_ _≤_ _≈_\n\n-- Irreflexivity - this is defined terms of the underlying equality.\n\nIrreflexive : REL A B ℓ₁ → REL A B ℓ₂ → Set _\nIrreflexive _≈_ _<_ = ∀ {x y} → x ≈ y → ¬ (x < y)\n\n-- Asymmetry.\n\nAsymmetric : Rel A ℓ → Set _\nAsymmetric _<_ = ∀ {x y} → x < y → ¬ (y < x)\n\n-- Generalised connex - exactly one of the two relations holds.\n\nConnex : REL A B ℓ₁ → REL B A ℓ₂ → Set _\nConnex P Q = ∀ x y → P x y ⊎ Q y x\n\n-- Totality.\n\nTotal : Rel A ℓ → Set _\nTotal _∼_ = Connex _∼_ _∼_\n\n-- Generalised trichotomy - exactly one of three types has a witness.\n\ndata Tri (A : Set a) (B : Set b) (C : Set c) : Set (a ⊔ b ⊔ c) where\n tri< : ( a : A) (¬b : ¬ B) (¬c : ¬ C) → Tri A B C\n tri≈ : (¬a : ¬ A) ( b : B) (¬c : ¬ C) → Tri A B C\n tri> : (¬a : ¬ A) (¬b : ¬ B) ( c : C) → Tri A B C\n\n-- Trichotomy.\n\nTrichotomous : Rel A ℓ₁ → Rel A ℓ₂ → Set _\nTrichotomous _≈_ _<_ = ∀ x y → Tri (x < y) (x ≈ y) (x > y)\n where _>_ = flip _<_\n\n-- Generalised maximum element.\n\nMax : REL A B ℓ → B → Set _\nMax _≤_ T = ∀ x → x ≤ T\n\n-- Maximum element.\n\nMaximum : Rel A ℓ → A → Set _\nMaximum = Max\n\n-- Generalised minimum element.\n\nMin : REL A B ℓ → A → Set _\nMin R = Max (flip R)\n\n-- Minimum element.\n\nMinimum : Rel A ℓ → A → Set _\nMinimum = Min\n\n-- Unary relations respecting a binary relation.\n\n_⟶_Respects_ : (A → Set ℓ₁) → (B → Set ℓ₂) → REL A B ℓ₃ → Set _\nP ⟶ Q Respects _∼_ = ∀ {x y} → x ∼ y → P x → Q y\n\n-- Unary relation respects a binary relation.\n\n_Respects_ : (A → Set ℓ₁) → Rel A ℓ₂ → Set _\nP Respects _∼_ = P ⟶ P Respects _∼_\n\n-- Right respecting - relatedness is preserved on the right by equality.\n\n_Respectsʳ_ : REL A B ℓ₁ → Rel B ℓ₂ → Set _\n_∼_ Respectsʳ _≈_ = ∀ {x} → (x ∼_) Respects _≈_\n\n-- Left respecting - relatedness is preserved on the left by equality.\n\n_Respectsˡ_ : REL A B ℓ₁ → Rel A ℓ₂ → Set _\nP Respectsˡ _∼_ = ∀ {y} → (flip P y) Respects _∼_\n\n-- Respecting - relatedness is preserved on both sides by equality\n\n_Respects₂_ : Rel A ℓ₁ → Rel A ℓ₂ → Set _\nP Respects₂ _∼_ = (P Respectsʳ _∼_) × (P Respectsˡ _∼_)\n\n-- Substitutivity - any two related elements satisfy exactly the same\n-- set of unary relations. Note that only the various derivatives\n-- of propositional equality can satisfy this property.\n\nSubstitutive : Rel A ℓ₁ → (ℓ₂ : Level) → Set _\nSubstitutive {A = A} _∼_ p = (P : A → Set p) → P Respects _∼_\n\n-- Decidability - it is possible to determine whether a given pair of\n-- elements are related.\n\nDecidable : REL A B ℓ → Set _\nDecidable _∼_ = ∀ x y → Dec (x ∼ y)\n\n-- Weak decidability - it is sometimes possible to determine if a given\n-- pair of elements are related.\n\nWeaklyDecidable : REL A B ℓ → Set _\nWeaklyDecidable _∼_ = ∀ x y → Maybe (x ∼ y)\n\n-- Propositional equality is decidable for the type.\n\nDecidableEquality : (A : Set a) → Set _\nDecidableEquality A = Decidable {A = A} _≡_\n\n-- Irrelevancy - all proofs that a given pair of elements are related\n-- are indistinguishable.\n\nIrrelevant : REL A B ℓ → Set _\nIrrelevant _∼_ = ∀ {x y} (a b : x ∼ y) → a ≡ b\n\n-- Recomputability - we can rebuild a relevant proof given an\n-- irrelevant one.\n\nRecomputable : REL A B ℓ → Set _\nRecomputable _∼_ = ∀ {x y} → .(x ∼ y) → x ∼ y\n\n-- Universal - all pairs of elements are related\n\nUniversal : REL A B ℓ → Set _\nUniversal _∼_ = ∀ x y → x ∼ y\n\n-- Non-emptiness - at least one pair of elements are related.\n\nrecord NonEmpty {A : Set a} {B : Set b}\n (T : REL A B ℓ) : Set (a ⊔ b ⊔ ℓ) where\n constructor nonEmpty\n field\n {x} : A\n {y} : B\n proof : T x y\n\n\n\n------------------------------------------------------------------------\n-- DEPRECATED NAMES\n------------------------------------------------------------------------\n-- Please use the new names as continuing support for the old names is\n-- not guaranteed.\n\n-- Version 1.1\n\nConn = Connex\n{-# WARNING_ON_USAGE Conn\n\"Warning: Conn was deprecated in v1.1.\nPlease use Connex instead.\"\n#-}\n", "meta": {"hexsha": "9c29757cba64b74015116dceb3e2e2067578fcd2", "size": 6039, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Relation/Binary/Definitions.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Relation/Binary/Definitions.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Relation/Binary/Definitions.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 26.9598214286, "max_line_length": 74, "alphanum_fraction": 0.592482199, "num_tokens": 1968, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673087708699, "lm_q2_score": 0.8267117898012104, "lm_q1q2_score": 0.672006987704859}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Cubical.Foundations.TotalFiber where\n\nopen import Cubical.Core.Everything\nopen import Cubical.Data.Prod\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Surjection\nopen import Cubical.Foundations.Isomorphism\nopen import Cubical.Foundations.Equiv\nopen import Cubical.HITs.PropositionalTruncation\n\nprivate\n variable\n ℓ ℓ' : Level\n\nmodule _ {A : Type ℓ} {B : Type ℓ'} (f : A → B) where\n private\n ℓ'' : Level\n ℓ'' = ℓ-max ℓ ℓ'\n\n LiftA : Type ℓ''\n LiftA = Lift {j = ℓ'} A\n\n Total-fiber : Type ℓ''\n Total-fiber = Σ B \\ b → fiber f b\n\n A→Total-fiber : A → Total-fiber\n A→Total-fiber a = f a , a , refl\n\n Total-fiber→A : Total-fiber → A\n Total-fiber→A (b , a , p) = a\n\n Total-fiber→A→Total-fiber : ∀ t → A→Total-fiber (Total-fiber→A t) ≡ t\n Total-fiber→A→Total-fiber (b , a , p) i = p i , a , λ j → p (i ∧ j)\n\n A→Total-fiber→A : ∀ a → Total-fiber→A (A→Total-fiber a) ≡ a\n A→Total-fiber→A a = refl\n\n LiftA→Total-fiber : LiftA → Total-fiber\n LiftA→Total-fiber x = A→Total-fiber (lower x)\n\n Total-fiber→LiftA : Total-fiber → LiftA\n Total-fiber→LiftA x = lift (Total-fiber→A x)\n\n Total-fiber→LiftA→Total-fiber : ∀ t → LiftA→Total-fiber (Total-fiber→LiftA t) ≡ t\n Total-fiber→LiftA→Total-fiber (b , a , p) i = p i , a , λ j → p (i ∧ j)\n\n LiftA→Total-fiber→LiftA : ∀ a → Total-fiber→LiftA (LiftA→Total-fiber a) ≡ a\n LiftA→Total-fiber→LiftA a = refl\n\n A≡Total : Lift A ≡ Total-fiber\n A≡Total = isoToPath (iso\n LiftA→Total-fiber\n Total-fiber→LiftA\n Total-fiber→LiftA→Total-fiber\n LiftA→Total-fiber→LiftA)\n\n -- HoTT Lemma 4.8.2\n A≃Total : Lift A ≃ Total-fiber\n A≃Total = isoToEquiv (iso\n LiftA→Total-fiber\n Total-fiber→LiftA\n Total-fiber→LiftA→Total-fiber\n LiftA→Total-fiber→LiftA)\n", "meta": {"hexsha": "ef5d768eb2cd9fcfe60d005935789bb126d4e11c", "size": 1832, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Foundations/TotalFiber.agda", "max_stars_repo_name": "limemloh/cubical", "max_stars_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Foundations/TotalFiber.agda", "max_issues_repo_name": "limemloh/cubical", "max_issues_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Foundations/TotalFiber.agda", "max_forks_repo_name": "limemloh/cubical", "max_forks_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.7575757576, "max_line_length": 83, "alphanum_fraction": 0.6621179039, "num_tokens": 711, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.870597268408361, "lm_q2_score": 0.7718435030872968, "lm_q1q2_score": 0.671964845426541}} {"text": "{-# OPTIONS --without-K #-}\r\n\r\nmodule P where\r\n\r\nopen import Data.Empty\r\nopen import Data.Unit\r\nopen import Data.Sum\r\nopen import Data.Product\r\nopen import Relation.Binary.PropositionalEquality\r\n\r\n------------------------------------------------------------------------------\r\n\r\n-- For now, a groupoid is just a set\r\n\r\nGroupoid : Set₁\r\nGroupoid = Set\r\n\r\nmutual \r\n\r\n-- types\r\n data B : Set where\r\n ZERO : B \r\n ONE : B\r\n _+_ : B → B → B\r\n _*_ : B → B → B\r\n _~_ : {b : B} → ⟦ b ⟧ → ⟦ b ⟧ → B\r\n\r\n-- values\r\n ⟦_⟧ : B → Groupoid\r\n ⟦ ZERO ⟧ = ⊥\r\n ⟦ ONE ⟧ = ⊤\r\n ⟦ b₁ + b₂ ⟧ = ⟦ b₁ ⟧ ⊎ ⟦ b₂ ⟧\r\n ⟦ b₁ * b₂ ⟧ = ⟦ b₁ ⟧ × ⟦ b₂ ⟧\r\n ⟦ v₁ ~ v₂ ⟧ = v₁ ≡ v₂\r\n\r\n-- pointed types\r\ndata PB : Set where\r\n POINTED : Σ B (λ b → ⟦ b ⟧) → PB\r\n RECIP : PB → PB \r\n\r\n-- lift B type constructors to pointed types\r\n\r\n_++_ : PB → PB → PB\r\n(POINTED (b₁ , v₁)) ++ (POINTED (b₂ , v₂)) = POINTED (b₁ + b₂ , inj₁ v₁)\r\n_ ++ _ = {!!}\r\n\r\n_**_ : PB → PB → PB\r\n(POINTED (b₁ , v₁)) ** (POINTED (b₂ , v₂)) = POINTED (b₁ * b₂ , (v₁ , v₂))\r\n_ ** _ = {!!}\r\n\r\n-- All the pi combinators now work on pointed types\r\n\r\ndata _⟷_ : PB → PB → Set₁ where\r\n swap⋆ : {pb₁ pb₂ : PB} → (pb₁ ** pb₂) ⟷ (pb₂ ** pb₁)\r\n eta : {pb : PB} → POINTED (ONE , tt) ⟷ RECIP pb\r\n\r\n-- induction principle to reason about identities; needed ???\r\n\r\nind : {b : B} → \r\n (C : (v₁ v₂ : ⟦ b ⟧) → (p : ⟦ _~_ {b} v₁ v₂ ⟧) → Set) → \r\n (c : (v : ⟦ b ⟧) → C v v refl) → \r\n (v₁ v₂ : ⟦ b ⟧) → (p : ⟦ _~_ {b} v₁ v₂ ⟧) → C v₁ v₂ p\r\nind C c v .v refl = c v\r\n\r\n-- Examples\r\n\r\nBool : B\r\nBool = ONE + ONE\r\n\r\nfalse : ⟦ Bool ⟧\r\nfalse = inj₁ tt\r\n\r\ntrue : ⟦ Bool ⟧\r\ntrue = inj₂ tt\r\n\r\npb1 : PB\r\npb1 = POINTED (Bool , false)\r\n\r\npb2 : PB\r\npb2 = POINTED (Bool , true)\r\n\r\nFalseID : B\r\nFalseID = _~_ {Bool} false false\r\n\r\npb3 : PB \r\npb3 = POINTED (FalseID , refl)\r\n\r\nFalseID^2 : B\r\nFalseID^2 = _~_ {FalseID} refl refl\r\n\r\npb4 : PB\r\npb4 = POINTED (FalseID^2 , refl)\r\n\r\n------------------------------------------------------------------------------\r\n\r\n\r\n", "meta": {"hexsha": "c8bb82142c853b3d48b3c9e71bf6518c9e42305f", "size": 1987, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "P.agda", "max_stars_repo_name": "JacquesCarette/pi-dual", "max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 14, "max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z", "max_issues_repo_path": "P.agda", "max_issues_repo_name": "JacquesCarette/pi-dual", "max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z", "max_forks_repo_path": "P.agda", "max_forks_repo_name": "JacquesCarette/pi-dual", "max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z", "avg_line_length": 20.4845360825, "max_line_length": 79, "alphanum_fraction": 0.4620030196, "num_tokens": 749, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972818382005, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6719648420850114}} {"text": "------------------------------------------------------------------------------\n-- Properties of the divisibility relation\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOTC.Data.Nat.Divisibility.By0.PropertiesATP where\n\nopen import FOTC.Base\nopen import FOTC.Data.Nat\nopen import FOTC.Data.Nat.Divisibility.By0\nopen import FOTC.Data.Nat.Inequalities\nopen import FOTC.Data.Nat.Inequalities.PropertiesATP\nopen import FOTC.Data.Nat.PropertiesATP\n\n------------------------------------------------------------------------------\n-- Any positive number divides 0.\npostulate S∣0 : ∀ n → succ₁ n ∣ zero\n{-# ATP prove S∣0 #-}\n\n-- 0 divides 0.\npostulate 0∣0 : zero ∣ zero\n{-# ATP prove 0∣0 #-}\n\n-- The divisibility relation is reflexive.\npostulate ∣-refl : ∀ {n} → N n → n ∣ n\n{-# ATP prove ∣-refl *-leftIdentity #-}\n\n-- If x divides y and z then x divides y ∸ z.\npostulate\n x∣y→x∣z→x∣y∸z-helper : ∀ {m n o k k'} → N m → N k → N k' →\n n ≡ k * m →\n o ≡ k' * m →\n n ∸ o ≡ (k ∸ k') * m\n{-# ATP prove x∣y→x∣z→x∣y∸z-helper *∸-leftDistributive #-}\n\nx∣y→x∣z→x∣y∸z : ∀ {m n o} → N m → N n → N o → m ∣ n → m ∣ o → m ∣ n ∸ o\nx∣y→x∣z→x∣y∸z Nm Nn No (k , Nk , h₁) (k' , Nk' , h₂) =\n k ∸ k' , ∸-N Nk Nk' , x∣y→x∣z→x∣y∸z-helper Nm Nk Nk' h₁ h₂\n\n-- If x divides y and z then x divides y + z.\npostulate\n x∣y→x∣z→x∣y+z-helper : ∀ {m n o k k'} → N m → N k → N k' →\n n ≡ k * m →\n o ≡ k' * m →\n n + o ≡ (k + k') * m\n{-# ATP prove x∣y→x∣z→x∣y+z-helper *+-leftDistributive #-}\n\nx∣y→x∣z→x∣y+z : ∀ {m n o} → N m → N n → N o → m ∣ n → m ∣ o → m ∣ n + o\nx∣y→x∣z→x∣y+z Nm Nn No (k , Nk , h₁) (k' , Nk' , h₂) =\n k + k' , +-N Nk Nk' , x∣y→x∣z→x∣y+z-helper Nm Nk Nk' h₁ h₂\n\n-- If x divides y and y is positive, then x ≤ y.\npostulate x∣S→x≤S-helper₁ : ∀ {m n} → succ₁ n ≡ zero * m → ⊥\n{-# ATP prove x∣S→x≤S-helper₁ #-}\n\n-- Nice proof by the ATPa.\npostulate x∣S→x≤S-helper₂ : ∀ {m n o} → N m → N n → N o →\n succ₁ n ≡ succ₁ o * m →\n m ≤ succ₁ n\n{-# ATP prove x∣S→x≤S-helper₂ x≤x+y *-N #-}\n\nx∣S→x≤S : ∀ {m n} → N m → N n → m ∣ (succ₁ n) → m ≤ succ₁ n\nx∣S→x≤S Nm Nn (.zero , nzero , Sn≡0*m) = ⊥-elim (x∣S→x≤S-helper₁ Sn≡0*m)\nx∣S→x≤S Nm Nn (.(succ₁ k) , nsucc {k} Nk , Sn≡Sk*m) =\n x∣S→x≤S-helper₂ Nm Nn Nk Sn≡Sk*m\n", "meta": {"hexsha": "52f42a50820fd5b658651104504b683bfadec24a", "size": 2584, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/FOTC/Data/Nat/Divisibility/By0/PropertiesATP.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/FOTC/Data/Nat/Divisibility/By0/PropertiesATP.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/FOTC/Data/Nat/Divisibility/By0/PropertiesATP.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 36.9142857143, "max_line_length": 78, "alphanum_fraction": 0.4574303406, "num_tokens": 1036, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.849971190859164, "lm_q2_score": 0.7905303162021596, "lm_q1q2_score": 0.6719279942726211}} {"text": "{-# OPTIONS --without-K --exact-split --safe #-}\n\nmodule Identity where\n\nopen import Basic_Types\n\n-- ------------------------------------\n-- the identity type, or path type\ninfix 1 _≡_\n\ndata _≡_ {A : Set} : A → A → Set where\n refl : ∀ (a : A) → a ≡ a\n\n{-# BUILTIN EQUALITY _≡_ #-}\n\n\n-- path induction\np-ind : ∀ {A : Set} {B : ∀ (x y : A) (p : x ≡ y) → Set} →\n (∀ (z : A) → B z z (refl z)) → ∀ (x y : A) (p : x ≡ y) → B x y p\np-ind f z z (refl z) = f z\n-- notice here that, in the proof system of agda, the induction principle is\n-- builtin for a data type, for their constructor is given expicitly. Hence,\n-- one way to prove identity type is to use p-ind, which is itself proved by\n-- agda using implicit path induction, or we can use agda's induction expicitly\n-- which is the case when we construct apd and ass-p\n\n-- the groupoid structure of path type\nconcat : ∀ {A : Set} → ∀ (x y : A) (p : x ≡ y) → ∀ (z : A) (q : y ≡ z) → x ≡ z\nconcat {A} x x (refl x) x (refl x) = refl x\n\ninfix 3 _∙_\n_∙_ : ∀ {A : Set} {x y z : A} → ∀ (p : x ≡ y) (q : y ≡ z) → x ≡ z\n_∙_ {_} {x} {y} {z} p q = concat x y p z q\n\ninv : ∀ {A : Set} {x y : A} → ∀ (p : x ≡ y) → y ≡ x\ninv {_} {x} {x} (refl x) = refl x\n\n-- the groupoid structure of identities, viewed as higher paths\np-ass : ∀ {A : Set} {x y z w : A} → ∀ (p : x ≡ y) (q : y ≡ z) (r : z ≡ w) →\n p ∙ (q ∙ r) ≡ (p ∙ q) ∙ r\np-ass {_} {x} {x} {x} {x} (refl x) (refl x) (refl x) =\n refl (((refl x) ∙ (refl x)) ∙ (refl x))\n\nleft_unit : ∀ {A : Set} {x y : A} → ∀ (p : x ≡ y) → (refl x) ∙ p ≡ p\nleft_unit {_} {x} {x} (refl x) = refl (refl x)\n\nright_unit : ∀ {A : Set} {x y : A} → ∀ (p : x ≡ y) → p ∙ (refl y) ≡ p\nright_unit {_} {x} {x} (refl x) = refl (refl x)\n\nrinv-unit : ∀ {A : Set} {x y : A} → ∀ (p : x ≡ y) → (inv p) ∙ p ≡ refl y\nrinv-unit {_} {x} {x} (refl x) = refl (refl x)\n\nlinv-unit : ∀ {A : Set} {x y : A} → ∀ (p : x ≡ y) → p ∙ (inv p) ≡ refl x\nlinv-unit {_} {x} {x} (refl x) = refl (refl x)\n\ninvinv : ∀ {A : Set} {x y : A} → ∀ (p : x ≡ y) → inv (inv p) ≡ p\ninvinv {_} {x} {x} (refl x) = refl (refl x)\n\n-- ------------------------------------\n-- loop spaces\nΩ : ∀ {A : Set} (a : A) → Set\nΩ {_} a = a ≡ a\n\n-- commutativity on 2-dimensional loops\n-- prove the commutativity by proving a general result in the groupoid\npwr : ∀ {A : Set} {a b c : A} {p q : a ≡ b} → ∀ (r : b ≡ c) → ∀ (α : p ≡ q) →\n p ∙ r ≡ q ∙ r\npwr {_} {_} {b} {b} {p} {p} (refl b) (refl p) = refl (p ∙ (refl b))\n\npwl : ∀ {A : Set} {a b c : A} {q r : b ≡ c} → ∀ (p : a ≡ b) → ∀ (β : q ≡ r) →\n p ∙ q ≡ p ∙ r\npwl {_} {_} {_} {_} {q} {q} p (refl q) = refl (p ∙ q)\n\n_*_ : ∀ {A : Set} {a b c : A} {p q : a ≡ b} {r s : b ≡ c} →\n ∀ (α : p ≡ q) (β : r ≡ s) → p ∙ r ≡ q ∙ s\n_*_ {_} {_} {_} {_} {p} {q} {r} {s} α β = α∙r ∙ q∙β\n where α∙r : p ∙ r ≡ q ∙ r\n α∙r = pwr r α\n q∙β : q ∙ r ≡ q ∙ s\n q∙β = pwl q β\n\n_*'_ : ∀ {A : Set} {a b c : A} {p q : a ≡ b} {r s : b ≡ c} →\n ∀ (α : p ≡ q) (β : r ≡ s) → p ∙ r ≡ q ∙ s\n_*'_ {_} {_} {_} {_} {p} {q} {r} {s} α β = p∙β ∙ α∙s\n where p∙β : p ∙ r ≡ p ∙ s\n p∙β = pwl p β\n α∙s : p ∙ s ≡ q ∙ s\n α∙s = pwr s α\n\npwr-ru : ∀ {A : Set} {a : A} (p : a ≡ a) (α : refl a ≡ p) →\n pwr (refl a) α ≡ α ∙ (inv (right_unit p))\npwr-ru {_} {_} (refl a) (refl (refl a)) = refl (refl (refl a))\n\npwl-lu : ∀ {A : Set} {a : A} (p : a ≡ a) (α : refl a ≡ p) →\n pwl (refl a) α ≡ α ∙ (inv (left_unit p))\npwl-lu {_} {_} (refl a) (refl (refl a)) = refl (refl (refl a))\n\n*≡*' : ∀ {A : Set} {a b c : A} {p q : a ≡ b} {r s : b ≡ c} →\n ∀ (α : p ≡ q) (β : r ≡ s) → (α * β) ≡ (α *' β)\n*≡*' {_} {a} {a} {a} {refl a} {refl a} {refl a} {refl a}\n (refl (refl a)) (refl (refl a))\n = refl ((refl ((refl a) ∙ (refl a))) ∙ (refl ((refl a) ∙ (refl a))))\n\n∙≡* : ∀ {A : Set} {a : A} → ∀ (α β : Ω (refl a)) → α ∙ β ≡ α * β\n∙≡* {_} {a} α β = inv (redua)\n where redul : α * β ≡ α ∙ (pwl (refl a) β)\n redul = (pwr (pwl (refl a) β) (pwr-ru (refl a) α)) ∙\n (pwr (pwl (refl a) β) (right_unit α))\n redua : α * β ≡ α ∙ β\n redua = (redul ∙ (pwl α (pwl-lu (refl a) β))) ∙ (pwl α (right_unit β))\n\n*'≡∙ : ∀ {A : Set} {a : A} → ∀ (α β : Ω (refl a)) → α *' β ≡ β ∙ α\n*'≡∙ {_} {a} α β = redua'\n where redul' : α *' β ≡ β ∙ (pwr (refl a) α)\n redul' = (pwr (pwr (refl a) α) (pwl-lu (refl a) β)) ∙\n (pwr (pwr (refl a) α) (right_unit β))\n redua' : α *' β ≡ β ∙ α\n redua' = redul' ∙ ((pwl β (pwr-ru (refl a) α)) ∙ (pwl β (right_unit α)))\n\n-- finally, we are able to prove that the higher path group is commutative\nΩ²-comm : ∀ {A : Set} {a : A} → ∀ (α β : Ω (refl a)) → α ∙ β ≡ β ∙ α\nΩ²-comm α β = ((∙≡* α β) ∙ (*≡*' α β)) ∙ (*'≡∙ α β)\n\n-- ------------------------------------\n-- functions behave functorially\n-- the action on paths\nap : ∀ {A B : Set} {x y : A} → ∀ (f : A → B) (p : x ≡ y) → f x ≡ f y\nap {_} {_} {x} {x} f (refl x) = refl (f x)\n\n-- ap acts like a functor\nap∙ : ∀ {A B : Set} {x y z : A} → ∀ (f : A → B) (p : x ≡ y) (q : y ≡ z) →\n ap f (p ∙ q) ≡ (ap f p) ∙ (ap f q)\nap∙ {_} {_} {x} {x} {x} f (refl x) (refl x) = inv (left_unit (refl (f x)))\n\napinv : ∀ {A B : Set} {x y : A} → ∀ (f : A → B) (p : x ≡ y) →\n ap f (inv p) ≡ inv (ap f p)\napinv {_} {_} {x} {x} f (refl x) = refl (refl (f x))\n\napcomp : ∀ {A B C : Set} {x y : A} → ∀ (f : A → B) (g : B → C) (p : x ≡ y) →\n ap g (ap f p) ≡ ap (comp g f) p\napcomp {_} {_} {_} {x} {x} f g (refl x) = refl (refl (g (f x)))\n\napid : ∀ {A : Set} {x y : A} → ∀ (p : x ≡ y) →\n ap id p ≡ p\napid {_} {x} {x} (refl x) = refl (refl x)\n\n-- the transport action, which is action on dependent types\ntr : ∀ {A : Set} {B : A → Set} → ∀ {x y : A} → ∀ (p : x ≡ y) → B x → B y\ntr {A} {B} {x} {x} (refl x) = id\n\n<<<<<<< HEAD\n=======\ntrc : ∀ {A B : Set} {x y : A} (p : x ≡ y) (b : B) → tr {A} {λ x → B} p b ≡ b\ntrc {_} {_} {x} {x} (refl x) b = refl b\n>>>>>>> a0dc66dca08059f740d9290f3d1cad1bb007d721\n-- If you think about this, this is not obvious from a classical point of view.\n-- The existence of the transport function tells us that the dependent type\n-- B : A → Set is always going to be continuous, since whenever we have a path\n-- in the base A from x to y, and whenever we're given a point in B x, we can\n-- construct a value in B y, using the path in the base.\n\n-- path lifting\nlift : ∀ {A : Set} {B : A → Set} → ∀ {x y : A} → ∀ (p : x ≡ y) → ∀ (b : B x) →\n (x , b) ≡ y , (tr {A} {B} p b)\nlift {A} {B} {x} {x} (refl x) b = refl (x , b)\n\n-- the dependent mapping functor\n<<<<<<< HEAD\napd : ∀ {A : Set} {B : A → Set} {x y : A} → ∀ (f : (∀ (a : A) → B a)) →\n ∀ (p : x ≡ y) → tr {A} {B} {x} {y} p (f x) ≡ f y\napd {A} {B} {x} {x} f (refl x) = refl (tr {A} {B} {x} {x} (refl x) (f x))\n\n-- the dependent and non-dependent ap(d) is closely related\ntrc : ∀ {A B : Set} {x y : A} (p : x ≡ y) (b : B) → tr {A} {λ x → B} p b ≡ b\ntrc {_} {_} {x} {x} (refl x) b = refl b\n\n-- and now we can prove the following:\napd≡ap : ∀ {A B : Set} {x y : A} →\n ∀ (f : A → B) (p : x ≡ y) → apd f p ≡ trc p (f x) ∙ (ap f p)\napd≡ap {_} {_} {x} {x} f (refl x) = refl (refl (f x))\n\n-- some useful properties about transport\ntr∙ : ∀ {A : Set} {B : A → Set} {x y z : A} → ∀ (p : x ≡ y) (q : y ≡ z) →\n ∀ (b : B x) → tr {A} {B} q (tr {A} {B} p b) ≡ tr {A} {B} (p ∙ q) b\ntr∙ {_} {_} {x} {x} {x} (refl x) (refl x) b = refl b\n\ntrcomp : ∀ {A B : Set} {P : B → Set} {x y : A} → ∀ (f : A → B) (p : x ≡ y) →\n ∀ (b : P (f x)) → tr {A} {λ a → P (f a)} p b ≡ tr {B} {P} (ap f p) b\ntrcomp {_} {_} {_} {x} {x} f (refl x) b = refl b\n\ntrhi : ∀ {A : Set} {P Q : A → Set} {x y : A} → ∀ (f : ∀ (x : A) → P x → Q x) →\n ∀ (p : x ≡ y) (b : P x) → f y (tr {A} {P} p b) ≡ tr {A} {Q} p (f x b)\ntrhi {_} {_} {_} {x} {x} f (refl x) b = refl (f x b)\n=======\napd : ∀ {A : Set} {B : A → Set} → ∀ (f : (∀ (a : A) → B a)) →\n ∀ (x y : A) (p : x ≡ y) → tr {A} {B} {x} {y} p (f x) ≡ f y\napd {A} {B} f x x (refl x) = refl (tr {A} {B} {x} {x} (refl x) (f x))\n\n-- apd helps to construct a\n>>>>>>> a0dc66dca08059f740d9290f3d1cad1bb007d721\n", "meta": {"hexsha": "2b98effbdd137cabbbd32446704a078c5694a0d5", "size": 8027, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "HoTT/Identity.agda", "max_stars_repo_name": "andyfreeyy/agda_and_math", "max_stars_repo_head_hexsha": "76b9ef64626b6d3bbb7ace4f1a16aeb447c54328", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-03-23T09:01:42.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-24T10:56:36.000Z", "max_issues_repo_path": "HoTT/Identity.agda", "max_issues_repo_name": "andyfreeyy/agda_and_math", "max_issues_repo_head_hexsha": "76b9ef64626b6d3bbb7ace4f1a16aeb447c54328", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "HoTT/Identity.agda", "max_forks_repo_name": "andyfreeyy/agda_and_math", "max_forks_repo_head_hexsha": "76b9ef64626b6d3bbb7ace4f1a16aeb447c54328", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.9353233831, "max_line_length": 80, "alphanum_fraction": 0.4373987791, "num_tokens": 3843, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711642563824, "lm_q2_score": 0.7905303236047049, "lm_q1q2_score": 0.6719279795342658}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Pointwise lifting of relations over Vector\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Vec.Functional.Relation.Binary.Pointwise where\n\nopen import Data.Fin.Base\nopen import Data.Nat.Base\nopen import Data.Vec.Functional as VF hiding (map)\nopen import Level using (Level)\nopen import Relation.Binary\n\nprivate\n variable\n a b r s ℓ : Level\n A : Set a\n B : Set b\n\n------------------------------------------------------------------------\n-- Definition\n\nPointwise : REL A B ℓ → ∀ {n} → Vector A n → Vector B n → Set ℓ\nPointwise R xs ys = ∀ i → R (xs i) (ys i)\n\n------------------------------------------------------------------------\n-- Operations\n\nmodule _ {R : REL A B r} {S : REL A B s} where\n\n map : R ⇒ S → ∀ {n} → Pointwise R ⇒ Pointwise S {n = n}\n map f rs i = f (rs i)\n", "meta": {"hexsha": "360dc46540b3957409615ddee1b6ca2bd269230a", "size": 968, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/Vec/Functional/Relation/Binary/Pointwise.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/Vec/Functional/Relation/Binary/Pointwise.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/Vec/Functional/Relation/Binary/Pointwise.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 26.8888888889, "max_line_length": 72, "alphanum_fraction": 0.4524793388, "num_tokens": 217, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9005297914570319, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6719203968754549}} {"text": "{-\nModule in which the Grothendieck Group (\"Groupification\") of a commutative monoid is defined.\n-}\n{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.CommMonoid.GrothendieckGroup where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Isomorphism\nopen import Cubical.Foundations.Structure\n\nopen import Cubical.Algebra.Monoid\nopen import Cubical.Algebra.CommMonoid\nopen import Cubical.Algebra.CommMonoid.CommMonoidProd\nopen import Cubical.Algebra.Group\nopen import Cubical.Algebra.Group.Morphisms\nopen import Cubical.Algebra.AbGroup\n\nopen import Cubical.HITs.SetQuotients.Base\nopen import Cubical.HITs.SetQuotients.Properties\n\nopen import Cubical.Relation.Binary.Base\n\n\nprivate\n variable\n ℓ ℓ' : Level\n\n\nmodule _ (M : CommMonoid ℓ) where\n open BinaryRelation\n\n M² : CommMonoid _\n M² = CommMonoidProd M M\n\n open CommMonoidStr ⦃...⦄\n private\n instance\n _ = snd M\n _ = snd M²\n\n R : ⟨ M² ⟩ → ⟨ M² ⟩ → Type _\n R (a₁ , b₁) (a₂ , b₂) = Σ[ k ∈ ⟨ M ⟩ ] k · (a₁ · b₂) ≡ k · (b₁ · a₂)\n\n M²/R : Type _\n M²/R = ⟨ M² ⟩ / R\n\n 0/R : M²/R\n 0/R = [ ε , ε ]\n\n private\n _+/_ : M²/R → M²/R → M²/R\n x +/ y = setQuotBinOp isReflR isReflR _·_ isCongR x y\n where\n isReflR : isRefl R\n isReflR (a , b) = ε , cong (ε ·_) (·Comm a b)\n\n isCongR : ∀ u u' v v' → R u u' → R v v' → R (u · v) (u' · v')\n isCongR (a₁ , b₁) (a₂ , b₂) (a₃ , b₃) (a₄ , b₄) (k , p) (s , q) = k · s , proof\n where\n proof =\n (k · s) · ((a₁ · a₃) · (b₂ · b₄)) ≡⟨ lemma ⟩\n (k · (a₁ · b₂)) · (s · (a₃ · b₄)) ≡⟨ cong₂ _·_ p q ⟩\n (k · (b₁ · a₂)) · (s · (b₃ · a₄)) ≡⟨ sym lemma ⟩\n (k · s) · ((b₁ · b₃) · (a₂ · a₄)) ∎\n where\n rExp : ∀ {x y z} → x ≡ y → x · z ≡ y · z\n rExp r = cong₂ _·_ r refl\n\n lExp : ∀ {x y z} → x ≡ y → z · x ≡ z · y\n lExp r = cong₂ _·_ refl r\n\n -- remove proof when MonoidSolver is done\n lemma : ∀ {k s a b c d} → (k · s) · ((a · b) · (c · d)) ≡ (k · (a · c)) · (s · (b · d))\n lemma = sym (·Assoc _ _ _) ∙ lExp (\n (·Assoc _ _ _) ∙ (·Assoc _ _ _) ∙ rExp (\n ·Comm _ _ ∙ (·Assoc _ _ _) ∙ (·Assoc _ _ _) ∙ rExp (\n ·Comm _ _ ∙ (·Assoc _ _ _)\n ) ∙ sym (·Assoc _ _ _)\n ) ∙ sym (·Assoc _ _ _) ∙ lExp (sym (·Assoc _ _ _))\n ) ∙ (·Assoc _ _ _)\n\n -/_ : M²/R → M²/R\n -/_ = setQuotUnaryOp swap h\n where\n swap : ⟨ M² ⟩ → ⟨ M² ⟩\n swap = λ (a , b) → b , a\n\n h : ∀ u v → R u v → R (swap u) (swap v)\n h _ _ (k , p) = k , sym p\n\n assoc/R : (x y z : M²/R) → x +/ ( y +/ z) ≡ (x +/ y) +/ z\n assoc/R = elimProp3 (λ x y z → squash/ _ _) (λ u v w → cong [_] (·Assoc _ _ _))\n\n rid/R : (x : M²/R) → x +/ 0/R ≡ x\n rid/R = elimProp (λ x → squash/ _ _) (λ u → cong [_] (·IdR u))\n\n rinv/R : (x : M²/R) → x +/ (-/ x) ≡ 0/R\n rinv/R = elimProp (λ x → squash/ _ _)\n (λ (a , b) → eq/ _ _ (ε , cong (λ x → ε · (x · ε)) (·Comm _ _)))\n\n comm/R : (x y : M²/R) → x +/ y ≡ y +/ x\n comm/R = elimProp2 (λ x y → squash/ _ _) (λ u v → cong [_] (·Comm _ _))\n\n asAbGroup : AbGroup ℓ\n asAbGroup = makeAbGroup 0/R _+/_ -/_ squash/ assoc/R rid/R rinv/R comm/R\n\nGroupification : CommMonoid ℓ → AbGroup ℓ\nGroupification M = asAbGroup M\n\n\nmodule UniversalProperty (M : CommMonoid ℓ) where\n open IsMonoidHom\n open CommMonoidStr ⦃...⦄\n\n private\n instance\n _ = snd M\n\n{-\nThe \"groupification\" of a monoid comes with a universal morphism and a universal property:\n\n M ----- ∀φ -----> A\n \\ Λ\n \\ /\n universalHom ∃! inducedHom\n \\ /\n V /\n Groupification M\n-}\n\n universalHom : CommMonoidHom M (AbGroup→CommMonoid (Groupification M))\n fst universalHom = λ m → [ m , ε ]\n pres· (snd universalHom) =\n λ _ _ → eq/ _ _ (ε , cong (ε ·_) (·Comm _ _ ∙ cong₂ _·_ (·IdR ε) refl))\n presε (snd universalHom) = refl\n\n private\n i = fst universalHom\n\n module _ {A : AbGroup ℓ} (φ : CommMonoidHom M (AbGroup→CommMonoid A)) where\n open IsGroupHom\n\n open GroupTheory (AbGroup→Group A)\n\n open AbGroupStr ⦃...⦄ using (-_; _-_; _+_; +InvR; +InvL)\n private\n instance\n AAsGroup = snd A\n MAsGroup = snd (Groupification M)\n AAsMonoid = snd (AbGroup→CommMonoid A)\n\n private\n module φ = IsMonoidHom (snd φ)\n f = fst φ\n\n inducedHom : AbGroupHom (Groupification M) A\n fst inducedHom = elim (λ x → isSetAbGroup A) g proof\n where\n g = λ (a , b) → f a - f b\n proof : (u v : ⟨ M² M ⟩) (r : R M u v) → g u ≡ g v\n proof _ _ (k , p) = lemma (lemma₂ p)\n where\n lemma₂ : ∀ {k a b c d} → k · (a · d) ≡ k · (b · c) → f a + f d ≡ f b + f c\n lemma₂ {k} {a} {b} {c} {d} p =\n f a + f d ≡⟨ sym (φ.pres· _ _) ⟩\n f (a · d) ≡⟨ ·CancelL _ (sym (φ.pres· _ _) ∙ (cong f p) ∙ φ.pres· _ _) ⟩\n f (b · c) ≡⟨ φ.pres· _ _ ⟩\n f b + f c ∎\n\n lemma : ∀ {a b c d} → f a + f d ≡ f b + f c → f a - f b ≡ f c - f d\n lemma {a} {b} {c} {d} p =\n f a - f b\n ≡⟨ cong (λ x → x - f b) (sym (·IdR _)) ⟩\n f a + ε - f b\n ≡⟨ cong (λ x → f a + x - f b) (sym (+InvR _)) ⟩\n f a + (f d - f d) - f b\n ≡⟨ cong (λ x → x - f b) (·Assoc _ _ _) ⟩\n f a + f d - f d - f b\n ≡⟨ cong (λ x → x - f d - f b) p ⟩\n f b + f c - f d - f b\n ≡⟨ ·Comm _ _ ∙ ·Assoc _ _ _ ⟩\n (- f b + (f b + f c)) - f d\n ≡⟨ cong (λ x → x - f d) (·Assoc _ _ _) ⟩\n ((- f b + f b) + f c) - f d\n ≡⟨ cong (λ x → (x + f c) - f d) (+InvL _) ∙ sym (·Assoc _ _ _) ∙ ·IdL _ ⟩\n f c - f d\n ∎\n\n pres· (snd inducedHom) = elimProp2 (λ _ _ → isSetAbGroup A _ _) proof\n where\n rExp : ∀ {x y z} → x ≡ y → x + z ≡ y + z\n rExp r = cong₂ _+_ r refl\n\n lExp : ∀ {x y z} → x ≡ y → z + x ≡ z + y\n lExp r = cong₂ _+_ refl r\n\n proof : ((a , b) (c , d) : ⟨ M² M ⟩) → (f (a · c)) - (f (b · d)) ≡ (f a - f b) + (f c - f d)\n proof (a , b) (c , d) =\n f (a · c) - f (b · d) ≡⟨ cong₂ _-_ (φ.pres· _ _) (φ.pres· _ _) ⟩\n (f a + f c) - (f b + f d) ≡⟨ lExp (invDistr _ _ ∙ ·Comm _ _) ∙ ·Assoc _ _ _ ⟩\n ((f a + f c) - f b) - f d ≡⟨ lemma ⟩\n (f a - f b) + (f c - f d) ∎\n where\n lemma = rExp (sym (·Assoc _ _ _) ∙ lExp (·Comm _ _) ∙ ·Assoc _ _ _) ∙ sym (·Assoc _ _ _)\n\n pres1 (snd inducedHom) = +InvR _\n presinv (snd inducedHom) = elimProp (λ _ → isSetAbGroup A _ _)\n (λ _ → sym (invDistr _ _ ∙ cong₂ _-_ (invInv _) refl))\n\n solution : (m : ⟨ M ⟩) → (fst inducedHom) (i m) ≡ f m\n solution m = cong ((f m)+_) ((cong (-_) φ.presε) ∙ inv1g) ∙ ·IdR _\n\n unique : (ψ : AbGroupHom (Groupification M) A)\n → (ψIsSolution : (m : ⟨ M ⟩) → ψ .fst (i m) ≡ f m)\n → (u : ⟨ M² M ⟩) → ψ .fst [ u ] ≡ inducedHom .fst [ u ]\n unique ψ ψIsSolution (a , b) =\n ψ .fst [ a , b ] ≡⟨ lemma ⟩\n ψ .fst ([ a , ε ] - [ b , ε ]) ≡⟨ (snd ψ).pres· _ _ ∙ cong₂ _+_ refl ((snd ψ).presinv _) ⟩\n ψ .fst [ a , ε ] - ψ .fst [ b , ε ] ≡⟨ cong₂ _-_ (ψIsSolution a) (ψIsSolution b) ⟩\n f a - f b ∎\n where\n lemma = cong (ψ .fst) (eq/ _ _ (ε , cong (ε ·_) (·Assoc _ _ _ ∙ ·Comm _ _)))\n", "meta": {"hexsha": "f1addba0e2d21c2c0e16aec19e398bb020749273", "size": 7785, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommMonoid/GrothendieckGroup.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommMonoid/GrothendieckGroup.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommMonoid/GrothendieckGroup.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.7544642857, "max_line_length": 102, "alphanum_fraction": 0.4447013487, "num_tokens": 3003, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.900529786117893, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6719203928917151}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Dependent product combinators for propositional equality\n-- preserving functions\n------------------------------------------------------------------------\n\n{-# OPTIONS --with-K --safe #-}\n\nmodule Data.Product.Function.Dependent.Propositional.WithK where\n\nopen import Data.Product\nopen import Data.Product.Function.Dependent.Setoid\nopen import Data.Product.Relation.Binary.Pointwise.Dependent\nopen import Data.Product.Relation.Binary.Pointwise.Dependent.WithK\nopen import Function.Equality using (_⟨$⟩_)\nopen import Function.Injection as Inj using (_↣_; module Injection)\nopen import Function.Inverse as Inv using (_↔_; module Inverse)\nimport Relation.Binary.HeterogeneousEquality as H\n\n------------------------------------------------------------------------\n-- Combinator for Injection\n\nmodule _ {a₁ a₂} {A₁ : Set a₁} {A₂ : Set a₂}\n {b₁ b₂} {B₁ : A₁ → Set b₁} {B₂ : A₂ → Set b₂}\n where\n\n ↣ : ∀ (A₁↣A₂ : A₁ ↣ A₂) →\n (∀ {x} → B₁ x ↣ B₂ (Injection.to A₁↣A₂ ⟨$⟩ x)) →\n Σ A₁ B₁ ↣ Σ A₂ B₂\n ↣ A₁↣A₂ B₁↣B₂ =\n Inverse.injection Pointwise-≡↔≡ ⟨∘⟩\n injection (H.indexedSetoid B₂) A₁↣A₂\n (Inverse.injection (H.≡↔≅ B₂) ⟨∘⟩\n B₁↣B₂ ⟨∘⟩\n Inverse.injection (Inv.sym (H.≡↔≅ B₁))) ⟨∘⟩\n Inverse.injection (Inv.sym Pointwise-≡↔≡)\n where open Inj using () renaming (_∘_ to _⟨∘⟩_)\n", "meta": {"hexsha": "0b3838e12fd78adcab5f30797e826f529601ec05", "size": 1423, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Propositional/WithK.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Propositional/WithK.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Propositional/WithK.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 36.4871794872, "max_line_length": 72, "alphanum_fraction": 0.5678144765, "num_tokens": 430, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9005297967961706, "lm_q2_score": 0.7461389873857265, "lm_q1q2_score": 0.6719203906921688}} {"text": "module BBHeap.Last {A : Set}(_≤_ : A → A → Set) where\n\nopen import BBHeap _≤_\nopen import BBHeap.Compound _≤_\nopen import BBHeap.DropLast _≤_\nopen import Bound.Lower A \nopen import Data.Sum \n\nlast : {b : Bound}(h : BBHeap b) → Compound h → A\nlast (left {b} {x} {l} {r} b≤x l⋘r) (cl .b≤x .l⋘r)\n with l | r | l⋘r | lemma-dropLast⋘ l⋘r\n... | leaf | leaf | lf⋘ | _ = x\n... | left x≤y₁ l₁⋘r₁ | left x≤y₂ l₂⋘r₂ | ll⋘ .x≤y₁ .x≤y₂ .l₁⋘r₁ .l₂⋘r₂ l₂≃r₂ r₁≃l₂ | inj₁ l≃r = last (left x≤y₂ l₂⋘r₂) (cl x≤y₂ l₂⋘r₂)\n... | left x≤y₁ l₁⋘r₁ | left x≤y₂ l₂⋘r₂ | ll⋘ .x≤y₁ .x≤y₂ .l₁⋘r₁ .l₂⋘r₂ l₂≃r₂ r₁≃l₂ | inj₂ dl⋘r = last (left x≤y₁ l₁⋘r₁) (cl x≤y₁ l₁⋘r₁)\n... | right x≤y₁ l₁⋙r₁ | left x≤y₂ l₂⋘r₂ | lr⋘ .x≤y₁ .x≤y₂ .l₁⋙r₁ .l₂⋘r₂ l₂≃r₂ l₁⋗l₂ | inj₁ ()\n... | right x≤y₁ l₁⋙r₁ | left x≤y₂ l₂⋘r₂ | lr⋘ .x≤y₁ .x≤y₂ .l₁⋙r₁ .l₂⋘r₂ l₂≃r₂ l₁⋗l₂ | inj₂ dl⋘r = last (right x≤y₁ l₁⋙r₁) (cr x≤y₁ l₁⋙r₁)\nlast (right {b} {x} {l} {r} b≤x l⋙r) (cr .b≤x .l⋙r)\n with l | r | l⋙r | lemma-dropLast⋙ l⋙r\n... | left x≤y lf⋘ | leaf | ⋙lf {x = y} .x≤y | _ = y\n... | left x≤y₁ l₁⋘r₁ | left x≤y₂ l₂⋘r₂ | ⋙rl .x≤y₁ .x≤y₂ .l₁⋘r₁ l₁≃r₁ .l₂⋘r₂ l₁⋗r₂ | inj₁ l⋗r = last (left x≤y₁ l₁⋘r₁) (cl x≤y₁ l₁⋘r₁)\n... | left x≤y₁ l₁⋘r₁ | left x≤y₂ l₂⋘r₂ | ⋙rl .x≤y₁ .x≤y₂ .l₁⋘r₁ l₁≃r₁ .l₂⋘r₂ l₁⋗r₂ | inj₂ l⋙dr = last (left x≤y₂ l₂⋘r₂) (cl x≤y₂ l₂⋘r₂)\n... | left x≤y₁ l₁⋘r₁ | right x≤y₂ l₂⋙r₂ | ⋙rr .x≤y₁ .x≤y₂ .l₁⋘r₁ l₁≃r₁ .l₂⋙r₂ l₁≃l₂ | inj₁ ()\n... | left x≤y₁ l₁⋘r₁ | right x≤y₂ l₂⋙r₂ | ⋙rr .x≤y₁ .x≤y₂ .l₁⋘r₁ l₁≃r₁ .l₂⋙r₂ l₁≃l₂ | inj₂ l⋙dr = last (right x≤y₂ l₂⋙r₂) (cr x≤y₂ l₂⋙r₂)\n", "meta": {"hexsha": "6d22bce572648cdd1789d10a5a096e0ac3b151ba", "size": 1530, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/BBHeap/Last.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/BBHeap/Last.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/BBHeap/Last.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 63.75, "max_line_length": 138, "alphanum_fraction": 0.560130719, "num_tokens": 1098, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9433475683211323, "lm_q2_score": 0.7122321903471563, "lm_q1q2_score": 0.6718825048440238}} {"text": "module Bound.Lower.Order {A : Set}(_≤_ : A → A → Set) where\n\nopen import Bound.Lower A\n\ndata LeB : Bound → Bound → Set where\n lebx : {b : Bound} \n → LeB bot b\n lexy : {a b : A} \n → a ≤ b \n → LeB (val a) (val b)\n\n\n\n", "meta": {"hexsha": "86675c91302aadc0b5e1539909755dea1527a507", "size": 270, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Bound/Lower/Order.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/Bound/Lower/Order.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Bound/Lower/Order.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.2857142857, "max_line_length": 59, "alphanum_fraction": 0.4444444444, "num_tokens": 87, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9390248225478306, "lm_q2_score": 0.7154239897159438, "lm_q1q2_score": 0.6718008849894751}} {"text": "-- Copyright: (c) 2016 Ertugrul Söylemez\n-- License: BSD3\n-- Maintainer: Ertugrul Söylemez \n\nmodule Data.Fin.Core where\n\nopen import Core\nopen import Data.Nat\nimport Data.Nat.Core as Nat\n\n\ndata Fin : ℕ → Set where\n fzero : {n : ℕ} → Fin (suc n)\n fsuc : {n : ℕ} → Fin n → Fin (suc n)\n\ninstance\n Fin-Number : {n : ℕ} → Number (Fin (suc n))\n Fin-Number {n} =\n record {\n Constraint = λ x → x ℕ,≤.≤ n;\n fromNat = f n\n }\n\n where\n f : ∀ n x {{_ : x ℕ,≤.≤ n}} → Fin (suc n)\n f n .0 {{Nat.0≤s}} = fzero\n f (suc n) (suc x) {{Nat.s≤s p}} = fsuc (f n x {{p}})\n\n Fin,≡ : ∀ {n} → Equiv (Fin n)\n Fin,≡ = PropEq _\n\n\nfsuc-inj : ∀ {n} {x y : Fin (suc n)} → fsuc x ≡ fsuc y → x ≡ y\nfsuc-inj ≡-refl = ≡-refl\n\n\nfromℕ : ∀ {n} (x : ℕ) → x Nat.≤ n → Fin (suc n)\nfromℕ zero p = fzero\nfromℕ (suc x) (Nat.s≤s p) = fsuc (fromℕ x p)\n\n\ntoℕ : ∀ {n} → Fin (suc n) → ∃ (λ x → x Nat.≤ n)\ntoℕ fzero = zero , Nat.0≤s\ntoℕ {zero} (fsuc ())\ntoℕ {suc n} (fsuc x) with toℕ x\ntoℕ {suc n} (fsuc x) | x' , p = suc x' , Nat.s≤s p\n\n\nembed : ∀ {n} → Fin n → Fin (suc n)\nembed fzero = fzero\nembed (fsuc x) = fsuc (embed x)\n\n\n_≤_ : ∀ {n} (x y : Fin (suc n)) → Set _\nx ≤ y = fst (toℕ x) Nat.≤ fst (toℕ y)\n\ninfix 1 _≤_\n\n_≤?_ : ∀ {n} (x y : Fin (suc n)) → Decision (x ≤ y)\nx ≤? y = fst (toℕ x) Nat.≤? fst (toℕ y)\n\n\n-- Fin,≤ : ∀ {n} → TotalOrder (Fin (suc n))\n-- Fin,≤ {n} =\n-- record {\n-- partialOrder = record {\n-- Eq = Fin,≡;\n-- _≤_ = _≤_;\n-- antisym = antisym;\n-- refl' = refl';\n-- trans = λ {x} {y} {z} → trans {x} {y} {z}\n-- };\n-- total = total\n-- }\n\n-- where\n-- not-s≤0 : ∀ {n} {x : Fin (suc n)} → not (fsuc x ≤ fzero)\n-- not-s≤0 ()\n\n-- antisym : ∀ {x y} → x ≤ y → y ≤ x → x ≡ y\n-- antisym {fzero} {fzero} p q = ≡-refl\n-- antisym {fzero} {fsuc y} p q with not-s≤0 {!!}\n-- antisym {fzero} {fsuc y} p q | ()\n-- antisym {fsuc x} p q = {!!}\n\n-- refl' : ∀ {x y} → x ≡ y → x ≤ y\n-- refl' = {!!}\n\n-- trans : ∀ {x y z} → x ≤ y → y ≤ z → x ≤ z\n-- trans = {!!}\n\n-- total : ∀ x y → Either (x ≤ y) (y ≤ x)\n-- total = {!!}\n", "meta": {"hexsha": "da45c906c26b183b78408a5acf0285dd84d2effe", "size": 2092, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Fin/Core.agda", "max_stars_repo_name": "esoeylemez/agda-simple", "max_stars_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-10-07T17:36:42.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-07T17:36:42.000Z", "max_issues_repo_path": "Data/Fin/Core.agda", "max_issues_repo_name": "esoeylemez/agda-simple", "max_issues_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Fin/Core.agda", "max_forks_repo_name": "esoeylemez/agda-simple", "max_forks_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.2553191489, "max_line_length": 62, "alphanum_fraction": 0.4679732314, "num_tokens": 966, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8933094060543488, "lm_q2_score": 0.7520125848754472, "lm_q1q2_score": 0.6717799155404813}} {"text": "open import Logic\nopen import Logic.Classical\nopen import Structure.Setoid\nopen import Structure.OrderedField\nopen import Type\n\nmodule Structure.Function.Metric\n {ℓF ℓₑF ℓ≤}\n {F : Type{ℓF}}\n ⦃ equiv-F : Equiv{ℓₑF}(F) ⦄\n {_+_}{_⋅_}\n {_≤_ : _ → _ → Type{ℓ≤}}\n ⦃ orderedField-F : OrderedField{F = F}(_+_)(_⋅_)(_≤_) ⦄\n ⦃ classical : ∀{ℓ}{P : Stmt{ℓ}} → Classical(P) ⦄\n where\n\nopen OrderedField(orderedField-F)\n\nimport Lvl\nopen import Data.Boolean\nopen import Data.Boolean.Proofs\nimport Data.Either as Either\nopen import Data.Tuple as Tuple using (_⨯_ ; _,_)\nopen import Functional as Fn\nopen import Logic.Propositional\nopen import Logic.Predicate\nopen import Relator.Ordering\nopen import Sets.PredicateSet renaming (_≡_ to _≡ₛ_)\nopen import Structure.Setoid.Uniqueness\nopen import Structure.Function.Ordering\nopen import Structure.Operator.Field\nopen import Structure.Operator.Monoid\nopen import Structure.Operator.Group\nopen import Structure.Operator.Proofs\nopen import Structure.Operator.Properties\nopen import Structure.Operator\nopen import Structure.Relator.Ordering\nopen Structure.Relator.Ordering.Weak.Properties\nopen import Structure.Relator.Properties\nopen import Syntax.Transitivity\n \nF₊ = ∃(Positive)\n\nmodule _ where\n record MetricSpace {ℓₘ ℓₑₘ} {M : Type{ℓₘ}} ⦃ equiv-M : Equiv{ℓₑₘ}(M) ⦄ (d : M → M → F) : Type{ℓF Lvl.⊔ ℓ≤ Lvl.⊔ ℓₘ Lvl.⊔ ℓₑₘ Lvl.⊔ ℓₑF} where\n field\n ⦃ distance-binary-operator ⦄ : BinaryOperator(d)\n self-distance : ∀{x y} → (d(x)(y) ≡ 𝟎) ↔ (x ≡ y)\n ⦃ distance-commutativity ⦄ : Commutativity(d)\n triangle-inequality : ∀{x y z} → (d(x)(z) ≤ (d(x)(y) + d(y)(z)))\n ⦃ non-negativity ⦄ : ∀{x y} → NonNegative(d(x)(y))\n {-\n non-negativity{x}{y} =\n ([≤]ₗ-of-[+] (\n 𝟎\n d(x)(x)\n d(x)(y) + d(y)(x)\n d(x)(y) + d(x)(y)\n 2 ⋅ d(x)(y)\n ))\n -}\n\n distance-to-self : ∀{x} → (d(x)(x) ≡ 𝟎)\n distance-to-self = [↔]-to-[←] self-distance (reflexivity(_≡_))\n\n Neighborhood : M → F₊ → PredSet(M)\n Neighborhood(p)([∃]-intro r)(q) = (d(p)(q) < r)\n\n Neighborhoods : ∀{ℓ} → M → PredSet(PredSet{ℓ}(M))\n Neighborhoods(p)(N) = ∃(r ↦ N ≡ₛ Neighborhood(p)(r))\n\n PuncturedNeighborhood : M → F₊ → PredSet(M)\n PuncturedNeighborhood(p)([∃]-intro r)(q) = (𝟎 < d(p)(q) < r)\n\n LimitPoint : ∀{ℓ} → PredSet{ℓ}(M) → PredSet(M)\n LimitPoint(E)(p) = ∀{r} → Overlapping(PuncturedNeighborhood(p)(r)) (E)\n\n IsolatedPoint : ∀{ℓ} → PredSet{ℓ}(M) → PredSet(M)\n IsolatedPoint(E)(p) = ∃(r ↦ Disjoint(PuncturedNeighborhood(p)(r)) (E))\n\n Interior : ∀{ℓ} → PredSet{ℓ}(M) → PredSet(M)\n Interior(E)(p) = ∃(r ↦ Neighborhood(p)(r) ⊆ E)\n\n Closed : ∀{ℓ} → PredSet(PredSet{ℓ}(M))\n Closed(E) = LimitPoint(E) ⊆ E\n\n Open : ∀{ℓ} → PredSet(PredSet{ℓ}(M))\n Open(E) = E ⊆ Interior(E)\n\n Perfect : ∀{ℓ} → PredSet(PredSet{ℓ}(M))\n Perfect(E) = LimitPoint(E) ≡ₛ E\n\n Bounded : ∀{ℓ} → PredSet(PredSet{ℓ}(M))\n Bounded(E) = ∃(p ↦ ∃(r ↦ E ⊆ Neighborhood(p)(r)))\n\n Discrete : ∀{ℓ} → PredSet(PredSet{ℓ}(M))\n Discrete(E) = E ⊆ IsolatedPoint(E)\n\n Closure : ∀{ℓ} → PredSet{ℓ}(M) → PredSet(M)\n Closure(E) = E ∪ LimitPoint(E)\n\n Dense : ∀{ℓ} → PredSet(PredSet{ℓ}(M))\n Dense(E) = ∀{p} → (p ∈ Closure(E))\n\n -- Compact\n\n Separated : ∀{ℓ₁ ℓ₂} → PredSet{ℓ₁}(M) → PredSet{ℓ₂}(M) → Stmt\n Separated(A)(B) = Disjoint(A)(Closure(B)) ∧ Disjoint(Closure(A))(B)\n\n Connected : ∀{ℓ} → PredSet{ℓ}(M) → Stmtω\n Connected(E) = ∀{ℓ₁ ℓ₂}{A : PredSet{ℓ₁}(M)}{B : PredSet{ℓ₂}(M)} → ((A ∪ B) ≡ₛ E) → Separated(A)(B) → ⊥\n\n -- Complete = Sequence.Cauchy ⊆ Sequence.Converging\n\n neighborhood-contains-center : ∀{p}{r} → (p ∈ Neighborhood(p)(r))\n neighborhood-contains-center {p}{[∃]-intro r ⦃ intro positive-r ⦄} =\n d(p)(p) 🝖-[ sub₂(_≡_)(_≤_) distance-to-self ]-sub\n 𝟎 🝖-semiend\n r 🝖-end-from-[ positive-r ]\n\n -- TODO: Not always the case?\n -- subneighborhood-subradius : ∀{p₁ p₂}{r₁ r₂} → (Neighborhood(p₁)(r₁) ⊆ Neighborhood(p₂)(r₂)) → ([∃]-witness r₁ ≤ [∃]-witness r₂)\n\n subneighborhood-radius : ∀{p₁ p₂}{r₁ r₂} → (Neighborhood(p₁)(r₁) ⊆ Neighborhood(p₂)(r₂)) ← (d(p₂)(p₁) ≤ ([∃]-witness r₂ − [∃]-witness r₁))\n subneighborhood-radius {p₁} {p₂} {[∃]-intro r₁} {[∃]-intro r₂} p {q} qN₁ =\n d(p₂)(q) 🝖[ _≤_ ]-[ triangle-inequality ]-sub\n d(p₂)(p₁) + d(p₁)(q) 🝖[ _<_ ]-[ [<][+]-preserve-subₗ p qN₁ ]-super\n (r₂ − r₁) + r₁ 🝖[ _≡_ ]-[ {!inverseOperₗ ? ?!} ] -- inverseOperatorᵣ(_+_)(_−_)\n r₂ 🝖-end\n {-where\n r₁r₂ : (r₁ ≤ r₂) -- TODO: This seems to be provable, but not used here\n r₁r₂ =\n r₁ 🝖-[ {!!} ]\n d(p₁)(p₂) + r₁ 🝖-[ {!!} ]\n r₂ 🝖-end\n -}\n\n subneighborhood-radius-on-same : ∀{p}{r₁ r₂} → (Neighborhood(p)(r₁) ⊆ Neighborhood(p)(r₂)) ← ([∃]-witness r₁ ≤ [∃]-witness r₂)\n subneighborhood-radius-on-same {p} {[∃]-intro r₁} {[∃]-intro r₂} r₁r₂ {x} xN₁ xN₂ = xN₁ (r₁r₂ 🝖 xN₂)\n\n interior-is-subset : ∀{ℓ}{E : PredSet{ℓ}(M)} → Interior(E) ⊆ E\n interior-is-subset {ℓ} {E} {x} ([∃]-intro ([∃]-intro r ⦃ intro positive-r ⦄) ⦃ N⊆E ⦄) =\n N⊆E {x} (p ↦ positive-r (\n r 🝖[ _≤_ ]-[ p ]-super\n d(x)(x) 🝖[ _≡_ ]-[ distance-to-self ]\n 𝟎 🝖[ _≡_ ]-end\n ))\n\n neighborhood-interior-is-self : ∀{p}{r} → (Interior(Neighborhood(p)(r)) ≡ₛ Neighborhood(p)(r))\n ∃.witness (Tuple.left (neighborhood-interior-is-self {p} {r}) x) = r\n ∃.proof (Tuple.left (neighborhood-interior-is-self {p} {r} {x}) Nx) = {!!}\n Tuple.right (neighborhood-interior-is-self {p} {r}) = {!!}\n\n neighborhood-is-open : ∀{p}{r} → Open(Neighborhood(p)(r))\n\n interior-is-largest-subspace : ∀{ℓ₁ ℓ₂}{E : PredSet{ℓ₁}(M)}{Eₛ : PredSet{ℓ₂}(M)} → Open(Eₛ) → (Eₛ ⊆ E) → (Eₛ ⊆ Interior(E))\n\n nested-interior : ∀{ℓ}{E : PredSet{ℓ}(M)} → Interior(Interior(E)) ≡ₛ Interior(E)\n\n isolated-limit-eq : ∀{ℓ}{E : PredSet{ℓ}(M)} → (IsolatedPoint(E) ⊆ ∅ {Lvl.𝟎}) ↔ (E ⊆ LimitPoint(E))\n\n interior-closure-eq1 : ∀{ℓ}{E : PredSet{ℓ}(M)} → ((∁ Interior(E)) ≡ₛ Closure(∁ E))\n\n interior-closure-eq2 : ∀{ℓ}{E : PredSet{ℓ}(M)} → (Interior(∁ E) ≡ₛ (∁ Closure(E)))\n\n open-closed-eq1 : ∀{ℓ}{E : PredSet{ℓ}(M)} → (Open(E) ↔ Closed(∁ E))\n\n open-closed-eq2 : ∀{ℓ}{E : PredSet{ℓ}(M)} → (Open(∁ E) ↔ Closed(E))\n\n union-is-open : ∀{ℓ₁ ℓ₂}{A : PredSet{ℓ₁}(M)}{B : PredSet{ℓ₂}(M)} → Open(A) → Open(B) → Open(A ∪ B)\n\n intersection-is-open : ∀{ℓ₁ ℓ₂}{A : PredSet{ℓ₁}(M)}{B : PredSet{ℓ₂}(M)} → Open(A) → Open(B) → Open(A ∩ B)\n\n -- open-subsubspace : ∀{ℓ₁ ℓ₂}{Eₛ : PredSet{ℓ₁}(M)}{E : PredSet{ℓ₂}(M)} → \n\n separated-is-disjoint : ∀{ℓ₁ ℓ₂}{A : PredSet{ℓ₁}(M)}{B : PredSet{ℓ₂}(M)} → Separated(A)(B) → Disjoint(A)(B)\n\n unionₗ-is-connected : ∀{ℓ₁ ℓ₂}{A : PredSet{ℓ₁}(M)}{B : PredSet{ℓ₂}(M)} → Connected(A ∪ B) → Connected(A)\n\n unionᵣ-is-connected : ∀{ℓ₁ ℓ₂}{A : PredSet{ℓ₁}(M)}{B : PredSet{ℓ₂}(M)} → Connected(A ∪ B) → Connected(B)\n\n intersection-is-connected : ∀{ℓ₁ ℓ₂}{A : PredSet{ℓ₁}(M)}{B : PredSet{ℓ₂}(M)} → Connected(A) → Connected(B) → Connected(A ∩ B)\n\nmodule Sequence {ℓ} {M : Type{ℓ}} ⦃ equiv-M : Equiv(M) ⦄ (d : M → M → F) where\n open import Numeral.Natural\n import Numeral.Natural.Relation.Order as ℕ\n\n ConvergesTo : (ℕ → M) → M → Stmt\n ConvergesTo f(L) = ∃{Obj = F₊ → ℕ}(N ↦ ∀{ε : F₊}{n} → (n ℕ.≥ N(ε)) → (d(f(n))(L) < [∃]-witness ε))\n\n Converging : (ℕ → M) → Stmt\n Converging(f) = ∃(ConvergesTo(f))\n\n Diverging : (ℕ → M) → Stmt\n Diverging(f) = ∀{L} → ¬(ConvergesTo f(L))\n\n lim : (f : ℕ → M) → ⦃ Converging(f) ⦄ → M\n lim(f) ⦃ [∃]-intro L ⦄ = L\n\n Cauchy : (ℕ → M) → Stmt\n Cauchy(f) = ∃{Obj = F₊ → ℕ}(N ↦ ∀{ε : F₊}{a b} → (a ℕ.≥ N(ε)) → (b ℕ.≥ N(ε)) → (d(f(a))(f(b)) < [∃]-witness ε))\n\n Complete : Stmt\n Complete = Cauchy ⊆ Converging\n\n Bounded : (ℕ → M) → Stmt\n Bounded(f) = ∃(r ↦ ∃(p ↦ ∀{n} → (d(p)(f(n)) < r)))\n\n unique-converges-to : ∀{f} → Unique(ConvergesTo(f))\n\n converging-bounded : Converging ⊆ Bounded\n\n -- strictly-ordered-sequence-limit : ∀{f g : ℕ → M} → (∀{n} → (f(n) < g(n))) → (lim f < lim g)\n -- ordered-sequence-limit : ∀{f g : ℕ → M} → (∀{n} → (f(n) ≤ g(n))) → (lim f ≤ lim g)\n\n -- limit-point-converging-sequence : ∀{E}{p} → LimitPoint(E)(p) → ∃(f ↦ (ConvergesTo f(p)) ∧ (∀{x} → (f(x) ∈ E)))\n\n -- TODO: Apparently, this requires both axiom of choice and excluded middle? At least the (←)-direction?\n -- continuous-sequence-convergence-composition : (ContinuousOn f(p)) ↔ (∀{g} → (ConvergesTo g(p)) → (ConvergesTo(f ∘ g)(f(p))))\n\n {-\n module Series where\n ∑ : (ℕ → M) → ℕ → M\n ∑ f(𝟎) = 𝟎\n ∑ f(𝐒(n)) = (∑ f(n)) + f(𝐒(n))\n\n ∑₂ : (ℕ → M) → (ℕ ⨯ ℕ) → M\n ∑₂ f(a , b) = ∑ (f ∘ (a +_))(b − a)\n\n ConvergesTo : (ℕ → M) → M → Stmt\n ConvergesTo f(L) = Sequence.ConvergesTo(∑ f)(L)\n\n Converging : (ℕ → M) → Stmt\n Converging(f) = ∃(ConvergesTo(f))\n\n Diverging : (ℕ → M) → Stmt\n Diverging(f) = ∀{L} → ¬(ConvergesTo f(L))\n\n ConvergesTo : (ℕ → M) → M → Stmt\n AbsolutelyConvergesTo f(L) = ConvergesTo (‖_‖ ∘ f)(L)\n\n AbsolutelyConverging : (ℕ → M) → Stmt\n AbsolutelyConverging(f) = ∃(AbsolutelyConvergesTo(f))\n\n AbsolutelyDiverging : (ℕ → M) → Stmt\n AbsolutelyDiverging(f) = ∀{L} → ¬(AbsolutelyConvergesTo f(L))\n\n ConditionallyConverging : (ℕ → M) → Stmt\n ConditionallyConverging(f) = AbsolutelyDiverging(f) ∧ Converging(f)\n\n sequence-of-converging-series-converges-to-0 : Converging(f) → (Sequence.ConvergesTo f(𝟎))\n\n convergence-by-ordering : (∀{n} → f(n) ≤ g(n)) → (Converging(f) ← Converging(g))\n divergence-by-ordering : (∀{n} → f(n) ≤ g(n)) → (Diverging(f) → Diverging(g))\n convergence-by-quotient : Sequence.Converging(n ↦ f(n) / g(n)) → (Converging(f) ↔ Converging(g))\n -}\n\nmodule Analysis\n {ℓ₁ ℓ₂}\n {M₁ : Type{ℓ₁}} ⦃ equiv-M₁ : Equiv(M₁) ⦄ (d₁ : M₁ → M₁ → F)\n ⦃ space₁ : MetricSpace(d₁) ⦄\n {M₂ : Type{ℓ₂}} ⦃ equiv-M₂ : Equiv(M₂) ⦄ (d₂ : M₂ → M₂ → F)\n ⦃ space₂ : MetricSpace(d₂) ⦄\n where\n\n open MetricSpace\n\n Lim : ∀{ℓ}{E : PredSet{ℓ}(M₁)} → ((x : M₁) → ⦃ x ∈ E ⦄ → M₂) → M₁ → M₂ → Stmt\n Lim {E = E} f(p)(L) = ∃{Obj = F₊ → F₊}(δ ↦ ∀{ε : F₊}{x} → ⦃ ex : x ∈ E ⦄ → (p ∈ PuncturedNeighborhood(space₁)(x)(δ(ε))) → (L ∈ Neighborhood(space₂)(f(x) ⦃ ex ⦄)(ε)))\n\n lim : ∀{ℓ}{E : PredSet{ℓ}(M₁)} → (f : (x : M₁) → ⦃ x ∈ E ⦄ → M₂) → (p : M₁) → ⦃ ∃(Lim f(p)) ⦄ → M₂\n lim f(p) ⦃ [∃]-intro L ⦄ = L\n\n ContinuousOn : ∀{ℓ}{E : PredSet{ℓ}(M₁)} → ((x : M₁) → ⦃ x ∈ E ⦄ → M₂) → (p : M₁) → ⦃ p ∈ E ⦄ → Stmt\n ContinuousOn f(p) = Lim f(p) (f(p))\n\n Continuous : ∀{ℓ}{E : PredSet{ℓ}(M₁)} → ((x : M₁) → ⦃ x ∈ E ⦄ → M₂) → Stmt\n Continuous{E = E}(f) = ∀{p} → ⦃ ep : p ∈ E ⦄ → ContinuousOn f(p) ⦃ ep ⦄\n\n -- continuous-mapping-connected : Continuous(f) → Connected(E) → Connected(map f(E))\n", "meta": {"hexsha": "674ac393a2251b388cde441ecc2f11b3900435e6", "size": 10722, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Function/Metric.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Function/Metric.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Function/Metric.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.1565836299, "max_line_length": 167, "alphanum_fraction": 0.5517627308, "num_tokens": 4566, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797075998822, "lm_q2_score": 0.7371581626286834, "lm_q1q2_score": 0.6716835590788701}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category\nopen import Categories.Functor hiding (id)\n\n-- Cone over a Functor F (from shape category J into category C)\n\nmodule Categories.Diagram.Cone\n {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) where\n\nopen Category C\nopen Functor F\n\nopen import Level\n\nrecord Apex (N : Obj) : Set (ℓ′ ⊔ o′ ⊔ e ⊔ ℓ) where\n field\n ψ : (X : Category.Obj J) → (N ⇒ F₀ X)\n commute : ∀ {X Y} (f : J [ X , Y ]) → F₁ f ∘ ψ X ≈ ψ Y\n\nrecord Cone : Set (o ⊔ ℓ′ ⊔ o′ ⊔ e ⊔ ℓ) where\n field\n {N} : Obj\n apex : Apex N\n\n open Apex apex public\n\nopen Apex\nopen Cone\n\nrecord Cone⇒ (c c′ : Cone) : Set (ℓ ⊔ e ⊔ o′) where\n field\n arr : N c ⇒ N c′\n commute : ∀ {X} → ψ c′ X ∘ arr ≈ ψ c X\n\nopen Cone⇒\n", "meta": {"hexsha": "26e930f15e137b948b75ccca482051d5d7213706", "size": 792, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Diagram/Cone.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Diagram/Cone.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Diagram/Cone.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 22.0, "max_line_length": 89, "alphanum_fraction": 0.5681818182, "num_tokens": 309, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797003640646, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.671683559006425}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.Algebra.RingSolver.CommRingAsAlmostRing where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Algebra.CommRing.Base\nopen import Cubical.Algebra.RingSolver.AlmostRing\nopen import Cubical.Algebra.Semigroup\nopen import Cubical.Algebra.Monoid\nopen import Cubical.Algebra.Group\nopen import Cubical.Algebra.AbGroup\nopen import Cubical.Algebra.Ring.Base\nopen import Cubical.Algebra.Ring.Properties\n\nprivate\n variable\n ℓ : Level\n\nopen Cubical.Algebra.Ring.Properties.Theory\n\nCommRingAsAlmostRing : CommRing {ℓ} → AlmostRing {ℓ}\nCommRingAsAlmostRing {ℓ}\n (R , commringstr _ _ _ _ _\n (iscommring (isring\n (isabgroup (isgroup +-isMonoid inverse) +-comm)\n ·-isMonoid dist)\n ·-comm)) =\n let\n R' : CommRing {ℓ}\n R' = (R , commringstr _ _ _ _ _\n (iscommring (isring\n (isabgroup (isgroup +-isMonoid inverse) +-comm) ·-isMonoid dist)\n ·-comm))\n R″ = CommRing→Ring R'\n in almostring R _ _ _ _ _\n (isalmostring\n +-isMonoid\n ·-isMonoid\n +-comm\n ·-comm\n (λ x y z → fst (dist x y z))\n (λ x y z → snd (dist x y z))\n (λ x y → sym (-DistL· R″ x y))\n (λ x y → sym (-Dist R″ x y))\n (λ x → 0LeftAnnihilates R″ x)\n λ x → 0RightAnnihilates R″ x)\n", "meta": {"hexsha": "c52b84974801e4eae67c81248c6d9796c6b28e5d", "size": 1397, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/RingSolver/CommRingAsAlmostRing.agda", "max_stars_repo_name": "dan-iel-lee/cubical", "max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/RingSolver/CommRingAsAlmostRing.agda", "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/RingSolver/CommRingAsAlmostRing.agda", "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.3695652174, "max_line_length": 87, "alphanum_fraction": 0.6156048676, "num_tokens": 423, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9111797100118215, "lm_q2_score": 0.7371581568543043, "lm_q1q2_score": 0.6716835555953539}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Groups.Definition\nopen import Setoids.Setoids\nopen import Groups.Subgroups.Definition\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Groups.Subgroups.Normal.Definition {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} (G : Group S _+_) where\n\nnormalSubgroup : {c : _} {pred : A → Set c} (sub : Subgroup G pred) → Set (a ⊔ c)\nnormalSubgroup {pred = pred} sub = {g k : A} → pred k → pred (g + (k + Group.inverse G g))\n", "meta": {"hexsha": "36c1d9b06a6a7d2253e14b457079a820e9ace836", "size": 514, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Subgroups/Normal/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Subgroups/Normal/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Subgroups/Normal/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 39.5384615385, "max_line_length": 128, "alphanum_fraction": 0.6478599222, "num_tokens": 171, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9149009457116781, "lm_q2_score": 0.7341195327172402, "lm_q1q2_score": 0.6716466547484182}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\nmodule Cubical.HITs.Ints.DiffInt.Properties where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Univalence\n\nopen import Cubical.HITs.Ints.DiffInt.Base\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Sigma\nopen import Cubical.Data.Bool\n\nopen import Cubical.Relation.Binary.Base\nopen import Cubical.Relation.Nullary\n\nopen import Cubical.HITs.SetQuotients\n\nopen BinaryRelation\n\nrelIsEquiv : isEquivRel rel\nrelIsEquiv = equivRel {A = ℕ × ℕ} relIsRefl relIsSym relIsTrans\n where\n relIsRefl : isRefl rel\n relIsRefl (a0 , a1) = refl\n\n relIsSym : isSym rel\n relIsSym (a0 , a1) (b0 , b1) p = sym p\n\n relIsTrans : isTrans rel\n relIsTrans (a0 , a1) (b0 , b1) (c0 , c1) p0 p1 =\n inj-m+ {m = (b0 + b1)} ((b0 + b1) + (a0 + c1) ≡⟨ +-assoc (b0 + b1) a0 c1 ⟩\n ((b0 + b1) + a0) + c1 ≡[ i ]⟨ +-comm b0 b1 i + a0 + c1 ⟩\n ((b1 + b0) + a0) + c1 ≡[ i ]⟨ +-comm (b1 + b0) a0 i + c1 ⟩\n (a0 + (b1 + b0)) + c1 ≡[ i ]⟨ +-assoc a0 b1 b0 i + c1 ⟩\n (a0 + b1) + b0 + c1 ≡⟨ sym (+-assoc (a0 + b1) b0 c1) ⟩\n (a0 + b1) + (b0 + c1) ≡⟨ cong (λ p → p . fst + p .snd) (transport ΣPath≡PathΣ (p0 , p1))⟩\n (b0 + a1) + (c0 + b1) ≡⟨ sym (+-assoc b0 a1 (c0 + b1))⟩\n b0 + (a1 + (c0 + b1)) ≡[ i ]⟨ b0 + (a1 + +-comm c0 b1 i) ⟩\n b0 + (a1 + (b1 + c0)) ≡[ i ]⟨ b0 + +-comm a1 (b1 + c0) i ⟩\n b0 + ((b1 + c0) + a1) ≡[ i ]⟨ b0 + +-assoc b1 c0 a1 (~ i) ⟩\n b0 + (b1 + (c0 + a1)) ≡⟨ +-assoc b0 b1 (c0 + a1)⟩\n (b0 + b1) + (c0 + a1) ∎ )\n\nrelIsProp : BinaryRelation.isPropValued rel\nrelIsProp a b x y = isSetℕ _ _ _ _\n\ndiscreteℤ : Discrete ℤ\ndiscreteℤ = discreteSetQuotients (discreteΣ discreteℕ λ _ → discreteℕ) relIsProp relIsEquiv (λ _ _ → discreteℕ _ _)\n\nprivate\n _ : Dec→Bool (discreteℤ [ (3 , 5) ] [ (4 , 6) ]) ≡ true\n _ = refl\n\n _ : Dec→Bool (discreteℤ [ (3 , 5) ] [ (4 , 7) ]) ≡ false\n _ = refl\n", "meta": {"hexsha": "f81847ecfc36122da21017898431c7a0c2eb0303", "size": 1984, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/HITs/Ints/DiffInt/Properties.agda", "max_stars_repo_name": "Edlyr/cubical", "max_stars_repo_head_hexsha": "5de11df25b79ee49d5c084fbbe6dfc66e4147a2e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/HITs/Ints/DiffInt/Properties.agda", "max_issues_repo_name": "Edlyr/cubical", "max_issues_repo_head_hexsha": "5de11df25b79ee49d5c084fbbe6dfc66e4147a2e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/HITs/Ints/DiffInt/Properties.agda", "max_forks_repo_name": "Edlyr/cubical", "max_forks_repo_head_hexsha": "5de11df25b79ee49d5c084fbbe6dfc66e4147a2e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.0727272727, "max_line_length": 115, "alphanum_fraction": 0.5514112903, "num_tokens": 873, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357563664174, "lm_q2_score": 0.7745833893685269, "lm_q1q2_score": 0.6715914948700039}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Semirings.Definition\nopen import LogicalFormulae\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Naturals.Order\nopen import Numbers.Integers.RingStructure.Ring\nopen import Groups.Orders.Archimedean\nopen import Rings.Orders.Partial.Definition\nopen import Numbers.Integers.Order\n\nmodule Numbers.Integers.RingStructure.Archimedean where\n\nopen import Groups.Cyclic.Definition ℤGroup\nopen import Semirings.Solver ℕSemiring multiplicationNIsCommutative\n\nprivate\n lemma : (x y : ℕ) → positiveEltPower (nonneg x) y ≡ nonneg (x *N y)\n lemma x zero rewrite Semiring.productZeroRight ℕSemiring x = refl\n lemma x (succ y) rewrite lemma x y | multiplicationNIsCommutative x (succ y) | multiplicationNIsCommutative y x = equalityCommutative (+Zinherits x (x *N y))\n\nℤArchimedean : Archimedean (toGroup ℤRing ℤPOrderedRing)\nℤArchimedean (nonneg (succ a)) (nonneg (succ b)) 0_ (PathGraph n) x y = (toNat x ≡ succ (toNat y)) || (toNat y ≡ succ (toNat x))\nGraph.noSelfRelation (PathGraph n) x (inl bad) = nNotSucc bad\nGraph.noSelfRelation (PathGraph n) x (inr bad) = nNotSucc bad\nGraph.symmetric (PathGraph n) (inl x) = inr x\nGraph.symmetric (PathGraph n) (inr x) = inl x\nGraph.wellDefined (PathGraph n) refl refl i = i\n", "meta": {"hexsha": "2fd0a393fb0e200bbd1c1853a94bcd299233a4d4", "size": 958, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Graphs/PathGraph.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Graphs/PathGraph.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Graphs/PathGraph.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 35.4814814815, "max_line_length": 88, "alphanum_fraction": 0.735908142, "num_tokens": 312, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9304582632076909, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.6715519357825909}} {"text": "------------------------------------------------------------------------------\n-- Inductive PA properties using the induction principle\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule PA.Inductive.PropertiesByInductionI where\n\nopen import PA.Inductive.Base\n\nopen import PA.Inductive.PropertiesByInduction\nopen import PA.Inductive.Relation.Binary.EqReasoning\n\n------------------------------------------------------------------------------\n\n+-comm : ∀ m n → m + n ≡ n + m\n+-comm m n = ℕ-ind A A0 is m\n where\n A : ℕ → Set\n A i = i + n ≡ n + i\n\n A0 : A zero\n A0 = sym (+-rightIdentity n)\n\n is : ∀ i → A i → A (succ i)\n is i ih = succ (i + n) ≡⟨ succCong ih ⟩\n succ (n + i) ≡⟨ sym (x+Sy≡S[x+y] n i) ⟩\n n + succ i ∎\n", "meta": {"hexsha": "7cd0aae676206d3cde94273c46092926aeb98f4f", "size": 953, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/PA/Inductive/PropertiesByInductionI.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/PA/Inductive/PropertiesByInductionI.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/PA/Inductive/PropertiesByInductionI.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 29.78125, "max_line_length": 78, "alphanum_fraction": 0.4270724029, "num_tokens": 235, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9184802484881361, "lm_q2_score": 0.7310585903489892, "lm_q1q2_score": 0.6714628757231261}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Equality over container extensions parametrised by some setoid\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary using (Setoid)\n\nmodule Data.Container.Relation.Binary.Equality.Setoid {c e} (S : Setoid c e) where\n\nopen import Level using (_⊔_; suc)\nopen import Relation.Binary\n\nopen import Data.Container.Core\nopen import Data.Container.Relation.Binary.Pointwise\nimport Data.Container.Relation.Binary.Pointwise.Properties as Pw\n\nprivate\n module S = Setoid S\nopen S using (_≈_) renaming (Carrier to X)\n\n------------------------------------------------------------------------\n-- Definition of equality\n\nmodule _ {s p} (C : Container s p) where\n\n Eq : Rel (⟦ C ⟧ X) (e ⊔ s ⊔ p)\n Eq = Pointwise C _≈_\n\n------------------------------------------------------------------------\n-- Relational properties\n\n refl : Reflexive Eq\n refl = Pw.refl C _ S.refl\n\n sym : Symmetric Eq\n sym = Pw.sym C _ S.sym\n\n trans : Transitive Eq\n trans = Pw.trans C _ S.trans\n\n isEquivalence : IsEquivalence Eq\n isEquivalence = record\n { refl = refl\n ; sym = sym\n ; trans = trans\n }\n\n setoid : Setoid (s ⊔ p ⊔ c) (s ⊔ p ⊔ e)\n setoid = record\n { isEquivalence = isEquivalence\n }\n", "meta": {"hexsha": "d2a6157777f01306a72c888b250b569db98d59b2", "size": 1376, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Container/Relation/Binary/Equality/Setoid.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Container/Relation/Binary/Equality/Setoid.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Container/Relation/Binary/Equality/Setoid.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 25.0181818182, "max_line_length": 82, "alphanum_fraction": 0.5356104651, "num_tokens": 331, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8962513731336204, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6713704533916373}} {"text": "------------------------------------------------------------------------------\n-- Exclusive disjunction base\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOL.ExclusiveDisjunction.Base where\n\nopen import FOL.Base\n\ninfixr 1 _⊻_\n\n------------------------------------------------------------------------------\n-- Exclusive disjunction.\n_⊻_ : Set → Set → Set\nP ⊻ Q = (P ∨ Q) ∧ ¬ (P ∧ Q)\n", "meta": {"hexsha": "cfc7aa8b6ccd7b3868c102ffcf62480aca2ac621", "size": 597, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/FOL/ExclusiveDisjunction/Base.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/FOL/ExclusiveDisjunction/Base.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/FOL/ExclusiveDisjunction/Base.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 29.85, "max_line_length": 78, "alphanum_fraction": 0.3433835846, "num_tokens": 105, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8962513675912912, "lm_q2_score": 0.7490872187162396, "lm_q1q2_score": 0.6713704442195865}} {"text": "\nopen import Oscar.Prelude\nopen import Oscar.Class.IsEquivalence\n\nmodule Oscar.Class.Setoid where\n\nrecord Setoid 𝔬 ℓ : Ø ↑̂ (𝔬 ∙̂ ℓ) where\n constructor ∁\n field\n {Object} : Ø 𝔬\n ObjectEquivalence : Object → Object → Ø ℓ\n ⦃ `IsEquivalence ⦄ : IsEquivalence ObjectEquivalence\n", "meta": {"hexsha": "64ad08d09ac011f3739e12f7ef7092e50ee66055", "size": 285, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-3/src/Oscar/Class/Setoid.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-3/src/Oscar/Class/Setoid.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-3/src/Oscar/Class/Setoid.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.9230769231, "max_line_length": 56, "alphanum_fraction": 0.7087719298, "num_tokens": 98, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.942506726044381, "lm_q2_score": 0.7122321842389469, "lm_q1q2_score": 0.6712836241504881}} {"text": "{-\n\nDefinition of subfinite sets\n\nA set is subfinite if it is merely a subset of `Fin n` for some `n`. This\ndefinition is weaker than `isFinSet` if we don't assume LEM, but they\nare equivalent if we do.\n\nEvery subfinite set is guaranteed to be a set and discrete.\n\n-}\n\n{-# OPTIONS --cubical --no-import-sorts --safe #-}\n\nmodule Cubical.Data.SubFinSet where\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Fin\nopen import Cubical.Data.Sigma\nopen import Cubical.Data.FinSet\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Functions.Embedding\nopen import Cubical.HITs.PropositionalTruncation as PT\nopen import Cubical.Relation.Nullary\n\nprivate\n variable\n ℓ : Level\n A B : Type ℓ\n\nisSubFinSet : Type ℓ → Type ℓ\nisSubFinSet A = ∃[ n ∈ ℕ ] A ↪ Fin n\n\nisFinSet→isSubFinSet : isFinSet A → isSubFinSet A\nisFinSet→isSubFinSet = PT.map\n λ (n , f , isEquiv-f) →\n n , f , isEquiv→isEmbedding isEquiv-f\n\nisSubFinSet→isSet : isSubFinSet A → isSet A\nisSubFinSet→isSet = PT.rec\n isPropIsSet\n λ (n , emb) → Embedding-into-isSet→isSet emb isSetFin\n\nisSubFinSet→Discrete : isSubFinSet A → Discrete A\nisSubFinSet→Discrete isSubFinSet-A x y = PT.rec\n (isPropDec (isSubFinSet→isSet isSubFinSet-A x y))\n (λ (n , emb) → Embedding-into-Discrete→Discrete emb discreteFin x y)\n isSubFinSet-A\n", "meta": {"hexsha": "ef0dc2af86eb28bc78e56a7953b5c51dc9a307f5", "size": 1339, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/SubFinSet.agda", "max_stars_repo_name": "dan-iel-lee/cubical", "max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/SubFinSet.agda", "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/Data/SubFinSet.agda", "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.78, "max_line_length": 73, "alphanum_fraction": 0.7475728155, "num_tokens": 442, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519528057272543, "lm_q2_score": 0.7879312056025699, "lm_q1q2_score": 0.6712802013331675}} {"text": "module Type.Size.Countable where\n\nimport Data.Either as Type\nimport Data.Either.Equiv as Either\nimport Data.Tuple as Type\nimport Data.Tuple.Equiv as Tuple\nimport Lvl\nopen import Logic\nopen import Logic.Predicate\nopen import Numeral.Natural\nopen import Numeral.Natural.Sequence\nopen import Numeral.Natural.Sequence.Proofs\nopen import Relator.Equals.Proofs.Equivalence\nopen import Structure.Setoid\nopen import Type\nopen import Type.Size\nopen import Type.Size.Proofs\n\nprivate variable ℓ ℓ₁ ℓ₂ ℓₑ : Lvl.Level\n\n-- Definition of a countable type\nCountable : (T : Type{ℓ}) → ⦃ _ : Equiv{ℓₑ}(T) ⦄ → Stmt\nCountable(T) = (ℕ ≽ T)\n\n-- Definition of a countably infinite type\nCountablyInfinite : (T : Type{ℓ}) → ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → Stmt\nCountablyInfinite(T) ⦃ equiv ⦄ = _≍_ ℕ ⦃ [≡]-equiv ⦄ T\n\nprivate variable A : Type{ℓ₁}\nprivate variable B : Type{ℓ₂}\nprivate variable ⦃ equiv-A ⦄ : Equiv{ℓₑ}(A)\nprivate variable ⦃ equiv-B ⦄ : Equiv{ℓₑ}(B)\nprivate variable ⦃ equiv-A‖B ⦄ : Equiv{ℓₑ}(A Type.‖ B)\nprivate variable ⦃ equiv-A⨯B ⦄ : Equiv{ℓₑ}(A Type.⨯ B)\n\nmodule Countable where\n -- TODO: Do something similar to CountablyInfinite here\n\n -- _+_ : Countable (A) ⦃ equiv-A ⦄ → Countable(B) ⦃ equiv-B ⦄ → Countable(A ‖ B) ⦃ equiv-A‖B ⦄\n -- [∃]-intro a ⦃ intro pa ⦄ + [∃]-intro b ⦃ intro pb ⦄ = [∃]-intro (Left ∘ a) ⦃ intro (\\{y} → [∃]-intro ([∃]-witness pa) ⦃ {!!} ⦄) ⦄\n -- [∃]-intro (Left ∘ a) ⦃ intro (\\{y} → [∃]-intro ([∃]-witness pa) ⦃ {!!} ⦄) ⦄\n\n -- _⋅_ : Countable (A) ⦃ equiv-A ⦄ → Countable(B) ⦃ equiv-B ⦄ → Countable(A ⨯ B) ⦃ equiv-A⨯B ⦄\n\nmodule CountablyInfinite where\n index : ∀{ℓ} → (T : Type{ℓ}) → ⦃ equiv-T : Equiv{ℓₑ}(T) ⦄ → ⦃ size : CountablyInfinite(T) ⦄ → (ℕ → T)\n index(_) ⦃ size = size ⦄ = [∃]-witness size\n\n indexing : ∀{ℓ} → (T : Type{ℓ}) → ⦃ equiv-T : Equiv{ℓₑ}(T) ⦄ → ⦃ size : CountablyInfinite(T) ⦄ → (T → ℕ)\n indexing(T) ⦃ size = size ⦄ = [∃]-witness([≍]-symmetry-raw ⦃ [≡]-equiv ⦄ size ⦃ [≡]-to-function ⦄)\n\n _+_ : ⦃ ext : Either.Extensionality ⦃ equiv-A ⦄ ⦃ equiv-B ⦄ (equiv-A‖B) ⦄ → CountablyInfinite(A) ⦃ equiv-A ⦄ → CountablyInfinite(B) ⦃ equiv-B ⦄ → CountablyInfinite(A Type.‖ B) ⦃ equiv-A‖B ⦄\n [∃]-intro a + [∃]-intro b = [∃]-intro (interleave a b)\n\n _⨯_ : ⦃ ext : Tuple.Extensionality ⦃ equiv-A ⦄ ⦃ equiv-B ⦄ (equiv-A⨯B) ⦄ → CountablyInfinite(A) ⦃ equiv-A ⦄ → CountablyInfinite(B) ⦃ equiv-B ⦄ → CountablyInfinite(A Type.⨯ B) ⦃ equiv-A⨯B ⦄\n [∃]-intro a ⨯ [∃]-intro b = [∃]-intro (pair a b)\n", "meta": {"hexsha": "b66df4cb6868f8fa23271b130541ea878ff35c5a", "size": 2448, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Type/Size/Countable.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Type/Size/Countable.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Type/Size/Countable.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.9473684211, "max_line_length": 191, "alphanum_fraction": 0.6225490196, "num_tokens": 1078, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467706759584, "lm_q2_score": 0.7634837743174788, "lm_q1q2_score": 0.6712142946547037}} {"text": "module Data.List.Setoid where\n\nimport Lvl\nopen import Data.List\nopen import Data.List.Equiv\nopen import Data.List.Relation.Quantification\nopen import Logic.Propositional\nopen import Structure.Operator\nopen import Structure.Setoid\nopen import Structure.Relator.Equivalence\nimport Structure.Relator.Names as Names\nopen import Structure.Relator.Properties\nopen import Type\n\nprivate variable ℓ ℓₑ ℓₚ : Lvl.Level\nprivate variable T : Type{ℓ}\n\ninstance\n List-equiv : ⦃ Equiv{ℓₑ}(T) ⦄ → Equiv(List(T))\n List-equiv = intro (AllElements₂(_≡_)) ⦃ intro ⦃ intro refl ⦄ ⦃ intro sym ⦄ ⦃ intro trans ⦄ ⦄ where\n refl : Names.Reflexivity(AllElements₂(_≡_))\n refl{∅} = ∅\n refl{x ⊰ l} = reflexivity(_≡_) ⊰ refl{l}\n\n sym : Names.Symmetry(AllElements₂(_≡_))\n sym ∅ = ∅\n sym (p ⊰ ps) = symmetry(_≡_) p ⊰ sym ps\n\n trans : Names.Transitivity(AllElements₂(_≡_))\n trans ∅ ∅ = ∅\n trans (p ⊰ ps) (q ⊰ qs) = (transitivity(_≡_) p q) ⊰ (trans ps qs)\n\ninstance\n List-equiv-extensionality : ⦃ equiv : Equiv{ℓₑ}(T) ⦄ → Extensionality(List-equiv ⦃ equiv ⦄)\n List-equiv-extensionality ⦃ equiv ⦄ = intro ⦃ binaryOperator = intro(_⊰_) ⦄ (\\{(p ⊰ _) → p}) (\\{(_ ⊰ pl) → pl}) \\()\n", "meta": {"hexsha": "8b46bd2149b15838629b2db02b33b0f5015f9316", "size": 1206, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/List/Setoid.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/List/Setoid.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/List/Setoid.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.5, "max_line_length": 117, "alphanum_fraction": 0.6575456053, "num_tokens": 420, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467706759584, "lm_q2_score": 0.7634837743174788, "lm_q1q2_score": 0.6712142946547037}} {"text": "{-# OPTIONS --prop --rewriting --confluence-check #-}\n\nopen import Agda.Primitive\nopen import Agda.Builtin.Equality\nopen import Agda.Builtin.Nat renaming (Nat to ℕ; _+_ to _+ℕ_)\n\ninfix 4 _≐_\ndata _≐_ {ℓ} {A : Set ℓ} (x : A) : A → Prop ℓ where\n refl : x ≐ x\n\n{-# BUILTIN REWRITE _≐_ #-}\n\nvariable\n ℓ : Level\n A B C : Set ℓ\n x y z : A\n\ncong : (f : A → B) → x ≐ y → f x ≐ f y\ncong f refl = refl\n\ndata ℤ : Set where\n zero : ℤ\n pred suc : ℤ → ℤ\n\npostulate\n pred-suc : (x : ℤ) → pred (suc x) ≐ x\n suc-pred : (x : ℤ) → suc (pred x) ≐ x\n\n{-# REWRITE pred-suc suc-pred #-}\n\n_+_ : ℤ → ℤ → ℤ\nzero + y = y\npred x + y = pred (x + y)\nsuc x + y = suc (x + y)\n\n-_ : ℤ → ℤ\n- zero = zero\n- pred x = suc (- x)\n- suc x = pred (- x)\n\ndata ℤ′ : Set where\n +[_] : ℕ → ℤ′\n -[1+_] : ℕ → ℤ′\n\nsuc′ : ℤ′ → ℤ′\nsuc′ +[ x ] = +[ suc x ]\nsuc′ -[1+ zero ] = +[ zero ]\nsuc′ -[1+ suc x ] = -[1+ x ]\n\npred′ : ℤ′ → ℤ′\npred′ +[ zero ] = -[1+ zero ]\npred′ +[ suc x ] = +[ x ]\npred′ -[1+ x ] = -[1+ suc x ]\n\nsuc-pred′ : suc′ (pred′ x) ≐ x\nsuc-pred′ {+[ zero ]} = refl\nsuc-pred′ {+[ suc x ]} = refl\nsuc-pred′ { -[1+ x ]} = refl\n\npred-suc′ : pred′ (suc′ x) ≐ x\npred-suc′ {+[ x ]} = refl\npred-suc′ { -[1+ zero ]} = refl\npred-suc′ { -[1+ suc x ]} = refl\n\n{-# REWRITE suc-pred′ pred-suc′ #-}\n\nnorm : ℤ → ℤ′\nnorm zero = +[ 0 ]\nnorm (pred x) = pred′ (norm x)\nnorm (suc x) = suc′ (norm x)\n\nfree : ℤ′ → ℤ\nfree +[ zero ] = zero\nfree +[ suc x ] = suc (free +[ x ])\nfree -[1+ zero ] = pred zero\nfree -[1+ suc x ] = pred (free -[1+ x ])\n", "meta": {"hexsha": "f4b10aea4e908f0d7ed45bb493f4f8e3d4b5cc1b", "size": 1499, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/ConstructorRewriteConfluence.agda", "max_stars_repo_name": "hborum/agda", "max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-10-29T09:40:30.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-20T00:28:57.000Z", "max_issues_repo_path": "test/Succeed/ConstructorRewriteConfluence.agda", "max_issues_repo_name": "hborum/agda", "max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z", "max_forks_repo_path": "test/Succeed/ConstructorRewriteConfluence.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-04-01T18:30:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-01T18:30:09.000Z", "avg_line_length": 19.4675324675, "max_line_length": 61, "alphanum_fraction": 0.4976651101, "num_tokens": 686, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8633916240341031, "lm_q2_score": 0.7772998714925403, "lm_q1q2_score": 0.671114198409444}} {"text": "-- Martin-Löf identity type\n\n{-# OPTIONS --without-K --safe #-}\nmodule TypeTheory.Identity where\n\nopen import Level renaming (zero to lzero; suc to lsuc)\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as P using (refl; _≡_)\n renaming (trans to ≡-trans; sym to ≡-sym; cong to ≡-cong)\nimport Relation.Binary.Reasoning.Setoid as SetoidReasoning\n\nrecord JBundle a : Set (lsuc a) where\n field\n Carrier : Set a\n _≈_ : Rel Carrier a\n ≈-refl : ∀ {x} → x ≈ x\n J : (C : ∀ x y → x ≈ y → Set a) → (∀ x → C x x ≈-refl) →\n ∀ x y (p : x ≈ y) → C x y p\n J-β : ∀ (C : ∀ x y → x ≈ y → Set a) (c : ∀ x → C x x ≈-refl) x →\n J C c x x ≈-refl ≡ c x\n\nmodule JBundleProperties {a} (jBundle : JBundle a) where\n open JBundle jBundle renaming (Carrier to A)\n sym : ∀ {x y} → x ≈ y → y ≈ x\n sym {x} {y} x≈y = J (λ x₁ y₁ x₁≈y₁ → y₁ ≈ x₁) (λ _ → ≈-refl) x y x≈y\n\n sym-≈-refl : ∀ x → sym (≈-refl {x}) ≡ ≈-refl\n sym-≈-refl x = J-β (λ x₁ y₁ x₁≈y₁ → y₁ ≈ x₁) (λ _ → ≈-refl) x\n\n sym-involutive : ∀ {x y} (p : x ≈ y) → sym (sym p) ≡ p\n sym-involutive {x} {y} p =\n J (λ x₁ y₁ x₁≈y₁ → sym (sym x₁≈y₁) ≡ x₁≈y₁)\n (λ z → ≡-trans (≡-cong sym (sym-≈-refl z)) (sym-≈-refl z)) x y p\n\n sym-injective : ∀ {x y} {p q : x ≈ y} → sym p ≡ sym q → p ≡ q\n sym-injective {p = p} {q} eq = begin\n p ≡⟨ ≡-sym (sym-involutive p) ⟩\n sym (sym p) ≡⟨ ≡-cong sym eq ⟩\n sym (sym q) ≡⟨ sym-involutive q ⟩\n q ∎\n where open P.≡-Reasoning\n{-\n trans : ∀ {x y z} → x ≈ y → y ≈ z → x ≈ z\n trans {x} {y} {z} x≈y y≈z = J D (λ u → λ w q → q) x y x≈y z y≈z\n where\n D : ∀ u v → u ≈ v → Set _\n D u v u≈v = ∀ w → (q : v ≈ w) → u ≈ w\n-}\n trans : ∀ {x y z} → x ≈ y → y ≈ z → x ≈ z\n trans {x} {y} {z} x≈y y≈z = J D (λ u → λ w q → J E (λ _ → ≈-refl) u w q) x y x≈y z y≈z\n where\n D : ∀ u v → u ≈ v → Set _\n D u v u≈v = ∀ w → v ≈ w → u ≈ w\n E : ∀ u v → u ≈ v → Set _\n E u v q = u ≈ v\n", "meta": {"hexsha": "00f4ae2789a07d86b4e28b09aaa70eb510d8d0dd", "size": 1967, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "TypeTheory/Identity.agda", "max_stars_repo_name": "rei1024/agda-misc", "max_stars_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:49:42.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-21T00:03:43.000Z", "max_issues_repo_path": "TypeTheory/Identity.agda", "max_issues_repo_name": "rei1024/agda-misc", "max_issues_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TypeTheory/Identity.agda", "max_forks_repo_name": "rei1024/agda-misc", "max_forks_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.125, "max_line_length": 88, "alphanum_fraction": 0.4865277072, "num_tokens": 937, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887588023318196, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6709373444914097}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Setoids.Setoids\nopen import Functions.Definition\nopen import Groups.Definition\nopen import Sets.EquivalenceRelations\nopen import Groups.Homomorphisms.Definition\n\nmodule Groups.Homomorphisms.Examples where\n\nidentityHom : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+A_ : A → A → A} (G : Group S _+A_) → GroupHom G G id\nGroupHom.groupHom (identityHom {S = S} G) = Equivalence.reflexive (Setoid.eq S)\nGroupHom.wellDefined (identityHom G) = id\n", "meta": {"hexsha": "71fb1fe2c81b8c5dcafc731ce8a6a6a5c3bfa3b8", "size": 507, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Homomorphisms/Examples.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Homomorphisms/Examples.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Homomorphisms/Examples.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 36.2142857143, "max_line_length": 114, "alphanum_fraction": 0.7297830375, "num_tokens": 155, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8887587964389112, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6709373400427648}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n{-\n Extremal Mono and Epimorphisms.\n\n https://ncatlab.org/nlab/show/extremal+epimorphism\n-}\n\nopen import Categories.Category.Core\n\nmodule Categories.Morphism.Extremal {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\nopen import Categories.Morphism 𝒞\n\nopen Category 𝒞\n\nIsExtremalEpi : ∀ {A B} {f : A ⇒ B} → Epi f → Set (o ⊔ ℓ ⊔ e)\nIsExtremalEpi {A = A} {B = B} {f = f} epi =\n ∀ {X} {i : X ⇒ B} {g : A ⇒ X} → Mono i → f ≈ i ∘ g → IsIso i\n\nIsExtremalMono : ∀ {A B} {f : A ⇒ B} → Mono f → Set (o ⊔ ℓ ⊔ e)\nIsExtremalMono {A = A} {B = B} {f = f} mono =\n ∀ {X} {g : X ⇒ B} {i : A ⇒ X} → Epi i → f ≈ g ∘ i → IsIso i\n \nrecord ExtremalEpi {A B} (f : A ⇒ B) : Set (o ⊔ ℓ ⊔ e) where\n field\n epi : Epi f\n extremal : IsExtremalEpi epi\n \n\nrecord ExtremalMono {A B} (f : A ⇒ B) : Set (o ⊔ ℓ ⊔ e) where\n field\n mono : Mono f\n extremal : IsExtremalMono mono\n", "meta": {"hexsha": "375d5a75dbbc19f2f5d4664569d7a2128e8a250b", "size": 903, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Morphism/Extremal.agda", "max_stars_repo_name": "maxsnew/agda-categories", "max_stars_repo_head_hexsha": "8f3c844d929508040dfa21f681fa260056214b73", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Morphism/Extremal.agda", "max_issues_repo_name": "maxsnew/agda-categories", "max_issues_repo_head_hexsha": "8f3c844d929508040dfa21f681fa260056214b73", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Morphism/Extremal.agda", "max_forks_repo_name": "maxsnew/agda-categories", "max_forks_repo_head_hexsha": "8f3c844d929508040dfa21f681fa260056214b73", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.0833333333, "max_line_length": 70, "alphanum_fraction": 0.5725359911, "num_tokens": 383, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887587817066392, "lm_q2_score": 0.7549149868676283, "lm_q1q2_score": 0.6709373240205568}} {"text": "{-# OPTIONS --allow-unsolved-metas #-}\nmodule finiteSet where\n\nopen import Data.Nat hiding ( _≟_ )\nopen import Data.Fin renaming ( _<_ to _<<_ ) hiding (_≤_)\n-- open import Data.Fin.Properties hiding ( ≤-refl )\nopen import Data.Empty\nopen import Relation.Nullary\nopen import Relation.Binary.Definitions\nopen import Relation.Binary.PropositionalEquality\nopen import logic\nopen import nat\nopen import Data.Nat.Properties hiding ( _≟_ )\n\nopen import Relation.Binary.HeterogeneousEquality as HE using (_≅_ ) \n\nrecord FiniteSet ( Q : Set ) : Set where\n field\n finite : ℕ\n Q←F : Fin finite → Q\n F←Q : Q → Fin finite\n finiso→ : (q : Q) → Q←F ( F←Q q ) ≡ q\n finiso← : (f : Fin finite ) → F←Q ( Q←F f ) ≡ f\n exists1 : (m : ℕ ) → m Data.Nat.≤ finite → (Q → Bool) → Bool\n exists1 zero _ _ = false\n exists1 ( suc m ) m Nat\n\nf : Nat -> Nat -> Nat\nf zero = \\x -> x\nf (suc n) m = f n (suc m)\n\n", "meta": {"hexsha": "e07cf9a5834820332c025a0411d25f0aa6a9c071", "size": 158, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/fail/DifferentArities.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T07:26:06.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T07:26:06.000Z", "max_issues_repo_path": "test/fail/DifferentArities.agda", "max_issues_repo_name": "dagit/agda", "max_issues_repo_head_hexsha": "4383a3d20328a6c43689161496cee8eb479aca08", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/fail/DifferentArities.agda", "max_forks_repo_name": "dagit/agda", "max_forks_repo_head_hexsha": "4383a3d20328a6c43689161496cee8eb479aca08", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 13.1666666667, "max_line_length": 29, "alphanum_fraction": 0.5506329114, "num_tokens": 59, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099070011518829, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.670745378386245}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\nopen import Categories.Object.Zero\n\n-- Cokernels of morphisms.\n-- https://ncatlab.org/nlab/show/cokernel\nmodule Categories.Object.Cokernel {o ℓ e} {𝒞 : Category o ℓ e} (𝟎 : Zero 𝒞) where\n\nopen import Level\n\nopen import Categories.Morphism 𝒞\nopen import Categories.Morphism.Reasoning 𝒞\n hiding (glue)\n\nopen Category 𝒞\nopen Zero 𝟎\n\nopen HomReasoning\n\nprivate\n variable\n A B X : Obj\n f h i j k : A ⇒ B\n\nrecord IsCokernel {A B K} (f : A ⇒ B) (k : B ⇒ K) : Set (o ⊔ ℓ ⊔ e) where\n field\n commute : k ∘ f ≈ zero⇒\n universal : ∀ {X} {h : B ⇒ X} → h ∘ f ≈ zero⇒ → K ⇒ X\n factors : ∀ {eq : h ∘ f ≈ zero⇒} → h ≈ universal eq ∘ k\n unique : ∀ {eq : h ∘ f ≈ zero⇒} → h ≈ i ∘ k → i ≈ universal eq\n\n universal-resp-≈ : ∀ {eq : h ∘ f ≈ zero⇒} {eq′ : i ∘ f ≈ zero⇒} →\n h ≈ i → universal eq ≈ universal eq′\n universal-resp-≈ h≈i = unique (⟺ h≈i ○ factors)\n\n universal-∘ : h ∘ k ∘ f ≈ zero⇒\n universal-∘ {h = h} = begin\n h ∘ k ∘ f ≈⟨ refl⟩∘⟨ commute ⟩\n h ∘ zero⇒ ≈⟨ zero-∘ˡ h ⟩\n zero⇒ ∎\n\nrecord Cokernel {A B} (f : A ⇒ B) : Set (o ⊔ ℓ ⊔ e) where\n field\n {cokernel} : Obj\n cokernel⇒ : B ⇒ cokernel\n isCokernel : IsCokernel f cokernel⇒\n\n open IsCokernel isCokernel public\n\nIsCokernel⇒Cokernel : IsCokernel f k → Cokernel f\nIsCokernel⇒Cokernel {k = k} isCokernel = record\n { cokernel⇒ = k\n ; isCokernel = isCokernel\n }\n", "meta": {"hexsha": "267f256b72327f95cbc72cc279095d627b19a65c", "size": 1427, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Object/Cokernel.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Object/Cokernel.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Object/Cokernel.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 25.4821428571, "max_line_length": 81, "alphanum_fraction": 0.5914505957, "num_tokens": 617, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110569397306, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6706531282366919}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Category.Extensive where\n\n-- https://ncatlab.org/nlab/show/extensive+category\n\nopen import Level\n\nopen import Categories.Category.Core\nopen import Categories.Diagram.Pullback\nopen import Categories.Category.Cocartesian\nopen import Categories.Object.Coproduct\nopen import Categories.Morphism\n\nrecord Extensive {o ℓ e : Level} (𝒞 : Category o ℓ e) : Set (suc (o ⊔ ℓ ⊔ e)) where\n open Category 𝒞\n open Pullback\n\n field\n cocartesian : Cocartesian 𝒞\n\n module CC = Cocartesian cocartesian\n open CC using (_+_; i₁; i₂; ¡)\n\n field\n pullback₁ : {A B C : Obj} (f : A ⇒ B + C) → Pullback 𝒞 f i₁\n pullback₂ : {A B C : Obj} (f : A ⇒ B + C) → Pullback 𝒞 f i₂\n pullback-of-cp-is-cp : {A B C : Obj} (f : A ⇒ _+_ B C) → IsCoproduct 𝒞 (p₁ (pullback₁ f)) (p₁ (pullback₂ f))\n \n pullback₁-is-mono : ∀ {A B : Obj} → Mono 𝒞 (i₁ {A = A}{B = B})\n pullback₂-is-mono : ∀ {A B : Obj} → Mono 𝒞 (i₂ {A = A}{B = B})\n\n disjoint : ∀ {A B : Obj} → IsPullback 𝒞 ¡ ¡ (i₁ {A = A}{B = B}) i₂\n\n\n\n\n\n\n\n\n\n\n\n", "meta": {"hexsha": "d8c2c3eecf439e893d67a8c09f668ef3235ab517", "size": 1049, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Extensive.agda", "max_stars_repo_name": "sergey-goncharov/agda-categories", "max_stars_repo_head_hexsha": "e2d7596549e7840b521576f48746ac3c4560f126", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Extensive.agda", "max_issues_repo_name": "sergey-goncharov/agda-categories", "max_issues_repo_head_hexsha": "e2d7596549e7840b521576f48746ac3c4560f126", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Extensive.agda", "max_forks_repo_name": "sergey-goncharov/agda-categories", "max_forks_repo_head_hexsha": "e2d7596549e7840b521576f48746ac3c4560f126", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.3111111111, "max_line_length": 112, "alphanum_fraction": 0.6244041945, "num_tokens": 380, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9173026528034425, "lm_q2_score": 0.7310585903489891, "lm_q1q2_score": 0.6706019842818729}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Data.FinData.Base where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Function\n\nimport Cubical.Data.Empty as ⊥\nopen import Cubical.Data.Nat using (ℕ; zero; suc; _+_; _·_; +-assoc)\nopen import Cubical.Data.Bool.Base\nopen import Cubical.Relation.Nullary\n\nprivate\n variable\n ℓ : Level\n A B : Type ℓ\n\ndata Fin : ℕ → Type₀ where\n zero : {n : ℕ} → Fin (suc n)\n suc : {n : ℕ} (i : Fin n) → Fin (suc n)\n\n-- useful patterns\npattern one = suc zero\npattern two = suc one\n\ntoℕ : ∀ {n} → Fin n → ℕ\ntoℕ zero = 0\ntoℕ (suc i) = suc (toℕ i)\n\nfromℕ : (n : ℕ) → Fin (suc n)\nfromℕ zero = zero\nfromℕ (suc n) = suc (fromℕ n)\n\ntoFromId : ∀ (n : ℕ) → toℕ (fromℕ n) ≡ n\ntoFromId zero = refl\ntoFromId (suc n) = cong suc (toFromId n)\n\n¬Fin0 : ¬ Fin 0\n¬Fin0 ()\n\n_==_ : ∀ {n} → Fin n → Fin n → Bool\nzero == zero = true\nzero == suc _ = false\nsuc _ == zero = false\nsuc m == suc n = m == n\n\nweakenFin : {n : ℕ} → Fin n → Fin (suc n)\nweakenFin zero = zero\nweakenFin (suc i) = suc (weakenFin i)\n\npredFin : {n : ℕ} → Fin (suc (suc n)) → Fin (suc n)\npredFin zero = zero\npredFin (suc x) = x\n\nfoldrFin : ∀ {n} → (A → B → B) → B → (Fin n → A) → B\nfoldrFin {n = zero} _ b _ = b\nfoldrFin {n = suc n} f b l = f (l zero) (foldrFin f b (l ∘ suc))\n\nelim\n : ∀(P : ∀{k} → Fin k → Type ℓ)\n → (∀{k} → P {suc k} zero)\n → (∀{k} → {fn : Fin k} → P fn → P (suc fn))\n → {k : ℕ} → (fn : Fin k) → P fn\n\nelim P fz fs {zero} = ⊥.rec ∘ ¬Fin0\nelim P fz fs {suc k} zero = fz\nelim P fz fs {suc k} (suc fj) = fs (elim P fz fs fj)\n\n\nrec : ∀{k} → (a0 aS : A) → Fin k → A\nrec a0 aS zero = a0\nrec a0 aS (suc x) = aS\n\nFinVec : (A : Type ℓ) (n : ℕ) → Type ℓ\nFinVec A n = Fin n → A\n\nreplicateFinVec : (n : ℕ) → A → FinVec A n\nreplicateFinVec _ a _ = a\n\n\n_++Fin_ : {n m : ℕ} → FinVec A n → FinVec A m → FinVec A (n + m)\n_++Fin_ {n = zero} _ W i = W i\n_++Fin_ {n = suc n} V _ zero = V zero\n_++Fin_ {n = suc n} V W (suc i) = ((V ∘ suc) ++Fin W) i\n", "meta": {"hexsha": "a994130a44160e67265e82b31b1ee4f8e1a6bf06", "size": 1964, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/FinData/Base.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/FinData/Base.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/FinData/Base.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.380952381, "max_line_length": 68, "alphanum_fraction": 0.5636456212, "num_tokens": 842, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267796346599, "lm_q2_score": 0.7718435030872968, "lm_q1q2_score": 0.6705983051692708}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.NatSolver.Examples where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.FinData\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Vec.Base\n\nopen import Cubical.Algebra.NatSolver.NatExpression\nopen import Cubical.Algebra.NatSolver.HornerForms\nopen import Cubical.Algebra.NatSolver.Solver\nopen import Cubical.Algebra.NatSolver.Reflection\n\nprivate\n variable\n ℓ : Level\n\nmodule ReflectionSolving where\n _ : (x y : ℕ) → (x + y) · (x + y) ≡ x · x + 2 · x · y + y · y\n _ = solve\n\n {-\n If you want to use the solver in some more complex situation,\n you have to declare a helper variable (`useSolver` below) that\n is a term of a dependent function type as above:\n -}\n module _ (SomeType : Type ℓ-zero) where\n complexSolverApplication :\n (someStuff : SomeType) → (x y : ℕ) → (moreStuff : SomeType)\n → x + y ≡ y + x\n complexSolverApplication someStuff x y moreStuff = useSolver x y\n where useSolver : (x y : ℕ) → x + y ≡ y + x\n useSolver = solve\n\nmodule SolvingExplained where\n open EqualityToNormalform renaming (solve to natSolve)\n open IteratedHornerOperations hiding (X)\n\n ℕ[X₀,X₁] = IteratedHornerForms 2\n X₀ : ℕ[X₀,X₁]\n X₀ = Variable 2 (Fin.zero)\n\n X₁ : ℕ[X₀,X₁]\n X₁ = Variable 2 (suc Fin.zero)\n\n Two : ℕ[X₀,X₁]\n Two = Constant 2 2\n\n _ : eval X₀ (1 ∷ 0 ∷ []) ≡ 1\n _ = refl\n\n _ : eval X₁ (0 ∷ 1 ∷ []) ≡ 1\n _ = refl\n\n X : Expr 3\n X = ∣ Fin.zero\n\n Y : Expr 3\n Y = ∣ (suc Fin.zero)\n\n Z : Expr 3\n Z = ∣ (suc (suc Fin.zero))\n\n {-\n 'normalize' maps an expression to its Horner Normalform.\n Two expressions evaluating to the same ring element\n have the same Horner Normal form.\n This means equality of the represented ring elements\n can be checked by agda's unification (so refl is a proof)\n\n -}\n _ : normalize ((K 2) ·' X) ≡\n normalize (X +' X)\n _ = refl\n\n\n _ : normalize ((K 2) ·' X) ≡ normalize (X +' X)\n _ = refl\n\n _ : normalize (((K 2) ·' X) ·' Y) ≡ normalize (Y ·' (X +' X))\n _ = refl\n\n _ : normalize (Z ·' (((K 2) ·' X) ·' Y)) ≡ normalize (Z ·' (Y ·' (X +' X)))\n _ = refl\n\n\n {-\n The solver needs to produce an equality between\n actual ring elements. So we need a proof that\n those actual ring elements are equal to a normal form:\n -}\n _ : (x y z : ℕ) →\n eval (normalize ((K 2) ·' X ·' Y)) (x ∷ y ∷ z ∷ [])\n ≡ 2 · x · y\n _ = λ x y z → isEqualToNormalform ((K 2) ·' X ·' Y) (x ∷ y ∷ z ∷ [])\n\n {-\n Now two of these proofs can be plugged together\n to solve an equation:\n -}\n open Eval\n _ : (x y z : ℕ) → 3 + x + y · y ≡ y · y + x + 1 + 2\n _ = let\n lhs = (K 3) +' X +' (Y ·' Y)\n rhs = Y ·' Y +' X +' (K 1) +' (K 2)\n in (λ x y z →\n ⟦ lhs ⟧ (x ∷ y ∷ z ∷ [])\n ≡⟨ sym (isEqualToNormalform lhs (x ∷ y ∷ z ∷ [])) ⟩\n eval (normalize lhs) (x ∷ y ∷ z ∷ [])\n ≡⟨ refl ⟩\n eval (normalize rhs) (x ∷ y ∷ z ∷ [])\n ≡⟨ isEqualToNormalform rhs (x ∷ y ∷ z ∷ []) ⟩\n ⟦ rhs ⟧ (x ∷ y ∷ z ∷ []) ∎)\n\n {-\n Parts of that can be automated easily:\n -}\n _ : (x y z : ℕ) → (x + y) · (x + y) ≡ x · x + 2 · x · y + y · y\n _ = λ x y z → let\n lhs = (X +' Y) ·' (X +' Y)\n rhs = X ·' X +' (K 2) ·' X ·' Y +' Y ·' Y\n in natSolve lhs rhs (x ∷ y ∷ z ∷ []) refl\n\n {-\n A bigger example\n -}\n _ : (x y z : ℕ) → (x + y) · (x + y) · (x + y) · (x + y)\n ≡ x · x · x · x + 4 · x · x · x · y + 6 · x · x · y · y\n + 4 · x · y · y · y + y · y · y · y\n _ = λ x y z → let\n lhs = (X +' Y) ·' (X +' Y) ·' (X +' Y) ·' (X +' Y)\n rhs = X ·' X ·' X ·' X\n +' (K 4) ·' X ·' X ·' X ·' Y\n +' (K 6) ·' X ·' X ·' Y ·' Y\n +' (K 4) ·' X ·' Y ·' Y ·' Y\n +' Y ·' Y ·' Y ·' Y\n in natSolve lhs rhs (x ∷ y ∷ z ∷ []) refl\n {-\n this one cannot work so far:\n\n _ : (x y z : ℕ) → (x + y) · (x - y) ≡ (x · x - (y · y))\n _ = λ x y z → let\n lhs = (X +' Y) ·' (X +' (-' Y))\n rhs = (X ·' X) +' (-' (Y ·' Y))\n in natSolve lhs rhs (x ∷ y ∷ z ∷ []) {!!}\n -}\n", "meta": {"hexsha": "f177de40487a7f69838d96fd88ea012f1eff04aa", "size": 4235, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/NatSolver/Examples.agda", "max_stars_repo_name": "FernandoLarrain/cubical", "max_stars_repo_head_hexsha": "9acdecfa6437ec455568be4e5ff04849cc2bc13b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-03-05T00:28:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T00:28:39.000Z", "max_issues_repo_path": "Cubical/Algebra/NatSolver/Examples.agda", "max_issues_repo_name": "Seanpm2001-web/cubical", "max_issues_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/NatSolver/Examples.agda", "max_forks_repo_name": "Seanpm2001-web/cubical", "max_forks_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.6148648649, "max_line_length": 77, "alphanum_fraction": 0.479811098, "num_tokens": 1566, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267660487573, "lm_q2_score": 0.7718434873426302, "lm_q1q2_score": 0.6705982810036923}} {"text": "module New.Types where\n\nopen import Data.Integer public\nopen import Data.Product public hiding (map)\nopen import Data.Sum public hiding (map)\ninfixr 5 _⇒_\n\ndata Type : Set where\n _⇒_ : (σ τ : Type) → Type\n int : Type\n pair : (σ τ : Type) → Type\n sum : (σ τ : Type) → Type\n\n⟦_⟧Type : Type → Set\n⟦ σ ⇒ τ ⟧Type = ⟦ σ ⟧Type → ⟦ τ ⟧Type\n⟦ int ⟧Type = ℤ\n⟦ pair σ τ ⟧Type = ⟦ σ ⟧Type × ⟦ τ ⟧Type\n⟦ sum σ τ ⟧Type = ⟦ σ ⟧Type ⊎ ⟦ τ ⟧Type\n\nΔt : Type → Type\nΔt (σ ⇒ τ) = σ ⇒ Δt σ ⇒ Δt τ\nΔt int = int\nΔt (pair σ τ) = pair (Δt σ) (Δt τ)\nΔt (sum σ τ) = sum (sum (Δt σ) (Δt τ)) (sum σ τ)\n", "meta": {"hexsha": "f57c7d3561ecd60935fdae1e178ef208fc5e0424", "size": 577, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "New/Types.agda", "max_stars_repo_name": "inc-lc/ilc-agda", "max_stars_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2015-03-04T06:09:20.000Z", "max_stars_repo_stars_event_max_datetime": "2019-07-19T07:06:59.000Z", "max_issues_repo_path": "New/Types.agda", "max_issues_repo_name": "inc-lc/ilc-agda", "max_issues_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2015-07-01T18:09:31.000Z", "max_issues_repo_issues_event_max_datetime": "2017-05-04T13:53:59.000Z", "max_forks_repo_path": "New/Types.agda", "max_forks_repo_name": "inc-lc/ilc-agda", "max_forks_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2016-02-18T12:26:44.000Z", "max_forks_repo_forks_event_max_datetime": "2016-02-18T12:26:44.000Z", "avg_line_length": 23.08, "max_line_length": 48, "alphanum_fraction": 0.5736568458, "num_tokens": 266, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.945801271704518, "lm_q2_score": 0.7090191337850932, "lm_q1q2_score": 0.6705911983967769}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\nopen import Categories.Category.Complete\n\nmodule Categories.Category.Complete.Properties.SolutionSet where\n\nopen import Level\n\nopen import Categories.Functor\nopen import Categories.Object.Initial\nopen import Categories.Object.Product.Indexed\nopen import Categories.Object.Product.Indexed.Properties\nopen import Categories.Diagram.Equalizer\nopen import Categories.Diagram.Equalizer.Limit\nopen import Categories.Diagram.Equalizer.Properties\n\nimport Categories.Diagram.Limit as Lim\nimport Categories.Morphism.Reasoning as MR\n\nprivate\n variable\n o ℓ e : Level\n o′ ℓ′ e′ : Level\n J : Category o ℓ e\n\nmodule _ (C : Category o ℓ e) where\n open Category C\n\n record SolutionSet : Set (o ⊔ ℓ) where\n field\n D : Obj → Obj\n arr : ∀ X → D X ⇒ X\n\nmodule _ {C : Category o ℓ e} (Com : Complete (o ⊔ ℓ ⊔ o′) (o ⊔ ℓ ⊔ ℓ′) (o ⊔ ℓ ⊔ e′) C) (S : SolutionSet C) where\n private\n module S = SolutionSet S\n module C = Category C\n\n open S\n open Category C\n open HomReasoning\n open MR C\n\n W : IndexedProductOf C D\n W = Complete⇒IndexedProductOf C {o′ = ℓ ⊔ o′} {ℓ′ = ℓ ⊔ ℓ′} {e′ = ℓ ⊔ e′} Com D\n module W = IndexedProductOf W\n\n W⇒W : Set ℓ\n W⇒W = W.X ⇒ W.X\n\n Warr : IndexedProductOf C {I = W⇒W} λ _ → W.X\n Warr = Complete⇒IndexedProductOf C {o′ = o ⊔ o′} {ℓ′ = o ⊔ ℓ′} {e′ = o ⊔ e′} Com _\n module Warr = IndexedProductOf Warr\n\n Δ : W.X ⇒ Warr.X\n Δ = Warr.⟨ (λ _ → C.id) ⟩\n\n Γ : W.X ⇒ Warr.X\n Γ = Warr.⟨ (λ f → f) ⟩\n\n equalizer : Equalizer C Δ Γ\n equalizer = complete⇒equalizer C Com Δ Γ\n module equalizer = Equalizer equalizer\n\n prop : (f : W.X ⇒ W.X) → f ∘ equalizer.arr ≈ equalizer.arr\n prop f = begin\n f ∘ equalizer.arr ≈˘⟨ pullˡ (Warr.commute _ f) ⟩\n Warr.π f ∘ Γ ∘ equalizer.arr ≈˘⟨ refl⟩∘⟨ equalizer.equality ⟩\n Warr.π f ∘ Δ ∘ equalizer.arr ≈⟨ cancelˡ (Warr.commute _ f) ⟩\n equalizer.arr ∎\n\n ! : ∀ A → equalizer.obj ⇒ A\n ! A = arr A ∘ W.π A ∘ equalizer.arr\n\n module _ {A} (f : equalizer.obj ⇒ A) where\n\n equalizer′ : Equalizer C (! A) f\n equalizer′ = complete⇒equalizer C Com (! A) f\n module equalizer′ = Equalizer equalizer′\n\n s : W.X ⇒ equalizer′.obj\n s = arr _ ∘ W.π (equalizer′.obj)\n\n t : W.X ⇒ W.X\n t = equalizer.arr ∘ equalizer′.arr ∘ s\n\n t′ : equalizer.obj ⇒ equalizer.obj\n t′ = equalizer′.arr ∘ s ∘ equalizer.arr\n\n t∘eq≈eq∘1 : equalizer.arr ∘ t′ ≈ equalizer.arr ∘ C.id\n t∘eq≈eq∘1 = begin\n equalizer.arr ∘ t′ ≈⟨ refl⟩∘⟨ sym-assoc ⟩\n equalizer.arr ∘ (equalizer′.arr ∘ s) ∘ equalizer.arr ≈⟨ sym-assoc ⟩\n t ∘ equalizer.arr ≈⟨ prop _ ⟩\n equalizer.arr ≈˘⟨ identityʳ ⟩\n equalizer.arr ∘ C.id ∎\n\n t′≈id : t′ ≈ C.id\n t′≈id = Equalizer⇒Mono C equalizer _ _ t∘eq≈eq∘1\n\n !-unique : ! A ≈ f\n !-unique = equalizer-≈⇒≈ C equalizer′ t′≈id\n\n SolutionSet⇒Initial : Initial C\n SolutionSet⇒Initial = record\n { ⊥ = equalizer.obj\n ; ⊥-is-initial = record\n { ! = ! _\n ; !-unique = !-unique\n }\n }\n", "meta": {"hexsha": "f5629ad811d9638ff745377774cf460bc1d4e74a", "size": 3272, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Complete/Properties/SolutionSet.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Complete/Properties/SolutionSet.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Complete/Properties/SolutionSet.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 28.9557522124, "max_line_length": 113, "alphanum_fraction": 0.5638753056, "num_tokens": 1148, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898178450964, "lm_q2_score": 0.740174367770488, "lm_q1q2_score": 0.6705904406299937}} {"text": "------------------------------------------------------------------------\n-- Lexicographic induction\n------------------------------------------------------------------------\n\nmodule Induction.Lexicographic where\n\nopen import Induction\nopen import Data.Product\n\n-- The structure of lexicographic induction.\n\n_⊗_ : ∀ {a b} → RecStruct a → RecStruct b → RecStruct (a × b)\n_⊗_ RecA RecB P (x , y) =\n -- Either x is constant and y is \"smaller\", ...\n RecB (λ y' → P (x , y')) y\n ×\n -- ...or x is \"smaller\" and y is arbitrary.\n RecA (λ x' → ∀ y' → P (x' , y')) x\n\n-- Constructs a recursor builder for lexicographic induction.\n\n[_⊗_] : ∀ {a} {RecA : RecStruct a} → RecursorBuilder RecA →\n ∀ {b} {RecB : RecStruct b} → RecursorBuilder RecB →\n RecursorBuilder (RecA ⊗ RecB)\n[_⊗_] {RecA = RecA} recA {RecB = RecB} recB P f (x , y) =\n (p₁ x y p₂x , p₂x)\n where\n p₁ : ∀ x y →\n RecA (λ x' → ∀ y' → P (x' , y')) x →\n RecB (λ y' → P (x , y')) y\n p₁ x y x-rec = recB (λ y' → P (x , y'))\n (λ y y-rec → f (x , y) (y-rec , x-rec))\n y\n\n p₂ : ∀ x → RecA (λ x' → ∀ y' → P (x' , y')) x\n p₂ = recA (λ x → ∀ y → P (x , y))\n (λ x x-rec y → f (x , y) (p₁ x y x-rec , x-rec))\n\n p₂x = p₂ x\n\n------------------------------------------------------------------------\n-- Example\n\nprivate\n\n open import Data.Nat\n open import Induction.Nat as N\n\n -- The Ackermann function à la Rózsa Péter.\n\n ackermann : ℕ → ℕ → ℕ\n ackermann m n = build [ N.rec-builder ⊗ N.rec-builder ]\n AckPred ack (m , n)\n where\n AckPred : ℕ × ℕ → Set\n AckPred _ = ℕ\n\n ack : ∀ p → (N.Rec ⊗ N.Rec) AckPred p → AckPred p\n ack (zero , n) _ = 1 + n\n ack (suc m , zero) (_ , ackm•) = ackm• 1\n ack (suc m , suc n) (ack[1+m]n , ackm•) = ackm• ack[1+m]n\n", "meta": {"hexsha": "556236e647903d01f79c043b747a2d463a6a3efe", "size": 1854, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Induction/Lexicographic.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Induction/Lexicographic.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Induction/Lexicographic.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 29.9032258065, "max_line_length": 72, "alphanum_fraction": 0.4466019417, "num_tokens": 631, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898279984214, "lm_q2_score": 0.7401743563075446, "lm_q1q2_score": 0.6705904377599146}} {"text": "module Numeral.Natural.Proofs where\n\nimport Lvl\nopen import Numeral.Natural\nopen import Relator.Equals\nopen import Relator.Equals.Proofs.Equiv\nopen import Structure.Function\nopen import Structure.Function.Domain\n\nprivate variable n : ℕ\n\n[𝐒]-not-0 : (𝐒(n) ≢ 𝟎)\n[𝐒]-not-0 ()\n\n𝐒-not-self : (𝐒(n) ≢ n)\n𝐒-not-self ()\n\ninstance\n [𝐒]-injectivity : Injective(𝐒)\n Injective.proof([𝐒]-injectivity) = congruence₁(𝐏)\n\ninstance\n [𝐏][𝐒]-inverseᵣ : Inverseᵣ(𝐏)(𝐒)\n [𝐏][𝐒]-inverseᵣ = intro [≡]-intro\n", "meta": {"hexsha": "bc4f7d70eaa04db5f8314805671384ef69cf0386", "size": 488, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.52, "max_line_length": 51, "alphanum_fraction": 0.7090163934, "num_tokens": 200, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.905989815306765, "lm_q2_score": 0.7401743620390163, "lm_q1q2_score": 0.670590433558531}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Cubical.HITs.FiniteMultiset.Base where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.HITs.SetTruncation\nopen import Cubical.Foundations.HLevels\n\nprivate\n variable\n A : Type₀\n\ninfixr 5 _∷_\n\ndata FMSet (A : Type₀) : Type₀ where\n [] : FMSet A\n _∷_ : (x : A) → (xs : FMSet A) → FMSet A\n comm : ∀ x y xs → x ∷ y ∷ xs ≡ y ∷ x ∷ xs\n trunc : isSet (FMSet A)\n\npattern [_] x = x ∷ []\n\nmodule FMSetElim {ℓ} {B : FMSet A → Type ℓ}\n ([]* : B []) (_∷*_ : (x : A) {xs : FMSet A} → B xs → B (x ∷ xs))\n (comm* : (x y : A) {xs : FMSet A} (b : B xs)\n → PathP (λ i → B (comm x y xs i)) (x ∷* (y ∷* b)) (y ∷* (x ∷* b)))\n (trunc* : (xs : FMSet A) → isSet (B xs)) where\n\n f : (xs : FMSet A) → B xs\n f [] = []*\n f (x ∷ xs) = x ∷* f xs\n f (comm x y xs i) = comm* x y (f xs) i\n f (trunc xs zs p q i j) =\n isOfHLevel→isOfHLevelDep {n = 2} trunc* (f xs) (f zs) (cong f p) (cong f q) (trunc xs zs p q) i j\n\nmodule FMSetElimProp {ℓ} {B : FMSet A → Type ℓ} (BProp : {xs : FMSet A} → isProp (B xs))\n ([]* : B []) (_∷*_ : (x : A) {xs : FMSet A} → B xs → B (x ∷ xs)) where\n\n f : (xs : FMSet A) → B xs\n f = FMSetElim.f []* _∷*_\n (λ x y {xs} b →\n toPathP (BProp (transp (λ i → B (comm x y xs i)) i0 (x ∷* (y ∷* b))) (y ∷* (x ∷* b))))\n (λ xs → isProp→isSet BProp)\n\nmodule FMSetRec {ℓ} {B : Type ℓ} (BType : isSet B)\n ([]* : B) (_∷*_ : A → B → B)\n (comm* : (x y : A) (b : B) → x ∷* (y ∷* b) ≡ y ∷* (x ∷* b)) where\n\n f : FMSet A → B\n f = FMSetElim.f []* (λ x b → x ∷* b) (λ x y b → comm* x y b) (λ _ → BType)\n", "meta": {"hexsha": "617fb7a89ddd27c5a54e75a0a2c8d991e6dadd59", "size": 1589, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/HITs/FiniteMultiset/Base.agda", "max_stars_repo_name": "cj-xu/cubical", "max_stars_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/HITs/FiniteMultiset/Base.agda", "max_issues_repo_name": "cj-xu/cubical", "max_issues_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/HITs/FiniteMultiset/Base.agda", "max_forks_repo_name": "cj-xu/cubical", "max_forks_repo_head_hexsha": "7fd336c6d31a6e6d58a44114831aacd63f422545", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.78, "max_line_length": 102, "alphanum_fraction": 0.4921334172, "num_tokens": 728, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8539127455162773, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.6705850106739629}} {"text": "{-# OPTIONS --without-K #-}\nmodule HIT.Interval where\n\nopen import PathOperations\nopen import PathStructure.Id.Tr\nopen import Types\n\nmodule I-Definition where\n private\n data #I : Set where\n #0 : #I\n #1 : #I\n\n I : Set\n I = #I\n\n 0ᵢ : I\n 0ᵢ = #0\n\n 1ᵢ : I\n 1ᵢ = #1\n\n postulate\n seg : 0ᵢ ≡ 1ᵢ\n\n I-ind : ∀ {p} (P : I → Set p)\n (x₀ : P 0ᵢ) (x₁ : P 1ᵢ) (p : tr P seg x₀ ≡ x₁) →\n ∀ i → P i\n I-ind P x₀ x₁ p #0 = x₀\n I-ind P x₀ x₁ p #1 = x₁\n\n postulate\n I-β-i : ∀ {p} (P : I → Set p)\n (x₀ : P 0ᵢ) (x₁ : P 1ᵢ)\n (p : tr P seg x₀ ≡ x₁) →\n apd (I-ind P x₀ x₁ p) seg ≡ p\n\n I-rec : ∀ {p} {P : Set p}\n (x₀ x₁ : P) (p : x₀ ≡ x₁)\n (i : I) → P\n I-rec x₀ x₁ p #0 = x₀\n I-rec x₀ x₁ p #1 = x₁\n\n postulate\n I-β-r : ∀ {p} {P : Set p}\n (x₀ x₁ : P) (p : x₀ ≡ x₁) →\n ap (I-rec x₀ x₁ p) seg ≡ p\n\nopen I-Definition public\n\nfrom-path-space : ∀ {a} {A : Set a} →\n (Σ A λ x → Σ A λ y → x ≡ y) → I → A\nfrom-path-space (x , y , p) = I-rec x y p\n\nto-path-space : ∀ {a} {A : Set a} →\n (I → A) → Σ A λ x → Σ A λ y → x ≡ y\nto-path-space f = f 0ᵢ , f 1ᵢ , ap f seg\n", "meta": {"hexsha": "03e3495f88bf43678951313e2dfaa03c5ad9e29d", "size": 1102, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/HIT/Interval.agda", "max_stars_repo_name": "vituscze/HoTT-lectures", "max_stars_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/HIT/Interval.agda", "max_issues_repo_name": "vituscze/HoTT-lectures", "max_issues_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/HIT/Interval.agda", "max_forks_repo_name": "vituscze/HoTT-lectures", "max_forks_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.0, "max_line_length": 52, "alphanum_fraction": 0.4709618875, "num_tokens": 550, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8596637469145054, "lm_q2_score": 0.7799929104825006, "lm_q1q2_score": 0.670531627992137}} {"text": "{-\nThis second-order equational theory was created from the following second-order syntax description:\n\nsyntax Lens | L\n\ntype\n S : 0-ary\n A : 0-ary\n\nterm\n get : S -> A\n put : S A -> S\n\ntheory\n (PG) s : S a : A |> get (put (s, a)) = a\n (GP) s : S |> put (s, get(s)) = s\n (PP) s : S a b : A |> put (put(s, a), b) = put (s, a)\n-}\n\nmodule Lens.Equality where\n\nopen import SOAS.Common\nopen import SOAS.Context\nopen import SOAS.Variable\nopen import SOAS.Families.Core\nopen import SOAS.Families.Build\nopen import SOAS.ContextMaps.Inductive\n\nopen import Lens.Signature\nopen import Lens.Syntax\n\nopen import SOAS.Metatheory.SecondOrder.Metasubstitution L:Syn\nopen import SOAS.Metatheory.SecondOrder.Equality L:Syn\n\nprivate\n variable\n α β γ τ : LT\n Γ Δ Π : Ctx\n\ninfix 1 _▹_⊢_≋ₐ_\n\n-- Axioms of equality\ndata _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ L) α Γ → (𝔐 ▷ L) α Γ → Set where\n PG : ⁅ S ⁆ ⁅ A ⁆̣ ▹ ∅ ⊢ get (put 𝔞 𝔟) ≋ₐ 𝔟\n GP : ⁅ S ⁆̣ ▹ ∅ ⊢ put 𝔞 (get 𝔞) ≋ₐ 𝔞\n PP : ⁅ S ⁆ ⁅ A ⁆ ⁅ A ⁆̣ ▹ ∅ ⊢ put (put 𝔞 𝔟) 𝔠 ≋ₐ put 𝔞 𝔟\n\nopen EqLogic _▹_⊢_≋ₐ_\nopen ≋-Reasoning\n", "meta": {"hexsha": "02ca423ec451c0c6853f97b1ebe88254af51a4b4", "size": 1099, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/Lens/Equality.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/Lens/Equality.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/Lens/Equality.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 21.98, "max_line_length": 99, "alphanum_fraction": 0.5969062784, "num_tokens": 482, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8596637433190939, "lm_q2_score": 0.7799929053683038, "lm_q1q2_score": 0.6705316207912518}} {"text": "{-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-}\nmodule Cubical.Data.Nat.Order where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Function\nopen import Cubical.Foundations.HLevels\n\n\nopen import Cubical.Data.Empty as ⊥\nopen import Cubical.Data.Sigma\nopen import Cubical.Data.Sum as ⊎\n\nopen import Cubical.Data.Nat.Base\nopen import Cubical.Data.Nat.Properties\n\nopen import Cubical.Induction.WellFounded\n\nopen import Cubical.Relation.Nullary\n\ninfix 4 _≤_ _<_\n\n_≤_ : ℕ → ℕ → Type₀\nm ≤ n = Σ[ k ∈ ℕ ] k + m ≡ n\n\n_<_ : ℕ → ℕ → Type₀\nm < n = suc m ≤ n\n\ndata Trichotomy (m n : ℕ) : Type₀ where\n lt : m < n → Trichotomy m n\n eq : m ≡ n → Trichotomy m n\n gt : n < m → Trichotomy m n\n\nprivate\n variable\n k l m n : ℕ\n\nprivate\n witness-prop : ∀ j → isProp (j + m ≡ n)\n witness-prop {m} {n} j = isSetℕ (j + m) n\n\nm≤n-isProp : isProp (m ≤ n)\nm≤n-isProp {m} {n} (k , p) (l , q)\n = Σ≡Prop witness-prop lemma\n where\n lemma : k ≡ l\n lemma = inj-+m (p ∙ (sym q))\n\nzero-≤ : 0 ≤ n\nzero-≤ {n} = n , +-zero n\n\nsuc-≤-suc : m ≤ n → suc m ≤ suc n\nsuc-≤-suc (k , p) = k , (+-suc k _) ∙ (cong suc p)\n\n≤-+k : m ≤ n → m + k ≤ n + k\n≤-+k {m} {k = k} (i , p)\n = i , +-assoc i m k ∙ cong (_+ k) p\n\n≤-k+ : m ≤ n → k + m ≤ k + n\n≤-k+ {m} {n} {k}\n = subst (_≤ k + n) (+-comm m k)\n ∘ subst (m + k ≤_) (+-comm n k)\n ∘ ≤-+k\n\npred-≤-pred : suc m ≤ suc n → m ≤ n\npred-≤-pred (k , p) = k , injSuc ((sym (+-suc k _)) ∙ p)\n\n≤-refl : m ≤ m\n≤-refl = 0 , refl\n\n≤-suc : m ≤ n → m ≤ suc n\n≤-suc (k , p) = suc k , cong suc p\n\n≤-predℕ : predℕ n ≤ n\n≤-predℕ {zero} = ≤-refl\n≤-predℕ {suc n} = ≤-suc ≤-refl\n\n≤-trans : k ≤ m → m ≤ n → k ≤ n\n≤-trans {k} {m} {n} (i , p) (j , q) = i + j , l2 ∙ (l1 ∙ q)\n where\n l1 : j + i + k ≡ j + m\n l1 = (sym (+-assoc j i k)) ∙ (cong (j +_) p)\n l2 : i + j + k ≡ j + i + k\n l2 = cong (_+ k) (+-comm i j)\n\n≤-antisym : m ≤ n → n ≤ m → m ≡ n\n≤-antisym {m} (i , p) (j , q) = (cong (_+ m) l3) ∙ p\n where\n l1 : j + i + m ≡ m\n l1 = (sym (+-assoc j i m)) ∙ ((cong (j +_) p) ∙ q)\n l2 : j + i ≡ 0\n l2 = m+n≡n→m≡0 l1\n l3 : 0 ≡ i\n l3 = sym (snd (m+n≡0→m≡0×n≡0 l2))\n\n≤-k+-cancel : k + m ≤ k + n → m ≤ n\n≤-k+-cancel {k} {m} (l , p) = l , inj-m+ (sub k m ∙ p)\n where\n sub : ∀ k m → k + (l + m) ≡ l + (k + m)\n sub k m = +-assoc k l m ∙ cong (_+ m) (+-comm k l) ∙ sym (+-assoc l k m)\n\n≤-+k-cancel : m + k ≤ n + k → m ≤ n\n≤-+k-cancel {m} {k} {n} (l , p) = l , cancelled\n where\n cancelled : l + m ≡ n\n cancelled = inj-+m (sym (+-assoc l m k) ∙ p)\n\n≤-·k : m ≤ n → m · k ≤ n · k\n≤-·k {m} {n} {k} (d , r) = d · k , reason where\n reason : d · k + m · k ≡ n · k\n reason = d · k + m · k ≡⟨ ·-distribʳ d m k ⟩\n (d + m) · k ≡⟨ cong (_· k) r ⟩\n n · k ∎\n\n<-k+-cancel : k + m < k + n → m < n\n<-k+-cancel {k} {m} {n} = ≤-k+-cancel ∘ subst (_≤ k + n) (sym (+-suc k m))\n\n¬-<-zero : ¬ m < 0\n¬-<-zero (k , p) = snotz ((sym (+-suc k _)) ∙ p)\n\n¬m_ complement x y = ((x <-> y) → False) && ((x ∼ y) → False)\nGraph.noSelfRelation complement x (pr1 ,, pr2) = pr2 reflexive\nGraph.symmetric complement (x!-y ,, x!=y) = (λ pr → x!-y (Graph.symmetric G pr)) ,, λ pr → x!=y (Equivalence.symmetric eq pr)\nGraph.wellDefined complement x=y r=s (x!-r ,, x!=r) = (λ y-s → x!-r (wellDefined (Equivalence.symmetric eq x=y) (Equivalence.symmetric eq r=s) y-s)) ,, λ y=s → x!=r (transitive x=y (transitive y=s (Equivalence.symmetric eq r=s)))\n", "meta": {"hexsha": "30a1da5a26c251cb00dffa5d8bcbfbd70472354b", "size": 959, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Graphs/Complement.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Graphs/Complement.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Graphs/Complement.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 43.5909090909, "max_line_length": 229, "alphanum_fraction": 0.6871741397, "num_tokens": 305, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9324533051062238, "lm_q2_score": 0.7185943985973772, "lm_q1q2_score": 0.6700557220029435}} {"text": "module Classes where\n\nopen import Agda.Primitive\nopen import Agda.Builtin.Equality\nopen import Relation.Binary.PropositionalEquality.Core\n\nopen ≡-Reasoning\n\n\n\nid : ∀ {ℓ} {A : Set ℓ} → A → A\nid x = x\n\n_$_ : ∀ {ℓ} {A B : Set ℓ} → (A → B) → A → B\n_$_ = id\n\n_∘_ : ∀ {ℓ} {A B C : Set ℓ} → (B → C) → (A → B) → A → C\nf ∘ g = λ x → f (g x)\n\n\nrecord Functor {ℓ} (F : Set ℓ → Set ℓ) : Set (lsuc ℓ) where\n field\n fmap : ∀ {A B} → (A → B) → F A → F B\n \n F-id : ∀ {A} → (a : F A) → fmap id a ≡ a\n F-∘ : ∀ {A B C} → (g : B → C) (f : A → B) (a : F A) → fmap (g ∘ f) a ≡ (fmap g ∘ fmap f) a\n\n _<$>_ : ∀ {A B} → (A → B) → F A → F B\n _<$>_ = fmap\n\n infixl 20 _<$>_\n\nopen Functor {{...}} public\n\n\nrecord Applicative (F : Set → Set) : Set₁ where\n field\n {{funF}} : Functor F\n\n pure : {A : Set} → A → F A\n _<*>_ : {A B : Set} → F (A → B) → F A → F B\n\n A-id : ∀ {A} → (v : F A) → pure id <*> v ≡ v\n A-∘ : ∀ {A B C} → (u : F (B → C)) (v : F (A → B)) (w : F A) → pure _∘_ <*> u <*> v <*> w ≡ u <*> (v <*> w)\n A-hom : ∀ {A B} → (f : A → B) (x : A) → pure f <*> pure x ≡ pure (f x)\n A-ic : ∀ {A B} → (u : F (A → B)) (y : A) → u <*> pure y ≡ pure (_$ y) <*> u\n \n infixl 20 _<*>_\n\nopen Applicative {{...}} public\n\n\npostulate\n -- this is from parametricity: fmap is universal w.r.t. the functor laws\n appFun : ∀ {A B F} {{aF : Applicative F}} → (f : A → B) (x : F A) → pure f <*> x ≡ fmap f x\n\n\nrecord Monad (F : Set → Set) : Set₁ where\n field\n {{appF}} : Applicative F\n _>>=_ : ∀ {A B} → F A → (A → F B) → F B\n\n return : ∀ {A} → A → F A\n return = pure\n\n _>=>_ : {A B C : Set} → (A → F B) → (B → F C) → A → F C\n f >=> g = λ a → f a >>= g\n\n infixl 10 _>>=_\n infixr 10 _>=>_\n \n\n field\n left-1 : ∀ {A B} → (a : A) (k : A → F B) → return a >>= k ≡ k a\n right-1 : ∀ {A} → (m : F A) → m >>= return ≡ m\n assoc : ∀ {A B C D} → (f : A → F B) (g : B → F C) (h : C → F D) (a : A) → (f >=> (g >=> h)) a ≡ ((f >=> g) >=> h) a\n\nopen Monad {{...}} public\n", "meta": {"hexsha": "f32936682a378b9415385a7b071518eb03186425", "size": 1986, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "proofs/Classes.agda", "max_stars_repo_name": "samuelhklumpers/strong-vector", "max_stars_repo_head_hexsha": "1b019ce3d7b978c369fcc82c97ccafdde8f7fd02", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "proofs/Classes.agda", "max_issues_repo_name": "samuelhklumpers/strong-vector", "max_issues_repo_head_hexsha": "1b019ce3d7b978c369fcc82c97ccafdde8f7fd02", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2022-03-09T10:24:33.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-10T10:24:40.000Z", "max_forks_repo_path": "proofs/Classes.agda", "max_forks_repo_name": "samuelhklumpers/strong-vector", "max_forks_repo_head_hexsha": "1b019ce3d7b978c369fcc82c97ccafdde8f7fd02", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.1392405063, "max_line_length": 119, "alphanum_fraction": 0.4264853978, "num_tokens": 898, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.877476784277755, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6699392824141215}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.Definition\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Rings.Subrings.Definition {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+A_ _*A_ : A → A → A} (R : Ring S _+A_ _*A_) where\n\nopen import Setoids.Subset S\nopen Ring R\nopen Group additiveGroup\nopen import Groups.Subgroups.Definition additiveGroup\nopen Setoid S\nopen Equivalence eq\n\nrecord Subring {c : _} (pred : A → Set c) : Set (a ⊔ b ⊔ c) where\n field\n isSubgroup : Subgroup pred\n containsOne : pred 1R\n closedUnderProduct : {x y : A} → pred x → pred y → pred (x *A y)\n isSubset = Subgroup.isSubset isSubgroup\n\nsubringMult : {c : _} {pred : A → Set c} → (s : Subring pred) → Sg A pred → Sg A pred → Sg A pred\nsubringMult s (a , prA) (b , prB) = (a *A b) , Subring.closedUnderProduct s prA prB\n\nsubringIsRing : {c : _} {pred : A → Set c} → (subring : Subring pred) → Ring (subsetSetoid (Subring.isSubset subring)) (subgroupOp (Subring.isSubgroup subring)) (subringMult subring)\nRing.additiveGroup (subringIsRing sub) = subgroupIsGroup (Subring.isSubgroup sub)\nRing.*WellDefined (subringIsRing sub) {r , prR} {s , prS} {t , prT} {u , prU} r=t s=u = *WellDefined r=t s=u\nRing.1R (subringIsRing sub) = (1R , Subring.containsOne sub)\nRing.groupIsAbelian (subringIsRing sub) {a , prA} {b , prB} = groupIsAbelian\nRing.*Associative (subringIsRing sub) {a , prA} {b , prB} {c , prC} = *Associative\nRing.*Commutative (subringIsRing sub) {a , prA} {b , prB} = *Commutative\nRing.*DistributesOver+ (subringIsRing sub) {a , prA} {b , prB} {c , prC} = *DistributesOver+\nRing.identIsIdent (subringIsRing sub) {a , prA} = identIsIdent\n", "meta": {"hexsha": "c6b7d4815d8dbd1bf21d29752da118437aa8431a", "size": 1803, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Subrings/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Subrings/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Subrings/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 46.2307692308, "max_line_length": 182, "alphanum_fraction": 0.6960621187, "num_tokens": 638, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767810736693, "lm_q2_score": 0.7634837689358857, "lm_q1q2_score": 0.6699392799678541}} {"text": "module prelude where\n\nSubset : Set → Set₁\nSubset(X) = X → Set\n\n_∈_ : ∀ {X} → X → Subset(X) → Set\n(x ∈ A) = A(x)\n\n_⊆_ : ∀ {X} → Subset(X) → Subset(X) → Set\n(A ⊆ B) = ∀ x → (x ∈ A) → (x ∈ B)\n\nrecord Inhabited {X} (S : Subset(X)) : Set where\n constructor _,_\n field witness : X\n field witness-in : (witness ∈ S)\n \nRel : Set → Set₁\nRel(X) = X → X → Set\n\ndata ℕ : Set where\n zero : ℕ\n succ : ℕ → ℕ\n\ndata ℤ : Set where\n succ : ℕ → ℤ\n -ve : ℕ → ℤ\n\n+ve : ℕ → ℤ\n+ve zero = -ve zero\n+ve (succ n) = (succ n)\n\nsucz : ℤ → ℤ\nsucz (succ x) = succ (succ x)\nsucz (-ve zero) = succ zero\nsucz (-ve (succ x)) = -ve x\n\npred : ℤ → ℤ\npred (succ zero) = -ve zero\npred (succ (succ x)) = succ x\npred (-ve x) = -ve (succ x)\n\n_+_ : ℤ → ℤ → ℤ\nsucc zero + y = sucz y\nsucc (succ x) + y = sucz (succ x + y)\n-ve zero + y = y\n-ve (succ x) + y = pred (-ve x + y)\n\ndata _^_ (X : Set) : ℕ → Set where\n nil : (X ^ zero)\n _∷_ : ∀ {n} → X → (X ^ n) → (X ^ succ(n))\n\ndata _≡_ {D : Set} (d : D) : D → Set where\n refl : (d ≡ d)\n\nsym : ∀ {D} {d e : D} → (d ≡ e) → (e ≡ d)\nsym refl = refl\n\ntrans : ∀ {D} {d e f : D} → (d ≡ e) → (e ≡ f) → (d ≡ f)\ntrans refl refl = refl\n\nsubst : ∀ {X L R} (P : X → Set) → (L ≡ R) → (P R) → (P L)\nsubst P refl p = p\n\ndata _≣_ {X : Set₁} (x : X) : X → Set₁ where\n REFL : (x ≣ x)\n\nSYM : ∀ {D} {d e : D} → (d ≣ e) → (e ≣ d)\nSYM REFL = REFL\n\nTRANS : ∀ {D} {d e f : D} → (d ≣ e) → (e ≣ f) → (d ≣ f)\nTRANS REFL REFL = REFL\n\nSUBST : ∀ {X L R} (P : X → Set) →\n (L ≣ R) →\n (P R) →\n (P L)\nSUBST P REFL p = p\n\nsucc-dist-+ : ∀ m n → ((succ m + n) ≡ sucz (+ve m + n))\nsucc-dist-+ zero n = refl\nsucc-dist-+ (succ m) n = refl\n\nrecord ⊤ : Set where\n constructor tt\n\ndata ⊥ : Set where\n\n¬ : Set → Set\n¬(X) = (X → ⊥)\n\ncontradiction : ∀ {X : Set} → ⊥ → X\ncontradiction ()\n\ndata _∨_ (X Y : Set) : Set where\n in₁ : X → (X ∨ Y)\n in₂ : Y → (X ∨ Y)\n\n_∪_ : ∀ {X} → Subset(X) → Subset(X) → Subset(X)\n(A ∪ B) x = (x ∈ A) ∨ (x ∈ B)\n\nrecord _∧_ (X Y : Set) : Set where\n constructor _,_\n field proj₁ : X\n field proj₂ : Y\n \n_∩_ : ∀ {X} → Subset(X) → Subset(X) → Subset(X)\n(A ∩ B) x = (x ∈ A) ∧ (x ∈ B)\n\nAll : ∀ {X n} → Subset(X) → Subset(X ^ n)\nAll(S) nil = ⊤\nAll(S) (x ∷ xs) = (x ∈ S) ∧ (xs ∈ All(S))\n\nAll-resp-⊆ : ∀ {X} {A B : Subset(X)} {n} → (A ⊆ B) → (All {n = n} (A) ⊆ All(B))\nAll-resp-⊆ A⊆B nil tt = tt\nAll-resp-⊆ A⊆B (x ∷ xs) (x∈A , xs∈A) = (A⊆B x x∈A , All-resp-⊆ A⊆B xs xs∈A)\n\nAll-resp-∩ : ∀ {X} {A B : Subset(X)} {n} → ((All {n = n} (A) ∩ All(B)) ⊆ All(A ∩ B))\nAll-resp-∩ nil (tt , tt) = tt\nAll-resp-∩ (d ∷ ds) ((d∈A , ds∈A) , (d∈B , ds∈B)) = ((d∈A , d∈B) , (All-resp-∩ ds (ds∈A , ds∈B)))\n\nrecord DirectedGraph(D : Set) : Set₁ where\n\n field _⇒_ : Rel(D)\n\n data _⇒+_ (d e : D) : Set where\n ⇒-impl-⇒+ : (d ⇒ e) → (d ⇒+ e)\n ⇒⇒+-impl-⇒+ : ∀ {f} → (d ⇒ f) → (f ⇒+ e) → (d ⇒+ e)\n\nrecord Forest(D : Set) : Set₁ where\n\n field DG : DirectedGraph(D)\n open DirectedGraph DG public\n\n field ⇒-parent-uniq : ∀ {d e f} → (d ⇒ f) → (e ⇒ f) → (d ≡ e)\n field ⇒-acyclic : ∀ {d} → (d ⇒+ d) → ⊥\n \nrecord PartialOrder(D : Set) : Set₁ where\n\n field _≤_ : Rel(D)\n field ≤-refl : ∀ {d} → (d ≤ d)\n field ≤-trans : ∀ {d e f} → (d ≤ e) → (e ≤ f) → (d ≤ f)\n field ≤-asym : ∀ {d e} → (d ≤ e) → (e ≤ d) → (d ≡ e)\n\n field _≤?_ : ∀ d e → ((d ≤ e) ∨ ¬(d ≤ e))\n \n _<_ : Rel(D)\n d < e = (d ≤ e) ∧ ¬(d ≡ e)\n\n ≡-impl-≤ : ∀ {d e} → (d ≡ e) → (d ≤ e)\n ≡-impl-≤ refl = ≤-refl\n\n <-trans-≤ : ∀ {d e f} → (d < e) → (e ≤ f) → (d < f)\n <-trans-≤ (d≤e , d≠e) e≤f = (≤-trans d≤e e≤f , (λ d≡f → d≠e (trans d≡f (≤-asym (≤-trans (≡-impl-≤ (sym d≡f)) d≤e) e≤f))))\n\n ≤-trans-< : ∀ {d e f} → (d ≤ e) → (e < f) → (d < f)\n ≤-trans-< d≤e (e≤f , e≠f) = (≤-trans d≤e e≤f , (λ d≡f → e≠f (trans (≤-asym (≤-trans e≤f (≡-impl-≤ (sym d≡f))) d≤e) d≡f)))\n\n <-trans : ∀ {d e f} → (d < e) → (e < f) → (d < f)\n <-trans dds , ds↓) , (d∈S , ds∈S)) , d∷ds-max) = (d∈S , d-max) where\n\n d-max : ∀ e → (e ∈ S) → (e ≤ d)\n d-max e e∈S with ≤-total e d\n d-max e e∈S | in₁ e≤d = e≤d\n d-max e e∈S | in₂ dds , ds↓) , (e∈S , ds∈S))\n d-max e e∈S | in₂ dds , ds↓) , (d∈S , ds∈S)) , d∷ds-max) = ((d>ds , (ds↓ , ds∈S)) , ds-max) where\n\n ds-max : ∀ es → (es ∈ (All(Past(d)) ∩ (Decreasing ∩ All(S)))) → (es ≤* ds)\n ds-max es (d>es , (es↓ , es∈S)) with d∷ds-max (d ∷ es) ((d>es , es↓) , (d∈S , es∈S)) \n ds-max es (d>es , (es↓ , es∈S)) | (d≤d , es≤ds) = es≤ds\n \nrecord Equivalence(D : Set) : Set₁ where\n\n field _~_ : Rel(D)\n field ~-refl : ∀ {d} → (d ~ d)\n field ~-trans : ∀ {d e f} → (d ~ e) → (e ~ f) → (d ~ f)\n field ~-sym : ∀ {d e} → (d ~ e) → (e ~ d)\n\n field _~?_ : ∀ d e → ((d ~ e) ∨ ¬(d ~ e))\n\n ≡-impl-~ : ∀ {d e} → (d ≡ e) → (d ~ e)\n ≡-impl-~ refl = ~-refl\n", "meta": {"hexsha": "a47add97c64e66d072067b7b4afc85cd8f4c2d93", "size": 6673, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/prelude.agda", "max_stars_repo_name": "cbrewster/ServoNavigation", "max_stars_repo_head_hexsha": "cea700aea1488df1d27092c8f3d79d5d99f7e09a", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2017-04-22T01:51:07.000Z", "max_stars_repo_stars_event_max_datetime": "2017-04-22T01:51:07.000Z", "max_issues_repo_path": "notes/prelude.agda", "max_issues_repo_name": "cbrewster/ServoNavigation", "max_issues_repo_head_hexsha": "cea700aea1488df1d27092c8f3d79d5d99f7e09a", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "notes/prelude.agda", "max_forks_repo_name": "cbrewster/ServoNavigation", "max_forks_repo_head_hexsha": "cea700aea1488df1d27092c8f3d79d5d99f7e09a", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.016194332, "max_line_length": 123, "alphanum_fraction": 0.4416304511, "num_tokens": 3335, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767970940975, "lm_q2_score": 0.7634837527911056, "lm_q1q2_score": 0.6699392780325211}} {"text": "-- Andreas, 2017-01-12, issue #2386\n\nopen import Agda.Primitive\n\ndata _≡_ {a b} {A : Set (a ⊔ b)} : (x y : A) → Set where\n refl : (x : A) → x ≡ x\n\n{-# BUILTIN EQUALITY _≡_ #-}\n\n-- Should be accepted\n\n-- The type of primTrustMe has to match the flavor of EQUALITY\n\nprimitive primTrustMe : ∀ {a b}{A : Set _} {x y : A} → x ≡ y\n\ntestTM : ∀{A : Set} {a : A} → primTrustMe {x = a} {y = a} ≡ refl _\ntestTM = refl _\n\n-- Testing rewrite\n\nsubst : ∀{ℓ}{A : Set ℓ} {P : A → Set}{a b : A} → _≡_ {a = ℓ} {b = ℓ} a b → P a → P b\nsubst eq p rewrite eq = p\n", "meta": {"hexsha": "abf6224980cca2e436d1516d488beeb28c880a5c", "size": 542, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2386BuiltinEqualityUniverseLub.agda", "max_stars_repo_name": "alhassy/agda", "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/Succeed/Issue2386BuiltinEqualityUniverseLub.agda", "max_issues_repo_name": "alhassy/agda", "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/Issue2386BuiltinEqualityUniverseLub.agda", "max_forks_repo_name": "alhassy/agda", "max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 23.5652173913, "max_line_length": 84, "alphanum_fraction": 0.5535055351, "num_tokens": 225, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.884039278690883, "lm_q2_score": 0.7577943822145998, "lm_q1q2_score": 0.6699199990489981}} {"text": "\nopen import Agda.Primitive\nopen import Agda.Builtin.Sigma\n\nvariable\n ℓ₁ ℓ₂ : Level\n\nis-universal-element : {X : Set ℓ₁} {A : X → Set ℓ₂} → Σ X A → Set (ℓ₁ ⊔ ℓ₂)\nis-universal-element {ℓ₁} {ℓ₂} {X} {A} (x , a) = ∀ y → A y\n\nfails : {X : Set ℓ₁} {A : X → Set ℓ₂} (x : X) (a : A x)\n → is-universal-element {A = _} (x , a) → (y : X) → A y -- a is yellow\nfails {ℓ₁} {ℓ₂} {X = X} {A} x a u y = u y\n\nworks : ∀ {ℓ₁} {ℓ₂} {X : Set ℓ₁} {A : X → Set ℓ₂} (x : X) (a : A x)\n → is-universal-element {A = _} (x , a) → (y : X) → A y\nworks x a u y = u y\n", "meta": {"hexsha": "42558235e1ebad232addad99555e1bf5972dd8c1", "size": 547, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue3519.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue3519.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue3519.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 30.3888888889, "max_line_length": 76, "alphanum_fraction": 0.5045703839, "num_tokens": 266, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392817460332, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.669919996528497}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n-- The Category of Algebraic Kan Complexes\nmodule Categories.Category.Instance.KanComplexes where\n\nopen import Level\n\nopen import Function using (_$_)\nopen import Data.Product using (Σ; _,_; proj₁)\n\nopen import Categories.Category\nopen import Categories.Category.SubCategory\nopen import Categories.Category.Construction.KanComplex\nopen import Categories.Category.Instance.SimplicialSet\n\n\nimport Categories.Category.Instance.SimplicialSet.Properties as ΔSetₚ\n\nimport Categories.Morphism.Reasoning as MR\n\nmodule _ (o ℓ : Level) where\n open Category (SimplicialSet o ℓ)\n open ΔSetₚ o ℓ\n open IsKanComplex\n open Equiv\n open MR (SimplicialSet o ℓ)\n \n -- As we are working with Algebraic Kan Complexes, maps between two Kan Complexes ought\n -- to take the chosen filler in 'X' to the chosen filler in 'Y'.\n PreservesFiller : ∀ {X Y : ΔSet} → IsKanComplex o ℓ X → IsKanComplex o ℓ Y → (X ⇒ Y) → Set (o ⊔ ℓ)\n PreservesFiller {X} {Y} X-Kan Y-Kan f = ∀ {n} {k} → (i : Λ[ n , k ] ⇒ X) → (f ∘ filler X-Kan {n} i) ≈ filler Y-Kan (f ∘ i) \n\n KanComplexes : Category (suc o ⊔ suc ℓ) (o ⊔ ℓ ⊔ (o ⊔ ℓ)) (o ⊔ ℓ)\n KanComplexes = SubCategory (SimplicialSet o ℓ) {I = Σ ΔSet (IsKanComplex o ℓ)} $ record\n { U = proj₁\n ; R = λ { {_ , X-Kan} {_ , Y-Kan} f → PreservesFiller X-Kan Y-Kan f }\n ; Rid = λ { {_ , X-Kan} i → begin\n id ∘ filler X-Kan i ≈⟨ identityˡ {f = filler X-Kan i} ⟩\n filler X-Kan i ≈˘⟨ filler-cong X-Kan (identityˡ {f = i}) ⟩\n filler X-Kan (id ∘ i) ∎\n }\n ; _∘R_ = λ { {_ , X-Kan} {_ , Y-Kan} {_ , Z-Kan} {f} {g} f-preserves g-preserves i → begin\n (f ∘ g) ∘ filler X-Kan i ≈⟨ assoc {f = filler X-Kan i} {g = g} {h = f} ⟩\n f ∘ (g ∘ filler X-Kan i) ≈⟨ ∘-resp-≈ʳ {f = (g ∘ filler X-Kan i)} {h = filler Y-Kan (g ∘ i)} {g = f} (g-preserves i) ⟩\n f ∘ filler Y-Kan (g ∘ i) ≈⟨ f-preserves (g ∘ i) ⟩\n filler Z-Kan (f ∘ g ∘ i) ≈˘⟨ filler-cong Z-Kan (assoc {f = i} {g = g} {h = f}) ⟩\n filler Z-Kan ((f ∘ g) ∘ i) ∎\n }\n }\n where\n open HomReasoning\n", "meta": {"hexsha": "e95214d937af3af660afd69d487f005efed963fe", "size": 2073, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Instance/KanComplexes.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Instance/KanComplexes.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Instance/KanComplexes.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 39.8653846154, "max_line_length": 126, "alphanum_fraction": 0.6020260492, "num_tokens": 790, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392909114835, "lm_q2_score": 0.7577943658046609, "lm_q1q2_score": 0.6699199938026698}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Some defined operations (multiplication by natural number and\n-- exponentiation)\n------------------------------------------------------------------------\n\nopen import Algebra\n\nmodule Algebra.Operations {s₁ s₂} (S : Semiring s₁ s₂) where\n\nopen Semiring S renaming (zero to *-zero)\nopen import Data.Nat\n using (zero; suc; ℕ) renaming (_+_ to _ℕ+_; _*_ to _ℕ*_)\nopen import Data.Product using (module Σ)\nopen import Function\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as PropEq using (_≡_)\nimport Relation.Binary.EqReasoning as EqR\nopen EqR setoid\n\n------------------------------------------------------------------------\n-- Operations\n\n-- Multiplication by natural number.\n\ninfixr 7 _×_\n\n_×_ : ℕ → Carrier → Carrier\n0 × x = 0#\nsuc n × x = x + n × x\n\n-- A variant that includes a \"redundant\" case which ensures that 1 × y\n-- is definitionally equal to y.\n\n_×′_ : ℕ → Carrier → Carrier\n0 ×′ x = 0#\n1 ×′ x = x\nsuc n ×′ x = x + n ×′ x\n\n-- Exponentiation.\n\ninfixr 8 _^_\n\n_^_ : Carrier → ℕ → Carrier\nx ^ zero = 1#\nx ^ suc n = x * x ^ n\n\n------------------------------------------------------------------------\n-- Some properties\n\n-- Unfolding lemma for _×′_.\n\n1+×′ : ∀ n x → suc n ×′ x ≈ x + n ×′ x\n1+×′ 0 x = begin\n x ≈⟨ sym $ Σ.proj₂ +-identity x ⟩\n x + 0# ∎\n1+×′ (suc n) x = begin\n x + suc n ×′ x ≡⟨⟩\n x + suc n ×′ x ∎\n\n-- _×_ and _×′_ are extensionally equal (up to the setoid\n-- equivalence).\n\n×≈×′ : ∀ n x → n × x ≈ n ×′ x\n×≈×′ 0 x = begin 0# ∎\n×≈×′ (suc n) x = begin\n x + n × x ≈⟨ +-cong refl (×≈×′ n x) ⟩\n x + n ×′ x ≈⟨ sym $ 1+×′ n x ⟩\n suc n ×′ x ∎\n\n-- _×_ is homomorphic with respect to _ℕ+_/_+_.\n\n×-homo-+ : ∀ c m n → (m ℕ+ n) × c ≈ m × c + n × c\n×-homo-+ c 0 n = begin\n n × c ≈⟨ sym $ Σ.proj₁ +-identity (n × c) ⟩\n 0# + n × c ∎\n×-homo-+ c (suc m) n = begin\n c + (m ℕ+ n) × c ≈⟨ +-cong refl (×-homo-+ c m n) ⟩\n c + (m × c + n × c) ≈⟨ sym $ +-assoc c (m × c) (n × c) ⟩\n c + m × c + n × c ∎\n\n-- _×′_ is homomorphic with respect to _ℕ+_/_+_.\n\n×′-homo-+ : ∀ c m n → (m ℕ+ n) ×′ c ≈ m ×′ c + n ×′ c\n×′-homo-+ c m n = begin\n (m ℕ+ n) ×′ c ≈⟨ sym $ ×≈×′ (m ℕ+ n) c ⟩\n (m ℕ+ n) × c ≈⟨ ×-homo-+ c m n ⟩\n m × c + n × c ≈⟨ +-cong (×≈×′ m c) (×≈×′ n c) ⟩\n m ×′ c + n ×′ c ∎\n\n-- _× 1# is homomorphic with respect to _ℕ*_/_*_.\n\n×1-homo-* : ∀ m n → (m ℕ* n) × 1# ≈ (m × 1#) * (n × 1#)\n×1-homo-* 0 n = begin\n 0# ≈⟨ sym $ Σ.proj₁ *-zero (n × 1#) ⟩\n 0# * (n × 1#) ∎\n×1-homo-* (suc m) n = begin\n (n ℕ+ m ℕ* n) × 1# ≈⟨ ×-homo-+ 1# n (m ℕ* n) ⟩\n n × 1# + (m ℕ* n) × 1# ≈⟨ +-cong refl (×1-homo-* m n) ⟩\n n × 1# + (m × 1#) * (n × 1#) ≈⟨ sym $ +-cong (Σ.proj₁ *-identity (n × 1#)) refl ⟩\n 1# * (n × 1#) + (m × 1#) * (n × 1#) ≈⟨ sym $ Σ.proj₂ distrib (n × 1#) 1# (m × 1#) ⟩\n (1# + m × 1#) * (n × 1#) ∎\n\n-- _×′ 1# is homomorphic with respect to _ℕ*_/_*_.\n\n×′1-homo-* : ∀ m n → (m ℕ* n) ×′ 1# ≈ (m ×′ 1#) * (n ×′ 1#)\n×′1-homo-* m n = begin\n (m ℕ* n) ×′ 1# ≈⟨ sym $ ×≈×′ (m ℕ* n) 1# ⟩\n (m ℕ* n) × 1# ≈⟨ ×1-homo-* m n ⟩\n (m × 1#) * (n × 1#) ≈⟨ *-cong (×≈×′ m 1#) (×≈×′ n 1#) ⟩\n (m ×′ 1#) * (n ×′ 1#) ∎\n\n-- _×_ preserves equality.\n\n×-cong : _×_ Preserves₂ _≡_ ⟶ _≈_ ⟶ _≈_\n×-cong {n} {n′} {x} {x′} n≡n′ x≈x′ = begin\n n × x ≈⟨ reflexive $ PropEq.cong (λ n → n × x) n≡n′ ⟩\n n′ × x ≈⟨ ×-congʳ n′ x≈x′ ⟩\n n′ × x′ ∎\n where\n ×-congʳ : ∀ n → (_×_ n) Preserves _≈_ ⟶ _≈_\n ×-congʳ 0 x≈x′ = refl\n ×-congʳ (suc n) x≈x′ = x≈x′ ⟨ +-cong ⟩ ×-congʳ n x≈x′\n\n-- _×′_ preserves equality.\n\n×′-cong : _×′_ Preserves₂ _≡_ ⟶ _≈_ ⟶ _≈_\n×′-cong {n} {n′} {x} {x′} n≡n′ x≈x′ = begin\n n ×′ x ≈⟨ sym $ ×≈×′ n x ⟩\n n × x ≈⟨ ×-cong n≡n′ x≈x′ ⟩\n n′ × x′ ≈⟨ ×≈×′ n′ x′ ⟩\n n′ ×′ x′ ∎\n\n-- _^_ preserves equality.\n\n^-cong : _^_ Preserves₂ _≈_ ⟶ _≡_ ⟶ _≈_\n^-cong {x} {x'} {n} {n'} x≈x' n≡n' = begin\n x ^ n ≈⟨ reflexive $ PropEq.cong (_^_ x) n≡n' ⟩\n x ^ n' ≈⟨ ^-congˡ n' x≈x' ⟩\n x' ^ n' ∎\n where\n ^-congˡ : ∀ n → (λ x → x ^ n) Preserves _≈_ ⟶ _≈_\n ^-congˡ zero x≈x' = refl\n ^-congˡ (suc n) x≈x' = x≈x' ⟨ *-cong ⟩ ^-congˡ n x≈x'\n", "meta": {"hexsha": "4534d8a2650e7b48f8396ad93da0ffb28bb0af00", "size": 4229, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Algebra/Operations.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Algebra/Operations.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Algebra/Operations.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.9657534247, "max_line_length": 91, "alphanum_fraction": 0.4242137621, "num_tokens": 2086, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8558511322604134, "lm_q2_score": 0.782662489091802, "lm_q1q2_score": 0.6698425774669723}} {"text": "{-# OPTIONS --safe --without-K #-}\n\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; cong)\nopen import Relation.Nullary using (Dec; yes; no)\n\nimport Data.Product as Product\nimport Data.Sum as Sum\nimport Data.Nat as ℕ\nimport Data.Nat.Properties as ℕₚ\n\nopen Product using (∃-syntax; _,_)\nopen Sum using (inj₁)\nopen ℕ using (ℕ; _+_; zero; suc)\n\nopen import PiCalculus.LinearTypeSystem.Algebras\nmodule PiCalculus.LinearTypeSystem.Algebras.Graded where\n\n_≔_∙_ : ℕ → ℕ → ℕ → Set\nx ≔ y ∙ z = x ≡ (y + z)\n\ncomputeʳ : (x y : ℕ) → Dec (∃[ z ] (x ≔ y ∙ z))\ncomputeʳ x y with y ℕₚ.≤″? x\ncomputeʳ x y | yes (ℕ.less-than-or-equal proof) = yes (_ , (sym proof))\ncomputeʳ x y | no ¬p = no λ where\n (_ , p) → ¬p (ℕ.less-than-or-equal (sym p))\n\n\nGraded : Algebra ℕ\nAlgebra.0∙ Graded = 0\nAlgebra.1∙ Graded = 1\nAlgebra._≔_∙_ Graded = _≔_∙_\nAlgebra.∙-computeʳ Graded = computeʳ\nAlgebra.∙-unique Graded refl refl = refl\nAlgebra.∙-uniqueˡ Graded refl = ℕₚ.+-cancelʳ-≡ _ _\nAlgebra.0∙-minˡ Graded {zero} {zero} refl = refl\nAlgebra.∙-idˡ Graded = refl\nAlgebra.∙-comm Graded {y = y} refl = ℕₚ.+-comm y _\nAlgebra.∙-assoc Graded {z = z} {v = v} refl refl = v + z , (ℕₚ.+-assoc _ v z , refl)\n", "meta": {"hexsha": "602bb9bcc7fb1663519f32d3b6ba2d46578b85fc", "size": 1187, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/PiCalculus/LinearTypeSystem/Algebras/Graded.agda", "max_stars_repo_name": "guilhermehas/typing-linear-pi", "max_stars_repo_head_hexsha": "0fc3cf6bcc0cd07d4511dbe98149ac44e6a38b1a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2020-05-02T23:32:11.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-14T15:18:23.000Z", "max_issues_repo_path": "src/PiCalculus/LinearTypeSystem/Algebras/Graded.agda", "max_issues_repo_name": "guilhermehas/typing-linear-pi", "max_issues_repo_head_hexsha": "0fc3cf6bcc0cd07d4511dbe98149ac44e6a38b1a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-15T09:16:14.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-15T09:16:14.000Z", "max_forks_repo_path": "src/PiCalculus/LinearTypeSystem/Algebras/Graded.agda", "max_forks_repo_name": "guilhermehas/typing-linear-pi", "max_forks_repo_head_hexsha": "0fc3cf6bcc0cd07d4511dbe98149ac44e6a38b1a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2021-01-25T13:57:13.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T16:24:07.000Z", "avg_line_length": 30.4358974359, "max_line_length": 84, "alphanum_fraction": 0.6672283067, "num_tokens": 467, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9124361509525463, "lm_q2_score": 0.7341195385342971, "lm_q1q2_score": 0.6698372060792935}} {"text": "module Open where\n\nopen import bool\nopen import nat\nopen import product\nopen import sum\nopen import functor\n\ndata Row : Set₁ where\n Empty : Row\n Ty : Set → Row \n Prod : Row → Row → Row\n\ninfixr 19 _♯_ \n\n_′ = Ty\n_♯_ = Prod \n\nall : Row → Set\nall Empty = ⊤\nall (Ty x) = x\nall (Prod r₁ r₂) = (all r₁) × (all r₂)\n\none : Row → Set\none Empty = ⊥\none (Ty x) = x\none (Prod r₁ r₂) = (one r₁) ⊎ (one r₂)\n\n_⊗_ : {A B : Row} → all A → all B → all (A ♯ B)\n_⊗_ p₁ p₂ = p₁ , p₂\n\n_&_ : {A : Set}{B : Row} → A → all B → all (A ′ ♯ B)\n_&_ {A}{B} = _⊗_ {A ′}{B}\n\n_⊕_ : {A B : Row} → (one A) ⊎ (one B) → one (A ♯ B)\n_⊕_ p = p\n\n⊕inj₁ : {A B : Row} → one A → one (A ♯ B)\n⊕inj₁ = inj₁\n⊕inj₂ : {A B : Row} → one B → one (A ♯ B)\n⊕inj₂ = inj₂\n\ninj : {A : Set}{B : Row} → A → one (A ′ ♯ B)\ninj {A}{B} = ⊕inj₁ {A ′}{B}\n\ntest₁ : all (ℕ ′ ♯ 𝔹 ′ ♯ Empty)\ntest₁ = _&_ {ℕ}{𝔹 ′ ♯ Empty} 1 (_&_ {𝔹}{Empty} tt triv)\n", "meta": {"hexsha": "3ea25ffb1e35ebb182ec750121f61e3f500d1dba", "size": 882, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "open.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "open.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "open.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.375, "max_line_length": 55, "alphanum_fraction": 0.5090702948, "num_tokens": 449, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9124361628580401, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.6698371988962695}} {"text": "module Cats.Util.SetoidReasoning where\n\nopen import Relation.Binary.SetoidReasoning public\n\nopen import Relation.Binary using (Setoid)\nopen import Relation.Binary.EqReasoning as EqR using (_IsRelatedTo_)\n\n\ninfixr 2 _≡⟨⟩_\n\n\n_≡⟨⟩_ : ∀ {c l} {S : Setoid c l} → ∀ x {y} → _IsRelatedTo_ S x y → _IsRelatedTo_ S x y\n_≡⟨⟩_ {S = S} = EqR._≡⟨⟩_ S\n\n\ntriangle : ∀ {l l′} (S : Setoid l l′) →\n let open Setoid S in\n ∀ m {x y}\n → x ≈ m\n → y ≈ m\n → x ≈ y\ntriangle S m x≈m y≈m = trans x≈m (sym y≈m)\n where\n open Setoid S\n", "meta": {"hexsha": "1f3ba15e102866697103dc70ac2f31e0a5fb00f0", "size": 515, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cats/Util/SetoidReasoning.agda", "max_stars_repo_name": "alessio-b-zak/cats", "max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cats/Util/SetoidReasoning.agda", "max_issues_repo_name": "alessio-b-zak/cats", "max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cats/Util/SetoidReasoning.agda", "max_forks_repo_name": "alessio-b-zak/cats", "max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.6, "max_line_length": 87, "alphanum_fraction": 0.6291262136, "num_tokens": 218, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8976952975813453, "lm_q2_score": 0.7461389986757757, "lm_q1q2_score": 0.6698054704532974}} {"text": "\nmodule Day2 where\n\n\nopen import Data.String as String\nopen import Data.Maybe\nopen import Foreign.Haskell using (Unit)\nopen import Data.List as List hiding (fromMaybe)\nopen import Data.Nat\nopen import Data.Nat.DivMod\nimport Data.Nat.Show as ℕs\nopen import Data.Char\nopen import Data.Vec as Vec renaming (_>>=_ to _VV=_ ; toList to VecToList)\nopen import Data.Product\nopen import Relation.Nullary\nopen import Data.Nat.Properties\nopen import Data.Bool.Base\nopen import AocIO\nopen import AocUtil\nopen import AocVec\nimport Data.Fin as Fin\n\nnatDiff : ℕ → ℕ → ℕ\nnatDiff zero y = y\nnatDiff x zero = x\nnatDiff (suc x) (suc y) = natDiff x y\n\nfromMaybe : ∀ {a} {A : Set a} → A → Maybe A → A\nfromMaybe v (just x) = x\nfromMaybe v nothing = v\n\nfind : ∀ {a} {A : Set a} → (A → Bool) → List A → Maybe A\nfind pred [] = nothing\nfind pred (x ∷ ls) with (pred x)\n... | false = find pred ls\n... | true = just x\n\ndividesEvenly : ℕ → ℕ → Bool\ndividesEvenly zero zero = true\ndividesEvenly zero dividend = false\ndividesEvenly (suc divisor) dividend with (dividend mod (suc divisor))\n... | Fin.Fin.zero = true\n... | Fin.Fin.suc p = false\n\noneDividesTheOther : ℕ → ℕ → Bool\noneDividesTheOther x y = dividesEvenly x y ∨ dividesEvenly y x\n\nmain2 : IO Unit\nmain2 = mainBuilder (readFileMain processFile)\n where\n parseLine : List Char → List ℕ\n parseLine ls with (words ls)\n ... | line-words = List.map unsafeParseNat line-words\n minMax : {n : ℕ} → Vec ℕ (suc n) → (ℕ × ℕ)\n minMax {0} (x ∷ []) = x , x\n minMax {suc _} (x ∷ ls) with (minMax ls)\n ... | min , max = (min ⊓ x) , (max ⊔ x)\n minMaxDiff : List ℕ → ℕ\n minMaxDiff ls = helper (Vec.fromList ls)\n where\n helper : {n : ℕ} → Vec ℕ n → ℕ\n helper [] = 0\n helper (x ∷ vec) with (minMax (x ∷ vec))\n ... | min , max = natDiff min max\n lineDiff : List Char → ℕ\n lineDiff s = minMaxDiff (parseLine s)\n processFile : String → IO Unit\n processFile file-content with (lines (String.toList file-content))\n ... | file-lines with (List.map lineDiff file-lines)\n ... | line-diffs = printString (ℕs.show (List.sum line-diffs))\n\nmain : IO Unit\nmain = mainBuilder (readFileMain processFile)\n where\n parseLine : List Char → List ℕ\n parseLine ls with (words ls)\n ... | line-words = List.map unsafeParseNat line-words\n pierreDiv : ℕ → ℕ → ℕ\n pierreDiv x y with (x ⊓ y) | (x ⊔ y)\n ... | 0 | _ = 0\n ... | _ | 0 = 0\n ... | (suc min) | (suc max) = (suc max) div (suc min)\n lineDivider : List ℕ → Maybe ℕ\n lineDivider [] = nothing\n lineDivider (x ∷ ln) with (find (oneDividesTheOther x) ln)\n ... | nothing = lineDivider ln\n ... | just y = just (pierreDiv x y)\n lineScore : List Char → ℕ\n lineScore s = fromMaybe 0 (lineDivider (parseLine s))\n processFile : String → IO Unit\n processFile file-content with (lines (String.toList file-content))\n ... | file-lines with (List.map lineScore file-lines)\n ... | line-scores = printString (ℕs.show (List.sum line-scores))\n", "meta": {"hexsha": "208559bf1a06527e041f035161d9fc69385358c9", "size": 3000, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "day-2/Day2.agda", "max_stars_repo_name": "Zalastax/adventofcode2017", "max_stars_repo_head_hexsha": "37956e581dc51bf78008d7dd902bb18d2ee481f6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "day-2/Day2.agda", "max_issues_repo_name": "Zalastax/adventofcode2017", "max_issues_repo_head_hexsha": "37956e581dc51bf78008d7dd902bb18d2ee481f6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "day-2/Day2.agda", "max_forks_repo_name": "Zalastax/adventofcode2017", "max_forks_repo_head_hexsha": "37956e581dc51bf78008d7dd902bb18d2ee481f6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.914893617, "max_line_length": 75, "alphanum_fraction": 0.6426666667, "num_tokens": 951, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8976952866333484, "lm_q2_score": 0.7461389873857264, "lm_q1q2_score": 0.669805452149546}} {"text": "\nmodule Issue422 where\n\ndata Bool : Set where\n true false : Bool\n\ndata _≡_ {A : Set} (x : A) : A → Set where\n refl : x ≡ x\n\nfoo : Bool → Bool → Bool\nfoo true b = b\nfoo n true = true\nfoo false b = false\n\ngood : foo false true ≡ true\ngood = refl\n\ndata Nat : Set where\n zero : Nat\n suc : Nat → Nat\n\ndata T : Set where\n t₁ : Nat → T\n t₂ : Nat → Nat → T\n t₃ : Nat → Nat → Nat → T\n\nbar : Nat → Nat → Nat → T\nbar x zero z = t₂ x z\nbar x y (suc z) = t₃ x y z\nbar x (suc y) zero = t₂ x y\n\npostulate\n a b c : Nat\n\neqn₁ : bar a zero c ≡ t₂ a c\neqn₁ = refl\n\neqn₂ : bar a (suc b) (suc c) ≡ t₃ a (suc b) c\neqn₂ = refl\n\neqn₃ : bar a (suc b) zero ≡ t₂ a b\neqn₃ = refl\n", "meta": {"hexsha": "56d6dda428e7660be7e2755afff94430811516c4", "size": 691, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue422.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue422.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue422.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 16.0697674419, "max_line_length": 45, "alphanum_fraction": 0.5499276411, "num_tokens": 296, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178944582997, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.6697951028571271}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.CommSemiring.Base where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.SIP using (TypeWithStr)\n\nopen import Cubical.Algebra.CommMonoid\nopen import Cubical.Algebra.Monoid\n\nprivate\n variable\n ℓ ℓ' : Level\n\nrecord IsCommSemiring {R : Type ℓ}\n (0r 1r : R) (_+_ _·_ : R → R → R) : Type ℓ where\n\n field\n +IsCommMonoid : IsCommMonoid 0r _+_\n ·IsCommMonoid : IsCommMonoid 1r _·_\n ·LDist+ : (x y z : R) → x · (y + z) ≡ (x · y) + (x · z)\n AnnihilL : (x : R) → 0r · x ≡ 0r\n\n open IsCommMonoid +IsCommMonoid public\n renaming\n ( isSemigroup to +IsSemigroup\n ; isMonoid to +IsMonoid)\n\n open IsCommMonoid ·IsCommMonoid public\n renaming\n ( isSemigroup to ·IsSemigroup\n ; isMonoid to ·IsMonoid)\n hiding\n ( is-set ) -- We only want to export one proof of this\n\nrecord CommSemiringStr (A : Type ℓ) : Type (ℓ-suc ℓ) where\n\n field\n 0r : A\n 1r : A\n _+_ : A → A → A\n _·_ : A → A → A\n isCommSemiring : IsCommSemiring 0r 1r _+_ _·_\n\n infixl 7 _·_\n infixl 6 _+_\n\n open IsCommSemiring isCommSemiring public\n\nCommSemiring : ∀ ℓ → Type (ℓ-suc ℓ)\nCommSemiring ℓ = TypeWithStr ℓ CommSemiringStr\n", "meta": {"hexsha": "2a762b0ec1524572b63d54974d08771b5e83c7fa", "size": 1265, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommSemiring/Base.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommSemiring/Base.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommSemiring/Base.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.8039215686, "max_line_length": 66, "alphanum_fraction": 0.6221343874, "num_tokens": 457, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171068, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6697640491068744}} {"text": "{-# OPTIONS --without-K #-}\n\n--\n-- This module defines/proves some basic functions/theorem using only\n-- the induction principle of the equality types the way they are done\n-- in the HoTT book. The functions defined/theorems proved in this\n-- module is often exposed in a better way from the main equality\n-- module, the word better means simpler definitions/proofs. This\n-- module is thus not meant for use in \"production\" hott.\n--\n\nmodule hott.core.equality.induction-proofs where\n\nopen import hott.core\n\n-- The symmetry of ≡ defined in terms of the induction principle\nsym : ∀{ℓ} {A : Type ℓ} {x y : A}\n → x ≡ y → y ≡ x\nsym {ℓ} {A} = induction≡ D d\n where\n D : {u v : A} → u ≡ v → Type ℓ\n D {u} {v} _ = v ≡ u\n d : {u : A} → D {u} refl\n d = refl\n\n-- The transitivity of ≡.\ntrans : ∀{ℓ} {A : Type ℓ} {x y z : A}\n → x ≡ y → y ≡ z → x ≡ z\ntrans {ℓ} {A} xEy = induction≡ D d xEy\n where\n D : {u v : A} → u ≡ v → Type ℓ\n D {u} {v} _ = {w : A} → v ≡ w → u ≡ w\n\n d : {u : A} → D {u} refl\n d uEw = uEw\n\nsymIsInv : ∀{ℓ} {A : Type ℓ} {x y : A}\n → (p : x ≡ y) → sym p ≡ p ⁻¹\nsymIsInv refl = refl\n", "meta": {"hexsha": "840e6ae7a9eca9122c521aa240006e4c816ece17", "size": 1132, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/hott/core/equality/induction-proofs.agda", "max_stars_repo_name": "piyush-kurur/hott", "max_stars_repo_head_hexsha": "876ecdcfddca1abf499e8f00db321c6dc3d5b2bc", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/hott/core/equality/induction-proofs.agda", "max_issues_repo_name": "piyush-kurur/hott", "max_issues_repo_head_hexsha": "876ecdcfddca1abf499e8f00db321c6dc3d5b2bc", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/hott/core/equality/induction-proofs.agda", "max_forks_repo_name": "piyush-kurur/hott", "max_forks_repo_head_hexsha": "876ecdcfddca1abf499e8f00db321c6dc3d5b2bc", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.3, "max_line_length": 70, "alphanum_fraction": 0.5759717314, "num_tokens": 421, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171067, "lm_q2_score": 0.7549149868676283, "lm_q1q2_score": 0.669764044214849}} {"text": "{-# OPTIONS --without-K #-}\nmodule Data.Inductive.Higher.Interval where\n\nopen import Relation.Equality\nopen import Relation.Path.Operation\n\n-- The interval, which we denote I, is perhaps an even simpler higher inductive type than the\n-- circle generated by:\nmodule Interval where\n private\n data #I : Set where\n #0 : #I\n #1 : #I\n\n I : Set\n I = #I\n\n -- A point 0ᵢ\n 0ᵢ : I\n 0ᵢ = #0\n\n -- A point 1₁\n 1ᵢ : I\n 1ᵢ = #1\n\n postulate -- A path segment\n path-seg : 0ᵢ ≡ 1ᵢ\n\n -- \"The recursion principle for the interval says that given a type B along with\n interval-rec : ∀ {b} {B : Set b} →\n (b₀ b₁ : B) → -- points b₀, b₁ and\n (p : b₀ ≡ b₁) → -- a path b₀ ≡ b₁\n (i : I) → B -- there is a function f : I → B such that\n interval-rec b₀ b₁ p #0 = b₀ -- f(0ᵢ) ≡ b₀\n interval-rec b₀ b₁ p #1 = b₁ -- f(1ᵢ) ≡ b₁\"\n\n -- The induction principle says that given P : I → U along with\n interval-ind : ∀ {b} (P : I → Set b)\n (b₀ : P 0ᵢ) → -- a point b₀ : P(0ᵢ) \n (b₁ : P 1ᵢ) → -- a point b₁ : P(1ᵢ) and\n (p : transport {_}{_}{I}{P} path-seg b₀ ≡ b₁) →\n ∀ i → P i -- there is a function f : Π(x:I) P(x) such that\n interval-ind P b₀ b₁ p #0 = b₀ -- f(0ᵢ) ≡ b₀\n interval-ind P b₀ b₁ p #1 = b₁ -- f(1ᵢ) ≡ b₁\"\nopen Interval public\n\n", "meta": {"hexsha": "003a76380569ed7af22aa9c984585eb56c1856cc", "size": 1392, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Inductive/Higher/Interval.agda", "max_stars_repo_name": "CodaFi/HoTT-Exercises", "max_stars_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Data/Inductive/Higher/Interval.agda", "max_issues_repo_name": "CodaFi/HoTT-Exercises", "max_issues_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Inductive/Higher/Interval.agda", "max_forks_repo_name": "CodaFi/HoTT-Exercises", "max_forks_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.6170212766, "max_line_length": 93, "alphanum_fraction": 0.5201149425, "num_tokens": 518, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045847699186, "lm_q2_score": 0.7549149923816048, "lm_q1q2_score": 0.6697640423525079}} {"text": "{-# OPTIONS --without-K --exact-split #-}\n\nmodule encode-decode where\n\nimport 05-identity-types\nopen 05-identity-types public\n\nrecord Lift {i j : Level} (A : UU i) : UU (i ⊔ j) where\n field\n raise : A\n\nmodule Coprod where\n code-left : {i j : Level} {A : UU i} {B : UU j} → A → (coprod A B) → (UU i)\n code-left a₀ (inl a) = Id a₀ a\n code-left a₀ (inr b) = Lift 𝟘\n\n code-right : {i j : Level} {A : UU i} {B : UU j} → B → (coprod A B) → (UU j)\n code-right b₀ (inr b) = Id b₀ b\n code-right b₀ (inl a) = Lift 𝟘\n\n encode-left : {i j : Level} {A : UU i} {B : UU j} → (a₀ : A) → (x : coprod A B) → (p : Id (inl a₀) x) → (code-left a₀ x)\n encode-left a₀ x p = tr (code-left a₀) p refl\n\n decode-left : {i j : Level} {A : UU i} {B : UU j} → (a₀ : A) → (x : coprod A B) → (c : (code-left a₀ x)) → Id (inl a₀) x\n decode-left a₀ (inl a) refl = refl\n decode-left a₀ (inr b) c = ind-empty (Lift.raise c)\n\nmodule Nats where\n code : ℕ → ℕ → (UU lzero)\n code zero-ℕ zero-ℕ = 𝟙\n code (succ-ℕ m) zero-ℕ = Lift 𝟘\n code zero-ℕ (succ-ℕ n) = Lift 𝟘\n code (succ-ℕ m) (succ-ℕ n) = code m n\n\n recursion : (n : ℕ) → code n n\n recursion zero-ℕ = star\n recursion (succ-ℕ n) = recursion n\n\n encode : (m n : ℕ) → (Id m n) → (code m n)\n encode m n p = tr (code m) p (recursion m)\n\n decode : (m n : ℕ) → (code m n) → (Id m n)\n decode zero-ℕ zero-ℕ s = refl\n decode (succ-ℕ m) zero-ℕ e = ind-empty (Lift.raise e)\n decode zero-ℕ (succ-ℕ n) e = ind-empty (Lift.raise e)\n decode (succ-ℕ m) (succ-ℕ n) c = ap succ-ℕ (decode m n c)\n\n -- This doesn't work.\n constant-fn : (n : ℕ) → code n n\n constant-fn n = star\n", "meta": {"hexsha": "a30b10e5e17e9351ea51b7c2589984194685fc3e", "size": 1643, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Agda/univalent-hott/encode-decode.agda", "max_stars_repo_name": "hemangandhi/HoTT-Intro", "max_stars_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Agda/univalent-hott/encode-decode.agda", "max_issues_repo_name": "hemangandhi/HoTT-Intro", "max_issues_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Agda/univalent-hott/encode-decode.agda", "max_forks_repo_name": "hemangandhi/HoTT-Intro", "max_forks_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.2156862745, "max_line_length": 122, "alphanum_fraction": 0.5538648813, "num_tokens": 702, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9161096067182449, "lm_q2_score": 0.7310585786300049, "lm_q1q2_score": 0.6697297869567329}} {"text": "\nopen import Auto.Prelude\n\n\n-- using a type argument as a proof\n\nh0 : (x₁ x₂ : ⊥) → x₁ ≡ x₂\nh0 = {!!}\n--h0 = λ x₁ → λ ()\n\n\n-- using dependent pair to define non-dep pair\n\nmodule DND where\n _×_ : Set → Set → Set\n A × B = Σ A (λ _ → B)\n\n h1-2 : ∀ {A B} → A × B → B × A\n-- h1-2 = {!!} -- no solution found\n h1-2 = λ h → Σ-i {!!} {!!}\n-- h1-2 = λ h → Σ-i (Σ.prf h) (Σ.wit h)\n\n\n\n", "meta": {"hexsha": "6da444fb9174e373a32c37e48f66b23d6bf8ad8f", "size": 375, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/interaction/Auto-Misc.agda", "max_stars_repo_name": "masondesu/agda", "max_stars_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z", "max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z", "max_issues_repo_path": "test/interaction/Auto-Misc.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/interaction/Auto-Misc.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 15.0, "max_line_length": 46, "alphanum_fraction": 0.4906666667, "num_tokens": 165, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942319436395, "lm_q2_score": 0.7520125848754472, "lm_q1q2_score": 0.6695124666636373}} {"text": "open import Data.Product using ( ∃ ; _×_ ; _,_ )\nopen import Relation.Binary.PropositionalEquality using ( _≡_ ; refl )\nopen import Relation.Nullary using ( ¬_ )\nopen import Relation.Unary using ( _∈_ ; ∅ )\nopen import Web.Semantic.DL.Signature using ( Signature ; CN ; RN )\nopen import Web.Semantic.Util using ( Setoid ; Subset ; _∘_ ; False )\n\nmodule Web.Semantic.DL.TBox.Interp where\n\ndata Interp (Σ : Signature) : Set₁ where\n interp :\n (Δ : Set) → \n (_≈_ : Δ → Δ → Set) → \n (ref : ∀ {x} → (x ≈ x)) → \n (sym : ∀ {x y} → (x ≈ y) → (y ≈ x)) → \n (trans : ∀ {x y z} → (x ≈ y) → (y ≈ z) → (x ≈ z)) → \n (con : CN Σ → Subset Δ) → \n (rol : RN Σ → Subset (Δ × Δ)) → \n (con-≈ : ∀ {x y} c → (x ∈ con c) → (x ≈ y) → (y ∈ con c)) →\n (rol-≈ : ∀ {w x y z} r → (w ≈ x) → ((x , y) ∈ rol r) → (y ≈ z) → ((w , z) ∈ rol r)) →\n Interp Σ\n\nΔ : ∀ {Σ} → Interp Σ → Set\nΔ (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = Δ\n\n_⊨_≈_ : ∀ {Σ} → (I : Interp Σ) → (Δ I) → (Δ I) → Set\n_⊨_≈_ (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = _≈_\n\n≈-refl : ∀ {Σ} → (I : Interp Σ) → ∀ {x} → (I ⊨ x ≈ x)\n≈-refl (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = ref\n\n≈-sym : ∀ {Σ} → (I : Interp Σ) → ∀ {x y} → (I ⊨ x ≈ y) → (I ⊨ y ≈ x)\n≈-sym (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = sym\n\n≈-trans : ∀ {Σ} → (I : Interp Σ) → ∀ {x y z} → (I ⊨ x ≈ y) → (I ⊨ y ≈ z) → (I ⊨ x ≈ z)\n≈-trans (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = trans\n\ncon : ∀ {Σ} → (I : Interp Σ) → CN Σ → Subset (Δ I)\ncon (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = con\n\nrol : ∀ {Σ} → (I : Interp Σ) → RN Σ → Subset (Δ I × Δ I)\nrol (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = rol\n\ncon-≈ : ∀ {Σ} → (I : Interp Σ) → ∀ {x y} c → (x ∈ con I c) → (I ⊨ x ≈ y) → (y ∈ con I c)\ncon-≈ (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = con-≈\n\nrol-≈ : ∀ {Σ} → (I : Interp Σ) → ∀ {w x y z} r → (I ⊨ w ≈ x) → ((x , y) ∈ rol I r) → (I ⊨ y ≈ z) → ((w , z) ∈ rol I r)\nrol-≈ (interp Δ _≈_ ref sym trans con rol con-≈ rol-≈) = rol-≈\n\n_⊨_≉_ : ∀ {Σ} → (I : Interp Σ) → (Δ I) → (Δ I) → Set\nI ⊨ x ≉ y = ¬(I ⊨ x ≈ y)\n\nemp : ∀ {Σ} → Interp Σ\nemp = interp False (λ ()) (λ {}) (λ {}) (λ {}) (λ c → ∅) (λ r → ∅) (λ {}) (λ {})\n\n≈-refl′ : ∀ {Σ} (I : Interp Σ) → ∀ {x y} → (x ≡ y) → (I ⊨ x ≈ y)\n≈-refl′ I refl = ≈-refl I\n", "meta": {"hexsha": "f5519c54f5721336a54a37dd298f1bd1a1f13cdb", "size": 2289, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Web/Semantic/DL/TBox/Interp.agda", "max_stars_repo_name": "agda/agda-web-semantic", "max_stars_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2015-09-13T17:46:41.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-14T14:21:08.000Z", "max_issues_repo_path": "src/Web/Semantic/DL/TBox/Interp.agda", "max_issues_repo_name": "agda/agda-web-semantic", "max_issues_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2018-11-14T02:32:28.000Z", "max_issues_repo_issues_event_max_datetime": "2021-01-04T20:57:19.000Z", "max_forks_repo_path": "src/Web/Semantic/DL/TBox/Interp.agda", "max_forks_repo_name": "agda/agda-web-semantic", "max_forks_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2017-12-03T14:52:09.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:40:03.000Z", "avg_line_length": 39.4655172414, "max_line_length": 118, "alphanum_fraction": 0.4700742682, "num_tokens": 1139, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942290328344, "lm_q2_score": 0.7520125793176223, "lm_q1q2_score": 0.6695124595265758}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.Monoid.Instances.Nat where\n\nopen import Cubical.Foundations.Prelude\n\nopen import Cubical.Data.Nat\n\nopen import Cubical.Algebra.Monoid\n\n\nNatMonoid : Monoid ℓ-zero\nfst NatMonoid = ℕ\nMonoidStr.ε (snd NatMonoid) = 0\nMonoidStr._·_ (snd NatMonoid) = _+_\nMonoidStr.isMonoid (snd NatMonoid) = makeIsMonoid isSetℕ +-assoc +-zero (λ _ → refl)\n", "meta": {"hexsha": "2d0eb95aab9907544e11b940ad1e9d8e65636061", "size": 379, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Monoid/Instances/Nat.agda", "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/Monoid/Instances/Nat.agda", "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/Monoid/Instances/Nat.agda", "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.6875, "max_line_length": 84, "alphanum_fraction": 0.7546174142, "num_tokens": 124, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9399133447766225, "lm_q2_score": 0.7122321964553657, "lm_q1q2_score": 0.6694365460279633}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Integers.Integers\nopen import Numbers.Integers.Addition\nopen import Groups.Lemmas\nopen import Groups.Definition\nopen import Groups.Cyclic.Definition\nopen import Semirings.Definition\n\nmodule Groups.Cyclic.DefinitionLemmas {m n : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} (G : Group S _+_) where\n\nopen Setoid S\nopen Group G\nopen Equivalence eq\n\nelementPowerCommutes : (x : A) (n : ℕ) → (x + positiveEltPower G x n) ∼ ((positiveEltPower G x n) + x)\nelementPowerCommutes x zero = transitive identRight (symmetric identLeft)\nelementPowerCommutes x (succ n) = transitive (+WellDefined reflexive (elementPowerCommutes x n)) +Associative\n\nelementPowerCollapse : (x : A) (i j : ℤ) → Setoid._∼_ S ((elementPower G x i) + (elementPower G x j)) (elementPower G x (i +Z j))\nelementPowerCollapse x (nonneg a) (nonneg b) rewrite equalityCommutative (+Zinherits a b) = positiveEltPowerCollapse G x a b\nelementPowerCollapse x (nonneg zero) (negSucc b) = identLeft\nelementPowerCollapse x (nonneg (succ a)) (negSucc zero) = transitive (+WellDefined (elementPowerCommutes x a) reflexive) (transitive (symmetric +Associative) (transitive (+WellDefined reflexive (transitive (+WellDefined reflexive (invContravariant G)) (transitive (+WellDefined reflexive (transitive (+WellDefined (invIdent G) reflexive) identLeft)) invRight))) identRight))\nelementPowerCollapse x (nonneg (succ a)) (negSucc (succ b)) = transitive (transitive (+WellDefined (elementPowerCommutes x a) reflexive) (transitive (symmetric +Associative) (+WellDefined reflexive (transitive (transitive (+WellDefined reflexive (inverseWellDefined G (transitive (+WellDefined reflexive (elementPowerCommutes x b)) +Associative))) (transitive (+WellDefined reflexive (invContravariant G)) (transitive +Associative (transitive (+WellDefined invRight (invContravariant G)) identLeft)))) (symmetric (invContravariant G)))))) (elementPowerCollapse x (nonneg a) (negSucc b))\nelementPowerCollapse x (negSucc zero) (nonneg zero) = identRight\nelementPowerCollapse x (negSucc zero) (nonneg (succ b)) = transitive (transitive +Associative (+WellDefined (transitive (+WellDefined (inverseWellDefined G identRight) reflexive) invLeft) reflexive)) identLeft\nelementPowerCollapse x (negSucc (succ a)) (nonneg zero) = identRight\nelementPowerCollapse x (negSucc (succ a)) (nonneg (succ b)) = transitive (transitive +Associative (+WellDefined (transitive (+WellDefined (invContravariant G) reflexive) (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invLeft) identRight))) reflexive)) (elementPowerCollapse x (negSucc a) (nonneg b))\nelementPowerCollapse x (negSucc a) (negSucc b) = transitive (+WellDefined reflexive (invContravariant G)) (transitive (transitive (transitive +Associative (+WellDefined (transitive (symmetric (invContravariant G)) (transitive (inverseWellDefined G +Associative) (transitive (inverseWellDefined G (+WellDefined (symmetric (elementPowerCommutes x b)) reflexive)) (transitive (inverseWellDefined G (symmetric +Associative)) (transitive (invContravariant G) (+WellDefined (inverseWellDefined G (transitive (positiveEltPowerCollapse G x b a) (identityOfIndiscernablesRight _∼_ reflexive (applyEquality (positiveEltPower G x) {b +N a} {a +N b} (Semiring.commutative ℕSemiring b a))))) reflexive)))))) reflexive)) (+WellDefined (symmetric (invContravariant G)) reflexive)) (symmetric (invContravariant G)))\n\npositiveEltPowerInverse : (m : ℕ) → (x : A) → (positiveEltPower G (inverse x) m) ∼ inverse (positiveEltPower G x m)\npositiveEltPowerInverse zero x = symmetric (invIdent G)\npositiveEltPowerInverse (succ m) x = transitive (+WellDefined reflexive (positiveEltPowerInverse m x)) (transitive (symmetric (invContravariant G)) (inverseWellDefined G (symmetric (elementPowerCommutes x m))))\n\npositiveEltPowerMultiplies : (m n : ℕ) → (x : A) → (positiveEltPower G x (m *N n)) ∼ (positiveEltPower G (positiveEltPower G x n) m)\npositiveEltPowerMultiplies zero n x = reflexive\npositiveEltPowerMultiplies (succ m) n x = transitive (symmetric (positiveEltPowerCollapse G x n (m *N n))) (+WellDefined reflexive (positiveEltPowerMultiplies m n x))\n\npowerZero : (m : ℕ) → positiveEltPower G 0G m ∼ 0G\npowerZero zero = reflexive\npowerZero (succ m) = transitive identLeft (powerZero m)\n\nelementPowerMultiplies : (m n : ℤ) → (x : A) → (elementPower G x (m *Z n)) ∼ (elementPower G (elementPower G x n) m)\nelementPowerMultiplies (nonneg m) (nonneg n) x = positiveEltPowerMultiplies m n x\nelementPowerMultiplies (nonneg zero) (negSucc n) x = reflexive\nelementPowerMultiplies (nonneg (succ m)) (negSucc n) x = transitive (transitive (inverseWellDefined G (transitive (transitive (elementPowerWellDefinedZ' G (nonneg (succ (n +N m *N n) +N m)) (nonneg (m *N succ n +N succ n)) (applyEquality nonneg (transitivity (applyEquality succ (transitivity (equalityCommutative (Semiring.+Associative ℕSemiring n (m *N n) m)) (applyEquality (n +N_) (transitivity (transitivity (Semiring.commutative ℕSemiring _ m) (applyEquality (m +N_) (multiplicationNIsCommutative m n))) (multiplicationNIsCommutative (succ n) m))))) (Semiring.commutative ℕSemiring (succ n) _))) {x}) (symmetric (positiveEltPowerCollapse G x (m *N succ n) (succ n)))) (+WellDefined (positiveEltPowerMultiplies m (succ n) x) reflexive))) (invContravariant G)) (+WellDefined reflexive (symmetric (positiveEltPowerInverse m (x + positiveEltPower G x n))))\nelementPowerMultiplies (negSucc m) (nonneg zero) r = transitive (symmetric (invIdent G)) (inverseWellDefined G (transitive (symmetric identLeft) (+WellDefined reflexive (symmetric (powerZero m)))))\nelementPowerMultiplies (negSucc m) (nonneg (succ n)) x = inverseWellDefined G (transitive (transitive (+WellDefined reflexive (transitive (elementPowerWellDefinedZ' G (nonneg ((m +N n *N m) +N n)) (nonneg (n +N m *N succ n)) (applyEquality nonneg (transitivity (Semiring.commutative ℕSemiring _ n) (applyEquality (n +N_) (multiplicationNIsCommutative _ m)))) {x}) (symmetric (positiveEltPowerCollapse G x n (m *N succ n))))) +Associative) (+WellDefined reflexive (positiveEltPowerMultiplies m (succ n) x)))\nelementPowerMultiplies (negSucc m) (negSucc n) r = transitive (transitive (transitive (transitive (elementPowerWellDefinedZ' G (nonneg (succ m *N succ n)) (nonneg (m *N succ n +N succ n)) (applyEquality nonneg (Semiring.commutative ℕSemiring (succ n) _)) {r}) (symmetric (positiveEltPowerCollapse G r (m *N succ n) (succ n)))) (transitive (elementPowerCollapse r (nonneg (m *N succ n)) (nonneg (succ n))) (transitive (transitive (elementPowerWellDefinedZ' G (nonneg (m *N succ n) +Z nonneg (succ n)) (nonneg (m *N succ n +N succ n)) (equalityCommutative (+Zinherits (m *N succ n) (succ n))) {r}) (symmetric (positiveEltPowerCollapse G r (m *N succ n) (succ n)))) (+WellDefined (positiveEltPowerMultiplies m (succ n) r) reflexive)))) (+WellDefined (transitive (symmetric (invTwice G _)) (inverseWellDefined G (symmetric (positiveEltPowerInverse m (r + positiveEltPower G r n))))) (symmetric (invTwice G _)))) (symmetric (invContravariant G))\n\npositiveEltPowerHomAbelian : ({x y : A} → (x + y) ∼ (y + x)) → (x y : A) → (r : ℕ) → (positiveEltPower G (x + y) r) ∼ (positiveEltPower G x r + positiveEltPower G y r)\npositiveEltPowerHomAbelian ab x y zero = symmetric identRight\npositiveEltPowerHomAbelian ab x y (succ r) = transitive (symmetric +Associative) (transitive (+WellDefined reflexive (transitive (+WellDefined reflexive (positiveEltPowerHomAbelian ab x y r)) (transitive (+WellDefined reflexive ab) (transitive +Associative ab)))) +Associative)\n\nelementPowerHomAbelian : ({x y : A} → (x + y) ∼ (y + x)) → (x y : A) → (r : ℤ) → (elementPower G (x + y) r) ∼ (elementPower G x r + elementPower G y r)\nelementPowerHomAbelian ab x y (nonneg n) = positiveEltPowerHomAbelian ab x y n\nelementPowerHomAbelian ab x y (negSucc n) = transitive (transitive (inverseWellDefined G (positiveEltPowerHomAbelian ab x y (succ n))) (inverseWellDefined G ab)) (invContravariant G)\n", "meta": {"hexsha": "72402de561f05694959156cb60ee9c2a50b883ac", "size": 8158, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Cyclic/DefinitionLemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Cyclic/DefinitionLemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Cyclic/DefinitionLemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 131.5806451613, "max_line_length": 940, "alphanum_fraction": 0.7561902427, "num_tokens": 2471, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9314625107731765, "lm_q2_score": 0.7185943925708562, "lm_q1q2_score": 0.6693437371315755}} {"text": "{-# OPTIONS --universe-polymorphism #-}\nmodule Categories.Cocone where\n\nopen import Level\n\nopen import Categories.Category\nopen import Categories.Functor hiding (_≡_; _∘_)\n\nrecord Cocone {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′) where\n module J = Category J\n open Category C\n open Functor F\n field\n N : Obj\n ψ : ∀ X → ((F₀ X) ⇒ N)\n .commute : ∀ {X Y} (f : J [ X , Y ]) → ψ X ≡ ψ Y ∘ F₁ f\n", "meta": {"hexsha": "fc2dd35bb8315ce904b55d1e5192b522678b5665", "size": 469, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Cocone.agda", "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 98, "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_issues_repo_path": "Categories/Cocone.agda", "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 19, "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_forks_repo_path": "Categories/Cocone.agda", "max_forks_repo_name": "p-pavel/categories", "max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 23, "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "avg_line_length": 27.5882352941, "max_line_length": 129, "alphanum_fraction": 0.5863539446, "num_tokens": 183, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.927363293639213, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.6693181569538664}} {"text": "{-# OPTIONS --without-K #-}\nmodule PathStructure.Sigma {a b} {A : Set a} {B : A → Set b} where\n\nopen import Equivalence\nopen import PathOperations\nopen import Transport\nopen import Types\n\nap₂-dep : ∀ {a b c} {A : Set a} {B : A → Set b} {C : Set c}\n {x x′ : A} {y : B x} {y′ : B x′}\n (f : (a : A) (b : B a) → C) (p : x ≡ x′) (q : tr B p y ≡ y′) →\n f x y ≡ f x′ y′\nap₂-dep {B = B} f p q = J\n (λ x x′ p → (y : B x) (y′ : B x′) (q : tr B p y ≡ y′) → f x y ≡ f x′ y′)\n (λ x _ _ q → ap (f x) q)\n _ _ p _ _ q\n\nap₂-dep-eq : ∀ {a b c} {A : Set a} {B : A → Set b} {C : Set c}\n (f : (x : A) → B x → C)\n {x x′ : A} (p p′ : x ≡ x′) (pp : p ≡ p′)\n {y : B x} {y′ : B x′} (q : tr B p y ≡ y′) (q′ : tr B p′ y ≡ y′)\n (qq : tr (λ z → tr B z y ≡ y′) pp q ≡ q′) →\n ap₂-dep f p q ≡ ap₂-dep f p′ q′\nap₂-dep-eq {B = B} f {x = x} {x′ = x′} p p′ pp q q′ qq = J\n (λ p p′ pp → (y : B x) (y′ : B x′)\n (q : tr B p y ≡ y′) (q′ : tr B p′ y ≡ y′)\n (qq : tr (λ z → tr B z y ≡ y′) pp q ≡ q′) →\n ap₂-dep f p q ≡ ap₂-dep f p′ q′)\n (λ p _ _ q q′ qq → J\n (λ q q′ qq → ap₂-dep f p q ≡ ap₂-dep f p q′)\n (λ _ → refl)\n _ _ qq)\n _ _ pp _ _ _ _ qq\n\nsplit-path : {x y : Σ A B} →\n x ≡ y → Σ (π₁ x ≡ π₁ y) (λ p → tr B p (π₂ x) ≡ π₂ y)\nsplit-path {x = x} p = ap π₁ p , tr-∘ π₁ p (π₂ x) ⁻¹ · apd π₂ p\n\nmerge-path : {x y : Σ A B} →\n Σ (π₁ x ≡ π₁ y) (λ p → tr B p (π₂ x) ≡ π₂ y) → x ≡ y\nmerge-path pq = ap₂-dep _,_ (π₁ pq) (π₂ pq)\n\nsplit-merge-eq : {x y : Σ A B} →\n (x ≡ y) ≃ Σ (π₁ x ≡ π₁ y) (λ p → tr B p (π₂ x) ≡ π₂ y)\nsplit-merge-eq\n = split-path\n , (merge-path , λ pq → J\n (λ x x′ p → (y : B x) (y′ : B x′) (q : tr B p y ≡ y′) →\n split-path (merge-path (p , q)) ≡ p , q)\n (λ x y y′ q → J {A = B x}\n (λ _ _ q → split-path (merge-path (refl , q)) ≡ refl , q)\n (λ _ → refl) _ _ q)\n _ _ (π₁ pq) _ _ (π₂ pq))\n , (merge-path , J\n (λ _ _ p → merge-path (split-path p) ≡ p)\n (λ _ → refl) _ _)\n", "meta": {"hexsha": "845b6cbcbc058a82b820aaedbbce5cec75b70a0e", "size": 1921, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/PathStructure/Sigma.agda", "max_stars_repo_name": "vituscze/HoTT-lectures", "max_stars_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/PathStructure/Sigma.agda", "max_issues_repo_name": "vituscze/HoTT-lectures", "max_issues_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/PathStructure/Sigma.agda", "max_forks_repo_name": "vituscze/HoTT-lectures", "max_forks_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.701754386, "max_line_length": 74, "alphanum_fraction": 0.4273815721, "num_tokens": 985, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357598021707, "lm_q2_score": 0.7718435083355187, "lm_q1q2_score": 0.6692159226980596}} {"text": "module Prelude.Ord.Properties where\n\nopen import Prelude.Ord\nopen import Prelude.Empty\nopen import Prelude.Equality\nopen import Prelude.Equality.Inspect\n\nopen import Prelude.Function\nopen import Prelude.Decidable\nopen import Prelude.Bool\nopen import Prelude.Bool.Properties\n\n\n-- Ord/Laws extra lemmas\nmodule _ {ℓ} {A : Set ℓ} {{_ : Ord/Laws A}} where\n\n <⇒≤ : {a b : A} → a < b → a ≤ b\n <⇒≤ = lt-to-leq\n\n ≡⇒≮ : {a b : A} → a ≡ b → a ≮ b\n ≡⇒≮ refl ab = lt-to-leq a>b\n\n ≰⇒> : {a b : A} → a ≰ b → a > b\n ≰⇒> {a = a} {b = b} a≰b\n with compare a b\n ...| less aa = b>a\n\n ≰⇒≥ : {a b : A} → a ≰ b → a ≥ b\n ≰⇒≥ = <⇒≤ ∘ ≰⇒>\n\n b = λ ab ab with≡ _ = lt-to-leq a>b\n\n ≰?⇒≰ : {a b : A} → (a ≤? b) ≡ false → a ≰ b\n ≰?⇒≰ {a = a} {b = b} a≰?b\n with (compare b a)\n ...| less b\n\n_==∎ : ∀ {i : Level} {A : UU i} (a : A) → a == a\na ==∎ = refl\n\n_==⟨_⟩_ : ∀ {i : Level} {A : UU i} (a : A) {b c : A} → a == b → b == c → a == c\na ==⟨ γ ⟩ η = γ · η\n-- end equational reasoning\n\nassoc : {i : Level} {A : UU i} {x y z w : A} (p : Id x y) (q : Id y z) (r : Id z w) → Id (concat _ p (concat _ q r)) (concat _ (concat _ p q) r)\nassoc refl q r = refl\n\nleft-unit : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (concat _ refl p) p\nleft-unit refl = refl\n\nright-unit : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (concat _ p refl) p\nright-unit refl = refl\n\nleft-inv : {i : Level} {A : UU i} {x y : A} (p : Id x y) →\n Id (concat _ (inv p) p) refl\nleft-inv refl = refl\n\nright-inv : {i : Level} {A : UU i} {x y : A} (p : Id x y) →\n Id (concat _ p (inv p)) refl\nright-inv refl = refl\n\n-- action on paths of a function\n\nap : {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y : A} (p : Id x y) → Id (f x) (f y)\nap f refl = refl\n\nap-id : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (ap id p) p\nap-id refl = refl\n\nap-comp : {i j k : Level} {A : UU i} {B : UU j} {C : UU k} (g : B → C) (f : A → B) {x y : A} (p : Id x y) → Id (ap (comp g f) p) (ap g (ap f p))\nap-comp g f refl = refl\n\nap-refl : {i j : Level} {A : UU i} {B : UU j} (f : A → B) (x : A) →\n Id (ap f (refl {_} {_} {x})) refl\nap-refl f x = refl\n\nap-concat : {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y z : A} (p : Id x y) (q : Id y z) → Id (ap f (concat _ p q)) (concat _ (ap f p) (ap f q))\nap-concat f refl q = refl\n\nap-inv : {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y : A} (p : Id x y) → Id (ap f (inv p)) (inv (ap f p))\nap-inv f refl = refl\n\ntr : {i j : Level} {A : UU i} (B : A → UU j) {x y : A} (p : Id x y) (b : B x) → B y\ntr B refl b = b\n\napd : {i j : Level} {A : UU i} {B : A → UU j} (f : (x : A) → B x) {x y : A} (p : Id x y) → Id (tr B p (f x)) (f y)\napd f refl = refl\n\n-- Exercises below\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n-- Exercise 4.1 The composition of transports is the transport of the concatenation\ntr-concat : {i j : Level} {A : UU i} (B : A → UU j) {x y z : A} (p : Id x y) (q : Id y z) (b : B x) → Id (tr B q (tr B p b)) (tr B (concat _ p q) b)\ntr-concat B refl refl b = refl\n\n-- Exercise 4.2 Taking the inverse distributes contravariantly over concatenation\ninv-assoc : {i : Level} {A : UU i} {x y z : A} (p : Id x y) (q : Id y z) → Id (inv (concat _ p q)) (concat _ (inv q) (inv p))\ninv-assoc refl refl = refl\n\n-- Exercise 4.3 If B is a weakened family over A (trivial bundle, not dependent), then tr is refl\ntr-triv : {i j : Level} {A : UU i} {B : UU j} {x y : A} (p : Id x y) (b : B) → Id (tr (weaken A B) p b) b\ntr-triv refl b = refl\n\n-- Exercise 4.4 Transporting, using x=y and f:A → B, an identity between identities\ntr-fib : {i j : Level} {A : UU i} {B : UU j} {f : A → B} {x y : A} (p : Id x y) (b : B) →\n (q : Id (f x) b) → Id (tr (λ (a : A) → Id (f a) b) p q) (concat _ (inv (ap f p)) q)\ntr-fib refl b q = refl\n\ntr-fib' : {i j : Level} {A : UU i} {B : UU j} {f : A → B} {x y : A} (p : Id x y) (b : B) →\n (q : Id b (f x)) → Id (tr (λ (a : A) → Id b (f a)) p q) (concat _ q (ap f p))\ntr-fib' refl b refl = refl\n\n-- Exercise 4.5\ninv-con : {i : Level} {A : UU i} {x y z : A} (p : Id x y) (q : Id y z) (r : Id x z) → (Id (p · q) r) → (Id q ((inv p) · r))\ninv-con refl refl r refl = refl\n\ncon-inv : {i : Level} {A : UU i} {x y z : A} (p : Id x y) (q : Id y z) (r : Id x z) → (Id (p · q) r) → (Id p (r · (inv q)))\ncon-inv refl refl r refl = refl\n\n-- Exercise 4.6 Path lifting, from a path in the base A to a path in the total space Σ A B\nlift : {i j : Level} {A : UU i} {B : A → UU j} {x y : A} (p : Id x y) (b : B x) → Id (dpair x b) (dpair y (tr B p b))\nlift refl b = refl\n\n-- Exercise 4.7 Some laws of arithmetic (follow-up from Remark 2.3.1)\nright-unit-addN : (m : ℕ) → Id (m + Nzero) m\nright-unit-addN Nzero = refl\nright-unit-addN (Nsucc m) = ap Nsucc (right-unit-addN m)\n\nleft-unit-addN : (m : ℕ) → Id (Nzero + m) m\nleft-unit-addN m = refl\n\nassoc-addN : (m n k : ℕ) → Id (m + (n + k)) ((m + n) + k)\nassoc-addN Nzero n k = refl\nassoc-addN (Nsucc m) n k = ap Nsucc (assoc-addN m n k)\n\nright-succ-addN : (m n : ℕ) → Id (m + (Nsucc n)) (Nsucc (m + n))\nright-succ-addN Nzero n = refl\nright-succ-addN (Nsucc m) n = ap Nsucc (right-succ-addN m n)\n\ncomm-addN : (m n : ℕ) → Id (m + n) (n + m)\ncomm-addN Nzero Nzero = refl\ncomm-addN Nzero (Nsucc n) = ap Nsucc (comm-addN Nzero n)\ncomm-addN (Nsucc m) Nzero = ap Nsucc (comm-addN m Nzero)\ncomm-addN (Nsucc m) (Nsucc n) =\n ((Nsucc m) + (Nsucc n))\n ==⟨ ap Nsucc (comm-addN m (Nsucc n)) ⟩\n (Nsucc ((Nsucc n) + m))\n ==⟨ inv (right-succ-addN (Nsucc n) m) ⟩\n ((Nsucc n) + (Nsucc m))\n ==∎\n\nleft-zero-mulN : (m : ℕ) → Id (Nzero ** m) Nzero\nleft-zero-mulN m = refl\n\nright-zero-mulN : (m : ℕ) → Id (m ** Nzero) Nzero\nright-zero-mulN Nzero = refl\nright-zero-mulN (Nsucc m) = concat (m ** Nzero) (right-unit-addN _) (right-zero-mulN m)\n\nleft-unit-mulN : (m : ℕ) → Id ((Nsucc Nzero) ** m) m\nleft-unit-mulN m = refl\n\nright-unit-mulN : (m : ℕ) → Id (m ** (Nsucc Nzero)) m\nright-unit-mulN Nzero = refl\nright-unit-mulN (Nsucc m) =\n ((Nsucc m) ** (Nsucc Nzero))\n ==⟨ comm-addN _ (Nsucc Nzero) ⟩\n (Nsucc Nzero) + (m ** (Nsucc Nzero))\n ==⟨ ap Nsucc (right-unit-mulN m) ⟩\n (Nsucc m)\n ==∎\n\ndistr-addN-mulN : (m n k : ℕ) → Id ((m + n) ** k) ((m ** k) + (n ** k))\ndistr-addN-mulN Nzero n k = refl\ndistr-addN-mulN (Nsucc m) n k =\n ((Nsucc m) + n) ** k\n ==⟨ refl ⟩\n (Nsucc (m + n)) ** k\n ==⟨ refl ⟩\n ((m + n) ** k) + k\n ==⟨ ap (λ x → x + k) (distr-addN-mulN m n k) ⟩\n ((m ** k) + (n ** k)) + k\n ==⟨ inv (assoc-addN (m ** k) (n ** k) k) ⟩\n (m ** k) + ((n ** k) + k)\n ==⟨ ap (λ x → (m ** k) + x) (comm-addN (n ** k) k) ⟩\n (m ** k) + (k + (n ** k))\n ==⟨ assoc-addN (m ** k) k (n ** k) ⟩\n ((m ** k) + k) + (n ** k)\n ==⟨ refl ⟩\n ((Nsucc m) ** k) + (n ** k)\n ==∎\n\nassoc-mulN : (m n k : ℕ) → Id (m ** (n ** k)) ((m ** n) ** k)\nassoc-mulN Nzero n k = refl\nassoc-mulN (Nsucc m) n k =\n ((Nsucc m) ** (n ** k))\n ==⟨ refl ⟩\n (m ** (n ** k)) + (n ** k)\n ==⟨ ap (λ x → x + (n ** k)) (assoc-mulN m n k) ⟩\n ((m ** n) ** k) + (n ** k)\n ==⟨ inv (distr-addN-mulN (m ** n) n k) ⟩\n ((m ** n) + n) ** k\n ==⟨ refl ⟩\n (Nsucc m ** n) ** k\n ==∎\n", "meta": {"hexsha": "ecf206418537f9446c11c9e695e1cbaf1584b737", "size": 7222, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Lecture4.agda", "max_stars_repo_name": "glangmead/hott_cmu80818", "max_stars_repo_head_hexsha": "af64d808630f4f1498a75201b6ca4d74d662516b", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-05-03T20:32:19.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-04T02:52:25.000Z", "max_issues_repo_path": "Lecture4.agda", "max_issues_repo_name": "glangmead/hott_cmu80818", "max_issues_repo_head_hexsha": "af64d808630f4f1498a75201b6ca4d74d662516b", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-02-22T21:01:16.000Z", "max_issues_repo_issues_event_max_datetime": "2018-03-25T14:44:31.000Z", "max_forks_repo_path": "Lecture4.agda", "max_forks_repo_name": "glangmead/hott_cmu80818", "max_forks_repo_head_hexsha": "af64d808630f4f1498a75201b6ca4d74d662516b", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-02-22T19:58:46.000Z", "max_forks_repo_forks_event_max_datetime": "2018-06-25T15:05:21.000Z", "avg_line_length": 30.0916666667, "max_line_length": 153, "alphanum_fraction": 0.4988922736, "num_tokens": 3219, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357494949105, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.6692159010912792}} {"text": "-- {-# OPTIONS --show-implicit --show-irrelevant #-}\nmodule Data.QuadTree.FunctorProofs.FunctorLaws where\n\nopen import Haskell.Prelude renaming (zero to Z; suc to S)\nopen import Data.Logic\nopen import Data.QuadTree.InternalAgda\nopen import Agda.Primitive\nopen import Data.QuadTree.Implementation.Functors\n\n\n-- First, define the Functor laws\n\nIdentityLaw : (f : (t : Set) -> {{ eqT : Eq t }} -> Set) -> {{ff : FunctorEq f}} -> Set₁\nIdentityLaw f {{ff}} = {t : Set} -> {{ eqT : Eq t }} \n -> (v : f t) -> fmapₑ ff id v ≡ id v\n\nCompositionLaw : (f : (t : Set) -> {{ eqT : Eq t }} -> Set) -> {{ff : FunctorEq f}} -> Set₁\nCompositionLaw f {{ff}} = {a b c : Set} -> {{ eqA : Eq a }} {{ eqB : Eq b }} {{ eqC : Eq c }} \n -> (v : f a) -> (fun1 : a -> b) -> (fun2 : b -> c) -> fmapₑ ff (fun2 ∘ fun1) v ≡ fmapₑ ff fun2 (fmapₑ ff fun1 v)\n", "meta": {"hexsha": "44d8660188802050231d1e4dbd5b4a10b3478d3f", "size": 827, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Data/QuadTree/FunctorProofs/FunctorLaws.agda", "max_stars_repo_name": "JonathanBrouwer/research-project", "max_stars_repo_head_hexsha": "4959a3c9cd8563a1726e0e968e6a179008cd4d9f", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-05-25T09:10:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-25T09:10:20.000Z", "max_issues_repo_path": "src/Data/QuadTree/FunctorProofs/FunctorLaws.agda", "max_issues_repo_name": "JonathanBrouwer/research-project", "max_issues_repo_head_hexsha": "4959a3c9cd8563a1726e0e968e6a179008cd4d9f", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Data/QuadTree/FunctorProofs/FunctorLaws.agda", "max_forks_repo_name": "JonathanBrouwer/research-project", "max_forks_repo_head_hexsha": "4959a3c9cd8563a1726e0e968e6a179008cd4d9f", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.35, "max_line_length": 114, "alphanum_fraction": 0.592503023, "num_tokens": 289, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8933094032139577, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6691666613104909}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Category.Cocomplete where\n\nopen import Level\n\nopen import Categories.Category using (Category)\nopen import Categories.Functor using (Functor)\nopen import Categories.Diagram.Colimit using (Colimit)\n\nCocomplete : (o ℓ e : Level) {o′ ℓ′ e′ : Level} (C : Category o′ ℓ′ e′) → Set _\nCocomplete o ℓ e C = ∀ {J : Category o ℓ e} (F : Functor J C) → Colimit F\n", "meta": {"hexsha": "13afc28ca4e2899bdde637a0d7521e11c9baced7", "size": 406, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Cocomplete.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Cocomplete.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Cocomplete.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 31.2307692308, "max_line_length": 79, "alphanum_fraction": 0.7019704433, "num_tokens": 117, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9230391727723469, "lm_q2_score": 0.7248702761768248, "lm_q1q2_score": 0.669083660089519}} {"text": "{-# OPTIONS --without-K --safe #-}\n\n-- The category of Cats is Monoidal\n\nmodule Categories.Category.Monoidal.Instance.Cats where\n\nopen import Level\nopen import Data.Product using (Σ; _×_; _,_; proj₁; proj₂; uncurry)\n\nopen import Categories.Category\nopen import Categories.Functor using (Functor; _∘F_) renaming (id to idF)\nopen import Categories.Category.Instance.Cats\nopen import Categories.Category.Monoidal\nopen import Categories.Functor.Bifunctor\nopen import Categories.Category.Instance.One\nopen import Categories.Category.Product\nopen import Categories.Category.Product.Properties\nimport Categories.Category.Cartesian as Cartesian\nopen import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism)\n\n-- Cats is a Monoidal Category with Product as Bifunctor\nmodule Product {o ℓ e : Level} where\n private\n C = Cats o ℓ e\n open Cartesian C\n\n Cats-has-all : BinaryProducts\n Cats-has-all = record { product = λ {A} {B} → record\n { A×B = Product A B\n ; π₁ = πˡ\n ; π₂ = πʳ\n ; ⟨_,_⟩ = _※_\n ; project₁ = λ {_} {h} {i} → project₁ {i = h} {j = i}\n ; project₂ = λ {_} {h} {i} → project₂ {i = h} {j = i}\n ; unique = unique\n } }\n\n Cats-is : Cartesian\n Cats-is = record { terminal = One-⊤ ; products = Cats-has-all }\n\n private\n module Cart = Cartesian.Cartesian Cats-is\n\n Cats-Monoidal : Monoidal C\n Cats-Monoidal = Cart.monoidal\n", "meta": {"hexsha": "ba8988335ab600d24271d569552d4c81765e01b9", "size": 1385, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Monoidal/Instance/Cats.agda", "max_stars_repo_name": "bblfish/agda-categories", "max_stars_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "src/Categories/Category/Monoidal/Instance/Cats.agda", "max_issues_repo_name": "bblfish/agda-categories", "max_issues_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Monoidal/Instance/Cats.agda", "max_forks_repo_name": "bblfish/agda-categories", "max_forks_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 30.1086956522, "max_line_length": 90, "alphanum_fraction": 0.7083032491, "num_tokens": 386, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9230391621868804, "lm_q2_score": 0.7248702761768248, "lm_q1q2_score": 0.669083652416429}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Finite sets\n------------------------------------------------------------------------\n\n-- Note that elements of Fin n can be seen as natural numbers in the\n-- set {m | m < n}. The notation \"m\" in comments below refers to this\n-- natural number view.\n\nmodule Data.Fin where\n\nopen import Data.Nat as Nat\n using (ℕ; zero; suc; z≤n; s≤s)\n renaming ( _+_ to _N+_; _∸_ to _N∸_\n ; _≤_ to _N≤_; _≥_ to _N≥_; _<_ to _N<_; _≤?_ to _N≤?_)\nopen import Function\nimport Level\nopen import Relation.Nullary.Decidable\nopen import Relation.Binary\n\n------------------------------------------------------------------------\n-- Types\n\n-- Fin n is a type with n elements.\n\ndata Fin : ℕ → Set where\n zero : {n : ℕ} → Fin (suc n)\n suc : {n : ℕ} (i : Fin n) → Fin (suc n)\n\n-- A conversion: toℕ \"n\" = n.\n\ntoℕ : ∀ {n} → Fin n → ℕ\ntoℕ zero = 0\ntoℕ (suc i) = suc (toℕ i)\n\n-- A Fin-indexed variant of Fin.\n\nFin′ : ∀ {n} → Fin n → Set\nFin′ i = Fin (toℕ i)\n\n------------------------------------------------------------------------\n-- Conversions\n\n-- toℕ is defined above.\n\n-- fromℕ n = \"n\".\n\nfromℕ : (n : ℕ) → Fin (suc n)\nfromℕ zero = zero\nfromℕ (suc n) = suc (fromℕ n)\n\n-- fromℕ≤ {m} _ = \"m\".\n\nfromℕ≤ : ∀ {m n} → m N< n → Fin n\nfromℕ≤ (Nat.s≤s Nat.z≤n) = zero\nfromℕ≤ (Nat.s≤s (Nat.s≤s m≤n)) = suc (fromℕ≤ (Nat.s≤s m≤n))\n\n-- # m = \"m\".\n\n#_ : ∀ m {n} {m False -> A\n\n infix 3 _/\\_\n\n data _/\\_ (P Q : Set) : Set where\n andI : P -> Q -> P /\\ Q\n\n -- Zero and One -----------------------------------------------------------\n\n data Zero : Set where\n\n data One : Set where\n unit : One\n\n -- Natural numbers --------------------------------------------------------\n\n data Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\n _+_ : Nat -> Nat -> Nat\n zero + m = m\n suc n + m = suc (n + m)\n\n module NatEq where\n\n infix 5 _==_\n\n _==_ : Nat -> Nat -> Set\n zero == zero = True\n suc n == suc m = n == m\n _ == _ = False\n\n rewriteEq : (C : Nat -> Set){m n : Nat} -> m == n -> C n -> C m\n rewriteEq C {zero} {zero} _ x = x\n rewriteEq C {suc _} {suc _} eq x = rewriteEq (\\z -> C (suc z)) eq x\n rewriteEq C {zero} {suc _} () _\n rewriteEq C {suc _} {zero} () _\n\nmodule Chain {A : Set}(_==_ : A -> A -> Set)\n (_trans_ : {x y z : A} -> x == y -> y == z -> x == z)\n where\n\n infixl 4 _=-=_\n infixl 4 _===_\n infixr 8 _since_\n\n _=-=_ : (x : A){y : A} -> x == y -> x == y\n x =-= xy = xy\n\n _===_ : {x y z : A} -> x == y -> y == z -> x == z\n xy === yz = xy trans yz\n\n _since_ : {x : A}(y : A) -> x == y -> x == y\n y since xy = xy\n\nmodule Fin where\n\n open Prelude\n\n -- Finite sets ------------------------------------------------------------\n\n data Suc (A : Set) : Set where\n fzero' : Suc A\n fsuc' : A -> Suc A\n\n mutual\n data Fin (n : Nat) : Set where\n finI : Fin' n -> Fin n\n\n Fin' : Nat -> Set\n Fin' zero = Zero\n Fin' (suc n) = Suc (Fin n)\n\n fzero : {n : Nat} -> Fin (suc n)\n fzero = finI fzero'\n\n fsuc : {n : Nat} -> Fin n -> Fin (suc n)\n fsuc i = finI (fsuc' i)\n\n finE : {n : Nat} -> Fin n -> Fin' n\n finE (finI i) = i\n\n module FinEq where\n\n infix 5 _==_\n\n _==_ : {n : Nat} -> Fin n -> Fin n -> Set\n _==_ {suc _} (finI fzero' ) (finI fzero' ) = True\n _==_ {suc _} (finI (fsuc' i)) (finI (fsuc' j)) = i == j\n _==_ _ _ = False\n\n rewriteEq : {n : Nat}(C : Fin n -> Set){i j : Fin n} -> i == j -> C j -> C i\n rewriteEq {suc _} C {finI fzero' } {finI fzero' } eq x = x\n rewriteEq {suc _} C {finI (fsuc' i)} {finI (fsuc' j)} eq x = rewriteEq (\\z -> C (fsuc z)) eq x\n rewriteEq {suc _} C {finI (fsuc' _)} {finI fzero' } () _\n rewriteEq {suc _} C {finI fzero' } {finI (fsuc' _)} () _\n rewriteEq {zero} C {finI ()} {_} _ _\n\nmodule Vec where\n\n open Prelude\n open Fin\n\n infixr 15 _::_\n\n -- Vectors ----------------------------------------------------------------\n\n data Nil : Set where\n nil' : Nil\n\n data Cons (A As : Set) : Set where\n cons' : A -> As -> Cons A As\n\n mutual\n data Vec (A : Set)(n : Nat) : Set where\n vecI : Vec' A n -> Vec A n\n\n Vec' : Set -> Nat -> Set\n Vec' A zero = Nil\n Vec' A (suc n) = Cons A (Vec A n)\n\n nil : {A : Set} -> Vec A zero\n nil = vecI nil'\n\n _::_ : {A : Set}{n : Nat} -> A -> Vec A n -> Vec A (suc n)\n x :: xs = vecI (cons' x xs)\n\n vecE : {A : Set}{n : Nat} -> Vec A n -> Vec' A n\n vecE (vecI xs) = xs\n\n vec : {A : Set}(n : Nat) -> A -> Vec A n\n vec zero _ = nil\n vec (suc n) x = x :: vec n x\n\n map : {n : Nat}{A B : Set} -> (A -> B) -> Vec A n -> Vec B n\n map {zero} f (vecI nil') = nil\n map {suc n} f (vecI (cons' x xs)) = f x :: map f xs\n\n _!_ : {n : Nat}{A : Set} -> Vec A n -> Fin n -> A\n _!_ {zero } _ (finI ())\n _!_ {suc n} (vecI (cons' x _ )) (finI fzero') = x\n _!_ {suc n} (vecI (cons' _ xs)) (finI (fsuc' i)) = xs ! i\n\n tabulate : {n : Nat}{A : Set} -> (Fin n -> A) -> Vec A n\n tabulate {zero} f = nil\n tabulate {suc n} f = f fzero :: tabulate (\\x -> f (fsuc x))\n\nmodule Untyped where\n\n open Prelude\n open Fin\n open Vec\n\n Name = Nat\n\n data Expr (n : Nat) : Set where\n eVar : Fin n -> Expr n\n eApp : Expr n -> Expr n -> Expr n\n eLam : Expr (suc n) -> Expr n\n eSet : Expr n\n eEl : Expr n\n ePi : Expr n\n eCon : Name -> Expr n\n\n module ExprEq where\n\n infix 5 _==_\n\n _==_ : {n : Nat} -> Expr n -> Expr n -> Set\n eVar i == eVar j = FinEq._==_ i j\n eApp e1 e2 == eApp e3 e4 = e1 == e3 /\\ e2 == e4\n eLam e1 == eLam e2 = e1 == e2\n eSet == eSet = True\n eEl == eEl = True\n ePi == ePi = True\n eCon f == eCon g = NatEq._==_ f g\n _ == _ = False\n\n rewriteEq : {n : Nat}(C : Expr n -> Set){r s : Expr n} -> r == s -> C s -> C r\n rewriteEq C {eVar i } {eVar j } eq x = FinEq.rewriteEq (\\z -> C (eVar z)) eq x\n rewriteEq C {eLam e1 } {eLam e2 } eq x = rewriteEq (\\z -> C (eLam z)) eq x\n rewriteEq C {eSet } {eSet } eq x = x\n rewriteEq C {eEl } {eEl } eq x = x\n rewriteEq C {ePi } {ePi } eq x = x\n rewriteEq C {eCon f } {eCon g } eq x = NatEq.rewriteEq (\\z -> C (eCon z)) eq x\n rewriteEq C {eApp e1 e2} {eApp e3 e4} (andI eq13 eq24) x =\n rewriteEq (\\z -> C (eApp z e2)) eq13 (\n rewriteEq (\\z -> C (eApp e3 z)) eq24 x\n )\n rewriteEq C {eVar _} {eLam _ } () _\n rewriteEq C {eVar _} {eSet } () _\n rewriteEq C {eVar _} {eEl } () _\n rewriteEq C {eVar _} {eCon _ } () _\n rewriteEq C {eVar _} {ePi } () _\n rewriteEq C {eVar _} {eApp _ _} () _\n\n rewriteEq C {eLam _} {eVar _ } () _\n rewriteEq C {eLam _} {eSet } () _\n rewriteEq C {eLam _} {eEl } () _\n rewriteEq C {eLam _} {eCon _ } () _\n rewriteEq C {eLam _} {ePi } () _\n rewriteEq C {eLam _} {eApp _ _} () _\n\n rewriteEq C {eSet } {eLam _ } () _\n rewriteEq C {eSet } {eVar _ } () _\n rewriteEq C {eSet } {eEl } () _\n rewriteEq C {eSet } {eCon _ } () _\n rewriteEq C {eSet } {ePi } () _\n rewriteEq C {eSet } {eApp _ _} () _\n\n rewriteEq C {eEl } {eLam _ } () _\n rewriteEq C {eEl } {eSet } () _\n rewriteEq C {eEl } {eVar _ } () _\n rewriteEq C {eEl } {eCon _ } () _\n rewriteEq C {eEl } {ePi } () _\n rewriteEq C {eEl } {eApp _ _} () _\n\n rewriteEq C {eCon _} {eLam _ } () _\n rewriteEq C {eCon _} {eSet } () _\n rewriteEq C {eCon _} {eEl } () _\n rewriteEq C {eCon _} {eVar _ } () _\n rewriteEq C {eCon _} {ePi } () _\n rewriteEq C {eCon _} {eApp _ _} () _\n\n rewriteEq C {ePi } {eLam _ } () _\n rewriteEq C {ePi } {eSet } () _\n rewriteEq C {ePi } {eEl } () _\n rewriteEq C {ePi } {eCon _ } () _\n rewriteEq C {ePi } {eVar _ } () _\n rewriteEq C {ePi } {eApp _ _} () _\n\n rewriteEq C {eApp _ _} {eLam _ } () _\n rewriteEq C {eApp _ _} {eSet } () _\n rewriteEq C {eApp _ _} {eEl } () _\n rewriteEq C {eApp _ _} {eCon _ } () _\n rewriteEq C {eApp _ _} {ePi } () _\n rewriteEq C {eApp _ _} {eVar _ } () _\n\nmodule Typed where\n\n open Prelude\n open Fin\n open Vec\n\n infixl 15 _&_\n infix 13 _!!_\n infix 5 _==_\n\n -- Contexts ---------------------------------------------------------------\n data CSuc (n : Nat) : Set\n\n Context' : Nat -> Set\n Context' zero = Nil\n Context' (suc n) = CSuc n\n\n data Context (n : Nat) : Set\n data Type {n : Nat}(Γ : Context n) : Set\n\n data CSuc n where\n ext : (Γ : Context n) -> Type Γ -> Context' (suc n)\n\n data Context n where\n ctxI : Context' n -> Context n\n\n -- Types ------------------------------------------------------------------\n _&_ : {n : Nat}(Γ : Context n) -> Type Γ -> Context (suc n)\n data Term {n : Nat}(Γ : Context n)(A : Type Γ) : Set\n\n data Type {n} Γ where\n SET : Type Γ\n Pi : (A : Type Γ) -> Type (Γ & A) -> Type Γ\n El : Term Γ SET -> Type Γ\n\n\n Γ & A = ctxI (ext Γ A)\n\n -- Variables --------------------------------------------------------------\n data VarSuc {n : Nat}(Γ : Context n)(B : Type Γ)(A : Type (Γ & B)) : Set\n\n Var' : {n : Nat}(Γ : Context n) -> Type Γ -> Set\n Var' {zero} Γ A = Zero\n Var' {suc n} (ctxI (ext Γ B)) A = VarSuc Γ B A\n\n _==_ : {n : Nat}{Γ : Context n} -> Type Γ -> Type Γ -> Set\n data Ren {n m : Nat}(Γ : Context n)(Δ : Context m) : Set\n\n rename : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Ren Γ Δ -> Type Γ -> Type Δ\n upR : {n : Nat}{Γ : Context n}{A : Type Γ} -> Ren Γ (Γ & A)\n data Var {n : Nat}(Γ : Context n)(A : Type Γ) : Set\n\n data VarSuc {n} Γ B A where\n vzero_ : A == rename upR B -> Var' (Γ & B) A\n vsuc_ : (C : Type Γ) -> A == rename upR C -> Var Γ C -> Var' (Γ & B) A\n\n data Var {n} Γ A where\n varI : Var' Γ A -> Var Γ A\n\n -- Terms ------------------------------------------------------------------\n data Sub {n m : Nat}(Γ : Context n)(Δ : Context m) : Set\n subst : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Sub Γ Δ -> Type Γ -> Type Δ\n down : {n : Nat}{Γ : Context n}{A : Type Γ} -> Term Γ A -> Sub (Γ & A) Γ\n\n data Term {n} Γ A where\n var : (x : Var Γ A) -> Term Γ A\n app : {B : Type Γ}{C : Type (Γ & B)} -> Term Γ (Pi B C) -> (t : Term Γ B) ->\n A == subst (down t) C -> Term Γ A\n lam : {B : Type Γ}{C : Type (Γ & B)} -> Term (Γ & B) C -> A == Pi B C -> Term Γ A\n\n -- Context manipulation ---------------------------------------------------\n\n ∅ : Context zero\n ∅ = ctxI nil'\n\n _!!_ : {n : Nat}(Γ : Context n) -> Fin n -> Type Γ\n _!!_ {zero} _ (finI ())\n _!!_ {suc _} (ctxI (ext Γ A)) (finI fzero') = rename upR A\n _!!_ {suc _} (ctxI (ext Γ A)) (finI (fsuc' i)) = rename upR (Γ !! i)\n\n -- Renamings --------------------------------------------------------------\n data ConsRen {n m : Nat}(Γ : Context n)(A : Type Γ)(Δ : Context m) : Set\n\n Ren' : {n m : Nat} -> Context n -> Context m -> Set\n Ren' {zero} {m} (ctxI nil') Δ = Nil\n Ren' {suc n} {m} (ctxI (ext Γ A)) Δ = ConsRen Γ A Δ\n\n data ConsRen {n m} Γ A Δ where\n extRen' : (ρ : Ren Γ Δ) -> Var Δ (rename ρ A) -> Ren' (Γ & A) Δ\n\n data Ren {n m} Γ Δ where\n renI : Ren' Γ Δ -> Ren Γ Δ\n\n -- Performing renamings ---------------------------------------------------\n rename' : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Ren Γ Δ -> Type Γ -> Type Δ\n\n rename ρ SET = SET\n rename ρ A = rename' ρ A\n\n liftR : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m} ->\n (ρ : Ren Γ Δ) -> Ren (Γ & A) (Δ & rename ρ A)\n renameTerm : {n m : Nat}{Γ : Context n}{Δ : Context m}{A : Type Γ}\n (ρ : Ren Γ Δ) -> Term Γ A -> Term Δ (rename ρ A)\n\n rename' ρ SET = SET\n rename' ρ (Pi A B) = Pi (rename ρ A) (rename (liftR ρ) B)\n rename' ρ (El t) = El (renameTerm ρ t)\n\n lookupR : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m}\n (ρ : Ren Γ Δ)(x : Var Γ A) -> Var Δ (rename ρ A)\n cong : {n m : Nat}{Γ : Context n}{Δ : Context m}(f : Type Γ -> Type Δ)\n {A B : Type Γ} -> A == B -> f A == f B\n _trans_ : {n : Nat}{Γ : Context n}{A B C : Type Γ} -> A == B -> B == C -> A == C\n renameSubstCommute :\n {n m : Nat}{Γ : Context n}{Δ : Context m}{A : Type Γ}{B : Type (Γ & A)}\n {ρ : Ren Γ Δ}{t : Term Γ A} ->\n rename ρ (subst (down t) B) == subst (down (renameTerm ρ t)) (rename (liftR ρ) B)\n\n renameTerm ρ (var x) = var (lookupR ρ x)\n renameTerm {_}{_}{_}{_}{A} ρ (app{_}{C} s t eq) =\n app (renameTerm ρ s) (renameTerm ρ t)\n (cong (rename ρ) eq trans renameSubstCommute)\n renameTerm ρ (lam t eq) = lam (renameTerm (liftR ρ) t) (cong (rename ρ) eq)\n\n lookupR {zero} _ (varI ())\n lookupR {suc n} {_} {ctxI (ext Γ B)} {A} {Δ}\n (renI (extRen' ρ z)) (varI (vzero_ eq)) = {!!}\n lookupR {suc n} {_} {ctxI (ext Γ B)} {A} {Δ}\n (renI (extRen' ρ z)) (varI (vsuc_ C eq x)) = {!!}\n\n -- Building renamings -----------------------------------------------------\n\n extRen : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m}\n (ρ : Ren Γ Δ) -> Var Δ (rename ρ A) -> Ren (Γ & A) Δ\n extRen ρ x = renI (extRen' ρ x)\n\n _coR_ : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p} -> Ren Δ Θ -> Ren Γ Δ -> Ren Γ Θ\n\n liftR {_}{_}{_}{A} ρ = extRen (upR coR ρ) (varI {!!})\n\n idR : {n : Nat} {Γ : Context n} -> Ren Γ Γ\n idR = {!!}\n\n _coR_ = {!!}\n\n upR = {!!}\n\n -- Substitutions ----------------------------------------------------------\n data ConsSub {n m : Nat}(Γ : Context n)(A : Type Γ)(Δ : Context m) : Set\n\n Sub' : {n m : Nat} -> Context n -> Context m -> Set\n Sub' {zero} {m} (ctxI nil') Δ = Nil\n Sub' {suc n} {m} (ctxI (ext Γ A)) Δ = ConsSub Γ A Δ\n\n data ConsSub {n m} Γ A Δ where\n extSub' : (σ : Sub Γ Δ) -> Term Δ (subst σ A) -> Sub' (Γ & A) Δ\n\n data Sub {n m} Γ Δ where\n subI : Sub' Γ Δ -> Sub Γ Δ\n\n -- Performing substitution ------------------------------------------------\n subst' : {n m : Nat}{Γ : Context n}{Δ : Context m} -> Sub Γ Δ -> Type Γ -> Type Δ\n\n subst σ SET = SET\n subst σ A = subst' σ A\n\n liftS : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m} ->\n (σ : Sub Γ Δ) -> Sub (Γ & A) (Δ & subst σ A)\n\n substTerm : {n m : Nat}{Γ : Context n}{Δ : Context m}{A : Type Γ} ->\n (σ : Sub Γ Δ) -> Term Γ A -> Term Δ (subst σ A)\n\n subst' σ (Pi A B) = Pi (subst σ A) (subst (liftS σ) B)\n subst' σ (El t) = El (substTerm σ t)\n subst' σ SET = SET\n\n substTerm σ (var x) = {!!}\n substTerm σ (app s t eq) = {!!}\n substTerm σ (lam t eq) = {!!}\n\n -- Building substitutions -------------------------------------------------\n\n liftS {_}{_}{_}{A} σ = {!!} -- extSub (upS ∘ σ) (var fzero (substCompose upS σ A))\n -- Works with hidden args to substCompose when inlined in subst \n -- but not here. Weird.\n\n topS : {n : Nat}{Γ : Context n} -> Sub ∅ Γ\n topS = subI nil'\n\n extSub : {n m : Nat}{Γ : Context n}{A : Type Γ}{Δ : Context m}\n (σ : Sub Γ Δ) -> Term Δ (subst σ A) -> Sub (Γ & A) Δ\n extSub σ t = subI (extSub' σ t)\n\n idS : {n : Nat}{Γ : Context n} -> Sub Γ Γ\n idS {zero} {ctxI nil'} = topS\n idS {suc _} {ctxI (ext Γ A)} = {!!} -- extSub upS (var fzero refl)\n\n convert : {n : Nat}{Γ : Context n}{A B : Type Γ} -> A == B -> Term Γ B -> Term Γ A\n\n _∘_ : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p} -> Sub Δ Θ -> Sub Γ Δ -> Sub Γ Θ\n\n substCompose : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p}\n (σ : Sub Δ Θ)(δ : Sub Γ Δ)(A : Type Γ) -> \n subst (σ ∘ δ) A == subst σ (subst δ A)\n\n _∘_ {zero} {_}{_} {ctxI nil'} _ _ = topS\n _∘_ {suc _}{_}{_} {ctxI (ext Γ A)} σ (subI (extSub' δ t)) =\n extSub (σ ∘ δ) (convert (substCompose σ δ A) (substTerm σ t))\n\n upS : {n : Nat}{Γ : Context n}{A : Type Γ} -> Sub Γ (Γ & A)\n upS = {!!}\n\n substId : {n : Nat}{Γ : Context n}{A : Type Γ} -> subst idS A == A\n\n down t = extSub idS (convert substId t)\n\n -- Convertibility ---------------------------------------------------------\n\n\n A == B = {!!}\n\n refl : {n : Nat}{Γ : Context n}{A : Type Γ} -> A == A\n refl = {!!}\n\n cong f eq = {!!}\n\n ab trans bc = {!!}\n\n convert eq t = {!!}\n\n -- Properties -------------------------------------------------------------\n\n renameId : {n : Nat}{Γ : Context n}{A : Type Γ} -> rename idR A == A\n renameId = {!!}\n\n renameCompose : {n m p : Nat}{Γ : Context n}{Δ : Context m}{Θ : Context p}\n (σ : Ren Δ Θ)(δ : Ren Γ Δ)(A : Type Γ) -> \n rename (σ coR δ) A == rename σ (rename δ A)\n renameCompose σ δ A = {!!}\n\n substId = {!!}\n\n substCompose σ δ A = {!!}\n\n renameSubstCommute = {!!}\n\n\n", "meta": {"hexsha": "e7d4f5836bb5effcd768421a2386afd2f7740acb", "size": 15828, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/TT.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/TT.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/TT.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.5928143713, "max_line_length": 101, "alphanum_fraction": 0.4462977003, "num_tokens": 5842, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467675095294, "lm_q2_score": 0.7606506635289835, "lm_q1q2_score": 0.6687235720454845}} {"text": "module McK-B where\n\nopen import CS410-Prelude\nopen import CS410-Nat\nopen import CS410-Vec\n\ndata Bit : Set where O I : Bit\n\nexp2 : Nat -> Nat\nexp2 zero = 1\nexp2 (suc n) = exp2 n +N exp2 n\n\nWordNZ : Nat -> Set\ndata Word (n : Nat) : Set where\n O : Word n\n [_] : WordNZ n -> Word n\nWordNZ zero = One\nWordNZ (suc n) = (WordNZ n * Word n) + WordNZ n\n\n_!_ : {n : Nat} -> Word n -> Word n -> Word (suc n)\nO ! O = O\nO ! [ x ] = [ inr x ]\n[ x ] ! y = [ inl (x , y) ]\n\n_!+_ : {n : Nat} -> Word n -> WordNZ n -> WordNZ (suc n)\nO !+ y = inr y\n[ x ] !+ y = inl (x , [ y ])\n\niNZ : (n : Nat) -> WordNZ n\niNZ zero = <>\niNZ (suc n) = inr (iNZ n)\ni : {n : Nat} -> Word n\ni {n} = [ iNZ n ] where\n\ndata WViewable : {n : Nat} -> Word n -> Set where\n O0 : WViewable {zero} O\n I0 : WViewable {zero} i\n _!!_ : {n : Nat}(x y : Word n) -> WViewable (x ! y)\n\nwView : {n : Nat}(x : Word n) -> WViewable x\nwView {zero} O = O0\nwView {zero} [ <> ] = I0\nwView {suc n} O = O !! O\nwView {suc n} [ inl (x , y) ] = [ x ] !! y\nwView {suc n} [ inr y ] = O !! [ y ]\n\nexpand : {n : Nat} -> Word n -> Vec Bit (exp2 n)\nexpand x with wView x\nexpand .O | O0 = O :: []\nexpand .([ <> ]) | I0 = I :: []\nexpand .(x ! y) | x !! y = expand x +V expand y\n\ninc : {n : Nat}(x : Word n) -> One + WordNZ n\ninc x with wView x\ninc .O | O0 = inr (iNZ zero)\ninc .([ <> ]) | I0 = inl <>\ninc .(x ! y) | x !! y with inc y\ninc .(x ! y) | x !! y | inr y' = inr (x !+ y')\ninc .(x ! y) | x !! y | inl <> with inc x\ninc .(x ! y) | x !! y | inl <> | inr x' = inr (inl (x' , O))\ninc .(x ! y) | x !! y | inl <> | inl <> = inl <>\n\nincm : {n : Nat}(x : Word n) -> Word n\nincm x with inc x\nincm x | inl <> = O\nincm x | inr x' = [ x' ]\n\nfiveW2 : Word 2\nfiveW2 = incm (incm (incm (incm (incm O))))\n\nadc : {n : Nat} -> Word n -> Word n -> Bit -> Bit * Word n\nadc x y c with wView x | wView y\nadc .O .O O | O0 | O0 = O , O\nadc .O .O I | O0 | O0 = O , i\nadc .O .i O | O0 | I0 = O , i\nadc .O .i I | O0 | I0 = I , O\nadc .i .O O | I0 | O0 = O , i\nadc .i .O I | I0 | O0 = I , O\nadc .i .i O | I0 | I0 = I , O\nadc .i .i I | I0 | I0 = I , i\nadc .(xh ! xl) .(yh ! yl) c | xh !! xl | yh !! yl with adc xl yl c\n... | cl , zl with adc xh yh cl\n... | ch , zh = ch , zh ! zl\n", "meta": {"hexsha": "af4bfbe9cca463b77e37b3f19ed7e303650305db", "size": 2257, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "data/github.com/pigworker/CS410-15/043477e6143af6a78b677bb528c46621da11df00/McK-B.agda", "max_stars_repo_name": "ajnavarro/language-dataset", "max_stars_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2018-08-07T11:54:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-11T09:48:45.000Z", "max_issues_repo_path": "data/github.com/pigworker/CS410-15/043477e6143af6a78b677bb528c46621da11df00/McK-B.agda", "max_issues_repo_name": "ajnavarro/language-dataset", "max_issues_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 91, "max_issues_repo_issues_event_min_datetime": "2019-11-11T15:41:26.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-21T04:17:18.000Z", "max_forks_repo_path": "data/github.com/pigworker/CS410-15/043477e6143af6a78b677bb528c46621da11df00/McK-B.agda", "max_forks_repo_name": "ajnavarro/language-dataset", "max_forks_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-11-13T12:44:41.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-06T19:34:26.000Z", "avg_line_length": 26.869047619, "max_line_length": 66, "alphanum_fraction": 0.47275144, "num_tokens": 1026, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467706759584, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.6687235601436815}} {"text": "\n{- Type class for monads. -}\nmodule CategoryTheory.Monad where\n\nopen import CategoryTheory.Categories\nopen import CategoryTheory.Functor\nopen import CategoryTheory.NatTrans\n\n-- A monad on a category\nrecord Monad {n} (ℂ : Category n) : Set (lsuc n) where\n open Category ℂ\n field\n -- Underlying endofunctor\n T : Endofunctor ℂ\n open Functor T\n\n field\n -- || Definitions\n -- Unit / return\n η : I ⟹ T\n -- Multiplication / join\n μ : (T ²) ⟹ T\n\n module η = _⟹_ η\n module μ = _⟹_ μ\n field\n -- || Laws\n -- Unit on both sides is cancelled by multiplication (unit)\n η-unit1 : ∀ {A : obj} -> (μ.at A) ∘ (η.at (omap A)) ≈ id\n η-unit2 : ∀ {A : obj} -> (μ.at A) ∘ (fmap (η.at A)) ≈ id\n\n -- Multiplication can be performed on both sides (associativity)\n μ-assoc : ∀ {A : obj} -> (μ.at A) ∘ (μ.at (omap A))\n ≈ (μ.at A) ∘ (fmap (μ.at A))\n", "meta": {"hexsha": "889ea43334a1d5a7cdf1eefcb19eae3f56186937", "size": 963, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/CategoryTheory/Monad.agda", "max_stars_repo_name": "DimaSamoz/temporal-type-systems", "max_stars_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-05-31T20:37:04.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-04T09:33:48.000Z", "max_issues_repo_path": "src/CategoryTheory/Monad.agda", "max_issues_repo_name": "DimaSamoz/temporal-type-systems", "max_issues_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/CategoryTheory/Monad.agda", "max_forks_repo_name": "DimaSamoz/temporal-type-systems", "max_forks_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.5142857143, "max_line_length": 72, "alphanum_fraction": 0.5410176532, "num_tokens": 306, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9518632261523028, "lm_q2_score": 0.7025300511670689, "lm_q1q2_score": 0.6687125209728285}} {"text": "{-# OPTIONS --cubical --safe #-}\n\nopen import Algebra\n\nmodule Algebra.Construct.OrderedMonoid {ℓ} (monoid : Monoid ℓ) where\n\nopen import Prelude\nopen import Relation.Binary\nopen import Path.Reasoning\n\nopen Monoid monoid\n\ninfix 4 _≤_ _≥_ _<_ _>_\n_≤_ : 𝑆 → 𝑆 → Type ℓ\nx ≤ y = ∃ z × (y ≡ x ∙ z)\n\n_<_ : 𝑆 → 𝑆 → Type ℓ\nx < y = ∃ z × (z ≢ ε) × (y ≡ x ∙ z)\n\n_>_ = flip _<_\n_≥_ = flip _≤_\n\n≤-refl : Reflexive _≤_\n≤-refl = ε , sym (∙ε _)\n\n≤-trans : Transitive _≤_\n≤-trans {x} {y} {z} (k₁ , y≡x∙k₁) (k₂ , z≡y∙k₂) = k₁ ∙ k₂ ,_ $\n z ≡⟨ z≡y∙k₂ ⟩\n y ∙ k₂ ≡⟨ cong (_∙ k₂) y≡x∙k₁ ⟩\n (x ∙ k₁) ∙ k₂ ≡⟨ assoc x k₁ k₂ ⟩\n x ∙ (k₁ ∙ k₂) ∎\n\nε≤x : ∀ x → ε ≤ x\nε≤x x = x , sym (ε∙ x)\n\n∙-cong : ∀ x {y z} → y ≤ z → x ∙ y ≤ x ∙ z\n∙-cong x (k , z≡y∙k) = k , cong (x ∙_) z≡y∙k ; sym (assoc x _ k)\n\n-- Trichotomous : Type _\n-- Trichotomous = (x y : 𝑆) → Tri _<_ _≡_ _>_ x y\n", "meta": {"hexsha": "086b3d2deaec1087a76e4e52a6f1461ea7886468", "size": 848, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Algebra/Construct/OrderedMonoid.agda", "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_issues_repo_path": "Algebra/Construct/OrderedMonoid.agda", "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Algebra/Construct/OrderedMonoid.agda", "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "avg_line_length": 20.6829268293, "max_line_length": 68, "alphanum_fraction": 0.5153301887, "num_tokens": 470, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278664544912, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.6686988750819661}} {"text": "{-# OPTIONS --cubical --no-import-sorts #-}\n\nopen import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc)\nopen import Function.Base using (_∋_; _$_)\n\nopen import MorePropAlgebra.Bundles\nimport Cubical.Algebra.Ring as Std\n\nmodule MorePropAlgebra.Properties.Ring {ℓ} (assumptions : Ring {ℓ}) where\nopen Ring assumptions renaming (Carrier to R)\n\nimport MorePropAlgebra.Properties.AbGroup\nmodule AbGroup'Properties = MorePropAlgebra.Properties.AbGroup (record { Ring assumptions renaming (+-AbGroup to is-AbGroup) })\nmodule AbGroup' = AbGroup (record { Ring assumptions renaming (+-AbGroup to is-AbGroup) })\n( AbGroup') = AbGroup ∋ (record { Ring assumptions renaming (+-AbGroup to is-AbGroup) })\n\nimport MorePropAlgebra.Properties.Monoid\nmodule Monoid'Properties = MorePropAlgebra.Properties.Monoid (record { Ring assumptions renaming (·-Monoid to is-Monoid) })\nmodule Monoid' = Monoid (record { Ring assumptions renaming (·-Monoid to is-Monoid) })\n( Monoid') = Monoid ∋ (record { Ring assumptions renaming (·-Monoid to is-Monoid) })\n\nstdIsRing : Std.IsRing 0r 1r _+_ _·_ (-_)\nstdIsRing .Std.IsRing.+-isAbGroup = AbGroup'Properties.stdIsAbGroup\nstdIsRing .Std.IsRing.·-isMonoid = Monoid'Properties.stdIsMonoid\nstdIsRing .Std.IsRing.dist = is-dist\n\nstdRing : Std.Ring {ℓ}\nstdRing = record { Ring assumptions ; isRing = stdIsRing }\n\nmodule RingTheory' = Std.Theory stdRing\n\n{-\n\n\n\n\n-- NOTE: a few facts about rings that might be collected from elsewhere\na+b-b≡a : ∀ a b → a ≡ (a + b) - b\na+b-b≡a a b = let P = sym (fst (+-inv b))\n Q = sym (fst (+-identity a))\n R = transport (λ i → a ≡ a + P i) Q\n S = transport (λ i → a ≡ (+-assoc a b (- b)) i ) R\n in S\n\n-- NOTE: this is called `simplL` and `simplL` in `Cubical.Structures.Group.Properties.GroupLemmas`\n+-preserves-≡ : ∀{a b} → ∀ c → a ≡ b → a + c ≡ b + c\n+-preserves-≡ c a≡b i = a≡b i + c\n\n+-preserves-≡-l : ∀{a b} → ∀ c → a ≡ b → c + a ≡ c + b\n+-preserves-≡-l c a≡b i = c + a≡b i\n\na+b≡0→a≡-b : ∀{a b} → a + b ≡ 0r → a ≡ - b\na+b≡0→a≡-b {a} {b} a+b≡0 = transport\n (λ i →\n let RHS = snd (+-identity (- b))\n LHS₁ : a + (b + - b) ≡ a + 0r\n LHS₁ = +-preserves-≡-l a (fst (+-inv b))\n LHS₂ : (a + b) - b ≡ a\n LHS₂ = transport (λ j → (+-assoc a b (- b)) j ≡ fst (+-identity a) j) LHS₁\n in LHS₂ i ≡ RHS i\n ) (+-preserves-≡ (- b) a+b≡0)\n\n-- NOTE: there is already\n-- -commutesWithRight-· : (x y : R) → x · (- y) ≡ - (x · y)\n\na·-b≡-a·b : ∀ a b → a · (- b) ≡ - (a · b)\na·-b≡-a·b a b =\n let P : a · 0r ≡ 0r\n P = 0-rightNullifies a\n Q : a · (- b + b) ≡ 0r\n Q = transport (λ i → a · snd (+-inv b) (~ i) ≡ 0r) P\n R : a · (- b) + a · b ≡ 0r\n R = transport (λ i → ·-rdist-+ a (- b) b i ≡ 0r) Q\n in a+b≡0→a≡-b R\n\na·b-a·c≡a·[b-c] : ∀ a b c → a · b - (a · c) ≡ a · (b - c)\na·b-a·c≡a·[b-c] a b c =\n let P : a · b + a · (- c) ≡ a · (b + - c)\n P = sym (·-rdist-+ a b (- c))\n Q : a · b - a · c ≡ a · (b + - c)\n Q = transport (λ i → a · b + a·-b≡-a·b a c i ≡ a · (b + - c) ) P\n in Q\n\n-}\n", "meta": {"hexsha": "ad45aa4dafe31eab50930db6bf478e19fa72b542", "size": 3261, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/MorePropAlgebra/Properties/Ring.agda", "max_stars_repo_name": "mchristianl/synthetic-reals", "max_stars_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-07-31T18:15:26.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-19T12:15:21.000Z", "max_issues_repo_path": "agda/MorePropAlgebra/Properties/Ring.agda", "max_issues_repo_name": "mchristianl/synthetic-reals", "max_issues_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/MorePropAlgebra/Properties/Ring.agda", "max_forks_repo_name": "mchristianl/synthetic-reals", "max_forks_repo_head_hexsha": "10206b5c3eaef99ece5d18bf703c9e8b2371bde4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.3647058824, "max_line_length": 129, "alphanum_fraction": 0.5348052745, "num_tokens": 1239, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278664544911, "lm_q2_score": 0.7577943767446201, "lm_q1q2_score": 0.668698875081966}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Endomorphisms on a Setoid\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Relation.Binary\n\nmodule Function.Endomorphism.Setoid {c e} (S : Setoid c e) where\n\nopen import Agda.Builtin.Equality\n\nopen import Algebra\nopen import Algebra.Structures\nopen import Algebra.Morphism; open Definitions\nopen import Function.Equality\nopen import Data.Nat.Base using (ℕ; _+_); open ℕ\nopen import Data.Nat.Properties\nopen import Data.Product\n\nimport Relation.Binary.Indexed.Heterogeneous.Construct.Trivial as Trivial\n\nprivate\n module E = Setoid (setoid S (Trivial.indexedSetoid S))\n open E hiding (refl)\n\n------------------------------------------------------------------------\n-- Basic type and functions\n\nEndo : Set _\nEndo = S ⟶ S\n\n_^_ : Endo → ℕ → Endo\nf ^ zero = id\nf ^ suc n = f ∘ (f ^ n)\n\n^-cong₂ : ∀ f → (f ^_) Preserves _≡_ ⟶ _≈_\n^-cong₂ f {n} refl = cong (f ^ n)\n\n^-homo : ∀ f → Homomorphic₂ ℕ Endo _≈_ (f ^_) _+_ _∘_\n^-homo f zero n x≈y = cong (f ^ n) x≈y\n^-homo f (suc m) n x≈y = cong f (^-homo f m n x≈y)\n\n------------------------------------------------------------------------\n-- Structures\n\n∘-isMagma : IsMagma _≈_ _∘_\n∘-isMagma = record\n { isEquivalence = isEquivalence\n ; ∙-cong = λ g f x → g (f x)\n }\n\n∘-magma : Magma _ _\n∘-magma = record { isMagma = ∘-isMagma }\n\n∘-isSemigroup : IsSemigroup _≈_ _∘_\n∘-isSemigroup = record\n { isMagma = ∘-isMagma\n ; assoc = λ h g f x≈y → cong h (cong g (cong f x≈y))\n }\n\n∘-semigroup : Semigroup _ _\n∘-semigroup = record { isSemigroup = ∘-isSemigroup }\n\n∘-id-isMonoid : IsMonoid _≈_ _∘_ id\n∘-id-isMonoid = record\n { isSemigroup = ∘-isSemigroup\n ; identity = cong , cong\n }\n\n∘-id-monoid : Monoid _ _\n∘-id-monoid = record { isMonoid = ∘-id-isMonoid }\n\n------------------------------------------------------------------------\n-- Homomorphism\n\n^-isSemigroupMorphism : ∀ f → IsSemigroupMorphism +-semigroup ∘-semigroup (f ^_)\n^-isSemigroupMorphism f = record\n { ⟦⟧-cong = ^-cong₂ f\n ; ∙-homo = ^-homo f\n }\n\n^-isMonoidMorphism : ∀ f → IsMonoidMorphism +-0-monoid ∘-id-monoid (f ^_)\n^-isMonoidMorphism f = record\n { sm-homo = ^-isSemigroupMorphism f\n ; ε-homo = λ x≈y → x≈y\n }\n", "meta": {"hexsha": "9897d8b32b437556110555039176084ab13a6a80", "size": 2321, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Function/Endomorphism/Setoid.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Function/Endomorphism/Setoid.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Function/Endomorphism/Setoid.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 25.7888888889, "max_line_length": 80, "alphanum_fraction": 0.5458853942, "num_tokens": 766, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278633625322, "lm_q2_score": 0.7577943658046609, "lm_q1q2_score": 0.668698863085172}} {"text": "module Cats.Category.Constructions.Unique where\n\nopen import Data.Unit using (⊤)\nopen import Level\n\nopen import Cats.Category.Base\nopen import Cats.Util.Conv\n\n\nmodule Build {lo la l≈} (Cat : Category lo la l≈) where\n\n open Category Cat\n\n\n IsUniqueSuchThat : ∀ {lp A B} → (A ⇒ B → Set lp) → A ⇒ B → Set (la ⊔ l≈ ⊔ lp)\n IsUniqueSuchThat P f = ∀ {g} → P g → f ≈ g\n\n\n IsUnique : ∀ {A B} → A ⇒ B → Set (la ⊔ l≈)\n IsUnique {A} {B} = IsUniqueSuchThat {A = A} {B} (λ _ → ⊤)\n\n\n IsUniqueSuchThat→≈ : ∀ {lp A B} {P : A ⇒ B → Set lp} {f}\n → IsUniqueSuchThat P f\n → ∀ {g h}\n → P g\n → P h\n → g ≈ h\n IsUniqueSuchThat→≈ unique Pg Ph = ≈.trans (≈.sym (unique Pg)) (unique Ph)\n\n\n record ∃!′ {lp A B} (P : A ⇒ B → Set lp) : Set (la ⊔ l≈ ⊔ lp) where\n constructor ∃!-intro\n field\n arr : A ⇒ B\n prop : P arr\n unique : IsUniqueSuchThat P arr\n\n\n instance\n HasArrow-∃! : ∀ {lp A B} {P : A ⇒ B → Set lp}\n → HasArrow (∃!′ P) lo la l≈\n HasArrow-∃! = record { Cat = Cat ; _⃗ = ∃!′.arr }\n\n\n syntax ∃!′ (λ f → P) = ∃![ f ] P\n\n\n ∃!″ : ∀ {lp A B} (P : A ⇒ B → Set lp) → Set (la ⊔ l≈ ⊔ lp)\n ∃!″ = ∃!′\n\n syntax ∃!″ {A = A} {B} (λ f → P) = ∃![ f ∈ A ⇒ B ] P\n\n\n ∃! : (A B : Obj) → Set (la ⊔ l≈)\n ∃! A B = ∃![ f ∈ A ⇒ B ] ⊤\n\n\n ∃!→≈ : ∀ {lp A B} {P : A ⇒ B → Set lp}\n → ∃!′ P\n → ∀ {g h}\n → P g\n → P h\n → g ≈ h\n ∃!→≈ (∃!-intro _ _ unique) = IsUniqueSuchThat→≈ unique\n", "meta": {"hexsha": "9f2d645257c7a64a4bdff21cce87df4da9557cf0", "size": 1406, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cats/Category/Constructions/Unique.agda", "max_stars_repo_name": "alessio-b-zak/cats", "max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cats/Category/Constructions/Unique.agda", "max_issues_repo_name": "alessio-b-zak/cats", "max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cats/Category/Constructions/Unique.agda", "max_forks_repo_name": "alessio-b-zak/cats", "max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.303030303, "max_line_length": 79, "alphanum_fraction": 0.4765291607, "num_tokens": 620, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757870046160257, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6686491583561837}} {"text": "\nmodule Prolegomenon where\n\nopen import Agda.Primitive\nopen import Relation.Binary\nopen import Algebra\nopen import Category.Applicative.Predicate\n\nopen import Algebra\nopen import Algebra.Structures\nopen import Category.Monad.Indexed\nopen import Algebra.FunctionProperties.Core\nopen import Function\n\nPowerRightIdentity : ∀ {a ℓ} {A : Set a} → Rel A ℓ → ∀ {b} {B : Set b} → B → (B → A → A) → Set _\nPowerRightIdentity _≈_ e _◃_ = ∀ x → (e ◃ x) ≈ x\n\nPowerAssociative : ∀ {a b ℓ} {A : Set a} {B : Set b} → (A → A → Set ℓ) → (B → A → A) → (B → B → B) → Set _\nPowerAssociative _≈_ _◃_ _∙_ = ∀ x a b → ((b ∙ a) ◃ x) ≈ (b ◃ (a ◃ x))\n\n_over_ : ∀ {f} {F : Set f} {g} → (F → F → Set g) → ∀ {i} {I : Set i} {a} {A : Set a} → (A → I → F) → A → A → Set (i ⊔ g)\n_*_ over f = λ x y → ∀ i → f x i * f y i\n\nrecord IsMonoidTransformer {s ℓˢ} {S : Set s} (≈ˢ : Rel S ℓˢ) {m ℓᵐ} {M : Set m} (≈ᵐ : Rel M ℓᵐ) (∙ : Op₂ M) (ε : M) (◃ : M → S → S) : Set (s ⊔ ℓˢ ⊔ m ⊔ ℓᵐ) where\n field\n ◃-identity : PowerRightIdentity ≈ˢ ε ◃\n ≈ˢ-over-◃-⟶-≈ᵐ : ≈ˢ over ◃ ⇒ ≈ᵐ\n ≈ᵐ-to-≈ˢ-over-◃ : ≈ᵐ ⇒ ≈ˢ over ◃\n ◃-extracts-∙ : PowerAssociative ≈ˢ ◃ ∙\n\nrecord MonoidTransformer ℓˢ ℓ⁼ˢ ℓᵐ ℓ⁼ᵐ\n : Set (lsuc (ℓˢ ⊔ ℓ⁼ˢ ⊔ ℓᵐ ⊔ ℓ⁼ᵐ)) where\n field\n base : Setoid ℓˢ ℓ⁼ˢ\n exponent : Monoid ℓᵐ ℓ⁼ᵐ\n\n module B = Setoid base\n module E = Monoid exponent\n{-\n open Setoid base public renaming\n (Carrier to Carrierˢ\n ;_≈_ to _≈ˢ_\n ;reflexive to reflexiveˢ\n ;refl to reflˢ\n ;trans to transˢ\n ;sym to symˢ\n )\n\n open Monoid exponent public renaming\n (Carrier to Carrierᵐ\n ;_≈_ to _≈ᵐ_\n ;reflexive to reflexiveᵐ\n ;_∙_ to _∙_\n ;ε to ε\n ;refl to reflᵐ\n ;trans to transᵐ\n ;sym to symᵐ)\n-}\n infixl 6 _◃_\n field\n _◃_ : E.Carrier → B.Carrier → B.Carrier\n isMonoidTransformer : IsMonoidTransformer B._≈_ E._≈_ E._∙_ E.ε _◃_\n\n open IsMonoidTransformer isMonoidTransformer public\n", "meta": {"hexsha": "e2247d7e84979beb1938f7b2546ec6325e41d7db", "size": 1884, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-1/Prolegomenon.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-1/Prolegomenon.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-1/Prolegomenon.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.9846153846, "max_line_length": 162, "alphanum_fraction": 0.5912951168, "num_tokens": 872, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942171172603, "lm_q2_score": 0.7401743620390162, "lm_q1q2_score": 0.6685952208883007}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Object.Product.Indexed.Properties {o ℓ e} (C : Category o ℓ e) where\n\nopen import Level\n\nopen import Categories.Category.Discrete\nopen import Categories.Category.Complete\nopen import Categories.Category.Construction.Cones\nopen import Categories.Category.Lift\nopen import Categories.Object.Product.Indexed C\nopen import Categories.Diagram.Limit\nopen import Categories.Functor\n\nimport Relation.Binary.PropositionalEquality as ≡\n\nprivate\n variable\n o′ ℓ′ e′ : Level\n open Category C\n\nmodule _ {i} (Com : Complete (i ⊔ o′) (i ⊔ ℓ′) (i ⊔ e′) C) where\n\n module _ {I : Set i} (P : I → Obj) where\n private\n Z = liftC o′ ℓ′ e′ (Discrete I)\n F = lift-func C P ∘F unliftF o′ ℓ′ e′ (Discrete I)\n module L = Limit (Com F)\n\n K : ∀ {Y} → (∀ i → Y ⇒ P i) → Cone F\n K f = record\n { apex = record\n { ψ = λ i → f (lower i)\n ; commute = λ { (lift ≡.refl) → identityˡ }\n }\n }\n\n Complete⇒IndexedProductOf : IndexedProductOf P\n Complete⇒IndexedProductOf = record\n { X = L.apex\n ; π = λ i → L.proj (lift i)\n ; ⟨_⟩ = λ f → L.rep (K f)\n ; commute = λ f _ → Cone⇒.commute (L.rep-cone (K f))\n ; unique = λ f g eq → L.terminal.!-unique {A = K g} record\n { arr = f\n ; commute = eq _\n }\n }\n", "meta": {"hexsha": "96ed0ce81508722ddfc28976bc011f8f23459620", "size": 1405, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Object/Product/Indexed/Properties.agda", "max_stars_repo_name": "bblfish/agda-categories", "max_stars_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "src/Categories/Object/Product/Indexed/Properties.agda", "max_issues_repo_name": "bblfish/agda-categories", "max_issues_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Object/Product/Indexed/Properties.agda", "max_forks_repo_name": "bblfish/agda-categories", "max_forks_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 27.5490196078, "max_line_length": 86, "alphanum_fraction": 0.5864768683, "num_tokens": 433, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942067038784, "lm_q2_score": 0.7401743620390163, "lm_q1q2_score": 0.6685952131805826}} {"text": "------------------------------------------------------------------------\n-- Properties of homogeneous binary relations\n------------------------------------------------------------------------\n\n-- This file contains some core definitions which are reexported by\n-- Relation.Binary or Relation.Binary.PropositionalEquality.\n\nmodule Relation.Binary.Core where\n\nopen import Data.Product\nopen import Data.Sum\nopen import Data.Function\nopen import Relation.Nullary.Core\n\n------------------------------------------------------------------------\n-- Homogeneous binary relations\n\nRel : Set → Set₁\nRel a = a → a → Set\n\n------------------------------------------------------------------------\n-- Simple properties of binary relations\n\ninfixr 4 _⇒_ _=[_]⇒_\n\n-- Implication/containment. Could also be written ⊆.\n\n_⇒_ : ∀ {a} → Rel a → Rel a → Set\nP ⇒ Q = ∀ {i j} → P i j → Q i j\n\n-- Generalised implication. If P ≡ Q it can be read as \"f preserves\n-- P\".\n\n_=[_]⇒_ : ∀ {a b} → Rel a → (a → b) → Rel b → Set\nP =[ f ]⇒ Q = P ⇒ (Q on₁ f)\n\n-- A synonym, along with a binary variant.\n\n_Preserves_⟶_ : ∀ {a₁ a₂} → (a₁ → a₂) → Rel a₁ → Rel a₂ → Set\nf Preserves P ⟶ Q = P =[ f ]⇒ Q\n\n_Preserves₂_⟶_⟶_ : ∀ {a₁ a₂ a₃} →\n (a₁ → a₂ → a₃) → Rel a₁ → Rel a₂ → Rel a₃ → Set\n_+_ Preserves₂ P ⟶ Q ⟶ R =\n ∀ {x y u v} → P x y → Q u v → R (x + u) (y + v)\n\n-- Reflexivity of _∼_ can be expressed as _≈_ ⇒ _∼_, for some\n-- underlying equality _≈_. However, the following variant is often\n-- easier to use.\n\nReflexive : {a : Set} → (_∼_ : Rel a) → Set\nReflexive _∼_ = ∀ {x} → x ∼ x\n\n-- Irreflexivity is defined using an underlying equality.\n\nIrreflexive : {a : Set} → (_≈_ _<_ : Rel a) → Set\nIrreflexive _≈_ _<_ = ∀ {x y} → x ≈ y → ¬ (x < y)\n\n-- Generalised symmetry.\n\nSym : ∀ {a} → Rel a → Rel a → Set\nSym P Q = P ⇒ flip₁ Q\n\nSymmetric : {a : Set} → Rel a → Set\nSymmetric _∼_ = Sym _∼_ _∼_\n\n-- Generalised transitivity.\n\nTrans : ∀ {a} → Rel a → Rel a → Rel a → Set\nTrans P Q R = ∀ {i j k} → P i j → Q j k → R i k\n\nTransitive : {a : Set} → Rel a → Set\nTransitive _∼_ = Trans _∼_ _∼_ _∼_\n\nAntisymmetric : {a : Set} → (_≈_ _≤_ : Rel a) → Set\nAntisymmetric _≈_ _≤_ = ∀ {x y} → x ≤ y → y ≤ x → x ≈ y\n\nAsymmetric : {a : Set} → (_<_ : Rel a) → Set\nAsymmetric _<_ = ∀ {x y} → x < y → ¬ (y < x)\n\n_Respects_ : {a : Set} → (a → Set) → Rel a → Set\nP Respects _∼_ = ∀ {x y} → x ∼ y → P x → P y\n\n_Respects₂_ : {a : Set} → Rel a → Rel a → Set\nP Respects₂ _∼_ =\n (∀ {x} → P x Respects _∼_) ×\n (∀ {y} → flip₁ P y Respects _∼_)\n\nSubstitutive : {a : Set} → Rel a → Set₁\nSubstitutive _∼_ = ∀ P → P Respects _∼_\n\nCongruential : ({a : Set} → Rel a) → Set₁\nCongruential ∼ = ∀ {a b} → (f : a → b) → f Preserves ∼ ⟶ ∼\n\nCongruential₂ : ({a : Set} → Rel a) → Set₁\nCongruential₂ ∼ =\n ∀ {a b c} → (f : a → b → c) → f Preserves₂ ∼ ⟶ ∼ ⟶ ∼\n\nDecidable : {a : Set} → Rel a → Set\nDecidable _∼_ = ∀ x y → Dec (x ∼ y)\n\nTotal : {a : Set} → Rel a → Set\nTotal _∼_ = ∀ x y → (x ∼ y) ⊎ (y ∼ x)\n\ndata Tri (A B C : Set) : Set where\n tri< : ( a : A) (¬b : ¬ B) (¬c : ¬ C) → Tri A B C\n tri≈ : (¬a : ¬ A) ( b : B) (¬c : ¬ C) → Tri A B C\n tri> : (¬a : ¬ A) (¬b : ¬ B) ( c : C) → Tri A B C\n\nTrichotomous : {a : Set} → Rel a → Rel a → Set\nTrichotomous _≈_ _<_ = ∀ x y → Tri (x < y) (x ≈ y) (x > y)\n where _>_ = flip₁ _<_\n\nrecord NonEmpty {I : Set} (T : Rel I) : Set where\n field\n i : I\n j : I\n proof : T i j\n\nnonEmpty : ∀ {I} {T : Rel I} {i j} → T i j → NonEmpty T\nnonEmpty p = record { i = _; j = _; proof = p }\n\n------------------------------------------------------------------------\n-- Propositional equality\n\n-- This dummy module is used to avoid shadowing of the field named\n-- refl defined in IsEquivalence below. The module is opened publicly\n-- at the end of this file.\n\nprivate\n module Dummy where\n\n infix 4 _≡_ _≢_\n\n data _≡_ {a : Set} (x : a) : a → Set where\n refl : x ≡ x\n\n {-# BUILTIN EQUALITY _≡_ #-}\n {-# BUILTIN REFL refl #-}\n\n -- Nonequality.\n\n _≢_ : {a : Set} → a → a → Set\n x ≢ y = ¬ x ≡ y\n\n------------------------------------------------------------------------\n-- Equivalence relations\n\n-- The preorders of this library are defined in terms of an underlying\n-- equivalence relation, and hence equivalence relations are not\n-- defined in terms of preorders.\n\nrecord IsEquivalence {a : Set} (_≈_ : Rel a) : Set where\n field\n refl : Reflexive _≈_\n sym : Symmetric _≈_\n trans : Transitive _≈_\n\n reflexive : Dummy._≡_ ⇒ _≈_\n reflexive Dummy.refl = refl\n\nopen Dummy public\n", "meta": {"hexsha": "14079419f605046cefb0f8b7264c84130b3f04f2", "size": 4484, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Relation/Binary/Core.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Relation/Binary/Core.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Relation/Binary/Core.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 27.509202454, "max_line_length": 72, "alphanum_fraction": 0.5133809099, "num_tokens": 1609, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8376199714402813, "lm_q2_score": 0.798186768138228, "lm_q1q2_score": 0.6685771779319529}} {"text": "open import Agda.Builtin.List\n\nmap : ∀ {a b} {A : Set a} {B : Set b} → (A → B) → List A → List B\nmap f [] = []\nmap f (x ∷ xs) = f x ∷ map f xs\n\nfoldr : ∀ {a b} {A : Set a} {B : Set b} → (A → B → B) → B → List A → B\nfoldr c n [] = n\nfoldr c n (x ∷ xs) = c x (foldr c n xs)\n\ndata Rose (A : Set) : Set where\n leaf : (a : A) → Rose A\n node : (rs : List (Rose A)) → Rose A\n\nrecord IsSeq (A S : Set) : Set where\n field\n nil : S\n sg : (a : A) → S\n _∙_ : (s t : S) → S\n\n concat : (ss : List S) → S\n concat = foldr _∙_ nil\n\nopen IsSeq {{...}}\n\n{-# TERMINATING #-}\nflatten : ∀{A S} {{_ : IsSeq A S}} → Rose A → S\nflatten (leaf a) = sg a\nflatten (node rs) = concat (map flatten rs)\n", "meta": {"hexsha": "7ba773f267d1699b339075e94bf242692164809a", "size": 698, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue3175.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue3175.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue3175.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 23.2666666667, "max_line_length": 70, "alphanum_fraction": 0.4885386819, "num_tokens": 289, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314828740729, "lm_q2_score": 0.7549149978955811, "lm_q1q2_score": 0.6685764890301411}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Lemmas\nopen import Groups.Definition\nopen import Groups.Subgroups.Definition\nopen import Setoids.Setoids\nopen import Sets.EquivalenceRelations\nopen import Rings.Definition\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Rings.Ideals.Definition {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) where\n\nopen Ring R\nopen Setoid S\nopen Equivalence eq\nopen Group additiveGroup\n\nopen import Rings.Lemmas R\nopen import Rings.Divisible.Definition R\n\nrecord Ideal {c : _} (pred : A → Set c) : Set (a ⊔ b ⊔ c) where\n field\n isSubgroup : Subgroup additiveGroup pred\n accumulatesTimes : {x : A} → {y : A} → pred x → pred (x * y)\n closedUnderPlus = Subgroup.closedUnderPlus isSubgroup\n closedUnderInverse = Subgroup.closedUnderInverse isSubgroup\n containsIdentity = Subgroup.containsIdentity isSubgroup\n isSubset = Subgroup.isSubset isSubgroup\n predicate = pred\n\ngeneratedIdealPred : A → A → Set (a ⊔ b)\ngeneratedIdealPred a b = a ∣ b\n\ngeneratedIdeal : (a : A) → Ideal (generatedIdealPred a)\nSubgroup.isSubset (Ideal.isSubgroup (generatedIdeal a)) {x} {y} x=y (c , prC) = c , transitive prC x=y\nSubgroup.closedUnderPlus (Ideal.isSubgroup (generatedIdeal a)) {g} {h} (c , prC) (d , prD) = (c + d) , transitive *DistributesOver+ (+WellDefined prC prD)\nSubgroup.containsIdentity (Ideal.isSubgroup (generatedIdeal a)) = 0G , timesZero\nSubgroup.closedUnderInverse (Ideal.isSubgroup (generatedIdeal a)) {g} (c , prC) = inverse c , transitive ringMinusExtracts (inverseWellDefined additiveGroup prC)\nIdeal.accumulatesTimes (generatedIdeal a) {x} {y} (c , prC) = (c * y) , transitive *Associative (*WellDefined prC reflexive)\n", "meta": {"hexsha": "6db2faade03ed21dbbd56c45b19cd0466a8159ea", "size": 1774, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/Ideals/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/Ideals/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/Ideals/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 42.2380952381, "max_line_length": 161, "alphanum_fraction": 0.7322435175, "num_tokens": 541, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314798554444, "lm_q2_score": 0.7549149978955811, "lm_q1q2_score": 0.6685764867513333}} {"text": "\nmodule Warshall\n (X : Set)\n ((≤) : X -> X -> Prop)\n -- and axioms...\n where\n\nid : {A:Set} -> A -> A\nid x = x\n\n(∘) : {A B C:Set} -> (B -> C) -> (A -> B) -> A -> C\nf ∘ g = \\x -> f (g x)\n\n-- Natural numbers --------------------------------------------------------\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\n(+) : Nat -> Nat -> Nat\nzero + m = m\nsuc n + m = suc (n + m)\n\n-- Finite sets ------------------------------------------------------------\n\ndata Zero : Set where\n\ndata Suc (A:Set) : Set where\n fzero_ : Suc A\n fsuc_ : A -> Suc A\n\nmutual\n\n data Fin (n:Nat) : Set where\n finI : Fin_ n -> Fin n\n\n Fin_ : Nat -> Set\n Fin_ zero = Zero\n Fin_ (suc n) = Suc (Fin n)\n\nfzero : {n:Nat} -> Fin (suc n)\nfzero = finI fzero_\n\nfsuc : {n:Nat} -> Fin n -> Fin (suc n)\nfsuc i = finI (fsuc_ i)\n\nfinE : {n:Nat} -> Fin n -> Fin_ n\nfinE (finI i) = i\n\ninfixr 15 ::\n\n-- Vectors ----------------------------------------------------------------\n\ndata Nil : Set where\n nil_ : Nil\n\ndata Cons (Xs:Set) : Set where\n cons_ : X -> Xs -> Cons Xs\n\nmutual\n\n data Vec (n:Nat) : Set where\n vecI : Vec_ n -> Vec n\n\n Vec_ : Nat -> Set\n Vec_ zero = Nil\n Vec_ (suc n) = Cons (Vec n)\n\nnil : Vec zero\nnil = vecI nil_\n\n(::) : {n:Nat} -> X -> Vec n -> Vec (suc n)\nx :: xs = vecI (cons_ x xs)\n\nvecE : {n:Nat} -> Vec n -> Vec_ n\nvecE (vecI xs) = xs\n\nvec : (n:Nat) -> X -> Vec n\nvec zero _ = nil\nvec (suc n) x = x :: vec n x\n\nmap : {n:Nat} -> (X -> X) -> Vec n -> Vec n\nmap {zero} f (vecI nil_)\t = nil\nmap {suc n} f (vecI (cons_ x xs)) = f x :: map f xs\n\n(!) : {n:Nat} -> Vec n -> Fin n -> X\n(!) {suc n} (vecI (cons_ x _ )) (finI fzero_) = x\n(!) {suc n} (vecI (cons_ _ xs)) (finI (fsuc_ i)) = xs ! i\n\nupd : {n:Nat} -> Fin n -> X -> Vec n -> Vec n\nupd {suc n} (finI fzero_) x (vecI (cons_ _ xs)) = x :: xs\nupd {suc n} (finI (fsuc_ i)) x (vecI (cons_ y xs)) = y :: upd i x xs\n\ntabulate : {n:Nat} -> (Fin n -> X) -> Vec n\ntabulate {zero} f = nil\ntabulate {suc n} f = f fzero :: tabulate (\\x -> f (fsuc x))\n\npostulate\n (===) : {n:Nat} -> Vec n -> Vec n -> Prop\n\n\nmodule Proof\n (F : {n:Nat} -> Vec n -> Vec n)\n -- and axioms...\n where\n\n stepF : {n:Nat} -> Fin n -> Vec n -> Vec n\n stepF i xs = upd i (F xs ! i) xs\n\n unsafeF' : {n:Nat} -> Nat -> Vec (suc n) -> Vec (suc n)\n unsafeF' zero = id\n unsafeF' (suc m) = unsafeF' m ∘ stepF fzero\n\n unsafeF : {n:Nat} -> Vec n -> Vec n\n unsafeF {zero} = id\n unsafeF {suc n} = unsafeF' (suc n)\n\n thm : {n:Nat} -> (xs:Vec n) -> F xs === unsafeF xs\n thm = ?\n\n", "meta": {"hexsha": "33c957a2be3b8af2daa74d2526b2a26014bb60ac", "size": 2525, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "examples/outdated-and-incorrect/Warshall.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "examples/outdated-and-incorrect/Warshall.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/outdated-and-incorrect/Warshall.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 20.867768595, "max_line_length": 75, "alphanum_fraction": 0.4685148515, "num_tokens": 1005, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314617436728, "lm_q2_score": 0.7549149813536518, "lm_q1q2_score": 0.668576458428432}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Sets.EquivalenceRelations\nopen import Setoids.Setoids\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Groups.Definition where\n\nrecord Group {lvl1 lvl2} {A : Set lvl1} (S : Setoid {lvl1} {lvl2} A) (_·_ : A → A → A) : Set (lsuc lvl1 ⊔ lvl2) where\n open Setoid S\n field\n +WellDefined : {m n x y : A} → (m ∼ x) → (n ∼ y) → (m · n) ∼ (x · y)\n 0G : A\n inverse : A → A\n +Associative : {a b c : A} → (a · (b · c)) ∼ (a · b) · c\n identRight : {a : A} → (a · 0G) ∼ a\n identLeft : {a : A} → (0G · a) ∼ a\n invLeft : {a : A} → (inverse a) · a ∼ 0G\n invRight : {a : A} → a · (inverse a) ∼ 0G\n +Associative' : {a b c : A} → ((a · b) · c) ∼ (a · (b · c))\n +Associative' = Equivalence.symmetric (Setoid.eq S) +Associative\n +WellDefinedLeft : {m x n : A} → (m ∼ n) → (m · x) ∼ (n · x)\n +WellDefinedLeft m=n = +WellDefined m=n (Equivalence.reflexive (Setoid.eq S))\n +WellDefinedRight : {m x y : A} → (x ∼ y) → (m · x) ∼ (m · y)\n +WellDefinedRight x=y = +WellDefined (Equivalence.reflexive (Setoid.eq S)) x=y\n", "meta": {"hexsha": "a999bcf5d98e8da36e463f835a78d7d9416b796b", "size": 1104, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 42.4615384615, "max_line_length": 117, "alphanum_fraction": 0.5570652174, "num_tokens": 456, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9263037343628702, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.6685534327886085}} {"text": "------------------------------------------------------------------------\n-- Digits and digit expansions\n------------------------------------------------------------------------\n\nmodule Data.Digit where\n\nopen import Data.Nat\nopen import Data.Nat.Properties\nopen SemiringSolver\nopen import Data.Fin as Fin using (Fin; zero; suc; toℕ)\nopen import Relation.Nullary.Decidable\nopen import Data.Char using (Char)\nopen import Data.List\nopen import Data.Vec as Vec using (Vec; _∷_; [])\nopen import Induction.Nat\nopen import Data.Nat.DivMod\nopen ≤-Reasoning\nopen import Relation.Binary.PropositionalEquality\nopen import Data.Function\n\n------------------------------------------------------------------------\n-- A boring lemma\n\nprivate\n\n lem : ∀ x k r → 2 + x ≤′ r + (1 + x) * (2 + k)\n lem x k r = ≤⇒≤′ $ begin\n 2 + x\n ≤⟨ m≤m+n _ _ ⟩\n 2 + x + (x + (1 + x) * k + r)\n ≡⟨ solve 3 (λ x r k → con 2 :+ x :+ (x :+ (con 1 :+ x) :* k :+ r)\n :=\n r :+ (con 1 :+ x) :* (con 2 :+ k))\n refl x r k ⟩\n r + (1 + x) * (2 + k)\n ∎\n\n------------------------------------------------------------------------\n-- Digits\n\n-- Digit b is the type of digits in base b.\n\nDigit : ℕ → Set\nDigit b = Fin b\n\n-- Some specific digit kinds.\n\nDecimal = Digit 10\nBit = Digit 2\n\n-- Some named digits.\n\n0b : Bit\n0b = zero\n\n1b : Bit\n1b = suc zero\n\n------------------------------------------------------------------------\n-- Showing digits\n\n-- The characters used to show the first 16 digits.\n\ndigitChars : Vec Char 16\ndigitChars =\n '0' ∷ '1' ∷ '2' ∷ '3' ∷ '4' ∷ '5' ∷ '6' ∷ '7' ∷ '8' ∷ '9' ∷\n 'a' ∷ 'b' ∷ 'c' ∷ 'd' ∷ 'e' ∷ 'f' ∷ []\n\n-- showDigit shows digits in base ≤ 16.\n\nshowDigit : ∀ {base} {base≤16 : True (base ≤? 16)} →\n Digit base → Char\nshowDigit {base≤16 = base≤16} d =\n Vec.lookup (Fin.inject≤ d (witnessToTruth base≤16)) digitChars\n\n------------------------------------------------------------------------\n-- Digit expansions\n\n-- fromDigits takes a digit expansion of a natural number, starting\n-- with the _least_ significant digit, and returns the corresponding\n-- natural number.\n\nfromDigits : ∀ {base} → List (Fin base) → ℕ\nfromDigits [] = 0\nfromDigits {base} (d ∷ ds) = toℕ d + fromDigits ds * base\n\n-- toDigits b n yields the digits of n, in base b, starting with the\n-- _least_ significant digit.\n--\n-- Note that the list of digits is always non-empty.\n--\n-- This function should be linear in n, if optimised properly (see\n-- Data.Nat.DivMod).\n\ndata Digits (base : ℕ) : ℕ → Set where\n digits : (ds : List (Fin base)) → Digits base (fromDigits ds)\n\ntoDigits : (base : ℕ) {base≥2 : True (2 ≤? base)} (n : ℕ) →\n Digits base n\ntoDigits zero {base≥2 = ()} _\ntoDigits (suc zero) {base≥2 = ()} _\ntoDigits (suc (suc k)) n = <-rec Pred helper n\n where\n base = suc (suc k)\n Pred = Digits base\n\n cons : ∀ {n} (r : Fin base) → Pred n → Pred (toℕ r + n * base)\n cons r (digits ds) = digits (r ∷ ds)\n\n helper : ∀ n → <-Rec Pred n → Pred n\n helper n rec with n divMod base\n helper .(toℕ r + 0 * base) rec | result zero r = digits (r ∷ [])\n helper .(toℕ r + suc x * base) rec | result (suc x) r =\n cons r (rec (suc x) (lem (pred (suc x)) k (toℕ r)))\n\ntheDigits : (base : ℕ) {base≥2 : True (2 ≤? base)} (n : ℕ) →\n List (Fin base)\ntheDigits base {base≥2} n with toDigits base {base≥2} n\ntheDigits base .(fromDigits ds) | digits ds = ds\n", "meta": {"hexsha": "dab111428285e30247b8e9f9d7a70e14c518e50e", "size": 3467, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "vendor/stdlib/src/Data/Digit.agda", "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 56, "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_issues_repo_path": "vendor/stdlib/src/Data/Digit.agda", "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_forks_repo_path": "vendor/stdlib/src/Data/Digit.agda", "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "avg_line_length": 28.8916666667, "max_line_length": 73, "alphanum_fraction": 0.5093740986, "num_tokens": 1073, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473746782093, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.6684742524345556}} {"text": "module Golden.FstSnd where\n\nopen import Agda.Builtin.Nat\n\ndata Tuple a b : Set where\n Tup : a -> b -> Tuple a b\n\nfst : {a b : Set} -> Tuple a b -> a\nfst (Tup x x₁) = x\nsnd : {a b : Set} -> Tuple a b -> b\nsnd (Tup x b) = b\n\n\ntup1 : Tuple Nat Nat\ntup1 = Tup 0 1\n\na = fst tup1\nb = snd tup1\n", "meta": {"hexsha": "811c24006477b8ee11d0f095a0a38346ffeb108d", "size": 288, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/agda-ocaml/Golden/FstSnd.agda", "max_stars_repo_name": "agda/agda-ocaml", "max_stars_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 48, "max_stars_repo_stars_event_min_datetime": "2017-03-29T14:19:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-15T09:08:14.000Z", "max_issues_repo_path": "test/agda-ocaml/Golden/FstSnd.agda", "max_issues_repo_name": "agda/agda-ocaml", "max_issues_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2017-03-29T13:37:52.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-05T21:28:57.000Z", "max_forks_repo_path": "test/agda-ocaml/Golden/FstSnd.agda", "max_forks_repo_name": "agda/agda-ocaml", "max_forks_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2018-05-24T10:45:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:48.000Z", "avg_line_length": 15.1578947368, "max_line_length": 35, "alphanum_fraction": 0.5868055556, "num_tokens": 117, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8723473746782093, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.6684742477786377}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Experiment.Transitive where\n\nopen import Level\nopen import Relation.Binary\nopen import Relation.Binary.Construct.Closure.Transitive\nopen import Relation.Binary.PropositionalEquality as ≡ using (_≡_)\n\ninsert-permutation : ∀ x xs → insert x xs ↭ x ∷ xs\ninsert-pres-Sorted : ∀ x {xs} → Sorted xs → Sorted (insert x xs)\nsort-Sorted : ∀ xs → Sorted (sort xs)\nsort-permutation : ∀ xs → sort xs ↭ xs\n\nprivate\n variable\n a b r : Level\n A B : Set a\n R S : Rel A r\n\nfold : Transitive R → A [ R ]⁺ B → R A B\nfold R-trans [ x∼y ] = x∼y\nfold R-trans (x ∼⁺⟨ x₁ ⟩ x₂) = R-trans (fold R-trans x₁) (fold R-trans x₂)\n\nreverse : Symmetric R → A [ R ]⁺ B → B [ R ]⁺ A\nreverse R-sym [ x∼y ] = [ R-sym x∼y ]\nreverse R-sym (x ∼⁺⟨ x₁ ⟩ x₂) = _ ∼⁺⟨ reverse R-sym x₂ ⟩ reverse R-sym x₁\n\nfold-reverse : (R-trans : Transitive R) (R-sym : Symmetric R) (xs : A [ R ]⁺ B) →\n (∀ {a b c} (x : R b c) (y : R a b) →\n R-trans (R-sym x) (R-sym y) ≡ R-sym (R-trans y x)) →\n fold R-trans (reverse R-sym xs) ≡ R-sym (fold R-trans xs)\nfold-reverse R-trans R-sym [ x∼y ] homo = ≡.refl\nfold-reverse R-trans R-sym (x ∼⁺⟨ xs₁ ⟩ xs₂) homo = begin\n R-trans (fold R-trans (reverse R-sym xs₂)) (fold R-trans (reverse R-sym xs₁))\n ≡⟨ ≡.cong₂ R-trans (fold-reverse R-trans R-sym xs₂ homo) (fold-reverse R-trans R-sym xs₁ homo) ⟩\n R-trans (R-sym (fold R-trans xs₂)) (R-sym (fold R-trans xs₁))\n ≡⟨ homo (fold R-trans xs₂) (fold R-trans xs₁) ⟩\n R-sym (R-trans (fold R-trans xs₁) (fold R-trans xs₂))\n ∎\n where\n open ≡.≡-Reasoning\n\n-- map :\n-- Star⇔ReflexiveTransitive : Star R x y ↔ Reflexive (Transitive R x y)\n\n-- map-reverse : (RS : R ⊆ S) (R-sym : Symmetric R) (S-sym : Symmetric S) xs → map RS (reverse R-sym xs) ≡ reverse S-sym (map RS xs)\n-- map-reverse R-sym xs = ?\n\n-- ∘ᵢ-tc (reverse f⁺) ∘ᵢ ∘ᵢ-tc f⁺ ≃ ≅.refl\n", "meta": {"hexsha": "d626c59ba3f506bb518ca19bbea5d14800c2d4d8", "size": 1905, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Experiment/Transitive.agda", "max_stars_repo_name": "rei1024/agda-misc", "max_stars_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:49:42.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-21T00:03:43.000Z", "max_issues_repo_path": "Experiment/Transitive.agda", "max_issues_repo_name": "rei1024/agda-misc", "max_issues_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Experiment/Transitive.agda", "max_forks_repo_name": "rei1024/agda-misc", "max_forks_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.1, "max_line_length": 132, "alphanum_fraction": 0.5910761155, "num_tokens": 739, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473647220787, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.668474244805236}} {"text": "{-\n\nDefinition of finitely indexed types\n\nA type is finitely indexed if, for some `n`, there merely exists a\nsurjective function from `Fin n` to it. Note that a type doesn't need\nto be a set in order for it to be finitely indexed. For example, the\ncircle is finitely indexed.\n\nThis definition is weaker than `isFinSet`.\n\n-}\n\n{-# OPTIONS --safe #-}\n\nmodule Cubical.Data.FinInd where\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.SumFin\nopen import Cubical.Data.Sigma\nopen import Cubical.Data.FinSet\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Equiv\nopen import Cubical.Functions.Surjection\nopen import Cubical.HITs.PropositionalTruncation as PT\nopen import Cubical.HITs.S1\n\nprivate\n variable\n ℓ : Level\n A : Type ℓ\n\nisFinInd : Type ℓ → Type ℓ\nisFinInd A = ∃[ n ∈ ℕ ] Fin n ↠ A\n\nisFinSet→isFinInd : isFinSet A → isFinInd A\nisFinSet→isFinInd h = PT.elim\n (λ _ → squash)\n (λ equiv →\n ∣ _ , invEq equiv , section→isSurjection (retEq equiv) ∣) (h .snd)\n\nisFinInd-S¹ : isFinInd S¹\nisFinInd-S¹ = ∣ 1 , f , isSurjection-f ∣\n where\n f : Fin 1 → S¹\n f _ = base\n isSurjection-f : isSurjection f\n isSurjection-f b = PT.map (λ base≡b → fzero , base≡b) (isConnectedS¹ b)\n", "meta": {"hexsha": "cebab1042025dbd929b5c10cca5730571d3ae99a", "size": 1218, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/FinInd.agda", "max_stars_repo_name": "howsiyu/cubical", "max_stars_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/FinInd.agda", "max_issues_repo_name": "howsiyu/cubical", "max_issues_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/FinInd.agda", "max_forks_repo_name": "howsiyu/cubical", "max_forks_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.8571428571, "max_line_length": 75, "alphanum_fraction": 0.7192118227, "num_tokens": 402, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887588052782737, "lm_q2_score": 0.7520125793176222, "lm_q1q2_score": 0.668357801548563}} {"text": "-- Andreas, 2017-04-26\n-- Allow more flexible size assignment.\n\nmodule _ where\n\nopen import Agda.Builtin.Size\n\nmodule ZeroZero where\n\n data Nat : Size → Set where\n zero : ∀{i} → Nat i -- does not have to be ↑ i\n suc : ∀{i} → Nat i → Nat (↑ i)\n\n mon : ∀{i}{j : Size< i} → Nat j → Nat i\n mon x = x\n\n minus : ∀{i} → Nat i → Nat ∞ → Nat i\n minus x zero = x\n minus zero (suc y) = zero\n minus (suc x) (suc y) = minus x y\n\n div : ∀{i} → Nat i → Nat ∞ → Nat i\n div zero y = zero\n div (suc x) y = suc (div (minus x y) y)\n\nmodule DSuc where\n\n -- Here, the upper least bound for the size is the number itself.\n\n data Nat : Size → Set where\n zero : ∀{i} → Nat i\n suc : ∀{i} → Nat i → Nat (↑ i)\n dsuc : ∀{i} → Nat i → Nat (↑ ↑ i)\n\n -- Testing subtyping.\n\n mon : ∀{i}{j : Size< i} → Nat j → Nat i\n mon x = x\n\n minus : ∀{i} → Nat i → Nat ∞ → Nat i\n minus x zero = x\n minus zero y = zero\n minus (suc x) (suc y) = minus x y\n minus (suc x) (dsuc y) = minus x (suc y)\n minus (dsuc x) (suc y) = minus (suc x) y\n minus (dsuc x) (dsuc y) = minus x y\n\n div : ∀{i} → Nat i → Nat ∞ → Nat i\n div zero y = zero\n div (suc x) y = suc (div (minus x y) y)\n div (dsuc x) y = suc (div (minus (suc x) y) y)\n", "meta": {"hexsha": "e579b51517dc3976b16b2f45bb3ff6bbd04f6b74", "size": 1277, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2554-size-plus2.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-10-29T09:40:30.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-20T00:28:57.000Z", "max_issues_repo_path": "test/Succeed/Issue2554-size-plus2.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z", "max_forks_repo_path": "test/Succeed/Issue2554-size-plus2.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 24.5576923077, "max_line_length": 67, "alphanum_fraction": 0.5152701644, "num_tokens": 501, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887587993853655, "lm_q2_score": 0.7520125682019722, "lm_q1q2_score": 0.6683577872378901}} {"text": "open import Data.Nat using (ℕ; zero; suc; _+_; _*_)\nopen import Data.Product using (∃; _,_)\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl; sym)\n\n+-identity : ∀ (m : ℕ) → m + zero ≡ m\n+-identity zero = refl\n+-identity (suc m) rewrite +-identity m = refl\n\n+-suc : ∀ (m n : ℕ) → n + suc m ≡ suc (n + m)\n+-suc m zero = refl\n+-suc m (suc n) rewrite +-suc m n = refl\n\n+-comm : ∀ (m n : ℕ) → m + n ≡ n + m\n+-comm zero n rewrite +-identity n = refl\n+-comm (suc m) n rewrite +-suc m n | +-comm m n = refl\n\nmutual\n data even : ℕ → Set where\n zero : even zero\n suc : ∀ {n : ℕ} → odd n → even (suc n)\n data odd : ℕ → Set where\n suc : ∀ {n : ℕ} → even n → odd (suc n)\n\n+-lemma : ∀ (m : ℕ) → suc (suc (m + (m + 0))) ≡ suc m + suc (m + 0)\n+-lemma m rewrite +-identity m | +-suc m m = refl\n\nmutual\n is-even : ∀ (n : ℕ) → even n → ∃(λ (m : ℕ) → n ≡ 2 * m)\n is-even zero zero = zero , refl\n is-even (suc n) (suc oddn) with is-odd n oddn\n ... | m , n≡1+2*m rewrite n≡1+2*m | +-lemma m = suc m , refl\n\n is-odd : ∀ (n : ℕ) → odd n → ∃(λ (m : ℕ) → n ≡ 1 + 2 * m)\n is-odd (suc n) (suc evenn) with is-even n evenn\n ... | m , n≡2*m rewrite n≡2*m = m , refl\n\n+-lemma′ : ∀ (m : ℕ) → suc (suc (m + (m + 0))) ≡ suc m + suc (m + 0)\n+-lemma′ m rewrite +-suc (m + 0) m = refl\n\nis-even′ : ∀ (n : ℕ) → even n → ∃(λ (m : ℕ) → n ≡ 2 * m)\nis-even′ zero zero = zero , refl\nis-even′ (suc n) (suc oddn) with is-odd n oddn\n... | m , n≡1+2*m rewrite n≡1+2*m | +-identity m | +-suc m m = suc m , {!!}\n\n", "meta": {"hexsha": "a36e33cd3976ebca247d1e9b37e900187db2559a", "size": 1500, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "extra/extra/EvenOdd.agda", "max_stars_repo_name": "manikdv/plfa.github.io", "max_stars_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 1003, "max_stars_repo_stars_event_min_datetime": "2018-07-05T18:15:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-27T07:03:28.000Z", "max_issues_repo_path": "extra/extra/EvenOdd.agda", "max_issues_repo_name": "manikdv/plfa.github.io", "max_issues_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": 323, "max_issues_repo_issues_event_min_datetime": "2018-07-05T22:34:34.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T07:42:57.000Z", "max_forks_repo_path": "extra/extra/EvenOdd.agda", "max_forks_repo_name": "manikdv/plfa.github.io", "max_forks_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4", "max_forks_repo_licenses": ["CC-BY-4.0"], "max_forks_count": 304, "max_forks_repo_forks_event_min_datetime": "2018-07-16T18:24:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T11:35:02.000Z", "avg_line_length": 33.3333333333, "max_line_length": 75, "alphanum_fraction": 0.5206666667, "num_tokens": 634, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9219218348550491, "lm_q2_score": 0.7248702821204019, "lm_q1q2_score": 0.6682737405243381}} {"text": "module YonedaLemma where\n\nopen import Library\nopen import Categories\nopen import Categories.Sets\nopen import Functors\nopen import Naturals\nopen import FunctorCat\n\nHomF[-,_] : ∀{l m}{C : Cat {l}{m}}(X : Cat.Obj C) -> Fun (C Op) (Sets {m})\nHomF[-,_] {C = C} B = functor\n (\\ X -> Hom X B)\n (\\ f g -> comp g f)\n (ext \\ _ -> idr)\n (ext \\ _ -> sym ass)\n where open Cat C\n\nHomN[-,_] : ∀{l m}{C : Cat {l}{m}}{X Y : Cat.Obj C}(f : Cat.Hom C X Y) ->\n NatT (HomF[-,_] {C = C} X) HomF[-, Y ]\nHomN[-,_] {C = C} f = natural\n (comp f)\n (ext \\ _ -> ass)\n where open Cat C\n\ny : ∀{l m}(C : Cat {l}{m}) -> Fun C (FunctorCat (C Op) (Sets {m}))\ny C = functor\n HomF[-,_]\n HomN[-,_]\n (NatTEq (iext \\ _ -> ext \\ _ -> idl))\n (NatTEq (iext \\ _ -> ext \\ _ -> ass))\n where open Cat C\n\nyleminv : ∀{l m}(C : Cat {l}{m})(F : Fun (C Op) (Sets {m}))(X : Cat.Obj C) ->\n NatT (Fun.OMap (y C) X) F -> Fun.OMap F X\nyleminv C F X α = NatT.cmp α {X} (Cat.iden C)\n\nylem : ∀{l m}(C : Cat {l}{m})(F : Fun (C Op) (Sets {m}))(X : Cat.Obj C) ->\n Fun.OMap F X -> NatT (Fun.OMap (y C) X) F\nylem C F X FX = natural\n (\\ {X'} f -> HMap f FX)\n (\\{X'}{Y}{f} -> ext \\ g -> sym (fcong FX (fcomp {f = f}{g = g})) ) \n where open Cat C; open Fun F\n", "meta": {"hexsha": "ad16acde6034b7e80652154c6d74d87d631b9d7c", "size": 1233, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "YonedaLemma.agda", "max_stars_repo_name": "jmchapman/Relative-Monads", "max_stars_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2015-07-30T01:25:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-13T18:02:18.000Z", "max_issues_repo_path": "YonedaLemma.agda", "max_issues_repo_name": "jmchapman/Relative-Monads", "max_issues_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2019-01-13T13:12:33.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-29T09:50:26.000Z", "max_forks_repo_path": "YonedaLemma.agda", "max_forks_repo_name": "jmchapman/Relative-Monads", "max_forks_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-04T21:33:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-04T21:33:13.000Z", "avg_line_length": 28.6744186047, "max_line_length": 77, "alphanum_fraction": 0.5133819951, "num_tokens": 516, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9099070133672955, "lm_q2_score": 0.7341195210831258, "lm_q1q2_score": 0.6679805008833763}} {"text": "module Relator.Equals.Proofs where\n\nopen import Relator.Equals\nopen import Structure.Relator.Equivalence\nopen import Structure.Relator.Properties\nopen import Structure.Setoid renaming (_≡_ to _≡ₛ_)\n\ninstance\n [≡]-reflexivity : ∀{ℓ}{A : Type{ℓ}} → Reflexivity(_≡_ {P = A})\n Reflexivity.proof([≡]-reflexivity) = constant-path\n\ninstance\n [≡]-symmetry : ∀{ℓ}{A : Type{ℓ}} → Symmetry(_≡_ {P = A})\n Symmetry.proof([≡]-symmetry) = reversed-path\n", "meta": {"hexsha": "f0e4a9d9f45c06e500402c9200970b8811dfc7d6", "size": 442, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Mathematical/Relator/Equals/Proofs.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Mathematical/Relator/Equals/Proofs.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Mathematical/Relator/Equals/Proofs.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.4666666667, "max_line_length": 64, "alphanum_fraction": 0.7104072398, "num_tokens": 150, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9136765234137297, "lm_q2_score": 0.7310585844894971, "lm_q1q2_score": 0.6679510658881261}} {"text": "module Matrix where\n\nopen import Data.Nat\nopen import Data.Vec\n\nMatrix : (A : Set) → ℕ → ℕ → Set\nMatrix A m n = Vec (Vec A m) n\n\ntranspose : ∀ {A m n} → Matrix A m n → Matrix A n m\ntranspose [] = replicate []\ntranspose (xs ∷ xss) = zipWith _∷_ xs (transpose xss)\n\na = (1 ∷ 2 ∷ 3 ∷ []) ∷ (4 ∷ 5 ∷ 6 ∷ []) ∷ []\nb = transpose a\n", "meta": {"hexsha": "0d86e59df63200ebaa6b07ee0cd76954933601b9", "size": 325, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Task/Matrix-transposition/Agda/matrix-transposition-1.agda", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Matrix-transposition/Agda/matrix-transposition-1.agda", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Matrix-transposition/Agda/matrix-transposition-1.agda", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 21.6666666667, "max_line_length": 53, "alphanum_fraction": 0.5753846154, "num_tokens": 126, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9059898203834278, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.667857796585667}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category\n\n-- Definition of Terminal object and some properties\n\nmodule Categories.Object.Terminal {o ℓ e} (C : Category o ℓ e) where\n\nopen import Level\n\nopen import Relation.Binary using (IsEquivalence; Setoid)\nopen import Relation.Binary.PropositionalEquality as ≡ using (_≡_)\n\nopen import Categories.Morphism C\nopen import Categories.Morphism.IsoEquiv C using (_≃_; ⌞_⌟)\nopen import Categories.Morphism.Reasoning C\n\nopen Category C\nopen HomReasoning\n\nrecord Terminal : Set (o ⊔ ℓ ⊔ e) where\n field\n ⊤ : Obj\n ! : {A : Obj} → (A ⇒ ⊤)\n !-unique : ∀ {A} → (f : A ⇒ ⊤) → ! ≈ f\n\n !-unique₂ : ∀ {A} {f g : A ⇒ ⊤} → f ≈ g\n !-unique₂ {A} {f} {g} = begin\n f ≈˘⟨ !-unique f ⟩\n ! ≈⟨ !-unique g ⟩\n g ∎\n where open HomReasoning\n\n ⊤-id : (f : ⊤ ⇒ ⊤) → f ≈ id\n ⊤-id _ = !-unique₂\n\nopen Terminal\n\nfrom-⊤-is-Mono : ∀ {A : Obj} {t : Terminal} → (f : ⊤ t ⇒ A) → Mono f\nfrom-⊤-is-Mono {_} {t} _ = λ _ _ _ → !-unique₂ t\n\nup-to-iso : (t₁ t₂ : Terminal) → ⊤ t₁ ≅ ⊤ t₂\nup-to-iso t₁ t₂ = record\n { from = ! t₂\n ; to = ! t₁\n ; iso = record { isoˡ = ⊤-id t₁ _; isoʳ = ⊤-id t₂ _ }\n }\n\ntransport-by-iso : (t : Terminal) → ∀ {X} → ⊤ t ≅ X → Terminal\ntransport-by-iso t {X} t≅X = record\n { ⊤ = X\n ; ! = from ∘ ! t\n ; !-unique = λ h → begin\n from ∘ ! t ≈⟨ refl⟩∘⟨ !-unique t (to ∘ h) ⟩\n from ∘ to ∘ h ≈⟨ cancelˡ isoʳ ⟩\n h ∎\n }\n where open _≅_ t≅X\n\nup-to-iso-unique : ∀ t t′ → (i : ⊤ t ≅ ⊤ t′) → up-to-iso t t′ ≃ i\nup-to-iso-unique t t′ i = ⌞ !-unique t′ _ ⌟\n\nup-to-iso-invˡ : ∀ {t X} {i : ⊤ t ≅ X} → up-to-iso t (transport-by-iso t i) ≃ i\nup-to-iso-invˡ {t} {i = i} = up-to-iso-unique t (transport-by-iso t i) i\n\nup-to-iso-invʳ : ∀ {t t′} → ⊤ (transport-by-iso t (up-to-iso t t′)) ≡ ⊤ t′\nup-to-iso-invʳ {t} {t′} = ≡.refl\n", "meta": {"hexsha": "c9b75edd60560df7d09e7ce90da262e79387a5f3", "size": 1828, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Object/Terminal.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Object/Terminal.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Object/Terminal.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.2835820896, "max_line_length": 79, "alphanum_fraction": 0.5432166302, "num_tokens": 795, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240895276224, "lm_q2_score": 0.7718435030872968, "lm_q1q2_score": 0.6678175922165169}} {"text": "module Issue558b where\n\ndata Nat : Set where\n Z : Nat\n S : Nat → Nat\n\ndata _≡_ {A : Set} (a : A) : A → Set where\n Refl : a ≡ a\n\nplus : Nat → Nat → Nat\nplus Z n = n\nplus (S n) m = S (plus n m)\n\ndata Addable (τ : Set) : Set where\n addable : (τ → τ → τ) → Addable τ\n\nplus' : {τ : Set} → Addable τ → τ → τ → τ\nplus' (addable p) = p\n\nrecord ⊤ : Set where\n\nmodule AddableM {τ : Set} {a : ⊤} (a : Addable τ) where\n _+_ : τ → τ → τ\n _+_ = plus' a\n\n-- record Addable (τ : Set) : Set where\n-- constructor addable\n-- field\n-- _+_ : τ → τ → τ\n\nopen module AddableIFS {t : Set} {a : ⊤} {{r : Addable t}} = AddableM {t} r\n\ndata CommAddable (τ : Set) {a : ⊤} : Set where\n commAddable : (addable : Addable τ) → ((a b : τ) → (a + b) ≡ (b + a)) → CommAddable τ\n\nprivate\n addableCA' : {τ : Set} (ca : CommAddable τ) → Addable τ\n addableCA' (commAddable a _) = a\n\n comm' : {τ : Set} (ca : CommAddable τ) →\n let a = addableCA' ca in (a b : τ) → (a + b) ≡ (b + a)\n comm' (commAddable _ c) = c\n\nmodule CommAddableM {τ : Set} {a : ⊤} (ca : CommAddable τ) where\n addableCA : Addable τ\n addableCA = addableCA' ca\n\n comm : (a b : τ) → (a + b) ≡ (b + a)\n comm = comm' ca\n\nnatAdd : Addable Nat\nnatAdd = addable plus\n\npostulate commPlus : (a b : Nat) → plus a b ≡ plus b a\n\ncommNatAdd : CommAddable Nat\ncommNatAdd = commAddable natAdd commPlus\n\nopen CommAddableM {{...}}\n\ntest : (Z + Z) ≡ Z\ntest = comm Z Z\n\na : {x y : Nat} → (S (S Z) + (x + y)) ≡ ((x + y) + S (S Z))\na {x}{y} = comm (S (S Z)) (x + y)\n", "meta": {"hexsha": "6d00062b19a8ba60bcd102b75a50a158fc967e82", "size": 1499, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/succeed/Issue558b.agda", "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/succeed/Issue558b.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/succeed/Issue558b.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "avg_line_length": 22.7121212121, "max_line_length": 86, "alphanum_fraction": 0.5503669113, "num_tokens": 620, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240686758841, "lm_q2_score": 0.7718434978390747, "lm_q1q2_score": 0.6678175715813501}} {"text": "module L.Base.Nat.Core where\n\n-- Introducing Nat type with constructors zero and succ\ndata Nat : Set where\n zero : Nat\n succ : Nat → Nat\n\n-- Enabling the usage of numerals in code.\n{-# BUILTIN NATURAL Nat #-}\n\nind : ∀{c} (C : Nat → Set c)\n → C zero → ((x : Nat) → C x → C (succ x))\n → (n : Nat) → C n\nind C cₒ cₛ zero = cₒ\nind C cₒ cₛ (succ n) = cₛ n (ind C cₒ cₛ n)\n", "meta": {"hexsha": "b05fbeb156a9e06a7d321a2f255dc1ad33674df9", "size": 375, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/L/Base/Nat/Core.agda", "max_stars_repo_name": "borszag/smallib", "max_stars_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/L/Base/Nat/Core.agda", "max_issues_repo_name": "borszag/smallib", "max_issues_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 10, "max_issues_repo_issues_event_min_datetime": "2020-10-19T10:13:16.000Z", "max_issues_repo_issues_event_max_datetime": "2020-11-09T16:40:39.000Z", "max_forks_repo_path": "src/L/Base/Nat/Core.agda", "max_forks_repo_name": "borszag/smallib", "max_forks_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.4375, "max_line_length": 55, "alphanum_fraction": 0.5946666667, "num_tokens": 143, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9334308073258009, "lm_q2_score": 0.7154240018510026, "lm_q1q2_score": 0.6677988036280367}} {"text": "open import Structure.Setoid\nopen import Structure.Category\nopen import Type\n\nmodule Structure.Category.Monoid\n {ℓₒ ℓₘ ℓₑ}\n {Obj : Type{ℓₒ}}\n {Morphism : Obj → Obj → Type{ℓₘ}}\n ⦃ morphism-equiv : ∀{x y} → Equiv{ℓₑ}(Morphism x y) ⦄\n (cat : Category(Morphism))\n where\n\nopen import Logic.Predicate\nopen import Structure.Categorical.Properties\nopen import Structure.Operator.Monoid\nopen import Structure.Operator.Properties\n\nopen Category(cat)\n\n-- A monoid constructed from a category for a specific object.\nmonoid : ∀{x} → Monoid(_∘_ {x = x})\nMonoid.binary-operator monoid = binaryOperator\nAssociativity.proof (Monoid.associativity monoid) = Morphism.associativity(_∘_)\n∃.witness (Monoid.identity-existence monoid) = id\nIdentityₗ.proof (Identity.left (∃.proof (Monoid.identity-existence monoid))) = Morphism.identityₗ(_∘_)(id)\nIdentityᵣ.proof (Identity.right (∃.proof (Monoid.identity-existence monoid))) = Morphism.identityᵣ(_∘_)(id)\n", "meta": {"hexsha": "c2ea8cdfa4288304bd7cabcab3204e42e6990ee8", "size": 939, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Structure/Category/Monoid.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Structure/Category/Monoid.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Structure/Category/Monoid.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.7777777778, "max_line_length": 107, "alphanum_fraction": 0.7539936102, "num_tokens": 287, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9334308073258007, "lm_q2_score": 0.7154240018510026, "lm_q1q2_score": 0.6677988036280366}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\nopen import Categories.Functor\n\n-- Street fibration, which is the version of fibration that respects the principle of equivalence.\n-- https://ncatlab.org/nlab/show/Grothendieck+fibration#StreetFibration\nmodule Categories.Functor.Fibration {o ℓ e o′ ℓ′ e′} {C : Category o ℓ e} {D : Category o′ ℓ′ e′} (F : Functor C D) where\n\nopen import Level\n\nopen import Categories.Morphism D using (_≅_)\nopen import Categories.Morphism.Cartesian using (Cartesian)\n\nprivate\n module C = Category C\n module D = Category D\n open Functor F\n\nrecord Fibration : Set (levelOfTerm F) where\n field\n universal₀ : ∀ {A B} (f : A D.⇒ F₀ B) → C.Obj\n universal₁ : ∀ {A B} (f : A D.⇒ F₀ B) → universal₀ f C.⇒ B\n iso : ∀ {A B} (f : A D.⇒ F₀ B) → F₀ (universal₀ f) ≅ A\n\n module iso {A B} (f : A D.⇒ F₀ B) = _≅_ (iso f)\n\n field\n commute : ∀ {A B} (f : A D.⇒ F₀ B) → f D.∘ iso.from f D.≈ F₁ (universal₁ f)\n cartesian : ∀ {A B} (f : A D.⇒ F₀ B) → Cartesian F (universal₁ f)\n\n module cartesian {A B} (f : A D.⇒ F₀ B) = Cartesian (cartesian f)\n", "meta": {"hexsha": "96732aad876672ad58c19f5988a3dd83190bef8f", "size": 1107, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Functor/Fibration.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2019-05-21T17:07:19.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-22T03:54:24.000Z", "max_issues_repo_path": "src/Categories/Functor/Fibration.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Functor/Fibration.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.5454545455, "max_line_length": 121, "alphanum_fraction": 0.6395663957, "num_tokens": 399, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9252299653388752, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.6677784417462952}} {"text": "module NatCat where\n\nopen import Relation.Binary.PropositionalEquality\n\n-- If you can show that a relation only ever has one inhabitant\n-- you get the category laws for free\nmodule\n EasyCategory\n (obj : Set)\n (_⟶_ : obj → obj → Set)\n (_∘_ : ∀ {x y z} → x ⟶ y → y ⟶ z → x ⟶ z)\n (id : ∀ x → x ⟶ x)\n (single-inhabitant : (x y : obj) (r s : x ⟶ y) → r ≡ s)\n where\n\n idʳ : ∀ x y (r : x ⟶ y) → r ∘ id y ≡ r\n idʳ x y r = single-inhabitant x y (r ∘ id y) r \n\n idˡ : ∀ x y (r : x ⟶ y) → id x ∘ r ≡ r\n idˡ x y r = single-inhabitant x y (id x ∘ r) r\n\n ∘-assoc : ∀ w x y z (r : w ⟶ x) (s : x ⟶ y) (t : y ⟶ z) → (r ∘ s) ∘ t ≡ r ∘ (s ∘ t)\n ∘-assoc w x y z r s t = single-inhabitant w z ((r ∘ s) ∘ t) (r ∘ (s ∘ t))\n\nopen import Data.Nat\n\nsame : (x y : ℕ) (r s : x ≤ y) → r ≡ s\nsame .0 y z≤n z≤n = refl\nsame .(suc m) .(suc n) (s≤s {m} {n} r) (s≤s s) = cong s≤s (same m n r s)\n\n≤-trans : ∀ x y z → x ≤ y → y ≤ z → x ≤ z\n≤-trans .0 y z z≤n s = z≤n\n≤-trans .(suc m) .(suc n) .(suc n₁) (s≤s {m} {n} r) (s≤s {.n} {n₁} s) = s≤s (≤-trans m n n₁ r s)\n\n≤-refl : ∀ x → x ≤ x\n≤-refl zero = z≤n\n≤-refl (suc x) = s≤s (≤-refl x)\n\nmodule Nat-EasyCategory = EasyCategory ℕ _≤_ (λ {x}{y}{z} → ≤-trans x y z) ≤-refl same\n", "meta": {"hexsha": "7aada27ee452566e1de5dd8dd76591c9cbaf358e", "size": 1200, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "samples/Agda/NatCat.agda", "max_stars_repo_name": "alexgracianoarj/detect-languages", "max_stars_repo_head_hexsha": "89fcfb45789f07778ac570e98629a6b767913425", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-06-23T13:43:34.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-23T14:03:52.000Z", "max_issues_repo_path": "samples/Agda/NatCat.agda", "max_issues_repo_name": "alexgracianoarj/detect-languages", "max_issues_repo_head_hexsha": "89fcfb45789f07778ac570e98629a6b767913425", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "samples/Agda/NatCat.agda", "max_forks_repo_name": "alexgracianoarj/detect-languages", "max_forks_repo_head_hexsha": "89fcfb45789f07778ac570e98629a6b767913425", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.0, "max_line_length": 96, "alphanum_fraction": 0.5008333333, "num_tokens": 607, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9173026528034425, "lm_q2_score": 0.7279754548076478, "lm_q1q2_score": 0.6677738158708478}} {"text": "module Dave.Embedding where\n open import Dave.Functions\n open import Dave.Equality\n open import Dave.Isomorphism\n\n infix 0 _≲_\n record _≲_ (A B : Set) : Set where\n field\n to : A → B\n from : B → A\n from∘to : ∀ (x : A) → from (to x) ≡ x\n \n open _≲_\n\n ≲-refl : ∀ {A : Set} → A ≲ A\n ≲-refl = record \n {\n to = λ a → a ;\n from = λ b → b ;\n from∘to = λ a → refl\n }\n\n ≲-trans : ∀ {A B C : Set} → A ≲ B → B ≲ C → A ≲ C\n ≲-trans A≲B B≲C = record \n {\n to = λ a → to B≲C (to A≲B a) ;\n from = λ c → from A≲B (from B≲C c) ;\n from∘to = λ a → begin\n (from A≲B ∘ from B≲C) ((to B≲C ∘ to A≲B) a) ≡⟨⟩\n from A≲B (from B≲C (to B≲C (to A≲B a))) ≡⟨ cong (from A≲B) (from∘to B≲C (to A≲B a)) ⟩\n from A≲B (to A≲B a) ≡⟨ from∘to A≲B a ⟩\n a ∎\n }\n\n ≲-antisym : ∀ {A B : Set} \n → (A≲B : A ≲ B) \n → (B≲A : B ≲ A) \n → (to A≲B ≡ from B≲A)\n → (from A≲B ≡ to B≲A)\n → A ≃ B\n ≲-antisym A≲B B≲A to≡from from≡to = record \n {\n to = λ a → to A≲B a ;\n from = λ b → from A≲B b ;\n from∘to = from∘to A≲B;\n to∘from = λ b → begin\n to A≲B (from A≲B b) ≡⟨ cong (λ x → (to A≲B (x b))) from≡to ⟩\n to A≲B (to B≲A b) ≡⟨ cong-app to≡from (to B≲A b) ⟩\n from B≲A (to B≲A b) ≡⟨ from∘to B≲A b ⟩\n b ∎\n } \n\n module ≲-Reasoning where\n\n infix 1 ≲-begin_\n infixr 2 _≲⟨_⟩_\n infix 3 _≲-∎\n\n ≲-begin_ : ∀ {A B : Set}\n → A ≲ B\n -----\n → A ≲ B\n ≲-begin A≲B = A≲B\n\n _≲⟨_⟩_ : ∀ (A : Set) {B C : Set}\n → A ≲ B\n → B ≲ C\n -----\n → A ≲ C\n A ≲⟨ A≲B ⟩ B≲C = ≲-trans A≲B B≲C\n\n _≲-∎ : ∀ (A : Set)\n -----\n → A ≲ A\n A ≲-∎ = ≲-refl\n\n open ≲-Reasoning \n\n ≃-implies-≲ : ∀ {A B : Set} → A ≃ B → A ≲ B\n ≃-implies-≲ A≃B = record \n { \n to = _≃_.to A≃B; \n from = _≃_.from A≃B; \n from∘to = _≃_.from∘to A≃B \n }\n\n \n", "meta": {"hexsha": "da3c65affb7f8d48f9574fc36080385b59947108", "size": 2248, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Dave/Embedding.agda", "max_stars_repo_name": "DavidStahl97/formal-proofs", "max_stars_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Dave/Embedding.agda", "max_issues_repo_name": "DavidStahl97/formal-proofs", "max_issues_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Dave/Embedding.agda", "max_forks_repo_name": "DavidStahl97/formal-proofs", "max_forks_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.5454545455, "max_line_length": 101, "alphanum_fraction": 0.3385231317, "num_tokens": 967, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.841825635346563, "lm_q2_score": 0.7931059536292271, "lm_q1q2_score": 0.6676569233110657}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Integers.RingStructure.Ring\nopen import Rings.IntegralDomains.Definition\n\nmodule Numbers.Integers.RingStructure.IntegralDomain where\n\nintDom : (a b : ℤ) → a *Z b ≡ nonneg 0 → (a ≡ nonneg 0 → False) → (b ≡ nonneg 0)\nintDom (nonneg zero) (nonneg b) x a!=0 = exFalso (a!=0 x)\nintDom (nonneg (succ a)) (nonneg zero) a!=0 _ = refl\nintDom (nonneg zero) (negSucc b) pr a!=0 = exFalso (a!=0 pr)\nintDom (negSucc a) (nonneg zero) _ _ = refl\n\nℤIntDom : IntegralDomain ℤRing\nIntegralDomain.intDom ℤIntDom {a} {b} = intDom a b\nIntegralDomain.nontrivial ℤIntDom ()\n", "meta": {"hexsha": "d0a78cd19bbae1904734021270341ea54971243a", "size": 689, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numbers/Integers/RingStructure/IntegralDomain.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Numbers/Integers/RingStructure/IntegralDomain.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Numbers/Integers/RingStructure/IntegralDomain.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 36.2631578947, "max_line_length": 80, "alphanum_fraction": 0.7213352685, "num_tokens": 236, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9416541643004808, "lm_q2_score": 0.7090191337850932, "lm_q1q2_score": 0.6676508198974527}} {"text": "module CH where\n\ndata ℕ : Set where\n zero : ℕ\n succ : ℕ → ℕ\n\ninfixl 6 _+_\n_+_ : ℕ → ℕ → ℕ\nzero + m = m\n(succ n) + m = succ (n + m)\n\ninfix 4 _≡_\ndata _≡_ {A : Set} (x : A) : A → Set where\n refl : x ≡ x\n\n{-\nt1 : {n : ℕ} -> zero ≡ n\nt1 = refl\n-}\n\ndata _==_ {A : Set} : A → A → Set where\n refl' : (a : A) → a == a\n\nsym : ∀ x y → x == y → y == x\nsym .a .a (refl' a) = refl' a\n", "meta": {"hexsha": "d78a1fc1d3571ec426ae75ff329eaa34bbce6d8b", "size": 383, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "tests/covered/CH.agda", "max_stars_repo_name": "andrejtokarcik/agda-semantics", "max_stars_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-08-10T15:33:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-06T17:24:25.000Z", "max_issues_repo_path": "tests/covered/CH.agda", "max_issues_repo_name": "andrejtokarcik/agda-semantics", "max_issues_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/covered/CH.agda", "max_forks_repo_name": "andrejtokarcik/agda-semantics", "max_forks_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 14.7307692308, "max_line_length": 42, "alphanum_fraction": 0.4464751958, "num_tokens": 183, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9416541626630935, "lm_q2_score": 0.7090191214879992, "lm_q1q2_score": 0.6676508071569041}} {"text": "module product where\n\nopen import level\nopen import unit public\n\n----------------------------------------------------------------------\n-- types\n----------------------------------------------------------------------\n\ndata Σ {ℓ ℓ'} (A : Set ℓ) (B : A → Set ℓ') : Set (ℓ ⊔ ℓ') where\n _,_ : (a : A) → (b : B a) → Σ A B\n\ndata Σi {ℓ ℓ'} (A : Set ℓ) (B : A → Set ℓ') : Set (ℓ ⊔ ℓ') where\n ,_ : {a : A} → (b : B a) → Σi A B\n_×_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ ⊔ ℓ')\nA × B = Σ A (λ x → B)\n\n_i×_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ ⊔ ℓ')\nA i× B = Σi A (λ x → B)\n\n----------------------------------------------------------------------\n-- syntax\n----------------------------------------------------------------------\n\ninfix 2 Σ-syntax\ninfixr 3 _×_ _i×_ _∧_\ninfixr 4 _,_ \ninfix 4 ,_\n\n-- This provides the syntax: Σ[ x ∈ A ] B it is taken from the Agda\n-- standard library. This style is nice when working in Set.\nΣ-syntax : ∀ {a b} (A : Set a) → (A → Set b) → Set (a ⊔ b)\nΣ-syntax = Σ\n\nsyntax Σ-syntax A (λ x → B) = Σ[ x ∈ A ] B\n\n----------------------------------------------------------------------\n-- operations\n----------------------------------------------------------------------\nfst : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} → A × B → A\nfst (a , b) = a\n\nsnd : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} → A × B → B\nsnd (a , b) = b\n\ntrans-× : ∀{ℓ₁ ℓ₂ ℓ₃}\n {A : Set ℓ₁}{B : Set ℓ₂}\n {C : Set ℓ₃}\n → (C → A)\n → (C → B)\n → (C → A × B)\ntrans-× f g c = f c , g c\n\n⟨_,_⟩ : ∀{ℓ₁ ℓ₂ ℓ₃ ℓ₄}\n {A : Set ℓ₁}{B : Set ℓ₂}\n {C : Set ℓ₃}{D : Set ℓ₄}\n → (A → C)\n → (B → D)\n → (A × B → C × D)\n⟨ f , g ⟩ (a , b) = f a , g b\n\ntwist-× : ∀{ℓ₁ ℓ₂}\n {A : Set ℓ₁}{B : Set ℓ₂}\n → A × B\n → B × A\ntwist-× (a , b) = (b , a) \n\nrl-assoc-× : ∀{ℓ₁ ℓ₂ ℓ₃}\n {A : Set ℓ₁}{B : Set ℓ₂}\n {C : Set ℓ₃}\n → A × (B × C)\n → (A × B) × C\nrl-assoc-× (a , b , c) = ((a , b) , c)\n\nlr-assoc-× : ∀{ℓ₁ ℓ₂ ℓ₃}\n {A : Set ℓ₁}{B : Set ℓ₂}\n {C : Set ℓ₃}\n → (A × B) × C\n → A × (B × C)\nlr-assoc-× ((a , b) , c) = (a , b , c)\n\nfunc-× : ∀{ℓ₁ ℓ₂ ℓ₃ ℓ₄}{A : Set ℓ₁}{B : Set ℓ₂}{C : Set ℓ₃}{D : Set ℓ₄} → (A → C) → (B → D) → (A × B) → (C × D)\nfunc-× f g (x , y) = (f x , g y)\n\n×-diag : ∀{ℓ}{X : Set ℓ} → X → X × X\n×-diag x = (x , x)\n\n----------------------------------------------------------------------\n-- some logical notation\n----------------------------------------------------------------------\n_∧_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ ⊔ ℓ')\n_∧_ = _×_\n\n∃ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : A → Set ℓ') → Set (ℓ ⊔ ℓ')\n∃ = Σ\n\n∃i : ∀ {ℓ ℓ'} (A : Set ℓ) (B : A → Set ℓ') → Set (ℓ ⊔ ℓ')\n∃i = Σi\n\n", "meta": {"hexsha": "0241a38273fde17e6b0735efff5e914edd374790", "size": 2711, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "product.agda", "max_stars_repo_name": "heades/AUGL", "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "product.agda", "max_issues_repo_name": "heades/AUGL", "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "product.agda", "max_forks_repo_name": "heades/AUGL", "max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.11, "max_line_length": 111, "alphanum_fraction": 0.3068978237, "num_tokens": 1130, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8947894661025424, "lm_q2_score": 0.746138993030751, "lm_q1q2_score": 0.6676373112122743}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.NaturalTransformation.NaturalIsomorphism.Functors where\n\nopen import Level\n\nopen import Categories.Category\nopen import Categories.Category.Construction.Functors\nopen import Categories.Functor\nopen import Categories.NaturalTransformation.NaturalIsomorphism\n\nimport Categories.Morphism as Mor\n\nprivate\n variable\n o ℓ e : Level\n C D : Category o ℓ e\n\n-- isomorphism in Functors category is the same as natural isomorphism\nmodule _ {F G : Functor C D} where\n open Mor (Functors C D)\n\n Functors-iso⇒NI : F ≅ G → NaturalIsomorphism F G\n Functors-iso⇒NI F≅G = record\n { F⇒G = from\n ; F⇐G = to\n ; iso = λ X → record\n { isoˡ = isoˡ\n ; isoʳ = isoʳ\n }\n }\n where open Mor._≅_ F≅G\n\n NI⇒Functors-iso : NaturalIsomorphism F G → F ≅ G\n NI⇒Functors-iso α = record\n { from = F⇒G\n ; to = F⇐G\n ; iso = record\n { isoˡ = isoˡ (iso _)\n ; isoʳ = isoʳ (iso _)\n }\n }\n where open NaturalIsomorphism α\n open Mor.Iso\n", "meta": {"hexsha": "8e1f28a0754663009b77a71bbe9635ca4853269a", "size": 1027, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Functors.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Functors.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Functors.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 22.8222222222, "max_line_length": 73, "alphanum_fraction": 0.6543330088, "num_tokens": 341, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.901920681802153, "lm_q2_score": 0.7401743735019595, "lm_q1q2_score": 0.6675785756013688}} {"text": "\nmodule Prelude.Functor where\n\nopen import Agda.Primitive\nopen import Prelude.Function\nopen import Prelude.Equality\n\nrecord Functor {a b} (F : Set a → Set b) : Set (lsuc a ⊔ b) where\n infixl 4 _<$>_ _<$_\n field\n fmap : ∀ {A B} → (A → B) → F A → F B\n _<$>_ = fmap\n\n _<$_ : ∀ {A B} → A → F B → F A\n x <$ m = fmap (const x) m\n\nopen Functor {{...}} public\n\n{-# DISPLAY Functor.fmap _ = fmap #-}\n{-# DISPLAY Functor._<$>_ _ = _<$>_ #-}\n{-# DISPLAY Functor._<$_ _ = _<$_ #-}\n\n-- Level polymorphic functors\nrecord Functor′ {a b} (F : ∀ {a} → Set a → Set a) : Set (lsuc (a ⊔ b)) where\n infixl 4 _<$>′_ _<$′_\n field\n fmap′ : {A : Set a} {B : Set b} → (A → B) → F A → F B\n _<$>′_ = fmap′\n\n _<$′_ : {A : Set a} {B : Set b} → B → F A → F B\n x <$′ m = fmap′ (const x) m\n\nopen Functor′ {{...}} public\n\ninfixr 0 flip-fmap\nsyntax flip-fmap a (λ x → y) = for x ← a return y\nflip-fmap : ∀ {a b} {F : Set a → Set b} {{_ : Functor F}} {A B} → F A → (A → B) → F B\nflip-fmap x f = fmap f x\n\ninfixr 0 caseF_of_\ncaseF_of_ : ∀ {a b} {F : Set a → Set b} {{_ : Functor F}} {A B} → F A → (A → B) → F B\ncaseF_of_ x f = fmap f x\n\nfor = caseF_of_\n\n{-# INLINE for #-}\n{-# INLINE caseF_of_ #-}\n\n-- Congruence for _<$>_ --\n\ninfixl 4 _=$=_ _=$=′_\n_=$=_ : ∀ {a b} {A B : Set a} {F : Set a → Set b} {{_ : Functor F}} {x y : F A}\n (f : A → B) → x ≡ y → (f <$> x) ≡ (f <$> y)\nf =$= refl = refl\n\n_=$=′_ : ∀ {a b} {A : Set a} {B : Set b} {F : ∀ {a} → Set a → Set a} {{_ : Functor′ F}} {x y : F A}\n (f : A → B) → x ≡ y → (f <$>′ x) ≡ (f <$>′ y)\nf =$=′ refl = refl\n", "meta": {"hexsha": "59b1243121a3dca7dfdc2768a67b7f3e31cf758b", "size": 1560, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Prelude/Functor.agda", "max_stars_repo_name": "L-TChen/agda-prelude", "max_stars_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 111, "max_stars_repo_stars_event_min_datetime": "2015-01-05T11:28:15.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-12T23:29:26.000Z", "max_issues_repo_path": "src/Prelude/Functor.agda", "max_issues_repo_name": "L-TChen/agda-prelude", "max_issues_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 59, "max_issues_repo_issues_event_min_datetime": "2016-02-09T05:36:44.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-14T07:32:36.000Z", "max_forks_repo_path": "src/Prelude/Functor.agda", "max_forks_repo_name": "L-TChen/agda-prelude", "max_forks_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 24, "max_forks_repo_forks_event_min_datetime": "2015-03-12T18:03:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-22T06:10:41.000Z", "avg_line_length": 26.4406779661, "max_line_length": 99, "alphanum_fraction": 0.4846153846, "num_tokens": 655, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.880797068590724, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.6674630656311963}} {"text": "open import Coinduction using ( ♭ )\nopen import Data.Product using ( _,_ )\nopen import Relation.Binary using ( Poset )\nopen import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; sym ; trans ; cong ; subst₂ ) renaming ( setoid to ≡-setoid )\nopen import System.IO.Transducers using ( _⇒_ ; inp ; out ; done ; ⟦_⟧ ; _≃_ ; _≲_ ; _⟫_ )\nopen import System.IO.Transducers.Session using ( Session )\nopen import System.IO.Transducers.Trace using ( Trace ; [] ; _∷_ ; _⊑_ )\nopen import System.IO.Transducers.Properties.Category using ( ⟫-semantics )\n\nimport Relation.Binary.PartialOrderReasoning\n\nmodule System.IO.Transducers.Properties.TwoCategory where\n\n-- The category is poset-enriched, with order inherited from prefix order on traces.\n\n-- Reflexivity\n\n⊑-refl : ∀ {S} (as : Trace S) → (as ⊑ as)\n⊑-refl [] = []\n⊑-refl (a ∷ as) = (a ∷ ⊑-refl as)\n\n≡-impl-⊑ : ∀ {S} {as bs : Trace S} → (as ≡ bs) → (as ⊑ bs)\n≡-impl-⊑ refl = ⊑-refl _\n\n≲-refl : ∀ {S T} (f : Trace S → Trace T) → (f ≲ f)\n≲-refl f as = ⊑-refl (f as)\n\n≃-impl-≲ : ∀ {S T} {f g : Trace S → Trace T} → (f ≃ g) → (f ≲ g)\n≃-impl-≲ f≃g as = ≡-impl-⊑ (f≃g as)\n\n-- Transitivity\n\n⊑-trans : ∀ {S} {as bs cs : Trace S} → (as ⊑ bs) → (bs ⊑ cs) → (as ⊑ cs)\n⊑-trans [] bs = []\n⊑-trans (a ∷ as) (.a ∷ bs) = (a ∷ ⊑-trans as bs)\n\n≲-trans : ∀ {S T} {f g h : Trace S → Trace T} → (f ≲ g) → (g ≲ h) → (f ≲ h)\n≲-trans f≲g g≲h as = ⊑-trans (f≲g as) (g≲h as)\n\n-- Antisymmetry\n\n⊑-antisym : ∀ {S} {as bs : Trace S} → (as ⊑ bs) → (bs ⊑ as) → (as ≡ bs)\n⊑-antisym [] [] = refl\n⊑-antisym (a ∷ as) (.a ∷ bs) = cong (_∷_ a) (⊑-antisym as bs)\n\n≲-antisym : ∀ {S T} {f g : Trace S → Trace T} → (f ≲ g) → (g ≲ f) → (f ≃ g)\n≲-antisym f≲g g≲f as = ⊑-antisym (f≲g as) (g≲f as)\n\n-- ⊑ and ≲ form posets\n\n⊑-poset : Session → Poset _ _ _ \n⊑-poset S = record \n { Carrier = Trace S\n ; _≈_ = _≡_\n ; _≤_ = _⊑_\n ; isPartialOrder = record\n { antisym = ⊑-antisym\n ; isPreorder = record\n { reflexive = ≡-impl-⊑\n ; trans = ⊑-trans\n ; ∼-resp-≈ = ((λ bs≡cs → subst₂ _⊑_ refl bs≡cs) , (λ as≡bs → subst₂ _⊑_ as≡bs refl))\n ; isEquivalence = Relation.Binary.Setoid.isEquivalence (≡-setoid (Trace S))\n }\n }\n }\n\n≲-poset : Session → Session → Poset _ _ _ \n≲-poset S T = record \n { Carrier = (Trace S → Trace T)\n ; _≈_ = _≃_\n ; _≤_ = _≲_\n ; isPartialOrder = record\n { antisym = ≲-antisym\n ; isPreorder = record\n { reflexive = ≃-impl-≲\n ; trans = ≲-trans\n ; ∼-resp-≈ = (λ P≃Q P≲R as → subst₂ _⊑_ refl (P≃Q as) (P≲R as)) , λ Q≃R Q≲P as → subst₂ _⊑_ (Q≃R as) refl (Q≲P as)\n ; isEquivalence = record\n { refl = λ as → refl\n ; sym = λ P≃Q as → sym (P≃Q as)\n ; trans = λ P≃Q Q≃R as → trans (P≃Q as) (Q≃R as)\n }\n }\n }\n }\n\n-- Inequational reasoning\n\nmodule ⊑-Reasoning {S} where\n open Relation.Binary.PartialOrderReasoning (⊑-poset S) public renaming ( _≤⟨_⟩_ to _⊑⟨_⟩_ ; _≈⟨_⟩_ to _≡⟨_⟩_ )\n\nmodule ≲-Reasoning {S T} where\n open Relation.Binary.PartialOrderReasoning (≲-poset S T) public renaming ( _≤⟨_⟩_ to _≲⟨_⟩_ ; _≈⟨_⟩_ to _≃⟨_⟩_ )\n\nopen ⊑-Reasoning\n\n-- Processes are ⊑-monotone\n\nP-monotone : ∀ {S T as bs} → (P : S ⇒ T) → (as ⊑ bs) → (⟦ P ⟧ as ⊑ ⟦ P ⟧ bs)\nP-monotone (inp F) [] = []\nP-monotone (inp F) (a ∷ as⊑bs) = P-monotone (♭ F a) as⊑bs\nP-monotone (out b P) as⊑bs = b ∷ P-monotone P as⊑bs\nP-monotone done as⊑bs = as⊑bs\n\n-- Composition is ≲-monotone\n\n⟫-monotone : ∀ {S T U} (P₁ P₂ : S ⇒ T) (Q₁ Q₂ : T ⇒ U) → \n (⟦ P₁ ⟧ ≲ ⟦ P₂ ⟧) → (⟦ Q₁ ⟧ ≲ ⟦ Q₂ ⟧) → \n (⟦ P₁ ⟫ Q₁ ⟧ ≲ ⟦ P₂ ⟫ Q₂ ⟧)\n⟫-monotone P₁ P₂ Q₁ Q₂ P₁≲P₂ Q₁≲Q₂ as = \n begin\n ⟦ P₁ ⟫ Q₁ ⟧ as\n ≡⟨ ⟫-semantics P₁ Q₁ as ⟩\n ⟦ Q₁ ⟧ (⟦ P₁ ⟧ as)\n ⊑⟨ P-monotone Q₁ (P₁≲P₂ as) ⟩\n ⟦ Q₁ ⟧ (⟦ P₂ ⟧ as)\n ⊑⟨ Q₁≲Q₂ (⟦ P₂ ⟧ as) ⟩\n ⟦ Q₂ ⟧ (⟦ P₂ ⟧ as)\n ≡⟨ sym (⟫-semantics P₂ Q₂ as) ⟩\n ⟦ P₂ ⟫ Q₂ ⟧ as\n ∎", "meta": {"hexsha": "183e8c3791a8f12458e4a0a003ea28dccd84914e", "size": 3817, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/System/IO/Transducers/Properties/TwoCategory.agda", "max_stars_repo_name": "ilya-fiveisky/agda-system-io", "max_stars_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2015-01-04T13:45:16.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-15T04:35:41.000Z", "max_issues_repo_path": "src/System/IO/Transducers/Properties/TwoCategory.agda", "max_issues_repo_name": "ilya-fiveisky/agda-system-io", "max_issues_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/System/IO/Transducers/Properties/TwoCategory.agda", "max_forks_repo_name": "ilya-fiveisky/agda-system-io", "max_forks_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2017-08-10T06:12:54.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:40:23.000Z", "avg_line_length": 31.5454545455, "max_line_length": 132, "alphanum_fraction": 0.5341891538, "num_tokens": 1799, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767906859264, "lm_q2_score": 0.760650658103136, "lm_q1q2_score": 0.6674532983054777}} {"text": "{-# OPTIONS --cubical --safe #-}\nmodule Cubical.Data.Unit.Properties where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Unit.Base\n\nisContrUnit : isContr Unit\nisContrUnit = tt , λ {tt → refl}\n\nisPropUnit : isProp Unit\nisPropUnit _ _ i = tt -- definitionally equal to: isContr→isProp isContrUnit\n\nisOfHLevelUnit : (n : ℕ) → isOfHLevel n Unit\nisOfHLevelUnit n = isContr→isOfHLevel n isContrUnit\n", "meta": {"hexsha": "606a88c78a055ba5a7fa8f345e5b648917d71236", "size": 520, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/Unit/Properties.agda", "max_stars_repo_name": "borsiemir/cubical", "max_stars_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/Unit/Properties.agda", "max_issues_repo_name": "borsiemir/cubical", "max_issues_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/Unit/Properties.agda", "max_forks_repo_name": "borsiemir/cubical", "max_forks_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.0, "max_line_length": 76, "alphanum_fraction": 0.7788461538, "num_tokens": 151, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8774767746654974, "lm_q2_score": 0.7606506581031359, "lm_q1q2_score": 0.6674532861195277}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Adjoint.Instance.0-Truncation where\n\n-- The adjunction between 0-truncation and the inclusion functor from\n-- Setoids to Categories/Groupoids.\n\nopen import Level using (Lift)\nopen import Data.Unit using (⊤)\nimport Function\nopen import Relation.Binary using (Setoid)\nopen import Function.Equality using (Π) renaming (id to idΠ)\n\nopen import Categories.Adjoint using (_⊣_)\nopen import Categories.Category.Construction.0-Groupoid using (0-Groupoid)\nopen import Categories.Category.Groupoid using (Groupoid)\nopen import Categories.Category.Instance.Groupoids using (Groupoids)\nopen import Categories.Category.Instance.Setoids using (Setoids)\nopen import Categories.Functor renaming (id to idF)\nopen import Categories.Functor.Instance.0-Truncation using (Trunc)\nopen import Categories.NaturalTransformation using (NaturalTransformation; ntHelper)\nopen import Categories.NaturalTransformation.NaturalIsomorphism using (refl)\n\n-- The inclusion functor from Setoids to Groupoids\n\nInclusion : ∀ {c ℓ} e → Functor (Setoids c ℓ) (Groupoids c ℓ e)\nInclusion {c} {ℓ} e = record\n { F₀ = 0-Groupoid e\n ; F₁ = λ f → record { F₀ = f ⟨$⟩_ ; F₁ = cong f }\n ; identity = refl\n ; homomorphism = refl\n ; F-resp-≈ = λ {S T f g} f≗g →\n let module S = Setoid S\n module T = Setoid T\n in record\n { F⇒G = record { η = λ _ → f≗g S.refl }\n ; F⇐G = record { η = λ _ → T.sym (f≗g S.refl) }\n }\n }\n where open Π\n\n-- Trunc is left-adjoint to the inclusion functor from Setoids to Groupoids\n\nTruncAdj : ∀ {o ℓ e} → Trunc ⊣ Inclusion {o} {ℓ} e\nTruncAdj {o} {ℓ} {e} = record\n { unit = unit\n ; counit = counit\n ; zig = Function.id\n ; zag = refl\n }\n where\n open Π\n open Groupoid using (category)\n\n unit : NaturalTransformation idF (Inclusion e ∘F Trunc)\n unit = record\n { η = λ _ → record { F₀ = Function.id ; F₁ = Function.id }\n ; commute = λ _ → refl\n ; sym-commute = λ _ → refl\n }\n\n counit : NaturalTransformation (Trunc ∘F Inclusion e) idF\n counit = ntHelper record { η = λ S → idΠ ; commute = λ f → cong f }\n", "meta": {"hexsha": "3d0a60b0e1e40effb03dab5360ee5209a1c5a4e4", "size": 2158, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Adjoint/Instance/0-Truncation.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Adjoint/Instance/0-Truncation.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Adjoint/Instance/0-Truncation.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 33.71875, "max_line_length": 84, "alphanum_fraction": 0.6668211307, "num_tokens": 652, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8774767810736693, "lm_q2_score": 0.7606506418255927, "lm_q1q2_score": 0.6674532767107417}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Some derivable properties\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nopen import Algebra\n\nmodule Algebra.Properties.AbelianGroup\n {g₁ g₂} (G : AbelianGroup g₁ g₂) where\n\nopen AbelianGroup G\nopen import Function\nopen import Relation.Binary.Reasoning.Setoid setoid\n\n------------------------------------------------------------------------\n-- Publicly re-export group properties\n\nopen import Algebra.Properties.Group group public\n\n------------------------------------------------------------------------\n-- Properties of abelian groups\n\nprivate\n\n lemma₁ : ∀ x y → x ∙ y ∙ x ⁻¹ ≈ y\n lemma₁ x y = begin\n x ∙ y ∙ x ⁻¹ ≈⟨ ∙-congʳ $ comm _ _ ⟩\n y ∙ x ∙ x ⁻¹ ≈⟨ assoc _ _ _ ⟩\n y ∙ (x ∙ x ⁻¹) ≈⟨ ∙-congˡ $ inverseʳ _ ⟩\n y ∙ ε ≈⟨ identityʳ _ ⟩\n y ∎\n\n lemma₂ : ∀ x y → x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ≈ y ⁻¹\n lemma₂ x y = begin\n x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ≈˘⟨ assoc _ _ _ ⟩\n x ∙ (y ∙ (x ∙ y) ⁻¹) ∙ y ⁻¹ ≈˘⟨ ∙-congʳ $ assoc _ _ _ ⟩\n x ∙ y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹ ≈⟨ ∙-congʳ $ inverseʳ _ ⟩\n ε ∙ y ⁻¹ ≈⟨ identityˡ _ ⟩\n y ⁻¹ ∎\n\n⁻¹-∙-comm : ∀ x y → x ⁻¹ ∙ y ⁻¹ ≈ (x ∙ y) ⁻¹\n⁻¹-∙-comm x y = begin\n x ⁻¹ ∙ y ⁻¹ ≈⟨ comm _ _ ⟩\n y ⁻¹ ∙ x ⁻¹ ≈˘⟨ ∙-congʳ $ lemma₂ x y ⟩\n x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ∙ x ⁻¹ ≈⟨ lemma₁ _ _ ⟩\n y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹ ≈⟨ lemma₁ _ _ ⟩\n (x ∙ y) ⁻¹ ∎\n", "meta": {"hexsha": "73cbdf60b5e878500f7331d8cdb1ee6b49f40057", "size": 1634, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/AbelianGroup.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/AbelianGroup.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/AbelianGroup.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.0392156863, "max_line_length": 72, "alphanum_fraction": 0.3671970624, "num_tokens": 639, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772351648677, "lm_q2_score": 0.7634837635542924, "lm_q1q2_score": 0.6673437771408034}} {"text": "---------------------------------------------\n-- Consequences of the axiom of regularity\n---------------------------------------------\n{-# OPTIONS --allow-unsolved-meta #-}\n\nmodule sv20.assign2.SetTheory.Regularity where\n\nopen import sv20.assign2.SetTheory.Logic\nopen import sv20.assign2.SetTheory.Algebra\nopen import sv20.assign2.SetTheory.Subset\nopen import sv20.assign2.SetTheory.ZAxioms\nopen import sv20.assign2.SetTheory.Pairs\n\n-- Theorem 105, p. 54\nA∉A : (A : 𝓢) → A ∉ A\nA∉A A h = cont _ (p₄ , notEmpty)\n where\n A∈Aₛ : A ∈ singleton A\n A∈Aₛ = singletonp₂ A\n\n A∈Aₛ∩A : A ∈ (singleton A ∩ A)\n A∈Aₛ∩A = ∩-d₂ _ _ _ (A∈Aₛ , h)\n\n notEmpty : (singleton A ∩ A) ≢ ∅\n notEmpty = prop-∅ A _ A∈Aₛ∩A\n\n Aₛ≢∅ : singleton A ≢ ∅\n Aₛ≢∅ x = prop-∅ _ _ A∈Aₛ x\n\n reg-step : ∃ (λ x → x ∈ singleton A ∧ ((y : 𝓢) → y ∈ x → y ∉ singleton A))\n reg-step = reg (singleton A) Aₛ≢∅\n\n aux : 𝓢\n aux = proj₁ reg-step\n\n aux-p : aux ∈ singleton A ∧ ((y : 𝓢) → y ∈ aux → y ∉ singleton A)\n aux-p = proj₂ _ reg-step\n\n p : aux ∈ singleton A\n p = ∧-proj₁ aux-p\n\n aux∈auxₛ : aux ∈ singleton aux\n aux∈auxₛ = singletonp₂ aux\n\n prop : A ∈ singleton aux → A ∩ singleton aux ≡ ∅\n prop = singletonp₄ A aux\n\n prop₂ : aux ≡ A\n prop₂ = singletonp _ p\n\n imp : A ∩ singleton aux ≡ ∅\n imp = prop (subs (λ w → w ∈ singleton aux) (prop₂) aux∈auxₛ)\n\n p₃ : singleton aux ∩ A ≡ ∅\n p₃ = subs (λ w → w ≡ ∅) (∩-sym _ _) imp\n\n p₄ : singleton A ∩ A ≡ ∅\n p₄ = subs (λ w → singleton w ∩ A ≡ ∅) prop₂ p₃\n\nreg-cons : (A B : 𝓢) → ¬ (A ∈ B ∧ B ∈ A)\nreg-cons A B h = {!!}\n where\n p₁ : A ∈ A ₚ B\n p₁ = pair-d₂ _ _ (inj₁ refl)\n\n p₂ : A ∈ B\n p₂ = ∧-proj₁ h\n\n p₃ : A ∈ A ₚ B ∩ B\n p₃ = ∩-d₂ _ _ _ (p₁ , p₂)\n\n p₄ : (A ₚ B) ≢ ∅\n p₄ = prop-∅ _ _ p₁\n\n reg-step : ∃ (λ x → x ∈ A ₚ B ∧ ((y : 𝓢) → y ∈ x → y ∉ A ₚ B))\n reg-step = {!!}\n\n x : 𝓢\n x = proj₁ reg-step\n\n x-p : x ∈ A ₚ B ∧ ((y : 𝓢) → y ∈ x → y ∉ A ₚ B)\n x-p = proj₂ _ reg-step\n\n p₆ : (A ₚ B ∩ x) ≡ ∅\n p₆ = {!!}\n\n p₇ : x ∈ A ₚ B\n p₇ = ∧-proj₁ x-p\n\n p₈ : x ≡ A ∨ x ≡ B\n p₈ = pair-d₁ _ _ p₇\n\n-- References\n--\n-- Suppes, Patrick (1960). Axiomatic Set Theory.\n-- The University Series in Undergraduate Mathematics.\n-- D. Van Nostrand Company, inc.\n--\n-- Enderton, Herbert B. (1977). Elements of Set Theory.\n-- Academic Press Inc.\n", "meta": {"hexsha": "6cc41f060d6a5a0ab9cebc8fd594bd6535e72c73", "size": 2259, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "proglangs-learning/Agda/sv20/assign2/SetTheory/Regularity.agda", "max_stars_repo_name": "helq/old_code", "max_stars_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "proglangs-learning/Agda/sv20/assign2/SetTheory/Regularity.agda", "max_issues_repo_name": "helq/old_code", "max_issues_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2020-03-10T19:20:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-07T15:39:48.000Z", "max_forks_repo_path": "proglangs-learning/Agda/sv20/assign2/SetTheory/Regularity.agda", "max_forks_repo_name": "helq/old_code", "max_forks_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.3663366337, "max_line_length": 76, "alphanum_fraction": 0.5374059318, "num_tokens": 991, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772286044095, "lm_q2_score": 0.7634837581726991, "lm_q1q2_score": 0.667343767428072}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\n\nopen import Cubical.Core.Everything\nopen import Cubical.Algebra.Magma\n\nmodule Cubical.Algebra.Magma.Construct.Opposite {ℓ} (M : Magma ℓ) where\n\nopen import Cubical.Foundations.Prelude\n\nopen Magma M\n\n_•ᵒᵖ_ : Op₂ Carrier\ny •ᵒᵖ x = x • y\n\n\nOp-isMagma : IsMagma Carrier _•ᵒᵖ_\nOp-isMagma = record { is-set = is-set }\n\nMᵒᵖ : Magma ℓ\nMᵒᵖ = record { isMagma = Op-isMagma }\n", "meta": {"hexsha": "75d317fe5b751e2c765b986c467593241a236b35", "size": 417, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Magma/Construct/Opposite.agda", "max_stars_repo_name": "bijan2005/univalent-foundations", "max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/Magma/Construct/Opposite.agda", "max_issues_repo_name": "bijan2005/univalent-foundations", "max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/Magma/Construct/Opposite.agda", "max_forks_repo_name": "bijan2005/univalent-foundations", "max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.8571428571, "max_line_length": 71, "alphanum_fraction": 0.7122302158, "num_tokens": 164, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8872045996818986, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.6671890144583151}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.CommAlgebra.Ideal where\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Powerset\n\nopen import Cubical.Algebra.CommRing\nopen import Cubical.Algebra.CommRing.Ideal renaming (IdealsIn to IdealsInCommRing;\n makeIdeal to makeIdealCommRing)\nopen import Cubical.Algebra.CommAlgebra\n\nprivate\n variable\n ℓ : Level\n\nmodule _ {R : CommRing ℓ} (A : CommAlgebra R ℓ) where\n IdealsIn : Type _\n IdealsIn = IdealsInCommRing (CommAlgebra→CommRing A)\n\n open CommAlgebraStr (snd A)\n\n makeIdeal : (I : fst A → hProp ℓ)\n → (+-closed : {x y : fst A} → x ∈ I → y ∈ I → (x + y) ∈ I)\n → (0-closed : 0a ∈ I)\n → (·-closedLeft : {x : fst A} → (r : fst A) → x ∈ I → r · x ∈ I)\n → IdealsIn\n makeIdeal = makeIdealCommRing {R = CommAlgebra→CommRing A}\n", "meta": {"hexsha": "8176c3c7a9fe31cc03b29339a56d734f65677968", "size": 943, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/CommAlgebra/Ideal.agda", "max_stars_repo_name": "howsiyu/cubical", "max_stars_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/CommAlgebra/Ideal.agda", "max_issues_repo_name": "howsiyu/cubical", "max_issues_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/CommAlgebra/Ideal.agda", "max_forks_repo_name": "howsiyu/cubical", "max_forks_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.6785714286, "max_line_length": 84, "alphanum_fraction": 0.624602333, "num_tokens": 282, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045996818986, "lm_q2_score": 0.752012562644147, "lm_q1q2_score": 0.667189004596459}} {"text": "\nmodule Div2 where\n\nrecord True : Set where\n\ndata False : Set where\n\ndata Nat : Set where\n zero : Nat\n suc : Nat -> Nat\n\nNonZero : Nat -> Set\nNonZero zero = False\nNonZero (suc _) = True\n\ndivHelp : Nat -> Nat -> Nat -> Nat\ndivHelp zero zero c = suc zero\ndivHelp zero (suc y) c = zero\ndivHelp (suc x) zero c = suc (divHelp x c c)\ndivHelp (suc x) (suc y) c = divHelp x y c\n\ndiv : (x y : Nat) -> {p : NonZero y} -> Nat\ndiv x zero {}\ndiv zero (suc y) = zero\ndiv (suc x) (suc y) = divHelp (suc x) (suc y) y\n\nn1 = suc zero\nn2 = suc n1\nn3 = suc n2\nn4 = suc n3\nn5 = suc n4\nn6 = suc n5\nn7 = suc n6\nn8 = suc n7\nn9 = suc n8\nn10 = suc n9\nn11 = suc n10\nn12 = suc n11\n\ntest1 : Nat\ntest1 = div n12 n7\n\n", "meta": {"hexsha": "cd2224be080cfed5fb524d6ecabf83b3a8b3ec86", "size": 715, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Div2.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Div2.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Div2.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 16.6279069767, "max_line_length": 47, "alphanum_fraction": 0.593006993, "num_tokens": 299, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9284087965937711, "lm_q2_score": 0.7185943985973772, "lm_q1q2_score": 0.6671493608408156}} {"text": "{-# OPTIONS --without-K #-}\nmodule PathStructure.Nat where\n\nopen import Equivalence\nopen import PathOperations\nopen import Types\n\nF : ℕ → ℕ → Set\nF = ind (λ _ → ℕ → Set)\n (λ _ r → ind (λ _ → Set) (λ n-1 _ → r n-1) ⊥)\n ( ind (λ _ → Set) (λ _ _ → ⊥) ⊤)\n\nF-lemma : ∀ n → F n n\nF-lemma = ind (λ n → F n n) (λ _ f → f) _\n\n-- Explicit arguments to prevent code littered with curly brackets.\nsplit-path : ∀ x y → x ≡ y → F x y\nsplit-path x _ p = tr (F x) p (F-lemma x)\n\nmerge-path : ∀ x y → F x y → x ≡ y\nmerge-path _ _ f = ind\n (λ x → ∀ y → F x y → x ≡ y)\n (λ x r → ind\n (λ y → F (suc x) y → suc x ≡ y)\n (λ _ _ f → ap suc (r _ f))\n 0-elim)\n (ind\n (λ y → F zero y → zero ≡ y)\n (λ _ _ → 0-elim)\n (λ _ → refl))\n _ _ f\n\n-- Lemmas.\nap-refl : ∀ {n} (p : n ≡ n) → p ≡ refl →\n ap suc p ≡ refl\nap-refl _ = J\n (λ p q _ → J (λ x y _ → suc x ≡ suc y) (λ _ → refl) _ _ p ≡ ap suc q)\n (λ _ → refl) _ refl\n\ntr-ap : ∀ m n (f : F m n) →\n tr (F (suc m)) (ap suc (merge-path m n f)) (F-lemma (suc m))\n ≡ tr (F (suc m) ∘ suc) (merge-path m n f) (F-lemma (suc m))\ntr-ap m n f = J\n (λ x y p → tr (F (suc x)) (ap suc p) (F-lemma (suc x))\n ≡ tr (F (suc x) ∘ suc) p (F-lemma (suc x)))\n (λ _ → refl)\n _ _ (merge-path m n f)\n\nsplit-merge-eq : ∀ {x y} → (x ≡ y) ≃ F x y\nsplit-merge-eq {x = x} {y = y}\n = split-path _ _\n , (merge-path _ _ , λ f → ind\n (λ x → ∀ y (f : F x y) → split-path x y (merge-path x y f) ≡ f)\n (λ x r → ind\n (λ y → (f : F (suc x) y) →\n split-path (suc x) y (merge-path (suc x) y f) ≡ f)\n (λ y _ f → tr-ap x y f · r y f)\n (λ b → 0-elim b))\n (ind\n (λ y → (f : F zero y) →\n split-path zero y (merge-path zero y f) ≡ f)\n (λ _ _ b → 0-elim b)\n (λ _ → refl))\n x y f)\n , (merge-path _ _ , J\n (λ _ _ p → merge-path _ _ (split-path _ _ p) ≡ p)\n (ind\n (λ x → merge-path x x (split-path x x refl) ≡ refl)\n (λ _ → ap-refl _)\n refl)\n _ _)\n", "meta": {"hexsha": "e430b4a65470cbf89211fb1203a657f5e4e0dbe3", "size": 2020, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/PathStructure/Nat.agda", "max_stars_repo_name": "vituscze/HoTT-lectures", "max_stars_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/PathStructure/Nat.agda", "max_issues_repo_name": "vituscze/HoTT-lectures", "max_issues_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/PathStructure/Nat.agda", "max_forks_repo_name": "vituscze/HoTT-lectures", "max_forks_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.0555555556, "max_line_length": 71, "alphanum_fraction": 0.4574257426, "num_tokens": 849, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952975813454, "lm_q2_score": 0.74316801430083, "lm_q1q2_score": 0.6671384317507211}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\n-- Skew closed structure on a category\nmodule SOAS.Construction.Skew.SkewClosed {o ℓ e} (C : Category o ℓ e) where\n\nprivate\n module C = Category C\n open C\n variable\n A B X X′ Y Y′ Z Z′ U ℐ : Obj\n f g : A ⇒ B\n\n open Commutation C\n\nopen import Level\nopen import Data.Product using (Σ; _,_)\nopen import Function.Equality using (_⟶_)\nopen import Function.Inverse using (_InverseOf_; Inverse)\n\nopen import Categories.Category.Product\nopen import Categories.Functor renaming (id to idF)\nopen import Categories.Functor.Bifunctor\nopen import Categories.Functor.Construction.Constant\nopen import Categories.NaturalTransformation\nopen import Categories.NaturalTransformation.NaturalIsomorphism\nopen import Categories.NaturalTransformation.Dinatural\n\nrecord SkewClosed : Set (levelOfTerm C) where\n field\n -- internal hom\n [-,-] : Bifunctor C.op C C\n unit : Obj\n\n [_,-] : Obj → Functor C C\n [_,-] = appˡ [-,-]\n\n [-,_] : Obj → Functor C.op C\n [-,_] = appʳ [-,-]\n\n module [-,-] = Functor [-,-]\n\n [_,_]₀ : Obj → Obj → Obj\n [ X , Y ]₀ = [-,-].F₀ (X , Y)\n\n [_,_]₁ : A ⇒ B → X ⇒ Y → [ B , X ]₀ ⇒ [ A , Y ]₀\n [ f , g ]₁ = [-,-].F₁ (f , g)\n\n field\n -- i\n identity : NaturalTransformation [ unit ,-] idF\n -- j\n diagonal : Extranaturalʳ unit [-,-]\n\n module identity = NaturalTransformation identity\n module diagonal = DinaturalTransformation diagonal\n\n [[X,-],[X,-]] : Obj → Bifunctor C.op C C\n [[X,-],[X,-]] X = [-,-] ∘F (Functor.op [ X ,-] ⁂ [ X ,-])\n\n [[-,Y],[-,Z]] : Obj → Obj → Bifunctor C C.op C\n [[-,Y],[-,Z]] Y Z = [-,-] ∘F ((Functor.op [-, Y ]) ⁂ [-, Z ])\n\n -- L needs to be natural in Y and Z.\n -- it is better to spell out the conditions and then prove that indeed\n -- the naturality conditions hold.\n field\n L : ∀ X Y Z → [ Y , Z ]₀ ⇒ [ [ X , Y ]₀ , [ X , Z ]₀ ]₀\n L-commute : [ [ Y , Z ]₀ ⇒ [ [ X , Y′ ]₀ , [ X , Z′ ]₀ ]₀ ]⟨\n [ f , g ]₁ ⇒⟨ [ Y′ , Z′ ]₀ ⟩\n L X Y′ Z′\n ≈ L X Y Z ⇒⟨ [ [ X , Y ]₀ , [ X , Z ]₀ ]₀ ⟩\n [ [ C.id , f ]₁ , [ C.id , g ]₁ ]₁\n ⟩\n\n L-natural : NaturalTransformation [-,-] ([[X,-],[X,-]] X)\n L-natural {X} = ntHelper record\n { η = λ where\n (Y , Z) → L X Y Z\n ; commute = λ _ → L-commute\n }\n\n module L-natural {X} = NaturalTransformation (L-natural {X})\n\n -- other required diagrams\n field\n Lj≈j : [ unit ⇒ [ [ X , Y ]₀ , [ X , Y ]₀ ]₀ ]⟨\n diagonal.α Y ⇒⟨ [ Y , Y ]₀ ⟩\n L X Y Y\n ≈ diagonal.α [ X , Y ]₀\n ⟩\n ijL≈id : [ [ X , Y ]₀ ⇒ [ X , Y ]₀ ]⟨\n L X X Y ⇒⟨ [ [ X , X ]₀ , [ X , Y ]₀ ]₀ ⟩\n [ diagonal.α X , C.id ]₁ ⇒⟨ [ unit , [ X , Y ]₀ ]₀ ⟩\n identity.η [ X , Y ]₀\n ≈ C.id\n ⟩\n iL≈i : [ [ Y , Z ]₀ ⇒ [ [ unit , Y ]₀ , Z ]₀ ]⟨\n L unit Y Z ⇒⟨ [ [ unit , Y ]₀ , [ unit , Z ]₀ ]₀ ⟩\n [ C.id , identity.η Z ]₁\n ≈ [ identity.η Y , C.id ]₁\n ⟩\n\n ij≈id : [ unit ⇒ unit ]⟨\n diagonal.α unit ⇒⟨ [ unit , unit ]₀ ⟩\n identity.η unit\n ≈ C.id\n ⟩\n\n pentagon : [ [ U , ℐ ]₀ ⇒ [ [ Y , U ]₀ , [ [ X , Y ]₀ , [ X , ℐ ]₀ ]₀ ]₀ ]⟨\n L X U ℐ ⇒⟨ [ [ X , U ]₀ , [ X , ℐ ]₀ ]₀ ⟩\n L [ X , Y ]₀ [ X , U ]₀ [ X , ℐ ]₀ ⇒⟨ [ [ [ X , Y ]₀ , [ X , U ]₀ ]₀ , [ [ X , Y ]₀ , [ X , ℐ ]₀ ]₀ ]₀ ⟩\n [ L X Y U , C.id ]₁\n ≈ L Y U ℐ ⇒⟨ [ [ Y , U ]₀ , [ Y , ℐ ]₀ ]₀ ⟩\n [ C.id , L X Y ℐ ]₁\n ⟩\n", "meta": {"hexsha": "2a610c163a6db9558df5fec79450987fb58fedd4", "size": 3750, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "SOAS/Construction/Skew/SkewClosed.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "SOAS/Construction/Skew/SkewClosed.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "SOAS/Construction/Skew/SkewClosed.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 31.7796610169, "max_line_length": 121, "alphanum_fraction": 0.4421333333, "num_tokens": 1328, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952893703477, "lm_q2_score": 0.7431680086124812, "lm_q1q2_score": 0.6671384205421664}} {"text": "\nmodule Oscar.Class.Injectivity where\n\nopen import Oscar.Level\n\nrecord Injectivity {a} {A : Set a} {b} {B : Set b} {ℓ₁} (_≋₁_ : A → B → Set ℓ₁)\n {i} {I : Set i} {ℓ₂} (_≋₂_ : I → I → Set ℓ₂)\n (f : I → A)\n (g : I → B)\n : Set (a ⊔ b ⊔ ℓ₁ ⊔ i ⊔ ℓ₂) where\n field\n injectivity : ∀ {x y} → f x ≋₁ g y → x ≋₂ y\n\nopen Injectivity ⦃ … ⦄ public\n\nrecord Injectivityoid a b ℓ₁ i ℓ₂ : Set (lsuc (a ⊔ b ⊔ ℓ₁ ⊔ i ⊔ ℓ₂)) where\n field\n {A} : Set a\n {B} : Set b\n _≋₁_ : A → B → Set ℓ₁\n I : Set i\n _≋₂_ : I → I → Set ℓ₂\n μₗ : I → A\n μᵣ : I → B\n `injectivity : ∀ {x y} → μₗ x ≋₁ μᵣ y → x ≋₂ y\n", "meta": {"hexsha": "9c6f5e8996cdb820cfc72b19e0d78e32072686e1", "size": 661, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "archive/agda-2/Oscar/Class/Injectivity.agda", "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "archive/agda-2/Oscar/Class/Injectivity.agda", "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_forks_repo_path": "archive/agda-2/Oscar/Class/Injectivity.agda", "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.4230769231, "max_line_length": 79, "alphanum_fraction": 0.447806354, "num_tokens": 308, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.897695283896349, "lm_q2_score": 0.7431680029241321, "lm_q1q2_score": 0.6671384113676615}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Basic types related to coinduction\n------------------------------------------------------------------------\n\nmodule Coinduction where\n\nimport Level\n\n------------------------------------------------------------------------\n-- A type used to make recursive arguments coinductive\n\ninfix 1000 ♯_\n\npostulate\n ∞ : ∀ {a} (A : Set a) → Set a\n ♯_ : ∀ {a} {A : Set a} → A → ∞ A\n ♭ : ∀ {a} {A : Set a} → ∞ A → A\n\n{-# BUILTIN INFINITY ∞ #-}\n{-# BUILTIN SHARP ♯_ #-}\n{-# BUILTIN FLAT ♭ #-}\n\n------------------------------------------------------------------------\n-- Rec, a type which is analogous to the Rec type constructor used in\n-- ΠΣ (see Altenkirch, Danielsson, Löh and Oury. ΠΣ: Dependent Types\n-- without the Sugar. FLOPS 2010, LNCS 6009.)\n\ndata Rec {a} (A : ∞ (Set a)) : Set a where\n fold : (x : ♭ A) → Rec A\n\nunfold : ∀ {a} {A : ∞ (Set a)} → Rec A → ♭ A\nunfold (fold x) = x\n\n{-\n\n -- If --guardedness-preserving-type-constructors is enabled one can\n -- define types like ℕ by recursion:\n\n open import Data.Sum\n open import Data.Unit\n\n ℕ : Set\n ℕ = ⊤ ⊎ Rec (♯ ℕ)\n\n zero : ℕ\n zero = inj₁ _\n\n suc : ℕ → ℕ\n suc n = inj₂ (fold n)\n\n ℕ-rec : (P : ℕ → Set) →\n P zero →\n (∀ n → P n → P (suc n)) →\n ∀ n → P n\n ℕ-rec P z s (inj₁ _) = z\n ℕ-rec P z s (inj₂ (fold n)) = s n (ℕ-rec P z s n)\n\n -- This feature is very experimental, though: it may lead to\n -- inconsistencies.\n\n-}\n", "meta": {"hexsha": "9587fbbb2ebef6203543a028ae70429f0a47f54b", "size": 1533, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Coinduction.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Coinduction.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Coinduction.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.953125, "max_line_length": 72, "alphanum_fraction": 0.4520547945, "num_tokens": 466, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972784807408, "lm_q2_score": 0.7662936377487304, "lm_q1q2_score": 0.6671331555411513}} {"text": "open import Data.Bool using (Bool; true; false; _∧_; _∨_; T)\nopen import Data.Bool.Properties using (∨-identityˡ; ∨-zeroˡ)\nopen import Data.List using (List; []; _∷_; any; map; foldl)\nopen import Data.List.Relation.Unary.Any using (Any; here; there; lookup; satisfied)\nopen import Data.Product as Prod using (∃; _,_; proj₁; proj₂)\nopen import Data.Unit using (⊤; tt)\nopen import Relation.Binary.PropositionalEquality \n using (_≡_; refl; cong; subst; sym; trans; module ≡-Reasoning)\nopen import Relation.Binary.PropositionalEquality as P\nopen ≡-Reasoning using (begin_; _≡⟨⟩_; _≡⟨_⟩_; _∎)\nopen import Data.Nat using (ℕ; zero; suc)\n\n≡→T : ∀ {b : Bool} → b ≡ true → T b\n≡→T refl = tt\n\nany-val : ∀ {a} {A : Set a} (f) (ns : List A)\n → any f ns ≡ true\n → Any (λ x → T (f x)) ns\nany-val f (n ∷ ns) any-f-⟨n∷ns⟩≡true with f n | P.inspect f n\n... | true | P.[ fn≡t ] = here (≡→T fn≡t)\n... | false | _ = there (any-val f ns any-f-⟨n∷ns⟩≡true)\n\nget-val : ∀ {a} {A : Set a} {f} (ns : List A)\n → any f ns ≡ true\n → A\nget-val {_} {_} {f} ns any≡true = lookup {xs = ns} (any-val f ns any≡true)\n\nget-prop : ∀ {a} {A : Set a} {f} (ns : List A)\n → any f ns ≡ true\n → ∃ (λ x → T (f x))\nget-prop {_} {_} {f} ns any≡true = satisfied {xs = ns} (any-val f ns any≡true)\n\nis-not-zero : ℕ → Bool\nis-not-zero zero = false\nis-not-zero _ = true\n\neg1 : any is-not-zero (0 ∷ 0 ∷ 3 ∷ []) ≡ true\neg1 = refl\n--proj₁ (get-prop {f = λ x → x} (true ∷ false ∷ []) _)\n--proj₁ (get-prop {f = is-not-zero} (0 ∷ 0 ∷ 3 ∷ []) refl)\n\n\n--data Singleton {a} {A : Set a} (x : A) : Set a where\n-- _with≡_ : (y : A) → x ≡ y → Singleton x\n--\n--inspect : ∀ {a} {A : Set a} (x : A) → Singleton x\n--inspect x = x with≡ refl\n\n\nany-val' : ∀ {a} {A : Set a} (f : A → Bool) (ns : List A)\n → any f ns ≡ true\n → (∃ λ x → T (f x))\nany-val' f [] ()\nany-val' f (n ∷ ns) anyfnns≡true with f n | P.inspect f n\n... | true | P.[ fn≡t ] = n , ≡→T fn≡t\n... | false | P.[ fn≡f ] = any-val' f ns anyfnns≡true\n-- where\n-- anyfns≡true =\n-- begin\n-- any f ns ≡⟨ sym (∨-identityˡ (any f ns)) ⟩\n-- false ∨ any f ns ≡⟨ cong (_∨ any f ns) (sym ?) ⟩\n-- f n ∨ any f ns ≡⟨ anyfnns≡true ⟩\n-- true\n-- ∎\n", "meta": {"hexsha": "88c6955c76890f7148024d44cb596fee089caae7", "size": 2260, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "proglangs-learning/Agda/general-exercises/lifting-bool-to-property.agda", "max_stars_repo_name": "helq/old_code", "max_stars_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "proglangs-learning/Agda/general-exercises/lifting-bool-to-property.agda", "max_issues_repo_name": "helq/old_code", "max_issues_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2020-03-10T19:20:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-07T15:39:48.000Z", "max_forks_repo_path": "proglangs-learning/Agda/general-exercises/lifting-bool-to-property.agda", "max_forks_repo_name": "helq/old_code", "max_forks_repo_head_hexsha": "a432faf1b340cb379190a2f2b11b997b02d1cd8d", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.7692307692, "max_line_length": 84, "alphanum_fraction": 0.5318584071, "num_tokens": 906, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8705972616934408, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.6671331473237273}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import LogicalFormulae\nopen import Groups.Lemmas\nopen import Groups.Definition\nopen import Setoids.Setoids\nopen import Rings.Definition\nopen import Sets.EquivalenceRelations\nopen import Rings.IntegralDomains.Definition\n\nmodule Rings.IntegralDomains.Lemmas {m n : _} {A : Set n} {S : Setoid {n} {m} A} {_+_ _*_ : A → A → A} {R : Ring S _+_ _*_} (I : IntegralDomain R) where\n\nopen Setoid S\nopen Equivalence eq\nopen Ring R\n\ncancelIntDom : {a b c : A} → (a * b) ∼ (a * c) → ((a ∼ (Ring.0R R)) → False) → (b ∼ c)\ncancelIntDom {a} {b} {c} ab=ac a!=0 = transferToRight (Ring.additiveGroup R) t3\n where\n t1 : (a * b) + Group.inverse (Ring.additiveGroup R) (a * c) ∼ Ring.0R R\n t1 = transferToRight'' (Ring.additiveGroup R) ab=ac\n t2 : a * (b + Group.inverse (Ring.additiveGroup R) c) ∼ Ring.0R R\n t2 = transitive (transitive (Ring.*DistributesOver+ R) (Group.+WellDefined (Ring.additiveGroup R) reflexive (transferToRight' (Ring.additiveGroup R) (transitive (symmetric (Ring.*DistributesOver+ R)) (transitive (Ring.*WellDefined R reflexive (Group.invLeft (Ring.additiveGroup R))) (Ring.timesZero R)))))) t1\n t3 : (b + Group.inverse (Ring.additiveGroup R) c) ∼ Ring.0R R\n t3 = IntegralDomain.intDom I t2 a!=0\n\ncancelIntDom' : {a b c : A} → (a * c) ∼ (b * c) → (c ∼ Ring.0R R → False) → a ∼ b\ncancelIntDom' pr n = cancelIntDom (transitive *Commutative (transitive pr *Commutative)) n\n", "meta": {"hexsha": "e7f9d142bbca0054788d800ec582598319216613", "size": 1450, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Rings/IntegralDomains/Lemmas.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Rings/IntegralDomains/Lemmas.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Rings/IntegralDomains/Lemmas.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 50.0, "max_line_length": 313, "alphanum_fraction": 0.6793103448, "num_tokens": 504, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972616934406, "lm_q2_score": 0.7662936324115011, "lm_q1q2_score": 0.6671331380305728}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Some defined operations over Rings\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\n-- This module gives the definition of _^_ which is used throughout\n-- the library. It's a little different from the normal definition:\n--\n-- x ^ zero = 1#\n-- x ^ suc i = x * x ^ i\n--\n-- This is for two reasons. First, we want to avoid unnecessarily\n-- multiplying by 1# if possible:\n--\n-- Standard definition: x ^ 2 = x * x * 1#\n-- Our definition: x ^ 2 = x * x\n--\n-- This speeds up typechecking and makes for much more readable\n-- proofs.\n--\n-- Secondly, we want to associate to the left:\n--\n-- Standard definition: x ^ 3 = x * (x * (x * 1#))\n-- Our definition: x ^ 2 = (x * x) * x\n--\n-- As counterintuitive as it may seem, this also speeds up\n-- typechecking.\n\nopen import Algebra\n\nmodule Algebra.Operations.Ring\n {ℓ₁ ℓ₂} (ring : RawRing ℓ₁ ℓ₂)\n where\n\nopen import Data.Nat.Base as ℕ using (ℕ; suc; zero)\n\nopen RawRing ring\n\ninfixr 8 _^_+1\n_^_+1 : Carrier → ℕ → Carrier\nx ^ zero +1 = x\nx ^ suc n +1 = (x ^ n +1) * x\n\ninfixr 8 _^_\n_^_ : Carrier → ℕ → Carrier\nx ^ zero = 1#\nx ^ suc i = x ^ i +1\n{-# INLINE _^_ #-}\n", "meta": {"hexsha": "0d783bfaa635673e2c6bcaaba1b4d217caae6c77", "size": 1303, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Algebra/Operations/Ring.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Algebra/Operations/Ring.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Algebra/Operations/Ring.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 25.0576923077, "max_line_length": 72, "alphanum_fraction": 0.5425940138, "num_tokens": 376, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9124361700013356, "lm_q2_score": 0.7310585727705126, "lm_q1q2_score": 0.6670442841853692}} {"text": "{-# OPTIONS --cubical #-}\n\nmodule Miscellaneous.LimNatural where\n\nimport Lvl\nopen import Numeral.Natural as ℕ using (ℕ)\nopen import Numeral.Sign as Sign using (−|+ ; −|0|+ ; ➖ ; ➕)\nopen import Type.Cubical\nopen import Type.Cubical.Path.Equality\nopen import Type\n\ndata ℕ∞ : Type{Lvl.𝟎} where\n 𝟎 : ℕ∞\n 𝐒 : ℕ∞ → ℕ∞\n ∞ : ℕ∞\n 𝐒-fixpoint : (𝐒(∞) ≡ ∞)\n\n𝐏₀ : ℕ∞ → ℕ∞\n𝐏₀(𝟎) = 𝟎\n𝐏₀(𝐒(n)) = n\n𝐏₀(∞) = ∞\n𝐏₀(𝐒-fixpoint i) = ∞\n\n_+_ : ℕ∞ → ℕ∞ → ℕ∞\nx + 𝟎 = x\nx + 𝐒(y) = 𝐒(x + y)\n_ + ∞ = ∞\nx + 𝐒-fixpoint i = 𝐒-fixpoint i\n\n_⋅_ : ℕ∞ → ℕ∞ → ℕ∞\nx ⋅ 𝟎 = 𝟎\nx ⋅ 𝐒(y) = x + (x ⋅ y)\nx ⋅ ∞ = ∞\nx ⋅ 𝐒-fixpoint i = ∞\n\ninfixl 10010 _+_\ninfixl 10020 _⋅_\n\nopen import Structure.Function.Domain\nopen import Structure.Function\nopen import Structure.Relator.Properties\nopen import Syntax.Transitivity\nopen import Type.Cubical.Path.Proofs\n\nprivate variable x y z : ℕ∞\n\n𝐒-∞-involutive : (𝐒(𝐒(∞)) ≡ ∞)\n𝐒-∞-involutive = congruence₁(𝐒) 𝐒-fixpoint 🝖 𝐒-fixpoint\n\ninstance\n 𝐒-injectivity : Injective(𝐒)\n Injective.proof 𝐒-injectivity = congruence₁(𝐏₀)\n\n[+]-baseₗ : (𝟎 + x ≡ x)\n[+]-baseₗ {𝟎} = reflexivity(_≡_)\n[+]-baseₗ {𝐒 x} = congruence₁(𝐒) ([+]-baseₗ {x})\n[+]-baseₗ {∞} = reflexivity(_≡_)\n[+]-baseₗ {𝐒-fixpoint i} = reflexivity(_≡_) {𝐒-fixpoint i}\n\n[+]-stepₗ : (𝐒(x) + y ≡ 𝐒(x + y))\n[+]-stepₗ {x} {𝟎} = reflexivity(_≡_)\n[+]-stepₗ {x} {𝐒 y} = congruence₁(𝐒) ([+]-stepₗ {x}{y})\n[+]-stepₗ {x} {∞} = symmetry(_≡_) 𝐒-fixpoint\n[+]-stepₗ {x} {𝐒-fixpoint i} = symmetry(_≡_) (Interval.hComp diagram {!!}) where\n diagram : Interval → Interval.Partial(Interval.farBound i) _\n diagram _ (i = Interval.𝟎) = congruence₁(𝐒) 𝐒-fixpoint\n diagram _ (i = Interval.𝟏) = 𝐒-fixpoint\n {-\n i0 j0 𝐒∞\n i0 j1 𝐒𝐒∞\n i1 j0 ∞\n i1 j1 𝐒∞\n -}\n -- test : ∀{i} → (𝐒(𝐒-fixpoint i) ≡ 𝐒-fixpoint i)\n -- test {i} j = {!!}\n {-\n i0 j0 𝐒𝐒∞\n i0 j1 𝐒∞\n i1 j0 𝐒∞\n i1 j1 ∞\n -}\n", "meta": {"hexsha": "befb7040b2e19936786506ddf302670737d0af99", "size": 1845, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Miscellaneous/LimNatural.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Miscellaneous/LimNatural.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Miscellaneous/LimNatural.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.5, "max_line_length": 80, "alphanum_fraction": 0.5772357724, "num_tokens": 976, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9086178944582997, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.6670341335272852}} {"text": "{-# OPTIONS --without-K #-}\nmodule algebra.group.classifying where\n\nopen import level\nopen import algebra.group.core\nopen import algebra.group.morphism\nopen import equality.core\nopen import function.isomorphism\nopen import pointed.core\nopen import sets.unit\nopen import sum\nopen import hott.level.core\nopen import hott.loop.core\nopen import hott.truncation.core\nopen import hott.equivalence\n\nmodule _ {i}(G : Set i) ⦃ gG : IsGroup G ⦄ where\n open import algebra.group.gset G\n open IsGroup ⦃ ... ⦄\n\n -- G as a G-Set\n G' : GSet i\n G' = (G , GisGSet)\n\n -- G as a pointed set\n G* : PSet i\n G* = (G , e)\n\n 𝑩 : Set (lsuc i)\n 𝑩 = Σ (GSet i) λ X → Trunc 1 (X ≡ G')\n\n base : 𝑩\n base = (G' , [ refl ])\n\n 𝑩* : PSet (lsuc i)\n 𝑩* = (𝑩 , base)\n\n 𝑩-Ω : (base ≡ base) ≅ G\n 𝑩-Ω = begin\n (base ≡ base)\n ≅⟨ sym≅ Σ-split-iso ⟩\n ( Σ (G' ≡ G') λ p\n → subst (λ X → Trunc 1 (X ≡ G')) p [ refl ] ≡ [ refl ] )\n ≅⟨ (Σ-ap-iso refl≅ λ p → contr-⊤-iso (Trunc-level 1 _ _)) ·≅ ×-right-unit ⟩\n (G' ≡ G')\n ≅⟨ GSet-univalence G ⦃ xG = GisGSet ⦄ G ⦃ yG = GisGSet ⦄ ⟩\n ( Σ (GSetMorphism G ⦃ xG = GisGSet ⦄ G ⦃ yG = GisGSet ⦄) λ { (f , _)\n → weak-equiv f } )\n ≅⟨ (Σ-ap-iso' (GSet-repr-iso is-set ⦃ xG = GisGSet ⦄) λ _ → refl≅) ⟩\n ( Σ G λ { g → weak-equiv (λ x → x * g) } )\n ≅⟨ ( Σ-ap-iso refl≅ λ g → contr-⊤-iso ( lem g , h1⇒prop (we-h1 _) _ ) )\n ·≅ ×-right-unit ⟩\n G\n ∎\n where\n open ≅-Reasoning\n lem : (g : G) → weak-equiv (λ x → x * g)\n lem g = proj₂ (≅'⇒≈ (≅⇒≅' (right-translation-iso g)))\n", "meta": {"hexsha": "8080addbbc42186e13d759d761bca281fa5aab5d", "size": 1558, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/algebra/group/classifying.agda", "max_stars_repo_name": "pcapriotti/agda-base", "max_stars_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2015-06-12T12:20:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-01T11:25:54.000Z", "max_issues_repo_path": "src/algebra/group/classifying.agda", "max_issues_repo_name": "pcapriotti/agda-base", "max_issues_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-02T14:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-26T11:57:26.000Z", "max_forks_repo_path": "src/algebra/group/classifying.agda", "max_forks_repo_name": "pcapriotti/agda-base", "max_forks_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-02-02T12:17:00.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-04T19:31:00.000Z", "avg_line_length": 26.406779661, "max_line_length": 79, "alphanum_fraction": 0.5423620026, "num_tokens": 684, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942203004185, "lm_q2_score": 0.7490872131147275, "lm_q1q2_score": 0.6669080163369897}} {"text": "{-# OPTIONS --cubical --safe #-}\n\nmodule Data.List.Indexing where\n\nopen import Data.List.Base\nopen import Data.Fin\nopen import Prelude\n\ninfixl 6 _!_\n_!_ : (xs : List A) → Fin (length xs) → A\n(x ∷ xs) ! f0 = x\n(x ∷ xs) ! fs i = xs ! i\n\ntabulate : ∀ n → (Fin n → A) → List A\ntabulate zero f = []\ntabulate (suc n) f = f f0 ∷ tabulate n (f ∘ fs)\n", "meta": {"hexsha": "a2a73e8d007d63c893672d1cc2d396788f73dd9c", "size": 342, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/List/Indexing.agda", "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_issues_repo_path": "Data/List/Indexing.agda", "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/List/Indexing.agda", "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "avg_line_length": 20.1176470588, "max_line_length": 47, "alphanum_fraction": 0.6023391813, "num_tokens": 128, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.890294223211224, "lm_q2_score": 0.7490872075132153, "lm_q1q2_score": 0.666908013530443}} {"text": "module Termination.Sized.DeBruijnBase where\n\nopen import Data.Maybe\nopen import Data.Maybe.Effectful\nopen import Function -- composition, identity\nopen import Relation.Binary.PropositionalEquality hiding ( subst )\nopen ≡-Reasoning\n\nopen import Effect.Functor\n\nfmap : {A B : Set} -> (A -> B) -> Maybe A -> Maybe B\nfmap = RawFunctor._<$>_ functor\n\n-- OR:\n-- open RawFunctor MaybeFunctor using () renaming (_<$>_ to fmap)\n\nfmapExt : {A B : Set}{f g : A -> B} ->\n (forall a -> f a ≡ g a) -> forall m -> fmap f m ≡ fmap g m\nfmapExt f≡g nothing = refl\nfmapExt f≡g (just a) = cong just (f≡g a)\n\nfmapLaw1 : {A : Set}(a : Maybe A) -> fmap id a ≡ a\nfmapLaw1 nothing = refl\nfmapLaw1 (just a) = refl\n\nfmapLaw2 : {A B C : Set}(f : B -> C)(g : A -> B) ->\n forall m -> fmap f (fmap g m) ≡ fmap (f ∘ g) m\nfmapLaw2 f g nothing = refl\nfmapLaw2 f g (just a) = refl\n\n-- untyped de Bruijn terms\ndata Lam (A : Set) : Set where\n var : A -> Lam A\n app : Lam A -> Lam A -> Lam A\n abs : Lam (Maybe A) -> Lam A\n\n-- functoriality of Lam\nlam : {A B : Set} -> (A -> B) -> Lam A -> Lam B\nlam f (var a) = var (f a)\nlam f (app t1 t2) = app (lam f t1) (lam f t2)\nlam f (abs r) = abs (lam (fmap f) r)\n\nlamExt : {A B : Set}{f g : A -> B} ->\n (forall a -> f a ≡ g a) -> forall t -> lam f t ≡ lam g t\nlamExt f≡g (var a) = cong var (f≡g a)\nlamExt f≡g (abs r) = cong abs (lamExt (fmapExt f≡g) r)\nlamExt f≡g (app r s) = cong₂ app (lamExt f≡g r) (lamExt f≡g s)\n\nlamLaw1 : {A : Set}(t : Lam A) -> lam id t ≡ t\nlamLaw1 (var a) = refl\nlamLaw1 (app r s) = begin\n lam id (app r s)\n ≡⟨ refl ⟩\n app (lam id r) (lam id s)\n ≡⟨ cong (app (lam id r)) (lamLaw1 s) ⟩\n app (lam id r) s\n ≡⟨ cong (\\ x -> app x s) (lamLaw1 r) ⟩\n app r s\n ∎\nlamLaw1 (abs t) = begin\n lam id (abs t)\n ≡⟨ refl ⟩\n abs (lam (fmap id) t)\n ≡⟨ cong abs (lamExt {g = id} fmapLaw1 t) ⟩\n abs (lam id t)\n ≡⟨ cong abs (lamLaw1 t) ⟩\n abs t\n ∎\n\nlamLaw2 : {A B C : Set}(f : B -> C)(g : A -> B) ->\n forall t -> lam f (lam g t) ≡ lam (f ∘ g) t\nlamLaw2 f g (var a) = refl\nlamLaw2 f g (app r s) = cong₂ app (lamLaw2 f g r) (lamLaw2 f g s)\nlamLaw2 f g (abs t) = begin\n lam f (lam g (abs t))\n ≡⟨ refl ⟩\n lam f (abs (lam (fmap g) t))\n ≡⟨ refl ⟩\n abs (lam (fmap f) (lam (fmap g) t))\n ≡⟨ cong abs (lamLaw2 (fmap f) (fmap g) t) ⟩\n abs (lam (fmap f ∘ fmap g) t)\n ≡⟨ cong abs (lamExt (fmapLaw2 f g) t) ⟩\n abs (lam (fmap (f ∘ g)) t)\n ≡⟨ refl ⟩\n lam (f ∘ g) (abs t)\n ∎\n\n-- lifting a substitution A -> Lam B under a binder\nlift : {A B : Set} -> (A -> Lam B) -> Maybe A -> Lam (Maybe B)\nlift f nothing = var nothing\nlift f (just a) = lam just (f a)\n\n-- extensionality of lifting\nliftExt : {A B : Set}{f g : A -> Lam B} ->\n ((a : A) -> f a ≡ g a) -> (t : Maybe A) -> lift f t ≡ lift g t\nliftExt H nothing = refl\nliftExt H (just a) = cong (lam just) $ H a\n\n-- simultaneous substitution\nsubst : {A B : Set} -> (A -> Lam B) -> Lam A -> Lam B\nsubst f (var a) = f a\nsubst f (app t1 t2) = app (subst f t1) (subst f t2)\nsubst f (abs r) = abs (subst (lift f) r)\n\n-- extensionality of subst\nsubstExt : {A B : Set}{f g : A -> Lam B} ->\n ((a : A) -> f a ≡ g a) -> (t : Lam A) -> subst f t ≡ subst g t\nsubstExt H (var a) = H a\nsubstExt {f = f}{g = g} H (app t1 t2) = begin\n subst f (app t1 t2)\n ≡⟨ refl ⟩\n app (subst f t1) (subst f t2)\n ≡⟨ cong (\\ x -> app x (subst f t2)) (substExt H t1) ⟩\n app (subst g t1) (subst f t2)\n ≡⟨ cong (\\ x -> app (subst g t1) x) (substExt H t2) ⟩\n app (subst g t1) (subst g t2)\n ∎\nsubstExt {f = f}{g = g} H (abs r) = begin\n subst f (abs r)\n ≡⟨ refl ⟩\n abs (subst (lift f) r)\n ≡⟨ cong abs (substExt (liftExt H) r) ⟩\n abs (subst (lift g) r)\n ≡⟨ refl ⟩\n subst g (abs r)\n ∎\n\n-- Lemma: lift g ∘ fmap f = lift (g ∘ f)\nliftLaw1 : {A B C : Set}(f : A -> B)(g : B -> Lam C)(t : Maybe A) ->\n lift g (fmap f t) ≡ lift (g ∘ f) t\nliftLaw1 f g nothing = begin\n lift g (fmap f nothing)\n ≡⟨ refl ⟩\n lift g nothing\n ≡⟨ refl ⟩\n var nothing\n ≡⟨ refl ⟩\n lift (g ∘ f) nothing\n ∎\nliftLaw1 f g (just a) = begin\n lift g (fmap f (just a))\n ≡⟨ refl ⟩\n lift g (just (f a))\n ≡⟨ refl ⟩\n lam just (g (f a))\n ≡⟨ refl ⟩\n lift (g ∘ f) (just a)\n ∎\n\n-- Lemma: subst g ∘ lam f t = subst (g ∘ f)\nsubstLaw1 : {A B C : Set}(f : A -> B)(g : B -> Lam C)(t : Lam A) ->\n subst g (lam f t) ≡ subst (g ∘ f) t\n\nsubstLaw1 f g (var a) = refl\n\nsubstLaw1 f g (app t1 t2) = begin\n subst g (lam f (app t1 t2))\n ≡⟨ refl ⟩\n subst g (app (lam f t1) (lam f t2))\n ≡⟨ refl ⟩\n app (subst g (lam f t1)) (subst g (lam f t2))\n ≡⟨ cong (\\ x -> app x (subst g (lam f t2))) (substLaw1 f g t1) ⟩\n app (subst (g ∘ f) t1) (subst g (lam f t2))\n ≡⟨ cong (\\ x -> app (subst (g ∘ f) t1) x) (substLaw1 f g t2) ⟩\n app (subst (g ∘ f) t1) (subst (g ∘ f) t2)\n ∎\n\nsubstLaw1 f g (abs r) =\n begin subst g (lam f (abs r))\n ≡⟨ refl ⟩\n subst g (abs (lam (fmap f) r))\n ≡⟨ refl ⟩\n abs (subst (lift g) (lam (fmap f) r))\n ≡⟨ cong abs (substLaw1 (fmap f) (lift g) r) ⟩\n abs (subst (lift g ∘ fmap f) r)\n ≡⟨ cong abs (substExt {f = lift g ∘ fmap f} {g = lift (g ∘ f)} (liftLaw1 f g) r) ⟩\n abs (subst (lift (g ∘ f)) r)\n ∎\n\n-- Lemma: lift (lam f ∘ g) = lam f ∘ subst g\nliftLaw2 : {A B C : Set}(f : B -> C)(g : A -> Lam B)(t : Maybe A) ->\n lift (lam f ∘ g) t ≡ lam (fmap f) (lift g t)\nliftLaw2 f g nothing = begin\n lift (lam f ∘ g) nothing\n ≡⟨ refl ⟩\n var nothing\n ≡⟨ refl ⟩\n var (fmap f nothing)\n ≡⟨ refl ⟩\n lam (fmap f) (var nothing)\n ≡⟨ refl ⟩\n lam (fmap f) (lift g nothing)\n ∎\nliftLaw2 f g (just a) = begin\n lift (lam f ∘ g) (just a)\n ≡⟨ refl ⟩\n lam just (lam f (g a))\n ≡⟨ lamLaw2 just f (g a) ⟩\n lam (just ∘ f) (g a)\n ≡⟨ lamExt (\\ a -> refl) (g a) ⟩\n lam (fmap f ∘ just) (g a)\n ≡⟨ sym (lamLaw2 (fmap f) just (g a)) ⟩\n lam (fmap f) (lam just (g a))\n ≡⟨ refl ⟩\n lam (fmap f) (lift g (just a))\n ∎\n\n\n-- Lemma: subst (lam f ∘ g) = lam f ∘ subst g\nsubstLaw2 : {A B C : Set}(f : B -> C)(g : A -> Lam B)(t : Lam A) ->\n subst (lam f ∘ g) t ≡ lam f (subst g t)\n\nsubstLaw2 f g (var a) = refl\n\nsubstLaw2 f g (app r s) = begin\n subst (lam f ∘ g) (app r s)\n ≡⟨ refl ⟩\n app (subst (lam f ∘ g) r) (subst (lam f ∘ g) s)\n ≡⟨ cong (app (subst (lam f ∘ g) r)) (substLaw2 f g s) ⟩\n app (subst (lam f ∘ g) r) (lam f (subst g s))\n ≡⟨ cong (\\ x -> app x (lam f (subst g s))) (substLaw2 f g r) ⟩\n app (lam f (subst g r)) (lam f (subst g s))\n ≡⟨ refl ⟩\n lam f (app (subst g r) (subst g s))\n ≡⟨ refl ⟩\n lam f (subst g (app r s))\n ∎\n\nsubstLaw2 f g (abs t) = begin\n subst (lam f ∘ g) (abs t)\n ≡⟨ refl ⟩\n abs (subst (lift (lam f ∘ g)) t)\n ≡⟨ cong abs (substExt (liftLaw2 f g) t) ⟩\n abs (subst (lam (fmap f) ∘ (lift g)) t)\n ≡⟨ cong abs (substLaw2 (fmap f) (lift g) t) ⟩\n abs (lam (fmap f) (subst (lift g) t))\n ≡⟨ refl ⟩\n lam f (abs (subst (lift g) t))\n ≡⟨ refl ⟩\n lam f (subst g (abs t))\n ∎\n", "meta": {"hexsha": "749ed16a9679c68522e10e61c50f2eae9fb9d6b8", "size": 6981, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/LibSucceed/Termination/Sized/DeBruijnBase.agda", "max_stars_repo_name": "KDr2/agda", "max_stars_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/LibSucceed/Termination/Sized/DeBruijnBase.agda", "max_issues_repo_name": "KDr2/agda", "max_issues_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/LibSucceed/Termination/Sized/DeBruijnBase.agda", "max_forks_repo_name": "KDr2/agda", "max_forks_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.847107438, "max_line_length": 87, "alphanum_fraction": 0.5178341212, "num_tokens": 3038, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8354835452961425, "lm_q2_score": 0.7981867729389246, "lm_q1q2_score": 0.6668719148634998}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Pointwise lifting of a predicate to a binary tree\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Tree.Binary.Relation.Unary.All where\n\nopen import Level\nopen import Data.Tree.Binary as Tree using (Tree; leaf; node)\nopen import Relation.Unary\n\nprivate\n variable\n a b p q : Level\n A : Set a\n B : Set b\n\ndata All {A : Set a} (P : A → Set p) : Tree A → Set (a ⊔ p) where\n leaf : All P leaf\n node : ∀ {l m r} → All P l → P m → All P r → All P (node l m r)\n\nmodule _ {P : A → Set p} {Q : A → Set q} where\n\n map : ∀[ P ⇒ Q ] → ∀[ All P ⇒ All Q ]\n map f leaf = leaf\n map f (node l m r) = node (map f l) (f m) (map f r)\n", "meta": {"hexsha": "3af499e8b8ed0bc88742c299068ad93c8b69c9d4", "size": 817, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/Tree/Binary/Relation/Unary/All.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/Tree/Binary/Relation/Unary/All.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/Tree/Binary/Relation/Unary/All.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 27.2333333333, "max_line_length": 72, "alphanum_fraction": 0.4810281518, "num_tokens": 229, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9362850075259039, "lm_q2_score": 0.7122321781307374, "lm_q1q2_score": 0.6668523102613284}} {"text": "------------------------------------------------------------------------------\n-- The LTC-PCF base\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\n{-\nLTC-PCF The logical framework (Agda)\n\n* Logical constants * Curry-Howard isomorphism\n* Equality * Identity type\n* Term language and conversion rules * Postulates\n* Inductively defined predicates * Inductive families\n-}\n\nmodule LTC-PCF.Base where\n\n-- First-order logic with equality.\nopen import Common.FOL.FOL-Eq public\n\n-- Common definitions.\nopen import Common.DefinitionsI public\n\ninfixl 7 _·_\ninfix 0 if_then_else_\n\n------------------------------------------------------------------------------\n-- The term language of LTC-PCF correspond to the PCF terms.\n\n-- t ::= x\n-- | t · t\n-- | λ x.t\n-- | fix x.t\n-- | true | false | if\n-- | zero | succ | pred | iszero\n\n-- NB. We define the PCF terms as constants. After that, we will\n-- define some function symbols based on these constants for\n-- convenience in writing.\n\npostulate\n _·_ : D → D → D -- LTC-PCF application.\n lam : (D → D) → D -- LTC-PCF λ-abstraction.\n fix : (D → D) → D -- LTC-PCF fixed-point operator.\n true false if : D -- LTC-PCF partial Booleans.\n zero succ pred iszero : D -- LTC-PCF partial natural numbers.\n\n------------------------------------------------------------------------------\n-- Definitions\n\n-- We define some function symbols for convenience in writing.\nabstract\n if_then_else_ : D → D → D → D\n if b then t else t' = if · b · t · t'\n\n succ₁ : D → D\n succ₁ n = succ · n\n\n pred₁ : D → D\n pred₁ n = pred · n\n\n iszero₁ : D → D\n iszero₁ n = iszero · n\n\n------------------------------------------------------------------------------\n-- Conversion rules\n\n-- The conversion relation _conv_ satifies (Aczel 1977. The strength\n-- of Martin-Löf's intuitionistic type theory with one universe,\n-- p. 8).\n--\n-- x conv y <=> FOTC ⊢ x ≡ y,\n--\n-- therefore, we introduce the conversion rules as non-logical axioms.\n\n-- N.B. We write the conversion rules on the defined function symbols\n-- instead of on the PCF constants.\n\n-- Conversion rule for the λ-abstraction and the application.\npostulate beta : ∀ f a → lam f · a ≡ f a\n\n-- Conversion rule for the fixed-pointed operator.\npostulate fix-eq : ∀ f → fix f ≡ f (fix f)\n\n-- Conversion rules for Booleans.\npostulate\n -- if-true : ∀ t {t'} → if · true · t · t' ≡ t\n -- if-false : ∀ {t} t' → if · false · t · t' ≡ t'\n if-true : ∀ t {t'} → (if true then t else t') ≡ t\n if-false : ∀ {t} t' → (if false then t else t') ≡ t'\n\n-- Conversion rules for pred.\npostulate\n -- pred-0 : pred · zero ≡ zero\n -- pred-S : ∀ d → pred · (succ · d) ≡ d\n\n -- N.B. We don't need this equation in FOTC.\n pred-0 : pred₁ zero ≡ zero\n pred-S : ∀ n → pred₁ (succ₁ n) ≡ n\n\n-- Conversion rules for iszero.\npostulate\n -- iszero-0 : iszero · zero ≡ true\n -- iszero-S : ∀ d → iszero · (succ · d) ≡ false\n iszero-0 : iszero₁ zero ≡ true\n iszero-S : ∀ n → iszero₁ (succ₁ n) ≡ false\n\n------------------------------------------------------------------------------\n-- Discrimination rules\n\npostulate\n t≢f : true ≢ false\n -- 0≢S : ∀ {d} → zero ≢ succ · d\n 0≢S : ∀ {n} → zero ≢ succ₁ n\n", "meta": {"hexsha": "09830f3db8af316531b6a46ee22e63c5cda6b0d3", "size": 3584, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/LTC-PCF/Base.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/LTC-PCF/Base.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/LTC-PCF/Base.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 30.3728813559, "max_line_length": 78, "alphanum_fraction": 0.5027901786, "num_tokens": 961, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357460591569, "lm_q2_score": 0.7690802370707281, "lm_q1q2_score": 0.666820057127972}} {"text": "{-# OPTIONS --cubical --no-import-sorts #-}\n\nmodule Number.Prelude.Nat where\n\nopen import Cubical.Data.Nat.Order public using () renaming\n ( _<_ to _<ⁿᵗ_\n ; <-trans to <ⁿ-trans -- TODO: use different version\n ; _≟_ to _≟ⁿ_\n ; lt to ltⁿ\n ; gt to gtⁿ\n ; eq to eqⁿ\n ; ¬-<-zero to ¬-<ⁿ-zero\n )\nopen import Data.Nat public using () renaming\n ( _⊔_ to maxⁿ\n ; _⊓_ to minⁿ\n ; _+_ to _+ⁿ_\n ; _*_ to _·ⁿ_\n ; pred to predⁿ\n )\nopen import Cubical.Data.Nat public using (suc; zero; ℕ; HasFromNat) renaming\n ( +-comm to +ⁿ-comm\n ; +-assoc to +ⁿ-assoc\n ; *-comm to ·ⁿ-comm\n ; *-suc to ·ⁿ-suc\n ; *-assoc to ·ⁿ-assoc\n ; +-suc to +ⁿ-suc\n ; *-distribˡ to ·ⁿ-distribˡ\n ; *-distribʳ to ·ⁿ-distribʳ\n ; *-identityʳ to ·ⁿ-identityʳ\n ; *-identityˡ to ·ⁿ-identityˡ\n ; snotz to snotzⁿ\n ; injSuc to injSucⁿ\n ; isSetℕ to is-setⁿ\n ; inj-m+ to +ⁿ-preserves-≡ˡ\n ; inj-+m to +ⁿ-preserves-≡ʳ\n ; inj-sm* to ·ⁿ-reflects-≡ˡ'\n ; inj-*sm to ·ⁿ-reflects-≡ʳ'\n )\nopen import Number.Instances.Nat as Nat public using () renaming\n ( bundle to ℕbundle\n ; _<_ to _<ⁿ_\n ; 0 Even\n\n data Odd : Set where\n S' : Even -> Odd \n \n", "meta": {"hexsha": "2f4d8611d38cf2c388a2b0a08339dec3e55c45e2", "size": 137, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "tests/beyond/evenodd.agda", "max_stars_repo_name": "andrejtokarcik/agda-semantics", "max_stars_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-08-10T15:33:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-06T17:24:25.000Z", "max_issues_repo_path": "tests/beyond/evenodd.agda", "max_issues_repo_name": "andrejtokarcik/agda-semantics", "max_issues_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/beyond/evenodd.agda", "max_forks_repo_name": "andrejtokarcik/agda-semantics", "max_forks_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 12.4545454545, "max_line_length": 23, "alphanum_fraction": 0.5547445255, "num_tokens": 44, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9489172630429475, "lm_q2_score": 0.7025300636233416, "lm_q1q2_score": 0.666642905178849}} {"text": "module Numeral.Natural.Function.FlooredLogarithm where\n\nopen import Data\nopen import Data.Boolean.Stmt\nopen import Numeral.Natural\nopen import Numeral.Natural.Inductions\nopen import Numeral.Natural.Oper\nopen import Numeral.Natural.Oper.Comparisons\nopen import Numeral.Natural.Oper.FlooredDivision\nopen import Numeral.Natural.Oper.FlooredDivision.Proofs\nopen import Numeral.Natural.Oper.Proofs\nopen import Numeral.Natural.Relation.Order\nopen import Numeral.Natural.Relation.Order.Proofs\nopen import Relator.Equals\nopen import Structure.Relator.Ordering\nopen Structure.Relator.Ordering.Strict.Properties\n\n⌊log⌋ : (b : ℕ) → ⦃ _ : IsTrue(b ≥? 2) ⦄ → (n : ℕ) → ⦃ _ : IsTrue(n ≥? 1) ⦄ → ℕ\n⌊log⌋ b@(𝐒(𝐒 _)) n = wellfounded-recursion (_<_) f(n) where\n f : (n : ℕ) → ((prev : ℕ) ⦃ _ : (prev < n) ⦄ → ℕ) → ℕ\n f 𝟎 _ = 𝟎\n f (𝐒 𝟎) _ = 𝟎\n f n@(𝐒(𝐒 _)) prev = 𝐒(prev((n ⌊/⌋ b)) ⦃ [⌊/⌋]-ltₗ {b = b} ⦄)\n", "meta": {"hexsha": "da088a946968fbdfa4efd54fa5b9401c63089bf4", "size": 917, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Function/FlooredLogarithm.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Function/FlooredLogarithm.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Function/FlooredLogarithm.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.2083333333, "max_line_length": 79, "alphanum_fraction": 0.6859323882, "num_tokens": 359, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9489172659321807, "lm_q2_score": 0.7025300573952052, "lm_q1q2_score": 0.6666429012986361}} {"text": "module Numeral.Integer where\n\nopen import Data.Tuple\nopen import Logic\nimport Lvl\nopen import Numeral.Natural\nopen import Numeral.Natural.Oper\nopen import Relator.Equals\nopen import Type\nopen import Type.Quotient\n\n-- Equivalence relation of difference equality.\n-- Essentially (if one would already work in the integers):\n-- (a₁ , a₂) diff-≡_ (b₁ , b₂)\n-- ⇔ a₁ + b₂ ≡ a₂ + b₁\n-- ⇔ a₁ − a₂ ≡ b₁ − b₂\n_diff-≡_ : (ℕ ⨯ ℕ) → (ℕ ⨯ ℕ) → Stmt{Lvl.𝟎}\n(a₁ , a₂) diff-≡ (b₁ , b₂) = (a₁ + b₂ ≡ a₂ + b₁)\n\nℤ : Type{Lvl.𝟎}\nℤ = (ℕ ⨯ ℕ) / (_diff-≡_)\n", "meta": {"hexsha": "15f5b8482328f24cd6e534e179080d3f394b51c2", "size": 544, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Mathematical/Numeral/Integer.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Mathematical/Numeral/Integer.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Mathematical/Numeral/Integer.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.7272727273, "max_line_length": 59, "alphanum_fraction": 0.6397058824, "num_tokens": 224, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9532750413739075, "lm_q2_score": 0.69925440852404, "lm_q1q2_score": 0.6665817752166414}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Properties of binary trees\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.Tree.Binary.Properties where\n\nopen import Level using (Level)\nopen import Data.Nat.Base using (suc; _+_)\nopen import Data.Tree.Binary\nopen import Function.Base\nopen import Relation.Binary.PropositionalEquality\n\nprivate\n variable\n a b : Level\n A : Set a\n B : Set b\n\nsize-map : ∀ (f : A → B) t → size (map f t) ≡ size t\nsize-map f leaf = refl\nsize-map f (node l m r) =\n cong₂ (λ l r → l + suc r) (size-map f l) (size-map f r)\n\nmap-id : ∀ (t : Tree A) → map id t ≡ t\nmap-id leaf = refl\nmap-id (node l v r) = cong₂ (flip node v) (map-id l) (map-id r)\n", "meta": {"hexsha": "d23b24aa198706814eaf1073e1fed3e2d509a703", "size": 831, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/Tree/Binary/Properties.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/Tree/Binary/Properties.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/Tree/Binary/Properties.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 26.8064516129, "max_line_length": 72, "alphanum_fraction": 0.5222623345, "num_tokens": 215, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9005297914570319, "lm_q2_score": 0.740174367770488, "lm_q1q2_score": 0.666549069050198}} {"text": "-- Testing termination using subpatterns\nmodule TerminationSubpattern where\n\n-- a list with two different conses\ndata EOList (A : Set) : Set where\n Nil : EOList A\n ECons : A -> EOList A -> EOList A\n OCons : A -> EOList A -> EOList A\n\n\nbutLastWithDefault : {A : Set} -> A -> EOList A -> A\nbutLastWithDefault a Nil = a\nbutLastWithDefault a (ECons b l) = butLastWithDefault b l\nbutLastWithDefault a (OCons b l) = butLastWithDefault b l\n\n\n-- a very stupid implementation:\nbutLastWithDefault' : {A : Set} -> A -> EOList A -> A\nbutLastWithDefault' a Nil = a\nbutLastWithDefault' a (ECons b Nil) = b\nbutLastWithDefault' a (OCons b Nil) = b\nbutLastWithDefault' a (ECons b (OCons c l)) = butLastWithDefault' b (OCons c l)\nbutLastWithDefault' a (ECons b (ECons c l)) = butLastWithDefault' b (ECons c l)\nbutLastWithDefault' a (OCons b (OCons c l)) = butLastWithDefault' b (OCons c l)\nbutLastWithDefault' a (OCons b (ECons c l)) = butLastWithDefault' b (ECons c l)\n\n-- terminates, because, e.g. in the last line\n--\n-- ECons c l is a subpattern of OCons b (ECons c l)\n\n-- another justification is with structured orders\n-- if all constructors are considered equivalent\n\n", "meta": {"hexsha": "f2821954b56df4317b81baa3cc02395d52646e84", "size": 1171, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/TerminationSubpattern.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/TerminationSubpattern.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/TerminationSubpattern.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 34.4411764706, "max_line_length": 79, "alphanum_fraction": 0.70794193, "num_tokens": 370, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8459424411924673, "lm_q2_score": 0.7879311956428947, "lm_q1q2_score": 0.6665444391338499}} {"text": "-- making sure that the fun clauses are kept in declaration order\n-- in an interleaved mutual block\n\nopen import Agda.Builtin.Nat\n\ninterleaved mutual\n\n plus : Nat → Nat → Nat\n minus : Nat → Nat → Nat\n\n -- 0 being neutral\n plus 0 n = n\n minus n 0 = n\n\n -- other 0 case\n plus n 0 = n\n minus 0 n = 0\n\n -- suc suc\n plus (suc m) (suc n) = suc (suc (plus m n))\n minus (suc m) (suc n) = minus m n\n\n-- All of these test cases should be true by computation\n-- It will not be the case if the definitions have been interleaved\n-- the wrong way around (because the resulting definition would be\n-- strict in a different argument)\n\nopen import Agda.Builtin.Equality\n\n_ : ∀ {n} → plus 0 n ≡ n\n_ = refl\n\n_ : ∀ {n} → minus n 0 ≡ n\n_ = refl\n\n-- The following should not check with refl; for the same reasons\n\n-- _ : ∀ {n} → plus n 0 ≡ n\n-- _ = refl\n\n-- _ : ∀ {n} → minus 0 n ≡ 0\n-- _ = refl\n\n-- but they are of course provable by case analysis:\n\n_ : ∀ n → plus n 0 ≡ n\n_ = λ where\n zero → refl\n (suc _) → refl\n\n_ : ∀ n → minus 0 n ≡ 0\n_ = λ where\n zero → refl\n (suc _) → refl\n", "meta": {"hexsha": "4f9e6aafb5b21f8420ed40d1018a77587f31f976", "size": 1091, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2858-Order.agda", "max_stars_repo_name": "cruhland/agda", "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1989, "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_issues_repo_path": "test/Succeed/Issue2858-Order.agda", "max_issues_repo_name": "cruhland/agda", "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4066, "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_forks_repo_path": "test/Succeed/Issue2858-Order.agda", "max_forks_repo_name": "cruhland/agda", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 371, "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "avg_line_length": 19.8363636364, "max_line_length": 67, "alphanum_fraction": 0.6122823098, "num_tokens": 371, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744850834648, "lm_q2_score": 0.8152324848629214, "lm_q1q2_score": 0.6665132790351165}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Categories.Morphism where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Data.Sigma\nopen import Cubical.Categories.Category\n\n\nprivate\n variable\n ℓ ℓ' : Level\n\n-- C needs to be explicit for these definitions as Agda can't infer it\nmodule _ (C : Category ℓ ℓ') where\n open Category C\n\n private\n variable\n x y z w : ob\n\n isMonic : Hom[ x , y ] → Type (ℓ-max ℓ ℓ')\n isMonic {x} {y} f =\n ∀ {z} {a a' : Hom[ z , x ]} → f ∘ a ≡ f ∘ a' → a ≡ a'\n\n isEpic : (Hom[ x , y ]) → Type (ℓ-max ℓ ℓ')\n isEpic {x} {y} g =\n ∀ {z} {b b' : Hom[ y , z ]} → b ∘ g ≡ b' ∘ g → b ≡ b'\n\n -- A morphism is split monic if it has a *retraction*\n isSplitMon : (Hom[ x , y ]) → Type ℓ'\n isSplitMon {x} {y} f = ∃[ r ∈ Hom[ y , x ] ] r ∘ f ≡ id\n\n -- A morphism is split epic if it has a *section*\n isSplitEpi : (Hom[ x , y ]) → Type ℓ'\n isSplitEpi {x} {y} g = ∃[ s ∈ Hom[ y , x ] ] g ∘ s ≡ id\n\n record areInv (f : Hom[ x , y ]) (g : Hom[ y , x ]) : Type ℓ' where\n field\n sec : g ⋆ f ≡ id\n ret : f ⋆ g ≡ id\n\n record isIso (f : Hom[ x , y ]) : Type ℓ' where\n field\n inv : Hom[ y , x ]\n sec : inv ⋆ f ≡ id\n ret : f ⋆ inv ≡ id\n\n\n-- C can be implicit here\nmodule _ {C : Category ℓ ℓ'} where\n open Category C\n\n private\n variable\n x y z w : ob\n\n open areInv\n\n symAreInv : {f : Hom[ x , y ]} {g : Hom[ y , x ]} → areInv C f g → areInv C g f\n sec (symAreInv x) = ret x\n ret (symAreInv x) = sec x\n\n -- equational reasoning with inverses\n invMoveR : ∀ {f : Hom[ x , y ]} {g : Hom[ y , x ]} {h : Hom[ z , x ]} {k : Hom[ z , y ]}\n → areInv C f g\n → h ⋆ f ≡ k\n → h ≡ k ⋆ g\n invMoveR {f = f} {g} {h} {k} ai p\n = h\n ≡⟨ sym (⋆IdR _) ⟩\n (h ⋆ id)\n ≡⟨ cong (h ⋆_) (sym (ai .ret)) ⟩\n (h ⋆ (f ⋆ g))\n ≡⟨ sym (⋆Assoc _ _ _) ⟩\n ((h ⋆ f) ⋆ g)\n ≡⟨ cong (_⋆ g) p ⟩\n k ⋆ g\n ∎\n\n invMoveL : ∀ {f : Hom[ x , y ]} {g : Hom[ y , x ]} {h : Hom[ y , z ]} {k : Hom[ x , z ]}\n → areInv C f g\n → f ⋆ h ≡ k\n → h ≡ g ⋆ k\n invMoveL {f = f} {g} {h} {k} ai p\n = h\n ≡⟨ sym (⋆IdL _) ⟩\n id ⋆ h\n ≡⟨ cong (_⋆ h) (sym (ai .sec)) ⟩\n (g ⋆ f) ⋆ h\n ≡⟨ ⋆Assoc _ _ _ ⟩\n g ⋆ (f ⋆ h)\n ≡⟨ cong (g ⋆_) p ⟩\n (g ⋆ k)\n ∎\n\n open isIso\n\n isIso→areInv : ∀ {f : Hom[ x , y ]}\n → (isI : isIso C f)\n → areInv C f (isI .inv)\n sec (isIso→areInv isI) = sec isI\n ret (isIso→areInv isI) = ret isI\n\n open CatIso\n\n -- isIso agrees with CatIso\n isIso→CatIso : ∀ {f : C [ x , y ]}\n → isIso C f\n → CatIso C x y\n mor (isIso→CatIso {f = f} x) = f\n inv (isIso→CatIso x) = inv x\n sec (isIso→CatIso x) = sec x\n ret (isIso→CatIso x) = ret x\n\n CatIso→isIso : (cIso : CatIso C x y)\n → isIso C (cIso .mor)\n inv (CatIso→isIso f) = inv f\n sec (CatIso→isIso f) = sec f\n ret (CatIso→isIso f) = ret f\n\n CatIso→areInv : (cIso : CatIso C x y)\n → areInv C (cIso .mor) (cIso .inv)\n CatIso→areInv cIso = isIso→areInv (CatIso→isIso cIso)\n\n -- reverse of an iso is also an iso\n symCatIso : ∀ {x y}\n → CatIso C x y\n → CatIso C y x\n symCatIso (catiso mor inv sec ret) = catiso inv mor ret sec\n", "meta": {"hexsha": "0cf33a1c9392d9545951d1ec9b4b880a36d0851b", "size": 3252, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Categories/Morphism.agda", "max_stars_repo_name": "FernandoLarrain/cubical", "max_stars_repo_head_hexsha": "9acdecfa6437ec455568be4e5ff04849cc2bc13b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-03-05T00:28:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T00:28:39.000Z", "max_issues_repo_path": "Cubical/Categories/Morphism.agda", "max_issues_repo_name": "Seanpm2001-web/cubical", "max_issues_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Categories/Morphism.agda", "max_forks_repo_name": "Seanpm2001-web/cubical", "max_forks_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.0153846154, "max_line_length": 90, "alphanum_fraction": 0.4812423124, "num_tokens": 1397, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744761936437, "lm_q2_score": 0.8152324848629215, "lm_q1q2_score": 0.6665132717878456}} {"text": "module O where\r\n\r\nopen import Data.Product\r\nopen import Function renaming (_∘_ to _○_)\r\n\r\nopen import Circle\r\n\r\n------------------------------------------------------------------------------\r\n-- Abstract interpretation:\r\n-- natural numbers with paths equating all even numbers in one\r\n-- connected component and all odd numbers in another connected\r\n-- component\r\n\r\n-- module with 0,1,2,3,4 ... this is the concrete domain\r\n\r\ndata N : Set where\r\n Zero : N\r\n One : N\r\n Two : N\r\n Three : N \r\n Four : N\r\n\r\nrecN : (C : Set) → C → C → C → C → C → N → C\r\nrecN C c0 c1 c2 c3 c4 Zero = c0\r\nrecN C c0 c1 c2 c3 c4 One = c1\r\nrecN C c0 c1 c2 c3 c4 Two = c2\r\nrecN C c0 c1 c2 c3 c4 Three = c3\r\nrecN C c0 c1 c2 c3 c4 Four = c4\r\n\r\n-- module for the abstract domain {even, odd} except that we don't define it\r\n-- this way: we simply add paths between the even elements and paths between\r\n-- the odd elements\r\n\r\nmodule Parity where\r\n\r\n private \r\n data N* : Set where\r\n Zero* : N*\r\n One* : N*\r\n Two* : N*\r\n Three* : N* \r\n Four* : N*\r\n\r\n NA : Set\r\n NA = N*\r\n\r\n zero : NA\r\n zero = Zero* \r\n \r\n one : NA\r\n one = One*\r\n\r\n two : NA\r\n two = Two*\r\n\r\n three : NA\r\n three = Three*\r\n\r\n four : NA\r\n four = Four*\r\n\r\n postulate\r\n even02 : Zero* ≡ Two*\r\n even04 : Zero* ≡ Four*\r\n odd13 : One* ≡ Three*\r\n\r\n recNA : (C : Set) → (c0 c1 c2 c3 c4 : C) → \r\n (ceven02 : c0 ≡ c2) → (ceven04 : c0 ≡ c4) → (codd13 : c1 ≡ c3) → \r\n NA → C\r\n recNA C c0 c1 c2 c3 c4 _ _ _ Zero* = c0\r\n recNA C c0 c1 c2 c3 c4 _ _ _ One* = c1\r\n recNA C c0 c1 c2 c3 c4 _ _ _ Two* = c2\r\n recNA C c0 c1 c2 c3 c4 _ _ _ Three* = c3\r\n recNA C c0 c1 c2 c3 c4 _ _ _ Four* = c4\r\n\r\nopen Parity\r\n\r\n-- Now we define functions back and forth\r\n\r\nabs : N → NA\r\nabs = recN NA zero one two three four\r\n\r\ncon : NA → N\r\ncon = recNA N Two Three Two Three Two (refl Two) (refl Two) (refl Three)\r\n\r\n-- Computations on N and NA can be related\r\n-- Concrete computation\r\n\r\nincN : N → N\r\n\r\nincN Zero = One\r\nincN One = Two\r\nincN Two = Three\r\nincN Three = Four\r\nincN Four = Zero\r\n\r\n-- we can apply an operation in the abstract domain and report the\r\n-- approximate result\r\n\r\nabsF : (N → N) → (NA → NA)\r\nabsF f = abs ○ f ○ con\r\n\r\napprox : (N → N) → (N → N)\r\napprox f n = con ((absF f) (abs n))\r\n\r\ntest0 : approx incN Zero ≡ Three\r\ntest0 = refl Three\r\n\r\ntest1 : approx incN One ≡ Two\r\ntest1 = refl Two\r\n\r\ntest2 : approx incN Two ≡ Three\r\ntest2 = refl Three\r\n\r\ntest3 : approx incN Three ≡ Two\r\ntest3 = refl Two\r\n\r\ntest4 : approx incN Four ≡ Three\r\ntest4 = refl Three\r\n\r\n------------------------------------------------------------------------------\r\n", "meta": {"hexsha": "a85c30fa9a2712cb42e5dd80c8d6c3c58928b07e", "size": 2639, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "OBT/O.agda", "max_stars_repo_name": "JacquesCarette/pi-dual", "max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 14, "max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z", "max_issues_repo_path": "OBT/O.agda", "max_issues_repo_name": "JacquesCarette/pi-dual", "max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z", "max_forks_repo_path": "OBT/O.agda", "max_forks_repo_name": "JacquesCarette/pi-dual", "max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z", "avg_line_length": 21.631147541, "max_line_length": 79, "alphanum_fraction": 0.5505873437, "num_tokens": 881, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391617003942, "lm_q2_score": 0.7718434925908524, "lm_q1q2_score": 0.6664032011419861}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Fresh lists, a proof relevant variant of Catarina Coquand's contexts in\n-- \"A Formalised Proof of the Soundness and Completeness of a Simply Typed\n-- Lambda-Calculus with Explicit Substitutions\"\n------------------------------------------------------------------------\n\n-- See README.Data.List.Fresh and README.Data.Trie.NonDependent for\n-- examples of how to use fresh lists.\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Data.List.Fresh where\n\nopen import Level using (Level; _⊔_; Lift)\nopen import Data.Bool.Base using (true; false)\nopen import Data.Unit.Base\nopen import Data.Product using (∃; _×_; _,_; -,_; proj₁; proj₂)\nopen import Data.List.Relation.Unary.All using (All; []; _∷_)\nopen import Data.List.Relation.Unary.AllPairs using (AllPairs; []; _∷_)\nopen import Data.Maybe.Base as Maybe using (Maybe; just; nothing)\nopen import Data.Nat.Base using (ℕ; zero; suc)\nopen import Function using (_∘′_; flip; id; _on_)\nopen import Relation.Nullary using (does)\nopen import Relation.Unary as U using (Pred)\nopen import Relation.Binary as B using (Rel)\nopen import Relation.Nary\n\nprivate\n variable\n a b p r s : Level\n A : Set a\n B : Set b\n\n------------------------------------------------------------------------\n-- Basic type\n\n-- If we pick an R such that (R a b) means that a is different from b\n-- then we have a list of distinct values.\n\nmodule _ {a} (A : Set a) (R : Rel A r) where\n\n data List# : Set (a ⊔ r)\n fresh : (a : A) (as : List#) → Set r\n\n data List# where\n [] : List#\n cons : (a : A) (as : List#) → fresh a as → List#\n\n -- Whenever R can be reconstructed by η-expansion (e.g. because it is\n -- the erasure ⌊_⌋ of a decidable predicate, cf. Relation.Nary) or we\n -- do not care about the proof, it is convenient to get back list syntax.\n\n -- We use a different symbol to avoid conflict when importing both Data.List\n -- and Data.List.Fresh.\n infixr 5 _∷#_\n pattern _∷#_ x xs = cons x xs _\n\n fresh a [] = Lift _ ⊤\n fresh a (x ∷# xs) = R a x × fresh a xs\n\n-- Convenient notation for freshness making A and R implicit parameters\ninfix 5 _#_\n_#_ : {R : Rel A r} (a : A) (as : List# A R) → Set r\n_#_ = fresh _ _\n\n------------------------------------------------------------------------\n-- Operations for modifying fresh lists\n\nmodule _ {R : Rel A r} {S : Rel B s} (f : A → B) (R⇒S : ∀[ R ⇒ (S on f) ]) where\n\n map : List# A R → List# B S\n map-# : ∀ {a} as → a # as → f a # map as\n\n map [] = []\n map (cons a as ps) = cons (f a) (map as) (map-# as ps)\n\n map-# [] _ = _\n map-# (a ∷# as) (p , ps) = R⇒S p , map-# as ps\n\nmodule _ {R : Rel B r} (f : A → B) where\n\n map₁ : List# A (R on f) → List# B R\n map₁ = map f id\n\nmodule _ {R : Rel A r} {S : Rel A s} (R⇒S : ∀[ R ⇒ S ]) where\n\n map₂ : List# A R → List# A S\n map₂ = map id R⇒S\n\n------------------------------------------------------------------------\n-- Views\n\ndata Empty {A : Set a} {R : Rel A r} : List# A R → Set (a ⊔ r) where\n [] : Empty []\n\ndata NonEmpty {A : Set a} {R : Rel A r} : List# A R → Set (a ⊔ r) where\n cons : ∀ x xs pr → NonEmpty (cons x xs pr)\n\n------------------------------------------------------------------------\n-- Operations for reducing fresh lists\n\nlength : {R : Rel A r} → List# A R → ℕ\nlength [] = 0\nlength (_ ∷# xs) = suc (length xs)\n\n------------------------------------------------------------------------\n-- Operations for constructing fresh lists\n\npattern [_] a = a ∷# []\n\nfromMaybe : {R : Rel A r} → Maybe A → List# A R\nfromMaybe nothing = []\nfromMaybe (just a) = [ a ]\n\nmodule _ {R : Rel A r} (R-refl : B.Reflexive R) where\n\n replicate : ℕ → A → List# A R\n replicate-# : (n : ℕ) (a : A) → a # replicate n a\n\n replicate zero a = []\n replicate (suc n) a = cons a (replicate n a) (replicate-# n a)\n\n replicate-# zero a = _\n replicate-# (suc n) a = R-refl , replicate-# n a\n\n------------------------------------------------------------------------\n-- Operations for deconstructing fresh lists\n\nuncons : {R : Rel A r} → List# A R → Maybe (A × List# A R)\nuncons [] = nothing\nuncons (a ∷# as) = just (a , as)\n\nhead : {R : Rel A r} → List# A R → Maybe A\nhead = Maybe.map proj₁ ∘′ uncons\n\ntail : {R : Rel A r} → List# A R → Maybe (List# A R)\ntail = Maybe.map proj₂ ∘′ uncons\n\ntake : {R : Rel A r} → ℕ → List# A R → List# A R\ntake-# : {R : Rel A r} → ∀ n a (as : List# A R) → a # as → a # take n as\n\ntake zero xs = []\ntake (suc n) [] = []\ntake (suc n) (cons a as ps) = cons a (take n as) (take-# n a as ps)\n\ntake-# zero a xs _ = _\ntake-# (suc n) a [] ps = _\ntake-# (suc n) a (x ∷# xs) (p , ps) = p , take-# n a xs ps\n\ndrop : {R : Rel A r} → ℕ → List# A R → List# A R\ndrop zero as = as\ndrop (suc n) [] = []\ndrop (suc n) (a ∷# as) = drop n as\n\nmodule _ {P : Pred A p} (P? : U.Decidable P) where\n\n takeWhile : {R : Rel A r} → List# A R → List# A R\n takeWhile-# : ∀ {R : Rel A r} a (as : List# A R) → a # as → a # takeWhile as\n\n takeWhile [] = []\n takeWhile (cons a as ps) with does (P? a)\n ... | true = cons a (takeWhile as) (takeWhile-# a as ps)\n ... | false = []\n\n takeWhile-# a [] _ = _\n takeWhile-# a (x ∷# xs) (p , ps) with does (P? x)\n ... | true = p , takeWhile-# a xs ps\n ... | false = _\n\n dropWhile : {R : Rel A r} → List# A R → List# A R\n dropWhile [] = []\n dropWhile aas@(a ∷# as) with does (P? a)\n ... | true = dropWhile as\n ... | false = aas\n\n filter : {R : Rel A r} → List# A R → List# A R\n filter-# : ∀ {R : Rel A r} a (as : List# A R) → a # as → a # filter as\n\n filter [] = []\n filter (cons a as ps) with does (P? a)\n ... | true = cons a (filter as) (filter-# a as ps)\n ... | false = filter as\n\n filter-# a [] _ = _\n filter-# a (x ∷# xs) (p , ps) with does (P? x)\n ... | true = p , filter-# a xs ps\n ... | false = filter-# a xs ps\n\n------------------------------------------------------------------------\n-- Relationship to List and AllPairs\n\ntoList : {R : Rel A r} → List# A R → ∃ (AllPairs R)\ntoAll : ∀ {R : Rel A r} {a} as → fresh A R a as → All (R a) (proj₁ (toList as))\n\ntoList [] = -, []\ntoList (cons x xs ps) = -, toAll xs ps ∷ proj₂ (toList xs)\n\ntoAll [] ps = []\ntoAll (a ∷# as) (p , ps) = p ∷ toAll as ps\n\nfromList : ∀ {R : Rel A r} {xs} → AllPairs R xs → List# A R\nfromList-# : ∀ {R : Rel A r} {x xs} (ps : AllPairs R xs) →\n All (R x) xs → x # fromList ps\n\nfromList [] = []\nfromList (r ∷ rs) = cons _ (fromList rs) (fromList-# rs r)\n\nfromList-# [] _ = _\nfromList-# (p ∷ ps) (r ∷ rs) = r , fromList-# ps rs\n", "meta": {"hexsha": "a73ccf5b7fdf281767c8926fe978229bd7b226ce", "size": 6766, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib/src/Data/List/Fresh.agda", "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_issues_repo_path": "agda-stdlib/src/Data/List/Fresh.agda", "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib/src/Data/List/Fresh.agda", "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "avg_line_length": 31.9150943396, "max_line_length": 80, "alphanum_fraction": 0.4985220219, "num_tokens": 2201, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8633916064586998, "lm_q2_score": 0.7718434925908525, "lm_q1q2_score": 0.6664031930027097}} {"text": "module plfa.part1.Naturals where\n\nimport Relation.Binary.PropositionalEquality as Eq\n\n-- import Data.Nat using (ℕ; zero; suc; _+_; _*_; _^_; _∸_)\n\nopen Eq using (_≡_; refl)\nopen Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _∎)\n\n-- 'refl' - the name for evidence that two terms are equal\n\n-- Agda uses underbars to indicate where terms appear in\n-- infix or mixfix operators:\n--\n-- * _≡_ and _≡⟨⟩_ -- infix\n-- * begin_ -- prefix\n-- * _∎ -- postfix\n\ndata ℕ : Set where\n zero : ℕ\n suc : ℕ → ℕ\n\n-- The following pragma tells Agda that ℕ corresponds to the\n-- natural numbers, and hence one is permitted to type 0 as\n-- shorthand for 'zero,' 1 as shorthand for 'suc zero'. It also\n-- enables a more efficient internal representation of naturals\n-- using the Haskell type for arbitrary-precision integers.\n\n{-# BUILTIN NATURAL ℕ #-}\n\n-- Operations on naturals are recursive functions\n\n-- The empty braces are called a hole,\n-- and 0 is a number used for referring to the hole\n\n-------------------------------------------------------------\n-- Workflow & hotkeys:\n-------------------------------------------------------------\n-- C-c C-l - load the current file\n-- C-c C-f - moves to the next hole\n-- C-c C-b - moves to the previous hole\n-- C-c C-, - displays information on the required\n-- type of the hole and available free vars\n-- C-c C-c - case split on a variable\n-- C-c C-SPC - give to the hole at point an expression in it\n-- C-c C-r - solve the case trivially (refine)\n-- gd - go to definition (custom key binding)\n-------------------------------------------------------------\n\n_+_ : ℕ → ℕ → ℕ\nzero + n = n\nsuc m + n = suc (m + n)\n\n-- It works because addition of larger numbers is defined in\n-- terms of addition of smaller numbers. Such a definition is\n-- called well founded.\n\n-- 0 + n ≡ n\n-- (1 + m) + n ≡ 1 + (m + n)\n\n-- We write '=' for definitions, while we write '≡' for\n-- assertions that two already defined things are the same.\n\n_ : 2 + 3 ≡ 5\n_ =\n begin\n 2 + 3\n ≡⟨⟩\n (suc (suc zero)) + (suc (suc (suc zero)))\n ≡⟨⟩\n suc ((suc zero) + (suc (suc (suc zero))))\n ≡⟨⟩\n suc (suc (zero + (suc (suc (suc zero)))))\n ≡⟨⟩\n suc (suc (suc (suc (suc zero))))\n ≡⟨⟩\n 5\n ∎\n\n_ : 2 + 3 ≡ 5\n_ =\n begin\n 2 + 3\n ≡⟨⟩\n suc (1 + 3)\n ≡⟨⟩\n suc (suc (0 + 3))\n ≡⟨⟩\n suc (suc 3)\n ≡⟨⟩\n 5\n ∎\n\n-- In fact, both proofs are longer than need be, and Agda is\n-- satisfied with the following:\n\n_ : 2 + 3 ≡ 5\n_ = refl\n\n-- Agda knows how to compute the value of 2 + 3, and so can\n-- immediately check it is the same as 5. A binary relation is\n-- said to be reflexive if every value relates to itself.\n-- Evidence that a value is equal to itself is written 'refl'.\n\n-- ^ 'refl' is defined almost the\n-- same way as 'eq_relf' in Coq\n\n-- Excercise:\n\n_ : 3 + 4 ≡ 7\n_ =\n begin\n 3 + 4\n ≡⟨⟩\n suc (2 + 4)\n ≡⟨⟩\n suc (suc (1 + 4))\n ≡⟨⟩\n suc (suc (suc (0 + 4)))\n ≡⟨⟩\n 7\n ∎\n\n-- Multiplication\n\n_*_ : ℕ → ℕ → ℕ\nzero * n = zero\n(suc m) * n = n + (m * n)\n\n_ =\n begin\n 2 * 3\n ≡⟨⟩ -- inductive case\n 3 + (1 * 3)\n ≡⟨⟩ -- inductive case\n 3 + (3 + (0 * 3))\n ≡⟨⟩ -- base case\n 3 + (3 + 0)\n ≡⟨⟩ -- simplify\n 6\n ∎\n\n-- Exercise:\n\n_^_ : ℕ → ℕ → ℕ\nm ^ zero = suc zero\nm ^ (suc n) = m * (m ^ n)\n\n_ : 3 ^ 4 ≡ 81\n_ =\n begin\n 3 ^ 4\n ≡⟨⟩\n 3 * (3 ^ 3)\n ≡⟨⟩\n 3 * (3 * (3 ^ 2))\n ≡⟨⟩\n 3 * (3 * (3 * (3 ^ 1)))\n ≡⟨⟩\n 81\n ∎\n\n_∸_ : ℕ → ℕ → ℕ\nm ∸ zero = m\nzero ∸ suc n = zero\nsuc m ∸ suc n = m ∸ n\n\n_ =\n begin\n 3 ∸ 2\n ≡⟨⟩\n 2 ∸ 1\n ≡⟨⟩\n 1 ∸ 0\n ≡⟨⟩\n 1\n ∎\n\n_ =\n begin\n 2 ∸ 3\n ≡⟨⟩\n 1 ∸ 2\n ≡⟨⟩\n 0 ∸ 1\n ≡⟨⟩\n 0\n ∎\n\n-- Precedence\n\ninfixl 6 _+_ _∸_\ninfixl 7 _*_\n\n-- Application binds more tightly than\n-- (or has precedence over) any operator\n\n-- Currying _\n\n-- ℕ → ℕ → ℕ stands for ℕ → (ℕ → ℕ)\n\n-- and\n\n-- _+_ 2 3 stands for (_+_ 2) 3.\n\n-- Writing definitions interactively\n\n_+₁_ : ℕ → ℕ → ℕ\nzero +₁ n = n\nsuc m +₁ n = suc (m +₁ n)\n\n-- Exercise\n\ndata Bin : Set where\n ⟨⟩ : Bin\n _O : Bin → Bin\n _I : Bin → Bin\n\ninc : Bin → Bin\ninc ⟨⟩ = ⟨⟩ O\ninc (x O) = x I\ninc (x I) = inc x O\n\n_ : inc (⟨⟩ I O I I) ≡ ⟨⟩ I I O O\n_ = {!!}\n\nto : ℕ → Bin\nto zero = ⟨⟩ O\nto (suc m) = (to m) I\n\n\n_ : to 12 ≡ ⟨⟩ I O I I\n_ = {!!}\n\nfrom : Bin → ℕ\nfrom ⟨⟩ = 0\nfrom (x O) = from x\nfrom (x I) = suc (from x)\n\n_ : from (⟨⟩ I O I I) ≡ 12\n_ = {!!}\n", "meta": {"hexsha": "fcd04406bd070647f361fdace840178825457cd6", "size": 4375, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "part1/Naturals.agda", "max_stars_repo_name": "vyorkin/plfa", "max_stars_repo_head_hexsha": "3429c5ef0a2636330f2d4e5e77b22605102a2247", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "part1/Naturals.agda", "max_issues_repo_name": "vyorkin/plfa", "max_issues_repo_head_hexsha": "3429c5ef0a2636330f2d4e5e77b22605102a2247", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "part1/Naturals.agda", "max_forks_repo_name": "vyorkin/plfa", "max_forks_repo_head_hexsha": "3429c5ef0a2636330f2d4e5e77b22605102a2247", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.0785123967, "max_line_length": 63, "alphanum_fraction": 0.5117714286, "num_tokens": 1723, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619263765707, "lm_q2_score": 0.8080672204860316, "lm_q1q2_score": 0.6662206572436747}} {"text": "open import Prelude\nopen import Data.Nat.Properties.Simple \n using (+-comm; +-right-identity; +-assoc)\n\nopen import RW.Language.RTerm\n\nopen import Relation.Binary.PropositionalEquality\nopen import RW.Strategy.PropEq\n\nopen import RW.RW (≡-strat ∷ [])\n\nmodule PropEqTransitivityTest where\n\n open ≡-Reasoning\n\n -- This is pretty slow...\n test2 : (x y : ℕ) → (x + y) + 0 ≡ y + (x + 0)\n test2 x y\n = begin\n (x + y) + 0\n ≡⟨ (tactic (by*-≡ (quote +-comm ∷ quote +-assoc ∷ []))) ⟩\n y + (x + 0)\n ∎\n\n {- \n\n Using a max height of 2 in the goal guesser.\n\n Finished RWTestingTrans.\n 46,981,963,256 bytes allocated in the heap\n 7,318,699,728 bytes copied during GC\n 387,537,960 bytes maximum residency (20 sample(s))\n 8,253,392 bytes maximum slop\n 1042 MB total memory in use (0 MB lost due to fragmentation)\n\n Tot time (elapsed) Avg pause Max pause\n Gen 0 90092 colls, 0 par 17.25s 17.25s 0.0002s 0.0030s\n Gen 1 20 colls, 0 par 5.15s 5.17s 0.2587s 0.6522s\n\n INIT time 0.00s ( 0.00s elapsed)\n MUT time 241.64s (241.88s elapsed)\n GC time 22.40s ( 22.42s elapsed)\n EXIT time 0.09s ( 0.09s elapsed)\n Total time 264.12s (264.40s elapsed)\n\n %GC time 8.5% (8.5% elapsed)\n\n Alloc rate 194,432,035 bytes per MUT second\n\n Productivity 91.5% of total user, 91.4% of total elapsed\n\n -}\n {-\n\n Using a height of 1\n\n Finished RWTestingTrans.\n 31,222,657,544 bytes allocated in the heap\n 5,109,928,984 bytes copied during GC\n 355,162,768 bytes maximum residency (18 sample(s))\n 7,579,240 bytes maximum slop\n 952 MB total memory in use (0 MB lost due to fragmentation)\n\n Tot time (elapsed) Avg pause Max pause\n Gen 0 59723 colls, 0 par 12.21s 12.22s 0.0002s 0.0036s\n Gen 1 18 colls, 0 par 3.91s 3.92s 0.2179s 0.6516s\n\n INIT time 0.00s ( 0.00s elapsed)\n MUT time 154.42s (154.57s elapsed)\n GC time 16.12s ( 16.14s elapsed)\n EXIT time 0.09s ( 0.09s elapsed)\n Total time 170.63s (170.80s elapsed)\n\n %GC time 9.5% (9.5% elapsed)\n\n Alloc rate 202,197,812 bytes per MUT second\n\n Productivity 90.5% of total user, 90.5% of total elapsed\n\n -}\n", "meta": {"hexsha": "fe26cc83ca2be13fe8868ab6e1d234005df8f90a", "size": 2368, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Testing/PropEqTransitivityTest.agda", "max_stars_repo_name": "VictorCMiraldo/agda-rw", "max_stars_repo_head_hexsha": "2856afd12b7dbbcc908482975638d99220f38bf2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2015-02-09T15:43:38.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-24T17:38:20.000Z", "max_issues_repo_path": "Testing/PropEqTransitivityTest.agda", "max_issues_repo_name": "VictorCMiraldo/agda-rw", "max_issues_repo_head_hexsha": "2856afd12b7dbbcc908482975638d99220f38bf2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-06T15:03:33.000Z", "max_issues_repo_issues_event_max_datetime": "2015-05-28T14:48:03.000Z", "max_forks_repo_path": "Testing/PropEqTransitivityTest.agda", "max_forks_repo_name": "VictorCMiraldo/agda-rw", "max_forks_repo_head_hexsha": "2856afd12b7dbbcc908482975638d99220f38bf2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.2345679012, "max_line_length": 76, "alphanum_fraction": 0.5891047297, "num_tokens": 867, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467770088162, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.6662124839504375}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category\n\n-- Definition of the Arrow Category of a Category C\nmodule Categories.Category.Construction.Arrow {o ℓ e} (C : Category o ℓ e) where\n\nopen import Level\nopen import Data.Product using (_,_; _×_; map; zip)\nopen import Function using (_$_)\nopen import Relation.Binary using (Rel)\n\nimport Categories.Morphism as M\nopen M C\nopen import Categories.Morphism.Reasoning C\n\nopen Category C hiding (dom; cod)\nopen HomReasoning\n\nprivate\n variable\n A B D E : Obj\n\nrecord Morphism : Set (o ⊔ ℓ) where\n field\n {dom} : Obj\n {cod} : Obj\n arr : dom ⇒ cod\n\nrecord Morphism⇒ (f g : Morphism) : Set (ℓ ⊔ e) where\n constructor mor⇒\n private\n module f = Morphism f\n module g = Morphism g\n\n field\n {dom⇒} : f.dom ⇒ g.dom\n {cod⇒} : f.cod ⇒ g.cod\n square : CommutativeSquare f.arr dom⇒ cod⇒ g.arr\n\nArrow : Category _ _ _\nArrow = record\n { Obj = Morphism\n ; _⇒_ = Morphism⇒\n ; _≈_ = λ f g → dom⇒ f ≈ dom⇒ g × cod⇒ f ≈ cod⇒ g\n ; id = mor⇒ $ identityˡ ○ ⟺ identityʳ\n ; _∘_ = λ m₁ m₂ → mor⇒ $ glue (square m₁) (square m₂)\n ; assoc = assoc , assoc\n ; sym-assoc = sym-assoc , sym-assoc\n ; identityˡ = identityˡ , identityˡ\n ; identityʳ = identityʳ , identityʳ\n ; identity² = identity² , identity²\n ; equiv = record\n { refl = refl , refl\n ; sym = map sym sym\n ; trans = zip trans trans\n }\n ; ∘-resp-≈ = zip ∘-resp-≈ ∘-resp-≈\n }\n where open Morphism⇒\n\nprivate\n module MM = M Arrow\n\nmodule _ where\n open _≅_\n\n lift-iso : ∀ {f h} →\n (iso₁ : A ≅ D) → (iso₂ : B ≅ E) →\n CommutativeSquare f (from iso₁) (from iso₂) h →\n record { arr = f } MM.≅ record { arr = h }\n lift-iso {f = f} {h = h} iso₁ iso₂ sq = record\n { from = record { square = sq }\n ; to = record { square = begin\n to iso₂ ∘ h ≈⟨ introʳ (isoʳ iso₁) ⟩\n (to iso₂ ∘ h) ∘ from iso₁ ∘ to iso₁ ≈⟨ assoc ⟩\n to iso₂ ∘ h ∘ from iso₁ ∘ to iso₁ ≈˘⟨ refl ⟩∘⟨ pushˡ sq ⟩\n to iso₂ ∘ (from iso₂ ∘ f) ∘ to iso₁ ≈˘⟨ assoc ⟩\n (to iso₂ ∘ (from iso₂ ∘ f)) ∘ to iso₁ ≈⟨ cancelˡ (isoˡ iso₂) ⟩∘⟨ refl ⟩\n f ∘ to iso₁ ∎ }\n ; iso = record\n { isoˡ = isoˡ iso₁ , isoˡ iso₂\n ; isoʳ = isoʳ iso₁ , isoʳ iso₂\n }\n }\n", "meta": {"hexsha": "d7dfc7a0f38a7b766948a510c0a5b755a1c1fccd", "size": 2343, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Category/Construction/Arrow.agda", "max_stars_repo_name": "Taneb/agda-categories", "max_stars_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Categories/Category/Construction/Arrow.agda", "max_issues_repo_name": "Taneb/agda-categories", "max_issues_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Category/Construction/Arrow.agda", "max_forks_repo_name": "Taneb/agda-categories", "max_forks_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.5647058824, "max_line_length": 80, "alphanum_fraction": 0.5548442168, "num_tokens": 882, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8791467643431001, "lm_q2_score": 0.7577943712746407, "lm_q1q2_score": 0.6662124695435142}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- \"Finite\" sets indexed on coinductive \"natural\" numbers\n------------------------------------------------------------------------\n\nmodule Data.Cofin where\n\nopen import Coinduction\nopen import Data.Conat as Conat using (Coℕ; suc; ∞ℕ)\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Data.Fin using (Fin; zero; suc)\n\n------------------------------------------------------------------------\n-- The type\n\n-- Note that Cofin ∞ℕ is /not/ finite. Note also that this is not a\n-- coinductive type, but it is indexed on a coinductive type.\n\ndata Cofin : Coℕ → Set where\n zero : ∀ {n} → Cofin (suc n)\n suc : ∀ {n} (i : Cofin (♭ n)) → Cofin (suc n)\n\n------------------------------------------------------------------------\n-- Some operations\n\nfromℕ : ℕ → Cofin ∞ℕ\nfromℕ zero = zero\nfromℕ (suc n) = suc (fromℕ n)\n\ntoℕ : ∀ {n} → Cofin n → ℕ\ntoℕ zero = zero\ntoℕ (suc i) = suc (toℕ i)\n\nfromFin : ∀ {n} → Fin n → Cofin (Conat.fromℕ n)\nfromFin zero = zero\nfromFin (suc i) = suc (fromFin i)\n\ntoFin : ∀ n → Cofin (Conat.fromℕ n) → Fin n\ntoFin zero ()\ntoFin (suc n) zero = zero\ntoFin (suc n) (suc i) = suc (toFin n i)\n", "meta": {"hexsha": "f086244fabdb586605166d80985c8b916455237e", "size": 1227, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Data/Cofin.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Data/Cofin.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Data/Cofin.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.5348837209, "max_line_length": 72, "alphanum_fraction": 0.4849225754, "num_tokens": 376, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9230391685381604, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.6661972490390007}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Sets.EquivalenceRelations\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Integers.Definition\nopen import Numbers.Naturals.Order\nopen import LogicalFormulae\nopen import Groups.Definition\nopen import Rings.Orders.Partial.Definition\nopen import Rings.Orders.Total.Definition\nopen import Setoids.Orders.Partial.Definition\nopen import Setoids.Orders.Total.Definition\nopen import Setoids.Setoids\nopen import Functions.Definition\nopen import Rings.Definition\nopen import Fields.Fields\nopen import Fields.Orders.Partial.Definition\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\n\nmodule Fields.Orders.Total.Archimedean {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} {R : Ring S _+_ _*_} {c : _} {_<_ : A → A → Set c} {pOrder : SetoidPartialOrder S _<_} {F : Field R} (p : PartiallyOrderedField F pOrder) where\n\nopen Setoid S\nopen Equivalence eq\nopen Ring R\nopen Group additiveGroup\nopen import Groups.Lemmas additiveGroup\nopen import Groups.Cyclic.Definition additiveGroup\nopen import Groups.Cyclic.DefinitionLemmas additiveGroup\nopen import Groups.Orders.Archimedean (toGroup R (PartiallyOrderedField.oRing p))\nopen import Rings.Orders.Partial.Lemmas (PartiallyOrderedField.oRing p)\nopen import Rings.InitialRing R\nopen SetoidPartialOrder pOrder\nopen PartiallyOrderedRing (PartiallyOrderedField.oRing p)\nopen Field F\n\nArchimedeanField : Set (a ⊔ c)\nArchimedeanField = (x : A) → (0R < x) → Sg ℕ (λ n → x < (fromN n))\n\nprivate\n lemma : (r : A) (N : ℕ) → (positiveEltPower 1R N * r) ∼ positiveEltPower r N\n lemma r zero = timesZero'\n lemma r (succ n) = transitive *DistributesOver+' (+WellDefined identIsIdent (lemma r n))\n\n findBound : (0<1 : 0R < 1R) → (r s : A) (N : ℕ) → (1R < r) → (s < positiveEltPower 1R N) → s < positiveEltPower r N\n findBound _ r s zero 1 0\nalwaysPos n = s≤s z≤n\n\nalwaysPosC : □ (_> 0) readSuc\nalwaysPosC = λ p → s≤s z≤n\n\nsometimes3 : ◇ (_≡ 3) readSuc\nsometimes3 = suc (suc zero) , refl\n\nsometimes5 : ◇ (_≡ 5) readSuc\nsometimes5 = suc (suc (suc (suc zero))) , refl\n\n-- It is always the case that constantly readSuc outputs ℕ > 0,\n-- regardless of the environment\nalways>0 : AG (map (_> 0) (constantly readSuc))\nnowA (always>0 p) = alwaysPos p\nlaterA (always>0 p) = {!!}\n\n{-nowA always>0 = λ p → s≤s z≤n\nlaterA always>0 = λ p → always>0\n-}\n\n{-\nnowA always>0 p = s≤s z≤n\nlaterA always>0 p = always>0\n-}\n\n-- Sums all values in the reader-environment\nsumFrom : ℕ → FStream (ReaderC ℕ) ℕ\nproj₁ (inF (sumFrom n0)) = tt\nhead (proj₂ (inF (sumFrom n0)) n) = n0 + n\ntail (proj₂ (inF (sumFrom n0)) n) = sumFrom (n0 + n)\n\nsum : FStream (ReaderC ℕ) ℕ\nsum = sumFrom 0\n\n-- Eventually the sum is greater than 2\neventuallysometimes>2 : EF (map (_> 2) sum)\n-- ... having 3 as input, this is of course the case after 1 step\neventuallysometimes>2 = ? --alreadyE (suc (suc (suc zero)) , s≤s (s≤s (s≤s z≤n)))\n\n-- Always somehow the sum is greater than 2\nalwaysSomehow>2 : ∀ {i} → EG {i} (map (_> 2) sum)\nalwaysSomehow>2 = {!!}\n\n{-proj₁ alwaysSomehow>2 = suc (suc (suc zero))\nnowE' (proj₂ alwaysSomehow>2) = s≤s (s≤s (s≤s z≤n))\nproj₁ (laterE' (proj₂ alwaysSomehow>2)) = zero\nproj₂ (laterE' (proj₂ alwaysSomehow>2)) = {! !}\n-}\n\n{-\nnowE alwaysSomehow>2 = (ℕ.suc (ℕ.suc (ℕ.suc ℕ.zero)) , s≤s (s≤s (s≤s z≤n)))\nlaterE alwaysSomehow>2 = ℕ.zero , alwaysSomehow>2\n-}\n\n\n\n\n\n--\n", "meta": {"hexsha": "b0780bfd57e74b630e2f68d859f046bc0e70c1c6", "size": 1977, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "CTL/ModalityExamples.agda", "max_stars_repo_name": "Aerate/condatis", "max_stars_repo_head_hexsha": "64d95885579395f641e9a9cb1b9487cf79280446", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-12-13T16:52:28.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-13T16:52:28.000Z", "max_issues_repo_path": "CTL/ModalityExamples.agda", "max_issues_repo_name": "zimbatm/condatis", "max_issues_repo_head_hexsha": "64d95885579395f641e9a9cb1b9487cf79280446", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2017-06-03T20:02:22.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-01T16:52:07.000Z", "max_forks_repo_path": "CTL/ModalityExamples.agda", "max_forks_repo_name": "zimbatm/condatis", "max_forks_repo_head_hexsha": "64d95885579395f641e9a9cb1b9487cf79280446", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-12-13T15:56:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-13T15:56:38.000Z", "avg_line_length": 24.4074074074, "max_line_length": 81, "alphanum_fraction": 0.6054628225, "num_tokens": 723, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9073122263731811, "lm_q2_score": 0.7341195152660687, "lm_q1q2_score": 0.6660756118200573}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Sets.EquivalenceRelations\nopen import Setoids.Setoids\nopen import Functions.Definition\nopen import Groups.Definition\nopen import Groups.Homomorphisms.Definition\nopen import Groups.Subgroups.Definition\nopen import Groups.Subgroups.Normal.Definition\n\nmodule Groups.Cosets {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} (G : Group S _+_) {c : _} {pred : A → Set c} (subgrp : Subgroup G pred) where\n\nopen Equivalence (Setoid.eq S)\nopen import Groups.Lemmas G\nopen Group G\nopen Subgroup subgrp\n\ncosetSetoid : Setoid A\nSetoid._∼_ cosetSetoid g h = pred ((Group.inverse G h) + g)\nEquivalence.reflexive (Setoid.eq cosetSetoid) = isSubset (symmetric (Group.invLeft G)) containsIdentity\nEquivalence.symmetric (Setoid.eq cosetSetoid) yx = isSubset (transitive invContravariant (+WellDefined reflexive invInv)) (closedUnderInverse yx)\nEquivalence.transitive (Setoid.eq cosetSetoid) yx zy = isSubset (transitive +Associative (+WellDefined (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight)) reflexive)) (closedUnderPlus zy yx)\n\ncosetGroup : normalSubgroup G subgrp → Group cosetSetoid _+_\nGroup.+WellDefined (cosetGroup norm) {m} {n} {x} {y} m=x n=y = ans\n where\n t : pred (inverse y + n)\n t = n=y\n u : pred (inverse x + m)\n u = m=x\n v : pred (m + inverse x)\n v = isSubset (+WellDefined reflexive (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight))) (norm u)\n ans' : pred ((inverse y) + ((inverse x + m) + inverse (inverse y)))\n ans' = norm u\n ans'' : pred ((inverse y) + ((inverse x + m) + y))\n ans'' = isSubset (+WellDefined reflexive (+WellDefined reflexive (invTwice y))) ans'\n ans : pred (inverse (x + y) + (m + n))\n ans = isSubset (transitive (transitive +Associative (transitive (+WellDefined (transitive (symmetric +Associative) (transitive (+WellDefined reflexive (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight))) +Associative)) reflexive) (symmetric +Associative))) (symmetric (+WellDefined invContravariant reflexive))) (closedUnderPlus ans'' t)\nGroup.0G (cosetGroup norm) = 0G\nGroup.inverse (cosetGroup norm) = inverse\nGroup.+Associative (cosetGroup norm) {a} {b} {c} = isSubset (symmetric (transitive (+WellDefined (inverseWellDefined (symmetric +Associative)) reflexive) (invLeft {a + (b + c)}))) containsIdentity\nGroup.identRight (cosetGroup norm) = isSubset (symmetric (transitive +Associative (transitive (+WellDefined invLeft reflexive) identRight))) containsIdentity\nGroup.identLeft (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive identLeft) invLeft)) containsIdentity\nGroup.invLeft (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive invLeft) invLeft)) containsIdentity\nGroup.invRight (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive invRight) invLeft)) containsIdentity\n\ncosetGroupHom : (norm : normalSubgroup G subgrp) → GroupHom G (cosetGroup norm) id\nGroupHom.groupHom (cosetGroupHom norm) = isSubset (symmetric (transitive (+WellDefined invContravariant reflexive) (transitive +Associative (transitive (+WellDefined (transitive (symmetric +Associative) (+WellDefined reflexive invLeft)) reflexive) (transitive (+WellDefined identRight reflexive) invLeft))))) (Subgroup.containsIdentity subgrp)\nGroupHom.wellDefined (cosetGroupHom norm) {x} {y} x=y = isSubset (symmetric (transitive (+WellDefined reflexive x=y) invLeft)) (Subgroup.containsIdentity subgrp)\n", "meta": {"hexsha": "35ef2809f0226dba2c0f61791f45c712e9ea4aae", "size": 3599, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Groups/Cosets.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Groups/Cosets.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Groups/Cosets.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 71.98, "max_line_length": 385, "alphanum_fraction": 0.7504862462, "num_tokens": 1027, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8962513786759491, "lm_q2_score": 0.7431680199891789, "lm_q1q2_score": 0.6660653625031768}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Relation.Binary.PropositionalEquality.Subst.Properties where\n\n-- Properties of 'subst' onto binary relations.\n\nopen import Level\nopen import Function using (_$_; flip) renaming (id to idFun; _∘_ to _⊚_)\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality\nopen import Relation.Binary.Construct.Closure.ReflexiveTransitive\n\nprivate\n variable\n ℓ ℓ₁ ℓ₂ t t₁ t₂ o : Level\n\n-- Two shorthands: transport the domain or codomain of a relation along an equality.\nmodule Shorthands {O : Set o} (R : Rel O ℓ) where\n infixr 9 _◂_\n infixl 9 _▸_\n\n _◂_ : ∀ {A B C} → A ≡ B → R B C → R A C\n p ◂ f = subst (flip R _) (sym p) f\n\n _▸_ : ∀ {A B C} → R A B → B ≡ C → R A C\n f ▸ p = subst (R _) p f\n\n -- Some simple properties of transports\nmodule Transport {O : Set o} (R : Rel O ℓ) where\n open Shorthands R public\n\n ◂-▸-id : ∀ {A} (f : R A A) → refl ◂ f ≡ f ▸ refl\n ◂-▸-id f = refl\n\n ◂-▸-comm : ∀ {A B C D} (p : A ≡ B) (f : R B C) (q : C ≡ D) →\n (p ◂ (f ▸ q)) ≡ ((p ◂ f) ▸ q)\n ◂-▸-comm refl f refl = refl\n\n ◂-assocˡ : ∀ {A B C D} (p : A ≡ B) {q : B ≡ C} (f : R C D) →\n p ◂ q ◂ f ≡ (trans p q) ◂ f\n ◂-assocˡ refl {refl} f = refl\n\n ▸-assocʳ : ∀ {A B C D} (f : R A B) {p : B ≡ C} (q : C ≡ D) →\n f ▸ p ▸ q ≡ f ▸ trans p q\n ▸-assocʳ f {refl} refl = refl\n\n-- If we have a relation Q over a relation R, we can transport over that too\nmodule TransportOverQ {O : Set o} (R : Rel O ℓ) (Q : {X Y : O} → Rel (R X Y) t) where\n open Transport R\n\n ◂-resp-≈ : ∀ {A B C} (p : A ≡ B) {f g : R B C} → Q f g → Q (p ◂ f) (p ◂ g)\n ◂-resp-≈ refl f≈g = f≈g\n\n ▸-resp-≈ : ∀ {A B C} {f g : R A B} → Q f g → (p : B ≡ C) → Q (f ▸ p) (g ▸ p)\n ▸-resp-≈ f≈g refl = f≈g\n\n-- Given two relations and a homomorphism between them,\n-- congruence properties over subst\nmodule TransportMor {O₁ O₂ : Set o}\n (R₁ : Rel O₁ ℓ) (R₂ : Rel O₂ t)\n (M₀ : O₁ → O₂)\n (M₁ : ∀ {A B} → R₁ A B → R₂ (M₀ A) (M₀ B)) where\n\n open Shorthands R₁\n open Shorthands R₂ renaming (_◂_ to _◃_; _▸_ to _▹_)\n\n M-resp-▸ : ∀ {A B C} (f : R₁ A B) (p : B ≡ C) →\n M₁ (f ▸ p) ≡ M₁ f ▹ cong M₀ p\n M-resp-▸ f refl = refl\n\n M-resp-◂ : ∀ {A B C} (p : A ≡ B) (f : R₁ B C) →\n M₁ (p ◂ f) ≡ cong M₀ p ◃ M₁ f\n M-resp-◂ refl f = refl\n\n\n-- Transports on paths\nmodule TransportStar {O : Set o} (R : Rel O ℓ) where\n open Shorthands (Star R) public renaming\n ( _◂_ to _◂*_\n ; _▸_ to _▸*_\n )\n open Shorthands R\n\n -- Lemmas relating transports to path operations.\n\n ◂*-▸*-ε : {A B : O} (p : A ≡ B) → ε ▸* p ≡ p ◂* ε\n ◂*-▸*-ε refl = refl\n\n ◂*-◅ : {A B C D : O} (p : A ≡ B) (f : R B C) (fs : Star R C D) →\n p ◂* (f ◅ fs) ≡ (p ◂ f) ◅ fs\n ◂*-◅ refl f fs = refl\n\n ◅-▸* : {A B C D : O} (f : R A B) (fs : Star R B C) (p : C ≡ D) →\n (f ◅ fs) ▸* p ≡ f ◅ (fs ▸* p)\n ◅-▸* f fs refl = refl\n\n ◅-◂*-▸ : {A B C D : O} (f : R A B) (p : B ≡ C) (fs : Star R C D) →\n _≡_ {_} {Star R A D} (f ◅ (p ◂* fs)) ((f ▸ p) ◅ fs)\n ◅-◂*-▸ f refl fs = refl\n", "meta": {"hexsha": "629586589c0923fb7ba8a1c91d49f09685892d98", "size": 3035, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Relation/Binary/PropositionalEquality/Subst/Properties.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Relation/Binary/PropositionalEquality/Subst/Properties.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Relation/Binary/PropositionalEquality/Subst/Properties.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 30.35, "max_line_length": 86, "alphanum_fraction": 0.5057660626, "num_tokens": 1388, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8539127566694177, "lm_q2_score": 0.7799928951399098, "lm_q1q2_score": 0.6660458832714804}} {"text": "module BHeap.Heap {A : Set}(_≤_ : A → A → Set) where\n\nopen import BHeap _≤_ \nopen import Bound.Lower A\nopen import Bound.Lower.Order _≤_\nopen import BTree.Heap _≤_\n\nlemma-bheap-heap : {b : Bound}(h : BHeap b) → Heap (forget h)\nlemma-bheap-heap lf = leaf\nlemma-bheap-heap (nd {x = x} _ lf lf) = single x\nlemma-bheap-heap (nd _ (nd (lexy x≤y) l r) lf) = left x≤y (lemma-bheap-heap (nd (lexy x≤y) l r))\nlemma-bheap-heap (nd _ lf (nd (lexy x≤y) l r)) = right x≤y (lemma-bheap-heap (nd (lexy x≤y) l r))\nlemma-bheap-heap (nd _ (nd (lexy x≤y) l r) (nd (lexy x≤y') l' r')) = both x≤y x≤y' (lemma-bheap-heap (nd (lexy x≤y) l r)) (lemma-bheap-heap (nd (lexy x≤y') l' r'))\n", "meta": {"hexsha": "a05534c90196e8da324eacb0a1ea129d141c846d", "size": 662, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/BHeap/Heap.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/BHeap/Heap.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/BHeap/Heap.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 47.2857142857, "max_line_length": 163, "alphanum_fraction": 0.6299093656, "num_tokens": 291, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.914900957313305, "lm_q2_score": 0.7279754371026368, "lm_q1q2_score": 0.666025424305774}} {"text": "------------------------------------------------------------------------------\n-- Exclusive disjunction theorems\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOL.ExclusiveDisjunction.TheoremsI where\n\n-- The theorems below are valid on intuitionistic logic and with an\n-- empty domain.\nopen import FOL.Base hiding ( D≢∅ ; pem )\nopen import FOL.ExclusiveDisjunction.Base\n\n------------------------------------------------------------------------------\n\np⊻q→p→¬q : {P Q : Set} → P ⊻ Q → P → ¬ Q\np⊻q→p→¬q (inj₁ _ , h) p q = h (p , q)\np⊻q→p→¬q (inj₂ _ , h) p q = h (p , q)\n\np⊻q→q→¬p : {P Q : Set} → P ⊻ Q → Q → ¬ P\np⊻q→q→¬p (inj₁ _ , h) q p = h (p , q)\np⊻q→q→¬p (inj₂ _ , h) q p = h (p , q)\n\np⊻q→¬p→q : {P Q : Set} → P ⊻ Q → ¬ P → Q\np⊻q→¬p→q (inj₁ p , _) ¬p = ⊥-elim (¬p p)\np⊻q→¬p→q (inj₂ q , _) _ = q\n\np⊻q→¬q→p : {P Q : Set} → P ⊻ Q → ¬ Q → P\np⊻q→¬q→p (inj₁ p , _) ¬q = p\np⊻q→¬q→p (inj₂ q , _) ¬q = ⊥-elim (¬q q)\n", "meta": {"hexsha": "333903e5edd1f3483defc57eed57e606e806b6ea", "size": 1124, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/FOL/ExclusiveDisjunction/TheoremsI.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/FOL/ExclusiveDisjunction/TheoremsI.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/FOL/ExclusiveDisjunction/TheoremsI.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 33.0588235294, "max_line_length": 78, "alphanum_fraction": 0.4003558719, "num_tokens": 426, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8856314677809303, "lm_q2_score": 0.7520125682019722, "lm_q1q2_score": 0.6660059945664195}} {"text": "open import Data.List using ( List ; [] ; _∷_ )\nopen import Data.Nat using ( ℕ ; zero ; suc )\nopen import Data.Maybe using ( Maybe ; just ; nothing )\nopen import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; subst )\nopen import Relation.Binary.PropositionalEquality.TrustMe using ( trustMe )\n\nmodule AssocFree.Util where\n\n≡-relevant : ∀ {α} {A : Set α} {a b : A} → .(a ≡ b) → (a ≡ b)\n≡-relevant a≡b = trustMe\n\nδsubst₂ : ∀ {a b p} {A : Set a} {B : A → Set b} (P : ∀ a → B a → Set p)\n {x₁ x₂ y₁ y₂} → (x₁≡x₂ : x₁ ≡ x₂) → (subst B x₁≡x₂ y₁ ≡ y₂) → P x₁ y₁ → P x₂ y₂\nδsubst₂ P refl refl p = p\n\nsubst-natural : ∀ {α β γ} {A : Set α} {B : A → Set β} {C : A → Set γ} {a₁ a₂ : A} \n (p : a₁ ≡ a₂) (f : ∀ {a} → B a → C a) (b : B a₁) →\n subst C p (f b) ≡ f (subst B p b)\nsubst-natural refl f b = refl\n\nlookup : ∀ {α} {A : Set α} → List A → ℕ → Maybe A\nlookup [] n = nothing\nlookup (a ∷ as) zero = just a\nlookup (a ∷ as) (suc n) = lookup as n\n", "meta": {"hexsha": "59b2767df25dd806f850080bc1f2c115de7af545", "size": 971, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/AssocFree/Util.agda", "max_stars_repo_name": "agda/agda-assoc-free", "max_stars_repo_head_hexsha": "08337fdb8375137a52cc9b3ade766305191b2394", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2016-11-22T11:48:31.000Z", "max_stars_repo_stars_event_max_datetime": "2020-08-27T20:56:20.000Z", "max_issues_repo_path": "src/AssocFree/Util.agda", "max_issues_repo_name": "agda/agda-assoc-free", "max_issues_repo_head_hexsha": "08337fdb8375137a52cc9b3ade766305191b2394", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/AssocFree/Util.agda", "max_forks_repo_name": "agda/agda-assoc-free", "max_forks_repo_head_hexsha": "08337fdb8375137a52cc9b3ade766305191b2394", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-03-03T04:39:31.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:38:44.000Z", "avg_line_length": 38.84, "max_line_length": 88, "alphanum_fraction": 0.5592173018, "num_tokens": 391, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8596637577007394, "lm_q2_score": 0.7745833945721304, "lm_q1q2_score": 0.6658812716304722}} {"text": "\n-- Concrete definition of contexts over a sort T\nmodule SOAS.Context {T : Set} where\n\nopen import SOAS.Common\n\nopen import Data.List using (List; []; _∷_; _++_)\n\n\n-- Context: a list of types\ndata Ctx : Set where\n ∅ : Ctx\n _∙_ : (α : T) → (Γ : Ctx) → Ctx\ninfixr 50 _∙_\n\n-- Singleton context\npattern _⌋ τ = τ ∙ ∅\npattern ⌈_⌋ α = α ∙ ∅\npattern ⌊_ α = α\ninfixr 60 _⌋\ninfix 70 ⌈_⌋\ninfix 70 ⌊_\n\n-- Context concatenation\n_∔_ : Ctx → Ctx → Ctx\n∅ ∔ Δ = Δ\n(α ∙ Γ) ∔ Δ = α ∙ (Γ ∔ Δ)\ninfixl 20 _∔_\n\n-- Context concatenation is associative\n∔-assoc : (Γ Δ Θ : Ctx) → ((Γ ∔ Δ) ∔ Θ) ≡ (Γ ∔ (Δ ∔ Θ))\n∔-assoc ∅ Δ Θ = refl\n∔-assoc (α ∙ Γ) Δ Θ = cong (α ∙_) (∔-assoc Γ Δ Θ)\n\n-- Empty context is right unit of context concatenation\n∔-unitʳ : (Γ : Ctx) → Γ ∔ ∅ ≡ Γ\n∔-unitʳ ∅ = refl\n∔-unitʳ (α ∙ Γ) = cong (α ∙_) (∔-unitʳ Γ)\n", "meta": {"hexsha": "a1a6703d414d7d40f2f571b8780bbba737a2d0f8", "size": 813, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "SOAS/Context.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "SOAS/Context.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "SOAS/Context.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 20.8461538462, "max_line_length": 55, "alphanum_fraction": 0.5670356704, "num_tokens": 393, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9032942067038784, "lm_q2_score": 0.7371581684030624, "lm_q1q2_score": 0.6658707029429282}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Category.Complete where\n\nopen import Level\n\nopen import Categories.Category\nopen import Categories.Category.Construction.Cones\nopen import Categories.Functor\nopen import Categories.Diagram.Cone.Properties\nopen import Categories.Diagram.Limit using (Limit)\n\nComplete : (o ℓ e : Level) {o′ ℓ′ e′ : Level} (C : Category o′ ℓ′ e′) → Set _\nComplete o ℓ e C = ∀ {J : Category o ℓ e} (F : Functor J C) → Limit F\n\n-- a functor between diagrams corresponds to a morphism between limits\nmodule _ {o ℓ e o′ ℓ′ e′} {C : Category o′ ℓ′ e′} (Com : Complete o ℓ e C)\n {J J′ : Category o ℓ e} (F : Functor J′ J) (G : Functor J C) where\n\n private\n module C = Category C\n module J = Category J\n module J′ = Category J′\n module F = Functor F\n module G = Functor G\n\n F⇒arr : Cones (G ∘F F) [ F-map-Coneʳ F (Limit.limit (Com G)) , Limit.limit (Com (G ∘F F)) ]\n F⇒arr = Limit.rep-cone (Com (G ∘F F)) (F-map-Coneʳ F (Limit.limit (Com G)))\n", "meta": {"hexsha": "dd23aafc715b8a0021b7e73a419fa446b745314c", "size": 993, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Complete.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Complete.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Complete.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 34.2413793103, "max_line_length": 93, "alphanum_fraction": 0.6576032226, "num_tokens": 325, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9184802395624257, "lm_q2_score": 0.7248702821204019, "lm_q1q2_score": 0.66577903037363}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nmodule Categories.Category.Finite.Fin.Construction.Discrete where\n\nopen import Data.Product using (∃; _,_)\nopen import Data.Nat using (ℕ)\nopen import Data.Fin\nopen import Data.Fin.Patterns\nopen import Function using (case_of_)\n\nopen import Relation.Nullary using (Dec; yes; no)\nopen import Relation.Binary.PropositionalEquality as ≡ using (_≡_ ; refl; ≡-≟-identity; ≢-≟-identity)\n\nopen import Categories.Category.Finite.Fin\nopen import Categories.Category\n\nprivate\n card : ∀ {n} (j k : Fin n) → ℕ\n card {ℕ.suc n} 0F 0F = 1\n card {ℕ.suc n} 0F (suc k) = 0\n card {ℕ.suc n} (suc j) 0F = 0\n card {ℕ.suc n} (suc j) (suc k) = card j k\n\n id : ∀ {n} (a : Fin n) → Fin (card a a)\n id {ℕ.suc n} 0F = 0F\n id {ℕ.suc n} (suc a) = id a\n\n comp : ∀ n {a b c : Fin n} → Fin (card b c) → Fin (card a b) → Fin (card a c)\n comp (ℕ.suc n) {0F} {0F} {0F} f g = 0F\n comp (ℕ.suc n) {suc a} {suc b} {suc c} f g = comp n f g\n\n assoc : ∀ n {a b c d : Fin n}\n {f : Fin (card a b)} {g : Fin (card b c)} {h : Fin (card c d)} →\n (comp n (comp n h g) f) ≡ comp n h (comp n g f)\n assoc (ℕ.suc n) {0F} {0F} {0F} {0F} {f} {g} {h} = refl\n assoc (ℕ.suc n) {suc a} {suc b} {suc c} {suc d} {f} {g} {h} = assoc n\n\n identityˡ : ∀ n {a b : Fin n} {f : Fin (card a b)} → comp n (id b) f ≡ f\n identityˡ (ℕ.suc n) {0F} {0F} {0F} = refl\n identityˡ (ℕ.suc n) {suc a} {suc b} {f} = identityˡ n\n\n identityʳ : ∀ n {a b : Fin n} {f : Fin (card a b)} → comp n f (id a) ≡ f\n identityʳ (ℕ.suc n) {0F} {0F} {0F} = refl\n identityʳ (ℕ.suc n) {suc a} {suc b} {f} = identityʳ n\n\nmodule _ (n : ℕ) where\n\n DiscreteShape : FinCatShape\n DiscreteShape = record\n { size = n\n ; ∣_⇒_∣ = card {n}\n ; hasShape = record\n { id = id {n} _\n ; _∘_ = comp n\n ; assoc = assoc n\n ; identityˡ = identityˡ n\n ; identityʳ = identityʳ n\n }\n }\n\nDiscrete : ∀ n → Category _ _ _\nDiscrete n = FinCategory (DiscreteShape n)\n\nmodule Discrete n = Category (Discrete n)\n", "meta": {"hexsha": "61de0c07bb92bb8334dc159d893f17f39f36f13f", "size": 2073, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Finite/Fin/Construction/Discrete.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/Finite/Fin/Construction/Discrete.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/Finite/Fin/Construction/Discrete.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.8923076923, "max_line_length": 101, "alphanum_fraction": 0.5513748191, "num_tokens": 858, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9184802373309982, "lm_q2_score": 0.7248702702332475, "lm_q1q2_score": 0.6657790178380179}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Functor.Core where\n\nopen import Level\nopen import Function renaming (id to id→; _∘_ to _●_) using ()\nopen import Relation.Binary hiding (_⇒_)\n\nimport Relation.Binary.Reasoning.Setoid as SetoidR\n\nimport Categories.Morphism as M\n\nprivate\n variable\n o ℓ e o′ ℓ′ e′ o′′ ℓ′′ e′′ : Level\n C D : Category o ℓ e\n\nrecord Functor (C : Category o ℓ e) (D : Category o′ ℓ′ e′) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where\n eta-equality\n private module C = Category C\n private module D = Category D\n\n field\n F₀ : C.Obj → D.Obj\n F₁ : ∀ {A B} (f : C [ A , B ]) → D [ F₀ A , F₀ B ]\n\n identity : ∀ {A} → D [ F₁ (C.id {A}) ≈ D.id ]\n homomorphism : ∀ {X Y Z} {f : C [ X , Y ]} {g : C [ Y , Z ]} →\n D [ F₁ (C [ g ∘ f ]) ≈ D [ F₁ g ∘ F₁ f ] ]\n F-resp-≈ : ∀ {A B} {f g : C [ A , B ]} → C [ f ≈ g ] → D [ F₁ f ≈ F₁ g ]\n\n op : Functor C.op D.op\n op = record\n { F₀ = F₀\n ; F₁ = F₁\n ; identity = identity\n ; homomorphism = homomorphism\n ; F-resp-≈ = F-resp-≈\n }\n\nEndofunctor : Category o ℓ e → Set _\nEndofunctor C = Functor C C\n\nid : ∀ {C : Category o ℓ e} → Endofunctor C\nid {C = C} = record\n { F₀ = id→\n ; F₁ = id→\n ; identity = refl\n ; homomorphism = refl\n ; F-resp-≈ = id→\n }\n where open Category.Equiv C\n\ninfixr 9 _∘F_\n\n-- note that this definition could be shortened a lot by inlining the definitions for\n-- identity′ and homomorphism′, but the definitions below are simpler to understand.\n_∘F_ : ∀ {C : Category o ℓ e} {D : Category o′ ℓ′ e′} {E : Category o′′ ℓ′′ e′′}\n → Functor D E → Functor C D → Functor C E\n_∘F_ {C = C} {D = D} {E = E} F G = record\n { F₀ = F₀ ● G₀\n ; F₁ = F₁ ● G₁\n ; identity = identity′\n ; homomorphism = homomorphism′\n ; F-resp-≈ = F-resp-≈ ● G-resp-≈\n }\n where\n module C = Category C\n module D = Category D\n module E = Category E\n module F = Functor F\n module G = Functor G\n open F\n open G renaming (F₀ to G₀; F₁ to G₁; F-resp-≈ to G-resp-≈)\n\n identity′ : ∀ {A} → E [ F₁ (G₁ (C.id {A})) ≈ E.id ]\n identity′ = begin\n F₁ (G₁ C.id) ≈⟨ F-resp-≈ G.identity ⟩\n F₁ D.id ≈⟨ F.identity ⟩\n E.id ∎\n where open SetoidR E.hom-setoid\n\n homomorphism′ : ∀ {X Y Z} {f : C [ X , Y ]} {g : C [ Y , Z ]}\n → E [ F₁ (G₁ (C [ g ∘ f ])) ≈ E [ F₁ (G₁ g) ∘ F₁ (G₁ f) ] ]\n homomorphism′ {f = f} {g = g} = begin\n F₁ (G₁ (C [ g ∘ f ])) ≈⟨ F-resp-≈ G.homomorphism ⟩\n F₁ (D [ G₁ g ∘ G₁ f ]) ≈⟨ F.homomorphism ⟩\n E [ F₁ (G₁ g) ∘ F₁ (G₁ f) ] ∎\n where open SetoidR E.hom-setoid\n", "meta": {"hexsha": "f53d81e447f124b2c39c7b5eee73bbd19f30f6a8", "size": 2655, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Categories/Functor/Core.agda", "max_stars_repo_name": "Taneb/agda-categories", "max_stars_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Categories/Functor/Core.agda", "max_issues_repo_name": "Taneb/agda-categories", "max_issues_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Categories/Functor/Core.agda", "max_forks_repo_name": "Taneb/agda-categories", "max_forks_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.8586956522, "max_line_length": 98, "alphanum_fraction": 0.5246704331, "num_tokens": 1072, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267864276108, "lm_q2_score": 0.7662936484231889, "lm_q1q2_score": 0.6657764480194086}} {"text": "-- Copyright: (c) 2016 Ertugrul Söylemez\n-- License: BSD3\n-- Maintainer: Ertugrul Söylemez \n\nmodule Algebra.Category.Semigroupoid where\n\nopen import Core\n\n\n-- A semigroupoid is a set of objects and morphisms between objects\n-- together with an associative binary function that combines morphisms.\n\nrecord Semigroupoid {c h r} : Set (lsuc (c ⊔ h ⊔ r)) where\n field\n Ob : Set c\n Hom : Ob → Ob → Set h\n Eq : ∀ {A B} → Equiv {r = r} (Hom A B)\n _∘_ : ∀ {A B C} → Hom B C → Hom A B → Hom A C\n\n infixl 6 _∘_\n\n open module MyEquiv {A} {B} = Equiv (Eq {A} {B}) public\n\n field\n ∘-cong :\n ∀ {A B C}\n {f1 f2 : Hom B C} {g1 g2 : Hom A B}\n → f1 ≈ f2 → g1 ≈ g2 → f1 ∘ g1 ≈ f2 ∘ g2\n\n assoc :\n ∀ {A B C D}\n (f : Hom C D) (g : Hom B C) (h : Hom A B)\n → (f ∘ g) ∘ h ≈ f ∘ (g ∘ h)\n\n Epic : ∀ {A B} → (f : Hom A B) → Set _\n Epic f = ∀ {C} {g1 g2 : Hom _ C} → g1 ∘ f ≈ g2 ∘ f → g1 ≈ g2\n\n Monic : ∀ {B C} → (f : Hom B C) → Set _\n Monic f = ∀ {A} {g1 g2 : Hom A _} → f ∘ g1 ≈ f ∘ g2 → g1 ≈ g2\n\n Unique : ∀ {A B} → (f : Hom A B) → Set _\n Unique f = ∀ g → f ≈ g\n\n IsProduct : ∀ A B AB → (fst : Hom AB A) (snd : Hom AB B) → Set _\n IsProduct A B AB fst snd =\n ∀ AB' (fst' : Hom AB' A) (snd' : Hom AB' B) →\n ∃ (λ (u : Hom AB' AB) → Unique u × (fst ∘ u ≈ fst') × (snd ∘ u ≈ snd'))\n\n record Product A B : Set (c ⊔ h ⊔ r) where\n field\n A×B : Ob\n cfst : Hom A×B A\n csnd : Hom A×B B\n isProduct : IsProduct A B A×B cfst csnd\n\n record _bimonic_ A B : Set (c ⊔ h ⊔ r) where\n field\n to : Hom A B\n from : Hom B A\n to-monic : Monic to\n from-monic : Monic from\n\n\n-- A semifunctor is a composition-preserving mapping from a semigroupoid\n-- to another.\n\nrecord Semifunctor\n {cc ch cr dc dh dr}\n (C : Semigroupoid {cc} {ch} {cr})\n (D : Semigroupoid {dc} {dh} {dr})\n : Set (cc ⊔ ch ⊔ cr ⊔ dc ⊔ dh ⊔ dr)\n where\n\n private\n module C = Semigroupoid C\n module D = Semigroupoid D\n\n field\n F : C.Ob → D.Ob\n map : ∀ {A B} → C.Hom A B → D.Hom (F A) (F B)\n\n map-cong :\n ∀ {A B} {f g : C.Hom A B}\n → f C.≈ g\n → map f D.≈ map g\n\n ∘-preserving :\n ∀ {A B C}\n (f : C.Hom B C) (g : C.Hom A B)\n → map (f C.∘ g) D.≈ map f D.∘ map g\n", "meta": {"hexsha": "a1e59b957649dc72a3eca7cd7d6ed68c26be4d01", "size": 2313, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Algebra/Category/Semigroupoid.agda", "max_stars_repo_name": "esoeylemez/agda-simple", "max_stars_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-10-07T17:36:42.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-07T17:36:42.000Z", "max_issues_repo_path": "Algebra/Category/Semigroupoid.agda", "max_issues_repo_name": "esoeylemez/agda-simple", "max_issues_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Algebra/Category/Semigroupoid.agda", "max_forks_repo_name": "esoeylemez/agda-simple", "max_forks_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.4175824176, "max_line_length": 75, "alphanum_fraction": 0.4963251189, "num_tokens": 958, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887588023318196, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.6657578643267121}} {"text": "module prelude.list where\nopen import Data.Nat renaming (zero to z; suc to s)\nopen import Data.Fin as Fin using (Fin)\nimport Data.Fin as Fin renaming (zero to z; suc to s)\nopen import Agda.Builtin.Sigma\nopen import Data.Product\nopen import Relation.Binary.PropositionalEquality.Core using (_≡_; _≢_; refl; cong)\nopen import Data.Empty\nopen import Function\n\nVect : ∀ {ℓ} → ℕ → Set ℓ → Set ℓ\nVect n t = Fin n → t\nList : ∀ {ℓ} → Set ℓ → Set ℓ\nList t = Σ[ n ∈ ℕ ] Vect n t\nlen : ∀ {ℓ} {a : Set ℓ} → List a → ℕ\nlen = fst\nhead : ∀ {ℓ} {a : Set ℓ} → (as : List a) → (len as ≢ z) → a\nhead (z , as) n≢0 = ⊥-elim (n≢0 refl)\nhead (s n , as) _ = as Fin.z\ntail : ∀ {ℓ} {a : Set ℓ} → (as : List a) → (len as ≢ z) → List a\ntail (z , as) n≢0 = ⊥-elim (n≢0 refl)\ntail (s n , as) _ = n , (as ∘ Fin.inject₁)\n", "meta": {"hexsha": "3b2407f9882bced8d9067f71b37d5787054db06a", "size": 789, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "code-examples/agda/prelude/list.agda", "max_stars_repo_name": "mstone/poly", "max_stars_repo_head_hexsha": "425de958985aacbd3284d3057fe21fd682e315ea", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 53, "max_stars_repo_stars_event_min_datetime": "2021-02-18T16:31:04.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T23:08:27.000Z", "max_issues_repo_path": "code-examples/agda/prelude/list.agda", "max_issues_repo_name": "dspivak/poly", "max_issues_repo_head_hexsha": "425de958985aacbd3284d3057fe21fd682e315ea", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-09-02T02:29:39.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-12T10:06:32.000Z", "max_forks_repo_path": "code-examples/agda/prelude/list.agda", "max_forks_repo_name": "dspivak/poly", "max_forks_repo_head_hexsha": "425de958985aacbd3284d3057fe21fd682e315ea", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-07-10T17:19:37.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-30T11:45:57.000Z", "avg_line_length": 34.3043478261, "max_line_length": 83, "alphanum_fraction": 0.6070975919, "num_tokens": 315, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.888758793492457, "lm_q2_score": 0.7490872187162396, "lm_q1q2_score": 0.6657578527268654}} {"text": "module Metalogic.Classical.Propositional.Syntax {ℓₚ} (Proposition : Set(ℓₚ)) where\n\nimport Lvl\n\ninfixl 1011 •_\ninfixl 1010 ¬_\ninfixl 1005 _∧_\ninfixl 1004 _∨_\ninfixl 1000 _⇐_ _⇔_ _⇒_\n\ndata Formula : Set(ℓₚ) where\n •_ : Proposition → Formula\n\n ⊤ : Formula\n ⊥ : Formula\n\n ¬_ : Formula → Formula\n\n _∧_ : Formula → Formula → Formula\n _∨_ : Formula → Formula → Formula\n _⇒_ : Formula → Formula → Formula\n\n_⇐_ : Formula → Formula → Formula\n_⇐_ a b = _⇒_ b a\n\n_⇔_ : Formula → Formula → Formula\n_⇔_ a b = (_⇐_ a b) ∧ (_⇒_ a b)\n", "meta": {"hexsha": "a83fd8e924dda4af6756b6e8d8c6d5751a914925", "size": 525, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "old/Metalogic/Metalogic/Classical/Propositional/Syntax.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "old/Metalogic/Metalogic/Classical/Propositional/Syntax.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "old/Metalogic/Metalogic/Classical/Propositional/Syntax.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.75, "max_line_length": 82, "alphanum_fraction": 0.6495238095, "num_tokens": 232, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9304582497090322, "lm_q2_score": 0.7154239957834733, "lm_q1q2_score": 0.6656721589165326}} {"text": "open import Relation.Binary.Core\n\nmodule BBHeap.Subtyping {A : Set}\n (_≤_ : A → A → Set) \n (trans≤ : Transitive _≤_) where\n\nopen import BBHeap _≤_\nopen import Bound.Lower A \nopen import Bound.Lower.Order _≤_\nopen import Bound.Lower.Order.Properties _≤_ trans≤\n\nsubtyping : {b b' : Bound} → LeB b' b → BBHeap b → BBHeap b'\nsubtyping _ leaf = leaf \nsubtyping b'≤b (left b≤x l⋘r) = left (transLeB b'≤b b≤x) l⋘r\nsubtyping b'≤b (right b≤x l⋙r) = right (transLeB b'≤b b≤x) l⋙r\n", "meta": {"hexsha": "ed2a0959a153a61fbbc223f166af6963c92f0905", "size": 505, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/BBHeap/Subtyping.agda", "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_issues_repo_path": "agda/BBHeap/Subtyping.agda", "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/BBHeap/Subtyping.agda", "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.5625, "max_line_length": 62, "alphanum_fraction": 0.6316831683, "num_tokens": 197, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9263037262250327, "lm_q2_score": 0.7185943985973772, "lm_q1q2_score": 0.6656366690651868}} {"text": "\ndata Bool : Set where\n true : Bool\n false : Bool\n\nrecord Eq (t : Set) : Set where\n field _==_ : t → t → Bool\n\nopen Eq {{...}}\n\n-- Now package this into a record type for \"sets with boolean equality\":\nrecord EqSet : Set₁ where\n field\n set : Set\n instance eq : Eq set\n\nopen EqSet\n\nequality : {{A : EqSet}} (x y : set A) → Bool\nequality x y = x == y\n", "meta": {"hexsha": "d41d2730c5b57e0d5f9bd77bb06aa1a542caf19a", "size": 359, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue1273.agda", "max_stars_repo_name": "alhassy/agda", "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_issues_repo_path": "test/Succeed/Issue1273.agda", "max_issues_repo_name": "alhassy/agda", "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/Succeed/Issue1273.agda", "max_forks_repo_name": "alhassy/agda", "max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 17.0952380952, "max_line_length": 72, "alphanum_fraction": 0.6072423398, "num_tokens": 113, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8991213691605411, "lm_q2_score": 0.740174367770488, "lm_q1q2_score": 0.665506590967339}} {"text": "module Data.Option.Setoid where\n\nimport Lvl\nopen import Data\nopen import Data.Option\nopen import Functional\nopen import Structure.Relator.Equivalence\nopen import Structure.Relator.Properties\nopen import Structure.Setoid\nopen import Type\n\nprivate variable ℓ ℓₑ ℓₑₐ : Lvl.Level\nprivate variable A : Type{ℓ}\n\ninstance\n Option-equiv : ⦃ equiv : Equiv{ℓₑ}(A) ⦄ → Equiv{ℓₑ}(Option A)\n Equiv._≡_ Option-equiv None None = Unit\n Equiv._≡_ Option-equiv None (Some _) = Empty\n Equiv._≡_ Option-equiv (Some _) None = Empty\n Equiv._≡_ Option-equiv (Some x) (Some y) = x ≡ y\n Reflexivity.proof (Equivalence.reflexivity (Equiv.equivalence Option-equiv)) {None} = <>\n Reflexivity.proof (Equivalence.reflexivity (Equiv.equivalence Option-equiv)) {Some _} = reflexivity(_≡_)\n Symmetry.proof (Equivalence.symmetry (Equiv.equivalence Option-equiv)) {None} {None} = const(<>)\n Symmetry.proof (Equivalence.symmetry (Equiv.equivalence Option-equiv)) {Some _} {Some _} = symmetry(_≡_)\n Transitivity.proof (Equivalence.transitivity (Equiv.equivalence Option-equiv)) {None} {None} {None} = const(const(<>))\n Transitivity.proof (Equivalence.transitivity (Equiv.equivalence Option-equiv)) {Some _} {Some _} {Some _} = transitivity(_≡_)\n", "meta": {"hexsha": "b294b14d51ae4f1425ff92c14dcf8dec1f7d559f", "size": 1272, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Data/Option/Setoid.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Data/Option/Setoid.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Data/Option/Setoid.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 47.1111111111, "max_line_length": 127, "alphanum_fraction": 0.715408805, "num_tokens": 386, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8991213826762114, "lm_q2_score": 0.7401743563075447, "lm_q1q2_score": 0.6655065906647144}} {"text": "{-# OPTIONS --safe #-}\nmodule Cubical.Algebra.Group.Instances.Int where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Data.Int renaming (Int to IntType ; _+_ to _+Int_ ; _-_ to _-Int_; -_ to -Int_ ; _·_ to _·Int_)\nopen import Cubical.Algebra.Group.Base\n\nopen GroupStr\n\nInt : Group₀\nfst Int = IntType\n1g (snd Int) = 0\n_·_ (snd Int) = _+Int_\ninv (snd Int) = _-Int_ 0\nisGroup (snd Int) = isGroupInt\n where\n abstract\n isGroupInt : IsGroup (pos 0) _+Int_ (_-Int_ (pos 0))\n isGroupInt = makeIsGroup isSetInt +-assoc (λ x → refl) (λ x → +-comm 0 x)\n (λ x → +-comm x (pos 0 -Int x) ∙ minusPlus x 0) (λ x → minusPlus x 0)\n", "meta": {"hexsha": "76030b039e3631979f1d3847c2587969bd6af914", "size": 665, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_stars_repo_name": "jespercockx/cubical", "max_stars_repo_head_hexsha": "94b474af2909727d04706d562d949928c19faf7b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_issues_repo_name": "jespercockx/cubical", "max_issues_repo_head_hexsha": "94b474af2909727d04706d562d949928c19faf7b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/Group/Instances/Int.agda", "max_forks_repo_name": "jespercockx/cubical", "max_forks_repo_head_hexsha": "94b474af2909727d04706d562d949928c19faf7b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-03-12T20:08:45.000Z", "max_forks_repo_forks_event_max_datetime": "2021-03-12T20:08:45.000Z", "avg_line_length": 31.6666666667, "max_line_length": 115, "alphanum_fraction": 0.6436090226, "num_tokens": 233, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9343951625409307, "lm_q2_score": 0.712232184238947, "lm_q1q2_score": 0.6655063075588329}} {"text": "------------------------------------------------------------------------\n-- Lemmas\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe --exact-split #-}\n\nmodule Math.Combinatorics.ListFunction.Properties.Lemma where\n\nopen import Data.List hiding (_∷ʳ_)\nimport Data.List.Properties as Lₚ\nopen import Data.List.Relation.Binary.Sublist.Propositional using (_⊆_; []; _∷_; _∷ʳ_)\nopen import Data.Product as Prod using (proj₁; proj₂; _×_; _,_)\nopen import Function\nopen import Relation.Binary.PropositionalEquality\n\nmodule _ {a} {A : Set a} where\n []⊆xs : ∀ (xs : List A) → [] ⊆ xs\n []⊆xs [] = []\n []⊆xs (x ∷ xs) = x ∷ʳ []⊆xs xs\n\nmodule _ {a b} {A : Set a} {B : Set b} where\n lemma₁ : ∀ (f : A → B) (x : A) (xss : List (List A)) →\n map (λ ys → f x ∷ ys) (map (map f) xss) ≡ map (map f) (map (λ ys → x ∷ ys) xss)\n lemma₁ f x xss = begin\n map (λ ys → f x ∷ ys) (map (map f) xss) ≡⟨ sym $ Lₚ.map-compose xss ⟩\n map (λ ys → f x ∷ map f ys) xss ≡⟨ Lₚ.map-compose xss ⟩\n map (map f) (map (λ ys → x ∷ ys) xss) ∎\n where open ≡-Reasoning\n\nmodule _ {a b c} {A : Set a} {B : Set b} {C : Set c} where\n proj₁-map₁ : ∀ (f : A → B) (t : A × C) → proj₁ (Prod.map₁ f t) ≡ f (Prod.proj₁ t)\n proj₁-map₁ _ _ = refl\n\nmodule _ {a b} {A : Set a} {B : Set b} where\n proj₁-map₂ : ∀ (f : B → B) (t : A × B) → proj₁ (Prod.map₂ f t) ≡ proj₁ t\n proj₁-map₂ _ _ = refl\n\n proj₁′ : A × B → A\n proj₁′ = proj₁\n", "meta": {"hexsha": "9b0cee2e607fe194262f6224f566c484649cd749", "size": 1464, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Math/Combinatorics/ListFunction/Properties/Lemma.agda", "max_stars_repo_name": "rei1024/agda-combinatorics", "max_stars_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-06-25T08:24:15.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-25T07:25:27.000Z", "max_issues_repo_path": "Math/Combinatorics/ListFunction/Properties/Lemma.agda", "max_issues_repo_name": "rei1024/agda-combinatorics", "max_issues_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Math/Combinatorics/ListFunction/Properties/Lemma.agda", "max_forks_repo_name": "rei1024/agda-combinatorics", "max_forks_repo_head_hexsha": "9fafa35c940ff7b893a80120f6a1f22b0a3917b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.6, "max_line_length": 86, "alphanum_fraction": 0.5109289617, "num_tokens": 545, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.841825655188238, "lm_q2_score": 0.7905303112671295, "lm_q1q2_score": 0.665488697228613}} {"text": "{-\n\nAxiom of Finite Choice\n- Yep, it's a theorem actually.\n\n-}\n{-# OPTIONS --safe #-}\n\nmodule Cubical.Data.FinSet.FiniteChoice where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.Equiv renaming (_∙ₑ_ to _⋆_)\n\nopen import Cubical.HITs.PropositionalTruncation as Prop\n\nopen import Cubical.Data.Nat\nopen import Cubical.Data.Unit\nopen import Cubical.Data.Empty\nopen import Cubical.Data.Sum\nopen import Cubical.Data.Sigma\n\nopen import Cubical.Data.SumFin\nopen import Cubical.Data.FinSet.Base\nopen import Cubical.Data.FinSet.Properties\n\nprivate\n variable\n ℓ ℓ' : Level\n\nchoice≃Fin :\n {n : ℕ}(Y : Fin n → Type ℓ) → ((x : Fin n) → ∥ Y x ∥) ≃ ∥ ((x : Fin n) → Y x) ∥\nchoice≃Fin {n = 0} Y =\n isContr→≃Unit (isContrΠ⊥)\n ⋆ Unit≃Unit*\n ⋆ invEquiv (propTruncIdempotent≃ isPropUnit*)\n ⋆ propTrunc≃ (invEquiv (isContr→≃Unit* (isContrΠ⊥ {A = Y})))\nchoice≃Fin {n = suc n} Y =\n Π⊎≃\n ⋆ Σ-cong-equiv-fst (ΠUnit (λ x → ∥ Y (inl x) ∥))\n ⋆ Σ-cong-equiv-snd (λ _ → choice≃Fin {n = n} (λ x → Y (inr x)))\n ⋆ Σ-cong-equiv-fst (propTrunc≃ (invEquiv (ΠUnit (λ x → Y (inl x)))))\n ⋆ ∥∥-×-≃\n ⋆ propTrunc≃ (invEquiv (Π⊎≃ {E = Y}))\n\nmodule _\n (X : Type ℓ)(p : isFinOrd X)\n (Y : X → Type ℓ') where\n\n private\n e = p .snd\n\n choice≃' : ((x : X) → ∥ Y x ∥) ≃ ∥ ((x : X) → Y x) ∥\n choice≃' =\n equivΠ {B' = λ x → ∥ Y (invEq e x) ∥} e (transpFamily p)\n ⋆ choice≃Fin _\n ⋆ propTrunc≃ (invEquiv (equivΠ {B' = λ x → Y (invEq e x)} e (transpFamily p)))\n\nmodule _\n (X : FinSet ℓ)\n (Y : X .fst → Type ℓ') where\n\n choice≃ : ((x : X .fst) → ∥ Y x ∥) ≃ ∥ ((x : X .fst) → Y x) ∥\n choice≃ =\n Prop.rec\n (isOfHLevel≃ 1 (isPropΠ (λ x → isPropPropTrunc)) isPropPropTrunc)\n (λ p → choice≃' (X .fst) (_ , p) Y) (X .snd .snd)\n\n choice : ((x : X .fst) → ∥ Y x ∥) → ∥ ((x : X .fst) → Y x) ∥\n choice = choice≃ .fst\n", "meta": {"hexsha": "eb5657278b99a77e9372e52fc0eea40953e0b3c3", "size": 1874, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Data/FinSet/FiniteChoice.agda", "max_stars_repo_name": "howsiyu/cubical", "max_stars_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Data/FinSet/FiniteChoice.agda", "max_issues_repo_name": "howsiyu/cubical", "max_issues_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Data/FinSet/FiniteChoice.agda", "max_forks_repo_name": "howsiyu/cubical", "max_forks_repo_head_hexsha": "1b9c97a2140fe96fe636f4c66beedfd7b8096e8f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.3943661972, "max_line_length": 82, "alphanum_fraction": 0.5939167556, "num_tokens": 810, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240895276223, "lm_q2_score": 0.7690802423634963, "lm_q1q2_score": 0.6654267524726392}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Category.BicartesianClosed {o ℓ e} (𝒞 : Category o ℓ e) where\n\nopen import Level\n\nopen import Categories.Category.CartesianClosed 𝒞\nopen import Categories.Category.Cocartesian 𝒞\n\nrecord BicartesianClosed : Set (levelOfTerm 𝒞) where\n field\n cartesianClosed : CartesianClosed\n cocartesian : Cocartesian\n\n module cartesianClosed = CartesianClosed cartesianClosed\n module cocartesian = Cocartesian cocartesian\n\n open cartesianClosed public\n open cocartesian public\n", "meta": {"hexsha": "dda23fc72e4fff896674e51df089381d3d2ee8ae", "size": 567, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/BicartesianClosed.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Category/BicartesianClosed.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Category/BicartesianClosed.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.7727272727, "max_line_length": 79, "alphanum_fraction": 0.7813051146, "num_tokens": 142, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9219218327098193, "lm_q2_score": 0.7217432182679956, "lm_q1q2_score": 0.6653908305315136}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- A universe which includes several kinds of \"relatedness\" for sets,\n-- such as equivalences, surjections and bijections\n------------------------------------------------------------------------\n\n{-# OPTIONS --without-K --safe #-}\n\nmodule Function.Related where\n\nopen import Level\nopen import Function\nopen import Function.Equality using (_⟨$⟩_)\nopen import Function.Equivalence as Eq using (Equivalence)\nopen import Function.Injection as Inj using (Injection; _↣_)\nopen import Function.Inverse as Inv using (Inverse; _↔_)\nopen import Function.LeftInverse as LeftInv using (LeftInverse)\nopen import Function.Surjection as Surj using (Surjection)\nopen import Relation.Binary\nopen import Relation.Binary.PropositionalEquality as P using (_≡_)\n\n------------------------------------------------------------------------\n-- Wrapper types\n\n-- Synonyms which are used to make _∼[_]_ below \"constructor-headed\"\n-- (which implies that Agda can deduce the universe code from an\n-- expression matching any of the right-hand sides).\n\nrecord _←_ {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where\n constructor lam\n field app-← : B → A\n\nopen _←_ public\n\nrecord _↢_ {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where\n constructor lam\n field app-↢ : B ↣ A\n\nopen _↢_ public\n\n------------------------------------------------------------------------\n-- Relatedness\n\n-- There are several kinds of \"relatedness\".\n\n-- The idea to include kinds other than equivalence and bijection came\n-- from Simon Thompson and Bengt Nordström. /NAD\n\ndata Kind : Set where\n implication : Kind\n reverse-implication : Kind\n equivalence : Kind\n injection : Kind\n reverse-injection : Kind\n left-inverse : Kind\n surjection : Kind\n bijection : Kind\n\n-- Interpretation of the codes above. The code \"bijection\" is\n-- interpreted as Inverse rather than Bijection; the two types are\n-- equivalent.\n\ninfix 4 _∼[_]_\n\n_∼[_]_ : ∀ {ℓ₁ ℓ₂} → Set ℓ₁ → Kind → Set ℓ₂ → Set _\nA ∼[ implication ] B = A → B\nA ∼[ reverse-implication ] B = A ← B\nA ∼[ equivalence ] B = Equivalence (P.setoid A) (P.setoid B)\nA ∼[ injection ] B = Injection (P.setoid A) (P.setoid B)\nA ∼[ reverse-injection ] B = A ↢ B\nA ∼[ left-inverse ] B = LeftInverse (P.setoid A) (P.setoid B)\nA ∼[ surjection ] B = Surjection (P.setoid A) (P.setoid B)\nA ∼[ bijection ] B = Inverse (P.setoid A) (P.setoid B)\n\n-- A non-infix synonym.\n\nRelated : Kind → ∀ {ℓ₁ ℓ₂} → Set ℓ₁ → Set ℓ₂ → Set _\nRelated k A B = A ∼[ k ] B\n\n-- The bijective equality implies any kind of relatedness.\n\n↔⇒ : ∀ {k x y} {X : Set x} {Y : Set y} →\n X ∼[ bijection ] Y → X ∼[ k ] Y\n↔⇒ {implication} = _⟨$⟩_ ∘ Inverse.to\n↔⇒ {reverse-implication} = lam ∘′ _⟨$⟩_ ∘ Inverse.from\n↔⇒ {equivalence} = Inverse.equivalence\n↔⇒ {injection} = Inverse.injection\n↔⇒ {reverse-injection} = lam ∘′ Inverse.injection ∘ Inv.sym\n↔⇒ {left-inverse} = Inverse.left-inverse\n↔⇒ {surjection} = Inverse.surjection\n↔⇒ {bijection} = id\n\n-- Actual equality also implies any kind of relatedness.\n\n≡⇒ : ∀ {k ℓ} {X Y : Set ℓ} → X ≡ Y → X ∼[ k ] Y\n≡⇒ P.refl = ↔⇒ Inv.id\n\n------------------------------------------------------------------------\n-- Special kinds of kinds\n\n-- Kinds whose interpretation is symmetric.\n\ndata Symmetric-kind : Set where\n equivalence : Symmetric-kind\n bijection : Symmetric-kind\n\n-- Forgetful map.\n\n⌊_⌋ : Symmetric-kind → Kind\n⌊ equivalence ⌋ = equivalence\n⌊ bijection ⌋ = bijection\n\n-- The proof of symmetry can be found below.\n\n-- Kinds whose interpretation include a function which \"goes in the\n-- forward direction\".\n\ndata Forward-kind : Set where\n implication : Forward-kind\n equivalence : Forward-kind\n injection : Forward-kind\n left-inverse : Forward-kind\n surjection : Forward-kind\n bijection : Forward-kind\n\n-- Forgetful map.\n\n⌊_⌋→ : Forward-kind → Kind\n⌊ implication ⌋→ = implication\n⌊ equivalence ⌋→ = equivalence\n⌊ injection ⌋→ = injection\n⌊ left-inverse ⌋→ = left-inverse\n⌊ surjection ⌋→ = surjection\n⌊ bijection ⌋→ = bijection\n\n-- The function.\n\n⇒→ : ∀ {k x y} {X : Set x} {Y : Set y} → X ∼[ ⌊ k ⌋→ ] Y → X → Y\n⇒→ {implication} = id\n⇒→ {equivalence} = _⟨$⟩_ ∘ Equivalence.to\n⇒→ {injection} = _⟨$⟩_ ∘ Injection.to\n⇒→ {left-inverse} = _⟨$⟩_ ∘ LeftInverse.to\n⇒→ {surjection} = _⟨$⟩_ ∘ Surjection.to\n⇒→ {bijection} = _⟨$⟩_ ∘ Inverse.to\n\n-- Kinds whose interpretation include a function which \"goes backwards\".\n\ndata Backward-kind : Set where\n reverse-implication : Backward-kind\n equivalence : Backward-kind\n reverse-injection : Backward-kind\n left-inverse : Backward-kind\n surjection : Backward-kind\n bijection : Backward-kind\n\n-- Forgetful map.\n\n⌊_⌋← : Backward-kind → Kind\n⌊ reverse-implication ⌋← = reverse-implication\n⌊ equivalence ⌋← = equivalence\n⌊ reverse-injection ⌋← = reverse-injection\n⌊ left-inverse ⌋← = left-inverse\n⌊ surjection ⌋← = surjection\n⌊ bijection ⌋← = bijection\n\n-- The function.\n\n⇒← : ∀ {k x y} {X : Set x} {Y : Set y} → X ∼[ ⌊ k ⌋← ] Y → Y → X\n⇒← {reverse-implication} = app-←\n⇒← {equivalence} = _⟨$⟩_ ∘ Equivalence.from\n⇒← {reverse-injection} = _⟨$⟩_ ∘ Injection.to ∘ app-↢\n⇒← {left-inverse} = _⟨$⟩_ ∘ LeftInverse.from\n⇒← {surjection} = _⟨$⟩_ ∘ Surjection.from\n⇒← {bijection} = _⟨$⟩_ ∘ Inverse.from\n\n-- Kinds whose interpretation include functions going in both\n-- directions.\n\ndata Equivalence-kind : Set where\n equivalence : Equivalence-kind\n left-inverse : Equivalence-kind\n surjection : Equivalence-kind\n bijection : Equivalence-kind\n\n-- Forgetful map.\n\n⌊_⌋⇔ : Equivalence-kind → Kind\n⌊ equivalence ⌋⇔ = equivalence\n⌊ left-inverse ⌋⇔ = left-inverse\n⌊ surjection ⌋⇔ = surjection\n⌊ bijection ⌋⇔ = bijection\n\n-- The functions.\n\n⇒⇔ : ∀ {k x y} {X : Set x} {Y : Set y} →\n X ∼[ ⌊ k ⌋⇔ ] Y → X ∼[ equivalence ] Y\n⇒⇔ {equivalence} = id\n⇒⇔ {left-inverse} = LeftInverse.equivalence\n⇒⇔ {surjection} = Surjection.equivalence\n⇒⇔ {bijection} = Inverse.equivalence\n\n-- Conversions between special kinds.\n\n⇔⌊_⌋ : Symmetric-kind → Equivalence-kind\n⇔⌊ equivalence ⌋ = equivalence\n⇔⌊ bijection ⌋ = bijection\n\n→⌊_⌋ : Equivalence-kind → Forward-kind\n→⌊ equivalence ⌋ = equivalence\n→⌊ left-inverse ⌋ = left-inverse\n→⌊ surjection ⌋ = surjection\n→⌊ bijection ⌋ = bijection\n\n←⌊_⌋ : Equivalence-kind → Backward-kind\n←⌊ equivalence ⌋ = equivalence\n←⌊ left-inverse ⌋ = left-inverse\n←⌊ surjection ⌋ = surjection\n←⌊ bijection ⌋ = bijection\n\n------------------------------------------------------------------------\n-- Opposites\n\n-- For every kind there is an opposite kind.\n\n_op : Kind → Kind\nimplication op = reverse-implication\nreverse-implication op = implication\nequivalence op = equivalence\ninjection op = reverse-injection\nreverse-injection op = injection\nleft-inverse op = surjection\nsurjection op = left-inverse\nbijection op = bijection\n\n-- For every morphism there is a corresponding reverse morphism of the\n-- opposite kind.\n\nreverse : ∀ {k a b} {A : Set a} {B : Set b} →\n A ∼[ k ] B → B ∼[ k op ] A\nreverse {implication} = lam\nreverse {reverse-implication} = app-←\nreverse {equivalence} = Eq.sym\nreverse {injection} = lam\nreverse {reverse-injection} = app-↢\nreverse {left-inverse} = Surj.fromRightInverse\nreverse {surjection} = Surjection.right-inverse\nreverse {bijection} = Inv.sym\n\n------------------------------------------------------------------------\n-- For a fixed universe level every kind is a preorder and each\n-- symmetric kind is an equivalence\n\nK-refl : ∀ {k ℓ} → Reflexive (Related k {ℓ})\nK-refl {implication} = id\nK-refl {reverse-implication} = lam id\nK-refl {equivalence} = Eq.id\nK-refl {injection} = Inj.id\nK-refl {reverse-injection} = lam Inj.id\nK-refl {left-inverse} = LeftInv.id\nK-refl {surjection} = Surj.id\nK-refl {bijection} = Inv.id\n\nK-reflexive : ∀ {k ℓ} → _≡_ ⇒ Related k {ℓ}\nK-reflexive P.refl = K-refl\n\nK-trans : ∀ {k ℓ₁ ℓ₂ ℓ₃} → Trans (Related k {ℓ₁} {ℓ₂})\n (Related k {ℓ₂} {ℓ₃})\n (Related k {ℓ₁} {ℓ₃})\nK-trans {implication} = flip _∘′_\nK-trans {reverse-implication} = λ f g → lam (app-← f ∘ app-← g)\nK-trans {equivalence} = flip Eq._∘_\nK-trans {injection} = flip Inj._∘_\nK-trans {reverse-injection} = λ f g → lam (Inj._∘_ (app-↢ f) (app-↢ g))\nK-trans {left-inverse} = flip LeftInv._∘_\nK-trans {surjection} = flip Surj._∘_\nK-trans {bijection} = flip Inv._∘_\n\nSK-sym : ∀ {k ℓ₁ ℓ₂} → Sym (Related ⌊ k ⌋ {ℓ₁} {ℓ₂})\n (Related ⌊ k ⌋ {ℓ₂} {ℓ₁})\nSK-sym {equivalence} = Eq.sym\nSK-sym {bijection} = Inv.sym\n\nSK-isEquivalence : ∀ k ℓ → IsEquivalence {ℓ = ℓ} (Related ⌊ k ⌋)\nSK-isEquivalence k ℓ = record\n { refl = K-refl\n ; sym = SK-sym\n ; trans = K-trans\n }\n\nSK-setoid : Symmetric-kind → (ℓ : Level) → Setoid _ _\nSK-setoid k ℓ = record { isEquivalence = SK-isEquivalence k ℓ }\n\nK-isPreorder : ∀ k ℓ → IsPreorder _↔_ (Related k)\nK-isPreorder k ℓ = record\n { isEquivalence = SK-isEquivalence bijection ℓ\n ; reflexive = ↔⇒\n ; trans = K-trans\n }\n\nK-preorder : Kind → (ℓ : Level) → Preorder _ _ _\nK-preorder k ℓ = record { isPreorder = K-isPreorder k ℓ }\n\n------------------------------------------------------------------------\n-- Equational reasoning\n\n-- Equational reasoning for related things.\n\nmodule EquationalReasoning where\n\n infix 3 _∎\n infixr 2 _∼⟨_⟩_ _↔⟨_⟩_ _↔⟨⟩_ _≡⟨_⟩_\n\n _∼⟨_⟩_ : ∀ {k x y z} (X : Set x) {Y : Set y} {Z : Set z} →\n X ∼[ k ] Y → Y ∼[ k ] Z → X ∼[ k ] Z\n _ ∼⟨ X↝Y ⟩ Y↝Z = K-trans X↝Y Y↝Z\n\n -- Isomorphisms can be combined with any other kind of relatedness.\n\n _↔⟨_⟩_ : ∀ {k x y z} (X : Set x) {Y : Set y} {Z : Set z} →\n X ↔ Y → Y ∼[ k ] Z → X ∼[ k ] Z\n X ↔⟨ X↔Y ⟩ Y⇔Z = X ∼⟨ ↔⇒ X↔Y ⟩ Y⇔Z\n\n _↔⟨⟩_ : ∀ {k x y} (X : Set x) {Y : Set y} →\n X ∼[ k ] Y → X ∼[ k ] Y\n X ↔⟨⟩ X⇔Y = X⇔Y\n\n _≡⟨_⟩_ : ∀ {k ℓ z} (X : Set ℓ) {Y : Set ℓ} {Z : Set z} →\n X ≡ Y → Y ∼[ k ] Z → X ∼[ k ] Z\n X ≡⟨ X≡Y ⟩ Y⇔Z = X ∼⟨ ≡⇒ X≡Y ⟩ Y⇔Z\n\n _∎ : ∀ {k x} (X : Set x) → X ∼[ k ] X\n X ∎ = K-refl\n\n sym = SK-sym\n {-# WARNING_ON_USAGE sym\n \"Warning: EquationalReasoning.sym was deprecated in v0.17.\n Please use SK-sym instead.\"\n #-}\n\n------------------------------------------------------------------------\n-- Every unary relation induces a preorder and, for symmetric kinds,\n-- an equivalence. (No claim is made that these relations are unique.)\n\nInducedRelation₁ : Kind → ∀ {a s} {A : Set a} →\n (A → Set s) → A → A → Set _\nInducedRelation₁ k S = λ x y → S x ∼[ k ] S y\n\nInducedPreorder₁ : Kind → ∀ {a s} {A : Set a} →\n (A → Set s) → Preorder _ _ _\nInducedPreorder₁ k S = record\n { _≈_ = _≡_\n ; _∼_ = InducedRelation₁ k S\n ; isPreorder = record\n { isEquivalence = P.isEquivalence\n ; reflexive = reflexive ∘\n K-reflexive ∘\n P.cong S\n ; trans = K-trans\n }\n } where open Preorder (K-preorder _ _)\n\nInducedEquivalence₁ : Symmetric-kind → ∀ {a s} {A : Set a} →\n (A → Set s) → Setoid _ _\nInducedEquivalence₁ k S = record\n { _≈_ = InducedRelation₁ ⌊ k ⌋ S\n ; isEquivalence = record\n { refl = K-refl\n ; sym = SK-sym\n ; trans = K-trans\n }\n }\n\n------------------------------------------------------------------------\n-- Every binary relation induces a preorder and, for symmetric kinds,\n-- an equivalence. (No claim is made that these relations are unique.)\n\nInducedRelation₂ : Kind → ∀ {a b s} {A : Set a} {B : Set b} →\n (A → B → Set s) → B → B → Set _\nInducedRelation₂ k _S_ = λ x y → ∀ {z} → (z S x) ∼[ k ] (z S y)\n\nInducedPreorder₂ : Kind → ∀ {a b s} {A : Set a} {B : Set b} →\n (A → B → Set s) → Preorder _ _ _\nInducedPreorder₂ k _S_ = record\n { _≈_ = _≡_\n ; _∼_ = InducedRelation₂ k _S_\n ; isPreorder = record\n { isEquivalence = P.isEquivalence\n ; reflexive = λ x≡y {z} →\n reflexive $\n K-reflexive $\n P.cong (_S_ z) x≡y\n\n ; trans = λ i↝j j↝k → K-trans i↝j j↝k\n }\n } where open Preorder (K-preorder _ _)\n\nInducedEquivalence₂ : Symmetric-kind →\n ∀ {a b s} {A : Set a} {B : Set b} →\n (A → B → Set s) → Setoid _ _\nInducedEquivalence₂ k _S_ = record\n { _≈_ = InducedRelation₂ ⌊ k ⌋ _S_\n ; isEquivalence = record\n { refl = refl\n ; sym = λ i↝j → sym i↝j\n ; trans = λ i↝j j↝k → trans i↝j j↝k\n }\n } where open Setoid (SK-setoid _ _)\n\n------------------------------------------------------------------------\n-- DEPRECATED NAMES\n------------------------------------------------------------------------\n-- Please use the new names as continuing support for the old names is\n-- not guaranteed.\n\n-- Version 0.17\n\npreorder = K-preorder\n{-# WARNING_ON_USAGE preorder\n\"Warning: preorder was deprecated in v0.17.\nPlease use K-preorder instead.\"\n#-}\nsetoid = SK-setoid\n{-# WARNING_ON_USAGE setoid\n\"Warning: setoid was deprecated in v0.17.\nPlease use SK-setoid instead.\"\n#-}\n", "meta": {"hexsha": "855428beb515d5ffdc533f646c68008e5c06c992", "size": 13544, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Function/Related.agda", "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Function/Related.agda", "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Function/Related.agda", "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.6448598131, "max_line_length": 73, "alphanum_fraction": 0.5538984052, "num_tokens": 4531, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711870587668, "lm_q2_score": 0.7826624688140726, "lm_q1q2_score": 0.6652405476842425}} {"text": "-- BEGIN prelude.agda\n\n-- the Haskell $ and .\n\n($) (A::Set) (B::Set) (f :: A -> B) (a :: A) :: B\n = f a\n\ncompose (B,C,A::Set)(f :: B -> C)(g :: A -> B) :: A -> C\n = \\ (x::A) -> f (g x)\n\n{- hardwired into Agda\n\nInteger :: Set\n = ?\n\nBool :: Set\n = data True | False\n\n-}\n\nnot (b::Bool) :: Bool\n = case b of {\n (True) -> False; -- Agda does not require @_ for built-in constructors\n (False) -> True;}\n\n(||) (b1::Bool)(b2::Bool) :: Bool\n = case b1 of {\n (True) -> True@_;\n (False) ->\n case b2 of {\n (True) -> True@_;\n (False) -> False@_;};}\n\n(&&) (b1::Bool)(b2::Bool) :: Bool\n = case b1 of {\n (True) ->\n case b2 of {\n (True) -> False@_;\n (False) -> True@_;};\n (False) -> False@_;}\n\nPair (a::Set)(b::Set) :: Set\n = data Pair (x::a) (y::b)\n\nTriple (a::Set)(b::Set)(c::Set) :: Set\n = data Triple (x::a) (y::b) (z::c)\n\nflip (a::Set)(b::Set)(c::Set)(f::a -> b -> c)(x::b)(y::a) :: c\n = f y x\n\n{- hardwired into Agda:\n\nList (a::Set) :: Set\n = data Nil | (:) (x::a) (xs::List a)\n\n-}\n\nfoldl (a::Set)(b::Set)(f::a -> b -> a)(acc::a)(l::List b) :: a\n = case l of {\n (Nil) -> acc;\n (x:xs) -> foldl a b f (f acc x) xs;}\n\nreverse (a::Set)(l::List a) :: List a\n = foldl (List a) a\n (flip a (List a) (List a) (\\(h::a) -> \\(h'::List a) -> (:)@_ h h'))\n Nil@_\n l\n\nappend (a::Set)(l1::List a)(l2::List a) :: List a\n = case l1 of {\n (Nil) -> l2;\n (x:xs) -> x : (append a xs l2);}\n\nnull (a::Set)(l::List a) :: Bool\n = case l of {\n (Nil) -> True@_;\n (x:xs) -> False@_;}\n\nmap (a,b::Set)(f::a -> b)(l::List a) :: List b\n = case l of \n (Nil) -> Nil\n (x:xs) -> f x : map a b f xs\n\nMaybe (a::Set) :: Set\n = data Nothing | Just (x::a)\n\n-- Should not be here - temporary addition to provide an \"interesting\" type\n-- data Simple = A | B | C -gone\n\n\n-- Properties\n-- naive implementation of Property.hs\n\n\n-- from SET.alfa\nRel (X::Set) :: Type\n = X -> X -> Set\nId (X::Set) :: Rel X\n = idata ref (x::X) :: _ x x\nZero :: Set\n = data \nwhenZero (X::Set)(z::Zero) :: X\n = case z of { }\nUnit :: Set\n = data tt\nSum (X::Set)(Y::X -> Set) :: Set\n = sig{fst :: X;\n snd :: Y fst;}\nPlus (X::Set)(Y::Set) :: Set\n = data inl (x::X) | inr (y::Y)\n\npackage Property where\n\n Prop :: Type \n = Set\n\n (===) (A :: Set) (a :: A) (b :: A) :: Prop\n = Id A a b\n \n -- translate forAll into a dependent function type\n forAll (A :: Set) (f :: A -> Prop) :: Prop\n = (x :: A) -> f x\n \n exists (A :: Set) (f :: A -> Prop) :: Prop\n = sig { witness :: A; \n prop :: f witness; }\n \n (/\\) (A,B :: Prop) :: Prop\n = Sum A (\\(a::A) -> B)\n \n (\\/) (A,B :: Prop) :: Prop\n = Plus A B\n \n (<=>) (A,B :: Prop) :: Prop\n = (A -> B) /\\ (B -> A)\n \n (==>) (A,B :: Prop) :: Prop\n = (A -> B)\n \n true :: Prop\n = Unit\n \n false :: Prop\n = Zero\n \n nt (A :: Prop) :: Prop\n = A -> false\n \n -- cannot do the naive using because of universe conflict\n -- List cannot have a parameter which is not a set, and Prop is a type\n --using (L :: List Prop) (A :: Prop) :: Prop\n -- = A\n \n holds (b::Bool) :: Prop\n = if b then true else false\n \n holdsNot (b::Bool) :: Prop\n = if b then false else true\n \n-- Class of inhabited types\n\nclass Inhabited (a::Set) :: Set exports\n arbitrary :: a\n\nerror (a::Set)(|ia::Inhabited a)(msg::String) :: a\n = arbitrary\n\n-- Prelude types are inhabited\n\ninstance iBool :: Inhabited Bool where\n arbitrary = True\n\ninstance iString :: Inhabited String where\n arbitrary = \"I AM ARBITRARY\"\n\ninstance iInteger :: Inhabited Integer where\n arbitrary = 123456789\n\n{- Syntax error:\ninstance iRational :: Inhabited Rational where\n arbitrary = 0.123456789\n-}\n\ninstance iList (|a::Set) :: Inhabited (List a) where\n arbitrary = Nil\n-- instance iList (a::Set)(ia::Inhabited a) :: Inhabited (List a) where\n\n\n-- END prelude.agda\n", "meta": {"hexsha": "ed87c2d855d98deb56efdd1524456133d0e1996e", "size": 3903, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "lib/prelude.agda", "max_stars_repo_name": "siddharthist/hs2agda", "max_stars_repo_head_hexsha": "4172bef9f4eede7e45dc002a70bf8c6dd9a56b5c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 17, "max_stars_repo_stars_event_min_datetime": "2016-10-25T10:07:49.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-25T19:54:48.000Z", "max_issues_repo_path": "lib/prelude.agda", "max_issues_repo_name": "siddharthist/CoverTranslator", "max_issues_repo_head_hexsha": "4172bef9f4eede7e45dc002a70bf8c6dd9a56b5c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2016-10-25T02:27:55.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-25T17:50:18.000Z", "max_forks_repo_path": "lib/prelude.agda", "max_forks_repo_name": "siddharthist/hs2agda", "max_forks_repo_head_hexsha": "4172bef9f4eede7e45dc002a70bf8c6dd9a56b5c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.5421052632, "max_line_length": 77, "alphanum_fraction": 0.4980784012, "num_tokens": 1424, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711604559848, "lm_q2_score": 0.7826624738835051, "lm_q1q2_score": 0.6652405311721147}} {"text": "{-# OPTIONS --without-K #-}\nmodule hott.loop.sum where\n\nopen import sum\nopen import equality\nopen import function.core\nopen import function.extensionality\nopen import function.isomorphism\nopen import function.overloading\nopen import sets.nat\nopen import pointed\nopen import hott.equivalence\nopen import hott.level.core\nopen import hott.loop.core\nopen import hott.loop.properties\n\nprivate\n abstract\n loop-sum' : ∀ {i}{j}{A : Set i}{B : A → Set j}(n : ℕ)\n → (hB : (a : A) → h n (B a))\n → {a₀ : A}{b₀ : B a₀}\n → Ω n {Σ A B} (a₀ , b₀) ≅ Ω n a₀\n loop-sum' 0 hB {a₀}{b₀} = Σ-ap-iso refl≅ (λ a → contr-⊤-iso (hB a)) ·≅ ×-right-unit\n loop-sum' {A = A}{B = B} (suc n) hB {a₀}{b₀} = Ω-iso n (sym≅ Σ-split-iso) refl\n ·≅ loop-sum' n λ p → hB _ _ _\n\n loop-sum-β : ∀ {i}{j}{A : Set i}{B : A → Set j}(n : ℕ)\n → (hB : (a : A) → h n (B a))\n → {a₀ : A}{b₀ : B a₀}\n → (p : Ω n {Σ A B} (a₀ , b₀))\n → apply≅ (loop-sum' n hB) p ≡ mapΩ n proj₁ p\n loop-sum-β zero hB p = refl\n loop-sum-β (suc n) hB p\n = loop-sum-β n _ (mapΩ n apΣ p)\n · mapΩ-hom n apΣ proj₁ p\n · funext-inv (ap proj₁ (ap (mapΩP n) lem)) p\n where\n lem : ∀ {i}{j}{A : Set i}{B : A → Set j}{a₀ : A}{b₀ : B a₀}\n → _≡_ {A = PMap (_≡_ {A = Σ A B} (a₀ , b₀) (a₀ , b₀) , refl) ((a₀ ≡ a₀) , refl)}\n (proj₁ ∘ apΣ , refl)\n (ap proj₁ , refl)\n lem = apply≅ pmap-eq ((λ _ → refl) , refl)\n\n\nloop-sum : ∀ {i}{j}{A : Set i}{B : A → Set j}(n : ℕ)\n → (hB : (a : A) → h n (B a))\n → {a₀ : A}{b₀ : B a₀}\n → Ω n {Σ A B} (a₀ , b₀) ≅ Ω n a₀\nloop-sum n hB {a₀}{b₀} = ≈⇒≅ (mapΩ n proj₁ , subst weak-equiv eq we)\n where\n abstract\n we : weak-equiv (apply (loop-sum' n hB {a₀}{b₀}))\n we = proj₂ (≅⇒≈ (loop-sum' n hB))\n\n eq : apply (loop-sum' n hB {a₀}{b₀}) ≡ mapΩ n proj₁\n eq = funext (loop-sum-β n hB)\n", "meta": {"hexsha": "dead2df931861e74d992cfcb5dbd6378c9ba339c", "size": 1996, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/hott/loop/sum.agda", "max_stars_repo_name": "pcapriotti/agda-base", "max_stars_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2015-06-12T12:20:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-01T11:25:54.000Z", "max_issues_repo_path": "src/hott/loop/sum.agda", "max_issues_repo_name": "pcapriotti/agda-base", "max_issues_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2015-02-02T14:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-26T11:57:26.000Z", "max_forks_repo_path": "src/hott/loop/sum.agda", "max_forks_repo_name": "pcapriotti/agda-base", "max_forks_repo_head_hexsha": "bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-02-02T12:17:00.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-04T19:31:00.000Z", "avg_line_length": 35.0175438596, "max_line_length": 92, "alphanum_fraction": 0.4844689379, "num_tokens": 798, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9099070035949656, "lm_q2_score": 0.7310585903489891, "lm_q1q2_score": 0.6651953313968081}} {"text": "{-# OPTIONS --safe --warning=error --without-K #-}\n\nopen import Functions.Definition\nopen import Numbers.Naturals.Definition\nopen import Sets.FinSet.Definition\n\nmodule Sets.Cardinality.Finite.Definition where\n\nrecord FiniteSet {a : _} (A : Set a) : Set a where\n field\n size : ℕ\n mapping : FinSet size → A\n bij : Bijection mapping\n\n", "meta": {"hexsha": "2d9d93d4de7c843631deee5bfff6baf4eaf7b789", "size": 341, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Sets/Cardinality/Finite/Definition.agda", "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_issues_repo_path": "Sets/Cardinality/Finite/Definition.agda", "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_forks_repo_path": "Sets/Cardinality/Finite/Definition.agda", "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "avg_line_length": 22.7333333333, "max_line_length": 50, "alphanum_fraction": 0.7184750733, "num_tokens": 89, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099070011518829, "lm_q2_score": 0.7310585844894971, "lm_q1q2_score": 0.6651953242791788}} {"text": "open import FRP.JS.RSet using ( RSet ; ⟦_⟧ ; _⇒_ )\nopen import FRP.JS.Time using ( Time )\n\nmodule FRP.JS.Product where\n\n-- We define _∧_ directly, rather than as λ t → (A t × B t)\n-- in order to make _∧_ invertable. (If we used the obvious defn,\n-- (A ∧ B) would only be invertable if A and B were invertable.\n\ninfixr 2 _∧_\ninfixr 4 _,_\n\ndata _∧_ (A B : RSet) (t : Time) : Set where\n _,_ : A t → B t → (A ∧ B) t\n\nproj₁ : ∀ {A B} → ⟦ A ∧ B ⇒ A ⟧\nproj₁ (a , b) = a\n\nproj₂ : ∀ {A B} → ⟦ A ∧ B ⇒ B ⟧\nproj₂ (a , b) = b\n\nswap : ∀ {A B} → ⟦ A ∧ B ⇒ B ∧ A ⟧\nswap (a , b) = (b , a)\n", "meta": {"hexsha": "fc515d8770cbdd144f71b359fa7afc8303977d51", "size": 575, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/agda/FRP/JS/Product.agda", "max_stars_repo_name": "agda/agda-frp-js", "max_stars_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_stars_repo_licenses": ["MIT", "BSD-3-Clause"], "max_stars_count": 63, "max_stars_repo_stars_event_min_datetime": "2015-04-20T21:47:00.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-28T09:46:14.000Z", "max_issues_repo_path": "src/agda/FRP/JS/Product.agda", "max_issues_repo_name": "agda/agda-frp-js", "max_issues_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_issues_repo_licenses": ["MIT", "BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/agda/FRP/JS/Product.agda", "max_forks_repo_name": "agda/agda-frp-js", "max_forks_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_forks_repo_licenses": ["MIT", "BSD-3-Clause"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-11-07T21:50:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:38.000Z", "avg_line_length": 23.9583333333, "max_line_length": 65, "alphanum_fraction": 0.547826087, "num_tokens": 251, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9099070109242131, "lm_q2_score": 0.7310585727705127, "lm_q1q2_score": 0.6651953207601385}} {"text": "------------------------------------------------------------------------\n-- The Agda standard library\n--\n-- Surjections\n------------------------------------------------------------------------\n\nmodule Function.Surjection where\n\nopen import Level\nopen import Function.Equality as F\n using (_⟶_) renaming (_∘_ to _⟪∘⟫_)\nopen import Function.Equivalence using (Equivalence)\nopen import Function.Injection hiding (id; _∘_)\nopen import Function.LeftInverse as Left hiding (id; _∘_)\nopen import Data.Product\nopen import Relation.Binary\nimport Relation.Binary.PropositionalEquality as P\n\n-- Surjective functions.\n\nrecord Surjective {f₁ f₂ t₁ t₂}\n {From : Setoid f₁ f₂} {To : Setoid t₁ t₂}\n (to : From ⟶ To) :\n Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where\n field\n from : To ⟶ From\n right-inverse-of : from RightInverseOf to\n\n-- The set of all surjections from one setoid to another.\n\nrecord Surjection {f₁ f₂ t₁ t₂}\n (From : Setoid f₁ f₂) (To : Setoid t₁ t₂) :\n Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where\n field\n to : From ⟶ To\n surjective : Surjective to\n\n open Surjective surjective public\n\n right-inverse : RightInverse From To\n right-inverse = record\n { to = from\n ; from = to\n ; left-inverse-of = right-inverse-of\n }\n\n open LeftInverse right-inverse public\n using () renaming (to-from to from-to)\n\n injective : Injective from\n injective = LeftInverse.injective right-inverse\n\n injection : Injection To From\n injection = LeftInverse.injection right-inverse\n\n equivalence : Equivalence From To\n equivalence = record\n { to = to\n ; from = from\n }\n\n-- Right inverses can be turned into surjections.\n\nfromRightInverse :\n ∀ {f₁ f₂ t₁ t₂} {From : Setoid f₁ f₂} {To : Setoid t₁ t₂} →\n RightInverse From To → Surjection From To\nfromRightInverse r = record\n { to = from\n ; surjective = record\n { from = to\n ; right-inverse-of = left-inverse-of\n }\n } where open LeftInverse r\n\n-- The set of all surjections from one set to another.\n\ninfix 3 _↠_\n\n_↠_ : ∀ {f t} → Set f → Set t → Set _\nFrom ↠ To = Surjection (P.setoid From) (P.setoid To)\n\n-- Identity and composition.\n\nid : ∀ {s₁ s₂} {S : Setoid s₁ s₂} → Surjection S S\nid {S = S} = record\n { to = F.id\n ; surjective = record\n { from = LeftInverse.to id′\n ; right-inverse-of = LeftInverse.left-inverse-of id′\n }\n } where id′ = Left.id {S = S}\n\ninfixr 9 _∘_\n\n_∘_ : ∀ {f₁ f₂ m₁ m₂ t₁ t₂}\n {F : Setoid f₁ f₂} {M : Setoid m₁ m₂} {T : Setoid t₁ t₂} →\n Surjection M T → Surjection F M → Surjection F T\nf ∘ g = record\n { to = to f ⟪∘⟫ to g\n ; surjective = record\n { from = LeftInverse.to g∘f\n ; right-inverse-of = LeftInverse.left-inverse-of g∘f\n }\n }\n where\n open Surjection\n g∘f = Left._∘_ (right-inverse g) (right-inverse f)\n", "meta": {"hexsha": "a8889a2df74fe2dc6938342f1eeb690bb06dc60a", "size": 2956, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Function/Surjection.agda", "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_issues_repo_path": "agda-stdlib-0.9/src/Function/Surjection.agda", "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda-stdlib-0.9/src/Function/Surjection.agda", "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.3703703704, "max_line_length": 72, "alphanum_fraction": 0.5774695535, "num_tokens": 861, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9059898279984214, "lm_q2_score": 0.7341195327172402, "lm_q1q2_score": 0.6651048291767739}} {"text": "\nmodule CategoryTheory.Linear where\n\nopen import CategoryTheory.Categories\nopen import CategoryTheory.Functor\nopen import CategoryTheory.BCCCs\nopen import CategoryTheory.Monad\nopen import CategoryTheory.Instances.Kleisli\n\nmodule L {n} {ℂ : Category n} (ℂ-BCCC : BicartesianClosed ℂ) (Mo : Monad ℂ) where\n open Category ℂ\n open BicartesianClosed ℂ-BCCC\n open Monad Mo\n open Functor T renaming (omap to M ; fmap to M-f)\n Kl : Category n\n Kl = Kleisli ℂ Mo\n\n -- Linear product of two objects\n _⊛_ : (A B : obj) -> obj\n A ⊛ B = (A ⊗ M B) ⊕ (M A ⊗ B) ⊕ (A ⊗ B)\n\n -- First projection from linear product\n *π₁ : ∀{A B} -> A ⊛ B ~> M A\n *π₁ {A}{B} = [ η.at A ∘ π₁ ⁏ π₁ ⁏ η.at A ∘ π₁ ]\n\n -- Second projection from linear product\n *π₂ : ∀{A B} -> A ⊛ B ~> M B\n *π₂ {A}{B} = [ π₂ ⁏ η.at B ∘ π₂ ⁏ η.at B ∘ π₂ ]\n\n\n -- Type class for linear products of type A ⊛ B. Need to provide\n -- linear product of morphisms and product laws in order to establish\n -- that the linear product is a product in the Kleisli category of the monad.\n record LinearProduct (A B : obj) : Set (lsuc n) where\n infix 10 ⟪_,_⟫\n field\n -- | Data\n -- Linear product\n ⟪_,_⟫ : ∀{L} -> (L ~> M A) -> (L ~> M B) -> (L ~> M (A ⊛ B))\n\n -- | Laws\n *π₁-comm : ∀{L} -> {l₁ : L ~> M A} {l₂ : L ~> M B}\n -> (μ.at A ∘ M-f *π₁) ∘ ⟪ l₁ , l₂ ⟫ ≈ l₁\n *π₂-comm : ∀{L} -> {l₁ : L ~> M A} {l₂ : L ~> M B}\n -> (μ.at B ∘ M-f *π₂) ∘ ⟪ l₁ , l₂ ⟫ ≈ l₂\n ⊛-unique : ∀{P} {p₁ : P ~> M A} {p₂ : P ~> M B} {m : P ~> M A⊕B}\n -> (μ.at A ∘ M-f *π₁) ∘ m ≈ p₁ -> (μ.at B ∘ M-f *π₂) ∘ m ≈ p₂\n -> ⟪ p₁ , p₂ ⟫ ≈ m\n\n Kl-⊛ : Product Kl A B\n Kl-⊛ = record\n { A⊗B = A ⊛ B\n ; π₁ = *π₁\n ; π₂ = *π₂\n ; ⟨_,_⟩ = ⟪_,_⟫\n ; π₁-comm = *π₁-comm\n ; π₂-comm = *π₂-comm\n ; ⊗-unique = ⊛-unique\n }\n\n-- Type class for linear categories\nrecord Linear {n} {ℂ : Category n}\n (ℂ-BCCC : BicartesianClosed ℂ) (Mo : Monad ℂ) : Set (lsuc n) where\n open Category ℂ\n open L ℂ-BCCC Mo\n\n field\n linprod : ∀(A B : obj) -> LinearProduct A B\n\n open module Li {A} {B} = LinearProduct (linprod A B) public\n", "meta": {"hexsha": "032a80c0de4f5d88c1e768ef05324a4e1f09703d", "size": 2347, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/CategoryTheory/Linear.agda", "max_stars_repo_name": "DimaSamoz/temporal-type-systems", "max_stars_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-05-31T20:37:04.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-04T09:33:48.000Z", "max_issues_repo_path": "src/CategoryTheory/Linear.agda", "max_issues_repo_name": "DimaSamoz/temporal-type-systems", "max_issues_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/CategoryTheory/Linear.agda", "max_forks_repo_name": "DimaSamoz/temporal-type-systems", "max_forks_repo_head_hexsha": "7d993ba55e502d5ef8707ca216519012121a08dd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.0563380282, "max_line_length": 81, "alphanum_fraction": 0.4874307627, "num_tokens": 872, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9465966656805269, "lm_q2_score": 0.7025300698514777, "lm_q1q2_score": 0.6650126216617165}} {"text": "{-# OPTIONS --safe --warning=error --without-K --guardedness #-}\n\nopen import Agda.Primitive using (Level; lzero; lsuc; _⊔_)\nopen import Setoids.Setoids\nopen import Rings.Definition\nopen import Rings.Orders.Partial.Definition\nopen import Rings.Orders.Total.Definition\nopen import Sequences\nopen import Setoids.Orders.Partial.Definition\nopen import Setoids.Orders.Total.Definition\nopen import Functions.Definition\nopen import LogicalFormulae\nopen import Numbers.Naturals.Semiring\nopen import Numbers.Naturals.Order\n\nmodule Rings.Orders.Total.Cauchy {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {m} {o} A} {pOrder : SetoidPartialOrder S _<_} {R : Ring S _+_ _*_} {pRing : PartiallyOrderedRing R pOrder} (order : TotallyOrderedRing pRing) where\n\nopen import Rings.Orders.Total.Lemmas order\nopen import Rings.Orders.Total.AbsoluteValue order\n\ncauchy : Sequence A → Set (m ⊔ o)\ncauchy s = ∀ (ε : A) → (Ring.0R R < ε) → Sg ℕ (λ N → ∀ {m n : ℕ} → (N List Nat -> List Nat\ninsert a [] = a ∷ []\ninsert x (a ∷ b) with x < a\n... | true = x ∷ a ∷ b\n... | false = a ∷ (insert x b)\n\nlst : List Nat\nlst = 2 ∷ []\n\nslst : List Nat\nslst = insert 3 lst\n\natDef : ∀ {a : Set} → a → List a -> Nat -> a\natDef def (x ∷ l) zero = x\natDef def (x ∷ l) (suc ix) = atDef def l ix\natDef def _ _ = def\n\nl0 : Nat\nl0 = atDef 0 slst 0\n\nl1 : Nat\nl1 = atDef 0 slst 1\n", "meta": {"hexsha": "94f285153377a6b83a7fc331a1b191e2ce00e2e2", "size": 524, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/agda-ocaml/Golden/Insertion.agda", "max_stars_repo_name": "agda/agda-ocaml", "max_stars_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 48, "max_stars_repo_stars_event_min_datetime": "2017-03-29T14:19:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-15T09:08:14.000Z", "max_issues_repo_path": "test/agda-ocaml/Golden/Insertion.agda", "max_issues_repo_name": "agda/agda-ocaml", "max_issues_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2017-03-29T13:37:52.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-05T21:28:57.000Z", "max_forks_repo_path": "test/agda-ocaml/Golden/Insertion.agda", "max_forks_repo_name": "agda/agda-ocaml", "max_forks_repo_head_hexsha": "e38b699870ba638221828b07b12948d70a1bdaec", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2018-05-24T10:45:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:48.000Z", "avg_line_length": 18.0689655172, "max_line_length": 44, "alphanum_fraction": 0.6011450382, "num_tokens": 207, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8774767810736692, "lm_q2_score": 0.7577943658046609, "lm_q1q2_score": 0.6649469608220364}} {"text": "module leftpad where\n\nopen import Agda.Builtin.Nat renaming (Nat to ℕ)\nopen import Data.Nat.Properties\nopen import Data.Vec\nopen import Data.Product\nopen import Function\nopen import Relation.Binary.PropositionalEquality\n\ndata LeOrGt : ℕ → ℕ → Set where\n le : ∀ m k → LeOrGt m (k + m)\n gt : ∀ m k → LeOrGt (suc k + m) m\n\ncompare : ∀ m n → LeOrGt m n\ncompare zero n = cast $ le 0 n\n where cast = subst (LeOrGt 0) (+-identityʳ n)\ncompare (suc m) zero = cast $ gt 0 m\n where cast = subst (flip LeOrGt 0) (+-identityʳ (suc m))\ncompare (suc m) (suc n) with compare m n\n... | le .m k = cast $ le (suc m) k\n where cast = subst (LeOrGt (suc m)) (+-suc k m)\n... | gt .n k = cast $ gt (suc n) k\n where cast = subst (flip LeOrGt (suc n) ∘′ suc) (+-suc k n)\n\n_⊔_ : ℕ → ℕ → ℕ\nm ⊔ n with compare m n\n... | le _ _ = n\n... | gt _ _ = m\n\nmodule _ {a} {A : Set a} (x : A) where\n\n data LeftPad {n : ℕ} (xs : Vec A n) : ∀ m → Vec A m → Set where\n Padded : ∀ k → LeftPad xs (k + n) (replicate {n = k} x ++ xs)\n\n leftPad : ∀ n m (xs : Vec A n) → ∃ (LeftPad xs (n ⊔ m))\n leftPad n m xs with compare n m\n ... | le .n k = , Padded k\n ... | gt .m k = , Padded 0\n", "meta": {"hexsha": "2a9755059e57997df931efde00228bd6831312ac", "size": 1149, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/leftpad.agda", "max_stars_repo_name": "RomainGehrig/lets-prove-leftpad", "max_stars_repo_head_hexsha": "4c28fb7c10710b66c4ebb72c3a4b0ec8d2ba4469", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 443, "max_stars_repo_stars_event_min_datetime": "2018-05-16T01:35:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-27T16:48:44.000Z", "max_issues_repo_path": "agda/leftpad.agda", "max_issues_repo_name": "RomainGehrig/lets-prove-leftpad", "max_issues_repo_head_hexsha": "4c28fb7c10710b66c4ebb72c3a4b0ec8d2ba4469", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": 32, "max_issues_repo_issues_event_min_datetime": "2018-05-15T22:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-03T09:56:05.000Z", "max_forks_repo_path": "agda/leftpad.agda", "max_forks_repo_name": "RomainGehrig/lets-prove-leftpad", "max_forks_repo_head_hexsha": "4c28fb7c10710b66c4ebb72c3a4b0ec8d2ba4469", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": 50, "max_forks_repo_forks_event_min_datetime": "2018-05-15T21:48:31.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-24T10:17:34.000Z", "avg_line_length": 29.4615384615, "max_line_length": 65, "alphanum_fraction": 0.5865970409, "num_tokens": 457, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9294404038127071, "lm_q2_score": 0.7154239897159439, "lm_q1q2_score": 0.6649439618988849}} {"text": "{-# OPTIONS --without-K --safe #-}\nopen import Categories.Category\nopen import Categories.Functor hiding (id)\n\n-- Cocone over a Functor F (from shape category J into category C)\n\nmodule Categories.Diagram.Cocone\n {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) where\n\nopen Category C\nopen Functor F\n\nopen import Level\n\nrecord Coapex (N : Obj) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′) where\n field\n ψ : (X : Category.Obj J) → F₀ X ⇒ N\n commute : ∀ {X Y} (f : J [ X , Y ]) → ψ Y ∘ F₁ f ≈ ψ X\n\nrecord Cocone : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′) where\n field\n {N} : Obj\n coapex : Coapex N\n\n open Coapex coapex public\n\nopen Coapex\nopen Cocone\n\nrecord Cocone⇒ (c c′ : Cocone) : Set (ℓ ⊔ e ⊔ o′) where\n field\n arr : N c ⇒ N c′\n commute : ∀ {X} → arr ∘ ψ c X ≈ ψ c′ X\n\nopen Cocone⇒\n", "meta": {"hexsha": "9e4e1c4993f823d6996c0446502afe46036aed32", "size": 822, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Diagram/Cocone.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Diagram/Cocone.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Diagram/Cocone.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 22.8333333333, "max_line_length": 89, "alphanum_fraction": 0.5802919708, "num_tokens": 329, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9294404057671712, "lm_q2_score": 0.7154239836484143, "lm_q1q2_score": 0.6649439576577483}} {"text": "{-\nThis second-order equational theory was created from the following second-order syntax description:\n\nsyntax CommMonoid | CM\n\ntype\n * : 0-ary\n\nterm\n unit : * | ε\n add : * * -> * | _⊕_ l20\n\ntheory\n (εU⊕ᴸ) a |> add (unit, a) = a\n (εU⊕ᴿ) a |> add (a, unit) = a\n (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c))\n (⊕C) a b |> add(a, b) = add(b, a)\n-}\n\nmodule CommMonoid.Equality where\n\nopen import SOAS.Common\nopen import SOAS.Context\nopen import SOAS.Variable\nopen import SOAS.Families.Core\nopen import SOAS.Families.Build\nopen import SOAS.ContextMaps.Inductive\n\nopen import CommMonoid.Signature\nopen import CommMonoid.Syntax\n\nopen import SOAS.Metatheory.SecondOrder.Metasubstitution CM:Syn\nopen import SOAS.Metatheory.SecondOrder.Equality CM:Syn\n\nprivate\n variable\n α β γ τ : *T\n Γ Δ Π : Ctx\n\ninfix 1 _▹_⊢_≋ₐ_\n\n-- Axioms of equality\ndata _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ CM) α Γ → (𝔐 ▷ CM) α Γ → Set where\n εU⊕ᴸ : ⁅ * ⁆̣ ▹ ∅ ⊢ ε ⊕ 𝔞 ≋ₐ 𝔞\n ⊕A : ⁅ * ⁆ ⁅ * ⁆ ⁅ * ⁆̣ ▹ ∅ ⊢ (𝔞 ⊕ 𝔟) ⊕ 𝔠 ≋ₐ 𝔞 ⊕ (𝔟 ⊕ 𝔠)\n ⊕C : ⁅ * ⁆ ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ 𝔟 ≋ₐ 𝔟 ⊕ 𝔞\n\nopen EqLogic _▹_⊢_≋ₐ_\nopen ≋-Reasoning\n\n-- Derived equations\nεU⊕ᴿ : ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ ε ≋ 𝔞\nεU⊕ᴿ = tr (ax ⊕C with《 𝔞 ◃ ε 》) (ax εU⊕ᴸ with《 𝔞 》)\n", "meta": {"hexsha": "d5b2be5c2a02c629959668b32b6c79591365a63f", "size": 1234, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "out/CommMonoid/Equality.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "out/CommMonoid/Equality.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "out/CommMonoid/Equality.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 22.8518518519, "max_line_length": 99, "alphanum_fraction": 0.5769854133, "num_tokens": 614, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438951143326726, "lm_q2_score": 0.7879311906630568, "lm_q1q2_score": 0.6649312822308792}} {"text": "module Negation where\n\n-- Imports\n\nopen import Relation.Binary.PropositionalEquality using (_≡_; refl)\nopen import Data.Nat using (ℕ; zero; suc)\nopen import Data.Empty using (⊥; ⊥-elim)\nopen import Data.Sum using (_⊎_; inj₁; inj₂)\nopen import Data.Product using (_×_)\n-- open import plfa.part1.Isomorphism using (_≃_; extensionality)\n\n-- 同型 (isomorphism)\ninfix 0 _≃_\nrecord _≃_ (A B : Set) : Set where\n field\n to : A → B\n from : B → A\n from∘to : ∀ (x : A) → from (to x) ≡ x\n to∘from : ∀ (y : B) → to (from y) ≡ y\nopen _≃_\n\npostulate\n -- 外延性の公理\n extensionality : ∀ {A B : Set} {f g : A → B}\n → (∀ (x : A) → f x ≡ g x)\n -----------------------\n → f ≡ g\n\n-- Negation (否定)\n\ninfix 3 ¬_\n¬_ : Set → Set\n¬ A = A → ⊥\n\n¬-elim : ∀ {A : Set}\n → ¬ A\n → A\n ---\n → ⊥\n¬-elim ¬x x = ¬x x\n\n-- 二重否定の導入則\n¬¬-intro : ∀ {A : Set}\n → A\n -----\n → ¬ ¬ A\n¬¬-intro x = λ{¬x → ¬x x}\n\n-- 二重否定の導入則\n¬¬-intro′ : ∀ {A : Set}\n → A\n -----\n → ¬ ¬ A\n¬¬-intro′ x ¬x = ¬x x\n\n-- 三重否定の除去則\n¬¬¬-elim : ∀ {A : Set}\n → ¬ ¬ ¬ A\n -------\n → ¬ A\n¬¬¬-elim ¬¬¬x = λ x → ¬¬¬x (¬¬-intro x)\n\n-- 対偶 (contraposition)\ncontraposition : ∀ {A B : Set}\n → (A → B)\n -----------\n → (¬ B → ¬ A)\ncontraposition f ¬y x = ¬y (f x)\n\n-- 不等号(inequality)\n_≢_ : ∀ {A : Set} → A → A → Set\nx ≢ y = ¬ (x ≡ y)\n\n_ : 1 ≢ 2\n_ = λ()\n\npeano : ∀ {m : ℕ} → zero ≢ suc m\npeano = λ()\n\nid : ⊥ → ⊥\nid x = x\n\nid′ : ⊥ → ⊥\nid′ ()\n\nid≡id′ : id ≡ id′\nid≡id′ = extensionality (λ())\n\n-- 同化\nassimilation : ∀ {A : Set} (¬x ¬x′ : ¬ A) → ¬x ≡ ¬x′\nassimilation ¬x ¬x′ = extensionality (λ x → ⊥-elim (¬x x))\n\n-- Excluded middle is irrefutable\n\n-- 排中律 (excluded middle)\npostulate\n em : ∀ {A : Set} → A ⊎ ¬ A\n\n-- 排中律は反駁できない\nem-irrefutable : ∀ {A : Set} → ¬ ¬ (A ⊎ ¬ A)\nem-irrefutable k = k (inj₂ λ{ x → k (inj₁ x) })\n", "meta": {"hexsha": "09f3184d917c67acda7441a98a345efa2e385daa", "size": 1776, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "part1/negation/Negation.agda", "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_issues_repo_path": "part1/negation/Negation.agda", "max_issues_repo_name": "akiomik/plfa-solutions", "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "part1/negation/Negation.agda", "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.4117647059, "max_line_length": 67, "alphanum_fraction": 0.4791666667, "num_tokens": 820, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438950947024555, "lm_q2_score": 0.7879311956428946, "lm_q1q2_score": 0.6649312709660795}} {"text": "------------------------------------------------------------------------------\n-- Mutual recursive functions\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOT.FOTC.Data.Nat.MutualRecursiveFunctions where\n\nopen import FOTC.Base\nopen import FOTC.Data.Nat.UnaryNumbers\n\n------------------------------------------------------------------------------\n\npostulate\n even : D → D\n odd : D → D\n\n even-0 : even zero ≡ true\n even-S : ∀ d → even (succ₁ d) ≡ odd d\n\n odd-0 : odd zero ≡ false\n odd-S : ∀ d → odd (succ₁ d) ≡ even d\n{-# ATP axioms even-0 even-S odd-0 odd-S #-}\n\npostulate even-2 : even 2' ≡ true\n{-# ATP prove even-2 #-}\n\npostulate even-3 : even 3' ≡ false\n{-# ATP prove even-3 #-}\n\npostulate odd-2 : odd 2' ≡ false\n{-# ATP prove odd-2 #-}\n\npostulate odd-3 : odd 3' ≡ true\n{-# ATP prove odd-3 #-}\n", "meta": {"hexsha": "dc225caf35e9dd212e56f088263d129ae2e92d8e", "size": 1040, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "notes/FOT/FOTC/Data/Nat/MutualRecursiveFunctions.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "notes/FOT/FOTC/Data/Nat/MutualRecursiveFunctions.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "notes/FOT/FOTC/Data/Nat/MutualRecursiveFunctions.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 26.6666666667, "max_line_length": 78, "alphanum_fraction": 0.4451923077, "num_tokens": 255, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.90192067652954, "lm_q2_score": 0.7371581684030623, "lm_q1q2_score": 0.6648581939553665}} {"text": "\nopen import SOAS.Common\n\n{-\nFramework for constructing categories of objects with extra structure.\nThe definitions required to construct a category is:\n* the category of carrier objects (e.g. sets, presheaves, etc.)\n* the extra operations and laws that the carrier objects are equipped with\n* the preservation properties of morphisms between the structures\n* proofs that the identities and composition of the carrier category preserve\n the extra structure\n-}\n\nmodule SOAS.Construction.Structure\n (CarrierCat : Category 1ℓ 0ℓ 0ℓ)\n (HasStruct : Category.Obj CarrierCat → Set) where\n\nprivate module ℂ = Category CarrierCat\n\n-- The carrier of the structure, e.g. sets, presheaves, etc.\nCarrier : Set₁\nCarrier = ℂ.Obj\n\ninfix 1 _⋉_\n\n-- Objects in the category for the structure: a carrier object together with\n-- the algebraic structure\nrecord Object : Set₁ where\n constructor _⋉_\n field\n 𝐶 : Carrier\n ˢ : HasStruct 𝐶\n\nopen Object public\n\n-- Properties of the morphisms between two objects, usually concerning\n-- the preservation of the extra operations\nMorphismProps : Set₁\nMorphismProps = {𝐶₁ 𝐶₂ : Carrier}\n → HasStruct 𝐶₁\n → HasStruct 𝐶₂\n → CarrierCat [ 𝐶₁ , 𝐶₂ ] → Set\n\n-- Morphisms in the category for the algebraic structure: an underlying\n-- morphism with preservation properties of the extra structure\nrecord Morphism (IsHomomorphism : MorphismProps) (O₁ O₂ : Object) : Set where\n constructor _⋉_\n field\n 𝑓 : CarrierCat [ 𝐶 O₁ , 𝐶 O₂ ]\n ˢ⇒ : IsHomomorphism (ˢ O₁)(ˢ O₂) 𝑓\n\nopen Morphism public\n\n-- Properties required to turn the objects and morphisms into a category; namely\n-- that the identity and composition in the carrier category are homomorphisms\nrecord CategoryProps : Set₁ where\n field\n IsHomomorphism : MorphismProps\n id-hom : {𝐶 : Carrier}{𝐶ˢ : HasStruct 𝐶} → IsHomomorphism 𝐶ˢ 𝐶ˢ ℂ.id\n comp-hom : {𝐶 𝐷 𝐸 : Carrier}\n {𝐶ˢ : HasStruct 𝐶}{𝐷ˢ : HasStruct 𝐷}{𝐸ˢ : HasStruct 𝐸} →\n (𝑔 : CarrierCat [ 𝐷 , 𝐸 ])(𝑓 : CarrierCat [ 𝐶 , 𝐷 ]) →\n (𝑔ʰ : IsHomomorphism 𝐷ˢ 𝐸ˢ 𝑔)(𝑓ʰ : IsHomomorphism 𝐶ˢ 𝐷ˢ 𝑓) →\n IsHomomorphism 𝐶ˢ 𝐸ˢ (𝑔 ℂ.∘ 𝑓)\n\nmodule _ (P : CategoryProps) where\n open CategoryProps P\n\n -- Category generated from the algebraic structure\n StructCat : Category 1ℓ 0ℓ 0ℓ\n StructCat = categoryHelper (record\n { Obj = Object\n ; _⇒_ = Morphism IsHomomorphism\n ; _≈_ = λ g₁ g₂ → 𝑓 g₁ ℂ.≈ 𝑓 g₂\n ; id = ℂ.id ⋉ id-hom\n ; _∘_ = λ{ (𝑔 ⋉ 𝑔ˢ⇒) (𝑓 ⋉ 𝑓ˢ⇒) → (𝑔 ℂ.∘ 𝑓) ⋉ (comp-hom 𝑔 𝑓 𝑔ˢ⇒ 𝑓ˢ⇒)}\n ; assoc = ℂ.assoc\n ; identityˡ = ℂ.identityˡ\n ; identityʳ = ℂ.identityʳ\n ; equiv = record { refl = ℂ.Equiv.refl ; sym = ℂ.Equiv.sym ; trans = ℂ.Equiv.trans }\n ; ∘-resp-≈ = ℂ.∘-resp-≈\n })\n\n -- Forget the structure of a carrier object\n Forget : Object → Carrier\n Forget (𝐶 ⋉ _) = 𝐶\n\n -- Forgetful functor from the structure category to the carrier category\n ForgetF : Functor StructCat CarrierCat\n ForgetF = record\n { F₀ = Forget\n ; F₁ = λ (𝑓 ⋉ _) → 𝑓\n ; identity = ℂ.Equiv.refl\n ; homomorphism = ℂ.Equiv.refl\n ; F-resp-≈ = λ x → x\n }\n where\n open ≡-Reasoning\n\n -- Free constructions with respect to the forgetful functor\n module Free where\n open import SOAS.Construction.Free ForgetF public\n", "meta": {"hexsha": "f58713df891456aae68829fc3fbd7bd34db45244", "size": 3284, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "SOAS/Construction/Structure.agda", "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z", "max_issues_repo_path": "SOAS/Construction/Structure.agda", "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_forks_repo_path": "SOAS/Construction/Structure.agda", "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "avg_line_length": 31.8834951456, "max_line_length": 88, "alphanum_fraction": 0.6717417783, "num_tokens": 1162, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392756357327, "lm_q2_score": 0.7520125682019722, "lm_q1q2_score": 0.6648086460622386}} {"text": "module Dave.Logic.Basics where\n open import Dave.Functions\n open import Dave.Equality\n open import Dave.Isomorphism\n open import Dave.Structures.Monoid\n\n {- True -}\n data ⊤ : Set where\n tt : ⊤\n\n η-⊤ : ∀ (w : ⊤) → tt ≡ w\n η-⊤ tt = refl\n\n {- False -}\n data ⊥ : Set where\n -- no clauses!\n\n ⊥-elim : ∀ {A : Set} → ⊥ → A\n ⊥-elim ()\n\n uniq-⊥ : ∀ {C : Set} (h : ⊥ → C) (w : ⊥) → ⊥-elim w ≡ h w\n uniq-⊥ h ()\n\n {- Product (Conjunction) -}\n data _×_ (A B : Set) : Set where\n ⟨_,_⟩ : A → B → A × B\n\n infixr 2 _×_\n\n proj₁ : {A B : Set} → A × B → A\n proj₁ ⟨ a , b ⟩ = a\n\n proj₂ : {A B : Set} → A × B → B\n proj₂ ⟨ a , b ⟩ = b\n \n ×-comm : {A B : Set} → (A × B) ≃ (B × A)\n ×-comm = record \n {\n to = λ{ ⟨ a , b ⟩ → ⟨ b , a ⟩ };\n from = λ {⟨ b , a ⟩ → ⟨ a , b ⟩};\n from∘to = λ { ⟨ a , b ⟩ → refl };\n to∘from = λ { ⟨ b , a ⟩ → refl }\n }\n\n ×-assoc : ∀ {A B C : Set} → (A × B) × C ≃ A × (B × C)\n ×-assoc = record \n {\n to = λ {⟨ ⟨ a , b ⟩ , c ⟩ → ⟨ a , ⟨ b , c ⟩ ⟩};\n from = λ {⟨ a , ⟨ b , c ⟩ ⟩ → ⟨ ⟨ a , b ⟩ , c ⟩};\n from∘to = λ {⟨ ⟨ a , b ⟩ , c ⟩ → refl};\n to∘from = λ {⟨ a , ⟨ b , c ⟩ ⟩ → refl}\n }\n\n η-× : ∀ {A B : Set} (w : A × B) → ⟨ proj₁ w , proj₂ w ⟩ ≡ w\n η-× ⟨ x , y ⟩ = refl \n\n ⊤-identityˡ : ∀ {A : Set} → ⊤ × A ≃ A\n ⊤-identityˡ = record\n { \n to = λ{ ⟨ tt , x ⟩ → x }; \n from = λ{ x → ⟨ tt , x ⟩ }; \n from∘to = λ{ ⟨ tt , x ⟩ → refl }; \n to∘from = λ{ x → refl }\n }\n\n ⊤-identityʳ : ∀ {A : Set} → (A × ⊤) ≃ A\n ⊤-identityʳ {A} = ≃-begin\n (A × ⊤) ≃⟨ ×-comm ⟩\n (⊤ × A) ≃⟨ ⊤-identityˡ ⟩\n A ≃-∎\n \n {- Sum (Disjunction) -}\n data _⊎_ (A B : Set) : Set where\n inj₁ : A → A ⊎ B\n inj₂ : B → A ⊎ B\n\n infixr 1 _⊎_\n\n case-⊎ : ∀ {A B C : Set}\n → (A → C)\n → (B → C)\n → A ⊎ B\n -----------\n → C\n case-⊎ f g (inj₁ x) = f x\n case-⊎ f g (inj₂ y) = g y\n\n uniq-⊎ : ∀ {A B C : Set} (h : A ⊎ B → C) (w : A ⊎ B) →\n case-⊎ (h ∘ inj₁) (h ∘ inj₂) w ≡ h w\n uniq-⊎ h (inj₁ x) = refl\n uniq-⊎ h (inj₂ y) = refl\n\n η-⊎ : ∀ {A B : Set} (w : A ⊎ B) → case-⊎ inj₁ inj₂ w ≡ w\n η-⊎ (inj₁ x) = refl\n η-⊎ (inj₂ y) = refl\n\n ⊥-identityˡ : ∀ {A : Set} → ⊥ ⊎ A ≃ A\n ⊥-identityˡ = record \n {\n to = λ {(inj₂ a) → a};\n from = λ a → inj₂ a;\n from∘to = λ {(inj₂ a) → refl};\n to∘from = λ a → refl\n }\n\n ⊎-comm : ∀ {A B : Set} → A ⊎ B ≃ B ⊎ A\n ⊎-comm = record \n {\n to = λ {(inj₁ A) → inj₂ A\n ; (inj₂ B) → inj₁ B};\n from = λ {(inj₁ B) → inj₂ B\n ; (inj₂ A) → inj₁ A};\n from∘to = λ {(inj₁ x) → refl\n ; (inj₂ x) → refl};\n to∘from = λ {(inj₁ x) → refl\n ; (inj₂ x) → refl}\n } \n\n ⊎-assoc : ∀ {A B C : Set} → (A ⊎ B) ⊎ C ≃ A ⊎ (B ⊎ C)\n ⊎-assoc = record \n { \n to = λ {(inj₁ (inj₁ a)) → inj₁ a\n ; (inj₁ (inj₂ b)) → inj₂ (inj₁ b)\n ; (inj₂ c) → inj₂ (inj₂ c)};\n from = λ {(inj₁ a) → inj₁ (inj₁ a)\n ; (inj₂ (inj₁ b)) → inj₁ (inj₂ b)\n ; (inj₂ (inj₂ c)) → inj₂ c};\n from∘to = λ {(inj₁ (inj₁ x)) → refl\n ; (inj₁ (inj₂ x)) → refl\n ; (inj₂ x) → refl};\n to∘from = λ {(inj₁ x) → refl\n ; (inj₂ (inj₁ x)) → refl\n ; (inj₂ (inj₂ x)) → refl}\n }\n\n ⊥-identityʳ : ∀ {A : Set} → A ⊎ ⊥ ≃ A\n ⊥-identityʳ {A} = ≃-begin \n (A ⊎ ⊥) ≃⟨ ⊎-comm ⟩\n (⊥ ⊎ A) ≃⟨ ⊥-identityˡ ⟩\n A ≃-∎\n\n {- Equality -}\n record _⇔_ (A B : Set) : Set where\n field\n to : A → B\n from : B → A\n\n open _⇔_\n\n ⇔-ref : ∀ {A : Set} → A ⇔ A\n ⇔-ref = record \n {\n to = λ a → a;\n from = λ a → a\n }\n\n ⇔-sym : ∀ {A B : Set} → A ⇔ B → B ⇔ A\n ⇔-sym A⇔B = record\n {\n to = from A⇔B;\n from = to A⇔B\n }\n\n ⇔-trans : ∀ {A B C : Set} → A ⇔ B → B ⇔ C → A ⇔ C\n ⇔-trans A⇔B B⇔C = record \n {\n to = λ a → to B⇔C (to A⇔B a);\n from = λ c → from A⇔B (from B⇔C c)\n } \n\n ⇔≃× : ∀ {A B : Set} → A ⇔ B ≃ (A → B) × (B → A)\n ⇔≃× = record\n {\n to = λ {A⇔B → ⟨ to A⇔B , from A⇔B ⟩};\n from = λ {x → record { to = proj₁ x; from = proj₂ x } };\n from∘to = λ A⇔B → refl;\n to∘from = λ {⟨ A→B , B→A ⟩ → refl}\n } \n", "meta": {"hexsha": "b590055fd4f8fb28a277f26604e8539eeff8af2b", "size": 4762, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Dave/Logic/Basics.agda", "max_stars_repo_name": "DavidStahl97/formal-proofs", "max_stars_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Dave/Logic/Basics.agda", "max_issues_repo_name": "DavidStahl97/formal-proofs", "max_issues_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Dave/Logic/Basics.agda", "max_forks_repo_name": "DavidStahl97/formal-proofs", "max_forks_repo_head_hexsha": "05213fb6ab1f51f770f9858b61526ba950e06232", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.6033519553, "max_line_length": 68, "alphanum_fraction": 0.3221335573, "num_tokens": 2036, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972583359806, "lm_q2_score": 0.7634837635542925, "lm_q1q2_score": 0.6646868713344031}} {"text": "open import Agda.Builtin.Sigma\nopen import Agda.Builtin.Equality\n\npostulate\n A : Set\n B : A → Set\n a : A\n\nPi : (A → Set) → Set\nPi B = {x : A} → B x\n\nfoo : Pi \\ y → Σ (B y) \\ _ → Pi \\ z → Σ (y ≡ a → B z) \\ _ → B y → B z → A\nfoo = {!!} , (\\ { refl → {!!} }) , {!!}\n", "meta": {"hexsha": "e077c65fb4e69ddc5451db4adcd6eb9b1e20eebf", "size": 267, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/interaction/Issue3678.agda", "max_stars_repo_name": "hborum/agda", "max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/interaction/Issue3678.agda", "max_issues_repo_name": "hborum/agda", "max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/interaction/Issue3678.agda", "max_forks_repo_name": "hborum/agda", "max_forks_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-04-01T18:30:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-01T18:30:09.000Z", "avg_line_length": 19.0714285714, "max_line_length": 74, "alphanum_fraction": 0.456928839, "num_tokens": 117, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9416541577509316, "lm_q2_score": 0.7057850340255385, "lm_q1q2_score": 0.664605411768531}} {"text": "{-# OPTIONS --without-K --safe #-}\nmodule Categories.Category.Instance.Sets where\n\n-- Category of (Agda) Sets, aka (types, functions, pointwise equality with implicit value)\n-- Note the (explicit) levels in each\n\nopen import Level\nopen import Relation.Binary\nopen import Function using (_∘′_) renaming (id to idf)\nopen import Relation.Binary.PropositionalEquality as ≡ using (_≡_)\n\nopen import Categories.Category\n\nSets : ∀ o → Category (suc o) o o\nSets o = record\n { Obj = Set o\n ; _⇒_ = λ c d → c → d\n ; _≈_ = λ f g → ∀ {x} → f x ≡ g x\n ; id = idf\n ; _∘_ = _∘′_\n ; assoc = ≡.refl\n ; sym-assoc = ≡.refl\n ; identityˡ = ≡.refl\n ; identityʳ = ≡.refl\n ; identity² = ≡.refl\n ; equiv = record\n { refl = ≡.refl\n ; sym = λ eq → ≡.sym eq\n ; trans = λ eq₁ eq₂ → ≡.trans eq₁ eq₂\n }\n ; ∘-resp-≈ = resp\n }\n where resp : ∀ {A B C : Set o} {f h : B → C} {g i : A → B} →\n ({x : B} → f x ≡ h x) →\n ({x : A} → g x ≡ i x) → {x : A} → f (g x) ≡ h (i x)\n resp {h = h} eq₁ eq₂ = ≡.trans eq₁ (≡.cong h eq₂)\n", "meta": {"hexsha": "af24c7aca5e619016fbbebb06eedf0344b517680", "size": 1093, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Category/Instance/Sets.agda", "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 279, "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_issues_repo_path": "src/Categories/Category/Instance/Sets.agda", "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 236, "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_forks_repo_path": "src/Categories/Category/Instance/Sets.agda", "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 64, "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "avg_line_length": 29.5405405405, "max_line_length": 90, "alphanum_fraction": 0.5242451967, "num_tokens": 418, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171067, "lm_q2_score": 0.7490872131147276, "lm_q1q2_score": 0.6645936165701316}} {"text": "-- Andreas, 2017-04-28, issue #2558 reported by Youyou Cong\n-- Size solver assumed invariants that do not hold.\n\nopen import Common.Size\n\ndata Con (i : Size) : Set where\n c : {j : Size< i} → Con i -- needed\n\npostulate\n Tms : {i j : Size} → Con i → Con j → Set\n Ty : (i : Size) {j : Size< i} → Con j → Set\n\n sub : ∀{i}{j k : Size< i} {l : Size< j} {Γ : Con k} {Δ : Con l} →\n Tms Γ Δ → Ty j Δ → Ty i Γ\n\n P : ∀{A : Set} (a : A) → Set\n\n [][]T : {i : Size} {j : Size< i} {k : Size< ↑ i} {l : Size< ↑ (↑ i)}\n {Γ : Con l} {Δ : Con k} {Σ : Con j} {A : Ty i Σ} →\n (δ : Tms Δ Σ) →\n (σ : Tms Γ Δ) → -- Γ needed\n P (sub σ (sub δ A)) -- sub σ needed\n\n-- Should pass\n", "meta": {"hexsha": "9b9b81e6ac49c74a0528b4304206aeba49703048", "size": 710, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue2558.agda", "max_stars_repo_name": "shlevy/agda", "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-10-29T09:40:30.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-20T00:28:57.000Z", "max_issues_repo_path": "test/Succeed/Issue2558.agda", "max_issues_repo_name": "shlevy/agda", "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z", "max_forks_repo_path": "test/Succeed/Issue2558.agda", "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "avg_line_length": 28.4, "max_line_length": 70, "alphanum_fraction": 0.4690140845, "num_tokens": 291, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872046056466901, "lm_q2_score": 0.749087201911703, "lm_q1q2_score": 0.664593615567055}} {"text": "{-# OPTIONS --without-K #-}\n\nmodule container.core where\n\nopen import level\nopen import sum\nopen import equality\nopen import function\n\nmodule _ {li}{I : Set li} where\n -- homsets in the slice category\n _→ⁱ_ : ∀ {lx ly} → (I → Set lx) → (I → Set ly) → Set _\n X →ⁱ Y = (i : I) → X i → Y i\n\n -- identity of the slice category\n idⁱ : ∀ {lx}{X : I → Set lx} → X →ⁱ X\n idⁱ i x = x\n\n -- composition in the slice category\n _∘ⁱ_ : ∀ {lx ly lz} {X : I → Set lx}{Y : I → Set ly}{Z : I → Set lz}\n → (Y →ⁱ Z) → (X →ⁱ Y) → (X →ⁱ Z)\n (f ∘ⁱ g) i = f i ∘ g i\n infixl 9 _∘ⁱ_\n\n -- extensionality\n funext-isoⁱ : ∀ {lx ly} {X : I → Set lx}{Y : (i : I) → X i → Set ly}\n → {f g : (i : I)(x : X i) → Y i x}\n → (∀ i x → f i x ≡ g i x)\n ≅ (f ≡ g)\n funext-isoⁱ {f = f}{g = g}\n = (Π-ap-iso refl≅ λ i → strong-funext-iso)\n ·≅ strong-funext-iso\n\n funext-invⁱ : ∀ {lx ly} {X : I → Set lx}{Y : (i : I) → X i → Set ly}\n → {f g : (i : I)(x : X i) → Y i x}\n → f ≡ g → ∀ i x → f i x ≡ g i x\n funext-invⁱ = invert funext-isoⁱ\n\n funextⁱ : ∀ {lx ly} {X : I → Set lx}{Y : (i : I) → X i → Set ly}\n → {f g : (i : I)(x : X i) → Y i x}\n → (∀ i x → f i x ≡ g i x) → f ≡ g\n funextⁱ = apply funext-isoⁱ\n\n-- Definition 1 in Ahrens, Capriotti and Spadotti (arXiv:1504.02949v1 [cs.LO])\nrecord Container (li la lb : Level) : Set (lsuc (li ⊔ la ⊔ lb)) where\n constructor container\n field\n I : Set li\n A : I → Set la\n B : {i : I} → A i → Set lb\n r : {i : I}{a : A i} → B a → I\n\n -- Definition 2 in Ahrens, Capriotti and Spadotti (arXiv:1504.02949v1 [cs.LO])\n -- functor associated to this indexed container\n F : ∀ {lx} → (I → Set lx) → I → Set _\n F X i = Σ (A i) λ a → (b : B a) → X (r b)\n\n F-ap-iso : ∀ {lx ly}{X : I → Set lx}{Y : I → Set ly}\n → (∀ i → X i ≅ Y i)\n → ∀ i → F X i ≅ F Y i\n F-ap-iso isom i = Σ-ap-iso refl≅ λ a\n → Π-ap-iso refl≅ λ b\n → isom (r b)\n\n -- morphism map for the functor F\n imap : ∀ {lx ly}\n → {X : I → Set lx}\n → {Y : I → Set ly}\n → (X →ⁱ Y)\n → (F X →ⁱ F Y)\n imap g i (a , f) = a , λ b → g (r b) (f b)\n\n -- action of a functor on homotopies\n hmap : ∀ {lx ly}\n → {X : I → Set lx}\n → {Y : I → Set ly}\n → {f g : X →ⁱ Y}\n → (∀ i x → f i x ≡ g i x)\n → (∀ i x → imap f i x ≡ imap g i x)\n hmap p i (a , u) = ap (_,_ a) (funext (λ b → p (r b) (u b)))\n\n hmap-id : ∀ {lx ly}\n → {X : I → Set lx}\n → {Y : I → Set ly}\n → (f : X →ⁱ Y)\n → ∀ i x\n → hmap (λ i x → refl {x = f i x}) i x ≡ refl\n hmap-id f i (a , u) = ap (ap (_,_ a)) (funext-id _)\n", "meta": {"hexsha": "3d6f4cf44e208c2635dda6c4ebfca12fc3e9a122", "size": 2695, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "container/core.agda", "max_stars_repo_name": "HoTT/M-types", "max_stars_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 27, "max_stars_repo_stars_event_min_datetime": "2015-04-14T15:47:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-09T07:26:57.000Z", "max_issues_repo_path": "container/core.agda", "max_issues_repo_name": "HoTT/M-types", "max_issues_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2015-02-11T11:14:59.000Z", "max_issues_repo_issues_event_max_datetime": "2015-02-11T15:20:34.000Z", "max_forks_repo_path": "container/core.agda", "max_forks_repo_name": "HoTT/M-types", "max_forks_repo_head_hexsha": "beebe176981953ab48f37de5eb74557cfc5402f4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-04-11T17:19:12.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-26T06:17:38.000Z", "avg_line_length": 30.2808988764, "max_line_length": 80, "alphanum_fraction": 0.4441558442, "num_tokens": 1135, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171068, "lm_q2_score": 0.7490872075132153, "lm_q1q2_score": 0.6645936116004443}} {"text": "{-# OPTIONS --cubical --safe #-}\n\nmodule Test where\n\nopen import Cubical.Core.Everything using (_≡_; Level; Type; Σ; _,_; fst; snd; _≃_; ~_)\nopen import Cubical.Foundations.Prelude using (refl; sym; _∙_; cong; transport; subst; funExt; transp; I; i0; i1)\nopen import Cubical.Foundations.Function using (_∘_)\nopen import Cubical.Foundations.Univalence using (ua)\nopen import Cubical.Foundations.Isomorphism using (iso; Iso; isoToPath; section; retract)\n\nopen import Data.Bool.Base using (Bool; true; false; _∧_)\nopen import Data.Nat.Base using (ℕ; zero; suc)\nopen import Data.Product using (_×_; proj₁; proj₂)\n\nnatrec : (P : ℕ → Type) → P 0 → ((n : ℕ) → P n → P (suc n)) → (n : ℕ) → P n\nnatrec P z s zero = z\nnatrec P z s (suc n) = s n (natrec P z s n)\n\n_+_ : ℕ → ℕ → ℕ\n_+_ = λ m → λ n → natrec (λ _ → ℕ) n (λ _ → suc) m\n\n0=0 : 0 ≡ 0\n0=0 = refl\n\nsuc=suc : (m n : ℕ) → m ≡ n → suc m ≡ suc n\nsuc=suc m n e = cong suc e\n\n0+n=n : (n : ℕ) → 0 + n ≡ n\n0+n=n = natrec (λ k → 0 + k ≡ k) 0=0 (λ n e → suc=suc n n e)\n\nn=0+n : (n : ℕ) → n + 0 ≡ n\nn=0+n = natrec (λ k → k + 0 ≡ k) 0=0 λ n e → suc=suc (n + 0) n e\n\n", "meta": {"hexsha": "56544ef5e4f87f87cc0014bf940970668ae5c16a", "size": 1123, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/Test.agda", "max_stars_repo_name": "halfaya/Alae", "max_stars_repo_head_hexsha": "5b22f5cb073dc2508ad158959a096df7763c57c4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/Test.agda", "max_issues_repo_name": "halfaya/Alae", "max_issues_repo_head_hexsha": "5b22f5cb073dc2508ad158959a096df7763c57c4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/Test.agda", "max_forks_repo_name": "halfaya/Alae", "max_forks_repo_head_hexsha": "5b22f5cb073dc2508ad158959a096df7763c57c4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.0294117647, "max_line_length": 117, "alphanum_fraction": 0.5903829029, "num_tokens": 456, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9207896802383028, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.6645736961409325}} {"text": "module PosNat where\n\nopen import Nats\nopen import Data.Product\nopen import Equality\n\ndata ℕ⁺ : Set where\n psuc : ℕ → ℕ⁺\n\n_→ℕ : ℕ⁺ → ℕ\npsuc zero →ℕ = suc zero\npsuc (suc x) →ℕ = suc (psuc x →ℕ)\n\n_⟨_⟩→ℕ⁺ : (a : ℕ) → ∃ (λ x → a ≡ suc x) → ℕ⁺\n.(suc x) ⟨ x , refl ⟩→ℕ⁺ = psuc x\n", "meta": {"hexsha": "4d59644e80600bd6b8bf4fea1e511c6667957982", "size": 277, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/PosNat.agda", "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_issues_repo_path": "src/PosNat.agda", "max_issues_repo_name": "ice1k/Theorems", "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/PosNat.agda", "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.3125, "max_line_length": 44, "alphanum_fraction": 0.559566787, "num_tokens": 136, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9207896693699845, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.6645736882967977}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\n\nmodule Cubical.Homotopy.Loopspace where\n\nopen import Cubical.Core.Everything\n\nopen import Cubical.Data.Nat\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Foundations.Pointed\nopen import Cubical.Foundations.HLevels\nopen import Cubical.Foundations.GroupoidLaws\nopen import Cubical.HITs.SetTruncation\nopen import Cubical.HITs.Truncation hiding (elim2)\n\n{- loop space of a pointed type -}\nΩ : {ℓ : Level} → Pointed ℓ → Pointed ℓ\nΩ (_ , a) = ((a ≡ a) , refl)\n\n{- n-fold loop space of a pointed type -}\nΩ^_ : ∀ {ℓ} → ℕ → Pointed ℓ → Pointed ℓ\n(Ω^ 0) p = p\n(Ω^ (suc n)) p = Ω ((Ω^ n) p)\n\n{- homotopy Group -}\nπ : ∀ {ℓ} (n : ℕ) (A : Pointed ℓ) → Type ℓ\nπ n A = ∥ typ ((Ω^ n) A) ∥ 2\n\n{- loop space map -}\nΩ→ : ∀ {ℓA ℓB} {A : Pointed ℓA} {B : Pointed ℓB} (f : A →∙ B) → (Ω A →∙ Ω B)\nΩ→ (f , f∙) = (λ p → (sym f∙ ∙ cong f p) ∙ f∙) , cong (λ q → q ∙ f∙) (sym (rUnit (sym f∙))) ∙ lCancel f∙\n\nEckmann-Hilton : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (α β : typ ((Ω^ (2 + n)) A))\n → α ∙ β ≡ β ∙ α\nEckmann-Hilton {A = A} n α β i =\n comp (λ k → rUnit (snd ((Ω^ (1 + n)) A)) (~ k) ≡ rUnit (snd ((Ω^ (1 + n)) A)) (~ k)) -- note : rUnit refl := lUnit refl\n (λ k → λ { (i = i0) → (cong (λ x → rUnit x (~ k)) α) ∙ cong (λ x → lUnit x (~ k)) β\n ; (i = i1) → (cong (λ x → lUnit x (~ k)) β) ∙ cong (λ x → rUnit x (~ k)) α})\n ((λ j → α (j ∧ ~ i) ∙ β (j ∧ i)) ∙ λ j → α (~ i ∨ j) ∙ β (i ∨ j))\n\n{- Homotopy group version -}\nπ-comp : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) → ∥ typ ((Ω^ (suc n)) A) ∥₂\n → ∥ typ ((Ω^ (suc n)) A) ∥₂ → ∥ typ ((Ω^ (suc n)) A) ∥₂\nπ-comp n = elim2 (λ _ _ → setTruncIsSet) λ p q → ∣ p ∙ q ∣₂\n\nEckmann-Hilton-π : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (p q : ∥ typ ((Ω^ (2 + n)) A) ∥₂)\n → π-comp (1 + n) p q ≡ π-comp (1 + n) q p\nEckmann-Hilton-π n = elim2 (λ x y → isOfHLevelPath 2 setTruncIsSet _ _)\n λ p q → cong ∣_∣₂ (Eckmann-Hilton n p q)\n", "meta": {"hexsha": "bf19f964b95d30326261afca816528bfefbce24f", "size": 1966, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Homotopy/Loopspace.agda", "max_stars_repo_name": "ayberkt/cubical", "max_stars_repo_head_hexsha": "f25b8479fe8160fa4ddbb32e288ba26be6cc242f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Homotopy/Loopspace.agda", "max_issues_repo_name": "ayberkt/cubical", "max_issues_repo_head_hexsha": "f25b8479fe8160fa4ddbb32e288ba26be6cc242f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_forks_repo_path": "Cubical/Homotopy/Loopspace.agda", "max_forks_repo_name": "ayberkt/cubical", "max_forks_repo_head_hexsha": "f25b8479fe8160fa4ddbb32e288ba26be6cc242f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.32, "max_line_length": 121, "alphanum_fraction": 0.514750763, "num_tokens": 887, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519528057272543, "lm_q2_score": 0.7799928900257127, "lm_q1q2_score": 0.6645171311047157}} {"text": "open import Structure.Operator.Monoid\nopen import Structure.Setoid\nopen import Type\n\nmodule Numeral.Natural.Oper.Summation {ℓᵢ ℓ ℓₑ} {I : Type{ℓᵢ}} {T : Type{ℓ}} {_▫_ : T → T → T} ⦃ equiv : Equiv{ℓₑ}(T) ⦄ ⦃ monoid : Monoid{T = T}(_▫_) ⦄ where\nopen Monoid(monoid)\n\nimport Lvl\nopen import Data.List\nopen import Data.List.Functions\nopen import Structure.Function\nopen import Structure.Operator\n\n∑ : List(I) → (I → T) → T\n∑(r) f = foldᵣ(_▫_) id (map f(r))\n", "meta": {"hexsha": "826f07c688f7ab8cd76d58b389ed01d5ecdd906f", "size": 457, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Numeral/Natural/Oper/Summation.agda", "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_issues_repo_path": "Numeral/Natural/Oper/Summation.agda", "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Numeral/Natural/Oper/Summation.agda", "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.5625, "max_line_length": 157, "alphanum_fraction": 0.6783369803, "num_tokens": 178, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8976952948443462, "lm_q2_score": 0.7401743735019595, "lm_q1q2_score": 0.6644510524570707}} {"text": "{-# OPTIONS --cubical --safe #-}\n\nmodule README where\n\n--------------------------------------------------------------------------------\n-- Section 1: Introduction\n--------------------------------------------------------------------------------\n\n-- 0, 1, and 2 types\nimport Data.Empty using (⊥)\nimport Data.Unit using (⊤)\nimport Data.Bool using (Bool)\n\n-- Dependent Sum and Product\nimport Data.Sigma using (Σ)\nimport Data.Pi using (Π)\n\n-- Disjoint Union\nimport Data.Sum using (_⊎_)\nimport Data.Sum.Properties using (sumAsSigma)\n\n-- Definition 1: Path types\nimport Path using (_≡_)\n\n-- Definition 2: Homotopy Levels\nimport HLevels using (isContr; isProp; isSet)\n\n-- Definition 3: Fibres\nimport Function.Fiber using (fiber)\n\n-- Definition 4: Equivalences\nimport Equiv using (isEquiv; _≃_)\n\n-- Definition 5: Decidable\nimport Relation.Nullary.Decidable using (Dec)\n\n-- Definition 6: Discrete\nimport Relation.Nullary.Discrete using (Discrete)\nimport Relation.Nullary.Discrete.Properties using (Discrete→isSet)\n\n-- Definition 8: Propositional Truncation\nimport HITs.PropositionalTruncation using (∥_∥)\nimport HITs.PropositionalTruncation using (rec; rec→set)\n\n--------------------------------------------------------------------------------\n-- Section 2: Finiteness Predicates\n--------------------------------------------------------------------------------\n\n-- Definition 9: Split Enumerability\nimport Cardinality.Finite.SplitEnumerable.Container using (ℰ!)\n\n-- Container based definition is isomophic to inductive\nimport Cardinality.Finite.SplitEnumerable.Isomorphism using (𝕃⇔ℒ⟨ℰ!⟩)\n\n-- Definition 10: Container\nimport Container using (Container; ⟦_⟧)\n\n-- Definition 11: List\nimport Container.List using (List)\n\n-- Definition 12: Fin\nimport Data.Fin.Base using (Fin)\n\n-- Definition 13: Surjections\nimport Function.Surjective using (_↠!_; _↠_)\n\n-- Lemma 1\nimport Cardinality.Finite.SplitEnumerable using (ℰ!⇔Fin↠!)\n\n-- Lemma 2\nimport Function.Surjective.Properties using (Discrete-distrib-surj)\n\n-- Lemma 3\nimport Cardinality.Finite.SplitEnumerable using (ℰ!⇒Discrete)\n\n-- Definition 14: Manifest Bishop Finiteness\nimport Cardinality.Finite.ManifestBishop.Container using (ℬ)\n\n-- Container based definition is isomophic to inductive\nimport Cardinality.Finite.ManifestBishop.Isomorphism using (𝕃⇔ℒ⟨ℬ⟩)\n\n-- Definition 15: Unique Membership\nimport Container.Membership using (_∈!_)\n\n-- Lemma 4\nimport Cardinality.Finite.ManifestBishop using (ℬ⇔Fin≃)\n\n-- Definition 16: Cardinal Finiteness\nimport Cardinality.Finite.Cardinal using (𝒞; 𝒞≃Fin≃)\n\n-- Lemma 5\nimport Cardinality.Finite.Cardinal using (cardinality)\n\n-- Lemma 6\nimport Cardinality.Finite.Cardinal using (𝒞⇒Discrete)\n\n-- Definition 17: Manifest Enumerability\nimport Cardinality.Finite.ManifestEnumerable.Container using (ℰ)\n\n-- Container based definition is isomorphic to inductive\nimport Cardinality.Finite.ManifestEnumerable.Isomorphism using (𝕃⇔ℒ⟨ℰ⟩)\n\n-- Lemma 7\nimport Cardinality.Finite.ManifestEnumerable using (ℰ⇔Fin↠)\n\n-- Definition 18: S¹\nopen import Cubical.HITs.S1 using (S¹)\n\n-- Lemma 8\nimport Cardinality.Finite.ManifestEnumerable using (ℰ⟨S¹⟩)\n\n-- Definition 19: Kuratowski finite subset\nimport Algebra.Construct.Free.Semilattice using (𝒦)\n\n-- Definition 20: Membership of 𝒦\nimport Algebra.Construct.Free.Semilattice.Relation.Unary using (_∈_)\n\n-- Definition 21: Kuratowski finiteness\nimport Cardinality.Finite.Kuratowski using (𝒦ᶠ)\n\n-- Lemma 9\nimport Cardinality.Finite.Kuratowski using (isProp𝒦ᶠ)\n\n-- Lemma 10\nimport Cardinality.Finite.Kuratowski using (𝒦ᶠ⟨S¹⟩)\n\n--------------------------------------------------------------------------------\n-- Section 3: Relations Between Each Finiteness Definition\n--------------------------------------------------------------------------------\n\n-- Lemma 11\nimport Cardinality.Finite.ManifestBishop using (ℰ!⇒ℬ)\n\n-- Lemma 12\nimport Cardinality.Finite.ManifestBishop using (ℬ⇒ℰ!)\n\n-- Lemma 13\nimport Cardinality.Finite.ManifestEnumerable using (ℰ!⇒ℰ)\n\n-- Lemma 14\nimport Cardinality.Finite.ManifestEnumerable using (ℰ⇒ℰ!)\n\n-- Lemma 15\nimport Cardinality.Finite.Cardinal using (ℬ⇒𝒞)\n\n-- Theorem 1\nimport Cardinality.Finite.Cardinal using (𝒞⇒ℬ)\n\n-- Definition 22: List Permutations\nimport Data.List.Relation.Binary.Permutation using (_↭_)\n\n-- Lemma 16\nimport Cardinality.Finite.Kuratowski using (𝒞⇔𝒦×Discrete)\n\n--------------------------------------------------------------------------------\n-- Section 4: Relations Between Each Finiteness Definition\n--------------------------------------------------------------------------------\n\n-- Lemma 17\nimport Cardinality.Finite.SplitEnumerable using (ℰ!⟨⊥⟩; ℰ!⟨⊤⟩; ℰ!⟨2⟩)\n\n-- Lemma 18\nimport Cardinality.Finite.SplitEnumerable using (_|Σ|_)\n\n-- Lemma 19\nimport Cardinality.Finite.ManifestBishop using (_|Π|_)\n\n-- Lemma 20\nimport Cardinality.Finite.Cardinal using (𝒞⇒Choice)\n\n-- Resulting closures on 𝒞:\nimport Cardinality.Finite.Cardinal using\n (_∥Σ∥_; _∥⊎∥_; _∥Π∥_; _∥→∥_; _∥×∥_; _∥⇔∥_; 𝒞⟨⊥⟩; 𝒞⟨⊤⟩; 𝒞⟨Bool⟩)\n\n-- Theorem 2:\nimport Cardinality.Finite.Cardinal.Category using (finSetCategory)\n\n-- Quotients are effective\nimport Cubical.HITs.SetQuotients.Properties using (isEquivRel→isEffective)\n\n-- Theorem 3:\nimport Cardinality.Finite.Cardinal.Category using\n ( finSetHasProducts\n ; finSetHasExp\n ; finSetHasPullbacks\n ; finSetTerminal\n ; finSetInitial\n ; finSetCoeq\n ; module PullbackSurjProofs\n )\n\n-- Same for hSets\nimport Categories.HSets using\n ( hSetProd\n ; hSetExp\n ; hSetHasPullbacks\n ; hSetTerminal\n ; hSetInitial\n ; hSetCoeq\n ; module PullbackSurjProofs\n )\n\n--------------------------------------------------------------------------------\n-- Section 5: Countably Infinite Types\n--------------------------------------------------------------------------------\n\n-- Definition 23: Streams\nimport Codata.Stream using (Stream)\n\n-- Definition 24: Split Countability\nimport Cardinality.Infinite.Split using (ℰ!)\n\n-- Definition 25: Countability\nimport Cardinality.Infinite.Split using (ℰ)\n\n-- Lemma 21\nimport Cardinality.Infinite.Split using (ℰ⇒Discrete)\n\n-- Theorem 4\nimport Cardinality.Infinite.Split using (_|Σ|_)\n\n-- Theorem 5\nimport Cardinality.Infinite.Split using (|star|)\n\n--------------------------------------------------------------------------------\n-- Section 6: Search\n--------------------------------------------------------------------------------\n\n-- Definition 26: Omniscience\nimport Relation.Nullary.Omniscience using (Omniscient)\n\n-- Definition 27: Exhaustibility\nimport Relation.Nullary.Omniscience using (Exhaustible)\n\nimport Cardinality.Finite.Kuratowski using (𝒦ᶠ⇒Exhaustible)\nimport Relation.Nullary.Omniscience using (Omniscient→Exhaustible)\nimport Cardinality.Finite.ManifestEnumerable using (ℰ⇒Omniscient)\nimport Cardinality.Finite.Kuratowski using (𝒦ᶠ⇒Prop-Omniscient)\n\nimport Data.Pauli using (Pauli)\nimport Data.Pauli using (assoc-·)\nimport Data.Pauli using (not-spec)\n", "meta": {"hexsha": "154c0d6f583f885bfbb0f5efbdfd06b75a832f41", "size": 6868, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "agda/README.agda", "max_stars_repo_name": "oisdk/combinatorics-paper", "max_stars_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agda/README.agda", "max_issues_repo_name": "oisdk/combinatorics-paper", "max_issues_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agda/README.agda", "max_forks_repo_name": "oisdk/combinatorics-paper", "max_forks_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.2633744856, "max_line_length": 80, "alphanum_fraction": 0.6608910891, "num_tokens": 1857, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8577680977182187, "lm_q2_score": 0.7745833789613196, "lm_q1q2_score": 0.6644129114958012}} {"text": "-- Andreas, 2014-08-30, reported by asr\n-- All of the following corecursive functions from Data.Stream\n-- should pass the termination checker.\n\n{-# OPTIONS --cubical-compatible --guardedness #-}\n-- {-# OPTIONS -v term:20 #-}\n\nopen import Common.Coinduction\nopen import Common.Prelude renaming (Nat to ℕ) hiding (_∷_; map)\n\ninfixr 5 _∷_\n\ndata Stream (A : Set) : Set where\n _∷_ : (x : A) (xs : ∞ (Stream A)) → Stream A\n\nmap : ∀ {A B} → (A → B) → Stream A → Stream B\nmap f (x ∷ xs) = f x ∷ ♯ map f (♭ xs)\n\nzipWith : ∀ {A B C} →\n (A → B → C) → Stream A → Stream B → Stream C\nzipWith _∙_ (x ∷ xs) (y ∷ ys) = (x ∙ y) ∷ ♯ zipWith _∙_ (♭ xs) (♭ ys)\n\ndrop : ∀ {A} → ℕ → Stream A → Stream A\ndrop zero xs = xs\ndrop (suc n) (x ∷ xs) = drop n (♭ xs)\n\nrepeat : ∀ {A} → A → Stream A\nrepeat x = x ∷ ♯ repeat x\n\niterate : ∀ {A} → (A → A) → A → Stream A\niterate f x = x ∷ ♯ iterate f (f x)\n\n-- Interleaves the two streams.\n\ninfixr 5 _⋎_\n\n_⋎_ : ∀ {A} → Stream A → Stream A → Stream A\n(x ∷ xs) ⋎ ys = x ∷ ♯ (ys ⋎ ♭ xs)\n\nmutual\n\n -- Takes every other element from the stream, starting with the\n -- first one.\n\n evens : ∀ {A} → Stream A → Stream A\n evens (x ∷ xs) = x ∷ ♯ odds (♭ xs)\n\n -- Takes every other element from the stream, starting with the\n -- second one.\n\n odds : ∀ {A} → Stream A → Stream A\n odds (x ∷ xs) = evens (♭ xs)\n", "meta": {"hexsha": "27285870192545e0252e0ee7213c8c05aa6a7407", "size": 1338, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/Succeed/Issue1264.agda", "max_stars_repo_name": "KDr2/agda", "max_stars_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/Succeed/Issue1264.agda", "max_issues_repo_name": "KDr2/agda", "max_issues_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z", "max_forks_repo_path": "test/Succeed/Issue1264.agda", "max_forks_repo_name": "KDr2/agda", "max_forks_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.2452830189, "max_line_length": 69, "alphanum_fraction": 0.5687593423, "num_tokens": 510, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891479496521, "lm_q2_score": 0.8080672204860316, "lm_q1q2_score": 0.664384099497454}} {"text": "------------------------------------------------------------------------------\n-- Properties related with lists (using induction on the FOTC lists type)\n------------------------------------------------------------------------------\n\n{-# OPTIONS --exact-split #-}\n{-# OPTIONS --no-sized-types #-}\n{-# OPTIONS --no-universe-polymorphism #-}\n{-# OPTIONS --without-K #-}\n\nmodule FOTC.Data.List.PropertiesByInductionATP where\n\nopen import FOTC.Base\nopen import FOTC.Base.List\nopen import FOTC.Data.List\nopen import FOTC.Data.Nat.Type\n\n------------------------------------------------------------------------------\n-- Totality properties\n\n-- See Issue https://github.com/asr/apia/issues/81 .\nlengthList-NA : D → Set\nlengthList-NA ds = N (length ds)\n{-# ATP definition lengthList-NA #-}\n\nlengthList-N : ∀ {xs} → List xs → N (length xs)\nlengthList-N = List-ind lengthList-NA A[] h\n where\n postulate A[] : lengthList-NA []\n {-# ATP prove A[] #-}\n\n postulate h : ∀ a {as} → lengthList-NA as → lengthList-NA (a ∷ as)\n {-# ATP prove h #-}\n\n------------------------------------------------------------------------------\n\n-- See Issue https://github.com/asr/apia/issues/81 .\n++-assocA : D → D → D → Set\n++-assocA ys zs as = (as ++ ys) ++ zs ≡ as ++ ys ++ zs\n{-# ATP definition ++-assocA #-}\n\n++-assoc : ∀ {xs} → List xs → ∀ ys zs → (xs ++ ys) ++ zs ≡ xs ++ ys ++ zs\n++-assoc Lxs ys zs = List-ind (++-assocA ys zs) A[] h Lxs\n where\n postulate A[] : ++-assocA ys zs []\n {-# ATP prove A[] #-}\n\n postulate h : ∀ a {as} → ++-assocA ys zs as → ++-assocA ys zs (a ∷ as)\n {-# ATP prove h #-}\n", "meta": {"hexsha": "8683f7b7152ed55ccd9d79ed087a7418615ab169", "size": 1619, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/fot/FOTC/Data/List/PropertiesByInductionATP.agda", "max_stars_repo_name": "asr/fotc", "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_issues_repo_path": "src/fot/FOTC/Data/List/PropertiesByInductionATP.agda", "max_issues_repo_name": "asr/fotc", "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_forks_repo_path": "src/fot/FOTC/Data/List/PropertiesByInductionATP.agda", "max_forks_repo_name": "asr/fotc", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "avg_line_length": 33.0408163265, "max_line_length": 78, "alphanum_fraction": 0.4780728845, "num_tokens": 414, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8459424373085145, "lm_q2_score": 0.7853085859124002, "lm_q1q2_score": 0.6643258592060387}} {"text": "module CoPatWith where\n\ndata Maybe (A : Set) : Set where\n nothing : Maybe A\n just : A -> Maybe A\n\ndata _×_ (A B : Set) : Set where\n _,_ : A -> B -> A × B\n\nrecord CoList (A : Set) : Set where\n constructor inn\n field\n out : Maybe (A × CoList A)\n\nopen CoList\n\nmodule With where\n\n map : {A B : Set}(f : A -> B)(l : CoList A) -> CoList B\n out (map f l) with out l\n out (map f l) | nothing = nothing\n out (map f l) | just (a , as) = just (f a , map f as)\n\nmodule NoWith where\n\n map : {A B : Set}(f : A -> B)(l : CoList A) -> CoList B\n out (map {A = A}{B = B} f l) = map' f l (out l)\n where outmap : (f : A -> B)(l : CoList A)(outl : Maybe (A × CoList A)) -> Maybe (B × CoList B)\n outmap f l nothing = nothing\n outmap f l (just (a , as)) = just (f a , map f as) \n\nmodule With2 where\n\n map : {A B : Set}(f : A -> B)(l : CoList A) -> CoList B\n out (map f (inn l)) with l\n out (map f (inn .nothing)) | nothing = nothing\n out (map f (inn .(just (a , as)))) | just (a , as) = just (f a , map f as)\n\nmodule NoWith2 where\n\n map : {A B : Set}(f : A -> B)(l : CoList A) -> CoList B\n out (map {A = A}{B = B} f l) = map' f l (out l)\n where outmap : (f : A -> B)(l : CoList A)(outl : Maybe (A × CoList A)) -> Maybe (B × CoList B)\n outmap f (inn .nothing) nothing = nothing\n outmap f (inn .(just (a , as))) (just (a , as)) = just (f a , map f as) \n", "meta": {"hexsha": "7d2c99631d61f988504ef371bebb5808828bf0a7", "size": 1423, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "test/features/CoPatWith.agda", "max_stars_repo_name": "np/agda-git-experiment", "max_stars_repo_head_hexsha": "20596e9dd9867166a64470dd24ea68925ff380ce", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_issues_repo_path": "test/features/CoPatWith.agda", "max_issues_repo_name": "masondesu/agda", "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/features/CoPatWith.agda", "max_forks_repo_name": "masondesu/agda", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.9347826087, "max_line_length": 98, "alphanum_fraction": 0.5193253689, "num_tokens": 529, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8376199552262967, "lm_q2_score": 0.7931059462938815, "lm_q1q2_score": 0.6643213672243907}} {"text": "module Data.Fin.Map where\n\nopen import Class.Monad\nopen import Data.Nat\nopen import Data.Fin\nopen import Function\n\nDepFinMap : ∀ {a} (n : ℕ) (A : Fin n -> Set a) -> Set a\nDepFinMap n A = (k : Fin n) -> A k\n\nFinMap : ∀ {a} (n : ℕ) -> Set a -> Set a\nFinMap n A = DepFinMap n (λ _ -> A)\n\nsequenceDepFinMap : ∀ {a n A} {M : Set a -> Set a} {{_ : Monad M}}\n -> DepFinMap n (λ x -> M $ A x) -> M (DepFinMap n A)\nsequenceDepFinMap {n = zero} f = return λ ()\nsequenceDepFinMap {n = suc n} f = do\n f' <- sequenceDepFinMap $ f ∘ suc\n fzero <- f zero\n return λ\n { zero → fzero\n ; (suc v) → f' v}\n", "meta": {"hexsha": "72012effd2db4c5852c6cb54dfeff9e59e39a773", "size": 595, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "stdlib-exts/Data/Fin/Map.agda", "max_stars_repo_name": "WhatisRT/meta-cedille", "max_stars_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 35, "max_stars_repo_stars_event_min_datetime": "2019-06-13T07:44:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-12T22:59:10.000Z", "max_issues_repo_path": "stdlib-exts/Data/Fin/Map.agda", "max_issues_repo_name": "WhatisRT/meta-cedille", "max_issues_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 10, "max_issues_repo_issues_event_min_datetime": "2019-06-13T17:44:43.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-25T15:29:17.000Z", "max_forks_repo_path": "stdlib-exts/Data/Fin/Map.agda", "max_forks_repo_name": "WhatisRT/meta-cedille", "max_forks_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2019-06-27T23:12:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-20T10:46:20.000Z", "avg_line_length": 25.8695652174, "max_line_length": 66, "alphanum_fraction": 0.581512605, "num_tokens": 226, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.91243616285804, "lm_q2_score": 0.7279754548076477, "lm_q1q2_score": 0.6642311306395265}} {"text": "{-# OPTIONS --without-K --safe #-}\n\nopen import Categories.Category\n\nmodule Categories.Diagram.Coequalizer {o ℓ e} (C : Category o ℓ e) where\n\nopen Category C\nopen HomReasoning\n\nopen import Level\n\nprivate\n variable\n A B : Obj\n h i : A ⇒ B\n\nrecord Coequalizer (f g : A ⇒ B) : Set (o ⊔ ℓ ⊔ e) where\n field\n {obj} : Obj\n arr : B ⇒ obj\n\n equality : arr ∘ f ≈ arr ∘ g\n coequalize : h ∘ f ≈ h ∘ g → obj ⇒ cod h\n universal : ∀ {eq : h ∘ f ≈ h ∘ g} → h ≈ coequalize eq ∘ arr\n unique : ∀ {eq : h ∘ f ≈ h ∘ g} → h ≈ i ∘ arr → i ≈ coequalize eq\n", "meta": {"hexsha": "c8ed381a9b4e155bdbfc11ae4b10a61bb7eea946", "size": 569, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "src/Categories/Diagram/Coequalizer.agda", "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Categories/Diagram/Coequalizer.agda", "max_issues_repo_name": "MirceaS/agda-categories", "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Categories/Diagram/Coequalizer.agda", "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.8846153846, "max_line_length": 73, "alphanum_fraction": 0.5571177504, "num_tokens": 217, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9284088064979618, "lm_q2_score": 0.7154239836484143, "lm_q1q2_score": 0.6642059267990417}} {"text": "{-# OPTIONS --cubical --no-import-sorts --safe #-}\n\nopen import Cubical.Core.Everything\nopen import Cubical.Algebra.Monoid\n\nmodule Cubical.Algebra.Monoid.Construct.Opposite {ℓ} (M : Monoid ℓ) where\n\nopen import Cubical.Foundations.Prelude\nopen import Cubical.Data.Prod using (_,_)\n\nopen Monoid M\n\nimport Cubical.Algebra.Semigroup.Construct.Opposite semigroup as OpSemigroup\nopen OpSemigroup public hiding (Op-isSemigroup; Sᵒᵖ)\n\n•ᵒᵖ-identityˡ : LeftIdentity ε _•ᵒᵖ_\n•ᵒᵖ-identityˡ _ = identityʳ _\n\n•ᵒᵖ-identityʳ : RightIdentity ε _•ᵒᵖ_\n•ᵒᵖ-identityʳ _ = identityˡ _\n\n•ᵒᵖ-identity : Identity ε _•ᵒᵖ_\n•ᵒᵖ-identity = •ᵒᵖ-identityˡ , •ᵒᵖ-identityʳ\n\n\nOp-isMonoid : IsMonoid Carrier _•ᵒᵖ_ ε\nOp-isMonoid = record\n { isSemigroup = OpSemigroup.Op-isSemigroup\n ; identity = •ᵒᵖ-identity\n }\n\nMᵒᵖ : Monoid ℓ\nMᵒᵖ = record { isMonoid = Op-isMonoid }\n", "meta": {"hexsha": "9e237d62d498a014f226a2e59b365c9cf9859d3b", "size": 840, "ext": "agda", "lang": "Agda", "max_stars_repo_path": "Cubical/Algebra/Monoid/Construct/Opposite.agda", "max_stars_repo_name": "bijan2005/univalent-foundations", "max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cubical/Algebra/Monoid/Construct/Opposite.agda", "max_issues_repo_name": "bijan2005/univalent-foundations", "max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cubical/Algebra/Monoid/Construct/Opposite.agda", "max_forks_repo_name": "bijan2005/univalent-foundations", "max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.7058823529, "max_line_length": 76, "alphanum_fraction": 0.75, "num_tokens": 351, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.9046505376715775, "lm_q2_score": 0.7341195385342971, "lm_q1q2_score": 0.6641216352502622}} {"text": "------------------------------------------------------------------------\n-- Well-founded induction\n------------------------------------------------------------------------\n\n-- I want universe polymorphism.\n\nopen import Relation.Binary\n\nmodule Induction1.WellFounded {a : Set} (_<_ : Rel a) where\n\nopen import Induction1\n\n-- When using well-founded recursion you can recurse arbitrarily, as\n-- long as the arguments become smaller, and \"smaller\" is\n-- well-founded.\n\nWfRec : RecStruct a\nWfRec P x = ∀ y → y < x → P y\n\n-- The accessibility predicate encodes what it means to be\n-- well-founded; if all elements are accessible, then _<_ is\n-- well-founded.\n\ndata Acc (x : a) : Set₁ where\n acc : (rs : WfRec Acc x) → Acc x\n\n-- Well-founded induction for the subset of accessible elements:\n\nmodule Some where\n\n wfRec-builder : SubsetRecursorBuilder Acc WfRec\n wfRec-builder P f x (acc rs) = λ y y