{"text": "> module SequentialDecisionProblems.TabBackwardsInductionOptDefaults1\n\n> import Data.Vect\n\n> import SequentialDecisionProblems.CoreTheory\n> import SequentialDecisionProblems.TabBackwardsInduction1\n> import SequentialDecisionProblems.Utils\n> import SequentialDecisionProblems.CoreTheoryOptDefaults\n\n> import Finite.Predicates\n> import Finite.Operations\n> import Finite.Properties\n> import Opt.Operations\n> import Rel.TotalPreorder\n> import Sigma.Sigma\n> import Sigma.Operations\n> import Sigma.Properties\n> import Vect.Operations\n> import Vect.Properties\n> import Decidable.Predicates\n\n> %default total\n> %access public export\n> %auto_implicits off\n\n\n> SequentialDecisionProblems.TabBackwardsInduction1.tabCvalargmax {n} x r v ps =\n>   Opt.Operations.argmax totalPreorderLTE (finiteGoodCtrl n x) (cardNotZGoodCtrl n x v) (tabCval x r v ps)\n\n> |||\n> goodCtrl : {t, m : Nat} ->\n>            (x : State t) -> .(r : Reachable x) -> .(v : Viable (S m) x) ->\n>            PolicyTable t (S m) -> GoodCtrl t x m\n> goodCtrl {t} {m} x r v pt =\n>   let xs   : Vect (cardState t) (State t)\n>            = vectState t in   \n>   let prf  : Elem x xs\n>            = toVectComplete (finiteState t) x in\n>   let rvxs : Vect (cardReachableAndViableState t (S m)) (State t)\n>            = map outl (vectReachableAndViableState t (S m)) in\n>   let dRV  : ((x : State t) -> Dec (ReachableAndViable (S m) x))\n>            = decidableReachableAndViable (S m) in                  \n>   let prf' : Elem x rvxs\n>            = filterTagSigmaLemma {P = ReachableAndViable (S m)} dRV x xs prf (r,v) in\n>   let k    : Fin (cardReachableAndViableState t (S m))\n>            = lookup x rvxs prf' in\n>   let x'   : State t\n>            = outl (index k pt) in\n>   let gy'  : GoodCtrl t x' m \n>            = snd (outr (index k pt)) in\n>   let gy   : GoodCtrl t x m\n>            = replace {P = \\ X => GoodCtrl t X m} (believe_me gy') gy' in\n>   gy\n\n> {-\n\n> ---}\n", "meta": {"hexsha": "bb30739e4092eb174ba7f81ddb192c6f40d0914a", "size": 1923, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "SequentialDecisionProblems/TabBackwardsInductionOptDefaults1.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/TabBackwardsInductionOptDefaults1.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/TabBackwardsInductionOptDefaults1.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 33.1551724138, "max_line_length": 107, "alphanum_fraction": 0.6432657306, "num_tokens": 594, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.822189121808099, "lm_q2_score": 0.6688802669716107, "lm_q1q2_score": 0.5499460792961555}}
{"text": "||| Spec: http://webassembly.github.io/spec/core/syntax/types.html#function-types\nmodule WebAssembly.Structure.Types.FunctionTypes\n\nimport WebAssembly.Structure.Types.ValueTypes\nimport WebAssembly.Structure.Types.ResultTypes\n\nimport Decidable.Equality\n\n-- Definition\n\ninfixr 6 ->>\n\npublic export\ndata FuncType : Type where\n  (->>) : ResultType -> ResultType -> FuncType\n\n-- Equality\n\ntotal public export\nlemma_functype__inputs_injective : ((in1 = in2) -> Void) -> ((in1 ->> out1) = (in2 ->> out2)) -> Void\nlemma_functype__inputs_injective in1_not_in2 Refl = in1_not_in2 Refl\n\ntotal public export\nlemma_functype__outputs_injective : ((out1 = out2) -> Void) -> ((in1 ->> out1) = (in2 ->> out2)) -> Void\nlemma_functype__outputs_injective out1_not_out2 Refl = out1_not_out2 Refl\n\n-- Decidable Equality\n\npublic export\nimplementation DecEq FuncType where\n  decEq (in1 ->> out1) (in2 ->> out2) = case (decEq in1 in2) of\n    No in1_not_in2 => No $ lemma_functype__inputs_injective in1_not_in2\n    Yes Refl  => case (decEq out1 out2) of\n      No out1_not_out2 => No $ lemma_functype__outputs_injective out1_not_out2\n      Yes Refl         => Yes Refl\n", "meta": {"hexsha": "edf1d1691562ff503aac80b549d3cf98cca9395e", "size": 1142, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "WebAssembly/Structure/Types/FunctionTypes.idr", "max_stars_repo_name": "RaoulSchaffranek/idris-webassembly", "max_stars_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-11-07T16:03:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-07T16:03:42.000Z", "max_issues_repo_path": "WebAssembly/Structure/Types/FunctionTypes.idr", "max_issues_repo_name": "RaoulSchaffranek/idris-webassembly", "max_issues_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "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": "WebAssembly/Structure/Types/FunctionTypes.idr", "max_forks_repo_name": "RaoulSchaffranek/idris-webassembly", "max_forks_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "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.7222222222, "max_line_length": 104, "alphanum_fraction": 0.738178634, "num_tokens": 341, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8056321889812553, "lm_q2_score": 0.6825737279551494, "lm_q1q2_score": 0.5499033665936028}}
{"text": "module Libra.Data\n\nimport Data.Vect\n\nimport Libra.Constants\n\n%access public export -- data constructors :)\n%default total\n\n{-\n  Proofs\n-}\n\n||| Proof builder ensuring all characters in a list are Alphanumeric\n|||\n||| @cs A list of possibly alphanumeric characters\nallAlphanumeric : (cs : List Char) -> Type\nallAlphanumeric [] = Elem True [True]\nallAlphanumeric (c :: cs) = case c `isElem` Alphanumeric of\n                                Yes prf => allAlphanumeric cs\n                                No contra => Elem c Alphanumeric\n\n{-\n  Types\n-}\n\n||| The empty atom\ndata Empty : Type where\n  MkEmpty : Empty\n\n||| The letter atom-part\ndata Letter : Char -> Type where\n  MkLetter : (c : Char) -> { auto prf : Elem c Alphabet } -> Letter c\n\n||| The number atom-part\ndata Number : Char -> Type where\n  MkNumber : (n : Char) -> { auto prf : Elem n Digits } -> Number n\n\n||| It's the smallest entity with resolvable meaning in Libra.\n|||\n||| Always starts with a letter and may contain an arbitrary number of\n||| alphanumeric characters afterwards.\ndata Symbol : Type where\n  MkSymbol : ( s : String ) ->\n             { auto nonEmpty : NonEmpty (unpack s) } ->\n             { auto headPrf : Elem (head (unpack s)) Alphabet } ->\n             { auto tailPrf : allAlphanumeric (tail (unpack s)) } ->\n             -- Considered using Data.Vect.Quantifiers.All but it was fairly\n             -- slower.\n             -- https://github.com/idris-lang/Idris-dev/blob/master/libs/base/Data/Vect/Quantifiers.idr#L70\n             -- { auto tailPrf : All ?isAlphanumeric (fromList (tail (unpack s))) } ->\n             Symbol\n\ndata SExpr : Type where\n  -- temporary, figure out how to make parseSymbol _guarantee_ a call to\n  -- MkName (MkSymbol name) -- with a non-empty name\n  MkName  : String -> SExpr\n  MkSExpr : List SExpr -> SExpr\n\npartial toString : SExpr -> String\ntoString (MkName x) = x\ntoString (MkSExpr []) = \"()\"\ntoString (MkSExpr xs) = let\n    body = (foldr (++) \"\" (intersperse \" \" (map toString xs)))\n  in\n    \"(\" ++ body ++ \")\"\n", "meta": {"hexsha": "f168e44212ec694bf83fc98d853058f85f45cd39", "size": 2026, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Libra/Data.idr", "max_stars_repo_name": "ostera/libra", "max_stars_repo_head_hexsha": "3b2b6ac4b0a11cbbe1f6a19847a2fa2f99b8a909", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2017-03-31T22:02:11.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-24T09:01:47.000Z", "max_issues_repo_path": "Libra/Data.idr", "max_issues_repo_name": "ostera/libra", "max_issues_repo_head_hexsha": "3b2b6ac4b0a11cbbe1f6a19847a2fa2f99b8a909", "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": "Libra/Data.idr", "max_forks_repo_name": "ostera/libra", "max_forks_repo_head_hexsha": "3b2b6ac4b0a11cbbe1f6a19847a2fa2f99b8a909", "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.2388059701, "max_line_length": 107, "alphanum_fraction": 0.6224086871, "num_tokens": 538, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744939732856, "lm_q2_score": 0.6723316926137812, "lm_q1q2_score": 0.5496812433709148}}
{"text": "test3ok : Nat\ntest3ok = case (the Nat 1, the Nat 2) of\n               (x, y) => x + y\n\ntest3ok' : Nat\ntest3ok' = case (1, 2) of\n             (x, y) => x + y\n", "meta": {"hexsha": "ed44f6e8b1955016784cd953b696cde101aded1d", "size": 157, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic017/CaseInf.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/basic017/CaseInf.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/basic017/CaseInf.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 19.625, "max_line_length": 40, "alphanum_fraction": 0.4458598726, "num_tokens": 67, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7279754489059774, "lm_q2_score": 0.7549149978955811, "lm_q1q2_score": 0.5495595844788906}}
{"text": "module Main\n\nimport CLaSH.Prelude\n\ndotp : Num a => Vect n a -> Vect n a -> a\ndotp as bs = foldr (+) 0 (zipWith (*) as bs)\n\nfir : (Num a, Default a) => Vect (S (S n)) (Signal a) -> Signal a -> Signal a\nfir {a} coeffs x_t = y_t\n  where\n    xs : Default a => Vect (S (S n)) (Signal a)\n    xs  = window x_t\n    y_t = dotp coeffs xs\n\ntopEntity : Signal Integer -> Signal Integer\ntopEntity = fir [2,3,-2,8]\n\ntestInput : List Integer\ntestInput = [2,3,-2,8]\n\nexpectedOutput : List Integer\nexpectedOutput = [4,12,1,20]\n\nmain : IO ()\nmain = putStrLn (show $ simulate topEntity testInput == expectedOutput)\n", "meta": {"hexsha": "3fb07cecd93718b25e97d2e8e165041ce7d8b35a", "size": 596, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "examples/FIR.idr", "max_stars_repo_name": "christiaanb/clash-prelude-idris", "max_stars_repo_head_hexsha": "b94c4dcc47db117c423ee7e86d7b7cf0118225dd", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2017-05-15T11:13:46.000Z", "max_stars_repo_stars_event_max_datetime": "2017-06-26T23:42:18.000Z", "max_issues_repo_path": "examples/FIR.idr", "max_issues_repo_name": "christiaanb/clash-prelude-idris", "max_issues_repo_head_hexsha": "b94c4dcc47db117c423ee7e86d7b7cf0118225dd", "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": "examples/FIR.idr", "max_forks_repo_name": "christiaanb/clash-prelude-idris", "max_forks_repo_head_hexsha": "b94c4dcc47db117c423ee7e86d7b7cf0118225dd", "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": 22.9230769231, "max_line_length": 77, "alphanum_fraction": 0.6359060403, "num_tokens": 197, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8577680977182186, "lm_q2_score": 0.640635861701035, "lm_q1q2_score": 0.5495170044213686}}
{"text": "data PowerSource = Petrol | Pedal | Electic\n\ndata Vehicle : PowerSource -> Type where\n  Unicycle : Vehicle Pedal\n  Bicycle : Vehicle Pedal\n  Motorcycle : (fuel : Nat) -> Vehicle Petrol\n  Car : (fuel : Nat) -> Vehicle Petrol\n  Bus : (fuel : Nat) -> Vehicle Petrol\n  Tram : (battery : Nat) -> Vehicle Electic\n  ElectricCar : (battery : nat) -> Vehicle Electic\n\nwheels : Vehicle power -> Nat\nwheels Unicycle = 1\nwheels Bicycle = 2\nwheels (Motorcycle fuel) = 2\nwheels (Car fuel) = 4\nwheels (Bus fuel) = 4\nwheels (Tram battery) = 16\nwheels (ElectricCar battery) = 4\n\nrefuel : Vehicle Petrol -> Vehicle Petrol\nrefuel (Motorcycle fuel) = Motorcycle 50\nrefuel (Car fuel) = Car 100\nrefuel (Bus fuel) = Bus 200\nrefuel (Tram battery) = Tram 1000\nrefuel (ElectricCar battery) = ElectricCar 300\n", "meta": {"hexsha": "fb2dd6458add131764251cc0b6942b173c06fe5e", "size": 782, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type_driven_book/chp4/vehicle.idr", "max_stars_repo_name": "Ryxai/idris_book_notes", "max_stars_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "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_driven_book/chp4/vehicle.idr", "max_issues_repo_name": "Ryxai/idris_book_notes", "max_issues_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_issues_repo_licenses": ["MIT"], "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_driven_book/chp4/vehicle.idr", "max_forks_repo_name": "Ryxai/idris_book_notes", "max_forks_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_forks_repo_licenses": ["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.962962963, "max_line_length": 50, "alphanum_fraction": 0.7033248082, "num_tokens": 252, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.872347368040789, "lm_q2_score": 0.6297746074044134, "lm_q1q2_score": 0.5493822212281613}}
{"text": "> module FastSimpleProb.BasicOperations\n\n> import Data.List\n> import Data.So\n> import Syntax.PreorderReasoning\n\n> import FastSimpleProb.SimpleProb\n> import Double.Predicates\n> import NonNegDouble.NonNegDouble\n> import NonNegDouble.Constants\n> import NonNegDouble.BasicOperations\n> import NonNegDouble.Operations\n> import NonNegDouble.Properties\n> import NonNegDouble.Postulates\n> import List.Operations\n> import List.Properties\n> import Fun.Operations\n> import Pairs.Operations\n\n> %default total\n> %access public export\n> %auto_implicits off\n\n\n> using implementation NumNonNegDouble\n>   |||\n>   mkSimpleProb : {A : Type} -> \n>                  (aps : List (A, NonNegDouble)) -> \n>                  {auto prf : Positive (toDouble (sumMapSnd aps))} ->\n>                  SimpleProb A\n>   mkSimpleProb aps {prf} = MkSimpleProb aps prf\n\n\n> |||\n> toList : {A : Type} -> SimpleProb A -> List (A, NonNegDouble)\n> toList (MkSimpleProb aps _) = aps\n\n\n> |||\n> support : {A : Type} -> SimpleProb A -> List A\n> support = (map fst) . toList\n\n\n> using implementation NumNonNegDouble\n>   |||\n>   rescale : {A : Type} -> \n>             (p : NonNegDouble) -> Positive (toDouble p) -> SimpleProb A -> SimpleProb A\n>   rescale {A} p pp (MkSimpleProb aps psum) = MkSimpleProb aps' psum' where\n>     aps'  : List (A, NonNegDouble)\n>     aps'  = mapIdRightMult (aps, p)\n>     psum' : Positive (toDouble (sumMapSnd aps'))\n>     psum' = mapIdRightMultPreservesPositivity aps psum p pp\n\n\n> using implementation NumNonNegDouble\n>   using implementation FractionalNonNegDouble\n>     |||\n>     normalize : {A : Type} -> \n>                 SimpleProb A -> SimpleProb A\n>     normalize (MkSimpleProb aps psum) = \n>       let p  : NonNegDouble\n>              = one / (sumMapSnd aps) in\n>       let pp : Positive (toDouble p)\n>              = divPreservesPositivity positiveOne psum in \n>       rescale p pp (MkSimpleProb aps psum) \n\n\n> |||\n> weights : {A : Type} -> SimpleProb A -> List NonNegDouble\n> weights = (map snd) . toList\n\n\n> using implementation NumNonNegDouble\n>   ||| 'weight sp a' is the weight of 'a' according to 'sp'\n>   weight : {A : Type} -> (Eq A) => SimpleProb A -> A -> NonNegDouble\n>   weight sp a = foldr f (fromInteger 0) (toList sp) where\n>     f : (A, NonNegDouble) -> NonNegDouble -> NonNegDouble\n>     f (a', w') w = if (a == a') then w + w' else w\n\n\n> using implementation FractionalNonNegDouble\n>   ||| 'prob sp a' is the probability of 'a' according to 'sp'\n>   prob : {A : Type} -> (Eq A) => SimpleProb A -> A -> NonNegDouble\n>   prob sp a = (weight sp a) / (sum (weights sp))\n\n> {-\n> ||| 'prob sp a' is the probability of 'a' according to 'sp'\n> prob : {A : Type} -> (Eq A) => SimpleProb A -> A -> Double\n> prob sp a = fst pq / snd pq where\n>   f : (A, Double) -> (Double, Double) -> (Double, Double)\n>   f (a', p') (p, q) = if (a == a') then (p + p', q + p') else (p, q + p')\n>   pq : (Double, Double)\n>   pq = foldr f (0.0, 0.0) (toList sp)\n> -}\n\n\n> using implementation NumNonNegDouble\n>   ||| Make a SimpleProb in which all elements of a list have the same \n>   ||| probablility. If the list has no duplicates, this results in a\n>   ||| uniform probability distribution\n>   mkFlatSimpleProb : {A : Type} -> (as : List A) -> List.Operations.NonEmpty as -> SimpleProb A\n>   mkFlatSimpleProb      Nil              prf = absurd prf\n>   mkFlatSimpleProb {A} (a :: Nil)        _   = MkSimpleProb [(a, one)] positiveOne\n>   mkFlatSimpleProb {A} (a :: (a' :: as)) _   = MkSimpleProb aps prf where\n>     ps' : SimpleProb A\n>     ps' = assert_total (mkFlatSimpleProb (a' :: as) ())\n>     aps : List (A, NonNegDouble)\n>     aps = (a, one) :: (toList ps')\n>     prf : Positive (toDouble (sumMapSnd aps))\n>     prf = sumMapSndConsLemma1 a 1.0 positiveOne (MkLTE Oh) (toList ps')\n\n\n> using implementation NumNonNegDouble\n>   using implementation EqNonNegDouble\n>     |||\n>     trim : {A : Type} -> (Eq A) => \n>            SimpleProb A -> SimpleProb A\n>     trim {A} (MkSimpleProb aps psum) = MkSimpleProb aps' psum' where\n>       aps'  : List (A, NonNegDouble)\n>       aps'  = discardBySndZeroEq aps\n>       psum' : Positive (toDouble (sumMapSnd aps'))\n>       psum' = replace {P = \\ X => Positive (toDouble X)} (sym (discardBySndZeroLemmaEq aps)) psum\n\n\n> using implementation ShowNonNegDouble\n>   ||| \n>   showlong : {A : Type} -> Show A => SimpleProb A -> String\n>   showlong sp = showlong (toList sp) \n\n\n> {-\n\n> ---}    \n\n\n\n\n", "meta": {"hexsha": "77c0e19d98298a4d8b4ef0140bd6453718fac45f", "size": 4421, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "FastSimpleProb/BasicOperations.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "FastSimpleProb/BasicOperations.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "FastSimpleProb/BasicOperations.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 32.0362318841, "max_line_length": 99, "alphanum_fraction": 0.6172811581, "num_tokens": 1405, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059511841119, "lm_q2_score": 0.6926419831347362, "lm_q1q2_score": 0.5493384788641246}}
{"text": "import Data.Vect\n\nMkBig : Nat -> Type\nMkBig Z = Int\nMkBig (S k) = ((n ** Vect n Int), MkBig k)\n\nbigEx : (n : Nat) -> MkBig n\nbigEx Z = 94\nbigEx (S k) = ((2 ** [0,0]), bigEx k)\n\ndata VWrap : Type -> Type where\n     MkVWrap : (0 n : Nat) -> Vect n a -> VWrap a\n\nexport\nMkBig' : Nat -> Type\nMkBig' Z = Int\nMkBig' (S k) = (VWrap Int, MkBig' k)\n\nnamespace Foo\n  public\n  export\n  bigEx' : (n : Nat) -> MkBig' n\n  bigEx' Z = 94\n  bigEx' (S k) = (MkVWrap 1 [0], bigEx' k)\n\neqBigs : bigEx 1000000 = bigEx 1000000\neqBigs = Refl\n\neqBigs' : bigEx' 800000 = bigEx' 800000\neqBigs' = Refl\n\n", "meta": {"hexsha": "b5167bbc4ab0c8b6e90e2c47f1ccd0656b5a7011", "size": 576, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/perf004/bigdpair.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/perf004/bigdpair.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/perf004/bigdpair.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.0, "max_line_length": 49, "alphanum_fraction": 0.5850694444, "num_tokens": 255, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673178375735, "lm_q2_score": 0.6757645879592641, "lm_q1q2_score": 0.54930694810406}}
{"text": "module Main\n\nimport Data.List\nimport Data.HVect\nimport Helper \n\nallowedChars : List Char\nallowedChars = ['a'..'z'] ++ ['0'..'9'] ++ ['-']\n\ndata ValidLiteral : List Char -> Type where\n  One : { auto prf : Elem value Main.allowedChars } -> ValidLiteral [value]\n  Multi : { auto prf : Elem value Main.allowedChars } -> ValidLiteral xs -> ValidLiteral (value :: xs) \n\ndata LiteralRoute : String -> Type where\n  Literal : (lit:String) ->\n            -- RULE 1  \n            { auto prf : ValidLiteral (unpack lit) } -> \n            LiteralRoute lit\n\n-----------------------------------\n                    \ndata Base = MkBase    \n\nmaxLevel : Nat\nmaxLevel = 3 \n\ninfixl 9 /\ndata Route :  List Type -> Type where\n  Root : Route [Base]\n  (/) : Route parent -> \n        child ->\n        -- RULE 2\n        { auto prf : LTE (length (child :: parent) ) Main.maxLevel } ->  \n        Route (child :: parent)\n\n--------------------------------------\n\ndata HttpMethod = HttpGet | HttpPost\n\nHttpHandler : Type \nHttpHandler = String -> String \n\nhandler : HttpHandler\nhandler = id\n\nRouteHandler : (route:List Type) -> Type\nRouteHandler r = (HttpMethod, Route r, HttpHandler)\n\nGET : Route r -> HttpHandler -> RouteHandler r \nGET route handler = (HttpGet, route, handler) \n\nsampleRoute : Test RouteHandler \nsampleRoute = Check $ GET (Root / Literal \"sports\") handler\n\n---------------------------------------\n\n--validConfiguration : Test RoutesConfiguration\n--validConfiguration = Check $ Routes \n--            ( GET  Root handler ) &      \n--            ( GET (Root / Literal \"sports\") handler) & \n--            ( GET (Root / Literal \"sports\" / Literal \"football\") handler ) -- must compile\n          \n--invalidConfiguration : Test RoutesConfiguration\n--invalidConfiguration = Check $ Routes \n--            ( GET  Root handler ) &      \n--            ( GET (Root / Literal \"sports\" / Literal \"football\") handler ) -- must not compile\n\n", "meta": {"hexsha": "5d420250a38c250e359d91965a32d0ac9a866895", "size": 1911, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "rule-3.idr", "max_stars_repo_name": "janschultecom/typelevel-seo", "max_stars_repo_head_hexsha": "078c3fcfd16d99ef5e97935bd54e629976cf5846", "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": "rule-3.idr", "max_issues_repo_name": "janschultecom/typelevel-seo", "max_issues_repo_head_hexsha": "078c3fcfd16d99ef5e97935bd54e629976cf5846", "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": "rule-3.idr", "max_forks_repo_name": "janschultecom/typelevel-seo", "max_forks_repo_head_hexsha": "078c3fcfd16d99ef5e97935bd54e629976cf5846", "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.1029411765, "max_line_length": 103, "alphanum_fraction": 0.5761381476, "num_tokens": 447, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7853085909370422, "lm_q2_score": 0.6992544273261176, "lm_q1q2_score": 0.5491305090299619}}
{"text": "= Data.Ix\n\n> ||| A partial port of Haskell's Data.Ix to Idris.\n> module Data.Ix\n>\n> import Debug.Error\n>\n> %language ElabReflection\n\n== Errors\n\n> %access export\n>\n> indexError : Show a => (a,a) -> a -> String -> b\n> indexError rng i tp =\n>     error $ \"Ix{\" ++ show tp ++ \"}.index: Index \" ++\n>             \"(\" ++ show i ++ \") out of range \" ++\n>             \"(\" ++ show rng ++ \")\"\n>\n> hopelessIndexError : Int         -- Try to use 'indexError' instead!\n> hopelessIndexError = error \"Error in array index\"\n\n== Interface\n\n> %access public export\n>\n> interface (Ord a) => Ix a where\n>   range                   : (a,a) -> List a\n>   index                   : (a,a) -> a -> Int\n>   unsafeIndex             : (a,a) -> a -> Int\n>   inRange                 : (a,a) -> a -> Bool\n>   rangeSize               : (a,a) -> Int\n>   unsafeRangeSize         : (a,a) -> Int\n>\n>   index b i               = if inRange b i\n>                                then unsafeIndex b i\n>                                else hopelessIndexError\n>\n>   unsafeIndex b i         = index b i\n>\n>   rangeSize b@(_,h)       = if inRange b h\n>                                then unsafeIndex b h + 1\n>                                else 0   -- This case is only here to\n>                                         -- check for an empty range\n>\n>   unsafeRangeSize b@(_,h) = unsafeIndex b h + 1\n\n== Implementations\n\n> implementation Ix Nat where\n>   range (m,n)             = [m .. n]\n>   unsafeIndex (m,_) i     = cast $ i `minus` m\n>   index b i               = if inRange b i\n>                                then unsafeIndex b i\n>                                else indexError b i \"Nat\"\n>   inRange (m,n) i         = m <= i && i <= n\n", "meta": {"hexsha": "84881901351038fdb22d0fa2c58fe317dab10228", "size": 1701, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "src/Data/Ix.lidr", "max_stars_repo_name": "yurrriq/advent-of-code", "max_stars_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-11-04T10:32:47.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-05T07:36:22.000Z", "max_issues_repo_path": "src/Data/Ix.lidr", "max_issues_repo_name": "yurrriq/aoc19", "max_issues_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_issues_repo_licenses": ["MIT"], "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/Ix.lidr", "max_forks_repo_name": "yurrriq/aoc19", "max_forks_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-02-26T19:27:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-26T19:27:21.000Z", "avg_line_length": 29.8421052632, "max_line_length": 70, "alphanum_fraction": 0.442680776, "num_tokens": 459, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7853085909370423, "lm_q2_score": 0.6992544210587585, "lm_q1q2_score": 0.5491305041081509}}
{"text": "data Vect : Nat -> Type -> Type where\n     Nil : Vect Z a\n     (::) : a -> Vect k a -> Vect (S k) a\n\n%name Vect xs, ys, zs\n\nappend : Vect n a -> Vect m a -> Vect (n + m) a\nappend xs ys\n    = case xs of\n           foo => ?bar\n\ndata Foo a = MkFoo a | MkBar (a -> a)\n\nFunctor Foo where\n  map f thing = ?baz\n", "meta": {"hexsha": "8e79c60833493c95e5c12d9287e74d51fef409e3", "size": 304, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interactive003/IEdit.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/interactive003/IEdit.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/interactive003/IEdit.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 19.0, "max_line_length": 47, "alphanum_fraction": 0.5197368421, "num_tokens": 105, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.785308580887758, "lm_q2_score": 0.6992544147913994, "lm_q1q2_score": 0.5491304921593335}}
{"text": "h : Nat -> () -> Nat\nh x = \\_ => (+) x 1\n\nh' : Nat -> Lazy Nat\nh' x = (+) x 1\n\n{-\n\n*11.2-InfiniteIO> h 1\n\\underscore => 2 : () -> Nat\n\n*11.2-InfiniteIO> h' 1\nDelay 2 : Lazy Nat\n\n-}\n", "meta": {"hexsha": "a254dcc19154e8740307aa642c001927234a6095", "size": 181, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris/Lazy.idr", "max_stars_repo_name": "ostera/asdf", "max_stars_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2017-03-02T22:25:19.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T18:22:11.000Z", "max_issues_repo_path": "idris/Lazy.idr", "max_issues_repo_name": "ostera/asdf", "max_issues_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2019-12-05T22:45:56.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-05T22:45:58.000Z", "max_forks_repo_path": "idris/Lazy.idr", "max_forks_repo_name": "ostera/asdf", "max_forks_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 11.3125, "max_line_length": 28, "alphanum_fraction": 0.4640883978, "num_tokens": 84, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7606506526772883, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.548994445488312}}
{"text": "||| [specification](https://csrc.nist.gov/csrc/media/publications/fips/46/3/archive/1999-10-25/documents/fips46-3.pdf)\nmodule Data.Crypto.Encryption.Block.DEA\n\n-- import Control.Isomorphism\nimport Data.Bits\nimport Data.Fin\nimport Data.Vect\n\nimport Data.Crypto.Encryption\nimport Data.Crypto.Encryption.Block\nimport Data.Crypto.Util\n\n%default total\n%access private\n\n-- utility functions\n\ntrim : Bits (1 + n) -> Bits n\ntrim b = truncate (shiftRightLogical (intToBits 1) b)\n\n-- Plenty of places in the 3DES spec use 1-based indexes, where we would like\n-- 0-based indexes. So we embed the same numbers from the spec (for easy\n-- eyeball-checking), then use this to correct the difference.\noffByOne : Fin (S (S n)) -> Fin (S n)\noffByOne FZ     = FZ\noffByOne (FS y) = y\n\nselectBits : Vect m (Fin n) -> Bits n -> Bits m\nselectBits positions input = foldl (\\acc, b => shiftLeft acc (intToBits 1) `and` b)\n                                   (intToBits 0)\n                                   (map (\\x => intToBits (if getBit x input then 1 else 0)) positions)\n\n||| The initial permutation\nIP : Bits 64 -> Bits 64\nIP = selectBits (map offByOne [58, 50, 42, 34, 26, 18, 10,  2,\n                               60, 52, 44, 36, 28, 20, 12,  4,\n                               62, 54, 46, 38, 30, 22, 14,  6,\n                               64, 56, 48, 40, 32, 24, 16,  8,\n                               57, 49, 41, 33, 25, 17,  9,  1,\n                               59, 51, 43, 35, 27, 19, 11,  3,\n                               61, 53, 45, 37, 29, 21, 13,  5,\n                               63, 55, 47, 39, 31, 23, 15,  7])\n\ninverseIP : Bits 64 -> Bits 64\ninverseIP = selectBits (map offByOne [40,  8, 48, 16, 56, 24, 64, 32,\n                                      39,  7, 47, 15, 55, 23, 63, 31,\n                                      38,  6, 46, 14, 54, 22, 62, 30,\n                                      37,  5, 45, 13, 53, 21, 61, 29,\n                                      36,  4, 44, 12, 52, 20, 60, 28,\n                                      35,  3, 43, 11, 51, 19, 59, 27,\n                                      34,  2, 42, 10, 50, 18, 58, 26,\n                                      33,  1, 41,  9, 49, 17, 57, 25])\n\n-- TODO: prove this\n-- permutation : Iso (Bits 64) (Bits 64)\n-- permutation = MkIso IP IP'\n\nE : Bits 32 -> Bits 48\nE = selectBits (map offByOne [32,  1,  2,  3,  4,  5,\n                               4,  5,  6,  7,  8,  9,\n                               8,  9, 10, 11, 12, 13,\n                              12, 13, 14, 15, 16, 17,\n                              16, 17, 18, 19, 20, 21,\n                              20, 21, 22, 23, 24, 25,\n                              24, 25, 26, 27, 28, 29,\n                              28, 29, 30, 31, 32,  1])\n\nP : Bits 32 -> Bits 32\nP = selectBits (map offByOne [16,  7, 20, 21,\n                              29, 12, 28, 17,\n                               1, 15, 23, 26,\n                               5, 18, 31, 10,\n                               2,  8, 24, 14,\n                              32, 27,  3,  9,\n                              19, 13, 30,  6,\n                              22, 11,  4, 25])\n\n-- TODO: Generalize from `16 in `Fin 16` and `nextPow2 16` to `n`.\nselect : Vect 4 (Vect 16 (Fin 16)) -> Bits 6 -> Bits (nextPow2 16)\nselect table bits =\n  let row = bitsToFin (truncate {m=4} (or (shiftRightLogical (cast 5) (and bits (intToBits 32))) (and bits (intToBits 1))))\n      col = bitsToFin (truncate {m=2} (shiftRightLogical (cast 1) (and bits (intToBits 30))))\n  in finToBits (index col (index row table))\n\nS : Vect 8 (Bits 6 -> Bits 4)\nS = map select\n        --  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15\n        [[[14,  4, 13,  1,  2, 15, 11,  8,  3, 10,  6, 12,  5,  9,  0,  7],\n          [ 0, 15,  7,  4, 14,  2, 13,  1, 10,  6, 12, 11,  9,  5,  3,  8],\n          [ 4,  1, 14,  8, 13,  6,  2, 11, 15, 12,  9,  7,  3, 10,  5,  0],\n          [15, 12,  8,  2,  4,  9,  1,  7,  5, 11,  3, 14, 10,  0,  6, 13]],\n         [[15,  1,  8, 14,  6, 11,  3,  4,  9,  7,  2, 13, 12,  0,  5, 10],\n          [ 3, 13,  4,  7, 15,  2,  8, 14, 12,  0,  1, 10,  6,  9, 11,  5],\n          [ 0, 14,  7, 11, 10,  4, 13,  1,  5,  8, 12,  6,  9,  3,  2, 15],\n          [13,  8, 10,  1,  3, 15,  4,  2, 11,  6,  7, 12,  0,  5, 14,  9]],\n         [[10,  0,  9, 14,  6,  3, 15,  5,  1, 13, 12,  7, 11,  4,  2,  8],\n          [13,  7,  0,  9,  3,  4,  6, 10,  2,  8,  5, 14, 12, 11, 15,  1],\n          [13,  6,  4,  9,  8, 15,  3,  0, 11,  1,  2, 12,  5, 10, 14,  7],\n          [ 1, 10, 13,  0,  6,  9,  8,  7,  4, 15, 14,  3, 11,  5,  2, 12]],\n         [[ 7, 13, 14,  3,  0,  6,  9, 10,  1,  2,  8,  5, 11, 12,  4, 15],\n          [13,  8, 11,  5,  6, 15,  0,  3,  4,  7,  2, 12,  1, 10, 14,  9],\n          [10,  6,  9,  0, 12, 11,  7, 13, 15,  1,  3, 14,  5,  2,  8,  4],\n          [ 3, 15,  0,  6, 10,  1, 13,  8,  9,  4,  5, 11, 12,  7,  2, 14]],\n         [[ 2, 12,  4,  1,  7, 10, 11,  6,  8,  5,  3, 15, 13,  0, 14,  9],\n          [14, 11,  2, 12,  4,  7, 13,  1,  5,  0, 15, 10,  3,  9,  8,  6],\n          [ 4,  2,  1, 11, 10, 13,  7,  8, 15,  9, 12,  5,  6,  3,  0, 14],\n          [11,  8, 12,  7,  1, 14,  2, 13,  6, 15,  0,  9, 10,  4,  5,  3]],\n         [[12,  1, 10, 15,  9,  2,  6,  8,  0, 13,  3,  4, 14,  7,  5, 11],\n          [10, 15,  4,  2,  7, 12,  9,  5,  6,  1, 13, 14,  0, 11,  3,  8],\n          [ 9, 14, 15,  5,  2,  8, 12,  3,  7,  0,  4, 10,  1, 13, 11,  6],\n          [ 4,  3,  2, 12,  9,  5, 15, 10, 11, 14,  1,  7,  6,  0,  8, 13]],\n         [[ 4, 11,  2, 14, 15,  0,  8, 13,  3, 12,  9,  7,  5, 10,  6,  1],\n          [13,  0, 11,  7,  4,  9,  1, 10, 14,  3,  5, 12,  2, 15,  8,  6],\n          [ 1,  4, 11, 13, 12,  3,  7, 14, 10, 15,  6,  8,  0,  5,  9,  2],\n          [ 6, 11, 13,  8,  1,  4, 10,  7,  9,  5,  0, 15, 14,  2,  3, 12]],\n         [[13,  2,  8,  4,  6, 15, 11,  1, 10,  9,  3, 14,  5,  0, 12,  7],\n          [ 1, 15, 13,  8, 10,  3,  7,  4, 12,  5,  6, 11,  0, 14,  9,  2],\n          [ 7, 11,  4,  1,  9, 12, 14,  2,  0,  6, 10, 13, 15,  3,  5,  8],\n          [ 2,  1, 14,  7,  4, 10,  8, 13, 15, 12,  9,  0,  3,  5,  6, 11]]]\n\nf : Bits 32 -> Bits 48 -> Bits 32\nf R K = P (concat (zipWith apply S (partition (E R `xor` K))))\n\niteration : (Bits 32, Bits 32) -> Bits 48 -> (Bits 32, Bits 32)\niteration (L, R) K = (R, L `xor` f R K)\n\ncentralDEA : Bits 64 -> Vect 16 (Bits 48) -> Bits 64\ncentralDEA input keys =\n  let [L, R] = the (Vect 2 (Bits 32)) (partition (IP input))\n  in inverseIP (uncurry (flip append) (foldl iteration (L, R) keys))\n\n||| permuted choice\nPC1 : Bits 64 -> Bits 56\nPC1 = selectBits (map offByOne [57, 49, 41, 33, 25, 17,  9,\n                                 1, 58, 50, 42, 34, 26, 18,\n                                10,  2, 59, 51, 43, 35, 27,\n                                19, 11,  3, 60, 52, 44, 36,\n                                63, 55, 47, 39, 31, 23, 15,\n                                 7, 62, 54, 46, 38, 30, 22,\n                                14,  6, 61, 53, 45, 37, 29,\n                                21, 13,  5, 28, 20, 12,  4])\n\n||| permuted choice\nPC2 : Bits 56 -> Bits 48\nPC2 = selectBits (map offByOne [14, 17, 11, 24,  1,  5,\n                                 3, 28, 15,  6, 21, 10,\n                                23, 19, 12,  4, 26,  8,\n                                16,  7, 27, 20, 13,  2,\n                                41, 52, 31, 37, 47, 55,\n                                30, 40, 51, 45, 33, 48,\n                                44, 49, 39, 56, 34, 53,\n                                46, 42, 50, 36, 29, 32])\n\npublic export\nDEAKey : Type\nDEAKey = Bits 64\n\n||| INSECURE!\npublic export\ndata DataEncryptionAlgorithm : Type where\n  DEA : DEAKey -> DataEncryptionAlgorithm\n\n\n||| key schedule\nKS : DEAKey -> Vect 16 (Bits 48)\nKS key = map PC2\n             (tail (scanl (\\prevKey, shift =>\n                            concat (map (rotateLeft shift)\n                                        (partition {m=28} {n=2} prevKey)))\n                          (PC1 key)\n                          [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1]))\n\n\nimplementation BlockCipher DataEncryptionAlgorithm 64 0 where\n  encryptBlock (DEA key) block = centralDEA block (KS key)\n  decryptBlock (DEA key) block = centralDEA block (reverse (KS key))\n", "meta": {"hexsha": "318b20747e4cde2ea0c09c0b4b4576151def1721", "size": 8266, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Crypto/Encryption/Block/DEA.idr", "max_stars_repo_name": "idris-hackers/idris-crypto", "max_stars_repo_head_hexsha": "0fb69b76e399f2fa72f338e410504323751843e7", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 79, "max_stars_repo_stars_event_min_datetime": "2015-01-11T20:37:05.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-10T07:41:27.000Z", "max_issues_repo_path": "src/Data/Crypto/Encryption/Block/DEA.idr", "max_issues_repo_name": "idris-hackers/idris-crypto", "max_issues_repo_head_hexsha": "0fb69b76e399f2fa72f338e410504323751843e7", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2015-09-10T20:32:40.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-18T16:27:23.000Z", "max_forks_repo_path": "src/Data/Crypto/Encryption/Block/DEA.idr", "max_forks_repo_name": "idris-hackers/idris-crypto", "max_forks_repo_head_hexsha": "0fb69b76e399f2fa72f338e410504323751843e7", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 12, "max_forks_repo_forks_event_min_datetime": "2015-04-23T23:09:48.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-10T22:30:23.000Z", "avg_line_length": 46.7005649718, "max_line_length": 123, "alphanum_fraction": 0.3998306315, "num_tokens": 3964, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.851952809486198, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5488493894126077}}
{"text": "module Main\n\ndata Ty = TyInt | TyBool | TyFun Ty Ty\n\ninterpTy : Ty -> Type\ninterpTy TyInt       = Int\ninterpTy TyBool      = Bool\ninterpTy (TyFun s t) = interpTy s -> interpTy t\n\nusing (G : Vect n Ty)\n\n  data Env : Vect n Ty -> Type where\n      Nil  : Env Nil\n      (::) : interpTy a -> Env G -> Env (a :: G)\n\n  data HasType : (i : Fin n) -> Vect n Ty -> Ty -> Type where\n      stop : HasType fZ (t :: G) t\n      pop  : HasType k G t -> HasType (fS k) (u :: G) t\n\n  lookup : HasType i G t -> Env G -> interpTy t\n  lookup stop    (x :: xs) = x\n  lookup (pop k) (x :: xs) = lookup k xs\n\n  data Expr : Vect n Ty -> Ty -> Type where\n      Var : HasType i G t -> Expr G t\n      Val : (x : Int) -> Expr G TyInt\n      Lam : Expr (a :: G) t -> Expr G (TyFun a t)\n      App : Expr G (TyFun a t) -> Expr G a -> Expr G t\n      Op  : (interpTy a -> interpTy b -> interpTy c) -> Expr G a -> Expr G b ->\n            Expr G c\n      If  : Expr G TyBool -> Expr G a -> Expr G a -> Expr G a\n      Bind : Expr G a -> (interpTy a -> Expr G b) -> Expr G b\n\n  dsl expr\n      lambda      = Lam\n      variable    = Var\n      index_first = stop\n      index_next  = pop\n\n  (<$>) : |(f : Expr G (TyFun a t)) -> Expr G a -> Expr G t\n  (<$>) = \\f, a => App f a\n\n  pure : Expr G a -> Expr G a\n  pure = id\n\n  syntax IF [x] THEN [t] ELSE [e] = If x t e\n\n  (==) : Expr G TyInt -> Expr G TyInt -> Expr G TyBool\n  (==) = Op (==)\n\n  (<) : Expr G TyInt -> Expr G TyInt -> Expr G TyBool\n  (<) = Op (<)\n\n  instance Num (Expr G TyInt) where\n    (+) x y = Op (+) x y\n    (-) x y = Op (-) x y\n    (*) x y = Op (*) x y\n\n    abs x = IF (x < 0) THEN (-x) ELSE x\n\n    fromInteger = Val . fromInteger\n\n  interp : Env G -> {static} Expr G t -> interpTy t\n  interp env (Var i)     = lookup i env\n  interp env (Val x)     = x\n  interp env (Lam sc)    = \\x => interp (x :: env) sc\n  interp env (App f s)   = (interp env f) (interp env s)\n  interp env (Op op x y) = op (interp env x) (interp env y)\n  interp env (If x t e)  = if (interp env x) then (interp env t) else (interp env e)\n  interp env (Bind v f)  = interp env (f (interp env v))\n\n  eId : Expr G (TyFun TyInt TyInt)\n  eId = expr (\\x => x)\n\n  eTEST : Expr G (TyFun TyInt (TyFun TyInt TyInt))\n  eTEST = expr (\\x, y => y)\n\n  eAdd : Expr G (TyFun TyInt (TyFun TyInt TyInt))\n  eAdd = expr (\\x, y => Op (+) x y)\n\n  eDouble : Expr G (TyFun TyInt TyInt)\n  eDouble = expr (\\x => App (App eAdd x) (Var stop))\n\n  eFac : Expr G (TyFun TyInt TyInt)\n  eFac = expr (\\x => IF x == 0 THEN 1 ELSE [| eFac (x - 1) |] * x)\n\ntestFac : Int\ntestFac = interp [] eFac 4\n\nmain : IO ()\nmain = print testFac\n\n\n", "meta": {"hexsha": "f0e96d884fd7cb6ebed6a555b8f9873418a514db", "size": 2591, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "vendor/bundle/ruby/2.0.0/gems/pygments.rb-0.6.1/vendor/pygments-main/tests/examplefiles/test.idr", "max_stars_repo_name": "agent010101/agent010101.github.io", "max_stars_repo_head_hexsha": "b8bf8ef1bc30999223deb95506b0685b4ec8449a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 23, "max_stars_repo_stars_event_min_datetime": "2015-02-17T18:34:15.000Z", "max_stars_repo_stars_event_max_datetime": "2017-08-25T17:11:52.000Z", "max_issues_repo_path": "vendor/bundle/ruby/2.0.0/gems/pygments.rb-0.6.1/vendor/pygments-main/tests/examplefiles/test.idr", "max_issues_repo_name": "agent010101/agent010101.github.io", "max_issues_repo_head_hexsha": "b8bf8ef1bc30999223deb95506b0685b4ec8449a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 34, "max_issues_repo_issues_event_min_datetime": "2015-05-12T17:54:27.000Z", "max_issues_repo_issues_event_max_datetime": "2019-01-28T14:30:46.000Z", "max_forks_repo_path": "vendor/bundle/ruby/2.0.0/gems/pygments.rb-0.6.1/vendor/pygments-main/tests/examplefiles/test.idr", "max_forks_repo_name": "agent010101/agent010101.github.io", "max_forks_repo_head_hexsha": "b8bf8ef1bc30999223deb95506b0685b4ec8449a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2015-02-06T20:43:39.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-14T10:05:12.000Z", "avg_line_length": 27.5638297872, "max_line_length": 84, "alphanum_fraction": 0.5283674257, "num_tokens": 932, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8080672135527632, "lm_q2_score": 0.6791787121629466, "lm_q1q2_score": 0.5488220494418664}}
{"text": "module Void\n\nimport Basic\n\n%default total\n\npublic export\ndata Void : Type where\n\npublic export\nVoidInduction : (0 p : Void -> Type) -> (0 x : Void) -> p x\nVoidInduction _ x impossible\n\npublic export\nVoidRecursion : (0 p : Type) -> (0 x : Void) -> p\nVoidRecursion p = VoidInduction (const p)\n\npublic export\nVoidInitial : (0 p : Type) -> (0 x : Void) -> p\nVoidInitial = VoidRecursion\n\npublic export\nIsEmpty : Type -> Type\nIsEmpty a = a -> Void\n\npublic export\nNeg : Type -> Type\nNeg = IsEmpty\n\n", "meta": {"hexsha": "a8826e5437e2acaf5598aeecc251e72ffb23b460", "size": 491, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Void.idr", "max_stars_repo_name": "Russoul/Idris2-HoTT", "max_stars_repo_head_hexsha": "0c11569ca8205caecd92e4cdb85fb7f10ca80454", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2021-01-17T05:44:08.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T09:36:13.000Z", "max_issues_repo_path": "src/Void.idr", "max_issues_repo_name": "Russoul/Idris2-HoTT", "max_issues_repo_head_hexsha": "0c11569ca8205caecd92e4cdb85fb7f10ca80454", "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/Void.idr", "max_forks_repo_name": "Russoul/Idris2-HoTT", "max_forks_repo_head_hexsha": "0c11569ca8205caecd92e4cdb85fb7f10ca80454", "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.3666666667, "max_line_length": 59, "alphanum_fraction": 0.6802443992, "num_tokens": 146, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8289387998695209, "lm_q2_score": 0.6619228758499942, "lm_q1q2_score": 0.548693554313276}}
{"text": "{--\nCopyright 2021 Joel Berkeley\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--}\n||| This module contains common library types.\nmodule Types\n\nimport public Data.Nat\nimport public Data.Vect\n\n||| Describes the shape of a `Tensor`. For example, a `Tensor` of `Double`s with contents\n||| `[[0, 1, 2], [3, 4, 5]]` has two elements in its outer-most axis, and each of those elements\n||| has three `Double`s in it, so this has shape [2, 3]. A `Tensor` can have axes of zero length,\n||| though the shape cannot be unambiguously inferred by visualising it. For example, `[[], []]`\n||| can have shape [2, 0], [2, 0, 5] or etc. A scalar `Tensor` has shape `[]`.\n|||\n||| The rank is the number of elements in the shape, or equivalently the number of axes.\npublic export 0\nShape : {0 rank: Nat} -> Type\nShape = Vect rank Nat\n\n||| An `Array shape` is either:\n||| \n||| * a single value of an implicitly inferred type `dtype` (for `shape` `[]`), or\n||| * an arbitrarily nested array of `Vect`s of such values (for any other `shape`)\n|||\n||| @shape The shape of this array.\npublic export 0\nArray : {0 dtype : Type} -> (0 shape : Shape) -> Type\nArray {dtype} [] = dtype\nArray {dtype} (d :: ds) = Vect d (Array ds {dtype=dtype})\n", "meta": {"hexsha": "4f046495cefc80d84e1c94644c8faee3874b0075", "size": 1691, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Types.idr", "max_stars_repo_name": "joelberkeley/spidr", "max_stars_repo_head_hexsha": "98cffe059ac5162a46942027658b6fe1dba5074d", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 18, "max_stars_repo_stars_event_min_datetime": "2020-11-21T00:57:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-09T18:18:43.000Z", "max_issues_repo_path": "src/Types.idr", "max_issues_repo_name": "joelberkeley/spidr", "max_issues_repo_head_hexsha": "98cffe059ac5162a46942027658b6fe1dba5074d", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 55, "max_issues_repo_issues_event_min_datetime": "2021-04-22T18:52:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T17:09:55.000Z", "max_forks_repo_path": "src/Types.idr", "max_forks_repo_name": "joelberkeley/spidr", "max_forks_repo_head_hexsha": "98cffe059ac5162a46942027658b6fe1dba5074d", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2021-08-11T10:43:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T04:00:23.000Z", "avg_line_length": 39.3255813953, "max_line_length": 97, "alphanum_fraction": 0.7031342401, "num_tokens": 461, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7772998714925403, "lm_q2_score": 0.7057850278370111, "lm_q1q2_score": 0.5486066114390677}}
{"text": "module TypeIndexedTypeChecker\n\n-- Based on https://cs.brynmawr.edu/~rae/papers/2018/stitch/stitch.pdf\n\nimport Data.Fin\nimport Data.List\nimport Data.Vect\nimport Control.Catchable\n\ndata Ty : Type where\n  TyInt : Ty\n  TyFun : Ty -> Ty -> Ty\n\n-- lemmas\nnotIntFun : TyInt = TyFun x y -> Void\nnotIntFun Refl impossible\nnotFunInt : (TyFun x y) = TyInt -> Void\nnotFunInt Refl impossible\nxEqyNeq : (x = x') -> ((y = y') -> Void) -> TyFun x y = TyFun x' y' -> Void\nxEqyNeq Refl contra Refl = contra Refl\nxNeqyEq : (y = y') -> ((x = x') -> Void) -> TyFun x y = TyFun x' y' -> Void\nxNeqyEq Refl contra Refl = contra Refl\nxNeqyNEq : ((x = x') -> Void) -> ((y = y') -> Void) -> TyFun x y = TyFun x' y' -> Void\nxNeqyNEq contra contra' Refl = contra Refl\n\nimplementation DecEq Ty where\n  decEq TyInt TyInt = Yes Refl\n  decEq TyInt (TyFun x y) = No notIntFun\n  decEq (TyFun x y) TyInt = No notFunInt\n  decEq (TyFun x y) (TyFun x' y') with (decEq x x')\n    decEq (TyFun x'' y) (TyFun x'' y') | (Yes Refl) with (decEq y y')\n      decEq (TyFun x'' y'') (TyFun x'' y'') | (Yes Refl) | (Yes Refl) = Yes Refl\n      decEq (TyFun x'' y) (TyFun x'' y') | (Yes Refl) | (No contra) = No (\\eq => xEqyNeq Refl contra eq)\n    decEq (TyFun x y) (TyFun x' y') | (No contra) with (decEq y y')\n      decEq (TyFun x y'') (TyFun x' y'') | (No contra) | (Yes Refl) = No (\\eq => xNeqyEq Refl contra eq)\n      decEq (TyFun x y) (TyFun x' y') | (No contra) | (No contra') = No (\\eq => xNeqyNEq contra contra' eq)\n\ndata UExp : Nat -> Type where\n  UVar : Fin n -> UExp n\n  ULam : Ty -> UExp (S n) -> UExp n\n  UApp : UExp n -> UExp n -> UExp n\n  UPlus : UExp n -> UExp n -> UExp n\n  UIntE : Int -> UExp n\n\n\ndata Expr : Vect n Ty -> Ty -> Type where\n  Val : Int -> Expr ctx TyInt\n  Plus : Expr ctx TyInt -> Expr ctx TyInt -> Expr ctx TyInt\n  Var : Elem t ctx -> Expr ctx t\n  Lam : Expr (a :: ctx) b -> Expr ctx (TyFun a b)\n  App : Expr ctx (TyFun a b) -> Expr ctx a -> Expr ctx b\n\n\ninterpTy : Ty -> Type\ninterpTy TyInt = Int\ninterpTy (TyFun arg res) = interpTy arg -> interpTy res\n\ninterpCtx : Vect n Ty -> Type\ninterpCtx [] = ()\ninterpCtx (t :: ts) = (interpTy t, interpCtx ts)\n\nlookup : Elem t ctx -> interpCtx ctx -> interpTy t\nlookup Here (t, _) = t\nlookup (There x) (_, ts) = lookup x ts\n\nshow : (t : Ty) -> interpTy t -> String\nshow TyInt v = show v\nshow (TyFun x y) v = \"Fun\"\n\neval : interpCtx ctx -> Expr ctx t -> interpTy t\neval ctx (Val x) = x\neval ctx (Var x) = lookup x ctx\neval ctx (Lam body) = \\x => eval (x, ctx) body\neval ctx (App f x) = (eval ctx f) (eval ctx x)\neval ctx (Plus e1 e2) = (eval ctx e1) + (eval ctx e2)\n\ncheck : (Catchable m String) => UExp Z -> ((t : Ty) -> Expr [] t -> m r) -> m r\ncheck uexp k = go [] uexp k\n  where\n    go : (Catchable m String) => (ctx : Vect n Ty) -> UExp n -> ((t : Ty) -> Expr ctx t -> m r) -> m r\n    go ctx (UVar n) k = checkVar n ctx $ \\ty, elem => k ty (Var elem)\n      where\n        checkVar : (Catchable m String) => {n : Nat} -> Fin n -> (ctx : Vect n Ty) -> ((t : Ty) -> Elem t ctx -> m r) -> m r\n        checkVar FZ (ty :: _) k = k ty Here\n        checkVar (FS n') (_ :: ctx') k = checkVar n' ctx' $ \\ty, elem => k ty (There elem)\n\n    go ctx (ULam ty body) k = go (ty :: ctx) body $ \\resTy, body' => k (TyFun ty resTy) (Lam body')\n    go ctx (UApp e1 e2) k = go ctx e1 $ \\funTy, e1' =>\n                            go ctx e2 $ \\argTy, e2' => checkApp funTy argTy e1' e2' k\n      where\n        checkApp : (Catchable m String) => (funTy : Ty) -> (argTy : Ty) -> Expr ctx funTy -> Expr ctx argTy -> ((t : Ty) -> Expr ctx t -> m r) -> m r\n        checkApp (TyFun argTy' resTy) argTy e1' e2' k with (decEq argTy' argTy)\n          checkApp (TyFun argTy resTy) argTy e1' e2' k | (Yes Refl) = k resTy (App e1' e2')\n          checkApp (TyFun argTy' refTy) argTy e1' e2' k | (No contra) = throw \"TypeError\"\n        checkApp _ _ e1' e2' k = throw \"TypeError\"\n    go ctx (UPlus e1 e2) k = go ctx e1 $ \\ty1, e1' =>\n                             go ctx e2 $ \\ty2, e2' => checkPlus ty1 ty2 e1' e2' k\n      where\n        checkPlus : (Catchable m String) => (ty1 : Ty) -> (ty2 : Ty) -> Expr ctx ty1 -> Expr ctx ty2 -> ((t : Ty) -> Expr ctx t -> m r) -> m r\n        checkPlus TyInt TyInt e1' e2' k = k TyInt (Plus e1' e2')\n        checkPlus _ _ e1' e2' k = throw \"TypeError\"\n    go ctx (UIntE x) k = k TyInt (Val x)\n\n\nexample : UExp Z\nexample = UApp (ULam TyInt (UPlus (UVar FZ) (UIntE 1))) (UIntE 5)\n\ntest : Either String String\ntest = check example (\\ty, expr => Right $ show ty $ eval () expr)\n", "meta": {"hexsha": "8d88fee3fc5a326f8753e6036b2c6082744c0432", "size": 4498, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/TypeIndexedTypeChecker.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/TypeIndexedTypeChecker.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/TypeIndexedTypeChecker.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 40.8909090909, "max_line_length": 149, "alphanum_fraction": 0.5751445087, "num_tokens": 1667, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619436290698, "lm_q2_score": 0.665410572017153, "lm_q1q2_score": 0.548605693516593}}
{"text": "||| Red black trees, adapted from Purely functional data structures by Chris Okasaki.\n|||\n||| You are guaranteed to get the correct value for a key.\n|||\n||| TODO: Implement deletion.\n|||\n||| The code has a lot of duplication that can not be unduplicated in trivially\n||| , due to the need to prove different things in different cases.\n\nmodule TypedContainers.RBTree\n\nimport Data.Nat\nimport Data.DPair\nimport Data.List\nimport TypedContainers.In\nimport TypedContainers.LawfulOrd\nimport TypedContainers.RBTree.Base\nimport TypedContainers.RBTree.Index\nimport TypedContainers.RBTree.Insert\n\n%default total\n\nexport\ndata RBTree : (kt : Type) -> (kord : LawfulOrd kt) => (kt -> Type) -> Type where\n  MkRBTree : GoodTree {height, color, kt, kord, vt, keys} -> RBTree kt vt {kord}\n\nexport\nempty : LawfulOrd kt => RBTree kt vt\nempty = MkRBTree (Empty Refl)\n\nexport\ninsert : LawfulOrd kt => (k : kt) -> vt k -> RBTree kt vt -> RBTree kt vt\ninsert k v (MkRBTree tree) =\n  let Evidence _ (Evidence _ tree') = insertG k v tree in\n  MkRBTree tree'\n\nexport\nindex : LawfulOrd kt => kt -> RBTree kt vt -> Maybe (DPair kt vt)\nindex k (MkRBTree tree) =\n  case indexGMaybe k tree {foldRight = \\_, _ => (), foldLeft = id} of\n    Left _ => Nothing\n    Right (MkDPair k' $ Evidence _ v) => Just $ MkDPair k' v\n\nexport\nindex' : LawfullerOrd kt => (k : kt) -> RBTree kt vt -> Maybe (vt k)\nindex' k (MkRBTree tree) =\n  case indexGMaybe k tree {foldRight = \\k', (p, _) => p, foldLeft = id} of\n    Left _ => Nothing\n    Right (MkDPair k' $ Evidence p v) =>\n      let 0 p = realEquality k' k p in\n      Just $ rewrite sym p in v\n", "meta": {"hexsha": "84fc162fff19ef5663d1cceedf968c772dd10a8b", "size": 1598, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "TypedContainers/RBTree.idr", "max_stars_repo_name": "L-as/idris-rbtree", "max_stars_repo_head_hexsha": "1c9bab3c5f54ab431c379bf54cec5b548e09f0d3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2021-08-25T15:48:22.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-10T05:31:53.000Z", "max_issues_repo_path": "TypedContainers/RBTree.idr", "max_issues_repo_name": "L-as/idris-rbtree", "max_issues_repo_head_hexsha": "1c9bab3c5f54ab431c379bf54cec5b548e09f0d3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TypedContainers/RBTree.idr", "max_forks_repo_name": "L-as/idris-rbtree", "max_forks_repo_head_hexsha": "1c9bab3c5f54ab431c379bf54cec5b548e09f0d3", "max_forks_repo_licenses": ["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.7307692308, "max_line_length": 85, "alphanum_fraction": 0.6852315394, "num_tokens": 484, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8244619350028205, "lm_q2_score": 0.6654105653819836, "lm_q1q2_score": 0.548605682306151}}
{"text": "parameters (eq : a -> a -> Bool)\n  lookup : a -> List (a, b) -> Maybe b\n  lookup x [] = Nothing\n  lookup x ((k, v) :: ys)\n      = if eq x k\n           then Just v\n           else lookup x ys\n\n  data Dict : Type -> Type where\n       MkDict : List (a, b) -> Dict b\n\n  lookupK : a -> Dict b -> Maybe b\n  lookupK k (MkDict xs) = lookup k xs\n\ntestDict : Dict {a=Int} (==) String\ntestDict = MkDict _ [(0, \"foo\"), (1, \"bar\")]\n\nparameters (y : ?) -- test that the type of 'y' can be inferred\n  foo : (x : Int) -> x = y -> Int\n  foo x@_ Refl = 42\n", "meta": {"hexsha": "37deaf0c9576c18f3bdb2db1dc0201d717315a1d", "size": 538, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic023/Params.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/basic023/Params.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/basic023/Params.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 25.619047619, "max_line_length": 63, "alphanum_fraction": 0.5241635688, "num_tokens": 188, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7956581000631542, "lm_q2_score": 0.6893056104028799, "lm_q1q2_score": 0.5484515923360281}}
{"text": "import Common\n\neitherBool : Iso (Either a a) (a, Bool)\neitherBool = MkIso to from tf ft\n  where\n    to : (Either a a) -> (a, Bool)\n    to (Left x) = (x, False)\n    to (Right x) = (x, True)\n    from : (a, Bool) -> (Either a a)\n    from (x, False) = Left x\n    from (x, True) = Right x\n    tf (a, False) = Refl\n    tf (a, True) = Refl\n    ft (Left x) = Refl\n    ft (Right x) = Refl\n\n\ndec : (pc: a -> Type) -> (f : (x: a) -> Dec (pc x)) -> Iso (Sigma a (\\x => Dec (pc x))) a\ndec pc f = MkIso to from tf ft\n  where\n    to : (Sigma a (\\x => Dec (pc x))) -> a\n    to (MkSigma x p) = x\n    from : a -> (Sigma a (\\x => Dec (pc x)))\n    from x = MkSigma x (f x)\n    tf x = Refl\n    ft (MkSigma x (Yes prf)) with (f x)\n      | Yes prf = cong {f=\\r => MkSigma x (Yes r)} $ believe_me ()\n      | No contra = void $ contra prf\n    ft (MkSigma x (No contra)) with (f x)\n      | Yes prf = void $ contra prf\n      | No contra = cong {f=\\r => MkSigma x (No r)} $ believe_me ()\n\n\neitherDec : (pc: a -> Type) -> Iso (Sigma a (\\x => Dec (pc x))) (Sigma a (\\x => (Either (pc x -> Void) (pc x))))\neitherDec pc = MkIso to from tf ft\n  where\n    to : (Sigma a (\\x => Dec (pc x))) -> (Sigma a (\\x => (Either (pc x -> Void) (pc x))))\n    to (MkSigma x (No contra)) = (x ** Left contra)\n    to (MkSigma x (Yes prf)) = (x ** Right prf)\n    from : (Sigma a (\\x => (Either (pc x -> Void) (pc x)))) -> (Sigma a (\\x => Dec (pc x)))\n    from (MkSigma x (Left contra)) = (x ** No contra)\n    from (MkSigma x (Right prf)) = (x ** Yes prf)\n    tf (MkSigma x (Left contra)) = Refl\n    tf (MkSigma x (Right prf)) = Refl\n    ft (MkSigma x (No contra)) = Refl\n    ft (MkSigma x (Yes prf)) = Refl\n\n\neitherSigmaDistribLeft : Iso (Sigma a (\\x => (Either pa pb)))\n                             (Either (Sigma a (\\x => pa)) (Sigma a (\\x => pb)))\neitherSigmaDistribLeft = MkIso to from tf ft\n  where\n    to : (Sigma a (\\x => (Either pa pb))) -> (Either (Sigma a (\\x => pa)) (Sigma a (\\x => pb)))\n    to (MkSigma x (Left pa)) = Left (MkSigma x pa)\n    to (MkSigma x (Right pb)) = Right (MkSigma x pb)\n    from : (Either (Sigma a (\\x => pa)) (Sigma a (\\x => pb))) -> (Sigma a (\\x => (Either pa pb)))\n    from (Left (MkSigma x pa)) = MkSigma x (Left pa)\n    from (Right (MkSigma x pb)) = MkSigma x (Right pb)\n    tf (Left (MkSigma x p)) = Refl\n    tf (Right (MkSigma x p)) = Refl\n    ft (MkSigma x (Left pa)) = Refl\n    ft (MkSigma x (Right pb)) = Refl\n\n-- use a to find whether it's b or c next to it\nbranch : (pc: a -> Type) ->\n       ((x: a) -> Dec (pc x)) ->\n       Iso b d ->\n       Iso c d ->\n       Iso (Sigma a (\\x => (Either (pc x -> Void, b) (pc x, c)))) (a, d)\nbranch pc\n       f\n       (MkIso bdto bdfrom bdtf bdft)\n       (MkIso cdto cdfrom cdtf cdft)\n       = MkIso to from tf ft\n  where\n    to : (Sigma a (\\x => (Either (pc x -> Void, b) (pc x, c)))) -> (a, d)\n    to (MkSigma x (Left (p, y))) = (x, bdto y)\n    to (MkSigma x (Right (p, y))) = (x, cdto y)\n    from : (a, d) -> (Sigma a (\\x => (Either (pc x -> Void, b) (pc x, c))))\n    from (x, y) = case (appIso (eitherDec pc) (unappIso (dec pc f) x)) of\n      (MkSigma z (Left p)) => MkSigma z $ Left (p, bdfrom y)\n      (MkSigma z (Right p)) => MkSigma z $ Right (p, cdfrom y)\n    tf (x, y) with (f x)\n      | Yes prf = rewrite (cdtf y) in Refl\n      | No contra = rewrite (bdtf y) in Refl\n    ft (MkSigma x (Left (p, y))) with (f x)\n      | Yes prf = void $ p prf\n      | No contra = rewrite (bdft y) in cong {f=\\r => MkSigma x (Left (r, y))} $ believe_me ()\n    ft (MkSigma x (Right (p, y))) with (f x)\n      | Yes prf = rewrite (cdft y) in cong {f=\\r => MkSigma x (Right (r, y))} $ believe_me ()\n      | No contra = void $ contra p\n", "meta": {"hexsha": "f604c0b30e78550fb604806df91bdb97ccff5aae", "size": 3653, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Either.idr", "max_stars_repo_name": "defanor/morphisms", "max_stars_repo_head_hexsha": "57ec23fc955dc69300d6fbd394cb9ac3209ff76b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-06-10T20:58:11.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-10T20:58:11.000Z", "max_issues_repo_path": "src/Either.idr", "max_issues_repo_name": "defanor/morphisms", "max_issues_repo_head_hexsha": "57ec23fc955dc69300d6fbd394cb9ac3209ff76b", "max_issues_repo_licenses": ["MIT"], "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/Either.idr", "max_forks_repo_name": "defanor/morphisms", "max_forks_repo_head_hexsha": "57ec23fc955dc69300d6fbd394cb9ac3209ff76b", "max_forks_repo_licenses": ["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.7065217391, "max_line_length": 112, "alphanum_fraction": 0.5149192445, "num_tokens": 1358, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.78793120560257, "lm_q2_score": 0.6959583376458152, "lm_q1q2_score": 0.5483672920304277}}
{"text": "module Control.Function\n\npublic export\ninterface Injective (f : a -> b) where\n  constructor MkInjective\n  injective : {x, y : a} -> f x = f y -> x = y\n\npublic export\ninj : (0 f : a -> b) -> {auto 0 _ : Injective f} -> {0 x, y : a} -> (0 _ : f x = f y) -> x = y\ninj _ eq = irrelevantEq (injective eq)\n", "meta": {"hexsha": "5b2c488806e9aca835c35ebc88708fa9027fd70e", "size": 300, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/base/Control/Function.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/libs/base/Control/Function.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/libs/base/Control/Function.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 27.2727272727, "max_line_length": 94, "alphanum_fraction": 0.5833333333, "num_tokens": 109, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.78793120560257, "lm_q2_score": 0.6959583124210896, "lm_q1q2_score": 0.5483672721550792}}
{"text": "parameters (n : Nat)\n    data X : Type -> Type where\n         A : t -> X t\n         B : t -> X t\n\n    Eq t => Eq (X t) where\n      A x == A y = x == y\n      B x == B y = x == y\n      _ == _ = False\n\n    test : Char -> Char -> Bool\n    test x y = A x == A y\n\nmkEq : (approx : Bool) -> Eq Nat\nmkEq True = withinOne\n  where\n    [withinOne] Eq Nat where\n      Z == Z = True\n      Z == S Z = True\n      S Z == Z = True\n      S x == S y = x == y\n      _ == _ = False\nmkEq False = %search\n", "meta": {"hexsha": "ebe7875d9f6a895b027d35165713188feafd3180", "size": 482, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/interface027/params.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "tests/idris2/interface027/params.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "tests/idris2/interface027/params.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 20.0833333333, "max_line_length": 32, "alphanum_fraction": 0.4253112033, "num_tokens": 170, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8418256472515684, "lm_q2_score": 0.6513548646660543, "lm_q1q2_score": 0.5483272305379588}}
{"text": "module Main\n\nimport Data.List\nimport Data.HVect\nimport Helper\n\nallowedChars : List Char\nallowedChars = ['a'..'z'] ++ ['0'..'9'] ++ ['-']\n\ndata ValidLiteral : List Char -> Type where\n  One : { auto prf : Elem value Main.allowedChars } -> ValidLiteral [value]\n  Multi : { auto prf : Elem value Main.allowedChars } -> ValidLiteral xs -> ValidLiteral (value :: xs) \n\ndata LiteralRoute : String -> Type where\n  Literal : (lit:String) ->\n            -- RULE 1  \n            { auto prf : ValidLiteral (unpack lit) } -> \n            LiteralRoute lit\n\n-----------------------------------\n                    \nmaxLevel : Nat\nmaxLevel = 3 \n\ndata Base = MkBase    \n\n-- shortRoute : Test Route\n-- shortRoute = Check (Root / Literal \"two\" / Literal \"three\") -- must compile\n\n-- longRoute : Test Route\n-- longRoute = Check (Root / Literal \"two\" / Literal \"three\" / Literal \"four\") -- does not compile\n\n", "meta": {"hexsha": "196917ff473a7ba8bb08419d17ab2e2a6bdf1801", "size": 887, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "rule-2.idr", "max_stars_repo_name": "janschultecom/typelevel-seo", "max_stars_repo_head_hexsha": "078c3fcfd16d99ef5e97935bd54e629976cf5846", "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": "rule-2.idr", "max_issues_repo_name": "janschultecom/typelevel-seo", "max_issues_repo_head_hexsha": "078c3fcfd16d99ef5e97935bd54e629976cf5846", "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": "rule-2.idr", "max_forks_repo_name": "janschultecom/typelevel-seo", "max_forks_repo_head_hexsha": "078c3fcfd16d99ef5e97935bd54e629976cf5846", "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.8787878788, "max_line_length": 103, "alphanum_fraction": 0.5918827508, "num_tokens": 222, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8031738057795403, "lm_q2_score": 0.6825737344123242, "lm_q1q2_score": 0.5482253439930996}}
{"text": "module Data.Double.FloatUtils.Chez\n\nimport Data.DPair\nimport Data.Fin\nimport Libraries.Utils.Scheme\n\n%default total\n\n\nrebool1 : (a -> Int) -> (a -> Bool)\nrebool1 f = \\x => (f x) == 1\n\nrebool2 : (a -> a -> Int) -> (a -> a -> Bool)\nrebool2 f = \\x,y => (f x y) == 1\n\nrebool3 : (a -> a -> a -> Int) -> (a -> a -> a -> Bool)\nrebool3 f = \\x,y,z => (f x y z) == 1\n\nrebool4 : (a -> a -> a -> a -> Int) -> (a -> a -> a -> a -> Bool)\nrebool4 f = \\w,x,y,z => (f w x y z) == 1\n\n\nnamespace Vector\n  data ForeignVector : Nat -> Type -> Type where\n    [external]\n\n  public export\n  0 Vector : Nat -> Type -> Type\n  Vector n ty = Ptr $ ForeignVector n ty\n\n  %foreign \"scheme,chez:idris-vector-ref\"\n  prim__vectorRef : Vector n ty -> Fin n -> ty\n\n  export\n  vectorRef : (i : Fin n) -> (v : Vector n ty) -> ty\n  vectorRef i v = prim__vectorRef v i\n\n\nnamespace Misc\n  export\n  %foreign \"scheme,chez:fllp\"\n  fllp : Double -> Int\n\n\n  %foreign \"scheme,chez:idris-+nan.0\"\n  prim__positiveNaN : Double\n\n  %foreign \"scheme,chez:idris-+inf.0\"\n  prim__positiveInf : Double\n\n  %foreign \"scheme,chez:idris--inf.0\"\n  prim__negativeInf : Double\n\n  %foreign \"scheme,chez:idris-isnan\"\n  prim__isNan : Double -> Int\n\n  %foreign \"scheme,chez:idris-notnan\"\n  prim__notNan : Double -> Int\n\n  export\n  nan : Double\n  nan = prim__positiveNaN\n\n  export\n  isNan : Double -> Bool\n  isNan = rebool1 prim__isNan\n\n  export\n  notNan : Double -> Bool\n  notNan = rebool1 prim__notNan\n\n  export\n  0 invertIsNan : forall x. not (isNan x) = True -> notNan x = True\n  invertIsNan = believe_me\n\n  export\n  0 invertNotNan : forall x. not (notNan x) = True -> isNan x = True\n  invertNotNan = believe_me\n\n\n  export\n  inf : Double\n  inf = prim__positiveInf\n\n  -- Kind of redundant, because we have Neg Double, so we can write `- inf`\n  export\n  negInf : Double\n  negInf = prim__negativeInf\n\n\n  %foreign \"scheme,chez:idris-flnonpositive\"\n  prim__isNonPositive : Double -> Int\n\n  export\n  isNonPositive : Double -> Bool\n  isNonPositive = rebool1 prim__isNonPositive\n\n\n  %foreign \"scheme,chez:idris-flnonnegative\"\n  prim__isNonNegative : Double -> Int\n\n  export\n  isNonNegative : Double -> Bool\n  isNonNegative = rebool1 prim__isNonNegative\n\n\n  public export\n  record DoubleInfo where\n    constructor MkDoubleInfo\n    mantissa : Int\n    exponent : Int\n    sign : Int\n\n  %foreign \"scheme,chez:decode-float\"\n  prim__decodeDouble : Double -> Vector 3 Int\n\n  decodeDouble : (x : Double) -> DoubleInfo\n  decodeDouble x =\n    let result = prim__decodeDouble x in\n      MkDoubleInfo\n        (vectorRef 0 result)\n        (vectorRef 1 result)\n        (vectorRef 2 result)\n\n\nnamespace Comparison\n  %foreign \"scheme,chez:idris-compare\"\n  prim__compare : Double -> Double -> Int\n\n  %foreign \"scheme,chez:idris-fl=-2\"\n  prim__doubleEq2 : Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl=-3\"\n  prim__doubleEq3 : Double -> Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl=-4\"\n  prim__doubleEq4 : Double -> Double -> Double -> Double -> Int\n\n  export\n  doubleEq2 : Double -> Double -> Bool\n  doubleEq2 = rebool2 prim__doubleEq2\n  export\n  doubleEq3 : Double -> Double -> Double -> Bool\n  doubleEq3 = rebool3 prim__doubleEq3\n  export\n  doubleEq4 : Double -> Double -> Double -> Double -> Bool\n  doubleEq4 = rebool4 prim__doubleEq4\n\n  %foreign \"scheme,chez:idris-fl>-2\"\n  prim__doubleGt2 : Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl>-3\"\n  prim__doubleGt3 : Double -> Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl>-4\"\n  prim__doubleGt4 : Double -> Double -> Double -> Double -> Int\n\n  export\n  doubleGt2 : Double -> Double -> Bool\n  doubleGt2 = rebool2 prim__doubleGt2\n  export\n  doubleGt3 : Double -> Double -> Double -> Bool\n  doubleGt3 = rebool3 prim__doubleGt3\n  export\n  doubleGt4 : Double -> Double -> Double -> Double -> Bool\n  doubleGt4 = rebool4 prim__doubleGt4\n\n  %foreign \"scheme,chez:idris-fl>=-2\"\n  prim__doubleGte2 : Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl>=-3\"\n  prim__doubleGte3 : Double -> Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl>=-4\"\n  prim__doubleGte4 : Double -> Double -> Double -> Double -> Int\n\n  export\n  doubleGte2 : Double -> Double -> Bool\n  doubleGte2 = rebool2 prim__doubleGte2\n  export\n  doubleGte3 : Double -> Double -> Double -> Bool\n  doubleGte3 = rebool3 prim__doubleGte3\n  export\n  doubleGte4 : Double -> Double -> Double -> Double -> Bool\n  doubleGte4 = rebool4 prim__doubleGte4\n\n  %foreign \"scheme,chez:idris-fl<-2\"\n  prim__doubleLt2 : Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl<-3\"\n  prim__doubleLt3 : Double -> Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl<-4\"\n  prim__doubleLt4 : Double -> Double -> Double -> Double -> Int\n\n  export\n  doubleLt2 : Double -> Double -> Bool\n  doubleLt2 = rebool2 prim__doubleLt2\n  export\n  doubleLt3 : Double -> Double -> Double -> Bool\n  doubleLt3 = rebool3 prim__doubleLt3\n  export\n  doubleLt4 : Double -> Double -> Double -> Double -> Bool\n  doubleLt4 = rebool4 prim__doubleLt4\n\n  %foreign \"scheme,chez:idris-fl<=-2\"\n  prim__doubleLte2 : Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl<=-3\"\n  prim__doubleLte3 : Double -> Double -> Double -> Int\n  %foreign \"scheme,chez:idris-fl<=-4\"\n  prim__doubleLte4 : Double -> Double -> Double -> Double -> Int\n\n  export\n  doubleLte2 : Double -> Double -> Bool\n  doubleLte2 = rebool2 prim__doubleLte2\n  export\n  doubleLte3 : Double -> Double -> Double -> Bool\n  doubleLte3 = rebool3 prim__doubleLte3\n  export\n  doubleLte4 : Double -> Double -> Double -> Double -> Bool\n  doubleLte4 = rebool4 prim__doubleLte4\n\n  export\n  %foreign \"scheme,chez:max\"\n  doubleMax2 : Double -> Double -> Double\n  export\n  %foreign \"scheme,chez:max\"\n  doubleMax3 : Double -> Double -> Double -> Double\n  export\n  %foreign \"scheme,chez:max\"\n  doubleMax4 : Double -> Double -> Double -> Double -> Double\n\n  export\n  %foreign \"scheme,chez:min\"\n  doubleMin2 : Double -> Double -> Double\n  export\n  %foreign \"scheme,chez:min\"\n  doubleMin3 : Double -> Double -> Double -> Double\n  export\n  %foreign \"scheme,chez:min\"\n  doubleMin4 : Double -> Double -> Double -> Double -> Double\n\n  public export\n  implementation [chezFloat] Ord Double where\n    compare x y =\n      if x < y \n      then LT\n      else\n        if x > y\n        then GT\n        else EQ\n    (<) = doubleLt2\n    (>) = doubleGt2\n    (<=) = doubleLte2\n    (>=) = doubleGte2\n    max = doubleMax2\n    min = doubleMin2\n\n  namespace NanSafe\n    0 DoubleNotNan : Type\n    DoubleNotNan = Subset Double (\\x => notNan x = True)\n\n    -- implementation Functor DoubleNotNan where\n    --   map f (Element x px) = ?help\n\n    unwrap : DoubleNotNan -> Double\n    unwrap (Element x _) = x\n\n    wrap1 : (Double -> a) -> (DoubleNotNan -> a)\n    wrap1 f = \\ (Element x _) => f x\n\n    wrap2 : (Double -> Double -> a) -> (DoubleNotNan -> DoubleNotNan -> a)\n    wrap2 f = \\ (Element x _), (Element y _) => f x y\n\n    export\n    doubleCompareSafe : DoubleNotNan -> DoubleNotNan -> Ordering\n    doubleCompareSafe (Element x _) (Element y _) =\n      assert_total $ case prim__compare x y of\n        1 => GT\n        -1 => LT\n        0 => EQ\n\n    export\n    doubleLt2Safe : DoubleNotNan -> DoubleNotNan -> Bool\n    doubleLt2Safe = wrap2 doubleLt2\n\n    export\n    doubleGt2Safe : DoubleNotNan -> DoubleNotNan -> Bool\n    doubleGt2Safe = wrap2 doubleGt2\n\n    export\n    doubleLte2Safe : DoubleNotNan -> DoubleNotNan -> Bool\n    doubleLte2Safe = wrap2 doubleLte2\n\n    export\n    doubleGte2Safe : DoubleNotNan -> DoubleNotNan -> Bool\n    doubleGte2Safe = wrap2 doubleGte2\n\n    export\n    doubleMax2Safe : DoubleNotNan -> DoubleNotNan -> DoubleNotNan\n    doubleMax2Safe = believe_me $ wrap2 doubleMax2\n\n    export\n    doubleMin2Safe : DoubleNotNan -> DoubleNotNan -> DoubleNotNan\n    doubleMin2Safe = believe_me $ wrap2 doubleMin2\n\n    public export\n    implementation [chezFloatNanSafe] Ord DoubleNotNan where\n      compare = doubleCompareSafe\n      (<) = wrap2 doubleLt2\n      (>) = wrap2 doubleGt2\n      (<=) = wrap2 doubleLte2\n      (>=) = wrap2 doubleGte2\n      max = believe_me $ wrap2 doubleMax2\n      min = believe_me $ wrap2 doubleMin2\n\n  namespace List\n    %foreign \"scheme,chez:idris-fl=-apply\"\n    prim__doubleEq : List Double -> Int\n    %foreign \"scheme,chez:idris-fl>-apply\"\n    prim__doubleGt : List Double -> Int\n    %foreign \"scheme,chez:idris-fl>=-apply\"\n    prim__doubleGte : List Double -> Int\n    %foreign \"scheme,chez:idris-fl<-apply\"\n    prim__doubleLt : List Double -> Int\n    %foreign \"scheme,chez:idris-fl<=-apply\"\n    prim__doubleLte : List Double -> Int\n\n    export\n    doubleEq : List Double -> Bool\n    doubleEq xs = (prim__doubleEq xs) == 1\n    export\n    doubleGt : List Double -> Bool\n    doubleGt xs = (prim__doubleGt xs) == 1\n    export\n    doubleGte : List Double -> Bool\n    doubleGte xs = (prim__doubleGte xs) == 1\n    export\n    doubleLt : List Double -> Bool\n    doubleLt xs = (prim__doubleLt xs) == 1\n    export\n    doubleLte : List Double -> Bool\n    doubleLte xs = (prim__doubleLte xs) == 1\n\n    export\n    %foreign \"scheme,chez:idris-max-apply\"\n    doubleMax : List Double -> Double\n    export\n    %foreign \"scheme,chez:idris-min-apply\"\n    doubleMin : List Double -> Double\n\n\nimplementation Show Ordering where\n  show LT = \"LT\"\n  show EQ = \"EQ\"\n  show GT = \"GT\"\n\nimplementation Interpolation Int where\n  interpolate = show\n\nimplementation Interpolation Ordering where\n  interpolate = show\n\n\n-- %foreign \"scheme:idris-bad\"\n-- bad : () -> Nat\n\ntest : IO ()\ntest = do\n  -- printLn $ bad ()\n  printLn $ isNonNegative 3.6\n  printLn $ doubleEq [1.5, 1.5]\n  printLn $ doubleMax [1.5, 1.5, 2.5]\n  printLn $ 1.5 == 1.5\n  let out = decodeDouble 4.5\n  printLn \"m=\\{out.mantissa} e=\\{out.exponent} s\\{out.sign}\"\n", "meta": {"hexsha": "0085f1abf71432714448dc64bb71317c16625caa", "size": 9689, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Double/FloatUtils/Chez.idr", "max_stars_repo_name": "gwerbin/idris2-float-utils", "max_stars_repo_head_hexsha": "47fe1c79fdcc2fb76393813443a91b6fc3a4801e", "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": "src/Data/Double/FloatUtils/Chez.idr", "max_issues_repo_name": "gwerbin/idris2-float-utils", "max_issues_repo_head_hexsha": "47fe1c79fdcc2fb76393813443a91b6fc3a4801e", "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": "src/Data/Double/FloatUtils/Chez.idr", "max_forks_repo_name": "gwerbin/idris2-float-utils", "max_forks_repo_head_hexsha": "47fe1c79fdcc2fb76393813443a91b6fc3a4801e", "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": 26.2574525745, "max_line_length": 75, "alphanum_fraction": 0.6593043658, "num_tokens": 3077, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031737963569014, "lm_q2_score": 0.6825737408694988, "lm_q1q2_score": 0.5482253427476873}}
{"text": "module Pythag\n\nimport Data.Strings\n\n%default total\n\npythag : Int -> List (Int, Int, Int)\npythag n = [(x, y, z) | z <- [1..n], y <- [1..z], x <- [1..y], x * x + y * y == z * z]\n\nreadNum : HasIO io => io (Maybe Int)\nreadNum = do ns <- getLine\n             case all isDigit (unpack ns) of\n                  False => pure Nothing\n                  True => pure $ Just (cast ns)\n\nmain : HasIO io => io ()\nmain = do Just n <- readNum\n            | Nothing => do putStrLn \"Error: you should have entered a number!\"\n                            pure ()\n          let res = pythag n\n          printLn res\n                        \n", "meta": {"hexsha": "a35e58eac5a2830ef09014de32b09415d4fcb619", "size": 620, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "types_and_functions/Pythag.idr", "max_stars_repo_name": "timmyjose-study/idris-from-the-docs", "max_stars_repo_head_hexsha": "ea1b7af57245ddb29b5d9d24ae623e37ecc01d12", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "types_and_functions/Pythag.idr", "max_issues_repo_name": "timmyjose-study/idris-from-the-docs", "max_issues_repo_head_hexsha": "ea1b7af57245ddb29b5d9d24ae623e37ecc01d12", "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": "types_and_functions/Pythag.idr", "max_forks_repo_name": "timmyjose-study/idris-from-the-docs", "max_forks_repo_head_hexsha": "ea1b7af57245ddb29b5d9d24ae623e37ecc01d12", "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": 26.9565217391, "max_line_length": 86, "alphanum_fraction": 0.4758064516, "num_tokens": 167, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8031738152021787, "lm_q2_score": 0.6825737214979745, "lm_q1q2_score": 0.5482253400522775}}
{"text": "lplus : (1 x : Nat) -> (1 y : Nat) -> Nat\nlplus Z y = y\nlplus (S k) y = S (lplus k y)\n\nfoo : (1 x : Nat) -> (1 y : Nat) -> Nat -> Nat\nfoo x y z\n    = let 1 test = the Nat $ case z of\n                        Z => Z\n                        (S k) => S z\n            in\n          lplus test x\n", "meta": {"hexsha": "4a4131f489112e5600071e9f5bab6e8f7a8849c6", "size": 289, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/linear007/LCase.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/linear007/LCase.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/linear007/LCase.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.0833333333, "max_line_length": 46, "alphanum_fraction": 0.3667820069, "num_tokens": 103, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8152324983301568, "lm_q2_score": 0.6723316926137812, "lm_q1q2_score": 0.5481066454760759}}
{"text": "module Toolkit.Data.List.View.PairWise\n\nimport Data.List\n\n%default total\n\npublic export\ndata PairWise : List a -> Type where\n  Empty : PairWise Nil\n  One   : (x:a) -> PairWise [x]\n  Two   : (x,y : a) -> PairWise [x,y]\n  N     : (x,y : a)\n       -> PairWise (y::xs)\n       -> PairWise (x::y::xs)\n\n\nexport\npairwise : (xs : List a) -> PairWise xs\npairwise [] = Empty\npairwise (x :: []) = One x\npairwise (x :: (y :: xs)) with (pairwise (y::xs))\n  pairwise (x :: (y :: [])) | (One y) = Two x y\n  pairwise (x :: (y :: [w])) | (Two y w) = N x y (Two y w)\n  pairwise (x :: (y :: (w :: xs))) | (N y w v) = N x y (N y w v)\n\nunSafeToList : {xs : List a} -> PairWise xs -> Maybe (List (a,a))\nunSafeToList Empty = Just Nil\nunSafeToList (One x) = Nothing\nunSafeToList (Two x y) = Just [(x,y)]\nunSafeToList (N x y z)\n  = do rest <- unSafeToList z\n       pure (MkPair x y :: rest)\n\n||| Returns a list of pairs if `xs` has even number of elements, Nothing if odd.\nexport\nunSafePairUp : (xs : List a) -> Maybe (List (a,a))\nunSafePairUp xs = (unSafeToList (pairwise xs))\n\n\n-- [ EOF ]\n", "meta": {"hexsha": "1d98c6ef6e46a6574d2af7af284dfd295306bf5e", "size": 1065, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Toolkit/Data/List/View/PairWise.idr", "max_stars_repo_name": "border-patrol/lightclick", "max_stars_repo_head_hexsha": "1f52fc27674f244c399e5e579403e8075f982a37", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2020-11-03T11:33:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-14T17:11:38.000Z", "max_issues_repo_path": "src/Toolkit/Data/List/View/PairWise.idr", "max_issues_repo_name": "border-patrol/lightclick", "max_issues_repo_head_hexsha": "1f52fc27674f244c399e5e579403e8075f982a37", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "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/Toolkit/Data/List/View/PairWise.idr", "max_forks_repo_name": "border-patrol/lightclick", "max_forks_repo_head_hexsha": "1f52fc27674f244c399e5e579403e8075f982a37", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-02-09T19:49:11.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-09T19:49:11.000Z", "avg_line_length": 25.9756097561, "max_line_length": 80, "alphanum_fraction": 0.5774647887, "num_tokens": 379, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7431680086124811, "lm_q2_score": 0.7371581510799253, "lm_q1q2_score": 0.5478323551705266}}
{"text": "module Main\n\n%language UniquenessTypes\n\ndata UList : Type -> UniqueType where\n     Nil   : UList a\n     (::)  : a -> UList a -> UList a\n\numap : (a -> b) -> UList a -> UList b\numap f [] = []\numap f (x :: xs) = f x :: umap f xs\n\nfree : {a : UniqueType} -> a -> String\nfree xs = \"\"\n\nshowU : Show a => Borrowed (UList a) -> String\nshowU [] = \"END\"\nshowU (x :: xs) = show x ++ \",\" ++ showU xs\n\nmkUList : Nat -> UList Int\nmkUList Z = []\nmkUList (S k) = cast k :: mkUList k\n\nshowStuff : UList Int -> IO ()\nshowStuff xs = do\n          putStrLn (showU xs)\n          putStrLn (showU xs)\n          let xs' = umap (*2) xs\n          putStrLn (showU xs')\n          putStrLn (showU xs')\n\nmain : IO ()\nmain = showStuff (mkUList 20)\n\n", "meta": {"hexsha": "fd860d0f209bb16447ec52cafd1b4e190624263c", "size": 717, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/unique001/unique001.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/unique001/unique001.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/unique001/unique001.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 20.4857142857, "max_line_length": 46, "alphanum_fraction": 0.5425383543, "num_tokens": 242, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8596637577007394, "lm_q2_score": 0.6370308082623216, "lm_q1q2_score": 0.5476322984019266}}
{"text": "\nmodule Applicative\n\n\n-- Attempt to write applicative from memory\ninterface Functor s => MyApplicative (s : Type -> Type) where\n          myPure : a -> s a\n          myApply : s (a -> b) -> s a -> s b\n\n", "meta": {"hexsha": "825ff3334b55436b6ee12f8e81d3b5628c4ce7a7", "size": 202, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter7/Applicative.idr", "max_stars_repo_name": "robkorn/idris-type-driven-development-exercises", "max_stars_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-12-18T12:54:01.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-28T09:54:21.000Z", "max_issues_repo_path": "Chapter7/Applicative.idr", "max_issues_repo_name": "robkorn/idris-type-driven-development-exercises", "max_issues_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "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": "Chapter7/Applicative.idr", "max_forks_repo_name": "robkorn/idris-type-driven-development-exercises", "max_forks_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-12-18T12:54:05.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-18T12:54:05.000Z", "avg_line_length": 20.2, "max_line_length": 61, "alphanum_fraction": 0.5891089109, "num_tokens": 55, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8596637577007393, "lm_q2_score": 0.6370307944803832, "lm_q1q2_score": 0.5476322865540937}}
{"text": "import Data.Bits\nimport Data.DPair\nimport Data.Nat\nimport Data.So\n\nnamespace SubsetNat\n\n  public export\n  fromInteger : (x : Integer) ->\n                {0 n : Nat} ->\n                {auto 0 prf : fromInteger x `LT` n} ->\n                Subset Nat (`LT` n)\n  fromInteger x = Element (integerToNat x) prf\n\nf : Int -> Int\nf x = shiftR x 1\n", "meta": {"hexsha": "9cefc64889f16680cb02c5eebc8ff2cfefe1a3fd", "size": 339, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "FromIntegerSubset.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "FromIntegerSubset.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "FromIntegerSubset.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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.9411764706, "max_line_length": 54, "alphanum_fraction": 0.5752212389, "num_tokens": 100, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8596637361282706, "lm_q2_score": 0.6370307806984444, "lm_q1q2_score": 0.5476322609639338}}
{"text": "module Main\n\nremoveDuplicatesFromSorted : Eq a => List a -> List a\nremoveDuplicatesFromSorted [] = []\nremoveDuplicatesFromSorted (x :: []) = [x]\nremoveDuplicatesFromSorted (x :: (y :: ys)) with (x == y)\n  removeDuplicatesFromSorted (x :: (y :: ys)) | False = x :: removeDuplicatesFromSorted (y :: ys)\n  removeDuplicatesFromSorted (x :: (y :: ys)) | True = removeDuplicatesFromSorted (y :: ys)\n\nelemInAll : Eq a => a -> List (List a) -> Bool\nelemInAll x xss = all (elem x) xss\n\nrecord Group where\n  constructor MkGroup\n  questions : List Char\n  answers : List (List Char)\n\nShow Group where\n  show (MkGroup questions answers) = \"Group \" ++ show questions ++ \" \" ++ show answers\n\nparseGroups : String -> List (List (List Char))\nparseGroups = map (map unpack) . splitOn \"\" . lines\n\ncreateGroup : List (List Char) -> Group\ncreateGroup unsortedAnswers = MkGroup questions answers\n  where answers = sort $ map sort unsortedAnswers\n        questions = removeDuplicatesFromSorted . sort $ concat answers\n\ncountYesAnswers : Group -> Nat\ncountYesAnswers (MkGroup questions answers) = length questions\n\ncountEveryoneYesAnswers : Group -> Nat\ncountEveryoneYesAnswers (MkGroup questions answers) =\n  length $ filter id $ elemInAll <$> questions <*> pure answers\n\nmain : IO ()\nmain = do\n  f <- readFile \"./data\"\n\n  putStrLn \"Part 1\"\n  print $ (sum . map countYesAnswers . map createGroup . parseGroups) <$> f\n  putStrLn \"\"\n\n  putStrLn \"Part 2\"\n  print $ (sum . map countEveryoneYesAnswers . map createGroup . parseGroups) <$> f\n  putStrLn \"\"\n", "meta": {"hexsha": "b903a2da20ec0c9ada3861fce7d707d0a79a7514", "size": 1527, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "6/Main.idr", "max_stars_repo_name": "jumper149/AoC2020", "max_stars_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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": "6/Main.idr", "max_issues_repo_name": "jumper149/AoC2020", "max_issues_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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": "6/Main.idr", "max_forks_repo_name": "jumper149/AoC2020", "max_forks_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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.4893617021, "max_line_length": 97, "alphanum_fraction": 0.6987557302, "num_tokens": 398, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7310585786300048, "lm_q2_score": 0.7490872243177518, "lm_q1q2_score": 0.5476266414796311}}
{"text": "module MiniForth\n\ndata IxList : {i  : Type} -> (rel : i -> i -> Type) -> i -> i -> Type where\n  Nil : IxList rel i i\n  (::) : rel i j -> IxList rel j k -> IxList rel i k\n\ndata Instr : Nat -> Nat -> Type where\n  Lit : Int -> Instr n (S n)\n  Dup : Instr (S n) (S (S n))\n  Swap : Instr (S (S n)) (S (S n))\n  Drop : Instr (S n) n\n  Over : Instr (S (S n)) (S (S (S n)))\n  Op : (Int -> Int -> Int) -> Instr (S (S n)) (S n)\n\ndata Val : Nat -> Nat -> Type where\n  ValC : Int -> Val (S n) n\n\nrun : IxList Instr i j -> IxList Val i 0 -> IxList Val j 0\nrun [] st = st\nrun ((Lit x) :: xs) st = run xs (ValC x :: st)\nrun (Dup :: xs) ((ValC x) :: st) = run xs (ValC x :: ValC x :: st)\nrun (Swap :: _) ((ValC _) :: []) impossible\nrun (Swap :: xs) ((ValC x) :: ((ValC y) :: st)) = run xs (ValC y :: ValC x :: st)\nrun (Drop :: xs) ((ValC x) :: st) = run xs st\nrun (Over :: _) ((ValC _) :: []) impossible\nrun (Over :: xs) ((ValC x) :: (ValC y) :: st) = run xs ((ValC y) :: (ValC x) :: (ValC y) :: st)\nrun (Op _ :: _) ((ValC _) :: []) impossible\nrun (Op f :: xs) ((ValC x) :: ((ValC y) :: st)) = run xs (ValC (f x y) :: st)\n\nsquare : IxList Instr (S n) (S n)\nsquare = Dup :: Op (*) :: Nil\n\nprg : IxList Instr 0 1\nprg = Lit 5 :: square\n\ntest : run MiniForth.prg [] = [ValC 25]\ntest = Refl\n", "meta": {"hexsha": "359df15a419f7f984ed298c890d4b1ab04cea685", "size": 1269, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/MiniForth.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/MiniForth.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/MiniForth.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 33.3947368421, "max_line_length": 95, "alphanum_fraction": 0.5074862096, "num_tokens": 514, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711680567799, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.547572766251723}}
{"text": "module Data.Verified.Fufunctor\n\nimport Data.Fufunctor\n\n%default total\n%access public export\n\n||| Verified Fufunctor\n||| A Fufunctor for which identity and composition laws are verified\ninterface Fufunctor t => VerifiedFufunctor (t : Type -> Type -> Type -> Type) where\n  fufunctorIdentity : {a : Type} -> {b : Type} -> {c : Type} ->\n                      (x : t a b c) ->\n                      fumap Basics.id Basics.id Basics.id x = x\n  fufunctorComposition : {a : Type} -> {b : Type} -> {c : Type} ->\n                         {a1 : Type} -> {b1 : Type} -> {c1 : Type} ->\n                         (x : t a b c) ->\n                         (fa1 : a1 -> a) -> (fb1 : b1 -> b) -> (fc1 : c -> c1) ->\n                         (fa2 : a2 -> a1) -> (fb2 : b2 -> b1) -> (fc2 : c1 -> c2) ->\n                         (fumap (fa1 . fa2) (fb1 . fb2) (fc2 . fc1) x) =\n                         (fumap fa2 fb2 fc2 . fumap fa1 fb1 fc1) x\n", "meta": {"hexsha": "f1aac9223908fd3a40bffd59d5c4a75c21c51c1e", "size": 922, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Verified/Fufunctor.idr", "max_stars_repo_name": "lemastero/Idris-Trifunctors", "max_stars_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "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/Data/Verified/Fufunctor.idr", "max_issues_repo_name": "lemastero/Idris-Trifunctors", "max_issues_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-10-13T21:31:36.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-13T21:31:36.000Z", "max_forks_repo_path": "src/Data/Verified/Fufunctor.idr", "max_forks_repo_name": "lemastero/Idris-Trifunctors", "max_forks_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-19T04:35:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-19T04:35:47.000Z", "avg_line_length": 43.9047619048, "max_line_length": 84, "alphanum_fraction": 0.4598698482, "num_tokens": 298, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8267118068790619, "lm_q2_score": 0.6619228691808011, "lm_q1q2_score": 0.547219451195033}}
{"text": "interface Queue (q: Type -> Type) where   \n  empty : q a \n  isEmpty : q a -> Bool\n  snoc : q a -> a -> q a \n  head : q a -> a\n  tail : q a -> q a\n\ndata CatList : (Type -> Type) -> Type -> Type where\n  E : CatList q a \n  C : {0 q : Type -> Type} -> a -> q (Lazy (CatList q a)) -> CatList q a\n  \nlink : (Queue q) => CatList q a -> Lazy (CatList q a) -> CatList q a \nlink E s = s -- Just to satisfy totality for now.\nlink (C x xs) s = C x (snoc xs s)\n", "meta": {"hexsha": "2c156f7222d49a34b090dd1d35e67b0317aa970a", "size": 448, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/reg029/lqueue.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/reg029/lqueue.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/reg029/lqueue.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.8666666667, "max_line_length": 72, "alphanum_fraction": 0.5401785714, "num_tokens": 161, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8354835452961425, "lm_q2_score": 0.6548947425132315, "lm_q1q2_score": 0.5471537812707591}}
{"text": "module Data.Profunctor.Morphism\n\nimport public Data.Morphisms\nimport Data.Profunctor\nimport Data.Profunctor.Choice\n\npublic export\nby : (Morphism a b -> Morphism c d) -> (a -> b) -> (c -> d)\nby f = applyMor . f . Mor\n\nexport\nProfunctor Morphism where\n  lmap pre  = Mor . (. pre) . applyMor\n  rmap post = Mor . (post .) . applyMor\n\nexport\nChoice Morphism where\n  right' = Mor . map . applyMor\n", "meta": {"hexsha": "1a32dd827cb39b5c45df757707944d039927fdf4", "size": 391, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Profunctor/Morphism.idr", "max_stars_repo_name": "tensorknower69/idris2-optics", "max_stars_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "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/Profunctor/Morphism.idr", "max_issues_repo_name": "tensorknower69/idris2-optics", "max_issues_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_issues_repo_licenses": ["MIT"], "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/Profunctor/Morphism.idr", "max_forks_repo_name": "tensorknower69/idris2-optics", "max_forks_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_forks_repo_licenses": ["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.5789473684, "max_line_length": 59, "alphanum_fraction": 0.6879795396, "num_tokens": 124, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8354835289107307, "lm_q2_score": 0.6548947223065754, "lm_q1q2_score": 0.5471537536577107}}
{"text": "module Hangman\n\nimport Data.Vect\nimport Pred\n\n\ndata GameState : (guesses_remaining : Nat) -> (letters : Nat) -> Type where\n     MkGameState : (word : String)\n                   -> (missing : Vect letters Char)\n                   -> GameState guesses_remaining letters\n\n\ndata Finished : Type where\n     Lost : (game : GameState 0 (S letters)) -> Finished\n     Won : (game : GameState (S guesses) 0) -> Finished\n\n\ndata ValidInput : List Char -> Type where\n     Letter : (c : Char) -> ValidInput [c]\n\n\nprocessGuess : (letter : Char) ->\n               GameState (S guesses) (S letters) ->\n               Either (GameState guesses (S letters)) (GameState (S guesses) letters)\nprocessGuess letter (MkGameState word missing)\n                = case isElem letter missing of\n                       Yes prf => Right (MkGameState word (removeElem_auto letter missing))\n                       No contra => Left (MkGameState word missing)\n\n\nisValidInput : (cs : List Char) -> Dec (ValidInput cs)\n\n\nisValidString : (s : String) -> Dec (ValidInput (unpack s))\n\n\nreadGuess : IO (x ** ValidInput x)\nreadGuess = do putStr \"Guess:\"\n               x <- getLine\n               case isValidString (toUpper x) of\n                    Yes prf => pure (_ ** prf)\n                    No contra => do putStrLn \"Invalid guess\"\n                                    readGuess\n\ngame : GameState (S guesses) (S letters) -> IO Finished\ngame st = ?game_rhs\n", "meta": {"hexsha": "dfa7922307037224337b050e7408ddef827fe81d", "size": 1421, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "9-pred/hangman.idr", "max_stars_repo_name": "prt2121/tdd-playground", "max_stars_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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": "9-pred/hangman.idr", "max_issues_repo_name": "prt2121/tdd-playground", "max_issues_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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": "9-pred/hangman.idr", "max_forks_repo_name": "prt2121/tdd-playground", "max_forks_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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": 30.2340425532, "max_line_length": 91, "alphanum_fraction": 0.5791695989, "num_tokens": 323, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891305219504, "lm_q2_score": 0.6654105454764747, "lm_q1q2_score": 0.5470933178254395}}
{"text": "> module EscadoOliva.Quantifier\n\n> %default total\n> %access public export\n> %auto_implicits off\n\n\n> ||| Quantifier\n> K : Type -> Type -> Type\n> K R X = (X -> R) -> R\n\n\n", "meta": {"hexsha": "c110b2ee7ce281c920c35274eb5f708851fe80c1", "size": 168, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "EscardoOliva/Quantifier.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "EscardoOliva/Quantifier.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "EscardoOliva/Quantifier.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 12.9230769231, "max_line_length": 31, "alphanum_fraction": 0.6130952381, "num_tokens": 57, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8397339596505965, "lm_q2_score": 0.6513548511303338, "lm_q1q2_score": 0.5469647882773}}
{"text": "import Common\n\nlist : Iso a b -> Iso (List a) (List b)\nlist (MkIso abto abfrom abtf abft) = MkIso to from tf ft\n  where\n    to : List a -> List b\n    to [] = []\n    to (x :: xs) = abto x :: to xs\n    from : List b -> List a\n    from [] = []\n    from (x :: xs) = abfrom x :: from xs\n    tf [] = Refl\n    tf (x :: xs) = rewrite (abtf x) in cong (tf xs)\n    ft [] = Refl\n    ft (x :: xs) = rewrite (abft x) in cong (ft xs)\n\n\ndep_to : Iso b c -> a -> b -> (a, c)\ndep_to (MkIso to' from' tf' ft') x y = (x, (to' y))\n\ndep_from : Iso b c -> a -> c -> (a, b)\ndep_from (MkIso to' from' tf' ft') x y = (x, (from' y))\n\ndep : (a -> Iso b c) -> Iso (a, b) (a, c)\ndep f = MkIso to from tf ft\n  where\n    to : (a, b) -> (a, c)\n    to (x, y) = dep_to (f x) x y\n    from : (a, c) -> (a, b)\n    from (x, y) = dep_from (f x) x y\n    tf (x, y) = case (inspect $ f x) of\n      (match (MkIso to' from' tf' ft') {eq=fx}) => rewrite fx in\n        case (dep_from (MkIso to' from' tf' ft') x y) of\n          (x', y') => rewrite fx in\n            case (dep_to (MkIso to' from' tf' ft') x (from' y)) of\n              (x'', y'') => rewrite (tf' y) in Refl\n    ft (x, y) = case (inspect $ f x) of\n      (match (MkIso to' from' tf' ft') {eq=fx}) => rewrite fx in\n        case (dep_to (MkIso to' from' tf' ft') x y) of\n          (x', y') => rewrite fx in\n            case (dep_from (MkIso to' from' tf' ft') x (to' y)) of\n              (x'', y'') => rewrite (ft' y) in Refl\n", "meta": {"hexsha": "298ca43f0432fc7f765a4dca099688f099dc1069", "size": 1442, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Misc.idr", "max_stars_repo_name": "defanor/morphisms", "max_stars_repo_head_hexsha": "57ec23fc955dc69300d6fbd394cb9ac3209ff76b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-06-10T20:58:11.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-10T20:58:11.000Z", "max_issues_repo_path": "src/Misc.idr", "max_issues_repo_name": "defanor/morphisms", "max_issues_repo_head_hexsha": "57ec23fc955dc69300d6fbd394cb9ac3209ff76b", "max_issues_repo_licenses": ["MIT"], "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/Misc.idr", "max_forks_repo_name": "defanor/morphisms", "max_forks_repo_head_hexsha": "57ec23fc955dc69300d6fbd394cb9ac3209ff76b", "max_forks_repo_licenses": ["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.5348837209, "max_line_length": 66, "alphanum_fraction": 0.4750346741, "num_tokens": 569, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.863391595913457, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.5468810984247741}}
{"text": "module Conway.Graphics\n\nimport Data.Vect\nimport Graphics.SDL\nimport Conway.Conway\n\n\n-- | Performs a sequence of IO actions\nsequenceIO : List (IO ()) -> IO ()\nsequenceIO Nil = pure ()\nsequenceIO (x::xs) =\n  do x\n     sequenceIO xs\n\n-- | Converts fin to int\nfinToInt : Fin m -> Int\nfinToInt = toIntNat . finToNat\n\n-- | Display the current conway state on the given SDL surface\ndisplayConway : Int -> Int -> Conway m n -> SDLSurface -> IO ()\ndisplayConway {m} {n} screenX screenY (MkConway v) s = \n  do \n     sequenceIO $ toList $ map displayRow (sequenceFin m) \n     flipBuffers s\n\n    where \n        iterY : Int\n        iterY = screenY `div` (toIntNat m)\n\n        iterX : Int\n        iterX = screenX `div` (toIntNat n)\n\n        drawCell : Int -> Int -> (Int, Int, Int) -> IO ()\n        drawCell py px (r,g,b) = filledRect s (iterX * px) (iterY * py) iterX iterY r g b 128\n\n        displayRow : Fin m -> IO ()\n        displayRow y = sequenceIO $ toList $ map displayPoint (sequenceFin n)\n\n        where displayPoint : Fin n -> IO ()\n              displayPoint x with (index x (index y v))\n                    | Alive = drawCell (finToInt y) (finToInt x) (0x00, 0x00, 0x00)\n                    | Dead  = drawCell (finToInt y) (finToInt x) (0xFF, 0xFF, 0xFF)\n\n\n-- | Given an initial Conway State, constantly updates \n--   and displays the Conway State\nexport\nconwayLoop : Conway m n -> IO ()\nconwayLoop cw {m} {n} = \n  do \n    surface <- startSDL screenX screenY\n    case surface of\n      Just surface' => conwayLoop' cw surface'\n      Nothing => print \"Unable to get SDL surface\\n\"\n\n  where \n        screenX : Int \n        screenX = cast $ n * 16\n       \n        screenY : Int\n        screenY = cast $ m * 16\n  \n  \n        conwayLoop' : Conway m n -> SDLSurface -> IO ()\n        processEvent : Conway m n -> SDLSurface -> Maybe Event -> IO (Maybe (Conway m n))\n        \n        \n        conwayLoop' cw surface = do\n            displayConway screenX screenY cw surface\n            flipBuffers surface\n            event <- pollEvent\n            eventPResult <- processEvent cw surface event\n\n            case eventPResult of\n              Just nextCw => conwayLoop' nextCw surface\n              Nothing     => pure ()\n\n\n        processEvent cw surface (Just (KeyDown KeyEnter)) \n                = do\n                    let nextCw = iterateGame cw\n                    displayConway screenX screenY nextCw surface\n                    flipBuffers surface\n                    pure $ Just nextCw \n                   \n\n        processEvent _ _ (Just AppQuit) \n                = pure Nothing\n\n        processEvent cw _ _ \n                = pure $ Just cw\n", "meta": {"hexsha": "73a31fba5159fb87bb9bb2306dfc3370ede92b23", "size": 2644, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Conway/Graphics.idr", "max_stars_repo_name": "RossMeikleham/Idris-Conway", "max_stars_repo_head_hexsha": "6a114d808d2dc6bf50ca0229b0d2ec3e8832180c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-04-15T02:34:42.000Z", "max_stars_repo_stars_event_max_datetime": "2016-04-15T02:34:42.000Z", "max_issues_repo_path": "src/Conway/Graphics.idr", "max_issues_repo_name": "RossMeikleham/Idris-Conway", "max_issues_repo_head_hexsha": "6a114d808d2dc6bf50ca0229b0d2ec3e8832180c", "max_issues_repo_licenses": ["MIT"], "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/Conway/Graphics.idr", "max_forks_repo_name": "RossMeikleham/Idris-Conway", "max_forks_repo_head_hexsha": "6a114d808d2dc6bf50ca0229b0d2ec3e8832180c", "max_forks_repo_licenses": ["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": 93, "alphanum_fraction": 0.5650529501, "num_tokens": 696, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744761936437, "lm_q2_score": 0.6688802603710086, "lm_q1q2_score": 0.5468594285090953}}
{"text": "module TreesIt\n\nimport Control.Monad.Reader\nimport Control.Monad.State\n\nimport Data.List\n\nimport MonadTransUniv\n\nrecord LeftToIterate a where\n  constructor MkLeftToIterate\n  leftToIterate : List a\n\nrecord OriginalValues a where\n  constructor MkOriginalValues\n  originalValues : List a\n\nnothingLeft : LeftToIterate a\nnothingLeft = MkLeftToIterate empty\n\norigToLeft : OriginalValues a -> LeftToIterate a\norigToLeft = MkLeftToIterate . originalValues\n\n%inline\nIterable'' : Type -> (Type -> Type) -> Type\nIterable'' a m = (MonadState (LeftToIterate a) m, MonadReader (OriginalValues a) m)\n\nnext'' : Iterable'' a m => m a\nnext'' = do\n  gg <- get\n  case leftToIterate gg of\n    []      => asks origToLeft >>= put >> next''\n    (x::xs) => put (MkLeftToIterate xs) $> x\n\n%inline\nItT : Type -> (Type -> Type) -> Type -> Type\nItT s m = StateT (LeftToIterate s) (ReaderT (OriginalValues s) m)\n\nrunIterableT : Monad m => List s -> ItT s m a -> m a\nrunIterableT orig = runReaderT (MkOriginalValues orig) . evalStateT nothingLeft\n\nnamespace Compositions\n\n  -- Ported from https://hackage.haskell.org/package/combinat-0.2.9.0/docs/src/Math.Combinat.Compositions.html\n  -- Copyright of the original code: (c) 2008-2018 Balazs Komuves\n  -- Original license is BSD-3-Clause.\n\n  compositions' : List Nat -> Nat -> List $ List Nat\n  compositions' []      0 = [[]]\n  compositions' []      _ = []\n  compositions' (s::ss) n =\n    [ x::xs | x <- [0 .. min s n], xs <- compositions' ss (n `minus` x) ]\n\n  compositions : Nat {-length-} -> Nat {-sum-} -> List $ List Nat\n  compositions len d = compositions' (replicate len d) d where\n\n  compositions1 : Nat {-len-} -> Nat {-sum-} -> List $ List Nat\n  compositions1 len d = if len > d\n    then []\n    else map (+1) <$> compositions len (d `minus` len)\n\n  export\n  allCompositions1 : Nat -> List $ List $ List Nat\n  allCompositions1 n = flip compositions1 n <$> [1..n]\n\nnamespace T\n\n  public export\n  data Tree = Leaf | Node (List Tree)\n\n  export\n  treesOfSize : Nat -> List Tree\n  treesOfSize 0 = []\n  treesOfSize 1 = [Leaf]\n  treesOfSize (S n) = concatMap subtrees $ concat $ allCompositions1 n\n    where\n      combineLists : forall a. List (List a) -> List (List a)\n      combineLists = sequence\n\n      subtrees : List Nat -> List Tree\n      subtrees = map Node . combineLists . map treesOfSize\n\ndata Tree a = Leaf a | Node (List $ Tree a)\n\nShow a => Show (Tree a) where\n  show (Leaf x) = \"{\" ++ show x ++ \"}\"\n  show (Node ts) = \"@(\" ++ (concat $ map show ts) ++ \")\"\n\ndecorateTree'' : Iterable'' a m => T.Tree -> m (Tree a)\ndecorateTree'' T.Leaf      = Leaf <$> next''\ndecorateTree'' (T.Node ts) = Node <$> traverse decorateTree'' ts\n\ndecoratedTreesIterator'' : Iterable'' a m => Iterable'' T.Tree m => Monad m => m (Tree a)\ndecoratedTreesIterator'' = next'' >>= decorateTree''\n\ntakeSome : Monad m => m a -> m $ List a\ntakeSome = sequence . replicate 6\n\ndecoratedTreesExample'' : List $ Tree Int\ndecoratedTreesExample'' =\n  runIdentity $\n    runIterableT {s=Int} [1..5] $\n      runIterableT (T.treesOfSize 4) $\n        takeSome $ decoratedTreesIterator''\n          @{(State.Trans, Reader.Trans @{Reader.Trans})}\n\ndtiMain : IO ()\ndtiMain = traverse_ putStrLn $ map show decoratedTreesExample''\n", "meta": {"hexsha": "d00d5fe5a2f7bd2b4c16171bc1691292a4b7b55a", "size": 3217, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "TreesIt.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "TreesIt.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "TreesIt.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 29.5137614679, "max_line_length": 110, "alphanum_fraction": 0.6586882188, "num_tokens": 938, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8006919925839875, "lm_q2_score": 0.6825737473266734, "lm_q1q2_score": 0.5465313338325133}}
{"text": "module Data.Compress.Utils.Bytes\n\nimport Syntax.WithProof\nimport Data.Bits\nimport Data.DPair\nimport Data.Fin\nimport Data.Fin.Extra\nimport Data.Nat\nimport Data.List\nimport Data.Vect\nimport Data.Nat.Factor\nimport Data.Nat.Order.Properties\n\nweakenN' : {m : Nat} -> (0 n : Nat) -> Fin m -> Fin (n + m)\nweakenN' n m' = rewrite plusCommutative n m in weakenN n m'\n\nfix_fin : (m : Nat) -> (n : Nat) -> (S m) = n -> S (S (S (S (S (S (S (S (mult m 8)))))))) = mult n 8\nfix_fin m n prf = rewrite sym prf in Refl\n\nexport\nto_le : (FiniteBits a, Cast a Bits8) => {n : _} -> {auto 0 no0 : NonZero n} -> {auto 0 prf : n * 8 = (bitSize {a})} -> a -> Vect n Bits8\nto_le x = let (S m) = n; nmeq = Refl in map (go nmeq x) Fin.range\n  where\n    go : {m : Nat} -> ((S m) = n) -> a -> Fin (S m) -> Bits8\n    go nmeq b i = cast $ shiftR b (bitsToIndex $ coerce prf $ coerce (fix_fin m n nmeq) $ weakenN' 7 $ i * 8)\n\nexport\nfrom_le : (FiniteBits a, Cast Bits8 a) => {n : _} -> {auto 0 no0 : NonZero n} -> {auto 0 prf : n * 8 = (bitSize {a})} -> Vect n Bits8 -> a\nfrom_le p = let (S m) = n; nmeq = Refl in foldl (.|.) zeroBits $ zipWith (go nmeq) p Fin.range\n  where\n    go : {m : Nat} -> ((S m) = n) -> Bits8 -> Fin (S m) -> a\n    go nmeq b i = shiftL (cast b) (bitsToIndex $ coerce prf $ coerce (fix_fin m n nmeq) $ weakenN' 7 $ i * 8)\n\nexport\nle_to_integer : Foldable t => t Bits8 -> Integer\nle_to_integer = go . toList\n  where\n  go : List Bits8 -> Integer\n  go v = foldr (.|.) 0 $ zipWith shiftL (cast {to=Integer} <$> v) ((*8) <$> [0..(length v)])\n\nexport\ninteger_to_le : (n : Nat) -> Integer -> Vect n Bits8\ninteger_to_le n v = (cast . shiftR v) <$> (((*8) . finToNat) <$> Fin.range)\n\nexport\nstring_to_ascii : (x : String) -> List Bits8\nstring_to_ascii = map (cast . ord) . unpack\n\nexport\nascii_to_string : List Bits8 -> String\nascii_to_string = pack . map cast\n", "meta": {"hexsha": "0adf68beb224dcdba77abaee800a1aa2866bc1f5", "size": 1843, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Compress/Utils/Bytes.idr", "max_stars_repo_name": "octeep/idris2-http", "max_stars_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "max_stars_repo_licenses": ["0BSD"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2022-01-05T11:39:50.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-20T10:43:01.000Z", "max_issues_repo_path": "src/Data/Compress/Utils/Bytes.idr", "max_issues_repo_name": "octeep/idris2-http", "max_issues_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "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": "src/Data/Compress/Utils/Bytes.idr", "max_forks_repo_name": "octeep/idris2-http", "max_forks_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "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": 35.4423076923, "max_line_length": 138, "alphanum_fraction": 0.6093326099, "num_tokens": 686, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8006920116079209, "lm_q2_score": 0.6825737279551494, "lm_q1q2_score": 0.5465313313071263}}
{"text": "> module Data.List.TypeEnumeration\n> import Data.List\n> import Data.List.DecIn\n> import Functions\n> %access public export\n\nThis module contains utilities for \"enumerating a type\" by placing all elements\nof that type into a list. It contains two basic quantifiers on a type `t` and a \nlist `xs : List t`:\n\n- `All {t} xs`, proofs that `xs` contains every element of `t`\n- `NoDupes {t} xs`, proofs that `xs` contains no duplicate elements of `t`\n\nFirst we start with `All {t} xs`: how can we determine if `xs` contains every \nelement of `t`? If this were the case, we would be able to construct a\nfunction $f_{xs} : (x:t) \\rightarrow \\texttt{Elem} x xs$.\n\n> ||| Proofs that a given list contains all possible elements of a given type.\n> All : {t : Type} -> List t -> Type \n> All xs {t} = (x:t) -> Elem x xs\n\nThere are some boilerplate and uninhabited trivialities to get out of the way. \n\n> ||| Given a type t and a proof of t, it is a contradiction to have a proof that\n> ||| the empty list contains all elements of t.\n> allNotEmpty : All {t} [] -> t -> Void\n> allNotEmpty f x = absurd (f x)\n\n> ||| If a type `t` is uninhabited, then the empty list contains all elements \n> ||| of that type.\n> voidEmptyAll : Uninhabited t => All {t} []\n> voidEmptyAll = \\c => absurd c\n\nProofs that a list contains some elements of $t$ with no duplicates are defined by\n\n> ||| Proofs that a list contains  no duplicates.\n> NoDupes : {t:Type} -> List t -> Type\n> NoDupes {t} xs = (x:t) -> Prop (Elem x xs)\n\nWith this we can start working on proving if a given list uniquely contains all\nelements of a given type. We start with some trivial helper lemmas:\n\n> ||| If we know $x$ belongs to a list $xs$ then $x :: xs$ obviously contains\n> ||| duplicate values (namely, $x$).\n> noDupesInHeadLemma : Elem x xs -> NoDupes (x :: xs) -> Void\n> noDupesInHeadLemma {x = x} {xs = []} _ _ impossible\n> noDupesInHeadLemma {x} a b = hereIsNotThere (b x Here (There a))\n\nIf a type has decidable equality, then All and NoDupes are decidable.\nWe need a (somewhat metamathematical) lemma to start stating that any two\nvoid values of the same type are equal (there are in fact zero of them - this\nis just a wrapper for \"void can prove anything\")\n\n> ||| Any two contradictions of the same type are identical.\n> voidsAreEquivalent : {t: Type} -> (t -> Void) -> (a:t) -> (b:t) -> (a=b)\n> voidsAreEquivalent f a b = void (f a)\n\n> ||| Equivalent to `There` being an injective function.\n> thereLemma2 : {a: Elem x xs} -> {b : Elem x xs} -> (There a = There b) -> a = b\n> thereLemma2 {a = Here} {b = Here} pf = Refl\n> thereLemma2 {a = Here} {b = (There _)} Refl impossible\n> thereLemma2 {a = (There _)} {b = Here} Refl impossible\n> thereLemma2 {a = (There x)} {b = (There x)} Refl = Refl\n\n> ||| For fixed $y$, `There` is an injective function from `Elem x xs` to \n> ||| `Elem x (y :: xs)`.\n> thereInjective : Injective There\n> thereInjective x y = thereLemma2 {a=x} {b=y}\n\n\n> ||| Given a list `xs` without duplicates, and an element `x` known not to be\n> ||| contained in `xs`, then `x :: xs` also contains no duplicates.\n> consNoDupes : DecEq t => {x : t} -> NoDupes {t} xs -> (Not (Elem x xs)) -> NoDupes (x :: xs)\n> consNoDupes {x = x} noDupesSublist notIn y pf1 pf2 with (decEq x y)\n>   consNoDupes {x = y} noDupesSublist notIn y Here Here | Yes pf = Refl\n>   consNoDupes {x = y} noDupesSublist notIn y Here (There later) | Yes pf = \n>               absurd (notIn later)\n>   consNoDupes {x = y} noDupesSublist notIn y (There later) Here | Yes pf = \n>               absurd (notIn later)\n>   consNoDupes {x = x} noDupesSublist notIn y (There later) (There z) | Yes pf = \n>               absurd (notIn (rewrite pf in later)) \n>   consNoDupes {x = y} noDupesSublist notIn y Here Here | No contra = Refl\n>   consNoDupes {x = y} noDupesSublist notIn y Here (There later) | No contra = \n>               absurd (notIn later)\n>   consNoDupes {x = y} noDupesSublist notIn y (There later) Here | No contra = \n>               absurd (notIn later)\n>   consNoDupes {x = x} noDupesSublist notIn y (There later) (There z) | No contra = \n>               let ndupes = (noDupesSublist y later z) in cong ndupes\n\n\n> ||| If a nonempty list contains no duplicates, then its tail has no duplicates.\n> dupeCons : NoDupes (x :: xs) -> NoDupes xs\n> dupeCons dupeBiglist item pf1 pf2 = thereLemma2 (dupeBiglist item (There pf1) (There pf2))\n\n> ||| If a type `t` has decidable equality, then `List t` has a decision \n> ||| procedure for determining if it contains any duplicates.\n> deqEqToDupe : DecEq t => (xs:List t) -> Dec (NoDupes xs)\n> deqEqToDupe [] = Yes (\\a => (\\b => (\\c => (voidsAreEquivalent uninhabited b c))))\n> deqEqToDupe (x :: xs) with (isElem x xs)\n>   deqEqToDupe (x :: xs) | Yes pf = No (noDupesInHeadLemma pf)\n>   deqEqToDupe (x :: xs) | No contra = case deqEqToDupe xs of\n>       Yes noDupes => Yes (consNoDupes noDupes contra)\n>       No areDupes => No (\\c => areDupes (dupeCons c))\n\nDecidable list membership allows us to remove duplicates from a list:\n\n> ||| Given an input list `xs`, return a list `ys` satisfying the following:\n> ||| - `Elem y ys` has at most one element up to equality (`NoDupes ys`)\n> ||| - Given a proof `Elem x xs` (resp `Elem x ys`) we have a proof `Elem x ys`\n> ||| (resp `Elem x xs`) (`ElementPreservingCorrespondence xs ys`)\n> remDup : DecIn t => (xs : List t) -> (ys ** (NoDupes ys, ElementPreservingCorrespondence xs ys))", "meta": {"hexsha": "95b9e94473c21680525b0981b6670fc101cbaa82", "size": 5404, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "src/Data/List/TypeEnumeration.lidr", "max_stars_repo_name": "nicklecompte/idris-finite-sets", "max_stars_repo_head_hexsha": "de247371fb125f84b32b50f805095e677d30c93b", "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/Data/List/TypeEnumeration.lidr", "max_issues_repo_name": "nicklecompte/idris-finite-sets", "max_issues_repo_head_hexsha": "de247371fb125f84b32b50f805095e677d30c93b", "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/Data/List/TypeEnumeration.lidr", "max_forks_repo_name": "nicklecompte/idris-finite-sets", "max_forks_repo_head_hexsha": "de247371fb125f84b32b50f805095e677d30c93b", "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": 48.6846846847, "max_line_length": 98, "alphanum_fraction": 0.6600666173, "num_tokens": 1716, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8006920020959545, "lm_q2_score": 0.6825737214979745, "lm_q1q2_score": 0.5465313196442996}}
{"text": "module Shaped\n\nimport Data.Vect\nimport Data.So\n\n%default total\n\nmkRank : (len: Nat) -> (stride: Nat) -> Fin 3\nmkRank len s = case len > s of\n  True => the (Fin 3) 2\n  False => if (len > 1) then the (Fin 3) 1 else the (Fin 3) 0\n\ndata Dim: (rows, stride, len: Nat) -> Type where\n  MkDim: (rows, stride: Nat)\n    -> {auto NZs : So (stride > 0)}\n    -> {auto NZs : So (rows > 0)}\n    -> Dim rows stride (rows * stride)\n\ndata Shape: (rank: Fin 3) -> Dim rows stride len -> Type where\n  SomeScalar:\n    Shape\n      (mkRank 1 1)\n      (MkDim 1 1)\n  SomeVect:\n    (stride: Nat)\n    -> {auto NZs : So (stride > 0)}\n    -> Shape\n        (mkRank stride stride)\n        (MkDim 1 stride)\n  SomeMat:\n    (rows, stride: Nat)\n    -> {auto NZs : So (stride > 0)}\n    -> {auto NZs : So (rows > 0)}\n    -> Shape\n        (mkRank (rows * stride) stride)\n        (MkDim rows stride)\n\ndata Operation =\n  Plus | Minus\n  | Slash | Backslash\n  | Equal\n\ndata Parallelism: Nat -> Nat -> Type where\n  mkPar: (x: Nat) -> (y: Nat) -> Parallelism x y\n\nrecord Phase where\n  constructor MkPhase\n  operation : Operation\n  shape : Shape rank (MkDim (S rows) (S stride))\n  par : Parallelism x y\n\n-- shape (Reduce (SomeVect 4))\n-- shape (Reduce (SomeMat 3 3))\n-- shape (Sum (SomeVect 4) (shape (Reduce (SomeMat 3 3))))\n-- shape (Sum SomeScalar (shape (Reduce (SomeVect 4))))\nReduce : Shape q (MkDim (S r) (S n)) -> Phase\nReduce {q=FZ} o = MkPhase Slash o (mkPar 0 0)\nReduce {q=FS(FZ)} {n} o = MkPhase Slash SomeScalar (mkPar (S n) 0)\nReduce {q=FS(FS(FZ))} {r} {n} o = MkPhase Slash (SomeVect (S n)) (mkPar ((S n)*(S r)) 0)\n\nScan : Shape p (MkDim (S r) (S n)) -> Phase\nScan {r} {n} o = MkPhase Backslash o (mkPar ((S n)*(S r)) 0)\n\n-- scalarToVect (MkScalar 1) (MkVect [1,2,3,4])\n-- [Plus, Minus, Slash]\n-- shape (Sum SomeScalar SomeScalar)\n-- shape (Sum (SomeVect 4) (SomeVect 4))\n-- shape (Sum (SomeMat 3 3) (SomeMat 3 3))\nSum : Shape p (MkDim (S r) (S n)) -> Shape p (MkDim (S r) (S n)) -> Phase\nSum {r} {n} a o = MkPhase Plus o (mkPar 0 ((S n)*(S r)))\n\n-- shape (NSum SomeScalar (SomeVect 4))\n-- shape (NSum SomeScalar (SomeMat 3 3))\nNSum : Shape 0 (MkDim (S r) (S n)) -> Shape p (MkDim (S j) (S m)) -> Phase\nNSum {j} {m} a o = MkPhase Plus (SomeMat (S j) (S m)) (mkPar 0 ((S j)*(S m)))\n", "meta": {"hexsha": "d458c0c91b2725f004376a9d001d874e5d159e34", "size": 2251, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Shaped.idr", "max_stars_repo_name": "jhvst/shaped-array", "max_stars_repo_head_hexsha": "0c5f5d1319ac4322cab205eecc51d3f374fb3b6b", "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": "Shaped.idr", "max_issues_repo_name": "jhvst/shaped-array", "max_issues_repo_head_hexsha": "0c5f5d1319ac4322cab205eecc51d3f374fb3b6b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Shaped.idr", "max_forks_repo_name": "jhvst/shaped-array", "max_forks_repo_head_hexsha": "0c5f5d1319ac4322cab205eecc51d3f374fb3b6b", "max_forks_repo_licenses": ["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.6184210526, "max_line_length": 88, "alphanum_fraction": 0.5864060418, "num_tokens": 850, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357666736772, "lm_q2_score": 0.6297746004557471, "lm_q1q2_score": 0.5460371035377574}}
{"text": "module Gspider.Main\n\n\nimport Data.Vect\nimport Data.SortedMap\n\nimport Core\nimport File.FrequencyFileParsing\nimport File.SystemLoading\nimport Types.AttackFrame\nimport Types.RestrictedCharString\n\nimport Probability.Core\n\n\n||| Looks up a password probability in a sorted map.\n|||\n||| @probs  the list of password probabilities\n||| @pwd    the password to look up\nlookupEff : (probs : SortedMap (RestrictedCharString s) Double) -> (pwd : RestrictedCharString s) -> Double\nlookupEff probs pwd =\n  case lookup pwd probs of\n    Just prob => prob\n    _ => 0\n\n\n||| Unzips a list of password frequency records into two lists.\n|||\n||| @freqs  the list of password frequencies\nsplitFreqRecords : (freqs : List PasswordFrequency) -> (List String, List Int)\nsplitFreqRecords [] = ([], [])\nsplitFreqRecords (x :: xs) =\n  let (ps, fs) = splitFreqRecords xs in\n  ((pwd x) :: ps, (freq x) :: fs)\n\n\n||| Converts a system and a list of password frequency records to a distribution.\n|||\n||| @s      the system to convert under\n||| @freqs  the frequencies to use to build the distribution\ntoDist : (s : System) -> (freqs : List PasswordFrequency) -> Prob (RestrictedCharString s)\ntoDist s [] = flat []\ntoDist s freqs =\n  let (ps, fs) = splitFreqRecords freqs in\n  shape (convertToRestricted s ps) (map cast fs)\n\n\n||| Loads a password probability distribution.\n|||\n||| @s      the system\n||| @path   the path to the frequency file\nloadDist : (s : System) -> (path : String) -> IO (Maybe (Distribution s))\nloadDist s path = do\n  txt <- readFile path\n  case txt of\n    (Right txt') =>\n      let rows = parseRows ':' txt'\n          dist = toDist s rows\n          tuples = runProb dist\n      in\n      pure (Just (lookupEff (fromList tuples)))\n    _ => pure Nothing\n\n\n||| Loads an attack.\n|||\n||| @s      the system\n||| @path   the path to the file\nloadAtt : (s : System) -> (path : String) -> IO (Maybe (List (RestrictedCharString s)))\nloadAtt s path = do\n  txt <- readFile path\n  case txt of\n    (Right txt') => pure (Just (convertToRestricted s (lines txt')))\n    _ => pure Nothing\n\n\n||| Initialises a probabilistic attack frame.\n|||\n||| @att    the attack\n||| @dist   the distribution\ninitFrame : (att : Vect n (RestrictedCharString s)) -> (dist : Distribution s) -> AttackFrame s n 0\ninitFrame [] dist = Empty dist\ninitFrame att@(_ :: _) dist = Initial att dist\n\n\n||| Runs a probabilistic attack frame to completion, printing each probability.\n|||\n||| @paf    the probabilistic attack frame\nrunFrame : (paf : AttackFrame _ _ _) -> IO ()\nrunFrame (Empty _) = putStrLn \"Frame is empty.\"\nrunFrame paf@(Initial _ _) = do\n  next <- pure (advance paf)\n  putStrLn (\"Frame is initial.\")\n  case next of\n    Ongoing _ _ _ q => putStrLn (cast q)\n    Terminal _ _ q => putStrLn (cast q)\n  runFrame next\nrunFrame paf@(Ongoing _ _ _ _) = do\n  next <- pure (advance paf)\n  case next of\n    Ongoing _ _ _ q => putStrLn (cast q)\n    Terminal _ _ q => putStrLn (cast q)\n  runFrame next\nrunFrame (Terminal _ _ _) = putStrLn \"Frame is terminal.\"\n\n\nmain : IO ()\nmain = do\n  [_, arg_sys, arg_dist, arg_att] <- getArgs -- TODO: Bind alternatives!\n  Just s <- loadSystem arg_sys | Nothing => putStrLn \"Error: Could not load system.\"\n  Just dist <- loadDist s arg_dist | Nothing => putStrLn \"Error: Could not load distribution.\"\n  Just att <- loadAtt s arg_att | Nothing => putStrLn \"Error: Could not load attack.\"\n  let frame = initFrame (fromList att) dist -- Initialise probabilistic attack frame.\n  runFrame frame -- Run PAF to completion.\n", "meta": {"hexsha": "b6d0bca3afb9642c94872b071214a1ce76219fc3", "size": 3495, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Main.idr", "max_stars_repo_name": "sr-lab/gspider", "max_stars_repo_head_hexsha": "fa6259a141dfad6548fc44932e8d90924ab89ad2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-07-04T07:56:15.000Z", "max_stars_repo_stars_event_max_datetime": "2019-07-04T07:56:15.000Z", "max_issues_repo_path": "src/Main.idr", "max_issues_repo_name": "sr-lab/gspider", "max_issues_repo_head_hexsha": "fa6259a141dfad6548fc44932e8d90924ab89ad2", "max_issues_repo_licenses": ["MIT"], "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.idr", "max_forks_repo_name": "sr-lab/gspider", "max_forks_repo_head_hexsha": "fa6259a141dfad6548fc44932e8d90924ab89ad2", "max_forks_repo_licenses": ["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.3913043478, "max_line_length": 107, "alphanum_fraction": 0.6732474964, "num_tokens": 948, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519527869325345, "lm_q2_score": 0.6406358411176238, "lm_q1q2_score": 0.5457914902490281}}
{"text": "module average\n\nexport\n\naverage: String -> Double\naverage str = let numwords = wordCount str\n                  totalLength = sum (allLengths (words str)) in\n                  cast totalLength / cast numwords\n        where\n            wordCount: String -> Nat\n            wordCount str = length (words str)\n\n            allLengths: List String -> List Nat\n            allLengths strs = map length strs\n", "meta": {"hexsha": "04ba196b30d1ef0053522eefb5eb8c7f1dd9c005", "size": 401, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "teste/average.idr", "max_stars_repo_name": "RonaldCamp/ImpCompiler", "max_stars_repo_head_hexsha": "b7690dd0bffc97be52f0e64f8e8dead1f240fb87", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-04-15T03:36:44.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-13T22:38:30.000Z", "max_issues_repo_path": "teste/average.idr", "max_issues_repo_name": "RonaldCamp/ImpCompiler", "max_issues_repo_head_hexsha": "b7690dd0bffc97be52f0e64f8e8dead1f240fb87", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2019-04-15T03:44:40.000Z", "max_issues_repo_issues_event_max_datetime": "2019-06-09T23:51:29.000Z", "max_forks_repo_path": "teste/average.idr", "max_forks_repo_name": "RonaldCamp/ImpCompiler", "max_forks_repo_head_hexsha": "b7690dd0bffc97be52f0e64f8e8dead1f240fb87", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-04-15T03:46:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-04-15T03:46:13.000Z", "avg_line_length": 26.7333333333, "max_line_length": 63, "alphanum_fraction": 0.5860349127, "num_tokens": 88, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.828938825225204, "lm_q2_score": 0.6584174938590246, "lm_q1q2_score": 0.5457878238672228}}
{"text": "||| N-ary congruence for reasoning\nmodule Data.Telescope.Congruence\n\nimport Data.Telescope.Telescope\nimport Data.Telescope.Segment\nimport Data.Telescope.SimpleFun\nimport Data.Telescope.Fun\n\npublic export\ncongType : (delta : Segment n gamma)\n  -> (env1 : Left.Environment gamma) -> (sy1 : SimpleFun env1 delta Type) -> (lhs : Fun env1 delta sy1)\n  -> (env2 : Left.Environment gamma) -> (sy2 : SimpleFun env2 delta Type) -> (rhs : Fun env2 delta sy2)\n  -> Type\ncongType []            env1 sy1 lhs  env2 sy2 rhs = lhs ~=~ rhs\ncongType (ty :: delta) env1 sy1 lhs  env2 sy2 rhs =\n                         {x1 : ty env1} -> {x2 : ty env2}\n                      -> x1 ~=~ x2\n                      -> congType delta\n                           (env1 ** x1) (sy1 x1) (lhs x1)\n                           (env2 ** x2) (sy2 x2) (rhs x2)\n\npublic export\ncongSegment : {n : Nat} -> (0 delta : Segment n gamma)\n  ->(0 env1 : Left.Environment gamma)-> (0 sy1 : SimpleFun env1 delta Type) -> (0 lhs : Fun env1 delta sy1)\n  ->(0 env2 : Left.Environment gamma)-> (0 sy2 : SimpleFun env2 delta Type) -> (0 rhs : Fun env2 delta sy2)\n  ->(0 _ : env1 ~=~ env2)      -> (0 _ : sy1 ~=~ sy2)                 -> (0 _ : lhs ~=~ rhs)\n  -> congType delta env1 sy1 lhs\n                    env2 sy2 rhs\ncongSegment {n = 0  } []            env sy context env sy context Refl Refl Refl = Refl\ncongSegment {n = S n} (ty :: delta) env sy context env sy context Refl Refl Refl = recursiveCall\n  where\n    recursiveCall : {x1 : ty env} -> {x2 : ty env} -> x1 ~=~ x2\n                 -> congType delta (env ** x1) (sy x1) (context x1)\n                                   (env ** x2) (sy x2) (context x2)\n    recursiveCall {x1=x} {x2=x} Refl = congSegment delta\n                                                   (env ** x) (sy x) (context x)\n                                                   (env ** x) (sy x) (context x)\n                                                   Refl       Refl   Refl\n\npublic export\ncong : {n : Nat} -> {0 delta : Segment n []} -> {0 sy : SimpleFun () delta Type}\n    -> (context : Fun () delta sy)\n    -> congType delta () sy context\n                      () sy context\ncong {n} {delta} {sy} context = congSegment delta ()    sy   context\n                                                  ()    sy   context\n                                                  Refl  Refl Refl\n", "meta": {"hexsha": "942e3f7b4c29977590aba974b09aed084617f8e5", "size": 2362, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/contrib/Data/Telescope/Congruence.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/libs/contrib/Data/Telescope/Congruence.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/libs/contrib/Data/Telescope/Congruence.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 49.2083333333, "max_line_length": 107, "alphanum_fraction": 0.4957662997, "num_tokens": 668, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7662936430859597, "lm_q2_score": 0.7122321903471563, "lm_q1q2_score": 0.5457789998642152}}
{"text": "import Data.Vect\n\ndata WordState : (guesses_remaining : Nat) -> (letters : Nat) -> Type where\n  MkWordState : (word : String) ->\n                (missing : Vect letters Char) ->\n                WordState guesses_remaining letters\n\ndata Finished : Type where\n  Lost : (game : WordState 0 (S letters)) -> Finished\n  Won  : (game : WordState (S guesses) 0) -> Finished\n\ntotal\nremoveElem : (value: a) -> (xs : Vect (S n) a) ->\n             {auto prf : Elem value xs} ->\n             Vect n a\nremoveElem value (value :: ys) {prf = Here} = ys\nremoveElem {n = Z} value (y :: []) {prf = There later} = absurd later\nremoveElem {n = (S k)} value (y :: ys) {prf = There later}\n                                          = y :: removeElem value ys\n\n\ndata ValidInput : List Char -> Type where\n  Letter : (c : Char) -> ValidInput [c]\n\nnilFailure : (s : String) -> ValidInput [] -> Void\nnilFailure _ (Letter _) impossible\n\ntwoFailure : (s : String) -> ValidInput (x :: (y :: xs)) -> Void\ntwoFailure _ (Letter _) impossible\n\nisValidString : (s : String) -> Dec (ValidInput (unpack s))\nisValidString s = isValidInput (unpack s) where\n  isValidInput : (cs : List Char) -> Dec (ValidInput cs)\n  isValidInput [] = No (nilFailure s)\n  isValidInput (x :: []) = Yes (Letter x)\n  isValidInput (x :: (y :: xs)) = No (twoFailure s)\n\nreadGuess : IO (x ** ValidInput x)\nreadGuess = do putStr \"Guess:\"\n               x <- getLine\n               case isValidString (toUpper x) of\n                    Yes prf => pure (_ ** prf)\n                    No contra => do putStr \"Invalid guess\"\n                                    readGuess\n\nprocessGuess : (letter : Char) ->\n               WordState (S guesses) (S letters) ->\n               Either (WordState guesses (S letters))\n                      (WordState (S guesses) letters)\nprocessGuess letter (MkWordState word missing) = case isElem letter missing of\n                                                      (Yes prf) => Right (MkWordState word (removeElem letter missing))\n                                                      (No contra) => Left (MkWordState word missing) \n\n\ngame : WordState (S guesses) (S letters) -> IO Finished\ngame {guesses} {letters} st\n     = do (_ ** Letter letter) <- readGuess\n          case processGuess letter st of\n               Left l => do putStrLn \"Wrong!\"\n                            case guesses of\n                                 Z => pure (Lost l)\n                                 S k => game l\n               Right r => do putStrLn \"Right!\"\n                             case letters of \n                                  Z => pure (Won r)\n                                  S k => game r\n\nmain : IO ()\nmain = do result <- game {guesses = 2}\n                 (MkWordState \"Test\" ['T','E', 'S'])\n          case result of\n               Lost (MkWordState word missing) =>\n                    putStrLn (\"You lose. The word was \" ++ word)\n               Won game =>\n                   putStrLn \"You win!\"\n\n          \n", "meta": {"hexsha": "76f55d549f9409a4bb4517ab814e8f0ccd1b0893", "size": 2974, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type_driven_book/chp9/Hangman.idr", "max_stars_repo_name": "Ryxai/idris_book_notes", "max_stars_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "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_driven_book/chp9/Hangman.idr", "max_issues_repo_name": "Ryxai/idris_book_notes", "max_issues_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_issues_repo_licenses": ["MIT"], "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_driven_book/chp9/Hangman.idr", "max_forks_repo_name": "Ryxai/idris_book_notes", "max_forks_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_forks_repo_licenses": ["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.1282051282, "max_line_length": 119, "alphanum_fraction": 0.5047074647, "num_tokens": 706, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619263765707, "lm_q2_score": 0.6619228825191871, "lm_q1q2_score": 0.5457302148345015}}
{"text": "%default total\n\n-- Let's try to replicate the dependent example with simple algebraic data types\ndata PetrolVehicle = Car' Nat | Bus' Nat\ndata PedalVehicle = Bike'\ndata Vehicle' = Petrol' PetrolVehicle | Pedal' PedalVehicle\n\nwheels' : Vehicle' -> Nat\nwheels' (Petrol' (Car' _)) = 4\nwheels' (Petrol' (Bus' _)) = 4\nwheels' (Pedal' _) = 2\n\nrefuel' : PetrolVehicle -> PetrolVehicle\nrefuel' (Car' k) = Car' 100\nrefuel' (Bus' k) = Bus' 200\n\ndata Power = Petrol | Pedal | Electric\ndata Vehicle : Power -> Type where\n  Bycicle : Vehicle Pedal\n  Car : (fuel : Nat) -> Vehicle Petrol\n  Bus : (fuel : Nat) -> Vehicle Petrol\n  -- Extra\n  Unicycle : Vehicle Pedal\n  Motorcycle : (fuel : Nat) -> Vehicle Petrol\n  ElectricCar : (energy : Nat) -> Vehicle Electric\n\nwheels : Vehicle _ -> Nat\nwheels Bycicle = 2\nwheels (Car fuel) = 4\nwheels (Bus fuel) = 4\nwheels Unicycle = 1\nwheels (Motorcycle fuel) = 2\nwheels (ElectricCar energy) = 4\n\nrefuel : Vehicle Petrol -> Vehicle Petrol\nrefuel (Car fuel) = Car 100\nrefuel (Bus fuel) = Bus 200\nrefuel (Motorcycle fuel) = Motorcycle 50\n\n\n", "meta": {"hexsha": "9878fa275173e117c89be5bf3daa9b43d744522a", "size": 1061, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "vehicles.idr", "max_stars_repo_name": "GustavoMF31/TDDwithIdrisExercises", "max_stars_repo_head_hexsha": "22b7c2802e1d8fd102a5b9b70d024205b3f35a74", "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": "vehicles.idr", "max_issues_repo_name": "GustavoMF31/TDDwithIdrisExercises", "max_issues_repo_head_hexsha": "22b7c2802e1d8fd102a5b9b70d024205b3f35a74", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "vehicles.idr", "max_forks_repo_name": "GustavoMF31/TDDwithIdrisExercises", "max_forks_repo_head_hexsha": "22b7c2802e1d8fd102a5b9b70d024205b3f35a74", "max_forks_repo_licenses": ["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.8780487805, "max_line_length": 80, "alphanum_fraction": 0.6870876532, "num_tokens": 355, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8872045937171068, "lm_q2_score": 0.615087848460224, "lm_q1q2_score": 0.5457087646934824}}
{"text": "> module Nat.CoprimeProperties\n\n> import Nat.Coprime\n> import Nat.GCD\n> import Nat.GCDOperations\n> import Nat.GCDProperties\n> import Nat.Divisor\n> import Nat.DivisorOperations\n> import Nat.DivisorProperties\n> import Nat.OperationsProperties\n> import Nat.GCDAlgorithm\n> import Nat.GCDEuclid\n> import Pairs.Operations\n> import Sigma.Sigma\n\n> %default total\n> %auto_implicits on\n> %access export\n> -- %access public export\n\n\n> ||| Coprime is decidable\n> decCoprime : (m : Nat) -> (n : Nat) -> Dec (Coprime m n)\n> decCoprime m n with (decEq (gcdAlg m n) (S Z))\n>   | (Yes p) = Yes (MkCoprime p)\n>   | (No contra) = No contra' where\n>         contra' : Coprime m n -> Void\n>         contra' (MkCoprime p) = contra p\n> %freeze decCoprime\n\n\n> ||| Coprime is symmetric\n> symmetricCoprime : Coprime m n -> Coprime n m\n> symmetricCoprime {m} {n} (MkCoprime prf) = MkCoprime (trans (gcdAlgCommutative n m) prf)\n> %freeze symmetricCoprime\n\n\n> ||| Any number is coprime with one\n> anyCoprimeOne : Coprime m (S Z)\n> anyCoprimeOne {m} = MkCoprime s3 where\n>   s1 : (gcdAlg m (S Z)) `Divisor` (S Z)\n>   s1 = gcdDivisorSnd (gcdAlgLemma m (S Z))\n>   s2 : (S Z ) `Divisor` (gcdAlg m (S Z))\n>   s2 = oneDivisorAny (gcdAlg m (S Z))\n>   s3 : gcdAlg m (S Z) = S Z\n>   s3 = divisorAntisymmetric (gcdAlg m (S Z)) (S Z) s1 s2\n> %freeze anyCoprimeOne\n\n\n> ||| Division by gcd yields coprime numbers\n> gcdCoprimeLemma : (d : Nat) -> (m : Nat) -> (n : Nat) -> \n>                   (dDm : d `Divisor` m) -> (dDn : d `Divisor` n) -> \n>                   Z `LT` d -> GCD d m n -> Coprime (quotient m d dDm) (quotient n d dDn)\n> gcdCoprimeLemma d m n dDm dDn zLTd dGCDmn =\n>   let m'         :  Nat\n>                  =  quotient m d dDm in\n>   let n'         :  Nat\n>                  =  quotient n d dDn in\n>   let d'         :  Nat\n>                  =  gcdAlg m' n' in\n>   let d'GCDm'n'  :  (GCD d' m' n')\n>                  =  gcdAlgLemma m' n' in\n>   let d'Dm'      :  (d' `Divisor` m')\n>                  =  gcdDivisorFst d'GCDm'n' in\n>   let d'Dn'      :  (d' `Divisor` n')\n>                  =  gcdDivisorSnd d'GCDm'n' in\n>   let oneDd'     :  ((S Z) `Divisor` d')\n>                  =  oneDivisorAny d' in\n>   let d'Done     :  (d' `Divisor` (S Z))\n>                  =  gcdLemma'' d m n dDm dDn dGCDmn zLTd d' d'Dm' d'Dn' in\n>   let d'EQone    :  (d' = (S Z)) \n>                  =  divisorAntisymmetric d' (S Z) d'Done oneDd' in\n>   MkCoprime d'EQone\n> %freeze gcdCoprimeLemma\n\n\n> {-\n\n> ||| Division by gcd yields coprime numbers\n> gcdCoprimeLemma : (v : GCD (S d) m n) -> Coprime (quotient m (S d) (gcdDivisorFst v))\n>                                                  (quotient n (S d) (gcdDivisorSnd v))\n> gcdCoprimeLemma {d} {m} {n} v = MkCoprime (MkGCD d'Dm' d'Dn' d'G) Refl where\n>   dDm     : (S d) `Divisor` m\n>   dDm     = gcdDivisorFst v\n>   dDn     : (S d) `Divisor` n\n>   dDn     = gcdDivisorSnd v\n>   m'      : Nat\n>   m'      = quotient m (S d) dDm\n>   n'      : Nat\n>   n'      = quotient n (S d) dDn\n>   d'Dm'   : S Z `Divisor` m'\n>   d'Dm'   = oneDivisorAny m'\n>   d'Dn'   : S Z `Divisor` n'\n>   d'Dn'   = oneDivisorAny n'\n>   d'G     : (d'' : Nat) -> d'' `Divisor` m' -> d'' `Divisor` n' -> d'' `Divisor` (S Z)\n>   d'G d'' = gcdLemma v\n> %freeze gcdCoprimeLemma\n\n> ||| Division by gcd yields coprime numbers\n> gcdCoprimeLemma' : (v : GCD d m n) -> Not (d = Z) -> Coprime (quotient m d (gcdDivisorFst v))\n>                                                              (quotient n d (gcdDivisorSnd v))\n> gcdCoprimeLemma' {d} {m} {n} v dNotZ = MkCoprime (MkGCD d'Dm' d'Dn' d'G) Refl where\n>   dDm     : d `Divisor` m\n>   dDm     = gcdDivisorFst v\n>   dDn     : d `Divisor` n\n>   dDn     = gcdDivisorSnd v\n>   m'      : Nat\n>   m'      = quotient m d dDm\n>   n'      : Nat\n>   n'      = quotient n d dDn\n>   d'Dm'   : S Z `Divisor` m'\n>   d'Dm'   = oneDivisorAny m'\n>   d'Dn'   : S Z `Divisor` n'\n>   d'Dn'   = oneDivisorAny n'\n>   d'G     : (d'' : Nat) -> d'' `Divisor` m' -> d'' `Divisor` n' -> d'' `Divisor` (S Z)\n>   d'G d'' = gcdLemma' v dNotZ\n> %freeze gcdCoprimeLemma'\n\n> ||| Division by gcd yields coprime numbers\n> gcdCoprimeLemma'' : (v : GCD d m n) -> Z `LT` d -> Coprime (quotient m d (gcdDivisorFst v))\n>                                                            (quotient n d (gcdDivisorSnd v))\n> gcdCoprimeLemma'' {d} {m} {n} v zLTd = MkCoprime (MkGCD d'Dm' d'Dn' d'G) Refl where\n>   dDm     : d `Divisor` m\n>   dDm     = gcdDivisorFst v\n>   dDn     : d `Divisor` n\n>   dDn     = gcdDivisorSnd v\n>   m'      : Nat\n>   m'      = quotient m d dDm\n>   n'      : Nat\n>   n'      = quotient n d dDn\n>   d'Dm'   : S Z `Divisor` m'\n>   d'Dm'   = oneDivisorAny m'\n>   d'Dn'   : S Z `Divisor` n'\n>   d'Dn'   = oneDivisorAny n'\n>   dNotZ   : Not (d = Z)\n>   dNotZ   = gtZisnotZ zLTd\n>   d'G     : (d'' : Nat) -> d'' `Divisor` m' -> d'' `Divisor` n' -> d'' `Divisor` (S Z)\n>   d'G d'' = gcdLemma' v dNotZ\n> %freeze gcdCoprimeLemma''\n\n\nGCD / Coprime properties:\n\n> |||\n> gcdOneCoprimeLemma1 : (alg : (a : Nat) -> (b : Nat) -> (d : Nat ** GCD d a b)) ->\n>                       (m : Nat) -> (n : Nat) ->\n>                       gcd (alg m n) = S Z -> Coprime m n\n> gcdOneCoprimeLemma1 alg m n prf = MkCoprime (getProof (alg m n)) prf\n> %freeze gcdOneCoprimeLemma1\n\n> |||\n> gcdOneCoprimeLemma2 : (m : Nat) -> (n : Nat) ->\n>                       (alg : (a : Nat) -> (b : Nat) -> (d : Nat ** GCD d a b)) ->\n>                       Coprime m n -> gcd (alg m n) = S Z\n> gcdOneCoprimeLemma2 m n alg (MkCoprime {d} v prf) = s3 where\n>   s1 : d = S Z\n>   s1 = prf\n>   s2 : gcd (alg m n) = d\n>   s2 = gcdUnique (gcd (alg m n)) d (getProof (alg m n)) v\n>   s3 : gcd (alg m n) = S Z\n>   s3 = trans s2 s1\n> %freeze gcdOneCoprimeLemma2\n\n> |||\n> gcdAnyOneOne : (alg : (a : Nat) -> (b : Nat) -> (d : Nat ** GCD d a b)) ->\n>                (m : Nat) ->\n>                gcd (alg m (S Z)) = S Z\n> gcdAnyOneOne alg m = gcdOneCoprimeLemma2 m (S Z) alg anyCoprimeOne\n> %freeze gcdAnyOneOne\n\n> ---}\n", "meta": {"hexsha": "2a04a20f1d35e2d3a4caabcdf231ce0f483449c1", "size": 5973, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "Nat/CoprimeProperties.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Nat/CoprimeProperties.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Nat/CoprimeProperties.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 34.726744186, "max_line_length": 95, "alphanum_fraction": 0.5163234555, "num_tokens": 2400, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8615382094310357, "lm_q2_score": 0.6334102775181399, "lm_q1q2_score": 0.5457071563281937}}
{"text": "module BadRefl\n\nimport IdrisPrelude\n\nplus : Nat -> Nat -> Nat\nplus =\n  natElim\n    ( \\ _ => (Nat -> Nat) )           -- motive\n    ( \\ n => n )                    -- case for Zero\n    ( \\ p, rec, n => Succ (rec n) )   -- case for Succ\n\n-- the other direction requires induction on N:\npostulate pNPlus0isN : (n : Nat) -> Eq Nat (plus n Zero) n\n\n\n-- the other direction requires induction on N:\nsuccPlus : (n : Nat) -> Eq Nat  (Succ n) (plus (Succ n) Zero)\nsuccPlus =\n  (\\n => pNPlus0isN (Succ n))\n", "meta": {"hexsha": "ad518c10965750a90d66a454b86c4ab3244ca620", "size": 496, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "thesisExamples/BadRefl.idr", "max_stars_repo_name": "JoeyEremondi/lambda-pi-constraint", "max_stars_repo_head_hexsha": "64a1b4c6632153d75cba540f7c91f40b49375e2f", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-03-16T11:14:56.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-05T20:21:46.000Z", "max_issues_repo_path": "thesisExamples/BadRefl.idr", "max_issues_repo_name": "JoeyEremondi/lambda-pi-constraint", "max_issues_repo_head_hexsha": "64a1b4c6632153d75cba540f7c91f40b49375e2f", "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": "thesisExamples/BadRefl.idr", "max_forks_repo_name": "JoeyEremondi/lambda-pi-constraint", "max_forks_repo_head_hexsha": "64a1b4c6632153d75cba540f7c91f40b49375e2f", "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.8, "max_line_length": 61, "alphanum_fraction": 0.5564516129, "num_tokens": 161, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8615382094310357, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.5457071444042465}}
{"text": "removeFromList: Eq a => (elem: a) -> List a -> List a\nremoveFromList elem [] = []\nremoveFromList elem (head :: tail) =\n  if   elem == head\n  then removeFromList elem tail\n  else head :: (removeFromList elem tail)\n\nexample1: List Int\nexample1 = [1,2,3,1,2,3]\n", "meta": {"hexsha": "d74e869875575b59599c2a2c1d137c1e8ad33de9", "size": 258, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "RemoveFromList.idr", "max_stars_repo_name": "coffius/idris-exercises", "max_stars_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "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": "RemoveFromList.idr", "max_issues_repo_name": "coffius/idris-exercises", "max_issues_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "RemoveFromList.idr", "max_forks_repo_name": "coffius/idris-exercises", "max_forks_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_forks_repo_licenses": ["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.8, "max_line_length": 53, "alphanum_fraction": 0.6627906977, "num_tokens": 83, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7401743505760728, "lm_q2_score": 0.737158174177441, "lm_q1q2_score": 0.545625572843631}}
{"text": "||| Here we present the syntax for our local types.\n||| Local Types present a role-oriented view of the protocol.\n|||\n||| We are inspired from the Tech Report 'A Linear Decomposition of Multiparty Sessions for Safe Distributed Programming' (DTRS12-2).\n||| The author's note that sending and receiving are special cases of select and branch..\n|||\n|||\nmodule Sessions.Local\n\nimport Decidable.Equality\nimport Data.List\nimport Data.List.Elem\n\nimport Data.List1\n\nimport Sessions.Meta\n\n\npublic export\ndata Local : (role, label, msg  : Type)\n          -> (rvars : List Ty)\n          -> (type  : Ty)\n                   -> Type\n  where\n    End : Local typeR typeL typeM rs G\n\n    Call : Elem R rs -> Local typeR typeL typeM rs R\n\n    Rec : Local typeR typeL typeM (R::rs) R\n       -> Local typeR typeL typeM     rs  R\n\n    Choice : (type : ChoiceTy)\n          -> (whom : typeR)\n          -> (selections : List1 (typeL, typeM, Local typeR typeL typeM rs g))\n                        -> Local typeR typeL typeM rs g\n\n\npublic export\nBranch : (role, label, msg : Type)\n      -> (rvars : List Ty)\n      -> (type  : Ty)\n               -> Type\nBranch role label msg rvars type\n  = (label, msg, Local role label msg rvars type)\n\npublic export\nBranches : (role, label, msg : Type)\n        -> (rvars : List Ty)\n        -> (type  : Ty)\n                 -> Type\nBranches role label msg rvars type\n  = List1 (Branch role label msg rvars type)\n\npublic export\nBranches' : (role, label, msg : Type)\n         -> (rvars : List Ty)\n         -> (type  : Ty)\n                  -> Type\nBranches' role label msg rvars type\n  = List (Branch role label msg rvars type)\n\n-- [ EOF ]\n", "meta": {"hexsha": "186fa8aa91c68f69919af7abcb4d903652046015", "size": 1646, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Sessions/Local.idr", "max_stars_repo_name": "DSbD-AppControl/sessions-playground", "max_stars_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-08-19T13:13:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-19T13:13:10.000Z", "max_issues_repo_path": "Sessions/Local.idr", "max_issues_repo_name": "DSbD-AppControl/sessions-playground", "max_issues_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Sessions/Local.idr", "max_forks_repo_name": "DSbD-AppControl/sessions-playground", "max_forks_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.126984127, "max_line_length": 133, "alphanum_fraction": 0.602673147, "num_tokens": 443, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8376199633332891, "lm_q2_score": 0.6513548646660542, "lm_q1q2_score": 0.5455878378585398}}
{"text": "> module SequentialDecisionProblems.examples.Main\n\n> import Decidable.Order\n\n> import Data.List\n> import Data.List.Quantifiers\n> import Effects\n> import Effect.Exception\n> import Effect.StdIO\n\n> import SequentialDecisionProblems.CoreTheory\n> import SequentialDecisionProblems.FullTheory\n> import SequentialDecisionProblems.TabBackwardsInduction\n> import SequentialDecisionProblems.Utils\n> import SequentialDecisionProblems.NonDeterministicDefaults\n> import SequentialDecisionProblems.CoreTheoryOptDefaults\n> import SequentialDecisionProblems.FullTheoryOptDefaults\n> import SequentialDecisionProblems.TabBackwardsInductionOptDefaults\n\n> import SequentialDecisionProblems.examples.LeftAheadRight\n\n> import List.Operations\n> import List.Properties\n> import BoundedNat.BoundedNat\n> import BoundedNat.Operations\n> import BoundedNat.Properties\n> import Sigma.Sigma\n> import Sigma.Operations\n> import Nat.OperationsProperties\n> import Nat.LTEProperties\n> import Nat.LTProperties\n> import Unit.Properties\n> import Void.Properties\n> import LocalEffect.Exception\n> import LocalEffect.StdIO\n\n> -- %default total\n> %auto_implicits off\n\n> -- %logging 5\n\nLike \"Example2.lidr\", but now |step t x y| is empty in states\ncorresponding to |maxColumn|, no matter which |y| is selected! Thus,\nsuch states are not viable for more than zero steps. Attemps at making\nmore than zero decision steps starting from |maxColumn| should be\ndetected and rejected.\n\n* The decision process:\n\n> maxColumn : Nat\n> maxColumn = 10\n\n> nColumns : Nat\n> nColumns = S maxColumn\n\n** States:\n\n> SequentialDecisionProblems.CoreTheory.State t = LTB nColumns\n\n** Controls:\n\n> SequentialDecisionProblems.CoreTheory.Ctrl t x = LeftAheadRight\n\n** Transition function:\n\n> SequentialDecisionProblems.CoreTheory.nexts t (MkSigma Z prf) Left =\n>   [MkSigma maxColumn (ltIdS maxColumn)]\n> SequentialDecisionProblems.CoreTheory.nexts t (MkSigma (S n) prf) Left with (decLT (S n) maxColumn)\n>   | (Yes p)     = [MkSigma n (ltLemma1 n nColumns prf)]\n>   | (No contra) = []\n> SequentialDecisionProblems.CoreTheory.nexts t (MkSigma n prf) Ahead with (decLT n maxColumn)\n>   | (Yes p)     = [MkSigma n prf]\n>   | (No contra) = []\n> SequentialDecisionProblems.CoreTheory.nexts t (MkSigma n prf) Right with (decLT n maxColumn)\n>   | (Yes p)     = [MkSigma (S n) (LTESucc p)]\n>   | (No contra) = []\n\n** |Val| and |LTE|:\n\n> SequentialDecisionProblems.CoreTheory.Val = \n>   Nat\n\n> SequentialDecisionProblems.CoreTheory.plus = \n>   Prelude.Nat.plus\n\n> SequentialDecisionProblems.CoreTheory.zero = \n>   Z\n\n> SequentialDecisionProblems.CoreTheory.LTE = \n>   Prelude.Nat.LTE\n\n> SequentialDecisionProblems.FullTheory.reflexiveLTE = \n>   Nat.LTEProperties.reflexiveLTE\n\n> SequentialDecisionProblems.FullTheory.transitiveLTE = \n>   Nat.LTEProperties.transitiveLTE\n\n> SequentialDecisionProblems.FullTheory.monotonePlusLTE = \n>   Nat.LTEProperties.monotoneNatPlusLTE\n\n> SequentialDecisionProblems.CoreTheoryOptDefaults.totalPreorderLTE = \n>   Nat.LTEProperties.totalPreorderLTE \n\n** Reward function:\n\n> SequentialDecisionProblems.CoreTheory.reward t x y (MkSigma c _) =\n>   if c == Z\n>   then (S Z)\n>   else if (S c) == nColumns\n>        then (S (S Z))\n>        else Z\n\n** Measure:\n\n> SequentialDecisionProblems.CoreTheory.meas = sum\n> SequentialDecisionProblems.FullTheory.measMon = sumMon\n\n** |State| is finite:\n\n> SequentialDecisionProblems.TabBackwardsInduction.finiteState t = \n>   finiteLTB nColumns\n\n** |Ctrl| is finite:\n\n> SequentialDecisionProblems.Utils.finiteCtrl _ = \n>   finiteLeftAheadRight\n\n** Reachability:\n\n> SequentialDecisionProblems.CoreTheory.Reachable x' = Unit\n> SequentialDecisionProblems.CoreTheory.reachableSpec1 {t} x r y = all (nexts t x y) where\n>   all : (xs : List (State (S t))) -> SequentialDecisionProblems.CoreTheory.All (Reachable {t' = S t}) xs\n>   all Nil = Nil\n>   all (x :: xs) = () :: (all xs)\n> SequentialDecisionProblems.TabBackwardsInduction.decidableReachable x = decidableUnit\n\n** Viability:\n\n> nextsLemma0 : {t : Nat} -> \n>               (x : State t) -> (outl x `LT` maxColumn) -> nexts t x Ahead = [x]\n> nextsLemma0 {t} (MkSigma i prf) p with (decLT i maxColumn)\n>   | (Yes _) = Refl\n>   | (No contra) = void (contra p)\n\n> nextsLemma1 : {t : Nat} -> \n>               (x : State t) -> (outl x `LT` maxColumn) -> \n>               SequentialDecisionProblems.CoreTheory.NotEmpty (nexts t x Ahead)\n> nextsLemma1 {t} x prf with (decLT (outl x) maxColumn)\n>   | (Yes p) = s3 where\n>     s1 : SequentialDecisionProblems.CoreTheory.NotEmpty [x] \n>     s1 = SequentialDecisionProblems.CoreTheory.elemNotEmptySpec0 x [x] Here\n>     s2 : [x] = nexts t x Ahead\n>     s2 = sym (nextsLemma0 x p)\n>     s3 : SequentialDecisionProblems.CoreTheory.NotEmpty (nexts t x Ahead)\n>     s3 = replace s2 s1\n>   | (No contra) = void (contra prf)\n\n> SequentialDecisionProblems.CoreTheory.Viable  Z    _ = Unit\n> SequentialDecisionProblems.CoreTheory.Viable (S n) x with (decLT (outl x) maxColumn)\n>   | (Yes _) = Unit\n>   | (No  _) = Void\n\n> viableLemma0 : {t : Nat} -> {x : State t} -> Viable Z x = Unit\n> viableLemma0 = Refl\n\n> viableLemma1 : {t : Nat} -> {n : Nat} -> {x : State t} -> \n>                (outl x) `Prelude.Nat.LT` maxColumn -> Viable (S n) x = Unit\n> viableLemma1 {t} {n} {x} prf with (decLT (outl x) maxColumn)\n>   | (Yes _) = Refl\n>   | (No contra) = void (contra prf)\n\n> viableLemma2 : {t : Nat} -> {n : Nat} -> {x : State t} -> \n>                Not ((outl x) `Prelude.Nat.LT` maxColumn) -> Viable (S n) x = Void\n> viableLemma2 {t} {n} {x} prf with (decLT (outl x) maxColumn)\n>   | (Yes p) = void (prf p)\n>   | (No _) = Refl\n\n> viableLemma : {t : Nat} -> {n : Nat} ->\n>               (x : State t) -> \n>               SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} n) (nexts t x Ahead)\n> viableLemma {t} {n = Z} (MkSigma i prf) with (decLT i maxColumn)\n>   | (Yes p) = res where\n>     res : SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} Z) [MkSigma i prf]\n>     res = v :: Nil where\n>       v : Viable {t = S t} Z (MkSigma i prf)\n>       v with (decLT i maxColumn)\n>         | (Yes _) = MkUnit\n>         | (No  contra) = void (contra p)\n>   | (No  _) = Nil\n> viableLemma {t} {n = S m} (MkSigma i prf) with (decLT i maxColumn)\n>   | (Yes p) = res where\n>     res : SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} (S m)) [MkSigma i prf]\n>     res = v :: Nil where\n>       v : Viable {t = S t} (S m) (MkSigma i prf)\n>       v with (decLT i maxColumn)\n>         | (Yes _) = MkUnit\n>         | (No  contra) = void (contra p)\n>   | (No  _) = Nil\n\n> SequentialDecisionProblems.CoreTheory.viableSpec1 {t} {n} x v with (decLT (outl x) maxColumn)\n>   | (Yes prf) = MkSigma Ahead (ne, av) where\n>     ne : NotEmpty (nexts t x Ahead)\n>     ne = nextsLemma1 x prf\n>     av : SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} n) (nexts t x Ahead)\n>     av = viableLemma x \n>   | (No _) = void v\n\n> SequentialDecisionProblems.Utils.finiteViable  Z    _ = finiteUnit\n> SequentialDecisionProblems.Utils.finiteViable (S m) x with (decLT (outl x) maxColumn)\n>   | (Yes p) = finiteUnit\n>   | (No  c) = finiteVoid\n\n> SequentialDecisionProblems.Utils.decidableViable  Z    _ = decidableUnit\n> SequentialDecisionProblems.Utils.decidableViable (S m) x with (decLT (outl x) maxColumn)\n>   | (Yes _) = decidableUnit\n>   | (No  _) = decidableVoid\n\n\n* The computation:\n\n> SequentialDecisionProblems.Utils.showState = show @{ShowLTB}\n> SequentialDecisionProblems.Utils.showCtrl = show\n\n> computation : { [STDIO] } Eff ()\n> computation =\n>   do putStr (\"enter number of steps:\\n\")\n>      nSteps <- getNat\n>      putStr (\"enter initial column:\\n\")\n>      x0 <- getLTB nColumns\n>      case (decidableViable {t = Z} nSteps x0) of\n>        (Yes v0) => do putStrLn (\"computing optimal policies ...\")\n>                       ps   <- pure (tabTailRecursiveBackwardsInduction Z nSteps)\n>                       putStrLn (\"computing optimal controls ...\")\n>                       mxys <- pure (possibleStateCtrlSeqs x0 () v0 ps)\n>                       putStrLn (show mxys)\n>                       putStrLn (\"done!\")                       \n>        (No _)   => putStrLn (\"initial column non viable for \" ++ cast {from = Int} (cast nSteps) ++ \" steps\")\n\n> main : IO ()\n> main = run computation\n\n\n> {-\n\n> ---}\n\n-- Local Variables:\n-- idris-packages: (\"effects\")\n-- End:\n", "meta": {"hexsha": "b4269a33775515a13402fddedbc4fd9cbf9dc328", "size": 8346, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "SequentialDecisionProblems/examples/Example3.NoViabilityDefaults.Tab.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/examples/Example3.NoViabilityDefaults.Tab.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/examples/Example3.NoViabilityDefaults.Tab.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 33.384, "max_line_length": 111, "alphanum_fraction": 0.6665468488, "num_tokens": 2507, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031737963569016, "lm_q2_score": 0.6791787056691698, "lm_q1q2_score": 0.5454985394370738}}
{"text": "module Data.ZZ.ModuloVerification\n\nimport Control.Algebra\nimport Classes.Verified\n\nimport Data.ZZ\nimport Control.Algebra.NumericInstances\nimport Control.Algebra.ZZVerifiedInstances\nimport Data.Matrix.AlgebraicVerified\t-- For (groupDivisionAddLToSubR)\n\nimport Control.Algebra.ZZDivisors\n\nimport Data.Fin.FinOrdering\nimport Data.Fin.Structural\n\n-- For (groupDivisionAddLToSubR)\nimport Control.Algebra.DiamondInstances\n\n\n\n{-\nTable of contents\n\n* ZZ algebraic theorems\n* Lemmas for (modNatFnIsRemainder)\n* (modNatFnIsRemainder)\n\tGenerate proofs of the quotient-remainder relation for binary\n\tmodulo operations on naturals from simpler properties.\n* modZGen - generate a verified ZZ modulo from a verified Nat modulo.\n-}\n\n\n\n{-\nZZ algebraic theorems\n-}\n\n\n\ntotal\ninvertByNegativity : ZZ -> ZZ -> ZZ\ninvertByNegativity x (Pos y) = x\ninvertByNegativity x (NegS y) = inverse x\n\ntotal\ntimesToAbs :\n\t(x, y : ZZ)\n\t-> (x `invertByNegativity` y) <.> y = x <.> Pos (absZ y)\ntimesToAbs (Pos x') (Pos y') = Refl\ntimesToAbs (Pos x') (NegS y') =\n\ttrans ( cong {f=((inverse $ Pos x')<.>) . NegS}\n\t\t$ sym $ multOneRightNeutral y' )\n\t$ ringNegationCancelsWithMult (Pos x') (Pos (S y'))\ntimesToAbs (NegS x') (Pos y') = Refl\ntimesToAbs (NegS x') (NegS y') = rewrite multOneRightNeutral x' in Refl\n\n\n\n{- (modNatFnIsRemainder) parameters -}\n\nparameters (\n\tmodNatFn : Nat -> Nat -> Nat\n\t, modNatFnIdModZero :\n\t\t(x : Nat)\n\t\t-> x `modNatFn` Z = x\n\t, modNatFnCharizLT :\n\t\t(x, m : Nat)\n\t\t-> (x `LT` m)\n\t\t-> x `modNatFn` m = x\n\t, modNatFnCharizGTE :\n\t\t(x, m : Nat)\n\t\t-> (m `plus` x) `modNatFn` m = x `modNatFn` m\n\t){\n\n\n\n{-\nLemmas for (modNatFnIsRemainder)\n\n* (modNatFnPreservesZero)\n* What to do with induction on constructed quotient-remainder pairs.\n-}\n\n\n\ntotal\nmodNatFnPreservesZero :\n\t(m : Nat) -> Z `modNatFn` m = Z\nmodNatFnPreservesZero Z = modNatFnIdModZero Z\nmodNatFnPreservesZero (S predm) = modNatFnCharizLT Z (S predm) $ LTESucc LTEZero\n\n\n\ntotal\nmodNatFnCharizModulusPlus2 :\n\t(x, m, k : Nat)\n\t-> x = (k `mult` m) `plus` (x `modNatFn` m)\n\t-> m `plus` x = (S k `mult` m) `plus` (x `modNatFn` m)\nmodNatFnCharizModulusPlus2 x m k pr\n\t= trans (cong {f=plus m} pr)\n\t$ plusAssociative m _ _\n\n-- by (modNatFnCharizModulusPlus2) & (modNatFnCharizGTE)\ntotal\nmodNatFnCharizModulusPlus :\n\t(x, m, k : Nat)\n\t-> x = (k `mult` m) `plus` (x `modNatFn` m)\n\t-> m `plus` x = (S k `mult` m) `plus` ((m `plus` x) `modNatFn` m)\nmodNatFnCharizModulusPlus x m k pr\n\t= trans (modNatFnCharizModulusPlus2 x m k pr)\n\t$ cong $ sym $ modNatFnCharizGTE x m\n\ntotal\nmodNatFnLTToDiffZ :\n\t(x, m : Nat)\n\t-> (x `LT` m)\n\t-> (Z `mult` m) `plus` (x `modNatFn` m) = x\nmodNatFnLTToDiffZ = modNatFnCharizLT\n\n\n\n{-\n(modNatFnIsRemainder):\nProof of the quotient-remainder expression for (modNatFn)\n\nProof of the quotient-remainder expression\nfor any natural in terms of any modulus\n-}\n\n\n\n{-\nProof sketch:\n\nEither x < m or x of the form m+x' for some x.\n(lteToSumExpr)\n\nIf m+x' then (modNatFnCharizModulusPlus):\n\nx = (k `mult` m) `plus` (x `modNatFn` m)\n-> m `plus` x = (S k `mult` m) `plus` ((m `plus` x) `modNatFn` m)\n\nso that (modNatFnCharizModulusPlus x' m)\napplied to\nthe divisor-remainder factorization for x'\ngives a divisor-remainder factorization for (m `plus` x')\nwhich by transitivity with the proof (x = m `plus` x')\ngives the divisor-remainder factorization for x.\nwwtbd.\n\n(multDistributesOverPlusRight), implicitly.\n(modNatFnLTToDiffZ)\n\n---\n\nTotality:\n\nThis proof recurses from an (x) of the form (m+x') into (x') when (m <= x).\nHowever, it only does so in cases where (m > 0).\nThus,\nm + x' = x\n==>\nx' = x - m < x\n\n---\n\nStructure:\n\nNote that the proof itself follows the recursion pattern of one modulo proof.\n\nThus, given a better modulo algorithm, there should be a corresponding\nbetter proof of the quotient-remainder property.\n\n-}\n\n\n\n%reflection\nmodNatFnIsRemainder :\n\t(x, m : Nat)\n\t-> (d : Nat ** (d `mult` m) `plus` (x `modNatFn` m) = x)\nmodNatFnIsRemainder Z _ = (0 ** modNatFnPreservesZero _)\nmodNatFnIsRemainder x Z = (0 ** modNatFnIdModZero _)\nmodNatFnIsRemainder x m\n\t= either\n\t\t(\\ltXM => (Z ** modNatFnLTToDiffZ x m ltXM))\n\t\t(\\gteXM =>\n\t\t\tlet gteXM' = lteRelToLTE $ either (Right . sym) Left gteXM\n\t\t\tin let xAsMPlus = lteToSumExpr x m gteXM'\n\t\t\tin let divremx' = modNatFnIsRemainder (getWitness xAsMPlus) m\n\t\t\tin let prevNatTChariz\n\t\t\t\t= modNatFnCharizModulusPlus\n\t\t\t\t\t(getWitness xAsMPlus)\n\t\t\t\t\tm\n\t\t\t\t\t(getWitness divremx')\n\t\t\t\t\t$ sym $ getProof divremx'\n\t\t\tin (S $ getWitness divremx'\n\t\t\t\t** sym\n\t\t\t\t$ trans (getProof xAsMPlus)\n\t\t\t\t$ trans prevNatTChariz\n\t\t\t\t$ rewrite (sym $ getProof xAsMPlus) in Refl))\n\t$ trichotomy x m\n\n} {- (modNatFnIsRemainder) parameters -}\n\n\n\n{- modZGen parameters -}\nparameters (\n\tmodN : Nat -> Nat -> Nat\n\t, quotientPartN : (x, m : Nat)\n\t\t-> (d : Nat ** (d `mult` m) `plus` (x `modN` m) = x)\n\t) {\n\ntotal\nmodZGenFn2 : ZZ -> ZZ -> ZZ\nmodZGenFn2 x m = Pos (absZ x `modN` absZ m)\n\ntotal\nmodZGenFn : ZZ -> ZZ -> ZZ\nmodZGenFn x@(Pos x') m = x `modZGenFn2` m\nmodZGenFn x@(NegS x') m = inverse $ inverse x `modZGenFn2` m\n\n{-\nBug: Registers as \"possibly not total due to recursive path\" in self,\nbut the pattern-matching recursion graph is\n\ncase NegS\n |\n v\ncase Pos (no call to (modZGenQuot) from Pos)\n\n-}\nmodZGenQuot : (x : ZZ) -> (m : ZZ)\n\t-> (x <-> (x `modZGenFn` m)) `quotientOverZZ` m\nmodZGenQuot x@(Pos x') m =\n\tlet quotientPartN' = quotientPartN x' (absZ m)\n\tin let witty = Pos (getWitness quotientPartN') `invertByNegativity` m\n\tin (witty\n\t\t** groupDivisionAddLToSubR\n\t\t\t(witty <.> m)\n\t\t\t(x `modZGenFn` m)\n\t\t\tx\n\t\t$ trans (cong {f=(<+>(Pos $ x' `modN` absZ m))}\n\t\t\t$ timesToAbs (Pos $ getWitness quotientPartN') m)\n\t\t$ cong {f=Pos} $ getProof quotientPartN'\n\t\t)\nmodZGenQuot x@(NegS x') m =\n\tquotientOverZZtrans\n\t(inverse Algebra.unity\n\t\t**\n\t\ttrans (ringOpIsDistributiveL (inverse Algebra.unity) (Pos $ S x') _)\n\t\t$ bileibniz (<+>)\n\t\t\t(cong $ plusZeroRightNeutral x')\n\t\t\t(trans (ringOpIsCommutative_ZZ _ _)\n\t\t\t$ cong {f=inverse . inverse . Pos . (\\t => t `modN` absZ m) . S}\n\t\t\t$ sym $ multOneRightNeutral x'\n\t\t\t)\n\t\t)\n\t$ modZGenQuot (Pos $ S x') m\n\n\n\n} {- modZGen parameters -}\n", "meta": {"hexsha": "7b68f3ff86c1e424b29261901c3f3afa041e8f36", "size": 6060, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/ZZ/ModuloVerification.idr", "max_stars_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_stars_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2016-07-12T15:25:52.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-14T05:43:48.000Z", "max_issues_repo_path": "Data/ZZ/ModuloVerification.idr", "max_issues_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_issues_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": 16, "max_issues_repo_issues_event_min_datetime": "2016-06-10T02:31:24.000Z", "max_issues_repo_issues_event_max_datetime": "2018-01-07T16:16:50.000Z", "max_forks_repo_path": "Data/ZZ/ModuloVerification.idr", "max_forks_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_forks_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "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": 22.8679245283, "max_line_length": 80, "alphanum_fraction": 0.6757425743, "num_tokens": 2179, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031737963569016, "lm_q2_score": 0.679178692681616, "lm_q1q2_score": 0.5454985290058109}}
{"text": "> module Real.Properties\n\n> import Real.Postulates\n\n> %default total\n> %access public export\n\n\n* Implementations:\n\n> ||| Real is an implementation of Num\n> implementation [NumReal] Num Real where\n>   (+) = plus\n>   (*) = mult\n>   fromInteger = fromNat . fromIntegerNat\n\n\n> using implementation NumReal\n>   ||| Real is an implementation of Neg\n>   implementation [NegReal] Neg Real where\n>     negate x = zero `minus` x\n>     (-) = minus\n\n\n> using implementation NumReal\n>   ||| Real is an implementation of Fractional\n>   implementation [FractionalReal] Fractional Real where\n>     (/) = div\n\n\n> using implementation NegReal\n>   |||\n>   minusLemma : {x : Real} -> x - x = 0\n\n\n> {-\n\n> ---}\n\n\n\n\n\n", "meta": {"hexsha": "dd9941db0b2b4ba7697588c2dfe75f3106408f9d", "size": 694, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "Real/Properties.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Real/Properties.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Real/Properties.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 15.7727272727, "max_line_length": 57, "alphanum_fraction": 0.644092219, "num_tokens": 189, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.815232489352, "lm_q2_score": 0.6688802669716107, "lm_q1q2_score": 0.5452929251216966}}
{"text": "module Sub06Apply36x9\r\n\r\nimport ProofColDivSeqBase\r\nimport ProofColDivSeqPostulate\r\n\r\n%default total\r\n-- %language ElabReflection\r\n\r\n\r\n-- 3(12x+3) --E[2,-4]--> 3x\r\ne36x9To3x :\r\n  (l:Nat) -> P (S (S (S (plus (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l))) (plus (plus l l) (plus l l)))))) 2 -> P l 2\r\ne36x9To3x l prf =\r\n  let prf2 = lvDown (S (S (S (plus (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l))) (plus (plus l l) (plus l l)))))) 2 prf in e36x9To3x' l prf2\r\n\r\nexport\r\napply36x9 : P (S (S (S (plus (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l))) (plus (plus l l) (plus l l)))))) 2\r\n  -> (m : Nat ** (LTE (S m) (S (S (S (plus (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l))) (plus (plus l l) (plus l l)))))), P m 2))\r\napply36x9 {l} col = let col2 = e36x9To3x l col in (l ** (lte36x9 l, col2)) where\r\n  lte36x9 : (l:Nat) -> LTE (S l) (S (S (S (plus (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l))) (plus (plus l l) (plus l l))))))\r\n  lte36x9 Z = (lteSuccRight . lteSuccRight . LTESucc) LTEZero\r\n  lte36x9 (S l) = let lemma = lte36x9 l in\r\n    rewrite (sym (plusSuccRightSucc l l)) in\r\n    rewrite (sym (plusSuccRightSucc (plus l l) (S (plus l l)))) in\r\n    rewrite (sym (plusSuccRightSucc (plus l l) (plus l l))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus l l) (plus l l))  (S (S (S (plus (plus l l) (plus l l))))))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus l l) (plus l l))  (S (S (plus (plus l l) (plus l l)))))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus l l) (plus l l))  (S (plus (plus l l) (plus l l))))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus l l) (plus l l))  (plus (plus l l) (plus l l)))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l)))  (S (S (S (plus (plus l l) (plus l l))))))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l)))  (S (S (plus (plus l l) (plus l l)))))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l)))  (S (plus (plus l l) (plus l l))))) in\r\n    rewrite (sym (plusSuccRightSucc (plus (plus (plus l l) (plus l l)) (plus (plus l l) (plus l l)))  (plus (plus l l) (plus l l)))) in\r\n      (lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . LTESucc) lemma\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "meta": {"hexsha": "dfa6cac8af67d4b9cc376a4b20bdb2f096e5aebb", "size": 2502, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "program/Sub06Apply36x9.idr", "max_stars_repo_name": "righ1113/collatzProof_DivSeq", "max_stars_repo_head_hexsha": "eef9da457fe77f0b58fb4407ab128d38ada9071e", "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": "program/Sub06Apply36x9.idr", "max_issues_repo_name": "righ1113/collatzProof_DivSeq", "max_issues_repo_head_hexsha": "eef9da457fe77f0b58fb4407ab128d38ada9071e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2019-01-26T12:59:21.000Z", "max_issues_repo_issues_event_max_datetime": "2019-10-19T07:02:00.000Z", "max_forks_repo_path": "program/Sub06Apply36x9.idr", "max_forks_repo_name": "righ1113/collatzProof_DivSeq", "max_forks_repo_head_hexsha": "eef9da457fe77f0b58fb4407ab128d38ada9071e", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 61.0243902439, "max_line_length": 187, "alphanum_fraction": 0.5935251799, "num_tokens": 1013, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8918110396870288, "lm_q2_score": 0.611381973294151, "lm_q1q2_score": 0.545237193249364}}
{"text": "module Prelude.Basics\n\nimport Builtin\n\n%default total\n\npublic export\nNot : Type -> Type\nNot x = x -> Void\n\n-----------------------\n-- UTILITY FUNCTIONS --\n-----------------------\n\n||| Manually assign a type to an expression.\n||| @ a the type to assign\n||| @ x the element to get the type\npublic export %inline\nthe : (0 a : Type) -> (1 x : a) -> a\nthe _ x = x\n\n||| Identity function.\npublic export %inline\nid : (1 x : a) -> a           -- Hopefully linearity annotation won't\n                              -- break equality proofs involving id\nid x = x\n\n||| Function that duplicates its input\npublic export\ndup : a -> (a, a)\ndup x = (x, x)\n\n||| Constant function.  Ignores its second argument.\npublic export %inline\nconst : a -> b -> a\nconst x = \\value => x\n\n||| Function composition.\npublic export %inline\n(.) : (b -> c) -> (a -> b) -> a -> c\n(.) f g = \\x => f (g x)\n\n||| Takes in the first two arguments in reverse order.\n||| @ f the function to flip\npublic export\nflip : (f : a -> b -> c) -> b -> a -> c\nflip f x y = f y x\n\n||| Function application.\npublic export\napply : (a -> b) -> a -> b\napply f a = f a\n\npublic export\ncurry : ((a, b) -> c) -> a -> b -> c\ncurry f a b = f (a, b)\n\npublic export\nuncurry : (a -> b -> c) -> (a, b) -> c\nuncurry f (a, b) = f a b\n\n-- $ is compiled specially to shortcut any tricky unification issues, but if\n-- it did have a type this is what it would be, and it might be useful to\n-- use directly sometimes (e.g. in higher order functions)\npublic export\n($) : forall a, b . ((x : a) -> b x) -> (x : a) -> b x\n($) f a = f a\n\n-------------------\n-- PROOF HELPERS --\n-------------------\n\n||| Equality is a congruence.\npublic export\ncong : (0 f : t -> u) -> (1 p : a = b) -> f a = f b\ncong f Refl = Refl\n\n||| Two-holed congruence.\nexport\n-- These are natural in equational reasoning.\ncong2 : (0 f : t1 -> t2 -> u) -> (1 p1 : a = b) -> (1 p2 : c = d) -> f a c = f b d\ncong2 f Refl Refl = Refl\n\n--------------\n-- BOOLEANS --\n--------------\n\n||| Boolean Data Type.\npublic export\ndata Bool = True | False\n\n||| Boolean NOT.\npublic export\nnot : (1 b : Bool) -> Bool\nnot True = False\nnot False = True\n\n||| Boolean AND only evaluates the second argument if the first is `True`.\npublic export\n(&&) : (1 b : Bool) -> Lazy Bool -> Bool\n(&&) True x = x\n(&&) False x = False\n\n||| Boolean OR only evaluates the second argument if the first is `False`.\npublic export\n(||) : (1 b : Bool) -> Lazy Bool -> Bool\n(||) True x = True\n(||) False x = x\n\n%inline\npublic export\nintToBool : Int -> Bool\nintToBool 0 = False\nintToBool x = True\n", "meta": {"hexsha": "106354b7023306d6868631dd174d2558da989a46", "size": 2545, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/prelude/Prelude/Basics.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/prelude/Prelude/Basics.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/prelude/Prelude/Basics.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.1304347826, "max_line_length": 82, "alphanum_fraction": 0.5693516699, "num_tokens": 786, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7248702761768248, "lm_q2_score": 0.7520125793176222, "lm_q1q2_score": 0.5451115660584112}}
{"text": "import Data.List\n\n\n\n\ndata Color = White | Yellow | Orange | Red | Green | Blue\ndata Piece = Up | Down | Left | Right | Front | Back -- \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438\n           | UpFL | UpFR | UpBL | UpBR | DownFL | DownFR | DownBL | DownBR\n           | LeftFU | LeftFD | LeftBU | LeftBD | RightFU | RightFD | RightBU | RightBD\n           | FrontUL | FrontUR | FrontDL | FrontDR | BackUL | BackUR | BackDL | BackDR\n\nrecord Cube where\n    constructor MkCube\n    stickers : List Color\n    pieces : List Piece\n    groups : List ( -- \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432\n                   List ( -- \u0441\u043f\u0438\u0441\u043e\u043a \u0433\u0440\u0443\u043f\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u043a\u043b\u0435\u0435\u043a\n                         List Piece)) -- \u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u043a\u043b\u0435\u0435\u043a\n    blocks : List (List Piece)\n\n                         \ncube1x1x1 : Cube\ncube1x1x1 = MkCube [White, Yellow, Orange, Red, Green, Blue]\n                   [Up, Down, Left, Right, Front, Back]\n                   [ [ [Up, Back, Down, Front] ], -- x\n                     [ [Up, Right, Down, Left] ], -- y\n                     [ [Front, Right, Back, Left] ] ] -- z\n                   []\n                     \ncube2x2x2 : Cube\ncube2x2x2 = MkCube [White, White, White, White, Yellow, Yellow, Yellow, Yellow,\n                    Orange, Orange, Orange, Orange, Red, Red, Red, Red,\n                    Green, Green, Green, Green, Blue, Blue, Blue, Blue]\n                   [UpFL, UpFR, UpBL, UpBR, DownFL, DownFR, DownBL, DownBR,\n                    LeftFU, LeftFD, LeftBU, LeftBD, RightFU, RightFD, RightBU, RightBD,\n                    FrontUL, FrontUR, FrontDL, FrontDR, BackUL, BackUR, BackDL, BackDR]\n                   [ [ [UpFL, BackUL, DownBL, FrontDL],\n                       [UpFR, BackUR, DownBR, FrontDR],\n                       [UpBL, BackDL, DownFL, FrontUL],\n                       [UpBR, BackDR, DownFR, FrontUR],\n                       [LeftFU, LeftBU, LeftBD, LeftFD],\n                       [RightFU, RightBU, RightBD, RightFD] ], -- x\n                     [ [UpFL, RightFU, DownFR, LeftFD],\n                       [UpFR, RightFD, DownFL, LeftFU],\n                       [UpBL, RightBU, DownBR, LeftBD],\n                       [UpBR, RightBD, DownBL, LeftBU],\n                       [FrontUL, FrontUR, FrontDR, FrontDL],\n                       [BackUL, BackUR, BackDR, BackDL] ], -- y\n                     [ [UpFL, BackUL, DownBL, FrontDL],\n                       [UpBL, BackDL, DownFL, FrontUL],\n                       [LeftFU, LeftBU, LeftBD, LeftFD] ] ] -- L\n                   []\n                       \ncube1x2x2 : Cube\ncube1x2x2 = ?hole122\n-- cube1x2x2 = record {blocks = []} cube2x2x2\n    \n    \n\n\ntoNat : Piece -> Nat\ntoNat Up = 0\ntoNat Down = 1\ntoNat Left = 2\ntoNat Right = 3\ntoNat Front = 4\ntoNat Back = 5\ntoNat UpFL = 0 -- zn as indexation list\ntoNat UpFR = 1\ntoNat UpBL = 2\ntoNat UpBR = 3\ntoNat DownFL = 4\ntoNat DownFR = 5\ntoNat DownBL = 6\ntoNat DownBR = 7\ntoNat LeftFU = 8\ntoNat LeftFD = 9\ntoNat LeftBU = 10\ntoNat LeftBD = 11\ntoNat RightFU = 12\ntoNat RightFD = 13\ntoNat RightBU = 14\ntoNat RightBD = 15\ntoNat FrontUL = 16\ntoNat FrontUR = 17\ntoNat FrontDL = 18\ntoNat FrontDR = 19\ntoNat BackUL = 20\ntoNat BackUR = 21\ntoNat BackDL = 22\ntoNat BackDR = 23\n    \nCast Piece Nat where\n    cast piece = toNat piece\n    \nEq Piece where\n    x == y = (toNat x) == (toNat y)\n\nCast (List Piece) (List Nat) where\n    cast [] = []\n    cast (x :: xs) = cast x :: cast xs\n    \nCast (List (List Piece)) (List (List Nat)) where\n    cast [] = []\n    cast (x :: xs) = cast x :: cast xs\n    \nEq (Nat, Color) where\n    (n1,_) == (n2,_) = n1 == n2\n\nOrd (Nat, Color) where\n    compare (n1,_) (n2,_) = compare n1 n2\n    \nShow Color where\n    show White = \"White\"\n    show Yellow = \"Yellow\"\n    show Orange = \"Orange\"\n    show Red = \"Red\"\n    show Green = \"Green\"\n    show Blue = \"Blue\"\n    \nShow Cube where\n    show cube = show (stickers cube)\n\n\nrotate : Nat -> Cube -> Maybe Cube\nrotate n cube = \n    let group = indexT n (groups cube) in\n        case checkBlocked group (blocks cube) of\n            True => Nothing\n            False => Just (record {stickers = multiperm (cast group) (stickers cube)} cube) where\n        \n    -- TODO stdlib\n    indexT : Nat -> List (List a) -> List a\n    indexT _ [] = []\n    indexT Z (x :: xs) = x\n    indexT (S k) (_ :: xs) = indexT k xs\n        \n    checkBlocked : List (List Piece) -> List (List Piece) -> Bool\n    checkBlocked xs ys = alienElem (flat xs) (flat ys) where\n        \n        -- TODO stdlib\n        flat : List (List a) -> List a\n        flat [] = []\n        flat ([] :: xxs) = flat xxs\n        flat (l@(x :: xs) :: xxs) = l ++ flat xxs \n        \n        -- TODO stdlib\n        isElem : Eq a => a -> List a -> Bool\n        isElem _ [] = False\n        isElem x (y :: ys) =\n            if x == y\n                then True\n                else isElem x ys\n                \n        alienElem : Eq a => (checked : List a) -> (checker : List a) -> Bool\n        alienElem [] _ = True -- not alien in first list\n        alienElem _ [] = False -- find alien in first list\n        alienElem (x :: xs) ys =\n            if isElem x ys\n                then alienElem xs ys\n                else False\n        \n\n    multiperm : List (List Nat) -> List Color -> List Color\n    multiperm [] xs = xs\n    multiperm (i :: is) xs = multiperm is (perm i xs) where\n\n        perm : List Nat -> List Color -> List Color\n        perm is xs = new 0 xs . sort . get 0 xs . sort $ zip is (shift is) where\n        \n            new : (index : Nat) -> (elems : List Color) -> (saved : List (Nat, Color)) -> List Color\n            new _ elems [] = elems\n            new n (elem :: elems) saved@((i, savedElem) :: saveds) =\n                if n == i\n                    then savedElem :: new (n+1) elems saveds\n                    else elem :: new (n+1) elems saved\n            new _ _ _ = []\n            \n            get : (index : Nat) -> (elems : List Color) -> (indexs : List (Nat, Nat)) -> List (Nat, Color)\n            get i (elem :: elems) indexs@((indexFrom, indexDest) :: indexsFromDest) =\n                if i == indexFrom\n                    then (indexDest, elem) :: get (i + 1) elems indexsFromDest\n                    else get (i + 1) elems indexs\n            get _ _ _ = []\n            \n            -- TODO stdlib\n            shift : List Nat -> List Nat \n            shift [] = []\n            shift (x :: xs) = xs ++ [x]\n\nmain : IO ()\nmain = putStrLn . show . rotate 1 $ cube2x2x2\n", "meta": {"hexsha": "07015af7a3ac7338d504f719343cf3d5806ff335", "size": 6390, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "cube.idr", "max_stars_repo_name": "mjdtdw/rubik", "max_stars_repo_head_hexsha": "bd15aa5a23a670be9f05594dfd9453b1672fb90b", "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": "cube.idr", "max_issues_repo_name": "mjdtdw/rubik", "max_issues_repo_head_hexsha": "bd15aa5a23a670be9f05594dfd9453b1672fb90b", "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": "cube.idr", "max_forks_repo_name": "mjdtdw/rubik", "max_forks_repo_head_hexsha": "bd15aa5a23a670be9f05594dfd9453b1672fb90b", "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": 33.1088082902, "max_line_length": 106, "alphanum_fraction": 0.50657277, "num_tokens": 1865, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8459424373085146, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5449773567564169}}
{"text": "data Input = Answer Int\n           | QuitCmd\n\ndata Command : Type -> Type where\n  PutStr : String -> Command ()\n  GetLine : Command String\n  Pure : ty -> Command ty\n  Bind : Command a -> (a -> Command b) -> Command b\n\ndata ConsoleIO : Type -> Type where\n  Quit : a -> ConsoleIO a\n  Do : Command a -> (a -> Inf (ConsoleIO b)) -> ConsoleIO b\n\nrunCommand : Command a -> IO a\nrunCommand (PutStr x) = putStr x\nrunCommand GetLine = getLine\nrunCommand (Pure val) = pure val\nrunCommand (Bind c f) = do res <- runCommand c\n                           runCommand (f res)\n\n\nnamespace CommandDo\n  (>>=) : Command a -> (a -> Command b) -> Command b\n  (>>=) = Bind\n\nnamespace ConsoleDo\n  (>>=) : Command a -> (a -> Inf (ConsoleIO b)) -> ConsoleIO b\n  (>>=) = Do\n\nreadInput : (prompt : String) -> Command Input\nreadInput prompt = do PutStr prompt\n                      answer <- GetLine\n                      if toLower answer == \"quit\"\n                         then Pure QuitCmd\n                         else Pure (Answer (cast answer))\n\n\nmutual\n  correct : Stream Int -> (score : Nat) -> (questions : Nat) -> ConsoleIO Nat\n  correct nums score questions\n    = do PutStr \"Correct!\\n\"\n         quiz nums (score + 1) (questions + 1)\n\n  wrong : Stream Int -> Int -> (score : Nat) -> (questions : Nat)\n    -> ConsoleIO Nat\n  wrong nums ans score questions\n    = do PutStr (\"Wrong the answer is \" ++ show ans ++ \"\\n\")\n         quiz nums score (questions + 1)\n\n  quiz : Stream Int -> (score : Nat) -> (questions : Nat) -> ConsoleIO Nat\n  quiz (num1 :: num2 :: nums) score questions\n    = do PutStr (\"Score so far: \" ++ show score ++ \"\\n\")\n         input <- readInput (show num1 ++ \" * \" ++ show num2 ++ \"? \") \n         case input of\n              Answer answer => if answer == num1 * num2\n                                  then correct nums score questions\n                                  else wrong nums (num1 * num2) score questions\n              QuitCmd => Quit score\n", "meta": {"hexsha": "36031749a3bfb92b1edebcd6d2413cd3390ca502", "size": 1952, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type_driven_book/chp11/ArithCmdDo.idr", "max_stars_repo_name": "Ryxai/idris_book_notes", "max_stars_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "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_driven_book/chp11/ArithCmdDo.idr", "max_issues_repo_name": "Ryxai/idris_book_notes", "max_issues_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_issues_repo_licenses": ["MIT"], "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_driven_book/chp11/ArithCmdDo.idr", "max_forks_repo_name": "Ryxai/idris_book_notes", "max_forks_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_forks_repo_licenses": ["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.0847457627, "max_line_length": 79, "alphanum_fraction": 0.5527663934, "num_tokens": 511, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303186696747, "lm_q2_score": 0.6893056167854461, "lm_q1q2_score": 0.5449169888981954}}
{"text": "import Data.Vect\n\nreadVect : IO (len ** Vect len String)\nreadVect = do x <- getLine\n              if (x == \"\")\n                    then pure (_ ** [])\n                    else do (_ ** xs) <- readVect\n                            pure (_ ** x :: xs)\n\nzipInputs : IO ()\nzipInputs = do putStrLn \"Enter first vector (blank line to end):\"\n               (len1 ** vec1) <- readVect\n               putStrLn \"Enter second vector (blank line to end):\"\n               (len2 ** vec2) <-readVect\n               (case exactLength len1 vec2 of\n                     Nothing => putStrLn \"Vectors are of different lengths\"\n                     (Just vec2') => printLn (zip vec1 vec2'))\n", "meta": {"hexsha": "749df96f1ccb2fd3490ca53a6054d701ad9adb42", "size": 669, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type_driven_book/chp5/zipvect.idr", "max_stars_repo_name": "Ryxai/idris_book_notes", "max_stars_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "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_driven_book/chp5/zipvect.idr", "max_issues_repo_name": "Ryxai/idris_book_notes", "max_issues_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_issues_repo_licenses": ["MIT"], "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_driven_book/chp5/zipvect.idr", "max_forks_repo_name": "Ryxai/idris_book_notes", "max_forks_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_forks_repo_licenses": ["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.1666666667, "max_line_length": 75, "alphanum_fraction": 0.4783258595, "num_tokens": 152, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6825737344123242, "lm_q2_score": 0.7981867753392728, "lm_q1q2_score": 0.5448213280018582}}
{"text": "module ExampleDetectableErrors\n\nimport Data.Nat\nimport Data.Vect\nimport Data.List\nimport LinearTypes\nimport Control.Linear.LIO\nimport Unitary\nimport QStateT\nimport System.Random\nimport Injection\nimport Complex\nimport QuantumOp\nimport Examples\n\n-------------------------------------- Impossible Unitaries ---------------------------------------\n-- In this example, we try to apply a Hadamard gate on a non-existing wire (index 4 on a gate of size 3)\n\nbrokenH : Unitary 3\n--brokenH = H 4 toffoli\n\n-- Error: While processing right hand side of brokenH. Can't find an implementation for == (compare 4 3) LT = True.\n\n\n\n\n-- In this example, we try to apply the control and the target of a CNOT on the same wire\n\nbrokenCNOT : Unitary 2\n--brokenCNOT = CNOT 1 1 IdGate\n\n-- Error: While processing right hand side of brokenCNOT. Can't find an implementation for not (== 1 1) = True.\n\n\n\n\n-- In this example, we try to apply a circuit on a non existing wire (index 4 on a gate of size 3)\n\nbrokenApply1 : Unitary 3\n--brokenApply1 = apply toBellBasis toffoli [1,4]\n\n-- Error: While processing right hand side of brokenApply1. Can't find an implementation for allSmaller [1, 4] 3 && Delay (allDifferent [1, 4]) = True.\n\n\n\n\n-- In this example, we try to apply a circuit twice on the same wire\n\nbrokenApply2 : Unitary 3\n--brokenApply2 = apply toffoli IdGate [1,2,1]\n\n-- Error: While processing right hand side of brokenApply2. Can't find an implementation for allSmaller [1, 2, 1] 3 && Delay (allDifferent [1, 2,1]) = True.\n\n\n--------------------------------- BROKEN QUANTUM STATE OPERATIONS ---------------------------------\n\n-- In this example, wew try to reuse a qubit that has be measured\n\nbrokenOp1 : IO (Vect 4 Bool)\n{-brokenOp1  = \n  run (do\n      [q1,q2,q3,q4] <- newQubits {t = SimulatedOp} 4\n      [b3] <- measure [q3]\n      [r4,r3,r1] <- applyUnitary [q4,q3,q1] (X 0 IdGate) --trying to reuse q3\n      [b1,b4,b2] <- measure [r1,r4,q2]\n      pure ([b1,b2,b3,b4])\n      )\n      -} \n-- Error: While processing right hand side of brokenOp1. q3 is not accessible in this context.\n\n\n\n-- In this example, we try to copy a qubit\n\nbrokenOp2 : IO (Vect 5 Bool)\n{-brokenOp2 = \n  run (do\n      [q1,q2,q3,q4] <- newQubits {t = SimulatedOp} 4\n      [b3] <- measure [q3]\n      [q4,q1,q5] <- applyUnitary [q4,q1,q4] (X 0 IdGate) --trying to copy q4\n      [b1,b2,b5] <- measure [q1,q2,q5]\n      pure [b1,b2,b3,b5,b5]\n      )\n      -}\n--Error : While processing right hand side of brokenOp2. There are 2 uses of linear name q4. \n\n\n\n-- In this example, we try to reuse a pointer to an old state of a qubit (the state of the qubit has been modified)\n\nbrokenOp3 : IO (Vect 4 Bool)\n{-brokenOp3  = \n  run (do\n      [q1,q2,q3,q4] <- newQubits {t = SimulatedOp} 4\n      [b3] <- measure [q3]\n      [r4,r2,r1] <- applyUnitary [q4,q2,q1] (X 0 IdGate) \n      [b1,b4,b2] <- measure [r1,r4,q2] --trying to reuse the name q2\n      pure ([b1,b2,b3,b4])\n      )\n      -}\n--Error: While processing right hand side of brokenOp2. q2 is not accessible in this context.\n\n", "meta": {"hexsha": "756ee1864291642e23a48862c61c7b975175c494", "size": 3026, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "ExampleDetectableErrors.idr", "max_stars_repo_name": "zamdzhiev/Qimaera", "max_stars_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2021-08-24T14:36:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-24T00:36:11.000Z", "max_issues_repo_path": "ExampleDetectableErrors.idr", "max_issues_repo_name": "zamdzhiev/Qimaera", "max_issues_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ExampleDetectableErrors.idr", "max_forks_repo_name": "zamdzhiev/Qimaera", "max_forks_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_forks_repo_licenses": ["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.3786407767, "max_line_length": 156, "alphanum_fraction": 0.641440846, "num_tokens": 948, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7981867777396212, "lm_q2_score": 0.6825737279551494, "lm_q1q2_score": 0.5448213244862414}}
{"text": "module Linear\n\npublic export\ndata Usage = Once | Many\n\npublic export\ndata Use : Usage -> (Type -> Type) -> Type -> Type where\n     Pure : (1 x : a) -> Use t m a\n     BindOnce : (1 act : Use Once m a) -> (1 k : (1 x : a) -> Use t m b) -> Use t m b\n     BindMany : (1 act : Use Many m a) -> (1 k : (x : a) -> Use t m b) -> Use t m b\n\npublic export\ncontType : (Type -> Type) -> Usage -> Usage -> Type -> Type -> Type\ncontType m Once q a b = ((1 x : a) -> Use q m b)\ncontType m Many q a b = ((x : a) -> Use q m b)\n\npublic export\n(>>=) : {p : _} -> (1 f : Use p m a) -> (1 k : contType m p q a b) -> Use q m b\n(>>=) {p = Once} = BindOnce\n(>>=) {p = Many} = BindMany\n\npublic export\npure : (1 x : a) -> Use t m a\npure = Pure\n\npublic export\nOne : (Type -> Type) -> Type -> Type\nOne = Use Once\n\npublic export\nAny : (Type -> Type) -> Type -> Type\nAny = Use Many\n", "meta": {"hexsha": "e93d70f138c74f0fb71621224d853a5c6a1ca17f", "size": 852, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/linear005/Linear.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/linear005/Linear.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/linear005/Linear.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 25.8181818182, "max_line_length": 85, "alphanum_fraction": 0.5363849765, "num_tokens": 308, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711832583695, "lm_q2_score": 0.640635868562172, "lm_q1q2_score": 0.5445220272395427}}
{"text": "module Main\n\nimport Backprop\nimport Control.Algebra\nimport Control.Optics\nimport Data.List.Quantifiers\nimport Data.Nat\nimport Data.Num\nimport Data.String.Extra\nimport Data.Vect\nimport Debug.Trace\nimport Linear\nimport Linear.Backprop\nimport Linear.Math\nimport Linear.Random\nimport NN.Dense\nimport Utils.String\n\nrecord Params where\n  constructor MkParams\n  dense1 : Dense 2 3 Double\n  dense2 : Dense 3 1 Double\n\nldense1 : Simple Lens ? ?\nldense1 = lens dense1 $ \\s, b => { dense1 := b } s\n\nldense2 : Simple Lens ? ?\nldense2 = lens dense2 $ \\s, b => { dense2 := b } s\n\nFromDouble Params where\n  fromDouble x = MkParams (fromDouble x) (fromDouble x)\n\nCanBack Params where\n  zero = MkParams zero zero\n  one = MkParams one one\n  add (MkParams a1 a2) (MkParams b1 b2) = MkParams (add a1 b1) (add a2 b2)\n\nNum Params where\n  (+) = add\n  MkParams a1 a2 * MkParams b1 b2 = MkParams (a1 * b1) (a2 * b2)\n  fromInteger x = MkParams (fromInteger x) (fromInteger x)\n\nNeg Params where\n  MkParams a1 a2 - MkParams b1 b2 = MkParams (a1 - b1) (a2 - b2)\n  negate (MkParams a1 a2) = MkParams (negate a1) (negate a2)\n\nShow Params where\n  show params = show_record \"MkParams\" [(\"dense1\", show params.dense1), (\"dense2\", show params.dense2)]\n\nmodel : {n : _} -> Node i Params -> Node i (T [n, 2] Double) -> Node i (T [n, 1] Double)\nmodel p = sigmoid . apply (p ^. ldense2) . sigmoid . apply (p ^. ldense1)\n\nloss : {a, n : _} -> Neg a => CanBack a => Floating a => (y : Node i (T [n, 1] a)) -> (y' : Node i (T [n, 1] a)) -> Node i a\nloss y y' = asum $ asum $ square (y - y')\n\ngd : {loss_t : _} -> (Neg params_t, Num params_t, CanBack params_t, CanBack loss_t, FromDouble params_t) => (loss_node : Node params_t loss_t) -> (params : params_t) -> (learning_rate : Double) -> (loss_t, params_t)\ngd loss_node params alpha = let (loss, grads) = backprop loss_node params in (loss, params - fromDouble alpha * grads)\n\ngdn : {loss_t : _} -> HasIO m => (Neg params_t, Show loss_t, Show params_t, Num params_t, CanBack params_t, CanBack loss_t, FromDouble params_t) => (iterations : Nat) -> (loss_node : Node params_t loss_t) -> (params : params_t) -> (learning_rate : Double) -> m params_t\ngdn Z loss_node params alpha = pure params\ngdn (S i) loss_node params alpha = do\n  let (loss, params) = gd loss_node params alpha\n  putStrLn $ \"\\{show i}: loss: \\{show loss}\"\n  gdn i loss_node params alpha\n\nmain : IO ()\nmain = do\n  putStrLn \"begin\"\n  let x = the (T [_, _] Double) $ [[0, 0], [0, 1], [1, 0], [1, 1]]\n  let y' = the (T [_, _] Double) $ [[0], [1], [1], [0]]\n  params <- pure $ MkParams (MkDense !rand_m !rand_v) (MkDense !rand_m !rand_v)\n  params <- gdn 100 (loss (model input (const x)) (const y')) params pi\n  printLn \"done\"\n", "meta": {"hexsha": "1e7c3946ee97f8a1cf0f35722d96e213aea5437c", "size": 2697, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Examples/XOR.idr", "max_stars_repo_name": "tensorknower69/idris2-ml", "max_stars_repo_head_hexsha": "2ab861b50554e2b11a8ba32f1efec9d1f84e5d7c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-01-30T20:10:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-30T20:10:19.000Z", "max_issues_repo_path": "src/Examples/XOR.idr", "max_issues_repo_name": "tensorknower69/idris2-ml", "max_issues_repo_head_hexsha": "2ab861b50554e2b11a8ba32f1efec9d1f84e5d7c", "max_issues_repo_licenses": ["MIT"], "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/Examples/XOR.idr", "max_forks_repo_name": "tensorknower69/idris2-ml", "max_forks_repo_head_hexsha": "2ab861b50554e2b11a8ba32f1efec9d1f84e5d7c", "max_forks_repo_licenses": ["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.4459459459, "max_line_length": 269, "alphanum_fraction": 0.6662958843, "num_tokens": 907, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8902942232112239, "lm_q2_score": 0.611381973294151, "lm_q1q2_score": 0.5443098389992613}}
{"text": "-- Exercises.idr\n-- Solutions for exercises of chapter 1\n\nmodule Exercises\n\n-- Check if words are palindromes\n\n||| Checks whether the given word is a palindrome\n||| The check is case-insensitive\n||| @str A string to be checked\nexport\npalindrome : (str : String) -> Bool\npalindrome str = let lstr = toLower str\n                     rev = reverse lstr in\n                     lstr == rev\n\n||| Checks whether the given word is a palindrome\n||| The check is case-insensitive and a minimum word\n||| length is required.\n||| @minLen Minimum required word length for palindrome\n||| @str A string to be checked\nexport\npalindromeMinLen : (minLen : Nat) -> (str : String) -> Bool\npalindromeMinLen minLen str = let wordLength = length str\n                                  lstr = toLower str\n                                  rev = reverse lstr in\n                                  (wordLength > minLen) && (lstr == rev)\n\n\n-- Count words & characters\n\n||| Counts the number of words and characters of the given string.\n||| Whitespace is ignored.\n||| @str A string to be counted\nexport\ncounts : (str : String) -> (Nat, Nat)\ncounts str = let ww = words str\n                 numWords = length ww\n                 numChars = sum (map length ww) in\n                 (numWords, numChars)\n\n||| Counts the number of words and characters of the given string.\n||| Whitespace is included..\n||| @str A string to be counted\nexport\ncountWithSpace : (str : String) -> (Nat, Nat)\ncountWithSpace str = let ww = words str\n                         numWords = length ww\n                         numChars = length str in\n                         (numWords, numChars)\n\n\n-- Extract top 10 values\n\n||| Extracts the 10 largest values from given list\n||| ('top ten')\n||| @l List with numeric values\nexport\ntop_ten : Ord a => (l : List a) -> List a\ntop_ten l = take 10 $ reverse $ sort l\n\n\n-- Count strings over given length\n\n||| Counts the number of strings wiht length\n||| larger than given limit\n||| @len A Nat of length limit\n||| @strs A list of string\nexport\nover_length : (len : Nat) -> (strs : List String) -> Nat\nover_length len strs = length $ filter (\\w => (length w) > len) strs\n\n\n", "meta": {"hexsha": "06fb283651724a2324c830dc3c2af2930a2501d5", "size": 2153, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Idris/TDD/Chapter_2/Exercises.idr", "max_stars_repo_name": "kkirstein/proglang-playground", "max_stars_repo_head_hexsha": "d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd", "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": "Idris/TDD/Chapter_2/Exercises.idr", "max_issues_repo_name": "kkirstein/proglang-playground", "max_issues_repo_head_hexsha": "d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Idris/TDD/Chapter_2/Exercises.idr", "max_forks_repo_name": "kkirstein/proglang-playground", "max_forks_repo_head_hexsha": "d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd", "max_forks_repo_licenses": ["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.0945945946, "max_line_length": 72, "alphanum_fraction": 0.6126335346, "num_tokens": 538, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6926419704455589, "lm_q2_score": 0.7853085758631159, "lm_q1q2_score": 0.5439376793936243}}
{"text": "module Derive.TestDefs\n\ndata W : (a : Type) -> (a -> Type) -> Type where\n  Sup : (x : a) -> (p x -> W a p) -> W a p\n", "meta": {"hexsha": "1d58dd5c3380915071ae6adbd7ae2a7696920a8d", "size": 116, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Derive/TestDefs.idr", "max_stars_repo_name": "Garnasha/derive-all-the-instances", "max_stars_repo_head_hexsha": "e6615e3dd5737cb1b8a085a57d4ea1efa5c99366", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 31, "max_stars_repo_stars_event_min_datetime": "2016-01-15T17:35:53.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-03T17:38:58.000Z", "max_issues_repo_path": "src/Derive/TestDefs.idr", "max_issues_repo_name": "Garnasha/derive-all-the-instances", "max_issues_repo_head_hexsha": "e6615e3dd5737cb1b8a085a57d4ea1efa5c99366", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2016-10-18T12:25:57.000Z", "max_issues_repo_issues_event_max_datetime": "2018-09-09T17:16:56.000Z", "max_forks_repo_path": "src/Derive/TestDefs.idr", "max_forks_repo_name": "Garnasha/derive-all-the-instances", "max_forks_repo_head_hexsha": "e6615e3dd5737cb1b8a085a57d4ea1efa5c99366", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 9, "max_forks_repo_forks_event_min_datetime": "2016-05-09T18:49:01.000Z", "max_forks_repo_forks_event_max_datetime": "2018-07-02T03:05:59.000Z", "avg_line_length": 23.2, "max_line_length": 48, "alphanum_fraction": 0.4913793103, "num_tokens": 46, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8438951104066293, "lm_q2_score": 0.6442251201477015, "lm_q1q2_score": 0.5436584288937686}}
{"text": "module Main\n\nrep : (n : Nat) -> a -> List a\nrep Z x = []\nrep (S k) x = x :: rep k x\n\ndata RLE : List Char -> Type where\n     REnd  : RLE []\n     RChar : (n : Nat) -> (c : Char) -> (rs : RLE xs) ->\n             RLE (rep n c ++ xs)\n\n------------\n\nrle : (xs : List Char) -> RLE xs\nrle [] = REnd\nrle (x :: xs) with (rle xs)\n  rle (x :: []) | REnd = RChar 1 x REnd\n  rle (x :: (rep n c ++ ys)) | (RChar n c rs) with (decEq x c)\n    rle (x :: (rep n x ++ ys)) | (RChar n x rs) | (Yes refl) \n             = RChar (S n) x rs\n    rle (x :: (rep n c ++ ys)) | (RChar n c rs) | (No f) \n             = RChar 1 x (RChar n c rs)\n\ncompress : List Char -> String\ncompress xs with (rle xs)\n  compress [] | REnd = \"\" \n  compress (rep n c ++ ys) | (RChar n c rs) \n         = show n ++ strCons c (compress ys)\n\ncompressString : String -> String\ncompressString xs = compress (unpack xs)\n\nmain : IO ()\nmain = putStrLn (compressString \"foooobaaaarbaaaz\")\n", "meta": {"hexsha": "9de8bdba2c9933c9b4754ceaa3d89efa6fd05e53", "size": 932, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "RLE/rle.idr", "max_stars_repo_name": "silky/idris-demos", "max_stars_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-06-27T11:33:51.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-27T11:33:51.000Z", "max_issues_repo_path": "RLE/rle.idr", "max_issues_repo_name": "silky/idris-demos", "max_issues_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "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": "RLE/rle.idr", "max_forks_repo_name": "silky/idris-demos", "max_forks_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "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.6285714286, "max_line_length": 62, "alphanum_fraction": 0.508583691, "num_tokens": 338, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8577680904463334, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.5433191123440495}}
{"text": "import Data.Vect\n\ndvec : (n : Nat) -> {default (replicate n 1) xs : Vect n Nat} -> Nat\ndvec n = foldr (+) Z xs\n\n", "meta": {"hexsha": "c84a21872984b0c8d5638c8f3c4b2c4f47f8c04f", "size": 112, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic036/defimp.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/basic036/defimp.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/basic036/defimp.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.6666666667, "max_line_length": 68, "alphanum_fraction": 0.5892857143, "num_tokens": 43, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8289388252252041, "lm_q2_score": 0.6548947290421276, "lm_q1q2_score": 0.5428676673383597}}
{"text": "module Main\n\ndata Identity a = Id a\n\nrunIdentity : Identity a -> a\nrunIdentity (Id a) = a\n\ninstance Functor Identity where\n  map f (Id x) = Id (f x)\n\ninstance Applicative Identity where\n  pure = Id\n  (Id f) <$> (Id x) = Id (f x)\n\ninstance Monad Identity where\n  (Id m) >>= f = f m\n\ndata Source : {r : Type} -> (m : Type -> Type) -> (a : Type) -> Type where\n  Src : (r -> (r -> a -> m r) -> m r) -> Source {r} m a\n\nrunSource : {r : Type} -> Source {r} m a -> r -> (r -> a -> m r) -> m r\nrunSource (Src await) = await\n\nConduit : {r : Type} -> Type -> (Type -> Type) -> Type -> Type\nConduit {r} a m b = Source {r} m a -> Source {r} m b\n\nSink : {r : Type} -> Type -> (Type -> Type) -> Type -> Type\nSink {r} a m s = Source {r} m a -> m s\n\ninstance Functor (Source {r} m) where\n    map f (Src await) = Src $ \\z, yield => await z (\\r => yield r . f)\n\nfoldM : Monad m => (r -> a -> m r) -> r -> List a -> m r\nfoldM f z []        = return z\nfoldM f z (x :: xs) = f z x >>= flip (foldM f) xs\n\nsource : {r : Type} -> (r -> (r -> a -> m r) -> m r) -> Source {r} m a\nsource = Src\n\nsourceList : Monad m => List a -> Source m a\nsourceList xs = source $ \\z, yield => foldM yield z xs\n\nmapC : Monad m => {r : Type} -> (a -> b) -> Conduit {r} a m b\nmapC = map\n\nsinkList : Monad m => Sink {r = List a} a m (List a)\nsinkList (Src await) = await Prelude.List.Nil (\\xs, x => return (x :: xs))\n\nmain : IO ()\nmain = print $ runIdentity $ sinkList $ mapC (+1) $ sourceList [1..10]\n", "meta": {"hexsha": "2ff05c1310ab0529bd83762ab3b8af8210fa45e7", "size": 1456, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Conduit/Simple.idr", "max_stars_repo_name": "jwiegley/simple-conduit", "max_stars_repo_head_hexsha": "a4c7e9d447b3321e91c0a5aa7872ec8d4c1bc283", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 13, "max_stars_repo_stars_event_min_datetime": "2015-01-27T23:13:48.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-28T13:21:32.000Z", "max_issues_repo_path": "Conduit/Simple.idr", "max_issues_repo_name": "jwiegley/simple-conduit", "max_issues_repo_head_hexsha": "a4c7e9d447b3321e91c0a5aa7872ec8d4c1bc283", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2015-02-15T19:32:12.000Z", "max_issues_repo_issues_event_max_datetime": "2015-02-16T22:35:26.000Z", "max_forks_repo_path": "Conduit/Simple.idr", "max_forks_repo_name": "jwiegley/simple-conduit", "max_forks_repo_head_hexsha": "a4c7e9d447b3321e91c0a5aa7872ec8d4c1bc283", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2017-05-27T15:25:38.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-28T13:21:44.000Z", "avg_line_length": 28.5490196078, "max_line_length": 74, "alphanum_fraction": 0.5432692308, "num_tokens": 517, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8289388167733099, "lm_q2_score": 0.6548947290421275, "lm_q1q2_score": 0.5428676618032586}}
{"text": "module Collections.BSTree.Set.Core\n\nimport Collections.Util.Bnd\nimport Collections.BSTree.Map.Core as M\nimport Decidable.Order.Strict\n\n||| A verified binary search tree with erased proofs.\n|||\n||| The keys in the tree are constrained by min/max bounds, which make use of `Bnd` to extend the\n||| tree key type with `Top` and `Bot` values. This allows for a natural way to leave bounds\n||| unconstrained (by having a minimum of `Bot` or a maximum of `Top`).\n|||\n||| @ ord The ordering implementations used in the tree. Since these are w.r.t. a type `kTy`, the\n|||       type of tree keys is defined implicitly by `ord`.\n||| @ min The minimum value constraint, proving that `sto min (Mid x)` for all values `x` in the\n|||       tree.\n||| @ max The maximum value constraint, proving that `sto (Mid x) max` for all values `x` in the\n|||       tree.\npublic export\nBST : {0 sto : kTy -> kTy -> Type} ->\n      (pre : StrictPreorder kTy sto) ->\n      (tot : StrictOrdered kTy sto) ->\n      (0 min,max : Bnd kTy) ->\n      Type\nBST pre tot min max = M.BST pre tot () min max\n%name Collections.BSTree.Set.Core.BST t,u,v\n\n||| A verified binary search tree with erased proofs.\n|||\n||| This is an alias for the more generic `BST` (which accepts min/max bounds for its contents).\n||| The bounds are necessary for verifying the structure of a tree, but the root node of any\n||| `BST` will always be unconstrained. So generally, `BST` can be considered an implementation\n||| detail.\n|||\n||| @ ord The strict total ordering used in the tree. Since a `StrictOrdered` impl is w.r.t. a type\n|||       `kTy`, the type of tree values is defined implicitly by `ord`.\npublic export\nBSTree : {0 kTy : Type} ->\n         (0 sto : kTy -> kTy -> Type) ->\n         {auto pre : StrictPreorder kTy sto} ->\n         {auto tot : StrictOrdered kTy sto} ->\n         Type\nBSTree sto {pre} {tot} = M.BST pre tot () Bot Top\n%name Collections.BSTree.Set.Core.BSTree t,u,v\n", "meta": {"hexsha": "eb02faaa5801db49777aadf8e104b2beeaae887f", "size": 1930, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Collections/BSTree/Set/Core.idr", "max_stars_repo_name": "polendri/idris-collections", "max_stars_repo_head_hexsha": "8492ab9ceffdef72d25a65c6b4296e561816f73c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-11-24T10:58:23.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-20T16:16:04.000Z", "max_issues_repo_path": "src/Collections/BSTree/Set/Core.idr", "max_issues_repo_name": "polendri/idris-collections", "max_issues_repo_head_hexsha": "8492ab9ceffdef72d25a65c6b4296e561816f73c", "max_issues_repo_licenses": ["MIT"], "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/Collections/BSTree/Set/Core.idr", "max_forks_repo_name": "polendri/idris-collections", "max_forks_repo_head_hexsha": "8492ab9ceffdef72d25a65c6b4296e561816f73c", "max_forks_repo_licenses": ["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.8888888889, "max_line_length": 99, "alphanum_fraction": 0.6689119171, "num_tokens": 531, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8244619350028204, "lm_q2_score": 0.658417487156366, "lm_q1q2_score": 0.5428401555006322}}
{"text": "module Prelude.Num\n\nimport Builtin\nimport Prelude.Basics\nimport Prelude.EqOrd\nimport Prelude.Ops\n\n%default total\n\n------------------------\n-- NUMERIC INTERFACES --\n------------------------\n\n%integerLit fromInteger\n\n||| The Num interface defines basic numerical arithmetic.\npublic export\ninterface Num ty where\n  constructor MkNum\n  (+) : ty -> ty -> ty\n  (*) : ty -> ty -> ty\n  ||| Conversion from Integer.\n  fromInteger : Integer -> ty\n\n%allow_overloads fromInteger\n\n||| The `Neg` interface defines operations on numbers which can be negative.\npublic export\ninterface Num ty => Neg ty where\n  constructor MkNeg\n  ||| The underlying of unary minus. `-5` desugars to `negate (fromInteger 5)`.\n  negate : ty -> ty\n  (-) : ty -> ty -> ty\n\n||| Numbers for which the absolute value is defined should implement `Abs`.\npublic export\ninterface Num ty => Abs ty where\n  constructor MkAbs\n  ||| Absolute value.\n  abs : ty -> ty\n\npublic export\ninterface Num ty => Fractional ty where\n  constructor MkFractional\n  partial\n  (/) : ty -> ty -> ty\n  partial\n  recip : ty -> ty\n\n  recip x = 1 / x\n\npublic export\ninterface Num ty => Integral ty where\n  constructor MkIntegral\n  partial\n  div : ty -> ty -> ty\n  partial\n  mod : ty -> ty -> ty\n\n----- Instances for primitives\n\n-- Integer\n\n%inline\npublic export\nNum Integer where\n  (+) = prim__add_Integer\n  (*) = prim__mul_Integer\n  fromInteger = id\n\n%inline\npublic export\nNeg Integer where\n  negate x = prim__sub_Integer 0 x\n  (-) = prim__sub_Integer\n\npublic export\nAbs Integer where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Integer where\n  div x y\n      = case y == 0 of\n             False => prim__div_Integer x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Integer x y\n\n-- This allows us to pick integer as a default at the end of elaboration if\n-- all other possibilities fail. I don't plan to provide a nicer syntax for\n-- this...\n%defaulthint\n%inline\npublic export\ndefaultInteger : Num Integer\ndefaultInteger = %search\n\n-- Int\n\n%inline\npublic export\nNum Int where\n  (+) = prim__add_Int\n  (*) = prim__mul_Int\n  fromInteger = prim__cast_IntegerInt\n\n%inline\npublic export\nNeg Int where\n  negate x = prim__sub_Int 0 x\n  (-) = prim__sub_Int\n\npublic export\nAbs Int where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Int where\n  div x y\n      = case y == 0 of\n             False => prim__div_Int x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Int x y\n\n-- Int8\n\n%inline\npublic export\nNum Int8 where\n  (+) = prim__add_Int8\n  (*) = prim__mul_Int8\n  fromInteger = prim__cast_IntegerInt8\n\n%inline\npublic export\nNeg Int8 where\n  negate x = prim__sub_Int8 0 x\n  (-) = prim__sub_Int8\n\npublic export\nAbs Int8 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Int8 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Int8 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Int8 x y\n\n-- Int16\n\n%inline\npublic export\nNum Int16 where\n  (+) = prim__add_Int16\n  (*) = prim__mul_Int16\n  fromInteger = prim__cast_IntegerInt16\n\n%inline\npublic export\nNeg Int16 where\n  negate x = prim__sub_Int16 0 x\n  (-) = prim__sub_Int16\n\npublic export\nAbs Int16 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Int16 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Int16 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Int16 x y\n\n-- Int32\n\n%inline\npublic export\nNum Int32 where\n  (+) = prim__add_Int32\n  (*) = prim__mul_Int32\n  fromInteger = prim__cast_IntegerInt32\n\n%inline\npublic export\nNeg Int32 where\n  negate x = prim__sub_Int32 0 x\n  (-) = prim__sub_Int32\n\npublic export\nAbs Int32 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Int32 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Int32 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Int32 x y\n\n-- Int64\n\n%inline\npublic export\nNum Int64 where\n  (+) = prim__add_Int64\n  (*) = prim__mul_Int64\n  fromInteger = prim__cast_IntegerInt64\n\n%inline\npublic export\nNeg Int64 where\n  negate x = prim__sub_Int64 0 x\n  (-) = prim__sub_Int64\n\npublic export\nAbs Int64 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Int64 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Int64 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Int64 x y\n\n-- Bits8\n\n%inline\npublic export\nNum Bits8 where\n  (+) = prim__add_Bits8\n  (*) = prim__mul_Bits8\n  fromInteger = prim__cast_IntegerBits8\n\n%inline\npublic export\nNeg Bits8 where\n  negate x = prim__sub_Bits8 0 x\n  (-) = prim__sub_Bits8\n\npublic export\nAbs Bits8 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Bits8 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Bits8 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Bits8 x y\n\n-- Bits16\n\n%inline\npublic export\nNum Bits16 where\n  (+) = prim__add_Bits16\n  (*) = prim__mul_Bits16\n  fromInteger = prim__cast_IntegerBits16\n\n%inline\npublic export\nNeg Bits16 where\n  negate x = prim__sub_Bits16 0 x\n  (-) = prim__sub_Bits16\n\npublic export\nAbs Bits16 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Bits16 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Bits16 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Bits16 x y\n\n-- Bits32\n\n%inline\npublic export\nNum Bits32 where\n  (+) = prim__add_Bits32\n  (*) = prim__mul_Bits32\n  fromInteger = prim__cast_IntegerBits32\n\n%inline\npublic export\nNeg Bits32 where\n  negate x = prim__sub_Bits32 0 x\n  (-) = prim__sub_Bits32\n\npublic export\nAbs Bits32 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Bits32 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Bits32 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Bits32 x y\n\n-- Bits64\n\n%inline\npublic export\nNum Bits64 where\n  (+) = prim__add_Bits64\n  (*) = prim__mul_Bits64\n  fromInteger = prim__cast_IntegerBits64\n\n%inline\npublic export\nNeg Bits64 where\n  negate x = prim__sub_Bits64 0 x\n  (-) = prim__sub_Bits64\n\npublic export\nAbs Bits64 where\n  abs x = if x < 0 then -x else x\n\npublic export\nIntegral Bits64 where\n  div x y\n      = case y == 0 of\n             False => prim__div_Bits64 x y\n  mod x y\n      = case y == 0 of\n             False => prim__mod_Bits64 x y\n\n-- Double\n\npublic export\nNum Double where\n  (+) = prim__add_Double\n  (*) = prim__mul_Double\n  fromInteger = prim__cast_IntegerDouble\n\n%inline\npublic export\nNeg Double where\n  negate x = prim__negate_Double x\n  (-) = prim__sub_Double\n\npublic export\nAbs Double where\n  abs x = if x < 0 then -x else x\n\npublic export\nFractional Double where\n  (/) = prim__div_Double\n", "meta": {"hexsha": "7ef56a19f42b206100ae542482e0b766165a31da", "size": 6715, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/prelude/Prelude/Num.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/prelude/Prelude/Num.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/prelude/Prelude/Num.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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.0510752688, "max_line_length": 79, "alphanum_fraction": 0.6589724497, "num_tokens": 2087, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619177503206, "lm_q2_score": 0.658417500561683, "lm_q1q2_score": 0.542840155193458}}
{"text": "module Ch03.Exercise_3_5_14\n\nimport Ch03.Arith\n\n%default total\n\nnumValueProofIs : {t : Term} ->\n                  (pf : IsNumValue t) ->\n                  (nv : NumValue ** (t = nv2t nv, pf = ConvertedFrom nv))\nnumValueProofIs {t = (v2t (Right nv))} (ConvertedFrom nv) = (nv ** (Refl, Refl))\n\nzeroNotSucc : {t : Term} ->\n              (Zero = Succ t) -> Void\nzeroNotSucc Refl impossible\n\nsucc_inj : {t1, t2 : Term} ->\n           (Succ t1 = Succ t2) ->\n           (t1 = t2)\nsucc_inj Refl = Refl\n\nnv2t_inj : {nv1, nv2 : NumValue} ->\n           (nv2t nv1 = nv2t nv2) ->\n           (nv1 = nv2)\nnv2t_inj {nv1=Zero} {nv2=Zero} prf = Refl\nnv2t_inj {nv1=Zero} {nv2=Succ x} prf = absurd (zeroNotSucc prf)\nnv2t_inj {nv1=Succ x} {nv2=Zero} prf = absurd (zeroNotSucc (sym prf))\nnv2t_inj {nv1=Succ x} {nv2=Succ y} prf = cong (nv2t_inj (succ_inj prf))\n\nnumValueProofsUnique : {t : Term} ->\n                       (pf1 : IsNumValue t) ->\n                       (pf2 : IsNumValue t) ->\n                       (pf1 = pf2)\nnumValueProofsUnique pf1 pf2 with (numValueProofIs pf1)\n  numValueProofsUnique pf1 pf2 | (nv ** (pf_t, pf_pf)) with (numValueProofIs pf2)\n    numValueProofsUnique pf1 pf2 | (nv ** (pf_t, pf_pf)) | (nv' ** (pf_t', pf_pf')) = case nv2t_inj {nv1=nv} {nv2=nv'} (trans (sym pf_t) pf_t') of\n                                                                                           Refl => trans pf_pf (sym pf_pf')\nuniqueEval : (t : Term) ->\n             (r : EvalsTo t t') ->\n             (r' : EvalsTo t t'') ->\n             (r = r') \nuniqueEval True EIfTrue _ impossible\nuniqueEval True EIfFalse _ impossible\nuniqueEval True (EIf _) _ impossible\nuniqueEval True (ESucc _) _ impossible\nuniqueEval True EPredZero _ impossible\nuniqueEval True EPredSucc _ impossible\nuniqueEval True (EPred _) _ impossible\nuniqueEval True EIsZeroZero _ impossible\nuniqueEval True EIsZeroSucc _ impossible\nuniqueEval True (EIsZero _) _ impossible\nuniqueEval False EIfTrue _ impossible\nuniqueEval False EIfFalse _ impossible\nuniqueEval False (EIf _) _ impossible\nuniqueEval False (ESucc _) _ impossible\nuniqueEval False EPredZero _ impossible\nuniqueEval False EPredSucc _ impossible\nuniqueEval False (EPred _) _ impossible\nuniqueEval False EIsZeroZero _ impossible\nuniqueEval False EIsZeroSucc _ impossible\nuniqueEval False (EIsZero _) _ impossible\nuniqueEval (IfThenElse True y z) EIfTrue EIfTrue = Refl\nuniqueEval (IfThenElse True y z) EIfTrue (EIf x) impossible\nuniqueEval (IfThenElse False y z) EIfFalse EIfFalse = Refl\nuniqueEval (IfThenElse False y z) EIfFalse (EIf x) impossible\nuniqueEval (IfThenElse True y z) (EIf w) EIfTrue impossible\nuniqueEval (IfThenElse False y z) (EIf w) EIfFalse impossible\nuniqueEval (IfThenElse x y z) (EIf w) (EIf s) = case uniqueEval x w s of\n                                                     Refl => Refl\nuniqueEval Zero EIfTrue _ impossible\nuniqueEval Zero EIfFalse _ impossible\nuniqueEval Zero (EIf _) _ impossible\nuniqueEval Zero (ESucc _) _ impossible\nuniqueEval Zero EPredZero _ impossible\nuniqueEval Zero EPredSucc _ impossible\nuniqueEval Zero (EPred _) _ impossible\nuniqueEval Zero EIsZeroZero _ impossible\nuniqueEval Zero EIsZeroSucc _ impossible\nuniqueEval Zero (EIsZero _) _ impossible\nuniqueEval (Succ x) (ESucc y) (ESucc z) = case uniqueEval x y z of\n                                               Refl => Refl\nuniqueEval (Pred Zero) EPredZero EPredZero = Refl\nuniqueEval (Pred Zero) EPredZero (EPred x) impossible\nuniqueEval (Pred (Succ t')) (EPredSucc {pf=pf1}) (EPredSucc {pf=pf2}) = case numValueProofsUnique pf1 pf2 of\n                                                                             Refl => Refl\nuniqueEval (Pred (Succ t')) (EPredSucc {pf}) (EPred x) = absurd (valuesDontEvaluate {pf=(numValueIsValue (succNumValueIsNumValue pf))} x)\nuniqueEval (Pred Zero) (EPred y) EPredZero = absurd (valuesDontEvaluate {pf=IsValue.ConvertedFrom (Right Zero)} y)\nuniqueEval (Pred (Succ t')) (EPred y) (EPredSucc {pf}) = absurd (valuesDontEvaluate {pf=(numValueIsValue (succNumValueIsNumValue pf))} y)\n\nuniqueEval (Pred x) (EPred y) (EPred z) = case uniqueEval x y z of\n                                               Refl => Refl\nuniqueEval (IsZero Zero) EIsZeroZero EIsZeroZero = Refl\nuniqueEval (IsZero Zero) EIsZeroZero (EIsZero x) impossible\nuniqueEval (IsZero (Succ nv1)) (EIsZeroSucc {pf=pf1}) (EIsZeroSucc {pf=pf2}) = case numValueProofsUnique pf1 pf2 of\n                                                                                    Refl => Refl\nuniqueEval (IsZero (Succ nv1)) (EIsZeroSucc {pf}) (EIsZero x) = absurd (valuesDontEvaluate {pf=(numValueIsValue (succNumValueIsNumValue pf))} x)\nuniqueEval (IsZero Zero) (EIsZero y) EIsZeroZero impossible\nuniqueEval (IsZero (Succ nv1)) (EIsZero y) (EIsZeroSucc {pf}) = absurd (valuesDontEvaluate {pf=(numValueIsValue (succNumValueIsNumValue pf))} y)\nuniqueEval (IsZero x) (EIsZero y) (EIsZero z) = case uniqueEval x y z of\n                                                     Refl => Refl\n\n||| Proof that the one-step evaluation rules of the arithmetic language are deterministic (Ex. 3.5.14).\ndetVal : {t,t',t'' : Term} ->\n         EvalsTo t t' ->\n         EvalsTo t t'' ->\n         (t' = t'')\ndetVal {t} pf pf' = case uniqueEval t pf pf' of\n                         Refl => Refl\n", "meta": {"hexsha": "0073d90e44a1ca009eb6b466c99420426ca9bec2", "size": 5276, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Ch03/Exercise_3_5_14.idr", "max_stars_repo_name": "mr-infty/tapl", "max_stars_repo_head_hexsha": "3934bfe42b93f84c1bf35b7b34cf30b3a7fd7399", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-02-27T13:52:57.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-15T11:38:28.000Z", "max_issues_repo_path": "Ch03/Exercise_3_5_14.idr", "max_issues_repo_name": "mr-infty/tapl", "max_issues_repo_head_hexsha": "3934bfe42b93f84c1bf35b7b34cf30b3a7fd7399", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Ch03/Exercise_3_5_14.idr", "max_forks_repo_name": "mr-infty/tapl", "max_forks_repo_head_hexsha": "3934bfe42b93f84c1bf35b7b34cf30b3a7fd7399", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2021-03-13T04:56:05.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-06T07:08:45.000Z", "avg_line_length": 48.8518518519, "max_line_length": 146, "alphanum_fraction": 0.6408263836, "num_tokens": 1606, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619177503206, "lm_q2_score": 0.6584174938590246, "lm_q1q2_score": 0.5428401496673714}}
{"text": "module Control.Category\n\nimport Data.Morphisms\n\n\npublic export\ninterface Category (0 cat : obj -> obj -> Type) | cat where\n  id  : cat a a\n  (.) : cat b c -> cat a b -> cat a c\n\npublic export\nCategory Morphism where\n  id                = Mor id\n  -- disambiguation needed below, because unification can now get further\n  -- here with Category.(.) and it's only interface resolution that fails!\n  (Mor f) . (Mor g) = Mor $ Basics.(.) f g\n\npublic export\nMonad m => Category (Kleislimorphism m) where\n  id                        = Kleisli (pure . id)\n  (Kleisli f) . (Kleisli g) = Kleisli $ \\a => g a >>= f\n\ninfixr 1 >>>\n\npublic export\n(>>>) : Category cat => cat a b -> cat b c -> cat a c\nf >>> g = g . f\n", "meta": {"hexsha": "1c0e72bb87cf5fd8d5c3402db829073fec38dad8", "size": 703, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/contrib/Control/Category.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "libs/contrib/Control/Category.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "libs/contrib/Control/Category.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 25.1071428571, "max_line_length": 74, "alphanum_fraction": 0.6017069701, "num_tokens": 215, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8933093946927837, "lm_q2_score": 0.6076631698328917, "lm_q1q2_score": 0.5428312184205187}}
{"text": "> module SequentialDecisionProblems.applications.Main\n\n> import Data.Fin\n> import Data.List\n> import Data.List.Quantifiers\n> import Data.So\n> import Effects\n> import Effect.Exception\n> import Effect.StdIO\n\n> import SequentialDecisionProblems.CoreTheory\n> import SequentialDecisionProblems.FullTheory\n> import SequentialDecisionProblems.TabBackwardsInduction\n> import SequentialDecisionProblems.Utils\n> import SequentialDecisionProblems.FastStochasticDefaults\n> import SequentialDecisionProblems.CoreTheoryOptDefaults\n> import SequentialDecisionProblems.FullTheoryOptDefaults\n> import SequentialDecisionProblems.TabBackwardsInductionOptDefaults\n\n> import SequentialDecisionProblems.applications.FreezeOrIncrease\n> import SequentialDecisionProblems.applications.GoodOrBad\n\n> import FastSimpleProb.SimpleProb\n> import FastSimpleProb.BasicOperations\n> import FastSimpleProb.BasicProperties\n> import FastSimpleProb.MonadicOperations\n> import FastSimpleProb.MonadicProperties\n> import FastSimpleProb.Measures\n> import FastSimpleProb.MeasuresProperties\n> import Sigma.Sigma\n> import Double.Predicates\n> import Double.Postulates\n> import Double.Operations\n> import Double.Properties\n> import NonNegDouble.NonNegDouble\n> import NonNegDouble.Constants\n> import NonNegDouble.BasicOperations\n> import NonNegDouble.Operations\n> import NonNegDouble.Properties\n> import NonNegDouble.Predicates\n> import NonNegDouble.LTEProperties\n> import Finite.Predicates\n> import Finite.Operations\n> import Finite.Properties\n> import Decidable.Predicates\n> import Decidable.Properties\n> import LocalEffect.Exception\n> import LocalEffect.StdIO\n> import Fin.Operations\n> import List.Operations\n> import Unit.Properties\n\n> -- %default total\n> %auto_implicits off\n\n> -- %logging 5\n\n\n* Introduction\n\nWe specify a first emissions game as a stochastic sequential decision\nproblem with a single decision maker.\n\n\n* Controls\n\nAt each decision step, the decision maker has two options: freezing\nemissions or increasing emissions:\n\n> SequentialDecisionProblems.CoreTheory.Ctrl _ _ = FreezeOrIncrease\n\n\n* States\n\nAt each decision step, the decision maker has to choose an option on the\nbases of two data: the amount of cumulated emissions and the state of\nthe world. The latter can be either good or bad:\n\n> SequentialDecisionProblems.CoreTheory.State t = (Fin (S t), GoodOrBad)\n\nThe idea is that the game starts with zero cumulated emissions and with\nthe world in the good state. In these conditions, the probability to\nturn to the bad state is low. But if the cumulated emissions increase\nbeyond a critical threshold, the probability that the state of the world\nturns bad increases.  If the world is the bad state, there is no chance\nto come back to the good state. As for controls, it is useful to show\nthat |State| is finite:\n\n\n* Transition function\n\n> -- The critical threshold\n> cr : Double\n> cr = 0.0\n\n> -- The probability of staying in a good world when the cumulated\n> -- emissions are below the critical threshold\n> p1  :  NonNegDouble\n> p1  =  cast 0.65\n\n> -- The probabilities of staying in a good world when the cumulated\n> -- emissions are above the critical threshold\n> p2  :  NonNegDouble\n> p2  =  cast 0.1\n\n> -- The transition function: good world, freezing emissions\n> SequentialDecisionProblems.CoreTheory.nexts t (e, Good) Freeze =\n>   let goodState = (weaken e, Good) in\n>   let badState  = (weaken e, Bad) in\n>   if (fromFin e <= cr)\n>   then mkSimpleProb [(goodState, p1), (badState, one - p1)]\n>   else mkSimpleProb [(goodState, p2), (badState, one - p2)]\n\n> -- The transition function: good world, increasing emissions\n> SequentialDecisionProblems.CoreTheory.nexts t (e, Good) Increase =\n>   let goodState = (FS e, Good) in\n>   let badState  = (FS e, Bad) in\n>   if (fromFin e <= cr)  then mkSimpleProb [(goodState, p1), (badState, one - p1)]\n>                         else mkSimpleProb [(goodState, p2), (badState, one - p2)]\n\n> -- The transition function: bad world, freezing emissions\n> SequentialDecisionProblems.CoreTheory.nexts t (e, Bad) Freeze =\n>   let badState  = (weaken e, Bad) in mkSimpleProb [(badState, one)]\n\n> -- The transition function: bad world, increasing emissions\n> SequentialDecisionProblems.CoreTheory.nexts t (e, Bad) Increase =\n>   let badState  = (FS e, Bad) in mkSimpleProb [(badState, one)]\n\n* |Val| and |LTE|:\n\n> SequentialDecisionProblems.CoreTheory.Val =\n>   NonNegDouble.NonNegDouble\n \n> SequentialDecisionProblems.CoreTheory.plus =\n>   NonNegDouble.Operations.plus\n\n> SequentialDecisionProblems.CoreTheory.zero =\n>   fromInteger @{NumNonNegDouble} 0\n\n> SequentialDecisionProblems.CoreTheory.LTE =\n>   NonNegDouble.Predicates.LTE\n\n> SequentialDecisionProblems.FullTheory.reflexiveLTE =\n>   NonNegDouble.LTEProperties.reflexiveLTE\n\n> SequentialDecisionProblems.FullTheory.transitiveLTE =\n>   NonNegDouble.LTEProperties.transitiveLTE\n \n> SequentialDecisionProblems.FullTheory.monotonePlusLTE =\n>   NonNegDouble.LTEProperties.monotonePlusLTE\n\n> SequentialDecisionProblems.CoreTheoryOptDefaults.totalPreorderLTE =\n>   NonNegDouble.LTEProperties.totalPreorderLTE\n\n\n* Reward function\n\nThe idea is that being in a good world yields one unit of benefits per\nstep and being in a bad world yield less benefits:\n\n> -- Ratio of the benefits in a bad world and the benefits in a good world\n> badOverGood : NonNegDouble\n> badOverGood = cast 0.5\n\n> -- Sanity check\n> badOverGoodLTEone : badOverGood `NonNegDouble.Predicates.LTE` one\n> badOverGoodLTEone = MkLTE Oh\n\nEmitting greenhouse gases also brings benefits. These are a fraction of\nthe step benefits in a good world and freezing emissions brings less\nbenefits than increasing emissions:\n\n> -- Ratio between freezing emissions benefits and step benefits (in a good world)\n> freezeOverGood : NonNegDouble\n> freezeOverGood = cast 0.1\n\n> -- Ratio between increasing emissions benefits and step benefits (in a good world)\n> increaseOverGood : NonNegDouble\n> increaseOverGood = cast 0.3\n\n> -- Sanity check\n> freezeOverGoodLTEone : freezeOverGood `NonNegDouble.Predicates.LTE` one\n> freezeOverGoodLTEone = MkLTE Oh\n\n> -- Sanity check\n> increaseOverGoodLTEone : increaseOverGood `NonNegDouble.Predicates.LTE` one\n> increaseOverGoodLTEone = MkLTE Oh\n\n> -- Sanity check\n> freezeLTEincrease : freezeOverGood `NonNegDouble.Predicates.LTE` increaseOverGood\n> freezeLTEincrease = MkLTE Oh\n\n> -- Reward function:\n> \n> using implementation NumNonNegDouble\n> \n>   SequentialDecisionProblems.CoreTheory.reward _ _ Freeze   (_, Good) =\n>     one                       + one * freezeOverGood\n>   SequentialDecisionProblems.CoreTheory.reward _ _ Increase (_, Good) =\n>     one                       + one * increaseOverGood\n>   SequentialDecisionProblems.CoreTheory.reward _ _ Freeze   (_,  Bad) =\n>     one * badOverGood + one * freezeOverGood\n>   SequentialDecisionProblems.CoreTheory.reward _ _ Increase (_,  Bad) =\n>     one * badOverGood + one * increaseOverGood\n\n\n* Completing the problem specification\n\nTo be able to apply the verified, generic backwards induction algorithm\nof |CoreTheory| to compute optimal policies for our problem, we have to\nexplain how the decision maker accounts for uncertainties on rewards\ninduced by uncertainties in the transition function. We first assume\nthat the decision maker measures uncertain rewards by their expected\nvalue:\n\n> SequentialDecisionProblems.CoreTheory.meas = expectedValue\n> SequentialDecisionProblems.FullTheory.measMon = monotoneExpectedValue\n\nFurther on, we have to implement the notions of viability and\nreachability. We start by positing that all states are viable for any\nnumber of steps:\n\n> -- Viable : (n : Nat) -> State t -> Type\n> SequentialDecisionProblems.CoreTheory.Viable n x = Unit\n\nFrom this definition, it trivially follows that all elements of an\narbitrary list of states are viable for an arbitrary number of steps:\n\n> viableLemma : {t, n : Nat} -> (xs : List (State t)) -> All (Viable n) xs\n> viableLemma  Nil      = Nil\n> viableLemma {t} {n} (x :: xs) = () :: (viableLemma {t} {n} xs)\n\nThis fact and the (less trivial) result that simple probability\ndistributions are never empty, see |nonEmptyLemma| in\n|MonadicProperties| in |SimpleProb|, allows us to show that the above\ndefinition of |Viable| fulfills |viableSpec1|:\n\n> -- viableSpec1 : (x : State t) -> Viable (S n) x -> GoodCtrl t x\n> SequentialDecisionProblems.CoreTheory.viableSpec1 {t} {n} s v =\n>   MkSigma Freeze (ne, av) where\n>     ne : SequentialDecisionProblems.CoreTheory.NotEmpty (nexts t s Freeze)\n>     ne = nonEmptyLemma (nexts t s Freeze)\n>     av : SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} n) (nexts t s Freeze)\n>     av = viableLemma {t = S t} (support (nexts t s Freeze))\n\n> SequentialDecisionProblems.Utils.finiteViable n x = finiteUnit\n\n> SequentialDecisionProblems.Utils.decidableViable n x = decidableUnit\n\nFor reachability, we proceed in a similar way. We say that all states\nare reachable\n\n> -- Reachable : State t' -> Type\n> SequentialDecisionProblems.CoreTheory.Reachable x' = Unit\n\nwhich immediately implies |reachableSpec1|:\n\n> -- reachableSpec1 : (x : State t) -> Reachable {t' = t} x -> (y : Ctrl t x) -> All (Reachable {t' = S t}) (nexts t x y)\n> SequentialDecisionProblems.CoreTheory.reachableSpec1 {t} x r y = all (nexts t x y) where\n>   all : (sp : SimpleProb  (State (S t))) -> SequentialDecisionProblems.CoreTheory.All (Reachable {t' = S t}) sp\n>   all sp = all' (support sp) where\n>     all' : (xs : List (State (S t))) -> Data.List.Quantifiers.All (Reachable {t' = S t}) xs\n>     all' Nil = Nil\n>     all' (x :: xs) = () :: (all' xs)\n\nand decidability of |Reachable|:\n\n> SequentialDecisionProblems.TabBackwardsInduction.decidableReachable x = decidableUnit\n\nFinally, we have to show that controls are finite\n\n> -- finiteCtrl : {t : Nat} -> (x : State t) -> Finite (Ctrl t x)\n> SequentialDecisionProblems.Utils.finiteCtrl _ = finiteFreezeOrIncrease\n\nand, in order to use the fast, tail-recursive tabulated version of\nbackwards induction, that states are finite:\n\n> SequentialDecisionProblems.TabBackwardsInduction.finiteState t =\n>   finitePair (finiteFin) (finiteGoodOrBad)\n\n\n* Optimal policies, optimal decisions, ...\n\nWe can now apply the results of our |CoreTheory| and of the |FullTheory|\nto compute verified optimal policies, possible state-control sequences,\netc. To this end, we need to be able to show the outcome of the decision\nprocess. This means implemeting functions to print states and controls:\n\n> -- showState : {t : Nat} -> State t -> String\n> SequentialDecisionProblems.Utils.showState {t} (e, Good) =\n>   \"(\" ++ show (finToNat e) ++ \",Good)\"\n> SequentialDecisionProblems.Utils.showState {t} (e, Bad) =\n>   \"(\" ++ show (finToNat e) ++ \",Bad)\"\n\n> -- showControl : {t : Nat} -> {x : State t} -> Ctrl t x -> String\n> SequentialDecisionProblems.Utils.showCtrl {t} {x} Freeze = \"Freeze\"\n> SequentialDecisionProblems.Utils.showCtrl {t} {x} Increase = \"Increase\"\n\n>\n> using implementation ShowNonNegDouble\n> \n>   computation : { [STDIO] } Eff ()\n>   computation =\n>     do putStr (\"enter number of steps:\\n\")\n>        nSteps <- getNat\n>        case (decidableViable {t = Z} nSteps (FZ, Good)) of\n>          (Yes v) => do putStrLn (\"computing optimal policies ...\")\n>                        -- ps   <- pure (backwardsInduction Z nSteps)\n>                        ps   <- pure (tabTailRecursiveBackwardsInduction Z nSteps)\n>                        putStrLn (\"computing optimal controls ...\")\n>                        mxys <- pure (possibleStateCtrlSeqs (FZ, Good) () v ps)\n>                        putStrLn \"possible state-control sequences:\"\n>                        putStr \"  \"\n>                        putStrLn (showlong mxys)\n>                        mvs <- pure (possibleRewards' mxys)\n>                        putStrLn \"possible rewards:\"\n>                        putStr \"  \"\n>                        putStrLn (show mvs)\n>                        putStrLn (\"done!\")\n>          (No _)  => putStrLn (\"initial state non viable for \" ++ cast {from = Int} (cast nSteps) ++ \" steps\")\n\n> main : IO ()\n> main = run computation\n\n\n> {-\n\n> ---}\n\n\n-- Local Variables:\n-- idris-packages: (\"effects\")\n-- End:\n", "meta": {"hexsha": "40609989d3565e9b11437093a8c07ecb408cb2a8", "size": 12136, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "SequentialDecisionProblems/applications/EmissionsGame1.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/applications/EmissionsGame1.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/applications/EmissionsGame1.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 36.3353293413, "max_line_length": 121, "alphanum_fraction": 0.7268457482, "num_tokens": 3090, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031737963569016, "lm_q2_score": 0.6757646010190476, "lm_q1q2_score": 0.5427564200440753}}
{"text": "> module NonNegDouble.Properties\n\n> import Data.So\n> import Syntax.PreorderReasoning\n\n> import Double.Predicates\n> import Double.Postulates\n> import Double.Properties\n> import NonNegDouble.NonNegDouble\n> import NonNegDouble.Constants\n> import NonNegDouble.BasicOperations\n> import NonNegDouble.Operations\n> import List.Operations\n> import Subset.Properties\n> import Pairs.Operations\n> import Unique.Predicates\n\n> %default total\n> %access public export\n\n\n* Positivity of constants\n\n> ||| zero is not positive\n> notPositiveZero : Not (Positive (toDouble NonNegDouble.Constants.zero))\n> notPositiveZero = s3 where\n>   s0 : toDouble (Element 0.0 (MkLTE Oh)) = 0.0\n>   s0 = Refl\n>   s1 : Element 0.0 (MkLTE Oh) = NonNegDouble.Constants.zero\n>   s1 = Refl\n>   s2 : toDouble NonNegDouble.Constants.zero = 0.0\n>   s2 = replace {P = \\ X => toDouble X = 0.0} s1 s0  \n>   s3 : Not (Positive (toDouble NonNegDouble.Constants.zero))\n>   s3 = replace {P = \\ X => Not (Positive X)} (sym s2) Double.Properties.notPositiveZero \n\n> ||| one is positive\n> positiveOne : Positive (toDouble NonNegDouble.Constants.one)\n> positiveOne = MkLT Oh\n\n\n* Implementations:\n\n> ||| NonNegDouble is an implementation of Show\n> -- implementation [ShowNonNegDouble] Show NonNegDouble where\n> implementation [ShowNonNegDouble] Show NonNegDouble where\n>   show = show . toDouble \n\n> ||| NonNegDouble is an implementation of Num\n> implementation [NumNonNegDouble] Num NonNegDouble where\n>   (+) = plus\n>   (*) = mult\n>   fromInteger = fromNat . fromIntegerNat\n\n> using implementation NumNonNegDouble\n>   ||| NonNegDouble is an implementation of Fractional\n>   implementation [FractionalNonNegDouble] Fractional NonNegDouble where\n>     (/) = div\n\n> ||| NonNegDouble is an implementation of Eq\n> implementation [EqNonNegDouble] Eq NonNegDouble where\n>   (==) x y = (toDouble x) == (toDouble y)\n\n> using implementation NumNonNegDouble\n>   using implementation EqNonNegDouble\n>     ||| NonNegDouble is an implementation of Ord\n>     implementation [OrdNonNegDouble] Ord NonNegDouble where\n>       compare x y = compare (toDouble x) (toDouble y)\n\n\n* Properties of |toDouble|:\n\n> using implementation NumNonNegDouble\n>   ||| \n>   toDoublePlusLemma : (x : NonNegDouble) -> (y : NonNegDouble) -> toDouble (x + y) = (toDouble x) + (toDouble y)\n>   toDoublePlusLemma (Element x px) (Element y py) = \n>       ( toDouble ((Element x px) + (Element y py)) )\n>     ={ Refl }=\n>       ( toDouble (plus (Element x px) (Element y py)) )\n>     ={ Refl }=\n>       ( toDouble (Element (x + y) (plusPreservesNonNegativity px py)) )\n>     ={ Refl }=\n>       ( x + y )\n>     ={ Refl }=\n>       ( (toDouble (Element x px)) + (toDouble (Element y py)) )\n>     QED\n\n> using implementation NumNonNegDouble\n>   ||| \n>   toDoubleMultLemma : (x : NonNegDouble) -> (y : NonNegDouble) -> toDouble (x * y) = (toDouble x) * (toDouble y)\n>   toDoubleMultLemma (Element x px) (Element y py) = \n>       ( toDouble ((Element x px) * (Element y py)) )\n>     ={ Refl }=\n>       ( toDouble (mult (Element x px) (Element y py)) )\n>     ={ Refl }=\n>       ( toDouble (Element (x * y) (multPreservesNonNegativity px py)) )\n>     ={ Refl }=\n>       ( x * y )\n>     ={ Refl }=\n>       ( (toDouble (Element x px)) * (toDouble (Element y py)) )\n>     QED\n\n> using implementation FractionalNonNegDouble\n>   ||| \n>   toDoubleDivLemma : (x : NonNegDouble) -> (y : NonNegDouble) -> toDouble (x / y) = (toDouble x) / (toDouble y)\n>   toDoubleDivLemma (Element x px) (Element y py) = \n>       ( toDouble ((Element x px) / (Element y py)) )\n>     ={ Refl }=\n>       ( toDouble (div (Element x px) (Element y py)) )\n>     ={ Refl }=\n>       ( toDouble (Element (x / y) (divPreservesNonNegativity px py)) )\n>     ={ Refl }=\n>       ( x / y )\n>     ={ Refl }=\n>       ( (toDouble (Element x px)) / (toDouble (Element y py)) )\n>     QED\n\n\n* Properties entailed by postulates and properties of |Double|s:\n\n> using implementation FractionalNonNegDouble\n>   |||\n>   divPreservesPositivity : {x, y : NonNegDouble} -> \n>                            Positive (toDouble x) -> Positive (toDouble y) -> Positive (toDouble (x / y))\n>   divPreservesPositivity {x} {y} pdx pdy = replace s1 s2 where\n>     s1 : (toDouble x) / (toDouble y) = toDouble (x / y)\n>     s1 = sym (toDoubleDivLemma x y)\n>     s2 : Positive ((toDouble x) / (toDouble y))\n>     s2 = Double.Postulates.divPreservesPositivity pdx pdy\n\n> using implementation NumNonNegDouble\n>   |||\n>   plusAssociative : (x : NonNegDouble) -> (y : NonNegDouble) -> (z : NonNegDouble) -> \n>                     x + (y + z) = (x + y) + z\n>   plusAssociative (Element x px) (Element y py) (Element z pz) =\n>       ( Element x px + ((Element y py) + (Element z pz)) )\n>     ={ Refl }=\n>       ( Element x px + Element (y + z) (plusPreservesNonNegativity py pz) )  \n>     ={ Refl }=\n>       ( Element (x + (y + z)) (plusPreservesNonNegativity px (plusPreservesNonNegativity py pz)) )    \n>     ={ subsetEqLemma1 (Element (x + (y + z)) (plusPreservesNonNegativity px (plusPreservesNonNegativity py pz))) \n>                       (Element ((x + y) + z) (plusPreservesNonNegativity (plusPreservesNonNegativity px py) pz)) \n>                       (plusAssociative x y z) uniqueLTE }=\n>       ( Element ((x + y) + z) (plusPreservesNonNegativity (plusPreservesNonNegativity px py) pz) )\n>     ={ Refl }=\n>       ( Element (x + y) (plusPreservesNonNegativity px py) + Element z pz )\n>     ={ Refl }=\n>       ( ((Element x px) + (Element y py)) + Element z pz )\n>     QED                   \n\n> {-\n\n> ---}\n\n\n\n\n\n", "meta": {"hexsha": "a2cfc6538d3c0c7286dd99d7de3d4a2be50c82cd", "size": 5542, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "NonNegDouble/Properties.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "NonNegDouble/Properties.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "NonNegDouble/Properties.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 35.0759493671, "max_line_length": 115, "alphanum_fraction": 0.6250451101, "num_tokens": 1668, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8519527906914787, "lm_q2_score": 0.6370307944803832, "lm_q1q2_score": 0.5427201631139723}}
{"text": "module Algebra.Monoid\n\nimport Data.List\n\n%default total\n\n||| This interface is a witness that for a\n||| type `a` the axioms of a monoid hold: `(<+>)` is associative\n||| with `neutral` being the neutral element.\npublic export\ninterface Monoid a => LMonoid a where\n  0 appendAssociative : {x,y,z : a} -> x <+> (y <+> z) === (x <+> y) <+> z\n\n  0 appendLeftNeutral : {x : a} -> Prelude.neutral <+> x === x\n\n  0 appendRightNeutral : {x : a} -> x <+> Prelude.neutral === x\n\nexport\nLMonoid (List a) where\n  appendAssociative = Data.List.appendAssociative _ _ _\n  appendRightNeutral = appendNilRightNeutral _\n  appendLeftNeutral = Refl\n\nunsafeRefl : a === b\nunsafeRefl = believe_me (Refl {x = a})\n\nexport\nLMonoid String where\n  appendAssociative = unsafeRefl\n  appendRightNeutral = unsafeRefl\n  appendLeftNeutral = unsafeRefl\n\n||| This interface is a witness that for a\n||| type `a` the axioms of a commutative monoid hold:\n||| `(<+>)` is commutative.\npublic export\ninterface LMonoid a => CommutativeMonoid a where\n  0 appendCommutative : {x,y : a} -> x <+> y === y <+> x\n", "meta": {"hexsha": "42cb88128dfe482c7277cb2609d39da3394f574e", "size": 1064, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Algebra/Monoid.idr", "max_stars_repo_name": "stefan-hoeck/idris2-prim", "max_stars_repo_head_hexsha": "d342072f3b30f7930221bab620a836e0e67c2374", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2022-03-13T22:37:25.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T22:22:30.000Z", "max_issues_repo_path": "src/Algebra/Monoid.idr", "max_issues_repo_name": "stefan-hoeck/idris2-prim", "max_issues_repo_head_hexsha": "d342072f3b30f7930221bab620a836e0e67c2374", "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/Algebra/Monoid.idr", "max_forks_repo_name": "stefan-hoeck/idris2-prim", "max_forks_repo_head_hexsha": "d342072f3b30f7930221bab620a836e0e67c2374", "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": 27.2820512821, "max_line_length": 74, "alphanum_fraction": 0.6795112782, "num_tokens": 333, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8376199552262967, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.5426087143167215}}
{"text": "module Average\n\nexport\naverage : String -> Double\naverage str = let numWords = wordCount str \n                  totalLength = sum (allLengths (words str)) in \n\t\t\t      cast totalLength / cast numWords\n\twhere\n\t\twordCount: String -> Nat\n\t\twordCount str = length (words str)\n\n\t\tallLengths : List String -> List Nat\n\t\tallLengths strs = map length strs\n\nadd : Int -> Int -> Int\nadd x y = x + y\n\nidentity: ty -> ty\nidentity x = x\n\ndouble: Num ty => ty -> ty\ndouble x = x + x\n\ntwice : (a -> a) -> a -> a\ntwice f x = f (f x)\n\nShape : Type\nrotate : Shape -> Shape\n\nquadruple : Num a => a -> a\nquadruple = twice double\n\nturn_around : Shape -> Shape\nturn_around = twice rotate\n\n\nlonger : String -> String -> String\nlonger word1 word2\n\t= let len1 = length word1\n\t      len2 = length word2 in\n              if len1 > len2 then word1 else word2\n\npythagoras : Double -> Double -> Double\npythagoras x y = sqrt (square x + square y)\n  where\n    square: Double -> Double\n    square x = x * x\n\nwordCount : String -> Nat\nwordCount str = length (words str)\n\nallLengths : List String -> List Nat\nallLengths strs = map length strs\n\n-- single line comment\n\n{- \nMultiple\nLine\nComment\n-}\n\n", "meta": {"hexsha": "ddf2faf49f79e1e9c0e2609e818775326dfc88cf", "size": 1163, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "ch2/Average.idr", "max_stars_repo_name": "Andrewp2/idris-book", "max_stars_repo_head_hexsha": "632910551f3f1646607aa12a7a089164eae945fb", "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": "ch2/Average.idr", "max_issues_repo_name": "Andrewp2/idris-book", "max_issues_repo_head_hexsha": "632910551f3f1646607aa12a7a089164eae945fb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ch2/Average.idr", "max_forks_repo_name": "Andrewp2/idris-book", "max_forks_repo_head_hexsha": "632910551f3f1646607aa12a7a089164eae945fb", "max_forks_repo_licenses": ["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.4603174603, "max_line_length": 64, "alphanum_fraction": 0.6440240757, "num_tokens": 337, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303087996143, "lm_q2_score": 0.6859494614282923, "lm_q1q2_score": 0.542263839563837}}
{"text": "module Prob\n\nimport Marginalization\nimport Semiring\nimport HetVect\n\n%default total\n%access public export\n\n-- TODO: convert to haskell, parallel, prove\n\nmutual\n  ||| Probability monad which keeps a list of the variables it contains\n  ||| Prob s xs a = probability of `a`, given `xs`. `s` is the unit\n  data Prob : Type -> Type -> Type where\n    ||| change to (forall s. Semiring s => (a -> s) -> s) in order to avoid enum,\n    ||| bounded constraints (maybe).\n    Dst : (a -> s) -> Prob s a\n    Bnd\n      : {xs : List Type}\n      -> {auto finite : AllFinite xs}\n      -> MultiProb s xs\n      -> (Vect xs -> Prob s b)\n      -> Prob s b\n\n  data MultiProb : Type -> List Type -> Type where\n    Nil  : MultiProb s []\n    (::) : {x : Type} -> Prob s x -> MultiProb s xs -> MultiProb s (x :: xs)\n\ngetProb : Semiring s => Prob s a -> a -> s\ngetProb (Dst f) = f\ngetProb (Bnd {xs} ps f) = \\y => margVec (\\ws => allMessages ws * getProb (f ws) y) where\n\n  funcs : Semiring s => {ys : List Type} -> MultiProb s ys -> s -> Vect ys -> s\n  funcs [] = \\n, _ => n\n  funcs (p::ps) =\n    let m  = getProb p\n        ms = funcs ps\n    in \\n, (v::vs) => ms (n * m v) vs -- change to not tail-recursive to make parallel\n\n  allMessages : Vect xs -> s\n  allMessages = funcs ps one\n\ngetProbPar : Semiring s => Prob s a -> a -> s\ngetProbPar (Dst f) = f\ngetProbPar (Bnd {xs} ps f) = \\y => margVec (\\ws => allMessages ws * getProb (f ws) y) where\n\n  funcs : Semiring s => {ys : List Type} -> MultiProb s ys -> Vect ys -> s\n  funcs [] = \\_ => one\n  funcs (p::ps) = \\(v::vs) =>\n    let m  = getProbPar p v -- Evaluate these in parallel (only currently possible in Haskell)\n        ms = funcs ps vs\n    in ms * m\n\n  allMessages : Vect xs -> s\n  allMessages = funcs ps\n", "meta": {"hexsha": "11514f80d8093f973ff33aadbac01220119837ff", "size": 1736, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Prob.idr", "max_stars_repo_name": "oisdk/belief-propagation-idris", "max_stars_repo_head_hexsha": "f8d958384d19ef550bd26464287f4d0da7951114", "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": "Prob.idr", "max_issues_repo_name": "oisdk/belief-propagation-idris", "max_issues_repo_head_hexsha": "f8d958384d19ef550bd26464287f4d0da7951114", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Prob.idr", "max_forks_repo_name": "oisdk/belief-propagation-idris", "max_forks_repo_head_hexsha": "f8d958384d19ef550bd26464287f4d0da7951114", "max_forks_repo_licenses": ["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.4561403509, "max_line_length": 94, "alphanum_fraction": 0.5852534562, "num_tokens": 558, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8807970842359877, "lm_q2_score": 0.6150878555160665, "lm_q1q2_score": 0.5417675896875178}}
{"text": "-- ----------------------------------------------------------- [ Chapter11.idr ]\n-- Module      : Exercises.Chapter11\n-- Description : Solutions to the Chapter 11 exercises in Edwin Brady's\n--               book, \"Type-Driven Development with Idris.\"\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Exercises.Chapter11\n\nimport Data.Primitives.Views\nimport Test\n\n%access  export\n%default total\n\n-- ------------------------------------------------------- [ Exercise 11.1.7.1 ]\n\neveryOther : Stream a -> Stream a\neveryOther (_ :: x :: xs) = x :: everyOther xs\n\n-- ------------------------------------------------------ [ Exercises 11.1.7.2 ]\n\n||| Generic infinite lists\ndata InfList : (elem : Type) -> Type where\n  ||| An infinite list, consisting of a head element and an infinite list.\n  (::) : (x : elem) -> (xs : Inf (InfList elem)) -> InfList elem\n\n%name InfList xs, ys, zs\n\ncountFrom : Integer -> InfList Integer\ncountFrom x = x :: countFrom (x + 1)\n\ngetPrefix : (count : Nat) -> InfList a -> List a\ngetPrefix  Z    _  = []\ngetPrefix (S k) (x :: xs) = x :: getPrefix k xs\n\nimplementation Functor InfList where\n  map f (x :: xs) = f x :: map f xs -- FIXME: Delay is implicit, right?\n\n-- ------------------------------------------------------- [ Exercise 11.1.7.3 ]\n\nrandoms : Int -> Stream Int\nrandoms seed = let seed' = 1664525 * seed + 1013904223 in\n                  (seed' `shiftR` 2) :: randoms seed'\n\n{-\nmutual\n  even : Nat -> Bool\n  even  Z    = True\n  even (S k) = odd k\n\n  odd : Nat -> Bool\n  odd  Z    = False\n  odd (S k) = even k\n-}\n\n||| The faces of a coin, heads or tails.\ndata Face = Heads | Tails\n\nimplementation Eq Face where\n  (==) Heads Heads = True\n  (==) Tails Tails = True\n  (==) _     _     = False\n\nsyntax [test] \"?\" [t] \":\" [e] = if test then t else e;\n\nprivate\ngetFace : Int -> Face\ngetFace x with (divides x 2)\n  getFace (_ + rem) | (DivBy _) = (rem == 1) ? Tails : Heads\n\ncoinFlips : (count : Nat) -> Stream Int -> List Face\ncoinFlips  Z     _        = []\ncoinFlips (S k) (x :: xs) = getFace x :: coinFlips k xs\n\n-- ------------------------------------------------------- [ Exercise 11.1.7.4 ]\n\nprivate\nsquareRootApprox : (number, approx : Double) -> Stream Double\nsquareRootApprox number approx =\n  let next = (approx + (number / approx)) / 2\n  in  approx :: squareRootApprox number next\n\n-- ------------------------------------------------------- [ Exercise 11.1.7.5 ]\n\nsquareRootBound : (max : Nat) -> (number, bound : Double)\n               -> (approxs : Stream Double)\n               -> Double\nsquareRootBound  Z    _      _     (x :: _)  = x\nsquareRootBound (S k) number bound (x :: xs) =\n  if bound > abs (x * x)\n    then x\n    else squareRootBound k number bound xs\n\nsquareRoot : (number : Double) -> Double\nsquareRoot number = squareRootBound 100 number 0.00000000001\n                      (squareRootApprox number number)\n\n-- ------------------------------------------------------------------- [ InfIO ]\n\nnamespace InfIO\n  data InfIO : Type where\n       Do    : IO a -> (a -> Inf InfIO) -> InfIO\n\n  (>>=) : IO a -> (a -> Inf InfIO) -> InfIO\n  (>>=) = Do\n\ndata Fuel = Dry | More (Lazy Fuel)\n\ntank : Nat -> Fuel\ntank  Z    = Dry\ntank (S k) = More (tank k)\n\npartial\nforever : Fuel\nforever = More forever\n\nrun : Fuel -> InfIO -> IO ()\nrun  Dry         _       = putStrLn \"Out of fuel\"\nrun (More fuel) (Do c f) = do res <- c\n                              run fuel (f res)\n\n-- --------------------------------------------------------- [ Exercise 11.2.7 ]\n\ntotalREPL : (prompt : String) -> (action : String -> String) -> InfIO\ntotalREPL prompt action\n  = do putStr prompt\n       input <- getLine\n       putStr (action input)\n       totalREPL prompt action\n\n-- ------------------------------------------ [ 11.3.2 Domain Specific Comands ]\n\ndata Command  : Type -> Type where\n     PutStr   : String -> Command ()\n     PutStrLn : String -> Command ()\n     GetLine  : Command String\n\n     Pure     : ty -> Command ty\n     Bind     : Command a -> (a -> Command b) -> Command b\n\n-- ------------------------------------------------------- [ Exercise 11.3.4.2 ]\n     ReadFile  : (filepath : String) -> Command (Either FileError String)\n     WriteFile : (filepath, contents : String) -> Command (Either FileError ())\n\nnamespace CommandDo\n  (>>=) : Command a -> (a -> Command b) -> Command b\n  (>>=) = Bind\n\nrunCommand : Command a -> IO a\nrunCommand (PutStr   str) = putStr str\nrunCommand (PutStrLn str) = putStrLn str\nrunCommand  GetLine       = getLine\nrunCommand (Pure val)     = pure val\nrunCommand (Bind c f)     = runCommand c >>= runCommand . f\nrunCommand (ReadFile  filepath)          = readFile filepath\nrunCommand (WriteFile filepath contents) = writeFile filepath contents\n\ndata ConsoleIO : Type -> Type where\n     Quit      : a -> ConsoleIO a\n     Do        : Command a -> (a -> Inf (ConsoleIO b)) -> ConsoleIO b\n\nnamespace ConsoleDo\n  (>>=) : Command a -> (a -> Inf (ConsoleIO b)) -> ConsoleIO b\n  (>>=) = Do\n\n  run : Fuel -> ConsoleIO a -> IO (Maybe a)\n  run       fuel  (Quit val) = do pure (Just val)\n  run (More fuel) (Do c f)   = do res <- runCommand c\n                                  run fuel (f res)\n  run  Dry         p         = pure Nothing\n\n  run_ : Fuel -> ConsoleIO a -> IO ()\n  run_       fuel  (Quit val) = pure ()\n  run_ (More fuel) (Do c f)   = do res <- runCommand c\n                                   run_ fuel (f res)\n  run_  Dry         p         = pure ()\n\n  partial\n  runForever : ConsoleIO a -> IO (Maybe a)\n  runForever = run forever\n\n  partial\n  runForever_ : ConsoleIO a -> IO ()\n  runForever_ = run_ forever\n\n-- ---------------------------------------------- [ 11.3.3 Sequencing Commands ]\n\ndata Input = Answer Int\n           | QuitCmd\n\nreadInput : (prompt : String) -> Command Input\nreadInput prompt = do PutStr prompt\n                      answer <- GetLine\n                      if toLower answer == \"quit\"\n                         then Pure QuitCmd\n                         else Pure (Answer (cast answer))\n\n-- ------------------------------------------------------- [ Exercise 11.3.4.1 ]\n\nrecord QuizState where\n  constructor MkQuizState\n  score, attempts : Nat\n\nimplementation Show QuizState where\n  show (MkQuizState score attempts)\n    = show score ++ \" / \" ++ show attempts\n\nprivate\narithInputs : (seed : Int) -> Stream Int\narithInputs seed = map bound (randoms seed)\n  where\n    bound : Int -> Int\n    bound num with (divides num 12)\n      bound ((12 * div) + rem) | (DivBy prf) = abs rem + 1\n\nmutual\n  correct : Stream Int -> QuizState -> ConsoleIO QuizState\n  correct nums state\n    = do PutStrLn \"Correct!\"\n         quiz nums (record { score $= (+ 1) } state)\n\n  wrong : Stream Int -> Int -> QuizState -> ConsoleIO QuizState\n  wrong nums answer state\n    = do PutStrLn $ \"Wrong, the answer is: \" ++ show answer\n         quiz nums state\n\n  quiz : Stream Int -> QuizState -> ConsoleIO QuizState\n  quiz (num1 :: num2 :: nums) state\n    = do PutStrLn $ \"Score so far: \" ++ show state\n         input <- readInput $ show num1 ++ \" * \" ++ show num2 ++ \"? \"\n         case input of\n              Answer answer =>\n                let newState = record { attempts $= (+ 1) } state\n                    correctAnswer = num1 * num2 in\n                if answer == correctAnswer\n                   then correct nums newState\n                   else wrong nums correctAnswer newState\n              QuitCmd =>\n                Quit state\n\n-- ------------------------------------------------------- [ Exercise 11.3.4.3 ]\n\nmutual\n  ||| Read the contents of a file and print it to stdout with a trailing\n  ||| newline. Print an error message if filename is not a normal file.\n  cat : (filename : String) -> ConsoleIO ()\n  cat filename\n    = do Right contents <- ReadFile filename\n           | Left err => do PutStrLn (show err)\n                            shell\n         PutStrLn contents\n         shell\n\n  ||| Read the contents of a source file and write it to a destination file.\n  ||| Print an error message if anything goes wrong.\n  ||| @ source a source filepath, must be a normal file\n  ||| @ destination a destination filepath, must be writable\n  copy : (source, destination : String) -> ConsoleIO ()\n  copy source destination\n    = do Right contents <- ReadFile source\n           | Left err => do PutStrLn (show err)\n                            shell\n         Right () <- WriteFile destination contents\n           | Left err => do PutStrLn (show err)\n                            shell\n         shell\n\n  ||| Print a warning about an invalid command.\n  ||| @ command a string that represents an invalid command\n  invalidCommand : (command : String) -> ConsoleIO ()\n  invalidCommand command\n    = do PutStrLn (\"Invalid command: \" ++ command)\n         shell\n\n  ||| Quit the shell.\n  exit : ConsoleIO ()\n  exit = Quit ()\n\n  ||| Run a limited, interactive shell.\n  ||| Supported commands:\n  |||   - cat [filename]\n  |||   - copy [source] [destination]\n  |||   - exit\n  shell : ConsoleIO ()\n  shell = do PutStr \"> \"\n             input <- GetLine\n             case words input of\n                  [\"exit\"] => exit\n                  [\"cat\", filepath] => cat filepath\n                  [\"copy\", source, destination] => copy source destination\n                  _ => invalidCommand input\n\n-- ------------------------------------------------------------------- [ Tests ]\n\ntestEveryOther : IO ()\ntestEveryOther = assertEq [2,4..20] $ take 10 (everyOther [1..])\n\ntestInfListFunctor : IO ()\ntestInfListFunctor = assertEq [2,4..20] $ getPrefix 10 (map (*2) (countFrom 1))\n\ntestCoinFlips : IO ()\ntestCoinFlips = assertEq [Tails,Heads,Tails,Tails,Heads,Tails] $\n                         coinFlips 6 (randoms 12345)\n\ntestSquareRootApprox1 : IO ()\ntestSquareRootApprox1 = assertEq [10.0,5.5,3.659090909090909] $\n                                 take 3 (squareRootApprox 10 10)\n\ntestSquareRootApprox2 : IO ()\ntestSquareRootApprox2 = assertEq [25.0,14.5,10.698275862068964] $\n                                 take 3 (squareRootApprox 100 25)\n\ntestSquareRoot1 : IO ()\ntestSquareRoot1 = assertEq 2.449489742783178 (squareRoot 6)\n\ntestSquareRoot2 : IO ()\ntestSquareRoot2 = assertEq 50.0 (squareRoot 2500)\n\ntestSquareRoot3 : IO ()\ntestSquareRoot3 = assertEq 50.009999000199954 (squareRoot 2501)\n\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "567979ce8467328efb00ae6b96b1d71f5d1ac28c", "size": 10357, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Exercises/Chapter11.idr", "max_stars_repo_name": "yurrriq/tdd-with-idris", "max_stars_repo_head_hexsha": "873c6c719706d06179527c5d93982bb7c184da90", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-15T01:29:36.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-15T01:29:36.000Z", "max_issues_repo_path": "src/Exercises/Chapter11.idr", "max_issues_repo_name": "yurrriq/tdd-with-idris", "max_issues_repo_head_hexsha": "873c6c719706d06179527c5d93982bb7c184da90", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2016-11-21T23:42:45.000Z", "max_issues_repo_issues_event_max_datetime": "2016-12-01T05:43:10.000Z", "max_forks_repo_path": "src/Exercises/Chapter11.idr", "max_forks_repo_name": "yurrriq/tdd-with-idris", "max_forks_repo_head_hexsha": "873c6c719706d06179527c5d93982bb7c184da90", "max_forks_repo_licenses": ["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.1645962733, "max_line_length": 80, "alphanum_fraction": 0.5368349908, "num_tokens": 2657, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7122321842389469, "lm_q2_score": 0.760650658103136, "lm_q1q2_score": 0.541759879663589}}
{"text": "module Crypto.Hash.MD5\n\nimport Crypto.Hash.Interfaces\nimport Data.Bits\nimport Data.DPair\nimport Data.Fin\nimport Data.Fin.Extra\nimport Data.List\nimport Data.Nat\nimport Data.Nat.Factor\nimport Data.Vect\nimport Utils.Misc\nimport Utils.Bytes\nimport Data.Stream\nimport Crypto.Hash.MerkleDamgard\n\nexport\ndata MD5 : Type where\n  MkMD5 : MerkleDamgard 4 64 Bits32 -> MD5\n\nk_table : Vect 64 Bits32\nk_table =\n  [ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee\n  , 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501\n  , 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be\n  , 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821\n  , 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa\n  , 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8\n  , 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed\n  , 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a\n  , 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c\n  , 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70\n  , 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05\n  , 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665\n  , 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039\n  , 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1\n  , 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1\n  , 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ]\n\ns_table : Vect 64 (Fin 32)\ns_table =\n  [ 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22\n  , 5,  9, 14, 20, 5,  9, 14, 20, 5,  9, 14, 20, 5,  9, 14, 20\n  , 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23\n  , 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 ]\n\ni_table : Vect 64 (Fin 16)\ni_table =\n  [ 0, 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15\n  , 1, 6, 11,  0,  5, 10, 15,  4,  9, 14,  3,  8, 13,  2,  7, 12\n  , 5, 8, 11, 14,  1,  4,  7, 10, 13,  0,  3,  6,  9, 12, 15,  2\n  , 0, 7, 14,  5, 12,  3, 10,  1,  8, 15,  6, 13,  4, 11,  2,  9 ]\n\ns_k_table : Vect 64 (Fin 32, Bits32)\ns_k_table = zip s_table k_table\n\nmd5_init_hash_values : Vect 4 Bits32\nmd5_init_hash_values = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 ]\n\nmd5_compress : (block : Vect 64 Bits8) -> (h : Vect 4 Bits32) -> Vect 4 Bits32\nmd5_compress block hash_values = zipWith (+) hash_values $ go (_ ** zip calc_m_g s_k_table) hash_values\n  where\n  calc_m_g : Vect 64 Bits32\n  calc_m_g =\n    let block' = map (from_le {a = Bits32} {n = 4}) $ group 16 4 block\n    in map (\\i => index i block') i_table\n  loop : Bits32 -> Bits32 -> Bits32 -> Fin 32 -> Bits32 -> Bits32 -> Bits32 -> Bits32 -> Vect 4 Bits32\n  loop f m_g k_i s_i a b c d =\n    let f = f + a + k_i + m_g\n        a = d\n        d = c\n        c = b\n        b = b + rotl s_i f\n    in [a, b, c, d]\n  go : (n ** Vect n (Bits32, Fin 32, Bits32)) -> Vect 4 Bits32 -> Vect 4 Bits32\n  go (Z ** []) abcd = abcd\n  go ((S n) ** ((i, s_i, k_i) :: xs)) [a, b, c, d] =\n    case n `div` 16 of\n      3 => go (n ** xs) $ loop (d `xor` (b .&. (c `xor` d)))    i k_i s_i a b c d\n      2 => go (n ** xs) $ loop (c `xor` (d .&. (b `xor` c)))    i k_i s_i a b c d\n      1 => go (n ** xs) $ loop (b `xor` c `xor` d)              i k_i s_i a b c d\n      _ => go (n ** xs) $ loop (c `xor` (b .|. (complement d))) i k_i s_i a b c d\n\nmd5_update : List Bits8 -> MD5 -> MD5\nmd5_update input (MkMD5 s) =\n  let\n    Fraction _ 64 nblocks residue_nbyte prf = divMod (s.buffer_nbyte + length input) 64\n    (blocks, residue) = splitAt (mult nblocks 64) (replace_vect (sym prf) (s.buffer ++ fromList input))\n  in\n    MkMD5 $ {buffer := residue, buffer_nbyte := _, buffer_nbyte_constraint := elemSmallerThanBound residue_nbyte }\n      ( foldl (\\s_, block_ => {hash_values $= md5_compress block_, npassed_blocks $= S} s_) s (group nblocks 64 blocks) )\n\nmd5_finalize : MD5 -> Vect 16 Bits8\nmd5_finalize (MkMD5 s) =\n  concat $ map (to_le {n = 4}) $\n    case pad_theorem {block_nbyte = 64} {residue_max_nbyte = 55} {length_nbyte = 8} (LTESucc LTEZero) Refl s.buffer_nbyte_constraint s.buffer (integer_to_le _ $ 8 * (cast s.npassed_blocks * 64 + cast s.buffer_nbyte)) of\n      Left block => md5_compress block s.hash_values\n      Right blocks => let (x1, x2) = splitAt 64 blocks in md5_compress x2 $ md5_compress x1 s.hash_values\n\nexport\nDigest MD5 where\n  digest_nbyte = 16\n  update = md5_update\n  finalize = md5_finalize\n\nexport\nHash MD5 where\n  block_nbyte = 64\n  initialize = MkMD5 $ mk_merkle_damgard md5_init_hash_values\n", "meta": {"hexsha": "59c93f7567a3e4a400c218c3476f8cf1a6716300", "size": 4279, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Crypto/Hash/MD5.idr", "max_stars_repo_name": "octeep/idris2-tls", "max_stars_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_stars_repo_licenses": ["ISC"], "max_stars_count": 28, "max_stars_repo_stars_event_min_datetime": "2021-12-23T15:57:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T11:00:15.000Z", "max_issues_repo_path": "src/Crypto/Hash/MD5.idr", "max_issues_repo_name": "octeep/idris2-tls", "max_issues_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_issues_repo_licenses": ["ISC"], "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/Crypto/Hash/MD5.idr", "max_forks_repo_name": "octeep/idris2-tls", "max_forks_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_forks_repo_licenses": ["ISC"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.9, "max_line_length": 219, "alphanum_fraction": 0.6429072213, "num_tokens": 2044, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240964782012, "lm_q2_score": 0.6261241772283034, "lm_q1q2_score": 0.5417377255255159}}
{"text": "||| Prime, coprime, compositie types for `Nat`\n||| Extremely slow, but it totally works.\nmodule Extra.Nat.Prime\n\nimport Data.Fin\nimport Data.Nat\nimport Data.Nat.Factor\nimport Data.Nat.Order\nimport Data.Nat.Order.Properties\nimport Decidable.Decidable\n\n||| A witness of two numbers being relatively prime\npublic export\ndata Coprime : Nat -> Nat -> Type where\n  MkCoprime : GCD 1 a b -> Coprime a b\n\n||| A witness of two numbers not being relatively prime\npublic export\ndata NotCoprime : Nat -> Nat -> Type where\n  MkNotCoprime0 : GCD 0 a b -> NotCoprime a b\n  MkNotCoprime2 : GCD (S (S n)) a b -> NotCoprime a b\n\n||| Coprimality of two `Nat`s\npublic export\ndata Coprimality : Nat -> Nat -> Type where\n  TheyAreCoprime : Coprime a b -> Coprimality a b\n  TheyArentCoprime : NotCoprime a b -> Coprimality a b\n\n||| Calculate the coprimality of two `Nat`s\npublic export\ncoprimality : (a : Nat) -> (b : Nat) -> {auto ok: NotBothZero a b} -> Coprimality a b\ncoprimality a b with (Data.Nat.Factor.gcd a b)\n  coprimality a b | (0 ** gcd_a_b) = TheyArentCoprime (MkNotCoprime0 gcd_a_b)\n  coprimality a b | (1 ** gcd_a_b) = TheyAreCoprime (MkCoprime gcd_a_b)\n  coprimality a b | ((S (S n)) ** gcd_a_b) = TheyArentCoprime (MkNotCoprime2 gcd_a_b)\n\n||| Check are two numbers coprime to each other\npublic export\nisCoprime : (a : Nat) -> (b : Nat) -> {auto ok: NotBothZero a b} -> Bool\nisCoprime a b =\n  case coprimality a b {ok = ok} of\n   TheyAreCoprime _ => True\n   _ => False\n\n||| A witness of a `Nat` being a compositie number\npublic export\ndata Composite : Nat -> Type where\n  MkComposite : (x : Nat) -> LTE 2 x -> LT x n -> Factor x n -> Composite n\n\n||| A witness of a `Nat` being a prime number\npublic export\ndata Prime : Nat -> Type where\n  MkPrime : ((x : Nat) -> LTE 2 x -> LT x n -> NotFactor x n) -> Prime n\n\n||| Primality of a `Nat`\npublic export\ndata Primality : Nat -> Type where\n  ItIsPrime : Prime n -> Primality n\n  ItIsComposite : Composite n -> Primality n\n\n||| This module's pseudo prime\ndata PseudoPrime : Nat -> Nat -> Type where\n  MkPseudoPrime : LTE 2 l -> LT l n -> ((x : Nat) -> LTE l x -> LT x n -> NotFactor x n) -> PseudoPrime l n\n\n||| Constructs a trivial pseudo prime of a `Nat`\ntrivial : (n : Nat) -> LTE 2 n -> PseudoPrime n (S n)\ntrivial 0 lte_2_n = void $ absurd lte_2_n\ntrivial 1 lte_2_n = void $ absurd lte_2_n\ntrivial (S (S n)) lte_2_n = MkPseudoPrime lte_2_n lteRefl lemma\n  where\n  gamma : (k : Nat) -> S k = plus (mult k 1) 1\n  gamma k =\n    rewrite multOneRightNeutral k in\n    rewrite plusCommutative k 1 in\n    Refl\n  lemma : (x : Nat) -> LTE (S (S n)) x -> LTE (S x) (S (S (S n))) -> NotFactor x (S (S (S n)))\n  lemma x lte lte' =\n    let ccc = LTEIsAntisymmetric (S (S n)) x lte (fromLteSucc lte') in\n    rewrite sym ccc in\n    ProperRemExists 1 0 (gamma (S (S n)))\n\n||| Realize that a `PseudoPrime` is an actual `Prime`\nrealize : PseudoPrime 2 n -> Prime n\nrealize (MkPseudoPrime _ _ prf) = MkPrime prf\n\n||| Strengthen a `PseudoPrime`, used to prove some other stuff\nstrengthen : {l : Nat} -> LTE 2 l -> PseudoPrime (S l) n -> NotFactor l n -> PseudoPrime l n\nstrengthen lte (MkPseudoPrime _ lt_l_n prf) notfactor_l_n = MkPseudoPrime lte (lteSuccLeft lt_l_n) lemma\n  where\n  lemma : (x : Nat) -> LTE l x -> LT x n -> NotFactor x n\n  lemma x lte_l_x lt_x_n = case isLTE (S l) x of\n    Yes lte_Sl_x => prf x lte_Sl_x lt_x_n\n    No contra => rewrite (LTEIsAntisymmetric x l (fromLteSucc $ notlteIsLT (S l) x $ notLteIsnotlte (S l) x contra) lte_l_x) in notfactor_l_n\n\n||| The prime number 2, proved manually\npublic export\nprime2 : Prime 2\nprime2 = MkPrime lemma\n  where\n  lemma : (x : Nat) -> LTE 2 x -> LT x 2 -> NotFactor x 2\n  lemma 0 lte_2_0 _ = void $ absurd lte_2_0\n  lemma 1 lte_2_1 _ = void $ absurd lte_2_1\n  lemma (S (S n)) _ lt_2_n = void $ absurd lt_2_n\n\n||| Calculates a `Nat`'s primality\npublic export\nprimality : (n : Nat) -> LTE 2 n -> Primality n\nprimality 0 lte_2_0 = void $ absurd lte_2_0\nprimality 1 lte_2_1 = void $ absurd lte_2_1\nprimality 2 lte_2_2 = ItIsPrime prime2\nprimality n@(S (S (S k))) lte_2_n = lemma (trivial (S (S k)) (LTESucc $ LTESucc $ LTEZero))\n  where\n  lemma : {x : Nat} -> PseudoPrime (S (S x)) (S (S (S k))) -> Primality (S (S (S k)))\n  lemma {x = 0} p = ItIsPrime (realize p)\n  lemma {x = (S y)} p@(MkPseudoPrime lte_2_x lte_x_n prf) =\n    case decFactor (S (S (S k))) (S (S y)) of\n      ItIsFactor factor => ItIsComposite $ MkComposite (S (S y)) (lteAddRight {m = y} 2) (lteSuccLeft lte_x_n) factor\n      ItIsNotFactor not_factor => lemma (strengthen (lteAddRight {m = y} 2) p not_factor)\n\n||| Check if a `Nat` is a prime number\npublic export\nisPrime : (n : Nat) -> {auto okay : LTE 2 n} -> Bool\nisPrime 1 = void $ absurd okay\nisPrime (S (S n)) = case primality (S (S n)) okay of\n  ItIsPrime _ => True\n  ItIsComposite _ => False\n", "meta": {"hexsha": "aff4233dba49550d6d3d1971adad7d4638ae01d6", "size": 4802, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Extra/Nat/Prime.idr", "max_stars_repo_name": "tensorknower69/idris2-extra", "max_stars_repo_head_hexsha": "b856915276987758da8c38865b4b336079bc1e9a", "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/Extra/Nat/Prime.idr", "max_issues_repo_name": "tensorknower69/idris2-extra", "max_issues_repo_head_hexsha": "b856915276987758da8c38865b4b336079bc1e9a", "max_issues_repo_licenses": ["MIT"], "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/Extra/Nat/Prime.idr", "max_forks_repo_name": "tensorknower69/idris2-extra", "max_forks_repo_head_hexsha": "b856915276987758da8c38865b4b336079bc1e9a", "max_forks_repo_licenses": ["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.811023622, "max_line_length": 141, "alphanum_fraction": 0.6686797168, "num_tokens": 1748, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.865224072151174, "lm_q2_score": 0.6261241772283034, "lm_q1q2_score": 0.541737710293776}}
{"text": "module Control.Optics.Types\n\nimport public Control.Applicative.Const\nimport public Control.Monad.Identity\nimport public Data.Contravariant\nimport public Data.Functor.Tagged\nimport public Data.Morphisms\nimport public Data.Profunctor\nimport public Data.Profunctor.Choice\n\npublic export\nSimple : (Type -> Type -> Type -> Type -> Type) -> Type -> Type -> Type\nSimple p s a = p s s a a\n\npublic export\nOptical : (p : Type -> Type -> Type)\n       -> (q : Type -> Type -> Type)\n       -> (f : Type -> Type)\n       -> (s : Type)\n       -> (t : Type)\n       -> (a : Type)\n       -> (b : Type)\n       -> Type\nOptical p q f s t a b = p a (f b) -> q s (f t)\n\npublic export\nOptic : (Type -> Type -> Type) -> (Type -> Type) -> Type -> Type -> Type -> Type -> Type\nOptic p = Optical p p\n\npublic export\nLensLike : (Type -> Type) -> Type -> Type -> Type -> Type -> Type\nLensLike = Optic Morphism\n\npublic export\nLens : Type -> Type -> Type -> Type -> Type\nLens s t a b = {f : Type -> Type} -> Functor f => LensLike f s t a b\n\npublic export\nSetter : Type -> Type -> Type -> Type -> Type\nSetter s t a b = LensLike Identity s t a b\n\npublic export\nGetter : Type -> Type -> Type\nGetter s a = {f : _} -> (Contravariant f, Functor f) => Simple (LensLike f) s a\n\npublic export\nGetting : Type -> Type -> Type -> Type\nGetting r s a = Simple (LensLike (Const r)) s a\n\npublic export\nPrism : Type -> Type -> Type -> Type -> Type\nPrism s t a b = {p, f : _} -> (Choice p, Applicative f) => Optic p f s t a b\n\npublic export\nReview : Type -> Type -> Type -> Type -> Type\nReview s t a b = {p : _} -> (Choice p) => Optic p Identity s t a b\n\npublic export\nAReview : Type -> Type -> Type\nAReview t b = Simple (Optic Tagged Identity) t b\n", "meta": {"hexsha": "79962f71d647de68d0e8ed0fdb074d6a166758d7", "size": 1697, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Control/Optics/Types.idr", "max_stars_repo_name": "tensorknower69/idris2-optics", "max_stars_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "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/Control/Optics/Types.idr", "max_issues_repo_name": "tensorknower69/idris2-optics", "max_issues_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_issues_repo_licenses": ["MIT"], "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/Control/Optics/Types.idr", "max_forks_repo_name": "tensorknower69/idris2-optics", "max_forks_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_forks_repo_licenses": ["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.8196721311, "max_line_length": 88, "alphanum_fraction": 0.6163818503, "num_tokens": 509, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711756575749, "lm_q2_score": 0.6370307806984444, "lm_q1q2_score": 0.5414578016003195}}
{"text": "module PositiveBug\n\ndata MyEmptyList : Type\ndata EmptyListLTE : Nat -> MyEmptyList -> Type\n\n-- mutual\ndata MyEmptyList : Type where\n    MyNil : MyEmptyList\n\ndata EmptyListLTE : Nat -> MyEmptyList -> Type where\n    NilLTE : (x : Nat) -> EmptyListLTE x MyNil\n", "meta": {"hexsha": "18a7f8ed6f529a5d8116543cfaae1b64725d0b8c", "size": 257, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "public/post_assets/idris/idris-intro/PositiveBug.idr", "max_stars_repo_name": "nokeeo/donald-pinckney.github.io", "max_stars_repo_head_hexsha": "b8b2f401b6b33ff418c9ae192f0bfc42e21ee0de", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2017-07-27T22:47:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-17T16:04:00.000Z", "max_issues_repo_path": "public/post_assets/idris/idris-intro/PositiveBug.idr", "max_issues_repo_name": "nokeeo/donald-pinckney.github.io", "max_issues_repo_head_hexsha": "b8b2f401b6b33ff418c9ae192f0bfc42e21ee0de", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 20, "max_issues_repo_issues_event_min_datetime": "2018-11-29T04:16:32.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T04:50:06.000Z", "max_forks_repo_path": "public/post_assets/idris/idris-intro/PositiveBug.idr", "max_forks_repo_name": "nokeeo/donald-pinckney.github.io", "max_forks_repo_head_hexsha": "b8b2f401b6b33ff418c9ae192f0bfc42e21ee0de", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 11, "max_forks_repo_forks_event_min_datetime": "2017-11-22T03:22:19.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T07:09:09.000Z", "avg_line_length": 21.4166666667, "max_line_length": 52, "alphanum_fraction": 0.7120622568, "num_tokens": 74, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8267117940706734, "lm_q2_score": 0.6548947290421275, "lm_q1q2_score": 0.5414091963738448}}
{"text": "module Control.Monad.Free\n\nimport Control.EffectAlgebra\n\n||| Higher-order free monad.\n||| Acts as a syntax generator of effectful programs.\npublic export\ndata Free : (sig : (Type -> Type) -> (Type -> Type))\n         -> Type\n         -> Type where\n  Return : a -> Free sig a\n  Op : sig (Free sig) a -> Free sig a\n\npublic export\nSyntax sig => Functor (Free sig) where\n  map f (Return x) = Return (f x)\n  map f (Op op)    = Op (emap (map f) op)\n\npublic export\nSyntax sig => Applicative (Free sig) where\n  pure v = Return v\n\n  Return v <*> prog = map v prog\n  Op op    <*> prog = Op (emap (<*> prog) op)\n\npublic export\nSyntax sig => Monad (Free sig) where\n  Return v >>= prog = prog v\n  Op op    >>= prog = Op (emap (>>= prog) op)\n\npublic export\nreturn : a -> Free sig a\nreturn = Return\n\npublic export\ninject : Inj sub sup => sub (Free sup) a -> Free sup a\ninject = Op . inj\n\npublic export\nproject : Prj sup sub => Free sup a -> Maybe (sub (Free sup) a)\nproject (Op s) = Just (prj s)\nproject _ = Nothing\n\n", "meta": {"hexsha": "590bd156e4be0cff63bfa3e35129af1e15b5ff75", "size": 1001, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Control/Monad/Free.idr", "max_stars_repo_name": "claymager/Idris2-Effect", "max_stars_repo_head_hexsha": "8d0f5381454931e94c855ebc11253e0bcfd5b051", "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/Control/Monad/Free.idr", "max_issues_repo_name": "claymager/Idris2-Effect", "max_issues_repo_head_hexsha": "8d0f5381454931e94c855ebc11253e0bcfd5b051", "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/Control/Monad/Free.idr", "max_forks_repo_name": "claymager/Idris2-Effect", "max_forks_repo_head_hexsha": "8d0f5381454931e94c855ebc11253e0bcfd5b051", "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.75, "max_line_length": 63, "alphanum_fraction": 0.6253746254, "num_tokens": 296, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8596637577007394, "lm_q2_score": 0.6297746213017459, "lm_q1q2_score": 0.541394417452819}}
{"text": "module Main\n\nimport Data.Vect\n\n%default total\n\ndata Store : Type where\n  Create : (size : Nat) ->\n           (elems : Vect size String) ->\n           Store\n{-\n  Splitting up the Commands for Processing from the strings that represent them\n  is what makes easier to isolate parsing and it's failure modes from the\n  processing.\n-}\ndata Command = Add String\n             | Get Integer\n             | Search String\n             | Size\n             | Quit\n\nsize : Store -> Nat\nsize (Create size' elems') = size'\n\nitems : (store : Store) -> Vect (size store) String\nitems (Create size' elems') = elems'\n\nadd : (store : Store) -> String -> Store\nadd (Create size elems) newElem = Create _ (elems ++ [newElem])\n\ngetByIndex : (store : Store) -> (pos : Integer) -> String\ngetByIndex store pos = case integerToFin pos (size store) of\n                            Nothing => \"Out of Range\"\n                            Just pos' => index pos' (items store)\n\ngetIndexByElement : (store : Store) -> (el : String) -> String\ngetIndexByElement store el = case elemIndex el (items store) of\n                                 Just i => show (finToNat i)\n                                 Nothing => \"?\"\n\nsearch : (store : Store) -> (query : String) -> (n : Nat ** Vect n String)\nsearch store query = filter (isInfixOf query) (items store)\n\nformatMatches : (store : Store) -> (results : (n : Nat ** Vect n String)) -> String\nformatMatches store (_ ** []) = \"No matches\\n\"\nformatMatches store (n ** rs) = foldr (++) \"\" (map resultToString rs)\n  where\n    resultToString : String -> String\n    resultToString r = (getIndexByElement store r) ++ \": \" ++ r ++ \"\\n\"\n\n\nrun : Store -> Command -> Maybe (String, Store)\nrun store (Search query) = let results = search store query in\n                               Just( (formatMatches store results), store )\nrun store (Add item) = Just (\"ID: \" ++ show (size store) ++ \"\\n\", add store item)\nrun store (Get pos) = Just (\"Result: \" ++ show (getByIndex store pos) ++ \"\\n\", store)\nrun store Size = Just (show (size store) ++ \" item(s)\\n\", store)\nrun store Quit = Nothing\n\ncleanInputs : String -> (String, String)\ncleanInputs input = case (span (/= ' ') input) of\n                         (cmd, args) => (toLower cmd, ltrim args)\n\nparseCommand : (cmd : String) -> (args : String) -> Maybe Command\nparseCommand \"get\" index = case all isDigit (unpack index) of\n                                False => Nothing\n                                True => Just (Get (cast index))\nparseCommand \"search\" query = Just (Search query)\nparseCommand \"add\" value = Just (Add value)\nparseCommand \"size\" \"\"  = Just Size\nparseCommand \"quit\" \"\"  = Just Quit\nparseCommand _  _ = Nothing\n\nparse : (input : String) -> Maybe Command\nparse input = case cleanInputs input of\n                   (cmd, args) => parseCommand cmd args\n\nprocessInput : Store -> String -> Maybe (String, Store)\nprocessInput store input\n= case parse input of\n       Just validCommand => run store validCommand\n       Nothing => Just (\"Invalid command\\n\", store)\n\npartial main : IO ()\nmain = replWith (Create _ []) \"Command > \" processInput\n", "meta": {"hexsha": "757d16a6fabd9509ebfbdbf6d00f5de788f4d247", "size": 3102, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris/4.3-Interactiveness.idr", "max_stars_repo_name": "ostera/asdf", "max_stars_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2017-03-02T22:25:19.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T18:22:11.000Z", "max_issues_repo_path": "idris/4.3-Interactiveness.idr", "max_issues_repo_name": "ostera/asdf", "max_issues_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2019-12-05T22:45:56.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-05T22:45:58.000Z", "max_forks_repo_path": "idris/4.3-Interactiveness.idr", "max_forks_repo_name": "ostera/asdf", "max_forks_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_forks_repo_licenses": ["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.0697674419, "max_line_length": 85, "alphanum_fraction": 0.6002578981, "num_tokens": 763, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059609645723, "lm_q2_score": 0.6825737214979745, "lm_q1q2_score": 0.5413532873178154}}
{"text": "module Issue835\n\nbaz : (x : Nat) -> {P2 : Nat -> Type} -> P2 x\nbaz x = ?rhs3\n\nfoo : {P : Nat -> Type}  -> Dec (P 0)\nfoo = ?rhs1 where\n\n\n  bar : {P2 : Nat -> Type} ->\n          (x : Nat)\n          -> P2 x\n  bar x with (S x)\n     bar x | x1 =  ?rhs2\n", "meta": {"hexsha": "81ac94f4de25fe7a7bc0ab84a96f4cfa43851a46", "size": 248, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/interactive020/Issue835.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/interactive020/Issue835.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/interactive020/Issue835.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 16.5333333333, "max_line_length": 45, "alphanum_fraction": 0.435483871, "num_tokens": 100, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7853085808877581, "lm_q2_score": 0.6893056295505783, "lm_q1q2_score": 0.5413176257403073}}
{"text": "module Data.Verified.Trifunctor\n\nimport Data.Trifunctor\n\n%default total\n%access public export\n\n||| Verified Trifunctor\n||| A Trifunctor for which identity and composition laws are verified\ninterface Trifunctor t => VerifiedTrifunctor (t : Type -> Type -> Type -> Type) where\n  trifunctorIdentity : {a : Type} -> {b : Type} -> {c : Type} ->\n                       (x : t a b c) ->\n                       timap Basics.id Basics.id Basics.id x = x\n  trifunctorComposition : {a : Type} -> {b : Type} -> {c : Type} ->\n                          {a1 : Type} -> {b1 : Type} -> {c1 : Type} ->\n                          (x : t a b c) ->\n                          (fa1 : a -> a1) -> (fb1 : b -> b1) -> (fc1 : c -> c1) ->\n                          (fa2 : a1 -> a2) -> (fb2 : b1 -> b2) -> (fc2 : c1 -> c2) ->\n                          (timap (fa2 . fa1) (fb2 . fb1) (fc2 . fc1) x) =\n                          (timap fa2 fb2 fc2 . timap fa1 fb1 fc1) x\n", "meta": {"hexsha": "655d13039fe1b7e04fec6f5673916f3f47fbcafe", "size": 938, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Verified/Trifunctor.idr", "max_stars_repo_name": "lemastero/Idris-Trifunctors", "max_stars_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "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/Data/Verified/Trifunctor.idr", "max_issues_repo_name": "lemastero/Idris-Trifunctors", "max_issues_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-10-13T21:31:36.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-13T21:31:36.000Z", "max_forks_repo_path": "src/Data/Verified/Trifunctor.idr", "max_forks_repo_name": "lemastero/Idris-Trifunctors", "max_forks_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-19T04:35:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-19T04:35:47.000Z", "avg_line_length": 44.6666666667, "max_line_length": 85, "alphanum_fraction": 0.460554371, "num_tokens": 292, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8175744939732855, "lm_q2_score": 0.6619228691808011, "lm_q1q2_score": 0.5411712548198387}}
{"text": "-- exercises in \"Type-Driven Development with Idris\"\n-- chapter 4\n\n-- check that all functions are total\n%default total\n\n||| Powersources for vehicles\ndata PowerSource = Petrol |\u00a0Pedal | Electric\n\n||| Vehicles\ndata Vehicle : PowerSource -> Type where\n  Unicycle : Vehicle Pedal\n  Bicycle : Vehicle Pedal\n  Motorcycle : (fuel : Nat) -> Vehicle Petrol\n  Car : (fuel : Nat) -> Vehicle Petrol\n  Bus : (fuel : Nat) -> Vehicle Petrol\n  Tram : Vehicle Electric\n  ElectricCar : Vehicle Electric\n\nwheels : Vehicle power -> Nat\nwheels Unicycle = 1\nwheels Bicycle = 2\nwheels (Motorcycle fuel) = 2\nwheels (Car fuel) = 4\nwheels (Bus fuel) = 4\nwheels Tram = 10\nwheels ElectricCar = 4\n\nrefuel : Vehicle Petrol -> Vehicle Petrol\nrefuel (Motorcycle fuel) = Motorcycle 50\nrefuel (Car fuel) = Car 100\nrefuel (Bus fuel) = Bus 200\nrefuel Unicycle impossible\nrefuel Bicycle impossible\nrefuel Tram impossible\nrefuel ElectricCar impossible\n", "meta": {"hexsha": "eb7a9ec9e2386bc669936aaa738d1b8d42d9c0b2", "size": 916, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter4/Vehicle.idr", "max_stars_repo_name": "pascalpoizat/idris-book", "max_stars_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-08-16T00:58:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T01:07:37.000Z", "max_issues_repo_path": "chapter4/Vehicle.idr", "max_issues_repo_name": "pascalpoizat/idris-book", "max_issues_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "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": "chapter4/Vehicle.idr", "max_forks_repo_name": "pascalpoizat/idris-book", "max_forks_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-23T03:15:39.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-23T03:15:39.000Z", "avg_line_length": 24.7567567568, "max_line_length": 52, "alphanum_fraction": 0.7325327511, "num_tokens": 269, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.812867299704166, "lm_q2_score": 0.665410558746814, "lm_q1q2_score": 0.540890484083163}}
{"text": "{-data SnocList ty = Empty | Snoc (SnocList ty) ty\n\nreverseSnoc : SnocList ty -> List ty\nreverseSnoc Empty = [] \nreverseSnoc (Snoc xs x) = x :: reverseSnoc xs-}\n\ndata SnocList : List a -> Type where\n  Empty : SnocList []\n  Snoc : (rec : SnocList xs) -> SnocList (xs ++ [x])\n\nsnocListHelp : (snoc : SnocList input) -> (rest : List a) ->\n               SnocList (input ++ rest)\nsnocListHelp {input} snoc [] = rewrite appendNilRightNeutral input in snoc\nsnocListHelp {input} snoc (x :: xs) = rewrite appendAssociative input [x] xs in\n                                      snocListHelp (Snoc snoc {x}) xs\n\nsnocList : (xs : List a) -> SnocList xs\nsnocList xs = snocListHelp Empty xs\n\nmyReverseHelper : (input : List a) -> SnocList input -> List a\nmyReverseHelper [] Empty = []\nmyReverseHelper (xs ++ [x]) (Snoc rec) = x :: myReverseHelper xs rec\n\n{-myReverse : List a -> List a\nmyReverse xs = myReverseHelper xs (snocList xs)-}\n\nmyReverse : List a -> List a\nmyReverse input with (snocList input)\n  myReverse [] | Empty = []\n  myReverse (xs ++ [x]) | (Snoc rec) = x :: myReverse xs | rec\n\nisSuffix : Eq a => List a -> List a -> Bool\nisSuffix input1 input2 with (snocList input1)\n  isSuffix [] input2 | Empty = True\n  isSuffix (xs ++ [x]) input2 | (Snoc xsrec) with (snocList input2)\n    isSuffix (xs ++ [x]) [] | (Snoc xsrec) | Empty = False\n    isSuffix (xs ++ [x]) (ys ++ [y]) | (Snoc xsrec) | (Snoc ysrec)\n      = if x == y then isSuffix xs ys | xsrec | ysrec\n                  else False\n\ndata SplitRec : List a -> Type where\n  SplitRecNil : SplitRec []\n  SplitRecOne : SplitRec [x]\n  SplitRecPair : (lrec : Lazy (SplitRec lefts)) ->\n                 (rrec : Lazy (SplitRec rights)) ->\n                 SplitRec (lefts ++ rights)\n\ntotal splitRec : (xs : List a) -> SplitRec xs\n", "meta": {"hexsha": "b109b88c89bcae3b807eb2368789348ded1162eb", "size": 1775, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type_driven_book/chp10/Snoc.idr", "max_stars_repo_name": "Ryxai/idris_book_notes", "max_stars_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "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_driven_book/chp10/Snoc.idr", "max_issues_repo_name": "Ryxai/idris_book_notes", "max_issues_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_issues_repo_licenses": ["MIT"], "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_driven_book/chp10/Snoc.idr", "max_forks_repo_name": "Ryxai/idris_book_notes", "max_forks_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_forks_repo_licenses": ["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.2244897959, "max_line_length": 79, "alphanum_fraction": 0.6146478873, "num_tokens": 561, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7461389930307512, "lm_q2_score": 0.7248702821204019, "lm_q1q2_score": 0.5408539823792332}}
{"text": "module Data.List.Fixes\n\n%default total\n%access export\n\npublic export\ndata PrefixOfBy : (holdsFor : type -> type -> Type)\n               -> (pref  : List type)\n               -> (input : List type)\n               -> Type where\n   Empty  : PrefixOfBy p Nil xs\n   Extend : (prf : p x y)\n         -> PrefixOfBy p xs ys\n         -> PrefixOfBy p (x::xs) (y::ys)\n\nrightIsEmpty : PrefixOfBy p (x :: xs) [] -> Void\nrightIsEmpty Empty impossible\nrightIsEmpty (Extend _ _) impossible\n\nnotPrefix : (contra : p x y -> Void)\n         -> PrefixOfBy p (x :: xs) (y :: ys)\n         -> Void\nnotPrefix contra (Extend prf x) = contra prf\n\nrestNotPrefix : (contra : PrefixOfBy p xs ys -> Void)\n             -> PrefixOfBy p (x :: xs) (y :: ys)\n             -> Void\nrestNotPrefix contra (Extend x y) = contra y\n\n\nisPrefixOfBy : (test : (x,y : type) -> Dec (p x y))\n            -> (pref, input : List type)\n            -> (Dec $ PrefixOfBy p pref input)\nisPrefixOfBy test [] input = Yes Empty\nisPrefixOfBy test (x :: xs) [] = No rightIsEmpty\nisPrefixOfBy test (x :: xs) (y :: ys) with (test x y)\n  isPrefixOfBy test (x :: xs) (y :: ys) | (Yes prf) with (isPrefixOfBy test xs ys)\n    isPrefixOfBy test (x :: xs) (y :: ys) | (Yes prf) | (Yes z) = Yes (Extend prf z)\n    isPrefixOfBy test (x :: xs) (y :: ys) | (Yes prf) | (No contra) =\n      No (restNotPrefix contra)\n\n  isPrefixOfBy test (x :: xs) (y :: ys) | (No contra) =\n      No (notPrefix contra)\n\n\nisPrefixOf : DecEq type\n          => (pref, input : List type)\n          -> Dec $ PrefixOfBy (=) pref input\nisPrefixOf = isPrefixOfBy decEq\n\npublic export\nSuffixOfBy : (holdsFor : type -> type -> Type)\n          -> (pref  : List type)\n          -> (input : List type)\n          -> Type\nSuffixOfBy holdsFor pref input =\n  PrefixOfBy holdsFor (reverse pref) (reverse input)\n\nisSuffixOfBy : (test : (x,y : type) -> Dec (p x y))\n            -> (pref, input : List type)\n            -> (Dec $ SuffixOfBy p pref input)\nisSuffixOfBy test pref input =\n  isPrefixOfBy test (reverse pref) (reverse input)\n\n\n\nisSuffixOf : DecEq type\n          => (suf, input : List type)\n          -> (Dec $ SuffixOfBy (=) suf input)\nisSuffixOf suf input =\n  isSuffixOfBy decEq suf input\n", "meta": {"hexsha": "d6fa2ec802524872a836471cfb3530c649eec3d8", "size": 2189, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/List/Fixes.idr", "max_stars_repo_name": "witt3rd/idris-containers", "max_stars_repo_head_hexsha": "6f4e06a0e85ee6336e493cee800fff42215da2ac", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 99, "max_stars_repo_stars_event_min_datetime": "2015-03-01T20:22:37.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-01T02:17:39.000Z", "max_issues_repo_path": "Data/List/Fixes.idr", "max_issues_repo_name": "witt3rd/idris-containers", "max_issues_repo_head_hexsha": "6f4e06a0e85ee6336e493cee800fff42215da2ac", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 30, "max_issues_repo_issues_event_min_datetime": "2015-03-23T19:17:35.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-01T13:05:44.000Z", "max_forks_repo_path": "Data/List/Fixes.idr", "max_forks_repo_name": "witt3rd/idris-containers", "max_forks_repo_head_hexsha": "6f4e06a0e85ee6336e493cee800fff42215da2ac", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 26, "max_forks_repo_forks_event_min_datetime": "2015-06-02T17:20:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-13T14:51:07.000Z", "avg_line_length": 30.4027777778, "max_line_length": 84, "alphanum_fraction": 0.576975788, "num_tokens": 665, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.72487026428967, "lm_q2_score": 0.7461389817407016, "lm_q1q2_score": 0.5408539608912076}}
{"text": "module Data.Compress.Utils.Misc\n\nimport Data.Fin\nimport Data.Vect\nimport Data.List\nimport Data.Bits\nimport Data.List1\nimport Data.SnocList\n\nexport\ntake_last : Nat -> SnocList a -> Maybe (List a)\ntake_last = loop Lin where\n  loop : SnocList a -> Nat -> SnocList a -> Maybe (List a)\n  loop acc Z _ = Just (asList acc)\n  loop acc (S n) (init :< last) = loop (acc :< last) n init\n  loop acc _ Lin = Nothing\n\nexport\nstream_concat : Stream (List a) -> Stream a\nstream_concat ([] :: ys) = stream_concat ys\nstream_concat ((x :: xs) :: ys) = x :: stream_concat (xs :: ys)\n\nexport\nindex_may : Nat -> List a -> Maybe a\nindex_may Z (x :: xs) = Just x\nindex_may (S n) (x :: xs) = index_may n xs\nindex_may _ [] = Nothing\n\nexport\ncount : Ord a => List a -> List (a, Nat)\ncount = map (\\xs => (head xs, length xs)) . group . sort\n", "meta": {"hexsha": "7935904f0a8d1057413f55764dfd506ede40775e", "size": 813, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Compress/Utils/Misc.idr", "max_stars_repo_name": "octeep/idris2-http", "max_stars_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "max_stars_repo_licenses": ["0BSD"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2022-01-05T11:39:50.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-20T10:43:01.000Z", "max_issues_repo_path": "src/Data/Compress/Utils/Misc.idr", "max_issues_repo_name": "octeep/idris2-http", "max_issues_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "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": "src/Data/Compress/Utils/Misc.idr", "max_forks_repo_name": "octeep/idris2-http", "max_forks_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "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.40625, "max_line_length": 63, "alphanum_fraction": 0.6580565806, "num_tokens": 258, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7662936430859597, "lm_q2_score": 0.7057850278370112, "lm_q1q2_score": 0.5408385802167488}}
{"text": "module Data.Queue1\n\nimport Data.List\nimport Data.List1\nimport Data.SnocList\n\n%default total\n\n-------------\n--- Queue ---\n-------------\n\n-- add from right, remove from left\nexport\nrecord Queue1 a where\n  constructor MkQueue\n  right : SnocList a\n  left  : List1 a\n\nexport\nsingleton : a -> Queue1 a\nsingleton = MkQueue [<] . singleton\n\nexport\nadd : a -> Queue1 a -> Queue1 a\nadd x = { right $= (:< x) }\n\n-- Constructs a `Queue1` which has all elements in the left part of the queue reverted\n%inline\npureLeftsFromSnoc : SnocList a -> Maybe $ Queue1 a\npureLeftsFromSnoc = map (MkQueue [<]) . fromList . cast\n\nexport\nremove : Queue1 a -> (a, Lazy (Maybe $ Queue1 a))\nremove $ MkQueue r (head ::: l) = (head,) $ delay $ case l of\n  []      => pureLeftsFromSnoc r\n  (x::xs) => Just $ MkQueue r (x:::xs)\n\nexport\nFunctor Queue1 where\n  map f = { left $= map f, right $= map f }\n\nexport\nfilter : (a -> Bool) -> Queue1 a -> Maybe $ Queue1 a\nfilter f $ MkQueue r l = do\n  let filteredR = filter f r\n  let Just filteredL = fromList $ filter f $ toList l\n    | Nothing => pureLeftsFromSnoc filteredR\n  Just $ MkQueue filteredR filteredL\n\n||| Returns a `List1` with newly added elements on the right and older elements in the left\nexport\ntoList1 : Queue1 a -> List1 a\ntoList1 $ MkQueue r l = l `appendl` cast r\n", "meta": {"hexsha": "d7ad03f516accf942d952872b361790f246d5432", "size": 1295, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Queue1.idr", "max_stars_repo_name": "buzden/idris2-coop", "max_stars_repo_head_hexsha": "39c00e062fad115c6fd22c2a229d52e478061bd7", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-02-20T11:06:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-20T11:06:17.000Z", "max_issues_repo_path": "src/Data/Queue1.idr", "max_issues_repo_name": "buzden/idris2-coop", "max_issues_repo_head_hexsha": "39c00e062fad115c6fd22c2a229d52e478061bd7", "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/Data/Queue1.idr", "max_forks_repo_name": "buzden/idris2-coop", "max_forks_repo_head_hexsha": "39c00e062fad115c6fd22c2a229d52e478061bd7", "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.5454545455, "max_line_length": 91, "alphanum_fraction": 0.6602316602, "num_tokens": 398, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7662936324115011, "lm_q2_score": 0.7057850216484838, "lm_q1q2_score": 0.5408385679406466}}
{"text": "module Q\nimport ZZ\nimport GCDZZ\nimport Divisors\nimport Monoid\nimport Rationals\nimport ZZUtils\nimport TwoVarDiophEq\nimport NatUtils\n\n\n\n|||data type for rationals\ndata Q : Type where\n  PbySq : (p: ZZ) -> (q: Nat) -> Q\n\nZQ : Q\nZQ = PbySq (Pos Z) Z\n\nOneQ : Q\nOneQ = PbySq (Pos (S Z)) Z\n\n|||data type which has the simplified form of a Rational number, a transversal group\ndata SimpQ : Type where\n SimplifiedQ : (p:ZZ) -> (q:ZZ) -> .(IsPositive q) -> .(GCDZ p q 1) -> SimpQ\n\n\n--Auxillary conversions to convert Q into a SimpQ\nQtoZZPair : Q -> ZZPair\nQtoZZPair (PbySq p q) = (p, Pos(S q))\n\nSimplifyToZZPair : (x:Q)-> (y: ZZPair ** (GCDZ (fst y) (snd y) 1))\nSimplifyToZZPair (PbySq p q)= simplifyWithProof (QtoZZPair (PbySq p q)) (PositiveZ{k=q})\n\nZZPairtoQ : ZZPair -> Q\nZZPairtoQ (p, Pos(S q)) = PbySq p q\n\n--auxillary functions for conversion of data types\n\nblah: {b:ZZ}-> {d:ZZ}-> (IsPositive b) -> (IsPositive d) -> (x: IsDivisibleZ b d) -> (IsPositive (fst x))\nblah Positive Positive ((Pos Z) ** pf) =  void (posIsNotPosTimesZero pf)\nblah Positive Positive ((NegS l)** pf) = void(PosTimesNegIsNotPos pf)\nblah Positive Positive ((Pos (S l))**pf) = Positive\n\ndDivsb: (GCDZ a b d) -> (IsDivisibleZ b d)\ndDivsb dgcdab = (snd (fst (snd dgcdab)))\n-- aux end\n\nZZtoSimpQ : (p:ZZ) ->(q:ZZ) -> (pf: IsPositive q) -> (d : ZZ ** GCDZ p q d) -> SimpQ\nZZtoSimpQ p q pf (d**dgcdab) = SimplifiedQ (aByd dgcdab) (fst (dDivsb dgcdab)) (blah pf (fst dgcdab) (dDivsb dgcdab)) (divideByGcdThenGcdOne dgcdab)\n\n|||Simplifies a rational number to its coprime form\nQtoSimpQ : Q -> SimpQ\nQtoSimpQ (PbySq p q) = ZZtoSimpQ p (Pos(S q)) Positive (gcdZZ p (Pos (S q)) RightPositive)\n\n|||addition over rational number\naddQ: Q -> Q -> Q\naddQ (PbySq p1 q1) (PbySq p2 q2) =\n  let\n    num : ZZ = (p1 * (Pos(S q2))) + (p2 * (Pos (S q1)))\n    denom: Nat = q1 * q2 + q1 + q2\n  in\n  PbySq num denom\n\n|||addition over the transversal group\naddSimpQ : SimpQ -> SimpQ -> SimpQ\naddSimpQ (SimplifiedQ p1 (Pos(S q1)) Positive gcd1) (SimplifiedQ p2 (Pos(S q2)) Positive gcd2) =\n                                          QtoSimpQ (addQ (PbySq p1 q1) (PbySq p2 q2))\n\n||| multiplication over Rationals\nmultQ: Q-> Q -> Q\nmultQ (PbySq p1 q1) (PbySq p2 q2) = PbySq (p1 * p2) (q1 * q2 + q1 + q2)\n\n|||Multiplication over the transversal group\nmultSimpQ : SimpQ -> SimpQ -> SimpQ\nmultSimpQ (SimplifiedQ p1 (Pos(S q1)) Positive gcd1) (SimplifiedQ p2 (Pos(S q2)) Positive gcd2) =\n                                          QtoSimpQ (multQ (PbySq p1 q1) (PbySq p2 q2))\n\n\n--Conversions from integers to aforementioned types\nZZtoQ : ZZ  -> Q\nZZtoQ x = PbySq x Z\n\nIntegertoQ : Integer -> Q\nIntegertoQ x = ZZtoQ(fromInt x)\n\nIntegertoSimpQ : Integer -> SimpQ\nIntegertoSimpQ x = QtoSimpQ (IntegertoQ x)\n\n--defining the + and * signs for Q and SimpQ\nimplementation Num Q where\n  (+) = addQ\n  (*) = multQ\n  fromInteger = IntegertoQ\n\nimplementation Num SimpQ where\n  (+) = addSimpQ\n  (*) = multSimpQ\n  fromInteger = IntegertoSimpQ\n\n|||Proves that addition over Q is commutative\naddQIsComm : (x:Q)->(y: Q)-> (x+y=y+x)\naddQIsComm (PbySq p1 q1) (PbySq p2 q2) =\n  rewrite plusCommutativeZ (p1 * (Pos(S q2))) (p2 * (Pos (S q1))) in\n  rewrite multCommutative q1 q2 in\n  rewrite plusCommutative (q2*q1 + q1) q2 in\n  rewrite plusAssociative q2 (q2 * q1) q1 in\n  rewrite plusCommutative q2 (q2 * q1) in\n  Refl\n--auxillary function\napYX : (x: Type)->(y: Type) -> (f: y -> x) -> (n: y) -> (m: y) -> n = m -> f n = f m\napYX x y f m m Refl = Refl\n\n{-\naddSimpQisComm : (x: SimpQ) -> (y: SimpQ) ->(x+y = y+x)\naddSimpQisComm (SimplifiedQ p1 (Pos(S q1)) Positive gcd1) (SimplifiedQ p2 (Pos(S q2)) Positive gcd2) =\n  let\n  sum :Q = ( (PbySq p1 q1)+(PbySq p2 q2))\n  in\n  rewrite addQIsComm (PbySq p1 q1) (PbySq p2 q2) in\n  Refl\n-}\n\n|||proves that multiplication over Q is commutative\nmultQisComm : (x:Q)-> (y: Q) -> (x*y = y*x)\nmultQisComm (PbySq p1 q1) (PbySq p2 q2) =\n  rewrite multCommutativeZ p1 p2 in\n  rewrite multCommutative q1 q2 in\n  rewrite plusCommutative (q2*q1 + q1) q2 in\n  rewrite plusAssociative q2 (q2 * q1) q1 in\n  rewrite plusCommutative q2 (q2 * q1) in\n  Refl\n\n|||Functions to give the IsIdentity type for Q over *\nleftMultId : (r : Q) -> (OneQ * r = r)\nleftMultId (PbySq p q) = rewrite multOneLeftNeutralZ p in Refl\n\nRightMultId : (r: Q)-> (r * OneQ = r)\nRightMultId r = trans (multQisComm r OneQ) (leftMultId r)\n\nOneIsQMultId : (a: Q) -> (a*OneQ =a, OneQ * a = a)\nOneIsQMultId a = (RightMultId a, leftMultId a)\n\n|||functions to give the IsIdentity type for Q over +\nleftAddId : (r : Q) ->  (ZQ + r = r)\nleftAddId (PbySq p q) =\n  rewrite multOneRightNeutralZ p in\n  rewrite plusZeroLeftNeutralZ p in\n  Refl\n\nrightAddId : (r: Q) -> (r + ZQ = r)\nrightAddId r = trans (addQIsComm r ZQ) (leftAddId r)\n\nZIsQAddId : (a:Q)->((a+ZQ)=a, (ZQ+a)=a)\nZIsQAddId a = (rightAddId a, leftAddId a)\n\n\n|||Auxillary functions\nmultZero : (n: Nat) -> mult n Z = Z\nmultZero Z = Refl\nmultZero (S k) = multZero k\n\n\n\nAux1 : (n: Nat) -> (q : Nat) -> Nat -> Q\nAux1 n q m = PbySq (Pos (plus m n)) q\n\nAux2: (n: Nat) -> (q: Nat) -> Nat -> Q\nAux2 n q m = PbySq (plusZ (plusZ (Pos 0) (negNat m)) (NegS n)) q\n{-\n||| The IdentityExists type for Q over +\nQAddIdExists : Type\nQAddIdExists = (ZQ ** (ZIsQAddId))\n-}\n", "meta": {"hexsha": "48f3b90edfafda6ced6504f627484acc20ae8e00", "size": 5209, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Code/Q.idr", "max_stars_repo_name": "anotherArka/LTS2019", "max_stars_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-01-16T18:03:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-13T16:28:41.000Z", "max_issues_repo_path": "Code/Q.idr", "max_issues_repo_name": "anotherArka/LTS2019", "max_issues_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 58, "max_issues_repo_issues_event_min_datetime": "2019-01-08T11:22:38.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-21T10:26:10.000Z", "max_forks_repo_path": "Code/Q.idr", "max_forks_repo_name": "anotherArka/LTS2019", "max_forks_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 22, "max_forks_repo_forks_event_min_datetime": "2019-01-08T05:56:23.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-31T03:58:00.000Z", "avg_line_length": 29.7657142857, "max_line_length": 148, "alphanum_fraction": 0.6463812632, "num_tokens": 2081, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8688267694452331, "lm_q2_score": 0.6224593312018545, "lm_q1q2_score": 0.5408093298391476}}
{"text": "module Main\n\nimport Data.Nat\nimport Data.Vect\nimport Data.List\nimport LinearTypes\nimport Control.Linear.LIO\nimport Unitary\nimport QStateT\nimport Teleportation\nimport System.Random\nimport Injection\nimport QFT\nimport Grover\nimport AlterningBitsOracle\nimport VQE\nimport Complex\nimport QuantumOp\nimport CoinToss\nimport QAOA\nimport Graph\nimport Examples\nimport RUS\n\n-- %default total\n  \n\n||| Perform 1000 fair coin tosses and count the number of heads\n||| (via simulating the quantum dynamics).\ntestCoins : IO ()\ntestCoins = do\n  let f = coin {t = SimulatedOp}\n  s <- sequence (Data.List.replicate 1000 f)\n  let heads = filter (== True) s\n  putStrLn $ \"Number of heads: \" ++ (show (length heads))\n\n\n||| Call the drawTeleportation function (using the SimulatedOp implementation)\n||| then execute the runTeleportation function 1000 times and report on the\n||| observed measurement results on the third qubit\n||| (which is in state |+> at the end of the teleportation protocol).\nexport\ntestTeleport : IO ()\ntestTeleport = do\n  drawTeleportation {t = SimulatedOp}\n  l <- sequence (Data.List.replicate 1000 (runTeleportation {t = SimulatedOp}))\n  let nbT = length $ filter (\\x => (last x) == True) l\n  putStrLn \"\\n\\nFor 1000 measurements\"\n  putStrLn (\"Number of True measurements : \" ++ show nbT) \n\n||| Test graph for the QAOA problem\nexport\ngraph1 : Graph 5\ngraph1 = AddVertex (AddVertex (AddVertex (AddVertex (AddVertex Empty []) [True]) [True, True]) [False, True, False]) [False, False, True, True]\n\n||| Execute QAOA with 100 samples on the previous graph to solve the MAXCUT problem\nexport\ntestQAOA : IO (Cut 5)\ntestQAOA = do\n  QAOA {t = SimulatedOp} 100 1 graph1\n\n\n||| Small test for the VQE algorithm\nexport\ntestVQE : IO Double\ntestVQE = do\n  putStrLn \"Test VQE\"\n  let hamiltonian = [(2, [PauliX, PauliY]),(3,[PauliZ, PauliI])]\n  VQE {t = SimulatedOp} 2 hamiltonian 5 10 5\n\n\nexport\nmain : IO ()\nmain = do\n\n  -- Execute the example file and draw the circuit examples\n  drawExamples\n\n  -- Draw the Quantum Fourier Transform for n = 3\n--  putStrLn \"\\n\\n\\nQuantum Fourier Transform for n = 3\"\n--  draw (qft 3)\n\n\n  -- Execute the coin toss example\n  putStrLn \"\\nTest coin toss by performing 1000 coin tosses.\"\n  testCoins\n\n  -- Teleportation protocol\n--  putStrLn \"\\nTest Teleportation protocol\"\n--  testTeleport\n\n  -- Repeat until success\n  putStrLn \"\\nTest 'Repeat Until Success'. Probability to measure '1' is 2/3 for this example.\"\n  testMultipleRUS 10000\n\n  -- VQE\n--  putStrLn \"\\nSmall test with VQE\"\n--  r <- testVQE\n--  putStrLn $ \"result from VQE : \" ++ show r\n\n  -- QAOA\n--  putStrLn \"\\nSmall test with QAOA\"\n--  cut <- testQAOA\n--  putStrLn $ \"result from QAOA : \" ++ show cut\n\n  pure ()\n\n\n  \n\n\n", "meta": {"hexsha": "d28d2a3a66516658e514947569686a2fcf513943", "size": 2698, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Main.idr", "max_stars_repo_name": "zamdzhiev/Qimaera", "max_stars_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2021-08-24T14:36:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-24T00:36:11.000Z", "max_issues_repo_path": "Main.idr", "max_issues_repo_name": "zamdzhiev/Qimaera", "max_issues_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Main.idr", "max_forks_repo_name": "zamdzhiev/Qimaera", "max_forks_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_forks_repo_licenses": ["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.0892857143, "max_line_length": 143, "alphanum_fraction": 0.7120088955, "num_tokens": 801, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7956581000631542, "lm_q2_score": 0.6791787056691698, "lm_q1q2_score": 0.5403940385560839}}
{"text": "module Data.Utils\n\nimport Data.Vect\n\nexport\nenumerateVect : {n : Nat} -> Vect n a -> Vect n (Int, a)\nenumerateVect l = enumerate' 0 l where\n  enumerate' : {n : Nat} -> Int -> Vect n a -> Vect n (Int, a)\n  enumerate' _ [] = []\n  enumerate' i (x::xs) = (i, x)::(enumerate' (i+1) xs)\n\n", "meta": {"hexsha": "da1811fceb26d7c36af199debf0224d16f6020b0", "size": 282, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Utils.idr", "max_stars_repo_name": "boxfire/rapid", "max_stars_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "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/Data/Utils.idr", "max_issues_repo_name": "boxfire/rapid", "max_issues_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "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/Data/Utils.idr", "max_forks_repo_name": "boxfire/rapid", "max_forks_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "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.5, "max_line_length": 62, "alphanum_fraction": 0.5886524823, "num_tokens": 97, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7185943805178138, "lm_q2_score": 0.7520125737597972, "lm_q1q2_score": 0.5403920095825282}}
{"text": "totalLen : List String -> Nat\ntotalLen xs = foldr (\\el, acc  => length el  + acc) 0 xs  \n", "meta": {"hexsha": "66c1850a09c9353deb9e01c151bbf6bcc1fc6889", "size": 89, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris-exercises/File.idr", "max_stars_repo_name": "0nkery/tt-tutorials", "max_stars_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "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": "idris-exercises/File.idr", "max_issues_repo_name": "0nkery/tt-tutorials", "max_issues_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "idris-exercises/File.idr", "max_forks_repo_name": "0nkery/tt-tutorials", "max_forks_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_forks_repo_licenses": ["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.6666666667, "max_line_length": 58, "alphanum_fraction": 0.6179775281, "num_tokens": 30, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7799929002541068, "lm_q2_score": 0.6926419894793248, "lm_q1q2_score": 0.540255834211753}}
{"text": "module Data.List\n\nimport Data.Nat\nimport Data.List1\n\npublic export\nisNil : List a -> Bool\nisNil [] = True\nisNil _  = False\n\npublic export\nisCons : List a -> Bool\nisCons [] = False\nisCons _  = True\n\npublic export\nsnoc : List a -> a -> List a\nsnoc xs x = xs ++ [x]\n\npublic export\ntake : Nat -> List a -> List a\ntake (S k) (x :: xs) = x :: take k xs\ntake _ _ = []\n\npublic export\ndrop : (n : Nat) -> (xs : List a) -> List a\ndrop Z     xs      = xs\ndrop (S n) []      = []\ndrop (S n) (_::xs) = drop n xs\n\n||| Satisfiable if `k` is a valid index into `xs`\n|||\n||| @ k the potential index\n||| @ xs the list into which k may be an index\npublic export\ndata InBounds : (k : Nat) -> (xs : List a) -> Type where\n    ||| Z is a valid index into any cons cell\n    InFirst : InBounds Z (x :: xs)\n    ||| Valid indices can be extended\n    InLater : InBounds k xs -> InBounds (S k) (x :: xs)\n\npublic export\nUninhabited (InBounds k []) where\n    uninhabited InFirst impossible\n    uninhabited (InLater _) impossible\n\n||| Decide whether `k` is a valid index into `xs`\npublic export\ninBounds : (k : Nat) -> (xs : List a) -> Dec (InBounds k xs)\ninBounds _ [] = No uninhabited\ninBounds Z (_ :: _) = Yes InFirst\ninBounds (S k) (x :: xs) with (inBounds k xs)\n  inBounds (S k) (x :: xs) | (Yes prf) = Yes (InLater prf)\n  inBounds (S k) (x :: xs) | (No contra)\n      = No $ \\(InLater y) => contra y\n\n||| Find a particular element of a list.\n|||\n||| @ ok a proof that the index is within bounds\npublic export\nindex : (n : Nat) -> (xs : List a) -> {auto ok : InBounds n xs} -> a\nindex Z (x :: xs) {ok = InFirst} = x\nindex (S k) (_ :: xs) {ok = InLater _} = index k xs\n\n||| Generate a list by repeatedly applying a partial function until exhausted.\n||| @ f the function to iterate\n||| @ x the initial value that will be the head of the list\npublic export\niterate : (f : a -> Maybe a) -> (x : a) -> List a\niterate f x  = x :: case f x of\n  Nothing => []\n  Just y => iterate f y\n\npublic export\ntakeWhile : (p : a -> Bool) -> List a -> List a\ntakeWhile p []      = []\ntakeWhile p (x::xs) = if p x then x :: takeWhile p xs else []\n\npublic export\ndropWhile : (p : a -> Bool) -> List a -> List a\ndropWhile p []      = []\ndropWhile p (x::xs) = if p x then dropWhile p xs else x::xs\n\npublic export\nfilter : (p : a -> Bool) -> List a -> List a\nfilter p [] = []\nfilter p (x :: xs)\n   = if p x\n        then x :: filter p xs\n        else filter p xs\n\n||| Find the first element of the list that satisfies the predicate.\npublic export\nfind : (p : a -> Bool) -> (xs : List a) -> Maybe a\nfind p [] = Nothing\nfind p (x::xs) = if p x then Just x else find p xs\n\n||| Find associated information in a list using a custom comparison.\npublic export\nlookupBy : (a -> a -> Bool) -> a -> List (a, b) -> Maybe b\nlookupBy p e []      = Nothing\nlookupBy p e ((l, r) :: xs) =\n  if p e l then\n    Just r\n  else\n    lookupBy p e xs\n\n||| Find associated information in a list using Boolean equality.\npublic export\nlookup : Eq a => a -> List (a, b) -> Maybe b\nlookup = lookupBy (==)\n\n||| Check if something is a member of a list using a custom comparison.\npublic export\nelemBy : (a -> a -> Bool) -> a -> List a -> Bool\nelemBy p e []      = False\nelemBy p e (x::xs) = p e x || elemBy p e xs\n\npublic export\nnubBy : (a -> a -> Bool) -> List a -> List a\nnubBy = nubBy' []\n  where\n    nubBy' : List a -> (a -> a -> Bool) -> List a -> List a\n    nubBy' acc p []      = []\n    nubBy' acc p (x::xs) =\n      if elemBy p x acc then\n        nubBy' acc p xs\n      else\n        x :: nubBy' (x::acc) p xs\n\n||| O(n^2). The nub function removes duplicate elements from a list. In\n||| particular, it keeps only the first occurrence of each element. It is a\n||| special case of nubBy, which allows the programmer to supply their own\n||| equality test.\n|||\n||| ```idris example\n||| nub (the (List _) [1,2,1,3])\n||| ```\npublic export\nnub : Eq a => List a -> List a\nnub = nubBy (==)\n\n||| The deleteBy function behaves like delete, but takes a user-supplied equality predicate.\npublic export\ndeleteBy : (a -> a -> Bool) -> a -> List a -> List a\ndeleteBy _  _ []      = []\ndeleteBy eq x (y::ys) = if x `eq` y then ys else y :: deleteBy eq x ys\n\n||| `delete x` removes the first occurrence of `x` from its list argument. For\n||| example,\n|||\n|||````idris example\n|||delete 'a' ['b', 'a', 'n', 'a', 'n', 'a']\n|||````\n|||\n||| It is a special case of deleteBy, which allows the programmer to supply\n||| their own equality test.\npublic export\ndelete : Eq a => a -> List a -> List a\ndelete = deleteBy (==)\n\n||| The unionBy function returns the union of two lists by user-supplied equality predicate.\npublic export\nunionBy : (a -> a -> Bool) -> List a -> List a -> List a\nunionBy eq xs ys = xs ++ foldl (flip (deleteBy eq)) (nubBy eq ys) xs\n\n||| Compute the union of two lists according to their `Eq` implementation.\n|||\n||| ```idris example\n||| union ['d', 'o', 'g'] ['c', 'o', 'w']\n||| ```\n|||\npublic export\nunion : Eq a => List a -> List a -> List a\nunion = unionBy (==)\n\npublic export\nspan : (a -> Bool) -> List a -> (List a, List a)\nspan p []      = ([], [])\nspan p (x::xs) =\n  if p x then\n    let (ys, zs) = span p xs in\n      (x::ys, zs)\n  else\n    ([], x::xs)\n\npublic export\nbreak : (a -> Bool) -> List a -> (List a, List a)\nbreak p xs = span (not . p) xs\n\npublic export\nsplit : (a -> Bool) -> List a -> List1 (List a)\nsplit p xs =\n  case break p xs of\n    (chunk, [])          => singleton chunk\n    (chunk, (c :: rest)) => cons chunk (split p (assert_smaller xs rest))\n\npublic export\nsplitAt : (n : Nat) -> (xs : List a) -> (List a, List a)\nsplitAt Z xs = ([], xs)\nsplitAt (S k) [] = ([], [])\nsplitAt (S k) (x :: xs)\n      = let (tk, dr) = splitAt k xs in\n            (x :: tk, dr)\n\npublic export\npartition : (a -> Bool) -> List a -> (List a, List a)\npartition p []      = ([], [])\npartition p (x::xs) =\n  let (lefts, rights) = partition p xs in\n    if p x then\n      (x::lefts, rights)\n    else\n      (lefts, x::rights)\n\n||| The inits function returns all initial segments of the argument, shortest\n||| first. For example,\n|||\n||| ```idris example\n||| inits [1,2,3]\n||| ```\npublic export\ninits : List a -> List (List a)\ninits xs = [] :: case xs of\n  []        => []\n  x :: xs'  => map (x ::) (inits xs')\n\n||| The tails function returns all final segments of the argument, longest\n||| first. For example,\n|||\n||| ```idris example\n||| tails [1,2,3] == [[1,2,3], [2,3], [3], []]\n|||```\npublic export\ntails : List a -> List (List a)\ntails xs = xs :: case xs of\n  []        => []\n  _ :: xs'  => tails xs'\n\n||| Split on the given element.\n|||\n||| ```idris example\n||| splitOn 0 [1,0,2,0,0,3]\n||| ```\n|||\npublic export\nsplitOn : Eq a => a -> List a -> List1 (List a)\nsplitOn a = split (== a)\n\n||| Replaces all occurences of the first argument with the second argument in a list.\n|||\n||| ```idris example\n||| replaceOn '-' ',' ['1', '-', '2', '-', '3']\n||| ```\n|||\npublic export\nreplaceOn : Eq a => a -> a -> List a -> List a\nreplaceOn a b l = map (\\c => if c == a then b else c) l\n\npublic export\nreverseOnto : List a -> List a -> List a\nreverseOnto acc [] = acc\nreverseOnto acc (x::xs) = reverseOnto (x::acc) xs\n\npublic export\nreverse : List a -> List a\nreverse = reverseOnto []\n\n||| Construct a list with `n` copies of `x`.\n||| @ n how many copies\n||| @ x the element to replicate\npublic export\nreplicate : (n : Nat) -> (x : a) -> List a\nreplicate Z     _ = []\nreplicate (S n) x = x :: replicate n x\n\n||| Compute the intersect of two lists by user-supplied equality predicate.\nexport\nintersectBy : (a -> a -> Bool) -> List a -> List a -> List a\nintersectBy eq xs ys = [x | x <- xs, any (eq x) ys]\n\n||| Compute the intersect of two lists according to the `Eq` implementation for the elements.\nexport\nintersect : Eq a => List a -> List a -> List a\nintersect = intersectBy (==)\n\nexport\nintersectAllBy : (a -> a -> Bool) -> List (List a) -> List a\nintersectAllBy eq [] = []\nintersectAllBy eq (xs :: xss) = filter (\\x => all (elemBy eq x) xss) xs\n\nexport\nintersectAll : Eq a => List (List a) -> List a\nintersectAll = intersectAllBy (==)\n\n||| Combine two lists elementwise using some function.\n|||\n||| If the lists are different lengths, the result is truncated to the\n||| length of the shortest list.\nexport\nzipWith : (a -> b -> c) -> List a -> List b -> List c\nzipWith _ [] _ = []\nzipWith _ _ [] = []\nzipWith f (x::xs) (y::ys) = f x y :: zipWith f xs ys\n\n||| Combine two lists elementwise into pairs.\n|||\n||| If the lists are different lengths, the result is truncated to the\n||| length of the shortest list.\nexport\nzip : List a -> List b -> List (a, b)\nzip = zipWith \\x, y => (x, y)\n\nexport\nzipWith3 : (a -> b -> c -> d) -> List a -> List b -> List c -> List d\nzipWith3 _ [] _ _ = []\nzipWith3 _ _ [] _ = []\nzipWith3 _ _ _ [] = []\nzipWith3 f (x::xs) (y::ys) (z::zs) = f x y z :: zipWith3 f xs ys zs\n\n||| Combine three lists elementwise into tuples.\n|||\n||| If the lists are different lengths, the result is truncated to the\n||| length of the shortest list.\nexport\nzip3 : List a -> List b -> List c -> List (a, b, c)\nzip3 = zipWith3 \\x, y, z => (x, y, z)\n\npublic export\ndata NonEmpty : (xs : List a) -> Type where\n    IsNonEmpty : NonEmpty (x :: xs)\n\nexport\nUninhabited (NonEmpty []) where\n  uninhabited IsNonEmpty impossible\n\n||| Get the head of a non-empty list.\n||| @ ok proof the list is non-empty\npublic export\nhead : (l : List a) -> {auto 0 ok : NonEmpty l} -> a\nhead [] impossible\nhead (x :: _) = x\n\n||| Get the tail of a non-empty list.\n||| @ ok proof the list is non-empty\npublic export\ntail : (l : List a) -> {auto 0 ok : NonEmpty l} -> List a\ntail [] impossible\ntail (_ :: xs) = xs\n\n||| Retrieve the last element of a non-empty list.\n||| @ ok proof that the list is non-empty\npublic export\nlast : (l : List a) -> {auto 0 ok : NonEmpty l} -> a\nlast [] impossible\nlast [x] = x\nlast (_::x::xs) = List.last (x::xs)\n\n||| Return all but the last element of a non-empty list.\n||| @ ok proof the list is non-empty\npublic export\ninit : (l : List a) -> {auto 0 ok : NonEmpty l} -> List a\ninit [] impossible\ninit [_] = []\ninit (x::y::ys) = x :: init (y::ys)\n\n||| Attempt to get the head of a list. If the list is empty, return `Nothing`.\npublic export\nhead' : List a -> Maybe a\nhead' []      = Nothing\nhead' (x::_) = Just x\n\n||| Attempt to get the tail of a list. If the list is empty, return `Nothing`.\nexport\ntail' : List a -> Maybe (List a)\ntail' []      = Nothing\ntail' (_::xs) = Just xs\n\n||| Attempt to retrieve the last element of a non-empty list.\n|||\n||| If the list is empty, return `Nothing`.\nexport\nlast' : List a -> Maybe a\nlast' [] = Nothing\nlast' xs@(_::_) = Just (last xs)\n\n||| Attempt to return all but the last element of a non-empty list.\n|||\n||| If the list is empty, return `Nothing`.\nexport\ninit' : List a -> Maybe (List a)\ninit' [] = Nothing\ninit' xs@(_::_) = Just (init xs)\n\n||| Convert any Foldable structure to a list.\nexport\ntoList : Foldable t => t a -> List a\ntoList = foldr (::) []\n\n||| Prefix every element in the list with the given element\n|||\n||| ```idris example\n||| with List (mergeReplicate '>' ['a', 'b', 'c', 'd', 'e'])\n||| ```\n|||\nexport\nmergeReplicate : a -> List a -> List a\nmergeReplicate sep []      = []\nmergeReplicate sep (y::ys) = sep :: y :: mergeReplicate sep ys\n\n\n||| Insert some separator between the elements of a list.\n|||\n||| ````idris example\n||| with List (intersperse ',' ['a', 'b', 'c', 'd', 'e'])\n||| ````\n|||\nexport\nintersperse : a -> List a -> List a\nintersperse sep []      = []\nintersperse sep (x::xs) = x :: mergeReplicate sep xs\n\n||| Given a separator list and some more lists, produce a new list by\n||| placing the separator between each of the lists.\n|||\n||| @ sep the separator\n||| @ xss the lists between which the separator will be placed\n|||\n||| ```idris example\n||| intercalate [0, 0, 0] [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]\n||| ```\nexport\nintercalate : (sep : List a) -> (xss : List (List a)) -> List a\nintercalate sep xss = concat $ intersperse sep xss\n\n||| Apply a partial function to the elements of a list, keeping the ones at which\n||| it is defined.\npublic export\nmapMaybe : (a -> Maybe b) -> List a -> List b\nmapMaybe f []      = []\nmapMaybe f (x::xs) =\n  case f x of\n    Nothing => mapMaybe f xs\n    Just j  => j :: mapMaybe f xs\n\n--------------------------------------------------------------------------------\n-- Special folds\n--------------------------------------------------------------------------------\n\n||| Foldl a non-empty list without seeding the accumulator.\n||| @ ok proof that the list is non-empty\npublic export\nfoldl1 : (a -> a -> a) -> (l : List a)  -> {auto 0 ok : NonEmpty l} -> a\nfoldl1 f [] impossible\nfoldl1 f (x::xs) = foldl f x xs\n\n||| Foldr a non-empty list without seeding the accumulator.\n||| @ ok proof that the list is non-empty\npublic export\nfoldr1 : (a -> a -> a) -> (l : List a)  -> {auto 0 ok : NonEmpty l} -> a\nfoldr1 f [] impossible\nfoldr1 f [x] = x\nfoldr1 f (x::y::ys) = f x (List.foldr1 f (y::ys))\n\n||| Foldl without seeding the accumulator. If the list is empty, return `Nothing`.\npublic export\nfoldl1' : (a -> a -> a) -> List a -> Maybe a\nfoldl1' f [] = Nothing\nfoldl1' f xs@(_::_) = Just (List.foldl1 f xs)\n\n||| Foldr without seeding the accumulator. If the list is empty, return `Nothing`.\npublic export\nfoldr1' : (a -> a -> a) -> List a -> Maybe a\nfoldr1' f [] = Nothing\nfoldr1' f xs@(_::_) = Just (List.foldr1 f xs)\n\n--------------------------------------------------------------------------------\n-- Sorting\n--------------------------------------------------------------------------------\n\n||| Check whether a list is sorted with respect to the default ordering for the type of its elements.\nexport\nsorted : Ord a => List a -> Bool\nsorted (x :: xs @ (y :: _)) = x <= y && sorted xs\nsorted _ = True\n\n||| Merge two sorted lists using an arbitrary comparison\n||| predicate. Note that the lists must have been sorted using this\n||| predicate already.\nexport\nmergeBy : (a -> a -> Ordering) -> List a -> List a -> List a\nmergeBy order []      right   = right\nmergeBy order left    []      = left\nmergeBy order (x::xs) (y::ys) =\n  -- The code below will emit `y` before `x` whenever `x == y`.\n  -- If you change this, `sortBy` will stop being stable, unless you fix `sortBy`, too.\n  case order x y of\n       LT => x :: mergeBy order xs (y::ys)\n       _  => y :: mergeBy order (x::xs) ys\n\n||| Merge two sorted lists using the default ordering for the type of their elements.\nexport\nmerge : Ord a => List a -> List a -> List a\nmerge left right = mergeBy compare left right\n\n||| Sort a list using some arbitrary comparison predicate.\n|||\n||| @ cmp how to compare elements\n||| @ xs the list to sort\nexport\nsortBy : (cmp : a -> a -> Ordering) -> (xs : List a) -> List a\nsortBy cmp []  = []\nsortBy cmp [x] = [x]\nsortBy cmp xs  = let (x, y) = split xs in\n    mergeBy cmp\n          (sortBy cmp (assert_smaller xs x))\n          (sortBy cmp (assert_smaller xs y)) -- not structurally smaller, hence assert\n  where\n    splitRec : List b -> List a -> (List a -> List a) -> (List a, List a)\n    splitRec (_::_::xs) (y::ys) zs = splitRec xs ys (zs . ((::) y))\n    splitRec _          ys      zs = (ys, zs [])\n    -- In the above base-case clause, we put `ys` on the LHS to get a stable sort.\n    -- This is because `mergeBy` prefers taking elements from its RHS operand\n    -- if both heads are equal, and all elements in `zs []` precede all elements of `ys`\n    -- in the original list.\n\n    split : List a -> (List a, List a)\n    split xs = splitRec xs xs id\n\n||| Sort a list using the default ordering for the type of its elements.\nexport\nsort : Ord a => List a -> List a\nsort = sortBy compare\n\nexport\nisPrefixOfBy : (eq : a -> a -> Bool) -> (left, right : List a) -> Bool\nisPrefixOfBy p [] _            = True\nisPrefixOfBy p _ []            = False\nisPrefixOfBy p (x::xs) (y::ys) = p x y && isPrefixOfBy p xs ys\n\n||| The isPrefixOf function takes two lists and returns True iff the first list is a prefix of the second.\nexport\nisPrefixOf : Eq a => List a -> List a -> Bool\nisPrefixOf = isPrefixOfBy (==)\n\nexport\nisSuffixOfBy : (a -> a -> Bool) -> List a -> List a -> Bool\nisSuffixOfBy p left right = isPrefixOfBy p (reverse left) (reverse right)\n\n||| The isSuffixOf function takes two lists and returns True iff the first list is a suffix of the second.\nexport\nisSuffixOf : Eq a => List a -> List a -> Bool\nisSuffixOf = isSuffixOfBy (==)\n\n||| The isInfixOf function takes two lists and returns True iff the first list\n||| is contained, wholly and intact, anywhere within the second.\n|||\n||| ```idris example\n||| isInfixOf ['b','c'] ['a', 'b', 'c', 'd']\n||| ```\n||| ```idris example\n||| isInfixOf ['b','d'] ['a', 'b', 'c', 'd']\n||| ```\n|||\nexport\nisInfixOf : Eq a => List a -> List a -> Bool\nisInfixOf n h = any (isPrefixOf n) (tails h)\n\n||| Transposes rows and columns of a list of lists.\n|||\n||| ```idris example\n||| with List transpose [[1, 2], [3, 4]]\n||| ```\n|||\n||| This also works for non square scenarios, thus\n||| involution does not always hold:\n|||\n|||     transpose [[], [1, 2]] = [[1], [2]]\n|||     transpose (transpose [[], [1, 2]]) = [[1, 2]]\nexport\ntranspose : List (List a) -> List (List a)\ntranspose [] = []\ntranspose (heads :: tails) = spreadHeads heads (transpose tails) where\n  spreadHeads : List a -> List (List a) -> List (List a)\n  spreadHeads []              tails           = tails\n  spreadHeads (head :: heads) []              = [head] :: spreadHeads heads []\n  spreadHeads (head :: heads) (tail :: tails) = (head :: tail) :: spreadHeads heads tails\n\n--------------------------------------------------------------------------------\n-- Properties\n--------------------------------------------------------------------------------\n\nexport\nUninhabited ([] = Prelude.(::) x xs) where\n  uninhabited Refl impossible\n\nexport\nUninhabited (Prelude.(::) x xs = []) where\n  uninhabited Refl impossible\n\n||| (::) is injective\nexport\nconsInjective : forall x, xs, y, ys .\n                the (List a) (x :: xs) = the (List b) (y :: ys) -> (x = y, xs = ys)\nconsInjective Refl = (Refl, Refl)\n\n||| The empty list is a right identity for append.\nexport\nappendNilRightNeutral : (l : List a) -> l ++ [] = l\nappendNilRightNeutral []      = Refl\nappendNilRightNeutral (_::xs) = rewrite appendNilRightNeutral xs in Refl\n\n||| Appending lists is associative.\nexport\nappendAssociative : (l, c, r : List a) -> l ++ (c ++ r) = (l ++ c) ++ r\nappendAssociative []      c r = Refl\nappendAssociative (_::xs) c r = rewrite appendAssociative xs c r in Refl\n\nrevOnto : (xs, vs : List a) -> reverseOnto xs vs = reverse vs ++ xs\nrevOnto _ [] = Refl\nrevOnto xs (v :: vs)\n    = rewrite revOnto (v :: xs) vs in\n        rewrite appendAssociative (reverse vs) [v] xs in\n                                  rewrite revOnto [v] vs in Refl\n\nexport\nrevAppend : (vs, ns : List a) -> reverse ns ++ reverse vs = reverse (vs ++ ns)\nrevAppend [] ns = rewrite appendNilRightNeutral (reverse ns) in Refl\nrevAppend (v :: vs) ns\n    = rewrite revOnto [v] vs in\n        rewrite revOnto [v] (vs ++ ns) in\n          rewrite sym (revAppend vs ns) in\n            rewrite appendAssociative (reverse ns) (reverse vs) [v] in\n              Refl\n\nexport\ndropFusion : (n, m : Nat) -> (l : List t) -> drop n (drop m l) = drop (n+m) l\ndropFusion  Z     m    l      = Refl\ndropFusion (S n)  Z    l      = rewrite plusZeroRightNeutral n in Refl\ndropFusion (S n) (S m) []     = Refl\ndropFusion (S n) (S m) (x::l) = rewrite plusAssociative n 1 m in\n                                rewrite plusCommutative n 1 in\n                                dropFusion (S n) m l\n\nexport\nlengthMap : (xs : List a) -> length (map f xs) = length xs\nlengthMap [] = Refl\nlengthMap (x :: xs) = cong S (lengthMap xs)\n", "meta": {"hexsha": "e8c77e801a0c7c652d8eabc46f9410cdbdee9f8d", "size": 19662, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/base/Data/List.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/base/Data/List.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/base/Data/List.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.2958397535, "max_line_length": 106, "alphanum_fraction": 0.5888007324, "num_tokens": 6065, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6926419831347361, "lm_q2_score": 0.7799928900257126, "lm_q1q2_score": 0.5402558221784037}}
{"text": "||| There are different flavours of induction-recursion. This is the one\n||| introduced in Dybjer and Setzer's paper:\n||| Indexed induction-recursion\n\nmodule Data.InductionRecursion.DybjerSetzer\n\npublic export\ndata Code : (input : sort -> Type) -> (output : Type) -> Type where\n  Yield  : output -> Code input output\n  Store  : (payload : Type) -> (payload -> Code input output) -> Code input output\n  Branch : (label : Type) -> (toSort : label -> sort) ->\n           (((l : label) -> input (toSort l)) -> Code input output) ->\n           Code input output\n\npublic export\nDecodeType\n  : Code input output -> (x : sort -> Type) ->\n    (f : {s : sort} -> x s -> input s) ->\n    Type\nDecodeType (Yield _) x f = ()\nDecodeType (Store payload k) x f = (v : payload ** DecodeType (k v) x f)\nDecodeType (Branch label toSort k) x f\n  = (r : ((l : label) -> x (toSort l)) ** DecodeType (k (\\ l => f (r l))) x f)\n\npublic export\nDecodeOutput\n  : (c : Code input output) -> (x : Lazy (sort -> Type)) ->\n    (f : {s : sort} -> x s -> input s) ->\n    DecodeType c x f -> output\nDecodeOutput (Yield o) x f _ = o\nDecodeOutput (Store p k) x f (v ** d) = DecodeOutput (k v) x f d\nDecodeOutput (Branch l s k) x f (r ** d) = DecodeOutput (k (\\ l => f (r l))) x f d\n\nmutual\n\n  public export\n  data Mu : (f : (s : sort) -> Code input (input s)) -> (s : sort) -> Type where\n    MkMu : {f : (s : sort) -> Code input (input s)} -> {s : sort} ->\n           DecodeType (f s) (Mu f) Decode -> Mu {input} f s\n\n  public export\n  Decode : {f : (s : sort) -> Code input (input s)} ->\n           {s : sort} -> Mu {input} f s -> input s\n  Decode (MkMu d) = DecodeOutput (f s) (Mu f) (\\ d => assert_total (Decode d)) d\n\npublic export\nbind : Code i o -> (o -> Code i o') -> Code i o'\nbind (Yield v) f = f v\nbind (Store p k) f = Store p (\\ v => bind (k v) f)\nbind (Branch l s k) f = Branch l s (\\ r => bind (k r) f)\n\npublic export\nFunctor (Code i) where\n  map f v = bind v (Yield . f)\n\npublic export\nApplicative (Code i) where\n  pure = Yield\n  cf <*> co = bind cf (\\ f => map (f $) co)\n\npublic export\nMonad (Code i) where\n  (>>=) = bind\n", "meta": {"hexsha": "33db914be47d06d2c811abf62d3750fa50257464", "size": 2099, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/contrib/Data/InductionRecursion/DybjerSetzer.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "libs/contrib/Data/InductionRecursion/DybjerSetzer.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "libs/contrib/Data/InductionRecursion/DybjerSetzer.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 32.796875, "max_line_length": 82, "alphanum_fraction": 0.5783706527, "num_tokens": 688, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677660619633, "lm_q2_score": 0.6370307806984444, "lm_q1q2_score": 0.5401815680215684}}
{"text": "module Hezarfen.FunDefn\n\nimport Hezarfen.Prover\nimport Hezarfen.Simplify\nimport Language.Reflection.Utils\n\n%access public export\n\n||| Looking at a proof term, collect the initial lambda argument names and\n||| their types, and return the remaining proof term after the initial lambdas.\ncollect : Tm -> (List (TTName, Ty), Tm)\ncollect (RBind n' (Lam b) t') with (collect t')\n  | (xs, rest) = ((n', b) :: xs, rest)\ncollect t' = ([], t')\n\n||| Returns a left and right hand side for a fun clause\nlambdas : TTName -> Tm -> Elab (Tm, Tm)\nlambdas n t =\n    let (xs, rhs) = collect t in\n    let apps = foldl (\\t, (name, _) => RApp t (Var name)) (Var n) xs in\n    let xsRev = reverse xs in\n    pure (binds xsRev apps, binds xsRev rhs)\n  where\n    ||| The list should be reversed beforehand\n    binds : List (TTName, Ty) -> Tm -> Raw\n    binds [] t' = t'\n    binds ((n', ty) :: xs) t' = binds xs $ RBind n' (PVar ty) t'\n\n||| Takes a list of the arguments parsed by `collect`, and the rest of\n||| the proof term. Checks how many consecutive `fst` and `snd` projections\n||| in the beginning of `rest`. Returns a list of the names of the pairs they\n||| project on, and what the projections are named. Also returns the rest\n||| of the proof term stripped from the projections.\npairProjections : (lamIntro : List (TTName, Tm)) -> (rest : Tm)\n               -> Elab (List (TTName, (TTName, TTName)), Tm)\npairProjections lamIntro rest =\n  case rest of\n    RBind n1 (Let a `(Prelude.Basics.fst {a=~a1} {b=~b1} ~(Var p1)))\n      (RBind n2 (Let b `(Prelude.Basics.snd {a=~a2} {b=~b2} ~(Var p2))) t) =>\n      if p1 == p2 && (p1 `elem` (fst <$> lamIntro)) && not (p1 `isBound` t)\n         then do (xs, t') <- pairProjections lamIntro t\n                 pure ((p1, (n1, n2)) :: xs, t)\n         else pure ([], rest)\n    RBind n b t =>\n      if n `elem` (fst <$> lamIntro)\n         then pure ([], rest)\n         else do (xs, t') <- pairProjections lamIntro t\n                 pure (xs, RBind n b t')\n    RApp t1 t2 =>\n      do (xs, t1') <- pairProjections lamIntro t1\n         (ys, t2') <- pairProjections lamIntro t2\n         pure (xs ++ ys, RApp t1' t2')\n    _ => pure ([], rest)\n\n||| The entry point for other modules.\ndefinitionize : TTName -> Tm -> Elab (FunDefn Raw)\ndefinitionize n t =\n  let (lhs, rhs) = !(lambdas n t) in\n  -- TODO figure out how to create LHS and RHS that respects the pair patterns\n  -- let (pairReplacements, rest) = pairProjections _ rhs\n  pure $ DefineFun n [MkFunClause lhs rhs]\n", "meta": {"hexsha": "b55f0165682aa592d1ef5508c98870df547ad3a5", "size": 2484, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Hezarfen/FunDefn.idr", "max_stars_repo_name": "joom/hezarfen", "max_stars_repo_head_hexsha": "da80a475cf57dee5cd3c10452878d951f1fa490f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 121, "max_stars_repo_stars_event_min_datetime": "2017-10-09T02:58:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-23T21:34:51.000Z", "max_issues_repo_path": "Hezarfen/FunDefn.idr", "max_issues_repo_name": "joom/hezarfen", "max_issues_repo_head_hexsha": "da80a475cf57dee5cd3c10452878d951f1fa490f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Hezarfen/FunDefn.idr", "max_forks_repo_name": "joom/hezarfen", "max_forks_repo_head_hexsha": "da80a475cf57dee5cd3c10452878d951f1fa490f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2017-10-10T19:49:26.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-10T14:55:33.000Z", "avg_line_length": 40.064516129, "max_line_length": 79, "alphanum_fraction": 0.615136876, "num_tokens": 786, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7549149758396752, "lm_q2_score": 0.7154239957834733, "lm_q1q2_score": 0.5400842884920046}}
{"text": "Ty : Type\nTy = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty : Ty\nempty = \\ _, empty, _ => empty\n\narr : Ty -> Ty -> Ty\narr = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon : Type\nCon = (Con : Type)\n ->(nil  : Con)\n ->(snoc : Con -> Ty -> Con)\n -> Con\n\nnil : Con\nnil = \\ con, nil, snoc => nil\n\nsnoc : Con -> Ty -> Con\nsnoc = \\ g, a, con, nil, snoc => snoc (g con nil snoc) a\n\nVar : Con -> Ty -> Type\nVar = \\ g, a =>\n    (Var : Con -> Ty -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var (snoc g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var g a -> Var (snoc g b) a)\n -> Var g a\n\nvz : {g : _}-> {a : _} -> Var (snoc g a) a\nvz = \\ var, vz, vs => vz _ _\n\nvs : {g : _} -> {B : _} -> {a : _} -> Var g a -> Var (snoc g B) a\nvs = \\ x, var, vz, vs => vs _ _ _ (x var vz vs)\n\nTm : Con -> Ty -> Type\nTm = \\ g, a =>\n    (Tm    : Con -> Ty -> Type)\n -> (var   : (g : _) -> (a : _) -> Var g a -> Tm g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm (snoc g a) B -> Tm g (arr a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm g (arr a B) -> Tm g a -> Tm g B)\n -> Tm g a\n\nvar : {g : _} -> {a : _} -> Var g a -> Tm g a\nvar = \\ x, tm, var, lam, app => var _ _ x\n\nlam : {g : _} -> {a : _} -> {B : _} -> Tm (snoc g a) B -> Tm g (arr a B)\nlam = \\ t, tm, var, lam, app => lam _ _ _ (t tm var lam app)\n\napp : {g:_}->{a:_}->{B:_} -> Tm g (arr a B) -> Tm g a -> Tm g B\napp = \\ t, u, tm, var, lam, app => app _ _ _ (t tm var lam app) (u tm var lam app)\n\nv0 : {g:_}->{a:_} -> Tm (snoc g a) a\nv0 = var vz\n\nv1 : {g:_}->{a:_}-> {B:_}-> Tm (snoc (snoc g a) B) a\nv1 = var (vs vz)\n\nv2 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm (snoc (snoc (snoc g a) B) C) a\nv2 = var (vs (vs vz))\n\nv3 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm (snoc (snoc (snoc (snoc g a) B) C) D) a\nv3 = var (vs (vs (vs vz)))\n\nv4 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm (snoc (snoc (snoc (snoc (snoc g a) B) C) D) E) a\nv4 = var (vs (vs (vs (vs vz))))\n\ntest : {g:_}-> {a:_} -> Tm g (arr (arr a a) (arr a a))\ntest  = lam (lam (app v1 (app v1 (app v1 (app v1 (app v1 (app v1 v0)))))))\nTy1 : Type\nTy1 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty1 : Ty1\nempty1 = \\ _, empty, _ => empty\n\narr1 : Ty1 -> Ty1 -> Ty1\narr1 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon1 : Type\nCon1 = (Con1 : Type)\n ->(nil  : Con1)\n ->(snoc : Con1 -> Ty1 -> Con1)\n -> Con1\n\nnil1 : Con1\nnil1 = \\ con, nil1, snoc => nil1\n\nsnoc1 : Con1 -> Ty1 -> Con1\nsnoc1 = \\ g, a, con, nil1, snoc1 => snoc1 (g con nil1 snoc1) a\n\nVar1 : Con1 -> Ty1 -> Type\nVar1 = \\ g, a =>\n    (Var1 : Con1 -> Ty1 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var1 (snoc1 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var1 g a -> Var1 (snoc1 g b) a)\n -> Var1 g a\n\nvz1 : {g : _}-> {a : _} -> Var1 (snoc1 g a) a\nvz1 = \\ var, vz1, vs => vz1 _ _\n\nvs1 : {g : _} -> {B : _} -> {a : _} -> Var1 g a -> Var1 (snoc1 g B) a\nvs1 = \\ x, var, vz1, vs1 => vs1 _ _ _ (x var vz1 vs1)\n\nTm1 : Con1 -> Ty1 -> Type\nTm1 = \\ g, a =>\n    (Tm1    : Con1 -> Ty1 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var1 g a -> Tm1 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm1 (snoc1 g a) B -> Tm1 g (arr1 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm1 g (arr1 a B) -> Tm1 g a -> Tm1 g B)\n -> Tm1 g a\n\nvar1 : {g : _} -> {a : _} -> Var1 g a -> Tm1 g a\nvar1 = \\ x, tm, var1, lam, app => var1 _ _ x\n\nlam1 : {g : _} -> {a : _} -> {B : _} -> Tm1 (snoc1 g a) B -> Tm1 g (arr1 a B)\nlam1 = \\ t, tm, var1, lam1, app => lam1 _ _ _ (t tm var1 lam1 app)\n\napp1 : {g:_}->{a:_}->{B:_} -> Tm1 g (arr1 a B) -> Tm1 g a -> Tm1 g B\napp1 = \\ t, u, tm, var1, lam1, app1 => app1 _ _ _ (t tm var1 lam1 app1) (u tm var1 lam1 app1)\n\nv01 : {g:_}->{a:_} -> Tm1 (snoc1 g a) a\nv01 = var1 vz1\n\nv11 : {g:_}->{a:_}-> {B:_}-> Tm1 (snoc1 (snoc1 g a) B) a\nv11 = var1 (vs1 vz1)\n\nv21 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm1 (snoc1 (snoc1 (snoc1 g a) B) C) a\nv21 = var1 (vs1 (vs1 vz1))\n\nv31 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm1 (snoc1 (snoc1 (snoc1 (snoc1 g a) B) C) D) a\nv31 = var1 (vs1 (vs1 (vs1 vz1)))\n\nv41 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm1 (snoc1 (snoc1 (snoc1 (snoc1 (snoc1 g a) B) C) D) E) a\nv41 = var1 (vs1 (vs1 (vs1 (vs1 vz1))))\n\ntest1 : {g:_}-> {a:_} -> Tm1 g (arr1 (arr1 a a) (arr1 a a))\ntest1  = lam1 (lam1 (app1 v11 (app1 v11 (app1 v11 (app1 v11 (app1 v11 (app1 v11 v01)))))))\nTy2 : Type\nTy2 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty2 : Ty2\nempty2 = \\ _, empty, _ => empty\n\narr2 : Ty2 -> Ty2 -> Ty2\narr2 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon2 : Type\nCon2 = (Con2 : Type)\n ->(nil  : Con2)\n ->(snoc : Con2 -> Ty2 -> Con2)\n -> Con2\n\nnil2 : Con2\nnil2 = \\ con, nil2, snoc => nil2\n\nsnoc2 : Con2 -> Ty2 -> Con2\nsnoc2 = \\ g, a, con, nil2, snoc2 => snoc2 (g con nil2 snoc2) a\n\nVar2 : Con2 -> Ty2 -> Type\nVar2 = \\ g, a =>\n    (Var2 : Con2 -> Ty2 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var2 (snoc2 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var2 g a -> Var2 (snoc2 g b) a)\n -> Var2 g a\n\nvz2 : {g : _}-> {a : _} -> Var2 (snoc2 g a) a\nvz2 = \\ var, vz2, vs => vz2 _ _\n\nvs2 : {g : _} -> {B : _} -> {a : _} -> Var2 g a -> Var2 (snoc2 g B) a\nvs2 = \\ x, var, vz2, vs2 => vs2 _ _ _ (x var vz2 vs2)\n\nTm2 : Con2 -> Ty2 -> Type\nTm2 = \\ g, a =>\n    (Tm2    : Con2 -> Ty2 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var2 g a -> Tm2 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm2 (snoc2 g a) B -> Tm2 g (arr2 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm2 g (arr2 a B) -> Tm2 g a -> Tm2 g B)\n -> Tm2 g a\n\nvar2 : {g : _} -> {a : _} -> Var2 g a -> Tm2 g a\nvar2 = \\ x, tm, var2, lam, app => var2 _ _ x\n\nlam2 : {g : _} -> {a : _} -> {B : _} -> Tm2 (snoc2 g a) B -> Tm2 g (arr2 a B)\nlam2 = \\ t, tm, var2, lam2, app => lam2 _ _ _ (t tm var2 lam2 app)\n\napp2 : {g:_}->{a:_}->{B:_} -> Tm2 g (arr2 a B) -> Tm2 g a -> Tm2 g B\napp2 = \\ t, u, tm, var2, lam2, app2 => app2 _ _ _ (t tm var2 lam2 app2) (u tm var2 lam2 app2)\n\nv02 : {g:_}->{a:_} -> Tm2 (snoc2 g a) a\nv02 = var2 vz2\n\nv12 : {g:_}->{a:_}-> {B:_}-> Tm2 (snoc2 (snoc2 g a) B) a\nv12 = var2 (vs2 vz2)\n\nv22 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm2 (snoc2 (snoc2 (snoc2 g a) B) C) a\nv22 = var2 (vs2 (vs2 vz2))\n\nv32 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm2 (snoc2 (snoc2 (snoc2 (snoc2 g a) B) C) D) a\nv32 = var2 (vs2 (vs2 (vs2 vz2)))\n\nv42 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm2 (snoc2 (snoc2 (snoc2 (snoc2 (snoc2 g a) B) C) D) E) a\nv42 = var2 (vs2 (vs2 (vs2 (vs2 vz2))))\n\ntest2 : {g:_}-> {a:_} -> Tm2 g (arr2 (arr2 a a) (arr2 a a))\ntest2  = lam2 (lam2 (app2 v12 (app2 v12 (app2 v12 (app2 v12 (app2 v12 (app2 v12 v02)))))))\nTy3 : Type\nTy3 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty3 : Ty3\nempty3 = \\ _, empty, _ => empty\n\narr3 : Ty3 -> Ty3 -> Ty3\narr3 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon3 : Type\nCon3 = (Con3 : Type)\n ->(nil  : Con3)\n ->(snoc : Con3 -> Ty3 -> Con3)\n -> Con3\n\nnil3 : Con3\nnil3 = \\ con, nil3, snoc => nil3\n\nsnoc3 : Con3 -> Ty3 -> Con3\nsnoc3 = \\ g, a, con, nil3, snoc3 => snoc3 (g con nil3 snoc3) a\n\nVar3 : Con3 -> Ty3 -> Type\nVar3 = \\ g, a =>\n    (Var3 : Con3 -> Ty3 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var3 (snoc3 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var3 g a -> Var3 (snoc3 g b) a)\n -> Var3 g a\n\nvz3 : {g : _}-> {a : _} -> Var3 (snoc3 g a) a\nvz3 = \\ var, vz3, vs => vz3 _ _\n\nvs3 : {g : _} -> {B : _} -> {a : _} -> Var3 g a -> Var3 (snoc3 g B) a\nvs3 = \\ x, var, vz3, vs3 => vs3 _ _ _ (x var vz3 vs3)\n\nTm3 : Con3 -> Ty3 -> Type\nTm3 = \\ g, a =>\n    (Tm3    : Con3 -> Ty3 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var3 g a -> Tm3 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm3 (snoc3 g a) B -> Tm3 g (arr3 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm3 g (arr3 a B) -> Tm3 g a -> Tm3 g B)\n -> Tm3 g a\n\nvar3 : {g : _} -> {a : _} -> Var3 g a -> Tm3 g a\nvar3 = \\ x, tm, var3, lam, app => var3 _ _ x\n\nlam3 : {g : _} -> {a : _} -> {B : _} -> Tm3 (snoc3 g a) B -> Tm3 g (arr3 a B)\nlam3 = \\ t, tm, var3, lam3, app => lam3 _ _ _ (t tm var3 lam3 app)\n\napp3 : {g:_}->{a:_}->{B:_} -> Tm3 g (arr3 a B) -> Tm3 g a -> Tm3 g B\napp3 = \\ t, u, tm, var3, lam3, app3 => app3 _ _ _ (t tm var3 lam3 app3) (u tm var3 lam3 app3)\n\nv03 : {g:_}->{a:_} -> Tm3 (snoc3 g a) a\nv03 = var3 vz3\n\nv13 : {g:_}->{a:_}-> {B:_}-> Tm3 (snoc3 (snoc3 g a) B) a\nv13 = var3 (vs3 vz3)\n\nv23 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm3 (snoc3 (snoc3 (snoc3 g a) B) C) a\nv23 = var3 (vs3 (vs3 vz3))\n\nv33 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm3 (snoc3 (snoc3 (snoc3 (snoc3 g a) B) C) D) a\nv33 = var3 (vs3 (vs3 (vs3 vz3)))\n\nv43 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm3 (snoc3 (snoc3 (snoc3 (snoc3 (snoc3 g a) B) C) D) E) a\nv43 = var3 (vs3 (vs3 (vs3 (vs3 vz3))))\n\ntest3 : {g:_}-> {a:_} -> Tm3 g (arr3 (arr3 a a) (arr3 a a))\ntest3  = lam3 (lam3 (app3 v13 (app3 v13 (app3 v13 (app3 v13 (app3 v13 (app3 v13 v03)))))))\nTy4 : Type\nTy4 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty4 : Ty4\nempty4 = \\ _, empty, _ => empty\n\narr4 : Ty4 -> Ty4 -> Ty4\narr4 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon4 : Type\nCon4 = (Con4 : Type)\n ->(nil  : Con4)\n ->(snoc : Con4 -> Ty4 -> Con4)\n -> Con4\n\nnil4 : Con4\nnil4 = \\ con, nil4, snoc => nil4\n\nsnoc4 : Con4 -> Ty4 -> Con4\nsnoc4 = \\ g, a, con, nil4, snoc4 => snoc4 (g con nil4 snoc4) a\n\nVar4 : Con4 -> Ty4 -> Type\nVar4 = \\ g, a =>\n    (Var4 : Con4 -> Ty4 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var4 (snoc4 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var4 g a -> Var4 (snoc4 g b) a)\n -> Var4 g a\n\nvz4 : {g : _}-> {a : _} -> Var4 (snoc4 g a) a\nvz4 = \\ var, vz4, vs => vz4 _ _\n\nvs4 : {g : _} -> {B : _} -> {a : _} -> Var4 g a -> Var4 (snoc4 g B) a\nvs4 = \\ x, var, vz4, vs4 => vs4 _ _ _ (x var vz4 vs4)\n\nTm4 : Con4 -> Ty4 -> Type\nTm4 = \\ g, a =>\n    (Tm4    : Con4 -> Ty4 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var4 g a -> Tm4 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm4 (snoc4 g a) B -> Tm4 g (arr4 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm4 g (arr4 a B) -> Tm4 g a -> Tm4 g B)\n -> Tm4 g a\n\nvar4 : {g : _} -> {a : _} -> Var4 g a -> Tm4 g a\nvar4 = \\ x, tm, var4, lam, app => var4 _ _ x\n\nlam4 : {g : _} -> {a : _} -> {B : _} -> Tm4 (snoc4 g a) B -> Tm4 g (arr4 a B)\nlam4 = \\ t, tm, var4, lam4, app => lam4 _ _ _ (t tm var4 lam4 app)\n\napp4 : {g:_}->{a:_}->{B:_} -> Tm4 g (arr4 a B) -> Tm4 g a -> Tm4 g B\napp4 = \\ t, u, tm, var4, lam4, app4 => app4 _ _ _ (t tm var4 lam4 app4) (u tm var4 lam4 app4)\n\nv04 : {g:_}->{a:_} -> Tm4 (snoc4 g a) a\nv04 = var4 vz4\n\nv14 : {g:_}->{a:_}-> {B:_}-> Tm4 (snoc4 (snoc4 g a) B) a\nv14 = var4 (vs4 vz4)\n\nv24 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm4 (snoc4 (snoc4 (snoc4 g a) B) C) a\nv24 = var4 (vs4 (vs4 vz4))\n\nv34 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm4 (snoc4 (snoc4 (snoc4 (snoc4 g a) B) C) D) a\nv34 = var4 (vs4 (vs4 (vs4 vz4)))\n\nv44 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm4 (snoc4 (snoc4 (snoc4 (snoc4 (snoc4 g a) B) C) D) E) a\nv44 = var4 (vs4 (vs4 (vs4 (vs4 vz4))))\n\ntest4 : {g:_}-> {a:_} -> Tm4 g (arr4 (arr4 a a) (arr4 a a))\ntest4  = lam4 (lam4 (app4 v14 (app4 v14 (app4 v14 (app4 v14 (app4 v14 (app4 v14 v04)))))))\nTy5 : Type\nTy5 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty5 : Ty5\nempty5 = \\ _, empty, _ => empty\n\narr5 : Ty5 -> Ty5 -> Ty5\narr5 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon5 : Type\nCon5 = (Con5 : Type)\n ->(nil  : Con5)\n ->(snoc : Con5 -> Ty5 -> Con5)\n -> Con5\n\nnil5 : Con5\nnil5 = \\ con, nil5, snoc => nil5\n\nsnoc5 : Con5 -> Ty5 -> Con5\nsnoc5 = \\ g, a, con, nil5, snoc5 => snoc5 (g con nil5 snoc5) a\n\nVar5 : Con5 -> Ty5 -> Type\nVar5 = \\ g, a =>\n    (Var5 : Con5 -> Ty5 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var5 (snoc5 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var5 g a -> Var5 (snoc5 g b) a)\n -> Var5 g a\n\nvz5 : {g : _}-> {a : _} -> Var5 (snoc5 g a) a\nvz5 = \\ var, vz5, vs => vz5 _ _\n\nvs5 : {g : _} -> {B : _} -> {a : _} -> Var5 g a -> Var5 (snoc5 g B) a\nvs5 = \\ x, var, vz5, vs5 => vs5 _ _ _ (x var vz5 vs5)\n\nTm5 : Con5 -> Ty5 -> Type\nTm5 = \\ g, a =>\n    (Tm5    : Con5 -> Ty5 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var5 g a -> Tm5 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm5 (snoc5 g a) B -> Tm5 g (arr5 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm5 g (arr5 a B) -> Tm5 g a -> Tm5 g B)\n -> Tm5 g a\n\nvar5 : {g : _} -> {a : _} -> Var5 g a -> Tm5 g a\nvar5 = \\ x, tm, var5, lam, app => var5 _ _ x\n\nlam5 : {g : _} -> {a : _} -> {B : _} -> Tm5 (snoc5 g a) B -> Tm5 g (arr5 a B)\nlam5 = \\ t, tm, var5, lam5, app => lam5 _ _ _ (t tm var5 lam5 app)\n\napp5 : {g:_}->{a:_}->{B:_} -> Tm5 g (arr5 a B) -> Tm5 g a -> Tm5 g B\napp5 = \\ t, u, tm, var5, lam5, app5 => app5 _ _ _ (t tm var5 lam5 app5) (u tm var5 lam5 app5)\n\nv05 : {g:_}->{a:_} -> Tm5 (snoc5 g a) a\nv05 = var5 vz5\n\nv15 : {g:_}->{a:_}-> {B:_}-> Tm5 (snoc5 (snoc5 g a) B) a\nv15 = var5 (vs5 vz5)\n\nv25 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm5 (snoc5 (snoc5 (snoc5 g a) B) C) a\nv25 = var5 (vs5 (vs5 vz5))\n\nv35 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm5 (snoc5 (snoc5 (snoc5 (snoc5 g a) B) C) D) a\nv35 = var5 (vs5 (vs5 (vs5 vz5)))\n\nv45 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm5 (snoc5 (snoc5 (snoc5 (snoc5 (snoc5 g a) B) C) D) E) a\nv45 = var5 (vs5 (vs5 (vs5 (vs5 vz5))))\n\ntest5 : {g:_}-> {a:_} -> Tm5 g (arr5 (arr5 a a) (arr5 a a))\ntest5  = lam5 (lam5 (app5 v15 (app5 v15 (app5 v15 (app5 v15 (app5 v15 (app5 v15 v05)))))))\nTy6 : Type\nTy6 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty6 : Ty6\nempty6 = \\ _, empty, _ => empty\n\narr6 : Ty6 -> Ty6 -> Ty6\narr6 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon6 : Type\nCon6 = (Con6 : Type)\n ->(nil  : Con6)\n ->(snoc : Con6 -> Ty6 -> Con6)\n -> Con6\n\nnil6 : Con6\nnil6 = \\ con, nil6, snoc => nil6\n\nsnoc6 : Con6 -> Ty6 -> Con6\nsnoc6 = \\ g, a, con, nil6, snoc6 => snoc6 (g con nil6 snoc6) a\n\nVar6 : Con6 -> Ty6 -> Type\nVar6 = \\ g, a =>\n    (Var6 : Con6 -> Ty6 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var6 (snoc6 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var6 g a -> Var6 (snoc6 g b) a)\n -> Var6 g a\n\nvz6 : {g : _}-> {a : _} -> Var6 (snoc6 g a) a\nvz6 = \\ var, vz6, vs => vz6 _ _\n\nvs6 : {g : _} -> {B : _} -> {a : _} -> Var6 g a -> Var6 (snoc6 g B) a\nvs6 = \\ x, var, vz6, vs6 => vs6 _ _ _ (x var vz6 vs6)\n\nTm6 : Con6 -> Ty6 -> Type\nTm6 = \\ g, a =>\n    (Tm6    : Con6 -> Ty6 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var6 g a -> Tm6 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm6 (snoc6 g a) B -> Tm6 g (arr6 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm6 g (arr6 a B) -> Tm6 g a -> Tm6 g B)\n -> Tm6 g a\n\nvar6 : {g : _} -> {a : _} -> Var6 g a -> Tm6 g a\nvar6 = \\ x, tm, var6, lam, app => var6 _ _ x\n\nlam6 : {g : _} -> {a : _} -> {B : _} -> Tm6 (snoc6 g a) B -> Tm6 g (arr6 a B)\nlam6 = \\ t, tm, var6, lam6, app => lam6 _ _ _ (t tm var6 lam6 app)\n\napp6 : {g:_}->{a:_}->{B:_} -> Tm6 g (arr6 a B) -> Tm6 g a -> Tm6 g B\napp6 = \\ t, u, tm, var6, lam6, app6 => app6 _ _ _ (t tm var6 lam6 app6) (u tm var6 lam6 app6)\n\nv06 : {g:_}->{a:_} -> Tm6 (snoc6 g a) a\nv06 = var6 vz6\n\nv16 : {g:_}->{a:_}-> {B:_}-> Tm6 (snoc6 (snoc6 g a) B) a\nv16 = var6 (vs6 vz6)\n\nv26 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm6 (snoc6 (snoc6 (snoc6 g a) B) C) a\nv26 = var6 (vs6 (vs6 vz6))\n\nv36 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm6 (snoc6 (snoc6 (snoc6 (snoc6 g a) B) C) D) a\nv36 = var6 (vs6 (vs6 (vs6 vz6)))\n\nv46 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm6 (snoc6 (snoc6 (snoc6 (snoc6 (snoc6 g a) B) C) D) E) a\nv46 = var6 (vs6 (vs6 (vs6 (vs6 vz6))))\n\ntest6 : {g:_}-> {a:_} -> Tm6 g (arr6 (arr6 a a) (arr6 a a))\ntest6  = lam6 (lam6 (app6 v16 (app6 v16 (app6 v16 (app6 v16 (app6 v16 (app6 v16 v06)))))))\nTy7 : Type\nTy7 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty7 : Ty7\nempty7 = \\ _, empty, _ => empty\n\narr7 : Ty7 -> Ty7 -> Ty7\narr7 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon7 : Type\nCon7 = (Con7 : Type)\n ->(nil  : Con7)\n ->(snoc : Con7 -> Ty7 -> Con7)\n -> Con7\n\nnil7 : Con7\nnil7 = \\ con, nil7, snoc => nil7\n\nsnoc7 : Con7 -> Ty7 -> Con7\nsnoc7 = \\ g, a, con, nil7, snoc7 => snoc7 (g con nil7 snoc7) a\n\nVar7 : Con7 -> Ty7 -> Type\nVar7 = \\ g, a =>\n    (Var7 : Con7 -> Ty7 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var7 (snoc7 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var7 g a -> Var7 (snoc7 g b) a)\n -> Var7 g a\n\nvz7 : {g : _}-> {a : _} -> Var7 (snoc7 g a) a\nvz7 = \\ var, vz7, vs => vz7 _ _\n\nvs7 : {g : _} -> {B : _} -> {a : _} -> Var7 g a -> Var7 (snoc7 g B) a\nvs7 = \\ x, var, vz7, vs7 => vs7 _ _ _ (x var vz7 vs7)\n\nTm7 : Con7 -> Ty7 -> Type\nTm7 = \\ g, a =>\n    (Tm7    : Con7 -> Ty7 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var7 g a -> Tm7 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm7 (snoc7 g a) B -> Tm7 g (arr7 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm7 g (arr7 a B) -> Tm7 g a -> Tm7 g B)\n -> Tm7 g a\n\nvar7 : {g : _} -> {a : _} -> Var7 g a -> Tm7 g a\nvar7 = \\ x, tm, var7, lam, app => var7 _ _ x\n\nlam7 : {g : _} -> {a : _} -> {B : _} -> Tm7 (snoc7 g a) B -> Tm7 g (arr7 a B)\nlam7 = \\ t, tm, var7, lam7, app => lam7 _ _ _ (t tm var7 lam7 app)\n\napp7 : {g:_}->{a:_}->{B:_} -> Tm7 g (arr7 a B) -> Tm7 g a -> Tm7 g B\napp7 = \\ t, u, tm, var7, lam7, app7 => app7 _ _ _ (t tm var7 lam7 app7) (u tm var7 lam7 app7)\n\nv07 : {g:_}->{a:_} -> Tm7 (snoc7 g a) a\nv07 = var7 vz7\n\nv17 : {g:_}->{a:_}-> {B:_}-> Tm7 (snoc7 (snoc7 g a) B) a\nv17 = var7 (vs7 vz7)\n\nv27 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm7 (snoc7 (snoc7 (snoc7 g a) B) C) a\nv27 = var7 (vs7 (vs7 vz7))\n\nv37 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm7 (snoc7 (snoc7 (snoc7 (snoc7 g a) B) C) D) a\nv37 = var7 (vs7 (vs7 (vs7 vz7)))\n\nv47 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm7 (snoc7 (snoc7 (snoc7 (snoc7 (snoc7 g a) B) C) D) E) a\nv47 = var7 (vs7 (vs7 (vs7 (vs7 vz7))))\n\ntest7 : {g:_}-> {a:_} -> Tm7 g (arr7 (arr7 a a) (arr7 a a))\ntest7  = lam7 (lam7 (app7 v17 (app7 v17 (app7 v17 (app7 v17 (app7 v17 (app7 v17 v07)))))))\nTy8 : Type\nTy8 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty8 : Ty8\nempty8 = \\ _, empty, _ => empty\n\narr8 : Ty8 -> Ty8 -> Ty8\narr8 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon8 : Type\nCon8 = (Con8 : Type)\n ->(nil  : Con8)\n ->(snoc : Con8 -> Ty8 -> Con8)\n -> Con8\n\nnil8 : Con8\nnil8 = \\ con, nil8, snoc => nil8\n\nsnoc8 : Con8 -> Ty8 -> Con8\nsnoc8 = \\ g, a, con, nil8, snoc8 => snoc8 (g con nil8 snoc8) a\n\nVar8 : Con8 -> Ty8 -> Type\nVar8 = \\ g, a =>\n    (Var8 : Con8 -> Ty8 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var8 (snoc8 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var8 g a -> Var8 (snoc8 g b) a)\n -> Var8 g a\n\nvz8 : {g : _}-> {a : _} -> Var8 (snoc8 g a) a\nvz8 = \\ var, vz8, vs => vz8 _ _\n\nvs8 : {g : _} -> {B : _} -> {a : _} -> Var8 g a -> Var8 (snoc8 g B) a\nvs8 = \\ x, var, vz8, vs8 => vs8 _ _ _ (x var vz8 vs8)\n\nTm8 : Con8 -> Ty8 -> Type\nTm8 = \\ g, a =>\n    (Tm8    : Con8 -> Ty8 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var8 g a -> Tm8 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm8 (snoc8 g a) B -> Tm8 g (arr8 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm8 g (arr8 a B) -> Tm8 g a -> Tm8 g B)\n -> Tm8 g a\n\nvar8 : {g : _} -> {a : _} -> Var8 g a -> Tm8 g a\nvar8 = \\ x, tm, var8, lam, app => var8 _ _ x\n\nlam8 : {g : _} -> {a : _} -> {B : _} -> Tm8 (snoc8 g a) B -> Tm8 g (arr8 a B)\nlam8 = \\ t, tm, var8, lam8, app => lam8 _ _ _ (t tm var8 lam8 app)\n\napp8 : {g:_}->{a:_}->{B:_} -> Tm8 g (arr8 a B) -> Tm8 g a -> Tm8 g B\napp8 = \\ t, u, tm, var8, lam8, app8 => app8 _ _ _ (t tm var8 lam8 app8) (u tm var8 lam8 app8)\n\nv08 : {g:_}->{a:_} -> Tm8 (snoc8 g a) a\nv08 = var8 vz8\n\nv18 : {g:_}->{a:_}-> {B:_}-> Tm8 (snoc8 (snoc8 g a) B) a\nv18 = var8 (vs8 vz8)\n\nv28 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm8 (snoc8 (snoc8 (snoc8 g a) B) C) a\nv28 = var8 (vs8 (vs8 vz8))\n\nv38 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm8 (snoc8 (snoc8 (snoc8 (snoc8 g a) B) C) D) a\nv38 = var8 (vs8 (vs8 (vs8 vz8)))\n\nv48 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm8 (snoc8 (snoc8 (snoc8 (snoc8 (snoc8 g a) B) C) D) E) a\nv48 = var8 (vs8 (vs8 (vs8 (vs8 vz8))))\n\ntest8 : {g:_}-> {a:_} -> Tm8 g (arr8 (arr8 a a) (arr8 a a))\ntest8  = lam8 (lam8 (app8 v18 (app8 v18 (app8 v18 (app8 v18 (app8 v18 (app8 v18 v08)))))))\nTy9 : Type\nTy9 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty9 : Ty9\nempty9 = \\ _, empty, _ => empty\n\narr9 : Ty9 -> Ty9 -> Ty9\narr9 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon9 : Type\nCon9 = (Con9 : Type)\n ->(nil  : Con9)\n ->(snoc : Con9 -> Ty9 -> Con9)\n -> Con9\n\nnil9 : Con9\nnil9 = \\ con, nil9, snoc => nil9\n\nsnoc9 : Con9 -> Ty9 -> Con9\nsnoc9 = \\ g, a, con, nil9, snoc9 => snoc9 (g con nil9 snoc9) a\n\nVar9 : Con9 -> Ty9 -> Type\nVar9 = \\ g, a =>\n    (Var9 : Con9 -> Ty9 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var9 (snoc9 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var9 g a -> Var9 (snoc9 g b) a)\n -> Var9 g a\n\nvz9 : {g : _}-> {a : _} -> Var9 (snoc9 g a) a\nvz9 = \\ var, vz9, vs => vz9 _ _\n\nvs9 : {g : _} -> {B : _} -> {a : _} -> Var9 g a -> Var9 (snoc9 g B) a\nvs9 = \\ x, var, vz9, vs9 => vs9 _ _ _ (x var vz9 vs9)\n\nTm9 : Con9 -> Ty9 -> Type\nTm9 = \\ g, a =>\n    (Tm9    : Con9 -> Ty9 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var9 g a -> Tm9 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm9 (snoc9 g a) B -> Tm9 g (arr9 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm9 g (arr9 a B) -> Tm9 g a -> Tm9 g B)\n -> Tm9 g a\n\nvar9 : {g : _} -> {a : _} -> Var9 g a -> Tm9 g a\nvar9 = \\ x, tm, var9, lam, app => var9 _ _ x\n\nlam9 : {g : _} -> {a : _} -> {B : _} -> Tm9 (snoc9 g a) B -> Tm9 g (arr9 a B)\nlam9 = \\ t, tm, var9, lam9, app => lam9 _ _ _ (t tm var9 lam9 app)\n\napp9 : {g:_}->{a:_}->{B:_} -> Tm9 g (arr9 a B) -> Tm9 g a -> Tm9 g B\napp9 = \\ t, u, tm, var9, lam9, app9 => app9 _ _ _ (t tm var9 lam9 app9) (u tm var9 lam9 app9)\n\nv09 : {g:_}->{a:_} -> Tm9 (snoc9 g a) a\nv09 = var9 vz9\n\nv19 : {g:_}->{a:_}-> {B:_}-> Tm9 (snoc9 (snoc9 g a) B) a\nv19 = var9 (vs9 vz9)\n\nv29 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm9 (snoc9 (snoc9 (snoc9 g a) B) C) a\nv29 = var9 (vs9 (vs9 vz9))\n\nv39 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm9 (snoc9 (snoc9 (snoc9 (snoc9 g a) B) C) D) a\nv39 = var9 (vs9 (vs9 (vs9 vz9)))\n\nv49 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm9 (snoc9 (snoc9 (snoc9 (snoc9 (snoc9 g a) B) C) D) E) a\nv49 = var9 (vs9 (vs9 (vs9 (vs9 vz9))))\n\ntest9 : {g:_}-> {a:_} -> Tm9 g (arr9 (arr9 a a) (arr9 a a))\ntest9  = lam9 (lam9 (app9 v19 (app9 v19 (app9 v19 (app9 v19 (app9 v19 (app9 v19 v09)))))))\nTy10 : Type\nTy10 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty10 : Ty10\nempty10 = \\ _, empty, _ => empty\n\narr10 : Ty10 -> Ty10 -> Ty10\narr10 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon10 : Type\nCon10 = (Con10 : Type)\n ->(nil  : Con10)\n ->(snoc : Con10 -> Ty10 -> Con10)\n -> Con10\n\nnil10 : Con10\nnil10 = \\ con, nil10, snoc => nil10\n\nsnoc10 : Con10 -> Ty10 -> Con10\nsnoc10 = \\ g, a, con, nil10, snoc10 => snoc10 (g con nil10 snoc10) a\n\nVar10 : Con10 -> Ty10 -> Type\nVar10 = \\ g, a =>\n    (Var10 : Con10 -> Ty10 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var10 (snoc10 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var10 g a -> Var10 (snoc10 g b) a)\n -> Var10 g a\n\nvz10 : {g : _}-> {a : _} -> Var10 (snoc10 g a) a\nvz10 = \\ var, vz10, vs => vz10 _ _\n\nvs10 : {g : _} -> {B : _} -> {a : _} -> Var10 g a -> Var10 (snoc10 g B) a\nvs10 = \\ x, var, vz10, vs10 => vs10 _ _ _ (x var vz10 vs10)\n\nTm10 : Con10 -> Ty10 -> Type\nTm10 = \\ g, a =>\n    (Tm10    : Con10 -> Ty10 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var10 g a -> Tm10 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm10 (snoc10 g a) B -> Tm10 g (arr10 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm10 g (arr10 a B) -> Tm10 g a -> Tm10 g B)\n -> Tm10 g a\n\nvar10 : {g : _} -> {a : _} -> Var10 g a -> Tm10 g a\nvar10 = \\ x, tm, var10, lam, app => var10 _ _ x\n\nlam10 : {g : _} -> {a : _} -> {B : _} -> Tm10 (snoc10 g a) B -> Tm10 g (arr10 a B)\nlam10 = \\ t, tm, var10, lam10, app => lam10 _ _ _ (t tm var10 lam10 app)\n\napp10 : {g:_}->{a:_}->{B:_} -> Tm10 g (arr10 a B) -> Tm10 g a -> Tm10 g B\napp10 = \\ t, u, tm, var10, lam10, app10 => app10 _ _ _ (t tm var10 lam10 app10) (u tm var10 lam10 app10)\n\nv010 : {g:_}->{a:_} -> Tm10 (snoc10 g a) a\nv010 = var10 vz10\n\nv110 : {g:_}->{a:_}-> {B:_}-> Tm10 (snoc10 (snoc10 g a) B) a\nv110 = var10 (vs10 vz10)\n\nv210 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm10 (snoc10 (snoc10 (snoc10 g a) B) C) a\nv210 = var10 (vs10 (vs10 vz10))\n\nv310 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm10 (snoc10 (snoc10 (snoc10 (snoc10 g a) B) C) D) a\nv310 = var10 (vs10 (vs10 (vs10 vz10)))\n\nv410 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm10 (snoc10 (snoc10 (snoc10 (snoc10 (snoc10 g a) B) C) D) E) a\nv410 = var10 (vs10 (vs10 (vs10 (vs10 vz10))))\n\ntest10 : {g:_}-> {a:_} -> Tm10 g (arr10 (arr10 a a) (arr10 a a))\ntest10  = lam10 (lam10 (app10 v110 (app10 v110 (app10 v110 (app10 v110 (app10 v110 (app10 v110 v010)))))))\nTy11 : Type\nTy11 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty11 : Ty11\nempty11 = \\ _, empty, _ => empty\n\narr11 : Ty11 -> Ty11 -> Ty11\narr11 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon11 : Type\nCon11 = (Con11 : Type)\n ->(nil  : Con11)\n ->(snoc : Con11 -> Ty11 -> Con11)\n -> Con11\n\nnil11 : Con11\nnil11 = \\ con, nil11, snoc => nil11\n\nsnoc11 : Con11 -> Ty11 -> Con11\nsnoc11 = \\ g, a, con, nil11, snoc11 => snoc11 (g con nil11 snoc11) a\n\nVar11 : Con11 -> Ty11 -> Type\nVar11 = \\ g, a =>\n    (Var11 : Con11 -> Ty11 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var11 (snoc11 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var11 g a -> Var11 (snoc11 g b) a)\n -> Var11 g a\n\nvz11 : {g : _}-> {a : _} -> Var11 (snoc11 g a) a\nvz11 = \\ var, vz11, vs => vz11 _ _\n\nvs11 : {g : _} -> {B : _} -> {a : _} -> Var11 g a -> Var11 (snoc11 g B) a\nvs11 = \\ x, var, vz11, vs11 => vs11 _ _ _ (x var vz11 vs11)\n\nTm11 : Con11 -> Ty11 -> Type\nTm11 = \\ g, a =>\n    (Tm11    : Con11 -> Ty11 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var11 g a -> Tm11 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm11 (snoc11 g a) B -> Tm11 g (arr11 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm11 g (arr11 a B) -> Tm11 g a -> Tm11 g B)\n -> Tm11 g a\n\nvar11 : {g : _} -> {a : _} -> Var11 g a -> Tm11 g a\nvar11 = \\ x, tm, var11, lam, app => var11 _ _ x\n\nlam11 : {g : _} -> {a : _} -> {B : _} -> Tm11 (snoc11 g a) B -> Tm11 g (arr11 a B)\nlam11 = \\ t, tm, var11, lam11, app => lam11 _ _ _ (t tm var11 lam11 app)\n\napp11 : {g:_}->{a:_}->{B:_} -> Tm11 g (arr11 a B) -> Tm11 g a -> Tm11 g B\napp11 = \\ t, u, tm, var11, lam11, app11 => app11 _ _ _ (t tm var11 lam11 app11) (u tm var11 lam11 app11)\n\nv011 : {g:_}->{a:_} -> Tm11 (snoc11 g a) a\nv011 = var11 vz11\n\nv111 : {g:_}->{a:_}-> {B:_}-> Tm11 (snoc11 (snoc11 g a) B) a\nv111 = var11 (vs11 vz11)\n\nv211 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm11 (snoc11 (snoc11 (snoc11 g a) B) C) a\nv211 = var11 (vs11 (vs11 vz11))\n\nv311 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm11 (snoc11 (snoc11 (snoc11 (snoc11 g a) B) C) D) a\nv311 = var11 (vs11 (vs11 (vs11 vz11)))\n\nv411 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm11 (snoc11 (snoc11 (snoc11 (snoc11 (snoc11 g a) B) C) D) E) a\nv411 = var11 (vs11 (vs11 (vs11 (vs11 vz11))))\n\ntest11 : {g:_}-> {a:_} -> Tm11 g (arr11 (arr11 a a) (arr11 a a))\ntest11  = lam11 (lam11 (app11 v111 (app11 v111 (app11 v111 (app11 v111 (app11 v111 (app11 v111 v011)))))))\nTy12 : Type\nTy12 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty12 : Ty12\nempty12 = \\ _, empty, _ => empty\n\narr12 : Ty12 -> Ty12 -> Ty12\narr12 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon12 : Type\nCon12 = (Con12 : Type)\n ->(nil  : Con12)\n ->(snoc : Con12 -> Ty12 -> Con12)\n -> Con12\n\nnil12 : Con12\nnil12 = \\ con, nil12, snoc => nil12\n\nsnoc12 : Con12 -> Ty12 -> Con12\nsnoc12 = \\ g, a, con, nil12, snoc12 => snoc12 (g con nil12 snoc12) a\n\nVar12 : Con12 -> Ty12 -> Type\nVar12 = \\ g, a =>\n    (Var12 : Con12 -> Ty12 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var12 (snoc12 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var12 g a -> Var12 (snoc12 g b) a)\n -> Var12 g a\n\nvz12 : {g : _}-> {a : _} -> Var12 (snoc12 g a) a\nvz12 = \\ var, vz12, vs => vz12 _ _\n\nvs12 : {g : _} -> {B : _} -> {a : _} -> Var12 g a -> Var12 (snoc12 g B) a\nvs12 = \\ x, var, vz12, vs12 => vs12 _ _ _ (x var vz12 vs12)\n\nTm12 : Con12 -> Ty12 -> Type\nTm12 = \\ g, a =>\n    (Tm12    : Con12 -> Ty12 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var12 g a -> Tm12 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm12 (snoc12 g a) B -> Tm12 g (arr12 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm12 g (arr12 a B) -> Tm12 g a -> Tm12 g B)\n -> Tm12 g a\n\nvar12 : {g : _} -> {a : _} -> Var12 g a -> Tm12 g a\nvar12 = \\ x, tm, var12, lam, app => var12 _ _ x\n\nlam12 : {g : _} -> {a : _} -> {B : _} -> Tm12 (snoc12 g a) B -> Tm12 g (arr12 a B)\nlam12 = \\ t, tm, var12, lam12, app => lam12 _ _ _ (t tm var12 lam12 app)\n\napp12 : {g:_}->{a:_}->{B:_} -> Tm12 g (arr12 a B) -> Tm12 g a -> Tm12 g B\napp12 = \\ t, u, tm, var12, lam12, app12 => app12 _ _ _ (t tm var12 lam12 app12) (u tm var12 lam12 app12)\n\nv012 : {g:_}->{a:_} -> Tm12 (snoc12 g a) a\nv012 = var12 vz12\n\nv112 : {g:_}->{a:_}-> {B:_}-> Tm12 (snoc12 (snoc12 g a) B) a\nv112 = var12 (vs12 vz12)\n\nv212 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm12 (snoc12 (snoc12 (snoc12 g a) B) C) a\nv212 = var12 (vs12 (vs12 vz12))\n\nv312 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm12 (snoc12 (snoc12 (snoc12 (snoc12 g a) B) C) D) a\nv312 = var12 (vs12 (vs12 (vs12 vz12)))\n\nv412 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm12 (snoc12 (snoc12 (snoc12 (snoc12 (snoc12 g a) B) C) D) E) a\nv412 = var12 (vs12 (vs12 (vs12 (vs12 vz12))))\n\ntest12 : {g:_}-> {a:_} -> Tm12 g (arr12 (arr12 a a) (arr12 a a))\ntest12  = lam12 (lam12 (app12 v112 (app12 v112 (app12 v112 (app12 v112 (app12 v112 (app12 v112 v012)))))))\nTy13 : Type\nTy13 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty13 : Ty13\nempty13 = \\ _, empty, _ => empty\n\narr13 : Ty13 -> Ty13 -> Ty13\narr13 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon13 : Type\nCon13 = (Con13 : Type)\n ->(nil  : Con13)\n ->(snoc : Con13 -> Ty13 -> Con13)\n -> Con13\n\nnil13 : Con13\nnil13 = \\ con, nil13, snoc => nil13\n\nsnoc13 : Con13 -> Ty13 -> Con13\nsnoc13 = \\ g, a, con, nil13, snoc13 => snoc13 (g con nil13 snoc13) a\n\nVar13 : Con13 -> Ty13 -> Type\nVar13 = \\ g, a =>\n    (Var13 : Con13 -> Ty13 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var13 (snoc13 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var13 g a -> Var13 (snoc13 g b) a)\n -> Var13 g a\n\nvz13 : {g : _}-> {a : _} -> Var13 (snoc13 g a) a\nvz13 = \\ var, vz13, vs => vz13 _ _\n\nvs13 : {g : _} -> {B : _} -> {a : _} -> Var13 g a -> Var13 (snoc13 g B) a\nvs13 = \\ x, var, vz13, vs13 => vs13 _ _ _ (x var vz13 vs13)\n\nTm13 : Con13 -> Ty13 -> Type\nTm13 = \\ g, a =>\n    (Tm13    : Con13 -> Ty13 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var13 g a -> Tm13 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm13 (snoc13 g a) B -> Tm13 g (arr13 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm13 g (arr13 a B) -> Tm13 g a -> Tm13 g B)\n -> Tm13 g a\n\nvar13 : {g : _} -> {a : _} -> Var13 g a -> Tm13 g a\nvar13 = \\ x, tm, var13, lam, app => var13 _ _ x\n\nlam13 : {g : _} -> {a : _} -> {B : _} -> Tm13 (snoc13 g a) B -> Tm13 g (arr13 a B)\nlam13 = \\ t, tm, var13, lam13, app => lam13 _ _ _ (t tm var13 lam13 app)\n\napp13 : {g:_}->{a:_}->{B:_} -> Tm13 g (arr13 a B) -> Tm13 g a -> Tm13 g B\napp13 = \\ t, u, tm, var13, lam13, app13 => app13 _ _ _ (t tm var13 lam13 app13) (u tm var13 lam13 app13)\n\nv013 : {g:_}->{a:_} -> Tm13 (snoc13 g a) a\nv013 = var13 vz13\n\nv113 : {g:_}->{a:_}-> {B:_}-> Tm13 (snoc13 (snoc13 g a) B) a\nv113 = var13 (vs13 vz13)\n\nv213 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm13 (snoc13 (snoc13 (snoc13 g a) B) C) a\nv213 = var13 (vs13 (vs13 vz13))\n\nv313 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm13 (snoc13 (snoc13 (snoc13 (snoc13 g a) B) C) D) a\nv313 = var13 (vs13 (vs13 (vs13 vz13)))\n\nv413 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm13 (snoc13 (snoc13 (snoc13 (snoc13 (snoc13 g a) B) C) D) E) a\nv413 = var13 (vs13 (vs13 (vs13 (vs13 vz13))))\n\ntest13 : {g:_}-> {a:_} -> Tm13 g (arr13 (arr13 a a) (arr13 a a))\ntest13  = lam13 (lam13 (app13 v113 (app13 v113 (app13 v113 (app13 v113 (app13 v113 (app13 v113 v013)))))))\nTy14 : Type\nTy14 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty14 : Ty14\nempty14 = \\ _, empty, _ => empty\n\narr14 : Ty14 -> Ty14 -> Ty14\narr14 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon14 : Type\nCon14 = (Con14 : Type)\n ->(nil  : Con14)\n ->(snoc : Con14 -> Ty14 -> Con14)\n -> Con14\n\nnil14 : Con14\nnil14 = \\ con, nil14, snoc => nil14\n\nsnoc14 : Con14 -> Ty14 -> Con14\nsnoc14 = \\ g, a, con, nil14, snoc14 => snoc14 (g con nil14 snoc14) a\n\nVar14 : Con14 -> Ty14 -> Type\nVar14 = \\ g, a =>\n    (Var14 : Con14 -> Ty14 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var14 (snoc14 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var14 g a -> Var14 (snoc14 g b) a)\n -> Var14 g a\n\nvz14 : {g : _}-> {a : _} -> Var14 (snoc14 g a) a\nvz14 = \\ var, vz14, vs => vz14 _ _\n\nvs14 : {g : _} -> {B : _} -> {a : _} -> Var14 g a -> Var14 (snoc14 g B) a\nvs14 = \\ x, var, vz14, vs14 => vs14 _ _ _ (x var vz14 vs14)\n\nTm14 : Con14 -> Ty14 -> Type\nTm14 = \\ g, a =>\n    (Tm14    : Con14 -> Ty14 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var14 g a -> Tm14 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm14 (snoc14 g a) B -> Tm14 g (arr14 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm14 g (arr14 a B) -> Tm14 g a -> Tm14 g B)\n -> Tm14 g a\n\nvar14 : {g : _} -> {a : _} -> Var14 g a -> Tm14 g a\nvar14 = \\ x, tm, var14, lam, app => var14 _ _ x\n\nlam14 : {g : _} -> {a : _} -> {B : _} -> Tm14 (snoc14 g a) B -> Tm14 g (arr14 a B)\nlam14 = \\ t, tm, var14, lam14, app => lam14 _ _ _ (t tm var14 lam14 app)\n\napp14 : {g:_}->{a:_}->{B:_} -> Tm14 g (arr14 a B) -> Tm14 g a -> Tm14 g B\napp14 = \\ t, u, tm, var14, lam14, app14 => app14 _ _ _ (t tm var14 lam14 app14) (u tm var14 lam14 app14)\n\nv014 : {g:_}->{a:_} -> Tm14 (snoc14 g a) a\nv014 = var14 vz14\n\nv114 : {g:_}->{a:_}-> {B:_}-> Tm14 (snoc14 (snoc14 g a) B) a\nv114 = var14 (vs14 vz14)\n\nv214 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm14 (snoc14 (snoc14 (snoc14 g a) B) C) a\nv214 = var14 (vs14 (vs14 vz14))\n\nv314 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm14 (snoc14 (snoc14 (snoc14 (snoc14 g a) B) C) D) a\nv314 = var14 (vs14 (vs14 (vs14 vz14)))\n\nv414 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm14 (snoc14 (snoc14 (snoc14 (snoc14 (snoc14 g a) B) C) D) E) a\nv414 = var14 (vs14 (vs14 (vs14 (vs14 vz14))))\n\ntest14 : {g:_}-> {a:_} -> Tm14 g (arr14 (arr14 a a) (arr14 a a))\ntest14  = lam14 (lam14 (app14 v114 (app14 v114 (app14 v114 (app14 v114 (app14 v114 (app14 v114 v014)))))))\nTy15 : Type\nTy15 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty15 : Ty15\nempty15 = \\ _, empty, _ => empty\n\narr15 : Ty15 -> Ty15 -> Ty15\narr15 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon15 : Type\nCon15 = (Con15 : Type)\n ->(nil  : Con15)\n ->(snoc : Con15 -> Ty15 -> Con15)\n -> Con15\n\nnil15 : Con15\nnil15 = \\ con, nil15, snoc => nil15\n\nsnoc15 : Con15 -> Ty15 -> Con15\nsnoc15 = \\ g, a, con, nil15, snoc15 => snoc15 (g con nil15 snoc15) a\n\nVar15 : Con15 -> Ty15 -> Type\nVar15 = \\ g, a =>\n    (Var15 : Con15 -> Ty15 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var15 (snoc15 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var15 g a -> Var15 (snoc15 g b) a)\n -> Var15 g a\n\nvz15 : {g : _}-> {a : _} -> Var15 (snoc15 g a) a\nvz15 = \\ var, vz15, vs => vz15 _ _\n\nvs15 : {g : _} -> {B : _} -> {a : _} -> Var15 g a -> Var15 (snoc15 g B) a\nvs15 = \\ x, var, vz15, vs15 => vs15 _ _ _ (x var vz15 vs15)\n\nTm15 : Con15 -> Ty15 -> Type\nTm15 = \\ g, a =>\n    (Tm15    : Con15 -> Ty15 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var15 g a -> Tm15 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm15 (snoc15 g a) B -> Tm15 g (arr15 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm15 g (arr15 a B) -> Tm15 g a -> Tm15 g B)\n -> Tm15 g a\n\nvar15 : {g : _} -> {a : _} -> Var15 g a -> Tm15 g a\nvar15 = \\ x, tm, var15, lam, app => var15 _ _ x\n\nlam15 : {g : _} -> {a : _} -> {B : _} -> Tm15 (snoc15 g a) B -> Tm15 g (arr15 a B)\nlam15 = \\ t, tm, var15, lam15, app => lam15 _ _ _ (t tm var15 lam15 app)\n\napp15 : {g:_}->{a:_}->{B:_} -> Tm15 g (arr15 a B) -> Tm15 g a -> Tm15 g B\napp15 = \\ t, u, tm, var15, lam15, app15 => app15 _ _ _ (t tm var15 lam15 app15) (u tm var15 lam15 app15)\n\nv015 : {g:_}->{a:_} -> Tm15 (snoc15 g a) a\nv015 = var15 vz15\n\nv115 : {g:_}->{a:_}-> {B:_}-> Tm15 (snoc15 (snoc15 g a) B) a\nv115 = var15 (vs15 vz15)\n\nv215 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm15 (snoc15 (snoc15 (snoc15 g a) B) C) a\nv215 = var15 (vs15 (vs15 vz15))\n\nv315 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm15 (snoc15 (snoc15 (snoc15 (snoc15 g a) B) C) D) a\nv315 = var15 (vs15 (vs15 (vs15 vz15)))\n\nv415 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm15 (snoc15 (snoc15 (snoc15 (snoc15 (snoc15 g a) B) C) D) E) a\nv415 = var15 (vs15 (vs15 (vs15 (vs15 vz15))))\n\ntest15 : {g:_}-> {a:_} -> Tm15 g (arr15 (arr15 a a) (arr15 a a))\ntest15  = lam15 (lam15 (app15 v115 (app15 v115 (app15 v115 (app15 v115 (app15 v115 (app15 v115 v015)))))))\nTy16 : Type\nTy16 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty16 : Ty16\nempty16 = \\ _, empty, _ => empty\n\narr16 : Ty16 -> Ty16 -> Ty16\narr16 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon16 : Type\nCon16 = (Con16 : Type)\n ->(nil  : Con16)\n ->(snoc : Con16 -> Ty16 -> Con16)\n -> Con16\n\nnil16 : Con16\nnil16 = \\ con, nil16, snoc => nil16\n\nsnoc16 : Con16 -> Ty16 -> Con16\nsnoc16 = \\ g, a, con, nil16, snoc16 => snoc16 (g con nil16 snoc16) a\n\nVar16 : Con16 -> Ty16 -> Type\nVar16 = \\ g, a =>\n    (Var16 : Con16 -> Ty16 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var16 (snoc16 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var16 g a -> Var16 (snoc16 g b) a)\n -> Var16 g a\n\nvz16 : {g : _}-> {a : _} -> Var16 (snoc16 g a) a\nvz16 = \\ var, vz16, vs => vz16 _ _\n\nvs16 : {g : _} -> {B : _} -> {a : _} -> Var16 g a -> Var16 (snoc16 g B) a\nvs16 = \\ x, var, vz16, vs16 => vs16 _ _ _ (x var vz16 vs16)\n\nTm16 : Con16 -> Ty16 -> Type\nTm16 = \\ g, a =>\n    (Tm16    : Con16 -> Ty16 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var16 g a -> Tm16 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm16 (snoc16 g a) B -> Tm16 g (arr16 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm16 g (arr16 a B) -> Tm16 g a -> Tm16 g B)\n -> Tm16 g a\n\nvar16 : {g : _} -> {a : _} -> Var16 g a -> Tm16 g a\nvar16 = \\ x, tm, var16, lam, app => var16 _ _ x\n\nlam16 : {g : _} -> {a : _} -> {B : _} -> Tm16 (snoc16 g a) B -> Tm16 g (arr16 a B)\nlam16 = \\ t, tm, var16, lam16, app => lam16 _ _ _ (t tm var16 lam16 app)\n\napp16 : {g:_}->{a:_}->{B:_} -> Tm16 g (arr16 a B) -> Tm16 g a -> Tm16 g B\napp16 = \\ t, u, tm, var16, lam16, app16 => app16 _ _ _ (t tm var16 lam16 app16) (u tm var16 lam16 app16)\n\nv016 : {g:_}->{a:_} -> Tm16 (snoc16 g a) a\nv016 = var16 vz16\n\nv116 : {g:_}->{a:_}-> {B:_}-> Tm16 (snoc16 (snoc16 g a) B) a\nv116 = var16 (vs16 vz16)\n\nv216 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm16 (snoc16 (snoc16 (snoc16 g a) B) C) a\nv216 = var16 (vs16 (vs16 vz16))\n\nv316 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm16 (snoc16 (snoc16 (snoc16 (snoc16 g a) B) C) D) a\nv316 = var16 (vs16 (vs16 (vs16 vz16)))\n\nv416 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm16 (snoc16 (snoc16 (snoc16 (snoc16 (snoc16 g a) B) C) D) E) a\nv416 = var16 (vs16 (vs16 (vs16 (vs16 vz16))))\n\ntest16 : {g:_}-> {a:_} -> Tm16 g (arr16 (arr16 a a) (arr16 a a))\ntest16  = lam16 (lam16 (app16 v116 (app16 v116 (app16 v116 (app16 v116 (app16 v116 (app16 v116 v016)))))))\nTy17 : Type\nTy17 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty17 : Ty17\nempty17 = \\ _, empty, _ => empty\n\narr17 : Ty17 -> Ty17 -> Ty17\narr17 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon17 : Type\nCon17 = (Con17 : Type)\n ->(nil  : Con17)\n ->(snoc : Con17 -> Ty17 -> Con17)\n -> Con17\n\nnil17 : Con17\nnil17 = \\ con, nil17, snoc => nil17\n\nsnoc17 : Con17 -> Ty17 -> Con17\nsnoc17 = \\ g, a, con, nil17, snoc17 => snoc17 (g con nil17 snoc17) a\n\nVar17 : Con17 -> Ty17 -> Type\nVar17 = \\ g, a =>\n    (Var17 : Con17 -> Ty17 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var17 (snoc17 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var17 g a -> Var17 (snoc17 g b) a)\n -> Var17 g a\n\nvz17 : {g : _}-> {a : _} -> Var17 (snoc17 g a) a\nvz17 = \\ var, vz17, vs => vz17 _ _\n\nvs17 : {g : _} -> {B : _} -> {a : _} -> Var17 g a -> Var17 (snoc17 g B) a\nvs17 = \\ x, var, vz17, vs17 => vs17 _ _ _ (x var vz17 vs17)\n\nTm17 : Con17 -> Ty17 -> Type\nTm17 = \\ g, a =>\n    (Tm17    : Con17 -> Ty17 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var17 g a -> Tm17 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm17 (snoc17 g a) B -> Tm17 g (arr17 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm17 g (arr17 a B) -> Tm17 g a -> Tm17 g B)\n -> Tm17 g a\n\nvar17 : {g : _} -> {a : _} -> Var17 g a -> Tm17 g a\nvar17 = \\ x, tm, var17, lam, app => var17 _ _ x\n\nlam17 : {g : _} -> {a : _} -> {B : _} -> Tm17 (snoc17 g a) B -> Tm17 g (arr17 a B)\nlam17 = \\ t, tm, var17, lam17, app => lam17 _ _ _ (t tm var17 lam17 app)\n\napp17 : {g:_}->{a:_}->{B:_} -> Tm17 g (arr17 a B) -> Tm17 g a -> Tm17 g B\napp17 = \\ t, u, tm, var17, lam17, app17 => app17 _ _ _ (t tm var17 lam17 app17) (u tm var17 lam17 app17)\n\nv017 : {g:_}->{a:_} -> Tm17 (snoc17 g a) a\nv017 = var17 vz17\n\nv117 : {g:_}->{a:_}-> {B:_}-> Tm17 (snoc17 (snoc17 g a) B) a\nv117 = var17 (vs17 vz17)\n\nv217 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm17 (snoc17 (snoc17 (snoc17 g a) B) C) a\nv217 = var17 (vs17 (vs17 vz17))\n\nv317 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm17 (snoc17 (snoc17 (snoc17 (snoc17 g a) B) C) D) a\nv317 = var17 (vs17 (vs17 (vs17 vz17)))\n\nv417 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm17 (snoc17 (snoc17 (snoc17 (snoc17 (snoc17 g a) B) C) D) E) a\nv417 = var17 (vs17 (vs17 (vs17 (vs17 vz17))))\n\ntest17 : {g:_}-> {a:_} -> Tm17 g (arr17 (arr17 a a) (arr17 a a))\ntest17  = lam17 (lam17 (app17 v117 (app17 v117 (app17 v117 (app17 v117 (app17 v117 (app17 v117 v017)))))))\nTy18 : Type\nTy18 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty18 : Ty18\nempty18 = \\ _, empty, _ => empty\n\narr18 : Ty18 -> Ty18 -> Ty18\narr18 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon18 : Type\nCon18 = (Con18 : Type)\n ->(nil  : Con18)\n ->(snoc : Con18 -> Ty18 -> Con18)\n -> Con18\n\nnil18 : Con18\nnil18 = \\ con, nil18, snoc => nil18\n\nsnoc18 : Con18 -> Ty18 -> Con18\nsnoc18 = \\ g, a, con, nil18, snoc18 => snoc18 (g con nil18 snoc18) a\n\nVar18 : Con18 -> Ty18 -> Type\nVar18 = \\ g, a =>\n    (Var18 : Con18 -> Ty18 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var18 (snoc18 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var18 g a -> Var18 (snoc18 g b) a)\n -> Var18 g a\n\nvz18 : {g : _}-> {a : _} -> Var18 (snoc18 g a) a\nvz18 = \\ var, vz18, vs => vz18 _ _\n\nvs18 : {g : _} -> {B : _} -> {a : _} -> Var18 g a -> Var18 (snoc18 g B) a\nvs18 = \\ x, var, vz18, vs18 => vs18 _ _ _ (x var vz18 vs18)\n\nTm18 : Con18 -> Ty18 -> Type\nTm18 = \\ g, a =>\n    (Tm18    : Con18 -> Ty18 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var18 g a -> Tm18 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm18 (snoc18 g a) B -> Tm18 g (arr18 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm18 g (arr18 a B) -> Tm18 g a -> Tm18 g B)\n -> Tm18 g a\n\nvar18 : {g : _} -> {a : _} -> Var18 g a -> Tm18 g a\nvar18 = \\ x, tm, var18, lam, app => var18 _ _ x\n\nlam18 : {g : _} -> {a : _} -> {B : _} -> Tm18 (snoc18 g a) B -> Tm18 g (arr18 a B)\nlam18 = \\ t, tm, var18, lam18, app => lam18 _ _ _ (t tm var18 lam18 app)\n\napp18 : {g:_}->{a:_}->{B:_} -> Tm18 g (arr18 a B) -> Tm18 g a -> Tm18 g B\napp18 = \\ t, u, tm, var18, lam18, app18 => app18 _ _ _ (t tm var18 lam18 app18) (u tm var18 lam18 app18)\n\nv018 : {g:_}->{a:_} -> Tm18 (snoc18 g a) a\nv018 = var18 vz18\n\nv118 : {g:_}->{a:_}-> {B:_}-> Tm18 (snoc18 (snoc18 g a) B) a\nv118 = var18 (vs18 vz18)\n\nv218 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm18 (snoc18 (snoc18 (snoc18 g a) B) C) a\nv218 = var18 (vs18 (vs18 vz18))\n\nv318 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm18 (snoc18 (snoc18 (snoc18 (snoc18 g a) B) C) D) a\nv318 = var18 (vs18 (vs18 (vs18 vz18)))\n\nv418 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm18 (snoc18 (snoc18 (snoc18 (snoc18 (snoc18 g a) B) C) D) E) a\nv418 = var18 (vs18 (vs18 (vs18 (vs18 vz18))))\n\ntest18 : {g:_}-> {a:_} -> Tm18 g (arr18 (arr18 a a) (arr18 a a))\ntest18  = lam18 (lam18 (app18 v118 (app18 v118 (app18 v118 (app18 v118 (app18 v118 (app18 v118 v018)))))))\nTy19 : Type\nTy19 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty19 : Ty19\nempty19 = \\ _, empty, _ => empty\n\narr19 : Ty19 -> Ty19 -> Ty19\narr19 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon19 : Type\nCon19 = (Con19 : Type)\n ->(nil  : Con19)\n ->(snoc : Con19 -> Ty19 -> Con19)\n -> Con19\n\nnil19 : Con19\nnil19 = \\ con, nil19, snoc => nil19\n\nsnoc19 : Con19 -> Ty19 -> Con19\nsnoc19 = \\ g, a, con, nil19, snoc19 => snoc19 (g con nil19 snoc19) a\n\nVar19 : Con19 -> Ty19 -> Type\nVar19 = \\ g, a =>\n    (Var19 : Con19 -> Ty19 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var19 (snoc19 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var19 g a -> Var19 (snoc19 g b) a)\n -> Var19 g a\n\nvz19 : {g : _}-> {a : _} -> Var19 (snoc19 g a) a\nvz19 = \\ var, vz19, vs => vz19 _ _\n\nvs19 : {g : _} -> {B : _} -> {a : _} -> Var19 g a -> Var19 (snoc19 g B) a\nvs19 = \\ x, var, vz19, vs19 => vs19 _ _ _ (x var vz19 vs19)\n\nTm19 : Con19 -> Ty19 -> Type\nTm19 = \\ g, a =>\n    (Tm19    : Con19 -> Ty19 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var19 g a -> Tm19 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm19 (snoc19 g a) B -> Tm19 g (arr19 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm19 g (arr19 a B) -> Tm19 g a -> Tm19 g B)\n -> Tm19 g a\n\nvar19 : {g : _} -> {a : _} -> Var19 g a -> Tm19 g a\nvar19 = \\ x, tm, var19, lam, app => var19 _ _ x\n\nlam19 : {g : _} -> {a : _} -> {B : _} -> Tm19 (snoc19 g a) B -> Tm19 g (arr19 a B)\nlam19 = \\ t, tm, var19, lam19, app => lam19 _ _ _ (t tm var19 lam19 app)\n\napp19 : {g:_}->{a:_}->{B:_} -> Tm19 g (arr19 a B) -> Tm19 g a -> Tm19 g B\napp19 = \\ t, u, tm, var19, lam19, app19 => app19 _ _ _ (t tm var19 lam19 app19) (u tm var19 lam19 app19)\n\nv019 : {g:_}->{a:_} -> Tm19 (snoc19 g a) a\nv019 = var19 vz19\n\nv119 : {g:_}->{a:_}-> {B:_}-> Tm19 (snoc19 (snoc19 g a) B) a\nv119 = var19 (vs19 vz19)\n\nv219 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm19 (snoc19 (snoc19 (snoc19 g a) B) C) a\nv219 = var19 (vs19 (vs19 vz19))\n\nv319 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm19 (snoc19 (snoc19 (snoc19 (snoc19 g a) B) C) D) a\nv319 = var19 (vs19 (vs19 (vs19 vz19)))\n\nv419 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm19 (snoc19 (snoc19 (snoc19 (snoc19 (snoc19 g a) B) C) D) E) a\nv419 = var19 (vs19 (vs19 (vs19 (vs19 vz19))))\n\ntest19 : {g:_}-> {a:_} -> Tm19 g (arr19 (arr19 a a) (arr19 a a))\ntest19  = lam19 (lam19 (app19 v119 (app19 v119 (app19 v119 (app19 v119 (app19 v119 (app19 v119 v019)))))))\nTy20 : Type\nTy20 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty20 : Ty20\nempty20 = \\ _, empty, _ => empty\n\narr20 : Ty20 -> Ty20 -> Ty20\narr20 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon20 : Type\nCon20 = (Con20 : Type)\n ->(nil  : Con20)\n ->(snoc : Con20 -> Ty20 -> Con20)\n -> Con20\n\nnil20 : Con20\nnil20 = \\ con, nil20, snoc => nil20\n\nsnoc20 : Con20 -> Ty20 -> Con20\nsnoc20 = \\ g, a, con, nil20, snoc20 => snoc20 (g con nil20 snoc20) a\n\nVar20 : Con20 -> Ty20 -> Type\nVar20 = \\ g, a =>\n    (Var20 : Con20 -> Ty20 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var20 (snoc20 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var20 g a -> Var20 (snoc20 g b) a)\n -> Var20 g a\n\nvz20 : {g : _}-> {a : _} -> Var20 (snoc20 g a) a\nvz20 = \\ var, vz20, vs => vz20 _ _\n\nvs20 : {g : _} -> {B : _} -> {a : _} -> Var20 g a -> Var20 (snoc20 g B) a\nvs20 = \\ x, var, vz20, vs20 => vs20 _ _ _ (x var vz20 vs20)\n\nTm20 : Con20 -> Ty20 -> Type\nTm20 = \\ g, a =>\n    (Tm20    : Con20 -> Ty20 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var20 g a -> Tm20 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm20 (snoc20 g a) B -> Tm20 g (arr20 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm20 g (arr20 a B) -> Tm20 g a -> Tm20 g B)\n -> Tm20 g a\n\nvar20 : {g : _} -> {a : _} -> Var20 g a -> Tm20 g a\nvar20 = \\ x, tm, var20, lam, app => var20 _ _ x\n\nlam20 : {g : _} -> {a : _} -> {B : _} -> Tm20 (snoc20 g a) B -> Tm20 g (arr20 a B)\nlam20 = \\ t, tm, var20, lam20, app => lam20 _ _ _ (t tm var20 lam20 app)\n\napp20 : {g:_}->{a:_}->{B:_} -> Tm20 g (arr20 a B) -> Tm20 g a -> Tm20 g B\napp20 = \\ t, u, tm, var20, lam20, app20 => app20 _ _ _ (t tm var20 lam20 app20) (u tm var20 lam20 app20)\n\nv020 : {g:_}->{a:_} -> Tm20 (snoc20 g a) a\nv020 = var20 vz20\n\nv120 : {g:_}->{a:_}-> {B:_}-> Tm20 (snoc20 (snoc20 g a) B) a\nv120 = var20 (vs20 vz20)\n\nv220 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm20 (snoc20 (snoc20 (snoc20 g a) B) C) a\nv220 = var20 (vs20 (vs20 vz20))\n\nv320 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm20 (snoc20 (snoc20 (snoc20 (snoc20 g a) B) C) D) a\nv320 = var20 (vs20 (vs20 (vs20 vz20)))\n\nv420 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm20 (snoc20 (snoc20 (snoc20 (snoc20 (snoc20 g a) B) C) D) E) a\nv420 = var20 (vs20 (vs20 (vs20 (vs20 vz20))))\n\ntest20 : {g:_}-> {a:_} -> Tm20 g (arr20 (arr20 a a) (arr20 a a))\ntest20  = lam20 (lam20 (app20 v120 (app20 v120 (app20 v120 (app20 v120 (app20 v120 (app20 v120 v020)))))))\nTy21 : Type\nTy21 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty21 : Ty21\nempty21 = \\ _, empty, _ => empty\n\narr21 : Ty21 -> Ty21 -> Ty21\narr21 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon21 : Type\nCon21 = (Con21 : Type)\n ->(nil  : Con21)\n ->(snoc : Con21 -> Ty21 -> Con21)\n -> Con21\n\nnil21 : Con21\nnil21 = \\ con, nil21, snoc => nil21\n\nsnoc21 : Con21 -> Ty21 -> Con21\nsnoc21 = \\ g, a, con, nil21, snoc21 => snoc21 (g con nil21 snoc21) a\n\nVar21 : Con21 -> Ty21 -> Type\nVar21 = \\ g, a =>\n    (Var21 : Con21 -> Ty21 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var21 (snoc21 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var21 g a -> Var21 (snoc21 g b) a)\n -> Var21 g a\n\nvz21 : {g : _}-> {a : _} -> Var21 (snoc21 g a) a\nvz21 = \\ var, vz21, vs => vz21 _ _\n\nvs21 : {g : _} -> {B : _} -> {a : _} -> Var21 g a -> Var21 (snoc21 g B) a\nvs21 = \\ x, var, vz21, vs21 => vs21 _ _ _ (x var vz21 vs21)\n\nTm21 : Con21 -> Ty21 -> Type\nTm21 = \\ g, a =>\n    (Tm21    : Con21 -> Ty21 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var21 g a -> Tm21 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm21 (snoc21 g a) B -> Tm21 g (arr21 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm21 g (arr21 a B) -> Tm21 g a -> Tm21 g B)\n -> Tm21 g a\n\nvar21 : {g : _} -> {a : _} -> Var21 g a -> Tm21 g a\nvar21 = \\ x, tm, var21, lam, app => var21 _ _ x\n\nlam21 : {g : _} -> {a : _} -> {B : _} -> Tm21 (snoc21 g a) B -> Tm21 g (arr21 a B)\nlam21 = \\ t, tm, var21, lam21, app => lam21 _ _ _ (t tm var21 lam21 app)\n\napp21 : {g:_}->{a:_}->{B:_} -> Tm21 g (arr21 a B) -> Tm21 g a -> Tm21 g B\napp21 = \\ t, u, tm, var21, lam21, app21 => app21 _ _ _ (t tm var21 lam21 app21) (u tm var21 lam21 app21)\n\nv021 : {g:_}->{a:_} -> Tm21 (snoc21 g a) a\nv021 = var21 vz21\n\nv121 : {g:_}->{a:_}-> {B:_}-> Tm21 (snoc21 (snoc21 g a) B) a\nv121 = var21 (vs21 vz21)\n\nv221 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm21 (snoc21 (snoc21 (snoc21 g a) B) C) a\nv221 = var21 (vs21 (vs21 vz21))\n\nv321 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm21 (snoc21 (snoc21 (snoc21 (snoc21 g a) B) C) D) a\nv321 = var21 (vs21 (vs21 (vs21 vz21)))\n\nv421 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm21 (snoc21 (snoc21 (snoc21 (snoc21 (snoc21 g a) B) C) D) E) a\nv421 = var21 (vs21 (vs21 (vs21 (vs21 vz21))))\n\ntest21 : {g:_}-> {a:_} -> Tm21 g (arr21 (arr21 a a) (arr21 a a))\ntest21  = lam21 (lam21 (app21 v121 (app21 v121 (app21 v121 (app21 v121 (app21 v121 (app21 v121 v021)))))))\nTy22 : Type\nTy22 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty22 : Ty22\nempty22 = \\ _, empty, _ => empty\n\narr22 : Ty22 -> Ty22 -> Ty22\narr22 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon22 : Type\nCon22 = (Con22 : Type)\n ->(nil  : Con22)\n ->(snoc : Con22 -> Ty22 -> Con22)\n -> Con22\n\nnil22 : Con22\nnil22 = \\ con, nil22, snoc => nil22\n\nsnoc22 : Con22 -> Ty22 -> Con22\nsnoc22 = \\ g, a, con, nil22, snoc22 => snoc22 (g con nil22 snoc22) a\n\nVar22 : Con22 -> Ty22 -> Type\nVar22 = \\ g, a =>\n    (Var22 : Con22 -> Ty22 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var22 (snoc22 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var22 g a -> Var22 (snoc22 g b) a)\n -> Var22 g a\n\nvz22 : {g : _}-> {a : _} -> Var22 (snoc22 g a) a\nvz22 = \\ var, vz22, vs => vz22 _ _\n\nvs22 : {g : _} -> {B : _} -> {a : _} -> Var22 g a -> Var22 (snoc22 g B) a\nvs22 = \\ x, var, vz22, vs22 => vs22 _ _ _ (x var vz22 vs22)\n\nTm22 : Con22 -> Ty22 -> Type\nTm22 = \\ g, a =>\n    (Tm22    : Con22 -> Ty22 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var22 g a -> Tm22 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm22 (snoc22 g a) B -> Tm22 g (arr22 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm22 g (arr22 a B) -> Tm22 g a -> Tm22 g B)\n -> Tm22 g a\n\nvar22 : {g : _} -> {a : _} -> Var22 g a -> Tm22 g a\nvar22 = \\ x, tm, var22, lam, app => var22 _ _ x\n\nlam22 : {g : _} -> {a : _} -> {B : _} -> Tm22 (snoc22 g a) B -> Tm22 g (arr22 a B)\nlam22 = \\ t, tm, var22, lam22, app => lam22 _ _ _ (t tm var22 lam22 app)\n\napp22 : {g:_}->{a:_}->{B:_} -> Tm22 g (arr22 a B) -> Tm22 g a -> Tm22 g B\napp22 = \\ t, u, tm, var22, lam22, app22 => app22 _ _ _ (t tm var22 lam22 app22) (u tm var22 lam22 app22)\n\nv022 : {g:_}->{a:_} -> Tm22 (snoc22 g a) a\nv022 = var22 vz22\n\nv122 : {g:_}->{a:_}-> {B:_}-> Tm22 (snoc22 (snoc22 g a) B) a\nv122 = var22 (vs22 vz22)\n\nv222 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm22 (snoc22 (snoc22 (snoc22 g a) B) C) a\nv222 = var22 (vs22 (vs22 vz22))\n\nv322 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm22 (snoc22 (snoc22 (snoc22 (snoc22 g a) B) C) D) a\nv322 = var22 (vs22 (vs22 (vs22 vz22)))\n\nv422 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm22 (snoc22 (snoc22 (snoc22 (snoc22 (snoc22 g a) B) C) D) E) a\nv422 = var22 (vs22 (vs22 (vs22 (vs22 vz22))))\n\ntest22 : {g:_}-> {a:_} -> Tm22 g (arr22 (arr22 a a) (arr22 a a))\ntest22  = lam22 (lam22 (app22 v122 (app22 v122 (app22 v122 (app22 v122 (app22 v122 (app22 v122 v022)))))))\nTy23 : Type\nTy23 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty23 : Ty23\nempty23 = \\ _, empty, _ => empty\n\narr23 : Ty23 -> Ty23 -> Ty23\narr23 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon23 : Type\nCon23 = (Con23 : Type)\n ->(nil  : Con23)\n ->(snoc : Con23 -> Ty23 -> Con23)\n -> Con23\n\nnil23 : Con23\nnil23 = \\ con, nil23, snoc => nil23\n\nsnoc23 : Con23 -> Ty23 -> Con23\nsnoc23 = \\ g, a, con, nil23, snoc23 => snoc23 (g con nil23 snoc23) a\n\nVar23 : Con23 -> Ty23 -> Type\nVar23 = \\ g, a =>\n    (Var23 : Con23 -> Ty23 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var23 (snoc23 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var23 g a -> Var23 (snoc23 g b) a)\n -> Var23 g a\n\nvz23 : {g : _}-> {a : _} -> Var23 (snoc23 g a) a\nvz23 = \\ var, vz23, vs => vz23 _ _\n\nvs23 : {g : _} -> {B : _} -> {a : _} -> Var23 g a -> Var23 (snoc23 g B) a\nvs23 = \\ x, var, vz23, vs23 => vs23 _ _ _ (x var vz23 vs23)\n\nTm23 : Con23 -> Ty23 -> Type\nTm23 = \\ g, a =>\n    (Tm23    : Con23 -> Ty23 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var23 g a -> Tm23 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm23 (snoc23 g a) B -> Tm23 g (arr23 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm23 g (arr23 a B) -> Tm23 g a -> Tm23 g B)\n -> Tm23 g a\n\nvar23 : {g : _} -> {a : _} -> Var23 g a -> Tm23 g a\nvar23 = \\ x, tm, var23, lam, app => var23 _ _ x\n\nlam23 : {g : _} -> {a : _} -> {B : _} -> Tm23 (snoc23 g a) B -> Tm23 g (arr23 a B)\nlam23 = \\ t, tm, var23, lam23, app => lam23 _ _ _ (t tm var23 lam23 app)\n\napp23 : {g:_}->{a:_}->{B:_} -> Tm23 g (arr23 a B) -> Tm23 g a -> Tm23 g B\napp23 = \\ t, u, tm, var23, lam23, app23 => app23 _ _ _ (t tm var23 lam23 app23) (u tm var23 lam23 app23)\n\nv023 : {g:_}->{a:_} -> Tm23 (snoc23 g a) a\nv023 = var23 vz23\n\nv123 : {g:_}->{a:_}-> {B:_}-> Tm23 (snoc23 (snoc23 g a) B) a\nv123 = var23 (vs23 vz23)\n\nv223 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm23 (snoc23 (snoc23 (snoc23 g a) B) C) a\nv223 = var23 (vs23 (vs23 vz23))\n\nv323 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm23 (snoc23 (snoc23 (snoc23 (snoc23 g a) B) C) D) a\nv323 = var23 (vs23 (vs23 (vs23 vz23)))\n\nv423 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm23 (snoc23 (snoc23 (snoc23 (snoc23 (snoc23 g a) B) C) D) E) a\nv423 = var23 (vs23 (vs23 (vs23 (vs23 vz23))))\n\ntest23 : {g:_}-> {a:_} -> Tm23 g (arr23 (arr23 a a) (arr23 a a))\ntest23  = lam23 (lam23 (app23 v123 (app23 v123 (app23 v123 (app23 v123 (app23 v123 (app23 v123 v023)))))))\nTy24 : Type\nTy24 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty24 : Ty24\nempty24 = \\ _, empty, _ => empty\n\narr24 : Ty24 -> Ty24 -> Ty24\narr24 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon24 : Type\nCon24 = (Con24 : Type)\n ->(nil  : Con24)\n ->(snoc : Con24 -> Ty24 -> Con24)\n -> Con24\n\nnil24 : Con24\nnil24 = \\ con, nil24, snoc => nil24\n\nsnoc24 : Con24 -> Ty24 -> Con24\nsnoc24 = \\ g, a, con, nil24, snoc24 => snoc24 (g con nil24 snoc24) a\n\nVar24 : Con24 -> Ty24 -> Type\nVar24 = \\ g, a =>\n    (Var24 : Con24 -> Ty24 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var24 (snoc24 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var24 g a -> Var24 (snoc24 g b) a)\n -> Var24 g a\n\nvz24 : {g : _}-> {a : _} -> Var24 (snoc24 g a) a\nvz24 = \\ var, vz24, vs => vz24 _ _\n\nvs24 : {g : _} -> {B : _} -> {a : _} -> Var24 g a -> Var24 (snoc24 g B) a\nvs24 = \\ x, var, vz24, vs24 => vs24 _ _ _ (x var vz24 vs24)\n\nTm24 : Con24 -> Ty24 -> Type\nTm24 = \\ g, a =>\n    (Tm24    : Con24 -> Ty24 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var24 g a -> Tm24 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm24 (snoc24 g a) B -> Tm24 g (arr24 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm24 g (arr24 a B) -> Tm24 g a -> Tm24 g B)\n -> Tm24 g a\n\nvar24 : {g : _} -> {a : _} -> Var24 g a -> Tm24 g a\nvar24 = \\ x, tm, var24, lam, app => var24 _ _ x\n\nlam24 : {g : _} -> {a : _} -> {B : _} -> Tm24 (snoc24 g a) B -> Tm24 g (arr24 a B)\nlam24 = \\ t, tm, var24, lam24, app => lam24 _ _ _ (t tm var24 lam24 app)\n\napp24 : {g:_}->{a:_}->{B:_} -> Tm24 g (arr24 a B) -> Tm24 g a -> Tm24 g B\napp24 = \\ t, u, tm, var24, lam24, app24 => app24 _ _ _ (t tm var24 lam24 app24) (u tm var24 lam24 app24)\n\nv024 : {g:_}->{a:_} -> Tm24 (snoc24 g a) a\nv024 = var24 vz24\n\nv124 : {g:_}->{a:_}-> {B:_}-> Tm24 (snoc24 (snoc24 g a) B) a\nv124 = var24 (vs24 vz24)\n\nv224 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm24 (snoc24 (snoc24 (snoc24 g a) B) C) a\nv224 = var24 (vs24 (vs24 vz24))\n\nv324 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm24 (snoc24 (snoc24 (snoc24 (snoc24 g a) B) C) D) a\nv324 = var24 (vs24 (vs24 (vs24 vz24)))\n\nv424 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm24 (snoc24 (snoc24 (snoc24 (snoc24 (snoc24 g a) B) C) D) E) a\nv424 = var24 (vs24 (vs24 (vs24 (vs24 vz24))))\n\ntest24 : {g:_}-> {a:_} -> Tm24 g (arr24 (arr24 a a) (arr24 a a))\ntest24  = lam24 (lam24 (app24 v124 (app24 v124 (app24 v124 (app24 v124 (app24 v124 (app24 v124 v024)))))))\nTy25 : Type\nTy25 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty25 : Ty25\nempty25 = \\ _, empty, _ => empty\n\narr25 : Ty25 -> Ty25 -> Ty25\narr25 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon25 : Type\nCon25 = (Con25 : Type)\n ->(nil  : Con25)\n ->(snoc : Con25 -> Ty25 -> Con25)\n -> Con25\n\nnil25 : Con25\nnil25 = \\ con, nil25, snoc => nil25\n\nsnoc25 : Con25 -> Ty25 -> Con25\nsnoc25 = \\ g, a, con, nil25, snoc25 => snoc25 (g con nil25 snoc25) a\n\nVar25 : Con25 -> Ty25 -> Type\nVar25 = \\ g, a =>\n    (Var25 : Con25 -> Ty25 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var25 (snoc25 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var25 g a -> Var25 (snoc25 g b) a)\n -> Var25 g a\n\nvz25 : {g : _}-> {a : _} -> Var25 (snoc25 g a) a\nvz25 = \\ var, vz25, vs => vz25 _ _\n\nvs25 : {g : _} -> {B : _} -> {a : _} -> Var25 g a -> Var25 (snoc25 g B) a\nvs25 = \\ x, var, vz25, vs25 => vs25 _ _ _ (x var vz25 vs25)\n\nTm25 : Con25 -> Ty25 -> Type\nTm25 = \\ g, a =>\n    (Tm25    : Con25 -> Ty25 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var25 g a -> Tm25 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm25 (snoc25 g a) B -> Tm25 g (arr25 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm25 g (arr25 a B) -> Tm25 g a -> Tm25 g B)\n -> Tm25 g a\n\nvar25 : {g : _} -> {a : _} -> Var25 g a -> Tm25 g a\nvar25 = \\ x, tm, var25, lam, app => var25 _ _ x\n\nlam25 : {g : _} -> {a : _} -> {B : _} -> Tm25 (snoc25 g a) B -> Tm25 g (arr25 a B)\nlam25 = \\ t, tm, var25, lam25, app => lam25 _ _ _ (t tm var25 lam25 app)\n\napp25 : {g:_}->{a:_}->{B:_} -> Tm25 g (arr25 a B) -> Tm25 g a -> Tm25 g B\napp25 = \\ t, u, tm, var25, lam25, app25 => app25 _ _ _ (t tm var25 lam25 app25) (u tm var25 lam25 app25)\n\nv025 : {g:_}->{a:_} -> Tm25 (snoc25 g a) a\nv025 = var25 vz25\n\nv125 : {g:_}->{a:_}-> {B:_}-> Tm25 (snoc25 (snoc25 g a) B) a\nv125 = var25 (vs25 vz25)\n\nv225 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm25 (snoc25 (snoc25 (snoc25 g a) B) C) a\nv225 = var25 (vs25 (vs25 vz25))\n\nv325 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm25 (snoc25 (snoc25 (snoc25 (snoc25 g a) B) C) D) a\nv325 = var25 (vs25 (vs25 (vs25 vz25)))\n\nv425 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm25 (snoc25 (snoc25 (snoc25 (snoc25 (snoc25 g a) B) C) D) E) a\nv425 = var25 (vs25 (vs25 (vs25 (vs25 vz25))))\n\ntest25 : {g:_}-> {a:_} -> Tm25 g (arr25 (arr25 a a) (arr25 a a))\ntest25  = lam25 (lam25 (app25 v125 (app25 v125 (app25 v125 (app25 v125 (app25 v125 (app25 v125 v025)))))))\nTy26 : Type\nTy26 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty26 : Ty26\nempty26 = \\ _, empty, _ => empty\n\narr26 : Ty26 -> Ty26 -> Ty26\narr26 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon26 : Type\nCon26 = (Con26 : Type)\n ->(nil  : Con26)\n ->(snoc : Con26 -> Ty26 -> Con26)\n -> Con26\n\nnil26 : Con26\nnil26 = \\ con, nil26, snoc => nil26\n\nsnoc26 : Con26 -> Ty26 -> Con26\nsnoc26 = \\ g, a, con, nil26, snoc26 => snoc26 (g con nil26 snoc26) a\n\nVar26 : Con26 -> Ty26 -> Type\nVar26 = \\ g, a =>\n    (Var26 : Con26 -> Ty26 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var26 (snoc26 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var26 g a -> Var26 (snoc26 g b) a)\n -> Var26 g a\n\nvz26 : {g : _}-> {a : _} -> Var26 (snoc26 g a) a\nvz26 = \\ var, vz26, vs => vz26 _ _\n\nvs26 : {g : _} -> {B : _} -> {a : _} -> Var26 g a -> Var26 (snoc26 g B) a\nvs26 = \\ x, var, vz26, vs26 => vs26 _ _ _ (x var vz26 vs26)\n\nTm26 : Con26 -> Ty26 -> Type\nTm26 = \\ g, a =>\n    (Tm26    : Con26 -> Ty26 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var26 g a -> Tm26 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm26 (snoc26 g a) B -> Tm26 g (arr26 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm26 g (arr26 a B) -> Tm26 g a -> Tm26 g B)\n -> Tm26 g a\n\nvar26 : {g : _} -> {a : _} -> Var26 g a -> Tm26 g a\nvar26 = \\ x, tm, var26, lam, app => var26 _ _ x\n\nlam26 : {g : _} -> {a : _} -> {B : _} -> Tm26 (snoc26 g a) B -> Tm26 g (arr26 a B)\nlam26 = \\ t, tm, var26, lam26, app => lam26 _ _ _ (t tm var26 lam26 app)\n\napp26 : {g:_}->{a:_}->{B:_} -> Tm26 g (arr26 a B) -> Tm26 g a -> Tm26 g B\napp26 = \\ t, u, tm, var26, lam26, app26 => app26 _ _ _ (t tm var26 lam26 app26) (u tm var26 lam26 app26)\n\nv026 : {g:_}->{a:_} -> Tm26 (snoc26 g a) a\nv026 = var26 vz26\n\nv126 : {g:_}->{a:_}-> {B:_}-> Tm26 (snoc26 (snoc26 g a) B) a\nv126 = var26 (vs26 vz26)\n\nv226 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm26 (snoc26 (snoc26 (snoc26 g a) B) C) a\nv226 = var26 (vs26 (vs26 vz26))\n\nv326 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm26 (snoc26 (snoc26 (snoc26 (snoc26 g a) B) C) D) a\nv326 = var26 (vs26 (vs26 (vs26 vz26)))\n\nv426 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm26 (snoc26 (snoc26 (snoc26 (snoc26 (snoc26 g a) B) C) D) E) a\nv426 = var26 (vs26 (vs26 (vs26 (vs26 vz26))))\n\ntest26 : {g:_}-> {a:_} -> Tm26 g (arr26 (arr26 a a) (arr26 a a))\ntest26  = lam26 (lam26 (app26 v126 (app26 v126 (app26 v126 (app26 v126 (app26 v126 (app26 v126 v026)))))))\nTy27 : Type\nTy27 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty27 : Ty27\nempty27 = \\ _, empty, _ => empty\n\narr27 : Ty27 -> Ty27 -> Ty27\narr27 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon27 : Type\nCon27 = (Con27 : Type)\n ->(nil  : Con27)\n ->(snoc : Con27 -> Ty27 -> Con27)\n -> Con27\n\nnil27 : Con27\nnil27 = \\ con, nil27, snoc => nil27\n\nsnoc27 : Con27 -> Ty27 -> Con27\nsnoc27 = \\ g, a, con, nil27, snoc27 => snoc27 (g con nil27 snoc27) a\n\nVar27 : Con27 -> Ty27 -> Type\nVar27 = \\ g, a =>\n    (Var27 : Con27 -> Ty27 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var27 (snoc27 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var27 g a -> Var27 (snoc27 g b) a)\n -> Var27 g a\n\nvz27 : {g : _}-> {a : _} -> Var27 (snoc27 g a) a\nvz27 = \\ var, vz27, vs => vz27 _ _\n\nvs27 : {g : _} -> {B : _} -> {a : _} -> Var27 g a -> Var27 (snoc27 g B) a\nvs27 = \\ x, var, vz27, vs27 => vs27 _ _ _ (x var vz27 vs27)\n\nTm27 : Con27 -> Ty27 -> Type\nTm27 = \\ g, a =>\n    (Tm27    : Con27 -> Ty27 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var27 g a -> Tm27 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm27 (snoc27 g a) B -> Tm27 g (arr27 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm27 g (arr27 a B) -> Tm27 g a -> Tm27 g B)\n -> Tm27 g a\n\nvar27 : {g : _} -> {a : _} -> Var27 g a -> Tm27 g a\nvar27 = \\ x, tm, var27, lam, app => var27 _ _ x\n\nlam27 : {g : _} -> {a : _} -> {B : _} -> Tm27 (snoc27 g a) B -> Tm27 g (arr27 a B)\nlam27 = \\ t, tm, var27, lam27, app => lam27 _ _ _ (t tm var27 lam27 app)\n\napp27 : {g:_}->{a:_}->{B:_} -> Tm27 g (arr27 a B) -> Tm27 g a -> Tm27 g B\napp27 = \\ t, u, tm, var27, lam27, app27 => app27 _ _ _ (t tm var27 lam27 app27) (u tm var27 lam27 app27)\n\nv027 : {g:_}->{a:_} -> Tm27 (snoc27 g a) a\nv027 = var27 vz27\n\nv127 : {g:_}->{a:_}-> {B:_}-> Tm27 (snoc27 (snoc27 g a) B) a\nv127 = var27 (vs27 vz27)\n\nv227 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm27 (snoc27 (snoc27 (snoc27 g a) B) C) a\nv227 = var27 (vs27 (vs27 vz27))\n\nv327 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm27 (snoc27 (snoc27 (snoc27 (snoc27 g a) B) C) D) a\nv327 = var27 (vs27 (vs27 (vs27 vz27)))\n\nv427 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm27 (snoc27 (snoc27 (snoc27 (snoc27 (snoc27 g a) B) C) D) E) a\nv427 = var27 (vs27 (vs27 (vs27 (vs27 vz27))))\n\ntest27 : {g:_}-> {a:_} -> Tm27 g (arr27 (arr27 a a) (arr27 a a))\ntest27  = lam27 (lam27 (app27 v127 (app27 v127 (app27 v127 (app27 v127 (app27 v127 (app27 v127 v027)))))))\nTy28 : Type\nTy28 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty28 : Ty28\nempty28 = \\ _, empty, _ => empty\n\narr28 : Ty28 -> Ty28 -> Ty28\narr28 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon28 : Type\nCon28 = (Con28 : Type)\n ->(nil  : Con28)\n ->(snoc : Con28 -> Ty28 -> Con28)\n -> Con28\n\nnil28 : Con28\nnil28 = \\ con, nil28, snoc => nil28\n\nsnoc28 : Con28 -> Ty28 -> Con28\nsnoc28 = \\ g, a, con, nil28, snoc28 => snoc28 (g con nil28 snoc28) a\n\nVar28 : Con28 -> Ty28 -> Type\nVar28 = \\ g, a =>\n    (Var28 : Con28 -> Ty28 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var28 (snoc28 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var28 g a -> Var28 (snoc28 g b) a)\n -> Var28 g a\n\nvz28 : {g : _}-> {a : _} -> Var28 (snoc28 g a) a\nvz28 = \\ var, vz28, vs => vz28 _ _\n\nvs28 : {g : _} -> {B : _} -> {a : _} -> Var28 g a -> Var28 (snoc28 g B) a\nvs28 = \\ x, var, vz28, vs28 => vs28 _ _ _ (x var vz28 vs28)\n\nTm28 : Con28 -> Ty28 -> Type\nTm28 = \\ g, a =>\n    (Tm28    : Con28 -> Ty28 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var28 g a -> Tm28 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm28 (snoc28 g a) B -> Tm28 g (arr28 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm28 g (arr28 a B) -> Tm28 g a -> Tm28 g B)\n -> Tm28 g a\n\nvar28 : {g : _} -> {a : _} -> Var28 g a -> Tm28 g a\nvar28 = \\ x, tm, var28, lam, app => var28 _ _ x\n\nlam28 : {g : _} -> {a : _} -> {B : _} -> Tm28 (snoc28 g a) B -> Tm28 g (arr28 a B)\nlam28 = \\ t, tm, var28, lam28, app => lam28 _ _ _ (t tm var28 lam28 app)\n\napp28 : {g:_}->{a:_}->{B:_} -> Tm28 g (arr28 a B) -> Tm28 g a -> Tm28 g B\napp28 = \\ t, u, tm, var28, lam28, app28 => app28 _ _ _ (t tm var28 lam28 app28) (u tm var28 lam28 app28)\n\nv028 : {g:_}->{a:_} -> Tm28 (snoc28 g a) a\nv028 = var28 vz28\n\nv128 : {g:_}->{a:_}-> {B:_}-> Tm28 (snoc28 (snoc28 g a) B) a\nv128 = var28 (vs28 vz28)\n\nv228 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm28 (snoc28 (snoc28 (snoc28 g a) B) C) a\nv228 = var28 (vs28 (vs28 vz28))\n\nv328 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm28 (snoc28 (snoc28 (snoc28 (snoc28 g a) B) C) D) a\nv328 = var28 (vs28 (vs28 (vs28 vz28)))\n\nv428 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm28 (snoc28 (snoc28 (snoc28 (snoc28 (snoc28 g a) B) C) D) E) a\nv428 = var28 (vs28 (vs28 (vs28 (vs28 vz28))))\n\ntest28 : {g:_}-> {a:_} -> Tm28 g (arr28 (arr28 a a) (arr28 a a))\ntest28  = lam28 (lam28 (app28 v128 (app28 v128 (app28 v128 (app28 v128 (app28 v128 (app28 v128 v028)))))))\nTy29 : Type\nTy29 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty29 : Ty29\nempty29 = \\ _, empty, _ => empty\n\narr29 : Ty29 -> Ty29 -> Ty29\narr29 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon29 : Type\nCon29 = (Con29 : Type)\n ->(nil  : Con29)\n ->(snoc : Con29 -> Ty29 -> Con29)\n -> Con29\n\nnil29 : Con29\nnil29 = \\ con, nil29, snoc => nil29\n\nsnoc29 : Con29 -> Ty29 -> Con29\nsnoc29 = \\ g, a, con, nil29, snoc29 => snoc29 (g con nil29 snoc29) a\n\nVar29 : Con29 -> Ty29 -> Type\nVar29 = \\ g, a =>\n    (Var29 : Con29 -> Ty29 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var29 (snoc29 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var29 g a -> Var29 (snoc29 g b) a)\n -> Var29 g a\n\nvz29 : {g : _}-> {a : _} -> Var29 (snoc29 g a) a\nvz29 = \\ var, vz29, vs => vz29 _ _\n\nvs29 : {g : _} -> {B : _} -> {a : _} -> Var29 g a -> Var29 (snoc29 g B) a\nvs29 = \\ x, var, vz29, vs29 => vs29 _ _ _ (x var vz29 vs29)\n\nTm29 : Con29 -> Ty29 -> Type\nTm29 = \\ g, a =>\n    (Tm29    : Con29 -> Ty29 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var29 g a -> Tm29 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm29 (snoc29 g a) B -> Tm29 g (arr29 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm29 g (arr29 a B) -> Tm29 g a -> Tm29 g B)\n -> Tm29 g a\n\nvar29 : {g : _} -> {a : _} -> Var29 g a -> Tm29 g a\nvar29 = \\ x, tm, var29, lam, app => var29 _ _ x\n\nlam29 : {g : _} -> {a : _} -> {B : _} -> Tm29 (snoc29 g a) B -> Tm29 g (arr29 a B)\nlam29 = \\ t, tm, var29, lam29, app => lam29 _ _ _ (t tm var29 lam29 app)\n\napp29 : {g:_}->{a:_}->{B:_} -> Tm29 g (arr29 a B) -> Tm29 g a -> Tm29 g B\napp29 = \\ t, u, tm, var29, lam29, app29 => app29 _ _ _ (t tm var29 lam29 app29) (u tm var29 lam29 app29)\n\nv029 : {g:_}->{a:_} -> Tm29 (snoc29 g a) a\nv029 = var29 vz29\n\nv129 : {g:_}->{a:_}-> {B:_}-> Tm29 (snoc29 (snoc29 g a) B) a\nv129 = var29 (vs29 vz29)\n\nv229 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm29 (snoc29 (snoc29 (snoc29 g a) B) C) a\nv229 = var29 (vs29 (vs29 vz29))\n\nv329 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm29 (snoc29 (snoc29 (snoc29 (snoc29 g a) B) C) D) a\nv329 = var29 (vs29 (vs29 (vs29 vz29)))\n\nv429 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm29 (snoc29 (snoc29 (snoc29 (snoc29 (snoc29 g a) B) C) D) E) a\nv429 = var29 (vs29 (vs29 (vs29 (vs29 vz29))))\n\ntest29 : {g:_}-> {a:_} -> Tm29 g (arr29 (arr29 a a) (arr29 a a))\ntest29  = lam29 (lam29 (app29 v129 (app29 v129 (app29 v129 (app29 v129 (app29 v129 (app29 v129 v029)))))))\nTy30 : Type\nTy30 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty30 : Ty30\nempty30 = \\ _, empty, _ => empty\n\narr30 : Ty30 -> Ty30 -> Ty30\narr30 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon30 : Type\nCon30 = (Con30 : Type)\n ->(nil  : Con30)\n ->(snoc : Con30 -> Ty30 -> Con30)\n -> Con30\n\nnil30 : Con30\nnil30 = \\ con, nil30, snoc => nil30\n\nsnoc30 : Con30 -> Ty30 -> Con30\nsnoc30 = \\ g, a, con, nil30, snoc30 => snoc30 (g con nil30 snoc30) a\n\nVar30 : Con30 -> Ty30 -> Type\nVar30 = \\ g, a =>\n    (Var30 : Con30 -> Ty30 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var30 (snoc30 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var30 g a -> Var30 (snoc30 g b) a)\n -> Var30 g a\n\nvz30 : {g : _}-> {a : _} -> Var30 (snoc30 g a) a\nvz30 = \\ var, vz30, vs => vz30 _ _\n\nvs30 : {g : _} -> {B : _} -> {a : _} -> Var30 g a -> Var30 (snoc30 g B) a\nvs30 = \\ x, var, vz30, vs30 => vs30 _ _ _ (x var vz30 vs30)\n\nTm30 : Con30 -> Ty30 -> Type\nTm30 = \\ g, a =>\n    (Tm30    : Con30 -> Ty30 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var30 g a -> Tm30 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm30 (snoc30 g a) B -> Tm30 g (arr30 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm30 g (arr30 a B) -> Tm30 g a -> Tm30 g B)\n -> Tm30 g a\n\nvar30 : {g : _} -> {a : _} -> Var30 g a -> Tm30 g a\nvar30 = \\ x, tm, var30, lam, app => var30 _ _ x\n\nlam30 : {g : _} -> {a : _} -> {B : _} -> Tm30 (snoc30 g a) B -> Tm30 g (arr30 a B)\nlam30 = \\ t, tm, var30, lam30, app => lam30 _ _ _ (t tm var30 lam30 app)\n\napp30 : {g:_}->{a:_}->{B:_} -> Tm30 g (arr30 a B) -> Tm30 g a -> Tm30 g B\napp30 = \\ t, u, tm, var30, lam30, app30 => app30 _ _ _ (t tm var30 lam30 app30) (u tm var30 lam30 app30)\n\nv030 : {g:_}->{a:_} -> Tm30 (snoc30 g a) a\nv030 = var30 vz30\n\nv130 : {g:_}->{a:_}-> {B:_}-> Tm30 (snoc30 (snoc30 g a) B) a\nv130 = var30 (vs30 vz30)\n\nv230 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm30 (snoc30 (snoc30 (snoc30 g a) B) C) a\nv230 = var30 (vs30 (vs30 vz30))\n\nv330 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm30 (snoc30 (snoc30 (snoc30 (snoc30 g a) B) C) D) a\nv330 = var30 (vs30 (vs30 (vs30 vz30)))\n\nv430 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm30 (snoc30 (snoc30 (snoc30 (snoc30 (snoc30 g a) B) C) D) E) a\nv430 = var30 (vs30 (vs30 (vs30 (vs30 vz30))))\n\ntest30 : {g:_}-> {a:_} -> Tm30 g (arr30 (arr30 a a) (arr30 a a))\ntest30  = lam30 (lam30 (app30 v130 (app30 v130 (app30 v130 (app30 v130 (app30 v130 (app30 v130 v030)))))))\nTy31 : Type\nTy31 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty31 : Ty31\nempty31 = \\ _, empty, _ => empty\n\narr31 : Ty31 -> Ty31 -> Ty31\narr31 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon31 : Type\nCon31 = (Con31 : Type)\n ->(nil  : Con31)\n ->(snoc : Con31 -> Ty31 -> Con31)\n -> Con31\n\nnil31 : Con31\nnil31 = \\ con, nil31, snoc => nil31\n\nsnoc31 : Con31 -> Ty31 -> Con31\nsnoc31 = \\ g, a, con, nil31, snoc31 => snoc31 (g con nil31 snoc31) a\n\nVar31 : Con31 -> Ty31 -> Type\nVar31 = \\ g, a =>\n    (Var31 : Con31 -> Ty31 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var31 (snoc31 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var31 g a -> Var31 (snoc31 g b) a)\n -> Var31 g a\n\nvz31 : {g : _}-> {a : _} -> Var31 (snoc31 g a) a\nvz31 = \\ var, vz31, vs => vz31 _ _\n\nvs31 : {g : _} -> {B : _} -> {a : _} -> Var31 g a -> Var31 (snoc31 g B) a\nvs31 = \\ x, var, vz31, vs31 => vs31 _ _ _ (x var vz31 vs31)\n\nTm31 : Con31 -> Ty31 -> Type\nTm31 = \\ g, a =>\n    (Tm31    : Con31 -> Ty31 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var31 g a -> Tm31 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm31 (snoc31 g a) B -> Tm31 g (arr31 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm31 g (arr31 a B) -> Tm31 g a -> Tm31 g B)\n -> Tm31 g a\n\nvar31 : {g : _} -> {a : _} -> Var31 g a -> Tm31 g a\nvar31 = \\ x, tm, var31, lam, app => var31 _ _ x\n\nlam31 : {g : _} -> {a : _} -> {B : _} -> Tm31 (snoc31 g a) B -> Tm31 g (arr31 a B)\nlam31 = \\ t, tm, var31, lam31, app => lam31 _ _ _ (t tm var31 lam31 app)\n\napp31 : {g:_}->{a:_}->{B:_} -> Tm31 g (arr31 a B) -> Tm31 g a -> Tm31 g B\napp31 = \\ t, u, tm, var31, lam31, app31 => app31 _ _ _ (t tm var31 lam31 app31) (u tm var31 lam31 app31)\n\nv031 : {g:_}->{a:_} -> Tm31 (snoc31 g a) a\nv031 = var31 vz31\n\nv131 : {g:_}->{a:_}-> {B:_}-> Tm31 (snoc31 (snoc31 g a) B) a\nv131 = var31 (vs31 vz31)\n\nv231 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm31 (snoc31 (snoc31 (snoc31 g a) B) C) a\nv231 = var31 (vs31 (vs31 vz31))\n\nv331 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm31 (snoc31 (snoc31 (snoc31 (snoc31 g a) B) C) D) a\nv331 = var31 (vs31 (vs31 (vs31 vz31)))\n\nv431 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm31 (snoc31 (snoc31 (snoc31 (snoc31 (snoc31 g a) B) C) D) E) a\nv431 = var31 (vs31 (vs31 (vs31 (vs31 vz31))))\n\ntest31 : {g:_}-> {a:_} -> Tm31 g (arr31 (arr31 a a) (arr31 a a))\ntest31  = lam31 (lam31 (app31 v131 (app31 v131 (app31 v131 (app31 v131 (app31 v131 (app31 v131 v031)))))))\nTy32 : Type\nTy32 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty32 : Ty32\nempty32 = \\ _, empty, _ => empty\n\narr32 : Ty32 -> Ty32 -> Ty32\narr32 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon32 : Type\nCon32 = (Con32 : Type)\n ->(nil  : Con32)\n ->(snoc : Con32 -> Ty32 -> Con32)\n -> Con32\n\nnil32 : Con32\nnil32 = \\ con, nil32, snoc => nil32\n\nsnoc32 : Con32 -> Ty32 -> Con32\nsnoc32 = \\ g, a, con, nil32, snoc32 => snoc32 (g con nil32 snoc32) a\n\nVar32 : Con32 -> Ty32 -> Type\nVar32 = \\ g, a =>\n    (Var32 : Con32 -> Ty32 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var32 (snoc32 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var32 g a -> Var32 (snoc32 g b) a)\n -> Var32 g a\n\nvz32 : {g : _}-> {a : _} -> Var32 (snoc32 g a) a\nvz32 = \\ var, vz32, vs => vz32 _ _\n\nvs32 : {g : _} -> {B : _} -> {a : _} -> Var32 g a -> Var32 (snoc32 g B) a\nvs32 = \\ x, var, vz32, vs32 => vs32 _ _ _ (x var vz32 vs32)\n\nTm32 : Con32 -> Ty32 -> Type\nTm32 = \\ g, a =>\n    (Tm32    : Con32 -> Ty32 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var32 g a -> Tm32 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm32 (snoc32 g a) B -> Tm32 g (arr32 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm32 g (arr32 a B) -> Tm32 g a -> Tm32 g B)\n -> Tm32 g a\n\nvar32 : {g : _} -> {a : _} -> Var32 g a -> Tm32 g a\nvar32 = \\ x, tm, var32, lam, app => var32 _ _ x\n\nlam32 : {g : _} -> {a : _} -> {B : _} -> Tm32 (snoc32 g a) B -> Tm32 g (arr32 a B)\nlam32 = \\ t, tm, var32, lam32, app => lam32 _ _ _ (t tm var32 lam32 app)\n\napp32 : {g:_}->{a:_}->{B:_} -> Tm32 g (arr32 a B) -> Tm32 g a -> Tm32 g B\napp32 = \\ t, u, tm, var32, lam32, app32 => app32 _ _ _ (t tm var32 lam32 app32) (u tm var32 lam32 app32)\n\nv032 : {g:_}->{a:_} -> Tm32 (snoc32 g a) a\nv032 = var32 vz32\n\nv132 : {g:_}->{a:_}-> {B:_}-> Tm32 (snoc32 (snoc32 g a) B) a\nv132 = var32 (vs32 vz32)\n\nv232 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm32 (snoc32 (snoc32 (snoc32 g a) B) C) a\nv232 = var32 (vs32 (vs32 vz32))\n\nv332 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm32 (snoc32 (snoc32 (snoc32 (snoc32 g a) B) C) D) a\nv332 = var32 (vs32 (vs32 (vs32 vz32)))\n\nv432 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm32 (snoc32 (snoc32 (snoc32 (snoc32 (snoc32 g a) B) C) D) E) a\nv432 = var32 (vs32 (vs32 (vs32 (vs32 vz32))))\n\ntest32 : {g:_}-> {a:_} -> Tm32 g (arr32 (arr32 a a) (arr32 a a))\ntest32  = lam32 (lam32 (app32 v132 (app32 v132 (app32 v132 (app32 v132 (app32 v132 (app32 v132 v032)))))))\nTy33 : Type\nTy33 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty33 : Ty33\nempty33 = \\ _, empty, _ => empty\n\narr33 : Ty33 -> Ty33 -> Ty33\narr33 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon33 : Type\nCon33 = (Con33 : Type)\n ->(nil  : Con33)\n ->(snoc : Con33 -> Ty33 -> Con33)\n -> Con33\n\nnil33 : Con33\nnil33 = \\ con, nil33, snoc => nil33\n\nsnoc33 : Con33 -> Ty33 -> Con33\nsnoc33 = \\ g, a, con, nil33, snoc33 => snoc33 (g con nil33 snoc33) a\n\nVar33 : Con33 -> Ty33 -> Type\nVar33 = \\ g, a =>\n    (Var33 : Con33 -> Ty33 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var33 (snoc33 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var33 g a -> Var33 (snoc33 g b) a)\n -> Var33 g a\n\nvz33 : {g : _}-> {a : _} -> Var33 (snoc33 g a) a\nvz33 = \\ var, vz33, vs => vz33 _ _\n\nvs33 : {g : _} -> {B : _} -> {a : _} -> Var33 g a -> Var33 (snoc33 g B) a\nvs33 = \\ x, var, vz33, vs33 => vs33 _ _ _ (x var vz33 vs33)\n\nTm33 : Con33 -> Ty33 -> Type\nTm33 = \\ g, a =>\n    (Tm33    : Con33 -> Ty33 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var33 g a -> Tm33 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm33 (snoc33 g a) B -> Tm33 g (arr33 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm33 g (arr33 a B) -> Tm33 g a -> Tm33 g B)\n -> Tm33 g a\n\nvar33 : {g : _} -> {a : _} -> Var33 g a -> Tm33 g a\nvar33 = \\ x, tm, var33, lam, app => var33 _ _ x\n\nlam33 : {g : _} -> {a : _} -> {B : _} -> Tm33 (snoc33 g a) B -> Tm33 g (arr33 a B)\nlam33 = \\ t, tm, var33, lam33, app => lam33 _ _ _ (t tm var33 lam33 app)\n\napp33 : {g:_}->{a:_}->{B:_} -> Tm33 g (arr33 a B) -> Tm33 g a -> Tm33 g B\napp33 = \\ t, u, tm, var33, lam33, app33 => app33 _ _ _ (t tm var33 lam33 app33) (u tm var33 lam33 app33)\n\nv033 : {g:_}->{a:_} -> Tm33 (snoc33 g a) a\nv033 = var33 vz33\n\nv133 : {g:_}->{a:_}-> {B:_}-> Tm33 (snoc33 (snoc33 g a) B) a\nv133 = var33 (vs33 vz33)\n\nv233 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm33 (snoc33 (snoc33 (snoc33 g a) B) C) a\nv233 = var33 (vs33 (vs33 vz33))\n\nv333 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm33 (snoc33 (snoc33 (snoc33 (snoc33 g a) B) C) D) a\nv333 = var33 (vs33 (vs33 (vs33 vz33)))\n\nv433 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm33 (snoc33 (snoc33 (snoc33 (snoc33 (snoc33 g a) B) C) D) E) a\nv433 = var33 (vs33 (vs33 (vs33 (vs33 vz33))))\n\ntest33 : {g:_}-> {a:_} -> Tm33 g (arr33 (arr33 a a) (arr33 a a))\ntest33  = lam33 (lam33 (app33 v133 (app33 v133 (app33 v133 (app33 v133 (app33 v133 (app33 v133 v033)))))))\nTy34 : Type\nTy34 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty34 : Ty34\nempty34 = \\ _, empty, _ => empty\n\narr34 : Ty34 -> Ty34 -> Ty34\narr34 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon34 : Type\nCon34 = (Con34 : Type)\n ->(nil  : Con34)\n ->(snoc : Con34 -> Ty34 -> Con34)\n -> Con34\n\nnil34 : Con34\nnil34 = \\ con, nil34, snoc => nil34\n\nsnoc34 : Con34 -> Ty34 -> Con34\nsnoc34 = \\ g, a, con, nil34, snoc34 => snoc34 (g con nil34 snoc34) a\n\nVar34 : Con34 -> Ty34 -> Type\nVar34 = \\ g, a =>\n    (Var34 : Con34 -> Ty34 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var34 (snoc34 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var34 g a -> Var34 (snoc34 g b) a)\n -> Var34 g a\n\nvz34 : {g : _}-> {a : _} -> Var34 (snoc34 g a) a\nvz34 = \\ var, vz34, vs => vz34 _ _\n\nvs34 : {g : _} -> {B : _} -> {a : _} -> Var34 g a -> Var34 (snoc34 g B) a\nvs34 = \\ x, var, vz34, vs34 => vs34 _ _ _ (x var vz34 vs34)\n\nTm34 : Con34 -> Ty34 -> Type\nTm34 = \\ g, a =>\n    (Tm34    : Con34 -> Ty34 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var34 g a -> Tm34 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm34 (snoc34 g a) B -> Tm34 g (arr34 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm34 g (arr34 a B) -> Tm34 g a -> Tm34 g B)\n -> Tm34 g a\n\nvar34 : {g : _} -> {a : _} -> Var34 g a -> Tm34 g a\nvar34 = \\ x, tm, var34, lam, app => var34 _ _ x\n\nlam34 : {g : _} -> {a : _} -> {B : _} -> Tm34 (snoc34 g a) B -> Tm34 g (arr34 a B)\nlam34 = \\ t, tm, var34, lam34, app => lam34 _ _ _ (t tm var34 lam34 app)\n\napp34 : {g:_}->{a:_}->{B:_} -> Tm34 g (arr34 a B) -> Tm34 g a -> Tm34 g B\napp34 = \\ t, u, tm, var34, lam34, app34 => app34 _ _ _ (t tm var34 lam34 app34) (u tm var34 lam34 app34)\n\nv034 : {g:_}->{a:_} -> Tm34 (snoc34 g a) a\nv034 = var34 vz34\n\nv134 : {g:_}->{a:_}-> {B:_}-> Tm34 (snoc34 (snoc34 g a) B) a\nv134 = var34 (vs34 vz34)\n\nv234 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm34 (snoc34 (snoc34 (snoc34 g a) B) C) a\nv234 = var34 (vs34 (vs34 vz34))\n\nv334 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm34 (snoc34 (snoc34 (snoc34 (snoc34 g a) B) C) D) a\nv334 = var34 (vs34 (vs34 (vs34 vz34)))\n\nv434 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm34 (snoc34 (snoc34 (snoc34 (snoc34 (snoc34 g a) B) C) D) E) a\nv434 = var34 (vs34 (vs34 (vs34 (vs34 vz34))))\n\ntest34 : {g:_}-> {a:_} -> Tm34 g (arr34 (arr34 a a) (arr34 a a))\ntest34  = lam34 (lam34 (app34 v134 (app34 v134 (app34 v134 (app34 v134 (app34 v134 (app34 v134 v034)))))))\nTy35 : Type\nTy35 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty35 : Ty35\nempty35 = \\ _, empty, _ => empty\n\narr35 : Ty35 -> Ty35 -> Ty35\narr35 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon35 : Type\nCon35 = (Con35 : Type)\n ->(nil  : Con35)\n ->(snoc : Con35 -> Ty35 -> Con35)\n -> Con35\n\nnil35 : Con35\nnil35 = \\ con, nil35, snoc => nil35\n\nsnoc35 : Con35 -> Ty35 -> Con35\nsnoc35 = \\ g, a, con, nil35, snoc35 => snoc35 (g con nil35 snoc35) a\n\nVar35 : Con35 -> Ty35 -> Type\nVar35 = \\ g, a =>\n    (Var35 : Con35 -> Ty35 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var35 (snoc35 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var35 g a -> Var35 (snoc35 g b) a)\n -> Var35 g a\n\nvz35 : {g : _}-> {a : _} -> Var35 (snoc35 g a) a\nvz35 = \\ var, vz35, vs => vz35 _ _\n\nvs35 : {g : _} -> {B : _} -> {a : _} -> Var35 g a -> Var35 (snoc35 g B) a\nvs35 = \\ x, var, vz35, vs35 => vs35 _ _ _ (x var vz35 vs35)\n\nTm35 : Con35 -> Ty35 -> Type\nTm35 = \\ g, a =>\n    (Tm35    : Con35 -> Ty35 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var35 g a -> Tm35 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm35 (snoc35 g a) B -> Tm35 g (arr35 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm35 g (arr35 a B) -> Tm35 g a -> Tm35 g B)\n -> Tm35 g a\n\nvar35 : {g : _} -> {a : _} -> Var35 g a -> Tm35 g a\nvar35 = \\ x, tm, var35, lam, app => var35 _ _ x\n\nlam35 : {g : _} -> {a : _} -> {B : _} -> Tm35 (snoc35 g a) B -> Tm35 g (arr35 a B)\nlam35 = \\ t, tm, var35, lam35, app => lam35 _ _ _ (t tm var35 lam35 app)\n\napp35 : {g:_}->{a:_}->{B:_} -> Tm35 g (arr35 a B) -> Tm35 g a -> Tm35 g B\napp35 = \\ t, u, tm, var35, lam35, app35 => app35 _ _ _ (t tm var35 lam35 app35) (u tm var35 lam35 app35)\n\nv035 : {g:_}->{a:_} -> Tm35 (snoc35 g a) a\nv035 = var35 vz35\n\nv135 : {g:_}->{a:_}-> {B:_}-> Tm35 (snoc35 (snoc35 g a) B) a\nv135 = var35 (vs35 vz35)\n\nv235 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm35 (snoc35 (snoc35 (snoc35 g a) B) C) a\nv235 = var35 (vs35 (vs35 vz35))\n\nv335 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm35 (snoc35 (snoc35 (snoc35 (snoc35 g a) B) C) D) a\nv335 = var35 (vs35 (vs35 (vs35 vz35)))\n\nv435 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm35 (snoc35 (snoc35 (snoc35 (snoc35 (snoc35 g a) B) C) D) E) a\nv435 = var35 (vs35 (vs35 (vs35 (vs35 vz35))))\n\ntest35 : {g:_}-> {a:_} -> Tm35 g (arr35 (arr35 a a) (arr35 a a))\ntest35  = lam35 (lam35 (app35 v135 (app35 v135 (app35 v135 (app35 v135 (app35 v135 (app35 v135 v035)))))))\nTy36 : Type\nTy36 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty36 : Ty36\nempty36 = \\ _, empty, _ => empty\n\narr36 : Ty36 -> Ty36 -> Ty36\narr36 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon36 : Type\nCon36 = (Con36 : Type)\n ->(nil  : Con36)\n ->(snoc : Con36 -> Ty36 -> Con36)\n -> Con36\n\nnil36 : Con36\nnil36 = \\ con, nil36, snoc => nil36\n\nsnoc36 : Con36 -> Ty36 -> Con36\nsnoc36 = \\ g, a, con, nil36, snoc36 => snoc36 (g con nil36 snoc36) a\n\nVar36 : Con36 -> Ty36 -> Type\nVar36 = \\ g, a =>\n    (Var36 : Con36 -> Ty36 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var36 (snoc36 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var36 g a -> Var36 (snoc36 g b) a)\n -> Var36 g a\n\nvz36 : {g : _}-> {a : _} -> Var36 (snoc36 g a) a\nvz36 = \\ var, vz36, vs => vz36 _ _\n\nvs36 : {g : _} -> {B : _} -> {a : _} -> Var36 g a -> Var36 (snoc36 g B) a\nvs36 = \\ x, var, vz36, vs36 => vs36 _ _ _ (x var vz36 vs36)\n\nTm36 : Con36 -> Ty36 -> Type\nTm36 = \\ g, a =>\n    (Tm36    : Con36 -> Ty36 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var36 g a -> Tm36 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm36 (snoc36 g a) B -> Tm36 g (arr36 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm36 g (arr36 a B) -> Tm36 g a -> Tm36 g B)\n -> Tm36 g a\n\nvar36 : {g : _} -> {a : _} -> Var36 g a -> Tm36 g a\nvar36 = \\ x, tm, var36, lam, app => var36 _ _ x\n\nlam36 : {g : _} -> {a : _} -> {B : _} -> Tm36 (snoc36 g a) B -> Tm36 g (arr36 a B)\nlam36 = \\ t, tm, var36, lam36, app => lam36 _ _ _ (t tm var36 lam36 app)\n\napp36 : {g:_}->{a:_}->{B:_} -> Tm36 g (arr36 a B) -> Tm36 g a -> Tm36 g B\napp36 = \\ t, u, tm, var36, lam36, app36 => app36 _ _ _ (t tm var36 lam36 app36) (u tm var36 lam36 app36)\n\nv036 : {g:_}->{a:_} -> Tm36 (snoc36 g a) a\nv036 = var36 vz36\n\nv136 : {g:_}->{a:_}-> {B:_}-> Tm36 (snoc36 (snoc36 g a) B) a\nv136 = var36 (vs36 vz36)\n\nv236 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm36 (snoc36 (snoc36 (snoc36 g a) B) C) a\nv236 = var36 (vs36 (vs36 vz36))\n\nv336 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm36 (snoc36 (snoc36 (snoc36 (snoc36 g a) B) C) D) a\nv336 = var36 (vs36 (vs36 (vs36 vz36)))\n\nv436 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm36 (snoc36 (snoc36 (snoc36 (snoc36 (snoc36 g a) B) C) D) E) a\nv436 = var36 (vs36 (vs36 (vs36 (vs36 vz36))))\n\ntest36 : {g:_}-> {a:_} -> Tm36 g (arr36 (arr36 a a) (arr36 a a))\ntest36  = lam36 (lam36 (app36 v136 (app36 v136 (app36 v136 (app36 v136 (app36 v136 (app36 v136 v036)))))))\nTy37 : Type\nTy37 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty37 : Ty37\nempty37 = \\ _, empty, _ => empty\n\narr37 : Ty37 -> Ty37 -> Ty37\narr37 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon37 : Type\nCon37 = (Con37 : Type)\n ->(nil  : Con37)\n ->(snoc : Con37 -> Ty37 -> Con37)\n -> Con37\n\nnil37 : Con37\nnil37 = \\ con, nil37, snoc => nil37\n\nsnoc37 : Con37 -> Ty37 -> Con37\nsnoc37 = \\ g, a, con, nil37, snoc37 => snoc37 (g con nil37 snoc37) a\n\nVar37 : Con37 -> Ty37 -> Type\nVar37 = \\ g, a =>\n    (Var37 : Con37 -> Ty37 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var37 (snoc37 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var37 g a -> Var37 (snoc37 g b) a)\n -> Var37 g a\n\nvz37 : {g : _}-> {a : _} -> Var37 (snoc37 g a) a\nvz37 = \\ var, vz37, vs => vz37 _ _\n\nvs37 : {g : _} -> {B : _} -> {a : _} -> Var37 g a -> Var37 (snoc37 g B) a\nvs37 = \\ x, var, vz37, vs37 => vs37 _ _ _ (x var vz37 vs37)\n\nTm37 : Con37 -> Ty37 -> Type\nTm37 = \\ g, a =>\n    (Tm37    : Con37 -> Ty37 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var37 g a -> Tm37 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm37 (snoc37 g a) B -> Tm37 g (arr37 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm37 g (arr37 a B) -> Tm37 g a -> Tm37 g B)\n -> Tm37 g a\n\nvar37 : {g : _} -> {a : _} -> Var37 g a -> Tm37 g a\nvar37 = \\ x, tm, var37, lam, app => var37 _ _ x\n\nlam37 : {g : _} -> {a : _} -> {B : _} -> Tm37 (snoc37 g a) B -> Tm37 g (arr37 a B)\nlam37 = \\ t, tm, var37, lam37, app => lam37 _ _ _ (t tm var37 lam37 app)\n\napp37 : {g:_}->{a:_}->{B:_} -> Tm37 g (arr37 a B) -> Tm37 g a -> Tm37 g B\napp37 = \\ t, u, tm, var37, lam37, app37 => app37 _ _ _ (t tm var37 lam37 app37) (u tm var37 lam37 app37)\n\nv037 : {g:_}->{a:_} -> Tm37 (snoc37 g a) a\nv037 = var37 vz37\n\nv137 : {g:_}->{a:_}-> {B:_}-> Tm37 (snoc37 (snoc37 g a) B) a\nv137 = var37 (vs37 vz37)\n\nv237 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm37 (snoc37 (snoc37 (snoc37 g a) B) C) a\nv237 = var37 (vs37 (vs37 vz37))\n\nv337 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm37 (snoc37 (snoc37 (snoc37 (snoc37 g a) B) C) D) a\nv337 = var37 (vs37 (vs37 (vs37 vz37)))\n\nv437 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm37 (snoc37 (snoc37 (snoc37 (snoc37 (snoc37 g a) B) C) D) E) a\nv437 = var37 (vs37 (vs37 (vs37 (vs37 vz37))))\n\ntest37 : {g:_}-> {a:_} -> Tm37 g (arr37 (arr37 a a) (arr37 a a))\ntest37  = lam37 (lam37 (app37 v137 (app37 v137 (app37 v137 (app37 v137 (app37 v137 (app37 v137 v037)))))))\n", "meta": {"hexsha": "1d24c2f34d1224d185991bc4ff1024d18f694627", "size": 91608, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "bench/stlc_small2k.idr", "max_stars_repo_name": "Kha/smalltt", "max_stars_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 377, "max_stars_repo_stars_event_min_datetime": "2017-11-26T16:57:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T21:31:01.000Z", "max_issues_repo_path": "bench/stlc_small2k.idr", "max_issues_repo_name": "Kha/smalltt", "max_issues_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2020-03-16T09:14:57.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-28T21:51:10.000Z", "max_forks_repo_path": "bench/stlc_small2k.idr", "max_forks_repo_name": "Kha/smalltt", "max_forks_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 19, "max_forks_repo_forks_event_min_datetime": "2018-12-05T21:11:34.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T19:46:54.000Z", "avg_line_length": 33.9414597999, "max_line_length": 118, "alphanum_fraction": 0.4984935813, "num_tokens": 42469, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619177503206, "lm_q2_score": 0.6548947290421275, "lm_q1q2_score": 0.539935764230649}}
{"text": "module Data.Trifunctor\n\n%default total\n%access public export\n\n||| Zifunctor is abstraction over description of computation t that:\n||| takes r as input (reader, input)\n||| produce result a (a result)\n||| or produce error of type e\n||| Progression of abstractions: Functor => Bifunctor, Profunctor => Zifunctor\n||| Zifunctor combine capabilities of Functor, Bifunctor, Profunctor and add more\ninterface Zifunctor (t : Type -> Type -> Type -> Type) where\n  zimap : (rr -> r) -> (e -> ee) -> (a -> aa) -> t r e a -> t rr ee aa\n\n  bimap : (e -> ee) -> (a -> aa) -> t r e a -> t r ee aa\n  bimap = zimap id\n\n  dimap : (rr -> r) -> (a -> aa) -> t r e a -> t rr e aa\n  dimap r = zimap r id\n\n  dimapLeft : (rr -> r) -> (e -> ee) -> t r e a -> t rr ee a\n  dimapLeft r e = zimap r e id\n\n  map : (a -> aa) -> t r e a -> t r e aa\n  map = zimap id id\n\n  mapLeft : (e -> ee) -> t r e a -> t r ee a\n  mapLeft e = zimap id e id\n\n  contramap : (rr -> r) -> t r e a -> t rr e a\n  contramap r = zimap r id id\n\n-- TODO Zifunctor implementation for r -> Either e a\n-- TODO Zifunctor implementation for r -> (e,a)\n-- TODO Zifunctor implementation for Bifunctor b => r -> b e a\n", "meta": {"hexsha": "fb827ccfaa27bd001c1f00f294012faf23906cc9", "size": 1154, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Zifunctor.idr", "max_stars_repo_name": "lemastero/Idris-Trifunctors", "max_stars_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "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/Data/Zifunctor.idr", "max_issues_repo_name": "lemastero/Idris-Trifunctors", "max_issues_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-10-13T21:31:36.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-13T21:31:36.000Z", "max_forks_repo_path": "src/Data/Zifunctor.idr", "max_forks_repo_name": "lemastero/Idris-Trifunctors", "max_forks_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-19T04:35:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-19T04:35:47.000Z", "avg_line_length": 32.0555555556, "max_line_length": 81, "alphanum_fraction": 0.6031195841, "num_tokens": 406, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8289388167733099, "lm_q2_score": 0.6513548646660543, "lm_q1q2_score": 0.5399333308158185}}
{"text": "module Term\n\nimport Data.Fin\n\n%logging 1\n%logging declare.def 3\n\nmutual\n\n  data Bdr : (cut : Bool) -> (vars : Nat) -> Type where\n    Lam : Bdr cut vars\n    Pi  : Chk cut vars -> Bdr cut vars\n\n  -- Checkable terms (i.e. introduction forms)\n  data Chk : (cut : Bool) -> (vars : Nat) -> Type where\n    Bnd : Bdr cut vars -> Chk cut (S vars) -> Chk cut vars\n    Emb : Syn cut vars -> Chk cut n\n\n\n  -- Synthesisable terms (i.e. elimination forms)\n  data Syn : (cut : Bool) -> (vars : Nat) -> Type where\n    Var : Fin vars -> Syn cut vars\n    App : Syn cut vars -> Chk cut vars -> Syn cut vars\n    Cut : Chk True vars -> Typ True vars -> Syn True vars\n\n  Typ : (cut : Bool) -> (vars : Nat) -> Type\n  Typ = Chk\n\nTerm : Nat -> Type\nTerm = Chk True\n\nNF : Nat -> Type\nNF = Chk False\n", "meta": {"hexsha": "481716c5e51382306284fa059bd5000081b46fd8", "size": 773, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic044/Term.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/basic044/Term.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/basic044/Term.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.7352941176, "max_line_length": 58, "alphanum_fraction": 0.595084088, "num_tokens": 252, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8333245787544824, "lm_q2_score": 0.647798211152541, "lm_q1q2_score": 0.5398261714265985}}
{"text": "module Verified.Applicative\n\nimport Verified.Functor\n\n%default total\n\nclass (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Type) where\n  applicativeMap : (x : f a) -> (g : a -> b) ->\n                   map g x = pure g <*> x\n  applicativeIdentity : (x : f a) -> pure id <*> x = x\n  applicativeComposition : (x : f a) -> (g1 : f (a -> b)) -> (g2 : f (b -> c)) ->\n                           ((pure (.) <*> g2) <*> g1) <*> x = g2 <*> (g1 <*> x)\n  applicativeHomomorphism : (x : a) -> (g : a -> b) ->\n                            (<*>) {f} (pure g) (pure x) = pure {f} (g x)\n  applicativeInterchange : (x : a) -> (g : f (a -> b)) ->\n                           g <*> pure x = pure (\\g' : a -> b => g' x) <*> g\n", "meta": {"hexsha": "dcdfc54fd0a045a310bb5d04ea925d59894d8835", "size": 728, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Verified/Applicative.idr", "max_stars_repo_name": "yurrriq/idris-verified", "max_stars_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "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/Verified/Applicative.idr", "max_issues_repo_name": "yurrriq/idris-verified", "max_issues_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "max_issues_repo_licenses": ["MIT"], "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/Verified/Applicative.idr", "max_forks_repo_name": "yurrriq/idris-verified", "max_forks_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "max_forks_repo_licenses": ["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.8235294118, "max_line_length": 88, "alphanum_fraction": 0.4450549451, "num_tokens": 236, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8723473879530491, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5397914950929024}}
{"text": "module Crypto.Curve\n\nimport Crypto.Random\nimport Data.Bits\nimport Utils.Misc\n\npublic export\ninterface Point p where\n  to_affine : p -> (Integer, Integer)\n  generator : p\n  infinity : p\n  bits : Nat\n  modulus : Integer\n  order : Integer\n\n  point_add : p -> p -> p\n  mul : Integer -> p -> p\n\n  encode : p -> List Bits8\n  decode : List Bits8 -> Maybe p\n\nPoint p => Eq p where\n  (==) a b = (to_affine a) == (to_affine b)\n\npublic export\ndata ECDSASignature : (p : Type) -> Type where\n  MkSignature : (Point p) => p -> (Integer, Integer) -> ECDSASignature p\n\npublic export\necdsa_sign : (Point p, MonadRandom m) => (sk : Integer) -> (msg : Integer) -> m (ECDSASignature p)\necdsa_sign {p} private_key message = do\n  k <- uniform_random' 1 (order {p} - 1)\n  let public_key = mul private_key generator {p}\n  let (x, y) = to_affine $ mul k generator {p}\n  let r = x `mod` (order {p})\n  let s = mul_mod (inv_mul_mod k $ order {p}) (message + (r * private_key)) (order {p})\n  if (r == 0) || (s == 0)\n     then ecdsa_sign {p} private_key message\n     else pure $ MkSignature public_key (r, s)\n\nwithin_interval : Point p => Integer -> Bool\nwithin_interval n = n > 0 && n < (order {p})\n\npublic export\necdsa_verify : Integer -> ECDSASignature p -> Bool\necdsa_verify message (MkSignature public_key (r, s)) =\n  let n = order {p}\n      s_inv = inv_mul_mod s n\n      u1 = mul_mod message s_inv n\n      u2 = mul_mod r s_inv n\n      pt = point_add (mul u1 generator) (mul u2 public_key)\n      (x, _) = to_affine pt\n  in within_interval {p} r && within_interval {p} s && (infinity /= pt) && (r `mod'` n) == (x `mod'` n)\n", "meta": {"hexsha": "53cda49a2aaa04d3d9c6dae027099329803e470d", "size": 1597, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Crypto/Curve.idr", "max_stars_repo_name": "octeep/idris2-tls", "max_stars_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_stars_repo_licenses": ["ISC"], "max_stars_count": 28, "max_stars_repo_stars_event_min_datetime": "2021-12-23T15:57:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T11:00:15.000Z", "max_issues_repo_path": "src/Crypto/Curve.idr", "max_issues_repo_name": "octeep/idris2-tls", "max_issues_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_issues_repo_licenses": ["ISC"], "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/Crypto/Curve.idr", "max_forks_repo_name": "octeep/idris2-tls", "max_forks_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_forks_repo_licenses": ["ISC"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.5740740741, "max_line_length": 103, "alphanum_fraction": 0.6361928616, "num_tokens": 519, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8824278571786139, "lm_q2_score": 0.6113819732941511, "lm_q1q2_score": 0.5395004846115904}}
{"text": "> module SequentialDecisionProblems.CoreTheory\n\n> import Sigma.Sigma\n> import Sigma.Operations\n\n> %default total\n> %access public export\n> %auto_implicits off\n\n\n* Preliminaries\n\nIn a nutshell, the core theory introduces the notion of policy, policy\nsequence, optimality of policy sequences and implements a generic\nbackwards induction algorithm |backwardsInduction| for computing optimal\npolicy sequences.\n\nHowever, the core theory does not implement a machine checkable proof\nthat |backwardsInduction| is correct that is, that its result is an\noptimal policy sequence.\n\nThis is done in the full theory presented in |FullTheory|. Both here and\nin |FullTheory|, the assumptions are implemented as holes\n(metavariables, forward declarations, partial definitions, etc.). The\nidea is that users that wish to apply the theory (typically, for\ncomputing optimal solutions for a specific decision problem) will\nfill-in the holes by providing problem-specific implementations.\n\n\n* Sequential decision processes\n\nA sequential decision problem (SDP) is specified in terms of, among\nothers, its underlying decision process.\n\nIn a decision process, a decision maker is required to perform a number\nof decision steps. At each step, the decision maker is in (observes) a\nstate and is required to select a control (action, option). The idea is\nthat, upon selecting a control in a given state, the decision maker will\nenter (observe) a new state. In a deterministic decision process, such\nnew state is uniquely defined in terms of the current decision step,\nstate and selected control. But in decision processes under uncertainty,\nthe decision maker only knows which new states are \"possible\" (again,\nfor a given decision step, \"current\" state and selected control) and,\nperhaps, their probabilities. But it does not know which one will\nactually occur.\n\nThus, in order to specify a decision process, one has to first specify\nwhat are the possible states at each decision step:\n\n> State : (t : Nat) -> Type\n\nThen, one has to explain which controls can be selected at a given step\nand for a given state:\n\n> Ctrl : (t : Nat) -> (x : State t) -> Type\n\nFinally, one has to explain which \"next\" states are possible at a given\ndecision step, in a given state and for a selected control. In the\ndeterministic case, one could provide such explanation by defining a\nstepping function\n\n< next : (t : Nat) -> (x : State t) -> (y : Ctrl t x) -> State (S t)\n\nBut what if the decision process has uncertain outcomes? In this case,\nwe follow an approach originally proposed by Ionescu [1] and generalize\n|next| to a monadic transition function:\n\n> M : Type -> Type\n\n> nexts : (t : Nat) -> (x : State t) -> (y : Ctrl t x) -> M (State (S t))\n\nFor reasons that will become clear in the sequel, |M| is is required\nto be a functor:\n\n> fmap  :  {A, B : Type} -> \n>          (A -> B) -> M A -> M B\n> postulate functorSpec1  :  fmap . id = id\n> postulate functorSpec2  :  {A, B, C : Type} -> {f : B -> C} -> {g : A -> B} ->\n>                            fmap (f . g) = (fmap f) . (fmap g)\n\nIn the above specification and throughout this file, we use postulates\nto denote assumptions that we consider to be conceptually relevant but\nthat are not necessary for the theory. Thus, strictly speaking, |M| is\nnot required to be a functor, just to implement |fmap|.\n\nIn specific decision processes, we expect |M| to be |Id| (deterministic\nSDP), |List| (non-deterministic SDP) or |Prob| (stochastic SDP). But our\nassumptions are general enough to specify other kinds of decision\nprocesses.\n\n\n* Sequential decision problems\n\nIn order to obtain a problem from a decision process, we introduce the\nadditional assumption that, with each transition from the current state\nto a new state, the decision maker receives a certain reward (payoff,\netc.)\n\n> Val : Type\n\n> reward : (t : Nat) -> (x : State t) -> (y : Ctrl t x) -> (x' : State (S t)) -> Val\n\nSince the original work of Bellman [1957], this has turned out to be a\nuseful abstraction. The idea is that the decision maker seeks controls\nthat maximize the sum of the rewards obtained in a decision\nprocess. Thus, values of type |Val| have to be \"addable\"\n\n> plus : Val -> Val -> Val\n\nWe will also need |Val| to be equipped with a \"zero\"\n\n> zero : Val\n\nand with a binary \"comparison\" relation\n\n> LTE : Val -> Val -> Type\n\nIn a deterministic case, implementing the above assumptions completely\ndefines a sequential decision problem. But whenever a decision step has\nan uncertain outcome, uncertainties about \"next\" states naturally yield\nuncertainties about rewards. In these cases, the decision makes faces a\nnumber of possible rewards (one for each possible next state) and has to\nexplain how it measures such chances. In stochastic decision problems,\npossible next states (and, therefore possible rewards) are labelled with\nprobabilities. In these cases, possible rewards are often measured in\nterms of their expected value.  Here, again, we follow the approach\nproposed by Ionescu in [2] and introduce a measure\n\n> meas : M Val -> Val\n\nthat characterizes how the decision maker values uncertainties about\nrewards in a single decision step. It is possible that a decision maker\nvalues uncertainties according to different measures at different\ndecision steps. This could be easily formalized by generalising\n\n< meas : M Val -> Val\n\nto\n\n< meas : (t : Nat) -> (x : State t) -> (M Val -> Val)\n\n\n* Solving sequential decision problems\n\nImplementing the above holes defines a specific SDP unambiguously. But\nin order to compute controls that maximize the sum of the rewards over\nan arbitrary number of decision steps, we need to be able to assess that\nall \"next\" states in an |M|-structure satisfy certain properties. This\nrequires |M| to be a \"container\":\n\n> Elem     : {A : Type} -> A -> M A -> Type\n> NotEmpty : {A : Type} -> M A -> Type\n> All      : {A : Type} -> (P : A -> Type) -> M A -> Type\n> tagElem  : {A : Type} -> (ma : M A) -> M (Sigma A (\\ a => a `Elem` ma))\n\n> allElemSpec0                 :  {A : Type} -> {P : A -> Type} ->\n>                                 (a : A) -> (ma : M A) -> All P ma -> a `Elem` ma -> P a\n\n> postulate elemNotEmptySpec0  :  {A : Type} -> \n>                                 (a : A) -> (ma : M A) -> a `Elem` ma -> NotEmpty ma\n\n> postulate elemNotEmptySpec1  :  {A : Type} -> \n>                                 (ma : M A) -> NotEmpty ma -> Sigma A (\\ a => a `Elem` ma)\n\n\n> postulate tagElemSpec        :  {A : Type} -> (ma : M A) -> fmap outl (tagElem ma) = ma\n\nThe theory presented here relies on two further notions: viability and\nreachability.\n\n\n* Viability\n\nIntuitively, a state |x : State t| is viable for |n| steps if, in spite\nof the uncertainties of the decision process, one can make |n| decision\nsteps starting from |x| without bumping into a dead end. Here, dead ends\nare states for which no controls are available. In concrete decision\nproblems, they could represent exceptional outcomes: aborting a\ncomputation, running out of fuel, being shot dead.\n\n> Viable : {t : Nat} -> (n : Nat) -> State t -> Type\n\nThus, every state is viable for zero steps\n\n> postulate viableSpec0 : {t : Nat} ->\n>                         (x : State t) -> Viable Z x\n\nand a state is viable for |S n| steps iff there exists a control that\nleads to a non-empty |M|-structure of next states which are viable for\n|n| steps. We call such controls \"good\" controls:\n\n> Good : (t : Nat) -> (x : State t) -> (n : Nat) -> (Ctrl t x) -> Type\n> Good t x n y = (NotEmpty (nexts t x y), All (Viable {t = S t} n) (nexts t x y))\n\n> GoodCtrl : (t : Nat) -> (x : State t) -> (n : Nat) -> Type\n> GoodCtrl t x n = Sigma (Ctrl t x) (Good t x n)\n> -- GoodCtrl t x n = Sigma (Ctrl t x) (\\ y => (NotEmpty (nexts t x y), All (Viable {t = S t} n) (nexts t x y)))\n\n> viableSpec1 : {t : Nat} -> {n : Nat} ->\n>               (x : State t) -> Viable (S n) x -> GoodCtrl t x n\n\n> postulate viableSpec2 : {t : Nat} -> {n : Nat} ->\n>                         (x : State t) -> GoodCtrl t x n -> Viable (S n) x\n\nAuxiliary functions:\n\n> |||\n> ctrl : {t, n : Nat} -> {x : State t} -> GoodCtrl t x n -> Ctrl t x\n> ctrl (MkSigma y _) = y\n\n> |||\n> -- good : {t, n : Nat} -> {x : State t} -> (y : GoodCtrl t x n) -> Good t x n (ctrl y)\n> -- good (MkSigma _ p) = p\n\n> |||\n> allViable : {t, n : Nat} -> {x : State t} -> (y : GoodCtrl t x n) -> All (Viable n) (nexts t x (ctrl y)) \n> allViable (MkSigma _ p) = snd p\n\n\n* Reachability\n\nViability is, strictly speaking, all what is needed to formalize the\nnotion of policies as functions that associate \"good\" controls to\nviable states.\n\nBut in a decision problem, not all viable states are actually\nreachable. Thus, we would like to further restrict the domain of\npolicies to states that can actually be reached. Intuitively, a state is\nreachable if there are controls that allow for a path from some initial\nstate to that state. Thus, tautologically, every initial state is\nreachable:\n\n> Reachable : {t' : Nat} -> State t' -> Type\n\n> postulate reachableSpec0 : (x : State Z) -> Reachable x\n\nMoreover, if |x| is reachable and admits a control |y|, then all states\nthat can be obtained by selecting |y| in |x| are also reachable:\n\n> reachableSpec1  :  {t : Nat} -> (x : State t) -> Reachable x -> (y : Ctrl t x) -> All Reachable (nexts t x y)\n\nAnd the other way round:\n\n> Pred : {t : Nat} -> State t -> State (S t) -> Type\n> Pred {t} x x'  =  Sigma (Ctrl t x) (\\ y => x' `Elem` nexts t x y)\n\n> ReachablePred : {t : Nat} -> State t -> State (S t) -> Type\n> ReachablePred x x'  = (Reachable x, x `Pred` x')\n\n> postulate reachableSpec2  :  {t : Nat} -> (x' : State (S t)) -> Reachable x' -> Sigma (State t) (\\ x => x `ReachablePred` x')\n\n\n* Policies and policy sequences\n\nPolicies are functions that associate to every state |x| at decision\nstep |t| which is reachable and viable for |S m| steps (from which |S\nm| more decision steps are doable) a good control:\n\n> Policy : (t : Nat) -> (n : Nat) -> Type\n> Policy t Z      =  Unit\n> Policy t (S m)  =  (x : State t) -> Reachable x -> Viable (S m) x -> GoodCtrl t x m\n\nA policy sequence for making |n| decision steps starting from some\n(reachable, viable for |n| steps) state at decision step |t| is a list\nof policies of length |n|, one for each decision step:\n\n> data PolicySeq : (t : Nat) -> (n : Nat) -> Type where\n>   Nil   :  {t : Nat} -> \n>            PolicySeq t Z\n>   (::)  :  {t, n : Nat} -> \n>            Policy t (S n) -> PolicySeq (S t) n -> PolicySeq t (S n)\n\nFold for |PolicySeq|:\n\n> foldPolicySeq : {X : (t : Nat) -> (n : Nat) -> Type} ->\n>                 ((t : Nat) -> X t Z) ->\n>                 ((t : Nat) -> (n : Nat) -> Policy t (S n) -> X (S t) n -> X t (S n)) ->\n>                 (t : Nat) -> (n : Nat) -> PolicySeq t n -> X t n\n> foldPolicySeq e f t Z Nil = e t\n> foldPolicySeq e f t (S n) (p :: ps) = f t n p (foldPolicySeq e f (S t) n ps)\n\n* The value of policy sequences\n\nAs mentioned before, the idea of a decision problem is that the\ndecision maker seeks controls that maximize the sum of the rewards\nobtained in a decision process.\n\nThus, in order to meaningfully define a notion of optimality for policy\nsequences, we have to compute the value (in terms of possible sums of\nrewards) of making decisions according to a given policy sequence.\n\nSpecifically, for a policy sequence |ps : PolicySeq tn| and a reachable,\nviable for |n| steps state |x : State t|, we have to compute the value\n(in terms of possible sums of rewards) of making |n| decision steps with\n|ps| starting from |x|:\n\n<   val : {t : Nat} -> {n : Nat} -> \n<         (x : State t) -> Reachable x -> Viable n x -> PolicySeq t n -> Val\n\nThe case |n = Z| (and |ps = Nil|) is trivial. Here, we are not making\nany decision step. Thus, we do not collect any reward and the value is\njust zero:\n\n<   val {t} {n = Z} x r v ps = zero\n\nIf |n = S m| and |ps| consists of a policy |p : Policy t (S m)| and of a\npolicy sequence |ps : PolicySeq (S t) m|, things are more complicated:\n\n<   val {t} {n = S m} x r v (p :: ps) = ?\n\nHere, we first have to compute the rewards obtained by selecting the\ncontrol |y = ctrl (p x r v)| in the first decision step. We get one\npossible reward for each state in |nexts t x y|. Thus, if |x' `Elem`\n(nexts t x y)|, its corresponding reward is\n\n< reward t x y x'\n\nNext, we have to add to all these rewards (one for every |x'|) the\nvalues of making |m| further decision steps with |ps| starting from\n|x'|:\n\n< val x' r' v' ps\n\nTo do so, we have to provide reachability and viability evidences |r'|\nand |v'| for |x'|. Finally, we have to reduce all possible values to a\nsingle aggregated value. Here is where the measure |meas| comes into\nplace.\n\nIt is useful to introduce the notion of those possible states that can\nbe obtained by selecting the control |y : Ctrl t x| in |x : State t|:\n\n> PossibleNextState  :  {t : Nat} -> \n>                       (x  : State t) -> (y : Ctrl t x) -> Type\n> PossibleNextState {t} x y = Sigma (State (S t)) (\\ x' => x' `Elem` (nexts t x y))\n\nWith this notion in place and assuming \n\n<   val : {t : Nat} -> {n : Nat} -> \n<         (x : State t) -> Reachable x -> Viable n x -> PolicySeq t n -> Val\n\nto be available, we can implement\n\n> mutual\n\n>   sval  :  {t, m : Nat} -> \n>            (x  : State t) -> (r  : Reachable x) -> (v  : Viable (S m) x) ->\n>            (gy  : GoodCtrl t x m) -> (ps : PolicySeq (S t) m) ->\n>            PossibleNextState x (ctrl gy) -> Val\n> {-         \n>   sval {t} {m} x r v gy ps (MkSigma x' x'emx') = reward t x y x' `plus` val x' r' v' ps where\n>     y   : Ctrl t x\n>     y   = ctrl gy\n>     mx' : M (State (S t))\n>     mx' = nexts t x y\n>     ar' : All Reachable mx'\n>     ar' = reachableSpec1 x r y\n>     av' : All (Viable m) mx'\n>     av' = allViable gy\n>     r'  : Reachable x'\n>     r'  = allElemSpec0 x' mx' ar' x'emx'\n>     v'  : Viable m x'\n>     v'  = allElemSpec0 x' mx' av' x'emx'\n> -}\n>   sval {t} {m} x r v gy ps (MkSigma x' x'emx') = \n>     let y   : Ctrl t x \n>             = ctrl gy in\n>     let mx' : M (State (S t))\n>             = nexts t x y in\n>     let ar' : All Reachable mx'\n>             = reachableSpec1 x r y in\n>     let av' : All (Viable m) mx'\n>             = allViable gy in\n>     let r'  : Reachable x'\n>             = allElemSpec0 x' mx' ar' x'emx' in\n>     let v'  : Viable m x'\n>             = allElemSpec0 x' mx' av' x'emx' in\n>     reward t x y x' `plus` val x' r' v' ps\n\nAnd finally\n\n>   val  :  {t, n : Nat} -> \n>           (x : State t) -> (r : Reachable x) -> (v : Viable n x) -> PolicySeq t n -> Val\n>   val {t} {n = Z} x r v ps = zero\n>   val {t} {n = S m} x r v (p :: ps) = meas (fmap (sval x r v gy ps) (tagElem mx')) where\n>     gy   :  GoodCtrl t x m\n>     gy   =  p x r v\n>     y    :  Ctrl t x\n>     y    =  ctrl gy\n>     mx'  :  M (State (S t))\n>     mx'  =  nexts t x y\n\n\n* Optimality of policy sequences\n\nWith a function for computing the value (in terms of \"possible\" sums\nof rewards) of making |n| decision steps with a policy sequence\nstarting from some specific state, we can formalise what it means for\none such sequence to be optimal.\n\nInformally, we say that a policy sequence |ps| for making |n| decision\nsteps starting from states in |State t| which are reachable and viable\nfor |n| steps is optimal if its value is at least as good as the value\nof any other policy sequence for making |n| decision steps starting\nfrom states in |State t|. Formally:\n\n> |||\n> OptPolicySeq  :  {t, n : Nat} -> \n>                  PolicySeq t n -> Type\n> \n> {-\n> OptPolicySeq {t} {n} ps  =  (ps' : PolicySeq t n) ->\n>                             (x : State t) -> (r : Reachable x) -> (v : Viable n x) ->\n>                             val x r v ps' `LTE` val x r v ps\n> -}\n> OptPolicySeq {t} {n} ps  =  (x : State t) -> (r : Reachable x) -> (v : Viable n x) ->\n>                             (ps' : PolicySeq t n) ->\n>                             val x r v ps' `LTE` val x r v ps\n\nNotice that the above notion of optimality is very strong. It entails a\nquantification over all (viable and reachable) states of |Stete t| to\nwhich the first policy of the sequence can be applied. \n\nThus, if we manage to compute an optimal policy sequence of length |n|\nfor making |n| decisions starting from step |t|, we have the guarantee\nthat, no matter which state we will happen to be at decision step |t|,\nthere is no better way to make |n| decision steps than that encoded by\nour policy.\n\nIn other words, we have |n| rules for making ``best'' (in terms of\n``possible'' sums of rewards) decisions.\n\nThus, an obvious question is whether it is at all possible to compute\nsequences of policies that are optimal in the above sense. As we shall\nsee in |FullTheory|, if the assumptions put forward here and in\n|ExtraAssumptions| are fulfilled, the answer to this question is\npositive.\n\nIn the rest of this file, we implement a generic backwards induction\nalgorithm for computing optimal policy sequences for an arbitrary number\nof decision steps.\n\n\n* Optimal extensions of policy sequences\n\nThe computation at the core of backwards induction is the computation\nof an optimal extension of a policy sequence. An extension of a policy\nsequence for making |m| decision steps starting from states at\ndecision step |S t| is just a policy for taking decisions at step |t|,\nthat is, a policy that is put *in front* of the list of policies that\nwill deal with any resulting future states.\n\nInformally, a policy |p| is an optimal extension of a policy sequence\n|ps| if there is no better way than |p :: ps| to make |S m| decision\nsteps at step |t|. Formally:\n\n> |||\n> OptExt  :  {t, m : Nat} -> \n>            PolicySeq (S t) m -> Policy t (S m) -> Type\n> {-           \n> OptExt {t} {m} ps p  =  (p' : Policy t (S m)) ->\n>                         (x : State t) -> (r : Reachable x) -> (v : Viable (S m) x) ->\n>                         val x r v (p' :: ps) `LTE` val x r v (p :: ps)\n> -}\n> OptExt {t} {m} ps p  =  (x : State t) -> (r : Reachable x) -> (v : Viable (S m) x) ->\n>                         (p' : Policy t (S m)) ->\n>                         val x r v (p' :: ps) `LTE` val x r v (p :: ps) \n\nThe idea behind the notion of optimal extension is that if |p| is an\noptimal extension of |ps| and |ps| is optimal, then |p :: ps| is\noptimal.  This is Bellman's principle of optimality [1] which we will\nimplement in |FullTheory|.\n\nThe strong requirement of optimality implies that |p| is optimal for\nevery state, therefore, the control obtained by applying |p| to a given\nstate |x| must be optimal, i.e., it must maximise the function |cval x r\nv ps|:\n\n> ||| \n> cval  :  {t, n : Nat} -> \n>          (x : State t) -> (r : Reachable x) -> (v : Viable (S n) x) ->\n>          (ps : PolicySeq (S t) n) -> GoodCtrl t x n -> Val\n> cval {t} x r v ps gy = meas (fmap (sval x r v gy ps) (tagElem mx')) where\n>   y    :  Ctrl t x\n>   y    =  ctrl gy\n>   mx'  :  M (State (S t))\n>   mx'  =  nexts t x y\n\nLet |cvalargmax| be a function that delivers the control that leads to\nthe maximal value of |cval x r v ps|:\n\n> cvalargmax  :  {t, n : Nat} -> \n>                (x  : State t) -> (r : Reachable x) -> (v : Viable (S n) x) ->\n>                (ps : PolicySeq (S t) n) -> GoodCtrl t x n\n\nThe controls obtained by maximising |cval x r v ps| for each of the\nstates |x : State t| will deliver a policy which is an optimal extension\nof |ps|.  Thus, the problem of maximising |val| has been reduced to the\nmaximisation of |cval| for the states at time |t|.  Therefore, the\nfunction that computes this optimal extension is:\n\n> ||| \n> optExt  :  {t, n : Nat} -> \n>            PolicySeq (S t) n -> Policy t (S n)\n> optExt {t} {n} ps = p where\n>   p : Policy t (S n)\n>   p x r v = cvalargmax x r v ps\n\n\n* Generic machine checkable backwards induction\n\nIf |LTE| is reflexive, it is straightforward to show that empty policy\nsequences (that is, sequences for performing zero decision steps) are\noptimal. Therefore, we have a starting point for the recursive process\nof extending optimal policy sequences. This suggests the following\nimplementations of backwards induction:\n\n> backwardsInduction : (t : Nat) -> (n : Nat) -> PolicySeq t n\n> backwardsInduction t  Z     =  Nil\n> {-\n> backwardsInduction t (S n)  =  optExt ps :: ps where\n>   ps : PolicySeq (S t) n\n>   ps = backwardsInduction (S t) n\n> -}\n> backwardsInduction t (S n)  =  let ps = backwardsInduction (S t) n in\n>                                optExt ps :: ps\n\n> {-\n\n> take : {t : Nat} -> (n : Nat) -> (m : Nat) -> PolicySeq t n -> Sigma Nat (\\ m' => PolicySeq t m')\n> take {t}    Z   m          ps  = MkSigma Z Nil\n> take {t} (S n)  Z          ps  = MkSigma Z Nil\n> take {t} (S n) (S m) (p :: ps) = MkSigma (S m') (p' :: ps') where\n>   mps' : Sigma Nat (\\ m' => PolicySeq (S t) m')\n>   mps' = take n m ps \n>   m'   : Nat\n>   m'   = outl mps'\n>   ps'  : PolicySeq (S t) m'\n>   ps'  = outr mps'\n>   p'   : Policy t (S m')\n>   p'   = ?this_might_work -- p\n\n> bi : (t : Nat) -> (n : Nat) -> (m : Nat) -> PolicySeq t n\n> bi t  Z    m  =  Nil\n> bi t (S n) m  =  p :: ps where\n>   ps        : PolicySeq (S t) n\n>   ps        = bi (S t) n m\n>   m'        : Nat \n>   m'        = outl (take n m ps)\n>   ps'       : PolicySeq (S t) m'\n>   ps'       = outr (take n m ps)\n>   p         : Policy t (S n)\n>   p         = ?this_will_not_work -- optExt ps'\n\n> -}\n\nThis file contains all the *computational* elements that the user must\nspecify in order to be able to run |backwardsInduction|.  The results\nare going to fulfill the condition of optimality only if several\nassumptions hold, some of which we have introduced only informally (and\nothers not at all).  For example, we have not formalised the requirement\nthat |cvalargmax| delivers an optimal control, or that |LTE| is\nreflexive (and we haven't even mentioned its transitivity, which is also\nrequired).\n\nThese additional assumptions are formulated in the file |FullTheory|,\nwhere we also implement a machine-checked proof of the correctness of\n|backwardsInduction| under these assumptions.\n\nThis separation has been introduced in order to enable users that do not\nwant to deal with formal proofs to use the framework for computing\noptimal policies.  Of course, the optimality of the results will, in\nthis case, not be machine-checked.\n\n\n> {-\n\n> ---}\n\n\n[1] Bellman, Richard; \"Dynamic Programming\", Princeton University Press,\n    1957\n\n[2] Ionescu, Cezar; \"Vulnerability Modelling and Monadic Dynamical\n    Systems\", Freie Universitaet Berlin, 2009\n \n", "meta": {"hexsha": "7e4af250b27a96a163a07c9b0ecf86d2905ff9ee", "size": 22398, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "SequentialDecisionProblems/CoreTheory.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/CoreTheory.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/CoreTheory.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 38.2218430034, "max_line_length": 127, "alphanum_fraction": 0.6378694526, "num_tokens": 6600, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7981867777396212, "lm_q2_score": 0.6757646010190477, "lm_q1q2_score": 0.5393863693978944}}
{"text": "module Example.Pil.AsC\n\nimport Example.Pil\n\nexport\nShow Name where\n  show (MkName n) = n\n\npublic export\n0 allShows : Expression ctx a -> Type\nallShows (C _) = Show a\nallShows (V n) = ()\nallShows (U _ e) = allShows e\nallShows (B _ e1 e2) = (allShows e1, allShows e2)\n\nexport\nshow : (ex : Expression ctx a) -> (shows : allShows ex) => String\nshow (C x) = show x\nshow (V n) = show n\nshow (U f e) = \"?(\" ++ show e ++ \")\"\nshow (B f e1 e2) = with Example.Pil.AsC.show \"(\" ++ show e1 {shows = fst shows} ++ \") ?? (\" ++ show e2 {shows = snd shows} ++ \")\"\n", "meta": {"hexsha": "e673265af3f8644078ba503ca8bc96bd3350845e", "size": 547, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil/AsC.idr", "max_stars_repo_name": "buzden/code-in-lectures", "max_stars_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-02-17T07:01:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-17T07:01:15.000Z", "max_issues_repo_path": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil/AsC.idr", "max_issues_repo_name": "buzden/code-in-lectures", "max_issues_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil/AsC.idr", "max_forks_repo_name": "buzden/code-in-lectures", "max_forks_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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.8636363636, "max_line_length": 129, "alphanum_fraction": 0.6106032907, "num_tokens": 191, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8104789086703224, "lm_q2_score": 0.6654105653819836, "lm_q1q2_score": 0.5393012288484923}}
{"text": "||| Universal clock - Ported from Haskell time package.\n||| \n||| Copyright 2021, HATTORI, Hiroki\n||| This file is released under the MIT license, see LICENSE for more detail.\n||| \nmodule Data.Time.Clock\n\nimport Data.Fixed\nimport Data.Rational\n\nimport public Data.Time.Clock.DiffTime\nimport public Data.Time.Clock.UTCTime\nimport Data.Time.Calendar\n\nimport Generics.Derive\n\n%default total\n%language ElabReflection\n\n-- ---------------------------------------------------------------------------\n\npublic export\nrecord UniversalTime where\n  constructor ModJulianDate\n  modJulianDate : Rational\n%runElab derive \"UniversalTime\" [Generic, Eq, Ord, DecEq]\n\n-- ---------------------------------------------------------------------------\n-- vim: tw=80 sw=2 expandtab :\n", "meta": {"hexsha": "86003ff2114790240ae8768b790c2dbee1280438", "size": 758, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "time-calendar-clock/src/Data/Time/Clock.idr", "max_stars_repo_name": "seagull-kamome/idris2-missing", "max_stars_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "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": "time-calendar-clock/src/Data/Time/Clock.idr", "max_issues_repo_name": "seagull-kamome/idris2-missing", "max_issues_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-02-03T11:05:02.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-01T12:42:01.000Z", "max_forks_repo_path": "time-calendar-clock/src/Data/Time/Clock.idr", "max_forks_repo_name": "seagull-kamome/idris2-missing", "max_forks_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_forks_repo_licenses": ["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.2666666667, "max_line_length": 78, "alphanum_fraction": 0.610817942, "num_tokens": 163, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8104788995148792, "lm_q2_score": 0.6654105454764746, "lm_q1q2_score": 0.5393012066233686}}
{"text": "{-\n$ cd collatzProof_DivSeq/program3\n$ chcp 65001\n$ idris\n> :l ProofColDivSeqMain\n-}\nmodule ProofColDivSeqMain\n\nimport ProofColDivSeqBase as B\nimport ProofColDivSeqPostulate\nimport Sub02LTE72t45\nimport Sub03LTE216t81\nimport Sub04LTE216t153\nimport Sub05LTE216t225\nimport Sub06LTE108t27\nimport Sub07LTE108t63\nimport Sub08LTE108t99\nimport Sub09LTE18t15\nimport Sub11LTE36t21\nimport Sub12LTE108t39\nimport Sub13LTE108t75\nimport Sub14LTE108t111\n\n%default total\n\n\n-- \u793a\u3059\u306e\u306b\u3001\u6574\u790e\u5e30\u7d0d\u6cd5\u3092\u4f7f\u3063\u3066\u3044\u308b\nmakeLimitedDivSeq :\n  ((z : Nat) -> ((FirstLimited . B.allDivSeq) z -> (AllLimited . B.allDivSeq) z))\n    ->  (n : Nat) -> (FirstLimited . B.allDivSeq) n\nmakeLimitedDivSeq firstToAll n = wfInd {P=(\\z=>(FirstLimited . B.allDivSeq) z)} {rel=LT'} (step firstToAll) n where\n  step : ((z : Nat) -> ((FirstLimited . B.allDivSeq) z -> (AllLimited . B.allDivSeq) z))\n    -> (x : Nat) -> ((y : Nat) -> LT' y x -> (FirstLimited . B.allDivSeq) y)\n      -> (FirstLimited . B.allDivSeq) x\n  step _          Z     _  = IsFirstLimited10                                                          -- 6*<0>+3 = 3\n  step firstToAll (S x) rs with (mod3 x)\n    -- 0 mod 9\n    step firstToAll (S (j + j + j)) rs | ThreeZero with (parity j)\n      step firstToAll (S ((Z+Z) + (Z+Z) + (Z+Z)))             rs | ThreeZero | Even = IsFirstLimited01 -- 6*<1>+3 = 9\n      step firstToAll (S (((S k)+(S k)) + ((S k)+(S k)) + ((S k)+(S k))))             rs | ThreeZero | Even with (parity k)\n        step firstToAll (S (((S (l+l))+(S (l+l))) + ((S (l+l))+(S (l+l))) + ((S (l+l))+(S (l+l)))))                         rs | ThreeZero | Even | Even\n          = (IsFirstLimited02 l . firstToAll l) (rs l $ lteToLt' $ lte72t45 l)\n        step firstToAll (S (((S (S (l+l)))+(S (S (l+l)))) + ((S (S (l+l)))+(S (S (l+l)))) + ((S (S (l+l)))+(S (S (l+l)))))) rs | ThreeZero | Even | Odd  with (mod3 l)\n          step firstToAll (S (((S (S ((m+m+m)+(m+m+m))))+(S (S ((m+m+m)+(m+m+m))))) + ((S (S ((m+m+m)+(m+m+m))))+(S (S ((m+m+m)+(m+m+m))))) + ((S (S ((m+m+m)+(m+m+m))))+(S (S ((m+m+m)+(m+m+m)))))))                                                                                                 rs | ThreeZero | Even | Odd | ThreeZero\n            = (IsFirstLimited03 m . firstToAll (m+m)) (rs (m+m) $ lteToLt' $ lte216t81 m)\n          step firstToAll (S (((S (S ((S (m+m+m))+(S (m+m+m)))))+(S (S ((S (m+m+m))+(S (m+m+m)))))) + ((S (S ((S (m+m+m))+(S (m+m+m)))))+(S (S ((S (m+m+m))+(S (m+m+m)))))) + ((S (S ((S (m+m+m))+(S (m+m+m)))))+(S (S ((S (m+m+m))+(S (m+m+m))))))))                                                 rs | ThreeZero | Even | Odd | ThreeOne\n            = (IsFirstLimited04 m . firstToAll (S ((m+m)+(m+m)))) (rs (S ((m+m)+(m+m))) $ lteToLt' $ lte216t153 m)\n          step firstToAll (S (((S (S ((S (S (m+m+m)))+(S (S (m+m+m))))))+(S (S ((S (S (m+m+m)))+(S (S (m+m+m))))))) + ((S (S ((S (S (m+m+m)))+(S (S (m+m+m))))))+(S (S ((S (S (m+m+m)))+(S (S (m+m+m))))))) + ((S (S ((S (S (m+m+m)))+(S (S (m+m+m))))))+(S (S ((S (S (m+m+m)))+(S (S (m+m+m))))))))) rs | ThreeZero | Even | Odd | ThreeTwo\n            = (IsFirstLimited05 m . firstToAll (S (S (S (S (S (S (S (m+m+m+m)+(m+m+m+m))))))))) (rs (S (S (S (S (S (S (S (m+m+m+m)+(m+m+m+m)))))))) $ lteToLt' $ lte216t225 m)\n      step firstToAll (S ((S (k+k)) + (S (k+k)) + (S (k+k)))) rs | ThreeZero | Odd  with (mod3 k)\n        step firstToAll (S ((S ((l+l+l)+(l+l+l))) + (S ((l+l+l)+(l+l+l))) + (S ((l+l+l)+(l+l+l)))))                                                 rs | ThreeZero | Odd | ThreeZero\n          = (IsFirstLimited06 l . firstToAll (S (S (S (l+l+l+l)+(l+l+l+l)+(l+l+l+l)+(l+l+l+l))))) (rs (S (S (S (l+l+l+l)+(l+l+l+l)+(l+l+l+l)+(l+l+l+l)))) $ lteToLt' $ lte108t27 l)\n        step firstToAll (S ((S ((S (l+l+l))+(S (l+l+l)))) + (S ((S (l+l+l))+(S (l+l+l)))) + (S ((S (l+l+l))+(S (l+l+l))))))                         rs | ThreeZero | Odd | ThreeOne\n          = (IsFirstLimited07 l . firstToAll (S (S (S (S (l+l+l+l)+(l+l+l+l)))))) (rs (S (S (S (S (l+l+l+l)+(l+l+l+l))))) $ lteToLt' $ lte108t63 l)\n        step firstToAll (S ((S ((S (S (l+l+l)))+(S (S (l+l+l))))) + (S ((S (S (l+l+l)))+(S (S (l+l+l))))) + (S ((S (S (l+l+l)))+(S (S (l+l+l))))))) rs | ThreeZero | Odd | ThreeTwo\n          = (IsFirstLimited08 l . firstToAll (S (S (S ((l+l)+(l+l)))))) (rs (S (S (S ((l+l)+(l+l))))) $ lteToLt' $ lte108t99 l)\n    -- 6 mod 9\n    step firstToAll (S (S (j + j + j)))     rs | ThreeOne\n      = (IsFirstLimited09 j . firstToAll j) (rs j $ lteToLt' $ lte18t15 j)\n    -- 3 mod 9\n    step firstToAll (S (S (S (j + j + j)))) rs | ThreeTwo with (parity j)\n      step firstToAll (S (S (S (   (k+k)  +    (k+k)  +    (k+k)))))  rs | ThreeTwo | Even\n        = (IsFirstLimited11 k . firstToAll k) (rs k $ lteToLt' $ lte36t21 k)\n      step firstToAll (S (S (S ((S (k+k)) + (S (k+k)) + (S (k+k)))))) rs | ThreeTwo | Odd  with (mod3 k)\n        step firstToAll (S (S (S ((S ((l+l+l)+(l+l+l))) + (S ((l+l+l)+(l+l+l))) + (S ((l+l+l)+(l+l+l)))))))                                                 rs | ThreeTwo | Odd  | ThreeZero\n          = (IsFirstLimited12 l . firstToAll (l+l)) (rs (l+l) $ lteToLt' $ lte108t39 l)\n        step firstToAll (S (S (S ((S ((S (l+l+l))+(S (l+l+l)))) + (S ((S (l+l+l))+(S (l+l+l)))) + (S ((S (l+l+l))+(S (l+l+l))))))))                         rs | ThreeTwo | Odd  | ThreeOne\n          = (IsFirstLimited13 l . firstToAll (S ((l+l)+(l+l)))) (rs (S ((l+l)+(l+l))) $ lteToLt' $ lte108t75 l)\n        step firstToAll (S (S (S ((S ((S (S (l+l+l)))+(S (S (l+l+l))))) + (S ((S (S (l+l+l)))+(S (S (l+l+l))))) + (S ((S (S (l+l+l)))+(S (S (l+l+l))))))))) rs | ThreeTwo | Odd  | ThreeTwo\n          = (IsFirstLimited14 l . firstToAll (S (S (S (S (S (S (S (l+l+l+l)+(l+l+l+l))))))))) (rs (S (S (S (S (S (S (S (l+l+l+l)+(l+l+l+l)))))))) $ lteToLt' $ lte108t111 l)\n\n-- \u5341\u5206\u6761\u4ef6\nfirstToAll :\n  (z : Nat) -> ((FirstLimited . B.allDivSeq) z -> (AllLimited . B.allDivSeq) z)\nfirstToAll z first =\n  let\n    suff2_1 = IsFirstLimitedSuff2_1 z first\n    suff2_2 = IsFirstLimitedSuff2_2 z first\n    suff2_3 = IsFirstLimitedSuff2_3 z first\n    suff2_4 = IsFirstLimitedSuff2_4 z first\n    suff2_5 = IsFirstLimitedSuff2_5 z first\n    suff2_6 = IsFirstLimitedSuff2_6 z first\n    all2    = IsAllLimited02 z suff2_1 suff2_2 suff2_3 suff2_4 suff2_5 suff2_6\n    suff3_1 = IsFirstLimitedSuff3_1 z first\n    suff3_2 = IsFirstLimitedSuff3_2 z first\n    suff3_3 = IsFirstLimitedSuff3_3 z first\n    suff3_4 = IsFirstLimitedSuff3_4 z first\n    suff3_5 = IsFirstLimitedSuff3_5 z first\n    suff3_6 = IsFirstLimitedSuff3_6 z first\n    all3    = IsAllLimited03 z suff3_1 suff3_2 suff3_3 suff3_4 suff3_5 suff3_6\n    suff4_1 = IsFirstLimitedSuff4_1 z first\n    suff4_2 = IsFirstLimitedSuff4_2 z first\n    suff4_3 = IsFirstLimitedSuff4_3 z first\n    suff4_4 = IsFirstLimitedSuff4_4 z first\n    suff4_5 = IsFirstLimitedSuff4_5 z first\n    all4    = IsAllLimited04 z suff4_1 suff4_2 suff4_3 suff4_4 suff4_5\n    suff5_1 = IsFirstLimitedSuff5_1 z first\n    suff5_2 = IsFirstLimitedSuff5_2 z first\n    suff5_3 = IsFirstLimitedSuff5_3 z first\n    suff5_4 = IsFirstLimitedSuff5_4 z first\n    suff5_5 = IsFirstLimitedSuff5_5 z first\n    suff5_6 = IsFirstLimitedSuff5_6 z first\n    all5    = IsAllLimited05 z suff5_1 suff5_2 suff5_3 suff5_4 suff5_5 suff5_6\n    suff6_1 = IsFirstLimitedSuff6_1 z first\n    suff6_2 = IsFirstLimitedSuff6_2 z first\n    suff6_3 = IsFirstLimitedSuff6_3 z first\n    suff6_4 = IsFirstLimitedSuff6_4 z first\n    suff6_5 = IsFirstLimitedSuff6_5 z first\n    suff6_6 = IsFirstLimitedSuff6_6 z first\n    all6    = IsAllLimited06 z suff6_1 suff6_2 suff6_3 suff6_4 suff6_5 suff6_6\n    suff7_1 = IsFirstLimitedSuff7_1 z first\n    suff7_2 = IsFirstLimitedSuff7_2 z first\n    suff7_3 = IsFirstLimitedSuff7_3 z first\n    suff7_4 = IsFirstLimitedSuff7_4 z first\n    suff7_5 = IsFirstLimitedSuff7_5 z first\n    suff7_6 = IsFirstLimitedSuff7_6 z first\n    suff7_7 = IsFirstLimitedSuff7_7 z first\n    all7    = IsAllLimited07 z suff7_1 suff7_2 suff7_3 suff7_4 suff7_5 suff7_6 suff7_7\n    suff8_1 = IsFirstLimitedSuff8_1 z first\n    suff8_2 = IsFirstLimitedSuff8_2 z first\n    suff8_3 = IsFirstLimitedSuff8_3 z first\n    suff8_4 = IsFirstLimitedSuff8_4 z first\n    suff8_5 = IsFirstLimitedSuff8_5 z first\n    suff8_6 = IsFirstLimitedSuff8_6 z first\n    all8    = IsAllLimited08 z suff8_1 suff8_2 suff8_3 suff8_4 suff8_5 suff8_6\n  in IsAllLimited01 z IsAllLimited00 all2 all3 all4 all5 all6 all7 all8\n\n-- \u6700\u7d42\u7684\u306a\u5b9a\u7406\nlimitedDivSeq : (n : Nat) -> (FirstLimited . B.allDivSeq) n\nlimitedDivSeq = makeLimitedDivSeq firstToAll\n\n\n\n", "meta": {"hexsha": "27879d2f5407f6cbae4bdbcde9027e2edccf4303", "size": 8478, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "program3/ProofColDivSeqMain.idr", "max_stars_repo_name": "righ1113/collatzProof_DivSeq", "max_stars_repo_head_hexsha": "eef9da457fe77f0b58fb4407ab128d38ada9071e", "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": "program3/ProofColDivSeqMain.idr", "max_issues_repo_name": "righ1113/collatzProof_DivSeq", "max_issues_repo_head_hexsha": "eef9da457fe77f0b58fb4407ab128d38ada9071e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2019-01-26T12:59:21.000Z", "max_issues_repo_issues_event_max_datetime": "2019-10-19T07:02:00.000Z", "max_forks_repo_path": "program3/ProofColDivSeqMain.idr", "max_forks_repo_name": "righ1113/collatzProof_DivSeq", "max_forks_repo_head_hexsha": "eef9da457fe77f0b58fb4407ab128d38ada9071e", "max_forks_repo_licenses": ["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.2686567164, "max_line_length": 333, "alphanum_fraction": 0.5576786978, "num_tokens": 3356, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8459424256566558, "lm_q2_score": 0.6370307944803831, "lm_q1q2_score": 0.5388913755007219}}
{"text": "labelWith : Stream labelType -> List a -> List (labelType, a)\nlabelWith lbs [] = []\nlabelWith (lbl :: lbs) (val :: vals) = (lbl, val) :: labelWith lbs vals\nlabel : List a -> List (Integer, a)\nlabel = labelWith (iterate (+1) 0)\n", "meta": {"hexsha": "058318e5890aee1356c11c86fd65d0ffe0d3a8c0", "size": 227, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type_driven_book/chp11/Streams.idr", "max_stars_repo_name": "Ryxai/idris_book_notes", "max_stars_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "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_driven_book/chp11/Streams.idr", "max_issues_repo_name": "Ryxai/idris_book_notes", "max_issues_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_issues_repo_licenses": ["MIT"], "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_driven_book/chp11/Streams.idr", "max_forks_repo_name": "Ryxai/idris_book_notes", "max_forks_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_forks_repo_licenses": ["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.8333333333, "max_line_length": 71, "alphanum_fraction": 0.6343612335, "num_tokens": 70, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7057850402140659, "lm_q2_score": 0.7634837635542925, "lm_q1q2_score": 0.5388554187629526}}
{"text": "import Effects\nimport Effect.StdIO\nimport Effect.State\n\n-- Local Variables:\n-- idris-load-packages: (\"contrib\" \"prelude\" \"effects\" \"base\")\n-- End:\n\n-- this is mostly code from the tutorial on effects\nhello : Eff () [STDIO]\nhello = putStrLn \"hello world!\"\n\n\ndata BTree a = Leaf\n             | Node (BTree a) a (BTree a)\n\ntestTree : BTree String\ntestTree = Node (Node Leaf \"Jim\" Leaf)\n                \"Fred\"\n                (Node (Node Leaf \"Alice\" Leaf)\n                      \"Sheila\"\n                      (Node Leaf \"Bob\" Leaf))\n\n\ntreeTagAux : BTree a -> Eff (BTree (Int,a)) [STATE Int]\ntreeTagAux Leaf = pure Leaf\ntreeTagAux (Node b1 x b2) = do\n                    b1' <- treeTagAux b1\n                    i <- get\n                    put (i + 1)\n                    b2' <- treeTagAux b2\n                    pure (Node b1' (i,x) b2')\n\n-- So one of the things that I find super fascinating are the dependent effects\n-- obviously such things are needed for the purpose of having things like state that\n-- contain dependent types, but it's also just really neat and makes, at least to me,\n-- more sense than the simple-type-theory style monadic approach to semantics\n-- The way I think I see effects in Idris is that you're essentially creating an internal\n-- language of an effect and then you need to give a semantics of the effect in terms of\n-- the types that support the operation and *that* is what the handlers are. \n\n-- Let's try making a reader effect, one that has an ask and local operation\n\ndata Reader : Effect where\n  Ask : Reader a a (\\x => a)\n  Local : (a -> b) -> Reader c b f -> Reader c a (\\x => a)\n  \n-- I think that's the right signature, it type checks at least. It's a little more complicated\n-- than a normal reader because there could be some kind of dependent type in the reader state\n-- such as, I don't know, an environment that's indexed by its length?\n\n-- so what we're trying to do here is \n-- run the \"local\" effect with the resource (f r)\n-- get back the value, in this case of type 't' from the local effect action\n-- then restore the original state by passing that to the original continuation\n-- now where I'm getting stuck, I think, is that, to me, this should clearly be something\n-- kinda like\n--  handle (f r) loc (\\t _ => k t r)\n\n rhs : (m : Type -> Type) -> (r : res) -> (act : Reader t res resk) -> (k : (x : t) -> resk x -> m a) -> m a\n rhs m r Ask k = k r r\n rhs m r (Local f loc) k = rhs m (f r) loc (\\ t,_ => k t r) -- Why did this work but recursion in handle didn't???\n\n READER : Type -> EFFECT\n READER t = MkEff t Reader -- yeah this part is just like state aren't I clever \n\ninstance Handler Reader m where\n  handle r act k = rhs m r act k\n\n{- \ninstance Handler Reader m where\n  handle r Ask k = k r r\n  handle r (Local f loc) k = handle (f r) loc ?f\n-}\n", "meta": {"hexsha": "ab09d7c318f7ca5229faa155037f635d9b244cad", "size": 2804, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "effectful.idr", "max_stars_repo_name": "clarissalittler/idris-practice", "max_stars_repo_head_hexsha": "e307a93fa4ab7bce9f6cf7fef9973c398b3d65ea", "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": "effectful.idr", "max_issues_repo_name": "clarissalittler/idris-practice", "max_issues_repo_head_hexsha": "e307a93fa4ab7bce9f6cf7fef9973c398b3d65ea", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "effectful.idr", "max_forks_repo_name": "clarissalittler/idris-practice", "max_forks_repo_head_hexsha": "e307a93fa4ab7bce9f6cf7fef9973c398b3d65ea", "max_forks_repo_licenses": ["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.3866666667, "max_line_length": 114, "alphanum_fraction": 0.6394436519, "num_tokens": 749, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7634837743174788, "lm_q2_score": 0.7057850278370112, "lm_q1q2_score": 0.5388554169097682}}
{"text": "data List' a = Nil | Cons a (List' a)\n\n-- Generated with `:gd 4 mapList'`\nmapList' : ((1 x : a) -> b) -> (1 xs : List' a) -> List' b\nmapList' f [] = []\nmapList' f (Cons x y) = Cons (f x) (mapList' f y)\n\ndata Tree1 a = Nil1 | Node1 a (Tree1 a) (Tree1 a)\n\nmapTree1 : ((1 x : a) -> b) -> (1 t : Tree1 a) -> Tree1 b\n\ndata Tree2 a = Nil2 | Node2 a (List' (Tree2 a))\n\n-- TODO: Fix not entirly appropriate definition (nulls list of Node2)\nmapTree2 : ((1 x : a) -> b) -> (1 t : Tree2 a) -> Tree2 b\n", "meta": {"hexsha": "eb8e095bd6627de23570d58ee8507dbcf7046de0", "size": 490, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interactive031/Signatures.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/tests/idris2/interactive031/Signatures.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/tests/idris2/interactive031/Signatures.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 30.625, "max_line_length": 69, "alphanum_fraction": 0.5591836735, "num_tokens": 194, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7431680086124811, "lm_q2_score": 0.7248702880639791, "lm_q1q2_score": 0.5387004084828629}}
{"text": "plus_commutes : (n, m : Nat) -> plus n m = plus m n\nplus_assoc : (n, m, p : Nat) -> plus n (plus m p) = plus (plus n m) p\n\n\n", "meta": {"hexsha": "6b588f9d3729160de92645b7289519092d48b7d6", "size": 124, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/samples/proofs/plusprops.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/samples/proofs/plusprops.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/samples/proofs/plusprops.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.8, "max_line_length": 69, "alphanum_fraction": 0.5483870968, "num_tokens": 49, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8757869851639066, "lm_q2_score": 0.6150878555160665, "lm_q1q2_score": 0.5386859385933485}}
{"text": "> module SimpleProb.MonadicOperations\n\n> import Data.List\n> import Data.List.Quantifiers\n> import Syntax.PreorderReasoning\n\n> import SimpleProb.SimpleProb\n> import SimpleProb.BasicOperations\n> import SimpleProb.BasicProperties\n> import NonNegRational.NonNegRational\n> import NonNegRational.BasicOperations\n> import NonNegRational.BasicProperties\n> import Nat.Positive\n> import Fraction.Normal\n> import Num.Refinements\n> import Fun.Operations\n> import List.Operations\n> import List.Properties\n> import Sigma.Sigma\n\n> %default total\n> %access public export\n> %auto_implicits off\n\n\n* |SimpleProb| is a functor:\n\n> |||\n> fmap : {A, B : Type} -> (A -> B) -> SimpleProb A -> SimpleProb B\n> fmap f (MkSimpleProb aps s1p) = MkSimpleProb aps' s1p' where\n>   aps' : List (B, NonNegRational)\n>   aps' = map (cross f id) aps\n>   s1p' : sumMapSnd aps' = 1\n>   s1p' = trans s1 (trans s2 s3) where\n>     s1 : sumMapSnd aps' = sum (map snd aps')\n>     s1 = Refl\n>     s2 : sum (map snd aps') = sum (map snd aps)\n>     s2 = cong (mapSndMapCrossAnyIdLemma f aps)\n>     s3 : sum (map snd aps) = 1\n>     s3 = s1p\n>     \n> {-  \n>   s1p' = ( sumMapSnd aps' )\n>        ={ Refl }=\n>          ( sum (map snd aps') )\n>        ={ cong (mapSndMapCrossAnyIdLemma f aps) }=\n>          ( sum (map snd aps) )\n>        ={ Refl }=\n>          ( sumMapSnd aps )\n>        ={ s1p }=\n>          ( 1 )\n>        QED\n> -}\n\n* |SimpleProb| is a monad:\n\n> |||\n> ret : {A : Type} -> A -> SimpleProb A\n> ret {A} a = MkSimpleProb [(a, 1)] (sumMapSndSingletonLemma a 1)\n\n> |||\n> bind : {A, B : Type} -> SimpleProb A -> (A -> SimpleProb B) -> SimpleProb B\n> bind {A} {B} (MkSimpleProb aps s1p) f = MkSimpleProb bps' s1p' where\n>   f' : A -> List (B, NonNegRational)\n>   f' a = toList (f a)\n>   s1ps' : (a : A) -> sumMapSnd (f' a) = 1\n>   s1ps' a = toListLemma (f a)\n>   bps' : List (B, NonNegRational)\n>   bps' = mvMult aps f'  \n>   s1p' : sumMapSnd bps' = 1\n>   s1p' = ( sumMapSnd bps' )\n>        ={ Refl }=\n>          ( sumMapSnd (mvMult aps f') )\n>        ={ mvMultLemma aps f' s1ps' }=\n>          ( sumMapSnd aps )\n>        ={ s1p }=\n>          ( 1 )\n>        QED\n\n\n* |SimpleProb| is a container monad:\n\n> |||\n> Elem : {A : Type} -> A -> SimpleProb A -> Type\n> Elem a sp = Elem a (support sp)\n\n> |||\n> NonEmpty : {A : Type} -> SimpleProb A -> Type\n> NonEmpty sp = List.Operations.NonEmpty (support sp) \n\n> |||\n> All : {A : Type} -> (P : A -> Type) -> SimpleProb A -> Type\n> All P sp = All P (support sp) \n\n> ||| Tagging\n> tagElem  :  {A : Type} -> (sp : SimpleProb A) -> SimpleProb (Sigma A (\\ a => a `Elem` sp))\n> tagElem sp = MkSimpleProb aps' s1p' where\n>     ssp  : List A\n>     ssp  = support sp\n>     psp  : List NonNegRational\n>     psp  = probs sp\n>     as'  : List (Sigma A (\\ a => a `Elem` sp))\n>     as'  = List.Operations.tagElem ssp\n>     aps' : List (Sigma A (\\ a => a `Elem` sp), NonNegRational)\n>     aps' = zip as' psp\n>     s1p' : sumMapSnd aps' = 1\n>     s1p' = trans s1 (trans s7 s8) where\n>       s1 : sumMapSnd aps' = sum (snd (unzip aps'))\n>       s1 = sumMapSndUnzipLemma aps'\n>       s2 : length as' = length ssp\n>       s2 = tagElemPreservesLength ssp\n>       s3 : length ssp = length psp\n>       s3 = lengthSupportProbsLemma sp\n>       s4 : length as' = length psp\n>       s4 = trans s2 s3\n>       s5 : unzip (zip as' psp) = (as', psp)\n>       s5 = unzipZipLemma as' psp s4\n>       s6 : snd (unzip aps') = psp\n>       s6 = cong {f = snd} s5\n>       s7 : sum (snd (unzip aps')) = sum psp\n>       s7 = cong {f = sum} s6\n>       s8 : sum psp = 1\n>       s8 = sumProbsLemma sp\n\n\n> {-\n\n> ---}\n", "meta": {"hexsha": "4e54fd382940a5c4193633650ecd11d79f071e5c", "size": 3569, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "SimpleProb/MonadicOperations.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SimpleProb/MonadicOperations.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SimpleProb/MonadicOperations.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 27.6666666667, "max_line_length": 92, "alphanum_fraction": 0.5589801065, "num_tokens": 1340, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7853085808877581, "lm_q2_score": 0.6859494485880928, "lm_q1q2_score": 0.5386819880314554}}
{"text": "%hide Prelude.integerToNat\n\ndata MyNat : Type where\n    Z : MyNat\n    S : MyNat -> MyNat\n\n%builtin Natural MyNat\n\nintegerToMyNat : Integer -> MyNat\nintegerToMyNat i = if i <= 0\n    then Z\n    else S $ integerToMyNat (i - 1)\n\n%builtin IntegerToNatural integerToMyNat\n\nnatToMyNat : Nat -> MyNat\nnatToMyNat Z = Z\nnatToMyNat (S k) = S $ natToMyNat k\n\n%builtin IntegerToNatural natToMyNat\n\nintegerToNotNat : Integer -> Maybe String\nintegerToNotNat x = Just \"Boo\"\n\n%builtin IntegerToNatural integerToNotNat\n", "meta": {"hexsha": "94932c7a3bfcdf4e35442491e2e4731c1ee439a1", "size": 501, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/builtin010/Test.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/builtin010/Test.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/builtin010/Test.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 19.2692307692, "max_line_length": 41, "alphanum_fraction": 0.7305389222, "num_tokens": 161, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891305219504, "lm_q2_score": 0.6548947290421275, "lm_q1q2_score": 0.5384473278545552}}
{"text": "= The First Tale\n\n> module WhoStoleTheTarts.TheFirstTale\n>\n> %access  export\n> %default total\n>\n> %hide Prelude.Pairs.DPair.fst\n\n\nSomeone stole the jam. Our job is to figure out who the thief was.\n\n== Suspects\n\nWe know it was one of the\n\n- March Hare,\n\n> data MarchHare\n\n- Mad Hatter, or\n\n> data MadHatter\n\n- Dormouse\n\n> data Dormouse\n\n... and that they worked alone.\n\n> SomeoneStoleTheJam : Type\n> SomeoneStoleTheJam = Either (    MarchHare, Not MadHatter, Not Dormouse)\n>                    $ Either (Not MarchHare,     MadHatter, Not Dormouse)\n>                             (Not MarchHare, Not MadHatter,     Dormouse)\n\n\n== Statements\n\nThe March Hare claims,\n<blockquote>\nI never stole the jam!\n</blockquote>\n\n> MarchHareStatement : (truth : Bool) -> Type\n> MarchHareStatement False =     MarchHare\n> MarchHareStatement True  = Not MarchHare\n\nAccording to the Mad Hatter,\n<blockquote>\nOne of us stole it, but it wasn't me!\n</blockquote>\n\n> MadHatterStatement : (truth : Bool) -> Type\n> MadHatterStatement False = (    MadHatter, Not    MarchHare, Not Dormouse)\n> MadHatterStatement True  = (Not MadHatter, Either MarchHare      Dormouse)\n\nAs per the Dormouse,\n<blockquote>\nAt least one of them (spoke the truth).\n</blockquote>\n\n> DormouseStatement : (truth : Bool) -> Type\n> DormouseStatement False =     (MarchHareStatement False, MadHatterStatement False)\n> DormouseStatement True  = Not (MarchHareStatement False, MadHatterStatement False)\n\n\n== Revelation\n\nWe're also given a revelation:\n\n> Revelation : Type\n\nThe March Hare and the Dormouse were not both speaking the truth, i.e. either\n\n- ... the March Hare spoke the truth and the Dormouse did not\n\n> Revelation = Either (MarchHareStatement True,  DormouseStatement False)\n\n- ... or the March Hare did not speak the truth and the Dormouse did.\n\n>                     (MarchHareStatement False, DormouseStatement True)\n\n\n== Conclusion\n\nGiven the [statements](#statements) above and the [revelation](#revelation),\n\n> Thief : SomeoneStoleTheJam -> Revelation\n\n... we can conclude the March Hare stole the jam.\n\n>      -> (MarchHare, Not MadHatter, Not Dormouse)\n\nThe first clause is a simple pattern match.\n\n> Thief (Left  marchHare)         _                        = marchHare\n\nFrom the revelation it follows that if the March Hare spoke the truth,\nthen the Dormouse lied. If the March Hare spoke the truth, then they\ndidn't steal the jam. But if the Dormouse lied, then so did the March Hare\nand is guilty *BWOC*.\n\n> Thief _                         (Left  (itWas,(them,_))) = absurd (itWas them)\n\nIf the March Hare lied, then they stole the jam.\n\n> Thief (Left  (_,did,it))        (Right (marchHare,_))    = (marchHare,did,it)\n\nIf we assume the Mad Hatter stole jam and the March Hare lied,\nthen the March Hare did it *BWOC*.\n\n> Thief (Right (Left  (itWas,_))) (Right (them,_))         = absurd (itWas them)\n\nAssume the Dormouse did it and lied. If the Dormouse lied,\nthen the March Hare lied, and therefore stole the jam.\n\n> Thief (Right (Right (itWas,_))) (Left  (_,(them,_)))     = absurd (itWas them)\n\nAssume the Dormouse did it and the March Hare lied.\nIf the March Hare lied then they are guilty.\n\n> Thief (Right (Right (itWas,_))) (Right (them,_))         = absurd (itWas them)\n\n\u220e\n", "meta": {"hexsha": "2d4f4ab681e851c9640755632f6712a132dcbca8", "size": 3247, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "src/WhoStoleTheTarts/TheFirstTale.lidr", "max_stars_repo_name": "yurrriq/alice-in-puzzleland", "max_stars_repo_head_hexsha": "c7f7c056c3de1f3ba5046bf62806f124f5bcb620", "max_stars_repo_licenses": ["WTFPL"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-09-25T00:05:29.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-25T00:05:29.000Z", "max_issues_repo_path": "src/WhoStoleTheTarts/TheFirstTale.lidr", "max_issues_repo_name": "yurrriq/alice-in-puzzleland", "max_issues_repo_head_hexsha": "c7f7c056c3de1f3ba5046bf62806f124f5bcb620", "max_issues_repo_licenses": ["WTFPL"], "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/WhoStoleTheTarts/TheFirstTale.lidr", "max_forks_repo_name": "yurrriq/alice-in-puzzleland", "max_forks_repo_head_hexsha": "c7f7c056c3de1f3ba5046bf62806f124f5bcb620", "max_forks_repo_licenses": ["WTFPL"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-09-25T00:05:31.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-25T00:05:31.000Z", "avg_line_length": 25.976, "max_line_length": 84, "alphanum_fraction": 0.6870957807, "num_tokens": 878, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998508568416, "lm_q2_score": 0.6926419894793246, "lm_q1q2_score": 0.5383905151194651}}
{"text": "module Main\n\nimport Data.Vect\n\ninfixr 5 .+.\n\ndata Schema = SString\n            | SInt\n            | SChar\n            | (.+.) Schema Schema\n\nSchemaType : Schema -> Type\nSchemaType SString = String\nSchemaType SInt = Int\nSchemaType SChar = Char\nSchemaType (x .+. y) = (SchemaType x, SchemaType y)\n\nrecord DataStore where\n  constructor MkData\n  schema : Schema\n  size : Nat\n  items : Vect size (SchemaType schema)\n\n-- search : (store : DataStore) -> String -> List String\n-- search (MkData _ items) q = filter (isInfixOf q) (toList items)\n\n-- search' : (store : DataStore) -> String -> List (Nat, String)\n-- search' (MkData size items) q\n--   = filter ((isInfixOf q) . snd)\n--            (zip (enumFromTo 0 size) (toList items))\n\naddToStore : (store : DataStore) -> SchemaType (schema store) -> DataStore\naddToStore (MkData schema size items) item = MkData schema _ (addToData items)\n  where\n    addToData : Vect old (SchemaType schema) -> Vect (S old) (SchemaType schema)\n    addToData [] = [item]\n    addToData (x :: xs) = x :: addToData xs\n\n-- sumInputs : Integer -> String -> Maybe (String, Integer)\n-- sumInputs sum input\n--   = let val = cast input in\n--         if val < 0\n--         then Nothing\n--         else let newVal = sum + val in\n--                  Just (\"Subtotal: \" ++ show newVal ++ \"\\n\", newVal)\n\ndata Command : Schema -> Type where\n  SetSchema : (new : Schema) -> Command schema\n  Add : SchemaType schema -> Command schema\n  Get : Integer -> Command schema\n  GetAll : Command schema\n  Search : String -> Command schema\n  Size : Command schema\n  Quit : Command schema\n\nmutual\n  parseSchema : List String -> Maybe Schema\n  parseSchema (\"String\" :: xs) = doParseSchema xs SString\n  parseSchema (\"Int\" :: xs) = doParseSchema xs SInt\n  parseSchema (\"Char\" :: xs) = doParseSchema xs SChar\n  parseSchema _ = Nothing\n\n  doParseSchema : List String -> Schema -> Maybe Schema\n  doParseSchema [] type = Just type\n  doParseSchema xs type = do\n    xs' <- parseSchema xs\n    pure (type .+. xs')\n\nsetSchema : (store : DataStore) -> Schema -> Maybe DataStore\nsetSchema store schema =\n  case size store of\n       Z => Just (MkData schema _ [])\n       (S k) => Nothing\n\nparsePrefix : (schema : Schema) -> String -> Maybe (SchemaType schema, String)\nparsePrefix SString input = getQuoted (unpack input)\n  where\n    getQuoted : List Char -> Maybe (String, String)\n    getQuoted ('\"' :: xs) =\n      case span (/= '\"') xs of\n        (quoted, '\"' :: rest) => Just (pack quoted, ltrim (pack rest))\n        _ => Nothing\n    getQuoted _ = Nothing\nparsePrefix SInt input = case span isDigit input of\n                             (\"\", rest) => Nothing\n                             (num, rest) => Just (cast num, ltrim rest)\nparsePrefix SChar input = getQuoted (unpack input)\n  where\n    getQuoted : List Char -> Maybe (Char, String)\n    getQuoted ('\\'' :: c :: '\\'' :: rest) = Just (c, ltrim (pack rest))\n    getQuoted ('\\'' :: '\\\\' :: '\\'' :: '\\'' :: rest) = Just ('\\'', ltrim (pack rest))\n    getQuoted _ = Nothing\nparsePrefix (lft .+. rgt) input = do\n  (l, input') <- parsePrefix lft input\n  (r, input'') <- parsePrefix rgt input'\n  pure ((l, r), input'')\n\nparseBySchema : (schema : Schema) -> String -> Maybe (SchemaType schema)\nparseBySchema schema input = do\n  (res, \"\") <- parsePrefix schema input | _ => Nothing\n  pure res\n\nparseCommand : (schema : Schema) -> (cmd : String) -> (args : String) -> Maybe (Command schema)\nparseCommand schema \"add\" str = Add <$> parseBySchema schema str\nparseCommand schema \"get\" \"\" = Just GetAll\nparseCommand schema \"get\" val =\n  case all isDigit (unpack val) of\n       False => Nothing\n       True => Just (Get (cast val))\nparseCommand schema \"search\" query = Just (Search query)\nparseCommand schema \"size\" \"\" = Just Size\nparseCommand schema \"quit\" \"\" = Just Quit\nparseCommand schema \"schema\" str = SetSchema <$> parseSchema (words str)\nparseCommand _ _ _ = Nothing\n\nparse : (schema : Schema) -> (input : String) -> Maybe (Command schema)\nparse schema input =\n  case span (/= ' ') input of\n       (cmd, args) => parseCommand schema cmd (ltrim args)\n\ndisplay : (SchemaType schema) -> String\ndisplay {schema = SString} item = show item\ndisplay {schema = SInt} item = show item\ndisplay {schema = SChar} item = show item\ndisplay {schema = (_ .+. _)} (l, r) = (display l) ++ \", \" ++ (display r)\n\nshowStore : DataStore -> String\nshowStore store = showItems (items store)\n  where\n    showItems : Vect size (SchemaType schema) -> String\n    showItems = concat . map (\\x => display x ++ \"\\n\")\n\ngetEntry : (store : DataStore) -> (id : Integer) -> Maybe String\ngetEntry store id = do\n  id' <- integerToFin id (size store)\n  pure (display (index id' (items store)))\n\nprocessInput : DataStore -> String -> Maybe (String, DataStore)\nprocessInput store input\n  = case parse (schema store) input of\n         Nothing => Just (\"Invalid command\\n\", store)\n         Just cmd => processCommand cmd\n  where\n    processCommand : (cmd : Command (schema store)) -> Maybe (String, DataStore)\n    processCommand (Add item)\n      = Just (\"ID \" ++ show (size store) ++ \"\\n\", addToStore store item)\n    processCommand (Get id) = case getEntry store id of\n                                         Just item => Just (item ++ \"\\n\", store)\n                                         Nothing => Just (\"Out of range\\n\", store)\n    processCommand GetAll = Just (showStore store, store)\n    -- processCommand (Search query)\n    --   = let results = search' store query\n    --         results' = map (\\(k, v) => show k ++ \": \" ++ v) results in\n    --         Just (unlines results' ++ \"\\n\", store)\n    processCommand Size = Just (\"Size: \" ++ show (size store) ++ \"\\n\", store)\n    processCommand (SetSchema schema') =\n      case setSchema store schema' of\n           Nothing => Just (\"Can't update schema\\n\", store)\n           Just store' => Just (\"OK\\n\", store')\n    processCommand Quit = Nothing\n\nmain : IO ()\nmain = replWith (MkData SString Z [])  \"Command: \" processInput\n", "meta": {"hexsha": "fc99a0901fb791a11b2476bdb5958dba53df8197", "size": 5966, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter-06/datastore.idr", "max_stars_repo_name": "tekerson/type-driven-development", "max_stars_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-23T04:46:42.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-23T04:46:42.000Z", "max_issues_repo_path": "Chapter-06/datastore.idr", "max_issues_repo_name": "tekerson/type-driven-development", "max_issues_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter-06/datastore.idr", "max_forks_repo_name": "tekerson/type-driven-development", "max_forks_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_forks_repo_licenses": ["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.3780487805, "max_line_length": 95, "alphanum_fraction": 0.6195105598, "num_tokens": 1608, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744761936438, "lm_q2_score": 0.6584175072643413, "lm_q1q2_score": 0.5383053486183685}}
{"text": "module Main\n\n%default total\n\n%logging \"declare.data.parameters\" 20\n%logging \"eval.eta\" 10\n\n\n-- explicit\ndata Value : (value : Nat -> Type) -> Type where\n  EmptyV : {0 value : Nat -> Type} -> Value (\\ n => value n)\n\ndata TValue : Nat -> Type where\n  MkTupleV : Value (\\n => TValue n) -> TValue n\n", "meta": {"hexsha": "c9d1a7d803204fc6dbd6206fa7b8210a52bdc9f8", "size": 295, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/positivity003/Issue660.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/positivity003/Issue660.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/positivity003/Issue660.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 19.6666666667, "max_line_length": 60, "alphanum_fraction": 0.6338983051, "num_tokens": 88, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7549149868676283, "lm_q2_score": 0.7122321903471563, "lm_q1q2_score": 0.5376747546226256}}
{"text": "module RegExp.Types\n\nimport Data.List\nimport Decidable.Equality\n\n||| A regular expression specification.\npublic export\ndata RegExp : (0 a : Type) -> Type where\n  ||| Denotes the empty set\n  Null : RegExp a\n  ||| Denotes the empty string\n  Empty : RegExp a\n  ||| Denotes a single literal character\n  Lit : a -> RegExp a\n  ||| Denotes concatenation\n  Cat : RegExp a -> RegExp a -> RegExp a\n  ||| Denotes disjunction (OR)\n  Disj : RegExp a -> RegExp a -> RegExp a\n  ||| Denotes conjunction (AND)\n  Conj : RegExp a -> RegExp a -> RegExp a\n  ||| Denotes the Kleene star\n  Star : RegExp a -> RegExp a\n\n||| The property of a regular expression matching an input string.\npublic export\ndata Matches: RegExp a -> List a -> Type where\n  ||| Rule: `[]` is in `Empty`\n  InEmpty : Matches Empty []\n  ||| Rule: `[x]` is in `Lit x`\n  InLit : {x : a} -> Matches (Lit x) [x]\n  ||| Rule: If `xs` is in regular expressions `r` and `ys` is in regular expression `s`, then\n  ||| `xs ++ ys` is in `Cat r s`\n  InCat : {xs : List a} ->\n          {ys : List a} ->\n          {zs : List a} ->\n          {r : RegExp a} ->\n          {s : RegExp a} ->\n          (p : zs = xs ++ ys) ->\n          Matches r xs ->\n          Matches s ys ->\n          Matches (Cat r s) zs\n  ||| Rule: If `xs` is in regular expression `r`, then `xs` is in `Disj r _` (i.e. left side)\n  InDisjL : {xs : List a} ->\n            {r : RegExp a} ->\n            {s : RegExp a} ->\n            Matches r xs ->\n            Matches (Disj r s) xs\n  ||| Rule: If `xs` is in regular expression `s`, then `xs` is in `Disj _ s` (i.e. right side)\n  InDisjR : {xs : List a} ->\n            {r : RegExp a} ->\n            {s: RegExp a} ->\n            Matches s xs ->\n            Matches (Disj r s) xs\n  ||| Rule: If `xs` is in regular expressions `r` and `s`, then `xs` is in `Conj r s`\n  InConj : {xs : List a} ->\n           {r : RegExp a} ->\n           {s : RegExp a} ->\n           Matches r xs ->\n           Matches s xs ->\n           Matches (Conj r s) xs\n  ||| Rule: For all regular expression `r`, the empty string is in `Star r`.\n  InStarZ : {r: RegExp a} ->\n            Matches (Star r) []\n  ||| Rule: If `xs` is in regular expression `r` and `ys` is in `Star r`, then `xs ++ ys` is also\n  ||| in `Star r`.\n  InStarS : {xs : List a} ->\n            {ys : List a} ->\n            {zs : List a} ->\n            {r : RegExp a} ->\n            (p : zs = xs ++ ys) ->\n            Matches r xs ->\n            Matches (Star r) ys ->\n            Matches (Star r) (xs ++ ys)\n\nexport\nUninhabited (Matches Null xs) where\n  uninhabited _ impossible\n\nexport\nUninhabited (Matches Empty (x::xs)) where\n  uninhabited _ impossible\n\nexport\nUninhabited (Matches (Lit x) []) where\n  uninhabited _ impossible\n\n----------------------------------------------------------------------------------------------------\n-- Interface Implementations                                                                      --\n----------------------------------------------------------------------------------------------------\n\nexport\nDecEq a => DecEq (RegExp a) where\n  decEq Null Null = Yes Refl\n  decEq (Lit x) (Lit y) with (decEq x y)\n    decEq (Lit x) (Lit x) | (Yes Refl)  = Yes Refl\n    decEq (Lit x) (Lit y) | (No contra) = No $ \\p => case p of\n                                                     Refl => contra Refl\n  decEq (Cat r s) (Cat t u) with (decEq r t)\n    decEq (Cat r s) (Cat r u) | (Yes Refl) with (decEq s u)\n      decEq (Cat r s) (Cat r s) | (Yes Refl) | (Yes Refl) = Yes Refl\n      decEq (Cat r s) (Cat r u) | (Yes Refl) | (No contra) = No $ \\p => case p of\n                                                                             Refl => contra Refl\n    decEq (Cat r s) (Cat t u) | (No contra) = No \\p => case p of\n                                                            Refl => contra Refl\n  decEq (Disj r s) (Disj t u) with (decEq r t)\n    decEq (Disj r s) (Disj r u) | (Yes Refl) with (decEq s u)\n      decEq (Disj r s) (Disj r s) | (Yes Refl) | (Yes Refl)  = Yes Refl\n      decEq (Disj r s) (Disj r u) | (Yes Refl) | (No contra) = No $ \\p => case p of\n                                                                               Refl => contra Refl\n    decEq (Disj r s) (Disj t u) | (No contra) = No $ \\p => case p of\n                                                                Refl => contra Refl\n  decEq (Conj r s) (Conj t u) with (decEq r t)\n    decEq (Conj r s) (Conj r u) | (Yes Refl) with (decEq s u)\n      decEq (Conj r s) (Conj r s) | (Yes Refl) | (Yes Refl)  = Yes Refl\n      decEq (Conj r s) (Conj r u) | (Yes Refl) | (No contra) = No $ \\p => case p of\n                                                                               Refl => contra Refl\n    decEq (Conj r s) (Conj t u) | (No contra) = No $ \\p => case p of\n                                                                Refl => contra Refl\n  decEq (Star r) (Star s) with (decEq r s)\n    decEq (Star r) (Star r) | (Yes Refl) = Yes Refl\n    decEq (Star r) (Star s) | (No contra) = No $ \\p => case p of\n                                                            Refl => contra Refl\n  -- This is plain old structural equality, so I figure it's better to use a `believe_me` catch-all\n  -- than to write out a million trivial `No` cases.\n  decEq _ _ = No believe_me\n\n----------------------------------------------------------------------------------------------------\n-- Proofs                                                                                         --\n----------------------------------------------------------------------------------------------------\n\n||| Proof that if the result of a concatenation is empty, then both inputs are empty\nappendOutputNil : {xs : List a} ->\n                  {ys : List a} ->\n                  xs ++ ys = [] ->\n                  (xs = [], ys = [])\nappendOutputNil {xs=[]} {ys=[]}    p = (Refl, Refl)\nappendOutputNil {xs=[]} {ys=y::ys} p = absurd p\nappendOutputNil {xs=(x::xs)} {ys}  p = absurd p\n\n||| Proof that if an `Empty` regular expression matches a string, then the string is empty.\nexport\nemptyMatch_implies_emptyList : Matches Empty xs -> xs = []\nemptyMatch_implies_emptyList InEmpty = Refl\n\n||| Proof that for all `Lit x` matches, `x` is equal to the head of the string.\nexport\nlitMatches_implies_headEqual : DecEq a =>\n                               {x : a} ->\n                               {y : a} ->\n                               {ys : List a} ->\n                               Matches (Lit x) (y::ys) ->\n                               x = y\nlitMatches_implies_headEqual {x} {y=x} {ys=[]} InLit = Refl\n\n||| Proof that if `Lit` matches `x::xs`, then `xs = []`\nexport\nlitMatchesCons_implies_restEmpty : Matches (Lit x) (x::xs) -> xs = []\nlitMatchesCons_implies_restEmpty InLit = Refl\n\n||| Proof that if the `Cat r s` matches empty, then both `r` and `s` also match empty\nexport\ncatNotEmpty : {r : RegExp a} ->\n              {s : RegExp a} ->\n              Matches (Cat r s) [] ->\n              (Matches r [], Matches s [])\ncatNotEmpty (InCat p r s) with (appendOutputNil $ sym p)\n  catNotEmpty (InCat p r s) | (Refl, Refl) = (r, s)\n\n||| Proof that if `Disj r s` matches empty, then at least one of `r` and `s` matches empty\nexport\ndisjNotEmpty : {r : RegExp a} ->\n               {s : RegExp a} ->\n               Matches (Disj r s) [] ->\n               Either (Matches r []) (Matches s [])\ndisjNotEmpty (InDisjL r) = Left r\ndisjNotEmpty (InDisjR r) = Right r\n\n||| Proof that if the `Conj r s` matches empty, then both `r` and `s` also match empty\nexport\nconjNotEmpty : {r : RegExp a} ->\n               {s : RegExp a} ->\n               Matches (Conj r s) [] ->\n               (Matches r [], Matches s [])\nconjNotEmpty (InConj r s) = (r, s)\n", "meta": {"hexsha": "725e922237231f5cae699b20e8feea681090f219", "size": 7708, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/RegExp/Types.idr", "max_stars_repo_name": "polendri/idris-regex", "max_stars_repo_head_hexsha": "72d5f1c05d34f3119b8be808a3e27b93a526e07a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-01T04:46:44.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-01T04:46:44.000Z", "max_issues_repo_path": "src/RegExp/Types.idr", "max_issues_repo_name": "polendri/idris-regex", "max_issues_repo_head_hexsha": "72d5f1c05d34f3119b8be808a3e27b93a526e07a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-06-06T13:44:36.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-07T01:16:42.000Z", "max_forks_repo_path": "src/RegExp/Types.idr", "max_forks_repo_name": "polendri/idris-regexp", "max_forks_repo_head_hexsha": "72d5f1c05d34f3119b8be808a3e27b93a526e07a", "max_forks_repo_licenses": ["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.6648648649, "max_line_length": 100, "alphanum_fraction": 0.4692527244, "num_tokens": 2151, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.757794360334681, "lm_q2_score": 0.7090191214879991, "lm_q1q2_score": 0.5372906916330557}}
{"text": "module G4LowerFormalPSpring\n\n%access public export\n%default total\n\n\n-- \u5f62\u5f0f\u7684\u4f53\u7cfbP\n-- \u6570\u9805\u5316\u3055\u308c\u305f\u81ea\u7136\u6570\nGNat : Type\nGNat = Nat\n\n-- 10.6.1 \u57fa\u672c\u8a18\u53f7\u306e\u30b2\u30fc\u30c7\u30eb\u6570\n\u5de6\u304b\u3063\u3053 : GNat\n\u5de6\u304b\u3063\u3053 = 11\n\u53f3\u304b\u3063\u3053 : GNat\n\u53f3\u304b\u3063\u3053 = 13\n\n\n\n", "meta": {"hexsha": "324173d89f48de3e8f2b2a0eae6b7bf6b40cbc98", "size": 183, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris_girls/G4LowerFormalPSpring.idr", "max_stars_repo_name": "righ1113/godel", "max_stars_repo_head_hexsha": "6d00c7dd90c555fb4bcc5f24a51f54f2a8812d07", "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": "idris_girls/G4LowerFormalPSpring.idr", "max_issues_repo_name": "righ1113/godel", "max_issues_repo_head_hexsha": "6d00c7dd90c555fb4bcc5f24a51f54f2a8812d07", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "idris_girls/G4LowerFormalPSpring.idr", "max_forks_repo_name": "righ1113/godel", "max_forks_repo_head_hexsha": "6d00c7dd90c555fb4bcc5f24a51f54f2a8812d07", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 9.15, "max_line_length": 27, "alphanum_fraction": 0.6994535519, "num_tokens": 101, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8479677583778258, "lm_q2_score": 0.6334102775181399, "lm_q1q2_score": 0.5371114931605336}}
{"text": "Ty : Type\nTy = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty : Ty\nempty = \\ _, empty, _ => empty\n\narr : Ty -> Ty -> Ty\narr = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon : Type\nCon = (Con : Type)\n ->(nil  : Con)\n ->(snoc : Con -> Ty -> Con)\n -> Con\n\nnil : Con\nnil = \\ con, nil, snoc => nil\n\nsnoc : Con -> Ty -> Con\nsnoc = \\ g, a, con, nil, snoc => snoc (g con nil snoc) a\n\nVar : Con -> Ty -> Type\nVar = \\ g, a =>\n    (Var : Con -> Ty -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var (snoc g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var g a -> Var (snoc g b) a)\n -> Var g a\n\nvz : {g : _}-> {a : _} -> Var (snoc g a) a\nvz = \\ var, vz, vs => vz _ _\n\nvs : {g : _} -> {B : _} -> {a : _} -> Var g a -> Var (snoc g B) a\nvs = \\ x, var, vz, vs => vs _ _ _ (x var vz vs)\n\nTm : Con -> Ty -> Type\nTm = \\ g, a =>\n    (Tm    : Con -> Ty -> Type)\n -> (var   : (g : _) -> (a : _) -> Var g a -> Tm g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm (snoc g a) B -> Tm g (arr a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm g (arr a B) -> Tm g a -> Tm g B)\n -> Tm g a\n\nvar : {g : _} -> {a : _} -> Var g a -> Tm g a\nvar = \\ x, tm, var, lam, app => var _ _ x\n\nlam : {g : _} -> {a : _} -> {B : _} -> Tm (snoc g a) B -> Tm g (arr a B)\nlam = \\ t, tm, var, lam, app => lam _ _ _ (t tm var lam app)\n\napp : {g:_}->{a:_}->{B:_} -> Tm g (arr a B) -> Tm g a -> Tm g B\napp = \\ t, u, tm, var, lam, app => app _ _ _ (t tm var lam app) (u tm var lam app)\n\nv0 : {g:_}->{a:_} -> Tm (snoc g a) a\nv0 = var vz\n\nv1 : {g:_}->{a:_}-> {B:_}-> Tm (snoc (snoc g a) B) a\nv1 = var (vs vz)\n\nv2 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm (snoc (snoc (snoc g a) B) C) a\nv2 = var (vs (vs vz))\n\nv3 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm (snoc (snoc (snoc (snoc g a) B) C) D) a\nv3 = var (vs (vs (vs vz)))\n\nv4 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm (snoc (snoc (snoc (snoc (snoc g a) B) C) D) E) a\nv4 = var (vs (vs (vs (vs vz))))\n\ntest : {g:_}-> {a:_} -> Tm g (arr (arr a a) (arr a a))\ntest  = lam (lam (app v1 (app v1 (app v1 (app v1 (app v1 (app v1 v0)))))))\nTy1 : Type\nTy1 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty1 : Ty1\nempty1 = \\ _, empty, _ => empty\n\narr1 : Ty1 -> Ty1 -> Ty1\narr1 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon1 : Type\nCon1 = (Con1 : Type)\n ->(nil  : Con1)\n ->(snoc : Con1 -> Ty1 -> Con1)\n -> Con1\n\nnil1 : Con1\nnil1 = \\ con, nil1, snoc => nil1\n\nsnoc1 : Con1 -> Ty1 -> Con1\nsnoc1 = \\ g, a, con, nil1, snoc1 => snoc1 (g con nil1 snoc1) a\n\nVar1 : Con1 -> Ty1 -> Type\nVar1 = \\ g, a =>\n    (Var1 : Con1 -> Ty1 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var1 (snoc1 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var1 g a -> Var1 (snoc1 g b) a)\n -> Var1 g a\n\nvz1 : {g : _}-> {a : _} -> Var1 (snoc1 g a) a\nvz1 = \\ var, vz1, vs => vz1 _ _\n\nvs1 : {g : _} -> {B : _} -> {a : _} -> Var1 g a -> Var1 (snoc1 g B) a\nvs1 = \\ x, var, vz1, vs1 => vs1 _ _ _ (x var vz1 vs1)\n\nTm1 : Con1 -> Ty1 -> Type\nTm1 = \\ g, a =>\n    (Tm1    : Con1 -> Ty1 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var1 g a -> Tm1 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm1 (snoc1 g a) B -> Tm1 g (arr1 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm1 g (arr1 a B) -> Tm1 g a -> Tm1 g B)\n -> Tm1 g a\n\nvar1 : {g : _} -> {a : _} -> Var1 g a -> Tm1 g a\nvar1 = \\ x, tm, var1, lam, app => var1 _ _ x\n\nlam1 : {g : _} -> {a : _} -> {B : _} -> Tm1 (snoc1 g a) B -> Tm1 g (arr1 a B)\nlam1 = \\ t, tm, var1, lam1, app => lam1 _ _ _ (t tm var1 lam1 app)\n\napp1 : {g:_}->{a:_}->{B:_} -> Tm1 g (arr1 a B) -> Tm1 g a -> Tm1 g B\napp1 = \\ t, u, tm, var1, lam1, app1 => app1 _ _ _ (t tm var1 lam1 app1) (u tm var1 lam1 app1)\n\nv01 : {g:_}->{a:_} -> Tm1 (snoc1 g a) a\nv01 = var1 vz1\n\nv11 : {g:_}->{a:_}-> {B:_}-> Tm1 (snoc1 (snoc1 g a) B) a\nv11 = var1 (vs1 vz1)\n\nv21 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm1 (snoc1 (snoc1 (snoc1 g a) B) C) a\nv21 = var1 (vs1 (vs1 vz1))\n\nv31 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm1 (snoc1 (snoc1 (snoc1 (snoc1 g a) B) C) D) a\nv31 = var1 (vs1 (vs1 (vs1 vz1)))\n\nv41 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm1 (snoc1 (snoc1 (snoc1 (snoc1 (snoc1 g a) B) C) D) E) a\nv41 = var1 (vs1 (vs1 (vs1 (vs1 vz1))))\n\ntest1 : {g:_}-> {a:_} -> Tm1 g (arr1 (arr1 a a) (arr1 a a))\ntest1  = lam1 (lam1 (app1 v11 (app1 v11 (app1 v11 (app1 v11 (app1 v11 (app1 v11 v01)))))))\nTy2 : Type\nTy2 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty2 : Ty2\nempty2 = \\ _, empty, _ => empty\n\narr2 : Ty2 -> Ty2 -> Ty2\narr2 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon2 : Type\nCon2 = (Con2 : Type)\n ->(nil  : Con2)\n ->(snoc : Con2 -> Ty2 -> Con2)\n -> Con2\n\nnil2 : Con2\nnil2 = \\ con, nil2, snoc => nil2\n\nsnoc2 : Con2 -> Ty2 -> Con2\nsnoc2 = \\ g, a, con, nil2, snoc2 => snoc2 (g con nil2 snoc2) a\n\nVar2 : Con2 -> Ty2 -> Type\nVar2 = \\ g, a =>\n    (Var2 : Con2 -> Ty2 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var2 (snoc2 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var2 g a -> Var2 (snoc2 g b) a)\n -> Var2 g a\n\nvz2 : {g : _}-> {a : _} -> Var2 (snoc2 g a) a\nvz2 = \\ var, vz2, vs => vz2 _ _\n\nvs2 : {g : _} -> {B : _} -> {a : _} -> Var2 g a -> Var2 (snoc2 g B) a\nvs2 = \\ x, var, vz2, vs2 => vs2 _ _ _ (x var vz2 vs2)\n\nTm2 : Con2 -> Ty2 -> Type\nTm2 = \\ g, a =>\n    (Tm2    : Con2 -> Ty2 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var2 g a -> Tm2 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm2 (snoc2 g a) B -> Tm2 g (arr2 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm2 g (arr2 a B) -> Tm2 g a -> Tm2 g B)\n -> Tm2 g a\n\nvar2 : {g : _} -> {a : _} -> Var2 g a -> Tm2 g a\nvar2 = \\ x, tm, var2, lam, app => var2 _ _ x\n\nlam2 : {g : _} -> {a : _} -> {B : _} -> Tm2 (snoc2 g a) B -> Tm2 g (arr2 a B)\nlam2 = \\ t, tm, var2, lam2, app => lam2 _ _ _ (t tm var2 lam2 app)\n\napp2 : {g:_}->{a:_}->{B:_} -> Tm2 g (arr2 a B) -> Tm2 g a -> Tm2 g B\napp2 = \\ t, u, tm, var2, lam2, app2 => app2 _ _ _ (t tm var2 lam2 app2) (u tm var2 lam2 app2)\n\nv02 : {g:_}->{a:_} -> Tm2 (snoc2 g a) a\nv02 = var2 vz2\n\nv12 : {g:_}->{a:_}-> {B:_}-> Tm2 (snoc2 (snoc2 g a) B) a\nv12 = var2 (vs2 vz2)\n\nv22 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm2 (snoc2 (snoc2 (snoc2 g a) B) C) a\nv22 = var2 (vs2 (vs2 vz2))\n\nv32 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm2 (snoc2 (snoc2 (snoc2 (snoc2 g a) B) C) D) a\nv32 = var2 (vs2 (vs2 (vs2 vz2)))\n\nv42 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm2 (snoc2 (snoc2 (snoc2 (snoc2 (snoc2 g a) B) C) D) E) a\nv42 = var2 (vs2 (vs2 (vs2 (vs2 vz2))))\n\ntest2 : {g:_}-> {a:_} -> Tm2 g (arr2 (arr2 a a) (arr2 a a))\ntest2  = lam2 (lam2 (app2 v12 (app2 v12 (app2 v12 (app2 v12 (app2 v12 (app2 v12 v02)))))))\nTy3 : Type\nTy3 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty3 : Ty3\nempty3 = \\ _, empty, _ => empty\n\narr3 : Ty3 -> Ty3 -> Ty3\narr3 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon3 : Type\nCon3 = (Con3 : Type)\n ->(nil  : Con3)\n ->(snoc : Con3 -> Ty3 -> Con3)\n -> Con3\n\nnil3 : Con3\nnil3 = \\ con, nil3, snoc => nil3\n\nsnoc3 : Con3 -> Ty3 -> Con3\nsnoc3 = \\ g, a, con, nil3, snoc3 => snoc3 (g con nil3 snoc3) a\n\nVar3 : Con3 -> Ty3 -> Type\nVar3 = \\ g, a =>\n    (Var3 : Con3 -> Ty3 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var3 (snoc3 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var3 g a -> Var3 (snoc3 g b) a)\n -> Var3 g a\n\nvz3 : {g : _}-> {a : _} -> Var3 (snoc3 g a) a\nvz3 = \\ var, vz3, vs => vz3 _ _\n\nvs3 : {g : _} -> {B : _} -> {a : _} -> Var3 g a -> Var3 (snoc3 g B) a\nvs3 = \\ x, var, vz3, vs3 => vs3 _ _ _ (x var vz3 vs3)\n\nTm3 : Con3 -> Ty3 -> Type\nTm3 = \\ g, a =>\n    (Tm3    : Con3 -> Ty3 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var3 g a -> Tm3 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm3 (snoc3 g a) B -> Tm3 g (arr3 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm3 g (arr3 a B) -> Tm3 g a -> Tm3 g B)\n -> Tm3 g a\n\nvar3 : {g : _} -> {a : _} -> Var3 g a -> Tm3 g a\nvar3 = \\ x, tm, var3, lam, app => var3 _ _ x\n\nlam3 : {g : _} -> {a : _} -> {B : _} -> Tm3 (snoc3 g a) B -> Tm3 g (arr3 a B)\nlam3 = \\ t, tm, var3, lam3, app => lam3 _ _ _ (t tm var3 lam3 app)\n\napp3 : {g:_}->{a:_}->{B:_} -> Tm3 g (arr3 a B) -> Tm3 g a -> Tm3 g B\napp3 = \\ t, u, tm, var3, lam3, app3 => app3 _ _ _ (t tm var3 lam3 app3) (u tm var3 lam3 app3)\n\nv03 : {g:_}->{a:_} -> Tm3 (snoc3 g a) a\nv03 = var3 vz3\n\nv13 : {g:_}->{a:_}-> {B:_}-> Tm3 (snoc3 (snoc3 g a) B) a\nv13 = var3 (vs3 vz3)\n\nv23 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm3 (snoc3 (snoc3 (snoc3 g a) B) C) a\nv23 = var3 (vs3 (vs3 vz3))\n\nv33 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm3 (snoc3 (snoc3 (snoc3 (snoc3 g a) B) C) D) a\nv33 = var3 (vs3 (vs3 (vs3 vz3)))\n\nv43 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm3 (snoc3 (snoc3 (snoc3 (snoc3 (snoc3 g a) B) C) D) E) a\nv43 = var3 (vs3 (vs3 (vs3 (vs3 vz3))))\n\ntest3 : {g:_}-> {a:_} -> Tm3 g (arr3 (arr3 a a) (arr3 a a))\ntest3  = lam3 (lam3 (app3 v13 (app3 v13 (app3 v13 (app3 v13 (app3 v13 (app3 v13 v03)))))))\nTy4 : Type\nTy4 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty4 : Ty4\nempty4 = \\ _, empty, _ => empty\n\narr4 : Ty4 -> Ty4 -> Ty4\narr4 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon4 : Type\nCon4 = (Con4 : Type)\n ->(nil  : Con4)\n ->(snoc : Con4 -> Ty4 -> Con4)\n -> Con4\n\nnil4 : Con4\nnil4 = \\ con, nil4, snoc => nil4\n\nsnoc4 : Con4 -> Ty4 -> Con4\nsnoc4 = \\ g, a, con, nil4, snoc4 => snoc4 (g con nil4 snoc4) a\n\nVar4 : Con4 -> Ty4 -> Type\nVar4 = \\ g, a =>\n    (Var4 : Con4 -> Ty4 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var4 (snoc4 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var4 g a -> Var4 (snoc4 g b) a)\n -> Var4 g a\n\nvz4 : {g : _}-> {a : _} -> Var4 (snoc4 g a) a\nvz4 = \\ var, vz4, vs => vz4 _ _\n\nvs4 : {g : _} -> {B : _} -> {a : _} -> Var4 g a -> Var4 (snoc4 g B) a\nvs4 = \\ x, var, vz4, vs4 => vs4 _ _ _ (x var vz4 vs4)\n\nTm4 : Con4 -> Ty4 -> Type\nTm4 = \\ g, a =>\n    (Tm4    : Con4 -> Ty4 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var4 g a -> Tm4 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm4 (snoc4 g a) B -> Tm4 g (arr4 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm4 g (arr4 a B) -> Tm4 g a -> Tm4 g B)\n -> Tm4 g a\n\nvar4 : {g : _} -> {a : _} -> Var4 g a -> Tm4 g a\nvar4 = \\ x, tm, var4, lam, app => var4 _ _ x\n\nlam4 : {g : _} -> {a : _} -> {B : _} -> Tm4 (snoc4 g a) B -> Tm4 g (arr4 a B)\nlam4 = \\ t, tm, var4, lam4, app => lam4 _ _ _ (t tm var4 lam4 app)\n\napp4 : {g:_}->{a:_}->{B:_} -> Tm4 g (arr4 a B) -> Tm4 g a -> Tm4 g B\napp4 = \\ t, u, tm, var4, lam4, app4 => app4 _ _ _ (t tm var4 lam4 app4) (u tm var4 lam4 app4)\n\nv04 : {g:_}->{a:_} -> Tm4 (snoc4 g a) a\nv04 = var4 vz4\n\nv14 : {g:_}->{a:_}-> {B:_}-> Tm4 (snoc4 (snoc4 g a) B) a\nv14 = var4 (vs4 vz4)\n\nv24 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm4 (snoc4 (snoc4 (snoc4 g a) B) C) a\nv24 = var4 (vs4 (vs4 vz4))\n\nv34 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm4 (snoc4 (snoc4 (snoc4 (snoc4 g a) B) C) D) a\nv34 = var4 (vs4 (vs4 (vs4 vz4)))\n\nv44 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm4 (snoc4 (snoc4 (snoc4 (snoc4 (snoc4 g a) B) C) D) E) a\nv44 = var4 (vs4 (vs4 (vs4 (vs4 vz4))))\n\ntest4 : {g:_}-> {a:_} -> Tm4 g (arr4 (arr4 a a) (arr4 a a))\ntest4  = lam4 (lam4 (app4 v14 (app4 v14 (app4 v14 (app4 v14 (app4 v14 (app4 v14 v04)))))))\nTy5 : Type\nTy5 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty5 : Ty5\nempty5 = \\ _, empty, _ => empty\n\narr5 : Ty5 -> Ty5 -> Ty5\narr5 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon5 : Type\nCon5 = (Con5 : Type)\n ->(nil  : Con5)\n ->(snoc : Con5 -> Ty5 -> Con5)\n -> Con5\n\nnil5 : Con5\nnil5 = \\ con, nil5, snoc => nil5\n\nsnoc5 : Con5 -> Ty5 -> Con5\nsnoc5 = \\ g, a, con, nil5, snoc5 => snoc5 (g con nil5 snoc5) a\n\nVar5 : Con5 -> Ty5 -> Type\nVar5 = \\ g, a =>\n    (Var5 : Con5 -> Ty5 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var5 (snoc5 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var5 g a -> Var5 (snoc5 g b) a)\n -> Var5 g a\n\nvz5 : {g : _}-> {a : _} -> Var5 (snoc5 g a) a\nvz5 = \\ var, vz5, vs => vz5 _ _\n\nvs5 : {g : _} -> {B : _} -> {a : _} -> Var5 g a -> Var5 (snoc5 g B) a\nvs5 = \\ x, var, vz5, vs5 => vs5 _ _ _ (x var vz5 vs5)\n\nTm5 : Con5 -> Ty5 -> Type\nTm5 = \\ g, a =>\n    (Tm5    : Con5 -> Ty5 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var5 g a -> Tm5 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm5 (snoc5 g a) B -> Tm5 g (arr5 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm5 g (arr5 a B) -> Tm5 g a -> Tm5 g B)\n -> Tm5 g a\n\nvar5 : {g : _} -> {a : _} -> Var5 g a -> Tm5 g a\nvar5 = \\ x, tm, var5, lam, app => var5 _ _ x\n\nlam5 : {g : _} -> {a : _} -> {B : _} -> Tm5 (snoc5 g a) B -> Tm5 g (arr5 a B)\nlam5 = \\ t, tm, var5, lam5, app => lam5 _ _ _ (t tm var5 lam5 app)\n\napp5 : {g:_}->{a:_}->{B:_} -> Tm5 g (arr5 a B) -> Tm5 g a -> Tm5 g B\napp5 = \\ t, u, tm, var5, lam5, app5 => app5 _ _ _ (t tm var5 lam5 app5) (u tm var5 lam5 app5)\n\nv05 : {g:_}->{a:_} -> Tm5 (snoc5 g a) a\nv05 = var5 vz5\n\nv15 : {g:_}->{a:_}-> {B:_}-> Tm5 (snoc5 (snoc5 g a) B) a\nv15 = var5 (vs5 vz5)\n\nv25 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm5 (snoc5 (snoc5 (snoc5 g a) B) C) a\nv25 = var5 (vs5 (vs5 vz5))\n\nv35 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm5 (snoc5 (snoc5 (snoc5 (snoc5 g a) B) C) D) a\nv35 = var5 (vs5 (vs5 (vs5 vz5)))\n\nv45 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm5 (snoc5 (snoc5 (snoc5 (snoc5 (snoc5 g a) B) C) D) E) a\nv45 = var5 (vs5 (vs5 (vs5 (vs5 vz5))))\n\ntest5 : {g:_}-> {a:_} -> Tm5 g (arr5 (arr5 a a) (arr5 a a))\ntest5  = lam5 (lam5 (app5 v15 (app5 v15 (app5 v15 (app5 v15 (app5 v15 (app5 v15 v05)))))))\nTy6 : Type\nTy6 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty6 : Ty6\nempty6 = \\ _, empty, _ => empty\n\narr6 : Ty6 -> Ty6 -> Ty6\narr6 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon6 : Type\nCon6 = (Con6 : Type)\n ->(nil  : Con6)\n ->(snoc : Con6 -> Ty6 -> Con6)\n -> Con6\n\nnil6 : Con6\nnil6 = \\ con, nil6, snoc => nil6\n\nsnoc6 : Con6 -> Ty6 -> Con6\nsnoc6 = \\ g, a, con, nil6, snoc6 => snoc6 (g con nil6 snoc6) a\n\nVar6 : Con6 -> Ty6 -> Type\nVar6 = \\ g, a =>\n    (Var6 : Con6 -> Ty6 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var6 (snoc6 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var6 g a -> Var6 (snoc6 g b) a)\n -> Var6 g a\n\nvz6 : {g : _}-> {a : _} -> Var6 (snoc6 g a) a\nvz6 = \\ var, vz6, vs => vz6 _ _\n\nvs6 : {g : _} -> {B : _} -> {a : _} -> Var6 g a -> Var6 (snoc6 g B) a\nvs6 = \\ x, var, vz6, vs6 => vs6 _ _ _ (x var vz6 vs6)\n\nTm6 : Con6 -> Ty6 -> Type\nTm6 = \\ g, a =>\n    (Tm6    : Con6 -> Ty6 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var6 g a -> Tm6 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm6 (snoc6 g a) B -> Tm6 g (arr6 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm6 g (arr6 a B) -> Tm6 g a -> Tm6 g B)\n -> Tm6 g a\n\nvar6 : {g : _} -> {a : _} -> Var6 g a -> Tm6 g a\nvar6 = \\ x, tm, var6, lam, app => var6 _ _ x\n\nlam6 : {g : _} -> {a : _} -> {B : _} -> Tm6 (snoc6 g a) B -> Tm6 g (arr6 a B)\nlam6 = \\ t, tm, var6, lam6, app => lam6 _ _ _ (t tm var6 lam6 app)\n\napp6 : {g:_}->{a:_}->{B:_} -> Tm6 g (arr6 a B) -> Tm6 g a -> Tm6 g B\napp6 = \\ t, u, tm, var6, lam6, app6 => app6 _ _ _ (t tm var6 lam6 app6) (u tm var6 lam6 app6)\n\nv06 : {g:_}->{a:_} -> Tm6 (snoc6 g a) a\nv06 = var6 vz6\n\nv16 : {g:_}->{a:_}-> {B:_}-> Tm6 (snoc6 (snoc6 g a) B) a\nv16 = var6 (vs6 vz6)\n\nv26 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm6 (snoc6 (snoc6 (snoc6 g a) B) C) a\nv26 = var6 (vs6 (vs6 vz6))\n\nv36 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm6 (snoc6 (snoc6 (snoc6 (snoc6 g a) B) C) D) a\nv36 = var6 (vs6 (vs6 (vs6 vz6)))\n\nv46 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm6 (snoc6 (snoc6 (snoc6 (snoc6 (snoc6 g a) B) C) D) E) a\nv46 = var6 (vs6 (vs6 (vs6 (vs6 vz6))))\n\ntest6 : {g:_}-> {a:_} -> Tm6 g (arr6 (arr6 a a) (arr6 a a))\ntest6  = lam6 (lam6 (app6 v16 (app6 v16 (app6 v16 (app6 v16 (app6 v16 (app6 v16 v06)))))))\nTy7 : Type\nTy7 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty7 : Ty7\nempty7 = \\ _, empty, _ => empty\n\narr7 : Ty7 -> Ty7 -> Ty7\narr7 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon7 : Type\nCon7 = (Con7 : Type)\n ->(nil  : Con7)\n ->(snoc : Con7 -> Ty7 -> Con7)\n -> Con7\n\nnil7 : Con7\nnil7 = \\ con, nil7, snoc => nil7\n\nsnoc7 : Con7 -> Ty7 -> Con7\nsnoc7 = \\ g, a, con, nil7, snoc7 => snoc7 (g con nil7 snoc7) a\n\nVar7 : Con7 -> Ty7 -> Type\nVar7 = \\ g, a =>\n    (Var7 : Con7 -> Ty7 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var7 (snoc7 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var7 g a -> Var7 (snoc7 g b) a)\n -> Var7 g a\n\nvz7 : {g : _}-> {a : _} -> Var7 (snoc7 g a) a\nvz7 = \\ var, vz7, vs => vz7 _ _\n\nvs7 : {g : _} -> {B : _} -> {a : _} -> Var7 g a -> Var7 (snoc7 g B) a\nvs7 = \\ x, var, vz7, vs7 => vs7 _ _ _ (x var vz7 vs7)\n\nTm7 : Con7 -> Ty7 -> Type\nTm7 = \\ g, a =>\n    (Tm7    : Con7 -> Ty7 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var7 g a -> Tm7 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm7 (snoc7 g a) B -> Tm7 g (arr7 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm7 g (arr7 a B) -> Tm7 g a -> Tm7 g B)\n -> Tm7 g a\n\nvar7 : {g : _} -> {a : _} -> Var7 g a -> Tm7 g a\nvar7 = \\ x, tm, var7, lam, app => var7 _ _ x\n\nlam7 : {g : _} -> {a : _} -> {B : _} -> Tm7 (snoc7 g a) B -> Tm7 g (arr7 a B)\nlam7 = \\ t, tm, var7, lam7, app => lam7 _ _ _ (t tm var7 lam7 app)\n\napp7 : {g:_}->{a:_}->{B:_} -> Tm7 g (arr7 a B) -> Tm7 g a -> Tm7 g B\napp7 = \\ t, u, tm, var7, lam7, app7 => app7 _ _ _ (t tm var7 lam7 app7) (u tm var7 lam7 app7)\n\nv07 : {g:_}->{a:_} -> Tm7 (snoc7 g a) a\nv07 = var7 vz7\n\nv17 : {g:_}->{a:_}-> {B:_}-> Tm7 (snoc7 (snoc7 g a) B) a\nv17 = var7 (vs7 vz7)\n\nv27 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm7 (snoc7 (snoc7 (snoc7 g a) B) C) a\nv27 = var7 (vs7 (vs7 vz7))\n\nv37 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm7 (snoc7 (snoc7 (snoc7 (snoc7 g a) B) C) D) a\nv37 = var7 (vs7 (vs7 (vs7 vz7)))\n\nv47 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm7 (snoc7 (snoc7 (snoc7 (snoc7 (snoc7 g a) B) C) D) E) a\nv47 = var7 (vs7 (vs7 (vs7 (vs7 vz7))))\n\ntest7 : {g:_}-> {a:_} -> Tm7 g (arr7 (arr7 a a) (arr7 a a))\ntest7  = lam7 (lam7 (app7 v17 (app7 v17 (app7 v17 (app7 v17 (app7 v17 (app7 v17 v07)))))))\nTy8 : Type\nTy8 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty8 : Ty8\nempty8 = \\ _, empty, _ => empty\n\narr8 : Ty8 -> Ty8 -> Ty8\narr8 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon8 : Type\nCon8 = (Con8 : Type)\n ->(nil  : Con8)\n ->(snoc : Con8 -> Ty8 -> Con8)\n -> Con8\n\nnil8 : Con8\nnil8 = \\ con, nil8, snoc => nil8\n\nsnoc8 : Con8 -> Ty8 -> Con8\nsnoc8 = \\ g, a, con, nil8, snoc8 => snoc8 (g con nil8 snoc8) a\n\nVar8 : Con8 -> Ty8 -> Type\nVar8 = \\ g, a =>\n    (Var8 : Con8 -> Ty8 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var8 (snoc8 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var8 g a -> Var8 (snoc8 g b) a)\n -> Var8 g a\n\nvz8 : {g : _}-> {a : _} -> Var8 (snoc8 g a) a\nvz8 = \\ var, vz8, vs => vz8 _ _\n\nvs8 : {g : _} -> {B : _} -> {a : _} -> Var8 g a -> Var8 (snoc8 g B) a\nvs8 = \\ x, var, vz8, vs8 => vs8 _ _ _ (x var vz8 vs8)\n\nTm8 : Con8 -> Ty8 -> Type\nTm8 = \\ g, a =>\n    (Tm8    : Con8 -> Ty8 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var8 g a -> Tm8 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm8 (snoc8 g a) B -> Tm8 g (arr8 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm8 g (arr8 a B) -> Tm8 g a -> Tm8 g B)\n -> Tm8 g a\n\nvar8 : {g : _} -> {a : _} -> Var8 g a -> Tm8 g a\nvar8 = \\ x, tm, var8, lam, app => var8 _ _ x\n\nlam8 : {g : _} -> {a : _} -> {B : _} -> Tm8 (snoc8 g a) B -> Tm8 g (arr8 a B)\nlam8 = \\ t, tm, var8, lam8, app => lam8 _ _ _ (t tm var8 lam8 app)\n\napp8 : {g:_}->{a:_}->{B:_} -> Tm8 g (arr8 a B) -> Tm8 g a -> Tm8 g B\napp8 = \\ t, u, tm, var8, lam8, app8 => app8 _ _ _ (t tm var8 lam8 app8) (u tm var8 lam8 app8)\n\nv08 : {g:_}->{a:_} -> Tm8 (snoc8 g a) a\nv08 = var8 vz8\n\nv18 : {g:_}->{a:_}-> {B:_}-> Tm8 (snoc8 (snoc8 g a) B) a\nv18 = var8 (vs8 vz8)\n\nv28 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm8 (snoc8 (snoc8 (snoc8 g a) B) C) a\nv28 = var8 (vs8 (vs8 vz8))\n\nv38 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm8 (snoc8 (snoc8 (snoc8 (snoc8 g a) B) C) D) a\nv38 = var8 (vs8 (vs8 (vs8 vz8)))\n\nv48 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm8 (snoc8 (snoc8 (snoc8 (snoc8 (snoc8 g a) B) C) D) E) a\nv48 = var8 (vs8 (vs8 (vs8 (vs8 vz8))))\n\ntest8 : {g:_}-> {a:_} -> Tm8 g (arr8 (arr8 a a) (arr8 a a))\ntest8  = lam8 (lam8 (app8 v18 (app8 v18 (app8 v18 (app8 v18 (app8 v18 (app8 v18 v08)))))))\nTy9 : Type\nTy9 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty9 : Ty9\nempty9 = \\ _, empty, _ => empty\n\narr9 : Ty9 -> Ty9 -> Ty9\narr9 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon9 : Type\nCon9 = (Con9 : Type)\n ->(nil  : Con9)\n ->(snoc : Con9 -> Ty9 -> Con9)\n -> Con9\n\nnil9 : Con9\nnil9 = \\ con, nil9, snoc => nil9\n\nsnoc9 : Con9 -> Ty9 -> Con9\nsnoc9 = \\ g, a, con, nil9, snoc9 => snoc9 (g con nil9 snoc9) a\n\nVar9 : Con9 -> Ty9 -> Type\nVar9 = \\ g, a =>\n    (Var9 : Con9 -> Ty9 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var9 (snoc9 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var9 g a -> Var9 (snoc9 g b) a)\n -> Var9 g a\n\nvz9 : {g : _}-> {a : _} -> Var9 (snoc9 g a) a\nvz9 = \\ var, vz9, vs => vz9 _ _\n\nvs9 : {g : _} -> {B : _} -> {a : _} -> Var9 g a -> Var9 (snoc9 g B) a\nvs9 = \\ x, var, vz9, vs9 => vs9 _ _ _ (x var vz9 vs9)\n\nTm9 : Con9 -> Ty9 -> Type\nTm9 = \\ g, a =>\n    (Tm9    : Con9 -> Ty9 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var9 g a -> Tm9 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm9 (snoc9 g a) B -> Tm9 g (arr9 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm9 g (arr9 a B) -> Tm9 g a -> Tm9 g B)\n -> Tm9 g a\n\nvar9 : {g : _} -> {a : _} -> Var9 g a -> Tm9 g a\nvar9 = \\ x, tm, var9, lam, app => var9 _ _ x\n\nlam9 : {g : _} -> {a : _} -> {B : _} -> Tm9 (snoc9 g a) B -> Tm9 g (arr9 a B)\nlam9 = \\ t, tm, var9, lam9, app => lam9 _ _ _ (t tm var9 lam9 app)\n\napp9 : {g:_}->{a:_}->{B:_} -> Tm9 g (arr9 a B) -> Tm9 g a -> Tm9 g B\napp9 = \\ t, u, tm, var9, lam9, app9 => app9 _ _ _ (t tm var9 lam9 app9) (u tm var9 lam9 app9)\n\nv09 : {g:_}->{a:_} -> Tm9 (snoc9 g a) a\nv09 = var9 vz9\n\nv19 : {g:_}->{a:_}-> {B:_}-> Tm9 (snoc9 (snoc9 g a) B) a\nv19 = var9 (vs9 vz9)\n\nv29 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm9 (snoc9 (snoc9 (snoc9 g a) B) C) a\nv29 = var9 (vs9 (vs9 vz9))\n\nv39 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm9 (snoc9 (snoc9 (snoc9 (snoc9 g a) B) C) D) a\nv39 = var9 (vs9 (vs9 (vs9 vz9)))\n\nv49 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm9 (snoc9 (snoc9 (snoc9 (snoc9 (snoc9 g a) B) C) D) E) a\nv49 = var9 (vs9 (vs9 (vs9 (vs9 vz9))))\n\ntest9 : {g:_}-> {a:_} -> Tm9 g (arr9 (arr9 a a) (arr9 a a))\ntest9  = lam9 (lam9 (app9 v19 (app9 v19 (app9 v19 (app9 v19 (app9 v19 (app9 v19 v09)))))))\nTy10 : Type\nTy10 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty10 : Ty10\nempty10 = \\ _, empty, _ => empty\n\narr10 : Ty10 -> Ty10 -> Ty10\narr10 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon10 : Type\nCon10 = (Con10 : Type)\n ->(nil  : Con10)\n ->(snoc : Con10 -> Ty10 -> Con10)\n -> Con10\n\nnil10 : Con10\nnil10 = \\ con, nil10, snoc => nil10\n\nsnoc10 : Con10 -> Ty10 -> Con10\nsnoc10 = \\ g, a, con, nil10, snoc10 => snoc10 (g con nil10 snoc10) a\n\nVar10 : Con10 -> Ty10 -> Type\nVar10 = \\ g, a =>\n    (Var10 : Con10 -> Ty10 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var10 (snoc10 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var10 g a -> Var10 (snoc10 g b) a)\n -> Var10 g a\n\nvz10 : {g : _}-> {a : _} -> Var10 (snoc10 g a) a\nvz10 = \\ var, vz10, vs => vz10 _ _\n\nvs10 : {g : _} -> {B : _} -> {a : _} -> Var10 g a -> Var10 (snoc10 g B) a\nvs10 = \\ x, var, vz10, vs10 => vs10 _ _ _ (x var vz10 vs10)\n\nTm10 : Con10 -> Ty10 -> Type\nTm10 = \\ g, a =>\n    (Tm10    : Con10 -> Ty10 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var10 g a -> Tm10 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm10 (snoc10 g a) B -> Tm10 g (arr10 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm10 g (arr10 a B) -> Tm10 g a -> Tm10 g B)\n -> Tm10 g a\n\nvar10 : {g : _} -> {a : _} -> Var10 g a -> Tm10 g a\nvar10 = \\ x, tm, var10, lam, app => var10 _ _ x\n\nlam10 : {g : _} -> {a : _} -> {B : _} -> Tm10 (snoc10 g a) B -> Tm10 g (arr10 a B)\nlam10 = \\ t, tm, var10, lam10, app => lam10 _ _ _ (t tm var10 lam10 app)\n\napp10 : {g:_}->{a:_}->{B:_} -> Tm10 g (arr10 a B) -> Tm10 g a -> Tm10 g B\napp10 = \\ t, u, tm, var10, lam10, app10 => app10 _ _ _ (t tm var10 lam10 app10) (u tm var10 lam10 app10)\n\nv010 : {g:_}->{a:_} -> Tm10 (snoc10 g a) a\nv010 = var10 vz10\n\nv110 : {g:_}->{a:_}-> {B:_}-> Tm10 (snoc10 (snoc10 g a) B) a\nv110 = var10 (vs10 vz10)\n\nv210 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm10 (snoc10 (snoc10 (snoc10 g a) B) C) a\nv210 = var10 (vs10 (vs10 vz10))\n\nv310 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm10 (snoc10 (snoc10 (snoc10 (snoc10 g a) B) C) D) a\nv310 = var10 (vs10 (vs10 (vs10 vz10)))\n\nv410 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm10 (snoc10 (snoc10 (snoc10 (snoc10 (snoc10 g a) B) C) D) E) a\nv410 = var10 (vs10 (vs10 (vs10 (vs10 vz10))))\n\ntest10 : {g:_}-> {a:_} -> Tm10 g (arr10 (arr10 a a) (arr10 a a))\ntest10  = lam10 (lam10 (app10 v110 (app10 v110 (app10 v110 (app10 v110 (app10 v110 (app10 v110 v010)))))))\nTy11 : Type\nTy11 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty11 : Ty11\nempty11 = \\ _, empty, _ => empty\n\narr11 : Ty11 -> Ty11 -> Ty11\narr11 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon11 : Type\nCon11 = (Con11 : Type)\n ->(nil  : Con11)\n ->(snoc : Con11 -> Ty11 -> Con11)\n -> Con11\n\nnil11 : Con11\nnil11 = \\ con, nil11, snoc => nil11\n\nsnoc11 : Con11 -> Ty11 -> Con11\nsnoc11 = \\ g, a, con, nil11, snoc11 => snoc11 (g con nil11 snoc11) a\n\nVar11 : Con11 -> Ty11 -> Type\nVar11 = \\ g, a =>\n    (Var11 : Con11 -> Ty11 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var11 (snoc11 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var11 g a -> Var11 (snoc11 g b) a)\n -> Var11 g a\n\nvz11 : {g : _}-> {a : _} -> Var11 (snoc11 g a) a\nvz11 = \\ var, vz11, vs => vz11 _ _\n\nvs11 : {g : _} -> {B : _} -> {a : _} -> Var11 g a -> Var11 (snoc11 g B) a\nvs11 = \\ x, var, vz11, vs11 => vs11 _ _ _ (x var vz11 vs11)\n\nTm11 : Con11 -> Ty11 -> Type\nTm11 = \\ g, a =>\n    (Tm11    : Con11 -> Ty11 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var11 g a -> Tm11 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm11 (snoc11 g a) B -> Tm11 g (arr11 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm11 g (arr11 a B) -> Tm11 g a -> Tm11 g B)\n -> Tm11 g a\n\nvar11 : {g : _} -> {a : _} -> Var11 g a -> Tm11 g a\nvar11 = \\ x, tm, var11, lam, app => var11 _ _ x\n\nlam11 : {g : _} -> {a : _} -> {B : _} -> Tm11 (snoc11 g a) B -> Tm11 g (arr11 a B)\nlam11 = \\ t, tm, var11, lam11, app => lam11 _ _ _ (t tm var11 lam11 app)\n\napp11 : {g:_}->{a:_}->{B:_} -> Tm11 g (arr11 a B) -> Tm11 g a -> Tm11 g B\napp11 = \\ t, u, tm, var11, lam11, app11 => app11 _ _ _ (t tm var11 lam11 app11) (u tm var11 lam11 app11)\n\nv011 : {g:_}->{a:_} -> Tm11 (snoc11 g a) a\nv011 = var11 vz11\n\nv111 : {g:_}->{a:_}-> {B:_}-> Tm11 (snoc11 (snoc11 g a) B) a\nv111 = var11 (vs11 vz11)\n\nv211 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm11 (snoc11 (snoc11 (snoc11 g a) B) C) a\nv211 = var11 (vs11 (vs11 vz11))\n\nv311 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm11 (snoc11 (snoc11 (snoc11 (snoc11 g a) B) C) D) a\nv311 = var11 (vs11 (vs11 (vs11 vz11)))\n\nv411 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm11 (snoc11 (snoc11 (snoc11 (snoc11 (snoc11 g a) B) C) D) E) a\nv411 = var11 (vs11 (vs11 (vs11 (vs11 vz11))))\n\ntest11 : {g:_}-> {a:_} -> Tm11 g (arr11 (arr11 a a) (arr11 a a))\ntest11  = lam11 (lam11 (app11 v111 (app11 v111 (app11 v111 (app11 v111 (app11 v111 (app11 v111 v011)))))))\nTy12 : Type\nTy12 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty12 : Ty12\nempty12 = \\ _, empty, _ => empty\n\narr12 : Ty12 -> Ty12 -> Ty12\narr12 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon12 : Type\nCon12 = (Con12 : Type)\n ->(nil  : Con12)\n ->(snoc : Con12 -> Ty12 -> Con12)\n -> Con12\n\nnil12 : Con12\nnil12 = \\ con, nil12, snoc => nil12\n\nsnoc12 : Con12 -> Ty12 -> Con12\nsnoc12 = \\ g, a, con, nil12, snoc12 => snoc12 (g con nil12 snoc12) a\n\nVar12 : Con12 -> Ty12 -> Type\nVar12 = \\ g, a =>\n    (Var12 : Con12 -> Ty12 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var12 (snoc12 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var12 g a -> Var12 (snoc12 g b) a)\n -> Var12 g a\n\nvz12 : {g : _}-> {a : _} -> Var12 (snoc12 g a) a\nvz12 = \\ var, vz12, vs => vz12 _ _\n\nvs12 : {g : _} -> {B : _} -> {a : _} -> Var12 g a -> Var12 (snoc12 g B) a\nvs12 = \\ x, var, vz12, vs12 => vs12 _ _ _ (x var vz12 vs12)\n\nTm12 : Con12 -> Ty12 -> Type\nTm12 = \\ g, a =>\n    (Tm12    : Con12 -> Ty12 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var12 g a -> Tm12 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm12 (snoc12 g a) B -> Tm12 g (arr12 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm12 g (arr12 a B) -> Tm12 g a -> Tm12 g B)\n -> Tm12 g a\n\nvar12 : {g : _} -> {a : _} -> Var12 g a -> Tm12 g a\nvar12 = \\ x, tm, var12, lam, app => var12 _ _ x\n\nlam12 : {g : _} -> {a : _} -> {B : _} -> Tm12 (snoc12 g a) B -> Tm12 g (arr12 a B)\nlam12 = \\ t, tm, var12, lam12, app => lam12 _ _ _ (t tm var12 lam12 app)\n\napp12 : {g:_}->{a:_}->{B:_} -> Tm12 g (arr12 a B) -> Tm12 g a -> Tm12 g B\napp12 = \\ t, u, tm, var12, lam12, app12 => app12 _ _ _ (t tm var12 lam12 app12) (u tm var12 lam12 app12)\n\nv012 : {g:_}->{a:_} -> Tm12 (snoc12 g a) a\nv012 = var12 vz12\n\nv112 : {g:_}->{a:_}-> {B:_}-> Tm12 (snoc12 (snoc12 g a) B) a\nv112 = var12 (vs12 vz12)\n\nv212 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm12 (snoc12 (snoc12 (snoc12 g a) B) C) a\nv212 = var12 (vs12 (vs12 vz12))\n\nv312 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm12 (snoc12 (snoc12 (snoc12 (snoc12 g a) B) C) D) a\nv312 = var12 (vs12 (vs12 (vs12 vz12)))\n\nv412 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm12 (snoc12 (snoc12 (snoc12 (snoc12 (snoc12 g a) B) C) D) E) a\nv412 = var12 (vs12 (vs12 (vs12 (vs12 vz12))))\n\ntest12 : {g:_}-> {a:_} -> Tm12 g (arr12 (arr12 a a) (arr12 a a))\ntest12  = lam12 (lam12 (app12 v112 (app12 v112 (app12 v112 (app12 v112 (app12 v112 (app12 v112 v012)))))))\nTy13 : Type\nTy13 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty13 : Ty13\nempty13 = \\ _, empty, _ => empty\n\narr13 : Ty13 -> Ty13 -> Ty13\narr13 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon13 : Type\nCon13 = (Con13 : Type)\n ->(nil  : Con13)\n ->(snoc : Con13 -> Ty13 -> Con13)\n -> Con13\n\nnil13 : Con13\nnil13 = \\ con, nil13, snoc => nil13\n\nsnoc13 : Con13 -> Ty13 -> Con13\nsnoc13 = \\ g, a, con, nil13, snoc13 => snoc13 (g con nil13 snoc13) a\n\nVar13 : Con13 -> Ty13 -> Type\nVar13 = \\ g, a =>\n    (Var13 : Con13 -> Ty13 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var13 (snoc13 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var13 g a -> Var13 (snoc13 g b) a)\n -> Var13 g a\n\nvz13 : {g : _}-> {a : _} -> Var13 (snoc13 g a) a\nvz13 = \\ var, vz13, vs => vz13 _ _\n\nvs13 : {g : _} -> {B : _} -> {a : _} -> Var13 g a -> Var13 (snoc13 g B) a\nvs13 = \\ x, var, vz13, vs13 => vs13 _ _ _ (x var vz13 vs13)\n\nTm13 : Con13 -> Ty13 -> Type\nTm13 = \\ g, a =>\n    (Tm13    : Con13 -> Ty13 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var13 g a -> Tm13 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm13 (snoc13 g a) B -> Tm13 g (arr13 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm13 g (arr13 a B) -> Tm13 g a -> Tm13 g B)\n -> Tm13 g a\n\nvar13 : {g : _} -> {a : _} -> Var13 g a -> Tm13 g a\nvar13 = \\ x, tm, var13, lam, app => var13 _ _ x\n\nlam13 : {g : _} -> {a : _} -> {B : _} -> Tm13 (snoc13 g a) B -> Tm13 g (arr13 a B)\nlam13 = \\ t, tm, var13, lam13, app => lam13 _ _ _ (t tm var13 lam13 app)\n\napp13 : {g:_}->{a:_}->{B:_} -> Tm13 g (arr13 a B) -> Tm13 g a -> Tm13 g B\napp13 = \\ t, u, tm, var13, lam13, app13 => app13 _ _ _ (t tm var13 lam13 app13) (u tm var13 lam13 app13)\n\nv013 : {g:_}->{a:_} -> Tm13 (snoc13 g a) a\nv013 = var13 vz13\n\nv113 : {g:_}->{a:_}-> {B:_}-> Tm13 (snoc13 (snoc13 g a) B) a\nv113 = var13 (vs13 vz13)\n\nv213 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm13 (snoc13 (snoc13 (snoc13 g a) B) C) a\nv213 = var13 (vs13 (vs13 vz13))\n\nv313 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm13 (snoc13 (snoc13 (snoc13 (snoc13 g a) B) C) D) a\nv313 = var13 (vs13 (vs13 (vs13 vz13)))\n\nv413 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm13 (snoc13 (snoc13 (snoc13 (snoc13 (snoc13 g a) B) C) D) E) a\nv413 = var13 (vs13 (vs13 (vs13 (vs13 vz13))))\n\ntest13 : {g:_}-> {a:_} -> Tm13 g (arr13 (arr13 a a) (arr13 a a))\ntest13  = lam13 (lam13 (app13 v113 (app13 v113 (app13 v113 (app13 v113 (app13 v113 (app13 v113 v013)))))))\nTy14 : Type\nTy14 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty14 : Ty14\nempty14 = \\ _, empty, _ => empty\n\narr14 : Ty14 -> Ty14 -> Ty14\narr14 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon14 : Type\nCon14 = (Con14 : Type)\n ->(nil  : Con14)\n ->(snoc : Con14 -> Ty14 -> Con14)\n -> Con14\n\nnil14 : Con14\nnil14 = \\ con, nil14, snoc => nil14\n\nsnoc14 : Con14 -> Ty14 -> Con14\nsnoc14 = \\ g, a, con, nil14, snoc14 => snoc14 (g con nil14 snoc14) a\n\nVar14 : Con14 -> Ty14 -> Type\nVar14 = \\ g, a =>\n    (Var14 : Con14 -> Ty14 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var14 (snoc14 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var14 g a -> Var14 (snoc14 g b) a)\n -> Var14 g a\n\nvz14 : {g : _}-> {a : _} -> Var14 (snoc14 g a) a\nvz14 = \\ var, vz14, vs => vz14 _ _\n\nvs14 : {g : _} -> {B : _} -> {a : _} -> Var14 g a -> Var14 (snoc14 g B) a\nvs14 = \\ x, var, vz14, vs14 => vs14 _ _ _ (x var vz14 vs14)\n\nTm14 : Con14 -> Ty14 -> Type\nTm14 = \\ g, a =>\n    (Tm14    : Con14 -> Ty14 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var14 g a -> Tm14 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm14 (snoc14 g a) B -> Tm14 g (arr14 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm14 g (arr14 a B) -> Tm14 g a -> Tm14 g B)\n -> Tm14 g a\n\nvar14 : {g : _} -> {a : _} -> Var14 g a -> Tm14 g a\nvar14 = \\ x, tm, var14, lam, app => var14 _ _ x\n\nlam14 : {g : _} -> {a : _} -> {B : _} -> Tm14 (snoc14 g a) B -> Tm14 g (arr14 a B)\nlam14 = \\ t, tm, var14, lam14, app => lam14 _ _ _ (t tm var14 lam14 app)\n\napp14 : {g:_}->{a:_}->{B:_} -> Tm14 g (arr14 a B) -> Tm14 g a -> Tm14 g B\napp14 = \\ t, u, tm, var14, lam14, app14 => app14 _ _ _ (t tm var14 lam14 app14) (u tm var14 lam14 app14)\n\nv014 : {g:_}->{a:_} -> Tm14 (snoc14 g a) a\nv014 = var14 vz14\n\nv114 : {g:_}->{a:_}-> {B:_}-> Tm14 (snoc14 (snoc14 g a) B) a\nv114 = var14 (vs14 vz14)\n\nv214 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm14 (snoc14 (snoc14 (snoc14 g a) B) C) a\nv214 = var14 (vs14 (vs14 vz14))\n\nv314 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm14 (snoc14 (snoc14 (snoc14 (snoc14 g a) B) C) D) a\nv314 = var14 (vs14 (vs14 (vs14 vz14)))\n\nv414 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm14 (snoc14 (snoc14 (snoc14 (snoc14 (snoc14 g a) B) C) D) E) a\nv414 = var14 (vs14 (vs14 (vs14 (vs14 vz14))))\n\ntest14 : {g:_}-> {a:_} -> Tm14 g (arr14 (arr14 a a) (arr14 a a))\ntest14  = lam14 (lam14 (app14 v114 (app14 v114 (app14 v114 (app14 v114 (app14 v114 (app14 v114 v014)))))))\nTy15 : Type\nTy15 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty15 : Ty15\nempty15 = \\ _, empty, _ => empty\n\narr15 : Ty15 -> Ty15 -> Ty15\narr15 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon15 : Type\nCon15 = (Con15 : Type)\n ->(nil  : Con15)\n ->(snoc : Con15 -> Ty15 -> Con15)\n -> Con15\n\nnil15 : Con15\nnil15 = \\ con, nil15, snoc => nil15\n\nsnoc15 : Con15 -> Ty15 -> Con15\nsnoc15 = \\ g, a, con, nil15, snoc15 => snoc15 (g con nil15 snoc15) a\n\nVar15 : Con15 -> Ty15 -> Type\nVar15 = \\ g, a =>\n    (Var15 : Con15 -> Ty15 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var15 (snoc15 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var15 g a -> Var15 (snoc15 g b) a)\n -> Var15 g a\n\nvz15 : {g : _}-> {a : _} -> Var15 (snoc15 g a) a\nvz15 = \\ var, vz15, vs => vz15 _ _\n\nvs15 : {g : _} -> {B : _} -> {a : _} -> Var15 g a -> Var15 (snoc15 g B) a\nvs15 = \\ x, var, vz15, vs15 => vs15 _ _ _ (x var vz15 vs15)\n\nTm15 : Con15 -> Ty15 -> Type\nTm15 = \\ g, a =>\n    (Tm15    : Con15 -> Ty15 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var15 g a -> Tm15 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm15 (snoc15 g a) B -> Tm15 g (arr15 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm15 g (arr15 a B) -> Tm15 g a -> Tm15 g B)\n -> Tm15 g a\n\nvar15 : {g : _} -> {a : _} -> Var15 g a -> Tm15 g a\nvar15 = \\ x, tm, var15, lam, app => var15 _ _ x\n\nlam15 : {g : _} -> {a : _} -> {B : _} -> Tm15 (snoc15 g a) B -> Tm15 g (arr15 a B)\nlam15 = \\ t, tm, var15, lam15, app => lam15 _ _ _ (t tm var15 lam15 app)\n\napp15 : {g:_}->{a:_}->{B:_} -> Tm15 g (arr15 a B) -> Tm15 g a -> Tm15 g B\napp15 = \\ t, u, tm, var15, lam15, app15 => app15 _ _ _ (t tm var15 lam15 app15) (u tm var15 lam15 app15)\n\nv015 : {g:_}->{a:_} -> Tm15 (snoc15 g a) a\nv015 = var15 vz15\n\nv115 : {g:_}->{a:_}-> {B:_}-> Tm15 (snoc15 (snoc15 g a) B) a\nv115 = var15 (vs15 vz15)\n\nv215 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm15 (snoc15 (snoc15 (snoc15 g a) B) C) a\nv215 = var15 (vs15 (vs15 vz15))\n\nv315 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm15 (snoc15 (snoc15 (snoc15 (snoc15 g a) B) C) D) a\nv315 = var15 (vs15 (vs15 (vs15 vz15)))\n\nv415 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm15 (snoc15 (snoc15 (snoc15 (snoc15 (snoc15 g a) B) C) D) E) a\nv415 = var15 (vs15 (vs15 (vs15 (vs15 vz15))))\n\ntest15 : {g:_}-> {a:_} -> Tm15 g (arr15 (arr15 a a) (arr15 a a))\ntest15  = lam15 (lam15 (app15 v115 (app15 v115 (app15 v115 (app15 v115 (app15 v115 (app15 v115 v015)))))))\nTy16 : Type\nTy16 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty16 : Ty16\nempty16 = \\ _, empty, _ => empty\n\narr16 : Ty16 -> Ty16 -> Ty16\narr16 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon16 : Type\nCon16 = (Con16 : Type)\n ->(nil  : Con16)\n ->(snoc : Con16 -> Ty16 -> Con16)\n -> Con16\n\nnil16 : Con16\nnil16 = \\ con, nil16, snoc => nil16\n\nsnoc16 : Con16 -> Ty16 -> Con16\nsnoc16 = \\ g, a, con, nil16, snoc16 => snoc16 (g con nil16 snoc16) a\n\nVar16 : Con16 -> Ty16 -> Type\nVar16 = \\ g, a =>\n    (Var16 : Con16 -> Ty16 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var16 (snoc16 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var16 g a -> Var16 (snoc16 g b) a)\n -> Var16 g a\n\nvz16 : {g : _}-> {a : _} -> Var16 (snoc16 g a) a\nvz16 = \\ var, vz16, vs => vz16 _ _\n\nvs16 : {g : _} -> {B : _} -> {a : _} -> Var16 g a -> Var16 (snoc16 g B) a\nvs16 = \\ x, var, vz16, vs16 => vs16 _ _ _ (x var vz16 vs16)\n\nTm16 : Con16 -> Ty16 -> Type\nTm16 = \\ g, a =>\n    (Tm16    : Con16 -> Ty16 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var16 g a -> Tm16 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm16 (snoc16 g a) B -> Tm16 g (arr16 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm16 g (arr16 a B) -> Tm16 g a -> Tm16 g B)\n -> Tm16 g a\n\nvar16 : {g : _} -> {a : _} -> Var16 g a -> Tm16 g a\nvar16 = \\ x, tm, var16, lam, app => var16 _ _ x\n\nlam16 : {g : _} -> {a : _} -> {B : _} -> Tm16 (snoc16 g a) B -> Tm16 g (arr16 a B)\nlam16 = \\ t, tm, var16, lam16, app => lam16 _ _ _ (t tm var16 lam16 app)\n\napp16 : {g:_}->{a:_}->{B:_} -> Tm16 g (arr16 a B) -> Tm16 g a -> Tm16 g B\napp16 = \\ t, u, tm, var16, lam16, app16 => app16 _ _ _ (t tm var16 lam16 app16) (u tm var16 lam16 app16)\n\nv016 : {g:_}->{a:_} -> Tm16 (snoc16 g a) a\nv016 = var16 vz16\n\nv116 : {g:_}->{a:_}-> {B:_}-> Tm16 (snoc16 (snoc16 g a) B) a\nv116 = var16 (vs16 vz16)\n\nv216 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm16 (snoc16 (snoc16 (snoc16 g a) B) C) a\nv216 = var16 (vs16 (vs16 vz16))\n\nv316 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm16 (snoc16 (snoc16 (snoc16 (snoc16 g a) B) C) D) a\nv316 = var16 (vs16 (vs16 (vs16 vz16)))\n\nv416 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm16 (snoc16 (snoc16 (snoc16 (snoc16 (snoc16 g a) B) C) D) E) a\nv416 = var16 (vs16 (vs16 (vs16 (vs16 vz16))))\n\ntest16 : {g:_}-> {a:_} -> Tm16 g (arr16 (arr16 a a) (arr16 a a))\ntest16  = lam16 (lam16 (app16 v116 (app16 v116 (app16 v116 (app16 v116 (app16 v116 (app16 v116 v016)))))))\nTy17 : Type\nTy17 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty17 : Ty17\nempty17 = \\ _, empty, _ => empty\n\narr17 : Ty17 -> Ty17 -> Ty17\narr17 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon17 : Type\nCon17 = (Con17 : Type)\n ->(nil  : Con17)\n ->(snoc : Con17 -> Ty17 -> Con17)\n -> Con17\n\nnil17 : Con17\nnil17 = \\ con, nil17, snoc => nil17\n\nsnoc17 : Con17 -> Ty17 -> Con17\nsnoc17 = \\ g, a, con, nil17, snoc17 => snoc17 (g con nil17 snoc17) a\n\nVar17 : Con17 -> Ty17 -> Type\nVar17 = \\ g, a =>\n    (Var17 : Con17 -> Ty17 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var17 (snoc17 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var17 g a -> Var17 (snoc17 g b) a)\n -> Var17 g a\n\nvz17 : {g : _}-> {a : _} -> Var17 (snoc17 g a) a\nvz17 = \\ var, vz17, vs => vz17 _ _\n\nvs17 : {g : _} -> {B : _} -> {a : _} -> Var17 g a -> Var17 (snoc17 g B) a\nvs17 = \\ x, var, vz17, vs17 => vs17 _ _ _ (x var vz17 vs17)\n\nTm17 : Con17 -> Ty17 -> Type\nTm17 = \\ g, a =>\n    (Tm17    : Con17 -> Ty17 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var17 g a -> Tm17 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm17 (snoc17 g a) B -> Tm17 g (arr17 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm17 g (arr17 a B) -> Tm17 g a -> Tm17 g B)\n -> Tm17 g a\n\nvar17 : {g : _} -> {a : _} -> Var17 g a -> Tm17 g a\nvar17 = \\ x, tm, var17, lam, app => var17 _ _ x\n\nlam17 : {g : _} -> {a : _} -> {B : _} -> Tm17 (snoc17 g a) B -> Tm17 g (arr17 a B)\nlam17 = \\ t, tm, var17, lam17, app => lam17 _ _ _ (t tm var17 lam17 app)\n\napp17 : {g:_}->{a:_}->{B:_} -> Tm17 g (arr17 a B) -> Tm17 g a -> Tm17 g B\napp17 = \\ t, u, tm, var17, lam17, app17 => app17 _ _ _ (t tm var17 lam17 app17) (u tm var17 lam17 app17)\n\nv017 : {g:_}->{a:_} -> Tm17 (snoc17 g a) a\nv017 = var17 vz17\n\nv117 : {g:_}->{a:_}-> {B:_}-> Tm17 (snoc17 (snoc17 g a) B) a\nv117 = var17 (vs17 vz17)\n\nv217 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm17 (snoc17 (snoc17 (snoc17 g a) B) C) a\nv217 = var17 (vs17 (vs17 vz17))\n\nv317 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm17 (snoc17 (snoc17 (snoc17 (snoc17 g a) B) C) D) a\nv317 = var17 (vs17 (vs17 (vs17 vz17)))\n\nv417 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm17 (snoc17 (snoc17 (snoc17 (snoc17 (snoc17 g a) B) C) D) E) a\nv417 = var17 (vs17 (vs17 (vs17 (vs17 vz17))))\n\ntest17 : {g:_}-> {a:_} -> Tm17 g (arr17 (arr17 a a) (arr17 a a))\ntest17  = lam17 (lam17 (app17 v117 (app17 v117 (app17 v117 (app17 v117 (app17 v117 (app17 v117 v017)))))))\nTy18 : Type\nTy18 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty18 : Ty18\nempty18 = \\ _, empty, _ => empty\n\narr18 : Ty18 -> Ty18 -> Ty18\narr18 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon18 : Type\nCon18 = (Con18 : Type)\n ->(nil  : Con18)\n ->(snoc : Con18 -> Ty18 -> Con18)\n -> Con18\n\nnil18 : Con18\nnil18 = \\ con, nil18, snoc => nil18\n\nsnoc18 : Con18 -> Ty18 -> Con18\nsnoc18 = \\ g, a, con, nil18, snoc18 => snoc18 (g con nil18 snoc18) a\n\nVar18 : Con18 -> Ty18 -> Type\nVar18 = \\ g, a =>\n    (Var18 : Con18 -> Ty18 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var18 (snoc18 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var18 g a -> Var18 (snoc18 g b) a)\n -> Var18 g a\n\nvz18 : {g : _}-> {a : _} -> Var18 (snoc18 g a) a\nvz18 = \\ var, vz18, vs => vz18 _ _\n\nvs18 : {g : _} -> {B : _} -> {a : _} -> Var18 g a -> Var18 (snoc18 g B) a\nvs18 = \\ x, var, vz18, vs18 => vs18 _ _ _ (x var vz18 vs18)\n\nTm18 : Con18 -> Ty18 -> Type\nTm18 = \\ g, a =>\n    (Tm18    : Con18 -> Ty18 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var18 g a -> Tm18 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm18 (snoc18 g a) B -> Tm18 g (arr18 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm18 g (arr18 a B) -> Tm18 g a -> Tm18 g B)\n -> Tm18 g a\n\nvar18 : {g : _} -> {a : _} -> Var18 g a -> Tm18 g a\nvar18 = \\ x, tm, var18, lam, app => var18 _ _ x\n\nlam18 : {g : _} -> {a : _} -> {B : _} -> Tm18 (snoc18 g a) B -> Tm18 g (arr18 a B)\nlam18 = \\ t, tm, var18, lam18, app => lam18 _ _ _ (t tm var18 lam18 app)\n\napp18 : {g:_}->{a:_}->{B:_} -> Tm18 g (arr18 a B) -> Tm18 g a -> Tm18 g B\napp18 = \\ t, u, tm, var18, lam18, app18 => app18 _ _ _ (t tm var18 lam18 app18) (u tm var18 lam18 app18)\n\nv018 : {g:_}->{a:_} -> Tm18 (snoc18 g a) a\nv018 = var18 vz18\n\nv118 : {g:_}->{a:_}-> {B:_}-> Tm18 (snoc18 (snoc18 g a) B) a\nv118 = var18 (vs18 vz18)\n\nv218 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm18 (snoc18 (snoc18 (snoc18 g a) B) C) a\nv218 = var18 (vs18 (vs18 vz18))\n\nv318 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm18 (snoc18 (snoc18 (snoc18 (snoc18 g a) B) C) D) a\nv318 = var18 (vs18 (vs18 (vs18 vz18)))\n\nv418 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm18 (snoc18 (snoc18 (snoc18 (snoc18 (snoc18 g a) B) C) D) E) a\nv418 = var18 (vs18 (vs18 (vs18 (vs18 vz18))))\n\ntest18 : {g:_}-> {a:_} -> Tm18 g (arr18 (arr18 a a) (arr18 a a))\ntest18  = lam18 (lam18 (app18 v118 (app18 v118 (app18 v118 (app18 v118 (app18 v118 (app18 v118 v018)))))))\nTy19 : Type\nTy19 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty19 : Ty19\nempty19 = \\ _, empty, _ => empty\n\narr19 : Ty19 -> Ty19 -> Ty19\narr19 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon19 : Type\nCon19 = (Con19 : Type)\n ->(nil  : Con19)\n ->(snoc : Con19 -> Ty19 -> Con19)\n -> Con19\n\nnil19 : Con19\nnil19 = \\ con, nil19, snoc => nil19\n\nsnoc19 : Con19 -> Ty19 -> Con19\nsnoc19 = \\ g, a, con, nil19, snoc19 => snoc19 (g con nil19 snoc19) a\n\nVar19 : Con19 -> Ty19 -> Type\nVar19 = \\ g, a =>\n    (Var19 : Con19 -> Ty19 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var19 (snoc19 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var19 g a -> Var19 (snoc19 g b) a)\n -> Var19 g a\n\nvz19 : {g : _}-> {a : _} -> Var19 (snoc19 g a) a\nvz19 = \\ var, vz19, vs => vz19 _ _\n\nvs19 : {g : _} -> {B : _} -> {a : _} -> Var19 g a -> Var19 (snoc19 g B) a\nvs19 = \\ x, var, vz19, vs19 => vs19 _ _ _ (x var vz19 vs19)\n\nTm19 : Con19 -> Ty19 -> Type\nTm19 = \\ g, a =>\n    (Tm19    : Con19 -> Ty19 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var19 g a -> Tm19 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm19 (snoc19 g a) B -> Tm19 g (arr19 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm19 g (arr19 a B) -> Tm19 g a -> Tm19 g B)\n -> Tm19 g a\n\nvar19 : {g : _} -> {a : _} -> Var19 g a -> Tm19 g a\nvar19 = \\ x, tm, var19, lam, app => var19 _ _ x\n\nlam19 : {g : _} -> {a : _} -> {B : _} -> Tm19 (snoc19 g a) B -> Tm19 g (arr19 a B)\nlam19 = \\ t, tm, var19, lam19, app => lam19 _ _ _ (t tm var19 lam19 app)\n\napp19 : {g:_}->{a:_}->{B:_} -> Tm19 g (arr19 a B) -> Tm19 g a -> Tm19 g B\napp19 = \\ t, u, tm, var19, lam19, app19 => app19 _ _ _ (t tm var19 lam19 app19) (u tm var19 lam19 app19)\n\nv019 : {g:_}->{a:_} -> Tm19 (snoc19 g a) a\nv019 = var19 vz19\n\nv119 : {g:_}->{a:_}-> {B:_}-> Tm19 (snoc19 (snoc19 g a) B) a\nv119 = var19 (vs19 vz19)\n\nv219 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm19 (snoc19 (snoc19 (snoc19 g a) B) C) a\nv219 = var19 (vs19 (vs19 vz19))\n\nv319 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm19 (snoc19 (snoc19 (snoc19 (snoc19 g a) B) C) D) a\nv319 = var19 (vs19 (vs19 (vs19 vz19)))\n\nv419 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm19 (snoc19 (snoc19 (snoc19 (snoc19 (snoc19 g a) B) C) D) E) a\nv419 = var19 (vs19 (vs19 (vs19 (vs19 vz19))))\n\ntest19 : {g:_}-> {a:_} -> Tm19 g (arr19 (arr19 a a) (arr19 a a))\ntest19  = lam19 (lam19 (app19 v119 (app19 v119 (app19 v119 (app19 v119 (app19 v119 (app19 v119 v019)))))))\nTy20 : Type\nTy20 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty20 : Ty20\nempty20 = \\ _, empty, _ => empty\n\narr20 : Ty20 -> Ty20 -> Ty20\narr20 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon20 : Type\nCon20 = (Con20 : Type)\n ->(nil  : Con20)\n ->(snoc : Con20 -> Ty20 -> Con20)\n -> Con20\n\nnil20 : Con20\nnil20 = \\ con, nil20, snoc => nil20\n\nsnoc20 : Con20 -> Ty20 -> Con20\nsnoc20 = \\ g, a, con, nil20, snoc20 => snoc20 (g con nil20 snoc20) a\n\nVar20 : Con20 -> Ty20 -> Type\nVar20 = \\ g, a =>\n    (Var20 : Con20 -> Ty20 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var20 (snoc20 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var20 g a -> Var20 (snoc20 g b) a)\n -> Var20 g a\n\nvz20 : {g : _}-> {a : _} -> Var20 (snoc20 g a) a\nvz20 = \\ var, vz20, vs => vz20 _ _\n\nvs20 : {g : _} -> {B : _} -> {a : _} -> Var20 g a -> Var20 (snoc20 g B) a\nvs20 = \\ x, var, vz20, vs20 => vs20 _ _ _ (x var vz20 vs20)\n\nTm20 : Con20 -> Ty20 -> Type\nTm20 = \\ g, a =>\n    (Tm20    : Con20 -> Ty20 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var20 g a -> Tm20 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm20 (snoc20 g a) B -> Tm20 g (arr20 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm20 g (arr20 a B) -> Tm20 g a -> Tm20 g B)\n -> Tm20 g a\n\nvar20 : {g : _} -> {a : _} -> Var20 g a -> Tm20 g a\nvar20 = \\ x, tm, var20, lam, app => var20 _ _ x\n\nlam20 : {g : _} -> {a : _} -> {B : _} -> Tm20 (snoc20 g a) B -> Tm20 g (arr20 a B)\nlam20 = \\ t, tm, var20, lam20, app => lam20 _ _ _ (t tm var20 lam20 app)\n\napp20 : {g:_}->{a:_}->{B:_} -> Tm20 g (arr20 a B) -> Tm20 g a -> Tm20 g B\napp20 = \\ t, u, tm, var20, lam20, app20 => app20 _ _ _ (t tm var20 lam20 app20) (u tm var20 lam20 app20)\n\nv020 : {g:_}->{a:_} -> Tm20 (snoc20 g a) a\nv020 = var20 vz20\n\nv120 : {g:_}->{a:_}-> {B:_}-> Tm20 (snoc20 (snoc20 g a) B) a\nv120 = var20 (vs20 vz20)\n\nv220 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm20 (snoc20 (snoc20 (snoc20 g a) B) C) a\nv220 = var20 (vs20 (vs20 vz20))\n\nv320 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm20 (snoc20 (snoc20 (snoc20 (snoc20 g a) B) C) D) a\nv320 = var20 (vs20 (vs20 (vs20 vz20)))\n\nv420 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm20 (snoc20 (snoc20 (snoc20 (snoc20 (snoc20 g a) B) C) D) E) a\nv420 = var20 (vs20 (vs20 (vs20 (vs20 vz20))))\n\ntest20 : {g:_}-> {a:_} -> Tm20 g (arr20 (arr20 a a) (arr20 a a))\ntest20  = lam20 (lam20 (app20 v120 (app20 v120 (app20 v120 (app20 v120 (app20 v120 (app20 v120 v020)))))))\nTy21 : Type\nTy21 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty21 : Ty21\nempty21 = \\ _, empty, _ => empty\n\narr21 : Ty21 -> Ty21 -> Ty21\narr21 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon21 : Type\nCon21 = (Con21 : Type)\n ->(nil  : Con21)\n ->(snoc : Con21 -> Ty21 -> Con21)\n -> Con21\n\nnil21 : Con21\nnil21 = \\ con, nil21, snoc => nil21\n\nsnoc21 : Con21 -> Ty21 -> Con21\nsnoc21 = \\ g, a, con, nil21, snoc21 => snoc21 (g con nil21 snoc21) a\n\nVar21 : Con21 -> Ty21 -> Type\nVar21 = \\ g, a =>\n    (Var21 : Con21 -> Ty21 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var21 (snoc21 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var21 g a -> Var21 (snoc21 g b) a)\n -> Var21 g a\n\nvz21 : {g : _}-> {a : _} -> Var21 (snoc21 g a) a\nvz21 = \\ var, vz21, vs => vz21 _ _\n\nvs21 : {g : _} -> {B : _} -> {a : _} -> Var21 g a -> Var21 (snoc21 g B) a\nvs21 = \\ x, var, vz21, vs21 => vs21 _ _ _ (x var vz21 vs21)\n\nTm21 : Con21 -> Ty21 -> Type\nTm21 = \\ g, a =>\n    (Tm21    : Con21 -> Ty21 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var21 g a -> Tm21 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm21 (snoc21 g a) B -> Tm21 g (arr21 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm21 g (arr21 a B) -> Tm21 g a -> Tm21 g B)\n -> Tm21 g a\n\nvar21 : {g : _} -> {a : _} -> Var21 g a -> Tm21 g a\nvar21 = \\ x, tm, var21, lam, app => var21 _ _ x\n\nlam21 : {g : _} -> {a : _} -> {B : _} -> Tm21 (snoc21 g a) B -> Tm21 g (arr21 a B)\nlam21 = \\ t, tm, var21, lam21, app => lam21 _ _ _ (t tm var21 lam21 app)\n\napp21 : {g:_}->{a:_}->{B:_} -> Tm21 g (arr21 a B) -> Tm21 g a -> Tm21 g B\napp21 = \\ t, u, tm, var21, lam21, app21 => app21 _ _ _ (t tm var21 lam21 app21) (u tm var21 lam21 app21)\n\nv021 : {g:_}->{a:_} -> Tm21 (snoc21 g a) a\nv021 = var21 vz21\n\nv121 : {g:_}->{a:_}-> {B:_}-> Tm21 (snoc21 (snoc21 g a) B) a\nv121 = var21 (vs21 vz21)\n\nv221 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm21 (snoc21 (snoc21 (snoc21 g a) B) C) a\nv221 = var21 (vs21 (vs21 vz21))\n\nv321 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm21 (snoc21 (snoc21 (snoc21 (snoc21 g a) B) C) D) a\nv321 = var21 (vs21 (vs21 (vs21 vz21)))\n\nv421 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm21 (snoc21 (snoc21 (snoc21 (snoc21 (snoc21 g a) B) C) D) E) a\nv421 = var21 (vs21 (vs21 (vs21 (vs21 vz21))))\n\ntest21 : {g:_}-> {a:_} -> Tm21 g (arr21 (arr21 a a) (arr21 a a))\ntest21  = lam21 (lam21 (app21 v121 (app21 v121 (app21 v121 (app21 v121 (app21 v121 (app21 v121 v021)))))))\nTy22 : Type\nTy22 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty22 : Ty22\nempty22 = \\ _, empty, _ => empty\n\narr22 : Ty22 -> Ty22 -> Ty22\narr22 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon22 : Type\nCon22 = (Con22 : Type)\n ->(nil  : Con22)\n ->(snoc : Con22 -> Ty22 -> Con22)\n -> Con22\n\nnil22 : Con22\nnil22 = \\ con, nil22, snoc => nil22\n\nsnoc22 : Con22 -> Ty22 -> Con22\nsnoc22 = \\ g, a, con, nil22, snoc22 => snoc22 (g con nil22 snoc22) a\n\nVar22 : Con22 -> Ty22 -> Type\nVar22 = \\ g, a =>\n    (Var22 : Con22 -> Ty22 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var22 (snoc22 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var22 g a -> Var22 (snoc22 g b) a)\n -> Var22 g a\n\nvz22 : {g : _}-> {a : _} -> Var22 (snoc22 g a) a\nvz22 = \\ var, vz22, vs => vz22 _ _\n\nvs22 : {g : _} -> {B : _} -> {a : _} -> Var22 g a -> Var22 (snoc22 g B) a\nvs22 = \\ x, var, vz22, vs22 => vs22 _ _ _ (x var vz22 vs22)\n\nTm22 : Con22 -> Ty22 -> Type\nTm22 = \\ g, a =>\n    (Tm22    : Con22 -> Ty22 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var22 g a -> Tm22 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm22 (snoc22 g a) B -> Tm22 g (arr22 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm22 g (arr22 a B) -> Tm22 g a -> Tm22 g B)\n -> Tm22 g a\n\nvar22 : {g : _} -> {a : _} -> Var22 g a -> Tm22 g a\nvar22 = \\ x, tm, var22, lam, app => var22 _ _ x\n\nlam22 : {g : _} -> {a : _} -> {B : _} -> Tm22 (snoc22 g a) B -> Tm22 g (arr22 a B)\nlam22 = \\ t, tm, var22, lam22, app => lam22 _ _ _ (t tm var22 lam22 app)\n\napp22 : {g:_}->{a:_}->{B:_} -> Tm22 g (arr22 a B) -> Tm22 g a -> Tm22 g B\napp22 = \\ t, u, tm, var22, lam22, app22 => app22 _ _ _ (t tm var22 lam22 app22) (u tm var22 lam22 app22)\n\nv022 : {g:_}->{a:_} -> Tm22 (snoc22 g a) a\nv022 = var22 vz22\n\nv122 : {g:_}->{a:_}-> {B:_}-> Tm22 (snoc22 (snoc22 g a) B) a\nv122 = var22 (vs22 vz22)\n\nv222 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm22 (snoc22 (snoc22 (snoc22 g a) B) C) a\nv222 = var22 (vs22 (vs22 vz22))\n\nv322 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm22 (snoc22 (snoc22 (snoc22 (snoc22 g a) B) C) D) a\nv322 = var22 (vs22 (vs22 (vs22 vz22)))\n\nv422 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm22 (snoc22 (snoc22 (snoc22 (snoc22 (snoc22 g a) B) C) D) E) a\nv422 = var22 (vs22 (vs22 (vs22 (vs22 vz22))))\n\ntest22 : {g:_}-> {a:_} -> Tm22 g (arr22 (arr22 a a) (arr22 a a))\ntest22  = lam22 (lam22 (app22 v122 (app22 v122 (app22 v122 (app22 v122 (app22 v122 (app22 v122 v022)))))))\nTy23 : Type\nTy23 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty23 : Ty23\nempty23 = \\ _, empty, _ => empty\n\narr23 : Ty23 -> Ty23 -> Ty23\narr23 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon23 : Type\nCon23 = (Con23 : Type)\n ->(nil  : Con23)\n ->(snoc : Con23 -> Ty23 -> Con23)\n -> Con23\n\nnil23 : Con23\nnil23 = \\ con, nil23, snoc => nil23\n\nsnoc23 : Con23 -> Ty23 -> Con23\nsnoc23 = \\ g, a, con, nil23, snoc23 => snoc23 (g con nil23 snoc23) a\n\nVar23 : Con23 -> Ty23 -> Type\nVar23 = \\ g, a =>\n    (Var23 : Con23 -> Ty23 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var23 (snoc23 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var23 g a -> Var23 (snoc23 g b) a)\n -> Var23 g a\n\nvz23 : {g : _}-> {a : _} -> Var23 (snoc23 g a) a\nvz23 = \\ var, vz23, vs => vz23 _ _\n\nvs23 : {g : _} -> {B : _} -> {a : _} -> Var23 g a -> Var23 (snoc23 g B) a\nvs23 = \\ x, var, vz23, vs23 => vs23 _ _ _ (x var vz23 vs23)\n\nTm23 : Con23 -> Ty23 -> Type\nTm23 = \\ g, a =>\n    (Tm23    : Con23 -> Ty23 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var23 g a -> Tm23 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm23 (snoc23 g a) B -> Tm23 g (arr23 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm23 g (arr23 a B) -> Tm23 g a -> Tm23 g B)\n -> Tm23 g a\n\nvar23 : {g : _} -> {a : _} -> Var23 g a -> Tm23 g a\nvar23 = \\ x, tm, var23, lam, app => var23 _ _ x\n\nlam23 : {g : _} -> {a : _} -> {B : _} -> Tm23 (snoc23 g a) B -> Tm23 g (arr23 a B)\nlam23 = \\ t, tm, var23, lam23, app => lam23 _ _ _ (t tm var23 lam23 app)\n\napp23 : {g:_}->{a:_}->{B:_} -> Tm23 g (arr23 a B) -> Tm23 g a -> Tm23 g B\napp23 = \\ t, u, tm, var23, lam23, app23 => app23 _ _ _ (t tm var23 lam23 app23) (u tm var23 lam23 app23)\n\nv023 : {g:_}->{a:_} -> Tm23 (snoc23 g a) a\nv023 = var23 vz23\n\nv123 : {g:_}->{a:_}-> {B:_}-> Tm23 (snoc23 (snoc23 g a) B) a\nv123 = var23 (vs23 vz23)\n\nv223 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm23 (snoc23 (snoc23 (snoc23 g a) B) C) a\nv223 = var23 (vs23 (vs23 vz23))\n\nv323 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm23 (snoc23 (snoc23 (snoc23 (snoc23 g a) B) C) D) a\nv323 = var23 (vs23 (vs23 (vs23 vz23)))\n\nv423 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm23 (snoc23 (snoc23 (snoc23 (snoc23 (snoc23 g a) B) C) D) E) a\nv423 = var23 (vs23 (vs23 (vs23 (vs23 vz23))))\n\ntest23 : {g:_}-> {a:_} -> Tm23 g (arr23 (arr23 a a) (arr23 a a))\ntest23  = lam23 (lam23 (app23 v123 (app23 v123 (app23 v123 (app23 v123 (app23 v123 (app23 v123 v023)))))))\nTy24 : Type\nTy24 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty24 : Ty24\nempty24 = \\ _, empty, _ => empty\n\narr24 : Ty24 -> Ty24 -> Ty24\narr24 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon24 : Type\nCon24 = (Con24 : Type)\n ->(nil  : Con24)\n ->(snoc : Con24 -> Ty24 -> Con24)\n -> Con24\n\nnil24 : Con24\nnil24 = \\ con, nil24, snoc => nil24\n\nsnoc24 : Con24 -> Ty24 -> Con24\nsnoc24 = \\ g, a, con, nil24, snoc24 => snoc24 (g con nil24 snoc24) a\n\nVar24 : Con24 -> Ty24 -> Type\nVar24 = \\ g, a =>\n    (Var24 : Con24 -> Ty24 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var24 (snoc24 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var24 g a -> Var24 (snoc24 g b) a)\n -> Var24 g a\n\nvz24 : {g : _}-> {a : _} -> Var24 (snoc24 g a) a\nvz24 = \\ var, vz24, vs => vz24 _ _\n\nvs24 : {g : _} -> {B : _} -> {a : _} -> Var24 g a -> Var24 (snoc24 g B) a\nvs24 = \\ x, var, vz24, vs24 => vs24 _ _ _ (x var vz24 vs24)\n\nTm24 : Con24 -> Ty24 -> Type\nTm24 = \\ g, a =>\n    (Tm24    : Con24 -> Ty24 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var24 g a -> Tm24 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm24 (snoc24 g a) B -> Tm24 g (arr24 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm24 g (arr24 a B) -> Tm24 g a -> Tm24 g B)\n -> Tm24 g a\n\nvar24 : {g : _} -> {a : _} -> Var24 g a -> Tm24 g a\nvar24 = \\ x, tm, var24, lam, app => var24 _ _ x\n\nlam24 : {g : _} -> {a : _} -> {B : _} -> Tm24 (snoc24 g a) B -> Tm24 g (arr24 a B)\nlam24 = \\ t, tm, var24, lam24, app => lam24 _ _ _ (t tm var24 lam24 app)\n\napp24 : {g:_}->{a:_}->{B:_} -> Tm24 g (arr24 a B) -> Tm24 g a -> Tm24 g B\napp24 = \\ t, u, tm, var24, lam24, app24 => app24 _ _ _ (t tm var24 lam24 app24) (u tm var24 lam24 app24)\n\nv024 : {g:_}->{a:_} -> Tm24 (snoc24 g a) a\nv024 = var24 vz24\n\nv124 : {g:_}->{a:_}-> {B:_}-> Tm24 (snoc24 (snoc24 g a) B) a\nv124 = var24 (vs24 vz24)\n\nv224 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm24 (snoc24 (snoc24 (snoc24 g a) B) C) a\nv224 = var24 (vs24 (vs24 vz24))\n\nv324 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm24 (snoc24 (snoc24 (snoc24 (snoc24 g a) B) C) D) a\nv324 = var24 (vs24 (vs24 (vs24 vz24)))\n\nv424 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm24 (snoc24 (snoc24 (snoc24 (snoc24 (snoc24 g a) B) C) D) E) a\nv424 = var24 (vs24 (vs24 (vs24 (vs24 vz24))))\n\ntest24 : {g:_}-> {a:_} -> Tm24 g (arr24 (arr24 a a) (arr24 a a))\ntest24  = lam24 (lam24 (app24 v124 (app24 v124 (app24 v124 (app24 v124 (app24 v124 (app24 v124 v024)))))))\nTy25 : Type\nTy25 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty25 : Ty25\nempty25 = \\ _, empty, _ => empty\n\narr25 : Ty25 -> Ty25 -> Ty25\narr25 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon25 : Type\nCon25 = (Con25 : Type)\n ->(nil  : Con25)\n ->(snoc : Con25 -> Ty25 -> Con25)\n -> Con25\n\nnil25 : Con25\nnil25 = \\ con, nil25, snoc => nil25\n\nsnoc25 : Con25 -> Ty25 -> Con25\nsnoc25 = \\ g, a, con, nil25, snoc25 => snoc25 (g con nil25 snoc25) a\n\nVar25 : Con25 -> Ty25 -> Type\nVar25 = \\ g, a =>\n    (Var25 : Con25 -> Ty25 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var25 (snoc25 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var25 g a -> Var25 (snoc25 g b) a)\n -> Var25 g a\n\nvz25 : {g : _}-> {a : _} -> Var25 (snoc25 g a) a\nvz25 = \\ var, vz25, vs => vz25 _ _\n\nvs25 : {g : _} -> {B : _} -> {a : _} -> Var25 g a -> Var25 (snoc25 g B) a\nvs25 = \\ x, var, vz25, vs25 => vs25 _ _ _ (x var vz25 vs25)\n\nTm25 : Con25 -> Ty25 -> Type\nTm25 = \\ g, a =>\n    (Tm25    : Con25 -> Ty25 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var25 g a -> Tm25 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm25 (snoc25 g a) B -> Tm25 g (arr25 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm25 g (arr25 a B) -> Tm25 g a -> Tm25 g B)\n -> Tm25 g a\n\nvar25 : {g : _} -> {a : _} -> Var25 g a -> Tm25 g a\nvar25 = \\ x, tm, var25, lam, app => var25 _ _ x\n\nlam25 : {g : _} -> {a : _} -> {B : _} -> Tm25 (snoc25 g a) B -> Tm25 g (arr25 a B)\nlam25 = \\ t, tm, var25, lam25, app => lam25 _ _ _ (t tm var25 lam25 app)\n\napp25 : {g:_}->{a:_}->{B:_} -> Tm25 g (arr25 a B) -> Tm25 g a -> Tm25 g B\napp25 = \\ t, u, tm, var25, lam25, app25 => app25 _ _ _ (t tm var25 lam25 app25) (u tm var25 lam25 app25)\n\nv025 : {g:_}->{a:_} -> Tm25 (snoc25 g a) a\nv025 = var25 vz25\n\nv125 : {g:_}->{a:_}-> {B:_}-> Tm25 (snoc25 (snoc25 g a) B) a\nv125 = var25 (vs25 vz25)\n\nv225 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm25 (snoc25 (snoc25 (snoc25 g a) B) C) a\nv225 = var25 (vs25 (vs25 vz25))\n\nv325 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm25 (snoc25 (snoc25 (snoc25 (snoc25 g a) B) C) D) a\nv325 = var25 (vs25 (vs25 (vs25 vz25)))\n\nv425 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm25 (snoc25 (snoc25 (snoc25 (snoc25 (snoc25 g a) B) C) D) E) a\nv425 = var25 (vs25 (vs25 (vs25 (vs25 vz25))))\n\ntest25 : {g:_}-> {a:_} -> Tm25 g (arr25 (arr25 a a) (arr25 a a))\ntest25  = lam25 (lam25 (app25 v125 (app25 v125 (app25 v125 (app25 v125 (app25 v125 (app25 v125 v025)))))))\nTy26 : Type\nTy26 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty26 : Ty26\nempty26 = \\ _, empty, _ => empty\n\narr26 : Ty26 -> Ty26 -> Ty26\narr26 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon26 : Type\nCon26 = (Con26 : Type)\n ->(nil  : Con26)\n ->(snoc : Con26 -> Ty26 -> Con26)\n -> Con26\n\nnil26 : Con26\nnil26 = \\ con, nil26, snoc => nil26\n\nsnoc26 : Con26 -> Ty26 -> Con26\nsnoc26 = \\ g, a, con, nil26, snoc26 => snoc26 (g con nil26 snoc26) a\n\nVar26 : Con26 -> Ty26 -> Type\nVar26 = \\ g, a =>\n    (Var26 : Con26 -> Ty26 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var26 (snoc26 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var26 g a -> Var26 (snoc26 g b) a)\n -> Var26 g a\n\nvz26 : {g : _}-> {a : _} -> Var26 (snoc26 g a) a\nvz26 = \\ var, vz26, vs => vz26 _ _\n\nvs26 : {g : _} -> {B : _} -> {a : _} -> Var26 g a -> Var26 (snoc26 g B) a\nvs26 = \\ x, var, vz26, vs26 => vs26 _ _ _ (x var vz26 vs26)\n\nTm26 : Con26 -> Ty26 -> Type\nTm26 = \\ g, a =>\n    (Tm26    : Con26 -> Ty26 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var26 g a -> Tm26 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm26 (snoc26 g a) B -> Tm26 g (arr26 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm26 g (arr26 a B) -> Tm26 g a -> Tm26 g B)\n -> Tm26 g a\n\nvar26 : {g : _} -> {a : _} -> Var26 g a -> Tm26 g a\nvar26 = \\ x, tm, var26, lam, app => var26 _ _ x\n\nlam26 : {g : _} -> {a : _} -> {B : _} -> Tm26 (snoc26 g a) B -> Tm26 g (arr26 a B)\nlam26 = \\ t, tm, var26, lam26, app => lam26 _ _ _ (t tm var26 lam26 app)\n\napp26 : {g:_}->{a:_}->{B:_} -> Tm26 g (arr26 a B) -> Tm26 g a -> Tm26 g B\napp26 = \\ t, u, tm, var26, lam26, app26 => app26 _ _ _ (t tm var26 lam26 app26) (u tm var26 lam26 app26)\n\nv026 : {g:_}->{a:_} -> Tm26 (snoc26 g a) a\nv026 = var26 vz26\n\nv126 : {g:_}->{a:_}-> {B:_}-> Tm26 (snoc26 (snoc26 g a) B) a\nv126 = var26 (vs26 vz26)\n\nv226 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm26 (snoc26 (snoc26 (snoc26 g a) B) C) a\nv226 = var26 (vs26 (vs26 vz26))\n\nv326 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm26 (snoc26 (snoc26 (snoc26 (snoc26 g a) B) C) D) a\nv326 = var26 (vs26 (vs26 (vs26 vz26)))\n\nv426 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm26 (snoc26 (snoc26 (snoc26 (snoc26 (snoc26 g a) B) C) D) E) a\nv426 = var26 (vs26 (vs26 (vs26 (vs26 vz26))))\n\ntest26 : {g:_}-> {a:_} -> Tm26 g (arr26 (arr26 a a) (arr26 a a))\ntest26  = lam26 (lam26 (app26 v126 (app26 v126 (app26 v126 (app26 v126 (app26 v126 (app26 v126 v026)))))))\nTy27 : Type\nTy27 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty27 : Ty27\nempty27 = \\ _, empty, _ => empty\n\narr27 : Ty27 -> Ty27 -> Ty27\narr27 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon27 : Type\nCon27 = (Con27 : Type)\n ->(nil  : Con27)\n ->(snoc : Con27 -> Ty27 -> Con27)\n -> Con27\n\nnil27 : Con27\nnil27 = \\ con, nil27, snoc => nil27\n\nsnoc27 : Con27 -> Ty27 -> Con27\nsnoc27 = \\ g, a, con, nil27, snoc27 => snoc27 (g con nil27 snoc27) a\n\nVar27 : Con27 -> Ty27 -> Type\nVar27 = \\ g, a =>\n    (Var27 : Con27 -> Ty27 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var27 (snoc27 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var27 g a -> Var27 (snoc27 g b) a)\n -> Var27 g a\n\nvz27 : {g : _}-> {a : _} -> Var27 (snoc27 g a) a\nvz27 = \\ var, vz27, vs => vz27 _ _\n\nvs27 : {g : _} -> {B : _} -> {a : _} -> Var27 g a -> Var27 (snoc27 g B) a\nvs27 = \\ x, var, vz27, vs27 => vs27 _ _ _ (x var vz27 vs27)\n\nTm27 : Con27 -> Ty27 -> Type\nTm27 = \\ g, a =>\n    (Tm27    : Con27 -> Ty27 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var27 g a -> Tm27 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm27 (snoc27 g a) B -> Tm27 g (arr27 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm27 g (arr27 a B) -> Tm27 g a -> Tm27 g B)\n -> Tm27 g a\n\nvar27 : {g : _} -> {a : _} -> Var27 g a -> Tm27 g a\nvar27 = \\ x, tm, var27, lam, app => var27 _ _ x\n\nlam27 : {g : _} -> {a : _} -> {B : _} -> Tm27 (snoc27 g a) B -> Tm27 g (arr27 a B)\nlam27 = \\ t, tm, var27, lam27, app => lam27 _ _ _ (t tm var27 lam27 app)\n\napp27 : {g:_}->{a:_}->{B:_} -> Tm27 g (arr27 a B) -> Tm27 g a -> Tm27 g B\napp27 = \\ t, u, tm, var27, lam27, app27 => app27 _ _ _ (t tm var27 lam27 app27) (u tm var27 lam27 app27)\n\nv027 : {g:_}->{a:_} -> Tm27 (snoc27 g a) a\nv027 = var27 vz27\n\nv127 : {g:_}->{a:_}-> {B:_}-> Tm27 (snoc27 (snoc27 g a) B) a\nv127 = var27 (vs27 vz27)\n\nv227 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm27 (snoc27 (snoc27 (snoc27 g a) B) C) a\nv227 = var27 (vs27 (vs27 vz27))\n\nv327 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm27 (snoc27 (snoc27 (snoc27 (snoc27 g a) B) C) D) a\nv327 = var27 (vs27 (vs27 (vs27 vz27)))\n\nv427 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm27 (snoc27 (snoc27 (snoc27 (snoc27 (snoc27 g a) B) C) D) E) a\nv427 = var27 (vs27 (vs27 (vs27 (vs27 vz27))))\n\ntest27 : {g:_}-> {a:_} -> Tm27 g (arr27 (arr27 a a) (arr27 a a))\ntest27  = lam27 (lam27 (app27 v127 (app27 v127 (app27 v127 (app27 v127 (app27 v127 (app27 v127 v027)))))))\nTy28 : Type\nTy28 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty28 : Ty28\nempty28 = \\ _, empty, _ => empty\n\narr28 : Ty28 -> Ty28 -> Ty28\narr28 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon28 : Type\nCon28 = (Con28 : Type)\n ->(nil  : Con28)\n ->(snoc : Con28 -> Ty28 -> Con28)\n -> Con28\n\nnil28 : Con28\nnil28 = \\ con, nil28, snoc => nil28\n\nsnoc28 : Con28 -> Ty28 -> Con28\nsnoc28 = \\ g, a, con, nil28, snoc28 => snoc28 (g con nil28 snoc28) a\n\nVar28 : Con28 -> Ty28 -> Type\nVar28 = \\ g, a =>\n    (Var28 : Con28 -> Ty28 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var28 (snoc28 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var28 g a -> Var28 (snoc28 g b) a)\n -> Var28 g a\n\nvz28 : {g : _}-> {a : _} -> Var28 (snoc28 g a) a\nvz28 = \\ var, vz28, vs => vz28 _ _\n\nvs28 : {g : _} -> {B : _} -> {a : _} -> Var28 g a -> Var28 (snoc28 g B) a\nvs28 = \\ x, var, vz28, vs28 => vs28 _ _ _ (x var vz28 vs28)\n\nTm28 : Con28 -> Ty28 -> Type\nTm28 = \\ g, a =>\n    (Tm28    : Con28 -> Ty28 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var28 g a -> Tm28 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm28 (snoc28 g a) B -> Tm28 g (arr28 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm28 g (arr28 a B) -> Tm28 g a -> Tm28 g B)\n -> Tm28 g a\n\nvar28 : {g : _} -> {a : _} -> Var28 g a -> Tm28 g a\nvar28 = \\ x, tm, var28, lam, app => var28 _ _ x\n\nlam28 : {g : _} -> {a : _} -> {B : _} -> Tm28 (snoc28 g a) B -> Tm28 g (arr28 a B)\nlam28 = \\ t, tm, var28, lam28, app => lam28 _ _ _ (t tm var28 lam28 app)\n\napp28 : {g:_}->{a:_}->{B:_} -> Tm28 g (arr28 a B) -> Tm28 g a -> Tm28 g B\napp28 = \\ t, u, tm, var28, lam28, app28 => app28 _ _ _ (t tm var28 lam28 app28) (u tm var28 lam28 app28)\n\nv028 : {g:_}->{a:_} -> Tm28 (snoc28 g a) a\nv028 = var28 vz28\n\nv128 : {g:_}->{a:_}-> {B:_}-> Tm28 (snoc28 (snoc28 g a) B) a\nv128 = var28 (vs28 vz28)\n\nv228 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm28 (snoc28 (snoc28 (snoc28 g a) B) C) a\nv228 = var28 (vs28 (vs28 vz28))\n\nv328 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm28 (snoc28 (snoc28 (snoc28 (snoc28 g a) B) C) D) a\nv328 = var28 (vs28 (vs28 (vs28 vz28)))\n\nv428 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm28 (snoc28 (snoc28 (snoc28 (snoc28 (snoc28 g a) B) C) D) E) a\nv428 = var28 (vs28 (vs28 (vs28 (vs28 vz28))))\n\ntest28 : {g:_}-> {a:_} -> Tm28 g (arr28 (arr28 a a) (arr28 a a))\ntest28  = lam28 (lam28 (app28 v128 (app28 v128 (app28 v128 (app28 v128 (app28 v128 (app28 v128 v028)))))))\nTy29 : Type\nTy29 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty29 : Ty29\nempty29 = \\ _, empty, _ => empty\n\narr29 : Ty29 -> Ty29 -> Ty29\narr29 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon29 : Type\nCon29 = (Con29 : Type)\n ->(nil  : Con29)\n ->(snoc : Con29 -> Ty29 -> Con29)\n -> Con29\n\nnil29 : Con29\nnil29 = \\ con, nil29, snoc => nil29\n\nsnoc29 : Con29 -> Ty29 -> Con29\nsnoc29 = \\ g, a, con, nil29, snoc29 => snoc29 (g con nil29 snoc29) a\n\nVar29 : Con29 -> Ty29 -> Type\nVar29 = \\ g, a =>\n    (Var29 : Con29 -> Ty29 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var29 (snoc29 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var29 g a -> Var29 (snoc29 g b) a)\n -> Var29 g a\n\nvz29 : {g : _}-> {a : _} -> Var29 (snoc29 g a) a\nvz29 = \\ var, vz29, vs => vz29 _ _\n\nvs29 : {g : _} -> {B : _} -> {a : _} -> Var29 g a -> Var29 (snoc29 g B) a\nvs29 = \\ x, var, vz29, vs29 => vs29 _ _ _ (x var vz29 vs29)\n\nTm29 : Con29 -> Ty29 -> Type\nTm29 = \\ g, a =>\n    (Tm29    : Con29 -> Ty29 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var29 g a -> Tm29 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm29 (snoc29 g a) B -> Tm29 g (arr29 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm29 g (arr29 a B) -> Tm29 g a -> Tm29 g B)\n -> Tm29 g a\n\nvar29 : {g : _} -> {a : _} -> Var29 g a -> Tm29 g a\nvar29 = \\ x, tm, var29, lam, app => var29 _ _ x\n\nlam29 : {g : _} -> {a : _} -> {B : _} -> Tm29 (snoc29 g a) B -> Tm29 g (arr29 a B)\nlam29 = \\ t, tm, var29, lam29, app => lam29 _ _ _ (t tm var29 lam29 app)\n\napp29 : {g:_}->{a:_}->{B:_} -> Tm29 g (arr29 a B) -> Tm29 g a -> Tm29 g B\napp29 = \\ t, u, tm, var29, lam29, app29 => app29 _ _ _ (t tm var29 lam29 app29) (u tm var29 lam29 app29)\n\nv029 : {g:_}->{a:_} -> Tm29 (snoc29 g a) a\nv029 = var29 vz29\n\nv129 : {g:_}->{a:_}-> {B:_}-> Tm29 (snoc29 (snoc29 g a) B) a\nv129 = var29 (vs29 vz29)\n\nv229 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm29 (snoc29 (snoc29 (snoc29 g a) B) C) a\nv229 = var29 (vs29 (vs29 vz29))\n\nv329 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm29 (snoc29 (snoc29 (snoc29 (snoc29 g a) B) C) D) a\nv329 = var29 (vs29 (vs29 (vs29 vz29)))\n\nv429 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm29 (snoc29 (snoc29 (snoc29 (snoc29 (snoc29 g a) B) C) D) E) a\nv429 = var29 (vs29 (vs29 (vs29 (vs29 vz29))))\n\ntest29 : {g:_}-> {a:_} -> Tm29 g (arr29 (arr29 a a) (arr29 a a))\ntest29  = lam29 (lam29 (app29 v129 (app29 v129 (app29 v129 (app29 v129 (app29 v129 (app29 v129 v029)))))))\nTy30 : Type\nTy30 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty30 : Ty30\nempty30 = \\ _, empty, _ => empty\n\narr30 : Ty30 -> Ty30 -> Ty30\narr30 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon30 : Type\nCon30 = (Con30 : Type)\n ->(nil  : Con30)\n ->(snoc : Con30 -> Ty30 -> Con30)\n -> Con30\n\nnil30 : Con30\nnil30 = \\ con, nil30, snoc => nil30\n\nsnoc30 : Con30 -> Ty30 -> Con30\nsnoc30 = \\ g, a, con, nil30, snoc30 => snoc30 (g con nil30 snoc30) a\n\nVar30 : Con30 -> Ty30 -> Type\nVar30 = \\ g, a =>\n    (Var30 : Con30 -> Ty30 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var30 (snoc30 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var30 g a -> Var30 (snoc30 g b) a)\n -> Var30 g a\n\nvz30 : {g : _}-> {a : _} -> Var30 (snoc30 g a) a\nvz30 = \\ var, vz30, vs => vz30 _ _\n\nvs30 : {g : _} -> {B : _} -> {a : _} -> Var30 g a -> Var30 (snoc30 g B) a\nvs30 = \\ x, var, vz30, vs30 => vs30 _ _ _ (x var vz30 vs30)\n\nTm30 : Con30 -> Ty30 -> Type\nTm30 = \\ g, a =>\n    (Tm30    : Con30 -> Ty30 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var30 g a -> Tm30 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm30 (snoc30 g a) B -> Tm30 g (arr30 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm30 g (arr30 a B) -> Tm30 g a -> Tm30 g B)\n -> Tm30 g a\n\nvar30 : {g : _} -> {a : _} -> Var30 g a -> Tm30 g a\nvar30 = \\ x, tm, var30, lam, app => var30 _ _ x\n\nlam30 : {g : _} -> {a : _} -> {B : _} -> Tm30 (snoc30 g a) B -> Tm30 g (arr30 a B)\nlam30 = \\ t, tm, var30, lam30, app => lam30 _ _ _ (t tm var30 lam30 app)\n\napp30 : {g:_}->{a:_}->{B:_} -> Tm30 g (arr30 a B) -> Tm30 g a -> Tm30 g B\napp30 = \\ t, u, tm, var30, lam30, app30 => app30 _ _ _ (t tm var30 lam30 app30) (u tm var30 lam30 app30)\n\nv030 : {g:_}->{a:_} -> Tm30 (snoc30 g a) a\nv030 = var30 vz30\n\nv130 : {g:_}->{a:_}-> {B:_}-> Tm30 (snoc30 (snoc30 g a) B) a\nv130 = var30 (vs30 vz30)\n\nv230 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm30 (snoc30 (snoc30 (snoc30 g a) B) C) a\nv230 = var30 (vs30 (vs30 vz30))\n\nv330 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm30 (snoc30 (snoc30 (snoc30 (snoc30 g a) B) C) D) a\nv330 = var30 (vs30 (vs30 (vs30 vz30)))\n\nv430 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm30 (snoc30 (snoc30 (snoc30 (snoc30 (snoc30 g a) B) C) D) E) a\nv430 = var30 (vs30 (vs30 (vs30 (vs30 vz30))))\n\ntest30 : {g:_}-> {a:_} -> Tm30 g (arr30 (arr30 a a) (arr30 a a))\ntest30  = lam30 (lam30 (app30 v130 (app30 v130 (app30 v130 (app30 v130 (app30 v130 (app30 v130 v030)))))))\nTy31 : Type\nTy31 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty31 : Ty31\nempty31 = \\ _, empty, _ => empty\n\narr31 : Ty31 -> Ty31 -> Ty31\narr31 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon31 : Type\nCon31 = (Con31 : Type)\n ->(nil  : Con31)\n ->(snoc : Con31 -> Ty31 -> Con31)\n -> Con31\n\nnil31 : Con31\nnil31 = \\ con, nil31, snoc => nil31\n\nsnoc31 : Con31 -> Ty31 -> Con31\nsnoc31 = \\ g, a, con, nil31, snoc31 => snoc31 (g con nil31 snoc31) a\n\nVar31 : Con31 -> Ty31 -> Type\nVar31 = \\ g, a =>\n    (Var31 : Con31 -> Ty31 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var31 (snoc31 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var31 g a -> Var31 (snoc31 g b) a)\n -> Var31 g a\n\nvz31 : {g : _}-> {a : _} -> Var31 (snoc31 g a) a\nvz31 = \\ var, vz31, vs => vz31 _ _\n\nvs31 : {g : _} -> {B : _} -> {a : _} -> Var31 g a -> Var31 (snoc31 g B) a\nvs31 = \\ x, var, vz31, vs31 => vs31 _ _ _ (x var vz31 vs31)\n\nTm31 : Con31 -> Ty31 -> Type\nTm31 = \\ g, a =>\n    (Tm31    : Con31 -> Ty31 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var31 g a -> Tm31 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm31 (snoc31 g a) B -> Tm31 g (arr31 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm31 g (arr31 a B) -> Tm31 g a -> Tm31 g B)\n -> Tm31 g a\n\nvar31 : {g : _} -> {a : _} -> Var31 g a -> Tm31 g a\nvar31 = \\ x, tm, var31, lam, app => var31 _ _ x\n\nlam31 : {g : _} -> {a : _} -> {B : _} -> Tm31 (snoc31 g a) B -> Tm31 g (arr31 a B)\nlam31 = \\ t, tm, var31, lam31, app => lam31 _ _ _ (t tm var31 lam31 app)\n\napp31 : {g:_}->{a:_}->{B:_} -> Tm31 g (arr31 a B) -> Tm31 g a -> Tm31 g B\napp31 = \\ t, u, tm, var31, lam31, app31 => app31 _ _ _ (t tm var31 lam31 app31) (u tm var31 lam31 app31)\n\nv031 : {g:_}->{a:_} -> Tm31 (snoc31 g a) a\nv031 = var31 vz31\n\nv131 : {g:_}->{a:_}-> {B:_}-> Tm31 (snoc31 (snoc31 g a) B) a\nv131 = var31 (vs31 vz31)\n\nv231 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm31 (snoc31 (snoc31 (snoc31 g a) B) C) a\nv231 = var31 (vs31 (vs31 vz31))\n\nv331 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm31 (snoc31 (snoc31 (snoc31 (snoc31 g a) B) C) D) a\nv331 = var31 (vs31 (vs31 (vs31 vz31)))\n\nv431 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm31 (snoc31 (snoc31 (snoc31 (snoc31 (snoc31 g a) B) C) D) E) a\nv431 = var31 (vs31 (vs31 (vs31 (vs31 vz31))))\n\ntest31 : {g:_}-> {a:_} -> Tm31 g (arr31 (arr31 a a) (arr31 a a))\ntest31  = lam31 (lam31 (app31 v131 (app31 v131 (app31 v131 (app31 v131 (app31 v131 (app31 v131 v031)))))))\nTy32 : Type\nTy32 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty32 : Ty32\nempty32 = \\ _, empty, _ => empty\n\narr32 : Ty32 -> Ty32 -> Ty32\narr32 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon32 : Type\nCon32 = (Con32 : Type)\n ->(nil  : Con32)\n ->(snoc : Con32 -> Ty32 -> Con32)\n -> Con32\n\nnil32 : Con32\nnil32 = \\ con, nil32, snoc => nil32\n\nsnoc32 : Con32 -> Ty32 -> Con32\nsnoc32 = \\ g, a, con, nil32, snoc32 => snoc32 (g con nil32 snoc32) a\n\nVar32 : Con32 -> Ty32 -> Type\nVar32 = \\ g, a =>\n    (Var32 : Con32 -> Ty32 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var32 (snoc32 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var32 g a -> Var32 (snoc32 g b) a)\n -> Var32 g a\n\nvz32 : {g : _}-> {a : _} -> Var32 (snoc32 g a) a\nvz32 = \\ var, vz32, vs => vz32 _ _\n\nvs32 : {g : _} -> {B : _} -> {a : _} -> Var32 g a -> Var32 (snoc32 g B) a\nvs32 = \\ x, var, vz32, vs32 => vs32 _ _ _ (x var vz32 vs32)\n\nTm32 : Con32 -> Ty32 -> Type\nTm32 = \\ g, a =>\n    (Tm32    : Con32 -> Ty32 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var32 g a -> Tm32 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm32 (snoc32 g a) B -> Tm32 g (arr32 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm32 g (arr32 a B) -> Tm32 g a -> Tm32 g B)\n -> Tm32 g a\n\nvar32 : {g : _} -> {a : _} -> Var32 g a -> Tm32 g a\nvar32 = \\ x, tm, var32, lam, app => var32 _ _ x\n\nlam32 : {g : _} -> {a : _} -> {B : _} -> Tm32 (snoc32 g a) B -> Tm32 g (arr32 a B)\nlam32 = \\ t, tm, var32, lam32, app => lam32 _ _ _ (t tm var32 lam32 app)\n\napp32 : {g:_}->{a:_}->{B:_} -> Tm32 g (arr32 a B) -> Tm32 g a -> Tm32 g B\napp32 = \\ t, u, tm, var32, lam32, app32 => app32 _ _ _ (t tm var32 lam32 app32) (u tm var32 lam32 app32)\n\nv032 : {g:_}->{a:_} -> Tm32 (snoc32 g a) a\nv032 = var32 vz32\n\nv132 : {g:_}->{a:_}-> {B:_}-> Tm32 (snoc32 (snoc32 g a) B) a\nv132 = var32 (vs32 vz32)\n\nv232 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm32 (snoc32 (snoc32 (snoc32 g a) B) C) a\nv232 = var32 (vs32 (vs32 vz32))\n\nv332 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm32 (snoc32 (snoc32 (snoc32 (snoc32 g a) B) C) D) a\nv332 = var32 (vs32 (vs32 (vs32 vz32)))\n\nv432 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm32 (snoc32 (snoc32 (snoc32 (snoc32 (snoc32 g a) B) C) D) E) a\nv432 = var32 (vs32 (vs32 (vs32 (vs32 vz32))))\n\ntest32 : {g:_}-> {a:_} -> Tm32 g (arr32 (arr32 a a) (arr32 a a))\ntest32  = lam32 (lam32 (app32 v132 (app32 v132 (app32 v132 (app32 v132 (app32 v132 (app32 v132 v032)))))))\nTy33 : Type\nTy33 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty33 : Ty33\nempty33 = \\ _, empty, _ => empty\n\narr33 : Ty33 -> Ty33 -> Ty33\narr33 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon33 : Type\nCon33 = (Con33 : Type)\n ->(nil  : Con33)\n ->(snoc : Con33 -> Ty33 -> Con33)\n -> Con33\n\nnil33 : Con33\nnil33 = \\ con, nil33, snoc => nil33\n\nsnoc33 : Con33 -> Ty33 -> Con33\nsnoc33 = \\ g, a, con, nil33, snoc33 => snoc33 (g con nil33 snoc33) a\n\nVar33 : Con33 -> Ty33 -> Type\nVar33 = \\ g, a =>\n    (Var33 : Con33 -> Ty33 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var33 (snoc33 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var33 g a -> Var33 (snoc33 g b) a)\n -> Var33 g a\n\nvz33 : {g : _}-> {a : _} -> Var33 (snoc33 g a) a\nvz33 = \\ var, vz33, vs => vz33 _ _\n\nvs33 : {g : _} -> {B : _} -> {a : _} -> Var33 g a -> Var33 (snoc33 g B) a\nvs33 = \\ x, var, vz33, vs33 => vs33 _ _ _ (x var vz33 vs33)\n\nTm33 : Con33 -> Ty33 -> Type\nTm33 = \\ g, a =>\n    (Tm33    : Con33 -> Ty33 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var33 g a -> Tm33 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm33 (snoc33 g a) B -> Tm33 g (arr33 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm33 g (arr33 a B) -> Tm33 g a -> Tm33 g B)\n -> Tm33 g a\n\nvar33 : {g : _} -> {a : _} -> Var33 g a -> Tm33 g a\nvar33 = \\ x, tm, var33, lam, app => var33 _ _ x\n\nlam33 : {g : _} -> {a : _} -> {B : _} -> Tm33 (snoc33 g a) B -> Tm33 g (arr33 a B)\nlam33 = \\ t, tm, var33, lam33, app => lam33 _ _ _ (t tm var33 lam33 app)\n\napp33 : {g:_}->{a:_}->{B:_} -> Tm33 g (arr33 a B) -> Tm33 g a -> Tm33 g B\napp33 = \\ t, u, tm, var33, lam33, app33 => app33 _ _ _ (t tm var33 lam33 app33) (u tm var33 lam33 app33)\n\nv033 : {g:_}->{a:_} -> Tm33 (snoc33 g a) a\nv033 = var33 vz33\n\nv133 : {g:_}->{a:_}-> {B:_}-> Tm33 (snoc33 (snoc33 g a) B) a\nv133 = var33 (vs33 vz33)\n\nv233 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm33 (snoc33 (snoc33 (snoc33 g a) B) C) a\nv233 = var33 (vs33 (vs33 vz33))\n\nv333 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm33 (snoc33 (snoc33 (snoc33 (snoc33 g a) B) C) D) a\nv333 = var33 (vs33 (vs33 (vs33 vz33)))\n\nv433 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm33 (snoc33 (snoc33 (snoc33 (snoc33 (snoc33 g a) B) C) D) E) a\nv433 = var33 (vs33 (vs33 (vs33 (vs33 vz33))))\n\ntest33 : {g:_}-> {a:_} -> Tm33 g (arr33 (arr33 a a) (arr33 a a))\ntest33  = lam33 (lam33 (app33 v133 (app33 v133 (app33 v133 (app33 v133 (app33 v133 (app33 v133 v033)))))))\nTy34 : Type\nTy34 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty34 : Ty34\nempty34 = \\ _, empty, _ => empty\n\narr34 : Ty34 -> Ty34 -> Ty34\narr34 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon34 : Type\nCon34 = (Con34 : Type)\n ->(nil  : Con34)\n ->(snoc : Con34 -> Ty34 -> Con34)\n -> Con34\n\nnil34 : Con34\nnil34 = \\ con, nil34, snoc => nil34\n\nsnoc34 : Con34 -> Ty34 -> Con34\nsnoc34 = \\ g, a, con, nil34, snoc34 => snoc34 (g con nil34 snoc34) a\n\nVar34 : Con34 -> Ty34 -> Type\nVar34 = \\ g, a =>\n    (Var34 : Con34 -> Ty34 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var34 (snoc34 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var34 g a -> Var34 (snoc34 g b) a)\n -> Var34 g a\n\nvz34 : {g : _}-> {a : _} -> Var34 (snoc34 g a) a\nvz34 = \\ var, vz34, vs => vz34 _ _\n\nvs34 : {g : _} -> {B : _} -> {a : _} -> Var34 g a -> Var34 (snoc34 g B) a\nvs34 = \\ x, var, vz34, vs34 => vs34 _ _ _ (x var vz34 vs34)\n\nTm34 : Con34 -> Ty34 -> Type\nTm34 = \\ g, a =>\n    (Tm34    : Con34 -> Ty34 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var34 g a -> Tm34 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm34 (snoc34 g a) B -> Tm34 g (arr34 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm34 g (arr34 a B) -> Tm34 g a -> Tm34 g B)\n -> Tm34 g a\n\nvar34 : {g : _} -> {a : _} -> Var34 g a -> Tm34 g a\nvar34 = \\ x, tm, var34, lam, app => var34 _ _ x\n\nlam34 : {g : _} -> {a : _} -> {B : _} -> Tm34 (snoc34 g a) B -> Tm34 g (arr34 a B)\nlam34 = \\ t, tm, var34, lam34, app => lam34 _ _ _ (t tm var34 lam34 app)\n\napp34 : {g:_}->{a:_}->{B:_} -> Tm34 g (arr34 a B) -> Tm34 g a -> Tm34 g B\napp34 = \\ t, u, tm, var34, lam34, app34 => app34 _ _ _ (t tm var34 lam34 app34) (u tm var34 lam34 app34)\n\nv034 : {g:_}->{a:_} -> Tm34 (snoc34 g a) a\nv034 = var34 vz34\n\nv134 : {g:_}->{a:_}-> {B:_}-> Tm34 (snoc34 (snoc34 g a) B) a\nv134 = var34 (vs34 vz34)\n\nv234 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm34 (snoc34 (snoc34 (snoc34 g a) B) C) a\nv234 = var34 (vs34 (vs34 vz34))\n\nv334 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm34 (snoc34 (snoc34 (snoc34 (snoc34 g a) B) C) D) a\nv334 = var34 (vs34 (vs34 (vs34 vz34)))\n\nv434 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm34 (snoc34 (snoc34 (snoc34 (snoc34 (snoc34 g a) B) C) D) E) a\nv434 = var34 (vs34 (vs34 (vs34 (vs34 vz34))))\n\ntest34 : {g:_}-> {a:_} -> Tm34 g (arr34 (arr34 a a) (arr34 a a))\ntest34  = lam34 (lam34 (app34 v134 (app34 v134 (app34 v134 (app34 v134 (app34 v134 (app34 v134 v034)))))))\nTy35 : Type\nTy35 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty35 : Ty35\nempty35 = \\ _, empty, _ => empty\n\narr35 : Ty35 -> Ty35 -> Ty35\narr35 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon35 : Type\nCon35 = (Con35 : Type)\n ->(nil  : Con35)\n ->(snoc : Con35 -> Ty35 -> Con35)\n -> Con35\n\nnil35 : Con35\nnil35 = \\ con, nil35, snoc => nil35\n\nsnoc35 : Con35 -> Ty35 -> Con35\nsnoc35 = \\ g, a, con, nil35, snoc35 => snoc35 (g con nil35 snoc35) a\n\nVar35 : Con35 -> Ty35 -> Type\nVar35 = \\ g, a =>\n    (Var35 : Con35 -> Ty35 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var35 (snoc35 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var35 g a -> Var35 (snoc35 g b) a)\n -> Var35 g a\n\nvz35 : {g : _}-> {a : _} -> Var35 (snoc35 g a) a\nvz35 = \\ var, vz35, vs => vz35 _ _\n\nvs35 : {g : _} -> {B : _} -> {a : _} -> Var35 g a -> Var35 (snoc35 g B) a\nvs35 = \\ x, var, vz35, vs35 => vs35 _ _ _ (x var vz35 vs35)\n\nTm35 : Con35 -> Ty35 -> Type\nTm35 = \\ g, a =>\n    (Tm35    : Con35 -> Ty35 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var35 g a -> Tm35 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm35 (snoc35 g a) B -> Tm35 g (arr35 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm35 g (arr35 a B) -> Tm35 g a -> Tm35 g B)\n -> Tm35 g a\n\nvar35 : {g : _} -> {a : _} -> Var35 g a -> Tm35 g a\nvar35 = \\ x, tm, var35, lam, app => var35 _ _ x\n\nlam35 : {g : _} -> {a : _} -> {B : _} -> Tm35 (snoc35 g a) B -> Tm35 g (arr35 a B)\nlam35 = \\ t, tm, var35, lam35, app => lam35 _ _ _ (t tm var35 lam35 app)\n\napp35 : {g:_}->{a:_}->{B:_} -> Tm35 g (arr35 a B) -> Tm35 g a -> Tm35 g B\napp35 = \\ t, u, tm, var35, lam35, app35 => app35 _ _ _ (t tm var35 lam35 app35) (u tm var35 lam35 app35)\n\nv035 : {g:_}->{a:_} -> Tm35 (snoc35 g a) a\nv035 = var35 vz35\n\nv135 : {g:_}->{a:_}-> {B:_}-> Tm35 (snoc35 (snoc35 g a) B) a\nv135 = var35 (vs35 vz35)\n\nv235 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm35 (snoc35 (snoc35 (snoc35 g a) B) C) a\nv235 = var35 (vs35 (vs35 vz35))\n\nv335 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm35 (snoc35 (snoc35 (snoc35 (snoc35 g a) B) C) D) a\nv335 = var35 (vs35 (vs35 (vs35 vz35)))\n\nv435 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm35 (snoc35 (snoc35 (snoc35 (snoc35 (snoc35 g a) B) C) D) E) a\nv435 = var35 (vs35 (vs35 (vs35 (vs35 vz35))))\n\ntest35 : {g:_}-> {a:_} -> Tm35 g (arr35 (arr35 a a) (arr35 a a))\ntest35  = lam35 (lam35 (app35 v135 (app35 v135 (app35 v135 (app35 v135 (app35 v135 (app35 v135 v035)))))))\nTy36 : Type\nTy36 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty36 : Ty36\nempty36 = \\ _, empty, _ => empty\n\narr36 : Ty36 -> Ty36 -> Ty36\narr36 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon36 : Type\nCon36 = (Con36 : Type)\n ->(nil  : Con36)\n ->(snoc : Con36 -> Ty36 -> Con36)\n -> Con36\n\nnil36 : Con36\nnil36 = \\ con, nil36, snoc => nil36\n\nsnoc36 : Con36 -> Ty36 -> Con36\nsnoc36 = \\ g, a, con, nil36, snoc36 => snoc36 (g con nil36 snoc36) a\n\nVar36 : Con36 -> Ty36 -> Type\nVar36 = \\ g, a =>\n    (Var36 : Con36 -> Ty36 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var36 (snoc36 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var36 g a -> Var36 (snoc36 g b) a)\n -> Var36 g a\n\nvz36 : {g : _}-> {a : _} -> Var36 (snoc36 g a) a\nvz36 = \\ var, vz36, vs => vz36 _ _\n\nvs36 : {g : _} -> {B : _} -> {a : _} -> Var36 g a -> Var36 (snoc36 g B) a\nvs36 = \\ x, var, vz36, vs36 => vs36 _ _ _ (x var vz36 vs36)\n\nTm36 : Con36 -> Ty36 -> Type\nTm36 = \\ g, a =>\n    (Tm36    : Con36 -> Ty36 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var36 g a -> Tm36 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm36 (snoc36 g a) B -> Tm36 g (arr36 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm36 g (arr36 a B) -> Tm36 g a -> Tm36 g B)\n -> Tm36 g a\n\nvar36 : {g : _} -> {a : _} -> Var36 g a -> Tm36 g a\nvar36 = \\ x, tm, var36, lam, app => var36 _ _ x\n\nlam36 : {g : _} -> {a : _} -> {B : _} -> Tm36 (snoc36 g a) B -> Tm36 g (arr36 a B)\nlam36 = \\ t, tm, var36, lam36, app => lam36 _ _ _ (t tm var36 lam36 app)\n\napp36 : {g:_}->{a:_}->{B:_} -> Tm36 g (arr36 a B) -> Tm36 g a -> Tm36 g B\napp36 = \\ t, u, tm, var36, lam36, app36 => app36 _ _ _ (t tm var36 lam36 app36) (u tm var36 lam36 app36)\n\nv036 : {g:_}->{a:_} -> Tm36 (snoc36 g a) a\nv036 = var36 vz36\n\nv136 : {g:_}->{a:_}-> {B:_}-> Tm36 (snoc36 (snoc36 g a) B) a\nv136 = var36 (vs36 vz36)\n\nv236 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm36 (snoc36 (snoc36 (snoc36 g a) B) C) a\nv236 = var36 (vs36 (vs36 vz36))\n\nv336 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm36 (snoc36 (snoc36 (snoc36 (snoc36 g a) B) C) D) a\nv336 = var36 (vs36 (vs36 (vs36 vz36)))\n\nv436 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm36 (snoc36 (snoc36 (snoc36 (snoc36 (snoc36 g a) B) C) D) E) a\nv436 = var36 (vs36 (vs36 (vs36 (vs36 vz36))))\n\ntest36 : {g:_}-> {a:_} -> Tm36 g (arr36 (arr36 a a) (arr36 a a))\ntest36  = lam36 (lam36 (app36 v136 (app36 v136 (app36 v136 (app36 v136 (app36 v136 (app36 v136 v036)))))))\nTy37 : Type\nTy37 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty37 : Ty37\nempty37 = \\ _, empty, _ => empty\n\narr37 : Ty37 -> Ty37 -> Ty37\narr37 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon37 : Type\nCon37 = (Con37 : Type)\n ->(nil  : Con37)\n ->(snoc : Con37 -> Ty37 -> Con37)\n -> Con37\n\nnil37 : Con37\nnil37 = \\ con, nil37, snoc => nil37\n\nsnoc37 : Con37 -> Ty37 -> Con37\nsnoc37 = \\ g, a, con, nil37, snoc37 => snoc37 (g con nil37 snoc37) a\n\nVar37 : Con37 -> Ty37 -> Type\nVar37 = \\ g, a =>\n    (Var37 : Con37 -> Ty37 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var37 (snoc37 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var37 g a -> Var37 (snoc37 g b) a)\n -> Var37 g a\n\nvz37 : {g : _}-> {a : _} -> Var37 (snoc37 g a) a\nvz37 = \\ var, vz37, vs => vz37 _ _\n\nvs37 : {g : _} -> {B : _} -> {a : _} -> Var37 g a -> Var37 (snoc37 g B) a\nvs37 = \\ x, var, vz37, vs37 => vs37 _ _ _ (x var vz37 vs37)\n\nTm37 : Con37 -> Ty37 -> Type\nTm37 = \\ g, a =>\n    (Tm37    : Con37 -> Ty37 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var37 g a -> Tm37 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm37 (snoc37 g a) B -> Tm37 g (arr37 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm37 g (arr37 a B) -> Tm37 g a -> Tm37 g B)\n -> Tm37 g a\n\nvar37 : {g : _} -> {a : _} -> Var37 g a -> Tm37 g a\nvar37 = \\ x, tm, var37, lam, app => var37 _ _ x\n\nlam37 : {g : _} -> {a : _} -> {B : _} -> Tm37 (snoc37 g a) B -> Tm37 g (arr37 a B)\nlam37 = \\ t, tm, var37, lam37, app => lam37 _ _ _ (t tm var37 lam37 app)\n\napp37 : {g:_}->{a:_}->{B:_} -> Tm37 g (arr37 a B) -> Tm37 g a -> Tm37 g B\napp37 = \\ t, u, tm, var37, lam37, app37 => app37 _ _ _ (t tm var37 lam37 app37) (u tm var37 lam37 app37)\n\nv037 : {g:_}->{a:_} -> Tm37 (snoc37 g a) a\nv037 = var37 vz37\n\nv137 : {g:_}->{a:_}-> {B:_}-> Tm37 (snoc37 (snoc37 g a) B) a\nv137 = var37 (vs37 vz37)\n\nv237 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm37 (snoc37 (snoc37 (snoc37 g a) B) C) a\nv237 = var37 (vs37 (vs37 vz37))\n\nv337 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm37 (snoc37 (snoc37 (snoc37 (snoc37 g a) B) C) D) a\nv337 = var37 (vs37 (vs37 (vs37 vz37)))\n\nv437 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm37 (snoc37 (snoc37 (snoc37 (snoc37 (snoc37 g a) B) C) D) E) a\nv437 = var37 (vs37 (vs37 (vs37 (vs37 vz37))))\n\ntest37 : {g:_}-> {a:_} -> Tm37 g (arr37 (arr37 a a) (arr37 a a))\ntest37  = lam37 (lam37 (app37 v137 (app37 v137 (app37 v137 (app37 v137 (app37 v137 (app37 v137 v037)))))))\nTy38 : Type\nTy38 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty38 : Ty38\nempty38 = \\ _, empty, _ => empty\n\narr38 : Ty38 -> Ty38 -> Ty38\narr38 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon38 : Type\nCon38 = (Con38 : Type)\n ->(nil  : Con38)\n ->(snoc : Con38 -> Ty38 -> Con38)\n -> Con38\n\nnil38 : Con38\nnil38 = \\ con, nil38, snoc => nil38\n\nsnoc38 : Con38 -> Ty38 -> Con38\nsnoc38 = \\ g, a, con, nil38, snoc38 => snoc38 (g con nil38 snoc38) a\n\nVar38 : Con38 -> Ty38 -> Type\nVar38 = \\ g, a =>\n    (Var38 : Con38 -> Ty38 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var38 (snoc38 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var38 g a -> Var38 (snoc38 g b) a)\n -> Var38 g a\n\nvz38 : {g : _}-> {a : _} -> Var38 (snoc38 g a) a\nvz38 = \\ var, vz38, vs => vz38 _ _\n\nvs38 : {g : _} -> {B : _} -> {a : _} -> Var38 g a -> Var38 (snoc38 g B) a\nvs38 = \\ x, var, vz38, vs38 => vs38 _ _ _ (x var vz38 vs38)\n\nTm38 : Con38 -> Ty38 -> Type\nTm38 = \\ g, a =>\n    (Tm38    : Con38 -> Ty38 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var38 g a -> Tm38 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm38 (snoc38 g a) B -> Tm38 g (arr38 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm38 g (arr38 a B) -> Tm38 g a -> Tm38 g B)\n -> Tm38 g a\n\nvar38 : {g : _} -> {a : _} -> Var38 g a -> Tm38 g a\nvar38 = \\ x, tm, var38, lam, app => var38 _ _ x\n\nlam38 : {g : _} -> {a : _} -> {B : _} -> Tm38 (snoc38 g a) B -> Tm38 g (arr38 a B)\nlam38 = \\ t, tm, var38, lam38, app => lam38 _ _ _ (t tm var38 lam38 app)\n\napp38 : {g:_}->{a:_}->{B:_} -> Tm38 g (arr38 a B) -> Tm38 g a -> Tm38 g B\napp38 = \\ t, u, tm, var38, lam38, app38 => app38 _ _ _ (t tm var38 lam38 app38) (u tm var38 lam38 app38)\n\nv038 : {g:_}->{a:_} -> Tm38 (snoc38 g a) a\nv038 = var38 vz38\n\nv138 : {g:_}->{a:_}-> {B:_}-> Tm38 (snoc38 (snoc38 g a) B) a\nv138 = var38 (vs38 vz38)\n\nv238 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm38 (snoc38 (snoc38 (snoc38 g a) B) C) a\nv238 = var38 (vs38 (vs38 vz38))\n\nv338 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm38 (snoc38 (snoc38 (snoc38 (snoc38 g a) B) C) D) a\nv338 = var38 (vs38 (vs38 (vs38 vz38)))\n\nv438 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm38 (snoc38 (snoc38 (snoc38 (snoc38 (snoc38 g a) B) C) D) E) a\nv438 = var38 (vs38 (vs38 (vs38 (vs38 vz38))))\n\ntest38 : {g:_}-> {a:_} -> Tm38 g (arr38 (arr38 a a) (arr38 a a))\ntest38  = lam38 (lam38 (app38 v138 (app38 v138 (app38 v138 (app38 v138 (app38 v138 (app38 v138 v038)))))))\nTy39 : Type\nTy39 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty39 : Ty39\nempty39 = \\ _, empty, _ => empty\n\narr39 : Ty39 -> Ty39 -> Ty39\narr39 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon39 : Type\nCon39 = (Con39 : Type)\n ->(nil  : Con39)\n ->(snoc : Con39 -> Ty39 -> Con39)\n -> Con39\n\nnil39 : Con39\nnil39 = \\ con, nil39, snoc => nil39\n\nsnoc39 : Con39 -> Ty39 -> Con39\nsnoc39 = \\ g, a, con, nil39, snoc39 => snoc39 (g con nil39 snoc39) a\n\nVar39 : Con39 -> Ty39 -> Type\nVar39 = \\ g, a =>\n    (Var39 : Con39 -> Ty39 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var39 (snoc39 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var39 g a -> Var39 (snoc39 g b) a)\n -> Var39 g a\n\nvz39 : {g : _}-> {a : _} -> Var39 (snoc39 g a) a\nvz39 = \\ var, vz39, vs => vz39 _ _\n\nvs39 : {g : _} -> {B : _} -> {a : _} -> Var39 g a -> Var39 (snoc39 g B) a\nvs39 = \\ x, var, vz39, vs39 => vs39 _ _ _ (x var vz39 vs39)\n\nTm39 : Con39 -> Ty39 -> Type\nTm39 = \\ g, a =>\n    (Tm39    : Con39 -> Ty39 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var39 g a -> Tm39 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm39 (snoc39 g a) B -> Tm39 g (arr39 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm39 g (arr39 a B) -> Tm39 g a -> Tm39 g B)\n -> Tm39 g a\n\nvar39 : {g : _} -> {a : _} -> Var39 g a -> Tm39 g a\nvar39 = \\ x, tm, var39, lam, app => var39 _ _ x\n\nlam39 : {g : _} -> {a : _} -> {B : _} -> Tm39 (snoc39 g a) B -> Tm39 g (arr39 a B)\nlam39 = \\ t, tm, var39, lam39, app => lam39 _ _ _ (t tm var39 lam39 app)\n\napp39 : {g:_}->{a:_}->{B:_} -> Tm39 g (arr39 a B) -> Tm39 g a -> Tm39 g B\napp39 = \\ t, u, tm, var39, lam39, app39 => app39 _ _ _ (t tm var39 lam39 app39) (u tm var39 lam39 app39)\n\nv039 : {g:_}->{a:_} -> Tm39 (snoc39 g a) a\nv039 = var39 vz39\n\nv139 : {g:_}->{a:_}-> {B:_}-> Tm39 (snoc39 (snoc39 g a) B) a\nv139 = var39 (vs39 vz39)\n\nv239 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm39 (snoc39 (snoc39 (snoc39 g a) B) C) a\nv239 = var39 (vs39 (vs39 vz39))\n\nv339 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm39 (snoc39 (snoc39 (snoc39 (snoc39 g a) B) C) D) a\nv339 = var39 (vs39 (vs39 (vs39 vz39)))\n\nv439 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm39 (snoc39 (snoc39 (snoc39 (snoc39 (snoc39 g a) B) C) D) E) a\nv439 = var39 (vs39 (vs39 (vs39 (vs39 vz39))))\n\ntest39 : {g:_}-> {a:_} -> Tm39 g (arr39 (arr39 a a) (arr39 a a))\ntest39  = lam39 (lam39 (app39 v139 (app39 v139 (app39 v139 (app39 v139 (app39 v139 (app39 v139 v039)))))))\nTy40 : Type\nTy40 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty40 : Ty40\nempty40 = \\ _, empty, _ => empty\n\narr40 : Ty40 -> Ty40 -> Ty40\narr40 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon40 : Type\nCon40 = (Con40 : Type)\n ->(nil  : Con40)\n ->(snoc : Con40 -> Ty40 -> Con40)\n -> Con40\n\nnil40 : Con40\nnil40 = \\ con, nil40, snoc => nil40\n\nsnoc40 : Con40 -> Ty40 -> Con40\nsnoc40 = \\ g, a, con, nil40, snoc40 => snoc40 (g con nil40 snoc40) a\n\nVar40 : Con40 -> Ty40 -> Type\nVar40 = \\ g, a =>\n    (Var40 : Con40 -> Ty40 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var40 (snoc40 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var40 g a -> Var40 (snoc40 g b) a)\n -> Var40 g a\n\nvz40 : {g : _}-> {a : _} -> Var40 (snoc40 g a) a\nvz40 = \\ var, vz40, vs => vz40 _ _\n\nvs40 : {g : _} -> {B : _} -> {a : _} -> Var40 g a -> Var40 (snoc40 g B) a\nvs40 = \\ x, var, vz40, vs40 => vs40 _ _ _ (x var vz40 vs40)\n\nTm40 : Con40 -> Ty40 -> Type\nTm40 = \\ g, a =>\n    (Tm40    : Con40 -> Ty40 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var40 g a -> Tm40 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm40 (snoc40 g a) B -> Tm40 g (arr40 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm40 g (arr40 a B) -> Tm40 g a -> Tm40 g B)\n -> Tm40 g a\n\nvar40 : {g : _} -> {a : _} -> Var40 g a -> Tm40 g a\nvar40 = \\ x, tm, var40, lam, app => var40 _ _ x\n\nlam40 : {g : _} -> {a : _} -> {B : _} -> Tm40 (snoc40 g a) B -> Tm40 g (arr40 a B)\nlam40 = \\ t, tm, var40, lam40, app => lam40 _ _ _ (t tm var40 lam40 app)\n\napp40 : {g:_}->{a:_}->{B:_} -> Tm40 g (arr40 a B) -> Tm40 g a -> Tm40 g B\napp40 = \\ t, u, tm, var40, lam40, app40 => app40 _ _ _ (t tm var40 lam40 app40) (u tm var40 lam40 app40)\n\nv040 : {g:_}->{a:_} -> Tm40 (snoc40 g a) a\nv040 = var40 vz40\n\nv140 : {g:_}->{a:_}-> {B:_}-> Tm40 (snoc40 (snoc40 g a) B) a\nv140 = var40 (vs40 vz40)\n\nv240 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm40 (snoc40 (snoc40 (snoc40 g a) B) C) a\nv240 = var40 (vs40 (vs40 vz40))\n\nv340 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm40 (snoc40 (snoc40 (snoc40 (snoc40 g a) B) C) D) a\nv340 = var40 (vs40 (vs40 (vs40 vz40)))\n\nv440 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm40 (snoc40 (snoc40 (snoc40 (snoc40 (snoc40 g a) B) C) D) E) a\nv440 = var40 (vs40 (vs40 (vs40 (vs40 vz40))))\n\ntest40 : {g:_}-> {a:_} -> Tm40 g (arr40 (arr40 a a) (arr40 a a))\ntest40  = lam40 (lam40 (app40 v140 (app40 v140 (app40 v140 (app40 v140 (app40 v140 (app40 v140 v040)))))))\nTy41 : Type\nTy41 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty41 : Ty41\nempty41 = \\ _, empty, _ => empty\n\narr41 : Ty41 -> Ty41 -> Ty41\narr41 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon41 : Type\nCon41 = (Con41 : Type)\n ->(nil  : Con41)\n ->(snoc : Con41 -> Ty41 -> Con41)\n -> Con41\n\nnil41 : Con41\nnil41 = \\ con, nil41, snoc => nil41\n\nsnoc41 : Con41 -> Ty41 -> Con41\nsnoc41 = \\ g, a, con, nil41, snoc41 => snoc41 (g con nil41 snoc41) a\n\nVar41 : Con41 -> Ty41 -> Type\nVar41 = \\ g, a =>\n    (Var41 : Con41 -> Ty41 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var41 (snoc41 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var41 g a -> Var41 (snoc41 g b) a)\n -> Var41 g a\n\nvz41 : {g : _}-> {a : _} -> Var41 (snoc41 g a) a\nvz41 = \\ var, vz41, vs => vz41 _ _\n\nvs41 : {g : _} -> {B : _} -> {a : _} -> Var41 g a -> Var41 (snoc41 g B) a\nvs41 = \\ x, var, vz41, vs41 => vs41 _ _ _ (x var vz41 vs41)\n\nTm41 : Con41 -> Ty41 -> Type\nTm41 = \\ g, a =>\n    (Tm41    : Con41 -> Ty41 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var41 g a -> Tm41 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm41 (snoc41 g a) B -> Tm41 g (arr41 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm41 g (arr41 a B) -> Tm41 g a -> Tm41 g B)\n -> Tm41 g a\n\nvar41 : {g : _} -> {a : _} -> Var41 g a -> Tm41 g a\nvar41 = \\ x, tm, var41, lam, app => var41 _ _ x\n\nlam41 : {g : _} -> {a : _} -> {B : _} -> Tm41 (snoc41 g a) B -> Tm41 g (arr41 a B)\nlam41 = \\ t, tm, var41, lam41, app => lam41 _ _ _ (t tm var41 lam41 app)\n\napp41 : {g:_}->{a:_}->{B:_} -> Tm41 g (arr41 a B) -> Tm41 g a -> Tm41 g B\napp41 = \\ t, u, tm, var41, lam41, app41 => app41 _ _ _ (t tm var41 lam41 app41) (u tm var41 lam41 app41)\n\nv041 : {g:_}->{a:_} -> Tm41 (snoc41 g a) a\nv041 = var41 vz41\n\nv141 : {g:_}->{a:_}-> {B:_}-> Tm41 (snoc41 (snoc41 g a) B) a\nv141 = var41 (vs41 vz41)\n\nv241 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm41 (snoc41 (snoc41 (snoc41 g a) B) C) a\nv241 = var41 (vs41 (vs41 vz41))\n\nv341 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm41 (snoc41 (snoc41 (snoc41 (snoc41 g a) B) C) D) a\nv341 = var41 (vs41 (vs41 (vs41 vz41)))\n\nv441 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm41 (snoc41 (snoc41 (snoc41 (snoc41 (snoc41 g a) B) C) D) E) a\nv441 = var41 (vs41 (vs41 (vs41 (vs41 vz41))))\n\ntest41 : {g:_}-> {a:_} -> Tm41 g (arr41 (arr41 a a) (arr41 a a))\ntest41  = lam41 (lam41 (app41 v141 (app41 v141 (app41 v141 (app41 v141 (app41 v141 (app41 v141 v041)))))))\nTy42 : Type\nTy42 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty42 : Ty42\nempty42 = \\ _, empty, _ => empty\n\narr42 : Ty42 -> Ty42 -> Ty42\narr42 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon42 : Type\nCon42 = (Con42 : Type)\n ->(nil  : Con42)\n ->(snoc : Con42 -> Ty42 -> Con42)\n -> Con42\n\nnil42 : Con42\nnil42 = \\ con, nil42, snoc => nil42\n\nsnoc42 : Con42 -> Ty42 -> Con42\nsnoc42 = \\ g, a, con, nil42, snoc42 => snoc42 (g con nil42 snoc42) a\n\nVar42 : Con42 -> Ty42 -> Type\nVar42 = \\ g, a =>\n    (Var42 : Con42 -> Ty42 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var42 (snoc42 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var42 g a -> Var42 (snoc42 g b) a)\n -> Var42 g a\n\nvz42 : {g : _}-> {a : _} -> Var42 (snoc42 g a) a\nvz42 = \\ var, vz42, vs => vz42 _ _\n\nvs42 : {g : _} -> {B : _} -> {a : _} -> Var42 g a -> Var42 (snoc42 g B) a\nvs42 = \\ x, var, vz42, vs42 => vs42 _ _ _ (x var vz42 vs42)\n\nTm42 : Con42 -> Ty42 -> Type\nTm42 = \\ g, a =>\n    (Tm42    : Con42 -> Ty42 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var42 g a -> Tm42 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm42 (snoc42 g a) B -> Tm42 g (arr42 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm42 g (arr42 a B) -> Tm42 g a -> Tm42 g B)\n -> Tm42 g a\n\nvar42 : {g : _} -> {a : _} -> Var42 g a -> Tm42 g a\nvar42 = \\ x, tm, var42, lam, app => var42 _ _ x\n\nlam42 : {g : _} -> {a : _} -> {B : _} -> Tm42 (snoc42 g a) B -> Tm42 g (arr42 a B)\nlam42 = \\ t, tm, var42, lam42, app => lam42 _ _ _ (t tm var42 lam42 app)\n\napp42 : {g:_}->{a:_}->{B:_} -> Tm42 g (arr42 a B) -> Tm42 g a -> Tm42 g B\napp42 = \\ t, u, tm, var42, lam42, app42 => app42 _ _ _ (t tm var42 lam42 app42) (u tm var42 lam42 app42)\n\nv042 : {g:_}->{a:_} -> Tm42 (snoc42 g a) a\nv042 = var42 vz42\n\nv142 : {g:_}->{a:_}-> {B:_}-> Tm42 (snoc42 (snoc42 g a) B) a\nv142 = var42 (vs42 vz42)\n\nv242 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm42 (snoc42 (snoc42 (snoc42 g a) B) C) a\nv242 = var42 (vs42 (vs42 vz42))\n\nv342 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm42 (snoc42 (snoc42 (snoc42 (snoc42 g a) B) C) D) a\nv342 = var42 (vs42 (vs42 (vs42 vz42)))\n\nv442 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm42 (snoc42 (snoc42 (snoc42 (snoc42 (snoc42 g a) B) C) D) E) a\nv442 = var42 (vs42 (vs42 (vs42 (vs42 vz42))))\n\ntest42 : {g:_}-> {a:_} -> Tm42 g (arr42 (arr42 a a) (arr42 a a))\ntest42  = lam42 (lam42 (app42 v142 (app42 v142 (app42 v142 (app42 v142 (app42 v142 (app42 v142 v042)))))))\nTy43 : Type\nTy43 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty43 : Ty43\nempty43 = \\ _, empty, _ => empty\n\narr43 : Ty43 -> Ty43 -> Ty43\narr43 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon43 : Type\nCon43 = (Con43 : Type)\n ->(nil  : Con43)\n ->(snoc : Con43 -> Ty43 -> Con43)\n -> Con43\n\nnil43 : Con43\nnil43 = \\ con, nil43, snoc => nil43\n\nsnoc43 : Con43 -> Ty43 -> Con43\nsnoc43 = \\ g, a, con, nil43, snoc43 => snoc43 (g con nil43 snoc43) a\n\nVar43 : Con43 -> Ty43 -> Type\nVar43 = \\ g, a =>\n    (Var43 : Con43 -> Ty43 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var43 (snoc43 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var43 g a -> Var43 (snoc43 g b) a)\n -> Var43 g a\n\nvz43 : {g : _}-> {a : _} -> Var43 (snoc43 g a) a\nvz43 = \\ var, vz43, vs => vz43 _ _\n\nvs43 : {g : _} -> {B : _} -> {a : _} -> Var43 g a -> Var43 (snoc43 g B) a\nvs43 = \\ x, var, vz43, vs43 => vs43 _ _ _ (x var vz43 vs43)\n\nTm43 : Con43 -> Ty43 -> Type\nTm43 = \\ g, a =>\n    (Tm43    : Con43 -> Ty43 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var43 g a -> Tm43 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm43 (snoc43 g a) B -> Tm43 g (arr43 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm43 g (arr43 a B) -> Tm43 g a -> Tm43 g B)\n -> Tm43 g a\n\nvar43 : {g : _} -> {a : _} -> Var43 g a -> Tm43 g a\nvar43 = \\ x, tm, var43, lam, app => var43 _ _ x\n\nlam43 : {g : _} -> {a : _} -> {B : _} -> Tm43 (snoc43 g a) B -> Tm43 g (arr43 a B)\nlam43 = \\ t, tm, var43, lam43, app => lam43 _ _ _ (t tm var43 lam43 app)\n\napp43 : {g:_}->{a:_}->{B:_} -> Tm43 g (arr43 a B) -> Tm43 g a -> Tm43 g B\napp43 = \\ t, u, tm, var43, lam43, app43 => app43 _ _ _ (t tm var43 lam43 app43) (u tm var43 lam43 app43)\n\nv043 : {g:_}->{a:_} -> Tm43 (snoc43 g a) a\nv043 = var43 vz43\n\nv143 : {g:_}->{a:_}-> {B:_}-> Tm43 (snoc43 (snoc43 g a) B) a\nv143 = var43 (vs43 vz43)\n\nv243 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm43 (snoc43 (snoc43 (snoc43 g a) B) C) a\nv243 = var43 (vs43 (vs43 vz43))\n\nv343 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm43 (snoc43 (snoc43 (snoc43 (snoc43 g a) B) C) D) a\nv343 = var43 (vs43 (vs43 (vs43 vz43)))\n\nv443 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm43 (snoc43 (snoc43 (snoc43 (snoc43 (snoc43 g a) B) C) D) E) a\nv443 = var43 (vs43 (vs43 (vs43 (vs43 vz43))))\n\ntest43 : {g:_}-> {a:_} -> Tm43 g (arr43 (arr43 a a) (arr43 a a))\ntest43  = lam43 (lam43 (app43 v143 (app43 v143 (app43 v143 (app43 v143 (app43 v143 (app43 v143 v043)))))))\nTy44 : Type\nTy44 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty44 : Ty44\nempty44 = \\ _, empty, _ => empty\n\narr44 : Ty44 -> Ty44 -> Ty44\narr44 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon44 : Type\nCon44 = (Con44 : Type)\n ->(nil  : Con44)\n ->(snoc : Con44 -> Ty44 -> Con44)\n -> Con44\n\nnil44 : Con44\nnil44 = \\ con, nil44, snoc => nil44\n\nsnoc44 : Con44 -> Ty44 -> Con44\nsnoc44 = \\ g, a, con, nil44, snoc44 => snoc44 (g con nil44 snoc44) a\n\nVar44 : Con44 -> Ty44 -> Type\nVar44 = \\ g, a =>\n    (Var44 : Con44 -> Ty44 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var44 (snoc44 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var44 g a -> Var44 (snoc44 g b) a)\n -> Var44 g a\n\nvz44 : {g : _}-> {a : _} -> Var44 (snoc44 g a) a\nvz44 = \\ var, vz44, vs => vz44 _ _\n\nvs44 : {g : _} -> {B : _} -> {a : _} -> Var44 g a -> Var44 (snoc44 g B) a\nvs44 = \\ x, var, vz44, vs44 => vs44 _ _ _ (x var vz44 vs44)\n\nTm44 : Con44 -> Ty44 -> Type\nTm44 = \\ g, a =>\n    (Tm44    : Con44 -> Ty44 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var44 g a -> Tm44 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm44 (snoc44 g a) B -> Tm44 g (arr44 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm44 g (arr44 a B) -> Tm44 g a -> Tm44 g B)\n -> Tm44 g a\n\nvar44 : {g : _} -> {a : _} -> Var44 g a -> Tm44 g a\nvar44 = \\ x, tm, var44, lam, app => var44 _ _ x\n\nlam44 : {g : _} -> {a : _} -> {B : _} -> Tm44 (snoc44 g a) B -> Tm44 g (arr44 a B)\nlam44 = \\ t, tm, var44, lam44, app => lam44 _ _ _ (t tm var44 lam44 app)\n\napp44 : {g:_}->{a:_}->{B:_} -> Tm44 g (arr44 a B) -> Tm44 g a -> Tm44 g B\napp44 = \\ t, u, tm, var44, lam44, app44 => app44 _ _ _ (t tm var44 lam44 app44) (u tm var44 lam44 app44)\n\nv044 : {g:_}->{a:_} -> Tm44 (snoc44 g a) a\nv044 = var44 vz44\n\nv144 : {g:_}->{a:_}-> {B:_}-> Tm44 (snoc44 (snoc44 g a) B) a\nv144 = var44 (vs44 vz44)\n\nv244 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm44 (snoc44 (snoc44 (snoc44 g a) B) C) a\nv244 = var44 (vs44 (vs44 vz44))\n\nv344 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm44 (snoc44 (snoc44 (snoc44 (snoc44 g a) B) C) D) a\nv344 = var44 (vs44 (vs44 (vs44 vz44)))\n\nv444 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm44 (snoc44 (snoc44 (snoc44 (snoc44 (snoc44 g a) B) C) D) E) a\nv444 = var44 (vs44 (vs44 (vs44 (vs44 vz44))))\n\ntest44 : {g:_}-> {a:_} -> Tm44 g (arr44 (arr44 a a) (arr44 a a))\ntest44  = lam44 (lam44 (app44 v144 (app44 v144 (app44 v144 (app44 v144 (app44 v144 (app44 v144 v044)))))))\nTy45 : Type\nTy45 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty45 : Ty45\nempty45 = \\ _, empty, _ => empty\n\narr45 : Ty45 -> Ty45 -> Ty45\narr45 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon45 : Type\nCon45 = (Con45 : Type)\n ->(nil  : Con45)\n ->(snoc : Con45 -> Ty45 -> Con45)\n -> Con45\n\nnil45 : Con45\nnil45 = \\ con, nil45, snoc => nil45\n\nsnoc45 : Con45 -> Ty45 -> Con45\nsnoc45 = \\ g, a, con, nil45, snoc45 => snoc45 (g con nil45 snoc45) a\n\nVar45 : Con45 -> Ty45 -> Type\nVar45 = \\ g, a =>\n    (Var45 : Con45 -> Ty45 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var45 (snoc45 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var45 g a -> Var45 (snoc45 g b) a)\n -> Var45 g a\n\nvz45 : {g : _}-> {a : _} -> Var45 (snoc45 g a) a\nvz45 = \\ var, vz45, vs => vz45 _ _\n\nvs45 : {g : _} -> {B : _} -> {a : _} -> Var45 g a -> Var45 (snoc45 g B) a\nvs45 = \\ x, var, vz45, vs45 => vs45 _ _ _ (x var vz45 vs45)\n\nTm45 : Con45 -> Ty45 -> Type\nTm45 = \\ g, a =>\n    (Tm45    : Con45 -> Ty45 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var45 g a -> Tm45 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm45 (snoc45 g a) B -> Tm45 g (arr45 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm45 g (arr45 a B) -> Tm45 g a -> Tm45 g B)\n -> Tm45 g a\n\nvar45 : {g : _} -> {a : _} -> Var45 g a -> Tm45 g a\nvar45 = \\ x, tm, var45, lam, app => var45 _ _ x\n\nlam45 : {g : _} -> {a : _} -> {B : _} -> Tm45 (snoc45 g a) B -> Tm45 g (arr45 a B)\nlam45 = \\ t, tm, var45, lam45, app => lam45 _ _ _ (t tm var45 lam45 app)\n\napp45 : {g:_}->{a:_}->{B:_} -> Tm45 g (arr45 a B) -> Tm45 g a -> Tm45 g B\napp45 = \\ t, u, tm, var45, lam45, app45 => app45 _ _ _ (t tm var45 lam45 app45) (u tm var45 lam45 app45)\n\nv045 : {g:_}->{a:_} -> Tm45 (snoc45 g a) a\nv045 = var45 vz45\n\nv145 : {g:_}->{a:_}-> {B:_}-> Tm45 (snoc45 (snoc45 g a) B) a\nv145 = var45 (vs45 vz45)\n\nv245 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm45 (snoc45 (snoc45 (snoc45 g a) B) C) a\nv245 = var45 (vs45 (vs45 vz45))\n\nv345 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm45 (snoc45 (snoc45 (snoc45 (snoc45 g a) B) C) D) a\nv345 = var45 (vs45 (vs45 (vs45 vz45)))\n\nv445 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm45 (snoc45 (snoc45 (snoc45 (snoc45 (snoc45 g a) B) C) D) E) a\nv445 = var45 (vs45 (vs45 (vs45 (vs45 vz45))))\n\ntest45 : {g:_}-> {a:_} -> Tm45 g (arr45 (arr45 a a) (arr45 a a))\ntest45  = lam45 (lam45 (app45 v145 (app45 v145 (app45 v145 (app45 v145 (app45 v145 (app45 v145 v045)))))))\nTy46 : Type\nTy46 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty46 : Ty46\nempty46 = \\ _, empty, _ => empty\n\narr46 : Ty46 -> Ty46 -> Ty46\narr46 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon46 : Type\nCon46 = (Con46 : Type)\n ->(nil  : Con46)\n ->(snoc : Con46 -> Ty46 -> Con46)\n -> Con46\n\nnil46 : Con46\nnil46 = \\ con, nil46, snoc => nil46\n\nsnoc46 : Con46 -> Ty46 -> Con46\nsnoc46 = \\ g, a, con, nil46, snoc46 => snoc46 (g con nil46 snoc46) a\n\nVar46 : Con46 -> Ty46 -> Type\nVar46 = \\ g, a =>\n    (Var46 : Con46 -> Ty46 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var46 (snoc46 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var46 g a -> Var46 (snoc46 g b) a)\n -> Var46 g a\n\nvz46 : {g : _}-> {a : _} -> Var46 (snoc46 g a) a\nvz46 = \\ var, vz46, vs => vz46 _ _\n\nvs46 : {g : _} -> {B : _} -> {a : _} -> Var46 g a -> Var46 (snoc46 g B) a\nvs46 = \\ x, var, vz46, vs46 => vs46 _ _ _ (x var vz46 vs46)\n\nTm46 : Con46 -> Ty46 -> Type\nTm46 = \\ g, a =>\n    (Tm46    : Con46 -> Ty46 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var46 g a -> Tm46 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm46 (snoc46 g a) B -> Tm46 g (arr46 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm46 g (arr46 a B) -> Tm46 g a -> Tm46 g B)\n -> Tm46 g a\n\nvar46 : {g : _} -> {a : _} -> Var46 g a -> Tm46 g a\nvar46 = \\ x, tm, var46, lam, app => var46 _ _ x\n\nlam46 : {g : _} -> {a : _} -> {B : _} -> Tm46 (snoc46 g a) B -> Tm46 g (arr46 a B)\nlam46 = \\ t, tm, var46, lam46, app => lam46 _ _ _ (t tm var46 lam46 app)\n\napp46 : {g:_}->{a:_}->{B:_} -> Tm46 g (arr46 a B) -> Tm46 g a -> Tm46 g B\napp46 = \\ t, u, tm, var46, lam46, app46 => app46 _ _ _ (t tm var46 lam46 app46) (u tm var46 lam46 app46)\n\nv046 : {g:_}->{a:_} -> Tm46 (snoc46 g a) a\nv046 = var46 vz46\n\nv146 : {g:_}->{a:_}-> {B:_}-> Tm46 (snoc46 (snoc46 g a) B) a\nv146 = var46 (vs46 vz46)\n\nv246 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm46 (snoc46 (snoc46 (snoc46 g a) B) C) a\nv246 = var46 (vs46 (vs46 vz46))\n\nv346 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm46 (snoc46 (snoc46 (snoc46 (snoc46 g a) B) C) D) a\nv346 = var46 (vs46 (vs46 (vs46 vz46)))\n\nv446 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm46 (snoc46 (snoc46 (snoc46 (snoc46 (snoc46 g a) B) C) D) E) a\nv446 = var46 (vs46 (vs46 (vs46 (vs46 vz46))))\n\ntest46 : {g:_}-> {a:_} -> Tm46 g (arr46 (arr46 a a) (arr46 a a))\ntest46  = lam46 (lam46 (app46 v146 (app46 v146 (app46 v146 (app46 v146 (app46 v146 (app46 v146 v046)))))))\nTy47 : Type\nTy47 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty47 : Ty47\nempty47 = \\ _, empty, _ => empty\n\narr47 : Ty47 -> Ty47 -> Ty47\narr47 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon47 : Type\nCon47 = (Con47 : Type)\n ->(nil  : Con47)\n ->(snoc : Con47 -> Ty47 -> Con47)\n -> Con47\n\nnil47 : Con47\nnil47 = \\ con, nil47, snoc => nil47\n\nsnoc47 : Con47 -> Ty47 -> Con47\nsnoc47 = \\ g, a, con, nil47, snoc47 => snoc47 (g con nil47 snoc47) a\n\nVar47 : Con47 -> Ty47 -> Type\nVar47 = \\ g, a =>\n    (Var47 : Con47 -> Ty47 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var47 (snoc47 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var47 g a -> Var47 (snoc47 g b) a)\n -> Var47 g a\n\nvz47 : {g : _}-> {a : _} -> Var47 (snoc47 g a) a\nvz47 = \\ var, vz47, vs => vz47 _ _\n\nvs47 : {g : _} -> {B : _} -> {a : _} -> Var47 g a -> Var47 (snoc47 g B) a\nvs47 = \\ x, var, vz47, vs47 => vs47 _ _ _ (x var vz47 vs47)\n\nTm47 : Con47 -> Ty47 -> Type\nTm47 = \\ g, a =>\n    (Tm47    : Con47 -> Ty47 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var47 g a -> Tm47 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm47 (snoc47 g a) B -> Tm47 g (arr47 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm47 g (arr47 a B) -> Tm47 g a -> Tm47 g B)\n -> Tm47 g a\n\nvar47 : {g : _} -> {a : _} -> Var47 g a -> Tm47 g a\nvar47 = \\ x, tm, var47, lam, app => var47 _ _ x\n\nlam47 : {g : _} -> {a : _} -> {B : _} -> Tm47 (snoc47 g a) B -> Tm47 g (arr47 a B)\nlam47 = \\ t, tm, var47, lam47, app => lam47 _ _ _ (t tm var47 lam47 app)\n\napp47 : {g:_}->{a:_}->{B:_} -> Tm47 g (arr47 a B) -> Tm47 g a -> Tm47 g B\napp47 = \\ t, u, tm, var47, lam47, app47 => app47 _ _ _ (t tm var47 lam47 app47) (u tm var47 lam47 app47)\n\nv047 : {g:_}->{a:_} -> Tm47 (snoc47 g a) a\nv047 = var47 vz47\n\nv147 : {g:_}->{a:_}-> {B:_}-> Tm47 (snoc47 (snoc47 g a) B) a\nv147 = var47 (vs47 vz47)\n\nv247 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm47 (snoc47 (snoc47 (snoc47 g a) B) C) a\nv247 = var47 (vs47 (vs47 vz47))\n\nv347 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm47 (snoc47 (snoc47 (snoc47 (snoc47 g a) B) C) D) a\nv347 = var47 (vs47 (vs47 (vs47 vz47)))\n\nv447 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm47 (snoc47 (snoc47 (snoc47 (snoc47 (snoc47 g a) B) C) D) E) a\nv447 = var47 (vs47 (vs47 (vs47 (vs47 vz47))))\n\ntest47 : {g:_}-> {a:_} -> Tm47 g (arr47 (arr47 a a) (arr47 a a))\ntest47  = lam47 (lam47 (app47 v147 (app47 v147 (app47 v147 (app47 v147 (app47 v147 (app47 v147 v047)))))))\nTy48 : Type\nTy48 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty48 : Ty48\nempty48 = \\ _, empty, _ => empty\n\narr48 : Ty48 -> Ty48 -> Ty48\narr48 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon48 : Type\nCon48 = (Con48 : Type)\n ->(nil  : Con48)\n ->(snoc : Con48 -> Ty48 -> Con48)\n -> Con48\n\nnil48 : Con48\nnil48 = \\ con, nil48, snoc => nil48\n\nsnoc48 : Con48 -> Ty48 -> Con48\nsnoc48 = \\ g, a, con, nil48, snoc48 => snoc48 (g con nil48 snoc48) a\n\nVar48 : Con48 -> Ty48 -> Type\nVar48 = \\ g, a =>\n    (Var48 : Con48 -> Ty48 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var48 (snoc48 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var48 g a -> Var48 (snoc48 g b) a)\n -> Var48 g a\n\nvz48 : {g : _}-> {a : _} -> Var48 (snoc48 g a) a\nvz48 = \\ var, vz48, vs => vz48 _ _\n\nvs48 : {g : _} -> {B : _} -> {a : _} -> Var48 g a -> Var48 (snoc48 g B) a\nvs48 = \\ x, var, vz48, vs48 => vs48 _ _ _ (x var vz48 vs48)\n\nTm48 : Con48 -> Ty48 -> Type\nTm48 = \\ g, a =>\n    (Tm48    : Con48 -> Ty48 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var48 g a -> Tm48 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm48 (snoc48 g a) B -> Tm48 g (arr48 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm48 g (arr48 a B) -> Tm48 g a -> Tm48 g B)\n -> Tm48 g a\n\nvar48 : {g : _} -> {a : _} -> Var48 g a -> Tm48 g a\nvar48 = \\ x, tm, var48, lam, app => var48 _ _ x\n\nlam48 : {g : _} -> {a : _} -> {B : _} -> Tm48 (snoc48 g a) B -> Tm48 g (arr48 a B)\nlam48 = \\ t, tm, var48, lam48, app => lam48 _ _ _ (t tm var48 lam48 app)\n\napp48 : {g:_}->{a:_}->{B:_} -> Tm48 g (arr48 a B) -> Tm48 g a -> Tm48 g B\napp48 = \\ t, u, tm, var48, lam48, app48 => app48 _ _ _ (t tm var48 lam48 app48) (u tm var48 lam48 app48)\n\nv048 : {g:_}->{a:_} -> Tm48 (snoc48 g a) a\nv048 = var48 vz48\n\nv148 : {g:_}->{a:_}-> {B:_}-> Tm48 (snoc48 (snoc48 g a) B) a\nv148 = var48 (vs48 vz48)\n\nv248 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm48 (snoc48 (snoc48 (snoc48 g a) B) C) a\nv248 = var48 (vs48 (vs48 vz48))\n\nv348 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm48 (snoc48 (snoc48 (snoc48 (snoc48 g a) B) C) D) a\nv348 = var48 (vs48 (vs48 (vs48 vz48)))\n\nv448 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm48 (snoc48 (snoc48 (snoc48 (snoc48 (snoc48 g a) B) C) D) E) a\nv448 = var48 (vs48 (vs48 (vs48 (vs48 vz48))))\n\ntest48 : {g:_}-> {a:_} -> Tm48 g (arr48 (arr48 a a) (arr48 a a))\ntest48  = lam48 (lam48 (app48 v148 (app48 v148 (app48 v148 (app48 v148 (app48 v148 (app48 v148 v048)))))))\nTy49 : Type\nTy49 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty49 : Ty49\nempty49 = \\ _, empty, _ => empty\n\narr49 : Ty49 -> Ty49 -> Ty49\narr49 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon49 : Type\nCon49 = (Con49 : Type)\n ->(nil  : Con49)\n ->(snoc : Con49 -> Ty49 -> Con49)\n -> Con49\n\nnil49 : Con49\nnil49 = \\ con, nil49, snoc => nil49\n\nsnoc49 : Con49 -> Ty49 -> Con49\nsnoc49 = \\ g, a, con, nil49, snoc49 => snoc49 (g con nil49 snoc49) a\n\nVar49 : Con49 -> Ty49 -> Type\nVar49 = \\ g, a =>\n    (Var49 : Con49 -> Ty49 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var49 (snoc49 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var49 g a -> Var49 (snoc49 g b) a)\n -> Var49 g a\n\nvz49 : {g : _}-> {a : _} -> Var49 (snoc49 g a) a\nvz49 = \\ var, vz49, vs => vz49 _ _\n\nvs49 : {g : _} -> {B : _} -> {a : _} -> Var49 g a -> Var49 (snoc49 g B) a\nvs49 = \\ x, var, vz49, vs49 => vs49 _ _ _ (x var vz49 vs49)\n\nTm49 : Con49 -> Ty49 -> Type\nTm49 = \\ g, a =>\n    (Tm49    : Con49 -> Ty49 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var49 g a -> Tm49 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm49 (snoc49 g a) B -> Tm49 g (arr49 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm49 g (arr49 a B) -> Tm49 g a -> Tm49 g B)\n -> Tm49 g a\n\nvar49 : {g : _} -> {a : _} -> Var49 g a -> Tm49 g a\nvar49 = \\ x, tm, var49, lam, app => var49 _ _ x\n\nlam49 : {g : _} -> {a : _} -> {B : _} -> Tm49 (snoc49 g a) B -> Tm49 g (arr49 a B)\nlam49 = \\ t, tm, var49, lam49, app => lam49 _ _ _ (t tm var49 lam49 app)\n\napp49 : {g:_}->{a:_}->{B:_} -> Tm49 g (arr49 a B) -> Tm49 g a -> Tm49 g B\napp49 = \\ t, u, tm, var49, lam49, app49 => app49 _ _ _ (t tm var49 lam49 app49) (u tm var49 lam49 app49)\n\nv049 : {g:_}->{a:_} -> Tm49 (snoc49 g a) a\nv049 = var49 vz49\n\nv149 : {g:_}->{a:_}-> {B:_}-> Tm49 (snoc49 (snoc49 g a) B) a\nv149 = var49 (vs49 vz49)\n\nv249 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm49 (snoc49 (snoc49 (snoc49 g a) B) C) a\nv249 = var49 (vs49 (vs49 vz49))\n\nv349 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm49 (snoc49 (snoc49 (snoc49 (snoc49 g a) B) C) D) a\nv349 = var49 (vs49 (vs49 (vs49 vz49)))\n\nv449 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm49 (snoc49 (snoc49 (snoc49 (snoc49 (snoc49 g a) B) C) D) E) a\nv449 = var49 (vs49 (vs49 (vs49 (vs49 vz49))))\n\ntest49 : {g:_}-> {a:_} -> Tm49 g (arr49 (arr49 a a) (arr49 a a))\ntest49  = lam49 (lam49 (app49 v149 (app49 v149 (app49 v149 (app49 v149 (app49 v149 (app49 v149 v049)))))))\nTy50 : Type\nTy50 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty50 : Ty50\nempty50 = \\ _, empty, _ => empty\n\narr50 : Ty50 -> Ty50 -> Ty50\narr50 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon50 : Type\nCon50 = (Con50 : Type)\n ->(nil  : Con50)\n ->(snoc : Con50 -> Ty50 -> Con50)\n -> Con50\n\nnil50 : Con50\nnil50 = \\ con, nil50, snoc => nil50\n\nsnoc50 : Con50 -> Ty50 -> Con50\nsnoc50 = \\ g, a, con, nil50, snoc50 => snoc50 (g con nil50 snoc50) a\n\nVar50 : Con50 -> Ty50 -> Type\nVar50 = \\ g, a =>\n    (Var50 : Con50 -> Ty50 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var50 (snoc50 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var50 g a -> Var50 (snoc50 g b) a)\n -> Var50 g a\n\nvz50 : {g : _}-> {a : _} -> Var50 (snoc50 g a) a\nvz50 = \\ var, vz50, vs => vz50 _ _\n\nvs50 : {g : _} -> {B : _} -> {a : _} -> Var50 g a -> Var50 (snoc50 g B) a\nvs50 = \\ x, var, vz50, vs50 => vs50 _ _ _ (x var vz50 vs50)\n\nTm50 : Con50 -> Ty50 -> Type\nTm50 = \\ g, a =>\n    (Tm50    : Con50 -> Ty50 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var50 g a -> Tm50 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm50 (snoc50 g a) B -> Tm50 g (arr50 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm50 g (arr50 a B) -> Tm50 g a -> Tm50 g B)\n -> Tm50 g a\n\nvar50 : {g : _} -> {a : _} -> Var50 g a -> Tm50 g a\nvar50 = \\ x, tm, var50, lam, app => var50 _ _ x\n\nlam50 : {g : _} -> {a : _} -> {B : _} -> Tm50 (snoc50 g a) B -> Tm50 g (arr50 a B)\nlam50 = \\ t, tm, var50, lam50, app => lam50 _ _ _ (t tm var50 lam50 app)\n\napp50 : {g:_}->{a:_}->{B:_} -> Tm50 g (arr50 a B) -> Tm50 g a -> Tm50 g B\napp50 = \\ t, u, tm, var50, lam50, app50 => app50 _ _ _ (t tm var50 lam50 app50) (u tm var50 lam50 app50)\n\nv050 : {g:_}->{a:_} -> Tm50 (snoc50 g a) a\nv050 = var50 vz50\n\nv150 : {g:_}->{a:_}-> {B:_}-> Tm50 (snoc50 (snoc50 g a) B) a\nv150 = var50 (vs50 vz50)\n\nv250 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm50 (snoc50 (snoc50 (snoc50 g a) B) C) a\nv250 = var50 (vs50 (vs50 vz50))\n\nv350 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm50 (snoc50 (snoc50 (snoc50 (snoc50 g a) B) C) D) a\nv350 = var50 (vs50 (vs50 (vs50 vz50)))\n\nv450 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm50 (snoc50 (snoc50 (snoc50 (snoc50 (snoc50 g a) B) C) D) E) a\nv450 = var50 (vs50 (vs50 (vs50 (vs50 vz50))))\n\ntest50 : {g:_}-> {a:_} -> Tm50 g (arr50 (arr50 a a) (arr50 a a))\ntest50  = lam50 (lam50 (app50 v150 (app50 v150 (app50 v150 (app50 v150 (app50 v150 (app50 v150 v050)))))))\nTy51 : Type\nTy51 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty51 : Ty51\nempty51 = \\ _, empty, _ => empty\n\narr51 : Ty51 -> Ty51 -> Ty51\narr51 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon51 : Type\nCon51 = (Con51 : Type)\n ->(nil  : Con51)\n ->(snoc : Con51 -> Ty51 -> Con51)\n -> Con51\n\nnil51 : Con51\nnil51 = \\ con, nil51, snoc => nil51\n\nsnoc51 : Con51 -> Ty51 -> Con51\nsnoc51 = \\ g, a, con, nil51, snoc51 => snoc51 (g con nil51 snoc51) a\n\nVar51 : Con51 -> Ty51 -> Type\nVar51 = \\ g, a =>\n    (Var51 : Con51 -> Ty51 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var51 (snoc51 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var51 g a -> Var51 (snoc51 g b) a)\n -> Var51 g a\n\nvz51 : {g : _}-> {a : _} -> Var51 (snoc51 g a) a\nvz51 = \\ var, vz51, vs => vz51 _ _\n\nvs51 : {g : _} -> {B : _} -> {a : _} -> Var51 g a -> Var51 (snoc51 g B) a\nvs51 = \\ x, var, vz51, vs51 => vs51 _ _ _ (x var vz51 vs51)\n\nTm51 : Con51 -> Ty51 -> Type\nTm51 = \\ g, a =>\n    (Tm51    : Con51 -> Ty51 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var51 g a -> Tm51 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm51 (snoc51 g a) B -> Tm51 g (arr51 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm51 g (arr51 a B) -> Tm51 g a -> Tm51 g B)\n -> Tm51 g a\n\nvar51 : {g : _} -> {a : _} -> Var51 g a -> Tm51 g a\nvar51 = \\ x, tm, var51, lam, app => var51 _ _ x\n\nlam51 : {g : _} -> {a : _} -> {B : _} -> Tm51 (snoc51 g a) B -> Tm51 g (arr51 a B)\nlam51 = \\ t, tm, var51, lam51, app => lam51 _ _ _ (t tm var51 lam51 app)\n\napp51 : {g:_}->{a:_}->{B:_} -> Tm51 g (arr51 a B) -> Tm51 g a -> Tm51 g B\napp51 = \\ t, u, tm, var51, lam51, app51 => app51 _ _ _ (t tm var51 lam51 app51) (u tm var51 lam51 app51)\n\nv051 : {g:_}->{a:_} -> Tm51 (snoc51 g a) a\nv051 = var51 vz51\n\nv151 : {g:_}->{a:_}-> {B:_}-> Tm51 (snoc51 (snoc51 g a) B) a\nv151 = var51 (vs51 vz51)\n\nv251 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm51 (snoc51 (snoc51 (snoc51 g a) B) C) a\nv251 = var51 (vs51 (vs51 vz51))\n\nv351 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm51 (snoc51 (snoc51 (snoc51 (snoc51 g a) B) C) D) a\nv351 = var51 (vs51 (vs51 (vs51 vz51)))\n\nv451 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm51 (snoc51 (snoc51 (snoc51 (snoc51 (snoc51 g a) B) C) D) E) a\nv451 = var51 (vs51 (vs51 (vs51 (vs51 vz51))))\n\ntest51 : {g:_}-> {a:_} -> Tm51 g (arr51 (arr51 a a) (arr51 a a))\ntest51  = lam51 (lam51 (app51 v151 (app51 v151 (app51 v151 (app51 v151 (app51 v151 (app51 v151 v051)))))))\nTy52 : Type\nTy52 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty52 : Ty52\nempty52 = \\ _, empty, _ => empty\n\narr52 : Ty52 -> Ty52 -> Ty52\narr52 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon52 : Type\nCon52 = (Con52 : Type)\n ->(nil  : Con52)\n ->(snoc : Con52 -> Ty52 -> Con52)\n -> Con52\n\nnil52 : Con52\nnil52 = \\ con, nil52, snoc => nil52\n\nsnoc52 : Con52 -> Ty52 -> Con52\nsnoc52 = \\ g, a, con, nil52, snoc52 => snoc52 (g con nil52 snoc52) a\n\nVar52 : Con52 -> Ty52 -> Type\nVar52 = \\ g, a =>\n    (Var52 : Con52 -> Ty52 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var52 (snoc52 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var52 g a -> Var52 (snoc52 g b) a)\n -> Var52 g a\n\nvz52 : {g : _}-> {a : _} -> Var52 (snoc52 g a) a\nvz52 = \\ var, vz52, vs => vz52 _ _\n\nvs52 : {g : _} -> {B : _} -> {a : _} -> Var52 g a -> Var52 (snoc52 g B) a\nvs52 = \\ x, var, vz52, vs52 => vs52 _ _ _ (x var vz52 vs52)\n\nTm52 : Con52 -> Ty52 -> Type\nTm52 = \\ g, a =>\n    (Tm52    : Con52 -> Ty52 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var52 g a -> Tm52 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm52 (snoc52 g a) B -> Tm52 g (arr52 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm52 g (arr52 a B) -> Tm52 g a -> Tm52 g B)\n -> Tm52 g a\n\nvar52 : {g : _} -> {a : _} -> Var52 g a -> Tm52 g a\nvar52 = \\ x, tm, var52, lam, app => var52 _ _ x\n\nlam52 : {g : _} -> {a : _} -> {B : _} -> Tm52 (snoc52 g a) B -> Tm52 g (arr52 a B)\nlam52 = \\ t, tm, var52, lam52, app => lam52 _ _ _ (t tm var52 lam52 app)\n\napp52 : {g:_}->{a:_}->{B:_} -> Tm52 g (arr52 a B) -> Tm52 g a -> Tm52 g B\napp52 = \\ t, u, tm, var52, lam52, app52 => app52 _ _ _ (t tm var52 lam52 app52) (u tm var52 lam52 app52)\n\nv052 : {g:_}->{a:_} -> Tm52 (snoc52 g a) a\nv052 = var52 vz52\n\nv152 : {g:_}->{a:_}-> {B:_}-> Tm52 (snoc52 (snoc52 g a) B) a\nv152 = var52 (vs52 vz52)\n\nv252 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm52 (snoc52 (snoc52 (snoc52 g a) B) C) a\nv252 = var52 (vs52 (vs52 vz52))\n\nv352 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm52 (snoc52 (snoc52 (snoc52 (snoc52 g a) B) C) D) a\nv352 = var52 (vs52 (vs52 (vs52 vz52)))\n\nv452 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm52 (snoc52 (snoc52 (snoc52 (snoc52 (snoc52 g a) B) C) D) E) a\nv452 = var52 (vs52 (vs52 (vs52 (vs52 vz52))))\n\ntest52 : {g:_}-> {a:_} -> Tm52 g (arr52 (arr52 a a) (arr52 a a))\ntest52  = lam52 (lam52 (app52 v152 (app52 v152 (app52 v152 (app52 v152 (app52 v152 (app52 v152 v052)))))))\nTy53 : Type\nTy53 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty53 : Ty53\nempty53 = \\ _, empty, _ => empty\n\narr53 : Ty53 -> Ty53 -> Ty53\narr53 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon53 : Type\nCon53 = (Con53 : Type)\n ->(nil  : Con53)\n ->(snoc : Con53 -> Ty53 -> Con53)\n -> Con53\n\nnil53 : Con53\nnil53 = \\ con, nil53, snoc => nil53\n\nsnoc53 : Con53 -> Ty53 -> Con53\nsnoc53 = \\ g, a, con, nil53, snoc53 => snoc53 (g con nil53 snoc53) a\n\nVar53 : Con53 -> Ty53 -> Type\nVar53 = \\ g, a =>\n    (Var53 : Con53 -> Ty53 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var53 (snoc53 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var53 g a -> Var53 (snoc53 g b) a)\n -> Var53 g a\n\nvz53 : {g : _}-> {a : _} -> Var53 (snoc53 g a) a\nvz53 = \\ var, vz53, vs => vz53 _ _\n\nvs53 : {g : _} -> {B : _} -> {a : _} -> Var53 g a -> Var53 (snoc53 g B) a\nvs53 = \\ x, var, vz53, vs53 => vs53 _ _ _ (x var vz53 vs53)\n\nTm53 : Con53 -> Ty53 -> Type\nTm53 = \\ g, a =>\n    (Tm53    : Con53 -> Ty53 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var53 g a -> Tm53 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm53 (snoc53 g a) B -> Tm53 g (arr53 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm53 g (arr53 a B) -> Tm53 g a -> Tm53 g B)\n -> Tm53 g a\n\nvar53 : {g : _} -> {a : _} -> Var53 g a -> Tm53 g a\nvar53 = \\ x, tm, var53, lam, app => var53 _ _ x\n\nlam53 : {g : _} -> {a : _} -> {B : _} -> Tm53 (snoc53 g a) B -> Tm53 g (arr53 a B)\nlam53 = \\ t, tm, var53, lam53, app => lam53 _ _ _ (t tm var53 lam53 app)\n\napp53 : {g:_}->{a:_}->{B:_} -> Tm53 g (arr53 a B) -> Tm53 g a -> Tm53 g B\napp53 = \\ t, u, tm, var53, lam53, app53 => app53 _ _ _ (t tm var53 lam53 app53) (u tm var53 lam53 app53)\n\nv053 : {g:_}->{a:_} -> Tm53 (snoc53 g a) a\nv053 = var53 vz53\n\nv153 : {g:_}->{a:_}-> {B:_}-> Tm53 (snoc53 (snoc53 g a) B) a\nv153 = var53 (vs53 vz53)\n\nv253 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm53 (snoc53 (snoc53 (snoc53 g a) B) C) a\nv253 = var53 (vs53 (vs53 vz53))\n\nv353 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm53 (snoc53 (snoc53 (snoc53 (snoc53 g a) B) C) D) a\nv353 = var53 (vs53 (vs53 (vs53 vz53)))\n\nv453 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm53 (snoc53 (snoc53 (snoc53 (snoc53 (snoc53 g a) B) C) D) E) a\nv453 = var53 (vs53 (vs53 (vs53 (vs53 vz53))))\n\ntest53 : {g:_}-> {a:_} -> Tm53 g (arr53 (arr53 a a) (arr53 a a))\ntest53  = lam53 (lam53 (app53 v153 (app53 v153 (app53 v153 (app53 v153 (app53 v153 (app53 v153 v053)))))))\nTy54 : Type\nTy54 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty54 : Ty54\nempty54 = \\ _, empty, _ => empty\n\narr54 : Ty54 -> Ty54 -> Ty54\narr54 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon54 : Type\nCon54 = (Con54 : Type)\n ->(nil  : Con54)\n ->(snoc : Con54 -> Ty54 -> Con54)\n -> Con54\n\nnil54 : Con54\nnil54 = \\ con, nil54, snoc => nil54\n\nsnoc54 : Con54 -> Ty54 -> Con54\nsnoc54 = \\ g, a, con, nil54, snoc54 => snoc54 (g con nil54 snoc54) a\n\nVar54 : Con54 -> Ty54 -> Type\nVar54 = \\ g, a =>\n    (Var54 : Con54 -> Ty54 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var54 (snoc54 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var54 g a -> Var54 (snoc54 g b) a)\n -> Var54 g a\n\nvz54 : {g : _}-> {a : _} -> Var54 (snoc54 g a) a\nvz54 = \\ var, vz54, vs => vz54 _ _\n\nvs54 : {g : _} -> {B : _} -> {a : _} -> Var54 g a -> Var54 (snoc54 g B) a\nvs54 = \\ x, var, vz54, vs54 => vs54 _ _ _ (x var vz54 vs54)\n\nTm54 : Con54 -> Ty54 -> Type\nTm54 = \\ g, a =>\n    (Tm54    : Con54 -> Ty54 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var54 g a -> Tm54 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm54 (snoc54 g a) B -> Tm54 g (arr54 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm54 g (arr54 a B) -> Tm54 g a -> Tm54 g B)\n -> Tm54 g a\n\nvar54 : {g : _} -> {a : _} -> Var54 g a -> Tm54 g a\nvar54 = \\ x, tm, var54, lam, app => var54 _ _ x\n\nlam54 : {g : _} -> {a : _} -> {B : _} -> Tm54 (snoc54 g a) B -> Tm54 g (arr54 a B)\nlam54 = \\ t, tm, var54, lam54, app => lam54 _ _ _ (t tm var54 lam54 app)\n\napp54 : {g:_}->{a:_}->{B:_} -> Tm54 g (arr54 a B) -> Tm54 g a -> Tm54 g B\napp54 = \\ t, u, tm, var54, lam54, app54 => app54 _ _ _ (t tm var54 lam54 app54) (u tm var54 lam54 app54)\n\nv054 : {g:_}->{a:_} -> Tm54 (snoc54 g a) a\nv054 = var54 vz54\n\nv154 : {g:_}->{a:_}-> {B:_}-> Tm54 (snoc54 (snoc54 g a) B) a\nv154 = var54 (vs54 vz54)\n\nv254 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm54 (snoc54 (snoc54 (snoc54 g a) B) C) a\nv254 = var54 (vs54 (vs54 vz54))\n\nv354 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm54 (snoc54 (snoc54 (snoc54 (snoc54 g a) B) C) D) a\nv354 = var54 (vs54 (vs54 (vs54 vz54)))\n\nv454 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm54 (snoc54 (snoc54 (snoc54 (snoc54 (snoc54 g a) B) C) D) E) a\nv454 = var54 (vs54 (vs54 (vs54 (vs54 vz54))))\n\ntest54 : {g:_}-> {a:_} -> Tm54 g (arr54 (arr54 a a) (arr54 a a))\ntest54  = lam54 (lam54 (app54 v154 (app54 v154 (app54 v154 (app54 v154 (app54 v154 (app54 v154 v054)))))))\nTy55 : Type\nTy55 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty55 : Ty55\nempty55 = \\ _, empty, _ => empty\n\narr55 : Ty55 -> Ty55 -> Ty55\narr55 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon55 : Type\nCon55 = (Con55 : Type)\n ->(nil  : Con55)\n ->(snoc : Con55 -> Ty55 -> Con55)\n -> Con55\n\nnil55 : Con55\nnil55 = \\ con, nil55, snoc => nil55\n\nsnoc55 : Con55 -> Ty55 -> Con55\nsnoc55 = \\ g, a, con, nil55, snoc55 => snoc55 (g con nil55 snoc55) a\n\nVar55 : Con55 -> Ty55 -> Type\nVar55 = \\ g, a =>\n    (Var55 : Con55 -> Ty55 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var55 (snoc55 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var55 g a -> Var55 (snoc55 g b) a)\n -> Var55 g a\n\nvz55 : {g : _}-> {a : _} -> Var55 (snoc55 g a) a\nvz55 = \\ var, vz55, vs => vz55 _ _\n\nvs55 : {g : _} -> {B : _} -> {a : _} -> Var55 g a -> Var55 (snoc55 g B) a\nvs55 = \\ x, var, vz55, vs55 => vs55 _ _ _ (x var vz55 vs55)\n\nTm55 : Con55 -> Ty55 -> Type\nTm55 = \\ g, a =>\n    (Tm55    : Con55 -> Ty55 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var55 g a -> Tm55 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm55 (snoc55 g a) B -> Tm55 g (arr55 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm55 g (arr55 a B) -> Tm55 g a -> Tm55 g B)\n -> Tm55 g a\n\nvar55 : {g : _} -> {a : _} -> Var55 g a -> Tm55 g a\nvar55 = \\ x, tm, var55, lam, app => var55 _ _ x\n\nlam55 : {g : _} -> {a : _} -> {B : _} -> Tm55 (snoc55 g a) B -> Tm55 g (arr55 a B)\nlam55 = \\ t, tm, var55, lam55, app => lam55 _ _ _ (t tm var55 lam55 app)\n\napp55 : {g:_}->{a:_}->{B:_} -> Tm55 g (arr55 a B) -> Tm55 g a -> Tm55 g B\napp55 = \\ t, u, tm, var55, lam55, app55 => app55 _ _ _ (t tm var55 lam55 app55) (u tm var55 lam55 app55)\n\nv055 : {g:_}->{a:_} -> Tm55 (snoc55 g a) a\nv055 = var55 vz55\n\nv155 : {g:_}->{a:_}-> {B:_}-> Tm55 (snoc55 (snoc55 g a) B) a\nv155 = var55 (vs55 vz55)\n\nv255 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm55 (snoc55 (snoc55 (snoc55 g a) B) C) a\nv255 = var55 (vs55 (vs55 vz55))\n\nv355 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm55 (snoc55 (snoc55 (snoc55 (snoc55 g a) B) C) D) a\nv355 = var55 (vs55 (vs55 (vs55 vz55)))\n\nv455 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm55 (snoc55 (snoc55 (snoc55 (snoc55 (snoc55 g a) B) C) D) E) a\nv455 = var55 (vs55 (vs55 (vs55 (vs55 vz55))))\n\ntest55 : {g:_}-> {a:_} -> Tm55 g (arr55 (arr55 a a) (arr55 a a))\ntest55  = lam55 (lam55 (app55 v155 (app55 v155 (app55 v155 (app55 v155 (app55 v155 (app55 v155 v055)))))))\nTy56 : Type\nTy56 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty56 : Ty56\nempty56 = \\ _, empty, _ => empty\n\narr56 : Ty56 -> Ty56 -> Ty56\narr56 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon56 : Type\nCon56 = (Con56 : Type)\n ->(nil  : Con56)\n ->(snoc : Con56 -> Ty56 -> Con56)\n -> Con56\n\nnil56 : Con56\nnil56 = \\ con, nil56, snoc => nil56\n\nsnoc56 : Con56 -> Ty56 -> Con56\nsnoc56 = \\ g, a, con, nil56, snoc56 => snoc56 (g con nil56 snoc56) a\n\nVar56 : Con56 -> Ty56 -> Type\nVar56 = \\ g, a =>\n    (Var56 : Con56 -> Ty56 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var56 (snoc56 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var56 g a -> Var56 (snoc56 g b) a)\n -> Var56 g a\n\nvz56 : {g : _}-> {a : _} -> Var56 (snoc56 g a) a\nvz56 = \\ var, vz56, vs => vz56 _ _\n\nvs56 : {g : _} -> {B : _} -> {a : _} -> Var56 g a -> Var56 (snoc56 g B) a\nvs56 = \\ x, var, vz56, vs56 => vs56 _ _ _ (x var vz56 vs56)\n\nTm56 : Con56 -> Ty56 -> Type\nTm56 = \\ g, a =>\n    (Tm56    : Con56 -> Ty56 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var56 g a -> Tm56 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm56 (snoc56 g a) B -> Tm56 g (arr56 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm56 g (arr56 a B) -> Tm56 g a -> Tm56 g B)\n -> Tm56 g a\n\nvar56 : {g : _} -> {a : _} -> Var56 g a -> Tm56 g a\nvar56 = \\ x, tm, var56, lam, app => var56 _ _ x\n\nlam56 : {g : _} -> {a : _} -> {B : _} -> Tm56 (snoc56 g a) B -> Tm56 g (arr56 a B)\nlam56 = \\ t, tm, var56, lam56, app => lam56 _ _ _ (t tm var56 lam56 app)\n\napp56 : {g:_}->{a:_}->{B:_} -> Tm56 g (arr56 a B) -> Tm56 g a -> Tm56 g B\napp56 = \\ t, u, tm, var56, lam56, app56 => app56 _ _ _ (t tm var56 lam56 app56) (u tm var56 lam56 app56)\n\nv056 : {g:_}->{a:_} -> Tm56 (snoc56 g a) a\nv056 = var56 vz56\n\nv156 : {g:_}->{a:_}-> {B:_}-> Tm56 (snoc56 (snoc56 g a) B) a\nv156 = var56 (vs56 vz56)\n\nv256 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm56 (snoc56 (snoc56 (snoc56 g a) B) C) a\nv256 = var56 (vs56 (vs56 vz56))\n\nv356 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm56 (snoc56 (snoc56 (snoc56 (snoc56 g a) B) C) D) a\nv356 = var56 (vs56 (vs56 (vs56 vz56)))\n\nv456 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm56 (snoc56 (snoc56 (snoc56 (snoc56 (snoc56 g a) B) C) D) E) a\nv456 = var56 (vs56 (vs56 (vs56 (vs56 vz56))))\n\ntest56 : {g:_}-> {a:_} -> Tm56 g (arr56 (arr56 a a) (arr56 a a))\ntest56  = lam56 (lam56 (app56 v156 (app56 v156 (app56 v156 (app56 v156 (app56 v156 (app56 v156 v056)))))))\nTy57 : Type\nTy57 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty57 : Ty57\nempty57 = \\ _, empty, _ => empty\n\narr57 : Ty57 -> Ty57 -> Ty57\narr57 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon57 : Type\nCon57 = (Con57 : Type)\n ->(nil  : Con57)\n ->(snoc : Con57 -> Ty57 -> Con57)\n -> Con57\n\nnil57 : Con57\nnil57 = \\ con, nil57, snoc => nil57\n\nsnoc57 : Con57 -> Ty57 -> Con57\nsnoc57 = \\ g, a, con, nil57, snoc57 => snoc57 (g con nil57 snoc57) a\n\nVar57 : Con57 -> Ty57 -> Type\nVar57 = \\ g, a =>\n    (Var57 : Con57 -> Ty57 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var57 (snoc57 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var57 g a -> Var57 (snoc57 g b) a)\n -> Var57 g a\n\nvz57 : {g : _}-> {a : _} -> Var57 (snoc57 g a) a\nvz57 = \\ var, vz57, vs => vz57 _ _\n\nvs57 : {g : _} -> {B : _} -> {a : _} -> Var57 g a -> Var57 (snoc57 g B) a\nvs57 = \\ x, var, vz57, vs57 => vs57 _ _ _ (x var vz57 vs57)\n\nTm57 : Con57 -> Ty57 -> Type\nTm57 = \\ g, a =>\n    (Tm57    : Con57 -> Ty57 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var57 g a -> Tm57 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm57 (snoc57 g a) B -> Tm57 g (arr57 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm57 g (arr57 a B) -> Tm57 g a -> Tm57 g B)\n -> Tm57 g a\n\nvar57 : {g : _} -> {a : _} -> Var57 g a -> Tm57 g a\nvar57 = \\ x, tm, var57, lam, app => var57 _ _ x\n\nlam57 : {g : _} -> {a : _} -> {B : _} -> Tm57 (snoc57 g a) B -> Tm57 g (arr57 a B)\nlam57 = \\ t, tm, var57, lam57, app => lam57 _ _ _ (t tm var57 lam57 app)\n\napp57 : {g:_}->{a:_}->{B:_} -> Tm57 g (arr57 a B) -> Tm57 g a -> Tm57 g B\napp57 = \\ t, u, tm, var57, lam57, app57 => app57 _ _ _ (t tm var57 lam57 app57) (u tm var57 lam57 app57)\n\nv057 : {g:_}->{a:_} -> Tm57 (snoc57 g a) a\nv057 = var57 vz57\n\nv157 : {g:_}->{a:_}-> {B:_}-> Tm57 (snoc57 (snoc57 g a) B) a\nv157 = var57 (vs57 vz57)\n\nv257 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm57 (snoc57 (snoc57 (snoc57 g a) B) C) a\nv257 = var57 (vs57 (vs57 vz57))\n\nv357 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm57 (snoc57 (snoc57 (snoc57 (snoc57 g a) B) C) D) a\nv357 = var57 (vs57 (vs57 (vs57 vz57)))\n\nv457 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm57 (snoc57 (snoc57 (snoc57 (snoc57 (snoc57 g a) B) C) D) E) a\nv457 = var57 (vs57 (vs57 (vs57 (vs57 vz57))))\n\ntest57 : {g:_}-> {a:_} -> Tm57 g (arr57 (arr57 a a) (arr57 a a))\ntest57  = lam57 (lam57 (app57 v157 (app57 v157 (app57 v157 (app57 v157 (app57 v157 (app57 v157 v057)))))))\nTy58 : Type\nTy58 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty58 : Ty58\nempty58 = \\ _, empty, _ => empty\n\narr58 : Ty58 -> Ty58 -> Ty58\narr58 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon58 : Type\nCon58 = (Con58 : Type)\n ->(nil  : Con58)\n ->(snoc : Con58 -> Ty58 -> Con58)\n -> Con58\n\nnil58 : Con58\nnil58 = \\ con, nil58, snoc => nil58\n\nsnoc58 : Con58 -> Ty58 -> Con58\nsnoc58 = \\ g, a, con, nil58, snoc58 => snoc58 (g con nil58 snoc58) a\n\nVar58 : Con58 -> Ty58 -> Type\nVar58 = \\ g, a =>\n    (Var58 : Con58 -> Ty58 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var58 (snoc58 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var58 g a -> Var58 (snoc58 g b) a)\n -> Var58 g a\n\nvz58 : {g : _}-> {a : _} -> Var58 (snoc58 g a) a\nvz58 = \\ var, vz58, vs => vz58 _ _\n\nvs58 : {g : _} -> {B : _} -> {a : _} -> Var58 g a -> Var58 (snoc58 g B) a\nvs58 = \\ x, var, vz58, vs58 => vs58 _ _ _ (x var vz58 vs58)\n\nTm58 : Con58 -> Ty58 -> Type\nTm58 = \\ g, a =>\n    (Tm58    : Con58 -> Ty58 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var58 g a -> Tm58 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm58 (snoc58 g a) B -> Tm58 g (arr58 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm58 g (arr58 a B) -> Tm58 g a -> Tm58 g B)\n -> Tm58 g a\n\nvar58 : {g : _} -> {a : _} -> Var58 g a -> Tm58 g a\nvar58 = \\ x, tm, var58, lam, app => var58 _ _ x\n\nlam58 : {g : _} -> {a : _} -> {B : _} -> Tm58 (snoc58 g a) B -> Tm58 g (arr58 a B)\nlam58 = \\ t, tm, var58, lam58, app => lam58 _ _ _ (t tm var58 lam58 app)\n\napp58 : {g:_}->{a:_}->{B:_} -> Tm58 g (arr58 a B) -> Tm58 g a -> Tm58 g B\napp58 = \\ t, u, tm, var58, lam58, app58 => app58 _ _ _ (t tm var58 lam58 app58) (u tm var58 lam58 app58)\n\nv058 : {g:_}->{a:_} -> Tm58 (snoc58 g a) a\nv058 = var58 vz58\n\nv158 : {g:_}->{a:_}-> {B:_}-> Tm58 (snoc58 (snoc58 g a) B) a\nv158 = var58 (vs58 vz58)\n\nv258 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm58 (snoc58 (snoc58 (snoc58 g a) B) C) a\nv258 = var58 (vs58 (vs58 vz58))\n\nv358 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm58 (snoc58 (snoc58 (snoc58 (snoc58 g a) B) C) D) a\nv358 = var58 (vs58 (vs58 (vs58 vz58)))\n\nv458 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm58 (snoc58 (snoc58 (snoc58 (snoc58 (snoc58 g a) B) C) D) E) a\nv458 = var58 (vs58 (vs58 (vs58 (vs58 vz58))))\n\ntest58 : {g:_}-> {a:_} -> Tm58 g (arr58 (arr58 a a) (arr58 a a))\ntest58  = lam58 (lam58 (app58 v158 (app58 v158 (app58 v158 (app58 v158 (app58 v158 (app58 v158 v058)))))))\nTy59 : Type\nTy59 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty59 : Ty59\nempty59 = \\ _, empty, _ => empty\n\narr59 : Ty59 -> Ty59 -> Ty59\narr59 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon59 : Type\nCon59 = (Con59 : Type)\n ->(nil  : Con59)\n ->(snoc : Con59 -> Ty59 -> Con59)\n -> Con59\n\nnil59 : Con59\nnil59 = \\ con, nil59, snoc => nil59\n\nsnoc59 : Con59 -> Ty59 -> Con59\nsnoc59 = \\ g, a, con, nil59, snoc59 => snoc59 (g con nil59 snoc59) a\n\nVar59 : Con59 -> Ty59 -> Type\nVar59 = \\ g, a =>\n    (Var59 : Con59 -> Ty59 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var59 (snoc59 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var59 g a -> Var59 (snoc59 g b) a)\n -> Var59 g a\n\nvz59 : {g : _}-> {a : _} -> Var59 (snoc59 g a) a\nvz59 = \\ var, vz59, vs => vz59 _ _\n\nvs59 : {g : _} -> {B : _} -> {a : _} -> Var59 g a -> Var59 (snoc59 g B) a\nvs59 = \\ x, var, vz59, vs59 => vs59 _ _ _ (x var vz59 vs59)\n\nTm59 : Con59 -> Ty59 -> Type\nTm59 = \\ g, a =>\n    (Tm59    : Con59 -> Ty59 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var59 g a -> Tm59 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm59 (snoc59 g a) B -> Tm59 g (arr59 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm59 g (arr59 a B) -> Tm59 g a -> Tm59 g B)\n -> Tm59 g a\n\nvar59 : {g : _} -> {a : _} -> Var59 g a -> Tm59 g a\nvar59 = \\ x, tm, var59, lam, app => var59 _ _ x\n\nlam59 : {g : _} -> {a : _} -> {B : _} -> Tm59 (snoc59 g a) B -> Tm59 g (arr59 a B)\nlam59 = \\ t, tm, var59, lam59, app => lam59 _ _ _ (t tm var59 lam59 app)\n\napp59 : {g:_}->{a:_}->{B:_} -> Tm59 g (arr59 a B) -> Tm59 g a -> Tm59 g B\napp59 = \\ t, u, tm, var59, lam59, app59 => app59 _ _ _ (t tm var59 lam59 app59) (u tm var59 lam59 app59)\n\nv059 : {g:_}->{a:_} -> Tm59 (snoc59 g a) a\nv059 = var59 vz59\n\nv159 : {g:_}->{a:_}-> {B:_}-> Tm59 (snoc59 (snoc59 g a) B) a\nv159 = var59 (vs59 vz59)\n\nv259 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm59 (snoc59 (snoc59 (snoc59 g a) B) C) a\nv259 = var59 (vs59 (vs59 vz59))\n\nv359 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm59 (snoc59 (snoc59 (snoc59 (snoc59 g a) B) C) D) a\nv359 = var59 (vs59 (vs59 (vs59 vz59)))\n\nv459 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm59 (snoc59 (snoc59 (snoc59 (snoc59 (snoc59 g a) B) C) D) E) a\nv459 = var59 (vs59 (vs59 (vs59 (vs59 vz59))))\n\ntest59 : {g:_}-> {a:_} -> Tm59 g (arr59 (arr59 a a) (arr59 a a))\ntest59  = lam59 (lam59 (app59 v159 (app59 v159 (app59 v159 (app59 v159 (app59 v159 (app59 v159 v059)))))))\nTy60 : Type\nTy60 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty60 : Ty60\nempty60 = \\ _, empty, _ => empty\n\narr60 : Ty60 -> Ty60 -> Ty60\narr60 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon60 : Type\nCon60 = (Con60 : Type)\n ->(nil  : Con60)\n ->(snoc : Con60 -> Ty60 -> Con60)\n -> Con60\n\nnil60 : Con60\nnil60 = \\ con, nil60, snoc => nil60\n\nsnoc60 : Con60 -> Ty60 -> Con60\nsnoc60 = \\ g, a, con, nil60, snoc60 => snoc60 (g con nil60 snoc60) a\n\nVar60 : Con60 -> Ty60 -> Type\nVar60 = \\ g, a =>\n    (Var60 : Con60 -> Ty60 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var60 (snoc60 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var60 g a -> Var60 (snoc60 g b) a)\n -> Var60 g a\n\nvz60 : {g : _}-> {a : _} -> Var60 (snoc60 g a) a\nvz60 = \\ var, vz60, vs => vz60 _ _\n\nvs60 : {g : _} -> {B : _} -> {a : _} -> Var60 g a -> Var60 (snoc60 g B) a\nvs60 = \\ x, var, vz60, vs60 => vs60 _ _ _ (x var vz60 vs60)\n\nTm60 : Con60 -> Ty60 -> Type\nTm60 = \\ g, a =>\n    (Tm60    : Con60 -> Ty60 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var60 g a -> Tm60 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm60 (snoc60 g a) B -> Tm60 g (arr60 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm60 g (arr60 a B) -> Tm60 g a -> Tm60 g B)\n -> Tm60 g a\n\nvar60 : {g : _} -> {a : _} -> Var60 g a -> Tm60 g a\nvar60 = \\ x, tm, var60, lam, app => var60 _ _ x\n\nlam60 : {g : _} -> {a : _} -> {B : _} -> Tm60 (snoc60 g a) B -> Tm60 g (arr60 a B)\nlam60 = \\ t, tm, var60, lam60, app => lam60 _ _ _ (t tm var60 lam60 app)\n\napp60 : {g:_}->{a:_}->{B:_} -> Tm60 g (arr60 a B) -> Tm60 g a -> Tm60 g B\napp60 = \\ t, u, tm, var60, lam60, app60 => app60 _ _ _ (t tm var60 lam60 app60) (u tm var60 lam60 app60)\n\nv060 : {g:_}->{a:_} -> Tm60 (snoc60 g a) a\nv060 = var60 vz60\n\nv160 : {g:_}->{a:_}-> {B:_}-> Tm60 (snoc60 (snoc60 g a) B) a\nv160 = var60 (vs60 vz60)\n\nv260 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm60 (snoc60 (snoc60 (snoc60 g a) B) C) a\nv260 = var60 (vs60 (vs60 vz60))\n\nv360 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm60 (snoc60 (snoc60 (snoc60 (snoc60 g a) B) C) D) a\nv360 = var60 (vs60 (vs60 (vs60 vz60)))\n\nv460 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm60 (snoc60 (snoc60 (snoc60 (snoc60 (snoc60 g a) B) C) D) E) a\nv460 = var60 (vs60 (vs60 (vs60 (vs60 vz60))))\n\ntest60 : {g:_}-> {a:_} -> Tm60 g (arr60 (arr60 a a) (arr60 a a))\ntest60  = lam60 (lam60 (app60 v160 (app60 v160 (app60 v160 (app60 v160 (app60 v160 (app60 v160 v060)))))))\nTy61 : Type\nTy61 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty61 : Ty61\nempty61 = \\ _, empty, _ => empty\n\narr61 : Ty61 -> Ty61 -> Ty61\narr61 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon61 : Type\nCon61 = (Con61 : Type)\n ->(nil  : Con61)\n ->(snoc : Con61 -> Ty61 -> Con61)\n -> Con61\n\nnil61 : Con61\nnil61 = \\ con, nil61, snoc => nil61\n\nsnoc61 : Con61 -> Ty61 -> Con61\nsnoc61 = \\ g, a, con, nil61, snoc61 => snoc61 (g con nil61 snoc61) a\n\nVar61 : Con61 -> Ty61 -> Type\nVar61 = \\ g, a =>\n    (Var61 : Con61 -> Ty61 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var61 (snoc61 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var61 g a -> Var61 (snoc61 g b) a)\n -> Var61 g a\n\nvz61 : {g : _}-> {a : _} -> Var61 (snoc61 g a) a\nvz61 = \\ var, vz61, vs => vz61 _ _\n\nvs61 : {g : _} -> {B : _} -> {a : _} -> Var61 g a -> Var61 (snoc61 g B) a\nvs61 = \\ x, var, vz61, vs61 => vs61 _ _ _ (x var vz61 vs61)\n\nTm61 : Con61 -> Ty61 -> Type\nTm61 = \\ g, a =>\n    (Tm61    : Con61 -> Ty61 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var61 g a -> Tm61 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm61 (snoc61 g a) B -> Tm61 g (arr61 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm61 g (arr61 a B) -> Tm61 g a -> Tm61 g B)\n -> Tm61 g a\n\nvar61 : {g : _} -> {a : _} -> Var61 g a -> Tm61 g a\nvar61 = \\ x, tm, var61, lam, app => var61 _ _ x\n\nlam61 : {g : _} -> {a : _} -> {B : _} -> Tm61 (snoc61 g a) B -> Tm61 g (arr61 a B)\nlam61 = \\ t, tm, var61, lam61, app => lam61 _ _ _ (t tm var61 lam61 app)\n\napp61 : {g:_}->{a:_}->{B:_} -> Tm61 g (arr61 a B) -> Tm61 g a -> Tm61 g B\napp61 = \\ t, u, tm, var61, lam61, app61 => app61 _ _ _ (t tm var61 lam61 app61) (u tm var61 lam61 app61)\n\nv061 : {g:_}->{a:_} -> Tm61 (snoc61 g a) a\nv061 = var61 vz61\n\nv161 : {g:_}->{a:_}-> {B:_}-> Tm61 (snoc61 (snoc61 g a) B) a\nv161 = var61 (vs61 vz61)\n\nv261 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm61 (snoc61 (snoc61 (snoc61 g a) B) C) a\nv261 = var61 (vs61 (vs61 vz61))\n\nv361 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm61 (snoc61 (snoc61 (snoc61 (snoc61 g a) B) C) D) a\nv361 = var61 (vs61 (vs61 (vs61 vz61)))\n\nv461 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm61 (snoc61 (snoc61 (snoc61 (snoc61 (snoc61 g a) B) C) D) E) a\nv461 = var61 (vs61 (vs61 (vs61 (vs61 vz61))))\n\ntest61 : {g:_}-> {a:_} -> Tm61 g (arr61 (arr61 a a) (arr61 a a))\ntest61  = lam61 (lam61 (app61 v161 (app61 v161 (app61 v161 (app61 v161 (app61 v161 (app61 v161 v061)))))))\nTy62 : Type\nTy62 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty62 : Ty62\nempty62 = \\ _, empty, _ => empty\n\narr62 : Ty62 -> Ty62 -> Ty62\narr62 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon62 : Type\nCon62 = (Con62 : Type)\n ->(nil  : Con62)\n ->(snoc : Con62 -> Ty62 -> Con62)\n -> Con62\n\nnil62 : Con62\nnil62 = \\ con, nil62, snoc => nil62\n\nsnoc62 : Con62 -> Ty62 -> Con62\nsnoc62 = \\ g, a, con, nil62, snoc62 => snoc62 (g con nil62 snoc62) a\n\nVar62 : Con62 -> Ty62 -> Type\nVar62 = \\ g, a =>\n    (Var62 : Con62 -> Ty62 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var62 (snoc62 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var62 g a -> Var62 (snoc62 g b) a)\n -> Var62 g a\n\nvz62 : {g : _}-> {a : _} -> Var62 (snoc62 g a) a\nvz62 = \\ var, vz62, vs => vz62 _ _\n\nvs62 : {g : _} -> {B : _} -> {a : _} -> Var62 g a -> Var62 (snoc62 g B) a\nvs62 = \\ x, var, vz62, vs62 => vs62 _ _ _ (x var vz62 vs62)\n\nTm62 : Con62 -> Ty62 -> Type\nTm62 = \\ g, a =>\n    (Tm62    : Con62 -> Ty62 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var62 g a -> Tm62 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm62 (snoc62 g a) B -> Tm62 g (arr62 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm62 g (arr62 a B) -> Tm62 g a -> Tm62 g B)\n -> Tm62 g a\n\nvar62 : {g : _} -> {a : _} -> Var62 g a -> Tm62 g a\nvar62 = \\ x, tm, var62, lam, app => var62 _ _ x\n\nlam62 : {g : _} -> {a : _} -> {B : _} -> Tm62 (snoc62 g a) B -> Tm62 g (arr62 a B)\nlam62 = \\ t, tm, var62, lam62, app => lam62 _ _ _ (t tm var62 lam62 app)\n\napp62 : {g:_}->{a:_}->{B:_} -> Tm62 g (arr62 a B) -> Tm62 g a -> Tm62 g B\napp62 = \\ t, u, tm, var62, lam62, app62 => app62 _ _ _ (t tm var62 lam62 app62) (u tm var62 lam62 app62)\n\nv062 : {g:_}->{a:_} -> Tm62 (snoc62 g a) a\nv062 = var62 vz62\n\nv162 : {g:_}->{a:_}-> {B:_}-> Tm62 (snoc62 (snoc62 g a) B) a\nv162 = var62 (vs62 vz62)\n\nv262 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm62 (snoc62 (snoc62 (snoc62 g a) B) C) a\nv262 = var62 (vs62 (vs62 vz62))\n\nv362 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm62 (snoc62 (snoc62 (snoc62 (snoc62 g a) B) C) D) a\nv362 = var62 (vs62 (vs62 (vs62 vz62)))\n\nv462 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm62 (snoc62 (snoc62 (snoc62 (snoc62 (snoc62 g a) B) C) D) E) a\nv462 = var62 (vs62 (vs62 (vs62 (vs62 vz62))))\n\ntest62 : {g:_}-> {a:_} -> Tm62 g (arr62 (arr62 a a) (arr62 a a))\ntest62  = lam62 (lam62 (app62 v162 (app62 v162 (app62 v162 (app62 v162 (app62 v162 (app62 v162 v062)))))))\nTy63 : Type\nTy63 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty63 : Ty63\nempty63 = \\ _, empty, _ => empty\n\narr63 : Ty63 -> Ty63 -> Ty63\narr63 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon63 : Type\nCon63 = (Con63 : Type)\n ->(nil  : Con63)\n ->(snoc : Con63 -> Ty63 -> Con63)\n -> Con63\n\nnil63 : Con63\nnil63 = \\ con, nil63, snoc => nil63\n\nsnoc63 : Con63 -> Ty63 -> Con63\nsnoc63 = \\ g, a, con, nil63, snoc63 => snoc63 (g con nil63 snoc63) a\n\nVar63 : Con63 -> Ty63 -> Type\nVar63 = \\ g, a =>\n    (Var63 : Con63 -> Ty63 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var63 (snoc63 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var63 g a -> Var63 (snoc63 g b) a)\n -> Var63 g a\n\nvz63 : {g : _}-> {a : _} -> Var63 (snoc63 g a) a\nvz63 = \\ var, vz63, vs => vz63 _ _\n\nvs63 : {g : _} -> {B : _} -> {a : _} -> Var63 g a -> Var63 (snoc63 g B) a\nvs63 = \\ x, var, vz63, vs63 => vs63 _ _ _ (x var vz63 vs63)\n\nTm63 : Con63 -> Ty63 -> Type\nTm63 = \\ g, a =>\n    (Tm63    : Con63 -> Ty63 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var63 g a -> Tm63 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm63 (snoc63 g a) B -> Tm63 g (arr63 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm63 g (arr63 a B) -> Tm63 g a -> Tm63 g B)\n -> Tm63 g a\n\nvar63 : {g : _} -> {a : _} -> Var63 g a -> Tm63 g a\nvar63 = \\ x, tm, var63, lam, app => var63 _ _ x\n\nlam63 : {g : _} -> {a : _} -> {B : _} -> Tm63 (snoc63 g a) B -> Tm63 g (arr63 a B)\nlam63 = \\ t, tm, var63, lam63, app => lam63 _ _ _ (t tm var63 lam63 app)\n\napp63 : {g:_}->{a:_}->{B:_} -> Tm63 g (arr63 a B) -> Tm63 g a -> Tm63 g B\napp63 = \\ t, u, tm, var63, lam63, app63 => app63 _ _ _ (t tm var63 lam63 app63) (u tm var63 lam63 app63)\n\nv063 : {g:_}->{a:_} -> Tm63 (snoc63 g a) a\nv063 = var63 vz63\n\nv163 : {g:_}->{a:_}-> {B:_}-> Tm63 (snoc63 (snoc63 g a) B) a\nv163 = var63 (vs63 vz63)\n\nv263 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm63 (snoc63 (snoc63 (snoc63 g a) B) C) a\nv263 = var63 (vs63 (vs63 vz63))\n\nv363 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm63 (snoc63 (snoc63 (snoc63 (snoc63 g a) B) C) D) a\nv363 = var63 (vs63 (vs63 (vs63 vz63)))\n\nv463 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm63 (snoc63 (snoc63 (snoc63 (snoc63 (snoc63 g a) B) C) D) E) a\nv463 = var63 (vs63 (vs63 (vs63 (vs63 vz63))))\n\ntest63 : {g:_}-> {a:_} -> Tm63 g (arr63 (arr63 a a) (arr63 a a))\ntest63  = lam63 (lam63 (app63 v163 (app63 v163 (app63 v163 (app63 v163 (app63 v163 (app63 v163 v063)))))))\nTy64 : Type\nTy64 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty64 : Ty64\nempty64 = \\ _, empty, _ => empty\n\narr64 : Ty64 -> Ty64 -> Ty64\narr64 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon64 : Type\nCon64 = (Con64 : Type)\n ->(nil  : Con64)\n ->(snoc : Con64 -> Ty64 -> Con64)\n -> Con64\n\nnil64 : Con64\nnil64 = \\ con, nil64, snoc => nil64\n\nsnoc64 : Con64 -> Ty64 -> Con64\nsnoc64 = \\ g, a, con, nil64, snoc64 => snoc64 (g con nil64 snoc64) a\n\nVar64 : Con64 -> Ty64 -> Type\nVar64 = \\ g, a =>\n    (Var64 : Con64 -> Ty64 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var64 (snoc64 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var64 g a -> Var64 (snoc64 g b) a)\n -> Var64 g a\n\nvz64 : {g : _}-> {a : _} -> Var64 (snoc64 g a) a\nvz64 = \\ var, vz64, vs => vz64 _ _\n\nvs64 : {g : _} -> {B : _} -> {a : _} -> Var64 g a -> Var64 (snoc64 g B) a\nvs64 = \\ x, var, vz64, vs64 => vs64 _ _ _ (x var vz64 vs64)\n\nTm64 : Con64 -> Ty64 -> Type\nTm64 = \\ g, a =>\n    (Tm64    : Con64 -> Ty64 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var64 g a -> Tm64 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm64 (snoc64 g a) B -> Tm64 g (arr64 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm64 g (arr64 a B) -> Tm64 g a -> Tm64 g B)\n -> Tm64 g a\n\nvar64 : {g : _} -> {a : _} -> Var64 g a -> Tm64 g a\nvar64 = \\ x, tm, var64, lam, app => var64 _ _ x\n\nlam64 : {g : _} -> {a : _} -> {B : _} -> Tm64 (snoc64 g a) B -> Tm64 g (arr64 a B)\nlam64 = \\ t, tm, var64, lam64, app => lam64 _ _ _ (t tm var64 lam64 app)\n\napp64 : {g:_}->{a:_}->{B:_} -> Tm64 g (arr64 a B) -> Tm64 g a -> Tm64 g B\napp64 = \\ t, u, tm, var64, lam64, app64 => app64 _ _ _ (t tm var64 lam64 app64) (u tm var64 lam64 app64)\n\nv064 : {g:_}->{a:_} -> Tm64 (snoc64 g a) a\nv064 = var64 vz64\n\nv164 : {g:_}->{a:_}-> {B:_}-> Tm64 (snoc64 (snoc64 g a) B) a\nv164 = var64 (vs64 vz64)\n\nv264 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm64 (snoc64 (snoc64 (snoc64 g a) B) C) a\nv264 = var64 (vs64 (vs64 vz64))\n\nv364 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm64 (snoc64 (snoc64 (snoc64 (snoc64 g a) B) C) D) a\nv364 = var64 (vs64 (vs64 (vs64 vz64)))\n\nv464 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm64 (snoc64 (snoc64 (snoc64 (snoc64 (snoc64 g a) B) C) D) E) a\nv464 = var64 (vs64 (vs64 (vs64 (vs64 vz64))))\n\ntest64 : {g:_}-> {a:_} -> Tm64 g (arr64 (arr64 a a) (arr64 a a))\ntest64  = lam64 (lam64 (app64 v164 (app64 v164 (app64 v164 (app64 v164 (app64 v164 (app64 v164 v064)))))))\nTy65 : Type\nTy65 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty65 : Ty65\nempty65 = \\ _, empty, _ => empty\n\narr65 : Ty65 -> Ty65 -> Ty65\narr65 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon65 : Type\nCon65 = (Con65 : Type)\n ->(nil  : Con65)\n ->(snoc : Con65 -> Ty65 -> Con65)\n -> Con65\n\nnil65 : Con65\nnil65 = \\ con, nil65, snoc => nil65\n\nsnoc65 : Con65 -> Ty65 -> Con65\nsnoc65 = \\ g, a, con, nil65, snoc65 => snoc65 (g con nil65 snoc65) a\n\nVar65 : Con65 -> Ty65 -> Type\nVar65 = \\ g, a =>\n    (Var65 : Con65 -> Ty65 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var65 (snoc65 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var65 g a -> Var65 (snoc65 g b) a)\n -> Var65 g a\n\nvz65 : {g : _}-> {a : _} -> Var65 (snoc65 g a) a\nvz65 = \\ var, vz65, vs => vz65 _ _\n\nvs65 : {g : _} -> {B : _} -> {a : _} -> Var65 g a -> Var65 (snoc65 g B) a\nvs65 = \\ x, var, vz65, vs65 => vs65 _ _ _ (x var vz65 vs65)\n\nTm65 : Con65 -> Ty65 -> Type\nTm65 = \\ g, a =>\n    (Tm65    : Con65 -> Ty65 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var65 g a -> Tm65 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm65 (snoc65 g a) B -> Tm65 g (arr65 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm65 g (arr65 a B) -> Tm65 g a -> Tm65 g B)\n -> Tm65 g a\n\nvar65 : {g : _} -> {a : _} -> Var65 g a -> Tm65 g a\nvar65 = \\ x, tm, var65, lam, app => var65 _ _ x\n\nlam65 : {g : _} -> {a : _} -> {B : _} -> Tm65 (snoc65 g a) B -> Tm65 g (arr65 a B)\nlam65 = \\ t, tm, var65, lam65, app => lam65 _ _ _ (t tm var65 lam65 app)\n\napp65 : {g:_}->{a:_}->{B:_} -> Tm65 g (arr65 a B) -> Tm65 g a -> Tm65 g B\napp65 = \\ t, u, tm, var65, lam65, app65 => app65 _ _ _ (t tm var65 lam65 app65) (u tm var65 lam65 app65)\n\nv065 : {g:_}->{a:_} -> Tm65 (snoc65 g a) a\nv065 = var65 vz65\n\nv165 : {g:_}->{a:_}-> {B:_}-> Tm65 (snoc65 (snoc65 g a) B) a\nv165 = var65 (vs65 vz65)\n\nv265 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm65 (snoc65 (snoc65 (snoc65 g a) B) C) a\nv265 = var65 (vs65 (vs65 vz65))\n\nv365 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm65 (snoc65 (snoc65 (snoc65 (snoc65 g a) B) C) D) a\nv365 = var65 (vs65 (vs65 (vs65 vz65)))\n\nv465 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm65 (snoc65 (snoc65 (snoc65 (snoc65 (snoc65 g a) B) C) D) E) a\nv465 = var65 (vs65 (vs65 (vs65 (vs65 vz65))))\n\ntest65 : {g:_}-> {a:_} -> Tm65 g (arr65 (arr65 a a) (arr65 a a))\ntest65  = lam65 (lam65 (app65 v165 (app65 v165 (app65 v165 (app65 v165 (app65 v165 (app65 v165 v065)))))))\nTy66 : Type\nTy66 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty66 : Ty66\nempty66 = \\ _, empty, _ => empty\n\narr66 : Ty66 -> Ty66 -> Ty66\narr66 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon66 : Type\nCon66 = (Con66 : Type)\n ->(nil  : Con66)\n ->(snoc : Con66 -> Ty66 -> Con66)\n -> Con66\n\nnil66 : Con66\nnil66 = \\ con, nil66, snoc => nil66\n\nsnoc66 : Con66 -> Ty66 -> Con66\nsnoc66 = \\ g, a, con, nil66, snoc66 => snoc66 (g con nil66 snoc66) a\n\nVar66 : Con66 -> Ty66 -> Type\nVar66 = \\ g, a =>\n    (Var66 : Con66 -> Ty66 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var66 (snoc66 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var66 g a -> Var66 (snoc66 g b) a)\n -> Var66 g a\n\nvz66 : {g : _}-> {a : _} -> Var66 (snoc66 g a) a\nvz66 = \\ var, vz66, vs => vz66 _ _\n\nvs66 : {g : _} -> {B : _} -> {a : _} -> Var66 g a -> Var66 (snoc66 g B) a\nvs66 = \\ x, var, vz66, vs66 => vs66 _ _ _ (x var vz66 vs66)\n\nTm66 : Con66 -> Ty66 -> Type\nTm66 = \\ g, a =>\n    (Tm66    : Con66 -> Ty66 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var66 g a -> Tm66 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm66 (snoc66 g a) B -> Tm66 g (arr66 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm66 g (arr66 a B) -> Tm66 g a -> Tm66 g B)\n -> Tm66 g a\n\nvar66 : {g : _} -> {a : _} -> Var66 g a -> Tm66 g a\nvar66 = \\ x, tm, var66, lam, app => var66 _ _ x\n\nlam66 : {g : _} -> {a : _} -> {B : _} -> Tm66 (snoc66 g a) B -> Tm66 g (arr66 a B)\nlam66 = \\ t, tm, var66, lam66, app => lam66 _ _ _ (t tm var66 lam66 app)\n\napp66 : {g:_}->{a:_}->{B:_} -> Tm66 g (arr66 a B) -> Tm66 g a -> Tm66 g B\napp66 = \\ t, u, tm, var66, lam66, app66 => app66 _ _ _ (t tm var66 lam66 app66) (u tm var66 lam66 app66)\n\nv066 : {g:_}->{a:_} -> Tm66 (snoc66 g a) a\nv066 = var66 vz66\n\nv166 : {g:_}->{a:_}-> {B:_}-> Tm66 (snoc66 (snoc66 g a) B) a\nv166 = var66 (vs66 vz66)\n\nv266 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm66 (snoc66 (snoc66 (snoc66 g a) B) C) a\nv266 = var66 (vs66 (vs66 vz66))\n\nv366 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm66 (snoc66 (snoc66 (snoc66 (snoc66 g a) B) C) D) a\nv366 = var66 (vs66 (vs66 (vs66 vz66)))\n\nv466 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm66 (snoc66 (snoc66 (snoc66 (snoc66 (snoc66 g a) B) C) D) E) a\nv466 = var66 (vs66 (vs66 (vs66 (vs66 vz66))))\n\ntest66 : {g:_}-> {a:_} -> Tm66 g (arr66 (arr66 a a) (arr66 a a))\ntest66  = lam66 (lam66 (app66 v166 (app66 v166 (app66 v166 (app66 v166 (app66 v166 (app66 v166 v066)))))))\nTy67 : Type\nTy67 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty67 : Ty67\nempty67 = \\ _, empty, _ => empty\n\narr67 : Ty67 -> Ty67 -> Ty67\narr67 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon67 : Type\nCon67 = (Con67 : Type)\n ->(nil  : Con67)\n ->(snoc : Con67 -> Ty67 -> Con67)\n -> Con67\n\nnil67 : Con67\nnil67 = \\ con, nil67, snoc => nil67\n\nsnoc67 : Con67 -> Ty67 -> Con67\nsnoc67 = \\ g, a, con, nil67, snoc67 => snoc67 (g con nil67 snoc67) a\n\nVar67 : Con67 -> Ty67 -> Type\nVar67 = \\ g, a =>\n    (Var67 : Con67 -> Ty67 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var67 (snoc67 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var67 g a -> Var67 (snoc67 g b) a)\n -> Var67 g a\n\nvz67 : {g : _}-> {a : _} -> Var67 (snoc67 g a) a\nvz67 = \\ var, vz67, vs => vz67 _ _\n\nvs67 : {g : _} -> {B : _} -> {a : _} -> Var67 g a -> Var67 (snoc67 g B) a\nvs67 = \\ x, var, vz67, vs67 => vs67 _ _ _ (x var vz67 vs67)\n\nTm67 : Con67 -> Ty67 -> Type\nTm67 = \\ g, a =>\n    (Tm67    : Con67 -> Ty67 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var67 g a -> Tm67 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm67 (snoc67 g a) B -> Tm67 g (arr67 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm67 g (arr67 a B) -> Tm67 g a -> Tm67 g B)\n -> Tm67 g a\n\nvar67 : {g : _} -> {a : _} -> Var67 g a -> Tm67 g a\nvar67 = \\ x, tm, var67, lam, app => var67 _ _ x\n\nlam67 : {g : _} -> {a : _} -> {B : _} -> Tm67 (snoc67 g a) B -> Tm67 g (arr67 a B)\nlam67 = \\ t, tm, var67, lam67, app => lam67 _ _ _ (t tm var67 lam67 app)\n\napp67 : {g:_}->{a:_}->{B:_} -> Tm67 g (arr67 a B) -> Tm67 g a -> Tm67 g B\napp67 = \\ t, u, tm, var67, lam67, app67 => app67 _ _ _ (t tm var67 lam67 app67) (u tm var67 lam67 app67)\n\nv067 : {g:_}->{a:_} -> Tm67 (snoc67 g a) a\nv067 = var67 vz67\n\nv167 : {g:_}->{a:_}-> {B:_}-> Tm67 (snoc67 (snoc67 g a) B) a\nv167 = var67 (vs67 vz67)\n\nv267 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm67 (snoc67 (snoc67 (snoc67 g a) B) C) a\nv267 = var67 (vs67 (vs67 vz67))\n\nv367 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm67 (snoc67 (snoc67 (snoc67 (snoc67 g a) B) C) D) a\nv367 = var67 (vs67 (vs67 (vs67 vz67)))\n\nv467 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm67 (snoc67 (snoc67 (snoc67 (snoc67 (snoc67 g a) B) C) D) E) a\nv467 = var67 (vs67 (vs67 (vs67 (vs67 vz67))))\n\ntest67 : {g:_}-> {a:_} -> Tm67 g (arr67 (arr67 a a) (arr67 a a))\ntest67  = lam67 (lam67 (app67 v167 (app67 v167 (app67 v167 (app67 v167 (app67 v167 (app67 v167 v067)))))))\nTy68 : Type\nTy68 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty68 : Ty68\nempty68 = \\ _, empty, _ => empty\n\narr68 : Ty68 -> Ty68 -> Ty68\narr68 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon68 : Type\nCon68 = (Con68 : Type)\n ->(nil  : Con68)\n ->(snoc : Con68 -> Ty68 -> Con68)\n -> Con68\n\nnil68 : Con68\nnil68 = \\ con, nil68, snoc => nil68\n\nsnoc68 : Con68 -> Ty68 -> Con68\nsnoc68 = \\ g, a, con, nil68, snoc68 => snoc68 (g con nil68 snoc68) a\n\nVar68 : Con68 -> Ty68 -> Type\nVar68 = \\ g, a =>\n    (Var68 : Con68 -> Ty68 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var68 (snoc68 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var68 g a -> Var68 (snoc68 g b) a)\n -> Var68 g a\n\nvz68 : {g : _}-> {a : _} -> Var68 (snoc68 g a) a\nvz68 = \\ var, vz68, vs => vz68 _ _\n\nvs68 : {g : _} -> {B : _} -> {a : _} -> Var68 g a -> Var68 (snoc68 g B) a\nvs68 = \\ x, var, vz68, vs68 => vs68 _ _ _ (x var vz68 vs68)\n\nTm68 : Con68 -> Ty68 -> Type\nTm68 = \\ g, a =>\n    (Tm68    : Con68 -> Ty68 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var68 g a -> Tm68 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm68 (snoc68 g a) B -> Tm68 g (arr68 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm68 g (arr68 a B) -> Tm68 g a -> Tm68 g B)\n -> Tm68 g a\n\nvar68 : {g : _} -> {a : _} -> Var68 g a -> Tm68 g a\nvar68 = \\ x, tm, var68, lam, app => var68 _ _ x\n\nlam68 : {g : _} -> {a : _} -> {B : _} -> Tm68 (snoc68 g a) B -> Tm68 g (arr68 a B)\nlam68 = \\ t, tm, var68, lam68, app => lam68 _ _ _ (t tm var68 lam68 app)\n\napp68 : {g:_}->{a:_}->{B:_} -> Tm68 g (arr68 a B) -> Tm68 g a -> Tm68 g B\napp68 = \\ t, u, tm, var68, lam68, app68 => app68 _ _ _ (t tm var68 lam68 app68) (u tm var68 lam68 app68)\n\nv068 : {g:_}->{a:_} -> Tm68 (snoc68 g a) a\nv068 = var68 vz68\n\nv168 : {g:_}->{a:_}-> {B:_}-> Tm68 (snoc68 (snoc68 g a) B) a\nv168 = var68 (vs68 vz68)\n\nv268 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm68 (snoc68 (snoc68 (snoc68 g a) B) C) a\nv268 = var68 (vs68 (vs68 vz68))\n\nv368 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm68 (snoc68 (snoc68 (snoc68 (snoc68 g a) B) C) D) a\nv368 = var68 (vs68 (vs68 (vs68 vz68)))\n\nv468 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm68 (snoc68 (snoc68 (snoc68 (snoc68 (snoc68 g a) B) C) D) E) a\nv468 = var68 (vs68 (vs68 (vs68 (vs68 vz68))))\n\ntest68 : {g:_}-> {a:_} -> Tm68 g (arr68 (arr68 a a) (arr68 a a))\ntest68  = lam68 (lam68 (app68 v168 (app68 v168 (app68 v168 (app68 v168 (app68 v168 (app68 v168 v068)))))))\nTy69 : Type\nTy69 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty69 : Ty69\nempty69 = \\ _, empty, _ => empty\n\narr69 : Ty69 -> Ty69 -> Ty69\narr69 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon69 : Type\nCon69 = (Con69 : Type)\n ->(nil  : Con69)\n ->(snoc : Con69 -> Ty69 -> Con69)\n -> Con69\n\nnil69 : Con69\nnil69 = \\ con, nil69, snoc => nil69\n\nsnoc69 : Con69 -> Ty69 -> Con69\nsnoc69 = \\ g, a, con, nil69, snoc69 => snoc69 (g con nil69 snoc69) a\n\nVar69 : Con69 -> Ty69 -> Type\nVar69 = \\ g, a =>\n    (Var69 : Con69 -> Ty69 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var69 (snoc69 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var69 g a -> Var69 (snoc69 g b) a)\n -> Var69 g a\n\nvz69 : {g : _}-> {a : _} -> Var69 (snoc69 g a) a\nvz69 = \\ var, vz69, vs => vz69 _ _\n\nvs69 : {g : _} -> {B : _} -> {a : _} -> Var69 g a -> Var69 (snoc69 g B) a\nvs69 = \\ x, var, vz69, vs69 => vs69 _ _ _ (x var vz69 vs69)\n\nTm69 : Con69 -> Ty69 -> Type\nTm69 = \\ g, a =>\n    (Tm69    : Con69 -> Ty69 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var69 g a -> Tm69 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm69 (snoc69 g a) B -> Tm69 g (arr69 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm69 g (arr69 a B) -> Tm69 g a -> Tm69 g B)\n -> Tm69 g a\n\nvar69 : {g : _} -> {a : _} -> Var69 g a -> Tm69 g a\nvar69 = \\ x, tm, var69, lam, app => var69 _ _ x\n\nlam69 : {g : _} -> {a : _} -> {B : _} -> Tm69 (snoc69 g a) B -> Tm69 g (arr69 a B)\nlam69 = \\ t, tm, var69, lam69, app => lam69 _ _ _ (t tm var69 lam69 app)\n\napp69 : {g:_}->{a:_}->{B:_} -> Tm69 g (arr69 a B) -> Tm69 g a -> Tm69 g B\napp69 = \\ t, u, tm, var69, lam69, app69 => app69 _ _ _ (t tm var69 lam69 app69) (u tm var69 lam69 app69)\n\nv069 : {g:_}->{a:_} -> Tm69 (snoc69 g a) a\nv069 = var69 vz69\n\nv169 : {g:_}->{a:_}-> {B:_}-> Tm69 (snoc69 (snoc69 g a) B) a\nv169 = var69 (vs69 vz69)\n\nv269 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm69 (snoc69 (snoc69 (snoc69 g a) B) C) a\nv269 = var69 (vs69 (vs69 vz69))\n\nv369 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm69 (snoc69 (snoc69 (snoc69 (snoc69 g a) B) C) D) a\nv369 = var69 (vs69 (vs69 (vs69 vz69)))\n\nv469 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm69 (snoc69 (snoc69 (snoc69 (snoc69 (snoc69 g a) B) C) D) E) a\nv469 = var69 (vs69 (vs69 (vs69 (vs69 vz69))))\n\ntest69 : {g:_}-> {a:_} -> Tm69 g (arr69 (arr69 a a) (arr69 a a))\ntest69  = lam69 (lam69 (app69 v169 (app69 v169 (app69 v169 (app69 v169 (app69 v169 (app69 v169 v069)))))))\nTy70 : Type\nTy70 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty70 : Ty70\nempty70 = \\ _, empty, _ => empty\n\narr70 : Ty70 -> Ty70 -> Ty70\narr70 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon70 : Type\nCon70 = (Con70 : Type)\n ->(nil  : Con70)\n ->(snoc : Con70 -> Ty70 -> Con70)\n -> Con70\n\nnil70 : Con70\nnil70 = \\ con, nil70, snoc => nil70\n\nsnoc70 : Con70 -> Ty70 -> Con70\nsnoc70 = \\ g, a, con, nil70, snoc70 => snoc70 (g con nil70 snoc70) a\n\nVar70 : Con70 -> Ty70 -> Type\nVar70 = \\ g, a =>\n    (Var70 : Con70 -> Ty70 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var70 (snoc70 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var70 g a -> Var70 (snoc70 g b) a)\n -> Var70 g a\n\nvz70 : {g : _}-> {a : _} -> Var70 (snoc70 g a) a\nvz70 = \\ var, vz70, vs => vz70 _ _\n\nvs70 : {g : _} -> {B : _} -> {a : _} -> Var70 g a -> Var70 (snoc70 g B) a\nvs70 = \\ x, var, vz70, vs70 => vs70 _ _ _ (x var vz70 vs70)\n\nTm70 : Con70 -> Ty70 -> Type\nTm70 = \\ g, a =>\n    (Tm70    : Con70 -> Ty70 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var70 g a -> Tm70 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm70 (snoc70 g a) B -> Tm70 g (arr70 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm70 g (arr70 a B) -> Tm70 g a -> Tm70 g B)\n -> Tm70 g a\n\nvar70 : {g : _} -> {a : _} -> Var70 g a -> Tm70 g a\nvar70 = \\ x, tm, var70, lam, app => var70 _ _ x\n\nlam70 : {g : _} -> {a : _} -> {B : _} -> Tm70 (snoc70 g a) B -> Tm70 g (arr70 a B)\nlam70 = \\ t, tm, var70, lam70, app => lam70 _ _ _ (t tm var70 lam70 app)\n\napp70 : {g:_}->{a:_}->{B:_} -> Tm70 g (arr70 a B) -> Tm70 g a -> Tm70 g B\napp70 = \\ t, u, tm, var70, lam70, app70 => app70 _ _ _ (t tm var70 lam70 app70) (u tm var70 lam70 app70)\n\nv070 : {g:_}->{a:_} -> Tm70 (snoc70 g a) a\nv070 = var70 vz70\n\nv170 : {g:_}->{a:_}-> {B:_}-> Tm70 (snoc70 (snoc70 g a) B) a\nv170 = var70 (vs70 vz70)\n\nv270 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm70 (snoc70 (snoc70 (snoc70 g a) B) C) a\nv270 = var70 (vs70 (vs70 vz70))\n\nv370 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm70 (snoc70 (snoc70 (snoc70 (snoc70 g a) B) C) D) a\nv370 = var70 (vs70 (vs70 (vs70 vz70)))\n\nv470 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm70 (snoc70 (snoc70 (snoc70 (snoc70 (snoc70 g a) B) C) D) E) a\nv470 = var70 (vs70 (vs70 (vs70 (vs70 vz70))))\n\ntest70 : {g:_}-> {a:_} -> Tm70 g (arr70 (arr70 a a) (arr70 a a))\ntest70  = lam70 (lam70 (app70 v170 (app70 v170 (app70 v170 (app70 v170 (app70 v170 (app70 v170 v070)))))))\nTy71 : Type\nTy71 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty71 : Ty71\nempty71 = \\ _, empty, _ => empty\n\narr71 : Ty71 -> Ty71 -> Ty71\narr71 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon71 : Type\nCon71 = (Con71 : Type)\n ->(nil  : Con71)\n ->(snoc : Con71 -> Ty71 -> Con71)\n -> Con71\n\nnil71 : Con71\nnil71 = \\ con, nil71, snoc => nil71\n\nsnoc71 : Con71 -> Ty71 -> Con71\nsnoc71 = \\ g, a, con, nil71, snoc71 => snoc71 (g con nil71 snoc71) a\n\nVar71 : Con71 -> Ty71 -> Type\nVar71 = \\ g, a =>\n    (Var71 : Con71 -> Ty71 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var71 (snoc71 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var71 g a -> Var71 (snoc71 g b) a)\n -> Var71 g a\n\nvz71 : {g : _}-> {a : _} -> Var71 (snoc71 g a) a\nvz71 = \\ var, vz71, vs => vz71 _ _\n\nvs71 : {g : _} -> {B : _} -> {a : _} -> Var71 g a -> Var71 (snoc71 g B) a\nvs71 = \\ x, var, vz71, vs71 => vs71 _ _ _ (x var vz71 vs71)\n\nTm71 : Con71 -> Ty71 -> Type\nTm71 = \\ g, a =>\n    (Tm71    : Con71 -> Ty71 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var71 g a -> Tm71 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm71 (snoc71 g a) B -> Tm71 g (arr71 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm71 g (arr71 a B) -> Tm71 g a -> Tm71 g B)\n -> Tm71 g a\n\nvar71 : {g : _} -> {a : _} -> Var71 g a -> Tm71 g a\nvar71 = \\ x, tm, var71, lam, app => var71 _ _ x\n\nlam71 : {g : _} -> {a : _} -> {B : _} -> Tm71 (snoc71 g a) B -> Tm71 g (arr71 a B)\nlam71 = \\ t, tm, var71, lam71, app => lam71 _ _ _ (t tm var71 lam71 app)\n\napp71 : {g:_}->{a:_}->{B:_} -> Tm71 g (arr71 a B) -> Tm71 g a -> Tm71 g B\napp71 = \\ t, u, tm, var71, lam71, app71 => app71 _ _ _ (t tm var71 lam71 app71) (u tm var71 lam71 app71)\n\nv071 : {g:_}->{a:_} -> Tm71 (snoc71 g a) a\nv071 = var71 vz71\n\nv171 : {g:_}->{a:_}-> {B:_}-> Tm71 (snoc71 (snoc71 g a) B) a\nv171 = var71 (vs71 vz71)\n\nv271 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm71 (snoc71 (snoc71 (snoc71 g a) B) C) a\nv271 = var71 (vs71 (vs71 vz71))\n\nv371 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm71 (snoc71 (snoc71 (snoc71 (snoc71 g a) B) C) D) a\nv371 = var71 (vs71 (vs71 (vs71 vz71)))\n\nv471 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm71 (snoc71 (snoc71 (snoc71 (snoc71 (snoc71 g a) B) C) D) E) a\nv471 = var71 (vs71 (vs71 (vs71 (vs71 vz71))))\n\ntest71 : {g:_}-> {a:_} -> Tm71 g (arr71 (arr71 a a) (arr71 a a))\ntest71  = lam71 (lam71 (app71 v171 (app71 v171 (app71 v171 (app71 v171 (app71 v171 (app71 v171 v071)))))))\nTy72 : Type\nTy72 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty72 : Ty72\nempty72 = \\ _, empty, _ => empty\n\narr72 : Ty72 -> Ty72 -> Ty72\narr72 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon72 : Type\nCon72 = (Con72 : Type)\n ->(nil  : Con72)\n ->(snoc : Con72 -> Ty72 -> Con72)\n -> Con72\n\nnil72 : Con72\nnil72 = \\ con, nil72, snoc => nil72\n\nsnoc72 : Con72 -> Ty72 -> Con72\nsnoc72 = \\ g, a, con, nil72, snoc72 => snoc72 (g con nil72 snoc72) a\n\nVar72 : Con72 -> Ty72 -> Type\nVar72 = \\ g, a =>\n    (Var72 : Con72 -> Ty72 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var72 (snoc72 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var72 g a -> Var72 (snoc72 g b) a)\n -> Var72 g a\n\nvz72 : {g : _}-> {a : _} -> Var72 (snoc72 g a) a\nvz72 = \\ var, vz72, vs => vz72 _ _\n\nvs72 : {g : _} -> {B : _} -> {a : _} -> Var72 g a -> Var72 (snoc72 g B) a\nvs72 = \\ x, var, vz72, vs72 => vs72 _ _ _ (x var vz72 vs72)\n\nTm72 : Con72 -> Ty72 -> Type\nTm72 = \\ g, a =>\n    (Tm72    : Con72 -> Ty72 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var72 g a -> Tm72 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm72 (snoc72 g a) B -> Tm72 g (arr72 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm72 g (arr72 a B) -> Tm72 g a -> Tm72 g B)\n -> Tm72 g a\n\nvar72 : {g : _} -> {a : _} -> Var72 g a -> Tm72 g a\nvar72 = \\ x, tm, var72, lam, app => var72 _ _ x\n\nlam72 : {g : _} -> {a : _} -> {B : _} -> Tm72 (snoc72 g a) B -> Tm72 g (arr72 a B)\nlam72 = \\ t, tm, var72, lam72, app => lam72 _ _ _ (t tm var72 lam72 app)\n\napp72 : {g:_}->{a:_}->{B:_} -> Tm72 g (arr72 a B) -> Tm72 g a -> Tm72 g B\napp72 = \\ t, u, tm, var72, lam72, app72 => app72 _ _ _ (t tm var72 lam72 app72) (u tm var72 lam72 app72)\n\nv072 : {g:_}->{a:_} -> Tm72 (snoc72 g a) a\nv072 = var72 vz72\n\nv172 : {g:_}->{a:_}-> {B:_}-> Tm72 (snoc72 (snoc72 g a) B) a\nv172 = var72 (vs72 vz72)\n\nv272 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm72 (snoc72 (snoc72 (snoc72 g a) B) C) a\nv272 = var72 (vs72 (vs72 vz72))\n\nv372 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm72 (snoc72 (snoc72 (snoc72 (snoc72 g a) B) C) D) a\nv372 = var72 (vs72 (vs72 (vs72 vz72)))\n\nv472 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm72 (snoc72 (snoc72 (snoc72 (snoc72 (snoc72 g a) B) C) D) E) a\nv472 = var72 (vs72 (vs72 (vs72 (vs72 vz72))))\n\ntest72 : {g:_}-> {a:_} -> Tm72 g (arr72 (arr72 a a) (arr72 a a))\ntest72  = lam72 (lam72 (app72 v172 (app72 v172 (app72 v172 (app72 v172 (app72 v172 (app72 v172 v072)))))))\nTy73 : Type\nTy73 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty73 : Ty73\nempty73 = \\ _, empty, _ => empty\n\narr73 : Ty73 -> Ty73 -> Ty73\narr73 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon73 : Type\nCon73 = (Con73 : Type)\n ->(nil  : Con73)\n ->(snoc : Con73 -> Ty73 -> Con73)\n -> Con73\n\nnil73 : Con73\nnil73 = \\ con, nil73, snoc => nil73\n\nsnoc73 : Con73 -> Ty73 -> Con73\nsnoc73 = \\ g, a, con, nil73, snoc73 => snoc73 (g con nil73 snoc73) a\n\nVar73 : Con73 -> Ty73 -> Type\nVar73 = \\ g, a =>\n    (Var73 : Con73 -> Ty73 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var73 (snoc73 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var73 g a -> Var73 (snoc73 g b) a)\n -> Var73 g a\n\nvz73 : {g : _}-> {a : _} -> Var73 (snoc73 g a) a\nvz73 = \\ var, vz73, vs => vz73 _ _\n\nvs73 : {g : _} -> {B : _} -> {a : _} -> Var73 g a -> Var73 (snoc73 g B) a\nvs73 = \\ x, var, vz73, vs73 => vs73 _ _ _ (x var vz73 vs73)\n\nTm73 : Con73 -> Ty73 -> Type\nTm73 = \\ g, a =>\n    (Tm73    : Con73 -> Ty73 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var73 g a -> Tm73 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm73 (snoc73 g a) B -> Tm73 g (arr73 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm73 g (arr73 a B) -> Tm73 g a -> Tm73 g B)\n -> Tm73 g a\n\nvar73 : {g : _} -> {a : _} -> Var73 g a -> Tm73 g a\nvar73 = \\ x, tm, var73, lam, app => var73 _ _ x\n\nlam73 : {g : _} -> {a : _} -> {B : _} -> Tm73 (snoc73 g a) B -> Tm73 g (arr73 a B)\nlam73 = \\ t, tm, var73, lam73, app => lam73 _ _ _ (t tm var73 lam73 app)\n\napp73 : {g:_}->{a:_}->{B:_} -> Tm73 g (arr73 a B) -> Tm73 g a -> Tm73 g B\napp73 = \\ t, u, tm, var73, lam73, app73 => app73 _ _ _ (t tm var73 lam73 app73) (u tm var73 lam73 app73)\n\nv073 : {g:_}->{a:_} -> Tm73 (snoc73 g a) a\nv073 = var73 vz73\n\nv173 : {g:_}->{a:_}-> {B:_}-> Tm73 (snoc73 (snoc73 g a) B) a\nv173 = var73 (vs73 vz73)\n\nv273 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm73 (snoc73 (snoc73 (snoc73 g a) B) C) a\nv273 = var73 (vs73 (vs73 vz73))\n\nv373 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm73 (snoc73 (snoc73 (snoc73 (snoc73 g a) B) C) D) a\nv373 = var73 (vs73 (vs73 (vs73 vz73)))\n\nv473 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm73 (snoc73 (snoc73 (snoc73 (snoc73 (snoc73 g a) B) C) D) E) a\nv473 = var73 (vs73 (vs73 (vs73 (vs73 vz73))))\n\ntest73 : {g:_}-> {a:_} -> Tm73 g (arr73 (arr73 a a) (arr73 a a))\ntest73  = lam73 (lam73 (app73 v173 (app73 v173 (app73 v173 (app73 v173 (app73 v173 (app73 v173 v073)))))))\nTy74 : Type\nTy74 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty74 : Ty74\nempty74 = \\ _, empty, _ => empty\n\narr74 : Ty74 -> Ty74 -> Ty74\narr74 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon74 : Type\nCon74 = (Con74 : Type)\n ->(nil  : Con74)\n ->(snoc : Con74 -> Ty74 -> Con74)\n -> Con74\n\nnil74 : Con74\nnil74 = \\ con, nil74, snoc => nil74\n\nsnoc74 : Con74 -> Ty74 -> Con74\nsnoc74 = \\ g, a, con, nil74, snoc74 => snoc74 (g con nil74 snoc74) a\n\nVar74 : Con74 -> Ty74 -> Type\nVar74 = \\ g, a =>\n    (Var74 : Con74 -> Ty74 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var74 (snoc74 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var74 g a -> Var74 (snoc74 g b) a)\n -> Var74 g a\n\nvz74 : {g : _}-> {a : _} -> Var74 (snoc74 g a) a\nvz74 = \\ var, vz74, vs => vz74 _ _\n\nvs74 : {g : _} -> {B : _} -> {a : _} -> Var74 g a -> Var74 (snoc74 g B) a\nvs74 = \\ x, var, vz74, vs74 => vs74 _ _ _ (x var vz74 vs74)\n\nTm74 : Con74 -> Ty74 -> Type\nTm74 = \\ g, a =>\n    (Tm74    : Con74 -> Ty74 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var74 g a -> Tm74 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm74 (snoc74 g a) B -> Tm74 g (arr74 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm74 g (arr74 a B) -> Tm74 g a -> Tm74 g B)\n -> Tm74 g a\n\nvar74 : {g : _} -> {a : _} -> Var74 g a -> Tm74 g a\nvar74 = \\ x, tm, var74, lam, app => var74 _ _ x\n\nlam74 : {g : _} -> {a : _} -> {B : _} -> Tm74 (snoc74 g a) B -> Tm74 g (arr74 a B)\nlam74 = \\ t, tm, var74, lam74, app => lam74 _ _ _ (t tm var74 lam74 app)\n\napp74 : {g:_}->{a:_}->{B:_} -> Tm74 g (arr74 a B) -> Tm74 g a -> Tm74 g B\napp74 = \\ t, u, tm, var74, lam74, app74 => app74 _ _ _ (t tm var74 lam74 app74) (u tm var74 lam74 app74)\n\nv074 : {g:_}->{a:_} -> Tm74 (snoc74 g a) a\nv074 = var74 vz74\n\nv174 : {g:_}->{a:_}-> {B:_}-> Tm74 (snoc74 (snoc74 g a) B) a\nv174 = var74 (vs74 vz74)\n\nv274 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm74 (snoc74 (snoc74 (snoc74 g a) B) C) a\nv274 = var74 (vs74 (vs74 vz74))\n\nv374 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm74 (snoc74 (snoc74 (snoc74 (snoc74 g a) B) C) D) a\nv374 = var74 (vs74 (vs74 (vs74 vz74)))\n\nv474 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm74 (snoc74 (snoc74 (snoc74 (snoc74 (snoc74 g a) B) C) D) E) a\nv474 = var74 (vs74 (vs74 (vs74 (vs74 vz74))))\n\ntest74 : {g:_}-> {a:_} -> Tm74 g (arr74 (arr74 a a) (arr74 a a))\ntest74  = lam74 (lam74 (app74 v174 (app74 v174 (app74 v174 (app74 v174 (app74 v174 (app74 v174 v074)))))))\nTy75 : Type\nTy75 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty75 : Ty75\nempty75 = \\ _, empty, _ => empty\n\narr75 : Ty75 -> Ty75 -> Ty75\narr75 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon75 : Type\nCon75 = (Con75 : Type)\n ->(nil  : Con75)\n ->(snoc : Con75 -> Ty75 -> Con75)\n -> Con75\n\nnil75 : Con75\nnil75 = \\ con, nil75, snoc => nil75\n\nsnoc75 : Con75 -> Ty75 -> Con75\nsnoc75 = \\ g, a, con, nil75, snoc75 => snoc75 (g con nil75 snoc75) a\n\nVar75 : Con75 -> Ty75 -> Type\nVar75 = \\ g, a =>\n    (Var75 : Con75 -> Ty75 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var75 (snoc75 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var75 g a -> Var75 (snoc75 g b) a)\n -> Var75 g a\n\nvz75 : {g : _}-> {a : _} -> Var75 (snoc75 g a) a\nvz75 = \\ var, vz75, vs => vz75 _ _\n\nvs75 : {g : _} -> {B : _} -> {a : _} -> Var75 g a -> Var75 (snoc75 g B) a\nvs75 = \\ x, var, vz75, vs75 => vs75 _ _ _ (x var vz75 vs75)\n\nTm75 : Con75 -> Ty75 -> Type\nTm75 = \\ g, a =>\n    (Tm75    : Con75 -> Ty75 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var75 g a -> Tm75 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm75 (snoc75 g a) B -> Tm75 g (arr75 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm75 g (arr75 a B) -> Tm75 g a -> Tm75 g B)\n -> Tm75 g a\n\nvar75 : {g : _} -> {a : _} -> Var75 g a -> Tm75 g a\nvar75 = \\ x, tm, var75, lam, app => var75 _ _ x\n\nlam75 : {g : _} -> {a : _} -> {B : _} -> Tm75 (snoc75 g a) B -> Tm75 g (arr75 a B)\nlam75 = \\ t, tm, var75, lam75, app => lam75 _ _ _ (t tm var75 lam75 app)\n\napp75 : {g:_}->{a:_}->{B:_} -> Tm75 g (arr75 a B) -> Tm75 g a -> Tm75 g B\napp75 = \\ t, u, tm, var75, lam75, app75 => app75 _ _ _ (t tm var75 lam75 app75) (u tm var75 lam75 app75)\n\nv075 : {g:_}->{a:_} -> Tm75 (snoc75 g a) a\nv075 = var75 vz75\n\nv175 : {g:_}->{a:_}-> {B:_}-> Tm75 (snoc75 (snoc75 g a) B) a\nv175 = var75 (vs75 vz75)\n\nv275 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm75 (snoc75 (snoc75 (snoc75 g a) B) C) a\nv275 = var75 (vs75 (vs75 vz75))\n\nv375 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm75 (snoc75 (snoc75 (snoc75 (snoc75 g a) B) C) D) a\nv375 = var75 (vs75 (vs75 (vs75 vz75)))\n\nv475 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm75 (snoc75 (snoc75 (snoc75 (snoc75 (snoc75 g a) B) C) D) E) a\nv475 = var75 (vs75 (vs75 (vs75 (vs75 vz75))))\n\ntest75 : {g:_}-> {a:_} -> Tm75 g (arr75 (arr75 a a) (arr75 a a))\ntest75  = lam75 (lam75 (app75 v175 (app75 v175 (app75 v175 (app75 v175 (app75 v175 (app75 v175 v075)))))))\nTy76 : Type\nTy76 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty76 : Ty76\nempty76 = \\ _, empty, _ => empty\n\narr76 : Ty76 -> Ty76 -> Ty76\narr76 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon76 : Type\nCon76 = (Con76 : Type)\n ->(nil  : Con76)\n ->(snoc : Con76 -> Ty76 -> Con76)\n -> Con76\n\nnil76 : Con76\nnil76 = \\ con, nil76, snoc => nil76\n\nsnoc76 : Con76 -> Ty76 -> Con76\nsnoc76 = \\ g, a, con, nil76, snoc76 => snoc76 (g con nil76 snoc76) a\n\nVar76 : Con76 -> Ty76 -> Type\nVar76 = \\ g, a =>\n    (Var76 : Con76 -> Ty76 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var76 (snoc76 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var76 g a -> Var76 (snoc76 g b) a)\n -> Var76 g a\n\nvz76 : {g : _}-> {a : _} -> Var76 (snoc76 g a) a\nvz76 = \\ var, vz76, vs => vz76 _ _\n\nvs76 : {g : _} -> {B : _} -> {a : _} -> Var76 g a -> Var76 (snoc76 g B) a\nvs76 = \\ x, var, vz76, vs76 => vs76 _ _ _ (x var vz76 vs76)\n\nTm76 : Con76 -> Ty76 -> Type\nTm76 = \\ g, a =>\n    (Tm76    : Con76 -> Ty76 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var76 g a -> Tm76 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm76 (snoc76 g a) B -> Tm76 g (arr76 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm76 g (arr76 a B) -> Tm76 g a -> Tm76 g B)\n -> Tm76 g a\n\nvar76 : {g : _} -> {a : _} -> Var76 g a -> Tm76 g a\nvar76 = \\ x, tm, var76, lam, app => var76 _ _ x\n\nlam76 : {g : _} -> {a : _} -> {B : _} -> Tm76 (snoc76 g a) B -> Tm76 g (arr76 a B)\nlam76 = \\ t, tm, var76, lam76, app => lam76 _ _ _ (t tm var76 lam76 app)\n\napp76 : {g:_}->{a:_}->{B:_} -> Tm76 g (arr76 a B) -> Tm76 g a -> Tm76 g B\napp76 = \\ t, u, tm, var76, lam76, app76 => app76 _ _ _ (t tm var76 lam76 app76) (u tm var76 lam76 app76)\n\nv076 : {g:_}->{a:_} -> Tm76 (snoc76 g a) a\nv076 = var76 vz76\n\nv176 : {g:_}->{a:_}-> {B:_}-> Tm76 (snoc76 (snoc76 g a) B) a\nv176 = var76 (vs76 vz76)\n\nv276 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm76 (snoc76 (snoc76 (snoc76 g a) B) C) a\nv276 = var76 (vs76 (vs76 vz76))\n\nv376 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm76 (snoc76 (snoc76 (snoc76 (snoc76 g a) B) C) D) a\nv376 = var76 (vs76 (vs76 (vs76 vz76)))\n\nv476 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm76 (snoc76 (snoc76 (snoc76 (snoc76 (snoc76 g a) B) C) D) E) a\nv476 = var76 (vs76 (vs76 (vs76 (vs76 vz76))))\n\ntest76 : {g:_}-> {a:_} -> Tm76 g (arr76 (arr76 a a) (arr76 a a))\ntest76  = lam76 (lam76 (app76 v176 (app76 v176 (app76 v176 (app76 v176 (app76 v176 (app76 v176 v076)))))))\nTy77 : Type\nTy77 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty77 : Ty77\nempty77 = \\ _, empty, _ => empty\n\narr77 : Ty77 -> Ty77 -> Ty77\narr77 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon77 : Type\nCon77 = (Con77 : Type)\n ->(nil  : Con77)\n ->(snoc : Con77 -> Ty77 -> Con77)\n -> Con77\n\nnil77 : Con77\nnil77 = \\ con, nil77, snoc => nil77\n\nsnoc77 : Con77 -> Ty77 -> Con77\nsnoc77 = \\ g, a, con, nil77, snoc77 => snoc77 (g con nil77 snoc77) a\n\nVar77 : Con77 -> Ty77 -> Type\nVar77 = \\ g, a =>\n    (Var77 : Con77 -> Ty77 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var77 (snoc77 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var77 g a -> Var77 (snoc77 g b) a)\n -> Var77 g a\n\nvz77 : {g : _}-> {a : _} -> Var77 (snoc77 g a) a\nvz77 = \\ var, vz77, vs => vz77 _ _\n\nvs77 : {g : _} -> {B : _} -> {a : _} -> Var77 g a -> Var77 (snoc77 g B) a\nvs77 = \\ x, var, vz77, vs77 => vs77 _ _ _ (x var vz77 vs77)\n\nTm77 : Con77 -> Ty77 -> Type\nTm77 = \\ g, a =>\n    (Tm77    : Con77 -> Ty77 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var77 g a -> Tm77 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm77 (snoc77 g a) B -> Tm77 g (arr77 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm77 g (arr77 a B) -> Tm77 g a -> Tm77 g B)\n -> Tm77 g a\n\nvar77 : {g : _} -> {a : _} -> Var77 g a -> Tm77 g a\nvar77 = \\ x, tm, var77, lam, app => var77 _ _ x\n\nlam77 : {g : _} -> {a : _} -> {B : _} -> Tm77 (snoc77 g a) B -> Tm77 g (arr77 a B)\nlam77 = \\ t, tm, var77, lam77, app => lam77 _ _ _ (t tm var77 lam77 app)\n\napp77 : {g:_}->{a:_}->{B:_} -> Tm77 g (arr77 a B) -> Tm77 g a -> Tm77 g B\napp77 = \\ t, u, tm, var77, lam77, app77 => app77 _ _ _ (t tm var77 lam77 app77) (u tm var77 lam77 app77)\n\nv077 : {g:_}->{a:_} -> Tm77 (snoc77 g a) a\nv077 = var77 vz77\n\nv177 : {g:_}->{a:_}-> {B:_}-> Tm77 (snoc77 (snoc77 g a) B) a\nv177 = var77 (vs77 vz77)\n\nv277 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm77 (snoc77 (snoc77 (snoc77 g a) B) C) a\nv277 = var77 (vs77 (vs77 vz77))\n\nv377 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm77 (snoc77 (snoc77 (snoc77 (snoc77 g a) B) C) D) a\nv377 = var77 (vs77 (vs77 (vs77 vz77)))\n\nv477 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm77 (snoc77 (snoc77 (snoc77 (snoc77 (snoc77 g a) B) C) D) E) a\nv477 = var77 (vs77 (vs77 (vs77 (vs77 vz77))))\n\ntest77 : {g:_}-> {a:_} -> Tm77 g (arr77 (arr77 a a) (arr77 a a))\ntest77  = lam77 (lam77 (app77 v177 (app77 v177 (app77 v177 (app77 v177 (app77 v177 (app77 v177 v077)))))))\nTy78 : Type\nTy78 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty78 : Ty78\nempty78 = \\ _, empty, _ => empty\n\narr78 : Ty78 -> Ty78 -> Ty78\narr78 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon78 : Type\nCon78 = (Con78 : Type)\n ->(nil  : Con78)\n ->(snoc : Con78 -> Ty78 -> Con78)\n -> Con78\n\nnil78 : Con78\nnil78 = \\ con, nil78, snoc => nil78\n\nsnoc78 : Con78 -> Ty78 -> Con78\nsnoc78 = \\ g, a, con, nil78, snoc78 => snoc78 (g con nil78 snoc78) a\n\nVar78 : Con78 -> Ty78 -> Type\nVar78 = \\ g, a =>\n    (Var78 : Con78 -> Ty78 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var78 (snoc78 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var78 g a -> Var78 (snoc78 g b) a)\n -> Var78 g a\n\nvz78 : {g : _}-> {a : _} -> Var78 (snoc78 g a) a\nvz78 = \\ var, vz78, vs => vz78 _ _\n\nvs78 : {g : _} -> {B : _} -> {a : _} -> Var78 g a -> Var78 (snoc78 g B) a\nvs78 = \\ x, var, vz78, vs78 => vs78 _ _ _ (x var vz78 vs78)\n\nTm78 : Con78 -> Ty78 -> Type\nTm78 = \\ g, a =>\n    (Tm78    : Con78 -> Ty78 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var78 g a -> Tm78 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm78 (snoc78 g a) B -> Tm78 g (arr78 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm78 g (arr78 a B) -> Tm78 g a -> Tm78 g B)\n -> Tm78 g a\n\nvar78 : {g : _} -> {a : _} -> Var78 g a -> Tm78 g a\nvar78 = \\ x, tm, var78, lam, app => var78 _ _ x\n\nlam78 : {g : _} -> {a : _} -> {B : _} -> Tm78 (snoc78 g a) B -> Tm78 g (arr78 a B)\nlam78 = \\ t, tm, var78, lam78, app => lam78 _ _ _ (t tm var78 lam78 app)\n\napp78 : {g:_}->{a:_}->{B:_} -> Tm78 g (arr78 a B) -> Tm78 g a -> Tm78 g B\napp78 = \\ t, u, tm, var78, lam78, app78 => app78 _ _ _ (t tm var78 lam78 app78) (u tm var78 lam78 app78)\n\nv078 : {g:_}->{a:_} -> Tm78 (snoc78 g a) a\nv078 = var78 vz78\n\nv178 : {g:_}->{a:_}-> {B:_}-> Tm78 (snoc78 (snoc78 g a) B) a\nv178 = var78 (vs78 vz78)\n\nv278 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm78 (snoc78 (snoc78 (snoc78 g a) B) C) a\nv278 = var78 (vs78 (vs78 vz78))\n\nv378 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm78 (snoc78 (snoc78 (snoc78 (snoc78 g a) B) C) D) a\nv378 = var78 (vs78 (vs78 (vs78 vz78)))\n\nv478 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm78 (snoc78 (snoc78 (snoc78 (snoc78 (snoc78 g a) B) C) D) E) a\nv478 = var78 (vs78 (vs78 (vs78 (vs78 vz78))))\n\ntest78 : {g:_}-> {a:_} -> Tm78 g (arr78 (arr78 a a) (arr78 a a))\ntest78  = lam78 (lam78 (app78 v178 (app78 v178 (app78 v178 (app78 v178 (app78 v178 (app78 v178 v078)))))))\nTy79 : Type\nTy79 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty79 : Ty79\nempty79 = \\ _, empty, _ => empty\n\narr79 : Ty79 -> Ty79 -> Ty79\narr79 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon79 : Type\nCon79 = (Con79 : Type)\n ->(nil  : Con79)\n ->(snoc : Con79 -> Ty79 -> Con79)\n -> Con79\n\nnil79 : Con79\nnil79 = \\ con, nil79, snoc => nil79\n\nsnoc79 : Con79 -> Ty79 -> Con79\nsnoc79 = \\ g, a, con, nil79, snoc79 => snoc79 (g con nil79 snoc79) a\n\nVar79 : Con79 -> Ty79 -> Type\nVar79 = \\ g, a =>\n    (Var79 : Con79 -> Ty79 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var79 (snoc79 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var79 g a -> Var79 (snoc79 g b) a)\n -> Var79 g a\n\nvz79 : {g : _}-> {a : _} -> Var79 (snoc79 g a) a\nvz79 = \\ var, vz79, vs => vz79 _ _\n\nvs79 : {g : _} -> {B : _} -> {a : _} -> Var79 g a -> Var79 (snoc79 g B) a\nvs79 = \\ x, var, vz79, vs79 => vs79 _ _ _ (x var vz79 vs79)\n\nTm79 : Con79 -> Ty79 -> Type\nTm79 = \\ g, a =>\n    (Tm79    : Con79 -> Ty79 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var79 g a -> Tm79 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm79 (snoc79 g a) B -> Tm79 g (arr79 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm79 g (arr79 a B) -> Tm79 g a -> Tm79 g B)\n -> Tm79 g a\n\nvar79 : {g : _} -> {a : _} -> Var79 g a -> Tm79 g a\nvar79 = \\ x, tm, var79, lam, app => var79 _ _ x\n\nlam79 : {g : _} -> {a : _} -> {B : _} -> Tm79 (snoc79 g a) B -> Tm79 g (arr79 a B)\nlam79 = \\ t, tm, var79, lam79, app => lam79 _ _ _ (t tm var79 lam79 app)\n\napp79 : {g:_}->{a:_}->{B:_} -> Tm79 g (arr79 a B) -> Tm79 g a -> Tm79 g B\napp79 = \\ t, u, tm, var79, lam79, app79 => app79 _ _ _ (t tm var79 lam79 app79) (u tm var79 lam79 app79)\n\nv079 : {g:_}->{a:_} -> Tm79 (snoc79 g a) a\nv079 = var79 vz79\n\nv179 : {g:_}->{a:_}-> {B:_}-> Tm79 (snoc79 (snoc79 g a) B) a\nv179 = var79 (vs79 vz79)\n\nv279 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm79 (snoc79 (snoc79 (snoc79 g a) B) C) a\nv279 = var79 (vs79 (vs79 vz79))\n\nv379 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm79 (snoc79 (snoc79 (snoc79 (snoc79 g a) B) C) D) a\nv379 = var79 (vs79 (vs79 (vs79 vz79)))\n\nv479 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm79 (snoc79 (snoc79 (snoc79 (snoc79 (snoc79 g a) B) C) D) E) a\nv479 = var79 (vs79 (vs79 (vs79 (vs79 vz79))))\n\ntest79 : {g:_}-> {a:_} -> Tm79 g (arr79 (arr79 a a) (arr79 a a))\ntest79  = lam79 (lam79 (app79 v179 (app79 v179 (app79 v179 (app79 v179 (app79 v179 (app79 v179 v079)))))))\nTy80 : Type\nTy80 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty80 : Ty80\nempty80 = \\ _, empty, _ => empty\n\narr80 : Ty80 -> Ty80 -> Ty80\narr80 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon80 : Type\nCon80 = (Con80 : Type)\n ->(nil  : Con80)\n ->(snoc : Con80 -> Ty80 -> Con80)\n -> Con80\n\nnil80 : Con80\nnil80 = \\ con, nil80, snoc => nil80\n\nsnoc80 : Con80 -> Ty80 -> Con80\nsnoc80 = \\ g, a, con, nil80, snoc80 => snoc80 (g con nil80 snoc80) a\n\nVar80 : Con80 -> Ty80 -> Type\nVar80 = \\ g, a =>\n    (Var80 : Con80 -> Ty80 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var80 (snoc80 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var80 g a -> Var80 (snoc80 g b) a)\n -> Var80 g a\n\nvz80 : {g : _}-> {a : _} -> Var80 (snoc80 g a) a\nvz80 = \\ var, vz80, vs => vz80 _ _\n\nvs80 : {g : _} -> {B : _} -> {a : _} -> Var80 g a -> Var80 (snoc80 g B) a\nvs80 = \\ x, var, vz80, vs80 => vs80 _ _ _ (x var vz80 vs80)\n\nTm80 : Con80 -> Ty80 -> Type\nTm80 = \\ g, a =>\n    (Tm80    : Con80 -> Ty80 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var80 g a -> Tm80 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm80 (snoc80 g a) B -> Tm80 g (arr80 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm80 g (arr80 a B) -> Tm80 g a -> Tm80 g B)\n -> Tm80 g a\n\nvar80 : {g : _} -> {a : _} -> Var80 g a -> Tm80 g a\nvar80 = \\ x, tm, var80, lam, app => var80 _ _ x\n\nlam80 : {g : _} -> {a : _} -> {B : _} -> Tm80 (snoc80 g a) B -> Tm80 g (arr80 a B)\nlam80 = \\ t, tm, var80, lam80, app => lam80 _ _ _ (t tm var80 lam80 app)\n\napp80 : {g:_}->{a:_}->{B:_} -> Tm80 g (arr80 a B) -> Tm80 g a -> Tm80 g B\napp80 = \\ t, u, tm, var80, lam80, app80 => app80 _ _ _ (t tm var80 lam80 app80) (u tm var80 lam80 app80)\n\nv080 : {g:_}->{a:_} -> Tm80 (snoc80 g a) a\nv080 = var80 vz80\n\nv180 : {g:_}->{a:_}-> {B:_}-> Tm80 (snoc80 (snoc80 g a) B) a\nv180 = var80 (vs80 vz80)\n\nv280 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm80 (snoc80 (snoc80 (snoc80 g a) B) C) a\nv280 = var80 (vs80 (vs80 vz80))\n\nv380 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm80 (snoc80 (snoc80 (snoc80 (snoc80 g a) B) C) D) a\nv380 = var80 (vs80 (vs80 (vs80 vz80)))\n\nv480 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm80 (snoc80 (snoc80 (snoc80 (snoc80 (snoc80 g a) B) C) D) E) a\nv480 = var80 (vs80 (vs80 (vs80 (vs80 vz80))))\n\ntest80 : {g:_}-> {a:_} -> Tm80 g (arr80 (arr80 a a) (arr80 a a))\ntest80  = lam80 (lam80 (app80 v180 (app80 v180 (app80 v180 (app80 v180 (app80 v180 (app80 v180 v080)))))))\nTy81 : Type\nTy81 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty81 : Ty81\nempty81 = \\ _, empty, _ => empty\n\narr81 : Ty81 -> Ty81 -> Ty81\narr81 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon81 : Type\nCon81 = (Con81 : Type)\n ->(nil  : Con81)\n ->(snoc : Con81 -> Ty81 -> Con81)\n -> Con81\n\nnil81 : Con81\nnil81 = \\ con, nil81, snoc => nil81\n\nsnoc81 : Con81 -> Ty81 -> Con81\nsnoc81 = \\ g, a, con, nil81, snoc81 => snoc81 (g con nil81 snoc81) a\n\nVar81 : Con81 -> Ty81 -> Type\nVar81 = \\ g, a =>\n    (Var81 : Con81 -> Ty81 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var81 (snoc81 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var81 g a -> Var81 (snoc81 g b) a)\n -> Var81 g a\n\nvz81 : {g : _}-> {a : _} -> Var81 (snoc81 g a) a\nvz81 = \\ var, vz81, vs => vz81 _ _\n\nvs81 : {g : _} -> {B : _} -> {a : _} -> Var81 g a -> Var81 (snoc81 g B) a\nvs81 = \\ x, var, vz81, vs81 => vs81 _ _ _ (x var vz81 vs81)\n\nTm81 : Con81 -> Ty81 -> Type\nTm81 = \\ g, a =>\n    (Tm81    : Con81 -> Ty81 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var81 g a -> Tm81 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm81 (snoc81 g a) B -> Tm81 g (arr81 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm81 g (arr81 a B) -> Tm81 g a -> Tm81 g B)\n -> Tm81 g a\n\nvar81 : {g : _} -> {a : _} -> Var81 g a -> Tm81 g a\nvar81 = \\ x, tm, var81, lam, app => var81 _ _ x\n\nlam81 : {g : _} -> {a : _} -> {B : _} -> Tm81 (snoc81 g a) B -> Tm81 g (arr81 a B)\nlam81 = \\ t, tm, var81, lam81, app => lam81 _ _ _ (t tm var81 lam81 app)\n\napp81 : {g:_}->{a:_}->{B:_} -> Tm81 g (arr81 a B) -> Tm81 g a -> Tm81 g B\napp81 = \\ t, u, tm, var81, lam81, app81 => app81 _ _ _ (t tm var81 lam81 app81) (u tm var81 lam81 app81)\n\nv081 : {g:_}->{a:_} -> Tm81 (snoc81 g a) a\nv081 = var81 vz81\n\nv181 : {g:_}->{a:_}-> {B:_}-> Tm81 (snoc81 (snoc81 g a) B) a\nv181 = var81 (vs81 vz81)\n\nv281 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm81 (snoc81 (snoc81 (snoc81 g a) B) C) a\nv281 = var81 (vs81 (vs81 vz81))\n\nv381 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm81 (snoc81 (snoc81 (snoc81 (snoc81 g a) B) C) D) a\nv381 = var81 (vs81 (vs81 (vs81 vz81)))\n\nv481 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm81 (snoc81 (snoc81 (snoc81 (snoc81 (snoc81 g a) B) C) D) E) a\nv481 = var81 (vs81 (vs81 (vs81 (vs81 vz81))))\n\ntest81 : {g:_}-> {a:_} -> Tm81 g (arr81 (arr81 a a) (arr81 a a))\ntest81  = lam81 (lam81 (app81 v181 (app81 v181 (app81 v181 (app81 v181 (app81 v181 (app81 v181 v081)))))))\nTy82 : Type\nTy82 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty82 : Ty82\nempty82 = \\ _, empty, _ => empty\n\narr82 : Ty82 -> Ty82 -> Ty82\narr82 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon82 : Type\nCon82 = (Con82 : Type)\n ->(nil  : Con82)\n ->(snoc : Con82 -> Ty82 -> Con82)\n -> Con82\n\nnil82 : Con82\nnil82 = \\ con, nil82, snoc => nil82\n\nsnoc82 : Con82 -> Ty82 -> Con82\nsnoc82 = \\ g, a, con, nil82, snoc82 => snoc82 (g con nil82 snoc82) a\n\nVar82 : Con82 -> Ty82 -> Type\nVar82 = \\ g, a =>\n    (Var82 : Con82 -> Ty82 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var82 (snoc82 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var82 g a -> Var82 (snoc82 g b) a)\n -> Var82 g a\n\nvz82 : {g : _}-> {a : _} -> Var82 (snoc82 g a) a\nvz82 = \\ var, vz82, vs => vz82 _ _\n\nvs82 : {g : _} -> {B : _} -> {a : _} -> Var82 g a -> Var82 (snoc82 g B) a\nvs82 = \\ x, var, vz82, vs82 => vs82 _ _ _ (x var vz82 vs82)\n\nTm82 : Con82 -> Ty82 -> Type\nTm82 = \\ g, a =>\n    (Tm82    : Con82 -> Ty82 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var82 g a -> Tm82 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm82 (snoc82 g a) B -> Tm82 g (arr82 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm82 g (arr82 a B) -> Tm82 g a -> Tm82 g B)\n -> Tm82 g a\n\nvar82 : {g : _} -> {a : _} -> Var82 g a -> Tm82 g a\nvar82 = \\ x, tm, var82, lam, app => var82 _ _ x\n\nlam82 : {g : _} -> {a : _} -> {B : _} -> Tm82 (snoc82 g a) B -> Tm82 g (arr82 a B)\nlam82 = \\ t, tm, var82, lam82, app => lam82 _ _ _ (t tm var82 lam82 app)\n\napp82 : {g:_}->{a:_}->{B:_} -> Tm82 g (arr82 a B) -> Tm82 g a -> Tm82 g B\napp82 = \\ t, u, tm, var82, lam82, app82 => app82 _ _ _ (t tm var82 lam82 app82) (u tm var82 lam82 app82)\n\nv082 : {g:_}->{a:_} -> Tm82 (snoc82 g a) a\nv082 = var82 vz82\n\nv182 : {g:_}->{a:_}-> {B:_}-> Tm82 (snoc82 (snoc82 g a) B) a\nv182 = var82 (vs82 vz82)\n\nv282 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm82 (snoc82 (snoc82 (snoc82 g a) B) C) a\nv282 = var82 (vs82 (vs82 vz82))\n\nv382 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm82 (snoc82 (snoc82 (snoc82 (snoc82 g a) B) C) D) a\nv382 = var82 (vs82 (vs82 (vs82 vz82)))\n\nv482 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm82 (snoc82 (snoc82 (snoc82 (snoc82 (snoc82 g a) B) C) D) E) a\nv482 = var82 (vs82 (vs82 (vs82 (vs82 vz82))))\n\ntest82 : {g:_}-> {a:_} -> Tm82 g (arr82 (arr82 a a) (arr82 a a))\ntest82  = lam82 (lam82 (app82 v182 (app82 v182 (app82 v182 (app82 v182 (app82 v182 (app82 v182 v082)))))))\nTy83 : Type\nTy83 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty83 : Ty83\nempty83 = \\ _, empty, _ => empty\n\narr83 : Ty83 -> Ty83 -> Ty83\narr83 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon83 : Type\nCon83 = (Con83 : Type)\n ->(nil  : Con83)\n ->(snoc : Con83 -> Ty83 -> Con83)\n -> Con83\n\nnil83 : Con83\nnil83 = \\ con, nil83, snoc => nil83\n\nsnoc83 : Con83 -> Ty83 -> Con83\nsnoc83 = \\ g, a, con, nil83, snoc83 => snoc83 (g con nil83 snoc83) a\n\nVar83 : Con83 -> Ty83 -> Type\nVar83 = \\ g, a =>\n    (Var83 : Con83 -> Ty83 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var83 (snoc83 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var83 g a -> Var83 (snoc83 g b) a)\n -> Var83 g a\n\nvz83 : {g : _}-> {a : _} -> Var83 (snoc83 g a) a\nvz83 = \\ var, vz83, vs => vz83 _ _\n\nvs83 : {g : _} -> {B : _} -> {a : _} -> Var83 g a -> Var83 (snoc83 g B) a\nvs83 = \\ x, var, vz83, vs83 => vs83 _ _ _ (x var vz83 vs83)\n\nTm83 : Con83 -> Ty83 -> Type\nTm83 = \\ g, a =>\n    (Tm83    : Con83 -> Ty83 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var83 g a -> Tm83 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm83 (snoc83 g a) B -> Tm83 g (arr83 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm83 g (arr83 a B) -> Tm83 g a -> Tm83 g B)\n -> Tm83 g a\n\nvar83 : {g : _} -> {a : _} -> Var83 g a -> Tm83 g a\nvar83 = \\ x, tm, var83, lam, app => var83 _ _ x\n\nlam83 : {g : _} -> {a : _} -> {B : _} -> Tm83 (snoc83 g a) B -> Tm83 g (arr83 a B)\nlam83 = \\ t, tm, var83, lam83, app => lam83 _ _ _ (t tm var83 lam83 app)\n\napp83 : {g:_}->{a:_}->{B:_} -> Tm83 g (arr83 a B) -> Tm83 g a -> Tm83 g B\napp83 = \\ t, u, tm, var83, lam83, app83 => app83 _ _ _ (t tm var83 lam83 app83) (u tm var83 lam83 app83)\n\nv083 : {g:_}->{a:_} -> Tm83 (snoc83 g a) a\nv083 = var83 vz83\n\nv183 : {g:_}->{a:_}-> {B:_}-> Tm83 (snoc83 (snoc83 g a) B) a\nv183 = var83 (vs83 vz83)\n\nv283 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm83 (snoc83 (snoc83 (snoc83 g a) B) C) a\nv283 = var83 (vs83 (vs83 vz83))\n\nv383 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm83 (snoc83 (snoc83 (snoc83 (snoc83 g a) B) C) D) a\nv383 = var83 (vs83 (vs83 (vs83 vz83)))\n\nv483 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm83 (snoc83 (snoc83 (snoc83 (snoc83 (snoc83 g a) B) C) D) E) a\nv483 = var83 (vs83 (vs83 (vs83 (vs83 vz83))))\n\ntest83 : {g:_}-> {a:_} -> Tm83 g (arr83 (arr83 a a) (arr83 a a))\ntest83  = lam83 (lam83 (app83 v183 (app83 v183 (app83 v183 (app83 v183 (app83 v183 (app83 v183 v083)))))))\nTy84 : Type\nTy84 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty84 : Ty84\nempty84 = \\ _, empty, _ => empty\n\narr84 : Ty84 -> Ty84 -> Ty84\narr84 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon84 : Type\nCon84 = (Con84 : Type)\n ->(nil  : Con84)\n ->(snoc : Con84 -> Ty84 -> Con84)\n -> Con84\n\nnil84 : Con84\nnil84 = \\ con, nil84, snoc => nil84\n\nsnoc84 : Con84 -> Ty84 -> Con84\nsnoc84 = \\ g, a, con, nil84, snoc84 => snoc84 (g con nil84 snoc84) a\n\nVar84 : Con84 -> Ty84 -> Type\nVar84 = \\ g, a =>\n    (Var84 : Con84 -> Ty84 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var84 (snoc84 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var84 g a -> Var84 (snoc84 g b) a)\n -> Var84 g a\n\nvz84 : {g : _}-> {a : _} -> Var84 (snoc84 g a) a\nvz84 = \\ var, vz84, vs => vz84 _ _\n\nvs84 : {g : _} -> {B : _} -> {a : _} -> Var84 g a -> Var84 (snoc84 g B) a\nvs84 = \\ x, var, vz84, vs84 => vs84 _ _ _ (x var vz84 vs84)\n\nTm84 : Con84 -> Ty84 -> Type\nTm84 = \\ g, a =>\n    (Tm84    : Con84 -> Ty84 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var84 g a -> Tm84 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm84 (snoc84 g a) B -> Tm84 g (arr84 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm84 g (arr84 a B) -> Tm84 g a -> Tm84 g B)\n -> Tm84 g a\n\nvar84 : {g : _} -> {a : _} -> Var84 g a -> Tm84 g a\nvar84 = \\ x, tm, var84, lam, app => var84 _ _ x\n\nlam84 : {g : _} -> {a : _} -> {B : _} -> Tm84 (snoc84 g a) B -> Tm84 g (arr84 a B)\nlam84 = \\ t, tm, var84, lam84, app => lam84 _ _ _ (t tm var84 lam84 app)\n\napp84 : {g:_}->{a:_}->{B:_} -> Tm84 g (arr84 a B) -> Tm84 g a -> Tm84 g B\napp84 = \\ t, u, tm, var84, lam84, app84 => app84 _ _ _ (t tm var84 lam84 app84) (u tm var84 lam84 app84)\n\nv084 : {g:_}->{a:_} -> Tm84 (snoc84 g a) a\nv084 = var84 vz84\n\nv184 : {g:_}->{a:_}-> {B:_}-> Tm84 (snoc84 (snoc84 g a) B) a\nv184 = var84 (vs84 vz84)\n\nv284 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm84 (snoc84 (snoc84 (snoc84 g a) B) C) a\nv284 = var84 (vs84 (vs84 vz84))\n\nv384 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm84 (snoc84 (snoc84 (snoc84 (snoc84 g a) B) C) D) a\nv384 = var84 (vs84 (vs84 (vs84 vz84)))\n\nv484 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm84 (snoc84 (snoc84 (snoc84 (snoc84 (snoc84 g a) B) C) D) E) a\nv484 = var84 (vs84 (vs84 (vs84 (vs84 vz84))))\n\ntest84 : {g:_}-> {a:_} -> Tm84 g (arr84 (arr84 a a) (arr84 a a))\ntest84  = lam84 (lam84 (app84 v184 (app84 v184 (app84 v184 (app84 v184 (app84 v184 (app84 v184 v084)))))))\nTy85 : Type\nTy85 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty85 : Ty85\nempty85 = \\ _, empty, _ => empty\n\narr85 : Ty85 -> Ty85 -> Ty85\narr85 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon85 : Type\nCon85 = (Con85 : Type)\n ->(nil  : Con85)\n ->(snoc : Con85 -> Ty85 -> Con85)\n -> Con85\n\nnil85 : Con85\nnil85 = \\ con, nil85, snoc => nil85\n\nsnoc85 : Con85 -> Ty85 -> Con85\nsnoc85 = \\ g, a, con, nil85, snoc85 => snoc85 (g con nil85 snoc85) a\n\nVar85 : Con85 -> Ty85 -> Type\nVar85 = \\ g, a =>\n    (Var85 : Con85 -> Ty85 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var85 (snoc85 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var85 g a -> Var85 (snoc85 g b) a)\n -> Var85 g a\n\nvz85 : {g : _}-> {a : _} -> Var85 (snoc85 g a) a\nvz85 = \\ var, vz85, vs => vz85 _ _\n\nvs85 : {g : _} -> {B : _} -> {a : _} -> Var85 g a -> Var85 (snoc85 g B) a\nvs85 = \\ x, var, vz85, vs85 => vs85 _ _ _ (x var vz85 vs85)\n\nTm85 : Con85 -> Ty85 -> Type\nTm85 = \\ g, a =>\n    (Tm85    : Con85 -> Ty85 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var85 g a -> Tm85 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm85 (snoc85 g a) B -> Tm85 g (arr85 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm85 g (arr85 a B) -> Tm85 g a -> Tm85 g B)\n -> Tm85 g a\n\nvar85 : {g : _} -> {a : _} -> Var85 g a -> Tm85 g a\nvar85 = \\ x, tm, var85, lam, app => var85 _ _ x\n\nlam85 : {g : _} -> {a : _} -> {B : _} -> Tm85 (snoc85 g a) B -> Tm85 g (arr85 a B)\nlam85 = \\ t, tm, var85, lam85, app => lam85 _ _ _ (t tm var85 lam85 app)\n\napp85 : {g:_}->{a:_}->{B:_} -> Tm85 g (arr85 a B) -> Tm85 g a -> Tm85 g B\napp85 = \\ t, u, tm, var85, lam85, app85 => app85 _ _ _ (t tm var85 lam85 app85) (u tm var85 lam85 app85)\n\nv085 : {g:_}->{a:_} -> Tm85 (snoc85 g a) a\nv085 = var85 vz85\n\nv185 : {g:_}->{a:_}-> {B:_}-> Tm85 (snoc85 (snoc85 g a) B) a\nv185 = var85 (vs85 vz85)\n\nv285 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm85 (snoc85 (snoc85 (snoc85 g a) B) C) a\nv285 = var85 (vs85 (vs85 vz85))\n\nv385 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm85 (snoc85 (snoc85 (snoc85 (snoc85 g a) B) C) D) a\nv385 = var85 (vs85 (vs85 (vs85 vz85)))\n\nv485 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm85 (snoc85 (snoc85 (snoc85 (snoc85 (snoc85 g a) B) C) D) E) a\nv485 = var85 (vs85 (vs85 (vs85 (vs85 vz85))))\n\ntest85 : {g:_}-> {a:_} -> Tm85 g (arr85 (arr85 a a) (arr85 a a))\ntest85  = lam85 (lam85 (app85 v185 (app85 v185 (app85 v185 (app85 v185 (app85 v185 (app85 v185 v085)))))))\nTy86 : Type\nTy86 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty86 : Ty86\nempty86 = \\ _, empty, _ => empty\n\narr86 : Ty86 -> Ty86 -> Ty86\narr86 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon86 : Type\nCon86 = (Con86 : Type)\n ->(nil  : Con86)\n ->(snoc : Con86 -> Ty86 -> Con86)\n -> Con86\n\nnil86 : Con86\nnil86 = \\ con, nil86, snoc => nil86\n\nsnoc86 : Con86 -> Ty86 -> Con86\nsnoc86 = \\ g, a, con, nil86, snoc86 => snoc86 (g con nil86 snoc86) a\n\nVar86 : Con86 -> Ty86 -> Type\nVar86 = \\ g, a =>\n    (Var86 : Con86 -> Ty86 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var86 (snoc86 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var86 g a -> Var86 (snoc86 g b) a)\n -> Var86 g a\n\nvz86 : {g : _}-> {a : _} -> Var86 (snoc86 g a) a\nvz86 = \\ var, vz86, vs => vz86 _ _\n\nvs86 : {g : _} -> {B : _} -> {a : _} -> Var86 g a -> Var86 (snoc86 g B) a\nvs86 = \\ x, var, vz86, vs86 => vs86 _ _ _ (x var vz86 vs86)\n\nTm86 : Con86 -> Ty86 -> Type\nTm86 = \\ g, a =>\n    (Tm86    : Con86 -> Ty86 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var86 g a -> Tm86 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm86 (snoc86 g a) B -> Tm86 g (arr86 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm86 g (arr86 a B) -> Tm86 g a -> Tm86 g B)\n -> Tm86 g a\n\nvar86 : {g : _} -> {a : _} -> Var86 g a -> Tm86 g a\nvar86 = \\ x, tm, var86, lam, app => var86 _ _ x\n\nlam86 : {g : _} -> {a : _} -> {B : _} -> Tm86 (snoc86 g a) B -> Tm86 g (arr86 a B)\nlam86 = \\ t, tm, var86, lam86, app => lam86 _ _ _ (t tm var86 lam86 app)\n\napp86 : {g:_}->{a:_}->{B:_} -> Tm86 g (arr86 a B) -> Tm86 g a -> Tm86 g B\napp86 = \\ t, u, tm, var86, lam86, app86 => app86 _ _ _ (t tm var86 lam86 app86) (u tm var86 lam86 app86)\n\nv086 : {g:_}->{a:_} -> Tm86 (snoc86 g a) a\nv086 = var86 vz86\n\nv186 : {g:_}->{a:_}-> {B:_}-> Tm86 (snoc86 (snoc86 g a) B) a\nv186 = var86 (vs86 vz86)\n\nv286 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm86 (snoc86 (snoc86 (snoc86 g a) B) C) a\nv286 = var86 (vs86 (vs86 vz86))\n\nv386 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm86 (snoc86 (snoc86 (snoc86 (snoc86 g a) B) C) D) a\nv386 = var86 (vs86 (vs86 (vs86 vz86)))\n\nv486 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm86 (snoc86 (snoc86 (snoc86 (snoc86 (snoc86 g a) B) C) D) E) a\nv486 = var86 (vs86 (vs86 (vs86 (vs86 vz86))))\n\ntest86 : {g:_}-> {a:_} -> Tm86 g (arr86 (arr86 a a) (arr86 a a))\ntest86  = lam86 (lam86 (app86 v186 (app86 v186 (app86 v186 (app86 v186 (app86 v186 (app86 v186 v086)))))))\nTy87 : Type\nTy87 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty87 : Ty87\nempty87 = \\ _, empty, _ => empty\n\narr87 : Ty87 -> Ty87 -> Ty87\narr87 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon87 : Type\nCon87 = (Con87 : Type)\n ->(nil  : Con87)\n ->(snoc : Con87 -> Ty87 -> Con87)\n -> Con87\n\nnil87 : Con87\nnil87 = \\ con, nil87, snoc => nil87\n\nsnoc87 : Con87 -> Ty87 -> Con87\nsnoc87 = \\ g, a, con, nil87, snoc87 => snoc87 (g con nil87 snoc87) a\n\nVar87 : Con87 -> Ty87 -> Type\nVar87 = \\ g, a =>\n    (Var87 : Con87 -> Ty87 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var87 (snoc87 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var87 g a -> Var87 (snoc87 g b) a)\n -> Var87 g a\n\nvz87 : {g : _}-> {a : _} -> Var87 (snoc87 g a) a\nvz87 = \\ var, vz87, vs => vz87 _ _\n\nvs87 : {g : _} -> {B : _} -> {a : _} -> Var87 g a -> Var87 (snoc87 g B) a\nvs87 = \\ x, var, vz87, vs87 => vs87 _ _ _ (x var vz87 vs87)\n\nTm87 : Con87 -> Ty87 -> Type\nTm87 = \\ g, a =>\n    (Tm87    : Con87 -> Ty87 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var87 g a -> Tm87 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm87 (snoc87 g a) B -> Tm87 g (arr87 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm87 g (arr87 a B) -> Tm87 g a -> Tm87 g B)\n -> Tm87 g a\n\nvar87 : {g : _} -> {a : _} -> Var87 g a -> Tm87 g a\nvar87 = \\ x, tm, var87, lam, app => var87 _ _ x\n\nlam87 : {g : _} -> {a : _} -> {B : _} -> Tm87 (snoc87 g a) B -> Tm87 g (arr87 a B)\nlam87 = \\ t, tm, var87, lam87, app => lam87 _ _ _ (t tm var87 lam87 app)\n\napp87 : {g:_}->{a:_}->{B:_} -> Tm87 g (arr87 a B) -> Tm87 g a -> Tm87 g B\napp87 = \\ t, u, tm, var87, lam87, app87 => app87 _ _ _ (t tm var87 lam87 app87) (u tm var87 lam87 app87)\n\nv087 : {g:_}->{a:_} -> Tm87 (snoc87 g a) a\nv087 = var87 vz87\n\nv187 : {g:_}->{a:_}-> {B:_}-> Tm87 (snoc87 (snoc87 g a) B) a\nv187 = var87 (vs87 vz87)\n\nv287 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm87 (snoc87 (snoc87 (snoc87 g a) B) C) a\nv287 = var87 (vs87 (vs87 vz87))\n\nv387 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm87 (snoc87 (snoc87 (snoc87 (snoc87 g a) B) C) D) a\nv387 = var87 (vs87 (vs87 (vs87 vz87)))\n\nv487 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm87 (snoc87 (snoc87 (snoc87 (snoc87 (snoc87 g a) B) C) D) E) a\nv487 = var87 (vs87 (vs87 (vs87 (vs87 vz87))))\n\ntest87 : {g:_}-> {a:_} -> Tm87 g (arr87 (arr87 a a) (arr87 a a))\ntest87  = lam87 (lam87 (app87 v187 (app87 v187 (app87 v187 (app87 v187 (app87 v187 (app87 v187 v087)))))))\nTy88 : Type\nTy88 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty88 : Ty88\nempty88 = \\ _, empty, _ => empty\n\narr88 : Ty88 -> Ty88 -> Ty88\narr88 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon88 : Type\nCon88 = (Con88 : Type)\n ->(nil  : Con88)\n ->(snoc : Con88 -> Ty88 -> Con88)\n -> Con88\n\nnil88 : Con88\nnil88 = \\ con, nil88, snoc => nil88\n\nsnoc88 : Con88 -> Ty88 -> Con88\nsnoc88 = \\ g, a, con, nil88, snoc88 => snoc88 (g con nil88 snoc88) a\n\nVar88 : Con88 -> Ty88 -> Type\nVar88 = \\ g, a =>\n    (Var88 : Con88 -> Ty88 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var88 (snoc88 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var88 g a -> Var88 (snoc88 g b) a)\n -> Var88 g a\n\nvz88 : {g : _}-> {a : _} -> Var88 (snoc88 g a) a\nvz88 = \\ var, vz88, vs => vz88 _ _\n\nvs88 : {g : _} -> {B : _} -> {a : _} -> Var88 g a -> Var88 (snoc88 g B) a\nvs88 = \\ x, var, vz88, vs88 => vs88 _ _ _ (x var vz88 vs88)\n\nTm88 : Con88 -> Ty88 -> Type\nTm88 = \\ g, a =>\n    (Tm88    : Con88 -> Ty88 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var88 g a -> Tm88 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm88 (snoc88 g a) B -> Tm88 g (arr88 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm88 g (arr88 a B) -> Tm88 g a -> Tm88 g B)\n -> Tm88 g a\n\nvar88 : {g : _} -> {a : _} -> Var88 g a -> Tm88 g a\nvar88 = \\ x, tm, var88, lam, app => var88 _ _ x\n\nlam88 : {g : _} -> {a : _} -> {B : _} -> Tm88 (snoc88 g a) B -> Tm88 g (arr88 a B)\nlam88 = \\ t, tm, var88, lam88, app => lam88 _ _ _ (t tm var88 lam88 app)\n\napp88 : {g:_}->{a:_}->{B:_} -> Tm88 g (arr88 a B) -> Tm88 g a -> Tm88 g B\napp88 = \\ t, u, tm, var88, lam88, app88 => app88 _ _ _ (t tm var88 lam88 app88) (u tm var88 lam88 app88)\n\nv088 : {g:_}->{a:_} -> Tm88 (snoc88 g a) a\nv088 = var88 vz88\n\nv188 : {g:_}->{a:_}-> {B:_}-> Tm88 (snoc88 (snoc88 g a) B) a\nv188 = var88 (vs88 vz88)\n\nv288 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm88 (snoc88 (snoc88 (snoc88 g a) B) C) a\nv288 = var88 (vs88 (vs88 vz88))\n\nv388 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm88 (snoc88 (snoc88 (snoc88 (snoc88 g a) B) C) D) a\nv388 = var88 (vs88 (vs88 (vs88 vz88)))\n\nv488 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm88 (snoc88 (snoc88 (snoc88 (snoc88 (snoc88 g a) B) C) D) E) a\nv488 = var88 (vs88 (vs88 (vs88 (vs88 vz88))))\n\ntest88 : {g:_}-> {a:_} -> Tm88 g (arr88 (arr88 a a) (arr88 a a))\ntest88  = lam88 (lam88 (app88 v188 (app88 v188 (app88 v188 (app88 v188 (app88 v188 (app88 v188 v088)))))))\nTy89 : Type\nTy89 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty89 : Ty89\nempty89 = \\ _, empty, _ => empty\n\narr89 : Ty89 -> Ty89 -> Ty89\narr89 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon89 : Type\nCon89 = (Con89 : Type)\n ->(nil  : Con89)\n ->(snoc : Con89 -> Ty89 -> Con89)\n -> Con89\n\nnil89 : Con89\nnil89 = \\ con, nil89, snoc => nil89\n\nsnoc89 : Con89 -> Ty89 -> Con89\nsnoc89 = \\ g, a, con, nil89, snoc89 => snoc89 (g con nil89 snoc89) a\n\nVar89 : Con89 -> Ty89 -> Type\nVar89 = \\ g, a =>\n    (Var89 : Con89 -> Ty89 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var89 (snoc89 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var89 g a -> Var89 (snoc89 g b) a)\n -> Var89 g a\n\nvz89 : {g : _}-> {a : _} -> Var89 (snoc89 g a) a\nvz89 = \\ var, vz89, vs => vz89 _ _\n\nvs89 : {g : _} -> {B : _} -> {a : _} -> Var89 g a -> Var89 (snoc89 g B) a\nvs89 = \\ x, var, vz89, vs89 => vs89 _ _ _ (x var vz89 vs89)\n\nTm89 : Con89 -> Ty89 -> Type\nTm89 = \\ g, a =>\n    (Tm89    : Con89 -> Ty89 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var89 g a -> Tm89 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm89 (snoc89 g a) B -> Tm89 g (arr89 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm89 g (arr89 a B) -> Tm89 g a -> Tm89 g B)\n -> Tm89 g a\n\nvar89 : {g : _} -> {a : _} -> Var89 g a -> Tm89 g a\nvar89 = \\ x, tm, var89, lam, app => var89 _ _ x\n\nlam89 : {g : _} -> {a : _} -> {B : _} -> Tm89 (snoc89 g a) B -> Tm89 g (arr89 a B)\nlam89 = \\ t, tm, var89, lam89, app => lam89 _ _ _ (t tm var89 lam89 app)\n\napp89 : {g:_}->{a:_}->{B:_} -> Tm89 g (arr89 a B) -> Tm89 g a -> Tm89 g B\napp89 = \\ t, u, tm, var89, lam89, app89 => app89 _ _ _ (t tm var89 lam89 app89) (u tm var89 lam89 app89)\n\nv089 : {g:_}->{a:_} -> Tm89 (snoc89 g a) a\nv089 = var89 vz89\n\nv189 : {g:_}->{a:_}-> {B:_}-> Tm89 (snoc89 (snoc89 g a) B) a\nv189 = var89 (vs89 vz89)\n\nv289 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm89 (snoc89 (snoc89 (snoc89 g a) B) C) a\nv289 = var89 (vs89 (vs89 vz89))\n\nv389 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm89 (snoc89 (snoc89 (snoc89 (snoc89 g a) B) C) D) a\nv389 = var89 (vs89 (vs89 (vs89 vz89)))\n\nv489 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm89 (snoc89 (snoc89 (snoc89 (snoc89 (snoc89 g a) B) C) D) E) a\nv489 = var89 (vs89 (vs89 (vs89 (vs89 vz89))))\n\ntest89 : {g:_}-> {a:_} -> Tm89 g (arr89 (arr89 a a) (arr89 a a))\ntest89  = lam89 (lam89 (app89 v189 (app89 v189 (app89 v189 (app89 v189 (app89 v189 (app89 v189 v089)))))))\nTy90 : Type\nTy90 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty90 : Ty90\nempty90 = \\ _, empty, _ => empty\n\narr90 : Ty90 -> Ty90 -> Ty90\narr90 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon90 : Type\nCon90 = (Con90 : Type)\n ->(nil  : Con90)\n ->(snoc : Con90 -> Ty90 -> Con90)\n -> Con90\n\nnil90 : Con90\nnil90 = \\ con, nil90, snoc => nil90\n\nsnoc90 : Con90 -> Ty90 -> Con90\nsnoc90 = \\ g, a, con, nil90, snoc90 => snoc90 (g con nil90 snoc90) a\n\nVar90 : Con90 -> Ty90 -> Type\nVar90 = \\ g, a =>\n    (Var90 : Con90 -> Ty90 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var90 (snoc90 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var90 g a -> Var90 (snoc90 g b) a)\n -> Var90 g a\n\nvz90 : {g : _}-> {a : _} -> Var90 (snoc90 g a) a\nvz90 = \\ var, vz90, vs => vz90 _ _\n\nvs90 : {g : _} -> {B : _} -> {a : _} -> Var90 g a -> Var90 (snoc90 g B) a\nvs90 = \\ x, var, vz90, vs90 => vs90 _ _ _ (x var vz90 vs90)\n\nTm90 : Con90 -> Ty90 -> Type\nTm90 = \\ g, a =>\n    (Tm90    : Con90 -> Ty90 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var90 g a -> Tm90 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm90 (snoc90 g a) B -> Tm90 g (arr90 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm90 g (arr90 a B) -> Tm90 g a -> Tm90 g B)\n -> Tm90 g a\n\nvar90 : {g : _} -> {a : _} -> Var90 g a -> Tm90 g a\nvar90 = \\ x, tm, var90, lam, app => var90 _ _ x\n\nlam90 : {g : _} -> {a : _} -> {B : _} -> Tm90 (snoc90 g a) B -> Tm90 g (arr90 a B)\nlam90 = \\ t, tm, var90, lam90, app => lam90 _ _ _ (t tm var90 lam90 app)\n\napp90 : {g:_}->{a:_}->{B:_} -> Tm90 g (arr90 a B) -> Tm90 g a -> Tm90 g B\napp90 = \\ t, u, tm, var90, lam90, app90 => app90 _ _ _ (t tm var90 lam90 app90) (u tm var90 lam90 app90)\n\nv090 : {g:_}->{a:_} -> Tm90 (snoc90 g a) a\nv090 = var90 vz90\n\nv190 : {g:_}->{a:_}-> {B:_}-> Tm90 (snoc90 (snoc90 g a) B) a\nv190 = var90 (vs90 vz90)\n\nv290 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm90 (snoc90 (snoc90 (snoc90 g a) B) C) a\nv290 = var90 (vs90 (vs90 vz90))\n\nv390 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm90 (snoc90 (snoc90 (snoc90 (snoc90 g a) B) C) D) a\nv390 = var90 (vs90 (vs90 (vs90 vz90)))\n\nv490 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm90 (snoc90 (snoc90 (snoc90 (snoc90 (snoc90 g a) B) C) D) E) a\nv490 = var90 (vs90 (vs90 (vs90 (vs90 vz90))))\n\ntest90 : {g:_}-> {a:_} -> Tm90 g (arr90 (arr90 a a) (arr90 a a))\ntest90  = lam90 (lam90 (app90 v190 (app90 v190 (app90 v190 (app90 v190 (app90 v190 (app90 v190 v090)))))))\nTy91 : Type\nTy91 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty91 : Ty91\nempty91 = \\ _, empty, _ => empty\n\narr91 : Ty91 -> Ty91 -> Ty91\narr91 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon91 : Type\nCon91 = (Con91 : Type)\n ->(nil  : Con91)\n ->(snoc : Con91 -> Ty91 -> Con91)\n -> Con91\n\nnil91 : Con91\nnil91 = \\ con, nil91, snoc => nil91\n\nsnoc91 : Con91 -> Ty91 -> Con91\nsnoc91 = \\ g, a, con, nil91, snoc91 => snoc91 (g con nil91 snoc91) a\n\nVar91 : Con91 -> Ty91 -> Type\nVar91 = \\ g, a =>\n    (Var91 : Con91 -> Ty91 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var91 (snoc91 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var91 g a -> Var91 (snoc91 g b) a)\n -> Var91 g a\n\nvz91 : {g : _}-> {a : _} -> Var91 (snoc91 g a) a\nvz91 = \\ var, vz91, vs => vz91 _ _\n\nvs91 : {g : _} -> {B : _} -> {a : _} -> Var91 g a -> Var91 (snoc91 g B) a\nvs91 = \\ x, var, vz91, vs91 => vs91 _ _ _ (x var vz91 vs91)\n\nTm91 : Con91 -> Ty91 -> Type\nTm91 = \\ g, a =>\n    (Tm91    : Con91 -> Ty91 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var91 g a -> Tm91 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm91 (snoc91 g a) B -> Tm91 g (arr91 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm91 g (arr91 a B) -> Tm91 g a -> Tm91 g B)\n -> Tm91 g a\n\nvar91 : {g : _} -> {a : _} -> Var91 g a -> Tm91 g a\nvar91 = \\ x, tm, var91, lam, app => var91 _ _ x\n\nlam91 : {g : _} -> {a : _} -> {B : _} -> Tm91 (snoc91 g a) B -> Tm91 g (arr91 a B)\nlam91 = \\ t, tm, var91, lam91, app => lam91 _ _ _ (t tm var91 lam91 app)\n\napp91 : {g:_}->{a:_}->{B:_} -> Tm91 g (arr91 a B) -> Tm91 g a -> Tm91 g B\napp91 = \\ t, u, tm, var91, lam91, app91 => app91 _ _ _ (t tm var91 lam91 app91) (u tm var91 lam91 app91)\n\nv091 : {g:_}->{a:_} -> Tm91 (snoc91 g a) a\nv091 = var91 vz91\n\nv191 : {g:_}->{a:_}-> {B:_}-> Tm91 (snoc91 (snoc91 g a) B) a\nv191 = var91 (vs91 vz91)\n\nv291 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm91 (snoc91 (snoc91 (snoc91 g a) B) C) a\nv291 = var91 (vs91 (vs91 vz91))\n\nv391 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm91 (snoc91 (snoc91 (snoc91 (snoc91 g a) B) C) D) a\nv391 = var91 (vs91 (vs91 (vs91 vz91)))\n\nv491 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm91 (snoc91 (snoc91 (snoc91 (snoc91 (snoc91 g a) B) C) D) E) a\nv491 = var91 (vs91 (vs91 (vs91 (vs91 vz91))))\n\ntest91 : {g:_}-> {a:_} -> Tm91 g (arr91 (arr91 a a) (arr91 a a))\ntest91  = lam91 (lam91 (app91 v191 (app91 v191 (app91 v191 (app91 v191 (app91 v191 (app91 v191 v091)))))))\nTy92 : Type\nTy92 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty92 : Ty92\nempty92 = \\ _, empty, _ => empty\n\narr92 : Ty92 -> Ty92 -> Ty92\narr92 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon92 : Type\nCon92 = (Con92 : Type)\n ->(nil  : Con92)\n ->(snoc : Con92 -> Ty92 -> Con92)\n -> Con92\n\nnil92 : Con92\nnil92 = \\ con, nil92, snoc => nil92\n\nsnoc92 : Con92 -> Ty92 -> Con92\nsnoc92 = \\ g, a, con, nil92, snoc92 => snoc92 (g con nil92 snoc92) a\n\nVar92 : Con92 -> Ty92 -> Type\nVar92 = \\ g, a =>\n    (Var92 : Con92 -> Ty92 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var92 (snoc92 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var92 g a -> Var92 (snoc92 g b) a)\n -> Var92 g a\n\nvz92 : {g : _}-> {a : _} -> Var92 (snoc92 g a) a\nvz92 = \\ var, vz92, vs => vz92 _ _\n\nvs92 : {g : _} -> {B : _} -> {a : _} -> Var92 g a -> Var92 (snoc92 g B) a\nvs92 = \\ x, var, vz92, vs92 => vs92 _ _ _ (x var vz92 vs92)\n\nTm92 : Con92 -> Ty92 -> Type\nTm92 = \\ g, a =>\n    (Tm92    : Con92 -> Ty92 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var92 g a -> Tm92 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm92 (snoc92 g a) B -> Tm92 g (arr92 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm92 g (arr92 a B) -> Tm92 g a -> Tm92 g B)\n -> Tm92 g a\n\nvar92 : {g : _} -> {a : _} -> Var92 g a -> Tm92 g a\nvar92 = \\ x, tm, var92, lam, app => var92 _ _ x\n\nlam92 : {g : _} -> {a : _} -> {B : _} -> Tm92 (snoc92 g a) B -> Tm92 g (arr92 a B)\nlam92 = \\ t, tm, var92, lam92, app => lam92 _ _ _ (t tm var92 lam92 app)\n\napp92 : {g:_}->{a:_}->{B:_} -> Tm92 g (arr92 a B) -> Tm92 g a -> Tm92 g B\napp92 = \\ t, u, tm, var92, lam92, app92 => app92 _ _ _ (t tm var92 lam92 app92) (u tm var92 lam92 app92)\n\nv092 : {g:_}->{a:_} -> Tm92 (snoc92 g a) a\nv092 = var92 vz92\n\nv192 : {g:_}->{a:_}-> {B:_}-> Tm92 (snoc92 (snoc92 g a) B) a\nv192 = var92 (vs92 vz92)\n\nv292 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm92 (snoc92 (snoc92 (snoc92 g a) B) C) a\nv292 = var92 (vs92 (vs92 vz92))\n\nv392 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm92 (snoc92 (snoc92 (snoc92 (snoc92 g a) B) C) D) a\nv392 = var92 (vs92 (vs92 (vs92 vz92)))\n\nv492 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm92 (snoc92 (snoc92 (snoc92 (snoc92 (snoc92 g a) B) C) D) E) a\nv492 = var92 (vs92 (vs92 (vs92 (vs92 vz92))))\n\ntest92 : {g:_}-> {a:_} -> Tm92 g (arr92 (arr92 a a) (arr92 a a))\ntest92  = lam92 (lam92 (app92 v192 (app92 v192 (app92 v192 (app92 v192 (app92 v192 (app92 v192 v092)))))))\nTy93 : Type\nTy93 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty93 : Ty93\nempty93 = \\ _, empty, _ => empty\n\narr93 : Ty93 -> Ty93 -> Ty93\narr93 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon93 : Type\nCon93 = (Con93 : Type)\n ->(nil  : Con93)\n ->(snoc : Con93 -> Ty93 -> Con93)\n -> Con93\n\nnil93 : Con93\nnil93 = \\ con, nil93, snoc => nil93\n\nsnoc93 : Con93 -> Ty93 -> Con93\nsnoc93 = \\ g, a, con, nil93, snoc93 => snoc93 (g con nil93 snoc93) a\n\nVar93 : Con93 -> Ty93 -> Type\nVar93 = \\ g, a =>\n    (Var93 : Con93 -> Ty93 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var93 (snoc93 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var93 g a -> Var93 (snoc93 g b) a)\n -> Var93 g a\n\nvz93 : {g : _}-> {a : _} -> Var93 (snoc93 g a) a\nvz93 = \\ var, vz93, vs => vz93 _ _\n\nvs93 : {g : _} -> {B : _} -> {a : _} -> Var93 g a -> Var93 (snoc93 g B) a\nvs93 = \\ x, var, vz93, vs93 => vs93 _ _ _ (x var vz93 vs93)\n\nTm93 : Con93 -> Ty93 -> Type\nTm93 = \\ g, a =>\n    (Tm93    : Con93 -> Ty93 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var93 g a -> Tm93 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm93 (snoc93 g a) B -> Tm93 g (arr93 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm93 g (arr93 a B) -> Tm93 g a -> Tm93 g B)\n -> Tm93 g a\n\nvar93 : {g : _} -> {a : _} -> Var93 g a -> Tm93 g a\nvar93 = \\ x, tm, var93, lam, app => var93 _ _ x\n\nlam93 : {g : _} -> {a : _} -> {B : _} -> Tm93 (snoc93 g a) B -> Tm93 g (arr93 a B)\nlam93 = \\ t, tm, var93, lam93, app => lam93 _ _ _ (t tm var93 lam93 app)\n\napp93 : {g:_}->{a:_}->{B:_} -> Tm93 g (arr93 a B) -> Tm93 g a -> Tm93 g B\napp93 = \\ t, u, tm, var93, lam93, app93 => app93 _ _ _ (t tm var93 lam93 app93) (u tm var93 lam93 app93)\n\nv093 : {g:_}->{a:_} -> Tm93 (snoc93 g a) a\nv093 = var93 vz93\n\nv193 : {g:_}->{a:_}-> {B:_}-> Tm93 (snoc93 (snoc93 g a) B) a\nv193 = var93 (vs93 vz93)\n\nv293 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm93 (snoc93 (snoc93 (snoc93 g a) B) C) a\nv293 = var93 (vs93 (vs93 vz93))\n\nv393 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm93 (snoc93 (snoc93 (snoc93 (snoc93 g a) B) C) D) a\nv393 = var93 (vs93 (vs93 (vs93 vz93)))\n\nv493 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm93 (snoc93 (snoc93 (snoc93 (snoc93 (snoc93 g a) B) C) D) E) a\nv493 = var93 (vs93 (vs93 (vs93 (vs93 vz93))))\n\ntest93 : {g:_}-> {a:_} -> Tm93 g (arr93 (arr93 a a) (arr93 a a))\ntest93  = lam93 (lam93 (app93 v193 (app93 v193 (app93 v193 (app93 v193 (app93 v193 (app93 v193 v093)))))))\nTy94 : Type\nTy94 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty94 : Ty94\nempty94 = \\ _, empty, _ => empty\n\narr94 : Ty94 -> Ty94 -> Ty94\narr94 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon94 : Type\nCon94 = (Con94 : Type)\n ->(nil  : Con94)\n ->(snoc : Con94 -> Ty94 -> Con94)\n -> Con94\n\nnil94 : Con94\nnil94 = \\ con, nil94, snoc => nil94\n\nsnoc94 : Con94 -> Ty94 -> Con94\nsnoc94 = \\ g, a, con, nil94, snoc94 => snoc94 (g con nil94 snoc94) a\n\nVar94 : Con94 -> Ty94 -> Type\nVar94 = \\ g, a =>\n    (Var94 : Con94 -> Ty94 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var94 (snoc94 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var94 g a -> Var94 (snoc94 g b) a)\n -> Var94 g a\n\nvz94 : {g : _}-> {a : _} -> Var94 (snoc94 g a) a\nvz94 = \\ var, vz94, vs => vz94 _ _\n\nvs94 : {g : _} -> {B : _} -> {a : _} -> Var94 g a -> Var94 (snoc94 g B) a\nvs94 = \\ x, var, vz94, vs94 => vs94 _ _ _ (x var vz94 vs94)\n\nTm94 : Con94 -> Ty94 -> Type\nTm94 = \\ g, a =>\n    (Tm94    : Con94 -> Ty94 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var94 g a -> Tm94 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm94 (snoc94 g a) B -> Tm94 g (arr94 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm94 g (arr94 a B) -> Tm94 g a -> Tm94 g B)\n -> Tm94 g a\n\nvar94 : {g : _} -> {a : _} -> Var94 g a -> Tm94 g a\nvar94 = \\ x, tm, var94, lam, app => var94 _ _ x\n\nlam94 : {g : _} -> {a : _} -> {B : _} -> Tm94 (snoc94 g a) B -> Tm94 g (arr94 a B)\nlam94 = \\ t, tm, var94, lam94, app => lam94 _ _ _ (t tm var94 lam94 app)\n\napp94 : {g:_}->{a:_}->{B:_} -> Tm94 g (arr94 a B) -> Tm94 g a -> Tm94 g B\napp94 = \\ t, u, tm, var94, lam94, app94 => app94 _ _ _ (t tm var94 lam94 app94) (u tm var94 lam94 app94)\n\nv094 : {g:_}->{a:_} -> Tm94 (snoc94 g a) a\nv094 = var94 vz94\n\nv194 : {g:_}->{a:_}-> {B:_}-> Tm94 (snoc94 (snoc94 g a) B) a\nv194 = var94 (vs94 vz94)\n\nv294 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm94 (snoc94 (snoc94 (snoc94 g a) B) C) a\nv294 = var94 (vs94 (vs94 vz94))\n\nv394 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm94 (snoc94 (snoc94 (snoc94 (snoc94 g a) B) C) D) a\nv394 = var94 (vs94 (vs94 (vs94 vz94)))\n\nv494 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm94 (snoc94 (snoc94 (snoc94 (snoc94 (snoc94 g a) B) C) D) E) a\nv494 = var94 (vs94 (vs94 (vs94 (vs94 vz94))))\n\ntest94 : {g:_}-> {a:_} -> Tm94 g (arr94 (arr94 a a) (arr94 a a))\ntest94  = lam94 (lam94 (app94 v194 (app94 v194 (app94 v194 (app94 v194 (app94 v194 (app94 v194 v094)))))))\nTy95 : Type\nTy95 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty95 : Ty95\nempty95 = \\ _, empty, _ => empty\n\narr95 : Ty95 -> Ty95 -> Ty95\narr95 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon95 : Type\nCon95 = (Con95 : Type)\n ->(nil  : Con95)\n ->(snoc : Con95 -> Ty95 -> Con95)\n -> Con95\n\nnil95 : Con95\nnil95 = \\ con, nil95, snoc => nil95\n\nsnoc95 : Con95 -> Ty95 -> Con95\nsnoc95 = \\ g, a, con, nil95, snoc95 => snoc95 (g con nil95 snoc95) a\n\nVar95 : Con95 -> Ty95 -> Type\nVar95 = \\ g, a =>\n    (Var95 : Con95 -> Ty95 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var95 (snoc95 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var95 g a -> Var95 (snoc95 g b) a)\n -> Var95 g a\n\nvz95 : {g : _}-> {a : _} -> Var95 (snoc95 g a) a\nvz95 = \\ var, vz95, vs => vz95 _ _\n\nvs95 : {g : _} -> {B : _} -> {a : _} -> Var95 g a -> Var95 (snoc95 g B) a\nvs95 = \\ x, var, vz95, vs95 => vs95 _ _ _ (x var vz95 vs95)\n\nTm95 : Con95 -> Ty95 -> Type\nTm95 = \\ g, a =>\n    (Tm95    : Con95 -> Ty95 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var95 g a -> Tm95 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm95 (snoc95 g a) B -> Tm95 g (arr95 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm95 g (arr95 a B) -> Tm95 g a -> Tm95 g B)\n -> Tm95 g a\n\nvar95 : {g : _} -> {a : _} -> Var95 g a -> Tm95 g a\nvar95 = \\ x, tm, var95, lam, app => var95 _ _ x\n\nlam95 : {g : _} -> {a : _} -> {B : _} -> Tm95 (snoc95 g a) B -> Tm95 g (arr95 a B)\nlam95 = \\ t, tm, var95, lam95, app => lam95 _ _ _ (t tm var95 lam95 app)\n\napp95 : {g:_}->{a:_}->{B:_} -> Tm95 g (arr95 a B) -> Tm95 g a -> Tm95 g B\napp95 = \\ t, u, tm, var95, lam95, app95 => app95 _ _ _ (t tm var95 lam95 app95) (u tm var95 lam95 app95)\n\nv095 : {g:_}->{a:_} -> Tm95 (snoc95 g a) a\nv095 = var95 vz95\n\nv195 : {g:_}->{a:_}-> {B:_}-> Tm95 (snoc95 (snoc95 g a) B) a\nv195 = var95 (vs95 vz95)\n\nv295 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm95 (snoc95 (snoc95 (snoc95 g a) B) C) a\nv295 = var95 (vs95 (vs95 vz95))\n\nv395 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm95 (snoc95 (snoc95 (snoc95 (snoc95 g a) B) C) D) a\nv395 = var95 (vs95 (vs95 (vs95 vz95)))\n\nv495 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm95 (snoc95 (snoc95 (snoc95 (snoc95 (snoc95 g a) B) C) D) E) a\nv495 = var95 (vs95 (vs95 (vs95 (vs95 vz95))))\n\ntest95 : {g:_}-> {a:_} -> Tm95 g (arr95 (arr95 a a) (arr95 a a))\ntest95  = lam95 (lam95 (app95 v195 (app95 v195 (app95 v195 (app95 v195 (app95 v195 (app95 v195 v095)))))))\n", "meta": {"hexsha": "1e2b2818e87f19d22ade727dd09392c0835ecf6e", "size": 234520, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "bench/stlc_small5k.idr", "max_stars_repo_name": "Kha/smalltt", "max_stars_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 377, "max_stars_repo_stars_event_min_datetime": "2017-11-26T16:57:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T21:31:01.000Z", "max_issues_repo_path": "bench/stlc_small5k.idr", "max_issues_repo_name": "Kha/smalltt", "max_issues_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2020-03-16T09:14:57.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-28T21:51:10.000Z", "max_forks_repo_path": "bench/stlc_small5k.idr", "max_forks_repo_name": "Kha/smalltt", "max_forks_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 19, "max_forks_repo_forks_event_min_datetime": "2018-12-05T21:11:34.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T19:46:54.000Z", "avg_line_length": 34.4022297198, "max_line_length": 118, "alphanum_fraction": 0.5050997783, "num_tokens": 107545, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8289388167733099, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.5369850882970811}}
{"text": "module QPF\n\nimport Linear.Types\nimport Linear.Equality\nimport FunExt\n\n{-\n   This file implements quantitative polynomial functors as a type\n   Desc with interpretation qpf, and shows that initiality implies\n   induction for them.\n-}\n\n\n-- Grammar of polynomial functors\n\npublic export\ndata Desc : Type where\n  Id' : Desc\n  Const' : Type -> Desc\n  Prod' : Desc -> Desc -> Desc\n  Sum' : Desc -> Desc -> Desc\n  With' : Desc -> Desc -> Desc\n  Arr' : Type -> Desc -> Desc\n\n-- Interpretation\n\npublic export\n0 qpf : Desc -> Type -> Type\nqpf Id' x = x\nqpf (Const' a) _  = a\nqpf (Prod' f g) x = LPair (qpf f x) (qpf g x)\nqpf (Sum' f g) x = Sum (qpf f x) (qpf g x)\nqpf (With' f g) x = With (qpf f x) (qpf g x)\nqpf (Arr' a f) x = a -<> qpf f x\n\npublic export\nfmap : (d : Desc) -> (f : a -<> b) -> qpf d a -<> qpf d b\nfmap Id' f x = f x\nfmap (Const' _) _ x = x\nfmap (Prod' c d) f x = bimap (fmap c f) (fmap d f) x\nfmap (Sum' c d) f x = bimap (fmap c f) (fmap d f) x\nfmap (With' c d) f x = bimap (fmap c f) (fmap d f) x\nfmap (Arr' a c) f x = \\ y => fmap c f (x y)\n\n-- Functor laws\n0 fmap_id : {d : Desc} -> (1 x : qpf d a) -> x = fmap {b = a} d (\\1 x => x) x\nfmap_id {d = Id'} x = Refl\nfmap_id {d = (Const' _)} _ = Refl\nfmap_id {d = (Prod' c d)} (x # y) = lcong2 (#) (fmap_id x) (fmap_id y)\nfmap_id {d = (Sum' c d)} (Inl x) = lcong Inl (fmap_id x)\nfmap_id {d = (Sum' c d)} (Inr y) = lcong Inr (fmap_id y)\nfmap_id {d = (With' c d)} x = funext (\\b => if b then fmap_id (x True) else fmap_id (x False))\nfmap_id {d = (Arr' a c)} g = funext (\\ y => fmap_id (g y))\n\n0 fmap_comp : (d : Desc) -> {f : a -<> b} -> {g : b -<> c} ->\n              (1 x : qpf d a) -> fmap d g (fmap d f x) = fmap d (\\ x => g (f x)) x\nfmap_comp Id' x = Refl\nfmap_comp (Const' a) _ = Refl\nfmap_comp (Prod' c d) (x # y) = lcong2 (#) (fmap_comp c {f} {g} x) (fmap_comp d {f} {g} y)\nfmap_comp (Sum' c d) (Inl x) = lcong Inl (fmap_comp c x)\nfmap_comp (Sum' c d) (Inr y) = lcong Inr (fmap_comp d y)\nfmap_comp (With' c d) x = funext (\\b => if b then fmap_comp c (x True) else fmap_comp d (x False))\nfmap_comp (Arr' a c) g = funext (\\ y => fmap_comp c (g y))\n\n-- Predicate lifting\n\npublic export\n0 lift : (d : Desc) -> (p : x -> Type) -> qpf d x -> Type\nlift Id' p f = p f\nlift (Const' a) p x = Sigma1 a (\\ y => x = y)\nlift (Prod' c d) p z = LPair (lift c p (LPair.fst z)) (lift d p (LPair.snd z))\nlift (Sum' c d) p z = Sum (Sigma0 (qpf c x) (\\ z1 => LPair (z = Inl z1) (lift c p z1))) (Sigma0 (qpf d x) (\\ z2 => LPair (z = Inr z2) (lift d p z2)))\nlift (With' c d) p f = With (lift c p (f True)) (lift d p (f False))\nlift (Arr' a c) p f = (1 y : a) -> lift c p (f y)\n\n-- Lifting fuses with fmap (we only provide the useful direction)\n\n0 liftcomp : (d : Desc) -> (p : x -> Type) -> (g : x' -<> x) ->\n           (y : qpf d x') -> lift d p (fmap d g y) -> lift d (\\ w => p (g w)) y\nliftcomp Id' p g y z = z\nliftcomp (Const' a) p g y z = z\nliftcomp (Prod' c d) p g (x # y) (z1 # z2) = (liftcomp c p g x z1) # (liftcomp d p g y z2)\nliftcomp (Sum' c d) p g (Inl y) (Inl (_ # (Refl # z))) = Inl (y # (Refl # liftcomp c p g y z))\nliftcomp (Sum' c d) p g (Inl y) (Inr (_ # (leqr # z))) = absurd leqr\nliftcomp (Sum' c d) p g (Inr y) (Inl (_ # (leqr # z))) = absurd (sym leqr)\nliftcomp (Sum' c d) p g (Inr y) (Inr (_ # (Refl # z))) = Inr (y # (Refl # liftcomp d p g y z))\nliftcomp (With' c d) p g y z = \\ b => if b then liftcomp c p g (y True) (z True) else liftcomp d p g (y False) (z False)\nliftcomp (Arr' a c) p g f z = \\ y => liftcomp c p g (f y) (z y)\n\nliftfmap : (d : Desc) -> {p : x -> Type} ->\n           ((1 y : x) -> p y) -> (1 z : qpf d x) -> lift d p z\nliftfmap Id' f z = f z\nliftfmap (Const' a) f z = z # Refl\nliftfmap (Prod' c d) f (z1 # z2) = liftfmap c f z1 # liftfmap d f z2\nliftfmap (Sum' c d) f (Inl z) = Inl (z # (Refl # liftfmap c f z))\nliftfmap (Sum' c d) f (Inr z) = Inr (z # (Refl # liftfmap d f z))\nliftfmap (With' c d) f z = \\ b => if b then liftfmap c f (z True) else liftfmap d f (z False)\nliftfmap (Arr' a c) f z = \\ y => liftfmap c f (z y)\n\n0 liftfmap_comp : {x : Type} -> {x' : Type} -> (d : Desc) -> {p : x -> Type} ->\n                (f : (1 y : x) -> p y) -> (g : x' -<> x) ->\n                (1 z : qpf d x') ->\n                liftcomp d p g z (liftfmap d {p} f (fmap d g z)) = liftfmap d {p = \\ w => p (g w)} (\\ x => f (g x)) z\n\nliftfmap_comp Id' f g y = Refl\nliftfmap_comp (Const' a) f g y = Refl\nliftfmap_comp (Prod' c d) f g (x # y) = lcong2 (#) (liftfmap_comp c f g x) (liftfmap_comp d f g y)\nliftfmap_comp (Sum' c d) f g (Inl y) = lcong (\\ z => Inl (y # (Refl # z))) (liftfmap_comp c f g y)\nliftfmap_comp (Sum' c d) f g (Inr y) = lcong (\\ z => Inr (y # (Refl # z))) (liftfmap_comp d f g y)\nliftfmap_comp (With' c d) f g y =  funext (\\ b => if b then liftfmap_comp c f g (y True) else liftfmap_comp d f g (y False))\nliftfmap_comp (Arr' a c) f g h = funext (\\ y => liftfmap_comp c f g (h y))\n\n\n\n-- qpf d distributes over Sigma0\n\npublic export\ndist : {0 x : Type} -> {0 y : x -> Type} ->\n       (d : Desc) -> qpf d (Sigma0 x y) -<> Sigma0 (qpf d x) (lift d y)\ndist Id' (x # y)  = x # y\ndist (Const' _) x = x # (x # Refl)\ndist (Prod' c d) (x # y) =\n  let (f # lf) = dist c x\n      (g # lg) = dist d y\n  in  (f # g) # (lf # lg)\ndist (Sum' c d) (Inl f) =\n  let (f # lf) = dist c f\n  in  (Inl f) # (Inl (f # (Refl # lf)))\ndist (Sum' c d) (Inr g) =\n  let (g # lg) = dist d g\n  in  (Inr g) # (Inr (g # (Refl # lg)))\ndist (With' c d) w =\n   (h w) # (j w) where\n    0 h : With (qpf c (Sigma0 x y)) (qpf d (Sigma0 x y)) -> With (qpf c x) (qpf d x)\n    h u True  = fst (dist c (u True))\n    h u False = fst (dist d (u False))\n\n    j : (1 u : With (qpf c (Sigma0 x y)) (qpf d (Sigma0 x y))) ->\n        With (lift c y (h u True)) (lift d y (h u False))\n    j u True  = snd (dist c (u True))\n    j u False = snd (dist d (u False))\ndist (Arr' a c) w =\n   (h w) # (j w) where\n    0 h : (a -<> qpf c (Sigma0 x y)) -> (a -<> qpf c x)\n    h g z = fst (dist c (g z))\n\n    j : (1 g : a -<> qpf c (Sigma0 x y)) ->\n        ((1 z : a) -> (lift c y (h g z)))\n    j g z = snd (dist c (g z))\n\n-- The first projection of dist is fmap fst\n0 distfst : (d : Desc) -> {0 x : Type} -> {0 p : x -> Type} ->\n          (y : qpf d (Sigma0 x p)) -> fst {b = lift d p} (dist {y = p} d y) = fmap {b = x} d (fst {b = p}) y\ndistfst Id' (x # y) = Refl\ndistfst (Const' a) y = Refl\ndistfst (Prod' c d) (x # y) with (distfst c x)\n  distfst (Prod' c d) (x # y) | r with (distfst d y)\n    distfst (Prod' c d) (x # y) | r | q with (dist c x)\n      distfst (Prod' c d) (x # y) | r | q | (f # lf) with (dist d y)\n         distfst (Prod' c d) (x # y) | r | q | (f # lf) | (g # lg) = lcong2 (#) r q\ndistfst (Sum' c d) (Inl y) with (distfst c y)\n  distfst (Sum' c d) (Inl y) | q with (dist c y)\n    distfst (Sum' c d) (Inl y) | q | (f # lf) = lcong Inl q\ndistfst (Sum' c d) (Inr y) with (distfst d y)\n  distfst (Sum' c d) (Inr y) | q with (dist d y)\n    distfst (Sum' c d) (Inr y) | q | (f # lf) = lcong Inr q\ndistfst (With' c d) y = funext (\\ b => if b then distfst c (y True) else distfst d (y False))\ndistfst (Arr' a c) y = funext (\\ z => distfst c (y z))\n\n\n-- Algebra\n\npublic export\ndata W : (0 u : Desc) -> Type where\n  Con : qpf u (W u)  -<> W u\n  -- Note: we only use pattern matching on Con to define fold and prove its properties\n\n-- The notion of algebra morphism\n\n0 morphism : (d : Desc) -> (alg1 : qpf d a -<> a) -> (alg2 : qpf d b -<> b) ->\n             a -<> b -> Type\nmorphism d alg1 alg2 f = (1 y : qpf d a) -> f (alg1 y) = alg2 (fmap d f y)\n\n0 morphism_id : (alg : qpf d a -<> a) -> morphism d alg alg (\\ x => x)\nmorphism_id alg y = lcong alg (fmap_id y)\n\n0 morphism_comp : {d : Desc} ->\n                  (alg1 : qpf d a -<> a) ->\n                  (alg2 : qpf d b -<> b) ->\n                  (alg3 : qpf d c -<> c) ->\n                  {f : a -<> b} -> {g : b -<> c} ->\n                  morphism d alg1 alg2 f ->\n                  morphism d alg2 alg3 g ->\n                  morphism d alg1 alg3 (\\ x => g (f x))\nmorphism_comp {d} alg1 alg2 alg3 {f} {g} m12 m23 y =\n  trans (lcong g (m12 y)) (trans (m23 (fmap d f y)) (lcong alg3 (fmap_comp d y)))\n\n-- Unique mediating morphism\n\nmutual\n  fold_h : {c : Desc} -> (d : Desc) -> (qpf c x -<> x) -> qpf d (W c) -<> qpf d x\n  fold_h Id' alg (Con w) = alg (fold_h c alg w)\n  fold_h (Const' y) alg w = w\n  fold_h (Prod' c d) alg w = bimap (fold_h c alg) (fold_h d alg) w\n  fold_h (Sum' c d) alg w = bimap (fold_h c alg) (fold_h d alg) w\n  fold_h (With' c d) alg w = with With.bimap (bimap (fold_h c alg) (fold_h d alg) w)\n  fold_h (Arr' a c) alg w = \\ y => fold_h c alg (w y)\n\n  fold : (d : Desc) -> (qpf d x -<> x) -> W d -<> x\n  fold d alg (Con w) = alg (fold_h d alg w)\n\nmutual\n  0 uniq_h : {c : Desc} -> (d : Desc) ->\n             (h : W c -<> x) ->\n             (alg : qpf c x -<> x) ->\n             morphism c Con alg h ->\n             (w : qpf d (W c)) -> fmap d h w = fold_h {c = c} d alg w\n  uniq_h Id' h alg commutes (Con y) = trans (commutes y) (lcong alg (uniq_h c h alg commutes y))\n  uniq_h (Const' y) h calg commutes z = Refl\n  uniq_h (Prod' c' d') h calg commutes (f' # g') =\n    let uc' = uniq_h c' h calg commutes f'\n        ud' = uniq_h d' h calg commutes g'\n    in lcong2 (#) uc' ud'\n  uniq_h (Sum' c' d') h calg commutes (Inl f') = lcong Inl (uniq_h c' h calg commutes f')\n  uniq_h (Sum' c' d') h calg commutes (Inr g') = lcong Inr (uniq_h d' h calg commutes g')\n  uniq_h (With' c' d') h calg commutes z =\n    funext (\\x => if x then uniq_h c' h calg commutes (z True)\n                       else uniq_h d' h calg commutes (z False))\n  uniq_h (Arr' a c') h calg commutes z = funext (\\ y => uniq_h c' h calg commutes (z y))\n\n  0 uniq : {d : Desc} ->\n           (alg : qpf d x -<> x) ->\n           (h : W d -<> x) ->\n           ((1 y : qpf d (W d)) -> h (Con y) = alg (fmap d h y)) ->\n           (w : W d) -> h w = fold d alg w\n  uniq alg h commutes (Con y) =\n    trans (commutes y) (lcong alg (uniq_h d h alg commutes y))\n\n0 foldCon_id : (1 w : W d) -> w = fold d Con w\nfoldCon_id w = uniq Con (\\x => x) (\\y => lcong Con (fmap_id y)) w\n\n0 foldCommutes : (d : Desc) -> (alg : qpf d x -<> x) ->\n                 morphism d Con alg (fold d alg)\nfoldCommutes Id' alg (Con x) = Refl\nfoldCommutes (Const' _) alg x = Refl\nfoldCommutes (Prod' c d) alg (x # y) =\n  let commutesC = uniq_h c (fold (Prod' c d) alg) alg (foldCommutes (Prod' c d) alg) x\n      commutesD = uniq_h d (fold (Prod' c d) alg) alg (foldCommutes (Prod' c d) alg) y\n  in lcong alg (lcong2 (#) (sym commutesC) (sym commutesD))\n\nfoldCommutes (Sum' c d) alg (Inl x) =\n  let commutesC = uniq_h c (fold (Sum' c d) alg) alg (foldCommutes (Sum' c d) alg) x\n  in lcong alg (lcong Inl (sym commutesC))\n\nfoldCommutes (Sum' c d) alg (Inr y) =\n  let commutesD = uniq_h d (fold (Sum' c d) alg) alg (foldCommutes (Sum' c d) alg) y\n  in lcong alg (lcong Inr (sym commutesD))\n\nfoldCommutes (With' c d) alg x =\n  lcong alg (funext (\\b => if b then sym (uniq_h c (fold (With' c d) alg) alg (foldCommutes (With' c d) alg) (x True))\n                else sym (uniq_h d (fold (With' c d) alg) alg (foldCommutes (With' c d) alg) (x False))\n     ))\nfoldCommutes (Arr' a c) alg g =\n   lcong alg (funext (\\ y => sym (uniq_h c (fold (Arr' a c) alg) alg (foldCommutes (Arr' a c) alg) (g y))))\n\n-- Induction from initiality\n\npAlg : {d : Desc} -> {0 p : x -> Type} -> (alg : qpf d x -<> x) ->\n       (step : (1 w : Sigma0 (qpf d x) (lift d p)) -> p (alg (fst w))) ->\n       qpf d (Sigma0 x p) -<> Sigma0 x p\npAlg alg step y = let z = dist d y in alg (fst z) # step z\n\n0 fstCommutes : (d : Desc) -> {0 p : x -> Type} -> {alg : qpf d x -<> x} ->\n                {step : (1 w : Sigma0 (qpf d x) (lift d p)) -> p (alg (fst w))} ->\n                morphism d (pAlg {d} {p} alg step) alg Sigma0.fst\nfstCommutes d z = lcong alg (distfst d z)\n\npublic export\ninduction : {d : Desc} -> {0 p : W d -> Type} ->\n            (step : (1 w : Sigma0 (qpf d (W d)) (lift d p)) -> p (Con (fst w))) ->\n            (1 w : W d) -> p w\ninduction step w =\n  let\n    h : W d -<> Sigma0 (W d) p\n    h = fold d (pAlg Con step)\n    0 eq : (w : W d) -> fst (h w) = w\n    eq w = trans (uniq Con (\\w => fst (h w)) (\\ y => morphism_comp Con (pAlg Con step) Con (foldCommutes d (pAlg Con step)) (fstCommutes {alg = Con} {step} d) y) w) (sym (foldCon_id w))\n  in replace {x = fst (h w)} {p = p} (eq w) (snd (h w))\n", "meta": {"hexsha": "58cccfe1bd8430ba382500af44ac67729a05ecae", "size": 12317, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "QPF.idr", "max_stars_repo_name": "g-nakov/quantitative-poly", "max_stars_repo_head_hexsha": "7602304f9e85b2a4abf1db08328d3ea302c854da", "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": "QPF.idr", "max_issues_repo_name": "g-nakov/quantitative-poly", "max_issues_repo_head_hexsha": "7602304f9e85b2a4abf1db08328d3ea302c854da", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "QPF.idr", "max_forks_repo_name": "g-nakov/quantitative-poly", "max_forks_repo_head_hexsha": "7602304f9e85b2a4abf1db08328d3ea302c854da", "max_forks_repo_licenses": ["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.6193771626, "max_line_length": 185, "alphanum_fraction": 0.5307298855, "num_tokens": 4984, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303186696748, "lm_q2_score": 0.6791786861878392, "lm_q1q2_score": 0.5369113432257235}}
{"text": "---\npandoc-minted:\n  language: idris\n---\n\n= Bathroom Security\n\n[Link](https://adventofcode.com/2016/day/2)\n\nYou arrive at *Easter Bunny Headquarters* under cover of darkness. However, you\nleft in such a rush that you forgot to use the bathroom! Fancy office buildings\nlike this one usually have keypad locks on their bathrooms, so you search the\nfront desk for the code.\n\n\"In order to improve security,\" the document you find says, \"bathroom codes will\nno longer be written down. Instead, please memorize and follow the procedure\nbelow to access the bathrooms.\"\n\nThe document goes on to explain that each button to be pressed can be found by\nstarting on the previous button and moving to adjacent buttons on the keypad:\n`U` moves up, `D` moves down, `L` moves left, and `R` moves right. Each line of\ninstructions corresponds to one button, starting at the previous button (or, for\nthe first line, *the \"5\" button*); press whatever button you're on at the end of\neach line. If a move doesn't lead to a button, ignore it.\n\nYou can't hold it much longer, so you decide to figure out the code as you walk\nto the bathroom. You picture a keypad like this:\n\n```text\n1 2 3\n4 5 6\n7 8 9\n```\n\nSuppose your instructions are:\n\n```text\nULL\nRRDDD\nLURDL\nUUUUD\n```\n\n- You start at \"5\" and move up (to \"2\"), left (to \"1\"), and left (you can't, and\n  stay on \"1\"), so the first button is `1`.\n- Starting from the previous button (\"1\"), you move right twice (to \"3\") and\n  then down three times (stopping at \"9\" after two moves and ignoring the\n  third), ending up with `9`.\n- Continuing from \"9\", you move left, up, right, down, and left, ending with\n  `8`.\n- Finally, you move up four times (stopping at \"2\"), then down once, ending with\n  `5`.\n\nSo, in this example, the bathroom code is `1985`.\n\nYour puzzle input is the instructions from the document you found at the front\ndesk.\n\n\n== Module Declaration and Imports\n\n> ||| Day 2: Bathroom Security\n> module Data.Advent.Day02\n>\n> import public Data.Advent.Day\n> import public Data.Ix\n>\n> import Data.Vect\n>\n> import public Lightyear\n> import public Lightyear.Char\n> import public Lightyear.Strings\n\n\n== Data Types\n\n> %access public export\n>\n> ||| Up, down, left or right.\n> data Instruction = ||| Up\n>                    U\n>                  | ||| Down\n>                    D\n>                  | ||| Left\n>                    L\n>                  | ||| Right\n>                    R\n>\n> ||| A single digit, i.e. a number strictly less than ten.\n> Digit : Type\n> Digit = Fin 10\n>\n> implementation Show Digit where\n>   show = show . finToInteger\n>\n> implementation [showDigits] Show (List Digit) where\n>   show = concatMap show\n>\n> ||| A pair of coordinates on the keypad, `(x, y)`.\n> Coordinates : Type\n> Coordinates = (Fin 3, Fin 3)\n\n\\newpage\n\n\n== Parsers\n\n> %access export\n>\n> up : Parser Instruction\n> up = char 'U' *> pure U <?> \"up\"\n>\n> down : Parser Instruction\n> down = char 'D' *> pure D <?> \"down\"\n>\n> left : Parser Instruction\n> left = char 'L' *> pure L <?> \"left\"\n>\n> right : Parser Instruction\n> right = char 'R' *> pure R <?> \"right\"\n>\n> instruction : Parser Instruction\n> instruction = up <|> down <|> left <|> right <?> \"up, down, left or right\"\n>\n> partial instructions : Parser (List Instruction)\n> instructions = some instruction <* (skip endOfLine <|> eof)\n\n\n== Part One\n\n\\begin{quote}\n  What is the bathroom code?\n\\end{quote}\n\n> namespace PartOne\n>\n>   ||| A keypad like this:\n>   |||\n>   ||| ```\n>   ||| 1 2 3\n>   ||| 4 5 6\n>   ||| 7 8 9\n>   ||| ```\n>   keypad : Vect 3 (Vect 3 Digit)\n>   keypad = [ [1, 2, 3],\n>              [4, 5, 6],\n>              [7, 8, 9] ]\n>\n>   move : Coordinates -> Instruction -> Coordinates\n>   move (x, y) U = (x, pred y)\n>   move (x, y) D = (x, succ y)\n>   move (x, y) L = (pred x, y)\n>   move (x, y) R = (succ x, y)\n\n\\newpage\n\n>   button : Coordinates -> List Instruction -> (Coordinates, Digit)\n>   button loc@(x, y) [] = (loc, index x (index y keypad))\n>   button loc (i :: is) = button (move loc i) is\n>\n> partial partOne : List (List Instruction) -> String\n> partOne = show @{showDigits} . go ((1,1), [])\n>   where\n>     go : (Coordinates, List Digit) -> List (List Instruction) -> List Digit\n>     go (_, ds) []            = reverse ds\n>     go (loc, ds) (is :: iis) = let (loc', d) = PartOne.button loc is in\n>                                    go (loc', d :: ds) iis\n>\n> namespace PartOne\n>\n>   ||| ```idris example\n>   ||| example\n>   ||| ```\n>   partial example : String\n>   example = fromEither $ partOne <$>\n>             parse (some instructions) \"ULL\\nRRDDD\\nLURDL\\nUUUUD\"\n\n\n== Part Two\n\nYou finally arrive at the bathroom (it's a several minute walk from the lobby so\nvisitors can behold the many fancy conference rooms and water coolers on this\nfloor) and go to punch in the code. Much to your bladder's dismay, the keypad is\nnot at all like you imagined it. Instead, you are confronted with the result of\nhundreds of man-hours of bathroom-keypad-design meetings:\n\n```text\n    1\n  2 3 4\n5 6 7 8 9\n  A B C\n    D\n```\n\nYou still start at \"5\" and stop when you're at an edge, but given the same\ninstructions as above, the outcome is very different:\n\n- You start at \"5\" and don't move at all (up and left are both edges), ending at\n  `5`.\n- Continuing from \"5\", you move right twice and down three times (through \"6\",\n  \"7\", \"B\", \"D\", \"D\"), ending at `D`.\n- Then, from \"D\", you move five more times (through \"D\", \"B\", \"C\", \"C\", \"B\"),\n  ending at `B`.\n- Finally, after five more moves, you end at `3`.\n\n\\newpage\n\nSo, given the actual keypad layout, the code would be `5DB3`.\n\n\\begin{quote}\n  Using the same instructions in your puzzle input, what is the correct\n  \\textit{bathroom code}?\n\\end{quote}\n\n> namespace PartTwo\n>\n>   keypad : Vect 5 (n ** Vect n Char)\n>   keypad = [ (1 **           ['1'])\n>            , (3 **      ['2', '3', '4'])\n>            , (5 ** ['5', '6', '7', '8', '9'])\n>            , (3 **      ['A', 'B', 'C'])\n>            , (1 **           ['D'])\n>            ]\n>\n>   -- NOTE: This will wrap at the bounds, which might be unexpected.\n>   partial convert : (n : Nat) -> Fin m -> Fin n\n>   convert (S j) fm {m} =\n>       let delta = half $ if S j > m\n>                             then S j `minus` m\n>                             else m `minus` S j in\n>           the (Fin (S j)) $ fromNat $ finToNat fm `f` delta\n>     where\n>       f : Nat -> Nat -> Nat\n>       f = if S j > m then plus else minus\n>       partial half : Nat -> Nat\n>       half = flip div 2\n>\n>   canMoveVertically : (Fin (S k), Fin 5) -> Instruction -> Bool\n>   canMoveVertically (x, y) i with ((finToNat x, finToNat y))\n>     canMoveVertically (x, y) U | (col, row) =\n>         case row of\n>              Z                   => False\n>              S Z                 => col == 1\n>              S (S Z)             => inRange (1,3) col\n>              _                   => True\n>     canMoveVertically (x, y) D | (col, row) =\n>         case row of\n>              S (S Z)             => inRange (1,3) col\n>              S (S (S Z))         => col == 1\n>              S (S (S (S Z)))     => False\n>              _                   => True\n>     canMoveVertically _ _ | _ = True\n\n\\newpage\n\n>   partial move : (Fin (S k), Fin 5) -> Instruction ->\n>     ((n ** Fin n), Fin 5)\n>   move (x, y) U = if canMoveVertically (x, y) U\n>                      then let n = fst (index (pred y) keypad) in\n>                               ((n ** convert n x), pred y)\n>                      else ((_ ** x), y)\n>   move (x, y) D = if canMoveVertically (x, y) D\n>                      then let n = fst (index (succ y) keypad) in\n>                               ((n ** convert n x), succ y)\n>                      else ((_ ** x), y)\n>   move (x, y) L = let n = fst (index y keypad) in\n>                       ((n ** convert n (pred x)), y)\n>   move (x, y) R = let n = fst (index y keypad) in\n>                       ((n ** convert n (succ x)), y)\n>\n>   partial button : (Fin (S k), Fin 5) -> List Instruction ->\n>     (((n ** Fin n), Fin 5), Char)\n>   button loc@(x, y) [] =\n>       let (n ** row) = index y PartTwo.keypad\n>           xx = convert n x in\n>           (((n ** xx), y), index xx row)\n>   button loc (i :: is) =\n>       let ((S _ ** x), y) = move loc i in\n>           button (x, y) is\n>\n> partial partTwo : List (List Instruction) -> String\n> partTwo = go (((5 ** 0),2), [])\n>   where\n>     partial go : (((n ** Fin n), Fin 5), List Char) ->\n>       List (List Instruction) -> String\n>     go (_, cs) []            = pack $ reverse cs\n>     go (loc, cs) (is :: iis) =\n>         let ((S k ** xx), y) = loc\n>             (loc', c) = PartTwo.button (xx, y) {k=k} is in\n>             go (loc', c :: cs) iis\n>\n> namespace PartTwo\n>\n>   ||| ```idris example\n>   ||| PartTwo.example\n>   ||| ```\n>   partial example : String\n>   example = fromEither $ partTwo <$>\n>             parse (some instructions) \"ULL\\nRRDDD\\nLURDL\\nUUUUD\"\n\n\n== Main\n\n> namespace Main\n>\n>   partial main : IO ()\n>   main = runDay $ MkDay 2 (some instructions)\n>          (pure . partOne)\n>          (pure . partTwo)\n", "meta": {"hexsha": "a2a315b258e5b285f0400eb632c49860f722198c", "size": 9065, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "src/Data/Advent/Day02.lidr", "max_stars_repo_name": "yurrriq/advent-of-code", "max_stars_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-11-04T10:32:47.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-05T07:36:22.000Z", "max_issues_repo_path": "src/Data/Advent/Day02.lidr", "max_issues_repo_name": "yurrriq/aoc19", "max_issues_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_issues_repo_licenses": ["MIT"], "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/Advent/Day02.lidr", "max_forks_repo_name": "yurrriq/aoc19", "max_forks_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-02-26T19:27:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-26T19:27:21.000Z", "avg_line_length": 29.2419354839, "max_line_length": 80, "alphanum_fraction": 0.5503585218, "num_tokens": 2714, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7606506418255928, "lm_q2_score": 0.7057850340255386, "lm_q1q2_score": 0.5368558391224239}}
{"text": "module Prelude.Interfaces\n\nimport Builtin\nimport Prelude.Basics\nimport Prelude.EqOrd\nimport Prelude.Num\nimport Prelude.Ops\n\n%default total\n\n-------------\n-- ALGEBRA --\n-------------\n\n||| Sets equipped with a single binary operation that is associative.  Must\n||| satisfy the following laws:\n|||\n||| + Associativity of `<+>`:\n|||     forall a b c, a <+> (b <+> c) == (a <+> b) <+> c\npublic export\ninterface Semigroup ty where\n  (<+>) : ty -> ty -> ty\n\n||| Sets equipped with a single binary operation that is associative, along with\n||| a neutral element for that binary operation.  Must satisfy the following\n||| laws:\n|||\n||| + Associativity of `<+>`:\n|||     forall a b c, a <+> (b <+> c) == (a <+> b) <+> c\n||| + Neutral for `<+>`:\n|||     forall a, a <+> neutral == a\n|||     forall a, neutral <+> a == a\npublic export\ninterface Semigroup ty => Monoid ty where\n  neutral : ty\n\npublic export\nSemigroup () where\n  _ <+> _ = ()\n\npublic export\nMonoid () where\n  neutral = ()\n\npublic export\nSemigroup Ordering where\n  LT <+> _ = LT\n  GT <+> _ = GT\n  EQ <+> o =  o\n\npublic export\nMonoid Ordering where\n  neutral = EQ\n\npublic export\nSemigroup b => Semigroup (a -> b) where\n  (f <+> g) x = f x <+> g x\n\npublic export\nMonoid b => Monoid (a -> b) where\n  neutral _ = neutral\n\n\nexport\nshiftL : Int -> Int -> Int\nshiftL = prim__shl_Int\n\nexport\nshiftR : Int -> Int -> Int\nshiftR = prim__shr_Int\n\n----------------------------------------------\n-- FUNCTOR, APPLICATIVE, ALTERNATIVE, MONAD --\n----------------------------------------------\n\n||| Functors allow a uniform action over a parameterised type.\n||| @ f a parameterised type\npublic export\ninterface Functor f where\n  ||| Apply a function across everything of type 'a' in a parameterised type\n  ||| @ f the parameterised type\n  ||| @ func the function to apply\n  map : (func : a -> b) -> f a -> f b\n\n||| An infix alias for `map`, applying a function across everything of type 'a'\n||| in a parameterised type.\n||| @ f the parameterised type\n||| @ func the function to apply\npublic export\n(<$>) : Functor f => (func : a -> b) -> f a -> f b\n(<$>) func x = map func x\n\n||| Run something for effects, replacing the return value with a given parameter.\npublic export\n(<$) : Functor f => b -> f a -> f b\n(<$) b = map (const b)\n\n||| Flipped version of `<$`.\npublic export\n($>) : Functor f => f a -> b -> f b\n($>) fa b = map (const b) fa\n\n||| Run something for effects, throwing away the return value.\npublic export\nignore : Functor f => f a -> f ()\nignore = map (const ())\n\npublic export\ninterface Functor f => Applicative f where\n  pure : a -> f a\n  (<*>) : f (a -> b) -> f a -> f b\n\npublic export\n(<*) : Applicative f => f a -> f b -> f a\na <* b = map const a <*> b\n\npublic export\n(*>) : Applicative f => f a -> f b -> f b\na *> b = map (const id) a <*> b\n\n%allow_overloads pure\n%allow_overloads (<*)\n%allow_overloads (*>)\n\npublic export\ninterface Applicative f => Alternative f where\n  empty : f a\n  (<|>) : f a -> f a -> f a\n\npublic export\ninterface Applicative m => Monad m where\n  ||| Also called `bind`.\n  (>>=) : m a -> (a -> m b) -> m b\n\n  ||| Also called `flatten` or mu.\n  join : m (m a) -> m a\n\n  -- default implementations\n  (>>=) x f = join (f <$> x)\n  join x = x >>= id\n\n%allow_overloads (>>=)\n\n||| `guard a` is `pure ()` if `a` is `True` and `empty` if `a` is `False`.\npublic export\nguard : Alternative f => Bool -> f ()\nguard x = if x then pure () else empty\n\n||| Conditionally execute an applicative expression.\npublic export\nwhen : Applicative f => Bool -> Lazy (f ()) -> f ()\nwhen True f = f\nwhen False f = pure ()\n\n---------------------------\n-- FOLDABLE, TRAVERSABLE --\n---------------------------\n\n||| The `Foldable` interface describes how you can iterate over the elements in\n||| a parameterised type and combine the elements together, using a provided\n||| function, into a single result.\n||| @ t The type of the 'Foldable' parameterised type.\npublic export\ninterface Foldable (t : Type -> Type) where\n  ||| Successively combine the elements in a parameterised type using the\n  ||| provided function, starting with the element that is in the final position\n  ||| i.e. the right-most position.\n  ||| @ func  The function used to 'fold' an element into the accumulated result\n  ||| @ init  The starting value the results are being combined into\n  ||| @ input The parameterised type\n  foldr : (func : elem -> acc -> acc) -> (init : acc) -> (input : t elem) -> acc\n\n  ||| The same as `foldr` but begins the folding from the element at the initial\n  ||| position in the data structure i.e. the left-most position.\n  ||| @ func  The function used to 'fold' an element into the accumulated result\n  ||| @ init  The starting value the results are being combined into\n  ||| @ input The parameterised type\n  foldl : (func : acc -> elem -> acc) -> (init : acc) -> (input : t elem) -> acc\n  foldl f z t = foldr (flip (.) . flip f) id t z\n\n||| Similar to `foldl`, but uses a function wrapping its result in a `Monad`.\n||| Consequently, the final value is wrapped in the same `Monad`.\npublic export\nfoldlM : (Foldable t, Monad m) => (funcM: a -> b -> m a) -> (init: a) -> (input: t b) -> m a\nfoldlM fm a0 = foldl (\\ma,b => ma >>= flip fm b) (pure a0)\n\n||| Combine each element of a structure into a monoid.\npublic export\nconcat : (Foldable t, Monoid a) => t a -> a\nconcat = foldr (<+>) neutral\n\n||| Combine into a monoid the collective results of applying a function to each\n||| element of a structure.\npublic export\nconcatMap : (Foldable t, Monoid m) => (a -> m) -> t a -> m\nconcatMap f = foldr ((<+>) . f) neutral\n\n||| The conjunction of all elements of a structure containing lazy boolean\n||| values.  `and` short-circuits from left to right, evaluating until either an\n||| element is `False` or no elements remain.\npublic export\nand : Foldable t => t (Lazy Bool) -> Bool\nand = foldl (&&) True\n\n||| The disjunction of all elements of a structure containing lazy boolean\n||| values.  `or` short-circuits from left to right, evaluating either until an\n||| element is `True` or no elements remain.\npublic export\nor : Foldable t => t (Lazy Bool) -> Bool\nor = foldl (||) False\n\n||| The disjunction of the collective results of applying a predicate to all\n||| elements of a structure.  `any` short-circuits from left to right.\npublic export\nany : Foldable t => (a -> Bool) -> t a -> Bool\nany p = foldl (\\x,y => x || p y) False\n\n||| The disjunction of the collective results of applying a predicate to all\n||| elements of a structure.  `all` short-circuits from left to right.\npublic export\nall : Foldable t => (a -> Bool) -> t a -> Bool\nall p = foldl (\\x,y => x && p y)  True\n\n||| Add together all the elements of a structure.\npublic export\nsum : (Foldable t, Num a) => t a -> a\nsum = foldr (+) 0\n\n||| Add together all the elements of a structure.\n||| Same as `sum` but tail recursive.\nexport\nsum' : (Foldable t, Num a) => t a -> a\nsum' = foldl (+) 0\n\n||| Multiply together all elements of a structure.\npublic export\nproduct : (Foldable t, Num a) => t a -> a\nproduct = foldr (*) 1\n\n||| Multiply together all elements of a structure.\n||| Same as `product` but tail recursive.\nexport\nproduct' : (Foldable t, Num a) => t a -> a\nproduct' = foldl (*) 1\n\n||| Map each element of a structure to a computation, evaluate those\n||| computations and discard the results.\npublic export\ntraverse_ : (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()\ntraverse_ f = foldr ((*>) . f) (pure ())\n\n||| Evaluate each computation in a structure and discard the results.\npublic export\nsequence_ : (Foldable t, Applicative f) => t (f a) -> f ()\nsequence_ = foldr (*>) (pure ())\n\n||| Like `traverse_` but with the arguments flipped.\npublic export\nfor_ : (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()\nfor_ = flip traverse_\n\n||| Fold using Alternative.\n|||\n||| If you have a left-biased alternative operator `<|>`, then `choice` performs\n||| left-biased choice from a list of alternatives, which means that it\n||| evaluates to the left-most non-`empty` alternative.\n|||\n||| If the list is empty, or all values in it are `empty`, then it evaluates to\n||| `empty`.\n|||\n||| Example:\n|||\n||| ```\n||| -- given a parser expression like:\n||| expr = literal <|> keyword <|> funcall\n|||\n||| -- choice lets you write this as:\n||| expr = choice [literal, keyword, funcall]\n||| ```\n|||\n||| Note: In Haskell, `choice` is called `asum`.\npublic export\nchoice : (Foldable t, Alternative f) => t (f a) -> f a\nchoice = foldr (<|>) empty\n\n||| A fused version of `choice` and `map`.\npublic export\nchoiceMap : (Foldable t, Alternative f) => (a -> f b) -> t a -> f b\nchoiceMap f = foldr (\\e, a => f e <|> a) empty\n\npublic export\ninterface (Functor t, Foldable t) => Traversable (t : Type -> Type) where\n  ||| Map each element of a structure to a computation, evaluate those\n  ||| computations and combine the results.\n  traverse : Applicative f => (a -> f b) -> t a -> f (t b)\n\n||| Evaluate each computation in a structure and collect the results.\npublic export\nsequence : (Traversable t, Applicative f) => t (f a) -> f (t a)\nsequence = traverse id\n\n||| Like `traverse` but with the arguments flipped.\npublic export\nfor : (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)\nfor = flip traverse\n\n", "meta": {"hexsha": "22a1107d2fae3d5c9aba807595d51448360dd3c7", "size": 9219, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/prelude/Prelude/Interfaces.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/prelude/Prelude/Interfaces.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/prelude/Prelude/Interfaces.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.0293159609, "max_line_length": 92, "alphanum_fraction": 0.6322811585, "num_tokens": 2672, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7606506526772883, "lm_q2_score": 0.7057850154599563, "lm_q1q2_score": 0.5368558326594658}}
{"text": "module Common.Util\n\nimport public Data.So\nimport public Data.Vect\nimport public Data.Rel\nimport public Decidable.Decidable\nimport public Common.Abbrev\n\n%default total\n%access public export\n\nexport\nrewriteRelation : (rel : Binrel s) -> a = aa -> b = bb -> rel a b -> rel aa bb\nrewriteRelation rel p q given = rewrite sym p in rewrite sym q in given\n\nexport\ncontraposition : (p -> q) -> Not q -> Not p\ncontraposition f contra p = contra (f p)\n\ntotal export\nbutNotLeft : Either a b -> Not a -> b\nbutNotLeft (Left a) contra = absurd (contra a)\nbutNotLeft (Right b) _ = b\n\ntotal\nisItSo : (b : Bool) -> Dec (So b)\nisItSo True = Yes Oh\nisItSo False = No absurd\n\n\ndata EitherErased : Type -> Type -> Type where\n  Left  : .a -> EitherErased a b\n  Right : .b -> EitherErased a b\n\n\nnamespace Either3Erased\n  data Either3Erased : Type -> Type -> Type -> Type where\n    Left   : .a -> Either3Erased a b c\n    Middle : .b -> Either3Erased a b c\n    Right  : .c -> Either3Erased a b c\n\nimplementation Show (EitherErased a b) where\n  show (Left _) = \"Left\"\n  show (Right _) = \"Right\"\n\nimplementation Show (Either3Erased a b c) where\n  show (Left _) = \"Left\"\n  show (Middle _) = \"Middle\"\n  show (Right _) = \"Right\"\n\n\ndecideBoth : (a -> b -> c) -> (c -> a) -> (c -> b) -> Dec a -> Dec b -> Dec c\ndecideBoth pair left right = dec\n  where\n    dec (Yes a) (Yes b) = Yes (pair a b)\n    dec (No contra) _ = No (contra . left)\n    dec _ (No contra) = No (contra . right)\n\n\n||| Reduce code clutter: if you inline this where it is used, an\n||| explicit type annotation would be needed.\ndecision : Decidable [s,s] rel => (a,b : s) -> Dec (rel a b)\ndecision {s} = decide {ts = [s,s]}\n", "meta": {"hexsha": "74c436fee12a9e33b1852f503530941a0b7e7ed9", "size": 1656, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Common/Util.idr", "max_stars_repo_name": "jeroennoels/verified-algebra", "max_stars_repo_head_hexsha": "85dfd88fecaf32bd20de72923d2d10de59d8b859", "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/Common/Util.idr", "max_issues_repo_name": "jeroennoels/verified-algebra", "max_issues_repo_head_hexsha": "85dfd88fecaf32bd20de72923d2d10de59d8b859", "max_issues_repo_licenses": ["MIT"], "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/Common/Util.idr", "max_forks_repo_name": "jeroennoels/verified-algebra", "max_forks_repo_head_hexsha": "85dfd88fecaf32bd20de72923d2d10de59d8b859", "max_forks_repo_licenses": ["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.875, "max_line_length": 78, "alphanum_fraction": 0.6485507246, "num_tokens": 517, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7057850154599562, "lm_q2_score": 0.7606506472514406, "lm_q1q2_score": 0.5368558288299837}}
{"text": "data Vect : Nat -> Type -> Type where\n    Nil  : Vect Z a\n    (::) : a -> Vect k a -> Vect (S k) a\n\n%name Vect xs, ys, zs\n\nzipWith : (a -> b -> c) -> Vect n a -> Vect n b -> Vect n c\n", "meta": {"hexsha": "39c3860281816dd73f5ca44c1c52e5356166915f", "size": 183, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "examples/type-driven-development/idris/vectors.idr", "max_stars_repo_name": "bemayr/talk.developer-confidence", "max_stars_repo_head_hexsha": "af300fb7c1ea695020fcd0ddece5ec2a34b471b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-02-12T09:28:28.000Z", "max_stars_repo_stars_event_max_datetime": "2019-02-12T09:28:28.000Z", "max_issues_repo_path": "examples/type-driven-development/idris/vectors.idr", "max_issues_repo_name": "bemayr/talk.developer-confidence", "max_issues_repo_head_hexsha": "af300fb7c1ea695020fcd0ddece5ec2a34b471b7", "max_issues_repo_licenses": ["MIT"], "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/type-driven-development/idris/vectors.idr", "max_forks_repo_name": "bemayr/talk.developer-confidence", "max_forks_repo_head_hexsha": "af300fb7c1ea695020fcd0ddece5ec2a34b471b7", "max_forks_repo_licenses": ["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.875, "max_line_length": 59, "alphanum_fraction": 0.4863387978, "num_tokens": 67, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8519527869325346, "lm_q2_score": 0.6297746074044134, "lm_q1q2_score": 0.5365382319175328}}
{"text": "module Set\n\nimport public Data.AVL.Set\n\nexport\nOrd a => Semigroup (Set a) where\n  (<+>) = union\n\nexport\nOrd a => Monoid (Set a) where\n  neutral = empty\n\n", "meta": {"hexsha": "4ceb18a8c993827a5d86fae600545de1a2397487", "size": 153, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Set.idr", "max_stars_repo_name": "gpyh/idris-graph", "max_stars_repo_head_hexsha": "c6ccb72cd839138cd2a5e0c0866b333f35635f06", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2017-01-29T03:30:17.000Z", "max_stars_repo_stars_event_max_datetime": "2017-01-29T03:30:17.000Z", "max_issues_repo_path": "src/Set.idr", "max_issues_repo_name": "gpyh/idris-graph", "max_issues_repo_head_hexsha": "c6ccb72cd839138cd2a5e0c0866b333f35635f06", "max_issues_repo_licenses": ["MIT"], "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/Set.idr", "max_forks_repo_name": "gpyh/idris-graph", "max_forks_repo_head_hexsha": "c6ccb72cd839138cd2a5e0c0866b333f35635f06", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 11.7692307692, "max_line_length": 32, "alphanum_fraction": 0.660130719, "num_tokens": 48, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7634837635542925, "lm_q2_score": 0.7025300449389326, "lm_q1q2_score": 0.5363702827199425}}
{"text": "\nmodule Determinism\n\n\n\nimport BigStep\nimport Progress\nimport Step\nimport Subst\nimport Term\nimport Equivalence\n\n\n%default total\n%access export\n\n\n------------------------------------------------------------------------------\n-- Begin: DETERMINISM OF INDUCTIVELY DEFINED SMALL-STEP AND BIG-STEP SEMANTICS\n\nstepDeterministic : (Step e1 e2) -> (Step e1 e3) ->\n                    e2 = e3\n-- case split in the following order: (Step e1 e2), (Step e1 e3)\nstepDeterministic {e1 = TApp _ e11} (StApp1 x) (StApp1 y) = \n  cong {f = \\e => TApp e e11} $ stepDeterministic x y\n--\nstepDeterministic (StApp1 x) (StApp2 y z) = absurd $ valueIrreducible _ y x\n--  \nstepDeterministic (StApp1 x) (StBeta y) = absurd $ valueIrreducible _ VAbs x\n--\nstepDeterministic (StApp2 x z) (StApp1 y) = absurd $ valueIrreducible _ x y\n--\nstepDeterministic {e1 = TApp e11 _} (StApp2 x z) (StApp2 y w) = \n  cong {f = \\e => TApp e11 e} $ stepDeterministic z w\n--  \nstepDeterministic (StApp2 x z) (StBeta y) = absurd $ valueIrreducible _ y z\n--\nstepDeterministic (StBeta x) (StApp2 y z) = absurd $ valueIrreducible _ x z\n--\nstepDeterministic (StBeta x) (StBeta y) = Refl\n--\nstepDeterministic (StFix x) (StFix y) = cong $ stepDeterministic x y\n--\nstepDeterministic (StFix x) StFixBeta = absurd $ valueIrreducible _ VAbs x\n--\nstepDeterministic StFixBeta StFixBeta = Refl\n--\nstepDeterministic (StSucc x) (StSucc y) = cong $ stepDeterministic x y\n--\nstepDeterministic (StPred x) (StPred y) = cong $ stepDeterministic x y\n--\nstepDeterministic (StPred x) StPredZero = absurd $ valueIrreducible _ VZero x\n--\nstepDeterministic (StPred x) (StPredSucc y) = absurd $ valueIrreducible _ (VSucc y) x\n--\nstepDeterministic StPredZero (StPred x) = absurd $ valueIrreducible _ VZero x\n--\nstepDeterministic StPredZero StPredZero = Refl\n--\nstepDeterministic (StPredSucc x) (StPred y) = absurd $ valueIrreducible _ (VSucc x) y\n--\nstepDeterministic (StPredSucc x) (StPredSucc y) = Refl\n--\nstepDeterministic {e1 = TIfz _ e12 e13} (StIfz x) (StIfz y) = \n  cong {f = \\e => TIfz e e12 e13} $ stepDeterministic x y\n--  \nstepDeterministic (StIfz x) StIfzZero = absurd $ valueIrreducible _ VZero x\n--\nstepDeterministic (StIfz x) (StIfzSucc y) = absurd $ valueIrreducible _ (VSucc y) x\n--\nstepDeterministic StIfzZero (StIfz x) = absurd $ valueIrreducible _ VZero x\n--\nstepDeterministic StIfzZero StIfzZero = Refl\n--\nstepDeterministic (StIfzSucc x) (StIfz y) = absurd $ valueIrreducible _ (VSucc x) y\n--\nstepDeterministic (StIfzSucc x) (StIfzSucc y) = Refl\n\n\n\ntransStepDeterministic : (v2 : Value e2) -> (TransStep e1 e2) ->\n                         (v3 : Value e3) -> (TransStep e1 e3) ->\n                         e2 = e3\ntransStepDeterministic v2 (TStRefl e3) v3 (TStRefl e3) = Refl\n--\ntransStepDeterministic v2 (TStRefl e2) v3 (TStTrans x y) = \n  absurd $ valueIrreducible e2 v2 x\n--\ntransStepDeterministic v2 (TStTrans x z) v3 (TStRefl e3) = \n  absurd $ valueIrreducible e3 v3 x\n--\ntransStepDeterministic {e2 = e2} v2 (TStTrans x z) v3 (TStTrans y w) =\n  let eq = stepDeterministic x y\n      z' = replace {P = \\x => x} (cong {f = \\e => TransStep e e2} eq) z\n  in transStepDeterministic v2 z' v3 w\n\n\n\n-- The following proof of the determinism of 'BigStep'\n-- relies on the equivalence of 'Step' and 'BigStep'.\nbigStepDeterministic' : (BigStep e1 e2) ->\n                        (BigStep e1 e3) ->\n                        e2 = e3\nbigStepDeterministic' x y = \n  let (tst2, v2) = bigStepToTransStep x\n      (tst3, v3) = bigStepToTransStep y\n  in transStepDeterministic v2 tst2 v3 tst3\n\n\n\ninjectiveAbs : (TAbs e1 = TAbs e2) -> e1 = e2\ninjectiveAbs Refl = Refl\n\n\ninjectiveSucc : (TSucc e1 = TSucc e2) -> e1 = e2\ninjectiveSucc Refl = Refl\n\n\nzeroNotSucc : (TZero = TSucc _) -> Void\nzeroNotSucc Refl impossible\n\n\npairEq : a = b -> c = d -> (a, c) = (b, d)\npairEq Refl Refl = Refl\n\n\nvalueBigStepEq : Value e1 -> BigStep e1 e2 -> e1 = e2\nvalueBigStepEq VZero (BStValue _)     = Refl\nvalueBigStepEq (VSucc x) (BStValue _) = Refl\nvalueBigStepEq (VSucc x) (BStSucc y)  = cong $ valueBigStepEq x y\nvalueBigStepEq VAbs (BStValue _)      = Refl\n\n\nbigStepDeterministic : (BigStep e1 e2) -> (BigStep e1 e3) ->\n                       e2 = e3\n-- case split in the following order: (BigStep e1 e2), (BigStep e1 e3)\nbigStepDeterministic (BStValue _) (BStValue _) = Refl\n--\nbigStepDeterministic (BStValue _) (BStApp z w t) impossible\n--\nbigStepDeterministic (BStValue _) (BStFix y z) impossible\n--\nbigStepDeterministic (BStValue v2) (BStSucc x) = case v2 of\n  VAbs      impossible\n  VZero     impossible\n  VSucc v2' => cong $ valueBigStepEq v2' x\n--  \nbigStepDeterministic (BStValue _) (BStPredZero y) impossible\n--\nbigStepDeterministic (BStValue _) (BStPredSucc x) impossible\n--\nbigStepDeterministic (BStValue _) (BStIfzZero z w) impossible\n--\nbigStepDeterministic (BStValue _) (BStIfzSucc w s) impossible\n--\nbigStepDeterministic (BStApp w t u) (BStValue _) impossible\n--\nbigStepDeterministic {e2 = e2} (BStApp w t u) (BStApp z s v) = \n  let ih1 = injectiveAbs $ bigStepDeterministic w z\n      ih2 = bigStepDeterministic t s\n      peq = pairEq ih1 ih2\n      u'  = replace {P = \\x => BigStep (subst (snd x) First (fst x)) e2} peq u\n  in bigStepDeterministic u' v\n--\nbigStepDeterministic (BStFix z w) (BStValue v3) impossible\n--\nbigStepDeterministic {e2 = e2} (BStFix z w) (BStFix y s) = \n  let ih = injectiveAbs $ bigStepDeterministic z y\n      w' = replace {P = \\x => BigStep (subst (TFix (TAbs x)) First x) e2} ih w\n  in bigStepDeterministic w' s\n--\nbigStepDeterministic (BStSucc x) (BStValue v3) = case v3 of\n  VAbs      impossible\n  VZero     impossible\n  VSucc v3' => cong . sym $ valueBigStepEq v3' x\n--\nbigStepDeterministic (BStSucc x) (BStSucc y) = cong $ bigStepDeterministic x y\n--\nbigStepDeterministic (BStPredZero z) (BStValue _) impossible\n--\nbigStepDeterministic (BStPredZero z) (BStPredZero y) = Refl\n--\nbigStepDeterministic (BStPredZero z) (BStPredSucc x) = \n  let ih = bigStepDeterministic z x\n  in absurd $ zeroNotSucc ih\n--\nbigStepDeterministic (BStPredSucc x) (BStValue _) impossible\n--\nbigStepDeterministic (BStPredSucc x) (BStPredZero z) = \n  let ih = bigStepDeterministic x z\n  in absurd . zeroNotSucc $ sym ih\n--\nbigStepDeterministic (BStPredSucc x) (BStPredSucc y) = \n  injectiveSucc $ bigStepDeterministic x y\n--\nbigStepDeterministic (BStIfzZero w s) (BStValue _) impossible\n--\nbigStepDeterministic (BStIfzZero w s) (BStIfzZero y z) = bigStepDeterministic s z\n--\nbigStepDeterministic (BStIfzZero w s) (BStIfzSucc z t) = \n  let ih = bigStepDeterministic w z\n  in absurd $ zeroNotSucc ih\n--\nbigStepDeterministic (BStIfzSucc s t) (BStValue _) impossible\n--\nbigStepDeterministic (BStIfzSucc s t) (BStIfzZero y z) = \n  let ih = bigStepDeterministic s y\n  in absurd . zeroNotSucc $ sym ih\n--\nbigStepDeterministic (BStIfzSucc s t) (BStIfzSucc z w) = bigStepDeterministic t w\n\n-- End: DETERMINISM OF INDUCTIVELY DEFINED SMALL-STEP AND BIG-STEP SEMANTICS\n----------------------------------------------------------------------------\n\n\n\n----------------------------------------------------------------------------------\n-- Begin: VERY RESTRICTED FROM OF DETERMINISM FOR CO-INDUCTIVELY DEFINED SEMANTICS\n\n-- The coinductive relation 'CoBigStep' is not deterministic as, for example,\n-- the term 'omega' can evaluate to anything. However, the following form of\n-- determinism holds for terminating terms:\n-- (cf. Lemma 35 in \"Coinductive big-step operational semantics\" by \n-- X. Leroy and H. Grall)\ncoBigStepDeterministic' : BigStep e1 e2 -> CoBigStep e1 e3 -> e2 = e3\n--\ncoBigStepDeterministic' (BStValue v) cbst = coBigStepValueIrreducible cbst v\n--\ncoBigStepDeterministic' (BStApp bst1 bst2 bst3) cbst = case cbst of\n  (CoBStValue v)               impossible\n  (CoBStApp cbst1 cbst2 cbst3) =>\n    case coBigStepDeterministic' bst1 cbst1 of\n         Refl => case coBigStepDeterministic' bst2 cbst2 of\n                      Refl => case coBigStepDeterministic' bst3 cbst3 of\n                                   Refl => Refl\n--\ncoBigStepDeterministic' (BStFix bst1 bst2) cbst = case cbst of\n  (CoBStValue v)         impossible\n  (CoBStFix cbst1 cbst2) => \n    case coBigStepDeterministic' bst1 cbst1 of\n         Refl => case coBigStepDeterministic' bst2 cbst2 of\n                      Refl => Refl\n--\ncoBigStepDeterministic' (BStSucc bst) cbst = case cbst of\n  (CoBStValue (VSucc v)) => cong . sym $ bigStepValueIrreducible bst v\n  (CoBStSucc cbst)       => case coBigStepDeterministic' bst cbst of\n                                 Refl => Refl\n--\ncoBigStepDeterministic' (BStPredZero bst) cbst = case cbst of \n  (CoBStValue v)       impossible\n  (CoBStPredZero cbst) => case coBigStepDeterministic' bst cbst of\n                               Refl => Refl\n  (CoBStPredSucc cbst) => case coBigStepDeterministic' bst cbst of\n                               Refl impossible\n--\ncoBigStepDeterministic' (BStPredSucc bst) cbst = case cbst of\n  (CoBStValue v)       impossible\n  (CoBStPredZero cbst) => case coBigStepDeterministic' bst cbst of\n                               Refl impossible\n  (CoBStPredSucc cbst) => case coBigStepDeterministic' bst cbst of\n                               Refl => Refl\n--\ncoBigStepDeterministic' (BStIfzZero bst1 bst2) cbst = case cbst of\n  (CoBStValue v)             impossible\n  (CoBStIfzZero cbst1 cbst2) => coBigStepDeterministic' bst2 cbst2\n  (CoBStIfzSucc cbst1 cbst2) => case coBigStepDeterministic' bst1 cbst1 of\n                                     Refl impossible\n--\ncoBigStepDeterministic' (BStIfzSucc bst1 bst2) cbst = case cbst of\n  (CoBStValue v)             impossible\n  (CoBStIfzZero cbst1 cbst2) => case coBigStepDeterministic' bst1 cbst1 of\n                                     Refl impossible\n  (CoBStIfzSucc cbst1 cbst2) => coBigStepDeterministic' bst2 cbst2\n\n\n-- An analogous statement holds for terminating terms and the coinductive \n-- relation 'CoTransStep', which is generally not deterministic either:\ncoTransStepDeterministic' : Value e2 -> TransStep e1 e2 -> \n                            Value e3 -> CoTransStep e1 e3 -> \n                            e2 = e3\ncoTransStepDeterministic' v2 (TStRefl e1)       v3 (CoTStRefl e1)    = Refl\ncoTransStepDeterministic' v2 (TStRefl e1)       v3 (CoTStTrans st _) = \n  absurd $ valueIrreducible _ v2 st\ncoTransStepDeterministic' v2 (TStTrans st tst)  v3 (CoTStRefl e1)    = \n  absurd $ valueIrreducible _ v3 st\ncoTransStepDeterministic' v2 (TStTrans st1 tst) v3 (CoTStTrans st2 ctst) =\n  case stepDeterministic st1 st2 of\n       Refl => coTransStepDeterministic' v2 tst v3 ctst\n\n\n-- The following statement can also be seen as a restricted\n-- from of determinism of the 'CoTransStep' relation given\n-- that 'TransStep' terminates:\ncoTransStepExtends : TransStep e1 e2 -> Value e2 -> \n                     CoTransStep e1 e3 -> CoTransStep e3 e2\ncoTransStepExtends (TStRefl e2)       v (CoTStRefl e2)       = CoTStRefl e2\ncoTransStepExtends (TStRefl e2)       v (CoTStTrans st ctst) = \n  absurd $ valueIrreducible _ v st\ncoTransStepExtends (TStTrans st tst)  v (CoTStRefl e1)   =\n  CoTStTrans st $ transToCoTrans tst\ncoTransStepExtends (TStTrans st1 tst) v (CoTStTrans st2 ctst) = \n  case stepDeterministic st1 st2 of\n       Refl => coTransStepExtends tst v ctst\n\n\ncoTransStepExtends' : TransStep e1 e2 -> Value e2 -> \n                      CoTransStep e1 e3 -> CoTransStep e1 e2\ncoTransStepExtends' tst v ctst = coTransStepTransitive ctst $ coTransStepExtends tst v ctst\n\n\n-- Another result that relies on \n--   (a) irreducibility of values and\n--   (b) determinism of the 'Step' relation:\ncoTransStepInterpolates : CoTransStep e1 e3 -> Value e3 -> Step e1 e2 -> CoTransStep e2 e3\ncoTransStepInterpolates (CoTStRefl e1)        v st = absurd $ valueIrreducible _ v st\ncoTransStepInterpolates (CoTStTrans st' ctst) v st = \n  let eq = stepDeterministic st st'\n  in rewrite eq in ctst\n\n-- End: VERY RESTRICTED FROM OF DETERMINISM FOR CO-INDUCTIVELY DEFINED SEMANTICS\n--------------------------------------------------------------------------------\n\n\n\n-----------------------------------------------------------\n-- Begin: DIVERGENCE OF TERM 'Subst.omega' UNDER SMALL-STEP\n\n-- Term 'omega' steps to itself in one step:\nstepOmega : Step Subst.omega Subst.omega\nstepOmega = StFixBeta\n\n\n-- That 'omega' steps to itself under the reflexive,\n-- transitive closure of 'Step' is trivial:\ntransStepOmega : TransStep Subst.omega Subst.omega\ntransStepOmega = TStRefl _\n\n\n-- By determinism of 'Step', the term 'omega' steps to nothing but itself:\nstepOmegaOnly : Step Subst.omega e -> e = Subst.omega            \nstepOmegaOnly st = stepDeterministic st stepOmega\n\n\n-- To extend the previous result 'stepOmegaOnly' to the transitive closure\n-- of the 'Step' relation, an indexed version of 'TransStep' is needed:\ndata TransStepN : Nat -> Term [] t -> Term [] t -> Type where\n   TStNRefl   : (e : Term [] t) -> TransStepN Z e e\n   TStNTrans  : {e : Term [] t} -> {e' : Term [] t} -> {e'' : Term [] t} ->\n                Step e e' -> TransStepN n e' e'' -> TransStepN (S n) e e''\n\n\ntransStepFromN : TransStepN n e1 e2 -> TransStep e1 e2\ntransStepFromN (TStNRefl e1)       = TStRefl e1\ntransStepFromN (TStNTrans st tstn) = TStTrans st (transStepFromN tstn)\n\n\ntransStepToN : TransStep e1 e2 -> (n : Nat ** TransStepN n e1 e2)\ntransStepToN (TStRefl e1)      = (Z ** TStNRefl e1)\ntransStepToN (TStTrans st tst) = let (m ** tstn) = transStepToN tst\n                                 in ((S m) ** TStNTrans st tstn)\n\n\ntransStepNOmegaOnly : (n : Nat) -> TransStepN n Subst.omega e -> e = Subst.omega\ntransStepNOmegaOnly     Z     (TStNRefl _)        = Refl\ntransStepNOmegaOnly {e} (S k) (TStNTrans st tstk) = \n  let eq    = stepOmegaOnly st \n      tstk' = replace {P = \\x => TransStepN k x e} eq tstk\n  in transStepNOmegaOnly k tstk'\n\n\n-- Finally, the fact that 'omega' only steps to itself is proven\n-- by appealing to the indexed version of the transitive closure:\n-- (An induction argument analogous to the one in 'transStepNOmegaOnly'\n-- is not accepted by Idris' totality checker. Induction would proceed on\n-- the structure of the 'TransStep omega e' argument, and the induction\n-- hypothesis would be applied to the second argument of the 'TStTrans'\n-- constructor, which would again have the type 'TransStep omega e' but\n-- only after rewriting with the equation obtained from 'stepOmegaOnly'.)\ntransStepOmegaOnly : TransStep Subst.omega e -> e = Subst.omega\ntransStepOmegaOnly tst = let (n ** tstn) = transStepToN tst\n                         in transStepNOmegaOnly n tstn\n\n\ntransStepDivergenceOmega : TransStep Subst.omega e -> (Value e -> Void)\ntransStepDivergenceOmega tst v = let eq = transStepOmegaOnly tst\n                                 in case (replace {P = \\x => Value x} eq v) of\n                                          VZero     impossible\n                                          (VSucc _) impossible\n                                          VAbs      impossible\n\n\n-- Instead of diverging, the term 'omega' can evaluate to anything\n-- under the coinductive relation 'CoTransStep'. Hence evaluation\n-- under 'CoTransStep' is not deterministic:\ncoTransStepOmegaAny : CoTransStep Subst.omega e\ncoTransStepOmegaAny = CoTStTrans StFixBeta (coTransStepOmegaAny)\n\n-- End: DIVERGENCE OF TERM 'Subst.omega' UNDER SMALL-STEP\n---------------------------------------------------------\n\n\n\n---------------------------------------------------------\n-- Begin: DIVERGENCE OF TERM 'Subst.omega' UNDER BIG-STEP\n\n-- The following straightforward approach to proving\n-- that 'omega' diverges does not pass Idris' totality\n-- checker because of the rewriting of 'bst' in the\n-- induction step:\n--\n-- divergenceOmega : BigStep Subst.omega e -> Void\n-- divergenceOmega {e = _} (BStValue v) = case v of\n--                                             VZero     impossible\n--                                             (VSucc _) impossible\n--                                             VAbs      impossible\n-- divergenceOmega {e = e} (BStFix (BStValue v) bst) =\n--   let bst' = replace {P = \\x => BigStep x e} substOmega bst\n--   in divergenceOmega bst'\n\n\n-- To prove that 'omega' diverges under big-step semantics,\n-- an indexed version of the 'BigStep' relation is introduced:\ndata BigStepN : Nat -> Term [] t -> (y: Term [] t) -> Type where\n  BStValueN    : (v : Value e) -> BigStepN Z e e\n  --\n  BStAppN      : BigStepN k e1 (TAbs e1') ->\n                 BigStepN m e2 e2' ->\n                 BigStepN n (subst e2' First e1') e ->\n                 BigStepN (S $ k+m+n) (TApp e1 e2) e\n  --              \n  BStFixN      : BigStepN m e (TAbs e') ->\n                 BigStepN n (subst (TFix (TAbs e')) First e') e'' ->\n                 BigStepN (S $ m+n) (TFix e) e''\n  --           \n  BStSuccN     : BigStepN n e e' ->\n                 BigStepN (S n) (TSucc e) (TSucc e')\n  --            \n  BStPredZeroN : BigStepN n e TZero ->\n                 BigStepN (S n) (TPred e) TZero\n  --                \n  BStPredSuccN : BigStepN n e (TSucc e') ->\n                 BigStepN (S n) (TPred e) e'\n  --                \n  BStIfzZeroN  : BigStepN m e1 TZero ->\n                 BigStepN n e2 e ->\n                 BigStepN (S $ m+n) (TIfz e1 e2 _) e\n  --              \n  BStIfzSuccN  : BigStepN m e1 (TSucc _) ->\n                 BigStepN n e3 e ->\n                 BigStepN (S $ m+n) (TIfz e1 _ e3) e\n\n\nbigStepToN : BigStep e1 e2 -> (n : Nat ** BigStepN n e1 e2)\nbigStepToN (BStValue v) = (Z ** BStValueN v)\n--\nbigStepToN (BStApp bst1 bst2 bst3) = let (n1 ** bstn1) = bigStepToN bst1\n                                         (n2 ** bstn2) = bigStepToN bst2\n                                         (n3 ** bstn3) = bigStepToN bst3\n                                     in ((S $ n1+n2+n3) ** BStAppN bstn1 bstn2 bstn3)\n--                                     \nbigStepToN (BStFix bst1 bst2) = let (n1 ** bstn1) = bigStepToN bst1\n                                    (n2 ** bstn2) = bigStepToN bst2\n                                in ((S $ n1+n2) ** BStFixN bstn1 bstn2) \n--                            \nbigStepToN (BStSucc bst) = let (n ** bstn) = bigStepToN bst\n                           in ((S n) ** BStSuccN bstn)\n--                            \nbigStepToN (BStPredZero bst) = let (n ** bstn) = bigStepToN bst\n                               in ((S n) ** BStPredZeroN bstn)\n--                               \nbigStepToN (BStPredSucc bst) = let (n ** bstn) = bigStepToN bst\n                               in ((S n) ** BStPredSuccN bstn)\n--\nbigStepToN (BStIfzZero bst1 bst2) = let (n1 ** bstn1) = bigStepToN bst1\n                                        (n2 ** bstn2) = bigStepToN bst2\n                                    in ((S $ n1+n2) ** BStIfzZeroN bstn1 bstn2) \n--                            \nbigStepToN (BStIfzSucc bst1 bst2) = let (n1 ** bstn1) = bigStepToN bst1\n                                        (n2 ** bstn2) = bigStepToN bst2\n                                    in ((S $ n1+n2) ** BStIfzSuccN bstn1 bstn2) \n\n\nbigStepFromN : BigStepN n e1 e2 -> BigStep e1 e2\nbigStepFromN (BStValueN v) = BStValue v\n--\nbigStepFromN (BStAppN bstn1 bstn2 bstn3) = let bst1 = bigStepFromN bstn1\n                                               bst2 = bigStepFromN bstn2\n                                               bst3 = bigStepFromN bstn3\n                                           in BStApp bst1 bst2 bst3\n--                                     \nbigStepFromN (BStFixN bstn1 bstn2) = let bst1 = bigStepFromN bstn1\n                                         bst2 = bigStepFromN bstn2\n                                     in BStFix bst1 bst2\n--                                     \nbigStepFromN (BStSuccN bstn) = let bst = bigStepFromN bstn\n                               in BStSucc bst\n--\nbigStepFromN (BStPredZeroN bstn) = let bst = bigStepFromN bstn\n                                   in BStPredZero bst\n--\nbigStepFromN (BStPredSuccN bstn) = let bst = bigStepFromN bstn\n                                   in BStPredSucc bst\n--\nbigStepFromN (BStIfzZeroN bstn1 bstn2) = let bst1 = bigStepFromN bstn1\n                                             bst2 = bigStepFromN bstn2\n                                         in BStIfzZero bst1 bst2\n--\nbigStepFromN (BStIfzSuccN bstn1 bstn2) = let bst1 = bigStepFromN bstn1\n                                             bst2 = bigStepFromN bstn2\n                                         in BStIfzSucc bst1 bst2\n\n\n-- Divergence of 'omega' under the indexed version of big-step semantics:\nbigStepDivergenceOmega' : (n : Nat) -> BigStepN n Subst.omega e -> Void\nbigStepDivergenceOmega' Z (BStValueN v) = case v of\n                                               VZero     impossible\n                                               (VSucc _) impossible\n                                               VAbs      impossible\nbigStepDivergenceOmega' {e} (S n) bstn = case bstn of\n  (BStFixN (BStValueN v) bstn2) => let bstn2' = replace {P = \\x => BigStepN n x e}\n                                                        substOmega bstn2\n                                   in bigStepDivergenceOmega' n bstn2'\n\n\nbigStepDivergenceOmega : BigStep Subst.omega e -> Void\nbigStepDivergenceOmega bst = let (n ** bstn) = bigStepToN bst\n                             in bigStepDivergenceOmega' n bstn\n\n\n-- Instead of diverging, the term 'omega' can evaluate to anything\n-- under the coinductive relation 'CoBigStep'. Hence, evaluation\n-- under 'CoBigStep' is non-deterministic:\ncoBigStepOmegaAny : CoBigStep Subst.omega e\ncoBigStepOmegaAny = CoBStFix (CoBStValue VAbs) Determinism.coBigStepOmegaAny \n\n-- End: DIVERGENCE OF TERM 'Subst.omega' UNDER BIG-STEP\n-------------------------------------------------------\n", "meta": {"hexsha": "c515cf9781609f72da07b451d03c20a2b0a67420", "size": 21589, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "codata/src/Determinism.idr", "max_stars_repo_name": "normanrink/PCF", "max_stars_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "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": "codata/src/Determinism.idr", "max_issues_repo_name": "normanrink/PCF", "max_issues_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "codata/src/Determinism.idr", "max_forks_repo_name": "normanrink/PCF", "max_forks_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_forks_repo_licenses": ["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.1282527881, "max_line_length": 91, "alphanum_fraction": 0.6102644865, "num_tokens": 6632, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7853085708384736, "lm_q2_score": 0.6825737408694988, "lm_q1q2_score": 0.5360310089340967}}
{"text": "import public Lightyear\nimport public Lightyear.Char\nimport public Lightyear.Strings\n\ndata Expression\n  = Numeral Integer\n  | Plus Expression Expression\n  | Minus Expression Expression\n  | Times Expression Expression\n  | Divide Expression Expression\n  | Negate Expression\n\nE : Type\nE = Expression\n\nmutual\n  Show Expression where\n    show (Numeral n) = \"(Numeral \" ++ (show n) ++ \")\"\n    show (Plus l r) = _show \"Plus\" l r\n    show (Minus l r) = _show \"Minus\" l r\n    show (Times l r) = _show \"Times\" l r\n    show (Divide l r) = _show \"Divide\" l r\n    show (Negate e) = \"(Negate \" ++ (show e) ++ \")\"\n\n  _show : String -> Expression -> Expression -> String\n  _show x l r = \"(\" ++ x ++ \" \" ++ (show l) ++ \" \" ++ (show r) ++ \")\"\n\nnumeral : Parser Expression\nnumeral = do i <- integer\n             pure (Numeral i)\n\nminus : Parser ()\nminus = token \"-\"\n\nlparen : Parser ()\nlparen = token (\"(\")\n\nrparen : Parser ()\nrparen = token (\")\")\n\ninfixOp : Parser () -> (E -> E -> E) -> Parser (E -> E -> E)\ninfixOp l ctor = do\n  _ <- l\n  pure ctor\n\naddOp : Parser (Expression -> Expression -> Expression)\naddOp = infixOp (token \"+\") Plus <|> infixOp (token \"-\") Minus\n\nmulOp : Parser (Expression -> Expression -> Expression)\nmulOp = infixOp (token \"*\") Times <|> infixOp (token \"/\") Times\n\nmutual\n  expression : Parser Expression\n  expression = chainl1 term addOp\n\n  term : Parser Expression\n  term = chainl1 factor mulOp\n\n  negate : Parser Expression\n  negate = do\n    _ <- minus\n    f <- factor\n    pure $ Negate f\n\n  subExp : Parser Expression\n  subExp = do\n    _ <- lparen\n    expr <- expression\n    _ <- rparen\n    pure expr\n\n  factor : Parser Expression\n  factor = spaces *>\n           (numeral\n           <|> subExp\n           <|> negate) <* spaces\n", "meta": {"hexsha": "f13e555acc3512a1d463527496b364e9ad15c843", "size": 1740, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "calculator/calc.idr", "max_stars_repo_name": "alexhumphreys/pl-playground", "max_stars_repo_head_hexsha": "da90cc3527e0ff3a7effd1f5dde5437b47ac1170", "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": "calculator/calc.idr", "max_issues_repo_name": "alexhumphreys/pl-playground", "max_issues_repo_head_hexsha": "da90cc3527e0ff3a7effd1f5dde5437b47ac1170", "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": "calculator/calc.idr", "max_forks_repo_name": "alexhumphreys/pl-playground", "max_forks_repo_head_hexsha": "da90cc3527e0ff3a7effd1f5dde5437b47ac1170", "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": 22.5974025974, "max_line_length": 69, "alphanum_fraction": 0.6086206897, "num_tokens": 504, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.793105951184112, "lm_q2_score": 0.6757646010190476, "lm_q1q2_score": 0.5359529266677636}}
{"text": "module NanoParsec.Parser\n\nimport NanoParsec.MonadPlus\n\n%access export\n\nrecord Parser a where\n    constructor MkParser\n    parse : String -> List (a, String)\n\nrunParser : Parser a -> String -> Maybe a\nrunParser p st =\n    case parse p st of\n        [(res, \"\")]  => Just res\n        [(_, remSt)] => Nothing\n        _            => Nothing\n\nitem : Parser Char\nitem = MkParser $ \\st =>\n    case st of\n        \"\" => []\n        _  => [(strHead st, strTail st)]\n\nimplementation Functor Parser where\n    map f (MkParser cs) = MkParser (\\st => [(f a, b) | (a, b) <- cs st])\n\nimplementation Applicative Parser where\n    pure a = MkParser (\\st => [(a, st)])\n    (MkParser cs1) <*> (MkParser cs2) =\n        MkParser (\\st => [(f a, st2) | (f, st1) <- cs1 st, (a, st2) <- cs2 st1])\n\nimplementation Monad Parser where\n    p >>= f = MkParser $ \\st => concatMap (\\(a, st') => parse (f a) st') $ parse p st\n\ncombine : Parser a -> Parser a -> Parser a\ncombine p1 p2 = MkParser (\\st => parse p1 st ++ parse p2 st)\n\nfailure : Parser a\nfailure = MkParser (\\cs => [])\n\noption : Parser a -> Parser a -> Parser a\noption p1 p2 = MkParser $ \\st =>\n    case parse p1 st of\n        []  => parse p2 st\n        res => res\n\nsatisfy : (Char -> Bool) -> Parser Char\nsatisfy pred = item >>= \\ch => if (pred ch) then (return ch) else failure\n\nimplementation MonadPlus Parser where\n    mzero = failure\n    mplus = option\n\nimplementation Alternative Parser where\n    empty = failure\n    (<|>) = option\n\n||| Extract at least one success.\nsome : (Alternative f, Applicative f) => f a -> f (List a)\nsome v = some_v\n    where\n        mutual\n            some_v : f (List a)\n            some_v = (map (::) v) <*> many_v\n\n            many_v : f (List a)\n            many_v = some_v <|> pure []\n\n\n||| Extracts 0 or more successes.\nmany : (Alternative f, Applicative f) => f a -> f (List a)\nmany v = many_v\n    where\n        mutual\n            many_v : f (List a)\n            many_v = some_v <|> pure []\n\n            some_v : f (List a)\n            some_v = (map (::) v) <*> many_v\n\nsepBy1 : Parser a -> Parser sep -> Parser (List a)\nsepBy1 p sep = do\n    first     <- p\n    remainder <- many (sep >>= \\_ => p)\n    return (first :: remainder)\n\nsepBy : Parser a -> Parser sep -> Parser (list a)\nsepBy p sep = (p `sepBy1` sep) <|> pure List.Nil\n", "meta": {"hexsha": "2a13d4c38b380f9a3524a0eb2de38b9784ab45ca", "size": 2296, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "NanoParsec/Parser.idr", "max_stars_repo_name": "stallmanifold/idris-nanoparsec", "max_stars_repo_head_hexsha": "adf74d4ad4f1e8df918f3616b1cc8ee89db1c315", "max_stars_repo_licenses": ["Apache-2.0", "MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2016-11-21T13:36:37.000Z", "max_stars_repo_stars_event_max_datetime": "2017-02-21T05:56:30.000Z", "max_issues_repo_path": "NanoParsec/Parser.idr", "max_issues_repo_name": "lambdaxymox/idris-nanoparsec", "max_issues_repo_head_hexsha": "adf74d4ad4f1e8df918f3616b1cc8ee89db1c315", "max_issues_repo_licenses": ["Apache-2.0", "MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "NanoParsec/Parser.idr", "max_forks_repo_name": "lambdaxymox/idris-nanoparsec", "max_forks_repo_head_hexsha": "adf74d4ad4f1e8df918f3616b1cc8ee89db1c315", "max_forks_repo_licenses": ["Apache-2.0", "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.797752809, "max_line_length": 85, "alphanum_fraction": 0.5618466899, "num_tokens": 676, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7490872131147275, "lm_q2_score": 0.7154239897159438, "lm_q1q2_score": 0.5359149626517358}}
{"text": "module Data.Time.Clock.DiffTime\n\nimport Data.So\nimport Data.Fixed\n\nimport Generics.Derive\n\n%default total\n%language ElabReflection\n\n-- --------------------------------------------------------------------------\n\npublic export\nrecord DiffTime' (nominal:Bool) where\n  constructor SecondsToDiffTime\n  seconds : Fixed 12\n%runElab derive \"DiffTime'\" [Generic, Eq, Ord, DecEq]\n\npublic export DiffTime : Type\nDiffTime = DiffTime' False\n\npublic export NominalDiffTime : Type\nNominalDiffTime = DiffTime' True\n\n\n--public export Eq (DiffTime' b) where x == y = x.seconds == y.seconds\n--public export Ord (DiffTime' b) where compare x y = compare x.seconds y.seconds\npublic export\nNum (DiffTime' b) where\n  x + y = SecondsToDiffTime $ x.seconds + y.seconds\n  x * y = SecondsToDiffTime $ x.seconds * y.seconds\n  fromInteger x = SecondsToDiffTime $ fromInteger x\npublic export\nNeg (DiffTime' b) where\n  negate x = { seconds $= negate } x\n  x - y = SecondsToDiffTime $ x.seconds - y.seconds\n\npublic export Show (DiffTime' b) where show x = show x.seconds ++ \"s\"\n\n\n-- --------------------------------------------------------------------------\n\nexport %inline picosecondsToDiffTime : {nominal:Bool} -> Integer -> DiffTime' nominal\npicosecondsToDiffTime x = SecondsToDiffTime $ MkFixed x\n\nexport %inline secondsToDiffTime : {nominal:Bool} -> Fixed 12 -> DiffTime' nominal\nsecondsToDiffTime x = SecondsToDiffTime x\n\nexport %inline diffTimeToPicoseconds : {nominal:Bool} -> DiffTime' nominal -> Integer\ndiffTimeToPicoseconds x = let MkFixed x' = x.seconds in x'\n\nexport %inline nominalDay : NominalDiffTime\nnominalDay = 86400\n\n\nexport %inline scale : Integer -> DiffTime' b -> DiffTime' b\nscale n dt = SecondsToDiffTime $ scale n dt.seconds\n\nexport %inline daysToDiffTime : Integer -> NominalDiffTime\ndaysToDiffTime n = scale n nominalDay\n\n\n-- --------------------------------------------------------------------------\n-- vim: tw=80 sw=2 expandtab :", "meta": {"hexsha": "e3c636714cf0e12f3f5bbc7e78f384b7e46c6a69", "size": 1928, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "time-calendar-clock/src/Data/Time/Clock/DiffTime.idr", "max_stars_repo_name": "seagull-kamome/idris2-missing", "max_stars_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "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": "time-calendar-clock/src/Data/Time/Clock/DiffTime.idr", "max_issues_repo_name": "seagull-kamome/idris2-missing", "max_issues_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-02-03T11:05:02.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-01T12:42:01.000Z", "max_forks_repo_path": "time-calendar-clock/src/Data/Time/Clock/DiffTime.idr", "max_forks_repo_name": "seagull-kamome/idris2-missing", "max_forks_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_forks_repo_licenses": ["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.125, "max_line_length": 85, "alphanum_fraction": 0.6566390041, "num_tokens": 486, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8006920116079208, "lm_q2_score": 0.6688802669716107, "lm_q1q2_score": 0.5355670864863421}}
{"text": "module FirUnsigned\n\nimport Bits\nimport Bounded\nimport Synchronous\nimport Unsigned\n\nimport Data.Vect\nimport Data.Bits\n\n%access export\n%default total\n\n-- The Vect implementation of Foldable breaks a proof here...\n-- Let's redefine sum for now without using fold\n%hide sum\nsum :  Num a => Vect n a -> a\nsum [] = 0\nsum (x::xs) = x + sum xs\n\n-- Proof of distributative property for `Bounded`'s ranges.\n-- Required for the readability (for the IEEE reader!) of the type of `dotProd`\ndotProdDistrib : (n, w, j : Nat) -> (ws : Vect j Nat)\n              -> Bounded (n * (w + sum ws)) = Bounded (n * w + n * sum ws)\ndotProdDistrib n w j ws = rewrite multDistributesOverPlusRight n w (sum ws) in Refl\n\n||| Combinatorial dot product over `Bounded`s\ndotProd : (ws : Vect j Nat)\n       -> Vect j (Bounded n)\n       -> Bounded (n * sum ws)\ndotProd {j=Z} _ _ = zeros\ndotProd {j=S l} {n} (w :: ws) (x :: xs) =\n  let y = add (mulConst x w) (dotProd ws xs)\n  in rewrite dotProdDistrib n w l ws in y\n\n||| Synchronous FIR over `Bounded`s\nfir : (ws : Vect j Nat)\n   -> Stream (Bounded n)\n   -> Stream (Bounded (n * sum ws))\nfir {j} ws x = liftA (dotProd ws) (window j zeros x)\n\n||| A wrapper for `fir` using `Unsigned`s`, more familiar to most IEEE readers\nfirU : (ws : Vect j Nat) -> Stream (Unsigned n)\n    -> Stream (Unsigned (maxToBits $ (bitsToMax n) * (sum ws)))\nfirU ws = map toUnsigned . fir ws . map fromUnsigned\n\n||| Example of simulating `firU`\nmain : IO ()\nmain = do let dut = firU [1,3,2]\n          let inp = map (saturate {n=4}) $ counterFrom 0\n          let out = take 5 $ simulate dut inp\n          putStrLn $ show out\n\n-- Local Variables:\n-- idris-load-packages: (\"contrib\")\n-- End:\n", "meta": {"hexsha": "c1b784820074bcf3d9346eef8c65289d8c490b7c", "size": 1678, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/FirUnsigned.idr", "max_stars_repo_name": "cramsay/idris_dsp_circuits", "max_stars_repo_head_hexsha": "d706aec31874ab57b24dd63e37076d3774922b3f", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-06-03T15:50:57.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-03T15:50:57.000Z", "max_issues_repo_path": "src/FirUnsigned.idr", "max_issues_repo_name": "cramsay/idris_dsp_circuits", "max_issues_repo_head_hexsha": "d706aec31874ab57b24dd63e37076d3774922b3f", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-06-03T16:46:47.000Z", "max_issues_repo_issues_event_max_datetime": "2020-06-03T16:46:47.000Z", "max_forks_repo_path": "src/FirUnsigned.idr", "max_forks_repo_name": "cramsay/idris_dsp_circuits", "max_forks_repo_head_hexsha": "d706aec31874ab57b24dd63e37076d3774922b3f", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-06-03T16:00:33.000Z", "max_forks_repo_forks_event_max_datetime": "2020-06-03T16:00:33.000Z", "avg_line_length": 29.4385964912, "max_line_length": 83, "alphanum_fraction": 0.6400476758, "num_tokens": 524, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891392358014, "lm_q2_score": 0.6513548646660542, "lm_q1q2_score": 0.535536895516835}}
{"text": "module Main\n\nimport Parity\nimport System\n\ndata Bit : Nat -> Type where\n     b0 : Bit 0\n     b1 : Bit 1\n\ninstance Show (Bit n) where\n     show b0 = \"0\"\n     show b1 = \"1\"\n\ninfixl 5 #\n\ndata Binary : (width : Nat) -> (value : Nat) -> Type where\n     zero : Binary Z Z\n     (#)  : Binary w v -> Bit bit -> Binary (S w) (bit + 2 * v)\n\ninstance Show (Binary w k) where\n     show zero = \"\"\n     show (bin # bit) = show bin ++ show bit\n\naddBit : Bit x -> Bit y -> Bit c -> Binary 2 (c + x + y)\n\nadc : Binary w x -> Binary w y -> Bit c -> Binary (S w) (x + c + y) \n\n\n\n\n\n\n\n\n\n\n\n\n\n-- adc zero zero carry ?= zero # carry  \n-- adc (numx # bx) (numy # by) carry\n--      = let (zero # carry0 # lsb) = addBit bx by carry in \n--            ?adcBody\n\n\n\n\n\n\n\n\n\n\n\n{-\naddBit b0 b0 b0 = zero # b0 # b0 \naddBit b0 b0 b1 = zero # b0 #\u00a0b1\naddBit b0 b1 b0 = zero # b0 # b1\naddBit b0 b1 b1 = zero # b1 #\u00a0b0\naddBit b1 b0 b0 = zero # b0 #\u00a0b1\naddBit b1 b0 b1 = zero #\u00a0b1 # b0\naddBit b1 b1 b0 = zero # b1 # b0\naddBit b1 b1 b1 = zero # b1 # b1\n-}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n{-\nadc zero zero carry = zero # carry\nadc (numx # bx) (numy # by) carry\n     = let (zero # carry0 # lsb) = addBit bx by carry in \n           ?adcBody\n-}\n\n\n", "meta": {"hexsha": "11204c94476a2447989d0e8b41d56ae015591212", "size": 1182, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Binary/binary-v1.idr", "max_stars_repo_name": "silky/idris-demos", "max_stars_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-06-27T11:33:51.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-27T11:33:51.000Z", "max_issues_repo_path": "Binary/binary-v1.idr", "max_issues_repo_name": "silky/idris-demos", "max_issues_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "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": "Binary/binary-v1.idr", "max_forks_repo_name": "silky/idris-demos", "max_forks_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "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": 13.5862068966, "max_line_length": 68, "alphanum_fraction": 0.5329949239, "num_tokens": 444, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972549785201, "lm_q2_score": 0.6150878555160665, "lm_q1q2_score": 0.5354937985829121}}
{"text": "module Control.Monad.Ideal.Free\n\nimport Control.Monad.Ideal\n\n%access public\n%default total\n\n\nFree : (Type -> Type) -> (Type -> Type) -- \u5927\u6587\u5b57\u3067\u59cb\u307e\u308b\u30b7\u30f3\u30dc\u30eb\u306f\u524d\u65b9\u53c2\u7167\u89e3\u6c7a\u3057\u3066\u304f\u308c\u306a\u3044\u3063\u307d\u3044\uff1f\n\ndata Liberty : (Type -> Type) -> Type -> Type where\n  ToLiberty : {f : Type -> Type} -> {a : Type} -> (f (Free f a)) -> Liberty f a\n\nFree f = Ideal $ Liberty f\n\nfree : Functor f => f (Free f a) -> Free f a\nfree f = I $ ToLiberty f\n\ninstance Functor f => Functor (Liberty f) where\n  map g (ToLiberty fa) = ToLiberty $ map (?gg) fa\n\ninstance Functor f => Mu' (Liberty f) where\n  mu' (ToLiberty fa) = ToLiberty $ map (?ff) fa\n\n", "meta": {"hexsha": "3bba2920a4724660c60076517ecdffc0e1650797", "size": 590, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Control/Monad/Ideal/Free.idr", "max_stars_repo_name": "seagull-kamome/idris-toy", "max_stars_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-06-04T16:11:33.000Z", "max_stars_repo_stars_event_max_datetime": "2016-06-04T16:11:33.000Z", "max_issues_repo_path": "Control/Monad/Ideal/Free.idr", "max_issues_repo_name": "seagull-kamome/idris-toy", "max_issues_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "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": "Control/Monad/Ideal/Free.idr", "max_forks_repo_name": "seagull-kamome/idris-toy", "max_forks_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "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.6, "max_line_length": 79, "alphanum_fraction": 0.6406779661, "num_tokens": 210, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8311430478583168, "lm_q2_score": 0.6442251133170357, "lm_q1q2_score": 0.5354432241891905}}
{"text": "||| An expression language with mechanical proof of type-safety.\n|||\n||| `Recorded` is an expression language supporting Let-bindings, and\n||| Records i.e. Named Tuples.  Standard constructions are used to\n||| represent the language as an EDSL, together with proof of progress\n||| taken from PLFA Part 2.\n|||\n||| This module represents Section 3 of the Functional Pearl.\n|||\nmodule Razor.Recorded\n\nimport Razor.Common\n\n%default total\n\nnamespace Types\n\n  public export\n  data Ty = TyInt\n          | TyChar\n          | TyRecord (Vect (S n) Ty)\n\nnamespace Terms\n\n  mutual\n    ||| Field in a record.\n    public export\n    data Field : (g : List Ty)\n              -> (type  : Ty)\n              -> Type\n      where\n        MkField : (value : Recorded g type)\n                        -> Field    g type\n\n    ||| Record Fields.\n    public export\n    data Fields : (g : List Ty)\n               -> (types : Vect (S n) Ty)\n               -> Type\n      where\n        Singleton : (first : Field  g  ty)\n                          -> Fields g (ty::Nil)\n\n        Extend : (next : Field  g  ty)\n              -> (rest : Fields g      tys)\n                      -> Fields g (ty::tys)\n\n    public export\n    data Recorded : List Ty -> Ty -> Type where\n          -- Let-Bindings & Variables\n          Var : Elem ty g -> Recorded g ty\n\n          Let : {expr, body : Ty}\n             -> (this     : Recorded        g  expr)\n             -> (beInThis : Recorded (expr::g) body)\n                         -> Recorded        g  body\n\n          -- Base Values\n          I : Int  -> Recorded g TyInt\n          C : Char -> Recorded g TyChar\n\n          -- Records & Accessors\n          MkRecord : {types  : Vect (S n) Ty}\n                  -> (values : Fields   g           types)\n                            -> Recorded g (TyRecord types)\n\n          Proj : {type : Ty}\n              -> {types : Vect (S n) Ty}\n              -> (rec   : Recorded g (TyRecord types))\n              -> (idx   : Elem type types)\n                       -> Recorded g type\n\n  public export\n  index : (idx    : Elem type types)\n       -> (fields : Fields g types)\n       -> Recorded g type\n  index Here (Singleton (MkField value)) = value\n  index Here (Extend (MkField value) rest) = value\n  index (There later) (Extend next rest) = index later rest\n\nnamespace Renaming\n\n  public export\n  weaken : (Contains  old           type -> Contains  new           type)\n        -> (Contains (old += type') type -> Contains (new += type') type)\n\n  weaken func Here         = Here\n  weaken func (There rest) = There (func rest)\n\n  mutual\n    namespace Fields\n      public export\n      rename : (forall type  . Contains old type  -> Contains new type)\n            -> (forall types . Fields   old types -> Fields   new types)\n      rename f (Singleton (MkField first))\n        = Singleton (MkField (rename f first))\n      rename f (Extend (MkField next) rest)\n        = Extend (MkField (rename f next)) (rename f rest)\n\n    public export\n    rename : (forall type . Contains old type -> Contains new type)\n          -> (forall type . Recorded old type -> Recorded new type)\n    -- Let-Bindings & Variables\n    rename f (Var x) = Var (f x)\n    rename f (Let this beInThis)\n      = Let (rename f this)\n            (rename (weaken f) beInThis)\n\n    -- Base Values\n    rename f (I x) = I x\n    rename f (C x) = C x\n\n    -- Records & Accessors\n    rename f (MkRecord values) = MkRecord (rename f values)\n    rename f (Proj rec idx) = Proj (rename f rec) idx\n\nnamespace Substitution\n  public export\n  weakens : (forall type . Contains  old type\n                        -> Recorded  new type)\n         -> (forall type . Contains (old += type') type\n                        -> Recorded (new += type') type)\n  weakens f Here         = Var Here\n  weakens f (There rest) = rename There (f rest)\n\n  namespace General\n    mutual\n      namespace Fields\n        public export\n        subst : (f : forall type  . Contains old type  -> Recorded new type)\n                 -> (forall types . Fields   old types -> Fields   new types)\n        subst f (Singleton (MkField first))\n          = Singleton (MkField (subst f first))\n        subst f (Extend (MkField next) rest)\n          = Extend (MkField (subst f next)) (subst f rest)\n\n      public export\n      subst : (forall type . Contains old type -> Recorded new type)\n           -> (forall type . Recorded old type -> Recorded new type)\n      -- Let-Bindings & Variables\n      subst f (Var x) =  f x\n      subst f (Let this beInThis)\n        = Let (subst f this)\n              (subst (weakens f) beInThis)\n\n      -- Base Values\n      subst f (I x) = I x\n      subst f (C x) = C x\n\n      -- Records & Accesors\n      subst f (MkRecord values) = MkRecord (subst f values)\n      subst f (Proj rec idx)    = Proj (subst f rec) idx\n\n  namespace Single\n    public export\n    apply : (this : Recorded  ctxt           typeB)\n         -> (idx  : Contains (ctxt += typeB) typeA)\n                 -> Recorded  ctxt           typeA\n    apply this Here         = this\n    apply this (There rest) = Var rest\n\n    public export\n    subst : (this   : Recorded  ctxt           typeB)\n         -> (inThis : Recorded (ctxt += typeB) typeA)\n                   -> Recorded  ctxt           typeA\n    subst {ctxt} {typeA} {typeB} this inThis\n      = General.subst (apply this) inThis\n\n\nnamespace Values\n  mutual\n    namespace Field\n      public export\n      data Value : (field  : Field g type) -> Type\n        where\n          MkField : (prf : Value v)\n                        -> Value (MkField v)\n\n    namespace Fields\n      public export\n      data Value : (fields : Fields g types) -> Type\n        where\n          Singleton : (field : Value value)\n                            -> Value (Singleton value)\n\n          Extend : {value  : Field g type}\n                -> {values : Fields g types}\n                -> (next   : Value value)\n                -> (rest   : Value values)\n                          -> Value (Extend value values)\n\n    public export\n    data Value : Recorded ctxt type -> Type where\n      -- Base Values\n      I : Value (I i)\n      C : Value (C c)\n\n      -- Records\n      MkRecord : Value fields -> Value (MkRecord fields)\n\n\nnamespace Reduction\n\n  mutual\n    namespace Field\n      public export\n      data Redux : (this, that : Field ctxt type) -> Type\n        where\n          SimplifyField : {this, that : Recorded g type}\n                       -> (prf        : Redux this that)\n                                     -> Redux (MkField this)\n                                              (MkField that)\n\n    namespace Fields\n      public export\n      data Redux : (this, that : Terms.Fields g types) -> Type\n        where\n          SimplifySingleton : (prf : Redux this that)\n                                  -> Redux (Singleton this)\n                                           (Singleton that)\n\n          SimplifyExtend : {this, that : Field g type}\n                        -> {rest       : Fields g types}\n                        -> (prf        : Redux this that)\n                                      -> Redux (Extend this rest)\n                                               (Extend that rest)\n\n          SimplifyExtendV : {this, that : Fields ctxt types}\n                         -> {v          : Field ctxt type}\n                         -> (value      : Value v)\n                         -> (rest       : Redux this that)\n                                       -> Redux (Extend v this)\n                                                (Extend v that)\n\n\n    public export\n    data Redux : (this, that : Recorded ctxt type) -> Type where\n      -- Let Bindings\n      SimplifyLetValue : Redux this that\n                      -> Redux (Let this body)\n                               (Let that body)\n      ReduceLetBody : Value value\n                   -> Redux (Let value body)\n                            (subst value body)\n\n      SimplifyRecord : Redux this that\n                    -> Redux (MkRecord this) (MkRecord that)\n\n\n      -- Accessors\n      SimplifyProj : {type       : Ty}\n                  -> {labels     : Vect (S n) Ty}\n                  -> {this, that : Recorded g (TyRecord labels)}\n                  -> {idx        : Elem type labels}\n                                -> Redux this that\n                                -> Redux (Proj this idx) (Proj that idx)\n\n      ReduceProj : {type   : Ty}\n                -> {types  : Vect (S n) Ty}\n                -> {fields : Fields g types}\n                -> {idx    : Elem type types}\n                -> (values : Value fields)\n                          -> Redux (Proj (MkRecord fields) idx)\n                                   (index idx fields)\n\nnamespace Progress\n\n  public export\n  data Progress : (term : Recorded Nil type)\n                       -> Type\n    where\n      Done : {term : Recorded Nil type} -> Value term -> Progress term\n      Step : {type : Ty}\n          -> {this, that : Recorded Nil type}\n          -> (step  : Redux this that)\n                   -> Progress this\n\n  namespace Field\n    public export\n    data Progress : (field : Field Nil type) -> Type where\n      Done : Value field -> Progress field\n      Step : {this, that : Field Nil type}\n          -> (step       : Redux this that)\n                        -> Progress this\n\n  namespace Fields\n    public export\n    data Progress : (fields : Fields Nil types) -> Type where\n      Done :  (value : Value fields) -> Progress fields\n\n      Step : {this, that : Fields Nil types}\n          -> (step       : Redux this that)\n                        -> Progress this\n\n\n  mutual\n    namespace Field\n      public export\n      progress : (field : Field Nil type)\n              -> Progress field\n      progress (MkField value) with (progress value)\n        progress(MkField value) | (Done v)\n          = Done (MkField v)\n        progress(MkField value) | (Step step)\n          = Step (SimplifyField step)\n\n    namespace Fields\n      public export\n      progress : (fields : Fields Nil types)\n              -> Progress fields\n      progress (Singleton first) with (Field.progress first)\n        progress (Singleton first) | (Done x)\n          = Done (Singleton x)\n        progress (Singleton first) | (Step prf)\n          = Step (SimplifySingleton prf)\n\n\n      progress (Extend next rest) with (progress next)\n        progress (Extend next rest) | (Done x) with (progress rest)\n          progress (Extend next rest) | (Done x) | (Done xs)\n            = Done (Extend x xs)\n          progress (Extend next rest) | (Done x) | (Step prf)\n            = Step (SimplifyExtendV x prf)\n\n        progress (Extend next rest) | (Step prf)\n          = Step (SimplifyExtend prf)\n\n    public export\n    progress : forall type . (term : Recorded Nil type) -> Progress term\n    -- Let-Bindings & Variables\n    progress (Var _) impossible\n    progress (Let this beInThis) with (progress this)\n      progress (Let this beInThis) | (Done x)\n        = Step (ReduceLetBody x)\n      progress (Let this beInThis) | (Step prf)\n        = Step (SimplifyLetValue prf)\n\n    -- Base Values\n    progress (I x) = Done I\n    progress (C x) = Done C\n\n    -- Records & Accessors\n    progress (MkRecord values) with (progress values)\n      progress (MkRecord values) | (Done v)   = Done (MkRecord v)\n      progress (MkRecord values) | (Step prf) = Step (SimplifyRecord prf)\n\n    progress (Proj rec idx) with (progress rec)\n      progress (Proj (MkRecord fields) idx) | (Done (MkRecord fieldsV))\n        = Step (ReduceProj fieldsV)\n      progress (Proj rec idx) | (Step prf)\n        = Step (SimplifyProj prf)\n\nnamespace Evaluation\n\n  public export\n  data Reduces : (this : Recorded ctxt type)\n              -> (that : Recorded ctxt type)\n                      -> Type\n    where\n      Refl  : {this : Recorded ctxt type}\n                   -> Reduces this this\n      Trans : {this, that, end : Recorded ctxt type}\n                              -> Redux this that\n                              -> Reduces that end\n                              -> Reduces this end\n\n  public export\n  data Finished : (term : Recorded ctxt type)\n                       -> Type\n    where\n      Normalised : {term : Recorded ctxt type} -> Value term -> Finished term\n      OOF : Finished term\n\n  public export\n  data Evaluate : (term : Recorded Nil type) -> Type where\n    RunEval : {this, that : Recorded Nil type}\n           -> (steps      : Inf (Reduces this that))\n           -> (result     : Finished that)\n                         -> Evaluate this\n\n  public export\n  data Fuel = Empty | More (Lazy Fuel)\n\n  public export\n  covering\n  forever : Fuel\n  forever = More forever\n\n  public export\n  compute : (fuel : Fuel)\n         -> (term : Recorded Nil type)\n                 -> Evaluate term\n  compute Empty term = RunEval Refl OOF\n  compute (More fuel) term with (progress term)\n    compute (More fuel) term | (Done value) = RunEval Refl (Normalised value)\n    compute (More fuel) term | (Step step {that}) with (compute fuel that)\n      compute (More fuel) term | (Step step {that = that}) | (RunEval steps result)\n        = RunEval (Trans step steps) result\n\npublic export\ncovering\nrun : (this : Recorded Nil type)\n           -> Maybe (Subset (Recorded Nil type) (Reduces this))\nrun this with (compute forever this)\n  run this | (RunEval steps (Normalised {term} x))\n    = Just (Element term steps)\n  run this | (RunEval steps OOF) = Nothing\n\n\nnamespace Examples\n\n  public export\n  pairIC : Recorded Nil (TyRecord [TyInt, (TyChar)])\n  pairIC = MkRecord (Extend    (MkField (I 1))\n                    (Singleton (MkField (C 'c'))))\n\n  public export\n  i : Recorded Nil TyInt\n  i = Proj pairIC Here\n\n  public export\n  c : Recorded Nil TyChar\n  c = Proj pairIC (There Here)\n", "meta": {"hexsha": "8fe34ebc50b51befb458bc7885fc27b9087a5824", "size": 13715, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Razor/Recorded.idr", "max_stars_repo_name": "border-patrol/pearly-razors", "max_stars_repo_head_hexsha": "bc2677dda9171f8043e6cfb62ef4153e92c15714", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-09-29T16:07:47.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-22T09:12:24.000Z", "max_issues_repo_path": "Razor/Recorded.idr", "max_issues_repo_name": "border-patrol/pearly-razors", "max_issues_repo_head_hexsha": "bc2677dda9171f8043e6cfb62ef4153e92c15714", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Razor/Recorded.idr", "max_forks_repo_name": "border-patrol/pearly-razors", "max_forks_repo_head_hexsha": "bc2677dda9171f8043e6cfb62ef4153e92c15714", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.3466981132, "max_line_length": 83, "alphanum_fraction": 0.5258476121, "num_tokens": 3257, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744761936437, "lm_q2_score": 0.6548947357776795, "lm_q1q2_score": 0.535425220565411}}
{"text": "module Main\n\nimport Data.Vect\n\nvdrop : (n:Nat) -> Vect (n+m) a -> Vect m a\nvdrop Z v = v\nvdrop (S k) (x::xs) = vdrop k xs\n\nmain : IO ()\n-- BOOOM!\nmain = putStrLn (show (vdrop 6 (1 :: 2 :: 3 :: 4 :: 5 :: Nil)))\n", "meta": {"hexsha": "06a5a1d8c8687e0577d602d603a9f61fc40d7ef9", "size": 210, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "vdrop.idr", "max_stars_repo_name": "janschultecom/idris-examples", "max_stars_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-05-05T15:26:06.000Z", "max_stars_repo_stars_event_max_datetime": "2016-05-05T15:26:06.000Z", "max_issues_repo_path": "vdrop.idr", "max_issues_repo_name": "janschultecom/idris-examples", "max_issues_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "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": "vdrop.idr", "max_forks_repo_name": "janschultecom/idris-examples", "max_forks_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "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.5, "max_line_length": 63, "alphanum_fraction": 0.5380952381, "num_tokens": 87, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8652240686758841, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5353837245008822}}
{"text": "module Data.Compress.CRC\n\nimport Data.Compress.Utils.ConstantTable\nimport Data.Vect\nimport Data.Bits\n\ncrc_table : ConstantTable 256 Bits32\ncrc_table = from_vect\n  [ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f\n  , 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988\n  , 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2\n  , 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7\n  , 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9\n  , 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172\n  , 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c\n  , 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59\n  , 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423\n  , 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924\n  , 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106\n  , 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433\n  , 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d\n  , 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e\n  , 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950\n  , 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65\n  , 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7\n  , 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0\n  , 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa\n  , 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f\n  , 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81\n  , 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a\n  , 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84\n  , 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1\n  , 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb\n  , 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc\n  , 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e\n  , 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b\n  , 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55\n  , 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236\n  , 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28\n  , 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d\n  , 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f\n  , 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38\n  , 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242\n  , 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777\n  , 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69\n  , 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2\n  , 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc\n  , 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9\n  , 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693\n  , 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94\n  , 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d ]\n\nexport\nupdate_crc32 : Bits32 -> List Bits8 -> Bits32\nupdate_crc32 crc = complement . foldl (\\crc,elem => xor (shiftR crc 8) (index_bits8 ((xor (cast crc) elem)) crc_table)) (complement crc)\n\nexport\ncrc32 : List Bits8 -> Bits32\ncrc32 = update_crc32 0\n", "meta": {"hexsha": "499b6f51f34f62156b3f4f6f85a73f08e77563c2", "size": 3615, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Compress/CRC.idr", "max_stars_repo_name": "octeep/idris2-http", "max_stars_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "max_stars_repo_licenses": ["0BSD"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2022-01-05T11:39:50.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-20T10:43:01.000Z", "max_issues_repo_path": "src/Data/Compress/CRC.idr", "max_issues_repo_name": "octeep/idris2-http", "max_issues_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "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": "src/Data/Compress/CRC.idr", "max_forks_repo_name": "octeep/idris2-http", "max_forks_repo_head_hexsha": "7afdce354be2a5eddef843b99c775d7939e94253", "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": 60.25, "max_line_length": 136, "alphanum_fraction": 0.7950207469, "num_tokens": 2422, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8652240756264638, "lm_q2_score": 0.6187804267137442, "lm_q1q2_score": 0.5353837227191481}}
{"text": "module Main\n\nimport Data.Vect\n\n%flag C \"-g3\"\n%flag C \"-ggdb\"\n%flag C \"-O0\"\n\nrep : (n : Nat) -> Char -> Vect n Char\nrep Z     x = []\nrep (S k) x = x :: rep k x\n\ndata RLE : Vect n Char -> Type where\n     REnd  : RLE []\n     RChar : .{k : Nat}\n             -> {xs : Vect k Char}\n             -> (n : Nat)\n             -> (x : Char)\n             -> RLE xs\n             -> RLE (rep (S n) x ++ xs)\n\neq : (x : Char) -> (y : Char) -> Maybe (x = y)\neq x y = if x == y then Just (believe_me (Refl {x})) else Nothing\n\n------------\n\nrle : (xs : Vect n Char) -> RLE xs\nrle [] = REnd\nrle (x :: xs) with (rle xs)\n   rle (x :: Vect.Nil)             | REnd = RChar Z x REnd\n   rle (x :: rep (S n) yvar ++ ys) | RChar n yvar rs with (eq x yvar)\n     rle (x :: rep (S n) x ++ ys) | RChar n x rs | Just Refl\n           = RChar (S n) x rs\n     rle (x :: rep (S n) y ++ ys) | RChar n y rs | Nothing\n           = RChar Z x (RChar n y rs)\n\ncompress : Vect n Char -> String\ncompress xs with (rle xs)\n  compress Nil                 | REnd         = \"\"\n  compress (rep (S n) x ++ xs) | RChar _ _ rs\n         = let ni : Integer = cast (S n) in\n               show ni ++ strCons x (compress xs)\n\n{-\nfmt : {xs : Vect n Char} -> RLE xs -> String\nfmt  REnd          = \"\"\nfmt (RChar n c xs) = show n ++ show c ++ fmt xs\n-}\n\ncompressString : String -> String\ncompressString xs = compress (fromList (unpack xs))\n\nmain : IO ()\nmain = putStrLn (compressString \"foooobaaaarbaaaz\")\n", "meta": {"hexsha": "fa9a275ae01d386cea3beab35cc326729c6ea4fe", "size": 1443, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/basic001/reg005.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/basic001/reg005.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/basic001/reg005.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 26.2363636364, "max_line_length": 69, "alphanum_fraction": 0.4913374913, "num_tokens": 493, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673087708699, "lm_q2_score": 0.658417500561683, "lm_q1q2_score": 0.535206061729218}}
{"text": "import Data.Primitives.Views\n\n\nquiz : Stream Int -> (score : Nat) -> IO ()\nquiz (num1 :: num2 :: nums) score =\n    do\n        putStrLn (\"Score so far: \" ++ show score)\n        putStr (show num1 ++ \" * \" ++ show num2 ++ \"? \")\n        answer <- getLine\n        if cast answer == num1 * num2\n            then do\n                putStrLn \"Correct!\"\n                quiz nums (score + 1)\n            else do\n                putStrLn (\"Wrong, the answer is \" ++ show (num1 * num2))\n                quiz nums score\n\nrandoms : Int -> Stream Int\nrandoms seed =\n    let seed' = 1664525 * seed + 1013904223 in\n        (seed' `shiftR` 2) :: randoms seed'\n\narithInputs : Int -> Stream Int\narithInputs seed = map bound (randoms seed)\n    where\n        bound : Int -> Int\n        bound num with (divides num 12)\n            bound ((12 * div) + rem) | DivBy prf = rem + 1\n\ndata Face = Heads | Tails\n\ntotal\ngetFace : Int -> Face\ngetFace x with (divides x 2)\n  getFace ((2 * div) + rem) | (DivBy prf) =\n    case rem of\n        0 => Heads\n        _ => Tails\n\ncoinFlips : (count : Nat) -> Stream Int -> List Face\ncoinFlips count xs = take count (map getFace xs)\n", "meta": {"hexsha": "f8d5aec6b42a29da41c804b0189eb7e22cfdf6de", "size": 1142, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris-exercises/Arith.idr", "max_stars_repo_name": "0nkery/tt-tutorials", "max_stars_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "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": "idris-exercises/Arith.idr", "max_issues_repo_name": "0nkery/tt-tutorials", "max_issues_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "idris-exercises/Arith.idr", "max_forks_repo_name": "0nkery/tt-tutorials", "max_forks_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_forks_repo_licenses": ["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.1904761905, "max_line_length": 72, "alphanum_fraction": 0.5420315236, "num_tokens": 328, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673178375734, "lm_q2_score": 0.658417487156366, "lm_q1q2_score": 0.5352060568021502}}
{"text": "interface (.defaultable) a where\n  defa : a\n\n(.defaultable) Int where\n  defa = 0\n\nf : Num a => a.defaultable => a -> a\nf x = x + defa\n", "meta": {"hexsha": "2ff0c88e549267f7130211f17e89c88ec6bf2ed3", "size": 134, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "InterfaceAsPostfix.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "InterfaceAsPostfix.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "InterfaceAsPostfix.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 14.8888888889, "max_line_length": 36, "alphanum_fraction": 0.6044776119, "num_tokens": 49, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8080672135527632, "lm_q2_score": 0.6619228758499941, "lm_q1q2_score": 0.5348781738749364}}
{"text": "{-\n0.42\n1.68\n1.34\n0.34\n0.5 < 0.5 => False\n0.5 <= 0.5 => True\n0.5 == 0.5 => True\n0.5 >= 0.5 => True\n0.5 > 0.5 => False\n0.5 compare 0.5 => EQ\n0.5 max 0.5 => 0.5\n0.5 min 0.5 => 0.5\n0.5 < 1 => True\n0.5 <= 1 => True\n0.5 == 1 => False\n0.5 >= 1 => False\n0.5 > 1 => False\n0.5 compare 1 => LT\n0.5 max 1 => 1\n0.5 min 1 => 0.5\n1 < 0.5 => False\n1 <= 0.5 => False\n1 == 0.5 => False\n1 >= 0.5 => True\n1 > 0.5 => True\n1 compare 0.5 => GT\n1 max 0.5 => 1\n1 min 0.5 => 0.5\n1 < 1 => False\n1 <= 1 => True\n1 == 1 => True\n1 >= 1 => True\n1 > 1 => False\n1 compare 1 => EQ\n1 max 1 => 1\n1 min 1 => 1\nabs -1 => 1\n- (-1) => 1\nabs 1 => 1\n- (1) => -1\n-}\nimport CIL.FFI.Single\n\nimplementation Show Ordering where\n  show EQ = \"EQ\"\n  show LT = \"LT\"\n  show GT = \"GT\"\n\ntestNum : IO ()\ntestNum =\n  for_ [(*), (/), (+), (-)] $ \\op =>\n    printLn $ single 0.84 `op` single 0.5\n\ntestOrd : IO ()\ntestOrd = traverse_ putStrLn (test singles singles)\n  where\n    singles = [ single 0.5, single 1.0 ]\n\n    op : Show r => String -> (Single -> Single -> r) -> (Single -> Single -> String)\n    op name o = \\x, y => show x ++ \" \" ++  name ++ \" \" ++ show y ++ \" => \" ++ show (x `o` y)\n\n    operators : List (Single -> Single -> String)\n    operators = [ op \"<\" (<), op \"<=\" (<=), op \"==\" (==)\n                , op \">=\" (>=), op \">\" (>), op \"compare\" compare\n                , op \"max\" max, op \"min\" min ]\n\n    test : List Single -> List Single -> List String\n    test xs ys = do\n      x <- xs\n      y <- ys\n      map (\\o => x `o` y) operators\n\ntestNeg : IO ()\ntestNeg =\n  for_ [ single (-1), single 1 ] $ \\x => do\n    putStrLn $ \"abs \" ++ show x ++ \" => \" ++ show (abs x)\n    putStrLn $ \"- (\" ++ show x ++ \") => \" ++ show (-x)\n\nmain : IO ()\nmain = do\n  testNum\n  testOrd\n  testNeg\n\n-- Local Variables:\n-- idris-load-packages: (\"cil\")\n-- End:\n", "meta": {"hexsha": "c911bc0efa1ba75a9820b51655015ae09d1c44fa", "size": 1792, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Tests/SinglePrimitives.idr", "max_stars_repo_name": "timjs/iris-clean", "max_stars_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 146, "max_stars_repo_stars_event_min_datetime": "2015-07-27T12:33:10.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-25T22:26:35.000Z", "max_issues_repo_path": "Tests/SinglePrimitives.idr", "max_issues_repo_name": "timjs/iris-clean", "max_issues_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 27, "max_issues_repo_issues_event_min_datetime": "2015-09-21T15:08:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-20T13:55:12.000Z", "max_forks_repo_path": "Tests/SinglePrimitives.idr", "max_forks_repo_name": "timjs/iris-clean", "max_forks_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 14, "max_forks_repo_forks_event_min_datetime": "2015-09-21T12:24:16.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-16T21:10:06.000Z", "avg_line_length": 20.1348314607, "max_line_length": 92, "alphanum_fraction": 0.4771205357, "num_tokens": 728, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7057850154599562, "lm_q2_score": 0.7577943767446202, "lm_q1q2_score": 0.5348399159061696}}
{"text": "module Average\n\nimport Data.List\nimport Data.Strings\nimport System.REPL\n\naverage : (str : String) -> Double\naverage str = let numWords = length (words str)\n                  totalLength = sum (allLengths (words str)) in\n                  cast totalLength / cast numWords\n               where\n                 allLengths : List String -> List Nat\n                 allLengths strs = map length strs\n\nshowAverage : (str : String) -> String\nshowAverage str = \"The average word length is \" ++ show (average str) ++ \"\\n\"\n\nmain : IO ()\nmain = repl \"Enter a string: \" showAverage", "meta": {"hexsha": "acdc7d6f2dda24d8c72c0057e8754b2591dca539", "size": 571, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter2/Average.idr", "max_stars_repo_name": "timmyjose-study/tdd-with-idris", "max_stars_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "max_stars_repo_licenses": ["Unlicense"], "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/Average.idr", "max_issues_repo_name": "timmyjose-study/tdd-with-idris", "max_issues_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": "chapter2/Average.idr", "max_forks_repo_name": "timmyjose-study/tdd-with-idris", "max_forks_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": 30.0526315789, "max_line_length": 77, "alphanum_fraction": 0.6147110333, "num_tokens": 133, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8031737963569016, "lm_q2_score": 0.6654105653819835, "lm_q1q2_score": 0.5344403299338399}}
{"text": "module Equiv\n\nimport Expr\nimport Imp\nimport Logic\nimport Maps\n\n%access public export\n\n%default total\n\nAEquiv : (a1, a2 : AExp) -> Type\nAEquiv a1 a2 = (st : State) -> aeval st a1 = aeval st a2\n\nBEquiv : (b1, b2 : BExp) -> Type\nBEquiv b1 b2 = (st : State) -> beval st b1 = beval st b2\n\nAEquiv_example : AEquiv (X - X) 0\nAEquiv_example st with (st X)\n  AEquiv_example st | Z = Refl\n  AEquiv_example st | S k = sym $ minusZeroN k\n\nBEquiv_example : BEquiv (X - X == 0) BTrue\nBEquiv_example st with (st X)\n  BEquiv_example st | Z = Refl\n  BEquiv_example st | S k = rewrite sym $ minusZeroN k in Refl\n\nbtrue_is_true : BEquiv BTrue BTrue\nbtrue_is_true _ = Refl\n\nbfalse_is_false : BEquiv BFalse BFalse\nbfalse_is_false _ = Refl\n\nbnot_btrue_is_bfalse : BEquiv (BNot BTrue) BFalse\nbnot_btrue_is_bfalse _ = Refl\n\nbnot_bfalse_is_btrue : BEquiv (BNot BFalse) BTrue\nbnot_bfalse_is_btrue _ = Refl\n\nCEquiv : (c1, c2 : Com) -> Type\nCEquiv c1 c2 = (st, st' : State) -> ((c1 / st \\\\ st') \u2194 (c2 / st \\\\ st'))\n\nskip_left : CEquiv (do SKIP; c) c\nskip_left st st' = (forward, backward)\nwhere forward : ((do SKIP; c) / st \\\\ st') -> (c / st \\\\ st')\n      forward (E_Seq E_Skip rel) = rel\n      backward : (c / st \\\\ st') -> ((do SKIP; c) / st \\\\ st')\n      backward rel = E_Seq E_Skip rel\n\nskip_right : CEquiv (do c; SKIP) c\nskip_right st st' = (forward, backward)\nwhere forward : ((do c; SKIP) / st \\\\ st') -> (c / st \\\\ st')\n      forward (E_Seq rel E_Skip) = rel\n      backward : (c / st \\\\ st') -> ((do c; SKIP) / st \\\\ st')\n      backward rel = E_Seq rel E_Skip\n\ntest_true_simple : CEquiv (IFB BTrue THEN c1 ELSE c2 FI) c1\ntest_true_simple st st' = (forward, backward)\nwhere forward : ((IFB BTrue THEN c1 ELSE c2 FI) / st \\\\ st') ->\n                (c1 / st \\\\ st')\n      forward (E_IfTrue _ rel) = rel\n      forward (E_IfFalse prf _) = absurd prf\n      backward : (c1 / st \\\\ st') ->\n                 ((IFB BTrue THEN c1 ELSE c2 FI) / st \\\\ st')\n      backward rel = E_IfTrue Refl rel\n\ntest_true : BEquiv b BTrue -> CEquiv (IFB b THEN c1 ELSE c2 FI) c1\ntest_true {b} btrue st st' = (forward, backward)\nwhere forward : ((IFB b THEN c1 ELSE c2 FI) / st \\\\ st') ->\n                (c1 / st \\\\ st')\n      forward (E_IfTrue _ rel) = rel\n      forward (E_IfFalse prf _) = absurd $ trans (sym $ btrue st) prf\n      backward : (c1 / st \\\\ st') ->\n                 ((IFB b THEN c1 ELSE c2 FI) / st \\\\ st')\n      backward rel = E_IfTrue (btrue st) rel\n\ntest_false : BEquiv b BFalse -> CEquiv (IFB b THEN c1 ELSE c2 FI) c2\ntest_false {b} bfalse st st' = (forward, backward)\nwhere forward : ((IFB b THEN c1 ELSE c2 FI) / st \\\\ st') ->\n                (c2 / st \\\\ st')\n      forward (E_IfTrue prf _) = absurd $ trans (sym $ bfalse st) prf\n      forward (E_IfFalse _ rel) = rel\n      backward : (c2 / st \\\\ st') ->\n                 ((IFB b THEN c1 ELSE c2 FI) / st \\\\ st')\n      backward rel = E_IfFalse (bfalse st) rel\n\nswap_if_branches : CEquiv (IFB b THEN c1 ELSE c2 FI)\n                          (IFB not b THEN c2 ELSE c1 FI)\nswap_if_branches {b} st st' = (forward, backward)\nwhere forward : ((IFB b THEN c1 ELSE c2 FI) / st \\\\ st') ->\n                ((IFB BNot b THEN c2 ELSE c1 FI) / st \\\\ st')\n      forward (E_IfTrue prf rel) = E_IfFalse (cong {f=not} prf) rel\n      forward (E_IfFalse prf rel) = E_IfTrue (cong {f=not} prf) rel\n      backward : ((IFB BNot b THEN c2 ELSE c1 FI) / st \\\\ st') ->\n                 ((IFB b THEN c1 ELSE c2 FI) / st \\\\ st')\n      backward (E_IfTrue prf rel) =\n        E_IfFalse (trans (sym $ notInvolutive (beval st b))\n                         (cong {f=not} prf))\n                  rel\n      backward (E_IfFalse prf rel) =\n        E_IfTrue (trans (sym $ notInvolutive (beval st b))\n                        (cong {f=not} prf))\n                 rel\n\nif1_if_equiv : CEquiv (CIf1 b c) (CIf b c SKIP)\nif1_if_equiv {b} {c} st st' = (forward, backward)\nwhere forward : CEval (CIf1 b c) st st' -> CEval (CIf b c SKIP) st st'\n      forward rel = case rel of\n        E_If1True prf cc => E_IfTrue prf cc\n        E_If1False prf => E_IfFalse prf E_Skip\n      backward : CEval (CIf b c SKIP) st st' -> CEval (CIf1 b c) st st'\n      backward rel = case rel of\n        E_IfTrue prf cct => E_If1True prf cct\n        E_IfFalse prf E_Skip => E_If1False prf\n\nif1_true : BEquiv b BTrue -> CEquiv (CIf1 b c) c\nif1_true {b} btrue st st' = (forward, backward)\nwhere forward : CEval (CIf1 b c) st st' -> CEval c st st'\n      forward rel = case rel of\n        E_If1True _ cc => cc\n        E_If1False prf => absurd $ trans (sym prf) (btrue st)\n      backward : CEval c st st' -> CEval (CIf1 b c) st st'\n      backward cc = E_If1True (btrue st) cc\n\n\nif1_false : BEquiv b BFalse -> CEquiv (CIf1 b c) SKIP\nif1_false {b} bfalse st st' = (forward, backward)\nwhere forward : CEval (CIf1 b c) st st' -> CEval SKIP st st'\n      forward rel = case rel of\n        E_If1True prf _ => absurd $ trans (sym prf) (bfalse st)\n        E_If1False _ => E_Skip\n      backward : CEval SKIP st st' -> CEval (CIf1 b c) st st'\n      backward rel = case rel of\n        E_Skip => E_If1False (bfalse st)\n\nwhile_false : BEquiv b BFalse -> CEquiv (WHILE b c) SKIP\nwhile_false {b} bfalse st _ = (forward, backward)\nwhere forward : ((WHILE b c) / st \\\\ st') -> (SKIP / st \\\\ st')\n      forward rel = case rel of\n        E_WhileEnd _ => E_Skip\n        E_WhileLoop prf _ _ => absurd $ trans (sym $ bfalse st) prf\n      backward : (SKIP / st \\\\ st') -> ((WHILE b c) / st \\\\ st')\n      backward rel = case rel of\n        E_Skip => E_WhileEnd (bfalse st)\n\nwhile_true_nonterm : BEquiv b BTrue -> Not ((WHILE b c) / st \\\\ st')\nwhile_true_nonterm {st'} btrue (E_WhileEnd prf) =\n  absurd $ trans (sym $ btrue st') prf\nwhile_true_nonterm btrue (E_WhileLoop prf rel next) =\n  while_true_nonterm btrue next\n\nwhile_true : BEquiv b BTrue -> CEquiv (WHILE b c) (WHILE BTrue SKIP)\nwhile_true {b} btrue st st' = (forward, backward)\nwhere forward : ((WHILE b c) / st \\\\ st') -> ((WHILE BTrue SKIP) / st \\\\ st')\n      forward rel = case rel of\n        E_WhileEnd prf => absurd $ trans (sym $ btrue st) prf\n        E_WhileLoop _ _ next => void $ while_true_nonterm btrue next\n      backward : ((WHILE BTrue SKIP) / st \\\\ st') -> ((WHILE b c) / st \\\\ st')\n      backward rel = case rel of\n        E_WhileEnd prf => absurd prf\n        E_WhileLoop Refl _ next => void $ while_true_nonterm btrue_is_true next\n\nloop_unrolling : CEquiv (WHILE b c) (IFB b THEN (do c; WHILE b c) ELSE SKIP FI)\nloop_unrolling st st' = (forward, backward)\nwhere forward : ((WHILE b c) / st \\\\ st') ->\n                ((IFB b THEN (do c; WHILE b c) ELSE SKIP FI) / st \\\\ st')\n      forward rel = case rel of\n        E_WhileEnd prf => E_IfFalse prf E_Skip\n        E_WhileLoop prf rel next => E_IfTrue prf (E_Seq rel next)\n      backward : ((IFB b THEN (do c; WHILE b c) ELSE SKIP FI) / st \\\\ st') ->\n                 ((WHILE b c) / st \\\\ st')\n      backward (E_IfTrue prf (E_Seq rel next)) = E_WhileLoop prf rel next\n      backward (E_IfFalse prf rel) = case rel of\n        E_Skip => E_WhileEnd prf\n\nfor_while_equiv : CEquiv (CFor c1 b c2 c3) (CSeq c1 (CWhile b (CSeq c3 c2)))\nfor_while_equiv {c1} {b} {c2} {c3} st st' = (forward, backward)\nwhere forward : ((CFor c1 b c2 c3) / st \\\\ st') ->\n                ((CSeq c1 (CWhile b (CSeq c3 c2))) / st \\\\ st')\n      forward (E_For cinit cwhile) = E_Seq cinit cwhile\n      backward : ((CSeq c1 (CWhile b (CSeq c3 c2))) / st \\\\ st') ->\n                 ((CFor c1 b c2 c3) / st \\\\ st')\n      backward (E_Seq cinit cwhile) = E_For cinit cwhile\n\nrepeat_while_equiv : CEquiv (CRepeat c b) (CSeq c (CWhile (not b) c))\nrepeat_while_equiv {c} {b} st st' = (forward, backward)\nwhere forward : CEval (CRepeat c b) st st' ->\n                CEval (CSeq c (CWhile (not b) c)) st st'\n      forward (E_Repeat cc cwhile) = E_Seq cc cwhile\n      backward : CEval (CSeq c (CWhile (not b) c)) st st' ->\n                 CEval (CRepeat c b) st st'\n      backward (E_Seq cc cwhile) = E_Repeat cc cwhile\n\nseq_assoc : CEquiv (do (do c1; c2); c3) (do c1; (do c2; c3))\nseq_assoc st st' = (forward, backward)\nwhere forward : ((do (do c1; c2); c3) / st \\\\ st') ->\n                ((do c1; (do c2; c3)) / st \\\\ st')\n      forward (E_Seq (E_Seq r1 r2) r3) = E_Seq r1 (E_Seq r2 r3)\n      backward : ((do c1; (do c2; c3)) / st \\\\ st') ->\n                 ((do (do c1; c2); c3) / st \\\\ st')\n      backward (E_Seq r1 (E_Seq r2 r3)) = E_Seq (E_Seq r1 r2) r3\n\nidentity_assignment : CEquiv (x ::= AId x) SKIP\nidentity_assignment {x} st st' = (forward, backward)\nwhere forward : ((x ::= AId x) / st \\\\ st') -> (SKIP / st \\\\ st')\n      forward rel = case rel of\n        E_Ass prf => rewrite sym prf\n                     in rewrite t_update_same {m=st} {x=x}\n                     in E_Skip\n      backward : (SKIP / st \\\\ st') -> ((x ::= AId x) / st \\\\ st')\n      backward rel = case rel of\n        E_Skip => replace (t_update_same {m=st} {x=x}) (E_Ass Refl)\n                    {P=\\s => (x ::= AId x) / st \\\\ s}\n\nassign_aequiv : AEquiv (AId x) e -> CEquiv SKIP (x ::= e)\nassign_aequiv {x} {e} x_eq_e st st' = (forward, backward)\nwhere forward : (SKIP / st \\\\ st') -> ((x ::= e) / st \\\\ st')\n      forward rel = case rel of\n        E_Skip => replace (t_update_same {m=st} {x=x}) (E_Ass (sym $ x_eq_e st))\n                    {P=\\s => (x ::= e) / st \\\\ s}\n      backward : ((x ::= e) / st \\\\ st') -> (SKIP / st \\\\ st')\n      backward rel = case rel of\n        E_Ass prf => rewrite sym prf\n                     in rewrite sym $ x_eq_e st\n                     in rewrite t_update_same {m=st} {x=x}\n                     in E_Skip\n\nprog_a : Com\nprog_a =\n  WHILE (not (X <= 0)) $\n    X ::= X + 1\n\nprog_b : Com\nprog_b = do\n  IFB X == 0\n      THEN do X ::= X + 1\n              Y ::= 1\n      ELSE Y ::= 0\n  FI\n  X ::= X - Y\n  Y ::= 0\n\nprog_c : Com\nprog_c = SKIP\n\nprog_d : Com\nprog_d =\n  WHILE (not (X == 0)) $\n    X ::= X * Y + 1\n\nprog_e : Com\nprog_e = Y ::= 0\n\nprog_f : Com\nprog_f = do\n  Y ::= X + 1\n  WHILE (not (X == Y)) $\n    Y ::= X + 1\n\nprog_g : Com\nprog_g = WHILE BTrue SKIP\n\nprog_h : Com\nprog_h =\n  WHILE (not (X == X)) $\n    X ::= X + 1\n\nprog_i : Com\nprog_i =\n  WHILE (not (X == Y)) $\n    X ::= Y + 1\n\nequiv_classes : List (List Com)\nequiv_classes = [ [prog_a, prog_f, prog_g]\n                , [prog_b]\n                , [prog_c, prog_h]\n                , [prog_d]\n                , [prog_e]\n                , [prog_i] ]\n\nrefl_aequiv : AEquiv a a\nrefl_aequiv _ = Refl\n\nsym_aequiv : AEquiv a1 a2 -> AEquiv a2 a1\nsym_aequiv a1_equiv_a2 st = sym $ a1_equiv_a2 st\n\ntrans_aequiv : AEquiv a1 a2 -> AEquiv a2 a3 -> AEquiv a1 a3\ntrans_aequiv a1_equiv_a2 a2_equiv_a3 st = rewrite a1_equiv_a2 st\n                                          in a2_equiv_a3 st\n\nrefl_bequiv : BEquiv b b\nrefl_bequiv _ = Refl\n\nsym_bequiv : BEquiv b1 b2 -> BEquiv b2 b1\nsym_bequiv b1_equiv_b2 st = sym $ b1_equiv_b2 st\n\ntrans_bequiv : BEquiv b1 b2 -> BEquiv b2 b3 -> BEquiv b1 b3\ntrans_bequiv b1_equiv_b2 b2_equiv_b3 st = rewrite b1_equiv_b2 st\n                                          in b2_equiv_b3 st\n\nrefl_cequiv : CEquiv c c\nrefl_cequiv _ _ = (id, id)\n\nsym_cequiv : CEquiv c1 c2 -> CEquiv c2 c1\nsym_cequiv c1_equiv_c2 st st' = swap $ c1_equiv_c2 st st'\n\ntrans_cequiv : CEquiv c1 c2 -> CEquiv c2 c3 -> CEquiv c1 c3\ntrans_cequiv c1_equiv_c2 c2_equiv_c3 st st' =\n  let (forward_c1_c2, backward_c2_c1) = c1_equiv_c2 st st'\n      (forward_c2_c3, backward_c3_c2) = c2_equiv_c3 st st'\n  in (forward_c2_c3 . forward_c1_c2, backward_c2_c1 . backward_c3_c2)\n\ncAss_congruence : AEquiv a1 a2 -> CEquiv (x ::= a1) (x ::= a2)\ncAss_congruence {a1} {a2} a1_equiv_a2 st st' = (forward, backward)\nwhere forward : ((x ::= a1) / st \\\\ st') -> ((x ::= a2) / st \\\\ st')\n      forward rel = case rel of\n        E_Ass prf => rewrite sym prf\n                     in rewrite a1_equiv_a2 st\n                     in E_Ass Refl\n      backward : ((x ::= a2) / st \\\\ st') -> ((x ::= a1) / st \\\\ st')\n      backward rel = case rel of\n        E_Ass prf => rewrite sym prf\n                     in rewrite sym $ a1_equiv_a2 st\n                     in E_Ass Refl\n\ncWhile_congruence : BEquiv b1 b2 -> CEquiv c1 c2 ->\n                    CEquiv (WHILE b1 c1) (WHILE b2 c2)\ncWhile_congruence {b1} {b2} {c1} {c2} b1_equiv_b2 c1_equiv_c2 _ _ =\n  (forward, backward)\nwhere forward : ((WHILE b1 c1) / st \\\\ st') -> ((WHILE b2 c2) / st \\\\ st')\n      forward {st} rel = case rel of\n        E_WhileEnd prf => E_WhileEnd $ trans (sym $ b1_equiv_b2 st) prf\n        E_WhileLoop {st1} prf rel next =>\n          E_WhileLoop (trans (sym $ b1_equiv_b2 st) prf)\n                      (fst (c1_equiv_c2 st st1) rel)\n                      (forward {st=st1} next)\n      backward : ((WHILE b2 c2) / st \\\\ st') -> ((WHILE b1 c1) / st \\\\ st')\n      backward {st} rel = case rel of\n        E_WhileEnd prf => E_WhileEnd $ trans (b1_equiv_b2 st) prf\n        E_WhileLoop {st1} prf rel next =>\n          E_WhileLoop (trans (b1_equiv_b2 st) prf)\n                      (snd (c1_equiv_c2 st st1) rel)\n                      (backward {st=st1} next)\n\ncSeq_congruence : CEquiv c1 c2 -> CEquiv c3 c4 -> CEquiv (do c1; c3) (do c2; c4)\ncSeq_congruence {c1} {c2} {c3} {c4} c1_equiv_c2 c3_equiv_c4 st st' =\n  (forward, backward)\nwhere forward : ((do c1; c3) / st \\\\ st') -> ((do c2; c4) / st \\\\ st')\n      forward (E_Seq {st2} r1 r2) = E_Seq (fst (c1_equiv_c2 st st2) r1)\n                                          (fst (c3_equiv_c4 st2 st') r2)\n      backward : ((do c2; c4) / st \\\\ st') -> ((do c1; c3) / st \\\\ st')\n      backward (E_Seq {st2} r3 r4) = E_Seq (snd (c1_equiv_c2 st st2) r3)\n                                           (snd (c3_equiv_c4 st2 st') r4)\n\nfor_false : BEquiv cond BFalse -> CEquiv (CFor init cond updt body) init\nfor_false {init} {cond} {updt} {body} cond_equiv =\n  trans_cequiv (for_while_equiv {c1=init} {b=cond} {c2=updt} {c3=body})\n               (trans_cequiv (cSeq_congruence (refl_cequiv {c=init})\n                                              (while_false cond_equiv))\n                             (skip_right {c=init}))\n\nfor_true : BEquiv cond BTrue -> CEquiv (CFor init cond updt body)\n                                       (CSeq init (CWhile BTrue SKIP))\nfor_true {init} {cond} {updt} {body} cond_equiv =\n  trans_cequiv (for_while_equiv {c1=init} {b=cond} {c2=updt} {c3=body})\n               (cSeq_congruence (refl_cequiv {c=init}) (while_true cond_equiv))\n\ncFor_congruence : CEquiv init1 init2 -> BEquiv cond1 cond2 ->\n                  CEquiv updt1 updt2 -> CEquiv body1 body2 ->\n                  CEquiv (CFor init1 cond1 updt1 body1)\n                         (CFor init2 cond2 updt2 body2)\ncFor_congruence init_equiv cond_equiv updt_equiv body_equiv =\n  trans_cequiv for_while_equiv\n               (trans_cequiv\n                  (cSeq_congruence init_equiv\n                                   (cWhile_congruence\n                                      cond_equiv\n                                      (cSeq_congruence body_equiv updt_equiv)))\n                  (sym_cequiv for_while_equiv))\n\nrepeat_false : BEquiv b BFalse -> CEquiv (CRepeat c b)\n                                         (CSeq c (CWhile BTrue SKIP))\nrepeat_false {b} {c} cond_equiv =\n  let not_cond_equiv = \\st1 => cong {f=not} (cond_equiv st1)\n  in trans_cequiv repeat_while_equiv\n                  (cSeq_congruence refl_cequiv (while_true not_cond_equiv))\n\nrepeat_true : BEquiv b BTrue -> CEquiv (CRepeat c b) c\nrepeat_true {b} {c} cond_equiv =\n  let not_cond_equiv = \\st1 => cong {f=not} (cond_equiv st1)\n  in trans_cequiv repeat_while_equiv\n                  (trans_cequiv (cSeq_congruence refl_cequiv\n                                                 (while_false not_cond_equiv))\n                                skip_right)\n\ncRepeat_congruence : CEquiv body1 body2 -> BEquiv cond1 cond2 ->\n                     CEquiv (CRepeat body1 cond1) (CRepeat body2 cond2)\ncRepeat_congruence body_equiv cond_equiv =\n  let not_cond_equiv = \\st1 => cong {f=not} (cond_equiv st1)\n  in trans_cequiv repeat_while_equiv\n                  (trans_cequiv\n                     (cSeq_congruence body_equiv\n                                      (cWhile_congruence not_cond_equiv\n                                                         body_equiv))\n                     (sym_cequiv repeat_while_equiv))\n\ncIf_congruence : BEquiv b1 b2 -> CEquiv c1 c2 -> CEquiv c3 c4 ->\n                 CEquiv (IFB b1 THEN c1 ELSE c3 FI) (IFB b2 THEN c2 ELSE c4 FI)\ncIf_congruence {b1} {b2} {c1} {c2} {c3} {c4}\n               b1_equiv_b2 c1_equiv_c2 c3_equiv_c4 st st' =\n  (forward, backward)\nwhere forward : ((IFB b1 THEN c1 ELSE c3 FI) / st \\\\ st') ->\n                ((IFB b2 THEN c2 ELSE c4 FI) / st \\\\ st')\n      forward (E_IfTrue prf rel) = E_IfTrue (trans (sym $ b1_equiv_b2 st) prf)\n                                            (fst (c1_equiv_c2 st st') rel)\n      forward (E_IfFalse prf rel) = E_IfFalse (trans (sym $ b1_equiv_b2 st) prf)\n                                              (fst (c3_equiv_c4 st st') rel)\n      backward : ((IFB b2 THEN c2 ELSE c4 FI) / st \\\\ st') ->\n                 ((IFB b1 THEN c1 ELSE c3 FI) / st \\\\ st')\n      backward (E_IfTrue prf rel) = E_IfTrue (trans (b1_equiv_b2 st) prf)\n                                             (snd (c1_equiv_c2 st st') rel)\n      backward (E_IfFalse prf rel) = E_IfFalse (trans (b1_equiv_b2 st) prf)\n                                               (snd (c3_equiv_c4 st st') rel)\n\ncIf1_congruence : BEquiv b1 b2 -> CEquiv c1 c2 ->\n                  CEquiv (CIf1 b1 c1) (CIf1 b2 c2)\ncIf1_congruence b_equiv c_equiv =\n  trans_cequiv\n    (trans_cequiv if1_if_equiv\n                  (cIf_congruence b_equiv c_equiv (refl_cequiv {c=SKIP})))\n    (sym_cequiv if1_if_equiv)\n\ncongruence_example : CEquiv\n  (do X ::= 0\n      IFB X == 0\n          THEN Y ::= 0\n          ELSE Y ::= 42\n      FI)\n  (do X ::= 0\n      IFB X == 0\n          THEN Y ::= X - X\n          ELSE Y ::= 42\n      FI)\ncongruence_example =\n  cSeq_congruence refl_cequiv\n                  (cIf_congruence refl_bequiv statements_equiv refl_cequiv)\nwhere forward : ((Y ::= 0) / st \\\\ st') ->\n                ((Y ::= X - X) / st \\\\ st')\n      forward {st} (E_Ass prf) = E_Ass $ trans (sym $ minusZeroN (st X)) prf\n      backward : ((Y ::= X - X) / st \\\\ st') ->\n                 ((Y ::= 0) / st \\\\ st')\n      backward {st} (E_Ass prf) = rewrite minusZeroN (st X)\n                                  in rewrite prf\n                                  in E_Ass Refl\n      statements_equiv : CEquiv (Y ::= 0) (Y ::= X - X)\n      statements_equiv _ _ = (forward, backward)\n\nATransSound : (atrans : AExp -> AExp) -> Type\nATransSound atrans = (a : AExp) -> AEquiv a (atrans a)\n\nBTransSound : (btrans : BExp -> BExp) -> Type\nBTransSound btrans = (b : BExp) -> BEquiv b (btrans b)\n\nCTransSound : (ctrans : Com -> Com) -> Type\nCTransSound ctrans = (c : Com) -> CEquiv c (ctrans c)\n", "meta": {"hexsha": "4b499c3b667715261faac603163011ddd45b8cdb", "size": 18764, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Equiv.idr", "max_stars_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_stars_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "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": "Equiv.idr", "max_issues_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_issues_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Equiv.idr", "max_forks_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_forks_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "max_forks_repo_licenses": ["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.2660944206, "max_line_length": 80, "alphanum_fraction": 0.5633127265, "num_tokens": 6217, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7279754371026367, "lm_q2_score": 0.7341195327172402, "lm_q1q2_score": 0.5344209877154164}}
{"text": "import Data.Vect\n\nmaryInVector : Elem \"Mary\" [\"Peter\", \"Paul\", \"Mary\"]\nmaryInVector = There (There Here)\n\nelemOfEmptyAbsurd : Elem a [] -> Void\nelemOfEmptyAbsurd Here impossible\nelemOfEmptyAbsurd (There _) impossible\n\nremoveElem : (elem : a) -> (v : Vect (S n) a) -> Elem elem v -> Vect n a\nremoveElem elem (elem :: xs) Here = xs\nremoveElem {n = Z} elem (x :: []) (There later) = absurd later\nremoveElem {n = (S k)} elem (x :: xs) (There later) = x :: removeElem elem xs later\n\nremoveElem_auto : (value : a) -> (xs : Vect (S n) a) -> {auto prf : Elem value xs} -> Vect n a\nremoveElem_auto value xs {prf} = removeElem value xs prf\n\nisElem' : DecEq a => (elem : a) -> (v : Vect n a) -> Dec (Elem elem v)\nisElem' elem [] = No absurd\nisElem' elem (x :: xs) = case decEq elem x of\n                              (Yes Refl) => Yes Here\n                              (No contraHead) => case isElem' elem xs of\n                                                      (Yes prf) => Yes (There prf)\n                                                      (No contraTail) => No (\\prf => (case prf of\n                                                                                           Here => contraHead Refl\n                                                                                           (There later) => contraTail later))\n\ndata ListElem : a -> List a -> Type where\n  Here : ListElem x (x :: ys)\n  There : ListElem x xs -> ListElem x (y :: xs)\n\ndata Last : List a -> a -> Type where\n  LastOne : Last [a] a\n  LastCons : Last as a -> Last (x :: as) a\n\nnoLastElemForEmptyList : Last [] a -> Void\nnoLastElemForEmptyList LastOne impossible\nnoLastElemForEmptyList (LastCons _) impossible\n\nisLast : DecEq a => (xs : List a) -> (elem : a) -> Dec (Last xs elem)\nisLast [] elem = No noLastElemForEmptyList\nisLast [e] elem = case decEq elem e of\n                       (Yes Refl) => Yes LastOne\n                       (No contra) => No (\\prf => (case prf of\n                                                        LastOne => contra Refl\n                                                        (LastCons x) => noLastElemForEmptyList x))\nisLast (_ :: y :: ys) elem = case isLast (y::ys) elem of\n                               (Yes prf) => Yes $ LastCons prf\n                               (No contra) => No (\\prf => (case prf of\n                                                                (LastCons x) => contra x)) \n\n\n", "meta": {"hexsha": "35a6b2d965cac571d0815346a62a3fd7da05b927", "size": 2412, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "removeElem.idr", "max_stars_repo_name": "GustavoMF31/TDDwithIdrisExercises", "max_stars_repo_head_hexsha": "22b7c2802e1d8fd102a5b9b70d024205b3f35a74", "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": "removeElem.idr", "max_issues_repo_name": "GustavoMF31/TDDwithIdrisExercises", "max_issues_repo_head_hexsha": "22b7c2802e1d8fd102a5b9b70d024205b3f35a74", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "removeElem.idr", "max_forks_repo_name": "GustavoMF31/TDDwithIdrisExercises", "max_forks_repo_head_hexsha": "22b7c2802e1d8fd102a5b9b70d024205b3f35a74", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.5094339623, "max_line_length": 126, "alphanum_fraction": 0.4755389718, "num_tokens": 609, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7279754371026367, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.5344209792460669}}
{"text": "||| Lambductive core calculus\nmodule Lambductive.Core\n\n%default total\n\ndata Context : Type\n\ndata TypeTerm : Context -> Type\n\ninfixl 7 :::\n\n||| De Bruijn variable context\ndata Context : Type where\n  Nil : Context\n  ||| Add a variable to a context\n  ||| @type The type of the variable\n  (:::) : (context : Context) -> (type : TypeTerm context) -> Context\n\n||| Judgment of whether the interpretation of a term as a type code is reducible\ndata InterpretReducibility : Type where\n  InterpretReducible : InterpretReducibility\n  InterpretIrreducible : InterpretReducibility\n\ndata ValueTerm : (context : Context) -> TypeTerm context -> InterpretReducibility -> Type\n\n||| Types of the calculus\ndata TypeTerm : Context -> Type where\n  ||| A universe of type codes\n  U : (level : Nat) -> TypeTerm context\n  ||| Dependent function type\n  Pi : (domain : TypeTerm context) -> (codomain : TypeTerm (context ::: domain)) -> TypeTerm context\n  ||| An irreducible application of the type code interpretation operator\n  |||\n  ||| Use the `interpret` function to interpret type codes without any concern for reducibility\n  IrreducibleInterpret : ValueTerm context (U level) InterpretIrreducible -> TypeTerm context\n\n||| Bring a type into a context with an extra variable at the head\naddVarToType : TypeTerm context -> TypeTerm (context ::: type)\n\n||| An index into a context\n||| @type The type of the variable at that index\ndata ContextIndex : (context : Context) -> (type : TypeTerm context) -> Type where\n  Z : ContextIndex (_ ::: type) (addVarToType type)\n  S : ContextIndex context type -> ContextIndex (context ::: type') (addVarToType type)\n\n||| Interpret a type code to a type\ninterpret : ValueTerm context (U _) _ -> TypeTerm context\n\n||| Values of the calculus\ndata ValueTerm : (context : Context) -> TypeTerm context -> InterpretReducibility -> Type where\n  Var : ContextIndex context type -> ValueTerm context type InterpretIrreducible\n\ninterpret (Var idx) = IrreducibleInterpret (Var idx)\n\n||| An offset into a context\ndata ContextOffset : Context -> Type where\n  OffZ : ContextOffset context\n  OffS : ContextOffset context -> ContextOffset (context ::: type)\n\n||| Drop some variables from a context\ndrop : (context : Context) -> ContextOffset context -> Context\ndrop context OffZ = context\ndrop (context ::: _) (OffS off) = drop context off\n\n||| Insert a variable into a context at a given offset\n||| @type The type of the variable\ninsertAt : (context : Context) -> (off : ContextOffset context) -> (type : TypeTerm (drop context off)) -> Context\n\n||| Bring a type into a context with an extra variable at a given offset\naddVarToTypeAtOffset : (off : ContextOffset context) -> TypeTerm context -> TypeTerm (insertAt context off type)\n\ninsertAt context OffZ type = context ::: type\ninsertAt (context ::: type) (OffS off) type' = insertAt context off type' ::: addVarToTypeAtOffset off type\n\n||| Bring a type code into a context with an extra variable at a given offset\naddVarToCodeAtOffset : (off : ContextOffset context) -> ValueTerm context (U level) interpretReducible -> ValueTerm (insertAt context off type') (U level) interpretReducible\n\naddVarToTypeAtOffset _ (U level) = U level\naddVarToTypeAtOffset off (Pi domain codomain) = Pi (addVarToTypeAtOffset off domain) (addVarToTypeAtOffset (OffS off) codomain)\naddVarToTypeAtOffset off (IrreducibleInterpret code) = IrreducibleInterpret (addVarToCodeAtOffset off code)\n\naddVarToType type = addVarToTypeAtOffset OffZ type\n\n||| Bring a value into a context with an extra variable at a given offset\naddVarToValueAtOffset : (off : ContextOffset context) -> ValueTerm context type interpretReducible -> ValueTerm (insertAt context off type') (addVarToTypeAtOffset off type) interpretReducible\naddVarToValueAtOffset OffZ (Var idx) = Var (S idx)\naddVarToValueAtOffset (OffS off) (Var idx) = ?hole\n\naddVarToCodeAtOffset off code = addVarToValueAtOffset off code\n", "meta": {"hexsha": "e72f2e01085612a90a5857bf16638af85445bade", "size": 3900, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Lambductive/Core.idr", "max_stars_repo_name": "shlevy/lambductive", "max_stars_repo_head_hexsha": "0aa651657cf552d39148c5224fe9f0a003fc75c1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2015-11-24T00:48:02.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-28T10:56:58.000Z", "max_issues_repo_path": "Lambductive/Core.idr", "max_issues_repo_name": "shlevy/lambductive", "max_issues_repo_head_hexsha": "0aa651657cf552d39148c5224fe9f0a003fc75c1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Lambductive/Core.idr", "max_forks_repo_name": "shlevy/lambductive", "max_forks_repo_head_hexsha": "0aa651657cf552d39148c5224fe9f0a003fc75c1", "max_forks_repo_licenses": ["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.3333333333, "max_line_length": 191, "alphanum_fraction": 0.7474358974, "num_tokens": 996, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8633916099737806, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.534249834910377}}
{"text": "\n\nNatOrError : Nat -> Type \nNatOrError Z = String \nNatOrError (S k) = Nat\n\ndivide : (x:Nat) -> (y:Nat) -> NatOrError y\ndivide x Z = \"Error: Division by zero\" \ndivide x (S k) = div x (S k)\n\n", "meta": {"hexsha": "ed969423eb67c0069f7e04d242a38329a8418668", "size": 189, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "division_solution.idr", "max_stars_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_stars_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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": "division_solution.idr", "max_issues_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_issues_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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": "division_solution.idr", "max_forks_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_forks_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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.1818181818, "max_line_length": 43, "alphanum_fraction": 0.6137566138, "num_tokens": 70, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8791467738423873, "lm_q2_score": 0.6076631698328916, "lm_q1q2_score": 0.5342251153414254}}
{"text": "-- Copyright (c) 2017, Matthew Morris\n--\n-- Permission to use, copy, modify, and/or distribute this software for any\n-- purpose with or without fee is hereby granted, provided that the above\n-- copyright notice and this permission notice appear in all copies.\n--\n-- THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nmodule Main \n\nfizzbuzz : Integer -> String \nfizzbuzz n with (mod n 3, mod n 5)\n  fizzbuzz n | (0, 0) = \"fizzbuzz\" \n  fizzbuzz n | (0, _) = \"fizz\"\n  fizzbuzz n | (_, 0) = \"buzz\"\n  fizzbuzz n | _ = show n \n\nmain : IO ()\nmain =\n  traverse_ putStrLn $ map fizzbuzz [1..100]\n", "meta": {"hexsha": "ffc13ac5244d8dfd5c3d5b97369ed7434a082c7f", "size": 1041, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris/fizzbuzz-with.idr", "max_stars_repo_name": "serpent7776/fizzbuzz", "max_stars_repo_head_hexsha": "092600ba22ef4efb097d64a875e7b2bec05aad99", "max_stars_repo_licenses": ["0BSD"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2018-03-25T20:44:46.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-15T15:44:50.000Z", "max_issues_repo_path": "idris/fizzbuzz-with.idr", "max_issues_repo_name": "serpent7776/fizzbuzz", "max_issues_repo_head_hexsha": "092600ba22ef4efb097d64a875e7b2bec05aad99", "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": "idris/fizzbuzz-with.idr", "max_forks_repo_name": "serpent7776/fizzbuzz", "max_forks_repo_head_hexsha": "092600ba22ef4efb097d64a875e7b2bec05aad99", "max_forks_repo_licenses": ["0BSD"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2020-02-18T14:12:32.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-01T19:19:11.000Z", "avg_line_length": 38.5555555556, "max_line_length": 75, "alphanum_fraction": 0.7252641691, "num_tokens": 263, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7401743505760728, "lm_q2_score": 0.7217432062975979, "lm_q1q2_score": 0.5342158090040171}}
{"text": "module Main\n\ncorecord Str a where -- Current stream is codata, not a corecord\n  constructor (::)\n  head : a\n  tail : Str a\n\nimplementation Functor Str where\n  map f (x :: xs) = (f x) :: (map f xs)\n\ntotal -- marked total to check that corecords are indeed treated as coinductive types\nzeros : Str Int\nzeros = 0 :: zeros\n\nones : Str Int\nones = map (1+) zeros\n\nmain : IO ()\nmain = do let x = record { head = 1 } zeros\n          printLn $ head zeros\n          printLn $ head x\n          printLn $ head (record { head = 3 } x)\n          printLn $ head (tail ones)\n          printLn $ head (tail (record { tail = zeros } ones))\n", "meta": {"hexsha": "d76ae940a61961b5d7305c0434d16472d04c245b", "size": 622, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/corecords001/corecords001.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/corecords001/corecords001.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/corecords001/corecords001.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 24.88, "max_line_length": 85, "alphanum_fraction": 0.6093247588, "num_tokens": 176, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8244619263765707, "lm_q2_score": 0.647798211152541, "lm_q1q2_score": 0.5340849610701205}}
{"text": "module Door\n\npublic export\ndata Usage = Once | Many\n\npublic export\ndata Lin : (Type -> Type) -> Usage -> Type -> Type where\n     Pure : (1 x :   a) -> Lin m u a\n     Lift : (1 x : m a) -> Lin m Many a\n     BindOnce : (1 act : Lin m Once a) ->\n                (1 k : (1 x : a) -> Lin m t b) -> Lin m t b\n     BindMany : (1 act : Lin m Many a) ->\n                (1 k : (x : a) -> Lin m t b) -> Lin m t b\n\npublic export\ndata Unrestricted : Type -> Type where\n     MkUn : (x : a) -> Unrestricted a\n\nexport\npure : (1 x : a) -> Lin m u a\npure = Pure\n\nexport\nlift : (1 x : m a) -> Lin m Many a\nlift = Lift\n\npublic export\ncontType : (Type -> Type) -> Usage -> Usage -> Type -> Type -> Type\ncontType m Once q a b = (1 x : a) -> Lin m q b\ncontType m Many q a b = (x : a) -> Lin m q b\n\npublic export\n(>>=) : {p : _} \n     -> (1 f : Lin m p a) \n     -> (1 k : contType m p q a b) \n     -> Lin m q b\n(>>=) {p=Once} = BindOnce\n(>>=) {p=Many} = BindMany\n\nexport\nrun : Monad m => Lin m u t -> m t\nrun (Pure x) = pure x\nrun (Lift p) = p\nrun (BindOnce act k)\n    = do act' <- run act\n         run (k act')\nrun (BindMany act k)\n    = do act' <- run act\n         run (k act')\n\npublic export\nOne : (Type -> Type) -> Type -> Type\nOne m = Lin m Once\n\npublic export\nAny : (Type -> Type) -> Type -> Type\nAny m = Lin m Many\n\ndata DoorState = Closed | Open\n\n-- changes start here\n\nopenWhen : Bool -> DoorState\nopenWhen ok = if ok then Open else Closed\n\ndata Door : DoorState -> Type where\n  MkDoor : (isOpen : Bool) -> Door (if isOpen then Open else Closed)\n\n-- Testing that 'if' works okay in an interface\ninterface Doored (m : Type -> Type) where\n    newDoor    : One m (Door Closed)\n    knock      : (1 d : Door t)      -> One m (Door t)\n    openDoor   : (1 d : Door Closed) \n             ->  One m (Res Bool (\\ok => Door (if ok then Open else Closed)))\n    closeDoor  : (1 d : Door Open)   -> One m (Door Closed)\n    deleteDoor : (1 d : Door Closed) -> Any m ()\n", "meta": {"hexsha": "bac817a088ff2760bfd16a239833e85dd7f4380b", "size": 1940, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/linear008/Door.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/linear008/Door.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/linear008/Door.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.1948051948, "max_line_length": 77, "alphanum_fraction": 0.5463917526, "num_tokens": 642, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677506936878, "lm_q2_score": 0.6297746074044134, "lm_q1q2_score": 0.5340285572847208}}
{"text": "module Main\n\n-- base\nimport Data.List\nimport System.File\n\n-- contrib\nimport Text.Parser\nimport Text.Parser.Core\n\ndata Direction = East\n               | SouthEast\n               | SouthWest\n               | West\n               | NorthEast\n               | NorthWest\n\nEq Direction where\n  (==) East East = True\n  (==) SouthEast SouthEast = True\n  (==) SouthWest SouthWest = True\n  (==) West West = True\n  (==) NorthEast NorthEast = True\n  (==) NorthWest NorthWest = True\n  (==) _ _ = False\n\nShow Direction where\n  show East = \"East\"\n  show SouthEast = \"SouthEast\"\n  show SouthWest = \"SouthWest\"\n  show West = \"West\"\n  show NorthEast = \"NorthEast\"\n  show NorthWest = \"NorthWest\"\n\nnamespace Grammar\n  eastWestGrammar : Grammar Char True Direction\n  eastWestGrammar = terminal \"Can't parse East\" $ \\ x =>\n                    case x of\n                         'e' => Just East\n                         'w' => Just West\n                         _ => Nothing\n\n  northGrammar : Grammar Char True Direction\n  northGrammar = terminal \"Can't parse North\" checkN *> terminal \"Can't parse North-?\" checkEW where\n    checkN : Char -> Maybe ()\n    checkN 'n' = Just ()\n    checkN _ = Nothing\n\n    checkEW : Char -> Maybe Direction\n    checkEW 'e' = Just NorthEast\n    checkEW 'w' = Just NorthWest\n    checkEW _ = Nothing\n\n  southGrammar : Grammar Char True Direction\n  southGrammar = terminal \"Can't parse South\" checkS *> terminal \"Can't parse South-?\" checkEW where\n    checkS : Char -> Maybe ()\n    checkS 's' = Just ()\n    checkS _ = Nothing\n\n    checkEW : Char -> Maybe Direction\n    checkEW 'e' = Just SouthEast\n    checkEW 'w' = Just SouthWest\n    checkEW _ = Nothing\n\n  directionGrammar : Grammar Char True Direction\n  directionGrammar = eastWestGrammar <|> northGrammar <|> southGrammar\n\n  directionsGrammar : Grammar Char True (List Direction)\n  directionsGrammar = many directionGrammar <* terminal \"Can't parse newline\" checkNewline where\n    checkNewline : Char -> Maybe ()\n    checkNewline '\\n' = Just ()\n    checkNewline _ = Nothing\n\n  export\n  dataGrammar : Grammar Char False (List (List Direction))\n  dataGrammar = many directionsGrammar <* eof\n\nrecord HexVector where\n  constructor MkHexVector\n  east, southeast, southwest : Integer\n\nEq HexVector where\n  (==) (MkHexVector x y z) (MkHexVector x' y' z') = x == x' && y == y' && z == z'\n\nShow HexVector where\n  show (MkHexVector east southeast southwest) = \"HexVector \" ++ show east ++ \" \" ++ show southeast ++ \" \" ++ show southwest\n\nnamespace HexVector\n  succ : Integer -> Integer\n  succ = (+ 1)\n\n  pred : Integer -> Integer\n  pred x = x - 1\n\n  export\n  toHexVector : List Direction -> HexVector\n  toHexVector [] = MkHexVector 0 0 0\n  toHexVector (East :: xs) = record { east $= succ } (toHexVector xs)\n  toHexVector (SouthEast :: xs) = record { southeast $= succ } (toHexVector xs)\n  toHexVector (SouthWest :: xs) = record { southwest $= succ } (toHexVector xs)\n  toHexVector (West :: xs) = record { east $= pred } (toHexVector xs)\n  toHexVector (NorthEast :: xs) = record { southwest $= pred } (toHexVector xs)\n  toHexVector (NorthWest :: xs) = record { southeast $= pred } (toHexVector xs)\n\nrecord Coordinate where\n  constructor MkCoordinate\n  xCoord, yCoord : Integer\n\nEq Coordinate where\n  (==) (MkCoordinate x y) (MkCoordinate x' y') = x == x' && y == y'\n\nShow Coordinate where\n  show (MkCoordinate x y) = \"Coordinate \" ++ show x ++ \" \" ++ show y\n\ntoCoordinate : HexVector -> Coordinate\ntoCoordinate (MkHexVector east southeast southwest) = MkCoordinate x y where\n  x : Integer\n  x = 2 * east + southeast - southwest\n  y : Integer\n  y = southeast + southwest\n\nnamespace countElements\n  -- removes duplicates\n  export\n  elements : Eq a => List a -> List a -> List a\n  elements [] acc = acc\n  elements (x :: xs) acc with (find (== x) acc)\n    elements (x :: xs) acc | Nothing = elements xs (x :: acc)\n    elements (x :: xs) acc | (Just _) = elements xs acc\n\n  occurrences : Eq a => a -> List a -> Nat\n  occurrences x [] = Z\n  occurrences x (y :: xs) with (x == y)\n    occurrences x (y :: xs) | True = S $ occurrences x xs\n    occurrences x (y :: xs) | False = occurrences x xs\n\n  export\n  countElements : List Coordinate -> List (Coordinate,Nat)\n  countElements xs = f <$> elements xs [] where\n    f : Coordinate -> (Coordinate,Nat)\n    f x = (x,occurrences x xs)\n\nmutual\n  even : Nat -> Bool\n  even Z = True\n  even (S k) = odd k\n\n  odd : Nat -> Bool\n  odd Z = False\n  odd (S k) = even k\n\nadjacentCoordinates : Coordinate -> List Coordinate\nadjacentCoordinates (MkCoordinate xCoord yCoord) =\n  [ MkCoordinate (xCoord - 2) yCoord\n  , MkCoordinate (xCoord + 2) yCoord\n  , MkCoordinate (xCoord - 1) (yCoord + 1)\n  , MkCoordinate (xCoord - 1) (yCoord - 1)\n  , MkCoordinate (xCoord + 1) (yCoord + 1)\n  , MkCoordinate (xCoord + 1) (yCoord - 1)\n  ]\n\n-- adjacent to: c, list of blacks: cs\ncountAdjacentBlacks : Coordinate -> List Coordinate -> Nat\ncountAdjacentBlacks c cs = length $ filter id (f <$> adjacentCoordinates c) where\n  f : Coordinate -> Bool\n  f adjC = case find (== adjC) cs of\n                Nothing => False\n                (Just _) => True\n\nblacksToWhites : List Coordinate -> List Coordinate\nblacksToWhites blacks = elements (foldr f prepWhites blacks) [] where\n  prepWhites : List Coordinate\n  prepWhites = concat $ adjacentCoordinates <$> blacks\n  f : Coordinate -> List Coordinate -> List Coordinate\n  f c cs = filter (/= c) cs\n\nflipOnce : List Coordinate -> List Coordinate\nflipOnce blacks = newBlacks where\n  whites : List Coordinate\n  whites = blacksToWhites blacks\n  blacksWithAdjacentBlacks : List (Coordinate,Nat)\n  blacksWithAdjacentBlacks = (\\ c => (c,countAdjacentBlacks c blacks)) <$> blacks\n  whitesWithAdjacentBlacks : List (Coordinate,Nat)\n  whitesWithAdjacentBlacks = (\\ c => (c,countAdjacentBlacks c blacks)) <$> whites\n  newBlacks : List Coordinate\n  newBlacks = elements (map fst (filter (\\ (_,n) => not (n == 0 || n > 2)) blacksWithAdjacentBlacks ++ filter (\\ (_,n) => n == 2) whitesWithAdjacentBlacks)) []\n\nflipTimes : Nat -> List Coordinate -> List Coordinate\nflipTimes 0 cs = cs\nflipTimes (S n) cs = flipTimes n $ flipOnce cs\n\nmain : IO ()\nmain = do\n  inputData <- readFile \"./data\"\n  case inputData of\n       Left err => print err\n       Right dat => do\n         let tokenList = unpack dat\n             directions = parse dataGrammar tokenList\n         case directions of\n              (Left (Error err _)) => putStrLn err\n              (Right (ds,cs)) => do\n                --print ds\n                let vecs = toHexVector <$> ds\n                --print vecs\n                let coords = toCoordinate <$> vecs\n                --print coords\n                let counts = countElements coords\n                    flips = snd <$> counts\n                    countBlacks = length $ filter odd flips\n                --print countBlacks\n                -- part 2\n                let blackCountsOdd = filter (\\ (_,c) => odd c) counts\n                    blacks = fst <$> blackCountsOdd\n                    newBlacks = flipTimes 100 blacks\n                    countNewBlacks = length newBlacks\n                print countNewBlacks\n         pure ()\n  pure ()\n", "meta": {"hexsha": "44e69075661d9f2f3573ddf4e2e8187ddbc97943", "size": 7144, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "24/Main.idr", "max_stars_repo_name": "jumper149/AoC2020", "max_stars_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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": "24/Main.idr", "max_issues_repo_name": "jumper149/AoC2020", "max_issues_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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": "24/Main.idr", "max_forks_repo_name": "jumper149/AoC2020", "max_forks_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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.4727272727, "max_line_length": 159, "alphanum_fraction": 0.625699888, "num_tokens": 1923, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7745833737577159, "lm_q2_score": 0.6893056167854461, "lm_q1q2_score": 0.533924670199814}}
{"text": "module Control.Monad.Ideal\n\n%access public\n%default total\n\ndata Ideal : (Type -> Type) -> Type -> Type where\n  P : {f : Type -> Type} -> a -> Ideal f a\n  I : {f : Type -> Type} -> (f a) -> Ideal f a\n\nclass Functor f => Mu' (f : Type -> Type) where\n  mu' : f (Ideal f a) -> f a\n\ninstance Mu' f => Functor (Ideal f) where\n  map g (P a) = P $ g a\n  map g (I fa) = I $ map g fa\n\ninstance Mu' f => Applicative (Ideal f) where\n  pure a = P a\n  (P g) <$> x = map g x\n  (I fg) <$> (P a) = I $ mu' $ map (\\k => P $ k a) fg\n  (I fg) <$> (I fa) = I $ mu' $ map (\\k => I $ map k fa) fg\n\n\ninstance Mu' f => Monad (Ideal f) where\n  (P a) >>= k = k a\n  (I fa) >>= k = I $ mu' $ map k fa\n\n", "meta": {"hexsha": "4bfc3b3e5e19cfd960a2868dbf930ce9a9481abf", "size": 673, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Control/Monad/Ideal.idr", "max_stars_repo_name": "seagull-kamome/idris-toy", "max_stars_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-06-04T16:11:33.000Z", "max_stars_repo_stars_event_max_datetime": "2016-06-04T16:11:33.000Z", "max_issues_repo_path": "Control/Monad/Ideal.idr", "max_issues_repo_name": "seagull-kamome/idris-toy", "max_issues_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "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": "Control/Monad/Ideal.idr", "max_forks_repo_name": "seagull-kamome/idris-toy", "max_forks_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "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": 24.0357142857, "max_line_length": 59, "alphanum_fraction": 0.5037147103, "num_tokens": 260, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392756357326, "lm_q2_score": 0.6039318337259584, "lm_q1q2_score": 0.5338994608204559}}
{"text": "module Main\n\nimport Data.Vect\nimport Control.ST\nimport Control.ST.ImplicitCall\nimport TicTacToe\n\nstart : ST m Var [add (State (Game Start InPlay))]\nstart = do game <- new initGame\n           pure game\n\nstatus : (game : Var) -> ST m GameState [game ::: State (Game b st)]\nstatus game = pure $ currentStatus !(read game)\n\ngrid : (game : Var) -> ST m Grid [game ::: State (Game b st)]\ngrid game = pure $ currentGrid !(read game)\n\nboard : {b : Board g p turn} -> (game : Var) -> ST m (Board g p turn) [game ::: State (Game b st)]\nboard game = pure $ currentBoard !(read game)\n\nmove : {b : Board g p turn}\n    -> (pos : Position)\n    -> (game : Var)\n    -> {auto prf : Empty pos g}\n    -> ST m GameState [game ::: State (Game b InPlay) :->\n                          (\\st' => State (Game (Turn pos b {prf = prf}) st'))]\nmove pos game = do g <- read game\n                   let (st' ** g') = move pos g\n                   write game g'\n                   pure st'\n\ninputPosition : ConsoleIO m => ST m (Maybe Position) []\ninputPosition = do putStr \"Input x position: \"\n                   x <- inputNat\n                   putStr \"Input y position: \"\n                   y <- inputNat\n                   pure [MkPair px py | x' <- x, y' <- y, px <- natToFin x' 3, py <- natToFin y' 3]\n  where\n    inputNat : ConsoleIO m => ST m (Maybe Nat) []\n    inputNat = do input <- getStr\n                  if all isDigit (unpack input)\n                     then pure . Just . cast $ input\n                     else pure Nothing\n\ninputPosLoop : ConsoleIO m => ST m Position []\ninputPosLoop = do Just pos <- inputPosition\n                    | Nothing => do putStrLn \"Bad input\"\n                                    inputPosLoop\n                  pure pos\n\nExistBoard : Type\nExistBoard = (g : Grid ** p : Player ** turn : Nat ** Board g p turn)\n\nWholeGame : (ExistBoard, EndState) -> Type\nWholeGame ((_ ** _ ** _ ** b), res) = State (Game b (Ended res))\n\nloop : ConsoleIO m\n    => (game : Var)\n    -> {b : Board g p turn}\n    -> ST m (ExistBoard, EndState)\n            [game ::: State (Game b InPlay) :-> WholeGame]\nloop game {b} {g} = do putStrLn $ Grid.show g\n                       pos <- inputPosLoop\n                       case isEmpty pos g of\n                            Yes prf => do InPlay <- move pos game\n                                            | Ended end => pure ((_ ** _ ** _ ** _), end)\n                                          loop game\n                            No contra => do putStrLn \"Position already occupied\"\n                                            loop game\n\nmain : IO ()\nmain = run $ do game <- start\n                ((g ** _ ** _ ** b), res) <- loop game\n                putStrLn $ Grid.show g\n                case res of\n                     Draw => do putStrLn \"DRAW!\"\n                                delete game\n                     Won p => do print p\n                                 putStrLn \" is the WINNER!\"\n                                 delete game\n", "meta": {"hexsha": "8ba88cffced7f99508133ef2fc472223a4c402d3", "size": 2973, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Main.idr", "max_stars_repo_name": "ShinKage/DT-TicTacToe", "max_stars_repo_head_hexsha": "c5faa476a6d54f3d224d777b6983b08eaddd1d6f", "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": "Main.idr", "max_issues_repo_name": "ShinKage/DT-TicTacToe", "max_issues_repo_head_hexsha": "c5faa476a6d54f3d224d777b6983b08eaddd1d6f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Main.idr", "max_forks_repo_name": "ShinKage/DT-TicTacToe", "max_forks_repo_head_hexsha": "c5faa476a6d54f3d224d777b6983b08eaddd1d6f", "max_forks_repo_licenses": ["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.7037037037, "max_line_length": 99, "alphanum_fraction": 0.4746047763, "num_tokens": 706, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8152324983301568, "lm_q2_score": 0.6548947290421276, "lm_q1q2_score": 0.5338914661002648}}
{"text": "> module FastSimpleProb.MeasuresProperties\n\n> import Data.So\n> import Syntax.PreorderReasoning\n\n> import FastSimpleProb.SimpleProb\n> import FastSimpleProb.BasicOperations\n> import FastSimpleProb.MonadicOperations\n> import FastSimpleProb.MonadicPostulates\n> import FastSimpleProb.MonadicProperties\n> import FastSimpleProb.Predicates\n> import FastSimpleProb.Functor\n> import FastSimpleProb.Measures\n> import Double.Predicates\n> import NonNegDouble.NonNegDouble\n> import NonNegDouble.Predicates\n> import NonNegDouble.BasicOperations\n> import NonNegDouble.Operations\n> import NonNegDouble.Properties\n> import NonNegDouble.Measures\n> import NonNegDouble.LTEProperties\n> import List.Operations\n> import List.Properties\n> import Fun.Operations\n> import Rel.TotalPreorder\n> import Pairs.Operations\n> import Functor.Predicates\n> import Functor.Properties\n\n> %default total\n> %access public export\n> %auto_implicits off\n\n\n* Monotonicity (of |SimpleProb| measures):\n\n> ||| Monotonicity\n> Monotone : (SimpleProb NonNegDouble -> NonNegDouble) -> Type\n> Monotone = Functor.Predicates.Monotone {B = NonNegDouble} {C = NonNegDouble} {F = SimpleProb} LTE LTE \n\n\n\n* General monotonicity results\n\n> ||| |monotoneNaturalLemma| for |SimpleProb|s\n> normalizePreservesMonotonicity : (m : SimpleProb NonNegDouble -> NonNegDouble) -> \n>                                  Monotone m -> \n>                                  Monotone (m . normalize)\n> normalizePreservesMonotonicity m mm = \n>   monotoneNaturalLemma {B = NonNegDouble} {C = NonNegDouble} {F = SimpleProb} \n>                        LTE LTE m mm normalize naturalNormalize\n\n\n* Monotonicity of measures\n\n> using implementation NumNonNegDouble\n>   ||| |(uncurry (*)) . (cross f id)| is monotone\n>   monotoneUncurryMultCrossId : {A : Type} ->\n>                                (f : A -> NonNegDouble) -> (g : A -> NonNegDouble) ->\n>                                (p : (a : A) -> f a `LTE` g a) ->\n>                                (ap : (A, NonNegDouble)) ->\n>                                uncurry (*) ((cross f id) ap) `LTE` uncurry (*) ((cross g id) ap)\n>   monotoneUncurryMultCrossId {A} f g p (a, x) = s3 where\n>     s1 : f a `LTE` g a\n>     s1 = p a\n>     s2 : (f a) * x `LTE` (g a) * x\n>     s2 = monotoneMultLTE s1 (reflexiveLTE x)\n>     s3 : uncurry (*) ((cross f id) (a, x)) `LTE` uncurry (*) ((cross g id) (a, x))\n>     s3 = s2\n\n> using implementation NumNonNegDouble\n>   ||| |sum| is monotone\n>   monotoneSum : Monotone sum\n>   monotoneSum = ms where\n>     ms  : {A : Type} ->\n>           (f : A -> NonNegDouble) -> \n>           (g : A -> NonNegDouble) -> \n>           (p : (a : A) -> f a `LTE` g a) -> \n>           (sp : SimpleProb A) -> \n>           sum (map f sp) `LTE` sum (map g sp)\n>     ms {A} f g p sp = s6 where        \n>       f'  : (A, NonNegDouble) -> NonNegDouble\n>       f'  = uncurry (*) . (cross f id)\n>       g'  : (A, NonNegDouble) -> NonNegDouble\n>       g'  = uncurry (*) . (cross g id)\n>       p'  : (ap : (A, NonNegDouble)) -> f' ap `LTE` g' ap\n>       p'  = monotoneUncurryMultCrossId f g p \n>       aps : List (A, NonNegDouble)\n>       aps = toList sp\n>       s1  : Prelude.Foldable.sum (map f' aps) `LTE` Prelude.Foldable.sum (map g' aps)\n>       s1  = monotoneSum {A = (A, NonNegDouble)} f' g' p' aps \n>       s2  : map f' aps = map (uncurry (*)) (toList (fmap f sp))\n>       s2  = ( map f' aps )\n>           ={ Refl }=\n>             ( map ((uncurry (*)) . (cross f id)) aps )\n>           ={ sym (mapFusion (uncurry (*)) (cross f id) aps) }=\n>             ( map (uncurry (*)) (fmap (cross f id) aps) )  \n>           ={ cong (sym (toListFmapLemma f sp)) }=\n>             ( map (uncurry (*)) (toList (fmap f sp)) )\n>           QED\n>       s3  : map g' aps = map (uncurry (*)) (toList (fmap g sp))\n>       s3  = ( map g' aps )\n>           ={ Refl }=\n>             ( map ((uncurry (*)) . (cross g id)) aps )\n>           ={ sym (mapFusion (uncurry (*)) (cross g id) aps) }=\n>             ( map (uncurry (*)) (fmap (cross g id) aps) )  \n>           ={ cong (sym (toListFmapLemma g sp)) }=\n>            ( map (uncurry (*)) (toList (fmap g sp)) )\n>           QED\n>       s4  : Prelude.Foldable.sum (map (uncurry (*)) (toList (fmap f sp))) `LTE` Prelude.Foldable.sum (map g' aps)\n>       s4  = replace {P = \\ X => Prelude.Foldable.sum X `LTE` (Prelude.Foldable.sum (map g' aps))} s2 s1\n>       s5  : Prelude.Foldable.sum (map (uncurry (*)) (toList (fmap f sp))) `LTE` Prelude.Foldable.sum (map (uncurry (*)) (toList (fmap g sp)))\n>       s5  = replace {P = \\ X => Prelude.Foldable.sum (map (uncurry (*)) (toList (fmap f sp))) `LTE` Prelude.Foldable.sum X} s3 s4\n>       s6  : sum (fmap f sp) `LTE` sum (fmap g sp)\n>       s6  = s5\n\n> ||| |expectedValue| is monotone\n> monotoneExpectedValue : Monotone expectedValue\n> monotoneExpectedValue = normalizePreservesMonotonicity sum monotoneSum\n\n\n> {-\n\n\n> ---}\n", "meta": {"hexsha": "070eba8bd1daf7a78941601570301cce17cdb036", "size": 4864, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "FastSimpleProb/MeasuresProperties.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "FastSimpleProb/MeasuresProperties.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "FastSimpleProb/MeasuresProperties.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 38.6031746032, "max_line_length": 143, "alphanum_fraction": 0.5721628289, "num_tokens": 1562, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8152324803738429, "lm_q2_score": 0.6548947155710234, "lm_q1q2_score": 0.5338914433586878}}
{"text": "import Data.Vect\n\nread_vect_len : (len : Nat) -> IO (Vect len String)\nread_vect_len Z = pure []\nread_vect_len (S k) = do x <- getLine\n                         xs <- read_vect_len k\n                         pure (x :: xs)\n\ndata VectUnknown : Type -> Type where\n  MkVect : (len : Nat) -> Vect len a -> VectUnknown a\n\nread_vect : IO (len ** Vect len String)\nread_vect = do x <- getLine\n               if (x == \"\")\n                  then pure (_ ** [])\n                  else do (_ ** xs) <- read_vect\n                          pure (_ ** x :: xs)\n\n", "meta": {"hexsha": "8828fd4b139254e54d44f59bc439b9a9651c28e5", "size": 545, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "depTypesTests.idr", "max_stars_repo_name": "janschultecom/idris-examples", "max_stars_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-05-05T15:26:06.000Z", "max_stars_repo_stars_event_max_datetime": "2016-05-05T15:26:06.000Z", "max_issues_repo_path": "depTypesTests.idr", "max_issues_repo_name": "janschultecom/idris-examples", "max_issues_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "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": "depTypesTests.idr", "max_forks_repo_name": "janschultecom/idris-examples", "max_forks_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "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.6842105263, "max_line_length": 53, "alphanum_fraction": 0.4733944954, "num_tokens": 135, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8104789086703224, "lm_q2_score": 0.658417500561683, "lm_q1q2_score": 0.5336334973046742}}
{"text": "module Main\n\nimport Data.Fin\nimport Data.Vect\n\n--------------------------------------------------------------------------------\n-- Player\n\ndata Player = X | O | N  -- N means nobody\ninstance Eq Player where\n    X == X = True\n    O == O = True\n    N == N = True\n    _ == _ = False\ninstance Show Player where\n    show X = \"X\"\n    show O = \"O\"\n    show N = \" \"\n\notherPlayer : Player -> Player\notherPlayer p = case p of\n    X => O\n    O => X\n    N => N\n\n--------------------------------------------------------------------------------\n-- BoardSquares (and accessors)\n\nBoardSquares : Type\nBoardSquares = Vect 9 Player\n\nblankBoardSquares : BoardSquares\nblankBoardSquares = [N,N,N,N,N,N,N,N,N]\n\nrows : BoardSquares -> Vect 3 (Vect 3 Player)\nrows [a,b,c,d,e,f,g,h,i] = [[a,b,c],[d,e,f],[g,h,i]]\n\ncols : BoardSquares -> Vect 3 (Vect 3 Player)\ncols sqs = transpose (rows sqs)\n\n--------------------------------------------------------------------------------\n-- Board (and Accessors)\n\nrecord Board : Type where\n    MkBoard : (squares : BoardSquares) ->\n              (whoseTurn : Player) -> Board\n\ninitialBoard : Board\ninitialBoard = MkBoard blankBoardSquares X\n\nBoardLocation : Type\nBoardLocation = Fin 9\n\n{-\n-- TODO: Need to fix type of (+) in the standard library first.\n--       Should be:      (Fin n) -> (Fin m) -> (Fin (n + m - 1))\n--       But is instead: (Fin n) -> (Fin m) -> (Fin (n + m))\nmkBoardLocation : Fin 3 -> Fin 3 -> BoardLocation\nmkBoardLocation x y =\n    (y + y + y) + x\n     3   5   7    9\n -}\n\nsquare : Board -> BoardLocation -> Player\nsquare b loc =\n    index loc (squares b)\n\nisPositionOccupied : Board -> BoardLocation -> Bool\nisPositionOccupied b loc =\n    (square b loc) /= N\n\n--------------------------------------------------------------------------------\n-- winner : BoardSquares -> Maybe Player\n\nallEqTo : Eq t => t -> Vect n t -> Bool\nallEqTo e Nil       = True\nallEqTo e (x :: xs) = if x == e then (allEqTo e xs)\n                                else False\n\nallEq : Eq t => Vect n t -> Bool\nallEq Nil       = True\nallEq (x :: xs) = allEqTo x xs\n\nwinnerInList : Vect (S n') Player -> Maybe Player\nwinnerInList (x :: xs) = \n    let isWinner = allEq (x :: xs) in\n    if isWinner then if x /= N then Just x\n                               else Nothing\n                else Nothing\n\n-- TODO: Surely this is in the standard library...\nfirstJust : Vect n (Maybe t) -> Maybe t\nfirstJust Nil       = Nothing\nfirstJust (m :: ms) =\n    case m of\n        Nothing => firstJust ms\n        Just x  => Just x\n\n-- TODO: Surely this is in the standard library...\nfirstJust' : List (Maybe t) -> Maybe t\nfirstJust' Nil       = Nothing\nfirstJust' (m :: ms) =\n    case m of\n        Nothing => firstJust' ms\n        Just x  => Just x\n\nwinnerRowCol : BoardSquares -> Maybe Player\nwinnerRowCol sqs = firstJust' [firstJust (map winnerInList (rows sqs)),\n                               firstJust (map winnerInList (cols sqs))]\n\nwinnerDiag : BoardSquares -> Maybe Player\nwinnerDiag [a,b,c,d,e,f,g,h,i] = \n    if      a == e && e == i && a /= N then Just a\n    else if c == e && e == g && c /= N then Just c\n                                       else Nothing\n\n{-\n-- TODO: Surely this is in the standard library...\n-- TODO: Figure out why I can't match on Nil. Compile error.\n-- TODO: Rename \"eType\" to \"E\" without confusing the compiler.\n-- TODO: Reorder arguments to be: Vect n eType -> eType -> Maybe (Fin n)\nindexOf : Eq eType => {n:Nat} -> eType -> Vect n eType -> Maybe (Fin n)\nindexOf {n} e v =\n    case v of\n        Nil => \n            Nothing\n        x::xs => \n            case (x == e) of\n                True =>\n                    Just (the (Fin n) 0)\n                False =>\n                    case (indexOf e xs) of\n                        Just index => index + 1  -- NOTE: requires linear memory\n                        Nothing    => Nothing\n-}\n\n-- TODO: Surely this is in the standard library...\ncontains : Eq eType => Vect n eType -> eType -> Bool\ncontains Nil e =\n    False\ncontains (x::xs) e =\n    (e == x) || (contains xs e)\n\nwinnerTie : BoardSquares -> Maybe Player\nwinnerTie sqs =\n    if (contains sqs N) then Nothing\n                        else Just N\n\nwinner : BoardSquares -> Maybe Player\nwinner sqs = firstJust' [winnerRowCol sqs, winnerDiag sqs, winnerTie sqs]\n\n--------------------------------------------------------------------------------\n-- Board Mutators\n\n-- TODO: Exercise: Refuse to play at an occupied location at *compile* time\n-- TODO: Exercise: Refuse to play if there is a winner at *compile* time\nmove : Board -> BoardLocation -> Maybe Board\nmove b loc = \n    if (not (isJust (winner (squares b)))) &&\n       (not (isPositionOccupied b loc)) then\n        Just (MkBoard (replaceAt loc (whoseTurn b) (squares b))\n                                  (otherPlayer (whoseTurn b)))\n    else\n        Nothing\n\n-- TODO: Implement a takeMoveBack method\n-- TODO: Exercise: Refuse to take back a move on an empty board at *compile* time\n\n--------------------------------------------------------------------------------\n-- Main\n\n-- NOTE: Implementation is probably quadratic time unless recursive string\n--       appends are specially optimized. Unlikely.\n-- \n-- TODO: Figure out how to make this work with (List String)\n--       in addition to (Vect n String). Probably some kind of\n--       type generalization is required.\nintercalateAcc : String -> Vect n String -> String -> String\nintercalateAcc separator Nil result =\n    result\nintercalateAcc separator (x::xs) result =\n    intercalateAcc separator xs (result ++ separator ++ x)\n\nintercalate : String -> Vect n String -> String\nintercalate separator Nil =\n    \"\"\nintercalate separator (x::xs) =\n    intercalateAcc separator xs x\n\nformatCell : Player -> String\nformatCell cell =\n    \" \" ++ (show cell) ++ \" \"\n\nformatBoardRow : Vect 3 Player -> String\nformatBoardRow row = \n    intercalate \"|\" (map formatCell row)\n\nformatBoardSquares : BoardSquares -> String\nformatBoardSquares sqs = \n    intercalate \"\\n---|---|---\\n\" (map formatBoardRow (rows sqs))\n\nformatBoard : Board -> String\nformatBoard board =\n    formatBoardSquares (squares board)\n\ninputFin : (n:Nat) -> IO (Fin n)\ninputFin n = do\n    line <- getLine\n    -- TODO: Detect and reject non-integer input\n    let int = the Integer (cast line)\n    case (integerToFin int n) of\n        Just int' => return int'\n        Nothing   => inputFin n  -- out of bounds; try again\n\nrunGame : Board -> IO ()\nrunGame board = do\n    putStrLn (formatBoard board)\n    putStrLn \"\"\n    case (winner (squares board)) of\n        Just theWinner =>\n            case theWinner of\n                N => putStrLn \"Tie!\"\n                _ => putStrLn ((show theWinner) ++ \" wins!\")\n        Nothing => do\n            putStr \"Next move? (0-8) \"\n            loc' <- inputFin 9 \n            putStrLn \"\"\n            let loc = the BoardLocation loc'\n            case (move board loc) of\n                Just newBoard => runGame newBoard\n                Nothing       => runGame board    -- illegal move; try again\n\nmain : IO ()\nmain = do\n    runGame initialBoard\n    ", "meta": {"hexsha": "8516c077e57cae4592ba54adbc8eb6bf88453aba", "size": 7067, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "TicTacToe.idr", "max_stars_repo_name": "davidfstr/tic-tac-idris", "max_stars_repo_head_hexsha": "5cc06d22788eacf556ac84abac54d4a16d6184a8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2017-08-22T08:38:04.000Z", "max_stars_repo_stars_event_max_datetime": "2017-08-22T08:38:04.000Z", "max_issues_repo_path": "TicTacToe.idr", "max_issues_repo_name": "davidfstr/tic-tac-idris", "max_issues_repo_head_hexsha": "5cc06d22788eacf556ac84abac54d4a16d6184a8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TicTacToe.idr", "max_forks_repo_name": "davidfstr/tic-tac-idris", "max_forks_repo_head_hexsha": "5cc06d22788eacf556ac84abac54d4a16d6184a8", "max_forks_repo_licenses": ["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.9449152542, "max_line_length": 81, "alphanum_fraction": 0.5505872365, "num_tokens": 1820, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.766293653760418, "lm_q2_score": 0.6959583124210896, "lm_q1q2_score": 0.5333084380900913}}
{"text": "module Apply\n\n-- These are not Biapplicatives.  Those are in Data.Biapplicative\n\nimport Bifunctor\n\ninfixl 4 <<$>>, <<&>>, <<.>>, <<., .>>, <<..>>\n\n||| Primarily used to make the definitions of bilift2 and bilift3 pretty\n|||\n||| ```idris example\n||| bimap const const <<$>> (1, 2) <<.>> (3, 4) == (1, 2)\n||| ```\n|||\nexport\n(<<$>>) : (a -> b) -> a -> b\n(<<$>>) = id\n\n||| <<$>> with the arguments reversed\n|||\n||| ```idris example\n||| (1, 2) <<&>> bimap const const <<.>> (3, 4) == (1, 2)\n||| ```\n|||\n(<<&>>) : a -> (a -> b) -> b\n(<<&>>) = flip id\n\n||| Biapplys (not to be confused with Biapplicatives)\n||| @p The action of the Biapply on pairs of objects\npublic export\ninterface Bifunctor p => Biapply (p : Type -> Type -> Type) where\n\n  ||| Applys a Bifunctor of functions to another Bifunctor of the same type\n  |||\n  ||| ````idris example\n  ||| (reverse, (\\x => x + 1)) <<.>> (\"hello\", 1) == (\"olleh\", 2)\n  ||| ````\n  |||\n  (<<.>>) : p (a -> b) (c -> d) -> p a c -> p b d\n\n  ||| Given two Bifunctors, sequences them leftwards\n  |||\n  ||| ````idris example\n  ||| (\"hello\", 1) <<. (\"goodbye\", 2) == (\"hello\", 1)\n  ||| ````\n  |||\n  (<<.) : p a b -> p c d -> p a b\n  a <<. b = bimap const const <<$>> a <<.>> b\n\n  ||| Given two Bifunctors, sequences them rightwards\n  |||\n  ||| ````idris example\n  ||| (\"hello\", 1) <<. (\"goodbye\", 2) == (\"goodbye\", 2)\n  ||| ````\n  |||\n  (.>>) : p a b -> p c d -> p c d\n  a .>> b = bimap (const id) (const id) <<$>> a <<.>> b\n\n||| Lifts a pair of binary functions into a Bifunctor\n|||\n||| ````idris example\n||| bilift2 (++) (+) (\"hello\", 1) (\"goodbye\", 2) == (\"hellogoodbye\", 3)\n||| ````\n|||\nbilift2 : Biapply p => (a -> b -> c) -> (d -> e -> f) -> p a d -> p b e -> p c f\nbilift2 f g a b = bimap f g <<$>> a <<.>> b\n\n||| Lifts a pair of ternary functions into a Bifunctor\n|||\n||| ````idris example\n||| bilift3 (\\x,y,z => x ++ (y ++ z)) (\\x,y,z => x + (y + z))\n|||         (\"hello\", 1) (\"goodbye\", 2) (\"hello again\", 3) ==\n||| (\"hellogoodbyehello again\", 6)\n||| ````\n|||\nbilift3 : Biapply p => (a -> b -> c -> d) -> (e -> f -> g -> h)\n        -> p a e -> p b f -> p c g -> p d h\nbilift3 f g a b c = bimap f g <<$>> a <<.>> b <<.>> c\n\n||| Applies the second of two Bifunctors to the first\n|||\n||| ````idris example\n||| (\"hello\", 1) <<..>> (reverse, (\\x => x + 1)) == (\"olleh\", 2)\n||| ````\n|||\n(<<..>>): Biapply p => p a c -> p (a -> b) (c -> d) -> p b d\n(<<..>>) = flip (<<.>>)\n\nimplementation Biapply Pair where\n  (f, g) <<.>> (a, b) = (f a, g b)\n", "meta": {"hexsha": "01bb3e3a35b35265ebb6878d9d349f6e9353cc18", "size": 2477, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interface006/Apply.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/interface006/Apply.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/interface006/Apply.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": 27.2197802198, "max_line_length": 80, "alphanum_fraction": 0.4646750101, "num_tokens": 988, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7662936324115011, "lm_q2_score": 0.6959583124210896, "lm_q1q2_score": 0.5333084232321351}}
{"text": "\nmodule MSubst\n\n-- Multiple substitution in order to\n-- turn a term that is well-typed in\n-- a context into a closed term (i.e.\n-- into a term that is well-typed in\n-- the empty context).\n\n\nimport R\nimport Subst\nimport SubstLemmas\nimport Term\nimport Typing\n\n\n%default total\n%access export\n\n\n\n-------------------------------------------------------------\n-- Begin: VALUE ENVIRONMENT THAT IS COMPATIBLE WITH A CONTEXT\n\npublic export\ndata VEnv : Context -> Type where\n  VNil  : VEnv []\n  VCons : (e : Term) -> Value e -> r s e ->\n          VEnv ctx -> \n          VEnv (s::ctx) \n\n-- End: VALUE ENVIRONMENT THAT IS COMPATIBLE WITH A CONTEXT\n-----------------------------------------------------------\n\n\n  \n\n-------------------------------\n-- Begin: MULTIPLE SUBSTITUTION\n\npublic export\nmsubst : Term -> (i : Nat) -> VEnv ctx -> Term\nmsubst e _ VNil = e\nmsubst e i (VCons x _ _ venv) = \n  let e' = subst x i e\n  in msubst e' i venv\n\n-- End: MULTIPLE SUBSTITUTION\n-----------------------------\n\n\n\n\n-------------------\n-- Begin: WEAKENING\n\n-- Weakening means extending a typing context\n-- of a term 'e' on the right. This leaves the\n-- de Bruijn indices that are referenced in 'e'\n-- unchanged.\n-- Weakening can be implemented with the 'shiftTerm'\n-- operation by using a cutoff that is exactly the\n-- length of the typing context.\n-- Weakening is useful in the subsequent reasoning\n-- about the 'msubst' operation.\n\nweaken : (e : Term) -> \n         Typing ctx e t ->\n         Context ->\n         Term\nweaken e {ctx} _ ctx' = shiftTerm (length ctx) (length ctx') e\n\n\n\n-- Weakening does not actually change a term:\nweakenIdentity : (e : Term) ->\n                 (ty : Typing ctx e t) ->\n                 (ctx' : Context) ->\n                 weaken e ty ctx' = e\nweakenIdentity e {ctx} ty ctx' = \n  let eq1 = shiftTermPastCtx e ctx ty Z (length ctx') \n      eq2 = plusZeroRightNeutral (length ctx)\n      eq3 = cong {f = \\q => shiftTerm q (length ctx') e} (sym eq2)\n  in trans eq3 eq1\n\n\n\n-- Weakening preserves typing, albeit in\n-- an extended context:\nweakenPreservesTy : (e : Term) ->\n                    (ty : Typing ctx e t) ->\n                    (ctx' : Context) ->\n                    Typing (ctx++ctx') (weaken e ty ctx') t\nweakenPreservesTy e {ctx} {t} ty ctx' = \n  let eq1 = appendNilRightNeutral ctx\n      ty1 = replace {P = \\q => Typing q e t} (sym eq1) ty\n      ty2 = shiftTermTy e {ctx1=ctx} {ctx2=[]} ty1 ctx'\n      e'  = shiftTerm (length ctx) (length ctx') e\n      eq2 = appendNilRightNeutral ctx'\n  in replace {P = \\q => Typing (ctx++q) e' t} eq2 ty2\n\n-- End: WEAKENING\n-----------------\n\n\n\n\n--------------------------------------------\n-- Begin: LEMMAS ABOUT MULTIPLE SUBSTITUTION\n\n-- Multiple substitution preserves typing:\nmSubstPreservesTy : (e : Term) ->\n                    Typing (ctx1++ctx2) e t ->\n                    (venv : VEnv ctx2) ->\n                    Typing ctx1 (msubst e (length ctx1) venv) t\nmSubstPreservesTy e ty {t} VNil {ctx1} =\n  let eq = appendNilRightNeutral ctx1\n  in replace {P = \\q => Typing q e t} eq ty\nmSubstPreservesTy e ty {t} (VCons x _ rx venv) {ctx1} {ctx2 = s::ctx2} = \n  let tyx  = rTyping x rx\n      x'   = weaken x tyx ctx2\n      tyx1 = weakenPreservesTy x tyx ctx2\n      ty'  = substPreservesTy {ctx1=ctx1} e ty x' tyx1\n      eq1  = weakenIdentity x tyx ctx2\n      ty'' = replace {P = \\q => Typing (ctx1++ctx2) (subst q (length ctx1) e) t} eq1 ty'\n  in mSubstPreservesTy (subst x (length ctx1) e) ty'' venv\n\n\n\n-- Multiple substitution acts as the identity\n-- on an expression 'e' if 'e' is typed in the\n-- context 'ctx' but multiple substitution only\n-- takes place at an index 'i' that is equal to\n-- or greater than 'length ctx':\nmSubstPastCtx : (e : Term) ->\n                (ctx : Context) ->\n                (Typing ctx e t) ->\n                (venv : VEnv ctx') ->\n                msubst e (length ctx) venv = e\nmSubstPastCtx e ctx ty VNil = Refl\nmSubstPastCtx e ctx ty (VCons x _ rx venv) {t} {ctx' = s::ctx'} = \n  let e'  = weaken e ty [s]\n      ty1 = weakenPreservesTy e ty [s]\n      tyx = rTyping x rx \n      ty2 = substPreservesTy {ctx1=ctx} {ctx2=[]} e' ty1 x tyx\n      eq1 = appendNilRightNeutral ctx\n      ty3 = replace {P = \\q => Typing q (subst x (length ctx) e') t} eq1 ty2\n      eq2 = weakenIdentity e ty [s]\n      ty4 = replace {P = \\q => Typing ctx (subst x (length ctx) q) t} eq2 ty3\n      ih  = mSubstPastCtx (subst x (length ctx) e) ctx ty4 venv\n      eq3 = substPastCtx e ctx ty {n=0}\n      eq4 = cong {f = \\q => subst x q e} $ plusZeroRightNeutral (length ctx)\n      eq5 = trans (sym eq4) eq3\n  in trans ih eq5\n\n\n\n-- Multiple subsitution commutes with (ordinary) substitution:\nmSubstSubstSwap : (e : Term) -> \n                  (i : Nat) -> (venv : VEnv ctx) ->\n                  (y : Term) -> Typing [] y s ->\n                  subst y i (msubst e (S i) venv) = msubst (subst y i e) i venv\nmSubstSubstSwap e i VNil y tyy = Refl\nmSubstSubstSwap e i (VCons x _ _ venv) y tyy = \n  let eq1 = substSwap e i y x tyy\n      eq2 = cong {f = \\q => msubst q i venv} eq1\n      ih  = mSubstSubstSwap (subst x (S i) e) i venv y tyy\n  in trans ih (sym eq2)\n\n\n-- Following multiple substitution with an ordinary\n-- substitution amounts to multiple substitution in\n-- an extended environment:\nmSubstSubstSwap' : (e : Term) -> \n                   (i : Nat) -> (venv : VEnv ctx) ->\n                   (y : Term) -> (vy : Value y) -> (ry : r s y) ->\n                   subst y i (msubst e (S i) venv) = msubst e i (VCons y vy ry venv)\nmSubstSubstSwap' e i venv y vy ry = mSubstSubstSwap e i venv y (rTyping y ry)\n\n-- End: LEMMAS ABOUT MULTIPLE SUBSTITUTION\n------------------------------------------\n\n\n\n\n---------------------------------------------------------------\n-- Begin: MULTIPLE SUBSTITUTION COMMUTES WITH TERM CONSTRUCTORS\n\nmSubstAbsComm : (e : Term) -> \n                (i : Nat) -> (venv : VEnv ctx) ->\n                TAbs (msubst e (S i) venv) = msubst (TAbs e) i venv\nmSubstAbsComm e _ VNil = Refl\nmSubstAbsComm e i (VCons x _ _ venv) = mSubstAbsComm (subst x (S i) e) i venv\n\n  \n  \nmSubstAppComm : (e1 : Term) -> (e2 : Term) ->\n                (i : Nat) -> (venv : VEnv ctx) ->\n                TApp (msubst e1 i venv) (msubst e2 i venv) = msubst (TApp e1 e2) i venv\nmSubstAppComm e1 e2 i VNil = Refl\nmSubstAppComm e1 e2 i (VCons x _ _ venv) = \n  mSubstAppComm (subst x i e1) (subst x i e2) i venv\n\n\n\nmSubstRecComm : (e1 : Term) -> (e2 : Term) -> (e3 : Term) ->\n                (i : Nat) -> (venv : VEnv ctx) ->\n                TRec (msubst e1 i venv) (msubst e2 i venv) (msubst e3 i venv) =\n                  msubst (TRec e1 e2 e3) i venv\nmSubstRecComm e1 e2 e3 i VNil = Refl\nmSubstRecComm e1 e2 e3 i (VCons x _ _ venv) =\n  mSubstRecComm (subst x i e1) (subst x i e2) (subst x i e3) i venv\n\n\n\nmSubstSuccComm : (e : Term) ->\n                 (i : Nat) -> (venv : VEnv ctx) ->\n                 TSucc (msubst e i venv) = msubst (TSucc e) i venv\nmSubstSuccComm e i VNil = Refl\nmSubstSuccComm e i (VCons x _ _ venv) = \n  mSubstSuccComm (subst x i e) i venv\n\n\n\nmSubstPredComm : (e : Term) ->\n                 (i : Nat) -> (venv : VEnv ctx) ->\n                 TPred (msubst e i venv) = msubst (TPred e) i venv\nmSubstPredComm e i VNil = Refl\nmSubstPredComm e i (VCons x _ _ venv) = \n  mSubstPredComm (subst x i e) i venv\n\n\n\nmSubstIfzComm : (e1 : Term) -> (e2 : Term) -> (e3 : Term) ->\n                (i : Nat) -> (venv : VEnv ctx) ->\n                TIfz (msubst e1 i venv) (msubst e2 i venv) (msubst e3 i venv) =\n                  msubst (TIfz e1 e2 e3) i venv\nmSubstIfzComm e1 e2 e3 i VNil = Refl\nmSubstIfzComm e1 e2 e3 i (VCons x _ _ venv) =\n  mSubstIfzComm (subst x i e1) (subst x i e2) (subst x i e3) i venv\n\n-- End: MULTIPLE SUBSTITUTION COMMUTES WITH TERM CONSTRUCTORS\n-------------------------------------------------------------\n", "meta": {"hexsha": "d5ca85d217b8ef404e7993ca512b300c74d56008", "size": 7805, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "totality/src/MSubst.idr", "max_stars_repo_name": "normanrink/PCF", "max_stars_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "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": "totality/src/MSubst.idr", "max_issues_repo_name": "normanrink/PCF", "max_issues_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "totality/src/MSubst.idr", "max_forks_repo_name": "normanrink/PCF", "max_forks_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_forks_repo_licenses": ["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.8571428571, "max_line_length": 88, "alphanum_fraction": 0.5584881486, "num_tokens": 2559, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059609645724, "lm_q2_score": 0.672331699179286, "lm_q1q2_score": 0.5332302783645315}}
{"text": "import Data.Fin\n\nfoo : (n : Nat) -> (i : Fin n) -> Bool\nfoo n@(_) i = ?foo_rhs\n", "meta": {"hexsha": "a0f641f6c12d951558e1f37f995dd2e22fa03e5e", "size": 79, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interactive041/Issue1741.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/tests/idris2/interactive041/Issue1741.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/tests/idris2/interactive041/Issue1741.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 15.8, "max_line_length": 38, "alphanum_fraction": 0.5316455696, "num_tokens": 32, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.793105941403651, "lm_q2_score": 0.6723316860482763, "lm_q1q2_score": 0.5332302547988221}}
{"text": "module Lambdapants.Environment\n\nimport Lambdapants.Term\nimport Lambdapants.Term.Nats\nimport Lambdapants.Term.Reduction\n\n%default total\n\npublic export\nEnvironment : Type\nEnvironment = List (String, Term)\n\nexport\nsubstEnv : Term -> Environment -> Term\nsubstEnv = foldr (uncurry substitute)\n\nexport\nencodeNats : Term -> Term\nencodeNats = enc [] where\n  enc : List String -> Term -> Term\n  enc bound (Var name) =\n    if not (elem name bound) && all isDigit (unpack name)\n       then let num = cast name in\n                if num > 800 -- Treat numbers larger than 800 as literals\n                   then Var name\n                   else encoded num\n       else Var name\n  enc bound (App t u) = App (enc bound t) (enc bound u)\n  enc bound (Lam v t) = Lam v (enc (v :: bound) t)\n\nexport\nclosed : Term -> Environment -> Term\nclosed = substEnv . encodeNats\n", "meta": {"hexsha": "43622829e6ccf0d37e8cd241302fa8cc314ad932", "size": 849, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Lambdapants/Environment.idr", "max_stars_repo_name": "laserpants/redex-reflex", "max_stars_repo_head_hexsha": "8088dd1a231f65ff0eeb24c960865a622d5a5507", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2018-01-16T15:04:50.000Z", "max_stars_repo_stars_event_max_datetime": "2018-01-16T15:54:56.000Z", "max_issues_repo_path": "Lambdapants/Environment.idr", "max_issues_repo_name": "laserpants/lambdapants", "max_issues_repo_head_hexsha": "8088dd1a231f65ff0eeb24c960865a622d5a5507", "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": "Lambdapants/Environment.idr", "max_forks_repo_name": "laserpants/lambdapants", "max_forks_repo_head_hexsha": "8088dd1a231f65ff0eeb24c960865a622d5a5507", "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.9705882353, "max_line_length": 73, "alphanum_fraction": 0.6619552415, "num_tokens": 220, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8418256472515683, "lm_q2_score": 0.6334102775181399, "lm_q1q2_score": 0.5332210168475037}}
{"text": "module Main\nimport Types\nimport Lib\n\n\n\n---Testcase calculateDeltas--PASS\n\nmain: IO()\nmain = do\n  let thetas = (0, 0)\n  let alpha = 0.3\n  let trainingset = [(0.0,50.0), (1.0,60.0), (2.0,70.0)]\n  let iterations = 1\n  print $ show $ linearRegression thetas alpha trainingset iterations\n\n--Results for the test -50.0\n\n--Testcase adjustDeltas -- PASS\n--main: IO()\n--main = do\n--  let deltas = [6.0, 5.2]\n--  let examples = [(7.0,50.0), (2.0,3.0)]\n--  print $ adjustDeltas deltas examples\n\n\n  \n\n", "meta": {"hexsha": "a2ccaad9d0d10e3dc318828d95509e89228534c5", "size": 489, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "experimental/linearregression/Main.idr", "max_stars_repo_name": "Eman22S/ai-dsl", "max_stars_repo_head_hexsha": "b08a9af86d90104892e73823dba02346af3014f7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-03-10T13:04:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-10T13:04:49.000Z", "max_issues_repo_path": "experimental/linearregression/Main.idr", "max_issues_repo_name": "Eman22S/ai-dsl", "max_issues_repo_head_hexsha": "b08a9af86d90104892e73823dba02346af3014f7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "experimental/linearregression/Main.idr", "max_forks_repo_name": "Eman22S/ai-dsl", "max_forks_repo_head_hexsha": "b08a9af86d90104892e73823dba02346af3014f7", "max_forks_repo_licenses": ["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.8620689655, "max_line_length": 69, "alphanum_fraction": 0.6339468303, "num_tokens": 177, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7520125737597972, "lm_q2_score": 0.7090191337850932, "lm_q1q2_score": 0.53319130364267}}
{"text": "module Average\n\nexport\naverage : String -> Double\naverage s = (cast (totalLength s)) / (cast (numWords s))\n  where\n    totalLength : String -> Nat\n    totalLength s = sum (map length (words s))\n\n    numWords : String -> Nat\n    numWords x = length (words x)\n", "meta": {"hexsha": "ca649f90577ca7b7063c11807af54b84f5ebe384", "size": 258, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Average.idr", "max_stars_repo_name": "neduard/type-driven-development", "max_stars_repo_head_hexsha": "38aba26d97c196a06d99e8aedec7cb779c61c49b", "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": "Average.idr", "max_issues_repo_name": "neduard/type-driven-development", "max_issues_repo_head_hexsha": "38aba26d97c196a06d99e8aedec7cb779c61c49b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Average.idr", "max_forks_repo_name": "neduard/type-driven-development", "max_forks_repo_head_hexsha": "38aba26d97c196a06d99e8aedec7cb779c61c49b", "max_forks_repo_licenses": ["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.5, "max_line_length": 56, "alphanum_fraction": 0.6511627907, "num_tokens": 71, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.86153820232079, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5331029825189553}}
{"text": "module Main\n\nnumTest : (Num a, Show a) => a -> a -> IO ()\nnumTest a b = do\n  putStrLn $ show a ++ \" + \" ++ show b ++ \" = \" ++ show (a + b)\n  putStrLn $ show a ++ \" * \" ++ show b ++ \" = \" ++ show (a * b)\n\nintegralTest : (Integral a, Show a) => a -> a -> IO ()\nintegralTest a b = do\n  putStrLn $ show a ++ \" div \" ++ show b ++ \" = \" ++ show (a `div` b)\n  putStrLn $ show a ++ \" mod \" ++ show b ++ \" = \" ++ show (a `mod` b)\n\nfractionalTest : (Fractional a, Show a) => a -> a -> IO ()\nfractionalTest a b = do\n  putStrLn $ show a ++ \" / \" ++ show b ++ \" = \" ++ show (a / b)\n  putStrLn $ \"recip \" ++ show a ++ \" = \" ++ show (recip a)\n  putStrLn $ \"recip \" ++ show b ++ \" = \" ++ show (recip b)\n\nshowOrdering : Ordering -> String\nshowOrdering EQ = \"EQ\"\nshowOrdering LT = \"LT\"\nshowOrdering GT = \"GT\"\n\nordTest : (Ord a, Show a) => a -> a -> IO ()\nordTest a b = putStrLn $ \"compare \" ++ show a ++ \" \" ++ show b ++ \" = \" ++ showOrdering (compare a b)\n\nint1 : Int\nint1 = 2147483647\n\nint2 : Int\nint2 = -2147483648\n\nint3 : Int\nint3 = 4\n\ninteger1 : Integer\ninteger1 = 100000000000000009\n\ninteger2 : Integer\ninteger2 = 200000000000000008\n\nbits8_1: Bits8\nbits8_1 = 255\n\nbits8_2: Bits8\nbits8_2 = 255\n\nbits16_1: Bits16\nbits16_1 = 4097\n\nbits16_2: Bits16\nbits16_2 = 512\n\nbits32_1: Bits32\nbits32_1 = 8388608\n\nbits32_2: Bits32\nbits32_2 = 524288\n\nbits64_1: Bits64\nbits64_1 = 9223372036854775807\n\nbits64_2: Bits64\nbits64_2 = 281474976710656\n\ndouble1 : Double\ndouble1 = 24.234234\n\ndouble2 : Double\ndouble2 = 75676.23232\n\nprintHeader : String -> IO ()\nprintHeader header = do\n  putStrLn \"\"\n  putStrLn header\n  putStrLn $ concat $ replicate (length header) \"=\"\n\npythag : Int -> List (Int, Int, Int)\npythag max = [(x, y, z) | z <- [1..max], y <- [1..z], x <- [1..y],\n                          x * x + y * y == z * z]\nmain : IO ()\nmain = do\n  print \"Hello \"\n  putStrLn \"world!\"\n  printHeader \"numTest on Int\"\n  numTest int1 int2\n\n  printHeader \"numTest on Integer\"\n  numTest integer1 integer2\n\n  printHeader \"numTest on Bits8\"\n  numTest bits8_1 bits8_2\n\n  printHeader \"numTest on Bits16\"\n  numTest bits16_1 bits16_2\n\n  printHeader \"numTest on Bits32\"\n  numTest bits32_1 bits32_2\n\n  printHeader \"numTest on Bits64\"\n  numTest bits64_1 bits64_2\n\n  printHeader \"numTest on Double\"\n  numTest double1 double2\n\n  printHeader \"integralTest on Int\"\n  integralTest int1 int2\n\n  printHeader \"integralTest on Integer\"\n  integralTest integer1 integer2\n\n  printHeader \"integralTest on Bits8\"\n  integralTest bits8_1 bits8_2\n\n  printHeader \"integralTest on Bits16\"\n  integralTest bits16_1 bits16_2\n\n  printHeader \"integralTest on Bits32\"\n  integralTest bits32_1 bits32_2\n\n  printHeader \"integralTest on Bits64\"\n  integralTest bits64_1 bits64_2\n\n  printHeader \"fractionalTest on Double\"\n  fractionalTest double1 double2\n\n  printHeader \"ordTest on Int\"\n  ordTest int1 int2\n\n  printHeader \"ordTest on Integer\"\n  ordTest integer1 integer2\n\n  printHeader \"ordTest on Bits8\"\n  ordTest bits8_1 bits8_2\n\n  printHeader \"ordTest on Bits16\"\n  ordTest bits16_1 bits16_2\n\n  printHeader \"ordTest on Bits32\"\n  ordTest bits32_1 bits32_2\n\n  printHeader \"ordTest on Bits64\"\n  ordTest bits64_1 bits64_2\n\n  printHeader \"ordTest on Double\"\n  ordTest double1 double2\n\n  putStrLn \"\"\n  printLn $ pythag 50\n", "meta": {"hexsha": "e9c83e6d2bd9981831d19f84ca87eb2deaaab2bd", "size": 3235, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/tests/basic/basic.idr", "max_stars_repo_name": "mmhelloworld/idris-jvm-hs", "max_stars_repo_head_hexsha": "4f1856e731cac7bc3318c085002518d77a9dbb5b", "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/tests/basic/basic.idr", "max_issues_repo_name": "mmhelloworld/idris-jvm-hs", "max_issues_repo_head_hexsha": "4f1856e731cac7bc3318c085002518d77a9dbb5b", "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/tests/basic/basic.idr", "max_forks_repo_name": "mmhelloworld/idris-jvm-hs", "max_forks_repo_head_hexsha": "4f1856e731cac7bc3318c085002518d77a9dbb5b", "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.5666666667, "max_line_length": 101, "alphanum_fraction": 0.6683153014, "num_tokens": 1101, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7549149758396752, "lm_q2_score": 0.7057850340255386, "lm_q1q2_score": 0.5328076919093938}}
{"text": "||| Defines functions to use in place of `RegExp`'s data constructors, in order to create\n||| regular expressions which are \"normalized\" to a canonical form as much as possible. This adds\n||| some compile-time complexity but results in smaller DFAs for testing language membership.\nmodule RegExp.Equivalences\n\nimport Data.List\nimport Decidable.Equality\n\nimport public RegExp.Types\n\n%default total\n\n||| Constructs a \"normalized\" `Cat`, which applies the following rules:\n|||   - \u2205 \u00b7 r \u2248 \u2205\n|||   - r \u00b7 \u2205 \u2248 \u2205\n|||   - \u03b5 \u00b7 r \u2248 r\n|||   - r \u00b7 \u03b5 \u2248 r\n|||   - (r \u00b7 s) \u00b7 t \u2248 r \u00b7 (s \u00b7 t)\nexport\nnormCat : DecEq a => RegExp a -> RegExp a -> RegExp a\nnormCat Null      _     = Null\nnormCat _         Null  = Null\nnormCat Empty     r     = r\nnormCat r         Empty = r\nnormCat (Cat r s) t     = Cat r (Cat s t)\nnormCat r         s     = Cat r s\n\n||| Constructs a \"normalized\" `Disj`, which applies the following rules:\n|||\n|||   - \u2205 + r \u2248 r\n|||   - r + r \u2248 r\n|||   - (r + s) + t \u2248 r + (s + t)\n|||\n||| Note that the remaining equivalence (symmetry) is not captured:\n|||\n|||   - r + s \u2248 s + r\nexport\nnormDisj : DecEq a => RegExp a -> RegExp a -> RegExp a\nnormDisj Null r    = r\nnormDisj r    Null = r\nnormDisj r s with (decEq r s)\n  normDisj r          r | (Yes Refl) = r\n  normDisj (Disj r s) t | (No _)     = Disj r (Disj s t)\n  normDisj r          s | (No _)     = Disj r s\n\n||| Constructs a \"normalized\" `Conj`, which applies the following rules:\n|||   - \u2205 & r \u2248 \u2205\n|||   - r & r \u2248 r\n|||   - (r & s) & t \u2248 r & (s & t)\n|||\n||| Note that the remaining equivalence (symmetry) is not captured:\n|||\n|||   - r & s \u2248 s & r\nexport\nnormConj : DecEq a => RegExp a -> RegExp a -> RegExp a\nnormConj Null _    = Null\nnormConj _    Null = Null\nnormConj r s with (decEq r s)\n  normConj r r          | (Yes Refl) = r\n  normConj (Conj r s) t | (No _)     = Conj r (Conj s t)\n  normConj r s          | (No _)     = Conj r s\n\n||| Proof (by exhaustion) that `normCat` is sound.\nexport\nnormCat_isSound : DecEq a =>\n                  {xs : List a} ->\n                  {r : RegExp a} ->\n                  {s : RegExp a} ->\n                  Matches (normCat r s) xs ->\n                  Matches (Cat r s) xs\nnormCat_isSound      {r=Null}       {s}            p = absurd p\nnormCat_isSound      {r=Empty}      {s=Null}       p = absurd p\nnormCat_isSound      {r=Empty}      {s=Empty}      p = InCat Refl InEmpty p\nnormCat_isSound      {r=Empty}      {s=(Lit _)}    p = InCat Refl InEmpty p\nnormCat_isSound      {r=Empty}      {s=(Cat _ _)}  p = InCat Refl InEmpty p\nnormCat_isSound      {r=Empty}      {s=(Disj _ _)} p = InCat Refl InEmpty p\nnormCat_isSound      {r=Empty}      {s=(Conj _ _)} p = InCat Refl InEmpty p\nnormCat_isSound      {r=Empty}      {s=(Star _)}   p = InCat Refl InEmpty p\nnormCat_isSound      {r=(Lit _)}    {s=Null}       p = absurd p\nnormCat_isSound {xs} {r=(Lit _)}    {s=Empty}      p = InCat (sym $ appendNilRightNeutral xs) p InEmpty\nnormCat_isSound      {r=(Lit _)}    {s=(Lit _)}    p = p\nnormCat_isSound      {r=(Lit _)}    {s=(Cat _ _)}  p = p\nnormCat_isSound      {r=(Lit _)}    {s=(Disj _ _)} p = p\nnormCat_isSound      {r=(Lit _)}    {s=(Conj _ _)} p = p\nnormCat_isSound      {r=(Lit _)}    {s=(Star _)}   p = p\nnormCat_isSound      {r=(Cat _ _)}  {s=Null}       p = absurd p\nnormCat_isSound {xs} {r=(Cat _ _)}  {s=Empty}      p = InCat (sym $ appendNilRightNeutral xs) p InEmpty\nnormCat_isSound {xs=xs++(ys++zs)} {r=(Cat _ _)} {s=(Lit _)} (InCat {xs} {ys=ys++zs} Refl pr (InCat {xs=ys} {ys=zs} Refl ps pl)) =\n  InCat (appendAssociative xs ys zs) (InCat Refl pr ps) pl\nnormCat_isSound {xs=xs++(ys++zs)} {r=(Cat _ _)} {s=(Cat _ _)} (InCat {xs} {ys=ys++zs} Refl pr (InCat {xs=ys} {ys=zs} Refl ps pl)) =\n  InCat (appendAssociative xs ys zs) (InCat Refl pr ps) pl\nnormCat_isSound {xs=xs++(ys++zs)} {r=(Cat _ _)} {s=(Disj _ _)} (InCat {xs} {ys=ys++zs} Refl pr (InCat {xs=ys} {ys=zs} Refl ps pl)) =\n  InCat (appendAssociative xs ys zs) (InCat Refl pr ps) pl\nnormCat_isSound {xs=xs++(ys++zs)} {r=(Cat _ _)} {s=(Conj _ _)} (InCat {xs} {ys=ys++zs} Refl pr (InCat {xs=ys} {ys=zs} Refl ps pl)) =\n  InCat (appendAssociative xs ys zs) (InCat Refl pr ps) pl\nnormCat_isSound {xs=xs++(ys++zs)} {r=(Cat _ _)} {s=(Star _)} (InCat {xs} {ys=ys++zs} Refl pr (InCat {xs=ys} {ys=zs} Refl ps pl)) =\n  InCat (appendAssociative xs ys zs) (InCat Refl pr ps) pl\nnormCat_isSound      {r=(Disj _ _)} {s=Null}       p = absurd p\nnormCat_isSound {xs} {r=(Disj _ _)} {s=Empty}      p = InCat (sym $ appendNilRightNeutral xs) p InEmpty\nnormCat_isSound      {r=(Disj _ _)} {s=(Lit z)}    p = p\nnormCat_isSound      {r=(Disj _ _)} {s=(Cat z w)}  p = p\nnormCat_isSound      {r=(Disj _ _)} {s=(Disj z w)} p = p\nnormCat_isSound      {r=(Disj _ _)} {s=(Conj z w)} p = p\nnormCat_isSound      {r=(Disj _ _)} {s=(Star z)}   p = p\nnormCat_isSound      {r=(Conj _ _)} {s=Null}       p = absurd p\nnormCat_isSound {xs} {r=(Conj _ _)} {s=Empty}      p = InCat (sym $ appendNilRightNeutral xs) p InEmpty\nnormCat_isSound      {r=(Conj _ _)} {s=(Lit z)}    p = p\nnormCat_isSound      {r=(Conj _ _)} {s=(Cat z w)}  p = p\nnormCat_isSound      {r=(Conj _ _)} {s=(Disj z w)} p = p\nnormCat_isSound      {r=(Conj _ _)} {s=(Conj z w)} p = p\nnormCat_isSound      {r=(Conj _ _)} {s=(Star z)}   p = p\nnormCat_isSound      {r=(Star _)}   {s=Null}       p = absurd p\nnormCat_isSound {xs} {r=(Star _)}   {s=Empty}      p = InCat (sym $ appendNilRightNeutral xs) p InEmpty\nnormCat_isSound      {r=(Star _)}   {s=(Lit y)}    p = p\nnormCat_isSound      {r=(Star _)}   {s=(Cat y z)}  p = p\nnormCat_isSound      {r=(Star _)}   {s=(Disj y z)} p = p\nnormCat_isSound      {r=(Star _)}   {s=(Conj y z)} p = p\nnormCat_isSound      {r=(Star _)}   {s=(Star y)}   p = p\n\n||| Proof (by exhaustion) that `normCat` is complete.\nexport\nnormCat_isComplete : DecEq a =>\n                     {xs : List a} ->\n                     {r : RegExp a} ->\n                     {s : RegExp a} ->\n                     Matches (Cat r s) xs ->\n                     Matches (normCat r s) xs\nnormCat_isComplete {r=Null}                      (InCat _ pr _) = absurd pr\nnormCat_isComplete                {s=Null}       (InCat _ _ ps) = absurd ps\nnormCat_isComplete {r=Empty}      {s=Empty}      (InCat pCat InEmpty ps) = rewrite pCat in ps\nnormCat_isComplete {r=Empty}      {s=(Lit _)}    (InCat pCat InEmpty ps) = rewrite pCat in ps\nnormCat_isComplete {r=Empty}      {s=(Cat _ _)}  (InCat pCat InEmpty ps) = rewrite pCat in ps\nnormCat_isComplete {r=Empty}      {s=(Disj _ _)} (InCat pCat InEmpty ps) = rewrite pCat in ps\nnormCat_isComplete {r=Empty}      {s=(Conj _ _)} (InCat pCat InEmpty ps) = rewrite pCat in ps\nnormCat_isComplete {r=Empty}      {s=(Star _)}   (InCat pCat InEmpty ps) = rewrite pCat in ps\nnormCat_isComplete {r=(Lit _)}    {s=Empty}      (InCat {xs} Refl pr InEmpty) = rewrite (appendNilRightNeutral xs) in pr\nnormCat_isComplete {r=(Lit _)}    {s=(Lit _)}    p = p\nnormCat_isComplete {r=(Lit _)}    {s=(Cat _ _)}  p = p\nnormCat_isComplete {r=(Lit _)}    {s=(Disj _ _)} p = p\nnormCat_isComplete {r=(Lit _)}    {s=(Conj _ _)} p = p\nnormCat_isComplete {r=(Lit _)}    {s=(Star _)}   p = p\nnormCat_isComplete {r=(Cat _ _)}  {s=Empty} (InCat {xs} Refl pr InEmpty) = rewrite (appendNilRightNeutral xs) in pr\nnormCat_isComplete {xs=(xs'++ys)++[x]} {r=(Cat _ _)} {s=(Lit x)} (InCat {xs=xs'++ys} {ys=[x]} Refl (InCat {xs=xs'} {ys} Refl pr ps) InLit) =\n  InCat (sym $ appendAssociative xs' ys [x]) pr (InCat Refl ps InLit)\nnormCat_isComplete {xs=(xs'++ys)++zs} {r=(Cat _ _)} {s=(Cat _ _)} (InCat {xs=xs'++ys} {ys=zs} Refl (InCat {xs=xs'} {ys} Refl pr ps) pt) =\n  InCat (sym $ appendAssociative xs' ys zs) pr (InCat Refl ps pt)\nnormCat_isComplete {xs=(xs'++ys)++zs} {r=(Cat _ _)} {s=(Disj _ _)} (InCat {xs=xs'++ys} {ys=zs} Refl (InCat {xs=xs'} {ys} Refl pr ps) pt) =\n  InCat (sym $ appendAssociative xs' ys zs) pr (InCat Refl ps pt)\nnormCat_isComplete {xs=(xs'++ys)++zs} {r=(Cat _ _)} {s=(Conj _ _)} (InCat {xs=xs'++ys} {ys=zs} Refl (InCat {xs=xs'} {ys} Refl pr ps) pt) =\n  InCat (sym $ appendAssociative xs' ys zs) pr (InCat Refl ps pt)\nnormCat_isComplete {xs=(xs'++ys)++zs} {r=(Cat _ _)} {s=(Star _)} (InCat {xs=xs'++ys} {ys=zs} Refl (InCat {xs=xs'} {ys} Refl pr ps) pt) =\n  InCat (sym $ appendAssociative xs' ys zs) pr (InCat Refl ps pt)\nnormCat_isComplete {r=(Disj _ _)} {s=Empty}      (InCat {xs} Refl pr InEmpty) = rewrite (appendNilRightNeutral xs) in pr\nnormCat_isComplete {r=(Disj _ _)} {s=(Lit _)}    p = p\nnormCat_isComplete {r=(Disj _ _)} {s=(Cat _ _)}  p = p\nnormCat_isComplete {r=(Disj _ _)} {s=(Disj _ _)} p = p\nnormCat_isComplete {r=(Disj _ _)} {s=(Conj _ _)} p = p\nnormCat_isComplete {r=(Disj _ _)} {s=(Star _)}   p = p\nnormCat_isComplete {r=(Conj _ _)} {s=Empty}      (InCat {xs} Refl pr InEmpty) = rewrite (appendNilRightNeutral xs) in pr\nnormCat_isComplete {r=(Conj _ _)} {s=(Lit _)}    p = p\nnormCat_isComplete {r=(Conj _ _)} {s=(Cat _ _)}  p = p\nnormCat_isComplete {r=(Conj _ _)} {s=(Disj _ _)} p = p\nnormCat_isComplete {r=(Conj _ _)} {s=(Conj _ _)} p = p\nnormCat_isComplete {r=(Conj _ _)} {s=(Star _)}   p = p\nnormCat_isComplete {r=(Star _)}   {s=Empty}      (InCat {xs} Refl pr InEmpty) = rewrite (appendNilRightNeutral xs) in pr\nnormCat_isComplete {r=(Star _)}   {s=(Lit _)}    p = p\nnormCat_isComplete {r=(Star _)}   {s=(Cat _ _)}  p = p\nnormCat_isComplete {r=(Star _)}   {s=(Disj _ _)} p = p\nnormCat_isComplete {r=(Star _)}   {s=(Conj _ _)} p = p\nnormCat_isComplete {r=(Star _)}   {s=(Star _)}   p = p\n\n||| Proof (by exhaustion) that `normDisj` is sound.\nexport\nnormDisj_isSound : DecEq a =>\n                   {xs : List a} ->\n                   {r : RegExp a} ->\n                   {s : RegExp a} ->\n                   Matches (normDisj r s) xs ->\n                   Matches (Disj r s) xs\nnormDisj_isSound {r=Null}                      p                     = InDisjR p\nnormDisj_isSound {r=Empty}      {s=Null}       p                     = InDisjL p\nnormDisj_isSound {r=Empty}      {s=Empty}      p                     = p\nnormDisj_isSound {r=Empty}      {s=(Lit _)}    p                     = p\nnormDisj_isSound {r=Empty}      {s=(Cat _ _)}  p                     = p\nnormDisj_isSound {r=Empty}      {s=(Disj _ _)} p                     = p\nnormDisj_isSound {r=Empty}      {s=(Conj _ _)} p                     = p\nnormDisj_isSound {r=Empty}      {s=(Star _)}   p                     = p\nnormDisj_isSound {r=(Lit _)}    {s=Null}       p                     = InDisjL p\nnormDisj_isSound {r=(Lit _)}    {s=Empty}      p                     = p\nnormDisj_isSound {r=(Lit x)}    {s=(Lit y)}    p with (decEq x y)\n  normDisj_isSound {r=(Lit x)}  {s=(Lit x)}    p | (Yes Refl)        = InDisjL p\n  normDisj_isSound {r=(Lit x)}  {s=(Lit y)}    p | (No _)       = p\nnormDisj_isSound {r=(Lit _)}    {s=(Cat _ _)}  p                     = p\nnormDisj_isSound {r=(Lit _)}    {s=(Disj _ _)} p                     = p\nnormDisj_isSound {r=(Lit _)}    {s=(Conj _ _)} p                     = p\nnormDisj_isSound {r=(Lit _)}    {s=(Star _)}   p                     = p\nnormDisj_isSound {r=(Cat _ _)}  {s=Null}       p                     = InDisjL p\nnormDisj_isSound {r=(Cat _ _)}  {s=Empty}      p                     = p\nnormDisj_isSound {r=(Cat _ _)}  {s=(Lit _)}    p                     = p\nnormDisj_isSound {r=(Cat r s)}  {s=(Cat t u)}  p with (decEq r t)\n  normDisj_isSound {r=(Cat r s)} {s=(Cat r u)} p | (Yes Refl) with (decEq s u)\n    normDisj_isSound {r=(Cat r s)} {s=(Cat r s)} p | (Yes Refl) | (Yes Refl) = InDisjL p\n    normDisj_isSound {r=(Cat r s)} {s=(Cat r u)} p | (Yes Refl) | (No _) = p\n  normDisj_isSound {r=(Cat r s)} {s=(Cat t u)} p | (No _) = p\nnormDisj_isSound {r=(Cat _ _)}  {s=(Disj _ _)} p                     = p\nnormDisj_isSound {r=(Cat _ _)}  {s=(Conj _ _)} p                     = p\nnormDisj_isSound {r=(Cat _ _)}  {s=(Star _)}   p                     = p\nnormDisj_isSound {r=(Disj _ _)} {s=Null}       p                     = InDisjL p\nnormDisj_isSound {r=(Disj _ _)} {s=Empty}      (InDisjL p)           = InDisjL (InDisjL p)\nnormDisj_isSound {r=(Disj _ _)} {s=Empty}      (InDisjR (InDisjL p)) = InDisjL (InDisjR p)\nnormDisj_isSound {r=(Disj _ _)} {s=Empty}      (InDisjR (InDisjR p)) = InDisjR p\nnormDisj_isSound {r=(Disj _ _)} {s=(Lit _)}    (InDisjL p)           = InDisjL (InDisjL p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Lit _)}    (InDisjR (InDisjL p)) = InDisjL (InDisjR p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Lit _)}    (InDisjR (InDisjR p)) = InDisjR p\nnormDisj_isSound {r=(Disj _ _)} {s=(Cat _ _)}  (InDisjL p)           = InDisjL (InDisjL p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Cat _ _)}  (InDisjR (InDisjL p)) = InDisjL (InDisjR p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Cat _ _)}  (InDisjR (InDisjR p)) = InDisjR p\nnormDisj_isSound {r=(Disj r s)} {s=(Disj t u)} p with (decEq r t)\n  normDisj_isSound {r=(Disj r s)} {s=(Disj r u)} p                     | (Yes Refl) with (decEq s u)\n    normDisj_isSound {r=(Disj r s)} {s=(Disj r s)} p                     | (Yes Refl) | (Yes Refl) = InDisjL p\n    normDisj_isSound {r=(Disj r s)} {s=(Disj r u)} (InDisjL p)           | (Yes Refl) | (No _)     = InDisjL (InDisjL p)\n    normDisj_isSound {r=(Disj r s)} {s=(Disj r u)} (InDisjR (InDisjL p)) | (Yes Refl) | (No _)     = InDisjL (InDisjR p)\n    normDisj_isSound {r=(Disj r s)} {s=(Disj r u)} (InDisjR (InDisjR p)) | (Yes Refl) | (No _)     = InDisjR p\n  normDisj_isSound {r=(Disj r s)} {s=(Disj t u)} (InDisjL p)           | (No _) = InDisjL (InDisjL p)\n  normDisj_isSound {r=(Disj r s)} {s=(Disj t u)} (InDisjR (InDisjL p)) | (No _) = InDisjL (InDisjR p)\n  normDisj_isSound {r=(Disj r s)} {s=(Disj t u)} (InDisjR (InDisjR p)) | (No _) = InDisjR p\nnormDisj_isSound {r=(Disj _ _)} {s=(Conj _ _)} (InDisjL p)           = InDisjL (InDisjL p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Conj _ _)} (InDisjR (InDisjL p)) = InDisjL (InDisjR p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Conj _ _)} (InDisjR (InDisjR p)) = InDisjR p\nnormDisj_isSound {r=(Disj _ _)} {s=(Star _)}   (InDisjL p)           = InDisjL (InDisjL p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Star _)}   (InDisjR (InDisjL p)) = InDisjL (InDisjR p)\nnormDisj_isSound {r=(Disj _ _)} {s=(Star _)}   (InDisjR (InDisjR p)) = InDisjR p\nnormDisj_isSound {r=(Conj _ _)} {s=Null}       p                     = InDisjL p\nnormDisj_isSound {r=(Conj _ _)} {s=Empty}      p                     = p\nnormDisj_isSound {r=(Conj _ _)} {s=(Lit _)}    p                     = p\nnormDisj_isSound {r=(Conj _ _)} {s=(Cat _ _)}  p                     = p\nnormDisj_isSound {r=(Conj _ _)} {s=(Disj _ _)} p                     = p\nnormDisj_isSound {r=(Conj r s)} {s=(Conj t u)} p with (decEq r t)\n  normDisj_isSound {r=(Conj r s)} {s=(Conj r u)} p | (Yes Refl) with (decEq s u)\n    normDisj_isSound {r=(Conj r s)} {s=(Conj r s)} p | (Yes Refl) | (Yes Refl) = InDisjL p\n    normDisj_isSound {r=(Conj r s)} {s=(Conj r u)} p | (Yes Refl) | (No _) = p\n  normDisj_isSound {r=(Conj r s)} {s=(Conj t u)} p | (No _) = p\nnormDisj_isSound {r=(Conj _ _)} {s=(Star _)}   p                     = p\nnormDisj_isSound {r=(Star _)}   {s=Null}       p                     = InDisjL p\nnormDisj_isSound {r=(Star _)}   {s=Empty}      p                     = p\nnormDisj_isSound {r=(Star _)}   {s=(Lit _)}    p                     = p\nnormDisj_isSound {r=(Star _)}   {s=(Cat _ _)}  p                     = p\nnormDisj_isSound {r=(Star _)}   {s=(Disj _ _)} p                     = p\nnormDisj_isSound {r=(Star _)}   {s=(Conj _ _)} p                     = p\nnormDisj_isSound {r=(Star r)}   {s=(Star s)}   p with (decEq r s)\n  normDisj_isSound {r=(Star r)} {s=(Star r)}   p | (Yes Refl)        = InDisjL p\n  normDisj_isSound {r=(Star r)} {s=(Star s)}   p | (No _)            = p\n\n||| Proof (by exhaustion) that `normDisj` is complete.\nexport\nnormDisj_isComplete : DecEq a =>\n                      {xs : List a} ->\n                      {r : RegExp a} ->\n                      {s : RegExp a} ->\n                      Matches (Disj r s) xs ->\n                      Matches (normDisj r s) xs\nnormDisj_isComplete {r=Null}                      (InDisjL p)           = absurd p\nnormDisj_isComplete {r=Null}                      (InDisjR p)           = p\nnormDisj_isComplete {r=Empty}      {s=Null}       (InDisjL p)           = p\nnormDisj_isComplete {r=Empty}      {s=Null}       (InDisjR p)           = absurd p\nnormDisj_isComplete {r=Empty}      {s=Empty}      (InDisjL p)           = InDisjL p\nnormDisj_isComplete {r=Empty}      {s=Empty}      (InDisjR p)           = InDisjR p\nnormDisj_isComplete {r=Empty}      {s=(Lit _)}    p                     = p\nnormDisj_isComplete {r=Empty}      {s=(Cat _ _)}  p                     = p\nnormDisj_isComplete {r=Empty}      {s=(Disj _ _)} p                     = p\nnormDisj_isComplete {r=Empty}      {s=(Conj _ _)} p                     = p\nnormDisj_isComplete {r=Empty}      {s=(Star _)}   p                     = p\nnormDisj_isComplete {r=(Lit _)}    {s=Null}       (InDisjL p)           = p\nnormDisj_isComplete {r=(Lit _)}    {s=Null}       (InDisjR p)           = absurd p\nnormDisj_isComplete {r=(Lit _)}    {s=Empty}      p                     = p\nnormDisj_isComplete {r=(Lit x)}    {s=(Lit y)}    p with (decEq x y)\n  normDisj_isComplete {r=(Lit x)}  {s=(Lit x)}    (InDisjL p) | (Yes Refl) = p\n  normDisj_isComplete {r=(Lit x)}  {s=(Lit x)}    (InDisjR p) | (Yes Refl) = p\n  normDisj_isComplete {r=(Lit x)}  {s=(Lit y)}    p           | (No _)     = p\nnormDisj_isComplete {r=(Lit _)}    {s=(Cat _ _)} p                      = p\nnormDisj_isComplete {r=(Lit _)}    {s=(Disj _ _)} p                     = p\nnormDisj_isComplete {r=(Lit _)}    {s=(Conj _ _)} p                     = p\nnormDisj_isComplete {r=(Lit _)}    {s=(Star _)} p                       = p\nnormDisj_isComplete {r=(Cat _ _)}  {s=Null} (InDisjL p)                 = p\nnormDisj_isComplete {r=(Cat _ _)}  {s=Null} (InDisjR p)                 = absurd p\nnormDisj_isComplete {r=(Cat _ _)}  {s=Empty} p = p\nnormDisj_isComplete {r=(Cat _ _)}  {s=(Lit _)} p = p\nnormDisj_isComplete {r=(Cat r s)}  {s=(Cat t u)} p with (decEq r t)\n  normDisj_isComplete {r=(Cat r s)} {s=(Cat r u)} p | (Yes Refl) with (decEq s u)\n    normDisj_isComplete {r=(Cat r s)} {s=(Cat r s)} (InDisjL p) | (Yes Refl) | (Yes Refl) = p\n    normDisj_isComplete {r=(Cat r s)} {s=(Cat r s)} (InDisjR p) | (Yes Refl) | (Yes Refl) = p\n    normDisj_isComplete {r=(Cat r s)} {s=(Cat r u)} p           | (Yes Refl) | (No _)     = p\n  normDisj_isComplete {r=(Cat r s)} {s=(Cat t u)} p             | (No _) = p\nnormDisj_isComplete {r=(Cat _ _)}  {s=(Disj _ _)} p                     = p\nnormDisj_isComplete {r=(Cat _ _)}  {s=(Conj _ _)} p                     = p\nnormDisj_isComplete {r=(Cat _ _)}  {s=(Star _)} p                       = p\nnormDisj_isComplete {r=(Disj _ _)} {s=Null}       (InDisjL p)           = p\nnormDisj_isComplete {r=(Disj _ _)} {s=Null}       (InDisjR p)           = absurd p\nnormDisj_isComplete {r=(Disj _ _)} {s=Empty}      (InDisjL (InDisjL p)) = InDisjL p\nnormDisj_isComplete {r=(Disj _ _)} {s=Empty}      (InDisjL (InDisjR p)) = InDisjR (InDisjL p)\nnormDisj_isComplete {r=(Disj _ _)} {s=Empty}      (InDisjR p)           = InDisjR (InDisjR p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Lit _)}    (InDisjL (InDisjL p)) = InDisjL p\nnormDisj_isComplete {r=(Disj _ _)} {s=(Lit _)}    (InDisjL (InDisjR p)) = InDisjR (InDisjL p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Lit _)}    (InDisjR p)           = InDisjR (InDisjR p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Cat _ _)}  (InDisjL (InDisjL p)) = InDisjL p\nnormDisj_isComplete {r=(Disj _ _)} {s=(Cat _ _)}  (InDisjL (InDisjR p)) = InDisjR (InDisjL p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Cat _ _)}  (InDisjR p)           = InDisjR (InDisjR p)\nnormDisj_isComplete {r=(Disj r s)} {s=(Disj t u)} p with (decEq r t)\n  normDisj_isComplete {r=(Disj r s)} {s=(Disj r u)} p                       | (Yes Refl) with (decEq s u)\n    normDisj_isComplete {r=(Disj r s)} {s=(Disj r s)} (InDisjL p)             | (Yes Refl) | (Yes Refl) = p\n    normDisj_isComplete {r=(Disj r s)} {s=(Disj r s)} (InDisjR p)             | (Yes Refl) | (Yes Refl) = p\n    normDisj_isComplete {r=(Disj r s)} {s=(Disj r u)} (InDisjL (InDisjL p)) | (Yes Refl) | (No _)       = InDisjL p\n    normDisj_isComplete {r=(Disj r s)} {s=(Disj r u)} (InDisjL (InDisjR p)) | (Yes Refl) | (No _)       = InDisjR (InDisjL p)\n    normDisj_isComplete {r=(Disj r s)} {s=(Disj r u)} (InDisjR p)             | (Yes Refl) | (No _)     = InDisjR (InDisjR p)\n  normDisj_isComplete {r=(Disj r s)} {s=(Disj t u)} (InDisjL (InDisjL p))   | (No _)                    = InDisjL p\n  normDisj_isComplete {r=(Disj r s)} {s=(Disj t u)} (InDisjL (InDisjR p))   | (No _)                    = InDisjR (InDisjL p)\n  normDisj_isComplete {r=(Disj r s)} {s=(Disj t u)} (InDisjR p)               | (No _)                  = InDisjR (InDisjR p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Conj _ _)} (InDisjL (InDisjL p)) = InDisjL p\nnormDisj_isComplete {r=(Disj _ _)} {s=(Conj _ _)} (InDisjL (InDisjR p)) = InDisjR (InDisjL p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Conj _ _)} (InDisjR p)           = InDisjR (InDisjR p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Star _)}   (InDisjL (InDisjL p)) = InDisjL p\nnormDisj_isComplete {r=(Disj _ _)} {s=(Star _)}   (InDisjL (InDisjR p)) = InDisjR (InDisjL p)\nnormDisj_isComplete {r=(Disj _ _)} {s=(Star _)}   (InDisjR p)           = InDisjR (InDisjR p)\nnormDisj_isComplete {r=(Conj _ _)} {s=Null}       (InDisjL p)           = p\nnormDisj_isComplete {r=(Conj _ _)} {s=Null}       (InDisjR p)           = absurd p\nnormDisj_isComplete {r=(Conj _ _)} {s=Empty}      p                     = p\nnormDisj_isComplete {r=(Conj _ _)} {s=(Lit _)}    p                     = p\nnormDisj_isComplete {r=(Conj _ _)} {s=(Cat _ _)}  p                     = p\nnormDisj_isComplete {r=(Conj _ _)} {s=(Disj _ _)} p                     = p\nnormDisj_isComplete {r=(Conj r s)} {s=(Conj t u)} p with (decEq r t)\n  normDisj_isComplete {r=(Conj r s)} {s=(Conj r u)} p | (Yes Refl) with (decEq s u)\n    normDisj_isComplete {r=(Conj r s)} {s=(Conj r s)} (InDisjL p) | (Yes Refl) | (Yes Refl) = p\n    normDisj_isComplete {r=(Conj r s)} {s=(Conj r s)} (InDisjR p) | (Yes Refl) | (Yes Refl) = p\n    normDisj_isComplete {r=(Conj r s)} {s=(Conj r u)} p           | (Yes Refl) | (No _)     = p\n  normDisj_isComplete {r=(Conj r s)} {s=(Conj t u)} p | (No _)                              = p\nnormDisj_isComplete {r=(Conj _ _)} {s=(Star _)}   p                     = p\nnormDisj_isComplete {r=(Star _)} {s=Null}         (InDisjL p)           = p\nnormDisj_isComplete {r=(Star _)} {s=Null}         (InDisjR p)           = absurd p\nnormDisj_isComplete {r=(Star _)} {s=Empty}        p                     = p\nnormDisj_isComplete {r=(Star _)} {s=(Lit _)}      p                     = p\nnormDisj_isComplete {r=(Star _)} {s=(Cat _ _)}    p                     = p\nnormDisj_isComplete {r=(Star _)} {s=(Disj _ _)}   p                     = p\nnormDisj_isComplete {r=(Star _)} {s=(Conj _ _)}   p                     = p\nnormDisj_isComplete {r=(Star r)} {s=(Star s)} p with (decEq r s)\n  normDisj_isComplete {r=(Star r)} {s=(Star r)}   (InDisjL p) | (Yes Refl) = p\n  normDisj_isComplete {r=(Star r)} {s=(Star r)}   (InDisjR p) | (Yes Refl) = p\n  normDisj_isComplete {r=(Star r)} {s=(Star s)}   p           | (No _)     = p\n\n||| Proof (by exhaustion) that `normConj` is sound.\nexport\nnormConj_isSound : DecEq a =>\n                   {xs : List a} ->\n                   {r : RegExp a} ->\n                   {s : RegExp a} ->\n                   Matches (normConj r s) xs ->\n                   Matches (Conj r s) xs\nnormConj_isSound {r=Null}       {s}       p = absurd p\nnormConj_isSound {r=Empty}      {s=Null}       p = absurd p\nnormConj_isSound {r=Empty}      {s=Empty}      p = p\nnormConj_isSound {r=Empty}      {s=(Lit _)}    p = p\nnormConj_isSound {r=Empty}      {s=(Cat _ _)}  p = p\nnormConj_isSound {r=Empty}      {s=(Disj _ _)} p = p\nnormConj_isSound {r=Empty}      {s=(Conj _ _)} p = p\nnormConj_isSound {r=Empty}      {s=(Star _)}   p = p\nnormConj_isSound {r=(Lit _)}    {s=Null}       p = absurd p\nnormConj_isSound {r=(Lit _)}    {s=Empty}      p = p\nnormConj_isSound {r=(Lit x)}    {s=(Lit y)}    p with (decEq x y)\n  normConj_isSound {r=(Lit x)}    {s=(Lit x)}    p | (Yes Refl) = InConj p p\n  normConj_isSound {r=(Lit x)}    {s=(Lit y)}    p | (No _)     = p\nnormConj_isSound {r=(Lit _)}    {s=(Cat _ _)}  p = p\nnormConj_isSound {r=(Lit _)}    {s=(Disj _ _)} p = p\nnormConj_isSound {r=(Lit _)}    {s=(Conj _ _)} p = p\nnormConj_isSound {r=(Lit _)}    {s=(Star _)}   p = p\nnormConj_isSound {r=(Cat _ _)}  {s=Null}       p = absurd p\nnormConj_isSound {r=(Cat _ _)}  {s=Empty}      p = p\nnormConj_isSound {r=(Cat _ _)}  {s=(Lit _)}    p = p\nnormConj_isSound {r=(Cat r s)}  {s=(Cat t u)}  p with (decEq r t)\n  normConj_isSound {r=(Cat r s)} {s=(Cat r u)} p | (Yes Refl) with (decEq s u)\n    normConj_isSound {r=(Cat r s)} {s=(Cat r s)} p | (Yes Refl) | (Yes Refl) = InConj p p\n    normConj_isSound {r=(Cat r s)} {s=(Cat r u)} p | (Yes Refl) | (No _) = p\n  normConj_isSound {r=(Cat r s)} {s=(Cat t u)} p | (No _) = p\nnormConj_isSound {r=(Cat _ _)}  {s=(Disj _ _)} p = p\nnormConj_isSound {r=(Cat _ _)}  {s=(Conj _ _)} p = p\nnormConj_isSound {r=(Cat _ _)}  {s=(Star _)}   p = p\nnormConj_isSound {r=(Disj _ _)} {s=Null}       p = absurd p\nnormConj_isSound {r=(Disj _ _)} {s=Empty}      p = p\nnormConj_isSound {r=(Disj _ _)} {s=(Lit _)}    p = p\nnormConj_isSound {r=(Disj _ _)} {s=(Cat _ _)}  p = p\nnormConj_isSound {r=(Disj r s)} {s=(Disj t u)} p with (decEq r t)\n  normConj_isSound {r=(Disj r s)} {s=(Disj r u)} p | (Yes Refl) with (decEq s u)\n    normConj_isSound {r=(Disj r s)} {s=(Disj r s)} p | (Yes Refl) | (Yes Refl) = InConj p p\n    normConj_isSound {r=(Disj r s)} {s=(Disj r u)} p | (Yes Refl) | (No _) = p\n  normConj_isSound {r=(Disj r s)} {s=(Disj t u)} p | (No _) = p\nnormConj_isSound {r=(Disj _ _)} {s=(Conj _ _)} p = p\nnormConj_isSound {r=(Disj _ _)} {s=(Star _)}   p = p\nnormConj_isSound {r=(Conj _ _)} {s=Null}       p = absurd p\nnormConj_isSound {r=(Conj _ _)} {s=Empty}      (InConj pr (InConj ps pt)) = InConj (InConj pr ps) pt\nnormConj_isSound {r=(Conj _ _)} {s=(Lit _)}    (InConj pr (InConj ps pt)) = InConj (InConj pr ps) pt\nnormConj_isSound {r=(Conj _ _)} {s=(Cat _ _)}  (InConj pr (InConj ps pt)) = InConj (InConj pr ps) pt\nnormConj_isSound {r=(Conj _ _)} {s=(Disj _ _)} (InConj pr (InConj ps pt)) = InConj (InConj pr ps) pt\nnormConj_isSound {r=(Conj r s)} {s=(Conj t u)} p with (decEq r t)\n  normConj_isSound {r=(Conj r s)} {s=(Conj r u)} p | (Yes Refl) with (decEq s u)\n    normConj_isSound {r=(Conj r s)} {s=(Conj r s)} p | (Yes Refl) | (Yes Refl) = InConj p p\n    normConj_isSound {r=(Conj r s)} {s=(Conj r u)} (InConj _ (InConj ps (InConj pt pu))) | (Yes Refl) | (No _) =\n      InConj (InConj pt ps) (InConj pt pu)\n  normConj_isSound {r=(Conj r s)} {s=(Conj t u)} (InConj pr (InConj ps (InConj pt pu))) | (No _) =\n    InConj (InConj pr ps) (InConj pt pu)\nnormConj_isSound {r=(Conj _ _)} {s=(Star _)}   (InConj pr (InConj ps pt)) = InConj (InConj pr ps) pt\nnormConj_isSound {r=(Star _)}   {s=Null}       p = absurd p\nnormConj_isSound {r=(Star _)}   {s=Empty}      p = p\nnormConj_isSound {r=(Star _)}   {s=(Lit _)}    p = p\nnormConj_isSound {r=(Star _)}   {s=(Cat _ _)}  p = p\nnormConj_isSound {r=(Star _)}   {s=(Disj _ _)} p = p\nnormConj_isSound {r=(Star _)}   {s=(Conj _ _)} p = p\nnormConj_isSound {r=(Star r)}   {s=(Star s)}   p with (decEq r s)\n  normConj_isSound {r=(Star r)}   {s=(Star r)}   p | (Yes Refl) = InConj p p\n  normConj_isSound {r=(Star r)}   {s=(Star s)}   p | (No _)     = p\n\n||| Proof (by exhaustion) that `normCat` is complete.\nexport\nnormConj_isComplete : DecEq a =>\n                      {xs : List a} ->\n                      {r : RegExp a} ->\n                      {s : RegExp a} ->\n                      Matches (Conj r s) xs ->\n                      Matches (normConj r s) xs\nnormConj_isComplete {r=Null}                      (InConj p _) = absurd p\nnormConj_isComplete                {s=Null}       (InConj _ p) = absurd p\nnormConj_isComplete {r=Empty}      {s=Empty}      p = p\nnormConj_isComplete {r=Empty}      {s=(Lit _)}    p = p\nnormConj_isComplete {r=Empty}      {s=(Cat _ _)}  p = p\nnormConj_isComplete {r=Empty}      {s=(Disj _ _)} p = p\nnormConj_isComplete {r=Empty}      {s=(Conj _ _)} p = p\nnormConj_isComplete {r=Empty}      {s=(Star _)}   p = p\nnormConj_isComplete {r=(Lit _)}    {s=Empty}      p = p\nnormConj_isComplete {r=(Lit x)}    {s=(Lit y)}    p with (decEq x y)\n  normConj_isComplete {r=(Lit x)}  {s=(Lit x)}    (InConj p _) | Yes Refl = p\n  normConj_isComplete {r=(Lit x)}  {s=(Lit y)}    p            | No _     = p\nnormConj_isComplete {r=(Lit _)}    {s=(Cat _ _)}  p = p\nnormConj_isComplete {r=(Lit _)}    {s=(Disj _ _)} p = p\nnormConj_isComplete {r=(Lit _)}    {s=(Conj _ _)} p = p\nnormConj_isComplete {r=(Lit _)}    {s=(Star _)}   p = p\nnormConj_isComplete {r=(Cat _ _)}  {s=Empty}      p = p\nnormConj_isComplete {r=(Cat _ _)}  {s=(Lit _)}    p = p\nnormConj_isComplete {r=(Cat r s)}   {s=(Cat t u)} p with (decEq (Cat r s) (Cat t u))\n  normConj_isComplete {r=(Cat r s)} {s=(Cat r s)} (InConj p _) | Yes Refl = p\n  normConj_isComplete {r=(Cat r s)} {s=(Cat t u)} p            | No _     = p\nnormConj_isComplete {r=(Cat _ _)}  {s=(Disj _ _)} p = p\nnormConj_isComplete {r=(Cat _ _)}  {s=(Conj _ _)} p = p\nnormConj_isComplete {r=(Cat _ _)}  {s=(Star _)}   p = p\nnormConj_isComplete {r=(Disj _ _)} {s=Empty}      p = p\nnormConj_isComplete {r=(Disj _ _)} {s=(Lit _)}    p = p\nnormConj_isComplete {r=(Disj _ _)} {s=(Cat _ _)}  p = p\nnormConj_isComplete {r=(Disj r s)}   {s=(Disj t u)} p with (decEq (Disj r s) (Disj t u))\n  normConj_isComplete {r=(Disj r s)} {s=(Disj r s)} (InConj p _) | Yes Refl = p\n  normConj_isComplete {r=(Disj r s)} {s=(Disj t u)} p            | No _     = p\nnormConj_isComplete {r=(Disj _ _)} {s=(Conj _ _)} p = p\nnormConj_isComplete {r=(Disj _ _)} {s=(Star _)}   p = p\nnormConj_isComplete {r=(Conj _ _)} {s=Empty}      (InConj (InConj pr ps) pt) = InConj pr (InConj ps pt)\nnormConj_isComplete {r=(Conj _ _)} {s=(Lit _)}    (InConj (InConj pr ps) pt) = InConj pr (InConj ps pt)\nnormConj_isComplete {r=(Conj _ _)} {s=(Cat _ _)}  (InConj (InConj pr ps) pt) = InConj pr (InConj ps pt)\nnormConj_isComplete {r=(Conj _ _)} {s=(Disj _ _)} (InConj (InConj pr ps) pt) = InConj pr (InConj ps pt)\nnormConj_isComplete {r=(Conj r s)} {s=(Conj t u)} p with (decEq (Conj r s) (Conj t u))\n  normConj_isComplete {r=(Conj r s)} {s=(Conj r s)} (InConj p _)                           | Yes Refl = p\n  normConj_isComplete {r=(Conj r s)} {s=(Conj t u)} (InConj (InConj pr ps) (InConj pt pu)) | No _     =\n    InConj pr (InConj ps (InConj pt pu))\nnormConj_isComplete {r=(Conj _ _)} {s=(Star _)}   (InConj (InConj pr ps) pt) = InConj pr (InConj ps pt)\nnormConj_isComplete {r=(Star _)}   {s=Empty}      p = p\nnormConj_isComplete {r=(Star _)}   {s=(Lit _)}    p = p\nnormConj_isComplete {r=(Star _)}   {s=(Cat _ _)}  p = p\nnormConj_isComplete {r=(Star _)}   {s=(Disj _ _)} p = p\nnormConj_isComplete {r=(Star _)}   {s=(Conj _ _)} p = p\nnormConj_isComplete {r=(Star r)}   {s=(Star s)}   p with (decEq r s)\n  normConj_isComplete {r=(Star r)} {s=(Star r)}   (InConj p _) | Yes Refl = p\n  normConj_isComplete {r=(Star r)} {s=(Star s)}   p            | No _     = p\n", "meta": {"hexsha": "6f74133f2417ffd06dc002f6530c4394fedf55ae", "size": 31216, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/RegExp/Equivalences.idr", "max_stars_repo_name": "polendri/idris-regex", "max_stars_repo_head_hexsha": "72d5f1c05d34f3119b8be808a3e27b93a526e07a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-01T04:46:44.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-01T04:46:44.000Z", "max_issues_repo_path": "src/RegExp/Equivalences.idr", "max_issues_repo_name": "polendri/idris-regex", "max_issues_repo_head_hexsha": "72d5f1c05d34f3119b8be808a3e27b93a526e07a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-06-06T13:44:36.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-07T01:16:42.000Z", "max_forks_repo_path": "src/RegExp/Equivalences.idr", "max_forks_repo_name": "polendri/idris-regexp", "max_forks_repo_head_hexsha": "72d5f1c05d34f3119b8be808a3e27b93a526e07a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 65.5798319328, "max_line_length": 140, "alphanum_fraction": 0.5514800103, "num_tokens": 12211, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7690802476562641, "lm_q2_score": 0.6926419894793248, "lm_q1q2_score": 0.5326972728058866}}
{"text": "import Data.Vect\n\nlength : Vect n elem -> Nat\nlength {n} xs = n\n\nempties : Vect n (Vect 0 a)\nempties {n = Z} = []\nempties {n = (S k)} = [] :: empties\n", "meta": {"hexsha": "4524077c23893f2097ab6c2eda93be117a227987", "size": 150, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris/3.4-ImplicitArguments.idr", "max_stars_repo_name": "ostera/asdf", "max_stars_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2017-03-02T22:25:19.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T18:22:11.000Z", "max_issues_repo_path": "idris/3.4-ImplicitArguments.idr", "max_issues_repo_name": "ostera/asdf", "max_issues_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2019-12-05T22:45:56.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-05T22:45:58.000Z", "max_forks_repo_path": "idris/3.4-ImplicitArguments.idr", "max_forks_repo_name": "ostera/asdf", "max_forks_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_forks_repo_licenses": ["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.6666666667, "max_line_length": 35, "alphanum_fraction": 0.5733333333, "num_tokens": 56, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8175744939732855, "lm_q2_score": 0.6513548714339145, "lm_q1q2_score": 0.5325311294096171}}
{"text": "module Data.CatQueue\n\nimport Data.List.Properties\nimport Interfaces.Verified\n\n%hide Prelude.List.reverse\n%hide Prelude.Strings.reverse\n%hide Prelude.Strings.null\n%hide Prelude.Strings.(++)\n\n%default total\n%access public export\n\ndata CatQueue a = MkCatQueue (List a) (List a)\n\ndata NonEmptyCatQueue : CatQueue a -> Type where\n  IsNonEmptyCatQueue : Either (NonEmpty x) (NonEmpty y) ->\n                       NonEmptyCatQueue (MkCatQueue x y)\n\ndata EmptyCatQueue : CatQueue a -> Type where\n  IsEmptyCatQueue : EmptyCatQueue (MkCatQueue [] [])\n\ndata SingletonCatQueue : CatQueue a -> Type where\n  IsSingletonCatQueueLeft : SingletonCatQueue (MkCatQueue [x] [])\n  IsSingletonCatQueueRight : SingletonCatQueue (MkCatQueue [] [x])\n\n\n--------------------------------------------------------------------------------\n-- Implementations\n--------------------------------------------------------------------------------\n\nUninhabited (NonEmptyCatQueue (MkCatQueue [] [])) where\n  uninhabited (IsNonEmptyCatQueue (Left IsNonEmpty)) impossible\n  uninhabited (IsNonEmptyCatQueue (Right IsNonEmpty)) impossible\n\nShow q => Show (CatQueue q) where\n  show (MkCatQueue xs ys) = \"MkCatQueue \" <+> show xs <+> \" \" <+> show ys\n\nEq q => Eq (CatQueue q) where\n  (==) (MkCatQueue xs ys) (MkCatQueue zs ws) =\n    xs <+> reverse ys == zs <+> reverse ws\n  (/=) x y = not (x == y)\n\nOrd q => Ord (CatQueue q) where\n  compare (MkCatQueue [] []) (MkCatQueue [] []) = EQ\n  compare (MkCatQueue [] []) _ = LT\n  compare _ (MkCatQueue [] []) = GT\n  compare (MkCatQueue xs ys) (MkCatQueue zs ws) = compare (xs <+> reverse ys) (zs <+> reverse ws)\n\nSemigroup (CatQueue q) where\n  (<+>) (MkCatQueue xs ys) (MkCatQueue zs ws) = MkCatQueue ((xs <+> reverse ys) <+> (zs <+> reverse ws)) []\n\nMonoid (CatQueue q) where\n  neutral = MkCatQueue [] []\n\nFunctor CatQueue where\n  map f (MkCatQueue xs ys) = MkCatQueue (map f xs) (map f ys)\n\nFoldable CatQueue where\n  foldr f init (MkCatQueue xs ys) = foldr f init (xs <+> reverse ys)\n  foldl f init (MkCatQueue xs ys) = foldl f init (xs <+> reverse ys)\n\n\n--------------------------------------------------------------------------------\n-- Verified implementations\n--------------------------------------------------------------------------------\n\n-- TODO: how do I formally write that this is an axiom?\nprivate\naxiomCatQueueSame : (xs : List a) -> (ys : List a) -> MkCatQueue xs ys = MkCatQueue (xs <+> reverse ys) []\naxiomCatQueueSame xs ys = ?axiomCatQueueSame_rhs\n\n-- However, we can't use this axiom due to some limitations of ITT. Even though we have an axiom saying that these\n-- two CatQueues are the same, we can contradict this axiom easily:\nprivate\ninconsistentAxiom : MkCatQueue xs ys = MkCatQueue (xs <+> reverse ys) [] -> Void\ninconsistentAxiom = case axiomCatQueueSame [] [1] of Refl impossible\n\n-- This could be viewed as a reasonable compromise, since we're only using it internally to prove that other\n-- properties hold. But it severely limits the ability to provide proofs for this type of data structure, specifically\n-- any data structure where two different constructions are considered equal\n\n\nVerifiedFunctor CatQueue where\n  functorIdentity (MkCatQueue xs ys) =\n    rewrite functorIdentity xs in\n    rewrite functorIdentity ys in Refl\n  functorComposition (MkCatQueue xs ys) g1 g2 =\n    rewrite functorComposition xs g1 g2 in\n    rewrite functorComposition ys g1 g2 in Refl\n\nVerifiedSemigroup (CatQueue q) where\n  semigroupOpIsAssociative (MkCatQueue ls ls') (MkCatQueue cs cs') (MkCatQueue rs rs') =\n    rewrite appendAssociative (ls ++ reverse' [] ls') ((cs ++ reverse' [] cs') ++ rs ++ reverse' [] rs') [] in\n    rewrite appendNilRightNeutral ((ls ++ reverse' [] ls') ++ cs ++ reverse' [] cs') in\n    rewrite appendNilRightNeutral ((ls ++ reverse' [] ls') ++ (cs ++ reverse' [] cs') ++ rs ++ reverse' [] rs') in\n    rewrite appendAssociative (ls ++ reverse' [] ls') (cs ++ reverse' [] cs') (rs ++ reverse' [] rs') in\n    Refl\n\nVerifiedMonoid (CatQueue q) where\n  monoidNeutralIsNeutralL (MkCatQueue xs ys) =\n    rewrite appendNilRightNeutral (xs ++ reverse' [] ys) in\n    rewrite axiomCatQueueSame xs ys in\n    Refl\n  monoidNeutralIsNeutralR (MkCatQueue xs ys) =\n    rewrite axiomCatQueueSame xs ys in\n    Refl\n\n\n--------------------------------------------------------------------------------\n-- Functions\n--------------------------------------------------------------------------------\n\n-- | Test whether a queue is empty.\n-- |\n-- | Running time: `O(1)`\nnull : CatQueue a -> Bool\nnull (MkCatQueue [] []) = True\nnull _ = False\n\n-- | Append an element to the end of the queue, creating a new queue.\n-- |\n-- | Running time: `O(1)`\nsnoc : CatQueue a -> a -> CatQueue a\nsnoc (MkCatQueue l r) a = MkCatQueue l (a :: r)\n\n-- | Decompose a queue into a `Tuple` of the first element and the rest of the queue.\n-- |\n-- | Running time: `O(1)`\n-- |\n-- | Note that any single operation may run in `O(n)`.\nuncons : (q : CatQueue a) -> {auto prf : NonEmptyCatQueue q} -> (a, CatQueue a)\nuncons (MkCatQueue [] []) {prf} = absurd prf\nuncons (MkCatQueue [] (x :: xs)) = uncons_prf (x :: xs) {prf' = reverseNonEmpty (x :: xs) IsNonEmpty}\n  where\n    uncons_prf : (l : List a) -> {auto prf : NonEmpty l} -> {prf' : NonEmpty (reverse l)} -> (a, CatQueue a)\n    uncons_prf l = assert_total $ uncons (MkCatQueue (reverse l) [])\nuncons (MkCatQueue (x :: xs) ys) = (x, (MkCatQueue xs ys))\n\n\n-- | Decompose a queue into a `Tuple` of the first element and the rest of the queue.\n-- |\n-- | Running time: `O(1)`\n-- |\n-- | Note that any single operation may run in `O(n)`.\nuncons' : CatQueue a -> Maybe (a, (CatQueue a))\nuncons' (MkCatQueue [] []) = Nothing\nuncons' (MkCatQueue [] r) = assert_total $ uncons' (MkCatQueue (reverse r) [])\nuncons' (MkCatQueue (a :: as) r) = Just (a, (MkCatQueue as r))\n\n\n--------------------------------------------------------------------------------\n-- Properties\n--------------------------------------------------------------------------------\n\nsnocNotEmpty : (x : a) -> (q : CatQueue a) -> {auto prf : EmptyCatQueue q} -> NonEmptyCatQueue (snoc q x)\nsnocNotEmpty x q@(MkCatQueue [] []) = the (NonEmptyCatQueue (snoc q x)) (IsNonEmptyCatQueue (Right IsNonEmpty))\n\nsingletonNonEmpty : SingletonCatQueue q -> NonEmptyCatQueue q\nsingletonNonEmpty IsSingletonCatQueueLeft = IsNonEmptyCatQueue (Left IsNonEmpty)\nsingletonNonEmpty IsSingletonCatQueueRight = IsNonEmptyCatQueue (Right IsNonEmpty)\n\nsnocEmptySingleton : (x : a) -> (q : CatQueue a) -> {auto prf : EmptyCatQueue q} -> SingletonCatQueue (snoc q x)\nsnocEmptySingleton x (MkCatQueue [] []) = IsSingletonCatQueueRight\n\nnonEmptyNotNull : (q : CatQueue a) -> {auto prf : NonEmptyCatQueue q} -> null q = False\nnonEmptyNotNull (MkCatQueue [] []) {prf} = absurd prf\nnonEmptyNotNull (MkCatQueue (x :: xs) []) = Refl\nnonEmptyNotNull (MkCatQueue [] (y :: ys)) = Refl\nnonEmptyNotNull (MkCatQueue (x :: xs) (y :: ys)) = Refl\n\nUninhabited (False = True) where\n  uninhabited Refl impossible\n\nnullDecidable : (q : CatQueue a) -> Dec (null q = True)\nnullDecidable (MkCatQueue [] []) = Yes Refl\nnullDecidable (MkCatQueue (x::xs) []) = No uninhabited\nnullDecidable (MkCatQueue [] (x::xs)) = No uninhabited\nnullDecidable (MkCatQueue (x::xs) (y::ys)) = No uninhabited\n", "meta": {"hexsha": "dd0cde49abbc1aeebb2ab0f3a3163ea24ef46cbc", "size": 7231, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/CatQueue.idr", "max_stars_repo_name": "Risto-Stevcev/idris-catenatable-lists", "max_stars_repo_head_hexsha": "2b9e8704adb79e3fa6c7ac4372f68a2190c0e11d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-02-24T09:06:21.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-24T09:06:21.000Z", "max_issues_repo_path": "Data/CatQueue.idr", "max_issues_repo_name": "Risto-Stevcev/idris-catenable-lists", "max_issues_repo_head_hexsha": "2b9e8704adb79e3fa6c7ac4372f68a2190c0e11d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2017-06-22T14:29:42.000Z", "max_issues_repo_issues_event_max_datetime": "2017-06-22T15:25:24.000Z", "max_forks_repo_path": "Data/CatQueue.idr", "max_forks_repo_name": "Risto-Stevcev/idris-catenatable-lists", "max_forks_repo_head_hexsha": "2b9e8704adb79e3fa6c7ac4372f68a2190c0e11d", "max_forks_repo_licenses": ["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.1722222222, "max_line_length": 118, "alphanum_fraction": 0.6237034988, "num_tokens": 2049, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744806385542, "lm_q2_score": 0.651354857898194, "lm_q1q2_score": 0.5325311096575153}}
{"text": "||| Test extended record syntax\ndata NotZero : Nat -> Type where\n  Is : {n : Nat} -> NotZero (S n)\n\nrecord Positive (n : Nat) {auto 0 pos : NotZero n} where\n  constructor Check\n\na : Positive 1\na = Check\n\nb : Positive 2\nb = Check\n\n{- Will not type-check\nc : Positive 0\n-}\n\ndata KindOfString = ASCII | UTF\n\nUTForASCII : KindOfString -> Type\nUTForASCII UTF = String\nUTForASCII ASCII = List Char   --- Just to demonstrate\n\nrecord FlexiString { default UTF k : KindOfString} where\n  constructor MkFlexiString\n  val : UTForASCII k\n  \nc : FlexiString\nc = MkFlexiString \"hello\"\n\nd : FlexiString {k = ASCII}\nd = MkFlexiString ['h', 'i']\n\n", "meta": {"hexsha": "b154a95346dc499c74ef221c8a11950c34c36e95", "size": 629, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/record003/Record.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/record003/Record.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/record003/Record.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.5, "max_line_length": 56, "alphanum_fraction": 0.6868044515, "num_tokens": 191, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.787931185683219, "lm_q2_score": 0.6757646075489392, "lm_q1q2_score": 0.5324560084687908}}
{"text": "module Main\n\n-- First iteration, complected number generation with labeling\n\nlabelFrom : Integer -> List a -> List (Integer, a)\nlabelFrom k [] = []\nlabelFrom k (x :: xs) = (k, x) :: labelFrom (k+1) xs\n\nlabel : List a -> List (Integer, a)\nlabel = labelFrom 0\n\n-- Second iteration, split number generation from labeling\n\ncountFrom : Integer -> List Integer\ncountFrom n = n :: countFrom (n+1)\n\nlabelWith : List Integer -> List a -> List (Integer, a)\nlabelWith _ []  = []\nlabelWith (x :: xs) (y :: ys) = (x, y) :: labelWith xs ys\n\n-- this works on the REPL because it's lazy\nlabel' : List a -> List (Integer, a)\nlabel' = labelWith (countFrom 0)\n\n-- Third iteration, Infinite Lists!\n\ndata InfList : Type -> Type where\n  (::) : (value : elem) -> Inf (InfList elem) -> InfList elem\n-- there's no [] constructor because infinite lists just don't end\n\n-- countFrom' is a corecursive function that returns codata\ntotal countFrom' : Integer -> InfList Integer\ncountFrom' x = x :: countFrom' (x + 1)\n\ngetPrefix : (count : Nat) -> InfList a -> List a\ngetPrefix Z xs = []\ngetPrefix (S k) (value :: xs) = value :: getPrefix k xs\n\nmain : IO ()\nmain = print $ getPrefix 10 (countFrom' 0)\n\n-- the following line doesn't work:\n-- main = print $ label' [1,2,3]\n", "meta": {"hexsha": "74f6bb3fad708b4ac47f09705f3a4b87df4bdd1b", "size": 1241, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris/11-InfiniteData.idr", "max_stars_repo_name": "ostera/asdf", "max_stars_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2017-03-02T22:25:19.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T18:22:11.000Z", "max_issues_repo_path": "idris/11-InfiniteData.idr", "max_issues_repo_name": "ostera/asdf", "max_issues_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2019-12-05T22:45:56.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-05T22:45:58.000Z", "max_forks_repo_path": "idris/11-InfiniteData.idr", "max_forks_repo_name": "ostera/asdf", "max_forks_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_forks_repo_licenses": ["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.2045454545, "max_line_length": 66, "alphanum_fraction": 0.6591458501, "num_tokens": 363, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673269042767, "lm_q2_score": 0.6548947223065755, "lm_q1q2_score": 0.5323425223250646}}
{"text": "module Num\n\n%default total\n\n{-\n  interface Num ty where\n    (+) : ty -> ty -> ty\n    (*) : ty -> ty -> ty\n    fromInteger : Integer -> ty\n\n  interface Num ty => Neg ty where\n    negate : ty -> ty\n    (-) : ty -> ty -> ty\n    abs : ty -> ty\n\n  interface Num ty => Integral ty  where\n    div  : ty -> ty -> ty\n    mod : ty -> ty -> ty\n\n  interface Num ty => Fractional ty where\n    (/) : ty -> ty -> ty\n    recip : ty -> ty\n\n    recip x = 1 / x\n-}", "meta": {"hexsha": "d2aca1e85639a2e7a3bddaf90cbf73bae7212351", "size": 445, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter7/Num.idr", "max_stars_repo_name": "timmyjose-study/tdd-with-idris", "max_stars_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "chapter7/Num.idr", "max_issues_repo_name": "timmyjose-study/tdd-with-idris", "max_issues_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": "chapter7/Num.idr", "max_forks_repo_name": "timmyjose-study/tdd-with-idris", "max_forks_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": 17.8, "max_line_length": 41, "alphanum_fraction": 0.4943820225, "num_tokens": 142, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8354835452961424, "lm_q2_score": 0.6370307944803832, "lm_q1q2_score": 0.5322287466352889}}
{"text": "module Quantities.ImperialUnits\n\nimport Quantities.Core\nimport Quantities.SIBaseQuantities\nimport Quantities.SIPrefixes\nimport Quantities.SIBaseUnits\nimport Quantities.SIDerivedQuantities\nimport Quantities.NonSIUnits\n\n%default total\n%access public export\n\n\n-- Based on http://en.wikipedia.org/wiki/Imperial_units\n\n\n-- Length\n\nThou : ElemUnit Length\nThou = < one \"th\" equals 25.4 (micro Metre) >\nTh : ElemUnit Length\nTh = Thou\n\nInch : ElemUnit Length\nInch = < one \"in\" equals 2.54 Centimetre >\nIn_ : ElemUnit Length\nIn_ = Inch\n\nFoot : ElemUnit Length\nFoot = < one \"ft\" equals 12 Inch >\nFt : ElemUnit Length\nFt = Foot\n\nYard : ElemUnit Length\nYard = < one \"yd\" equals 3 Foot >\nYd : ElemUnit Length\nYd = Yard\n\nChain : ElemUnit Length\nChain = < one \"ch\" equals 22 Yard >\nCh : ElemUnit Length\nCh = Chain\n\nFurlong : ElemUnit Length\nFurlong = < one \"fur\" equals 10 Chain >\nFur : ElemUnit Length\nFur = Furlong\n\nMile : ElemUnit Length\nMile = < one \"mi\" equals 1760 Yard >\nMi : ElemUnit Length\nMi = Mile\n\nLeague : ElemUnit Length\nLeague = < one \"lea\" equals 3 Mile >\nLea : ElemUnit Length\nLea = League\n\n-- Maritime units\n\nFathom : ElemUnit Length\nFathom = < one \"ftm\" equals 6.08 Foot >\nFtm : ElemUnit Length\nFtm = Fathom\n\nCable : ElemUnit Length\nCable = < one \"cable\" equals 608 Foot >\n\nNauticalMile : ElemUnit Length\nNauticalMile = < one \"nmi\" equals 1852 Metre >\nNmi : ElemUnit Length\nNmi = NauticalMile\n\n-- Gunter's survey units\n\nLink : ElemUnit Length\nLink = < one \"link\" equals (1/100) Chain >\n\nRod : ElemUnit Length\nRod = < one \"rod\" equals (1/4) Chain >\n\n\n-- Speed\n\nKnot : ElemUnit Speed\nKnot = < one \"kn\" equals 1 (NauticalMile <//> Hour) >\nKn : ElemUnit Speed\nKn = Knot\n\n\n-- Area\n\nPerch : ElemUnit Area\nPerch = < one \"perch\" equals 1 (Rod ^^ 2) >\n\nRood : ElemUnit Area\nRood = < one \"rood\" equals 1 (Furlong <**> Rod) >\n\nAcre : ElemUnit Area\nAcre = < one \"acre\" equals 1 (Furlong <**> Chain) >\n\n\n-- Volume\n\nFluidOunce : ElemUnit Volume\nFluidOunce = < one \"floz\" equals 28.4130625 (milli $ (deci Metre) ^^ 3) >\nFloz : ElemUnit Volume\nFloz = FluidOunce\n\nGill : ElemUnit Volume\nGill = < one \"gi\" equals 5 FluidOunce >\nGi : ElemUnit Volume\nGi = Gill\n\nPint : ElemUnit Volume\nPint = < one \"pt\" equals 20 FluidOunce >\nPt : ElemUnit Volume\nPt = Pint\n\nQuart : ElemUnit Volume\nQuart = < one \"qt\" equals 40 FluidOunce >\nQt : ElemUnit Volume\nQt = Quart\n\nGallon : ElemUnit Volume\nGallon = < one \"gal\" equals 160 FluidOunce >\nGal : ElemUnit Volume\nGal = Gallon\n\n-- British apothecaries' volume measures\n\nMinim : ElemUnit Volume\nMinim = < one \"min\" equals 59.1938802083 (micro $ (deci Metre) ^^ 3) >\nMin : ElemUnit Volume\nMin = Minim\n\nFluidScruple : ElemUnit Volume\nFluidScruple = < one \"fls\" equals 20 Minim >\nFls : ElemUnit Volume\nFls = FluidScruple\n\nFluidDrachm : ElemUnit Volume\nFluidDrachm = < one \"fldr\" equals 3 FluidScruple >\nFldr : ElemUnit Volume\nFldr = FluidDrachm\n\n\n-- Mass\n\nPound : ElemUnit Mass\nPound = < one \"lb\" equals 453.59237 Gram >\nLb : ElemUnit Mass\nLb = Pound\n\nGrain : ElemUnit Mass\nGrain = < one \"gr\" equals (1/7000) Pound >\nGr : ElemUnit Mass\nGr = Grain\n\nDrachm : ElemUnit Mass\nDrachm = < one \"dr\" equals (1/256) Pound >\nDr : ElemUnit Mass\nDr = Drachm\n\nOunce : ElemUnit Mass\nOunce = < one \"oz\" equals (1/16) Pound >\nOz : ElemUnit Mass\nOz = Ounce\n\nStone : ElemUnit Mass\nStone = < one \"st\" equals 14 Pound >\nSt : ElemUnit Mass\nSt = Stone\n\nQuarter : ElemUnit Mass\nQuarter = < one \"qtr\" equals 28 Pound >\nQtr : ElemUnit Mass\nQtr = Quarter\n\nHundredweight : ElemUnit Mass\nHundredweight = < one \"cwt\" equals 112 Pound >\nCwt : ElemUnit Mass\nCwt = Hundredweight\n\nTon : ElemUnit Mass\nTon = < one \"ton\" equals 2240 Pound >\n\n\n-- Energy\n\nFootPound : ElemUnit Energy\nFootPound = < one \"ftlb\" equals 1 (Foot <**> Pound <**> G_0) >\nFtlb : ElemUnit Energy\nFtlb = FootPound\n\n\n-- Power\n\nMechanicalHorsepower : ElemUnit Power\nMechanicalHorsepower = < one \"hp\" equals 550 (FootPound <//> Second) >\nImperialHorsepower : ElemUnit Power\nImperialHorsepower = MechanicalHorsepower\nHorsepower : ElemUnit Power\nHorsepower = MechanicalHorsepower\nHp : ElemUnit Power\nHp = MechanicalHorsepower\n", "meta": {"hexsha": "5651e4c6d276afd645b6722e4e9484a4913cb16b", "size": 4070, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Quantities/ImperialUnits.idr", "max_stars_repo_name": "timjb/quantities", "max_stars_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 112, "max_stars_repo_stars_event_min_datetime": "2015-01-18T13:52:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-08T14:15:46.000Z", "max_issues_repo_path": "Quantities/ImperialUnits.idr", "max_issues_repo_name": "timjb/quantities", "max_issues_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2015-11-04T08:51:41.000Z", "max_issues_repo_issues_event_max_datetime": "2018-04-17T09:52:29.000Z", "max_forks_repo_path": "Quantities/ImperialUnits.idr", "max_forks_repo_name": "timjb/quantities", "max_forks_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 9, "max_forks_repo_forks_event_min_datetime": "2015-04-28T23:49:30.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-01T17:28:34.000Z", "avg_line_length": 19.6618357488, "max_line_length": 73, "alphanum_fraction": 0.7100737101, "num_tokens": 1348, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7956581000631542, "lm_q2_score": 0.6688802603710086, "lm_q1q2_score": 0.5321999971365445}}
{"text": "import Data.String\nimport System\n\nreadNumber : IO (Maybe Nat)\nreadNumber =\n    do numstr <- getLine\n       pure (parsePositive numstr)\n\n-- worst random number generator\nrand : (min : Integer) -> (max : Integer) -> IO (Nat)\nrand min max = do secs <- time\n                  let n = (mod secs (max - min + 1)) + 1\n                  pure (integerToNat n)\n\n-- Guess the number game\nguess : (target : Nat) -> (guesses : Nat) -> IO ()\nguess target guesses =\n               do putStrLn (\"[Guess count: \" ++ show guesses ++ \"]\")\n                  putStrLn \"Enter guess: \" \n                  Just num <- readNumber \n                            | Nothing => do putStrLn \"Invalid input\"\n                                            guess target guesses\n                  case compare num target of\n                       LT => do putStrLn \"Too low.\"\n                                guess target (guesses + 1)\n                       EQ => putStrLn \"Correct!\"\n                       GT => do putStrLn \"Too high.\"\n                                guess target (guesses + 1)\n\nmain : IO ()\nmain = do\n        target <- rand 1 100\n        guess target 0", "meta": {"hexsha": "e3a7a007eb3790d2a96d52199feec52851b466fb", "size": 1132, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/ch5/ex_5_2.idr", "max_stars_repo_name": "trevarj/tdd_idris_examples", "max_stars_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "max_stars_repo_licenses": ["Unlicense"], "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/ch5/ex_5_2.idr", "max_issues_repo_name": "trevarj/tdd_idris_examples", "max_issues_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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/ch5/ex_5_2.idr", "max_forks_repo_name": "trevarj/tdd_idris_examples", "max_forks_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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": 34.303030303, "max_line_length": 68, "alphanum_fraction": 0.4717314488, "num_tokens": 240, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7956581000631542, "lm_q2_score": 0.668880247169804, "lm_q1q2_score": 0.5321999866328992}}
{"text": "import Data.List\nimport Data.List1\nimport Data.String\n\nimport System.File\n\nsimulate1 : Nat -> Nat -> Nat\nsimulate1 0 c = 1\nsimulate1 (S n) 0 = simulate1 n 6 + simulate1 n 8\nsimulate1 (S n) (S c) = simulate1 n c\n\nrun : String -> IO ()\nrun s = do let l = group $ sort $ catMaybes $ parsePositive {a=Nat} <$> (forget $ split (== ',') s)\n           let n = sum $ (\\l@(c ::: _) => (length $ forget $ l) * simulate1 256 c) <$> l\n           putStrLn $ show n\n\nmain : IO ()\nmain = do Right s <- readFile \"input.txt\"\n            | Left err => putStrLn $ show err\n          run s\n\n", "meta": {"hexsha": "39b7825cbae673d25ac6927fc16843b5d2dd433b", "size": 571, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "06/main.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "06/main.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "06/main.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.9545454545, "max_line_length": 99, "alphanum_fraction": 0.5726795096, "num_tokens": 176, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8499711604559846, "lm_q2_score": 0.6261241772283034, "lm_q1q2_score": 0.5321874935082896}}
{"text": "module AOC.Day.Three\n\nimport Data.Vect\nimport Data.String\nimport Decidable.Equality\n\n\n%default total\n\ndata Bit : Type where\n  Low : Bit\n  High : Bit\n\nShow Bit where\n  show Low = \"0\"\n  show High = \"1\"\n\nByte : (n : Nat) -> Type\nByte n = Vect n Bit\n\n-- The only problem with this is that I now need to prove that all inputs\n-- provided are of the same length. What fun.\ndata Binary : Nat -> Type where\n  BE : Binary Z\n  B0 : Binary n -> Binary (S n)\n  B1 : Binary n -> Binary (S n)\n\nexport\nShow (Binary n) where\n  show BE = \"\"\n  show (B0 b) = \"0\" ++ show b\n  show (B1 b) = \"1\" ++ show b\n\n----------------------------------------------------------------------------\n-- Code I did not need hooray ----------------------------------------------\n----------------------------------------------------------------------------\n\ntoBinary' : (s : List Char) -> Maybe (Binary (length s))\ntoBinary' [] = Just BE\ntoBinary' ('0' :: str) = (toBinary' str) >>= (\\bin => Just $ B0 bin)\ntoBinary' ('1' :: str) = (toBinary' str) >>= (\\bin => Just $ B1 bin)\ntoBinary' _ = Nothing\n\n-- This works only if the type is unpacked in the type. Otherwise there is a\n-- conflict in the length function used.\ntoBinary : (s : String) -> Maybe (Binary (length (unpack s)))\ntoBinary s = toBinary' (unpack s)\n\npublic export\nEq (Binary n) where\n  (==) BE BE = False\n  (==) (B0 x) (B0 y) = x == y\n  (==) (B0 x) (B1 y) = False\n  (==) (B1 x) (B0 y) = False\n  (==) (B1 x) (B1 y) = x == y\n\n-- The new Control.Function defines the `Injective` interface, which would make\n-- these definitions unnecessary.\nB0Injective : (0 left, right : Binary n) -> B0 left = B0 right -> left = right\nB0Injective _ _ Refl = Refl\n\nB1Injective : (0 left, right : Binary n) -> B1 left = B1 right -> left = right\nB1Injective _ _ Refl = Refl\n\n-- Sweet, I don't actually need this for the exactLength function\npublic export\nDecEq (Binary n) where\n  decEq BE BE = Yes Refl\n  decEq (B0 x) (B0 y) with (decEq x y)\n    decEq (B0 x) (B0 y) | (Yes prf) = Yes (cong B0 prf)\n    decEq (B0 x) (B0 y) | (No contra) = No $ \\h : (B0 x = B0 y) => contra $ B0Injective x y h\n  decEq (B1 x) (B1 y) with (decEq x y)\n    decEq (B1 x) (B1 y) | (Yes prf) = Yes (cong B1 prf)\n    decEq (B1 x) (B1 y) | (No contra) = No $ \\h : (B1 x = B1 y) => contra $ B1Injective x y h\n  decEq (B0 x) (B1 y) = No B0B1impossible\n    where\n      B0B1impossible : (B0 x = B1 y) -> Void\n      B0B1impossible Refl impossible\n  decEq (B1 x) (B0 y) = No B1B0impossible\n    where\n      B1B0impossible : (B1 x = B0 y) -> Void\n      B1B0impossible Refl impossible\n\n----------------------------------------------------------------------------\n-- Proofs required for parsing ---------------------------------------------\n----------------------------------------------------------------------------\n\nexactLength : {m : Nat} -> -- expected at run-time\n              (len : Nat) -> (xs : Binary m) -> Maybe (Binary len)\nexactLength {m} len xs with (decEq m len)\n  exactLength {m = m} m xs | (Yes Refl) = Just xs\n  exactLength {m = m} len xs | (No contra) = Nothing\n\n-- Stolen from https://github.com/jumper149/AoC2021/blob/main/03/src/Main.idr\nexactLengths : (len : Nat) -> Traversable t => t (n ** Binary n) -> Maybe (t (Binary len))\nexactLengths len xs = traverse (\\ x => exactLength len x.snd) xs\n\n----------------------------------------------------------------------------\n-- Actual parsing code -----------------------------------------------------\n----------------------------------------------------------------------------\n\ntoBinaryDep' : (s : List Char) -> Maybe (n ** Binary n)\ntoBinaryDep' [] = Just (0 ** BE)\ntoBinaryDep' ('0' :: str) = (toBinaryDep' str) >>= (\\(n ** bin) => Just $ (S n ** B0 bin))\ntoBinaryDep' ('1' :: str) = (toBinaryDep' str) >>= (\\(n ** bin) => Just $ (S n ** B1 bin))\ntoBinaryDep' _ = Nothing\n\nexport\ntoBinaryDep : (s : String) -> Maybe (n ** Binary n)\ntoBinaryDep s = toBinaryDep' (unpack s)\n\nexport\nparseBinary : List (n ** Binary n) -> Maybe (m ** List (Binary m))\nparseBinary [] = Just (0 ** [])\nparseBinary ((len ** bin) :: ys) = do\n    list <- exactLengths len ys\n    pure (len ** bin :: list)\n\n  -- Ok, this does not work for some reason or another\n  -- Prove that the size of the binary numbers in ys is the same as the size of\n  -- bin.\n\n  -- (ys_len ** ys) <- parseBinary ys\n  -- bin <- exactLength ys_len bin\n\n  -- -- With the sizes resolved, reconstruct with the dependent pair on the outside\n  -- -- of the list.\n  -- pure (ys_len ** bin :: ys)\n\n----------------------------------------------------------------------------\n-- Implementing Vect like interfaces for Binary ----------------------------\n----------------------------------------------------------------------------\n\n-- Most of these functions are just to make it easier to answer the AOC questions, since they involve transforming the individual bits into a\n\nbinaryToVect : Binary n -> Vect n Bool\nbinaryToVect BE = []\nbinaryToVect (B0 x) = False :: (binaryToVect x)\nbinaryToVect (B1 x) = True :: (binaryToVect x)\n\nmapBinary : (Bool -> a) -> Binary n -> Vect n a\nmapBinary f = map f . binaryToVect\n\n\n-- day3 : List String -> (Integer, Integer)\n-- day3 binary = ?something\n", "meta": {"hexsha": "2d05cfacc4b98388dce9c7d86aac3517798a23eb", "size": 5165, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/AOC/Day/ThreeOld.idr", "max_stars_repo_name": "ryanorendorff/aoc2021", "max_stars_repo_head_hexsha": "47a4d406ee8b70a73bcf6e4b168b02af83201ae7", "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/AOC/Day/ThreeOld.idr", "max_issues_repo_name": "ryanorendorff/aoc2021", "max_issues_repo_head_hexsha": "47a4d406ee8b70a73bcf6e4b168b02af83201ae7", "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/AOC/Day/ThreeOld.idr", "max_forks_repo_name": "ryanorendorff/aoc2021", "max_forks_repo_head_hexsha": "47a4d406ee8b70a73bcf6e4b168b02af83201ae7", "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": 35.1360544218, "max_line_length": 141, "alphanum_fraction": 0.5297192643, "num_tokens": 1491, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7745833841649233, "lm_q2_score": 0.6859494614282923, "lm_q1q2_score": 0.5313250551992332}}
{"text": "> module Main\n\n> import Data.So\n\n> ifTrue        :   So True -> Nat\n> ifTrue Oh     =   S Z\n\n> ifFalse       :   So False -> Nat\n> ifFalse Oh impossible\n\n> test          :   (f : Nat -> Bool) -> (n : Nat) -> So (f n) -> Nat\n> test f n x   with   (f n)\n>               |   True     =  ifTrue  x\n>               |   False    =  ifFalse x\n\n> main : IO ()\n> main = printLn (test ((S 4) ==) 5 Oh)\n\n", "meta": {"hexsha": "98cd8135c682784c54ef072d312f496723aa0a3f", "size": 393, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/basic005/test019.lidr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/basic005/test019.lidr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/basic005/test019.lidr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 20.6842105263, "max_line_length": 69, "alphanum_fraction": 0.4300254453, "num_tokens": 134, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8289387998695209, "lm_q2_score": 0.640635854839898, "lm_q1q2_score": 0.5310479166643697}}
{"text": "module Control.Optics.Getter\n\nimport public Control.Optics.Types\n\nexport\nview : Getting a s a -> s -> a\nview l = runConst . applyMor (l (Mor MkConst))\n\ninfixl 8 ^.\nexport\n(^.) : s -> Getting a s a -> a\ns ^. l = view l s\n\nexport\nto : (Profunctor p, Contravariant f) => (s -> a) -> Simple (Optic p f) s a\nto k = dimap k (contramap k)\n", "meta": {"hexsha": "45ee09e2d4bd5defd79c08e5b43a9dad38bc58e9", "size": 332, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Control/Optics/Getter.idr", "max_stars_repo_name": "tensorknower69/idris2-optics", "max_stars_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "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/Control/Optics/Getter.idr", "max_issues_repo_name": "tensorknower69/idris2-optics", "max_issues_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_issues_repo_licenses": ["MIT"], "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/Control/Optics/Getter.idr", "max_forks_repo_name": "tensorknower69/idris2-optics", "max_forks_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_forks_repo_licenses": ["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.5294117647, "max_line_length": 74, "alphanum_fraction": 0.6355421687, "num_tokens": 116, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8152324983301568, "lm_q2_score": 0.6513548646660543, "lm_q1q2_score": 0.5310056536212086}}
{"text": "module Data.Functor.Compose\n\npublic export\ndata Compose : (f : Type -> Type) -> (g : Type -> Type) -> Type -> Type where\n  MkCompose : f (g x) -> Compose f g x\n\npublic export\ngetCompose : Compose f g a -> f (g a)\ngetCompose (MkCompose x) = x\n\npublic export\nimplementation (Functor f, Functor g) => Functor (Compose f g) where\n  map f (MkCompose x) = MkCompose $ map (map f) x\n\n", "meta": {"hexsha": "6df897d714a1ff124717b914493f05c4e6434e80", "size": 377, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Functor/Compose.idr", "max_stars_repo_name": "MarcelineVQ/idris2-streaming", "max_stars_repo_head_hexsha": "fa0864c9b441e7ab82131364b7b4124f4bb3a600", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2020-08-18T20:53:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-20T15:56:37.000Z", "max_issues_repo_path": "src/Data/Functor/Compose.idr", "max_issues_repo_name": "MarcelineVQ/idris2-streaming", "max_issues_repo_head_hexsha": "fa0864c9b441e7ab82131364b7b4124f4bb3a600", "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/Data/Functor/Compose.idr", "max_forks_repo_name": "MarcelineVQ/idris2-streaming", "max_forks_repo_head_hexsha": "fa0864c9b441e7ab82131364b7b4124f4bb3a600", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2020-12-18T08:23:15.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-22T15:41:07.000Z", "avg_line_length": 25.1333333333, "max_line_length": 77, "alphanum_fraction": 0.6631299735, "num_tokens": 120, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7853085909370423, "lm_q2_score": 0.6757646010190477, "lm_q1q2_score": 0.5306837466314009}}
{"text": "------------------------------------------------------------------------\n-- This module is based on the following papers:\n\n-- Categories of Containers\n-- Abbott, Altenkirch, Ghani\n\n-- Derivatives of Containers\n-- Abbott, Altenkirch, Ghani, McBride\n------------------------------------------------------------------------\n\nmodule Data.Container\n\nimport Data.Either\nimport Decidable.Equality\n\n%default total\n\n------------------------------------------------------------------------\n-- Container and their morphisms\n-- * Extension is a functor from Container to Type\n\n-- Objects of the category of containers\nnamespace Container\n\n  public export\n  record Container where\n    constructor MkContainer\n    Shape : Type\n    Position : Shape -> Type\n\n  public export\n  record Extension (c : Container) (x : Type) where\n    constructor MkExtension\n    shape    : Shape c\n    payloads : Position c shape -> x\n\n  ||| The image of a container by @Extension@ is a functor\n  public export\n  Functor (Extension c) where map f (MkExtension s p) = MkExtension s (f . p)\n\n-- Morphisms of the category of containers\nnamespace Morphism\n\n  public export\n  record Morphism (c, d : Container) where\n    constructor MkMorphism\n    shapeMorphism : Shape c -> Shape d\n    positionMorphism : {s : Shape c} -> Position d (shapeMorphism s) -> Position c s\n\n  public export\n  Extension : Morphism c d -> Extension c x -> Extension d x\n  Extension phi (MkExtension s p)\n    = MkExtension (shapeMorphism phi s) (p . positionMorphism phi)\n\n------------------------------------------------------------------------\n-- Combinators to build containers\n\nnamespace Combinators\n\n  -- Constant\n  public export\n  Const : Type -> Container\n  Const k = MkContainer k (const Void)\n\n  export\n  toConst : k -> Extension (Const k) x\n  toConst v = MkExtension v absurd\n\n  export\n  fromConst : Extension (Const k) x -> k\n  fromConst (MkExtension v _) = v\n\n  -- Identity\n  public export\n  Identity : Container\n  Identity = MkContainer () (\\ () => ())\n\n  export\n  toIdentity : x -> Extension Identity x\n  toIdentity v = MkExtension () (const v)\n\n  export\n  fromIdentity : Extension Identity x -> x\n  fromIdentity (MkExtension () chld) = chld ()\n\n  -- Composition\n  public export\n  Compose : (d, c : Container) -> Container\n  Compose d c = MkContainer\n    (Extension d (Shape c))\n    (\\ (MkExtension shp chld) => (p : Position d shp ** Position c (chld p)))\n\n  export\n  toCompose : (Extension d . Extension c) x -> Extension (Compose d c) x\n  toCompose (MkExtension shp1 chld)\n    = MkExtension (MkExtension shp1 (shape . chld)) (\\ (p ** q) => payloads (chld p) q)\n\n  export\n  fromCompose : Extension (Compose d c) x -> (Extension d . Extension c) x\n  fromCompose (MkExtension (MkExtension shp1 shp2) chld)\n    = MkExtension shp1 (\\ p => MkExtension (shp2 p) (\\ q => chld (p ** q)))\n\n  -- Direct sum\n  public export\n  Sum : (c, d : Container) -> Container\n  Sum c d = MkContainer (Either (Shape c) (Shape d)) (either (Position c) (Position d))\n\n  export\n  toSum : Either (Extension c x) (Extension d x) -> Extension (Sum c d) x\n  toSum (Left (MkExtension shp chld)) = MkExtension (Left shp) chld\n  toSum (Right (MkExtension shp chld)) = MkExtension (Right shp) chld\n\n  export\n  fromSum : Extension (Sum c d) x -> Either (Extension c x) (Extension d x)\n  fromSum (MkExtension (Left shp) chld) = Left (MkExtension shp chld)\n  fromSum (MkExtension (Right shp) chld) = Right (MkExtension shp chld)\n\n  -- Pairing\n  public export\n  Pair : (c, d : Container) -> Container\n  Pair c d = MkContainer (Shape c, Shape d) (\\ (p, q) => Either (Position c p) (Position d q))\n\n  export\n  toPair : (Extension c x, Extension d x) -> Extension (Pair c d) x\n  toPair (MkExtension shp1 chld1, MkExtension shp2 chld2)\n    = MkExtension (shp1, shp2) (either chld1 chld2)\n\n  export\n  fromPair : Extension (Pair c d) x -> (Extension c x, Extension d x)\n  fromPair (MkExtension (shp1, shp2) chld)\n    = (MkExtension shp1 (chld . Left), MkExtension shp2 (chld . Right))\n\n  -- Branching over a Type\n  public export\n  Exponential : Type -> Container -> Container\n  Exponential k c = MkContainer (k -> Shape c) (\\ p => (v : k ** Position c (p v)))\n\n  export\n  toExponential : (k -> Extension c x) -> Extension (Exponential k c) x\n  toExponential f = MkExtension (shape . f) (\\ (v ** p) => payloads (f v) p)\n\n  export\n  fromExponential : Extension (Exponential k c) x -> (k -> Extension c x)\n  fromExponential (MkExtension  shp chld) k = MkExtension (shp k) (\\ p => chld (k ** p))\n\n------------------------------------------------------------------------\n-- Taking various fixpoints of containers\n\nnamespace Initial\n\n  public export\n  data W : Container -> Type where\n    MkW : Extension c (W c) -> W c\n\n  export\n  map : Morphism c d -> W c -> W d\n  map f (MkW (MkExtension shp chld)) = MkW $ Extension f (MkExtension shp (\\ p => map f (chld p)))\n  --  Container.map inlined because of -------------------^\n  --  termination checking\n\n  export\n  foldr : (Extension c x -> x) -> W c -> x\n  foldr alg (MkW (MkExtension shp chld)) = alg (MkExtension shp (\\ p => foldr alg (chld p)))\n\n  export\n  para : (Extension c (x, W c) -> x) -> W c -> x\n  para alg (MkW (MkExtension shp chld)) = alg (MkExtension shp (\\ p => let w = chld p in (para alg w, w)))\n\nnamespace Monad\n\n  ||| @Free@ is a wrapper around @W@ to make it inference friendly.\n  ||| Without this wrapper, neither @pure@ nor @bind@ are able to infer their @c@ argument.\n  public export\n  record Free (c : Container) (x : Type) where\n    constructor MkFree\n    runFree : W (Sum c (Const x))\n\n  export\n  pure : x -> Free c x\n  pure x = MkFree $ MkW (toSum (Right (toConst x)))\n\n  export\n  (>>=) : Free c x -> (x -> Free c y) -> Free c y\n  (>>=) (MkFree mx) k = foldr (alg . fromSum {c} {d = Const x}) mx where\n\n    alg : Either (Extension c (Free c y)) (Extension (Const x) (Free c y)) -> Free c y\n    alg  = either (MkFree . MkW . toSum {c} {d = Const y} . Left . map (runFree {c}))\n                  (k . fromConst {k = x})\n\n  export\n  join : Free c (Free c x) -> Free c x\n  join = (>>= id)\n\nnamespace Final\n\n  public export\n  data M : Container -> Type where\n    MkM : Extension c (Inf (M c)) -> M c\n\n  export\n  unfoldr : (s -> Extension c s) -> s -> M c\n  unfoldr next seed =\n    let (MkExtension shp chld) = next seed in\n    MkM (MkExtension shp (\\ p => unfoldr next (chld p)))\n\nnamespace Comonad\n\n  ||| @Cofree@ is a wrapper around @M@ to make it inference friendly.\n  ||| Without this wrapper, neither @extract@ nor @extend@ are able to infer their @c@ argument.\n  public export\n  record Cofree (c : Container) (x : Type) where\n    constructor MkCofree\n    runCofree : M (Pair (Const x) c)\n\n  export\n  extract : Cofree c x -> x\n  extract (MkCofree (MkM m)) = fst (shape m)\n\n  export\n  extend : (Cofree c a -> b) -> Cofree c a -> Cofree c b\n  extend alg = MkCofree . unfoldr next . runCofree where\n\n    next : M (Pair (Const a) c) -> Extension (Pair (Const b) c) (M (Pair (Const a) c))\n    next m@(MkM layer) =\n      let (_, (MkExtension shp chld)) = fromPair {c = Const a} layer in\n      let b = toConst (alg (MkCofree m)) in\n      toPair (b, MkExtension shp (\\ p => chld p))\n-- Eta-expanded to force Inf ------^\n\n  export\n  duplicate : Cofree c a -> Cofree c (Cofree c a)\n  duplicate = extend id\n\n------------------------------------------------------------------------\n-- Derivative\n\nnamespace Derivative\n\n  public export\n  Derivative : Container -> Container\n  Derivative c = MkContainer\n    (s : Shape c ** Position c s)\n    (\\ (s ** p) => (p' : Position c s ** Not (p === p')))\n\n  export\n  hole : (v : Extension (Derivative c) x) -> Position c (fst (shape v))\n  hole (MkExtension (shp ** p) _) = p\n\n  export\n  unplug : (v : Extension c x) -> Position c (shape v) -> (Extension (Derivative c) x, x)\n  unplug (MkExtension shp chld) p = (MkExtension (shp ** p) (chld . fst), chld p)\n\n  export\n  plug : (v : Extension (Derivative c) x) -> DecEq (Position c (fst (shape v))) => x -> Extension c x\n  plug (MkExtension (shp ** p) chld) x = MkExtension shp $ \\ p' => case decEq p p' of\n    Yes eq => x\n    No neq => chld (p' ** neq)\n\n  export\n  toConst : Extension (Const Void) x -> Extension (Derivative (Const k)) x\n  toConst v = absurd (fromConst v)\n\n  export\n  fromConst : Extension (Derivative (Const k)) x -> Extension (Const Void) x\n  fromConst v = absurd (hole {c = Const _} v)\n\n  export\n  toIdentity : Extension (Derivative Identity) x\n  toIdentity = MkExtension (() ** ()) (\\ (() ** eq) => absurd (eq Refl))\n\n  export\n  toSum : Extension (Sum (Derivative c) (Derivative d)) x ->\n          Extension (Derivative (Sum c d)) x\n  toSum v = case fromSum {c = Derivative c} {d = Derivative d} v of\n    Left (MkExtension (shp ** p) chld) => MkExtension (Left shp ** p) chld\n    Right (MkExtension (shp ** p) chld) => MkExtension (Right shp ** p) chld\n\n  export\n  fromSum : Extension (Derivative (Sum c d)) x ->\n            Extension (Sum (Derivative c) (Derivative d)) x\n  fromSum (MkExtension (shp ** p) chld) = toSum {c = Derivative c} {d = Derivative d} $ case shp of\n    Left shp => Left (MkExtension (shp ** p) chld)\n    Right shp => Right (MkExtension (shp ** p) chld)\n\n  export\n  toPair : Extension (Sum (Pair (Derivative c) d) (Pair c (Derivative d))) x ->\n           Extension (Derivative (Pair c d)) x\n  toPair v = case fromSum {c = Pair (Derivative c) d} {d = Pair c (Derivative d)} v of\n    Left p => let (MkExtension (shp1 ** p1) chld1, MkExtension shp2 chld2) = fromPair {c = Derivative c} p in\n              MkExtension ((shp1, shp2) ** Left p1) $ \\ (p' ** neq) => case p' of\n                  Left p1' => chld1 (p1' ** (neq . cong Left))\n                  Right p2' => chld2 p2'\n    Right p => let (MkExtension shp1 chld1, MkExtension (shp2 ** p2) chld2) = fromPair {c} {d = Derivative d} p in\n               MkExtension ((shp1, shp2) ** Right p2) $ \\ (p' ** neq) => case p' of\n                  Left p1' => chld1 p1'\n                  Right p2' => chld2 (p2' ** (neq . cong Right))\n\n  export\n  fromPair : Extension (Derivative (Pair c d)) x ->\n             Extension (Sum (Pair (Derivative c) d) (Pair c (Derivative d))) x\n  fromPair (MkExtension ((shp1, shp2) ** p) chld) = case p of\n    Left p1 => toSum {c = Pair (Derivative c) d} {d = Pair c (Derivative d)}\n                     (Left (MkExtension ((shp1 ** p1), shp2) $ either\n                         (\\ p1' => chld (Left (DPair.fst p1') ** DPair.snd p1' . injective))\n                         (\\ p2 => chld (Right p2 ** absurd))))\n    Right p2 => toSum {c = Pair (Derivative c) d} {d = Pair c (Derivative d)}\n                     (Right (MkExtension (shp1, (shp2 ** p2)) $ either\n                         (\\ p1 => chld (Left p1 ** absurd))\n                         (\\ p2' => chld (Right (DPair.fst p2') ** DPair.snd p2' . injective))))\n\n\n  export\n  fromCompose : Extension (Derivative (Compose c d)) x ->\n                Extension (Pair (Derivative d) (Compose (Derivative c) d)) x\n  fromCompose (MkExtension (MkExtension shp1 shp2 ** (p1 ** p2)) chld)\n    = toPair (left, right) where\n\n      left : Extension (Derivative d) x\n      left = MkExtension (shp2 p1 ** p2)\n           $ \\ (p2' ** neqp2) => chld ((p1 ** p2') ** neqp2 . mkDPairInjectiveSnd)\n\n      right : Extension (Compose (Derivative c) d) x\n      right = toCompose\n            $ MkExtension (shp1 ** p1)\n            $ \\ (p1' ** neqp1) => MkExtension (shp2 p1')\n                                 $ \\ p2' => chld ((p1' ** p2') ** (neqp1 . cong fst))\n\n  export\n  toCompose : ((s : _) -> DecEq (Position c s)) -> ((s : _) -> DecEq (Position d s)) ->\n              Extension (Pair (Derivative d) (Compose (Derivative c) d)) x ->\n              Extension (Derivative (Compose c d)) x\n  toCompose dec1 dec2 v with (fromPair {c = Derivative d} {d = Compose (Derivative c) d} v)\n    toCompose dec1 dec2 v | (MkExtension (shp2 ** p2) chld2, w) with (fromCompose w)\n      toCompose dec1 dec2 v\n        | (MkExtension (shp2 ** p2) chld2, w)\n        | (MkExtension (shp1 ** p1) chld1)\n        = MkExtension (MkExtension shp1 (\\ p1' => shp2' p1' (decEq @{dec1 shp1} p1 p1')) **\n                      (p1 ** (p2' (decEq @{dec1 shp1} p1 p1))))\n        $ \\ ((p1' ** p2'') ** neq) => chld2' p1' p2'' neq\n\n         where\n          shp2' : (p1' : Position c shp1) -> Dec (p1 === p1') -> Shape d\n          shp2' p1' (Yes eq) = shp2\n          shp2' p1' (No neq) = shape (chld1 (p1' ** neq))\n\n          p2' : (eq : Dec (p1 === p1)) -> Position d (shp2' p1 eq)\n          p2' (Yes Refl) = p2\n          p2' (No neq)   = absurd (neq Refl)\n\n          chld2' : (p1' : Position c shp1) ->\n                   (p2'' : Position d (shp2' p1' (decEq @{dec1 shp1} p1 p1'))) ->\n                   (neq : Not (MkDPair p1 (p2' (decEq @{dec1 shp1} p1 p1)) = MkDPair p1' p2'')) -> x\n          chld2' p1' p2'' neq with (decEq @{dec1 shp1} p1 p1')\n            chld2' p1' p2'' neq | No neq1 = payloads (chld1 (p1' ** neq1)) p2''\n            chld2' _ p2'' neq | Yes Refl with (decEq @{dec1 shp1} p1 p1)\n              chld2' _ p2'' neq | Yes Refl | No argh = absurd (argh Refl)\n              chld2' _ p2'' neq | Yes Refl | Yes Refl with (decEq @{dec2 shp2} p2 p2'')\n                chld2' _ p2'' neq | Yes Refl | Yes Refl | No neq2 = chld2 (p2'' ** neq2)\n                chld2' _ _ neq | Yes Refl | Yes Refl | Yes Refl = absurd (neq Refl)\n", "meta": {"hexsha": "8bef70815c655878ce5b51f53ca7f20020d42e5f", "size": 13304, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/contrib/Data/Container.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/libs/contrib/Data/Container.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/libs/contrib/Data/Container.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 36.9555555556, "max_line_length": 114, "alphanum_fraction": 0.576443175, "num_tokens": 4280, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059511841119, "lm_q2_score": 0.6688802603710085, "lm_q1q2_score": 0.5304929151298251}}
{"text": "module Leap\n\nexport \nisLeap : Int -> Bool\nisLeap year =\n  (divBy 4 && not (divBy 100)) || divBy 400\n  where divBy : Int -> Bool\n        divBy n = (year `mod` n) == 0\n\nexport\nversion : String\nversion = \"1.0.0\"\n", "meta": {"hexsha": "927443875f06eed295e177cd17a5aa56accbd179", "size": 209, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "exercises/practice/leap/example/Leap.idr", "max_stars_repo_name": "ee7/idris", "max_stars_repo_head_hexsha": "4681a9c23e1eeee2902c9ff9c46b1296b0ceb3f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2017-07-19T05:27:12.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T20:25:21.000Z", "max_issues_repo_path": "exercises/practice/leap/example/Leap.idr", "max_issues_repo_name": "ee7/idris", "max_issues_repo_head_hexsha": "4681a9c23e1eeee2902c9ff9c46b1296b0ceb3f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 52, "max_issues_repo_issues_event_min_datetime": "2017-07-29T03:20:04.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-02T13:17:24.000Z", "max_forks_repo_path": "exercises/practice/leap/example/Leap.idr", "max_forks_repo_name": "ee7/idris", "max_forks_repo_head_hexsha": "4681a9c23e1eeee2902c9ff9c46b1296b0ceb3f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 15, "max_forks_repo_forks_event_min_datetime": "2017-06-28T18:14:58.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-27T07:24:33.000Z", "avg_line_length": 16.0769230769, "max_line_length": 43, "alphanum_fraction": 0.5980861244, "num_tokens": 76, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7690802370707283, "lm_q2_score": 0.6893056231680122, "lm_q1q2_score": 0.530131332080241}}
{"text": "||| Spec: https://webassembly.github.io/spec/core/syntax/modules.html#memories\nmodule WebAssembly.Structure.Modules.Memories\n\nimport WebAssembly.Structure.Types\n\nimport Decidable.Equality\n\n-- Definition\n\npublic export\nrecord Mem where\n  constructor MkMem\n  type : MemType\n\n-- Equality\n\ntotal public export\nlemma_mem__type_injective : ((m1 = m2) -> Void) -> (MkMem m1 = MkMem m2) -> Void\nlemma_mem__type_injective m1_not_m2 Refl = m1_not_m2 Refl\n\n-- Decidable Equality\n\npublic export\nimplementation DecEq Mem where\n  decEq (MkMem m1) (MkMem m2) = case decEq m1 m2 of\n    No m1_not_m2 => No $ lemma_mem__type_injective m1_not_m2\n    Yes Refl     => Yes Refl\n", "meta": {"hexsha": "e8a31c6e25e1947e7d50db8e6aae87853fd6f57b", "size": 656, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "WebAssembly/Structure/Modules/Memories.idr", "max_stars_repo_name": "RaoulSchaffranek/idris-webassembly", "max_stars_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-11-07T16:03:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-07T16:03:42.000Z", "max_issues_repo_path": "WebAssembly/Structure/Modules/Memories.idr", "max_issues_repo_name": "RaoulSchaffranek/idris-webassembly", "max_issues_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "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": "WebAssembly/Structure/Modules/Memories.idr", "max_forks_repo_name": "RaoulSchaffranek/idris-webassembly", "max_forks_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "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": 23.4285714286, "max_line_length": 80, "alphanum_fraction": 0.7576219512, "num_tokens": 199, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7577943712746406, "lm_q2_score": 0.6992544273261176, "lm_q1q2_score": 0.5298910691166041}}
{"text": "module Example.Pil.GenShow\n\nimport Data.List\n\nimport Example.Pil.Gen\n\n%default total\n\n%hint\ninterestingType : Gen Type\ninterestingType = oneOf $ map pure $ [Int, String, Bool]\n\nDecEq' Type where\n  decEq' Int    Int    = Yes Refl\n  decEq' String String = Yes Refl\n  decEq' Bool   Bool   = Yes Refl\n  decEq' _      _      = No\n\nalphaChar : Gen Char\nalphaChar = choose ('a', 'z')\n\n%hint\nalphaString : Gen String\nalphaString = map pack $ sequence $ replicate !(choose (1, 3)) alphaChar\n\n%hint\nvarName : Gen Name\nvarName = MkName <$> alphaString\n\npartial\nsimpleValue : {a : Type} -> Gen a\nsimpleValue {a=Int}    = chooseAny\nsimpleValue {a=String} = alphaString\nsimpleValue {a=Bool}   = chooseAny\n\npartial\nuniFunction : {a : Type} -> Gen (a -> a)\nuniFunction {a=Int}    = oneOf $ map pure $ [ (+1), (+2), \\x => x - 1 ]\nuniFunction {a=String} = oneOf $ map pure $ [ (\"a\"++), (++\"z\") ]\nuniFunction {a=Bool}   = pure not\n\npartial\nbiFunction : {a : Type} -> Gen (a -> a -> a)\nbiFunction {a=Int}    = oneOf $ map pure $ [ (+), (*) ]\nbiFunction {a=String} = pure (++)\nbiFunction {a=Bool}   = oneOf $ map pure $ [ (\\x, y => x && y), (\\x, y => x || y) ]\n\n%hint\npartial\ninterestingExpr : {a : Type} -> {ctx : Context} -> Gen (Expression ctx a)\ninterestingExpr = exprGen 3 simpleValue uniFunction biFunction\n\npartial\nsomeStatementGen : Gen (post ** Statement [] post)\nsomeStatementGen = stmtGen []\n\npartial\nsomeStatement : (post ** Statement [] post)\nsomeStatement = unGen someStatementGen someStdGen\n", "meta": {"hexsha": "16700d47c6658a03538a8bcec20bc6596f733626", "size": 1485, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil/GenShow.idr", "max_stars_repo_name": "buzden/code-in-lectures", "max_stars_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-02-17T07:01:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-17T07:01:15.000Z", "max_issues_repo_path": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil/GenShow.idr", "max_issues_repo_name": "buzden/code-in-lectures", "max_issues_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil/GenShow.idr", "max_forks_repo_name": "buzden/code-in-lectures", "max_forks_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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": 83, "alphanum_fraction": 0.6464646465, "num_tokens": 466, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7799929002541068, "lm_q2_score": 0.679178699175393, "lm_q1q2_score": 0.5297545633606263}}
{"text": "module Foo\n\nplusAssoc : plus n (plus m o) = plus (plus n m) o\nplusAssoc = ?impl\n", "meta": {"hexsha": "30625647cb6e4e8d5a20c17033d0162206d27c30", "size": 80, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris-exercises/InteractiveProving.idr", "max_stars_repo_name": "0nkery/tt-tutorials", "max_stars_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "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": "idris-exercises/InteractiveProving.idr", "max_issues_repo_name": "0nkery/tt-tutorials", "max_issues_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "idris-exercises/InteractiveProving.idr", "max_forks_repo_name": "0nkery/tt-tutorials", "max_forks_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_forks_repo_licenses": ["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.0, "max_line_length": 49, "alphanum_fraction": 0.6625, "num_tokens": 28, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7879312155622449, "lm_q2_score": 0.6723316991792861, "lm_q1q2_score": 0.5297511329953645}}
{"text": "Ty : Type\nTy = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty : Ty\nempty = \\ _, empty, _ => empty\n\narr : Ty -> Ty -> Ty\narr = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon : Type\nCon = (Con : Type)\n ->(nil  : Con)\n ->(snoc : Con -> Ty -> Con)\n -> Con\n\nnil : Con\nnil = \\ con, nil, snoc => nil\n\nsnoc : Con -> Ty -> Con\nsnoc = \\ g, a, con, nil, snoc => snoc (g con nil snoc) a\n\nVar : Con -> Ty -> Type\nVar = \\ g, a =>\n    (Var : Con -> Ty -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var (snoc g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var g a -> Var (snoc g b) a)\n -> Var g a\n\nvz : {g : _}-> {a : _} -> Var (snoc g a) a\nvz = \\ var, vz, vs => vz _ _\n\nvs : {g : _} -> {B : _} -> {a : _} -> Var g a -> Var (snoc g B) a\nvs = \\ x, var, vz, vs => vs _ _ _ (x var vz vs)\n\nTm : Con -> Ty -> Type\nTm = \\ g, a =>\n    (Tm    : Con -> Ty -> Type)\n -> (var   : (g : _) -> (a : _) -> Var g a -> Tm g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm (snoc g a) B -> Tm g (arr a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm g (arr a B) -> Tm g a -> Tm g B)\n -> Tm g a\n\nvar : {g : _} -> {a : _} -> Var g a -> Tm g a\nvar = \\ x, tm, var, lam, app => var _ _ x\n\nlam : {g : _} -> {a : _} -> {B : _} -> Tm (snoc g a) B -> Tm g (arr a B)\nlam = \\ t, tm, var, lam, app => lam _ _ _ (t tm var lam app)\n\napp : {g:_}->{a:_}->{B:_} -> Tm g (arr a B) -> Tm g a -> Tm g B\napp = \\ t, u, tm, var, lam, app => app _ _ _ (t tm var lam app) (u tm var lam app)\n\nv0 : {g:_}->{a:_} -> Tm (snoc g a) a\nv0 = var vz\n\nv1 : {g:_}->{a:_}-> {B:_}-> Tm (snoc (snoc g a) B) a\nv1 = var (vs vz)\n\nv2 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm (snoc (snoc (snoc g a) B) C) a\nv2 = var (vs (vs vz))\n\nv3 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm (snoc (snoc (snoc (snoc g a) B) C) D) a\nv3 = var (vs (vs (vs vz)))\n\nv4 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm (snoc (snoc (snoc (snoc (snoc g a) B) C) D) E) a\nv4 = var (vs (vs (vs (vs vz))))\n\ntest : {g:_}-> {a:_} -> Tm g (arr (arr a a) (arr a a))\ntest  = lam (lam (app v1 (app v1 (app v1 (app v1 (app v1 (app v1 v0)))))))\nTy1 : Type\nTy1 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty1 : Ty1\nempty1 = \\ _, empty, _ => empty\n\narr1 : Ty1 -> Ty1 -> Ty1\narr1 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon1 : Type\nCon1 = (Con1 : Type)\n ->(nil  : Con1)\n ->(snoc : Con1 -> Ty1 -> Con1)\n -> Con1\n\nnil1 : Con1\nnil1 = \\ con, nil1, snoc => nil1\n\nsnoc1 : Con1 -> Ty1 -> Con1\nsnoc1 = \\ g, a, con, nil1, snoc1 => snoc1 (g con nil1 snoc1) a\n\nVar1 : Con1 -> Ty1 -> Type\nVar1 = \\ g, a =>\n    (Var1 : Con1 -> Ty1 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var1 (snoc1 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var1 g a -> Var1 (snoc1 g b) a)\n -> Var1 g a\n\nvz1 : {g : _}-> {a : _} -> Var1 (snoc1 g a) a\nvz1 = \\ var, vz1, vs => vz1 _ _\n\nvs1 : {g : _} -> {B : _} -> {a : _} -> Var1 g a -> Var1 (snoc1 g B) a\nvs1 = \\ x, var, vz1, vs1 => vs1 _ _ _ (x var vz1 vs1)\n\nTm1 : Con1 -> Ty1 -> Type\nTm1 = \\ g, a =>\n    (Tm1    : Con1 -> Ty1 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var1 g a -> Tm1 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm1 (snoc1 g a) B -> Tm1 g (arr1 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm1 g (arr1 a B) -> Tm1 g a -> Tm1 g B)\n -> Tm1 g a\n\nvar1 : {g : _} -> {a : _} -> Var1 g a -> Tm1 g a\nvar1 = \\ x, tm, var1, lam, app => var1 _ _ x\n\nlam1 : {g : _} -> {a : _} -> {B : _} -> Tm1 (snoc1 g a) B -> Tm1 g (arr1 a B)\nlam1 = \\ t, tm, var1, lam1, app => lam1 _ _ _ (t tm var1 lam1 app)\n\napp1 : {g:_}->{a:_}->{B:_} -> Tm1 g (arr1 a B) -> Tm1 g a -> Tm1 g B\napp1 = \\ t, u, tm, var1, lam1, app1 => app1 _ _ _ (t tm var1 lam1 app1) (u tm var1 lam1 app1)\n\nv01 : {g:_}->{a:_} -> Tm1 (snoc1 g a) a\nv01 = var1 vz1\n\nv11 : {g:_}->{a:_}-> {B:_}-> Tm1 (snoc1 (snoc1 g a) B) a\nv11 = var1 (vs1 vz1)\n\nv21 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm1 (snoc1 (snoc1 (snoc1 g a) B) C) a\nv21 = var1 (vs1 (vs1 vz1))\n\nv31 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm1 (snoc1 (snoc1 (snoc1 (snoc1 g a) B) C) D) a\nv31 = var1 (vs1 (vs1 (vs1 vz1)))\n\nv41 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm1 (snoc1 (snoc1 (snoc1 (snoc1 (snoc1 g a) B) C) D) E) a\nv41 = var1 (vs1 (vs1 (vs1 (vs1 vz1))))\n\ntest1 : {g:_}-> {a:_} -> Tm1 g (arr1 (arr1 a a) (arr1 a a))\ntest1  = lam1 (lam1 (app1 v11 (app1 v11 (app1 v11 (app1 v11 (app1 v11 (app1 v11 v01)))))))\nTy2 : Type\nTy2 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty2 : Ty2\nempty2 = \\ _, empty, _ => empty\n\narr2 : Ty2 -> Ty2 -> Ty2\narr2 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon2 : Type\nCon2 = (Con2 : Type)\n ->(nil  : Con2)\n ->(snoc : Con2 -> Ty2 -> Con2)\n -> Con2\n\nnil2 : Con2\nnil2 = \\ con, nil2, snoc => nil2\n\nsnoc2 : Con2 -> Ty2 -> Con2\nsnoc2 = \\ g, a, con, nil2, snoc2 => snoc2 (g con nil2 snoc2) a\n\nVar2 : Con2 -> Ty2 -> Type\nVar2 = \\ g, a =>\n    (Var2 : Con2 -> Ty2 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var2 (snoc2 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var2 g a -> Var2 (snoc2 g b) a)\n -> Var2 g a\n\nvz2 : {g : _}-> {a : _} -> Var2 (snoc2 g a) a\nvz2 = \\ var, vz2, vs => vz2 _ _\n\nvs2 : {g : _} -> {B : _} -> {a : _} -> Var2 g a -> Var2 (snoc2 g B) a\nvs2 = \\ x, var, vz2, vs2 => vs2 _ _ _ (x var vz2 vs2)\n\nTm2 : Con2 -> Ty2 -> Type\nTm2 = \\ g, a =>\n    (Tm2    : Con2 -> Ty2 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var2 g a -> Tm2 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm2 (snoc2 g a) B -> Tm2 g (arr2 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm2 g (arr2 a B) -> Tm2 g a -> Tm2 g B)\n -> Tm2 g a\n\nvar2 : {g : _} -> {a : _} -> Var2 g a -> Tm2 g a\nvar2 = \\ x, tm, var2, lam, app => var2 _ _ x\n\nlam2 : {g : _} -> {a : _} -> {B : _} -> Tm2 (snoc2 g a) B -> Tm2 g (arr2 a B)\nlam2 = \\ t, tm, var2, lam2, app => lam2 _ _ _ (t tm var2 lam2 app)\n\napp2 : {g:_}->{a:_}->{B:_} -> Tm2 g (arr2 a B) -> Tm2 g a -> Tm2 g B\napp2 = \\ t, u, tm, var2, lam2, app2 => app2 _ _ _ (t tm var2 lam2 app2) (u tm var2 lam2 app2)\n\nv02 : {g:_}->{a:_} -> Tm2 (snoc2 g a) a\nv02 = var2 vz2\n\nv12 : {g:_}->{a:_}-> {B:_}-> Tm2 (snoc2 (snoc2 g a) B) a\nv12 = var2 (vs2 vz2)\n\nv22 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm2 (snoc2 (snoc2 (snoc2 g a) B) C) a\nv22 = var2 (vs2 (vs2 vz2))\n\nv32 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm2 (snoc2 (snoc2 (snoc2 (snoc2 g a) B) C) D) a\nv32 = var2 (vs2 (vs2 (vs2 vz2)))\n\nv42 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm2 (snoc2 (snoc2 (snoc2 (snoc2 (snoc2 g a) B) C) D) E) a\nv42 = var2 (vs2 (vs2 (vs2 (vs2 vz2))))\n\ntest2 : {g:_}-> {a:_} -> Tm2 g (arr2 (arr2 a a) (arr2 a a))\ntest2  = lam2 (lam2 (app2 v12 (app2 v12 (app2 v12 (app2 v12 (app2 v12 (app2 v12 v02)))))))\nTy3 : Type\nTy3 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty3 : Ty3\nempty3 = \\ _, empty, _ => empty\n\narr3 : Ty3 -> Ty3 -> Ty3\narr3 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon3 : Type\nCon3 = (Con3 : Type)\n ->(nil  : Con3)\n ->(snoc : Con3 -> Ty3 -> Con3)\n -> Con3\n\nnil3 : Con3\nnil3 = \\ con, nil3, snoc => nil3\n\nsnoc3 : Con3 -> Ty3 -> Con3\nsnoc3 = \\ g, a, con, nil3, snoc3 => snoc3 (g con nil3 snoc3) a\n\nVar3 : Con3 -> Ty3 -> Type\nVar3 = \\ g, a =>\n    (Var3 : Con3 -> Ty3 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var3 (snoc3 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var3 g a -> Var3 (snoc3 g b) a)\n -> Var3 g a\n\nvz3 : {g : _}-> {a : _} -> Var3 (snoc3 g a) a\nvz3 = \\ var, vz3, vs => vz3 _ _\n\nvs3 : {g : _} -> {B : _} -> {a : _} -> Var3 g a -> Var3 (snoc3 g B) a\nvs3 = \\ x, var, vz3, vs3 => vs3 _ _ _ (x var vz3 vs3)\n\nTm3 : Con3 -> Ty3 -> Type\nTm3 = \\ g, a =>\n    (Tm3    : Con3 -> Ty3 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var3 g a -> Tm3 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm3 (snoc3 g a) B -> Tm3 g (arr3 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm3 g (arr3 a B) -> Tm3 g a -> Tm3 g B)\n -> Tm3 g a\n\nvar3 : {g : _} -> {a : _} -> Var3 g a -> Tm3 g a\nvar3 = \\ x, tm, var3, lam, app => var3 _ _ x\n\nlam3 : {g : _} -> {a : _} -> {B : _} -> Tm3 (snoc3 g a) B -> Tm3 g (arr3 a B)\nlam3 = \\ t, tm, var3, lam3, app => lam3 _ _ _ (t tm var3 lam3 app)\n\napp3 : {g:_}->{a:_}->{B:_} -> Tm3 g (arr3 a B) -> Tm3 g a -> Tm3 g B\napp3 = \\ t, u, tm, var3, lam3, app3 => app3 _ _ _ (t tm var3 lam3 app3) (u tm var3 lam3 app3)\n\nv03 : {g:_}->{a:_} -> Tm3 (snoc3 g a) a\nv03 = var3 vz3\n\nv13 : {g:_}->{a:_}-> {B:_}-> Tm3 (snoc3 (snoc3 g a) B) a\nv13 = var3 (vs3 vz3)\n\nv23 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm3 (snoc3 (snoc3 (snoc3 g a) B) C) a\nv23 = var3 (vs3 (vs3 vz3))\n\nv33 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm3 (snoc3 (snoc3 (snoc3 (snoc3 g a) B) C) D) a\nv33 = var3 (vs3 (vs3 (vs3 vz3)))\n\nv43 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm3 (snoc3 (snoc3 (snoc3 (snoc3 (snoc3 g a) B) C) D) E) a\nv43 = var3 (vs3 (vs3 (vs3 (vs3 vz3))))\n\ntest3 : {g:_}-> {a:_} -> Tm3 g (arr3 (arr3 a a) (arr3 a a))\ntest3  = lam3 (lam3 (app3 v13 (app3 v13 (app3 v13 (app3 v13 (app3 v13 (app3 v13 v03)))))))\nTy4 : Type\nTy4 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty4 : Ty4\nempty4 = \\ _, empty, _ => empty\n\narr4 : Ty4 -> Ty4 -> Ty4\narr4 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon4 : Type\nCon4 = (Con4 : Type)\n ->(nil  : Con4)\n ->(snoc : Con4 -> Ty4 -> Con4)\n -> Con4\n\nnil4 : Con4\nnil4 = \\ con, nil4, snoc => nil4\n\nsnoc4 : Con4 -> Ty4 -> Con4\nsnoc4 = \\ g, a, con, nil4, snoc4 => snoc4 (g con nil4 snoc4) a\n\nVar4 : Con4 -> Ty4 -> Type\nVar4 = \\ g, a =>\n    (Var4 : Con4 -> Ty4 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var4 (snoc4 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var4 g a -> Var4 (snoc4 g b) a)\n -> Var4 g a\n\nvz4 : {g : _}-> {a : _} -> Var4 (snoc4 g a) a\nvz4 = \\ var, vz4, vs => vz4 _ _\n\nvs4 : {g : _} -> {B : _} -> {a : _} -> Var4 g a -> Var4 (snoc4 g B) a\nvs4 = \\ x, var, vz4, vs4 => vs4 _ _ _ (x var vz4 vs4)\n\nTm4 : Con4 -> Ty4 -> Type\nTm4 = \\ g, a =>\n    (Tm4    : Con4 -> Ty4 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var4 g a -> Tm4 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm4 (snoc4 g a) B -> Tm4 g (arr4 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm4 g (arr4 a B) -> Tm4 g a -> Tm4 g B)\n -> Tm4 g a\n\nvar4 : {g : _} -> {a : _} -> Var4 g a -> Tm4 g a\nvar4 = \\ x, tm, var4, lam, app => var4 _ _ x\n\nlam4 : {g : _} -> {a : _} -> {B : _} -> Tm4 (snoc4 g a) B -> Tm4 g (arr4 a B)\nlam4 = \\ t, tm, var4, lam4, app => lam4 _ _ _ (t tm var4 lam4 app)\n\napp4 : {g:_}->{a:_}->{B:_} -> Tm4 g (arr4 a B) -> Tm4 g a -> Tm4 g B\napp4 = \\ t, u, tm, var4, lam4, app4 => app4 _ _ _ (t tm var4 lam4 app4) (u tm var4 lam4 app4)\n\nv04 : {g:_}->{a:_} -> Tm4 (snoc4 g a) a\nv04 = var4 vz4\n\nv14 : {g:_}->{a:_}-> {B:_}-> Tm4 (snoc4 (snoc4 g a) B) a\nv14 = var4 (vs4 vz4)\n\nv24 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm4 (snoc4 (snoc4 (snoc4 g a) B) C) a\nv24 = var4 (vs4 (vs4 vz4))\n\nv34 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm4 (snoc4 (snoc4 (snoc4 (snoc4 g a) B) C) D) a\nv34 = var4 (vs4 (vs4 (vs4 vz4)))\n\nv44 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm4 (snoc4 (snoc4 (snoc4 (snoc4 (snoc4 g a) B) C) D) E) a\nv44 = var4 (vs4 (vs4 (vs4 (vs4 vz4))))\n\ntest4 : {g:_}-> {a:_} -> Tm4 g (arr4 (arr4 a a) (arr4 a a))\ntest4  = lam4 (lam4 (app4 v14 (app4 v14 (app4 v14 (app4 v14 (app4 v14 (app4 v14 v04)))))))\nTy5 : Type\nTy5 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty5 : Ty5\nempty5 = \\ _, empty, _ => empty\n\narr5 : Ty5 -> Ty5 -> Ty5\narr5 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon5 : Type\nCon5 = (Con5 : Type)\n ->(nil  : Con5)\n ->(snoc : Con5 -> Ty5 -> Con5)\n -> Con5\n\nnil5 : Con5\nnil5 = \\ con, nil5, snoc => nil5\n\nsnoc5 : Con5 -> Ty5 -> Con5\nsnoc5 = \\ g, a, con, nil5, snoc5 => snoc5 (g con nil5 snoc5) a\n\nVar5 : Con5 -> Ty5 -> Type\nVar5 = \\ g, a =>\n    (Var5 : Con5 -> Ty5 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var5 (snoc5 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var5 g a -> Var5 (snoc5 g b) a)\n -> Var5 g a\n\nvz5 : {g : _}-> {a : _} -> Var5 (snoc5 g a) a\nvz5 = \\ var, vz5, vs => vz5 _ _\n\nvs5 : {g : _} -> {B : _} -> {a : _} -> Var5 g a -> Var5 (snoc5 g B) a\nvs5 = \\ x, var, vz5, vs5 => vs5 _ _ _ (x var vz5 vs5)\n\nTm5 : Con5 -> Ty5 -> Type\nTm5 = \\ g, a =>\n    (Tm5    : Con5 -> Ty5 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var5 g a -> Tm5 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm5 (snoc5 g a) B -> Tm5 g (arr5 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm5 g (arr5 a B) -> Tm5 g a -> Tm5 g B)\n -> Tm5 g a\n\nvar5 : {g : _} -> {a : _} -> Var5 g a -> Tm5 g a\nvar5 = \\ x, tm, var5, lam, app => var5 _ _ x\n\nlam5 : {g : _} -> {a : _} -> {B : _} -> Tm5 (snoc5 g a) B -> Tm5 g (arr5 a B)\nlam5 = \\ t, tm, var5, lam5, app => lam5 _ _ _ (t tm var5 lam5 app)\n\napp5 : {g:_}->{a:_}->{B:_} -> Tm5 g (arr5 a B) -> Tm5 g a -> Tm5 g B\napp5 = \\ t, u, tm, var5, lam5, app5 => app5 _ _ _ (t tm var5 lam5 app5) (u tm var5 lam5 app5)\n\nv05 : {g:_}->{a:_} -> Tm5 (snoc5 g a) a\nv05 = var5 vz5\n\nv15 : {g:_}->{a:_}-> {B:_}-> Tm5 (snoc5 (snoc5 g a) B) a\nv15 = var5 (vs5 vz5)\n\nv25 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm5 (snoc5 (snoc5 (snoc5 g a) B) C) a\nv25 = var5 (vs5 (vs5 vz5))\n\nv35 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm5 (snoc5 (snoc5 (snoc5 (snoc5 g a) B) C) D) a\nv35 = var5 (vs5 (vs5 (vs5 vz5)))\n\nv45 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm5 (snoc5 (snoc5 (snoc5 (snoc5 (snoc5 g a) B) C) D) E) a\nv45 = var5 (vs5 (vs5 (vs5 (vs5 vz5))))\n\ntest5 : {g:_}-> {a:_} -> Tm5 g (arr5 (arr5 a a) (arr5 a a))\ntest5  = lam5 (lam5 (app5 v15 (app5 v15 (app5 v15 (app5 v15 (app5 v15 (app5 v15 v05)))))))\nTy6 : Type\nTy6 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty6 : Ty6\nempty6 = \\ _, empty, _ => empty\n\narr6 : Ty6 -> Ty6 -> Ty6\narr6 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon6 : Type\nCon6 = (Con6 : Type)\n ->(nil  : Con6)\n ->(snoc : Con6 -> Ty6 -> Con6)\n -> Con6\n\nnil6 : Con6\nnil6 = \\ con, nil6, snoc => nil6\n\nsnoc6 : Con6 -> Ty6 -> Con6\nsnoc6 = \\ g, a, con, nil6, snoc6 => snoc6 (g con nil6 snoc6) a\n\nVar6 : Con6 -> Ty6 -> Type\nVar6 = \\ g, a =>\n    (Var6 : Con6 -> Ty6 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var6 (snoc6 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var6 g a -> Var6 (snoc6 g b) a)\n -> Var6 g a\n\nvz6 : {g : _}-> {a : _} -> Var6 (snoc6 g a) a\nvz6 = \\ var, vz6, vs => vz6 _ _\n\nvs6 : {g : _} -> {B : _} -> {a : _} -> Var6 g a -> Var6 (snoc6 g B) a\nvs6 = \\ x, var, vz6, vs6 => vs6 _ _ _ (x var vz6 vs6)\n\nTm6 : Con6 -> Ty6 -> Type\nTm6 = \\ g, a =>\n    (Tm6    : Con6 -> Ty6 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var6 g a -> Tm6 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm6 (snoc6 g a) B -> Tm6 g (arr6 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm6 g (arr6 a B) -> Tm6 g a -> Tm6 g B)\n -> Tm6 g a\n\nvar6 : {g : _} -> {a : _} -> Var6 g a -> Tm6 g a\nvar6 = \\ x, tm, var6, lam, app => var6 _ _ x\n\nlam6 : {g : _} -> {a : _} -> {B : _} -> Tm6 (snoc6 g a) B -> Tm6 g (arr6 a B)\nlam6 = \\ t, tm, var6, lam6, app => lam6 _ _ _ (t tm var6 lam6 app)\n\napp6 : {g:_}->{a:_}->{B:_} -> Tm6 g (arr6 a B) -> Tm6 g a -> Tm6 g B\napp6 = \\ t, u, tm, var6, lam6, app6 => app6 _ _ _ (t tm var6 lam6 app6) (u tm var6 lam6 app6)\n\nv06 : {g:_}->{a:_} -> Tm6 (snoc6 g a) a\nv06 = var6 vz6\n\nv16 : {g:_}->{a:_}-> {B:_}-> Tm6 (snoc6 (snoc6 g a) B) a\nv16 = var6 (vs6 vz6)\n\nv26 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm6 (snoc6 (snoc6 (snoc6 g a) B) C) a\nv26 = var6 (vs6 (vs6 vz6))\n\nv36 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm6 (snoc6 (snoc6 (snoc6 (snoc6 g a) B) C) D) a\nv36 = var6 (vs6 (vs6 (vs6 vz6)))\n\nv46 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm6 (snoc6 (snoc6 (snoc6 (snoc6 (snoc6 g a) B) C) D) E) a\nv46 = var6 (vs6 (vs6 (vs6 (vs6 vz6))))\n\ntest6 : {g:_}-> {a:_} -> Tm6 g (arr6 (arr6 a a) (arr6 a a))\ntest6  = lam6 (lam6 (app6 v16 (app6 v16 (app6 v16 (app6 v16 (app6 v16 (app6 v16 v06)))))))\nTy7 : Type\nTy7 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty7 : Ty7\nempty7 = \\ _, empty, _ => empty\n\narr7 : Ty7 -> Ty7 -> Ty7\narr7 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon7 : Type\nCon7 = (Con7 : Type)\n ->(nil  : Con7)\n ->(snoc : Con7 -> Ty7 -> Con7)\n -> Con7\n\nnil7 : Con7\nnil7 = \\ con, nil7, snoc => nil7\n\nsnoc7 : Con7 -> Ty7 -> Con7\nsnoc7 = \\ g, a, con, nil7, snoc7 => snoc7 (g con nil7 snoc7) a\n\nVar7 : Con7 -> Ty7 -> Type\nVar7 = \\ g, a =>\n    (Var7 : Con7 -> Ty7 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var7 (snoc7 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var7 g a -> Var7 (snoc7 g b) a)\n -> Var7 g a\n\nvz7 : {g : _}-> {a : _} -> Var7 (snoc7 g a) a\nvz7 = \\ var, vz7, vs => vz7 _ _\n\nvs7 : {g : _} -> {B : _} -> {a : _} -> Var7 g a -> Var7 (snoc7 g B) a\nvs7 = \\ x, var, vz7, vs7 => vs7 _ _ _ (x var vz7 vs7)\n\nTm7 : Con7 -> Ty7 -> Type\nTm7 = \\ g, a =>\n    (Tm7    : Con7 -> Ty7 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var7 g a -> Tm7 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm7 (snoc7 g a) B -> Tm7 g (arr7 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm7 g (arr7 a B) -> Tm7 g a -> Tm7 g B)\n -> Tm7 g a\n\nvar7 : {g : _} -> {a : _} -> Var7 g a -> Tm7 g a\nvar7 = \\ x, tm, var7, lam, app => var7 _ _ x\n\nlam7 : {g : _} -> {a : _} -> {B : _} -> Tm7 (snoc7 g a) B -> Tm7 g (arr7 a B)\nlam7 = \\ t, tm, var7, lam7, app => lam7 _ _ _ (t tm var7 lam7 app)\n\napp7 : {g:_}->{a:_}->{B:_} -> Tm7 g (arr7 a B) -> Tm7 g a -> Tm7 g B\napp7 = \\ t, u, tm, var7, lam7, app7 => app7 _ _ _ (t tm var7 lam7 app7) (u tm var7 lam7 app7)\n\nv07 : {g:_}->{a:_} -> Tm7 (snoc7 g a) a\nv07 = var7 vz7\n\nv17 : {g:_}->{a:_}-> {B:_}-> Tm7 (snoc7 (snoc7 g a) B) a\nv17 = var7 (vs7 vz7)\n\nv27 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm7 (snoc7 (snoc7 (snoc7 g a) B) C) a\nv27 = var7 (vs7 (vs7 vz7))\n\nv37 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm7 (snoc7 (snoc7 (snoc7 (snoc7 g a) B) C) D) a\nv37 = var7 (vs7 (vs7 (vs7 vz7)))\n\nv47 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm7 (snoc7 (snoc7 (snoc7 (snoc7 (snoc7 g a) B) C) D) E) a\nv47 = var7 (vs7 (vs7 (vs7 (vs7 vz7))))\n\ntest7 : {g:_}-> {a:_} -> Tm7 g (arr7 (arr7 a a) (arr7 a a))\ntest7  = lam7 (lam7 (app7 v17 (app7 v17 (app7 v17 (app7 v17 (app7 v17 (app7 v17 v07)))))))\nTy8 : Type\nTy8 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty8 : Ty8\nempty8 = \\ _, empty, _ => empty\n\narr8 : Ty8 -> Ty8 -> Ty8\narr8 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon8 : Type\nCon8 = (Con8 : Type)\n ->(nil  : Con8)\n ->(snoc : Con8 -> Ty8 -> Con8)\n -> Con8\n\nnil8 : Con8\nnil8 = \\ con, nil8, snoc => nil8\n\nsnoc8 : Con8 -> Ty8 -> Con8\nsnoc8 = \\ g, a, con, nil8, snoc8 => snoc8 (g con nil8 snoc8) a\n\nVar8 : Con8 -> Ty8 -> Type\nVar8 = \\ g, a =>\n    (Var8 : Con8 -> Ty8 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var8 (snoc8 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var8 g a -> Var8 (snoc8 g b) a)\n -> Var8 g a\n\nvz8 : {g : _}-> {a : _} -> Var8 (snoc8 g a) a\nvz8 = \\ var, vz8, vs => vz8 _ _\n\nvs8 : {g : _} -> {B : _} -> {a : _} -> Var8 g a -> Var8 (snoc8 g B) a\nvs8 = \\ x, var, vz8, vs8 => vs8 _ _ _ (x var vz8 vs8)\n\nTm8 : Con8 -> Ty8 -> Type\nTm8 = \\ g, a =>\n    (Tm8    : Con8 -> Ty8 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var8 g a -> Tm8 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm8 (snoc8 g a) B -> Tm8 g (arr8 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm8 g (arr8 a B) -> Tm8 g a -> Tm8 g B)\n -> Tm8 g a\n\nvar8 : {g : _} -> {a : _} -> Var8 g a -> Tm8 g a\nvar8 = \\ x, tm, var8, lam, app => var8 _ _ x\n\nlam8 : {g : _} -> {a : _} -> {B : _} -> Tm8 (snoc8 g a) B -> Tm8 g (arr8 a B)\nlam8 = \\ t, tm, var8, lam8, app => lam8 _ _ _ (t tm var8 lam8 app)\n\napp8 : {g:_}->{a:_}->{B:_} -> Tm8 g (arr8 a B) -> Tm8 g a -> Tm8 g B\napp8 = \\ t, u, tm, var8, lam8, app8 => app8 _ _ _ (t tm var8 lam8 app8) (u tm var8 lam8 app8)\n\nv08 : {g:_}->{a:_} -> Tm8 (snoc8 g a) a\nv08 = var8 vz8\n\nv18 : {g:_}->{a:_}-> {B:_}-> Tm8 (snoc8 (snoc8 g a) B) a\nv18 = var8 (vs8 vz8)\n\nv28 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm8 (snoc8 (snoc8 (snoc8 g a) B) C) a\nv28 = var8 (vs8 (vs8 vz8))\n\nv38 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm8 (snoc8 (snoc8 (snoc8 (snoc8 g a) B) C) D) a\nv38 = var8 (vs8 (vs8 (vs8 vz8)))\n\nv48 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm8 (snoc8 (snoc8 (snoc8 (snoc8 (snoc8 g a) B) C) D) E) a\nv48 = var8 (vs8 (vs8 (vs8 (vs8 vz8))))\n\ntest8 : {g:_}-> {a:_} -> Tm8 g (arr8 (arr8 a a) (arr8 a a))\ntest8  = lam8 (lam8 (app8 v18 (app8 v18 (app8 v18 (app8 v18 (app8 v18 (app8 v18 v08)))))))\nTy9 : Type\nTy9 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty9 : Ty9\nempty9 = \\ _, empty, _ => empty\n\narr9 : Ty9 -> Ty9 -> Ty9\narr9 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon9 : Type\nCon9 = (Con9 : Type)\n ->(nil  : Con9)\n ->(snoc : Con9 -> Ty9 -> Con9)\n -> Con9\n\nnil9 : Con9\nnil9 = \\ con, nil9, snoc => nil9\n\nsnoc9 : Con9 -> Ty9 -> Con9\nsnoc9 = \\ g, a, con, nil9, snoc9 => snoc9 (g con nil9 snoc9) a\n\nVar9 : Con9 -> Ty9 -> Type\nVar9 = \\ g, a =>\n    (Var9 : Con9 -> Ty9 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var9 (snoc9 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var9 g a -> Var9 (snoc9 g b) a)\n -> Var9 g a\n\nvz9 : {g : _}-> {a : _} -> Var9 (snoc9 g a) a\nvz9 = \\ var, vz9, vs => vz9 _ _\n\nvs9 : {g : _} -> {B : _} -> {a : _} -> Var9 g a -> Var9 (snoc9 g B) a\nvs9 = \\ x, var, vz9, vs9 => vs9 _ _ _ (x var vz9 vs9)\n\nTm9 : Con9 -> Ty9 -> Type\nTm9 = \\ g, a =>\n    (Tm9    : Con9 -> Ty9 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var9 g a -> Tm9 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm9 (snoc9 g a) B -> Tm9 g (arr9 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm9 g (arr9 a B) -> Tm9 g a -> Tm9 g B)\n -> Tm9 g a\n\nvar9 : {g : _} -> {a : _} -> Var9 g a -> Tm9 g a\nvar9 = \\ x, tm, var9, lam, app => var9 _ _ x\n\nlam9 : {g : _} -> {a : _} -> {B : _} -> Tm9 (snoc9 g a) B -> Tm9 g (arr9 a B)\nlam9 = \\ t, tm, var9, lam9, app => lam9 _ _ _ (t tm var9 lam9 app)\n\napp9 : {g:_}->{a:_}->{B:_} -> Tm9 g (arr9 a B) -> Tm9 g a -> Tm9 g B\napp9 = \\ t, u, tm, var9, lam9, app9 => app9 _ _ _ (t tm var9 lam9 app9) (u tm var9 lam9 app9)\n\nv09 : {g:_}->{a:_} -> Tm9 (snoc9 g a) a\nv09 = var9 vz9\n\nv19 : {g:_}->{a:_}-> {B:_}-> Tm9 (snoc9 (snoc9 g a) B) a\nv19 = var9 (vs9 vz9)\n\nv29 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm9 (snoc9 (snoc9 (snoc9 g a) B) C) a\nv29 = var9 (vs9 (vs9 vz9))\n\nv39 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm9 (snoc9 (snoc9 (snoc9 (snoc9 g a) B) C) D) a\nv39 = var9 (vs9 (vs9 (vs9 vz9)))\n\nv49 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm9 (snoc9 (snoc9 (snoc9 (snoc9 (snoc9 g a) B) C) D) E) a\nv49 = var9 (vs9 (vs9 (vs9 (vs9 vz9))))\n\ntest9 : {g:_}-> {a:_} -> Tm9 g (arr9 (arr9 a a) (arr9 a a))\ntest9  = lam9 (lam9 (app9 v19 (app9 v19 (app9 v19 (app9 v19 (app9 v19 (app9 v19 v09)))))))\nTy10 : Type\nTy10 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty10 : Ty10\nempty10 = \\ _, empty, _ => empty\n\narr10 : Ty10 -> Ty10 -> Ty10\narr10 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon10 : Type\nCon10 = (Con10 : Type)\n ->(nil  : Con10)\n ->(snoc : Con10 -> Ty10 -> Con10)\n -> Con10\n\nnil10 : Con10\nnil10 = \\ con, nil10, snoc => nil10\n\nsnoc10 : Con10 -> Ty10 -> Con10\nsnoc10 = \\ g, a, con, nil10, snoc10 => snoc10 (g con nil10 snoc10) a\n\nVar10 : Con10 -> Ty10 -> Type\nVar10 = \\ g, a =>\n    (Var10 : Con10 -> Ty10 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var10 (snoc10 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var10 g a -> Var10 (snoc10 g b) a)\n -> Var10 g a\n\nvz10 : {g : _}-> {a : _} -> Var10 (snoc10 g a) a\nvz10 = \\ var, vz10, vs => vz10 _ _\n\nvs10 : {g : _} -> {B : _} -> {a : _} -> Var10 g a -> Var10 (snoc10 g B) a\nvs10 = \\ x, var, vz10, vs10 => vs10 _ _ _ (x var vz10 vs10)\n\nTm10 : Con10 -> Ty10 -> Type\nTm10 = \\ g, a =>\n    (Tm10    : Con10 -> Ty10 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var10 g a -> Tm10 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm10 (snoc10 g a) B -> Tm10 g (arr10 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm10 g (arr10 a B) -> Tm10 g a -> Tm10 g B)\n -> Tm10 g a\n\nvar10 : {g : _} -> {a : _} -> Var10 g a -> Tm10 g a\nvar10 = \\ x, tm, var10, lam, app => var10 _ _ x\n\nlam10 : {g : _} -> {a : _} -> {B : _} -> Tm10 (snoc10 g a) B -> Tm10 g (arr10 a B)\nlam10 = \\ t, tm, var10, lam10, app => lam10 _ _ _ (t tm var10 lam10 app)\n\napp10 : {g:_}->{a:_}->{B:_} -> Tm10 g (arr10 a B) -> Tm10 g a -> Tm10 g B\napp10 = \\ t, u, tm, var10, lam10, app10 => app10 _ _ _ (t tm var10 lam10 app10) (u tm var10 lam10 app10)\n\nv010 : {g:_}->{a:_} -> Tm10 (snoc10 g a) a\nv010 = var10 vz10\n\nv110 : {g:_}->{a:_}-> {B:_}-> Tm10 (snoc10 (snoc10 g a) B) a\nv110 = var10 (vs10 vz10)\n\nv210 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm10 (snoc10 (snoc10 (snoc10 g a) B) C) a\nv210 = var10 (vs10 (vs10 vz10))\n\nv310 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm10 (snoc10 (snoc10 (snoc10 (snoc10 g a) B) C) D) a\nv310 = var10 (vs10 (vs10 (vs10 vz10)))\n\nv410 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm10 (snoc10 (snoc10 (snoc10 (snoc10 (snoc10 g a) B) C) D) E) a\nv410 = var10 (vs10 (vs10 (vs10 (vs10 vz10))))\n\ntest10 : {g:_}-> {a:_} -> Tm10 g (arr10 (arr10 a a) (arr10 a a))\ntest10  = lam10 (lam10 (app10 v110 (app10 v110 (app10 v110 (app10 v110 (app10 v110 (app10 v110 v010)))))))\nTy11 : Type\nTy11 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty11 : Ty11\nempty11 = \\ _, empty, _ => empty\n\narr11 : Ty11 -> Ty11 -> Ty11\narr11 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon11 : Type\nCon11 = (Con11 : Type)\n ->(nil  : Con11)\n ->(snoc : Con11 -> Ty11 -> Con11)\n -> Con11\n\nnil11 : Con11\nnil11 = \\ con, nil11, snoc => nil11\n\nsnoc11 : Con11 -> Ty11 -> Con11\nsnoc11 = \\ g, a, con, nil11, snoc11 => snoc11 (g con nil11 snoc11) a\n\nVar11 : Con11 -> Ty11 -> Type\nVar11 = \\ g, a =>\n    (Var11 : Con11 -> Ty11 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var11 (snoc11 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var11 g a -> Var11 (snoc11 g b) a)\n -> Var11 g a\n\nvz11 : {g : _}-> {a : _} -> Var11 (snoc11 g a) a\nvz11 = \\ var, vz11, vs => vz11 _ _\n\nvs11 : {g : _} -> {B : _} -> {a : _} -> Var11 g a -> Var11 (snoc11 g B) a\nvs11 = \\ x, var, vz11, vs11 => vs11 _ _ _ (x var vz11 vs11)\n\nTm11 : Con11 -> Ty11 -> Type\nTm11 = \\ g, a =>\n    (Tm11    : Con11 -> Ty11 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var11 g a -> Tm11 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm11 (snoc11 g a) B -> Tm11 g (arr11 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm11 g (arr11 a B) -> Tm11 g a -> Tm11 g B)\n -> Tm11 g a\n\nvar11 : {g : _} -> {a : _} -> Var11 g a -> Tm11 g a\nvar11 = \\ x, tm, var11, lam, app => var11 _ _ x\n\nlam11 : {g : _} -> {a : _} -> {B : _} -> Tm11 (snoc11 g a) B -> Tm11 g (arr11 a B)\nlam11 = \\ t, tm, var11, lam11, app => lam11 _ _ _ (t tm var11 lam11 app)\n\napp11 : {g:_}->{a:_}->{B:_} -> Tm11 g (arr11 a B) -> Tm11 g a -> Tm11 g B\napp11 = \\ t, u, tm, var11, lam11, app11 => app11 _ _ _ (t tm var11 lam11 app11) (u tm var11 lam11 app11)\n\nv011 : {g:_}->{a:_} -> Tm11 (snoc11 g a) a\nv011 = var11 vz11\n\nv111 : {g:_}->{a:_}-> {B:_}-> Tm11 (snoc11 (snoc11 g a) B) a\nv111 = var11 (vs11 vz11)\n\nv211 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm11 (snoc11 (snoc11 (snoc11 g a) B) C) a\nv211 = var11 (vs11 (vs11 vz11))\n\nv311 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm11 (snoc11 (snoc11 (snoc11 (snoc11 g a) B) C) D) a\nv311 = var11 (vs11 (vs11 (vs11 vz11)))\n\nv411 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm11 (snoc11 (snoc11 (snoc11 (snoc11 (snoc11 g a) B) C) D) E) a\nv411 = var11 (vs11 (vs11 (vs11 (vs11 vz11))))\n\ntest11 : {g:_}-> {a:_} -> Tm11 g (arr11 (arr11 a a) (arr11 a a))\ntest11  = lam11 (lam11 (app11 v111 (app11 v111 (app11 v111 (app11 v111 (app11 v111 (app11 v111 v011)))))))\nTy12 : Type\nTy12 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty12 : Ty12\nempty12 = \\ _, empty, _ => empty\n\narr12 : Ty12 -> Ty12 -> Ty12\narr12 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon12 : Type\nCon12 = (Con12 : Type)\n ->(nil  : Con12)\n ->(snoc : Con12 -> Ty12 -> Con12)\n -> Con12\n\nnil12 : Con12\nnil12 = \\ con, nil12, snoc => nil12\n\nsnoc12 : Con12 -> Ty12 -> Con12\nsnoc12 = \\ g, a, con, nil12, snoc12 => snoc12 (g con nil12 snoc12) a\n\nVar12 : Con12 -> Ty12 -> Type\nVar12 = \\ g, a =>\n    (Var12 : Con12 -> Ty12 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var12 (snoc12 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var12 g a -> Var12 (snoc12 g b) a)\n -> Var12 g a\n\nvz12 : {g : _}-> {a : _} -> Var12 (snoc12 g a) a\nvz12 = \\ var, vz12, vs => vz12 _ _\n\nvs12 : {g : _} -> {B : _} -> {a : _} -> Var12 g a -> Var12 (snoc12 g B) a\nvs12 = \\ x, var, vz12, vs12 => vs12 _ _ _ (x var vz12 vs12)\n\nTm12 : Con12 -> Ty12 -> Type\nTm12 = \\ g, a =>\n    (Tm12    : Con12 -> Ty12 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var12 g a -> Tm12 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm12 (snoc12 g a) B -> Tm12 g (arr12 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm12 g (arr12 a B) -> Tm12 g a -> Tm12 g B)\n -> Tm12 g a\n\nvar12 : {g : _} -> {a : _} -> Var12 g a -> Tm12 g a\nvar12 = \\ x, tm, var12, lam, app => var12 _ _ x\n\nlam12 : {g : _} -> {a : _} -> {B : _} -> Tm12 (snoc12 g a) B -> Tm12 g (arr12 a B)\nlam12 = \\ t, tm, var12, lam12, app => lam12 _ _ _ (t tm var12 lam12 app)\n\napp12 : {g:_}->{a:_}->{B:_} -> Tm12 g (arr12 a B) -> Tm12 g a -> Tm12 g B\napp12 = \\ t, u, tm, var12, lam12, app12 => app12 _ _ _ (t tm var12 lam12 app12) (u tm var12 lam12 app12)\n\nv012 : {g:_}->{a:_} -> Tm12 (snoc12 g a) a\nv012 = var12 vz12\n\nv112 : {g:_}->{a:_}-> {B:_}-> Tm12 (snoc12 (snoc12 g a) B) a\nv112 = var12 (vs12 vz12)\n\nv212 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm12 (snoc12 (snoc12 (snoc12 g a) B) C) a\nv212 = var12 (vs12 (vs12 vz12))\n\nv312 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm12 (snoc12 (snoc12 (snoc12 (snoc12 g a) B) C) D) a\nv312 = var12 (vs12 (vs12 (vs12 vz12)))\n\nv412 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm12 (snoc12 (snoc12 (snoc12 (snoc12 (snoc12 g a) B) C) D) E) a\nv412 = var12 (vs12 (vs12 (vs12 (vs12 vz12))))\n\ntest12 : {g:_}-> {a:_} -> Tm12 g (arr12 (arr12 a a) (arr12 a a))\ntest12  = lam12 (lam12 (app12 v112 (app12 v112 (app12 v112 (app12 v112 (app12 v112 (app12 v112 v012)))))))\nTy13 : Type\nTy13 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty13 : Ty13\nempty13 = \\ _, empty, _ => empty\n\narr13 : Ty13 -> Ty13 -> Ty13\narr13 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon13 : Type\nCon13 = (Con13 : Type)\n ->(nil  : Con13)\n ->(snoc : Con13 -> Ty13 -> Con13)\n -> Con13\n\nnil13 : Con13\nnil13 = \\ con, nil13, snoc => nil13\n\nsnoc13 : Con13 -> Ty13 -> Con13\nsnoc13 = \\ g, a, con, nil13, snoc13 => snoc13 (g con nil13 snoc13) a\n\nVar13 : Con13 -> Ty13 -> Type\nVar13 = \\ g, a =>\n    (Var13 : Con13 -> Ty13 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var13 (snoc13 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var13 g a -> Var13 (snoc13 g b) a)\n -> Var13 g a\n\nvz13 : {g : _}-> {a : _} -> Var13 (snoc13 g a) a\nvz13 = \\ var, vz13, vs => vz13 _ _\n\nvs13 : {g : _} -> {B : _} -> {a : _} -> Var13 g a -> Var13 (snoc13 g B) a\nvs13 = \\ x, var, vz13, vs13 => vs13 _ _ _ (x var vz13 vs13)\n\nTm13 : Con13 -> Ty13 -> Type\nTm13 = \\ g, a =>\n    (Tm13    : Con13 -> Ty13 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var13 g a -> Tm13 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm13 (snoc13 g a) B -> Tm13 g (arr13 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm13 g (arr13 a B) -> Tm13 g a -> Tm13 g B)\n -> Tm13 g a\n\nvar13 : {g : _} -> {a : _} -> Var13 g a -> Tm13 g a\nvar13 = \\ x, tm, var13, lam, app => var13 _ _ x\n\nlam13 : {g : _} -> {a : _} -> {B : _} -> Tm13 (snoc13 g a) B -> Tm13 g (arr13 a B)\nlam13 = \\ t, tm, var13, lam13, app => lam13 _ _ _ (t tm var13 lam13 app)\n\napp13 : {g:_}->{a:_}->{B:_} -> Tm13 g (arr13 a B) -> Tm13 g a -> Tm13 g B\napp13 = \\ t, u, tm, var13, lam13, app13 => app13 _ _ _ (t tm var13 lam13 app13) (u tm var13 lam13 app13)\n\nv013 : {g:_}->{a:_} -> Tm13 (snoc13 g a) a\nv013 = var13 vz13\n\nv113 : {g:_}->{a:_}-> {B:_}-> Tm13 (snoc13 (snoc13 g a) B) a\nv113 = var13 (vs13 vz13)\n\nv213 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm13 (snoc13 (snoc13 (snoc13 g a) B) C) a\nv213 = var13 (vs13 (vs13 vz13))\n\nv313 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm13 (snoc13 (snoc13 (snoc13 (snoc13 g a) B) C) D) a\nv313 = var13 (vs13 (vs13 (vs13 vz13)))\n\nv413 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm13 (snoc13 (snoc13 (snoc13 (snoc13 (snoc13 g a) B) C) D) E) a\nv413 = var13 (vs13 (vs13 (vs13 (vs13 vz13))))\n\ntest13 : {g:_}-> {a:_} -> Tm13 g (arr13 (arr13 a a) (arr13 a a))\ntest13  = lam13 (lam13 (app13 v113 (app13 v113 (app13 v113 (app13 v113 (app13 v113 (app13 v113 v013)))))))\nTy14 : Type\nTy14 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty14 : Ty14\nempty14 = \\ _, empty, _ => empty\n\narr14 : Ty14 -> Ty14 -> Ty14\narr14 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon14 : Type\nCon14 = (Con14 : Type)\n ->(nil  : Con14)\n ->(snoc : Con14 -> Ty14 -> Con14)\n -> Con14\n\nnil14 : Con14\nnil14 = \\ con, nil14, snoc => nil14\n\nsnoc14 : Con14 -> Ty14 -> Con14\nsnoc14 = \\ g, a, con, nil14, snoc14 => snoc14 (g con nil14 snoc14) a\n\nVar14 : Con14 -> Ty14 -> Type\nVar14 = \\ g, a =>\n    (Var14 : Con14 -> Ty14 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var14 (snoc14 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var14 g a -> Var14 (snoc14 g b) a)\n -> Var14 g a\n\nvz14 : {g : _}-> {a : _} -> Var14 (snoc14 g a) a\nvz14 = \\ var, vz14, vs => vz14 _ _\n\nvs14 : {g : _} -> {B : _} -> {a : _} -> Var14 g a -> Var14 (snoc14 g B) a\nvs14 = \\ x, var, vz14, vs14 => vs14 _ _ _ (x var vz14 vs14)\n\nTm14 : Con14 -> Ty14 -> Type\nTm14 = \\ g, a =>\n    (Tm14    : Con14 -> Ty14 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var14 g a -> Tm14 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm14 (snoc14 g a) B -> Tm14 g (arr14 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm14 g (arr14 a B) -> Tm14 g a -> Tm14 g B)\n -> Tm14 g a\n\nvar14 : {g : _} -> {a : _} -> Var14 g a -> Tm14 g a\nvar14 = \\ x, tm, var14, lam, app => var14 _ _ x\n\nlam14 : {g : _} -> {a : _} -> {B : _} -> Tm14 (snoc14 g a) B -> Tm14 g (arr14 a B)\nlam14 = \\ t, tm, var14, lam14, app => lam14 _ _ _ (t tm var14 lam14 app)\n\napp14 : {g:_}->{a:_}->{B:_} -> Tm14 g (arr14 a B) -> Tm14 g a -> Tm14 g B\napp14 = \\ t, u, tm, var14, lam14, app14 => app14 _ _ _ (t tm var14 lam14 app14) (u tm var14 lam14 app14)\n\nv014 : {g:_}->{a:_} -> Tm14 (snoc14 g a) a\nv014 = var14 vz14\n\nv114 : {g:_}->{a:_}-> {B:_}-> Tm14 (snoc14 (snoc14 g a) B) a\nv114 = var14 (vs14 vz14)\n\nv214 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm14 (snoc14 (snoc14 (snoc14 g a) B) C) a\nv214 = var14 (vs14 (vs14 vz14))\n\nv314 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm14 (snoc14 (snoc14 (snoc14 (snoc14 g a) B) C) D) a\nv314 = var14 (vs14 (vs14 (vs14 vz14)))\n\nv414 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm14 (snoc14 (snoc14 (snoc14 (snoc14 (snoc14 g a) B) C) D) E) a\nv414 = var14 (vs14 (vs14 (vs14 (vs14 vz14))))\n\ntest14 : {g:_}-> {a:_} -> Tm14 g (arr14 (arr14 a a) (arr14 a a))\ntest14  = lam14 (lam14 (app14 v114 (app14 v114 (app14 v114 (app14 v114 (app14 v114 (app14 v114 v014)))))))\nTy15 : Type\nTy15 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty15 : Ty15\nempty15 = \\ _, empty, _ => empty\n\narr15 : Ty15 -> Ty15 -> Ty15\narr15 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon15 : Type\nCon15 = (Con15 : Type)\n ->(nil  : Con15)\n ->(snoc : Con15 -> Ty15 -> Con15)\n -> Con15\n\nnil15 : Con15\nnil15 = \\ con, nil15, snoc => nil15\n\nsnoc15 : Con15 -> Ty15 -> Con15\nsnoc15 = \\ g, a, con, nil15, snoc15 => snoc15 (g con nil15 snoc15) a\n\nVar15 : Con15 -> Ty15 -> Type\nVar15 = \\ g, a =>\n    (Var15 : Con15 -> Ty15 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var15 (snoc15 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var15 g a -> Var15 (snoc15 g b) a)\n -> Var15 g a\n\nvz15 : {g : _}-> {a : _} -> Var15 (snoc15 g a) a\nvz15 = \\ var, vz15, vs => vz15 _ _\n\nvs15 : {g : _} -> {B : _} -> {a : _} -> Var15 g a -> Var15 (snoc15 g B) a\nvs15 = \\ x, var, vz15, vs15 => vs15 _ _ _ (x var vz15 vs15)\n\nTm15 : Con15 -> Ty15 -> Type\nTm15 = \\ g, a =>\n    (Tm15    : Con15 -> Ty15 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var15 g a -> Tm15 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm15 (snoc15 g a) B -> Tm15 g (arr15 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm15 g (arr15 a B) -> Tm15 g a -> Tm15 g B)\n -> Tm15 g a\n\nvar15 : {g : _} -> {a : _} -> Var15 g a -> Tm15 g a\nvar15 = \\ x, tm, var15, lam, app => var15 _ _ x\n\nlam15 : {g : _} -> {a : _} -> {B : _} -> Tm15 (snoc15 g a) B -> Tm15 g (arr15 a B)\nlam15 = \\ t, tm, var15, lam15, app => lam15 _ _ _ (t tm var15 lam15 app)\n\napp15 : {g:_}->{a:_}->{B:_} -> Tm15 g (arr15 a B) -> Tm15 g a -> Tm15 g B\napp15 = \\ t, u, tm, var15, lam15, app15 => app15 _ _ _ (t tm var15 lam15 app15) (u tm var15 lam15 app15)\n\nv015 : {g:_}->{a:_} -> Tm15 (snoc15 g a) a\nv015 = var15 vz15\n\nv115 : {g:_}->{a:_}-> {B:_}-> Tm15 (snoc15 (snoc15 g a) B) a\nv115 = var15 (vs15 vz15)\n\nv215 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm15 (snoc15 (snoc15 (snoc15 g a) B) C) a\nv215 = var15 (vs15 (vs15 vz15))\n\nv315 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm15 (snoc15 (snoc15 (snoc15 (snoc15 g a) B) C) D) a\nv315 = var15 (vs15 (vs15 (vs15 vz15)))\n\nv415 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm15 (snoc15 (snoc15 (snoc15 (snoc15 (snoc15 g a) B) C) D) E) a\nv415 = var15 (vs15 (vs15 (vs15 (vs15 vz15))))\n\ntest15 : {g:_}-> {a:_} -> Tm15 g (arr15 (arr15 a a) (arr15 a a))\ntest15  = lam15 (lam15 (app15 v115 (app15 v115 (app15 v115 (app15 v115 (app15 v115 (app15 v115 v015)))))))\nTy16 : Type\nTy16 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty16 : Ty16\nempty16 = \\ _, empty, _ => empty\n\narr16 : Ty16 -> Ty16 -> Ty16\narr16 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon16 : Type\nCon16 = (Con16 : Type)\n ->(nil  : Con16)\n ->(snoc : Con16 -> Ty16 -> Con16)\n -> Con16\n\nnil16 : Con16\nnil16 = \\ con, nil16, snoc => nil16\n\nsnoc16 : Con16 -> Ty16 -> Con16\nsnoc16 = \\ g, a, con, nil16, snoc16 => snoc16 (g con nil16 snoc16) a\n\nVar16 : Con16 -> Ty16 -> Type\nVar16 = \\ g, a =>\n    (Var16 : Con16 -> Ty16 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var16 (snoc16 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var16 g a -> Var16 (snoc16 g b) a)\n -> Var16 g a\n\nvz16 : {g : _}-> {a : _} -> Var16 (snoc16 g a) a\nvz16 = \\ var, vz16, vs => vz16 _ _\n\nvs16 : {g : _} -> {B : _} -> {a : _} -> Var16 g a -> Var16 (snoc16 g B) a\nvs16 = \\ x, var, vz16, vs16 => vs16 _ _ _ (x var vz16 vs16)\n\nTm16 : Con16 -> Ty16 -> Type\nTm16 = \\ g, a =>\n    (Tm16    : Con16 -> Ty16 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var16 g a -> Tm16 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm16 (snoc16 g a) B -> Tm16 g (arr16 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm16 g (arr16 a B) -> Tm16 g a -> Tm16 g B)\n -> Tm16 g a\n\nvar16 : {g : _} -> {a : _} -> Var16 g a -> Tm16 g a\nvar16 = \\ x, tm, var16, lam, app => var16 _ _ x\n\nlam16 : {g : _} -> {a : _} -> {B : _} -> Tm16 (snoc16 g a) B -> Tm16 g (arr16 a B)\nlam16 = \\ t, tm, var16, lam16, app => lam16 _ _ _ (t tm var16 lam16 app)\n\napp16 : {g:_}->{a:_}->{B:_} -> Tm16 g (arr16 a B) -> Tm16 g a -> Tm16 g B\napp16 = \\ t, u, tm, var16, lam16, app16 => app16 _ _ _ (t tm var16 lam16 app16) (u tm var16 lam16 app16)\n\nv016 : {g:_}->{a:_} -> Tm16 (snoc16 g a) a\nv016 = var16 vz16\n\nv116 : {g:_}->{a:_}-> {B:_}-> Tm16 (snoc16 (snoc16 g a) B) a\nv116 = var16 (vs16 vz16)\n\nv216 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm16 (snoc16 (snoc16 (snoc16 g a) B) C) a\nv216 = var16 (vs16 (vs16 vz16))\n\nv316 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm16 (snoc16 (snoc16 (snoc16 (snoc16 g a) B) C) D) a\nv316 = var16 (vs16 (vs16 (vs16 vz16)))\n\nv416 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm16 (snoc16 (snoc16 (snoc16 (snoc16 (snoc16 g a) B) C) D) E) a\nv416 = var16 (vs16 (vs16 (vs16 (vs16 vz16))))\n\ntest16 : {g:_}-> {a:_} -> Tm16 g (arr16 (arr16 a a) (arr16 a a))\ntest16  = lam16 (lam16 (app16 v116 (app16 v116 (app16 v116 (app16 v116 (app16 v116 (app16 v116 v016)))))))\nTy17 : Type\nTy17 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty17 : Ty17\nempty17 = \\ _, empty, _ => empty\n\narr17 : Ty17 -> Ty17 -> Ty17\narr17 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon17 : Type\nCon17 = (Con17 : Type)\n ->(nil  : Con17)\n ->(snoc : Con17 -> Ty17 -> Con17)\n -> Con17\n\nnil17 : Con17\nnil17 = \\ con, nil17, snoc => nil17\n\nsnoc17 : Con17 -> Ty17 -> Con17\nsnoc17 = \\ g, a, con, nil17, snoc17 => snoc17 (g con nil17 snoc17) a\n\nVar17 : Con17 -> Ty17 -> Type\nVar17 = \\ g, a =>\n    (Var17 : Con17 -> Ty17 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var17 (snoc17 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var17 g a -> Var17 (snoc17 g b) a)\n -> Var17 g a\n\nvz17 : {g : _}-> {a : _} -> Var17 (snoc17 g a) a\nvz17 = \\ var, vz17, vs => vz17 _ _\n\nvs17 : {g : _} -> {B : _} -> {a : _} -> Var17 g a -> Var17 (snoc17 g B) a\nvs17 = \\ x, var, vz17, vs17 => vs17 _ _ _ (x var vz17 vs17)\n\nTm17 : Con17 -> Ty17 -> Type\nTm17 = \\ g, a =>\n    (Tm17    : Con17 -> Ty17 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var17 g a -> Tm17 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm17 (snoc17 g a) B -> Tm17 g (arr17 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm17 g (arr17 a B) -> Tm17 g a -> Tm17 g B)\n -> Tm17 g a\n\nvar17 : {g : _} -> {a : _} -> Var17 g a -> Tm17 g a\nvar17 = \\ x, tm, var17, lam, app => var17 _ _ x\n\nlam17 : {g : _} -> {a : _} -> {B : _} -> Tm17 (snoc17 g a) B -> Tm17 g (arr17 a B)\nlam17 = \\ t, tm, var17, lam17, app => lam17 _ _ _ (t tm var17 lam17 app)\n\napp17 : {g:_}->{a:_}->{B:_} -> Tm17 g (arr17 a B) -> Tm17 g a -> Tm17 g B\napp17 = \\ t, u, tm, var17, lam17, app17 => app17 _ _ _ (t tm var17 lam17 app17) (u tm var17 lam17 app17)\n\nv017 : {g:_}->{a:_} -> Tm17 (snoc17 g a) a\nv017 = var17 vz17\n\nv117 : {g:_}->{a:_}-> {B:_}-> Tm17 (snoc17 (snoc17 g a) B) a\nv117 = var17 (vs17 vz17)\n\nv217 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm17 (snoc17 (snoc17 (snoc17 g a) B) C) a\nv217 = var17 (vs17 (vs17 vz17))\n\nv317 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm17 (snoc17 (snoc17 (snoc17 (snoc17 g a) B) C) D) a\nv317 = var17 (vs17 (vs17 (vs17 vz17)))\n\nv417 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm17 (snoc17 (snoc17 (snoc17 (snoc17 (snoc17 g a) B) C) D) E) a\nv417 = var17 (vs17 (vs17 (vs17 (vs17 vz17))))\n\ntest17 : {g:_}-> {a:_} -> Tm17 g (arr17 (arr17 a a) (arr17 a a))\ntest17  = lam17 (lam17 (app17 v117 (app17 v117 (app17 v117 (app17 v117 (app17 v117 (app17 v117 v017)))))))\nTy18 : Type\nTy18 = (Ty    : Type)\n   ->(empty : Ty)\n   ->(arr   : Ty -> Ty -> Ty)\n   -> Ty\n\nempty18 : Ty18\nempty18 = \\ _, empty, _ => empty\n\narr18 : Ty18 -> Ty18 -> Ty18\narr18 = \\ a, b, ty, empty, arr => arr (a ty empty arr) (b ty empty arr)\n\nCon18 : Type\nCon18 = (Con18 : Type)\n ->(nil  : Con18)\n ->(snoc : Con18 -> Ty18 -> Con18)\n -> Con18\n\nnil18 : Con18\nnil18 = \\ con, nil18, snoc => nil18\n\nsnoc18 : Con18 -> Ty18 -> Con18\nsnoc18 = \\ g, a, con, nil18, snoc18 => snoc18 (g con nil18 snoc18) a\n\nVar18 : Con18 -> Ty18 -> Type\nVar18 = \\ g, a =>\n    (Var18 : Con18 -> Ty18 -> Type)\n -> (vz  : (g : _)-> (a : _) -> Var18 (snoc18 g a) a)\n -> (vs  : (g : _)-> (b : _) ->  (a : _) -> Var18 g a -> Var18 (snoc18 g b) a)\n -> Var18 g a\n\nvz18 : {g : _}-> {a : _} -> Var18 (snoc18 g a) a\nvz18 = \\ var, vz18, vs => vz18 _ _\n\nvs18 : {g : _} -> {B : _} -> {a : _} -> Var18 g a -> Var18 (snoc18 g B) a\nvs18 = \\ x, var, vz18, vs18 => vs18 _ _ _ (x var vz18 vs18)\n\nTm18 : Con18 -> Ty18 -> Type\nTm18 = \\ g, a =>\n    (Tm18    : Con18 -> Ty18 -> Type)\n -> (var   : (g : _) -> (a : _) -> Var18 g a -> Tm18 g a)\n -> (lam   : (g : _) -> (a : _) -> (B : _) -> Tm18 (snoc18 g a) B -> Tm18 g (arr18 a B))\n -> (app   : (g : _) -> (a : _) -> (B : _) -> Tm18 g (arr18 a B) -> Tm18 g a -> Tm18 g B)\n -> Tm18 g a\n\nvar18 : {g : _} -> {a : _} -> Var18 g a -> Tm18 g a\nvar18 = \\ x, tm, var18, lam, app => var18 _ _ x\n\nlam18 : {g : _} -> {a : _} -> {B : _} -> Tm18 (snoc18 g a) B -> Tm18 g (arr18 a B)\nlam18 = \\ t, tm, var18, lam18, app => lam18 _ _ _ (t tm var18 lam18 app)\n\napp18 : {g:_}->{a:_}->{B:_} -> Tm18 g (arr18 a B) -> Tm18 g a -> Tm18 g B\napp18 = \\ t, u, tm, var18, lam18, app18 => app18 _ _ _ (t tm var18 lam18 app18) (u tm var18 lam18 app18)\n\nv018 : {g:_}->{a:_} -> Tm18 (snoc18 g a) a\nv018 = var18 vz18\n\nv118 : {g:_}->{a:_}-> {B:_}-> Tm18 (snoc18 (snoc18 g a) B) a\nv118 = var18 (vs18 vz18)\n\nv218 : {g:_}-> {a:_}-> {B:_}-> {C:_} -> Tm18 (snoc18 (snoc18 (snoc18 g a) B) C) a\nv218 = var18 (vs18 (vs18 vz18))\n\nv318 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_} -> Tm18 (snoc18 (snoc18 (snoc18 (snoc18 g a) B) C) D) a\nv318 = var18 (vs18 (vs18 (vs18 vz18)))\n\nv418 : {g:_}-> {a:_}-> {B:_}-> {C:_}-> {D:_}-> {E:_}-> Tm18 (snoc18 (snoc18 (snoc18 (snoc18 (snoc18 g a) B) C) D) E) a\nv418 = var18 (vs18 (vs18 (vs18 (vs18 vz18))))\n\ntest18 : {g:_}-> {a:_} -> Tm18 g (arr18 (arr18 a a) (arr18 a a))\ntest18  = lam18 (lam18 (app18 v118 (app18 v118 (app18 v118 (app18 v118 (app18 v118 (app18 v118 v018)))))))\n", "meta": {"hexsha": "733d13df43ce5dc2d6279a95fa27255eaebb09f5", "size": 44792, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "bench/stlc_small1k.idr", "max_stars_repo_name": "Kha/smalltt", "max_stars_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 377, "max_stars_repo_stars_event_min_datetime": "2017-11-26T16:57:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-19T21:31:01.000Z", "max_issues_repo_path": "bench/stlc_small1k.idr", "max_issues_repo_name": "Kha/smalltt", "max_issues_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2020-03-16T09:14:57.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-28T21:51:10.000Z", "max_forks_repo_path": "bench/stlc_small1k.idr", "max_forks_repo_name": "Kha/smalltt", "max_forks_repo_head_hexsha": "3d4a20a6d80ac524325cf2d8d0a48095ded08eb6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 19, "max_forks_repo_forks_event_min_datetime": "2018-12-05T21:11:34.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T19:46:54.000Z", "avg_line_length": 33.1792592593, "max_line_length": 118, "alphanum_fraction": 0.4871628862, "num_tokens": 21151, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.822189121808099, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5296748745487573}}
{"text": "record Is3 (n : Nat) where\n  constructor MkThree\n  {auto prf : n === 3}\n\nthree : Is3 3\nthree = MkThree\n", "meta": {"hexsha": "dac17e38dccfd363aee80552a119599bc44d436a", "size": 103, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/record007/Fld.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/record007/Fld.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/record007/Fld.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 14.7142857143, "max_line_length": 26, "alphanum_fraction": 0.640776699, "num_tokens": 38, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891305219504, "lm_q2_score": 0.6442250928250375, "lm_q1q2_score": 0.5296748689302404}}
{"text": "module Main\n\nimport FndType\n\n-- Lifted increment function. Input fund must be at least 1.\ninc : (FndType (10 + fund) Int) -> (FndType fund Int)\n-- inc = upliftFun (\\x => (x + 1))\ninc (FT i) = FT (i + 1)\n\n-- Lifted decrement function. Input fund must be at least 1.\ndec : (FndType (10 + fund) Int) -> (FndType fund Int)\n-- dec = upliftFun (\\x => (x - 1))\ndec (FT i) = FT (i - 1)\n\n-- Main\nrich_42 : FndType 99 Int\nrich_42 = FT 42\npoor_42 : FndType 1 Int\npoor_42 = FT 42\nmain : IO ()\nmain = do\n  putStrLn (FndType.show rich_42)\n  putStrLn (FndType.show (inc rich_42)) -- Decrement the fund while incrementing the content\n  -- putStrLn (FndType.show (inc poor_42)) -- Just enough fund\n  -- putStrLn (FndType.show ((compose inc dec) rich_42)) -- Decrement the fund by 2\n  -- putStrLn (show ((compose inc dec) poor_42)) -- Not enough fund\n", "meta": {"hexsha": "0df70f47b262a05e317853b8dcac5e3d416dc5c8", "size": 833, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "experimental/realized-function/FndType-test.idr", "max_stars_repo_name": "nunet-io/ai-dsl", "max_stars_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2021-02-17T08:02:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-03T12:52:29.000Z", "max_issues_repo_path": "experimental/realized-function/FndType-test.idr", "max_issues_repo_name": "nunet-io/ai-dsl", "max_issues_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 15, "max_issues_repo_issues_event_min_datetime": "2021-03-04T10:33:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-16T04:55:50.000Z", "max_forks_repo_path": "experimental/realized-function/FndType-test.idr", "max_forks_repo_name": "nunet-io/ai-dsl", "max_forks_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2021-02-19T07:58:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-28T18:37:13.000Z", "avg_line_length": 30.8518518519, "max_line_length": 92, "alphanum_fraction": 0.6602641056, "num_tokens": 284, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8221891305219504, "lm_q2_score": 0.6442250928250375, "lm_q1q2_score": 0.5296748689302404}}
{"text": "module Minesweeper.Board\n\nimport Data.Vect \nimport Data.Fin\n\nimport Effects\nimport Effect.Random\nimport Effect.StdIO\nimport Effect.System\n\n-- |X,Y co-ordinate\npublic export\ndata Pos = MkPos Nat Nat \n\n-- | Two positions are the same if their x and y co-oridinates\n--   are equal\nimplementation Eq Pos where \n  (MkPos x1 y1) == (MkPos x2 y2) = (x1 == x2) && (y1 == y2)\n\nimplementation Show Pos where\n  show (MkPos x y) = \"(x : \" ++ show x ++ \", y : \" ++ show y ++ \")\"\n\n-- | A Square can either contain a mine or be adjacent to\n--   0 - 8 mines\ndata SqState = Mine | Safe Nat\n\n\n-- | A Square can be hidden (not yet pressed) or \n--   revealed \ndata Visibility = Hidden | Revealed\n\n\ndata Square = MkSquare Visibility SqState\n\n\n-- | Board is m * n squares\nexport\ndata Board : Nat -> Nat -> Type where\n   MkBoard : (Vect m (Vect n Square)) -> Board m n\n\n\nstrRepeat : Nat -> String -> String\nstrRepeat Z s = \"\"\nstrRepeat (S n) s = s ++ strRepeat n s\n\nconcatSV : Vect n String -> String\nconcatSV Nil = \"\"\nconcatSV (v :: vs) = v ++ (concatSV vs)\n\n\n-- | Display the board, hiding any hidden squares\nexport\nshowBoard : (Board rows cols) -> String\nshowBoard {rows} {cols} board = if rows == 0 \n  then \"Empty\"\n  else  firstRow ++ \"\\n\" ++ (showRows board)\n \n  where firstRow = strRepeat (2 * cols + 1) \"-\" \n        \n        showRows : (Board rows cols) -> String\n        showRows (MkBoard vs) = concatSV $ map (\\v => (showRow v) ++ \"\\n\") vs\n\n        where showRow : Vect k Square -> String\n              showRow v = \"|\" ++ rowStr ++ \"\\n\" ++ endStr\n                where rowStr = concatSV $ map (\\(MkSquare vis st) => case (vis, st) of\n                                    (Hidden, _) => \"?|\"\n                                    (Revealed, Mine) => \"m|\"\n                                    (Revealed, Safe Z) => \" |\"\n                                    (Revealed, Safe n) => (show n) ++ \"|\" ) v \n\n                      -- Line under each Row\n                      endStr = (concatSV $ map (\\_ => \"--\") v) ++ \"-\"\n\n\n-- | Display the board, revealing all hidden squares\nexport\nshowRevealed : (Board rows cols) -> String\nshowRevealed {rows} {cols} board = if rows == 0 \n  then \"Empty\"\n  else  firstRow ++ \"\\n\" ++ (showRows board)\n \n  where firstRow = strRepeat (2 * cols + 1) \"-\" \n        \n        showRows : (Board rows cols) -> String\n        showRows (MkBoard vs) = concatSV $ map (\\v => (showRow v) ++ \"\\n\") vs\n\n        where showRow : Vect k Square -> String\n              showRow v = \"|\" ++ rowStr ++ \"\\n\" ++ endStr\n                where rowStr = concatSV $ map (\\(MkSquare _ st) => case st of\n                                    Mine => \"m|\"\n                                    (Safe Z) => \" |\"\n                                    (Safe n) => (show n) ++ \"|\" ) v \n\n                      -- Line under each Row\n                      endStr = (concatSV $ map (\\_ => \"--\") v) ++ \"-\"\n\n\n\n-- | Prove n = plus n 0\nnatPlusZ : (n : Nat) -> n = plus n 0\nnatPlusZ Z = Refl\nnatPlusZ (S o) = rewrite natPlusZ o in Refl \n\n\n-- | Apply the given function (k - 1) times to a given value and return\n--   all the intermediate values as a vector\niterateV : (k : Nat) -> (a -> a) -> a -> Vect k a\niterateV k f b = rewrite (natPlusZ k) in (reverse $ iterateV' k b Nil)\n  where iterateV' : (m : Nat) -> a -> (Vect n a) -> (Vect (m + n) a)\n        iterateV' Z _ v = v\n        iterateV' (S l) a v {n} = rewrite (plusSuccRightSucc l n) in \n                                    iterateV' l (f a) (a :: v)\n \n-- | Given an index, element and vector create a new\n--   vector with the given element at that index.\n--   If the index is >= the vector size then the same\n--   vector is returned \nreplaceV : Nat -> a -> Vect n a -> Vect n a \nreplaceV = replaceV' Z \n  where replaceV' : Nat -> Nat -> a -> Vect n a -> Vect n a \n        replaceV' _ _ _ Nil = Nil\n        replaceV' cur pos a (v :: vs) = \n          if (cur == pos) \n            then a :: vs\n            else v :: (replaceV' (cur + 1) pos a vs)\n         \n\n-- | Given row and column number and a Board, attempts\n--   to increment the bomb adjacency value of the given\n--   square in the board, if the row/col numbers are out\n--   of range returns nothing, if the square selected is\n--   a mine then the same Board is returned\nincBoardSquare : Nat -> Nat -> (Board rows cols) -> Maybe (Board rows cols)\nincBoardSquare {rows} {cols} y x (MkBoard v) = do\n  rowPos <- natToFin y rows \n  colPos <- natToFin x cols\n  let row  =index rowPos v\n  let square = index colPos row\n\n  let newSquare = case square of\n    (MkSquare vis (Safe n)) => (MkSquare vis (Safe (S n)))\n    sq => sq\n    \n  pure $ MkBoard (replaceV y (replaceV x newSquare row) v)\n\n\n-- | Attempt to increment the mine adjacency value for all 8 adjacent squares\n--   of a given mine position, if the bomb position given is out of bounds then\n--   Nothing is returned. Any adjacent squares which aren't on the board are \n--   not incremented\nincAdjacentSquares : Pos -> (Board rows cols) -> Maybe (Board rows cols)\nincAdjacentSquares {rows} {cols} (MkPos x y) board = do\n    -- Increment squares to the left of the mine\n    leftSide <- incLeftSide board x \n    -- Increment squares to the right side of the mine\n    rightSide <- incRightSide leftSide cols\n    -- Increment squares above and below the mine\n    top <- incTop rightSide y \n    bot <- incBot top rows \n\n    pure bot\n\n  where\n        incTopLeft : (Board rows cols) -> Nat -> Nat -> Maybe (Board rows cols)\n        incTopLeft prev Z _ = pure prev\n        incTopLeft prev _ Z = pure prev\n        incTopLeft prev (S y) (S x) = incBoardSquare y x prev\n        \n        incBotLeft : (Board rows cols) -> Nat -> Nat -> Maybe (Board rows cols)\n        incBotLeft prev Z _ = pure prev\n        incBotLeft prev _ Z = pure prev\n        incBotLeft prev (S r) (S x) = if y < r then incBoardSquare (y + 1) x prev else pure prev\n        \n        incLeftSide : (Board rows cols) -> Nat -> Maybe (Board rows cols)\n        incLeftSide prev Z = pure prev\n        incLeftSide prev (S x) = do\n            left <- incBoardSquare y x prev\n            topLeft <- incTopLeft left y (S x)\n            incBotLeft topLeft rows (S x)\n\n        incTopRight : (Board rows cols) -> Nat -> Maybe (Board rows cols)\n        incTopRight prev Z = pure prev\n        incTopRight prev (S y) = incBoardSquare y (x + 1) prev\n       \n        incBotRight : (Board rows cols) -> Nat -> Maybe (Board rows cols)\n        incBotRight prev Z = pure prev\n        incBotRight prev (S r) = if y < r then incBoardSquare (y + 1) (x + 1) prev else pure prev\n  \n        incRightSide : (Board rows cols) -> Nat -> Maybe (Board rows cols)\n        incRightSide prev Z = pure prev\n        incRightSide prev (S c) = if x < c\n          then do\n            right <- incBoardSquare y (x + 1) prev\n            topRight <- incTopRight right y\n            incBotRight topRight rows\n          else\n            pure prev\n\n        incTop : (Board rows cols) -> Nat -> Maybe (Board rows cols)\n        incTop prev Z = pure prev\n        incTop prev (S y) = incBoardSquare y x prev\n\n        incBot : Board rows cols -> Nat -> Maybe (Board rows cols)\n        incBot prev Z = pure prev\n        incBot prev (S r) = if y < r then incBoardSquare (y + 1) x prev else pure prev\n\n-- | Given row and column  dimensions of board with mines generate \n--   the board\nexport\ncreateBoard : (n : Nat) ->  (m : Nat) -> Vect k Pos -> Maybe (Board m n)\ncreateBoard cols rows mines = do\n      let initialBoard = MkBoard $ map (\\row => generateRow row cols) (iterateV rows (+1) 0)\n      calculateState initialBoard\n\n    where generateRow : Nat -> (n : Nat) -> Vect n Square\n          generateRow row cols = map (\\col => generateSquare row col) (iterateV cols (+1) 0)\n\n          where generateSquare : Nat -> Nat -> Square\n                generateSquare row col = MkSquare Hidden sqState\n                -- Check if Square is a mine\n                where sqState = if (MkPos col row) `elem` mines \n                                then Mine \n                                else Safe 0\n        \n         -- For each non mine square work out the number of adjacent\n         -- bombs\n          calculateState : Board m n -> Maybe (Board m n)\n          calculateState board = calculateState' board mines\n            where calculateState' : Board m n -> Vect k Pos -> Maybe (Board m n) \n                  calculateState' board Nil = pure board\n                  calculateState' board (x :: xs) = do \n                    res <- (incAdjacentSquares x board) \n                    calculateState' res xs\n\n\n-- | Determines if the Board is in a \"Win\" State\n--   i.e. all hidden squares are mines\nexport\ncheckWin : Board m n -> Bool\ncheckWin (MkBoard v) = foldl (\\b, v => (checkRow v) && b) True v -- Check each row matches win condition\n  where checkRow : Vect n Square -> Bool \n        checkRow v = foldl (\\b, (MkSquare vis st) => case (vis, st) of\n                      (Revealed, Safe m) => b -- All safe squares must be revealed\n                      (Hidden, Mine) => b  -- Hidden mines are still a win condition\n                      _ => b && False) True v\n\n-- | Determines if the Board is in a \"Lose\" State\n--   i.e. a revealed square is a mine\nexport\ncheckLose : Board m n -> Bool\ncheckLose (MkBoard v) = foldl(\\b, v => (checkRow v) || b) False v\n  where checkRow v = foldl (\\b, (MkSquare vis st) => case (vis, st) of\n                      (Revealed, Mine) => True -- If any mines are revealed, the player loses\n                      _ => b || False) False v \n \n\n-- Reveals the given position, returns the new Board state\n-- if a square is revealed, otherwise returns an error message\n-- if the square has already been revealed or it's out of bounds\nexport\nreveal : Pos -> Board rows cols -> Either String (Board rows cols)\nreveal (MkPos x y) board@(MkBoard v) = do\n  rowPos <- maybeToEither \"Out Of Bounds.\" (natToFin y rows) \n  colPos <- maybeToEither \"Out Of Bounds.\" (natToFin x cols)\n  let row  =index rowPos v\n  let square = index colPos row\n  \n \n  case square of\n    (MkSquare Revealed _) => Left \"Square has already been revealed\"\n\n    -- No surrounding mines, reveal all squares surrounding the revealed square\n    (MkSquare Hidden (Safe Z)) => do\n        let newSq = MkSquare Revealed (Safe Z)\n        pure (MkBoard (replaceV y (replaceV x newSq row) v)) >>=\n\n          \\b => pure (revealTop b y) >>=\n          \\b => pure (revealLeft b x) >>=\n          \\b => pure (revealTopLeft b y x) >>=\n          \\b => pure (revealNoErr (MkPos x       (y + 1)) b) >>=\n          \\b => pure (revealNoErr (MkPos (x + 1) y      ) b) >>=\n          \\b => pure (revealNoErr (MkPos (x + 1) (y + 1)) b)  \n\n    (MkSquare Hidden sq) => do \n        let newSq = MkSquare Revealed sq\n        pure $ MkBoard (replaceV y (replaceV x newSq row) v)\n   \n -- Reveals the given position, returns the new Board state\n -- if a square is revealed, otherwise returns the old board state\n where revealNoErr : Pos -> Board rows cols -> Board rows cols\n       revealNoErr p b = case reveal p b of\n                           (Right newB) => newB\n                           (Left _) => b\n\n       revealLeft : Board rows cols -> Nat -> Board rows cols\n       revealLeft prev Z = prev\n       revealLeft prev (S x) = revealNoErr (MkPos x (y + 1)) (revealNoErr (MkPos x y) prev)\n        \n       revealTop : Board rows cols -> Nat -> Board rows cols\n       revealTop prev Z = prev\n       revealTop prev (S y) = revealNoErr (MkPos (x + 1) y) (revealNoErr (MkPos x y) prev)\n\n       revealTopLeft : Board rows cols -> Nat -> Nat -> Board rows cols\n       revealTopLeft prev Z _ = prev\n       revealTopLeft prev _ Z = prev\n       revealTopLeft prev y x = revealNoErr (MkPos x y) prev\n\n-- | Given x and y dimensions and a vector containing\n--   the positions of already generated mines, places a mine\n--   in a position which isn't contained in the given vector\ngenerateMine : Nat -> Nat -> (Vect n Pos) -> {[RND]} Eff Pos\ngenerateMine x y mines = do\n  xPos <- rndInt 0 (toIntegerNat x) \n  yPos <- rndInt 0 (toIntegerNat y)\n  let mine = MkPos (fromIntegerNat xPos) (fromIntegerNat yPos)\n\n  -- If position already taken then attempt to regenerate\n  if mine `elem` mines \n    then pure $ placeRightMine mine \n    else pure mine\n  \n  \n where placeRightMine : Pos -> Pos\n       placeRightMine (MkPos col row) = \n            if nextPos `elem` mines\n              then placeRightMine nextPos \n              else nextPos\n           \n           -- Modulo giving strange division by 0 runtime error,\n           -- so calculate next square to the right manually \n           where nextCol : Nat\n                 nextCol = if (S col) == x then Z else (S col)\n                 nextRow : Nat\n                 nextRow = if nextCol == Z \n                              then if ((S row) == y) then Z else (S row)\n                              else row\n                 nextPos = (MkPos nextCol nextRow)\n\n\n\n-- | Given x and y dimensions and number of mines to create \n--   creates a vector containing positions of randomly placed mines.\n--  if there are more mines than x * y spaces then Nothing is returned.\n--  To guarantee termination if a collision occurs then a mine is attempted\n--  to be placed to the right of the mine until a free space is hit\ngenerateMines' : Nat -> Nat -> (n : Nat) -> {[RND]} Eff (Vect (n) Pos)\ngenerateMines' x y nMines = rewrite (natPlusZ nMines) in \n                                generateMines'' nMines Nil\n \n  where generateMines'' : (m : Nat) -> (Vect k Pos) -> {[RND]} Eff (Vect (m + k)  Pos)\n        generateMines'' Z v = pure v\n        generateMines'' {k} (S l) mines = \n\t\t\t\t\t(generateMine x y mines) >>= \n\t\t\t\t\t\\mine => rewrite (plusSuccRightSucc l k) in generateMines'' l (mine ::mines) \n        \nexport          \ngenerateMines : Nat -> Nat -> (n : Nat) -> {[SYSTEM, RND]} Eff (Maybe (Vect n Pos))\ngenerateMines x y nMines = \n  if (x * y < nMines) \n    then pure Nothing\n    else do\n      -- Use current system time as RNG seed\n      t <- time \n      srand t\n      pure $ Just !(generateMines' x y nMines)\n      \n\n\n\n", "meta": {"hexsha": "3a460e4999f21f90080f2bedf88c70765bd7533c", "size": 14023, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Minesweeper/Board.idr", "max_stars_repo_name": "RossMeikleham/Idris-Minesweeper", "max_stars_repo_head_hexsha": "59fad3cbccff2b8b3f65f1a848d454efe78742b7", "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/Minesweeper/Board.idr", "max_issues_repo_name": "RossMeikleham/Idris-Minesweeper", "max_issues_repo_head_hexsha": "59fad3cbccff2b8b3f65f1a848d454efe78742b7", "max_issues_repo_licenses": ["MIT"], "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/Minesweeper/Board.idr", "max_forks_repo_name": "RossMeikleham/Idris-Minesweeper", "max_forks_repo_head_hexsha": "59fad3cbccff2b8b3f65f1a848d454efe78742b7", "max_forks_repo_licenses": ["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.9, "max_line_length": 104, "alphanum_fraction": 0.5768380518, "num_tokens": 3862, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7401743505760728, "lm_q2_score": 0.7154239957834733, "lm_q1q2_score": 0.5295384914655714}}
{"text": "module MinesweeperSMT\n\nimport Data.Vect\nimport src.SMTLib\nimport src.Tensor\nimport src.GridOps\n\npuzzle : Vect 9 (Vect 9 Int)\npuzzle = [ [-1, -1, -1, -1,  1,  0,  0,  1, -1],\n           [-1, -1,  2,  1,  1,  0,  0,  1,  1],\n           [-1, -1,  1,  0,  0,  0,  0,  0,  0],\n           [-1,  2,  1,  0,  0,  0,  0,  0,  0],\n           [-1,  2,  0,  0,  0,  0,  0,  0,  0],\n           [-1,  3,  1,  0,  0,  0,  1,  1,  1],\n           [-1, -1,  1,  0,  0,  0,  1, -1, -1],\n           [-1, -1,  2,  2,  1,  1,  1, -1, -1],\n           [-1, -1, -1, -1, -1, -1, -1, -1, -1] ]\n\nlookup : Fin n -> Fin m -> List Dir ->  Vect n (Vect m (Expr (NumT IntT))) -> Expr (NumT IntT)\nlookup n m ds xss = GridOps.lookup n m ds (int 0) xss\n\nequation : Fin n -> Fin m -> Int -> Vect n (Vect m (Expr (NumT IntT))) -> Expr BoolT\nequation n m v xss with (toPos n, toPos m)\n  equation n m v xss | (First, First) = add [lookup n m [Left] xss, lookup n m [Up] xss, lookup n m [Up, Left] xss] == (int v)\n  equation n m v xss | (Last, Last) = add [lookup n m [Right] xss, lookup n m [Down] xss, lookup n m [Down, Right] xss] == (int v)\n  equation n m v xss | (First, Last) = add [lookup n m [Right] xss, lookup n m [Up] xss, lookup n m [Up, Right] xss] == (int v)\n  equation n m v xss | (Last, First) = add [lookup n m [Left] xss, lookup n m [Down] xss, lookup n m [Down, Left] xss] == (int v)\n  equation n m v xss | (First, _) = add [lookup n m [Left] xss, lookup n m [Right] xss, lookup n m [Up] xss,\n                                         lookup n m [Up, Right] xss, lookup n m [Up, Left] xss] == (int v)\n  equation n m v xss | (Last, _) = add [lookup n m [Left] xss, lookup n m [Right] xss, lookup n m [Down] xss,\n                                        lookup n m [Down, Right] xss, lookup n m [Down, Left] xss] == (int v)\n  equation n m v xss | (_, First) = add [lookup n m [Left] xss, lookup n m [Down] xss, lookup n m [Down, Left] xss,\n                                         lookup n m [Up] xss, lookup n m [Up, Left] xss] == (int v)\n  equation n m v xss | (_, Last) = add [lookup n m [Right] xss, lookup n m [Down] xss, lookup n m [Down, Right] xss,\n                                        lookup n m [Up] xss, lookup n m [Up, Right] xss] == (int v)\n  equation n m v xss | (_, _) = add [lookup n m [Left] xss, lookup n m [Right] xss, lookup n m [Down] xss,\n                                     lookup n m [Up] xss, lookup n m [Down, Right] xss, lookup n m [Down, Left] xss,\n                                     lookup n m [Up, Right] xss, lookup n m [Up, Left] xss] == (int v)\n\ncollect : Vect n (Vect m Int) -> Vect n (Vect m (Expr (NumT IntT))) -> Vect n (Vect m (Expr BoolT))\ncollect puzzle vars = tabulate (\\n => tabulate (\\m => let (x, v) = (index n m puzzle, index n m vars) in\n                                                      if x < 0 then (v == (int 0)) || (v == (int 1)) else (v == (int 0)) && equation n m x vars))\n\nvars : Tensor [9, 9] String\nvars = toTensor $ tabulate (\\i0 => tabulate (\\i1 => \"x_\" ++ show (finToNat i0) ++ \"_\" ++ show (finToNat i1)))\n\ninst : Vect 9 (Vect 9 (Expr (NumT IntT)))\ninst = tabulate (\\i0 => tabulate (\\i1 => int $ index i0 i1 puzzle))\n\nsolver : Smt ()\nsolver = do vars <- declareVars vars (NumT IntT)\n            assert $ and $ concat $ collect puzzle (toVect vars)\n            assert $ index 0 1 (toVect vars) == (int 1)\n            checkSat\n            getModel\n            end\n\ntest : IO ()\ntest = print solver\n", "meta": {"hexsha": "ebfd02d01bc155dfcfa5223dd80b4172cfac0fb3", "size": 3439, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/MinesweeperSMT.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/MinesweeperSMT.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/MinesweeperSMT.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 57.3166666667, "max_line_length": 145, "alphanum_fraction": 0.5013085199, "num_tokens": 1295, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673269042767, "lm_q2_score": 0.6513548646660542, "lm_q1q2_score": 0.5294650877071924}}
{"text": "module Quantities.Units\n\nimport Quantities.Core\nimport Quantities.SIBaseQuantities\nimport Quantities.SIDerivedQuantities\nimport Quantities.SIBaseUnits\n\n%default total\n%access public export\n\nRadian : Unit PlaneAngle\nRadian = One\nRad : Unit PlaneAngle\nRad = One\n\nSteradian : Unit SolidAngle\nSteradian = One\nSr : Unit SolidAngle\nSr = Steradian\n\nHertz : Unit Frequency\nHertz = Second ^^ (-1)\nHz : Unit Frequency\nHz = Hertz\n\nNewton : Unit Force'\nNewton = ((Metre <//> Second) <//> Second) <**> Kilogram\nN : Unit Force'\nN = Newton\n\nPascal : Unit Pressure\nPascal = Newton <//> (Metre ^^ 2)\nPa : Unit Pressure\nPa = Pascal\n\nJoule : Unit Energy\nJoule = Newton <**> Metre\nJ : Unit Energy\nJ = Joule\n\nWatt : Unit Power\nWatt = Joule <//> Second\nW : Unit Power\nW = Watt\n\nCoulomb : Unit ElectricCharge\nCoulomb = Second <**> Ampere\nC : Unit ElectricCharge\nC = Coulomb\n\nVolt : Unit ElectricPotentialDifference\nVolt = Watt <//> Ampere\nV : Unit ElectricPotentialDifference\nV = Volt\n\nFarad : Unit Capacitance\nFarad = Coulomb <//> Volt\nF : Unit Capacitance\nF = Farad\n\nOhm : Unit ElectricResistance\nOhm = Volt <//> Ampere\n\nSiemens : Unit ElectricConductance\nSiemens = Ampere <//> Volt\nS : Unit ElectricConductance\nS = Siemens\n\nWeber : Unit MagneticFlux\nWeber = Second <**> Volt\nWb : Unit MagneticFlux\nWb = Weber\n\nTesla : Unit MagneticFluxDensity\nTesla = Weber <//> (Metre ^^ 2)\nT : Unit MagneticFluxDensity\nT = Tesla\n\nHenry : Unit Inductance\nHenry = Weber <//> Ampere\nH : Unit Inductance\nH = Henry\n\n-- For relative temperature measurements\nCelsius : Unit Temperature\nCelsius = Kelvin\nDC : Unit Temperature\nDC = Celsius\n\nLumen : Unit LuminousFlux\nLumen = Candela <**> Steradian\nLm : Unit LuminousFlux\nLm = Lumen\n\nLux : Unit Illuminance\nLux = Lumen <//> (Metre ^^ 2)\nLx : Unit Illuminance\nLx = Lux\n\nBecquerel : Unit ActivityReferredToARadionuclide\nBecquerel = Second ^^ (-1)\nBq : Unit ActivityReferredToARadionuclide\nBq = Becquerel\n\nGray : Unit AbsorbedDose\nGray = Joule <//> Kilogram\nGy : Unit AbsorbedDose\nGy = Gray\n\nSievert : Unit DoseEquivalent\nSievert = Joule <//> Kilogram\nSv : Unit DoseEquivalent\nSv = Sievert\n\nKatal : Unit CatalyticActivity\nKatal = Mol <//> Second\nKat : Unit CatalyticActivity\nKat = Katal\n", "meta": {"hexsha": "28d60138b532960956887882d17738b8e9438f22", "size": 2189, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Quantities/SIDerivedUnits.idr", "max_stars_repo_name": "timjb/quantities", "max_stars_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 112, "max_stars_repo_stars_event_min_datetime": "2015-01-18T13:52:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-08T14:15:46.000Z", "max_issues_repo_path": "Quantities/SIDerivedUnits.idr", "max_issues_repo_name": "timjb/quantities", "max_issues_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2015-11-04T08:51:41.000Z", "max_issues_repo_issues_event_max_datetime": "2018-04-17T09:52:29.000Z", "max_forks_repo_path": "Quantities/SIDerivedUnits.idr", "max_forks_repo_name": "timjb/quantities", "max_forks_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 9, "max_forks_repo_forks_event_min_datetime": "2015-04-28T23:49:30.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-01T17:28:34.000Z", "avg_line_length": 18.3949579832, "max_line_length": 56, "alphanum_fraction": 0.7295568753, "num_tokens": 696, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673087708699, "lm_q2_score": 0.6513548646660542, "lm_q1q2_score": 0.5294650758959096}}
{"text": "labelWith : Stream labelType -> List a -> List (labelType, a)\nlabelWith lbl [] = []\nlabelWith (lbl :: lbls) (val :: vals) = (lbl, val) :: labelWith lbls vals\n\nlabel : List a -> List (Integer, a)\nlabel = labelWith (iterate (+1) 0)\n", "meta": {"hexsha": "faf44a869f385c309ecd27b6cc996e7fb5e98193", "size": 230, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris-exercises/Streams.idr", "max_stars_repo_name": "0nkery/tt-tutorials", "max_stars_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "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": "idris-exercises/Streams.idr", "max_issues_repo_name": "0nkery/tt-tutorials", "max_issues_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "idris-exercises/Streams.idr", "max_forks_repo_name": "0nkery/tt-tutorials", "max_forks_repo_head_hexsha": "a39926989c2f39c718893b99bd857b6d51a172b0", "max_forks_repo_licenses": ["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.8571428571, "max_line_length": 73, "alphanum_fraction": 0.6347826087, "num_tokens": 72, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6859494678483918, "lm_q2_score": 0.7718434978390747, "lm_q1q2_score": 0.5294456366049547}}
{"text": "import Data.Vect\n\n-- using implicit arguments in pattern matching\nlength : Vect n elem -> Nat\nlength {n} xs = n\n\n-- give explicit values for implicit arguments by\n-- using the notation {n = value}\ncreate_empties : Vect n (Vect 0 a)\ncreate_empties {n = Z} = []\ncreate_empties {n = (S k)} = [] :: create_empties\n", "meta": {"hexsha": "7c8a141f9470a3b7c14fb709ce19c3ea171fe8bb", "size": 310, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "starting/3_4_3.idr", "max_stars_repo_name": "prt2121/tdd-playground", "max_stars_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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": "starting/3_4_3.idr", "max_issues_repo_name": "prt2121/tdd-playground", "max_issues_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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": "starting/3_4_3.idr", "max_forks_repo_name": "prt2121/tdd-playground", "max_forks_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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.8333333333, "max_line_length": 49, "alphanum_fraction": 0.6935483871, "num_tokens": 90, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7956581097540519, "lm_q2_score": 0.6654105653819836, "lm_q1q2_score": 0.5294393126622041}}
{"text": "module Verified.Functor.Maybe\n\nimport Verified.Functor\n\ninstance VerifiedFunctor Maybe where\n  functorIdentity Nothing = Refl\n  functorIdentity (Just x) = Refl\n  functorComposition Nothing g1 g2 = Refl\n  functorComposition (Just x) g1 g2 = Refl\n", "meta": {"hexsha": "cbb661be848af065de582d3720310217a8d28033", "size": 245, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Verified/Functor/Maybe.idr", "max_stars_repo_name": "yurrriq/idris-verified", "max_stars_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "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/Verified/Functor/Maybe.idr", "max_issues_repo_name": "yurrriq/idris-verified", "max_issues_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "max_issues_repo_licenses": ["MIT"], "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/Verified/Functor/Maybe.idr", "max_forks_repo_name": "yurrriq/idris-verified", "max_forks_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "max_forks_repo_licenses": ["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.5, "max_line_length": 42, "alphanum_fraction": 0.7918367347, "num_tokens": 66, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7956580903722561, "lm_q2_score": 0.6654105653819835, "lm_q1q2_score": 0.5294392997653523}}
{"text": "data Fin : Nat -> Type where\n     FZ : Fin (S k)\n     FS : Fin k -> Fin (S k)\n\ninterface Finite t where\n  card   : Nat\n  to     : t -> Fin card\n  from   : Fin card -> t\n  toFrom : (k : Fin card) -> to (from k) = k\n  fromTo : (x : t) -> from (to x) = x\n\n-- Checking dependent methods work, and that having names from the\n-- methods shadowed in the interface head doesn't cause any issues\n\nimplementation Finite (Fin k) where\n  card   = ?ncard\n  to     = ?lala\n  from   = ?lula\n  toFrom = ?foo\n  fromTo = ?bar\n\nimplementation Finite (Fin n) where\n  card   = ?ncard1\n  to     = ?lala1\n  from   = ?lula1\n  toFrom = ?foo1\n  fromTo = ?bar1\n\nimplementation Finite (Fin t) where\n  card   = ?ncard2\n  to     = ?lala2\n  from   = ?lula2\n  toFrom = ?foo2\n  fromTo = ?bar2\n", "meta": {"hexsha": "4ed81f509844eb4f71181aba40313c0b26c907f2", "size": 760, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interface005/Deps.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/interface005/Deps.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/interface005/Deps.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 21.7142857143, "max_line_length": 66, "alphanum_fraction": 0.5934210526, "num_tokens": 269, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8499711604559846, "lm_q2_score": 0.6224593312018546, "lm_q1q2_score": 0.5290724800782964}}
{"text": "||| An embedding of `Dec` instances into `Either` to gain access to Do notation.\n|||\n||| Thanks Matus for figuring it out.\n|||\n||| So let's have this:\n|||\n||| ```\n||| exampleDo : DecEq a => DecEq b => (ps, rs : Pair a b) -> Dec (ps = rs)\n||| exampleDo (x, y) (a,b)\n|||   = decDo $ do Refl <- decEq x a `otherwise` (\\Refl => Refl)\n|||                Refl <- decEq y b `otherwise` (\\Refl => Refl)\n|||                Right Refl\n||| ```\n|||\n||| Rather than:\n|||\n||| ```\n||| example : DecEq a => DecEq b => (ps, rs : Pair a b) -> Dec (ps = rs)\n||| example (x, y) (a, b) with (decEq x a)\n|||   example (x, y) (x, b) | (Yes Refl) with (decEq y b)\n|||     example (x, y) (x, y) | (Yes Refl) | (Yes Refl) = Yes Refl\n|||     example (x, y) (x, b) | (Yes Refl) | (No contra) = No (\\Refl => contra Refl)\n|||   example (x, y) (a, b) | (No contra) = No (\\Refl => contra Refl)\n||| ```\n|||\nmodule Toolkit.Decidable.Do\n\nimport Decidable.Equality\n\nimport Toolkit.Decidable.Informative\n\n%default total\n\nexport\notherwise : Dec b -> (a -> b) -> Either (Not a) b\notherwise (Yes pfB)  f = Right pfB\notherwise (No notB)  f = Left (notB . f)\n\nexport\ndecDo : Either (Not a) a -> Dec a\ndecDo (Left notA) = No notA\ndecDo (Right pfA) = Yes pfA\n\n\n-- [ EOF ]\n", "meta": {"hexsha": "665bcc78ad64e7a0fc75ea5ac20b5e6c8ec2255c", "size": 1228, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Toolkit/Decidable/Do.idr", "max_stars_repo_name": "gallais/linear-circuits", "max_stars_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2020-11-03T11:33:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-14T17:11:38.000Z", "max_issues_repo_path": "src/Toolkit/Decidable/Do.idr", "max_issues_repo_name": "gallais/linear-circuits", "max_issues_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "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/Toolkit/Decidable/Do.idr", "max_forks_repo_name": "gallais/linear-circuits", "max_forks_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-02-09T19:49:11.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-09T19:49:11.000Z", "avg_line_length": 26.6956521739, "max_line_length": 84, "alphanum_fraction": 0.5447882736, "num_tokens": 447, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7461389930307512, "lm_q2_score": 0.7090191399336402, "lm_q1q2_score": 0.5290268271096156}}
{"text": "module WordLength\n\nallLengths : List String -> List Nat\nallLengths [] = []\nallLengths (x :: xs) = length x :: allLengths xs", "meta": {"hexsha": "9d1d20c851717a0db378b4e8ca66d0416cbc6e33", "size": 123, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter3/WordLength.idr", "max_stars_repo_name": "timmyjose-study/tdd-with-idris", "max_stars_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "chapter3/WordLength.idr", "max_issues_repo_name": "timmyjose-study/tdd-with-idris", "max_issues_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": "chapter3/WordLength.idr", "max_forks_repo_name": "timmyjose-study/tdd-with-idris", "max_forks_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": 24.6, "max_line_length": 48, "alphanum_fraction": 0.6910569106, "num_tokens": 36, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7461390043208003, "lm_q2_score": 0.7090191276365462, "lm_q1q2_score": 0.529026825939135}}
{"text": "> module Discussion\n\n> import Fix\n\n# Data Types a la Carte in Idris\n\nA brief discussion on design choices implementing DTalC.\n\n## Syntax\n\nOne of the problems with the [original Data Types a la Carte implementation](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf),\nwas that the coproduct, `(:+:)`, allowed arbitrary grouping of signatures,\ne.g. `(f :+: g) :+: g`. However, injection only performed a linear search from\nleft to right, and so the subtyping relation could not be satisfied in cases\nwhich were not right-associative, such as `f :\u227a: (f :+: g) :+: h`.\n\nTo remedy this, a [list of signatures can be used instead](https://reasonablypolymorphic.com/blog/better-data-types-a-la-carte/).\nFor example, `f :+: g` would be written as `Sig [f, g]`, using `Sig` below.\nHere, `fs` is a list of the different signatures that make up the composite\nsignature `Sig`. The `a` is the type given to each `f` in `fs`.\n\n(Side note: An alternative method to solve injection into non-right-associative\nsignatures involves using a [backtracking search](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.643.3533&rep=rep1&type=pdf),\nbut using a list provides a simpler solution)\n\n> data Sig : (fs : List (Type -> Type)) -> (a : Type) -> Type where\n>     Here  : f a -> Sig (f :: fs) a\n>     There : Sig fs a -> Sig (f :: fs) a\n\nInstead of `InL` and `InR` constructors for the coproduct, `Sig` uses `Here`\nand `There` to describe how to construct a value of a signature. For example,\nthe DSL from Data Types a la Carte paper can be described as:\n\n> data Val k = V Int\n> data Add k = A k k\n\nUsing the standard definition of Fix, and the `Here` and `There` constructors,\nDSLs containing both values and addition can be created. Below represents the\nexpression `1 + 2`:\n\n> ex1 : Fix (Sig [Val, Add])\n> ex1 = In (There (Here (A x y))) where\n>     x = In (Here (V 1))\n>     y = In (Here (V 2))\n\nClearly, this is very cumbersome to write, and so, like in the original paper,\nit would be better to automate injection into some super-type. This will involve\nfinding the correct combination of `There` and `Here`.\n\nAttempting to use interface instances, like in the original paper, such as\nthose below to perform this linear-search requires overlapping instances, which\nIdris [does not allow](http://docs.idris-lang.org/en/v0.9.18/tutorial/classes.html).\n\nTherefore, another solution to this search is required. Fortunately, this has\nalready been solved in the standard library (see `Elem` in [Data.List](https://github.com/idris-lang/Idris-dev/blob/master/libs/base/Data/List.idr)),\nwith a structure similar to `Elem` below.\n\nThe constructor `H` is a proof the signature `f` is at the front of the list\nof signatures to be composed together, `fs`. The constructor `T` is a proof the\nsignature is after the front of the list.\n\n> data Elem : (f : Type -> Type) -> (fs : List (Type -> Type)) -> Type where\n>     H : Elem f (f :: fs)\n>     T : Elem f ys -> Elem f (y :: ys)\n\nUsing this, an `inj` function can be created to construct a sequence of `Here`\nand `There`:\n\n> inj' : Elem f fs -> f a -> Sig fs a\n> inj' H     x = Here x\n> inj' (T t) x = There (inj' t x)\n\nHowever, this does not currently provide any advantage over manually using\n`Here` and `There`, since `inj'` requires manually specifying `H` and `T`.\nHowever, Idris' automatic proof search can be leveraged to have it automatically\nfind the correct combination of `H` and `T`:\n\n> inj : {auto prf : Elem f fs} -> f a -> Sig fs a\n> inj {prf=H}   x = Here x\n> inj {prf=T t} x = There (inj {prf=t} x)\n\nFor convenience, `inj` can be adapted to work with `Fix`:\n\n> inject : {auto prf : Elem f fs} -> f (Fix (Sig fs)) -> Fix (Sig fs)\n> inject = In . inj\n\nPutting this together, smart constructors can be created for the example DSL.\nInstead of a type constraint, `Val :<: f`, such as in the original paper,\n`Elem Val fs` is used to prove that `Val` exists in `fs`:\n\n> val : {auto prf : Elem Val fs} -> Int -> Fix (Sig fs)\n> val x = inject (V x)\n\n> add : {auto prf : Elem Add fs} -> Fix (Sig fs) -> Fix (Sig fs) -> Fix (Sig fs)\n> add x y = inject (A x y)\n\nPutting this all together, DSLs containing values and addition can be succinctly\nrepresented:\n\n> ex2 : Fix (Sig [Val, Add])\n> ex2 = add (val 1) (add (val 2) (val 3))\n\n## Semantics\n\nIn the original paper, typeclasses provide a method to specify the semantics\nof different pieces of syntax separately, by providing an algebra `f a -> a`\nto fold over a fix tree `Fix f`.\n\nIn order to fold over a `Fix` tree using `cata`, a `f` needs to be a functor:\n\n```idris\ncata : Functor f => (f a -> a) -> Fix f -> a\ncata alg = alg . map (cata alg) . inop\n```\n\nIn this implementation `f` is `Sig fs`, therefore, `Sig fs` needs to be a\nfunctor. This *could* be done by modifying the definition of `Here` to be\n`Here : Functor f => f a -> Sig (f :: fs) a`. However, in the implementation\nso-far no functions have required `f` to be a functor and so this solution feels\nsub-optimal.\n\nInstead, the functor instance for `Sig fs` will be defined inductively such that\n`Sig fs` will be a functor when each `f` in `fs` has its own definition of functor.\n\nFirstly, where there are no signatures it is not possible to map over anything:\n\n> Functor (Sig []) where\n>     map _ (Here _) impossible\n>     map _ (There _) impossible\n\nFor the base case, `Here`, `map func x` calls `map : (a -> b) -> f a -> f b`.\nWhereas, in the recursive case, `There`, `map func t` calls\n`map : (a -> b) -> Sig fs a -> Sig fs b`.\n\n> (Functor f, Functor (Sig fs)) => Functor (Sig (f :: fs)) where\n>     map func (Here x) = Here (map func x)\n>     map func (There t) = There (map func t)\n\nContinuing the example, by defining functor instances for both values and\naddition, `Sig [Val, Add]` is also a functor.\n\n> Functor Val where\n>     map f (V x) = V x\n\n> Functor Add where\n>     map f (A x y) = A (f x) (f y)\n\nIn order to define the algebra `f a -> a` for a signature `f`, an interface is\nused to allow the algebra for different pieces of syntax to be defined separately.\n\n> interface Alg (f : Type -> Type) (a : Type) where\n>     alg : f a -> a\n\nUsing the same technique used to define the `Functor` instance for `Sig`, the\n`Alg` instance will be defined for `Sig fs`, provided each `f` in `fs` has its\nown `Alg` instance. Again, when there is no syntax it is not possible to\nuse the algebras of any signatures:\n\n> Alg (Sig []) a where\n>     alg (Here _) impossible\n>     alg (There _) impossible\n\nIn the base case, `alg x` uses `alg : f a -> a`. The recursive case uses\n`alg : Sig fs -> a`.\n\n> (Alg f a, Alg (Sig fs) a) => Alg (Sig (f :: fs)) a where\n>     alg (Here x) = alg x\n>     alg (There x) = alg x\n\nTo continue the expression example, `Alg` instances can be created that\ntranslate into a result integer:\n\n> Alg Val Int where\n>     alg (V x) = x\n\n> Alg Add Int where\n>     alg (A x y) = x + y\n\nGiven signatures which have an algebra to which converts their syntax to\nintegers, a `calc` function can be created which calculates the value of an\nexpression:\n\n> calc : (Functor (Sig fs), Alg (Sig fs) Int) => Fix (Sig fs) -> Int\n> calc = cata alg\n\n## Summary\n\nThis demonstrates how Data Types a la Carte can be implemented in such as\nway as to solve one of the original problems. This shows how the inability to\ncreate overlapping instances is solved by using the `Elem` type, and how\nautomatic proof search can be used to automatically inject into a type.\n\n## Related Work: Effect Handlers\n\nA problem inherent with Data Types a la Carte is it inability to allow\ndifferent semantic domains to be easily composed. To extend the DSL presented\nwith exceptions, for example, would require reimplementing the interface\ninstances `Alg Val Int` and `Alg Add Int` to be `Alg Val (Either Err Int)` and\n`Alg Add (Either Err Int)`. One solution to this is [Effect Handlers](http://okmij.org/ftp/Haskell/extensible/extensible-a-la-carte.html)\nwhich handle only specific parts of the syntax composed, instead of *all* the\nsyntax at once. Fortunately, this has [already been implemented in Idris](http://docs.idris-lang.org/en/latest/effects/introduction.html).\n", "meta": {"hexsha": "4e36e47d867df1630c7ff3133c26d3d897eaf3a2", "size": 8120, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "src/Discussion.lidr", "max_stars_repo_name": "BakerSmithA/alacarte-idris", "max_stars_repo_head_hexsha": "885a1a9ca3bdc1ff3ef64339cbbd740fdcec15ca", "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/Discussion.lidr", "max_issues_repo_name": "BakerSmithA/alacarte-idris", "max_issues_repo_head_hexsha": "885a1a9ca3bdc1ff3ef64339cbbd740fdcec15ca", "max_issues_repo_licenses": ["MIT"], "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/Discussion.lidr", "max_forks_repo_name": "BakerSmithA/alacarte-idris", "max_forks_repo_head_hexsha": "885a1a9ca3bdc1ff3ef64339cbbd740fdcec15ca", "max_forks_repo_licenses": ["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.198019802, "max_line_length": 149, "alphanum_fraction": 0.6931034483, "num_tokens": 2276, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7826624840223699, "lm_q2_score": 0.6757646075489392, "lm_q1q2_score": 0.5288956063586547}}
{"text": "import Data.Either\nimport Data.List\nimport Data.Maybe\nimport Data.Nat\nimport Data.String\n\nimport System.File\n\ndata Bracket = P | S | B | L\nEq Bracket where\n  P == P = True\n  S == S = True\n  B == B = True\n  L == L = True\n  _ == _ = False\ndata Chunk = Open Bracket | Close Bracket\n\nfindMissing : List Bracket -> List Chunk -> List Bracket\nfindMissing s [] = s\nfindMissing s ((Open x) :: xs) = findMissing (x :: s)  xs\nfindMissing [] ((Close x) :: xs) = []\nfindMissing (y :: ys) ((Close x) :: xs) = if x == y\n                                       then findMissing ys xs\n                                       else []\n\nparseChunk : Char -> Maybe Chunk\nparseChunk '(' = Just $ Open P\nparseChunk ')' = Just $ Close P\nparseChunk '[' = Just $ Open S\nparseChunk ']' = Just $ Close S\nparseChunk '{' = Just $ Open B\nparseChunk '}' = Just $ Close B\nparseChunk '<' = Just $ Open L\nparseChunk '>' = Just $ Close L\nparseChunk _ = Nothing\nparseChunks : List Char -> List (Maybe Chunk)\nparseChunks l = parseChunk <$> l\n\nscore : Bracket -> Nat\nscore P = 1\nscore S = 2\nscore B = 3\nscore L = 4\n\nrun : String -> IO ()\nrun s = do let l = filter (\\l => length l > 0) $ findMissing [] . catMaybes . parseChunks . unpack <$> lines s\n           let s = sort $ (\\bs => foldl (\\a => \\n => 5 * a + n ) 0 $ score <$> bs) <$> l\n           let h = (div (length s) 2) + 1\n           putStrLn $ show $ head' $ reverse $ take h s\n\nmain : IO ()\nmain = do Right s <- readFile \"input.txt\"\n            | Left err => putStrLn $ show err\n          run s\n\n", "meta": {"hexsha": "832bd42ef3ba8eb90bacc9c0a1592b2ba8222ef7", "size": 1515, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "10/main+.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "10/main+.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "10/main+.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.0535714286, "max_line_length": 110, "alphanum_fraction": 0.5603960396, "num_tokens": 441, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031738057795403, "lm_q2_score": 0.6584174938590246, "lm_q1q2_score": 0.5288236843345799}}
{"text": "\nmodule Minesweeper.Game\n\nimport Minesweeper.Board\nimport Control.Monad.State\n\npublic export\ndata Difficulty = Easy | Medium | Hard\n\npublic export\ndata GState = Playing String | Won | Lost\n\n-- | Get board dimensions and number of mines\n--   for the given difficulty level\nexport\ngetSetupDetails : Difficulty -> (Pos, Nat) \ngetSetupDetails Easy = ((MkPos 8 8), 10)\ngetSetupDetails Medium = ((MkPos 16 16), 40)\ngetSetupDetails Hard = ((MkPos 30 16), 99)\n\n-- | Attempt to reveal the given position\n-- returns the GameState after this move\nexport\nrevealPos : Pos -> State (Board m n) GState\nrevealPos pos@(MkPos x y) = do\n  board <- get\n  case (reveal pos board) of\n    (Left err) => pure $ Playing err\n    (Right newBoard) => do\n      put newBoard\n      if checkWin newBoard then pure Won\n      else if checkLose newBoard then pure Lost\n      else pure $ Playing $ \"Revealed square in row:\" ++ show y ++ \" col:\" ++  show x ++ \"\\n\"\n", "meta": {"hexsha": "d880f3fb91008ee86fb858f54c4b8a5faec27752", "size": 928, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Minesweeper/Game.idr", "max_stars_repo_name": "RossMeikleham/Idris-Minesweeper", "max_stars_repo_head_hexsha": "59fad3cbccff2b8b3f65f1a848d454efe78742b7", "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/Minesweeper/Game.idr", "max_issues_repo_name": "RossMeikleham/Idris-Minesweeper", "max_issues_repo_head_hexsha": "59fad3cbccff2b8b3f65f1a848d454efe78742b7", "max_issues_repo_licenses": ["MIT"], "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/Minesweeper/Game.idr", "max_forks_repo_name": "RossMeikleham/Idris-Minesweeper", "max_forks_repo_head_hexsha": "59fad3cbccff2b8b3f65f1a848d454efe78742b7", "max_forks_repo_licenses": ["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.2941176471, "max_line_length": 93, "alphanum_fraction": 0.6918103448, "num_tokens": 263, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8031737963569014, "lm_q2_score": 0.6584174938590246, "lm_q1q2_score": 0.5288236781305496}}
{"text": "module Algebra.ZeroOneOmega\n\nimport Algebra.Semiring\nimport Algebra.Preorder\n\n%default total\n\nexport\ndata ZeroOneOmega = Rig0 | Rig1 | RigW\n\nexport\nPreorder ZeroOneOmega where\n  Rig0 <=    _ = True\n  Rig1 <= Rig1 = True\n  _    <= RigW = True\n  _    <=    _ = False\n  preorderRefl {x = Rig0} = Refl\n  preorderRefl {x = Rig1} = Refl\n  preorderRefl {x = RigW} = Refl\n  preorderTrans {x = Rig0} _ _ = Refl\n  preorderTrans {x = Rig1} {y = Rig0} _ _ impossible\n  preorderTrans {x = Rig1} {y = Rig1} _ yz = yz\n  preorderTrans {x = Rig1} {y = RigW} {z = Rig0} _ _ impossible\n  preorderTrans {x = Rig1} {y = RigW} {z = Rig1} _ _ = Refl\n  preorderTrans {x = Rig1} {y = RigW} {z = RigW} _ _ = Refl\n  preorderTrans {x = RigW} {y = Rig0} _ _ impossible\n  preorderTrans {x = RigW} {y = Rig1} _ _ impossible\n  preorderTrans {x = RigW} {y = RigW} _ yz = yz\n\npublic export\nEq ZeroOneOmega where\n  (==) Rig0 Rig0 = True\n  (==) Rig1 Rig1 = True\n  (==) RigW RigW = True\n  (==) _ _ = False\n\nexport\nShow ZeroOneOmega where\n  show Rig0 = \"Rig0\"\n  show Rig1 = \"Rig1\"\n  show RigW = \"RigW\"\n\nexport\nrigPlus : ZeroOneOmega -> ZeroOneOmega -> ZeroOneOmega\nrigPlus Rig0 a = a\nrigPlus a Rig0 = a\nrigPlus _ _ = RigW\n\nexport\nrigMult : ZeroOneOmega -> ZeroOneOmega -> ZeroOneOmega\nrigMult Rig0 _ = Rig0\nrigMult _ Rig0 = Rig0\nrigMult Rig1 a = a\nrigMult a Rig1 = a\nrigMult _ _ = RigW\n\n\npublic export\nSemiring ZeroOneOmega where\n  (|+|) = rigPlus\n  (|*|) = rigMult\n  plusNeutral = Rig0\n  timesNeutral = Rig1\n\n||| The top value of a lattice\nexport\nTop ZeroOneOmega where\n  top = RigW\n  topAbs {x = Rig0} = Refl\n  topAbs {x = Rig1} = Refl\n  topAbs {x = RigW} = Refl\n\n----------------------------------------\n\nrigPlusAssociative : (x, y, z : ZeroOneOmega) ->\n  rigPlus x (rigPlus y z) = rigPlus (rigPlus x y) z\nrigPlusAssociative Rig0 _ _ = Refl\nrigPlusAssociative Rig1 Rig0 _ = Refl\nrigPlusAssociative Rig1 Rig1 Rig0 = Refl\nrigPlusAssociative Rig1 Rig1 Rig1 = Refl\nrigPlusAssociative Rig1 Rig1 RigW = Refl\nrigPlusAssociative Rig1 RigW Rig0 = Refl\nrigPlusAssociative Rig1 RigW Rig1 = Refl\nrigPlusAssociative Rig1 RigW RigW = Refl\nrigPlusAssociative RigW Rig0 _ = Refl\nrigPlusAssociative RigW Rig1 Rig0 = Refl\nrigPlusAssociative RigW Rig1 Rig1 = Refl\nrigPlusAssociative RigW Rig1 RigW = Refl\nrigPlusAssociative RigW RigW Rig0 = Refl\nrigPlusAssociative RigW RigW Rig1 = Refl\nrigPlusAssociative RigW RigW RigW = Refl\n\nrigPlusCommutative : (x, y : ZeroOneOmega) ->\n  rigPlus x y = rigPlus y x\nrigPlusCommutative Rig0 Rig0 = Refl\nrigPlusCommutative Rig0 Rig1 = Refl\nrigPlusCommutative Rig0 RigW = Refl\nrigPlusCommutative Rig1 Rig0 = Refl\nrigPlusCommutative Rig1 Rig1 = Refl\nrigPlusCommutative Rig1 RigW = Refl\nrigPlusCommutative RigW Rig0 = Refl\nrigPlusCommutative RigW Rig1 = Refl\nrigPlusCommutative RigW RigW = Refl\n\nrigMultAssociative : (x, y, z : ZeroOneOmega) ->\n  rigMult x (rigMult y z) = rigMult (rigMult x y) z\nrigMultAssociative Rig0 _ _ = Refl\nrigMultAssociative Rig1 Rig0 _ = Refl\nrigMultAssociative Rig1 Rig1 Rig0 = Refl\nrigMultAssociative Rig1 Rig1 Rig1 = Refl\nrigMultAssociative Rig1 Rig1 RigW = Refl\nrigMultAssociative Rig1 RigW Rig0 = Refl\nrigMultAssociative Rig1 RigW Rig1 = Refl\nrigMultAssociative Rig1 RigW RigW = Refl\nrigMultAssociative RigW Rig0 _ = Refl\nrigMultAssociative RigW Rig1 Rig0 = Refl\nrigMultAssociative RigW Rig1 Rig1 = Refl\nrigMultAssociative RigW Rig1 RigW = Refl\nrigMultAssociative RigW RigW Rig0 = Refl\nrigMultAssociative RigW RigW Rig1 = Refl\nrigMultAssociative RigW RigW RigW = Refl\n\nrigMultCommutative : (x, y : ZeroOneOmega) ->\n  rigMult x y = rigMult y x\nrigMultCommutative Rig0 Rig0 = Refl\nrigMultCommutative Rig0 Rig1 = Refl\nrigMultCommutative Rig0 RigW = Refl\nrigMultCommutative Rig1 Rig0 = Refl\nrigMultCommutative Rig1 Rig1 = Refl\nrigMultCommutative Rig1 RigW = Refl\nrigMultCommutative RigW Rig0 = Refl\nrigMultCommutative RigW Rig1 = Refl\nrigMultCommutative RigW RigW = Refl\n", "meta": {"hexsha": "da0f1c6478c08a08bc0293dc7f5fb465ac5fd066", "size": 3877, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Algebra/ZeroOneOmega.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "src/Algebra/ZeroOneOmega.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "src/Algebra/ZeroOneOmega.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 28.9328358209, "max_line_length": 63, "alphanum_fraction": 0.7307196286, "num_tokens": 1392, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8539127380808499, "lm_q2_score": 0.6187804407739559, "lm_q1q2_score": 0.5283845004521638}}
{"text": "module IdrisWeb.Common.Date\nimport Builtins\n%access public\n\n{- Simple date and time records.\n   Like, really simple. They'll do for now.\n\n   Allows date serialisation and deserialisation as per\n   RFC822, which is used when setting cookies.\n\n   TODO: Timezones, timestamp, comparison\n\n-}\n\ndata Day = Monday\n         | Tuesday\n         | Wednesday\n         | Thursday\n         | Friday\n         | Saturday\n         | Sunday\n\n\ndata Month = January\n           | February\n           | March\n           | April\n           | May\n           | June\n           | July\n           | August\n           | September\n           | October\n           | November\n           | December\n\n-- Not using the show typeclass for cookies, since there are so many\n-- different ways of showing dates.\nshowCookieDay : Day -> String\nshowCookieDay Monday = \"Mon\"\nshowCookieDay Tuesday = \"Tue\"\nshowCookieDay Wednesday = \"Wed\"\nshowCookieDay Thursday = \"Thu\"\nshowCookieDay Friday = \"Fri\"\nshowCookieDay Saturday = \"Sat\"\nshowCookieDay Sunday = \"Sun\"\n\n\n--private\n{-\ndivides : Integer -> Integer -> Bool\ndivides x y = (x `mod` y) == 0\n\nisLeapYear : (year : Integer) -> Bool\nisLeapYear y = if divides y 400 then True\n                   else if divides y 100 then False\n                   else if divides y 4 then True\n                   else False\n\n\n--  where y : Nat\n  --      y = cast year\n  -}\n\nisLeapYear : (year : Integer) -> Bool\nisLeapYear year = if (y `mod` 400) == O then True\n                   else if (y `mod` 100) == O then False\n                   else if (y `mod` 4) == O then True\n                   else False\n  where y : Nat\n        y = cast year\n\ndaysInMonth : Month -> (year : Integer) -> Int\ndaysInMonth September _ = 30\ndaysInMonth April _ = 30\ndaysInMonth June _ = 30\ndaysInMonth November _ = 30\ndaysInMonth February y = if isLeapYear y then 29\n                                         else 28\ndaysInMonth _ _ = 31\n\ndayOfWeek : (year : Integer) -> (month : Integer) -> (day : Integer) -> Int\ndayOfWeek year month day = d + (2.6 * m) \n  where y = if (month == 1 || month == 2) then year - 1 else year\n        m = (month - 2) `mod` 12\n        d = daysInMonth month\n\npublic\nrecord Date : Type where \n  MkDate : (day : Integer) ->\n           (month : Integer) ->\n           (year : Integer) -> Date\n\npublic\nrecord DateTime : Type where\n  MkDateTime : (day : Integer) ->\n               (month : Integer) ->\n               (year : Integer) ->\n               (hour : Integer) -> \n               (minute : Integer) ->\n               (second : Integer) ->\n               DateTime\n\n\n-- Why everyone can't just use the ISO one, I'll never know...\n-- Wed, 13 Jan 2021 22:23:01 GMT\n--abstract\n--showCookieTime : DateTime -> String\n--showCookieTime dt \n", "meta": {"hexsha": "2b613f2740a422cacb6c94ff68ce71d41fae99f9", "size": 2723, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/IdrisWeb/Common/Date.idr", "max_stars_repo_name": "idris-hackers/IdrisWeb", "max_stars_repo_head_hexsha": "735d0fc15cd0e95d51ce93bcbbaa1757dca2e8c1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 80, "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:44:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-07T02:16:48.000Z", "max_issues_repo_path": "src/IdrisWeb/Common/Date.idr", "max_issues_repo_name": "idris-hackers/IdrisWeb", "max_issues_repo_head_hexsha": "735d0fc15cd0e95d51ce93bcbbaa1757dca2e8c1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2015-12-05T19:43:15.000Z", "max_issues_repo_issues_event_max_datetime": "2016-05-18T02:02:14.000Z", "max_forks_repo_path": "src/IdrisWeb/Common/Date.idr", "max_forks_repo_name": "idris-hackers/IdrisWeb", "max_forks_repo_head_hexsha": "735d0fc15cd0e95d51ce93bcbbaa1757dca2e8c1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2016-05-21T12:02:25.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-13T00:33:52.000Z", "avg_line_length": 24.7545454545, "max_line_length": 75, "alphanum_fraction": 0.5644509732, "num_tokens": 718, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7520125848754471, "lm_q2_score": 0.7025300698514777, "lm_q1q2_score": 0.5283114537817382}}
{"text": "{- Ctrl-Alt-A: Add definition\n   Ctrl-Alt-C: Case split\n   Ctrl-Alt-D: Documentation\n   Ctrl-Alt-L: Lift hole: Lifts a hole to the top level as a new function definition\n   Ctrl-Alt-M: Match: Replaces a hole with a case expression that matches on an intermediate result\n   Ctrl-Alt-R: Reloads and typechecks the current buffer\n   Ctrl-Alt-S: Search\n   Ctrl-Alt-T: Type-check: Displays the type under cursor -}\nmodule Main\n\nimport Data.Vect\n\ndata DataStore : Type where\n  MkData : (size : Nat) -> (items : Vect size String) -> DataStore\n\nsize : DataStore -> Nat\nsize (MkData s i) = s\n\nitems : (store : DataStore) -> Vect (size store) String\nitems (MkData s i) = i\n\naddToStore : DataStore -> String -> DataStore\naddToStore (MkData s i) n = MkData _ (addToData i)\n  where\n    addToData : Vect old String -> Vect (S old) String\n    addToData [] = [n]\n    addToData (i :: is) = i :: addToData is\n\ndata Command = Add String\n             | Get Integer\n             | Size\n             | Search String\n             | Quit\n\nparseCommand : (cmd : String) -> (args : String) -> Maybe Command\nparseCommand \"add\" str    = Just (Add str)\nparseCommand \"get\" val    = case all isDigit (unpack val) of\n                              False => Nothing\n                              True  => Just (Get (cast val))\nparseCommand \"quit\" \"\"    = Just Quit\nparseCommand \"size\" \"\"    = Just Size\nparseCommand \"search\" str = Just $ Search str\nparseCommand _      _     = Nothing\n\nparse : (input : String) -> Maybe Command\nparse input = case span (/= ' ') input of\n  (cmd, args) => parseCommand cmd args\n\ngetEntry : (pos : Integer) -> (store : DataStore) -> Maybe (String, DataStore)\ngetEntry pos store =\n  let store_items = items store\n  in case integerToFin pos (size store) of\n    Nothing => Just (\"Out of range\\n\", store)\n    Just ix => Just (index ix store_items ++ \"\\n\", store)\n\ngetSize : (store : DataStore) -> Maybe (String, DataStore)\ngetSize store = Just (\"Size of store: \" ++ cast (size store), store)\n\nsearch : (store : DataStore) -> (str : String) -> Maybe (String, DataStore)\nsearch store str =\n  let store_items  = items store in\n  let found = foldrImpl\n                (\\(ix, msg), acc => if (str `isInfixOf` msg)\n                  then (cast $ finToInteger ix) ++ \": \" ++ msg ++ \"\\n\" ++ acc\n                  else acc)\n                \"\"\n                (\\acc => acc)\n                (zip range store_items)\n  in Just (found, store)\n\nprocessInput : DataStore -> String -> Maybe (String, DataStore)\nprocessInput store inp = case parse inp of\n  Nothing           => Just (\"Invalid command\\n\", store)\n  Just (Add item)   => Just (\"ID \" ++ show (size store) ++ \"\\n\", addToStore store item)\n  Just (Get pos)    => getEntry pos store\n  Just Size         => getSize store\n  Just (Search str) => search store str\n  Just Quit         => Nothing\n\nmain : IO ()\nmain = replWith (MkData _ []) \"Command: \" processInput\n", "meta": {"hexsha": "9127c918f6bcbf8adf58861af74efe30e77c16f8", "size": 2893, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/tdd/chapter04/02_DataStore.idr", "max_stars_repo_name": "pdani/idris-grin", "max_stars_repo_head_hexsha": "c224b65551b2b2b91f564f858ba08df1d6af00b3", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/tdd/chapter04/02_DataStore.idr", "max_issues_repo_name": "pdani/idris-grin", "max_issues_repo_head_hexsha": "c224b65551b2b2b91f564f858ba08df1d6af00b3", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/tdd/chapter04/02_DataStore.idr", "max_forks_repo_name": "pdani/idris-grin", "max_forks_repo_head_hexsha": "c224b65551b2b2b91f564f858ba08df1d6af00b3", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 35.2804878049, "max_line_length": 99, "alphanum_fraction": 0.6094020048, "num_tokens": 778, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7662936430859597, "lm_q2_score": 0.689305616785446, "lm_q1q2_score": 0.5282105122861339}}
{"text": "module Data.List\n\nimport Data.Nat\nimport Data.List1\nimport Data.Fin\nimport public Data.Zippable\n\n%default total\n\npublic export\nisNil : List a -> Bool\nisNil [] = True\nisNil _  = False\n\npublic export\nisCons : List a -> Bool\nisCons [] = False\nisCons _  = True\n\npublic export\nsnoc : List a -> a -> List a\nsnoc xs x = xs ++ [x]\n\npublic export\ntake : Nat -> List a -> List a\ntake (S k) (x :: xs) = x :: take k xs\ntake _ _ = []\n\npublic export\ndrop : (n : Nat) -> (xs : List a) -> List a\ndrop Z     xs      = xs\ndrop (S n) []      = []\ndrop (S n) (_::xs) = drop n xs\n\n||| Satisfiable if `k` is a valid index into `xs`.\n|||\n||| @ k  the potential index\n||| @ xs the list into which k may be an index\npublic export\ndata InBounds : (k : Nat) -> (xs : List a) -> Type where\n    ||| Z is a valid index into any cons cell\n    InFirst : InBounds Z (x :: xs)\n    ||| Valid indices can be extended\n    InLater : InBounds k xs -> InBounds (S k) (x :: xs)\n\npublic export\nUninhabited (InBounds k []) where\n  uninhabited InFirst impossible\n  uninhabited (InLater _) impossible\n\nexport\nUninhabited (InBounds k xs) => Uninhabited (InBounds (S k) (x::xs)) where\n  uninhabited (InLater y) = uninhabited y\n\n||| Decide whether `k` is a valid index into `xs`.\npublic export\ninBounds : (k : Nat) -> (xs : List a) -> Dec (InBounds k xs)\ninBounds _ [] = No uninhabited\ninBounds Z (_ :: _) = Yes InFirst\ninBounds (S k) (x :: xs) with (inBounds k xs)\n  inBounds (S k) (x :: xs) | (Yes prf) = Yes (InLater prf)\n  inBounds (S k) (x :: xs) | (No contra)\n      = No $ \\(InLater y) => contra y\n\n||| Find a particular element of a list.\n|||\n||| @ ok a proof that the index is within bounds\npublic export\nindex : (n : Nat) -> (xs : List a) -> {auto 0 ok : InBounds n xs} -> a\nindex Z (x :: xs) {ok = InFirst} = x\nindex (S k) (_ :: xs) {ok = InLater _} = index k xs\n\npublic export\nindex' : (xs : List a) -> Fin (length xs) -> a\nindex' (x::_)  FZ     = x\nindex' (_::xs) (FS i) = index' xs i\n\n||| Generate a list by repeatedly applying a partial function until exhausted.\n||| @ f the function to iterate\n||| @ x the initial value that will be the head of the list\ncovering\npublic export\niterate : (f : a -> Maybe a) -> (x : a) -> List a\niterate f x  = x :: case f x of\n  Nothing => []\n  Just y => iterate f y\n\ncovering\npublic export\nunfoldr : (b -> Maybe (a, b)) -> b -> List a\nunfoldr f c = case f c of\n  Nothing     => []\n  Just (a, n) => a :: unfoldr f n\n\npublic export\niterateN : Nat -> (a -> a) -> a -> List a\niterateN Z     _ _ = []\niterateN (S n) f x = x :: iterateN n f (f x)\n\npublic export\ntakeWhile : (p : a -> Bool) -> List a -> List a\ntakeWhile p []      = []\ntakeWhile p (x::xs) = if p x then x :: takeWhile p xs else []\n\npublic export\ndropWhile : (p : a -> Bool) -> List a -> List a\ndropWhile p []      = []\ndropWhile p (x::xs) = if p x then dropWhile p xs else x::xs\n\n||| Applied to a predicate and a list, returns the list of those elements that\n||| satisfy the predicate.\npublic export\nfilter : (p : a -> Bool) -> List a -> List a\nfilter p [] = []\nfilter p (x :: xs)\n   = if p x\n        then x :: filter p xs\n        else filter p xs\n\n||| Find the first element of the list that satisfies the predicate.\npublic export\nfind : (p : a -> Bool) -> (xs : List a) -> Maybe a\nfind p [] = Nothing\nfind p (x::xs) = if p x then Just x else find p xs\n\n||| Find the index and proof of InBounds of the first element (if exists) of a\n||| list that satisfies the given test, else `Nothing`.\npublic export\nfindIndex : (a -> Bool) -> (xs : List a) -> Maybe $ Fin (length xs)\nfindIndex _ [] = Nothing\nfindIndex p (x :: xs) = if p x\n  then Just FZ\n  else FS <$> findIndex p xs\n\n||| Find indices of all elements that satisfy the given test.\npublic export\nfindIndices : (a -> Bool) -> List a -> List Nat\nfindIndices p = h 0 where\n  h : Nat -> List a -> List Nat\n  h _         []  = []\n  h lvl (x :: xs) = if p x\n    then lvl :: h (S lvl) xs\n    else        h (S lvl) xs\n\n||| Find associated information in a list using a custom comparison.\npublic export\nlookupBy : (a -> a -> Bool) -> a -> List (a, b) -> Maybe b\nlookupBy p e []      = Nothing\nlookupBy p e ((l, r) :: xs) =\n  if p e l then\n    Just r\n  else\n    lookupBy p e xs\n\n||| Find associated information in a list using Boolean equality.\npublic export\nlookup : Eq a => a -> List (a, b) -> Maybe b\nlookup = lookupBy (==)\n\n||| Check if something is a member of a list using a custom comparison.\npublic export\nelemBy : (a -> a -> Bool) -> a -> List a -> Bool\nelemBy p e []      = False\nelemBy p e (x::xs) = p e x || elemBy p e xs\n\npublic export\nnubBy : (a -> a -> Bool) -> List a -> List a\nnubBy = nubBy' []\n  where\n    nubBy' : List a -> (a -> a -> Bool) -> List a -> List a\n    nubBy' acc p []      = []\n    nubBy' acc p (x::xs) =\n      if elemBy p x acc then\n        nubBy' acc p xs\n      else\n        x :: nubBy' (x::acc) p xs\n\n||| O(n^2). The nub function removes duplicate elements from a list. In\n||| particular, it keeps only the first occurrence of each element. It is a\n||| special case of nubBy, which allows the programmer to supply their own\n||| equality test.\n|||\n||| ```idris example\n||| nub (the (List _) [1,2,1,3])\n||| ```\npublic export\nnub : Eq a => List a -> List a\nnub = nubBy (==)\n\n||| The deleteBy function behaves like delete, but takes a user-supplied equality predicate.\npublic export\ndeleteBy : (a -> a -> Bool) -> a -> List a -> List a\ndeleteBy _  _ []      = []\ndeleteBy eq x (y::ys) = if x `eq` y then ys else y :: deleteBy eq x ys\n\n||| `delete x` removes the first occurrence of `x` from its list argument. For\n||| example,\n|||\n|||````idris example\n|||delete 'a' ['b', 'a', 'n', 'a', 'n', 'a']\n|||````\n|||\n||| It is a special case of deleteBy, which allows the programmer to supply\n||| their own equality test.\npublic export\ndelete : Eq a => a -> List a -> List a\ndelete = deleteBy (==)\n\n||| Delete the first occurrence of each element from the second list in the first\n||| list where equality is determined by the predicate passed as the first argument.\n||| @ p            A function that returns true when its two arguments should be considered equal.\n||| @ source       The list to delete elements from.\n||| @ undesirables The list of elements to delete.\npublic export\ndeleteFirstsBy : (p : a -> a -> Bool) -> (source : List a) -> (undesirables : List a) -> List a\ndeleteFirstsBy p = foldl (flip (deleteBy p))\n\ninfix 7 \\\\\n\n||| The non-associative list-difference.\n||| A specialized form of @deleteFirstsBy@ where the predicate is equality under the @Eq@\n||| interface.\n||| Deletes the first occurrence of each element of the second list from the first list.\n|||\n||| In the following example, the result is `[2, 4]`.\n||| ```idris example\n||| [1, 2, 3, 4] // [1, 3]\n||| ```\n|||\npublic export\n(\\\\) : (Eq a) => List a -> List a -> List a\n(\\\\) = foldl (flip delete)\n\n||| The unionBy function returns the union of two lists by user-supplied equality predicate.\npublic export\nunionBy : (a -> a -> Bool) -> List a -> List a -> List a\nunionBy eq xs ys = xs ++ foldl (flip (deleteBy eq)) (nubBy eq ys) xs\n\n||| Compute the union of two lists according to their `Eq` implementation.\n|||\n||| ```idris example\n||| union ['d', 'o', 'g'] ['c', 'o', 'w']\n||| ```\n|||\npublic export\nunion : Eq a => List a -> List a -> List a\nunion = unionBy (==)\n\n||| Like @span@ but using a predicate that might convert a to b, i.e. given a\n||| predicate from a to Maybe b and a list of as, returns a tuple consisting of\n||| the longest prefix of the list where a -> Just b, and the rest of the list.\npublic export\nspanBy : (a -> Maybe b) -> List a -> (List b, List a)\nspanBy p [] = ([], [])\nspanBy p (x :: xs) = case p x of\n  Nothing => ([], x :: xs)\n  Just y => let (ys, zs) = spanBy p xs in (y :: ys, zs)\n\n||| Given a predicate and a list, returns a tuple consisting of the longest\n||| prefix of the list whose elements satisfy the predicate, and the rest of the\n||| list.\npublic export\nspan : (a -> Bool) -> List a -> (List a, List a)\nspan p []      = ([], [])\nspan p (x::xs) =\n  if p x then\n    let (ys, zs) = span p xs in\n        (x::ys, zs)\n  else\n    ([], x::xs)\n\npublic export\nbreak : (a -> Bool) -> List a -> (List a, List a)\nbreak p xs = span (not . p) xs\n\npublic export\nsplit : (a -> Bool) -> List a -> List1 (List a)\nsplit p xs =\n  case break p xs of\n    (chunk, [])          => singleton chunk\n    (chunk, (c :: rest)) => chunk ::: forget (split p (assert_smaller xs rest))\n\npublic export\nsplitAt : (n : Nat) -> (xs : List a) -> (List a, List a)\nsplitAt Z xs = ([], xs)\nsplitAt (S k) [] = ([], [])\nsplitAt (S k) (x :: xs)\n      = let (tk, dr) = splitAt k xs in\n            (x :: tk, dr)\n\npublic export\npartition : (a -> Bool) -> List a -> (List a, List a)\npartition p []      = ([], [])\npartition p (x::xs) =\n  let (lefts, rights) = partition p xs in\n    if p x then\n      (x::lefts, rights)\n    else\n      (lefts, x::rights)\n\n||| The inits function returns all initial segments of the argument, shortest\n||| first. For example,\n|||\n||| ```idris example\n||| inits [1,2,3]\n||| ```\npublic export\ninits : List a -> List (List a)\ninits xs = [] :: case xs of\n  []        => []\n  x :: xs'  => map (x ::) (inits xs')\n\n||| The tails function returns all final segments of the argument, longest\n||| first. For example,\n|||\n||| ```idris example\n||| tails [1,2,3] == [[1,2,3], [2,3], [3], []]\n|||```\npublic export\ntails : List a -> List (List a)\ntails xs = xs :: case xs of\n  []        => []\n  _ :: xs'  => tails xs'\n\n||| Split on the given element.\n|||\n||| ```idris example\n||| splitOn 0 [1,0,2,0,0,3]\n||| ```\n|||\npublic export\nsplitOn : Eq a => a -> List a -> List1 (List a)\nsplitOn a = split (== a)\n\npublic export\nreplaceWhen : (a -> Bool) -> a -> List a -> List a\nreplaceWhen p b l = map (\\c => if p c then b else c) l\n\n||| Replaces all occurences of the first argument with the second argument in a list.\n|||\n||| ```idris example\n||| replaceOn '-' ',' ['1', '-', '2', '-', '3']\n||| ```\n|||\npublic export\nreplaceOn : Eq a => a -> a -> List a -> List a\nreplaceOn a = replaceWhen (== a)\n\n||| Construct a list with `n` copies of `x`.\n||| @ n how many copies\n||| @ x the element to replicate\npublic export\nreplicate : (n : Nat) -> (x : a) -> List a\nreplicate Z     _ = []\nreplicate (S n) x = x :: replicate n x\n\n||| Compute the intersect of two lists by user-supplied equality predicate.\nexport\nintersectBy : (a -> a -> Bool) -> List a -> List a -> List a\nintersectBy eq xs ys = [x | x <- xs, any (eq x) ys]\n\n||| Compute the intersect of two lists according to the `Eq` implementation for the elements.\nexport\nintersect : Eq a => List a -> List a -> List a\nintersect = intersectBy (==)\n\nexport\nintersectAllBy : (a -> a -> Bool) -> List (List a) -> List a\nintersectAllBy eq [] = []\nintersectAllBy eq (xs :: xss) = filter (\\x => all (elemBy eq x) xss) xs\n\nexport\nintersectAll : Eq a => List (List a) -> List a\nintersectAll = intersectAllBy (==)\n\n---------------------------\n-- Zippable --\n---------------------------\n\npublic export\nZippable List where\n  zipWith _ [] _ = []\n  zipWith _ _ [] = []\n  zipWith f (x :: xs) (y :: ys) = f x y :: zipWith f xs ys\n\n  zipWith3 _ [] _ _ = []\n  zipWith3 _ _ [] _ = []\n  zipWith3 _ _ _ [] = []\n  zipWith3 f (x :: xs) (y :: ys) (z :: zs) = f x y z :: zipWith3 f xs ys zs\n\n  unzipWith f [] = ([], [])\n  unzipWith f (x :: xs) = let (b, c) = f x\n                              (bs, cs) = unzipWith f xs in\n                              (b :: bs, c :: cs)\n\n  unzipWith3 f [] = ([], [], [])\n  unzipWith3 f (x :: xs) = let (b, c, d) = f x\n                               (bs, cs, ds) = unzipWith3 f xs in\n                               (b :: bs, c :: cs, d :: ds)\n\n---------------------------\n-- Non-empty List\n---------------------------\n\npublic export\ndata NonEmpty : (xs : List a) -> Type where\n    IsNonEmpty : NonEmpty (x :: xs)\n\nexport\nUninhabited (NonEmpty []) where\n  uninhabited IsNonEmpty impossible\n\n||| Get the head of a non-empty list.\n||| @ ok proof the list is non-empty\npublic export\nhead : (l : List a) -> {auto 0 ok : NonEmpty l} -> a\nhead [] impossible\nhead (x :: _) = x\n\n||| Get the tail of a non-empty list.\n||| @ ok proof the list is non-empty\npublic export\ntail : (l : List a) -> {auto 0 ok : NonEmpty l} -> List a\ntail [] impossible\ntail (_ :: xs) = xs\n\n||| Retrieve the last element of a non-empty list.\n||| @ ok proof that the list is non-empty\npublic export\nlast : (l : List a) -> {auto 0 ok : NonEmpty l} -> a\nlast [] impossible\nlast [x] = x\nlast (x :: xs@(_::_)) = last xs\n\n||| Return all but the last element of a non-empty list.\n||| @ ok proof the list is non-empty\npublic export\ninit : (l : List a) -> {auto 0 ok : NonEmpty l} -> List a\ninit [] impossible\ninit [x] = []\ninit (x :: xs@(_::_)) = x :: init xs\n\n||| Attempt to get the head of a list. If the list is empty, return `Nothing`.\npublic export\nhead' : List a -> Maybe a\nhead' []      = Nothing\nhead' (x::_) = Just x\n\n||| Attempt to get the tail of a list. If the list is empty, return `Nothing`.\nexport\ntail' : List a -> Maybe (List a)\ntail' []      = Nothing\ntail' (_::xs) = Just xs\n\n||| Attempt to retrieve the last element of a non-empty list.\n|||\n||| If the list is empty, return `Nothing`.\nexport\nlast' : List a -> Maybe a\nlast' [] = Nothing\nlast' xs@(_::_) = Just (last xs)\n\n||| Attempt to return all but the last element of a non-empty list.\n|||\n||| If the list is empty, return `Nothing`.\nexport\ninit' : List a -> Maybe (List a)\ninit' [] = Nothing\ninit' xs@(_::_) = Just (init xs)\n\npublic export\nfoldr1By : (func : a -> b -> b) -> (map : a -> b) ->\n           (l : List a) -> {auto 0 ok : NonEmpty l} -> b\nfoldr1By f map [] impossible\nfoldr1By f map [x] = map x\nfoldr1By f map (x :: xs@(_::_)) = f x (foldr1By f map xs)\n\npublic export\nfoldl1By : (func : b -> a -> b) -> (map : a -> b) ->\n           (l : List a) -> {auto 0 ok : NonEmpty l} -> b\nfoldl1By f map [] impossible\nfoldl1By f map (x::xs) = foldl f (map x) xs\n\n||| Foldr a non-empty list without seeding the accumulator.\n||| @ ok proof that the list is non-empty\npublic export\nfoldr1 : (a -> a -> a) -> (l : List a) -> {auto 0 ok : NonEmpty l} -> a\nfoldr1 f xs = foldr1By f id xs\n\n||| Foldl a non-empty list without seeding the accumulator.\n||| @ ok proof that the list is non-empty\npublic export\nfoldl1 : (a -> a -> a) -> (l : List a) -> {auto 0 ok : NonEmpty l} -> a\nfoldl1 f xs = foldl1By f id xs\n\n||| Convert to a non-empty list.\n||| @ ok proof the list is non-empty\nexport\ntoList1 : (l : List a) -> {auto 0 ok : NonEmpty l} -> List1 a\ntoList1 [] impossible\ntoList1 (x :: xs) = x ::: xs\n\n||| Convert to a non-empty list, returning Nothing if the list is empty.\nexport\ntoList1' : (l : List a) -> Maybe (List1 a)\ntoList1' [] = Nothing\ntoList1' (x :: xs) = Just (x ::: xs)\n\n||| Prefix every element in the list with the given element\n|||\n||| ```idris example\n||| with List (mergeReplicate '>' ['a', 'b', 'c', 'd', 'e'])\n||| ```\n|||\nexport\nmergeReplicate : a -> List a -> List a\nmergeReplicate sep []      = []\nmergeReplicate sep (y::ys) = sep :: y :: mergeReplicate sep ys\n\n||| Insert some separator between the elements of a list.\n|||\n||| ````idris example\n||| with List (intersperse ',' ['a', 'b', 'c', 'd', 'e'])\n||| ````\n|||\nexport\nintersperse : a -> List a -> List a\nintersperse sep []      = []\nintersperse sep (x::xs) = x :: mergeReplicate sep xs\n\n||| Given a separator list and some more lists, produce a new list by\n||| placing the separator between each of the lists.\n|||\n||| @ sep the separator\n||| @ xss the lists between which the separator will be placed\n|||\n||| ```idris example\n||| intercalate [0, 0, 0] [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]\n||| ```\nexport\nintercalate : (sep : List a) -> (xss : List (List a)) -> List a\nintercalate sep xss = concat $ intersperse sep xss\n\n||| Apply a partial function to the elements of a list, keeping the ones at which\n||| it is defined.\npublic export\nmapMaybe : (a -> Maybe b) -> List a -> List b\nmapMaybe f []      = []\nmapMaybe f (x::xs) =\n  case f x of\n    Nothing => mapMaybe f xs\n    Just j  => j :: mapMaybe f xs\n\n||| Extract all of the values contained in a List of Maybes\npublic export\ncatMaybes : List (Maybe a) -> List a\ncatMaybes = mapMaybe id\n\n--------------------------------------------------------------------------------\n-- Sorting\n--------------------------------------------------------------------------------\n\n||| Check whether a list is sorted with respect to the default ordering for the type of its elements.\nexport\nsorted : Ord a => List a -> Bool\nsorted (x :: xs @ (y :: _)) = x <= y && sorted xs\nsorted _ = True\n\n||| Merge two sorted lists using an arbitrary comparison\n||| predicate. Note that the lists must have been sorted using this\n||| predicate already.\nexport\nmergeBy : (a -> a -> Ordering) -> List a -> List a -> List a\nmergeBy order []      right   = right\nmergeBy order left    []      = left\nmergeBy order (x::xs) (y::ys) =\n  -- The code below will emit `y` before `x` whenever `x == y`.\n  -- If you change this, `sortBy` will stop being stable, unless you fix `sortBy`, too.\n  case order x y of\n       LT => x :: mergeBy order xs (y::ys)\n       _  => y :: mergeBy order (x::xs) ys\n\n||| Merge two sorted lists using the default ordering for the type of their elements.\nexport\nmerge : Ord a => List a -> List a -> List a\nmerge left right = mergeBy compare left right\n\n||| Sort a list using some arbitrary comparison predicate.\n|||\n||| @ cmp how to compare elements\n||| @ xs the list to sort\nexport\nsortBy : (cmp : a -> a -> Ordering) -> (xs : List a) -> List a\nsortBy cmp []  = []\nsortBy cmp [x] = [x]\nsortBy cmp xs  = let (x, y) = split xs in\n    mergeBy cmp\n          (sortBy cmp (assert_smaller xs x))\n          (sortBy cmp (assert_smaller xs y)) -- not structurally smaller, hence assert\n  where\n    splitRec : List b -> List a -> (List a -> List a) -> (List a, List a)\n    splitRec (_::_::xs) (y::ys) zs = splitRec xs ys (zs . ((::) y))\n    splitRec _          ys      zs = (ys, zs [])\n    -- In the above base-case clause, we put `ys` on the LHS to get a stable sort.\n    -- This is because `mergeBy` prefers taking elements from its RHS operand\n    -- if both heads are equal, and all elements in `zs []` precede all elements of `ys`\n    -- in the original list.\n\n    split : List a -> (List a, List a)\n    split xs = splitRec xs xs id\n\n||| Sort a list using the default ordering for the type of its elements.\nexport\nsort : Ord a => List a -> List a\nsort = sortBy compare\n\nexport\nisPrefixOfBy : (eq : a -> a -> Bool) -> (left, right : List a) -> Bool\nisPrefixOfBy p [] _            = True\nisPrefixOfBy p _ []            = False\nisPrefixOfBy p (x::xs) (y::ys) = p x y && isPrefixOfBy p xs ys\n\n||| The isPrefixOf function takes two lists and returns True iff the first list is a prefix of the second.\nexport\nisPrefixOf : Eq a => List a -> List a -> Bool\nisPrefixOf = isPrefixOfBy (==)\n\nexport\nisSuffixOfBy : (a -> a -> Bool) -> List a -> List a -> Bool\nisSuffixOfBy p left right = isPrefixOfBy p (reverse left) (reverse right)\n\n||| The isSuffixOf function takes two lists and returns True iff the first list is a suffix of the second.\nexport\nisSuffixOf : Eq a => List a -> List a -> Bool\nisSuffixOf = isSuffixOfBy (==)\n\n||| The isInfixOf function takes two lists and returns True iff the first list\n||| is contained, wholly and intact, anywhere within the second.\n|||\n||| ```idris example\n||| isInfixOf ['b','c'] ['a', 'b', 'c', 'd']\n||| ```\n||| ```idris example\n||| isInfixOf ['b','d'] ['a', 'b', 'c', 'd']\n||| ```\n|||\nexport\nisInfixOf : Eq a => List a -> List a -> Bool\nisInfixOf n h = any (isPrefixOf n) (tails h)\n\n||| Transposes rows and columns of a list of lists.\n|||\n||| ```idris example\n||| with List transpose [[1, 2], [3, 4]]\n||| ```\n|||\n||| This also works for non square scenarios, thus\n||| involution does not always hold:\n|||\n|||     transpose [[], [1, 2]] = [[1], [2]]\n|||     transpose (transpose [[], [1, 2]]) = [[1, 2]]\nexport\ntranspose : List (List a) -> List (List a)\ntranspose [] = []\ntranspose (heads :: tails) = spreadHeads heads (transpose tails) where\n  spreadHeads : List a -> List (List a) -> List (List a)\n  spreadHeads []              tails           = tails\n  spreadHeads (head :: heads) []              = [head] :: spreadHeads heads []\n  spreadHeads (head :: heads) (tail :: tails) = (head :: tail) :: spreadHeads heads tails\n\n------------------------------------------------------------------------\n-- Grouping\n\n||| `groupBy` operates like `group`, but uses the provided equality\n||| predicate instead of `==`.\npublic export\ngroupBy : (a -> a -> Bool) -> List a -> List (List1 a)\ngroupBy _ [] = []\ngroupBy eq (h :: t) = let (ys,zs) = go h t\n                       in ys :: zs\n\n  where go : a -> List a -> (List1 a, List (List1 a))\n        go v [] = (singleton v,[])\n        go v (x :: xs) = let (ys,zs) = go x xs\n                          in if eq v x\n                                then (cons v ys, zs)\n                                else (singleton v, ys :: zs)\n\n||| The `group` function takes a list of values and returns a list of\n||| lists such that flattening the resulting list is equal to the\n||| argument.  Moreover, each list in the resulting list\n||| contains only equal elements.\npublic export\ngroup : Eq a => List a -> List (List1 a)\ngroup = groupBy (==)\n\n||| `groupWith` operates like `group`, but uses the provided projection when\n||| comparing for equality\npublic export\ngroupWith : Eq b => (a -> b) -> List a -> List (List1 a)\ngroupWith f = groupBy (\\x,y => f x == f y)\n\n||| `groupAllWith` operates like `groupWith`, but sorts the list\n||| first so that each equivalence class has, at most, one list in the\n||| output\npublic export\ngroupAllWith : Ord b => (a -> b) -> List a -> List (List1 a)\ngroupAllWith f = groupWith f . sortBy (comparing f)\n\n--------------------------------------------------------------------------------\n-- Properties\n--------------------------------------------------------------------------------\n\nexport\nUninhabited ([] = x :: xs) where\n  uninhabited Refl impossible\n\nexport\nUninhabited (x :: xs = []) where\n  uninhabited Refl impossible\n\nexport\n{0 xs : List a} -> Either (Uninhabited $ x === y) (Uninhabited $ xs === ys) => Uninhabited (x::xs = y::ys) where\n  uninhabited @{Left  z} Refl = uninhabited @{z} Refl\n  uninhabited @{Right z} Refl = uninhabited @{z} Refl\n\n||| (::) is injective\nexport\nconsInjective : forall x, xs, y, ys .\n                the (List a) (x :: xs) = the (List b) (y :: ys) -> (x = y, xs = ys)\nconsInjective Refl = (Refl, Refl)\n\nreverseReverseOnto : (l, r : List a) -> reverse (reverseOnto l r) = reverseOnto r l\nreverseReverseOnto _ [] = Refl\nreverseReverseOnto l (x :: xs) = reverseReverseOnto (x :: l) xs\n\n||| List reverse applied twice yields the identity function.\nexport\nreverseInvolutive : (xs : List a) -> reverse (reverse xs) = xs\nreverseInvolutive = reverseReverseOnto []\n\nconsReverse : (x : a) -> (l, r : List a) -> x :: reverseOnto r l = reverseOnto r (reverseOnto [x] (reverse l))\nconsReverse _ [] _ = Refl\nconsReverse x (y::ys) r\n  = rewrite consReverse x ys (y :: r) in\n      rewrite cong (reverseOnto r . reverse) $ consReverse x ys [y] in\n        rewrite reverseInvolutive (y :: reverseOnto [x] (reverse ys)) in\n          Refl\n\nconsTailRecAppend : (x : a) -> (l, r : List a) -> tailRecAppend (x :: l) r = x :: (tailRecAppend l r)\nconsTailRecAppend x l r\n  = rewrite consReverse x (reverse l) r in\n      rewrite reverseInvolutive l in\n        Refl\n\n||| Proof that `(++)` and `tailRecAppend` do the same thing, so the %transform\n||| directive is safe.\ntailRecAppendIsAppend : (xs, ys : List a) -> tailRecAppend xs ys = xs ++ ys\ntailRecAppendIsAppend [] ys = Refl\ntailRecAppendIsAppend (x::xs) ys =\n  trans (consTailRecAppend x xs ys) (cong (x ::) $ tailRecAppendIsAppend xs ys)\n\n||| The empty list is a right identity for append.\nexport\nappendNilRightNeutral : (l : List a) -> l ++ [] = l\nappendNilRightNeutral []      = Refl\nappendNilRightNeutral (_::xs) = rewrite appendNilRightNeutral xs in Refl\n\n||| Appending lists is associative.\nexport\nappendAssociative : (l, c, r : List a) -> l ++ (c ++ r) = (l ++ c) ++ r\nappendAssociative []      c r = Refl\nappendAssociative (_::xs) c r = rewrite appendAssociative xs c r in Refl\n\nrevOnto : (xs, vs : List a) -> reverseOnto xs vs = reverse vs ++ xs\nrevOnto _ [] = Refl\nrevOnto xs (v :: vs)\n    = rewrite revOnto (v :: xs) vs in\n        rewrite appendAssociative (reverse vs) [v] xs in\n                                  rewrite revOnto [v] vs in Refl\n\nexport\nrevAppend : (vs, ns : List a) -> reverse ns ++ reverse vs = reverse (vs ++ ns)\nrevAppend [] ns = rewrite appendNilRightNeutral (reverse ns) in Refl\nrevAppend (v :: vs) ns\n    = rewrite revOnto [v] vs in\n        rewrite revOnto [v] (vs ++ ns) in\n          rewrite sym (revAppend vs ns) in\n            rewrite appendAssociative (reverse ns) (reverse vs) [v] in\n              Refl\n\nexport\ndropFusion : (n, m : Nat) -> (l : List t) -> drop n (drop m l) = drop (n+m) l\ndropFusion  Z     m    l      = Refl\ndropFusion (S n)  Z    l      = rewrite plusZeroRightNeutral n in Refl\ndropFusion (S n) (S m) []     = Refl\ndropFusion (S n) (S m) (x::l) = rewrite plusAssociative n 1 m in\n                                rewrite plusCommutative n 1 in\n                                dropFusion (S n) m l\n\nexport\nlengthMap : (xs : List a) -> length (map f xs) = length xs\nlengthMap [] = Refl\nlengthMap (x :: xs) = cong S (lengthMap xs)\n", "meta": {"hexsha": "2aab47410f116631929a6d559542692a93a6f89f", "size": 25325, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/base/Data/List.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/base/Data/List.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/base/Data/List.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": 31.4596273292, "max_line_length": 112, "alphanum_fraction": 0.5902862784, "num_tokens": 7808, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6893056040203135, "lm_q2_score": 0.7662936430859597, "lm_q1q2_score": 0.528210502504294}}
{"text": "||| Until Idris2 starts supporting the 'syntax' keyword, here's a\n||| poor-man's equational reasoning\nmodule Syntax.PreorderReasoning\n\ninfixl 0  ~~\nprefix 1  |~\ninfix  1  ...\n\n|||Slightly nicer syntax for justifying equations:\n|||```\n||| |~ a\n||| ~~ b ...( justification )\n|||```\n|||and we can think of the `...( justification )` as ASCII art for a thought bubble.\npublic export\n(...) : (x : a) -> (y ~=~ x) -> (z : a ** y ~=~ z)\n(...) x pf = (x ** pf)\n\npublic export\ndata FastDerivation : (x : a) -> (y : b) -> Type where\n  (|~) : (x : a) -> FastDerivation x x\n  (~~) : FastDerivation x y -> (step : (z : c ** y ~=~ z)) -> FastDerivation x (fst step)\n  \npublic export \nCalc : {x : a} -> {y : b} -> FastDerivation x y -> x ~=~ y\nCalc (|~ x) = Refl\nCalc ((~~) {z=_} {y=_} der (_ ** Refl)) = Calc der\n\n{- -- requires import Data.Nat\n0\nexample : (x : Nat) -> (x + 1) + 0 = 1 + x\nexample x = \n  Calc $ \n   |~ (x + 1) + 0\n   ~~ x+1  ...( plusZeroRightNeutral $ x + 1 )\n   ~~ 1+x  ...( plusCommutative x 1          )\n-}\n", "meta": {"hexsha": "269e358e694b7b039fdc3fe43b74be7c7b7ba4a6", "size": 1014, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/contrib/Syntax/PreorderReasoning.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/contrib/Syntax/PreorderReasoning.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/contrib/Syntax/PreorderReasoning.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.6842105263, "max_line_length": 89, "alphanum_fraction": 0.5305719921, "num_tokens": 370, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8244619263765706, "lm_q2_score": 0.640635868562172, "lm_q1q2_score": 0.5281798823006958}}
{"text": "||| Projection based on Plain Merge.\n|||\n||| The POPL '08 Paper /Multi-Party Asynchronous Session Types/.\n||| When projecting a =Choice= in which the projected role is not involved,\n||| projection occurs when all choices are equal.\nmodule Sessions.Projection.Plain\n\nimport Decidable.Equality\nimport Data.List\nimport Data.List.Elem\n\nimport Data.List1\n\nimport Sessions.Meta\n\nimport Sessions.Global\nimport Sessions.Global.Involved\n\nimport Sessions.Local\nimport Sessions.Local.Same\nimport Sessions.Local.Same.All\n\nimport public Sessions.Projection.Error\nimport public Sessions.Projection\n\n%default total\n\npublic export\ndata Merge : (this  : List1 (typeL, typeM, Local typeR typeL typeM rs g))\n          -> (that  :                      Local typeR typeL typeM rs g)\n                   -> Type\n  where\n    PMerge : (same : All ((cl,cm,c):::cs))\n                  -> Merge ((cl,cm,c):::cs) c\n\npublic export\nmerge : DecEq typeR typeL typeM\n     => (this : List1 (typeL, typeM, Local typeR typeL typeM rs g))\n             -> Maybe (that ** Merge this that)\nmerge ((l,(m,c)) ::: tail) with (allSame ((l,(m,c)) ::: tail))\n  merge ((l,(m,c)) ::: tail) | (Yes prf)\n    = Just (c ** PMerge prf)\n  merge ((l,(m,c)) ::: tail) | (No contra)\n    = Nothing\n\npublic export\nproject : DecEq typeR typeL typeM\n       => {rs    : List Ty}\n       -> {g     :      Ty}\n       -> (role  : typeR)\n       -> (termG : Global typeR typeL typeM rs g)\n                -> Maybe (termL ** Project Merge role termG termL)\nproject = Projection.Term.project merge\n\n-- [ EOF ]\n", "meta": {"hexsha": "914ca77dd067d650b1af1dae76872750ecedeea9", "size": 1539, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Sessions/Projection/Plain.idr", "max_stars_repo_name": "DSbD-AppControl/sessions-playground", "max_stars_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-08-19T13:13:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-19T13:13:10.000Z", "max_issues_repo_path": "Sessions/Projection/Plain.idr", "max_issues_repo_name": "DSbD-AppControl/sessions-playground", "max_issues_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Sessions/Projection/Plain.idr", "max_forks_repo_name": "DSbD-AppControl/sessions-playground", "max_forks_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.4821428571, "max_line_length": 75, "alphanum_fraction": 0.6250812216, "num_tokens": 416, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.815232489352, "lm_q2_score": 0.6477982315512488, "lm_q1q2_score": 0.5281061649053479}}
{"text": "module NN.Dense\n\nimport Backprop\nimport Control.Optics\nimport Linear.Backprop\nimport Linear.V\nimport Utils.String\n\npublic export\nrecord Dense (i : Nat) (o : Nat) (a : Type) where\n  constructor MkDense\n  weights : T [i, o] a\n  biases : T [o] a\n\nexport\nlweights : Simple Lens (Dense i o a) (T [i, o] a)\nlweights = lens weights (\\s, b => { weights := b } s)\n\nexport\nlbiases : Simple Lens (Dense i o a) (T [o] a)\nlbiases = lens biases (\\s, b => { biases := b } s)\n\nexport\n{i : _} -> {o : _} -> FromDouble a => FromDouble (Dense i o a) where\n  fromDouble x = MkDense (fromDouble x) (fromDouble x)\n\nexport\n{i : _} -> {o : _} -> CanBack a => CanBack (Dense i o a) where\n  zero = MkDense zero zero\n  one = MkDense one one\n  add x1 x2 = MkDense (add x1.weights x2.weights) (add x1.biases x2.biases)\n\nexport\n{i : _} -> {o : _} -> Num a => Num (Dense i o a) where\n  x1 + x2 = MkDense (x1.weights + x2.weights) (x1.biases + x2.biases)\n  x1 * x2 = MkDense (x1.weights * x2.weights) (x1.biases * x2.biases)\n  fromInteger x = MkDense (fromInteger x) (fromInteger x)\n\nexport\n{i : _} -> {o : _} -> Neg a => Neg (Dense i o a) where\n  x1 - x2 = MkDense (x1.weights - x2.weights) (x1.biases - x2.biases)\n  negate x = MkDense (negate x.weights) (negate x.biases)\n\nexport\nShow a => Show (Dense i o a) where\n  show x = show_record \"MkDense\" [(\"weights\", show x.weights), (\"biases\", show x.biases)]\n\nexport\napply : {i, o, n, a : _} -> CanBack a => Num a => Node s (Dense i o a) -> Node s (T [n, i] a) -> Node s (T [n, o] a)\napply layer x = x <> (layer ^. lweights) + konst (layer ^. lbiases)\n", "meta": {"hexsha": "1228d89da942b245bb79133e4082dda5389705e6", "size": 1568, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/NN/Dense.idr", "max_stars_repo_name": "tensorknower69/idris2-ml", "max_stars_repo_head_hexsha": "2ab861b50554e2b11a8ba32f1efec9d1f84e5d7c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-01-30T20:10:19.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-30T20:10:19.000Z", "max_issues_repo_path": "src/NN/Dense.idr", "max_issues_repo_name": "tensorknower69/idris2-ml", "max_issues_repo_head_hexsha": "2ab861b50554e2b11a8ba32f1efec9d1f84e5d7c", "max_issues_repo_licenses": ["MIT"], "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/NN/Dense.idr", "max_forks_repo_name": "tensorknower69/idris2-ml", "max_forks_repo_head_hexsha": "2ab861b50554e2b11a8ba32f1efec9d1f84e5d7c", "max_forks_repo_licenses": ["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.7450980392, "max_line_length": 116, "alphanum_fraction": 0.625, "num_tokens": 578, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.828938825225204, "lm_q2_score": 0.6370308082623217, "lm_q1q2_score": 0.5280595698332311}}
{"text": "{-\n  1. Input: Vect n elem\n     Output: Vect n elem\n     Operations: Cloning the Vect, replacing the elements of the Vect with random elements.\n\n     Input: Vect n elem\n     Output: Vect (n * 2) elem\n     Operations: Append a Vect with itself, inserting `n` random elements into the Vect.\n\n     Input: Vect (1 + n) elem\n     Output: Vect n elem\n     Operations: Popping an element from any position in the Vect.\n\n     Input: Bounded n, Vect n elem\n     Output: elem\n     Operations: Retrieving the element at index `Bounded n` in the Vect.\n\n-}", "meta": {"hexsha": "ba0e93653861a50740cb54cb404b7281f2120751", "size": 543, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter1/Ex1.idr", "max_stars_repo_name": "timmyjose-study/tdd-with-idris", "max_stars_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "max_stars_repo_licenses": ["Unlicense"], "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/Ex1.idr", "max_issues_repo_name": "timmyjose-study/tdd-with-idris", "max_issues_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": "chapter1/Ex1.idr", "max_forks_repo_name": "timmyjose-study/tdd-with-idris", "max_forks_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": 30.1666666667, "max_line_length": 91, "alphanum_fraction": 0.6685082873, "num_tokens": 143, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6791786991753931, "lm_q2_score": 0.7772998663336157, "lm_q1q2_score": 0.5279255120856721}}
{"text": "module Data.AVL.Core.API\n\nimport public Data.Tree\nimport public Data.AVL.Core\n\n%default total\n%access export\n\nnamespace AVL\n  ||| Find a value in the tree.\n  lookup : (Ord k) => k -> AVLTree h k v -> Maybe v\n  lookup key (Element t _) = lookup' key t\n    where\n      lookup' : (Ord k) => k -> Tree k v -> Maybe v\n      lookup' key Empty = Nothing\n      lookup' key (Node key' value' l r) with (compare key key')\n        lookup' key (Node key' value' l r) | LT = lookup' key l\n        lookup' key (Node key' value' l r) | EQ = Just value'\n        lookup' key (Node key' value' l r) | GT = lookup' key r\n\n  ||| Update an element in the tree.\n  update : (Ord k) => k\n                   -> (v -> v)\n                   -> AVLTree h k v\n                   -> AVLTree h k v\n  update key f t@(Element Empty inv) = t\n  update key f (Element (Node key' value' l r) inv) with (compare key key')\n      update key f (Element (Node key' value' l r) (AVLNode invl invr b)) | LT with (assert_total $ update key f (Element l invl)) -- Totality checker again\n        update key f (Element (Node key' value' l r) (AVLNode invl invr b)) | LT | (Element l' invl')\n                                                             = Element (Node key' value' l' r) (AVLNode invl' invr b)\n      update key f (Element (Node key' value' l r) (AVLNode invl invr b)) | EQ\n                                                             = Element (Node key' (f value') l r) (AVLNode invl invr b)\n      update key f (Element (Node key' value' l r) (AVLNode invl invr b)) | GT with (assert_total $ update key f (Element r invr))\n        update key f (Element (Node key' value' l r) (AVLNode invl invr b)) | GT | (Element r' invr')\n                                                             = Element (Node key' value' l r') (AVLNode invl invr' b)\n\n  ||| Perform a right fold over the tree.\n  foldr : (step : k -> v -> p -> p)\n       -> (init : p)\n       -> AVLTree n k v\n       -> p\n  foldr step init (Element t _) = foldr' step init t\n    where\n      foldr' : (k -> v -> p -> p) -> p -> Tree k v -> p\n      foldr' step' init' Empty = init'\n      foldr' step' init' (Node key val l r) = foldr' step' (step' key val (foldr' step' init' r)) l\n\n  ||| Construct a AVL Tree from an association list.\n  fromList : (Ord k) => List (k, v)\n                     -> (n : Nat ** AVLTree n k v)\n  fromList [] = (0 ** Element Empty AVLEmpty)\n  fromList ((k, v) :: xs) with (doInsert k v (snd (fromList xs)))\n    fromList ((k, v) :: xs) | (Same x) = (_ ** x)\n    fromList ((k, v) :: xs) | (Grew x) = (_ ** x)\n\n  ||| Flatten the tree to an association list.\n  toList : AVLTree n k v -> List (k, v)\n  toList = foldr (\\k,v,xs => (k, v) :: xs) []\n\n  ||| Is the tree empty?\n  isEmpty : AVLTree h k v -> Bool\n  isEmpty (Element t _) = isEmpty' t\n    where\n      isEmpty' : Tree k v -> Bool\n      isEmpty' Empty          = True\n      isEmpty' (Node _ _ _ _) = False\n\n  ||| Calculate the size of the tree.\n  size : AVLTree h k v -> Nat\n  size = foldr (\\_,_=> S) 0\n\n  ||| Return a list of keys in the tree.\n  keys : AVLTree h k v -> List k\n  keys = map fst . toList\n\n  ||| Return a list of the values in the key.\n  values : AVLTree h k v -> List v\n  values = map snd . toList\n\n  ||| Check if the provided check holds for all elements in the tree.\n  all : (pred : k -> v -> Bool) ->  AVLTree h k v -> Bool\n  all pred = foldr (\\k,v,pred' => pred' && pred k v) True\n\n  ||| Check if the provided check holds for at least one element in the tree.\n  any : (pred : k -> v -> Bool) ->  AVLTree h k v -> Bool\n  any pred = foldr (\\k,v,pred' => pred' || pred k v) False\n\n  ||| Does the given key exist in the tree?\n  hasKey : (o : Ord k) => k -> AVLTree h k v -> Bool\n  hasKey key = any (\\key',value' => key == key')\n\n  ||| Does the given value exist in the tree?\n  hasValue : (Eq v) => v -> AVLTree h k v -> Bool\n  hasValue value = any (\\key',value' => value == value')\n\n  ||| Find the first key that satisfies the provided predicate.\n  findKey : (pred : v -> Bool) -> AVLTree h k v -> Maybe k\n  findKey pred = foldr (\\k,v,p => if pred v then Just k else p) Nothing\n\n  ||| Find the key that is associated with provided value.\n  findKeyOf : (Eq v) => v -> AVLTree h k v -> Maybe k\n  findKeyOf value = findKey (== value)\n\n  -- --------------------------------------------------------- [ Implementations ]\n\nprivate\neqTree : (Eq k, Eq v) => Tree k v -> Tree k v -> Bool\neqTree Empty              Empty              = True\neqTree (Node xk xv xl xr) (Node yk yv yl yr) =\n      xk == yk  &&\n      xv == yv  &&\n      eqTree xl yl &&\n      eqTree xr yr\neqTree _ _                                   = False\n\n(Eq k, Eq v) => Eq (Tree k v) where\n  (==) = eqTree\n\n(Eq k, Eq v) => Eq (AVLTree h k v) where\n  (==) (Element t _) (Element t' _) = t == t'\n\n(Show k, Show v) => Show (Tree k v) where\n  show Empty          = \"\"\n  show (Node k v l r) = unwords\n      [\n        \"{\"\n      , show l\n      , \"(\", show k, \":\", show v, \"),\"\n      , show r\n      , \"}\"\n      ]\n\n(Show k, Show v) => Show (AVLTree h k v) where\n  show (Element t _) = show t\n", "meta": {"hexsha": "843242a0830f59e3a8691605bfce457040b44579", "size": 5057, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/AVL/Core/API.idr", "max_stars_repo_name": "witt3rd/idris-containers", "max_stars_repo_head_hexsha": "6f4e06a0e85ee6336e493cee800fff42215da2ac", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 99, "max_stars_repo_stars_event_min_datetime": "2015-03-01T20:22:37.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-01T02:17:39.000Z", "max_issues_repo_path": "Data/AVL/Core/API.idr", "max_issues_repo_name": "witt3rd/idris-containers", "max_issues_repo_head_hexsha": "6f4e06a0e85ee6336e493cee800fff42215da2ac", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 30, "max_issues_repo_issues_event_min_datetime": "2015-03-23T19:17:35.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-01T13:05:44.000Z", "max_forks_repo_path": "Data/AVL/Core/API.idr", "max_forks_repo_name": "witt3rd/idris-containers", "max_forks_repo_head_hexsha": "6f4e06a0e85ee6336e493cee800fff42215da2ac", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 26, "max_forks_repo_forks_event_min_datetime": "2015-06-02T17:20:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-13T14:51:07.000Z", "avg_line_length": 37.4592592593, "max_line_length": 156, "alphanum_fraction": 0.5297607277, "num_tokens": 1568, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998611746912, "lm_q2_score": 0.679178699175393, "lm_q1q2_score": 0.5279255085818403}}
{"text": "word_lengths : List String -> List Nat\nword_lengths [] = []\nword_lengths (word :: words) = length word :: word_lengths words\n", "meta": {"hexsha": "7de088816a614861c534d0a180134abc53b64a8c", "size": 125, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "wordlen.idr", "max_stars_repo_name": "janschultecom/idris-examples", "max_stars_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-05-05T15:26:06.000Z", "max_stars_repo_stars_event_max_datetime": "2016-05-05T15:26:06.000Z", "max_issues_repo_path": "wordlen.idr", "max_issues_repo_name": "janschultecom/idris-examples", "max_issues_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "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": "wordlen.idr", "max_forks_repo_name": "janschultecom/idris-examples", "max_forks_repo_head_hexsha": "c0bf0105d69f07492c6b99f14e9ca3c4cd7443c8", "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.25, "max_line_length": 64, "alphanum_fraction": 0.712, "num_tokens": 29, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7772998508568416, "lm_q2_score": 0.6791787056691698, "lm_q1q2_score": 0.5279255066217884}}
{"text": "module Flexidisc.OrdList.Row\n\nimport Flexidisc.OrdList.Label\nimport Flexidisc.OrdList.Type\n\n%default total\n%access public export\n\n||| Proof that a key value pair is part of an `OrdList`. If you don't need the value, use `Label`.\ndata OrdRow : (l : k) -> (ty : v) -> OrdList k o v -> Type where\n  ||| The label is in the first element of the list\n  Here  :                             OrdRow l ty ((l, ty) :: xs)\n  ||| The label is in the tail\n  There : (later : OrdRow l ty xs) -> OrdRow l ty (x::xs)\n\n%name OrdRow lbl, loc, prf, e, elem\n\n||| Demote it to a label existence proof\nlabelFromOrdRow : OrdRow l v xs -> OrdLabel l xs\nlabelFromOrdRow Here          = Here\nlabelFromOrdRow (There later) = There (labelFromOrdRow later)\n\nUninhabited (OrdRow k v []) where\n  uninhabited Here      impossible\n  uninhabited (There _) impossible\n\n||| Map a row and its header simultaneously\nmapRow : {xs : OrdList k o a} -> (f : a -> b) -> (loc : OrdRow l ty xs) -> OrdRow l (f ty) (map f xs)\nmapRow f loc {xs = []} = absurd loc\nmapRow f Here {xs = ((k, x) :: xs)} = Here\nmapRow f (There later) {xs = ((k, x) :: xs)} = There (mapRow f later)\n\n||| Given a proof that an element is in a vector, remove it\ndropOrdRow : (xs : OrdList k o v) -> (loc : OrdRow l ty xs) -> OrdList k o v\ndropOrdRow xs = dropLabel xs . labelFromOrdRow\n\n||| Update a value in the list given it's location and an update function\nchangeValue : (xs : OrdList k o v) -> (loc : OrdRow l old xs) -> (new : v) ->\n             OrdList k o v\nchangeValue xs loc new = changeValue xs (labelFromOrdRow loc) new\n\nchangeWithSameTypeIsUnchanged : (row : OrdRow l x xs) -> changeValue xs row x = xs\nchangeWithSameTypeIsUnchanged Here = Refl\nchangeWithSameTypeIsUnchanged (There later) = cong $ changeWithSameTypeIsUnchanged later\n\n\nfindInsertOrdRow : (l : k) -> (xs : OrdList k o v) -> OrdRow l ty (insert (l,ty) xs)\nfindInsertOrdRow l [] = Here\nfindInsertOrdRow l ((kx, vx) :: xs) with (l < kx)\n  | True  = Here\n  | False = There (findInsertOrdRow l xs)\n\ndropInsertInv : (l : k) -> (ty : v) -> (xs : OrdList k o v) ->\n                dropOrdRow (insert (l, ty) xs) (findInsertOrdRow l xs) = xs\ndropInsertInv l ty [] = Refl\ndropInsertInv l ty ((kx,vx) :: xs) with (l < kx)\n  | True  = Refl\n  | False = cong (dropInsertInv l ty xs)\n", "meta": {"hexsha": "16ff71b32f01cab841bf043f3f28b79581154f1c", "size": 2276, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Flexidisc/OrdList/Row.idr", "max_stars_repo_name": "berewt/flexidisc", "max_stars_repo_head_hexsha": "8a0c367244229be5d417c04588d8d41b6030dba2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2020-04-02T09:51:01.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-03T05:15:49.000Z", "max_issues_repo_path": "src/Flexidisc/OrdList/Row.idr", "max_issues_repo_name": "LIST-LUXEMBOURG/flexidisc", "max_issues_repo_head_hexsha": "f5a9cdc81554359e324b64400d8479494cd45a8c", "max_issues_repo_licenses": ["MIT"], "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/Flexidisc/OrdList/Row.idr", "max_forks_repo_name": "LIST-LUXEMBOURG/flexidisc", "max_forks_repo_head_hexsha": "f5a9cdc81554359e324b64400d8479494cd45a8c", "max_forks_repo_licenses": ["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.5762711864, "max_line_length": 101, "alphanum_fraction": 0.6493848858, "num_tokens": 737, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8104789086703225, "lm_q2_score": 0.6513548714339145, "lm_q1q2_score": 0.5279093853568572}}
{"text": "-- --------------------------------------------------------------- [ Nonce.idr ]\n-- Module      : Nonce\n-- Description : Types for Nonces\n-- Copyright   : (c) Jan de Muijnck-Hughes\n-- License     : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Crypto.Nonce\n\nimport Crypto.Common\n\ndata TyNonce = Zero | Random\n\n||| Nonces for guaranteeing freshness.\n||| \n||| @ s The setting.\n||| @ tyN The nonce type.\n||| @ l The length.\ndata Nonce : (s : Setting) -> (tyN : TyNonce) -> (l : Nat) -> Type where\n  ||| The all zero nonce for asymmetric encryption.\n  MkZeroPkNonce : Vect n a -> Nonce Asymm Zero n\n  ||| A randomly generated nonce for asymmetric encryption.\n  MkRndPkNonce  : Vect n a -> Nonce Asymm Random n\n\n  ||| The all zero nonce for symmetric encryption.\n  MkZeroSkNonce : Vect n a -> Nonce Symm Zero n\n  ||| A randomly generated nonce for symmetric encryption.\n  MkRndSkNonce  : Vect n a -> Nonce Symm Random n\n\n\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "d60eb481d738e60e6065336b0707dadb581aa23a", "size": 1052, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Crypto/Nonce.idr", "max_stars_repo_name": "silky/idris-crypto-types", "max_stars_repo_head_hexsha": "aed6375fbe7202a1c9aae45904b036017d90e8bc", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-06-27T11:33:38.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-27T11:33:38.000Z", "max_issues_repo_path": "src/Crypto/Nonce.idr", "max_issues_repo_name": "silky/idris-crypto-types", "max_issues_repo_head_hexsha": "aed6375fbe7202a1c9aae45904b036017d90e8bc", "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/Crypto/Nonce.idr", "max_forks_repo_name": "silky/idris-crypto-types", "max_forks_repo_head_hexsha": "aed6375fbe7202a1c9aae45904b036017d90e8bc", "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.935483871, "max_line_length": 80, "alphanum_fraction": 0.5313688213, "num_tokens": 254, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8333245953120233, "lm_q2_score": 0.63341027751814, "lm_q1q2_score": 0.5278363631792804}}
{"text": "> module Functor.tests.Main\n\n> import Control.Monad.Identity\n\n> import Functor.Operations\n> import Identity.Properties\n\n> %default total\n> %auto_implicits off\n\n> b : Bool\n> b = elem Z (Id Z)\n\n> B : Type\n> B = Elem (S Z) (Id Z)\n\n> b' : Bool\n> b' = decAsBool (decElem (S Z) (Id Z))\n\n> main : IO ()\n> main = do putStrLn (\"b  = \" ++ show b)\n>           putStrLn (\"b' = \" ++ show b')\n\n\n\n\n", "meta": {"hexsha": "bc6f91a21535841d3de70475c6c02bf27ea41612", "size": 383, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "Functor/tests/operations.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Functor/tests/operations.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Functor/tests/operations.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 14.1851851852, "max_line_length": 41, "alphanum_fraction": 0.5744125326, "num_tokens": 123, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7931059414036511, "lm_q2_score": 0.665410558746814, "lm_q1q2_score": 0.5277410676148214}}
{"text": "module Examples.ConferenceLattice\n\nimport public DepSec.Lattice\nimport Decidable.Equality\nimport Pruviloj.Derive.DecEq\nimport Pruviloj.Disjoint\nimport Pruviloj.Injective\n\n%language ElabReflection\n%access public export\n\ndata Id : Type where\n  Top : Id\n  Nat : Nat -> Id\n  Bot : Id\n\nUid : Type\nUid = Id\n\nSid : Type\nSid = Id\n\nnatInjective : (Nat a) = (Nat b) -> a = b\nnatInjective Refl = Refl\n\nDecEq Id where\n  decEq Top Top = Yes Refl\n  decEq Top (Nat k) = No (%runElab disjoint)\n  decEq Top Bot = No (%runElab disjoint)\n  decEq (Nat k) Top = No (%runElab disjoint)\n  decEq (Nat k) (Nat j) with (decEq k j)\n    | (Yes prf) = Yes $ cong prf\n    | (No contra) = No $ \\a => contra $ natInjective a\n  decEq (Nat k) Bot = No (%runElab disjoint)\n  decEq Bot Top = No (%runElab disjoint)\n  decEq Bot (Nat k) = No (%runElab disjoint)\n  decEq Bot Bot = Yes Refl\n\nEq Id where\n  Top == Top         = True\n  Top == (Nat k)     = False\n  Top == Bot         = False\n  (Nat k) == Top     = False\n  (Nat k) == (Nat j) = k == j\n  (Nat k) == Bot     = False\n  Bot == Top         = False\n  Bot == (Nat k)     = False\n  Bot == Bot         = True\n\ndata Compartment : Type where\n  U  : Uid -> Compartment\n  A  : Uid -> Sid -> Compartment\n  PC : Uid -> Sid -> Compartment\n\ntotal\njoinId : (x, y : Id) -> Id\njoinId Top y = Top\njoinId (Nat k) Top = Top\njoinId (Nat k) (Nat j) with (decEq k j)\n  | (Yes _) = Nat k\n  | (No _) = Top\njoinId (Nat k) Bot = (Nat k)\njoinId Bot y = y\n\ntotal\njoinComp : (x , y : Compartment) -> Compartment\njoinComp (U x) (U y) = U (joinId x y)\njoinComp (U x) (A y z) = A (joinId x y) z\njoinComp (U x) (PC y z) = PC y z\njoinComp (A x z) (U y) = A (joinId x y) z\njoinComp (A x z) (A y w) = A (joinId x y) (joinId z w)\njoinComp (A x z) (PC y w) = PC y (joinId z w)\njoinComp (PC x z) (U y) = PC x z\njoinComp (PC x z) (A y w) = PC x (joinId z w)\njoinComp (PC x z) (PC y w) = PC (joinId x y) (joinId z w)\n\nlemma1 : a = b -> joinId (Nat a) (Nat b) = (Nat a)\nlemma1 {a} {b} prf with (decEq a b)\n  | (Yes x) = Refl\n  | (No contra) = void $ contra prf\n\nlemma2 : (a = b -> Void) -> joinId (Nat a) (Nat b) = Top\nlemma2 {a} {b} contra with (decEq a b)\n  | (Yes prf) = void $ contra prf\n  | (No f) = Refl\n\nlemma3 : a = b -> (b = c -> Void) -> a = c -> Void\nlemma3 prf contra prf' = contra $ trans (sym prf) prf'\n\nimplementation JoinSemilattice Id where\n  join = joinId\n  associative Top y z = Refl\n  associative (Nat k) Top z = Refl\n  associative (Nat k) (Nat j) Top with (decEq k j)\n    | (Yes prf) = Refl\n    | (No contra) = Refl\n  associative (Nat k) (Nat j) (Nat i) with (decEq k j, decEq j i)\n    | (Yes prf, Yes prf') =\n        rewrite lemma1 prf in\n        rewrite lemma1 prf' in\n        rewrite lemma1 (trans prf prf') in\n        lemma1 prf\n    | (Yes prf, No contra) =\n        rewrite lemma1 prf in\n        rewrite lemma2 contra in\n        rewrite lemma2 $ lemma3 prf contra in\n        Refl\n    | (No contra, Yes prf) =\n        rewrite lemma2 contra in\n        rewrite lemma1 prf in\n        lemma2 contra\n    | (No contra, No contra') =\n        rewrite lemma2 contra in\n        rewrite lemma2 contra' in\n        Refl\n  associative (Nat k) (Nat j) Bot with (decEq k j)\n    | (Yes _) = Refl\n    | (No _) = Refl\n  associative (Nat k) Bot z = Refl\n  associative Bot y z = Refl\n\n  commutative Top Top = Refl\n  commutative Top (Nat k) = Refl\n  commutative Top Bot = Refl\n  commutative (Nat k) Top = Refl\n  commutative (Nat k) (Nat j) with (decEq k j)\n    | (Yes prf) = rewrite lemma1 $ sym prf in cong prf\n    | (No contra) = sym $ lemma2 $ negEqSym contra\n  commutative (Nat k) Bot = Refl\n  commutative Bot Top = Refl\n  commutative Bot (Nat k) = Refl\n  commutative Bot Bot = Refl\n\n  idempotent Top = Refl\n  idempotent (Nat k) with (decEq k k)\n    | (Yes _) = Refl\n    | (No contra) = void $ contra Refl\n  idempotent Bot = Refl\n\nimplementation BoundedJoinSemilattice Id where\n  Bottom = Bot\n\n  unitary Top = Refl\n  unitary (Nat k) = Refl\n  unitary Bot = Refl\n\nimplementation JoinSemilattice Compartment where\n  join = joinComp\n\n  associative (U x) (U y) (U z) = cong $ associative x y z\n  associative (U x) (U y) (A z w) = rewrite associative x y z in Refl\n  associative (U x) (U y) (PC z w) = Refl\n  associative (U x) (A y w) (U z) = rewrite associative x y z in Refl\n  associative (U x) (A y w) (A z s) = rewrite associative x y z in Refl\n  associative (U x) (A y w) (PC z s) = Refl\n  associative (U x) (PC y w) (U z) = Refl\n  associative (U x) (PC y w) (A z s) = Refl\n  associative (U x) (PC y w) (PC z s) = Refl\n  associative (A x w) (U y) (U z) = rewrite associative x y z in Refl\n  associative (A x w) (U y) (A z s) = rewrite associative x y z in Refl\n  associative (A x w) (U y) (PC z s) = Refl\n  associative (A x w) (A y s) (U z) = rewrite associative x y z in Refl\n  associative (A x w) (A y s) (A z t) =\n    rewrite associative x y z in\n    rewrite associative w s t in Refl\n  associative (A x w) (A y s) (PC z t) = rewrite associative w s t in Refl\n  associative (A x w) (PC y s) (U z) = Refl\n  associative (A x w) (PC y s) (A z t) = rewrite associative w s t in Refl\n  associative (A x w) (PC y s) (PC z t) = rewrite associative w s t in Refl\n  associative (PC x w) (U y) (U z) = Refl\n  associative (PC x w) (U y) (A z s) = Refl\n  associative (PC x w) (U y) (PC z s) = Refl\n  associative (PC x w) (A y s) (U z) = Refl\n  associative (PC x w) (A y s) (A z t) = rewrite associative w s t in Refl\n  associative (PC x w) (A y s) (PC z t) = rewrite associative w s t in Refl\n  associative (PC x w) (PC y s) (U z) = Refl\n  associative (PC x w) (PC y s) (A z t) = rewrite associative w s t in Refl\n  associative (PC x w) (PC y s) (PC z t) =\n    rewrite associative x y z in\n    rewrite associative w s t in Refl\n\n  commutative (U x) (U y) = cong $ commutative x y\n  commutative (U x) (A y z) = rewrite commutative x y in Refl\n  commutative (U x) (PC y z) = Refl\n  commutative (A x z) (U y) = rewrite commutative x y in Refl\n  commutative (A x z) (A y w) =\n    rewrite commutative x y in\n    rewrite commutative z w in\n    Refl\n  commutative (A x z) (PC y w) = rewrite commutative w z in Refl\n  commutative (PC x z) (U y) = Refl\n  commutative (PC x z) (A y w) = rewrite commutative z w in Refl\n  commutative (PC x z) (PC y w) =\n    rewrite commutative x y in\n    rewrite commutative z w in\n    Refl\n\n  idempotent (U x) = cong $ idempotent x\n  idempotent (A x y) =\n     rewrite idempotent x in\n     rewrite idempotent y in\n     Refl\n  idempotent (PC x y) =\n     rewrite idempotent x in\n     rewrite idempotent y in\n     Refl\n\nimplementation BoundedJoinSemilattice Compartment where\n  Bottom = U Bot\n\n  unitary (U x) = cong $ unitary x\n  unitary (A x y) = rewrite unitary x in Refl\n  unitary (PC x y) = Refl\n\n--------------------------------------------------------------------------------\n-- Lemmas\n--------------------------------------------------------------------------------\nU_leq_A : U uid `leq` A uid sid\nU_leq_A {uid} = rewrite reflexive uid in Refl\n\nA_leq_PC : A uid1 sid `leq` PC uid2 sid\nA_leq_PC {sid} = rewrite reflexive sid in Refl\n", "meta": {"hexsha": "f3743d911a228df8efe44624077ba06920fc665c", "size": 7034, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Examples/ConferenceLattice.idr", "max_stars_repo_name": "simongregersen/DepSec", "max_stars_repo_head_hexsha": "10e0419acbe690c460df509d0cb9f4690867422c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2019-08-25T15:16:34.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-18T11:10:20.000Z", "max_issues_repo_path": "Examples/ConferenceLattice.idr", "max_issues_repo_name": "simongregersen/DepSec", "max_issues_repo_head_hexsha": "10e0419acbe690c460df509d0cb9f4690867422c", "max_issues_repo_licenses": ["MIT"], "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/ConferenceLattice.idr", "max_forks_repo_name": "simongregersen/DepSec", "max_forks_repo_head_hexsha": "10e0419acbe690c460df509d0cb9f4690867422c", "max_forks_repo_licenses": ["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.5426008969, "max_line_length": 80, "alphanum_fraction": 0.601933466, "num_tokens": 2529, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8056321936479701, "lm_q2_score": 0.6548947290421275, "lm_q1q2_score": 0.5276042771667022}}
{"text": "module Mem\n\nimport Data.Vect\n\n-- Effectively (size : Nat ** Vect size a)\nrecord Region a where\n  constructor MkRegion\n  regionSize : Nat\n  regionData : Vect regionSize a\n\n-- Effectively (regs : Nat ** Vect regs (Region a))\nrecord RegionsOfType a where\n  constructor MkRegOfType\n  regionCnt : Nat\n  regionsOfType : Vect regs $ Region a\n\nrecord Memory where\n  constructor MkMemReg\n  regionsByType : (a : Type) -> RegionsOfType a\n\nrecord Pointer where\n  constructor MkPointer\n  type : Type\n  regionNum : Nat\n  idxInRegion : Nat\n\ndata CorrectPointer : Pointer -> Memory -> Type where\n", "meta": {"hexsha": "3bcd12d29f8bfbb33f59d02ddea0d241bc2c3fda", "size": 580, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Mem.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "Mem.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "Mem.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 20.7142857143, "max_line_length": 53, "alphanum_fraction": 0.7327586207, "num_tokens": 150, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8056321889812554, "lm_q2_score": 0.6548947223065755, "lm_q1q2_score": 0.5276042686841178}}
{"text": "-- -------------------------------------------------------------- [ Lens.idr ]\n-- Description : Idris port of Control.Lens\n-- Copyright   : (c) Huw Campbell\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Data.Yoneda\n\nimport Data.Morphisms\n\n\n-- | @Yoneda f a@ can be viewed as the partial application of 'fmap' to its second argument.\npublic export\ndata Yoneda : ( f : Type -> Type ) -> ( a : Type ) -> Type where\n  MkYoneda : ({0 b : Type} -> (a -> b) -> f b) -> Yoneda f a\n\n-- | The natural isomorphism between @f@ and @'Yoneda' f@ given by the Yoneda lemma\n-- is witnessed by 'liftYoneda' and 'lowerYoneda'\n--\n-- @\n-- 'liftYoneda' . 'lowerYoneda' \u2261 'id'\n-- 'lowerYoneda' . 'liftYoneda' \u2261 'id'\n-- @\n--\n-- @\n-- lowerYoneda (liftYoneda fa) =         -- definition\n-- lowerYoneda (Yoneda (\\f -> fmap f a)) -- definition\n-- (\\f -> fmap f fa) id                  -- beta reduction\n-- fmap id fa                            -- functor law\n-- fa\n-- @\n--\n-- @\n-- 'lift' = 'liftYoneda'\n-- @\npublic export\nliftYoneda : { f : Type -> Type } -> Functor f => f a -> Yoneda f a\nliftYoneda a = MkYoneda (flip map a)\n\npublic export\nlowerYoneda : {0 a : Type} -> Yoneda f a -> f a\nlowerYoneda (MkYoneda f) = f id\n\npublic export\nimplementation Functor f => Functor (Yoneda f) where\n  map h (MkYoneda k) = MkYoneda (flip map (k h))\n\npublic export\nimplementation Applicative f => Applicative (Yoneda f) where\n  pure a = MkYoneda (\\f => pure (f a))\n  (MkYoneda m) <*> (MkYoneda n) = MkYoneda (\\f => m (f .) <*> n id)\n", "meta": {"hexsha": "62f0d5d0fe646c51ab3acfd0ddfc636316066949", "size": 1537, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/Yoneda.idr", "max_stars_repo_name": "shmish111/idris-lens", "max_stars_repo_head_hexsha": "0f9dd4e96ead2d012631075743ba38cdb8d80c83", "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/Yoneda.idr", "max_issues_repo_name": "shmish111/idris-lens", "max_issues_repo_head_hexsha": "0f9dd4e96ead2d012631075743ba38cdb8d80c83", "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/Yoneda.idr", "max_forks_repo_name": "shmish111/idris-lens", "max_forks_repo_head_hexsha": "0f9dd4e96ead2d012631075743ba38cdb8d80c83", "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.74, "max_line_length": 92, "alphanum_fraction": 0.5452179571, "num_tokens": 498, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8056321796478255, "lm_q2_score": 0.6548947290421275, "lm_q1q2_score": 0.5276042679980814}}
{"text": "myfib : Integer -> Integer\nmyfib 0 = 1\nmyfib 1 = 1\nmyfib n = myfib (n - 1) + myfib (n - 2)\n\nmain : IO ()\nmain = putStrLn $ show $ myfib 40\n", "meta": {"hexsha": "11cd061a380d7dc6b89492b3d23ac128c1c4a9ad", "size": 139, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "benchmark/Fib.idr", "max_stars_repo_name": "ioanluca/real-world-idris", "max_stars_repo_head_hexsha": "e9e261e436aa30843fa736567efc07b20a1925c3", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 27, "max_stars_repo_stars_event_min_datetime": "2019-05-23T23:46:23.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-04T19:39:04.000Z", "max_issues_repo_path": "benchmark/Fib.idr", "max_issues_repo_name": "ioanluca/real-world-idris", "max_issues_repo_head_hexsha": "e9e261e436aa30843fa736567efc07b20a1925c3", "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": "benchmark/Fib.idr", "max_forks_repo_name": "ioanluca/real-world-idris", "max_forks_repo_head_hexsha": "e9e261e436aa30843fa736567efc07b20a1925c3", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2019-09-10T22:56:21.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-15T04:58:39.000Z", "avg_line_length": 17.375, "max_line_length": 39, "alphanum_fraction": 0.5899280576, "num_tokens": 59, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8056321796478255, "lm_q2_score": 0.6548947223065755, "lm_q1q2_score": 0.5276042625717039}}
{"text": "module Solutions.Functions1\n\n--------------------------------------------------------------------------------\n--          Exercise 1\n--------------------------------------------------------------------------------\n\nsquare : Integer -> Integer\nsquare n = n * n\n\ntestSquare : (Integer -> Bool) -> Integer -> Bool\ntestSquare fun = fun . square\n\ntwice : (Integer -> Integer) -> Integer -> Integer\ntwice f = f . f\n\n--------------------------------------------------------------------------------\n--          Exercise 2\n--------------------------------------------------------------------------------\n\nisEven : Integer -> Bool\nisEven n = (n `mod` 2) == 0\n\nisOdd : Integer -> Bool\nisOdd = not . isEven\n\n--------------------------------------------------------------------------------\n--          Exercise 3\n--------------------------------------------------------------------------------\n\nisSquareOf : Integer -> Integer -> Bool\nisSquareOf n x = n == x * x\n\n--------------------------------------------------------------------------------\n--          Exercise 4\n--------------------------------------------------------------------------------\n\nisSmall : Integer -> Bool\nisSmall n = n <= 100\n\n--------------------------------------------------------------------------------\n--          Exercise 5\n--------------------------------------------------------------------------------\n\nabsIsSmall : Integer -> Bool\nabsIsSmall = isSmall . abs\n\n--------------------------------------------------------------------------------\n--          Exercise 6\n--------------------------------------------------------------------------------\n\nand : (Integer -> Bool) -> (Integer -> Bool) -> Integer -> Bool\nand f1 f2 n = f1 n && f2 n\n\nor : (Integer -> Bool) -> (Integer -> Bool) -> Integer -> Bool\nor f1 f2 n = f1 n || f2 n\n\nnegate : (Integer -> Bool) -> Integer -> Bool\nnegate f = not . f\n\n--------------------------------------------------------------------------------\n--          Exercise 7\n--------------------------------------------------------------------------------\n\n(&&) : (Integer -> Bool) -> (Integer -> Bool) -> Integer -> Bool\n(&&) = and\n\n(||) : (Integer -> Bool) -> (Integer -> Bool) -> Integer -> Bool\n(||) = or\n\nnot : (Integer -> Bool) -> Integer -> Bool\nnot = negate\n", "meta": {"hexsha": "e5b4ec1a73500ab08186176d23b81d6f8cb0bb8e", "size": 2257, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Solutions/Functions1.idr", "max_stars_repo_name": "ska80/idris2-tutorial", "max_stars_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 60, "max_stars_repo_stars_event_min_datetime": "2022-01-13T16:14:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T16:16:57.000Z", "max_issues_repo_path": "src/Solutions/Functions1.idr", "max_issues_repo_name": "ska80/idris2-tutorial", "max_issues_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 11, "max_issues_repo_issues_event_min_datetime": "2022-01-14T15:42:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T09:53:16.000Z", "max_forks_repo_path": "src/Solutions/Functions1.idr", "max_forks_repo_name": "ska80/idris2-tutorial", "max_forks_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2022-01-14T15:48:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T06:49:13.000Z", "avg_line_length": 31.3472222222, "max_line_length": 80, "alphanum_fraction": 0.2782454586, "num_tokens": 375, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7341195269001831, "lm_q2_score": 0.718594386544335, "lm_q1q2_score": 0.5275341710830546}}
{"text": "> module Interfaces.Math\n\n> %default total\n> %access public export\n> %auto_implicits off\n\n\n> interface (Num ty) => Math ty where\n>   exp : ty -> ty \n>   sin : ty -> ty \n>   cos : ty -> ty \n\n\n", "meta": {"hexsha": "ea39cca2a50b81f0de32e6a2c49609195d90cd4f", "size": 191, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "Interfaces/Math.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Interfaces/Math.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Interfaces/Math.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 13.6428571429, "max_line_length": 37, "alphanum_fraction": 0.5916230366, "num_tokens": 59, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.837619979547273, "lm_q2_score": 0.6297746074044134, "lm_q1q2_score": 0.5275117937734766}}
{"text": "module Inputs\nimport Data.Primitives.Views\n\npublic export\nrandoms : Int -> Stream Int\nrandoms seed = let seed' = 1664525 * seed + 1013904223 in\n                   (seed' `shiftR` 2) :: randoms seed'\n\npublic export\narithInputs : Int -> Stream Int\narithInputs seed = map bound (randoms seed)\n  where\n    bound : Int -> Int\n    bound num with (divides num 12)\n      bound ((12 * div) + rem) | (DivBy prf) = rem + 1\n", "meta": {"hexsha": "ebfe86d22759dbde2fc649219b241137e83b3d49", "size": 412, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter-11/Arith.idr", "max_stars_repo_name": "tekerson/type-driven-development", "max_stars_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-23T04:46:42.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-23T04:46:42.000Z", "max_issues_repo_path": "Chapter-11/Arith.idr", "max_issues_repo_name": "tekerson/type-driven-development", "max_issues_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter-11/Arith.idr", "max_forks_repo_name": "tekerson/type-driven-development", "max_forks_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_forks_repo_licenses": ["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": 57, "alphanum_fraction": 0.6432038835, "num_tokens": 124, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8376199552262967, "lm_q2_score": 0.6297746074044134, "lm_q1q2_score": 0.5275117784567434}}
{"text": "module LinearTypes \n\nimport Data.Vect\n\ninfixr 10 ::\ninfix 5 #\n\n%default total\n\npublic export\ndata LFstPair : Type -> Type -> Type where\n  (#) : (1 _ : a) -> b -> LFstPair a b\n\n\npublic export\ndata LVect : Nat -> Type ->  Type where\n  Nil : LVect Z a\n  (::) : (1 _ : a) -> (1 _ : LVect k a) -> LVect (S k) a\n\npublic export\nShow a => Show (LVect n a) where\n  show v = \"[\" ++ show' v ++ \"]\" where\n    show' :  LVect k a -> String\n    show' Nil = \"\"\n    show' [x] = show x\n    show' (x :: xs) = show x ++ \" , \" ++ show' xs \n\npublic export\n(Show a, Show b) => Show (LPair a b) where\n  show ( a # b ) = \"( \" ++ show a ++ \" # \" ++ show b ++ \" )\"\n\npublic export\n(Show a, Show b) => Show (LFstPair a b) where\n  show ( a # b ) = \"( \" ++ show a ++ \" # \" ++ show b ++ \" )\"\n\npublic export\n(++) : (1 xs : LVect m a) -> (1 ys : LVect n a) -> LVect (m + n) a\n(++) []      ys = ys\n(++) (x::xs) ys = x :: (xs ++ ys)\n\npublic export\nsplitAt : {n : Nat} -> (i : Nat) -> (1 xs : LVect (i+n) a) -> LPair (LVect i a) (LVect n a)\nsplitAt 0 xs            = [] # xs\nsplitAt (S k) (x :: xs) = let ys # zs = LinearTypes.splitAt k xs in\n                              (x :: ys) # zs\n\n||| diff n i = n - i\npublic export\ndiff : Nat -> Nat -> Nat\ndiff Z     n = Z\ndiff (S k) n = S (diff k n)\n\nexport\nlemmaDiffZero : (n : Nat) -> diff n 0 = n\nlemmaDiffZero 0 = Refl\nlemmaDiffZero (S k) = rewrite lemmaDiffZero k in Refl\n\npublic export\nconsLin : (1 _ : Bool) -> (1 _ : Vect n Bool) -> Vect (S n) Bool\nconsLin False [] = [False]\nconsLin False (x :: xs) = False :: x :: xs\nconsLin True [] = [True]\nconsLin True (x :: xs) = True :: x :: xs\n\npublic export\ntoVect : (1 _ : LVect n Bool) -> Vect n Bool\ntoVect [] = []\ntoVect (x :: xs) = x `consLin` (toVect xs)\n", "meta": {"hexsha": "4205c6294101206c9bfab35b10522f137e3c86b5", "size": 1718, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "LinearTypes.idr", "max_stars_repo_name": "zamdzhiev/Qimaera", "max_stars_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2021-08-24T14:36:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-24T00:36:11.000Z", "max_issues_repo_path": "LinearTypes.idr", "max_issues_repo_name": "zamdzhiev/Qimaera", "max_issues_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "LinearTypes.idr", "max_forks_repo_name": "zamdzhiev/Qimaera", "max_forks_repo_head_hexsha": "3823cd1d103dd07ca0fb6fe3be08b535e56e3b87", "max_forks_repo_licenses": ["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.8985507246, "max_line_length": 91, "alphanum_fraction": 0.5215366705, "num_tokens": 628, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.757794360334681, "lm_q2_score": 0.6959583313396339, "lm_q1q2_score": 0.5273932985171098}}
{"text": "module Data.SortedMap.Extra\n\nimport Data.SortedMap\nimport Data.List\n\nexport\nfilter : Ord k => (k -> v -> Bool) -> SortedMap k v -> SortedMap k v\nfilter pred = fromList . filter (uncurry pred) . toList\n\nexport\nsize : Foldable t => t a -> Nat\nsize = foldr (\\_ => (+ 1)) 0\n", "meta": {"hexsha": "09afe9504fee31ebed21133e8c92011c879cf30b", "size": 270, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "grin/src/Data/SortedMap/Extra.idr", "max_stars_repo_name": "danielkroeni/Idris2-Grin", "max_stars_repo_head_hexsha": "8fc28628300e5c9a97d83c62999290d809b50838", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 26, "max_stars_repo_stars_event_min_datetime": "2021-02-26T13:11:57.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-27T16:04:05.000Z", "max_issues_repo_path": "grin/src/Data/SortedMap/Extra.idr", "max_issues_repo_name": "danielkroeni/Idris2-Grin", "max_issues_repo_head_hexsha": "8fc28628300e5c9a97d83c62999290d809b50838", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2021-03-18T08:34:59.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-10T07:39:42.000Z", "max_forks_repo_path": "grin/src/Data/SortedMap/Extra.idr", "max_forks_repo_name": "danielkroeni/Idris2-Grin", "max_forks_repo_head_hexsha": "8fc28628300e5c9a97d83c62999290d809b50838", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2021-06-16T12:20:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-28T23:36:48.000Z", "avg_line_length": 20.7692307692, "max_line_length": 68, "alphanum_fraction": 0.6592592593, "num_tokens": 86, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7371581510799253, "lm_q2_score": 0.7154239957834733, "lm_q1q2_score": 0.5273806299699575}}
{"text": "module Main\n\nimport Data.List\n\n\ndata Tree a = Empty\n            | Node (Tree a) a (Tree a)\n\nShow a => Show (Tree a) where\n  show Empty = \"Empty\"\n  show (Node left val right) = \"(Node \" ++ show left ++ \" \" ++ show val ++ \" \" ++ show right ++ \")\"\n\ntestTree : Tree String\ntestTree = Node (Node (Node Empty \"Jim\" Empty)\n                      \"Fred\"\n                      (Node Empty \"Sheila\" Empty))\n                \"Alice\"\n                (Node Empty \"Bob\" (Node Empty \"Eve\" Empty))\n\nflatten : Tree a -> List a\nflatten Empty = []\nflatten (Node left val right) = flatten left ++ val :: flatten right\n\ntreeLabelWith\n  : Stream labelType\n  -> Tree a\n  -> (Stream labelType, Tree (labelType, a))\ntreeLabelWith lbls Empty = (lbls, Empty)\ntreeLabelWith lbls (Node left val right)\n  = let (lblThis :: lblsLeft, leftLabelled) = treeLabelWith lbls left\n        (lblRight, rightLabelled) = treeLabelWith lblsLeft right\n    in (lblRight, Node leftLabelled (lblThis, val) rightLabelled)\n\ntreeLabel : Tree a -> Tree (Integer, a)\ntreeLabel tree = snd (treeLabelWith [1..] tree)\n\nmain : IO ()\nmain = do\n  printLn $ flatten testTree\n  printLn $ flatten $ treeLabel testTree\n", "meta": {"hexsha": "0f2565eb0be882fbced58864188ee9d00c4144d6", "size": 1155, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/tdd/chapter12/01_TreeLabel.idr", "max_stars_repo_name": "luc-tielen/idris-grin", "max_stars_repo_head_hexsha": "b259e8861a2a5f66ebf9a545e6d9620b3f0ec969", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/tdd/chapter12/01_TreeLabel.idr", "max_issues_repo_name": "luc-tielen/idris-grin", "max_issues_repo_head_hexsha": "b259e8861a2a5f66ebf9a545e6d9620b3f0ec969", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/tdd/chapter12/01_TreeLabel.idr", "max_forks_repo_name": "luc-tielen/idris-grin", "max_forks_repo_head_hexsha": "b259e8861a2a5f66ebf9a545e6d9620b3f0ec969", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 28.1707317073, "max_line_length": 99, "alphanum_fraction": 0.6225108225, "num_tokens": 322, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7371581510799252, "lm_q2_score": 0.7154239957834733, "lm_q1q2_score": 0.5273806299699574}}
{"text": "-- Tests bitwise ops for the different data types\n--\n-- The tests in `idris2/basic055`, `chez/chez032` and `node/node024` are the\n-- same and should all have the same output.\n\nimport Data.Stream\n\n--------------------------------------------------------------------------------\n--          Utilities\n--------------------------------------------------------------------------------\n\nshl1 : Int -> Int\nshl1 = prim__shl_Int 1\n\nb8max : Bits8\nb8max = 0xff\n\nb16max : Bits16\nb16max = 0xffff\n\nb32max : Bits32\nb32max = 0xffffffff\n\nb64max : Bits64\nb64max = 18446744073709551615\n\n-- the only way to create -2^31\nintmin : Int\nintmin = shl1 31\n\nintmax : Int\nintmax = 0x7fffffff\n\npowsOf2 : Num a => Nat -> List a\npowsOf2 n = take n (iterate (*2) 1)\n\n--------------------------------------------------------------------------------\n--          shiftR\n--------------------------------------------------------------------------------\n\nshiftRBits8 : List Bits8\nshiftRBits8 = map (`prim__shr_Bits8` 1) (powsOf2 8 ++ [b8max])\n\nshiftRBits16 : List Bits16\nshiftRBits16 = map (`prim__shr_Bits16` 1) (powsOf2 16 ++ [b16max])\n\nshiftRBits32 : List Bits32\nshiftRBits32 = map (`prim__shr_Bits32` 1) (powsOf2 32 ++ [b32max])\n\nshiftRBits64 : List Bits64\nshiftRBits64 = map (`prim__shr_Bits64` 1) (powsOf2 64 ++ [b64max])\n\nshiftRInteger : List Integer\nshiftRInteger = map (`prim__shr_Integer` 1) (powsOf2 128)\n\nshiftRInt : List Int\nshiftRInt = map (`prim__shr_Int` 1) (powsOf2 31 ++ [intmax])\n\nshiftRNegativeInt : List Int\nshiftRNegativeInt = map (`prim__shr_Int` 1) (map negate (powsOf2 31) ++ [intmin])\n\n--------------------------------------------------------------------------------\n--          shiftL\n--------------------------------------------------------------------------------\n\nshiftLBits8 : List Bits8\nshiftLBits8 = map (`prim__shl_Bits8` 1) (0 :: powsOf2 7)\n\nshiftLBits16 : List Bits16\nshiftLBits16 = map (`prim__shl_Bits16` 1) (0 :: powsOf2 15)\n\nshiftLBits32 : List Bits32\nshiftLBits32 = map (`prim__shl_Bits32` 1) (0 :: powsOf2 31)\n\nshiftLBits64 : List Bits64\nshiftLBits64 = map (`prim__shl_Bits64` 1) (0 :: powsOf2 63)\n\nshiftLInteger : List Integer\nshiftLInteger = map (`prim__shl_Integer` 1) (0 :: powsOf2 127)\n\nshiftLInt : List Int\nshiftLInt = map (`prim__shl_Int` 1) (0 :: powsOf2 30)\n\nshiftLNegativeInt : List Int\nshiftLNegativeInt = map (`prim__shl_Int` 1) (map negate (powsOf2 30))\n\n\n--------------------------------------------------------------------------------\n--          Bitwise AND\n--------------------------------------------------------------------------------\n\nandBits8 : List Bits8\nandBits8 = [ prim__and_Bits8 11 b8max\n           , prim__and_Bits8 11 0\n           , prim__and_Bits8 11 1\n           , prim__and_Bits8 11 2\n           , prim__and_Bits8 11 4\n           , prim__and_Bits8 11 11\n           ]\n\nandBits16 : List Bits16\nandBits16 = [ prim__and_Bits16 11 b16max\n            , prim__and_Bits16 11 0\n            , prim__and_Bits16 11 1\n            , prim__and_Bits16 11 2\n            , prim__and_Bits16 11 4\n            , prim__and_Bits16 11 11\n            ]\n\nandBits32 : List Bits32\nandBits32 = [ prim__and_Bits32 11 b32max\n            , prim__and_Bits32 11 0\n            , prim__and_Bits32 11 1\n            , prim__and_Bits32 11 2\n            , prim__and_Bits32 11 4\n            , prim__and_Bits32 11 11\n            ]\n\nandBits64 : List Bits64\nandBits64 = [ prim__and_Bits64 11 b64max\n            , prim__and_Bits64 11 0\n            , prim__and_Bits64 11 1\n            , prim__and_Bits64 11 2\n            , prim__and_Bits64 11 4\n            , prim__and_Bits64 11 11\n            ]\n\nandInteger : List Integer\nandInteger = [ prim__and_Integer 11 (prim__shl_Integer 1 128 - 1)\n             , prim__and_Integer 11 0\n             , prim__and_Integer 11 1\n             , prim__and_Integer 11 2\n             , prim__and_Integer 11 4\n             , prim__and_Integer 11 11\n             ]\n\nandInt : List Int\nandInt = [ prim__and_Int 11 intmax\n         , prim__and_Int 11 0\n         , prim__and_Int 11 1\n         , prim__and_Int 11 2\n         , prim__and_Int 11 4\n         , prim__and_Int 11 11\n         ]\n\nandNegativeInt : List Int\nandNegativeInt = [ prim__and_Int (-11) intmax\n                 , prim__and_Int (-11) 0\n                 , prim__and_Int (-11) 1\n                 , prim__and_Int (-11) 2\n                 , prim__and_Int (-11) 4\n                 , prim__and_Int (-11) 11\n                 , prim__and_Int (-11) intmin\n                 , prim__and_Int (-11) (-1)\n                 , prim__and_Int (-11) (-2)\n                 , prim__and_Int (-11) (-4)\n                 , prim__and_Int (-11) (-11)\n                 ]\n\n--------------------------------------------------------------------------------\n--          Bitwise OR\n--------------------------------------------------------------------------------\n\norBits8 : List Bits8\norBits8 = [ prim__or_Bits8 11 b8max\n          , prim__or_Bits8 11 0\n          , prim__or_Bits8 11 1\n          , prim__or_Bits8 11 2\n          , prim__or_Bits8 11 4\n          , prim__or_Bits8 11 11\n          ]\n\norBits16 : List Bits16\norBits16 = [ prim__or_Bits16 11 b16max\n           , prim__or_Bits16 11 0\n           , prim__or_Bits16 11 1\n           , prim__or_Bits16 11 2\n           , prim__or_Bits16 11 4\n           , prim__or_Bits16 11 11\n           ]\n\norBits32 : List Bits32\norBits32 = [ prim__or_Bits32 11 b32max\n           , prim__or_Bits32 11 0\n           , prim__or_Bits32 11 1\n           , prim__or_Bits32 11 2\n           , prim__or_Bits32 11 4\n           , prim__or_Bits32 11 11\n           ]\n\norBits64 : List Bits64\norBits64 = [ prim__or_Bits64 11 b64max\n           , prim__or_Bits64 11 0\n           , prim__or_Bits64 11 1\n           , prim__or_Bits64 11 2\n           , prim__or_Bits64 11 4\n           , prim__or_Bits64 11 11\n           ]\n\norInteger : List Integer\norInteger = [ prim__or_Integer 11 (prim__shl_Integer 1 128 - 1)\n            , prim__or_Integer 11 0\n            , prim__or_Integer 11 1\n            , prim__or_Integer 11 2\n            , prim__or_Integer 11 4\n            , prim__or_Integer 11 11\n            ]\n\norInt : List Int\norInt = [ prim__or_Int 11 intmax\n        , prim__or_Int 11 0\n        , prim__or_Int 11 1\n        , prim__or_Int 11 2\n        , prim__or_Int 11 4\n        , prim__or_Int 11 11\n        ]\n\norNegativeInt : List Int\norNegativeInt = [ prim__or_Int (-11) intmax\n                , prim__or_Int (-11) 0\n                , prim__or_Int (-11) 1\n                , prim__or_Int (-11) 2\n                , prim__or_Int (-11) 4\n                , prim__or_Int (-11) 11\n                , prim__or_Int (-11) intmin\n                , prim__or_Int (-11) (-1)\n                , prim__or_Int (-11) (-2)\n                , prim__or_Int (-11) (-4)\n                , prim__or_Int (-11) (-11)\n                ]\n\n--------------------------------------------------------------------------------\n--          Bitwise XOR\n--------------------------------------------------------------------------------\n\nxorBits8 : List Bits8\nxorBits8 = [ prim__xor_Bits8 11 b8max\n           , prim__xor_Bits8 11 0\n           , prim__xor_Bits8 11 1\n           , prim__xor_Bits8 11 2\n           , prim__xor_Bits8 11 4\n           , prim__xor_Bits8 11 11\n           ]\n\nxorBits16 : List Bits16\nxorBits16 = [ prim__xor_Bits16 11 b16max\n            , prim__xor_Bits16 11 0\n            , prim__xor_Bits16 11 1\n            , prim__xor_Bits16 11 2\n            , prim__xor_Bits16 11 4\n            , prim__xor_Bits16 11 11\n            ]\n\nxorBits32 : List Bits32\nxorBits32 = [ prim__xor_Bits32 11 b32max\n            , prim__xor_Bits32 11 0\n            , prim__xor_Bits32 11 1\n            , prim__xor_Bits32 11 2\n            , prim__xor_Bits32 11 4\n            , prim__xor_Bits32 11 11\n            ]\n\nxorBits64 : List Bits64\nxorBits64 = [ prim__xor_Bits64 11 b64max\n            , prim__xor_Bits64 11 0\n            , prim__xor_Bits64 11 1\n            , prim__xor_Bits64 11 2\n            , prim__xor_Bits64 11 4\n            , prim__xor_Bits64 11 11\n            ]\n\nxorInteger : List Integer\nxorInteger = [ prim__xor_Integer 11 (prim__shl_Integer 1 128 - 1)\n             , prim__xor_Integer 11 0\n             , prim__xor_Integer 11 1\n             , prim__xor_Integer 11 2\n             , prim__xor_Integer 11 4\n             , prim__xor_Integer 11 11\n             ]\n\nxorInt : List Int\nxorInt = [ prim__xor_Int 11 intmax\n         , prim__xor_Int 11 0\n         , prim__xor_Int 11 1\n         , prim__xor_Int 11 2\n         , prim__xor_Int 11 4\n         , prim__xor_Int 11 11\n         ]\n\nxorNegativeInt : List Int\nxorNegativeInt = [ prim__xor_Int (-11) intmax\n                 , prim__xor_Int (-11) 0\n                 , prim__xor_Int (-11) 1\n                 , prim__xor_Int (-11) 2\n                 , prim__xor_Int (-11) 4\n                 , prim__xor_Int (-11) 11\n                 , prim__xor_Int (-11) intmin\n                 , prim__xor_Int (-11) (-1)\n                 , prim__xor_Int (-11) (-2)\n                 , prim__xor_Int (-11) (-4)\n                 , prim__xor_Int (-11) (-11)\n                 ]\n\n--------------------------------------------------------------------------------\n--          Running Tests\n--------------------------------------------------------------------------------\n\nmain : IO ()\nmain = do printLn intmin\n\n          putStrLn \"\"\n\n          printLn shiftRBits8\n          printLn shiftRBits16\n          printLn shiftRBits32\n          printLn shiftRBits64\n          printLn shiftRInteger\n          printLn shiftRInt\n          printLn shiftRNegativeInt\n\n          putStrLn \"\"\n\n          printLn shiftLBits8\n          printLn shiftLBits16\n          printLn shiftLBits32\n          printLn shiftLBits64\n          printLn shiftLInteger\n          printLn shiftLInt\n          printLn shiftLNegativeInt\n\n          putStrLn \"\"\n\n          printLn andBits8\n          printLn andBits16\n          printLn andBits32\n          printLn andBits64\n          printLn andInteger\n          printLn andInt\n          printLn andNegativeInt\n\n          putStrLn \"\"\n\n          printLn orBits8\n          printLn orBits16\n          printLn orBits32\n          printLn orBits64\n          printLn orInteger\n          printLn orInt\n          printLn orNegativeInt\n\n          putStrLn \"\"\n\n          printLn xorBits8\n          printLn xorBits16\n          printLn xorBits32\n          printLn xorBits64\n          printLn xorInteger\n          printLn xorInt\n          printLn xorNegativeInt\n", "meta": {"hexsha": "6a7b5385290a1bf056c212ef9086738ad4cd3277", "size": 10389, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/basic055/BitOps.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "tests/idris2/basic055/BitOps.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "tests/idris2/basic055/BitOps.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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.8583333333, "max_line_length": 81, "alphanum_fraction": 0.5083261142, "num_tokens": 3073, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7401743620390162, "lm_q2_score": 0.7122321964553657, "lm_q1q2_score": 0.5271760116349976}}
{"text": "module ReadNum\n\nimport Data.Strings\n\n%default total\n\nreadNumber : HasIO io => io (Maybe Nat)\nreadNumber = do n <- getLine\n                if all isDigit (unpack n) \n                   then pure $ Just (stringToNatOrZ n)\n                   else pure Nothing\n\nreadNumbers : HasIO io => io (Maybe (Nat, Nat))\nreadNumbers = do m <- readNumber\n                 case m of\n                      Nothing => pure Nothing\n                      Just mm => do n <- readNumber\n                                    case n of\n                                         Nothing => pure Nothing\n                                         Just nn => pure $ Just (mm, nn)\n\n-- pattern-matched destucturing\n\nreadNumbersImproved : HasIO io => io (Maybe (Nat, Nat))\nreadNumbersImproved = do Just m <- readNumber | Nothing => pure Nothing \n                         Just n <- readNumber | Nothing => pure Nothing\n                         pure $ Just (m, n)", "meta": {"hexsha": "1ab83a01c2c9fcdd6bcabf6a98502216d83fefd4", "size": 926, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter5/ReadNum.idr", "max_stars_repo_name": "timmyjose-study/tdd-with-idris", "max_stars_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "chapter5/ReadNum.idr", "max_issues_repo_name": "timmyjose-study/tdd-with-idris", "max_issues_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": "chapter5/ReadNum.idr", "max_forks_repo_name": "timmyjose-study/tdd-with-idris", "max_forks_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": 34.2962962963, "max_line_length": 72, "alphanum_fraction": 0.4902807775, "num_tokens": 190, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7122321842389469, "lm_q2_score": 0.7401743505760728, "lm_q1q2_score": 0.5271759944284403}}
{"text": "module NanoParsec.Combinators\n\nimport NanoParsec.Parser\nimport Data.String\n\n%access export\n\noneOf : List Char -> Parser Char\noneOf st = satisfy (flip elem st)\n\nchainl1 : Parser a -> Parser (a -> a -> a) -> Parser a\nchainl1 p op = do { a <- p; rest a }\n    where\n        rest a = (do f <- op\n                     b <- p\n                     rest (f a b))\n                <|> return a\n\nchainl : Parser a -> Parser (a -> a -> a) -> a -> Parser a\nchainl p op a = (chainl1 p op) <|> return a\n\n\nchar : Char -> Parser Char\nchar ch = satisfy (ch ==)\n\ndigit : Parser Char\ndigit = satisfy isDigit\n\nspaces : Parser String\nspaces = pack <$> (many . oneOf . unpack $ \" \\n\\r\")\n\nstring : String -> Parser String\nstring st = pack <$> (string' $ unpack st)\n    where\n        string' : List Char -> Parser (List Char)\n        string' [] = return []\n        string' (c :: cs) = char c\n                          >>= \\_ => string' cs\n                          >>= \\_ => return (c :: cs)\n\ntoken : Parser a -> Parser a\ntoken p = p >>= \\a => spaces >>= \\_ => return a\n\nreserved : String -> Parser String\nreserved st = token (string st)\n\nmaybeNatural : Parser (Maybe Integer)\nmaybeNatural = parseInteger <$> (pack <$> some digit)\n\nnatural : Parser Integer\nnatural = fromMaybe <$> maybeNatural\n\nmaybeNumber : Parser (Maybe Int)\nmaybeNumber = do\n    sign   <- (unpack <$> string \"-\") <|> return []\n    digits <- some digit\n    return $ parseInteger $ pack (sign ++ digits)\n\nnumber : Parser Int\nnumber = fromMaybe <$> maybeNumber\n\nparens : Parser a -> Parser a\nparens p = do\n    reserved \"(\"\n    val <- p\n    reserved \")\"\n    return val\n", "meta": {"hexsha": "720254909e23deaa288f460c721b77c7ac6c948a", "size": 1609, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "NanoParsec/Combinators.idr", "max_stars_repo_name": "stallmanifold/idris-nanoparsec", "max_stars_repo_head_hexsha": "adf74d4ad4f1e8df918f3616b1cc8ee89db1c315", "max_stars_repo_licenses": ["Apache-2.0", "MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2016-11-21T13:36:37.000Z", "max_stars_repo_stars_event_max_datetime": "2017-02-21T05:56:30.000Z", "max_issues_repo_path": "NanoParsec/Combinators.idr", "max_issues_repo_name": "lambdaxymox/idris-nanoparsec", "max_issues_repo_head_hexsha": "adf74d4ad4f1e8df918f3616b1cc8ee89db1c315", "max_issues_repo_licenses": ["Apache-2.0", "MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "NanoParsec/Combinators.idr", "max_forks_repo_name": "lambdaxymox/idris-nanoparsec", "max_forks_repo_head_hexsha": "adf74d4ad4f1e8df918f3616b1cc8ee89db1c315", "max_forks_repo_licenses": ["Apache-2.0", "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.6617647059, "max_line_length": 58, "alphanum_fraction": 0.5668116843, "num_tokens": 427, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6757645879592641, "lm_q2_score": 0.7799929053683038, "lm_q1q2_score": 0.527091584307361}}
{"text": "\nmodule SubstLemmas\n\n-- Lemmas about substitution (and the related\n-- operations 'shiftTerm' and 'shift').\n\n\nimport Subst\nimport Term\nimport Typing\n\n\n%default total\n%access export\n\n\n\n---------------------------------------\n-- Begin: SUBSTITUTION PRESERVES TYPING\n\n-- Lemmas about extending contexts (in the middle)\n-- are required for the proof of the fact that\n-- substitution preserves typing.\n-- (In fact, the proof of preservation of typing under\n-- substitution only requires a lemma about extending\n-- the context at the front. However, to prove this\n-- lemma about extending the context, one has to assume\n-- that the context is extended in the middle in order\n-- for induction to go through in the case of 'TAbs'.)\n\n\n-- Extending a context 'ctx1++ctx2' in the middle preserves\n-- the types that are in the context, but the index 'k' must\n-- be shifted appropriately in order to retrieve the same\n-- type from the extended context:\nshiftTy : (k : Nat) ->\n          index' k (ctx1++ctx2) = Just t -> \n          (ctx : Context) ->\n          index' (shift (length ctx1) (length ctx) k) (ctx1++ctx++ctx2) = Just t\nshiftTy {ctx1 = []}       k     prf  []       = prf\nshiftTy {ctx1 = []}       k     prf  (s::ctx) = shiftTy {ctx1=[]} k prf ctx\nshiftTy {ctx1 = t1::ctx1} Z     Refl ctx      = Refl\nshiftTy {ctx1 = t1::ctx1} (S k) prf  ctx      = shiftTy {ctx1=ctx1} k prf ctx\n\n\n\n-- Typing is preserved if a context 'ctx1++ctx2' is extended\n-- in the middle provided the term 'e' is shifted appropriately:\nshiftTermTy : (e : Term) ->\n              Typing (ctx1++ctx2) e t -> \n              (ctx : Context) ->\n              Typing (ctx1++ctx++ctx2) (shiftTerm (length ctx1) (length ctx) e) t\n--\nshiftTermTy (TVar i) (TyVar prf) ctx = \n  TyVar $ shiftTy i prf ctx\n--\nshiftTermTy (TAbs e) (TyAbs s ty) ctx {ctx1} = \n  TyAbs s $ shiftTermTy e ty ctx {ctx1=s::ctx1}\n--\nshiftTermTy (TApp e1 e2) (TyApp ty1 ty2) ctx = \n  TyApp (shiftTermTy e1 ty1 ctx)\n        (shiftTermTy e2 ty2 ctx)\n--\nshiftTermTy (TRec e1 e2 e3) (TyRec ty1 ty2 ty3) ctx =\n  TyRec (shiftTermTy e1 ty1 ctx)\n        (shiftTermTy e2 ty2 ctx)\n        (shiftTermTy e3 ty3 ctx)\n--\nshiftTermTy TZero TyZero ctx = TyZero\n--\nshiftTermTy (TSucc e) (TySucc ty) ctx = \n  TySucc $ shiftTermTy e ty ctx\n--  \nshiftTermTy (TPred e) (TyPred ty) ctx = \n  TyPred $ shiftTermTy e ty ctx\n--\nshiftTermTy (TIfz e1 e2 e3) (TyIfz ty1 ty2 ty3) ctx =\n  TyIfz (shiftTermTy e1 ty1 ctx)\n        (shiftTermTy e2 ty2 ctx)\n        (shiftTermTy e3 ty3 ctx)\n\n\n\n-- Finally, substitution preserves typing:\nsubstPreservesTy : (e : Term) ->   -- Term in which substitution takes place.\n                   Typing (ctx1++s::ctx2) e t -> \n                   (es : Term) ->  -- Term that is substituted in.\n                   Typing ctx2 es s ->\n                   Typing (ctx1++ctx2) (subst es (length ctx1) e) t\n--\nsubstPreservesTy {ctx1 = []}       (TVar Z)     (TyVar Refl) es esTy = esTy\nsubstPreservesTy {ctx1 = []}       (TVar (S i)) (TyVar prf)  es esTy = TyVar prf\nsubstPreservesTy {ctx1 = t1::ctx1} (TVar Z)     (TyVar prf)  es esTy = TyVar prf\nsubstPreservesTy {ctx1 = t1::ctx1} (TVar (S k)) (TyVar prf)  es esTy = \n  let ih = substPreservesTy {ctx1=ctx1} (TVar k) (TyVar prf) es esTy\n  in shiftTermTy _ ih [t1] {ctx1=[]}\n--\nsubstPreservesTy {ctx1} (TAbs e) (TyAbs s ty) es esTy = \n  TyAbs s $ substPreservesTy e ty es esTy {ctx1=s::ctx1} \n--\nsubstPreservesTy (TApp e1 e2) (TyApp ty1 ty2) es esTy = \n  TyApp (substPreservesTy e1 ty1 es esTy)\n        (substPreservesTy e2 ty2 es esTy)\n--\nsubstPreservesTy (TRec e1 e2 e3) (TyRec ty1 ty2 ty3) es esTy =\n  TyRec (substPreservesTy e1 ty1 es esTy)\n        (substPreservesTy e2 ty2 es esTy)\n        (substPreservesTy e3 ty3 es esTy)        \n--\nsubstPreservesTy TZero TyZero es esTy = TyZero\n--\nsubstPreservesTy (TSucc e) (TySucc ty) es esTy =\n  TySucc $ substPreservesTy e ty es esTy\n--  \nsubstPreservesTy (TPred e) (TyPred ty) es esTy = \n  TyPred $ substPreservesTy e ty es esTy\n--\nsubstPreservesTy (TIfz e1 e2 e3) (TyIfz ty1 ty2 ty3) es esTy =\n  TyIfz (substPreservesTy e1 ty1 es esTy)\n        (substPreservesTy e2 ty2 es esTy)\n        (substPreservesTy e3 ty3 es esTy)\n\n-- End: SUBSTITUTION PRESERVES TYPING\n-------------------------------------\n\n\n\n\n---------------------------------------\n-- Begin: SEVERAL LEMMAS ABOUT SHIFTING\n\n-- The following lemmas come in pairs: \n-- The really useful lemma in each pair\n-- is the one about 'shiftTerm'.\n-- However, the lemma in each pair that\n-- is non-trivial to prove is usually the\n-- other one, i.e. the one about 'shift'.\n\n\nshiftByZero : (c : Nat) ->\n              (k : Nat) ->\n              shift c Z k = k\nshiftByZero Z     k     = Refl\nshiftByZero (S c) Z     = Refl\nshiftByZero (S c) (S k) = cong $ shiftByZero c k\n\n\nshiftTermByZero : (c : Nat) ->\n                  (e : Term) ->\n                  shiftTerm c Z e = e\nshiftTermByZero c (TVar i) = congVar $ shiftByZero c i\nshiftTermByZero c (TAbs e) = congAbs $ shiftTermByZero (S c) e\nshiftTermByZero c (TApp e1 e2) = \n  congApp (shiftTermByZero c e1)\n          (shiftTermByZero c e2)\nshiftTermByZero c (TRec e1 e2 e3) = \n  congRec (shiftTermByZero c e1)\n          (shiftTermByZero c e2)\n          (shiftTermByZero c e3)\nshiftTermByZero c TZero = congZero\nshiftTermByZero c (TSucc e) = congSucc $ shiftTermByZero c e\nshiftTermByZero c (TPred e) = congPred $ shiftTermByZero c e\nshiftTermByZero c (TIfz e1 e2 e3) =\n  congIfz (shiftTermByZero c e1)\n          (shiftTermByZero c e2)\n          (shiftTermByZero c e3)\n\n\n\nshiftTwice : (c : Nat) ->\n             (d1 : Nat) -> (d2 : Nat) ->\n             (k : Nat) ->\n             shift c d2 (shift c d1 k) = shift c (d2+d1) k\nshiftTwice Z     d1 d2 k     = plusAssociative d2 d1 k\nshiftTwice (S c) d1 d2 Z     = Refl\nshiftTwice (S c) d1 d2 (S k) = cong $ shiftTwice c d1 d2 k\n\n\nshiftTermTwice : (c : Nat) ->\n                 (d1 : Nat) -> (d2 : Nat) ->\n                 (e : Term) ->\n                 shiftTerm c d2 (shiftTerm c d1 e) = shiftTerm c (d2+d1) e\nshiftTermTwice c d1 d2 (TVar i) = congVar $ shiftTwice c d1 d2 i\nshiftTermTwice c d1 d2 (TAbs e) = congAbs $ shiftTermTwice (S c) d1 d2 e\nshiftTermTwice c d1 d2 (TApp e1 e2) = \n  congApp (shiftTermTwice c d1 d2 e1)\n          (shiftTermTwice c d1 d2 e2)\nshiftTermTwice c d1 d2 (TRec e1 e2 e3) =\n  congRec (shiftTermTwice c d1 d2 e1)\n          (shiftTermTwice c d1 d2 e2)\n          (shiftTermTwice c d1 d2 e3)\nshiftTermTwice c d1 d2 TZero = congZero\nshiftTermTwice c d1 d2 (TSucc e) = congSucc $ shiftTermTwice c d1 d2 e\nshiftTermTwice c d1 d2 (TPred e) = congPred $ shiftTermTwice c d1 d2 e\nshiftTermTwice c d1 d2 (TIfz e1 e2 e3) = \n  congIfz (shiftTermTwice c d1 d2 e1)\n          (shiftTermTwice c d1 d2 e2)\n          (shiftTermTwice c d1 d2 e3)\n\n\nshiftTermTwice' : (c : Nat) ->\n                  (d1 : Nat) -> (d2 : Nat) ->\n                  (e : Term) ->\n                  shiftTerm c d2 (shiftTerm c d1 e) = shiftTerm c d1 (shiftTerm c d2 e)\nshiftTermTwice' c d1 d2 e = \n  let eq1  = shiftTermTwice c d1 d2 e\n      comm = cong {f = \\q => shiftTerm c q e} $ plusCommutative d1 d2 \n      eq1' = trans eq1 (sym comm)\n      eq2  = shiftTermTwice c d2 d1 e\n  in trans eq1' (sym eq2)\n\n\n\nshiftSwap :  (c1 : Nat) -> (d1 : Nat) ->\n             (c2 : Nat) -> (d2 : Nat) ->\n             (k : Nat) ->\n             shift (c1+d1+c2) d2 (shift c1 d1 k) = shift c1 d1 (shift (c1+c2) d2 k)\nshiftSwap Z      Z      c2 d2 k     = Refl\nshiftSwap Z      (S d1) c2 d2 k     = cong $ shiftSwap Z d1 c2 d2 k\nshiftSwap (S c1) d1     c2 d2 Z     = Refl\nshiftSwap (S c1) d1     c2 d2 (S k) = cong $ shiftSwap c1 d1 c2 d2 k\n\n\nshiftTermSwap : (c1 : Nat) -> (d1 : Nat) ->\n                (c2 : Nat) -> (d2 : Nat) ->                \n                (e : Term) ->\n                shiftTerm (c1+d1+c2) d2 (shiftTerm c1 d1 e) = \n                  shiftTerm c1 d1 (shiftTerm (c1+c2) d2 e)\nshiftTermSwap c1 d1 c2 d2 (TVar i) = congVar $ shiftSwap c1 d1 c2 d2 i\nshiftTermSwap c1 d1 c2 d2 (TAbs e) = congAbs $ shiftTermSwap (S c1) d1 c2 d2 e\nshiftTermSwap c1 d1 c2 d2 (TApp e1 e2) = \n  congApp (shiftTermSwap c1 d1 c2 d2 e1)\n          (shiftTermSwap c1 d1 c2 d2 e2)\nshiftTermSwap c1 d1 c2 d2 (TRec e1 e2 e3) =\n  congRec (shiftTermSwap c1 d1 c2 d2 e1)\n          (shiftTermSwap c1 d1 c2 d2 e2)\n          (shiftTermSwap c1 d1 c2 d2 e3)\nshiftTermSwap c1 d1 c2 d2 TZero = congZero\nshiftTermSwap c1 d1 c2 d2 (TSucc e) = congSucc $ shiftTermSwap c1 d1 c2 d2 e\nshiftTermSwap c1 d1 c2 d2 (TPred e) = congPred $ shiftTermSwap c1 d1 c2 d2 e\nshiftTermSwap c1 d1 c2 d2 (TIfz e1 e2 e3) =\n  congIfz (shiftTermSwap c1 d1 c2 d2 e1)\n          (shiftTermSwap c1 d1 c2 d2 e2)\n          (shiftTermSwap c1 d1 c2 d2 e3)\n\n\n\n-- Shifting acts as the identity if the\n-- cutoff is set past the typing context:\nshiftPastCtx : (k : Nat) -> \n               (ctx : Context) ->\n               index' k ctx = Just t ->\n               (n : Nat) -> (d : Nat) ->\n               shift (length ctx + n) d k = k\nshiftPastCtx Z     []       Refl _ _ impossible\nshiftPastCtx (S _) []       Refl _ _ impossible\nshiftPastCtx Z     (s::ctx) prf  n d = Refl\nshiftPastCtx (S k) (s::ctx) prf  n d = \n  cong $ shiftPastCtx k ctx prf n d\n\n\nshiftTermPastCtx : (e : Term) ->\n                   (ctx : Context) -> \n                   Typing ctx e t ->\n                   (n : Nat) -> (d : Nat) ->\n                   shiftTerm (length ctx + n) d e = e\nshiftTermPastCtx (TVar i) ctx (TyVar prf) n d = congVar $ shiftPastCtx i ctx prf n d\nshiftTermPastCtx (TAbs e) ctx (TyAbs s ty) n d = congAbs $ shiftTermPastCtx e (s::ctx) ty n d\nshiftTermPastCtx (TApp e1 e2) ctx (TyApp ty1 ty2) n d = \n  congApp (shiftTermPastCtx e1 ctx ty1 n d)\n          (shiftTermPastCtx e2 ctx ty2 n d)\nshiftTermPastCtx (TRec e1 e2 e3) ctx (TyRec ty1 ty2 ty3) n d =\n  congRec (shiftTermPastCtx e1 ctx ty1 n d)\n          (shiftTermPastCtx e2 ctx ty2 n d)\n          (shiftTermPastCtx e3 ctx ty3 n d)          \nshiftTermPastCtx TZero ctx TyZero n d = congZero\nshiftTermPastCtx (TSucc e) ctx (TySucc ty) n d = congSucc $ shiftTermPastCtx e ctx ty n d\nshiftTermPastCtx (TPred e) ctx (TyPred ty) n d = congPred $ shiftTermPastCtx e ctx ty n d\nshiftTermPastCtx (TIfz e1 e2 e3) ctx (TyIfz ty1 ty2 ty3) n d = \n  congIfz (shiftTermPastCtx e1 ctx ty1 n d)\n          (shiftTermPastCtx e2 ctx ty2 n d)\n          (shiftTermPastCtx e3 ctx ty3 n d)          \n\n-- End: SEVERAL LEMMAS ABOUT SHIFTING\n-------------------------------------\n\n\n\n\n-------------------------------------------\n-- Begin: SHIFTING AND SUBSTITUTION COMMUTE\n\n-- The following lemma is a convoluted way of\n-- expressing 'k < length ctx'; it is used to\n-- address the 'TVar' case in the subsequent\n-- lemma.\nsubstVarPastCtx : (k : Nat) -> \n                  (ctx : Context) ->\n                  index' k ctx = Just t ->\n                  subst_var x (length ctx + n) k = TVar k\nsubstVarPastCtx Z     []       Refl impossible\nsubstVarPastCtx (S _) []       Refl impossible\nsubstVarPastCtx Z     (s::ctx) prf  = Refl\nsubstVarPastCtx (S k) (s::ctx) prf  =\n  let ih = substVarPastCtx k ctx prf\n  in cong {f = \\q => shiftTerm 0 1 q} ih\n\n\n-- Subsituting at a de Bruijn index past the\n-- context 'ctx' in which an expression 'e'\n-- is typed yields 'e':\nsubstPastCtx : (e : Term) -> \n               (ctx : Context) ->\n               Typing ctx e t ->\n               subst x (length ctx + n) e = e\nsubstPastCtx (TVar i) ctx (TyVar prf) = substVarPastCtx i ctx prf\nsubstPastCtx (TAbs e) ctx (TyAbs s ty) = congAbs $ substPastCtx e (s::ctx) ty\nsubstPastCtx (TApp e1 e2) ctx (TyApp ty1 ty2) = \n  congApp (substPastCtx e1 ctx ty1)\n          (substPastCtx e2 ctx ty2)\nsubstPastCtx (TRec e1 e2 e3) ctx (TyRec ty1 ty2 ty3) = \n  congRec (substPastCtx e1 ctx ty1)\n          (substPastCtx e2 ctx ty2)\n          (substPastCtx e3 ctx ty3)\nsubstPastCtx TZero ctx TyZero = congZero\nsubstPastCtx (TSucc e) ctx (TySucc ty) = congSucc $ substPastCtx e ctx ty\nsubstPastCtx (TPred e) ctx (TyPred ty) = congPred $ substPastCtx e ctx ty\nsubstPastCtx (TIfz e1 e2 e3) ctx (TyIfz ty1 ty2 ty3) = \n  congIfz (substPastCtx e1 ctx ty1)\n          (substPastCtx e2 ctx ty2)\n          (substPastCtx e3 ctx ty3)\n\n\n-- A less convoluted way of stating the lemma\n-- that is used in the 'TVar' case above:\nsubstVarPastCtx' : (k : Nat) ->\n                   subst_var x (S k + n) k = TVar k\nsubstVarPastCtx' Z     = Refl\nsubstVarPastCtx' (S k) = let ih = substVarPastCtx' k\n                         in cong {f = \\q => shiftTerm 0 1 q} ih\n\n\n\n-- Shifting and substituting for a variable commute:\nshiftSubstVarComm : (c : Nat) -> (d : Nat) ->  (i : Nat) -> \n                    (x : Term) ->\n                    (k : Nat) ->\n                    shiftTerm c d (subst_var x (c+i) k) = subst_var x (c+d+i) (shift c d k)\n--\nshiftSubstVarComm Z     Z     i x k = shiftTermByZero Z (subst_var x i k)\n--\nshiftSubstVarComm Z     (S d) i x k = \n  let ih  = shiftSubstVarComm Z d i x k\n      ih' = cong {f = \\q => shiftTerm Z (S Z) q} ih\n      eq  = shiftTermTwice Z d (S Z) (subst_var x i k)\n  in trans (sym eq) ih' \n--\nshiftSubstVarComm (S c)  d    i x Z     = Refl\n--\nshiftSubstVarComm (S c)  d    i x (S k) = \n  let ih  = shiftSubstVarComm c d i x k\n      ih' = cong {f = \\q => shiftTerm Z (S Z) q} ih\n      eq  = shiftTermSwap Z (S Z) c d (subst_var x (c+i) k)\n  in trans eq ih'\n\n\n-- Shifting and substituting in a general term 'e' commute:\nshiftTermSubstComm : (c : Nat) -> (d : Nat) -> (i : Nat) -> \n                     (x : Term) ->\n                     (e : Term) ->\n                     shiftTerm c d (subst x (c+i) e) = subst x (c+d+i) (shiftTerm c d e)\n--\nshiftTermSubstComm c d i x (TVar k) = shiftSubstVarComm c d i x k\nshiftTermSubstComm c d i x (TAbs e) = congAbs $ shiftTermSubstComm (S c) d i x e\nshiftTermSubstComm c d i x (TApp e1 e2) = \n  congApp (shiftTermSubstComm c d i x e1)\n          (shiftTermSubstComm c d i x e2)\nshiftTermSubstComm c d i x (TRec e1 e2 e3) = \n  congRec (shiftTermSubstComm c d i x e1)\n          (shiftTermSubstComm c d i x e2)\n          (shiftTermSubstComm c d i x e3)  \nshiftTermSubstComm c d i x TZero = congZero\nshiftTermSubstComm c d i x (TSucc e) = congSucc $ shiftTermSubstComm c d i x e\nshiftTermSubstComm c d i x (TPred e) = congPred $ shiftTermSubstComm c d i x e\nshiftTermSubstComm c d i x (TIfz e1 e2 e3) = \n  congIfz (shiftTermSubstComm c d i x e1)\n          (shiftTermSubstComm c d i x e2)\n          (shiftTermSubstComm c d i x e3)  \n\n-- End: SHIFTING AND SUBSTITUTION COMMUTE\n-----------------------------------------\n\n\n\n\n-----------------------------------\n-- Begin: SWAPPING OF SUBSTITUTIONS\n\n-- Substitution in a shifted variable, below the \n-- cutoff 'c' of the 'shift' operation, preserves\n-- the variable (modulo shifting):\nsubstVarBelowShift : (c : Nat) -> (n : Nat) ->\n                     (k : Nat) ->\n                     (x : Term) ->\n                     subst_var x c (shift c (S n) k) = TVar (shift c n k)\nsubstVarBelowShift Z     n k     x = Refl\nsubstVarBelowShift (S c) n Z     x = Refl\nsubstVarBelowShift (S c) n (S k) x = \n  let ih  = substVarBelowShift c n k x\n  in cong {f = shiftTerm Z (S Z)} ih\n\n\n-- Substitution in a shifted term, below the \n-- cutoff 'c' of the 'shift' operation, preserves\n-- the term (modulo shifting):\nsubstBelowShiftTerm : (c : Nat) -> (n : Nat) ->\n                      (e : Term) ->\n                      (x : Term) ->\n                      subst x c (shiftTerm c (S n) e) = shiftTerm c n e\nsubstBelowShiftTerm c n (TVar i) x = substVarBelowShift c n i x\nsubstBelowShiftTerm c n (TAbs e) x = congAbs $ substBelowShiftTerm (S c) n e x\nsubstBelowShiftTerm c n (TApp e1 e2) x = \n  congApp (substBelowShiftTerm c n e1 x) \n          (substBelowShiftTerm c n e2 x)\nsubstBelowShiftTerm c n (TRec e1 e2 e3) x = \n  congRec (substBelowShiftTerm c n e1 x)\n          (substBelowShiftTerm c n e2 x)\n          (substBelowShiftTerm c n e3 x)\nsubstBelowShiftTerm c n TZero x = Refl\nsubstBelowShiftTerm c n (TSucc e) x = cong $ substBelowShiftTerm c n e x\nsubstBelowShiftTerm c n (TPred e) x = cong $ substBelowShiftTerm c n e x\nsubstBelowShiftTerm c n (TIfz e1 e2 e3) x = \n  congIfz (substBelowShiftTerm c n e1 x)\n          (substBelowShiftTerm c n e2 x)\n          (substBelowShiftTerm c n e3 x)\n\n\n\n\n-- Swapping substitutions in the variable with\n-- de Bruijn index 'k' does not affect the result:\n-- (Note that the typing for 'x' in the empty context\n-- ensures that there are no free variables in 'x',\n-- which could otherwise be affected by the second\n-- substitution of 'y' on the left-hand side of the\n-- equation in the conclusion of the lemma.)\nsubstVarSwap : (k : Nat) -> \n               (i : Nat) ->\n               (x : Term) -> (y : Term) ->\n               (Typing [] x t) ->\n               subst y i (subst_var x i k) = subst x i (subst_var y (S i) k)\n--\nsubstVarSwap Z     Z     x y tyx = substPastCtx x _ tyx {n=0}\n--\nsubstVarSwap Z     (S i) x y tyx = Refl\n--\nsubstVarSwap (S k) Z     x y tyx = \n  case k of\n    Z     => let eq1 = substBelowShiftTerm Z Z y x\n                 eq2 = shiftTermByZero Z y\n             in sym (trans eq1 eq2)\n    (S _) => Refl\n--\nsubstVarSwap (S k) (S i) x y tyx = \n  let ih  = substVarSwap k i x y tyx\n      ih' = cong {f = shiftTerm Z (S Z)} ih\n      eq1 = shiftTermSubstComm Z (S Z) i y (subst_var x i k)\n      eq2 = trans (sym eq1) ih'\n      eq3 = shiftTermSubstComm Z (S Z) i x (subst_var y (S i) k)\n  in trans eq2 eq3\n\n\n-- Swapping the order of two substitutions at adjacent\n-- de Bruijn indices (indices 'i' and 'S i') preserves\n-- the result:\n-- (See the comment immediately before the previous\n-- lemma for an explanation of why the typing of 'x'\n-- in the empty context is needed.)\nsubstSwap : (e : Term) ->\n            (i : Nat) -> \n            (x : Term) -> (y : Term) ->\n            Typing [] x t ->\n            subst y i (subst x i e) = subst x i (subst y (S i) e)\n--\nsubstSwap (TVar k) i x y tyx = substVarSwap k i x y tyx\nsubstSwap (TAbs e) i x y tyx = congAbs $ substSwap e (S i) x y tyx\nsubstSwap (TApp e1 e2) i x y tyx = \n  congApp (substSwap e1 i x y tyx)\n          (substSwap e2 i x y tyx)\nsubstSwap (TRec e1 e2 e3) i x y tyx =\n  congRec (substSwap e1 i x y tyx)\n          (substSwap e2 i x y tyx)\n          (substSwap e3 i x y tyx)\nsubstSwap TZero i x y tyx = Refl\nsubstSwap (TSucc e) i x y tyx = congSucc $ substSwap e i x y tyx\nsubstSwap (TPred e) i x y tyx = congPred $ substSwap e i x y tyx\nsubstSwap (TIfz e1 e2 e3) i x y tyx =\n  congIfz (substSwap e1 i x y tyx)\n          (substSwap e2 i x y tyx)\n          (substSwap e3 i x y tyx)\n\n-- End: SWAPPING OF SUBSTITUTIONS\n---------------------------------\n\n\n\n\n\n\n\n\n\n", "meta": {"hexsha": "01b4d6a37d614d54039f3b8b917ad2d75f3c71cc", "size": 18527, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "totality/src/SubstLemmas.idr", "max_stars_repo_name": "normanrink/PCF", "max_stars_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "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": "totality/src/SubstLemmas.idr", "max_issues_repo_name": "normanrink/PCF", "max_issues_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "totality/src/SubstLemmas.idr", "max_forks_repo_name": "normanrink/PCF", "max_forks_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_forks_repo_licenses": ["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.1150097466, "max_line_length": 93, "alphanum_fraction": 0.5991256005, "num_tokens": 6350, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7718434978390747, "lm_q2_score": 0.6825737473266735, "lm_q1q2_score": 0.5268401086697444}}
{"text": "module Main\n\n%default total\n\n%logging declare.data.parameters 20\n%logging eval.eta 10\n\n\n-- explicit\ndata Value : (value : Nat -> Type) -> Type where\n  EmptyV : {0 value : Nat -> Type} -> Value (\\ n => value n)\n\ndata TValue : Nat -> Type where\n  MkTupleV : Value (\\n => TValue n) -> TValue n\n", "meta": {"hexsha": "ad191b3d264e2f518b3d2106b8488cb972e6cc4f", "size": 291, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/positivity003/Issue660.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/positivity003/Issue660.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/positivity003/Issue660.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.4, "max_line_length": 60, "alphanum_fraction": 0.6426116838, "num_tokens": 84, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7718434873426302, "lm_q2_score": 0.6825737344123242, "lm_q1q2_score": 0.5268400915372905}}
{"text": "module Examples.AuthorityLattice\n\nimport public DepSec.Lattice\n\n%access public export\n%default total\n\ndata Principal : Type where\n  Top : Principal\n  Alice : Principal\n  Bob : Principal\n  Chuck : Principal\n  Bot : Principal\n\nimplementation JoinSemilattice Principal where\n  join Top b = Top\n  join Alice Top =Top\n  join Alice Alice = Alice\n  join Alice Bob = Top\n  join Alice Chuck = Top\n  join Alice Bot = Alice\n  join Bob Top = Top\n  join Bob Alice = Top\n  join Bob Bob = Bob\n  join Bob Chuck = Top\n  join Bob Bot = Bob\n  join Chuck Top = Top\n  join Chuck Alice = Top\n  join Chuck Bob = Top\n  join Chuck Chuck = Chuck\n  join Chuck Bot = Chuck\n  join Bot b = b\n\n  associative Top b c = Refl\n  associative Alice Top c = Refl\n  associative Alice Alice Top = Refl\n  associative Alice Alice Alice = Refl\n  associative Alice Alice Bob = Refl\n  associative Alice Alice Chuck = Refl\n  associative Alice Alice Bot = Refl\n  associative Alice Bob Top = Refl\n  associative Alice Bob Alice = Refl\n  associative Alice Bob Bob = Refl\n  associative Alice Bob Chuck = Refl\n  associative Alice Bob Bot = Refl\n  associative Alice Chuck Top = Refl\n  associative Alice Chuck Alice = Refl\n  associative Alice Chuck Bob = Refl\n  associative Alice Chuck Chuck = Refl\n  associative Alice Chuck Bot = Refl\n  associative Alice Bot c = Refl\n  associative Bob Top c = Refl\n  associative Bob Alice Top = Refl\n  associative Bob Alice Alice = Refl\n  associative Bob Alice Bob = Refl\n  associative Bob Alice Chuck = Refl\n  associative Bob Alice Bot = Refl\n  associative Bob Bob Top = Refl\n  associative Bob Bob Alice = Refl\n  associative Bob Bob Bob = Refl\n  associative Bob Bob Chuck = Refl\n  associative Bob Bob Bot = Refl\n  associative Bob Chuck Top = Refl\n  associative Bob Chuck Alice = Refl\n  associative Bob Chuck Bob = Refl\n  associative Bob Chuck Chuck = Refl\n  associative Bob Chuck Bot = Refl\n  associative Bob Bot c = Refl\n  associative Chuck Top c = Refl\n  associative Chuck Alice Top = Refl\n  associative Chuck Alice Alice = Refl\n  associative Chuck Alice Bob = Refl\n  associative Chuck Alice Chuck = Refl\n  associative Chuck Alice Bot = Refl\n  associative Chuck Bob Top = Refl\n  associative Chuck Bob Alice = Refl\n  associative Chuck Bob Bob = Refl\n  associative Chuck Bob Chuck = Refl\n  associative Chuck Bob Bot = Refl\n  associative Chuck Chuck Top = Refl\n  associative Chuck Chuck Alice = Refl\n  associative Chuck Chuck Bob = Refl\n  associative Chuck Chuck Chuck = Refl\n  associative Chuck Chuck Bot = Refl\n  associative Chuck Bot c = Refl\n  associative Bot b c = Refl\n\n  commutative Top Top = Refl\n  commutative Top Alice = Refl\n  commutative Top Bob = Refl\n  commutative Top Chuck = Refl\n  commutative Top Bot = Refl\n  commutative Alice Top = Refl\n  commutative Alice Alice = Refl\n  commutative Alice Bob = Refl\n  commutative Alice Chuck = Refl\n  commutative Alice Bot = Refl\n  commutative Bob Top = Refl\n  commutative Bob Alice = Refl\n  commutative Bob Bob = Refl\n  commutative Bob Chuck = Refl\n  commutative Bob Bot = Refl\n  commutative Chuck Top = Refl\n  commutative Chuck Alice = Refl\n  commutative Chuck Bob = Refl\n  commutative Chuck Chuck = Refl\n  commutative Chuck Bot = Refl\n  commutative Bot Top = Refl\n  commutative Bot Alice = Refl\n  commutative Bot Bob = Refl\n  commutative Bot Chuck = Refl\n  commutative Bot Bot = Refl\n\n  idempotent Top = Refl\n  idempotent Alice = Refl\n  idempotent Bob = Refl\n  idempotent Chuck = Refl\n  idempotent Bot = Refl\n", "meta": {"hexsha": "80b4d82ede37e577ee582e140488d7090ebc376a", "size": 3447, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Examples/AuthorityLattice.idr", "max_stars_repo_name": "simongregersen/DepSec", "max_stars_repo_head_hexsha": "10e0419acbe690c460df509d0cb9f4690867422c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2019-08-25T15:16:34.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-18T11:10:20.000Z", "max_issues_repo_path": "Examples/AuthorityLattice.idr", "max_issues_repo_name": "simongregersen/DepSec", "max_issues_repo_head_hexsha": "10e0419acbe690c460df509d0cb9f4690867422c", "max_issues_repo_licenses": ["MIT"], "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/AuthorityLattice.idr", "max_forks_repo_name": "simongregersen/DepSec", "max_forks_repo_head_hexsha": "10e0419acbe690c460df509d0cb9f4690867422c", "max_forks_repo_licenses": ["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.9663865546, "max_line_length": 46, "alphanum_fraction": 0.7365825355, "num_tokens": 953, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8887588052782737, "lm_q2_score": 0.5926665999540698, "lm_q1q2_score": 0.5267376593035156}}
{"text": "module Issue1200\n\n%default total\n\nmain : IO ()\nmain = traverse_ printLn $ do\n  f <- [(1/), log, sin, cos, tan, asin, acos, atan, sqrt, floor, ceiling]\n  x <- [-2,-1,-0.5,0,0.5,1,2]\n  pure (f x)\n", "meta": {"hexsha": "438b3c355be242cc40b7bdda4835bd0407e1095a", "size": 194, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/allbackends/evaluator005/Issue1200.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/allbackends/evaluator005/Issue1200.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/allbackends/evaluator005/Issue1200.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 19.4, "max_line_length": 73, "alphanum_fraction": 0.5824742268, "num_tokens": 78, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8128673359709795, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.5265740116734798}}
{"text": "\ndata Zuple : Type where\n    Empty : Zuple    \ndata Monople : Type -> Type where\n    Single : a -> Monople a\ndata Duple : Type -> Type -> Type where\n    Dup : a -> b -> Duple a b \n\nappend : Duple a b -> c -> Duple (Duple a b) c\nappend = Dup\n\n--succTup : Duple a b -> Type -> Type\n--succTup d t = Duple (Duple a b) t\n\n{-\ndata NTuple : (n : Nat) -> Type where\n    Empty : NTuple 0\n    --Singple : (t : Type) -> (x : t) -> NTuple 1\n    NTup : NTuple n -> (t : Type) -> (x : t) -> NTuple (S n)\n  \n  \nimplementation Show (NTuple n) where\n    show Empty = \"()\"\n    show (NTup first thist elem) = (Prelude.Strings.++) (show elem) (show first)\n-}\n{-\nimplementation Show (NTuple 0) where\n    show Empty = \"()\"\n\nimplementation (Show (NTuple n)) => Show (NTuple (S n)) where\n    show (NTup first thist elem) = (Prelude.Strings.++) (show elem) (show first)\n-}\n{-\ninterface IsTuple (t : Nat -> Type) where\n    nextType : t -> (n : Nat) -> t (S n)\n\nimplementation IsTuple (\n-}    \n\nntypes : (n : Nat) -> Type\nntypes Z = Type\nntypes (S n) = Type -> ntypes n\n\n-- uncurry : (n : Nat) -> ntypes n -> Vector n Type\n-- uncurry 2 f \n\nntuple : (n : Nat) -> ntypes n\nntuple Z = Zuple\nntuple (S Z) = \\a => Monople a\nntuple (S (S Z)) = \\a => \\b => Duple a b\n\\a => \\b => \\c => Duple (Duple a b) c\nntuple (S n) = \\c => Duple \n\nlayerTup : Type -> Type -> Type\nlayerTup a b = Duple a b\n\nlayer2Tup : Type -> Type -> Type -> Type\nlayer2Tup a b t = Duple (Duple a b) t\n\nlayer3Tup : Type -> Type -> Type -> Type -> Type\nlayer3Tup a b t1 = Duple (layer2Tup a b t1)\n\nlayerNTup : (n : Nat) -> ntypes (S n)\nlayerNTup (S n) = Duple (layerNTup n)\n\n", "meta": {"hexsha": "8c7ca6268621e3caffaa2ec44aa6025f31a0b303", "size": 1609, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "ntuple.idr", "max_stars_repo_name": "Crazycolorz5/IdrisExplorations", "max_stars_repo_head_hexsha": "af851f62783a9bad196f9e45764f5ed23805d3a1", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ntuple.idr", "max_issues_repo_name": "Crazycolorz5/IdrisExplorations", "max_issues_repo_head_hexsha": "af851f62783a9bad196f9e45764f5ed23805d3a1", "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": "ntuple.idr", "max_forks_repo_name": "Crazycolorz5/IdrisExplorations", "max_forks_repo_head_hexsha": "af851f62783a9bad196f9e45764f5ed23805d3a1", "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": 24.3787878788, "max_line_length": 80, "alphanum_fraction": 0.577377253, "num_tokens": 587, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673269042767, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.526574005800086}}
{"text": "||| Algebra: The interface to the modules of 'algebra': a representation of\n||| several basic algebraic structures (e.g., groups, rings, vector spaces) as\n||| Idris datatypes (axioms fully enforced).\n|||\n||| Mathematically, the idea of an algebraic structure is quite simple. Consider\n||| (a) the set of integers \\\\(\\mathbb{Z}\\\\), (b) two of the most basic\n||| functions on it, \\\\(+: \\mathbb{Z}^2 \\to \\mathbb{Z} \\\\) and\n||| \\\\(\\cdot: \\mathbb{Z}^2 \\to \\mathbb{Z}\\\\), and (c) two unique elements of it,\n||| \\\\(0\\\\) and \\\\(1\\\\). There are various obvious properties that universally\n||| hold; e.g.:\n|||\n||| * \\\\(x+(y+z) = (x+y)+z\\\\), and \\\\(x\\cdot (y\\cdot z) = (x\\cdot y) \\cdot z\\\\)\n||| * \\\\(x+y= y+x\\\\), and \\\\(x\\cdot y = y \\cdot x\\\\)\n||| * \\\\(x+0 = x \\cdot 1 = x \\\\)\n||| * \\\\(\\exists~y\\in \\mathbb{Z} [ x+y = 0 ]\\\\)\n||| * \\\\(x \\cdot (y+z) = x \\cdot y + x \\cdot z\\\\)\n|||\n||| (Unquantified variables are implicitly quantified over the domain of\n||| discourse, \\\\(\\mathbb{Z}\\\\).) These properties are referred to,\n||| respectively, as **associativity**, **commutativity**, **identities**,\n||| **additive inverses**, and **dsitributivity of (multiplication over\n||| addition)**. There are various things to note. Plenty of other sets satisfy\n||| these laws; for example, the rational numbers, or the real numbers, or the\n||| complex numbers. Note also that, say, the irrational numbers do *not*\n||| satisfy these properties; \\\\(pi + (1-\\pi)\\\\) is rational, and so \\\\(+\\\\)\n||| isn't even a binary function over the irrationals! Finally, note the\n||| asymmetry in the fourth law, an asymmetry not present in the others. This is\n||| necessary, as the following property (referred to as **multiplicative\n||| inverses**) does *not* hold:\n|||\n||| * \\\\(\\exists y \\in \\mathbb{Z} [ x \\cdot y = 1 ]\\\\)\n|||\n||| While \\\\(2\\\\), for example, *does* have a multiplicative inverse among the\n||| *rationals*, it doesn't when we restrict our attention to the integers. (In\n||| fact, not even the rational numbers satisfy the above law, because \\\\(0\\\\)\n||| does not have a multiplicative inverse. After modifying the law to account\n||| for that special case, however, the rationals do satisfy it, while the\n||| integers still don't.)\n|||\n||| So, was the point of all this? All we did was consider some numbers that\n||| everyone is familiar with and mention some elementary properties of them.\n||| How does that lead to any interesting mathematical questions? Well, the key\n||| idea, the crucial motivating question of abstract algebra, is the following:\n|||\n||| __*What happens when we go in the other direction?*__\n|||\n||| That is, what happens when we *start* with a list of properties, then ask\n||| what sorts of things satisfy it? The answers to this question are more\n||| diverse than you may expect. For example, in addition to the integers and\n||| its extensions, other more esoteric sets satisfy the above laws. E.g., the\n||| set of integers modulo five, \\\\(\\mathbb{Z}\\_5 = \\left\\\\{\\overline{0},\n||| \\overline{1}, \\overline{2}, \\overline{3}, \\overline{4}\\right\\\\}\\\\). In the\n||| set, to calculate the \\\"sum\\\" of two elements, we calculate their usual sum,\n||| then take that modulo 5 (that is, the remainder when dividing by 5; the\n||| modulo operation is essentially a generalization of the concept of even and\n||| odd numbers to divisibilities other than by 2); similarly with the product.\n||| Thus, for example, \\\\(\\overline{4} + \\overline{3} = \\overline{2}\\\\). A\n||| similar line of reasoning indicates that additive inverses exist\\-\\-\\-in\n||| fact, so do multiplicative inverses, at least for non-\\\\(0\\\\) elements!\n||| Observe:\n|||\n||| * \\\\(\\overline{1} \\cdot \\overline{1} = \\overline{1}\\\\)\n||| * \\\\(\\overline{2} \\cdot \\overline{3} = \\overline{1}\\\\)\n||| * \\\\(\\overline{3} \\cdot \\overline{2} = \\overline{1}\\\\)\n||| * \\\\(\\overline{4} \\cdot \\overline{4} = \\overline{1}\\\\)\n|||\n||| However, if we look at the integers modulo 6 (\\\\(\\mathbb{Z}\\_6\\\\)), we find\n||| that multiplicative inverses do *not* always exist; only \\\\(\\overline{1}\\\\)\n||| and \\\\(\\overline\\{\\-1} = \\overline{5}\\\\) are invertible. (Try it!) In fact,\n||| the integers modulo n, \\\\(\\mathbb{Z}\\_n\\\\), satisfy the weakened (i.e.,\n||| ignoring \\\\(0\\\\)) multiplicative inverse law if and only if \\\\(n\\\\) is\n||| prime.\n|||\n||| These do not exhaust the possibilities\\-\\-\\-not even close!\\-\\-\\-but it should\n||| be enough to give a taste of what abstract algebra is all about. You start\n||| with some set with defined operations (a pairing known as a \\\"structure\\\")\n||| that you are familiar with, you distill that structure down to its most\n||| basic and fundamental properties, and then you look at what sorts of things\n||| satisfy those properties and what those properties alone entail. This allows\n||| you to generalize familiar structures to more abstract ideas\\-\\-\\-the\n||| original motivating structure becomes just a special case of a more general\n||| property, and seemingly disparate things suddenly become two special cases\n||| of a more general idea.\n|||\n||| Note that in the process of generalization, we choose to \\\"forget\\\" any\n||| auxiliary properties of the motivating structure. That is, the set of\n||| objects, the binary functions \\\\(+\\\\) and \\\\(\\cdot\\\\), and the privilleged\n||| elements \\\\(0\\\\) and \\\\(1\\\\), are not necessarily numbers, addition,\n||| multiplication, zero, or one (respectively)! They can be any mathematical\n||| object (that is, any concept that can be precisely defined) satisfying the\n||| list of properties above. In other words, they are *like* numbers with\n||| respect to the most basic qualities of them, but they may in fact be\n||| completely different!\n|||\n||| Thus, using the axioms as a starting point, one can ask which properties are\n||| entailed by them, and which properties will differ between different\n||| implementations of the axioms. What are the necessary and sufficient\n||| conditions for various additional facts? E.g., does it follow from the laws\n||| above that every element has a unique factorization? Among the motivating\n||| structure of the integers this was true (a fact known as the Fundamental\n||| Theorem of Arithmetic); in general, though, it is false! The question then\n||| becomes how to further classify the space of implementations\\-\\-\\-what's the\n||| simplest way to divide those that do always admit a unique factorization and\n||| those that don't? These are the kinds of questions that the framework of\n||| algebraic structures allows you to ask.\n|||\n||| The laws given above define a ring; that is, any set (with the two defined\n||| binary operations over it, as well as the two distinguished elements (which\n||| can be thought of as nullary operations for uniformity)) satisfying the\n||| above list of properties is known as a __ring__. The laws are called the\n||| __ring axioms__. __Ring theory__ is the branch of math studying rings, how\n||| they relate to each other (namely, via __ring homomorphisms__), and how they\n||| relate to other mathematical objects. Rings are not the only algebraic\n||| structure; there are many, many more, and this package defines a few of the\n||| more important ones as Idris records, as well as some members of that type.\n||| Each module contains in its documentation an overview of that algebraic\n||| structure and some interesting properties of them that make them worth\n||| studying.\n|||\n||| To create a term of an algebraic structure's type, one must not only provide\n||| the sets and operations with the proper signatures, but also provide proofs\n||| of the axioms of that algebraic structure. To see how this works, you might\n||| want to take a look at `Algebra.Group`.\nmodule Algebra\n\nimport Algebra.Magma\n\n%default total\n\n||| If one attempts to define both the Question and the Answer, the project will\n||| fail to typecheck.\nexport\nAnswer : Integer\nAnswer = 42\n", "meta": {"hexsha": "e4a425010c372b28b48376ff8fa3d99d99a98fb6", "size": 7829, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Algebra.idr", "max_stars_repo_name": "greatBigDot/algebra", "max_stars_repo_head_hexsha": "87ba6c9672d81dc60c9da14a3b08cc548a25c228", "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/Algebra.idr", "max_issues_repo_name": "greatBigDot/algebra", "max_issues_repo_head_hexsha": "87ba6c9672d81dc60c9da14a3b08cc548a25c228", "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/Algebra.idr", "max_forks_repo_name": "greatBigDot/algebra", "max_forks_repo_head_hexsha": "87ba6c9672d81dc60c9da14a3b08cc548a25c228", "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": 57.9925925926, "max_line_length": 82, "alphanum_fraction": 0.6981734577, "num_tokens": 2151, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6477982179521105, "lm_q2_score": 0.8128673133042217, "lm_q1q2_score": 0.5265739969899946}}
{"text": "||| Here we present the syntax for our global types.\n||| Global Types present a top-level view of the protocol.\n|||\n||| We are inspired from the Tech Report 'A Linear Decomposition of Multiparty Sessions for Safe Distributed Programming' (DTRS12-2).\n||| The author's note that sending and receiving are special cases of choice.\n|||\n|||\nmodule Sessions.Global\n\nimport Decidable.Equality\nimport Data.List\nimport Data.List.Elem\n\nimport Data.List1\n\nimport Sessions.Meta\n\n%default total\n\n\npublic export\ndata Global : (role, label, msg : Type)\n           -> (rvars : List Ty)\n           -> (type  : Ty)\n                   -> Type\n  where\n    End : Global typeR typeL typeM rs G\n\n    Call : Elem R rs -> Global typeR typeL typeM rs R\n\n    Rec : Global typeR typeL typeM (R::rs) R\n       -> Global typeR typeL typeM     rs  R\n\n    Choice : (sender, receiver : typeR)\n          -> (prf              : Not (sender = receiver))\n          -> (choices          : List1 (typeL, typeM, Global typeR typeL typeM rs g))\n                              -> Global typeR typeL typeM rs g\n\npublic export\nBranch : (role, label, msg : Type)\n      -> (rvars : List Ty)\n      -> (type  : Ty)\n               -> Type\nBranch role label msg rvars type\n  = (label, msg, Global role label msg rvars type)\n\npublic export\nBranches : (role, label, msg : Type)\n        -> (rvars : List Ty)\n        -> (type  : Ty)\n                 -> Type\nBranches role label msg rvars type\n  = List1 (Branch role label msg rvars type)\n\npublic export\nBranches' : (role, label, msg : Type)\n         -> (rvars : List Ty)\n         -> (type  : Ty)\n                  -> Type\nBranches' role label msg rvars type\n  = List (Branch role label msg rvars type)\n\n-- [ EOF ]\n", "meta": {"hexsha": "1b8661b3d0505c797a39a2399546c846e4784244", "size": 1708, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Sessions/Global.idr", "max_stars_repo_name": "DSbD-AppControl/sessions-playground", "max_stars_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-08-19T13:13:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-19T13:13:10.000Z", "max_issues_repo_path": "Sessions/Global.idr", "max_issues_repo_name": "DSbD-AppControl/sessions-playground", "max_issues_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Sessions/Global.idr", "max_forks_repo_name": "DSbD-AppControl/sessions-playground", "max_forks_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.6875, "max_line_length": 133, "alphanum_fraction": 0.5954332553, "num_tokens": 450, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8311430562234878, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.5264545423965253}}
{"text": "module Package\n\ndata Version : Type where\n  V : (major : Nat) -> (minor : Nat) -> (patch : Nat) -> Version\n\nEq Version where\n  (V a b c) == (V a' b' c') = (a == a') && (b == b') && (c == c')\n\nOrd Version where\n  compare (V a b c) (V a' b' c') = if a > a' then GT else\n                                   if a == a' && b > b' then GT else\n                                   if a == a' && b == b' && c > c' then GT else\n                                   if a == a' && b == b' && c == c' then EQ else LT\n\nShow Version where\n  show (V a b c) = \"version \" ++ show a ++ \".\" ++ show b ++ \".\" ++ show c\n\ndata PkgConstraint : Type where\n  Any     : PkgConstraint\n  Up      : Version -> PkgConstraint\n  Down    : Version -> PkgConstraint\n  Exactly : Version -> PkgConstraint\n  Between : Version -> Version -> PkgConstraint\n\nShow PkgConstraint where\n  show Any           = \"\"\n  show (Up v)        = \"(>= \" ++ show v ++ \")\"\n  show (Down v)      = \"(<= \" ++ show v ++ \")\"\n  show (Exactly v)   = \"(= \" ++ show v ++ \")\"\n  show (Between v w) = \"(>= \" ++ show v ++ \", <=\" ++ show w ++ \")\"\n\ninRange : Version -> PkgConstraint -> Bool\ninRange v Any           = True\ninRange v (Up w)        = v >= w\ninRange v (Down w)      = v <= w\ninRange v (Exactly w)   = v == w\ninRange v (Between w x) = w <= v && v <= x\n\ndata Dep : Type where\n  Dependency : String -> PkgConstraint -> List Dep -> Dep\n\nShow Dep where\n  show (Dependency s v xs) = \"Package \" ++ s ++ \" \" ++ show v\n\n[depverbose] Show Dep where\n  show (Dependency s v xs) = \"Package \" ++ s ++ \" \" ++ show v ++ \" depends on: \" ++ show xs\n\ndata Hash = None\n          | Md5 String\n          | Sha1 String\n          | Blake2 String\n\nrecord Pkg where\n  constructor Package\n  pname : String\n  version : Version\n  compile, install, uninstall : String\n  src : String\n  hash : Hash\n  deps : List Dep -- Should packages still store their dependencies?\n\nEq Pkg where\n  p == p' = pname p == pname p' && version p == version p'\n\nOrd Pkg where\n  compare p p' = if pname p > pname p' then GT else\n                 if pname p < pname p' then LT else\n                 if version p > version p' then GT else\n                 if version p < version p' then LT else EQ\n\nShow Pkg where\n  show p = \"Package \" ++ pname p ++ \" \" ++ (show $ version p)\n\n[pkgverbose] Show Pkg where\n  show p = \"Package \" ++ pname p ++ \" \" ++ (show $ version p) ++ \" depends on: \" ++ show (deps p)\n\nqueryPkg : String -> PkgConstraint -> List Pkg -> Maybe Pkg\nqueryPkg query constraint srcs = head' matches\n  where matches = filter (\\pkg => pname pkg == query && inRange (version pkg) constraint) $ reverse $ sort srcs -- This is slow, will bottleneck\n", "meta": {"hexsha": "2d7ed45ca91c51184fbf5c944a78454bfd4d051f", "size": 2639, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Package.idr", "max_stars_repo_name": "nv-vn/Anvil", "max_stars_repo_head_hexsha": "751b3eb5399e40c88c7e6f2e3850523564f83876", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-08-15T17:01:49.000Z", "max_stars_repo_stars_event_max_datetime": "2016-09-13T01:48:11.000Z", "max_issues_repo_path": "src/Package.idr", "max_issues_repo_name": "nv-vn/Anvil", "max_issues_repo_head_hexsha": "751b3eb5399e40c88c7e6f2e3850523564f83876", "max_issues_repo_licenses": ["MIT"], "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/Package.idr", "max_forks_repo_name": "nv-vn/Anvil", "max_forks_repo_head_hexsha": "751b3eb5399e40c88c7e6f2e3850523564f83876", "max_forks_repo_licenses": ["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.9875, "max_line_length": 144, "alphanum_fraction": 0.5365668814, "num_tokens": 772, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8311430645886584, "lm_q2_score": 0.6334102498375401, "lm_q1q2_score": 0.5264545361918409}}
{"text": "module VectFilter\n\nimport Data.Vect\n\nfilter' : (a -> Bool) -> Vect n a -> (m ** Vect m a)\nfilter' pred [] = (0 ** [])\nfilter' pred (x :: xs) =\n  let (_ ** rek) = filter' pred xs\n  in if pred x then (_ ** x::rek) else (_ ** rek)\n\nbeispiel : (m ** Vect m Integer)\nbeispiel = filter' (\\x => (x `mod` 2) == 0) [1,2,3,4,5,6,7,8,9,10]\n", "meta": {"hexsha": "2c8bc12aa785ac514bf178bf78a7e4ee73f510b9", "size": 329, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Beispiele/VectFilter.idr", "max_stars_repo_name": "CarstenKoenig/DOS2016_IdrisWorkshop", "max_stars_repo_head_hexsha": "f329b584e5ae434f0c52564bf75710070cc247da", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2016-10-14T07:30:59.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-15T09:50:24.000Z", "max_issues_repo_path": "Beispiele/VectFilter.idr", "max_issues_repo_name": "CarstenKoenig/DOS2016_IdrisWorkshop", "max_issues_repo_head_hexsha": "f329b584e5ae434f0c52564bf75710070cc247da", "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": "Beispiele/VectFilter.idr", "max_forks_repo_name": "CarstenKoenig/DOS2016_IdrisWorkshop", "max_forks_repo_head_hexsha": "f329b584e5ae434f0c52564bf75710070cc247da", "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": 25.3076923077, "max_line_length": 66, "alphanum_fraction": 0.5349544073, "num_tokens": 127, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8080672135527632, "lm_q2_score": 0.6513548714339145, "lm_q1q2_score": 0.5263385159936216}}
{"text": "-- exercises in \"Type-Driven Development with Idris\"\n-- chapter 13, section 1\n\n-- check that all functions are total\n%default total\n\nnamespace exercise1\n\n  data DoorState = DoorClosed |\u00a0DoorOpen\n\n  data DoorCmd : Type ->\n                 DoorState ->\n                 DoorState ->\n                 Type where\n    Open :     DoorCmd ()       DoorClosed DoorOpen\n    Close :    DoorCmd ()       DoorOpen   DoorClosed\n    RingBell : DoorCmd ()       state      state\n    Pure :     ty -> DoorCmd ty state      state\n    (>>=) :    DoorCmd a        state1     state2 ->\n               (a -> DoorCmd b  state2     state3) ->\n               DoorCmd b        state1     state3\n\n  doorProg : DoorCmd () DoorClosed DoorClosed\n  doorProg = do RingBell\n                Open\n                RingBell\n                Close\n\nnamespace exercise2\n\n  data GuessCmd : Type -> Nat -> Nat -> Type where\n    Try : Integer -> GuessCmd Ordering (S k) (k)\n    Pure : ty -> GuessCmd ty state state\n    (>>=) : GuessCmd a state1 state2 ->\n            (a -> GuessCmd b state2 state3) ->\n            GuessCmd b state1 state3\n\n  threeGuesses : GuessCmd () 3 0\n  threeGuesses = do Try 10\n                    Try 20\n                    Try 15\n                    Pure ()\n\n  -- noGuesses : GuessCmd () 0 0\n  -- noGuesses = do Try 10\n  --                Pure ()\n\nnamespace exercise3\n\n  data Matter = Solid | Liquid | Gas\n\n  data MatterCmd : Type -> Matter -> Matter -> Type where\n    Melt :     MatterCmd () Solid Liquid\n    Boil :     MatterCmd () Liquid Gas\n    Condense : MatterCmd () Gas Liquid\n    Freeze :   MatterCmd () Liquid Solid\n    Pure : ty -> MatterCmd ty state state\n    (>>=) : MatterCmd a state1 state2 ->\n            (a -> MatterCmd b state2 state3) ->\n            MatterCmd b state1 state3\n\n  iceSteam : MatterCmd () Solid Gas\n  iceSteam = do Melt\n                Boil\n\n  steamIce : MatterCmd () Gas Solid\n  steamIce = do Condense\n                Freeze\n\n  -- overMelt : MatterCmd () Solid Gas\n  -- overMelt = do Melt\n  --               Melt\n", "meta": {"hexsha": "9c7c3e61f2ccef2259ae64ca4b547582c8774f09", "size": 2028, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter13/exercises_1.idr", "max_stars_repo_name": "pascalpoizat/idris-book", "max_stars_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-08-16T00:58:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T01:07:37.000Z", "max_issues_repo_path": "chapter13/exercises_1.idr", "max_issues_repo_name": "pascalpoizat/idris-book", "max_issues_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "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": "chapter13/exercises_1.idr", "max_forks_repo_name": "pascalpoizat/idris-book", "max_forks_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-23T03:15:39.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-23T03:15:39.000Z", "avg_line_length": 27.7808219178, "max_line_length": 57, "alphanum_fraction": 0.541913215, "num_tokens": 528, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.752012562644147, "lm_q2_score": 0.6992544273261175, "lm_q1q2_score": 0.525848113833779}}
{"text": "import Data.List\nimport Data.List1\nimport Data.String\n\nimport System.File\n\nfuel : List Int -> Int -> Int\nfuel [] y = 0\nfuel (x :: xs) y = abs (x - y) + fuel xs y\n\nrun : String -> IO ()\nrun s = do let l = catMaybes $ parseInteger {a=Int} <$> (forget $ split (== ',') s)\n           let u = (\\(c ::: _) => c) <$> (group $ sort $ l)\n           let fs = head' $ sort $ fuel l <$> u\n           putStrLn $ show fs\n\nmain : IO ()\nmain = do Right s <- readFile \"input.txt\"\n            | Left err => putStrLn $ show err\n          run s\n\n", "meta": {"hexsha": "a4a04a099ee3bea288374eec1bf71ddace6c4d0d", "size": 526, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "07/main.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "07/main.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "07/main.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.9090909091, "max_line_length": 83, "alphanum_fraction": 0.5171102662, "num_tokens": 156, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7981867873410141, "lm_q2_score": 0.658417500561683, "lm_q1q2_score": 0.5255401495024301}}
{"text": "import InfList\n\ntotal\ngetPrefix : (count : Nat) -> InfList ty -> List ty\ngetPrefix Z xs = []\ngetPrefix (S k) (value :: xs) = value :: getPrefix k xs\n", "meta": {"hexsha": "628ff6b099a81e2ae995abd6ffe76b408acb8487", "size": 149, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter-11/get_prefix.idr", "max_stars_repo_name": "tekerson/type-driven-development", "max_stars_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-23T04:46:42.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-23T04:46:42.000Z", "max_issues_repo_path": "Chapter-11/get_prefix.idr", "max_issues_repo_name": "tekerson/type-driven-development", "max_issues_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter-11/get_prefix.idr", "max_forks_repo_name": "tekerson/type-driven-development", "max_forks_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_forks_repo_licenses": ["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.2857142857, "max_line_length": 55, "alphanum_fraction": 0.6510067114, "num_tokens": 47, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7981867777396211, "lm_q2_score": 0.658417487156366, "lm_q1q2_score": 0.5255401324807581}}
{"text": "module HOF\n\n%default total\n\ntwice : (a -> a) -> a -> a\ntwice f x = f (f x)\n\nShape : Type\nrotate : Shape -> Shape\n\ndouble : Num ty => ty -> ty\ndouble x = x + x\n\nquadruple : Num ty => ty -> ty\nquadruple = twice double\n\nturnAround : Shape -> Shape\nturnAround = twice rotate\n", "meta": {"hexsha": "b57f1b9622d5b4fe4928f40b11173d3cc7df761e", "size": 271, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter2/HOF.idr", "max_stars_repo_name": "timmyjose-study/tdd-with-idris", "max_stars_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "max_stars_repo_licenses": ["Unlicense"], "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/HOF.idr", "max_issues_repo_name": "timmyjose-study/tdd-with-idris", "max_issues_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": "chapter2/HOF.idr", "max_forks_repo_name": "timmyjose-study/tdd-with-idris", "max_forks_repo_head_hexsha": "be2cd6fc4bbcd58cb4e14ed1e22c9cc99aade4d0", "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": 14.2631578947, "max_line_length": 30, "alphanum_fraction": 0.6199261993, "num_tokens": 88, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7549149758396752, "lm_q2_score": 0.6959583250334526, "lm_q1q2_score": 0.5253893621280497}}
{"text": "module Toolkit.Data.List.Occurs.Does\n\nimport Decidable.Equality\n\nimport Data.Nat\n\nimport Toolkit.Decidable.Informative\n\nimport public Toolkit.Data.List.Occurs.Error\n\n\n%default total\n\nnamespace Exactly\n  public export\n  data Occurs : (type : Type)\n             -> (p    : type -> Type)\n             -> (xs   : List type)\n             -> (cy   : Nat)\n                     -> Type\n    where\n      End : Occurs type p Nil Z\n\n      Yes : (holds : p x)\n         -> (rest  : Occurs type p     xs     cy)\n                  -> Occurs type p (x::xs) (S cy)\n\n      No : (nope : Not (p x))\n        -> (rest : Occurs type p     xs  cy)\n                -> Occurs type p (x::xs) cy\n\n  export\n  Uninhabited (Occurs type p Nil (S x)) where\n    uninhabited End impossible\n    uninhabited (Yes holds rest) impossible\n    uninhabited (No nope rest) impossible\n\n  namespace Check\n    shouldHaveOneMore : (p x)\n                     -> (Occurs type p       xs     k  -> Void)\n                     ->  Occurs type p (x :: xs) (S k) -> Void\n    shouldHaveOneMore prf f (Yes holds rest) = f rest\n    shouldHaveOneMore prf f (No nope rest) = nope prf\n\n    wrongOccurs : (Occurs type p       xs  cy -> Void)\n               -> (p x -> Void)\n               ->  Occurs type p (x :: xs) cy -> Void\n    wrongOccurs f g (Yes holds rest) = g holds\n    wrongOccurs f g (No nope rest) = f rest\n\n    namespace Exactly\n      export\n      occurs : {type : Type}\n            -> {p    : type -> Type}\n            -> (f    : (this : type) -> Dec (p this))\n            -> (xs   : List type)\n            -> (cy   : Nat)\n                    -> DecInfo Occurs.Error\n                               (Occurs type p xs cy)\n      occurs f [] Z\n        = Yes End\n\n      occurs f [] (S k)\n        = No (MkError (S k) Z) absurd\n\n      occurs f (x :: xs) cy with (f x)\n        occurs f (x :: xs) cy | (Yes prf) with (cy)\n          occurs f (x :: xs) cy | (Yes prf) | Z\n            = No (MkError Z 1)\n                 (\\(No f x) => f prf)\n\n          occurs f (x :: xs) cy | (Yes prf) | (S k) with (occurs f xs k)\n            occurs f (x :: xs) cy | (Yes prf) | (S k) | (Yes y)\n              = Yes (Yes prf y)\n\n            occurs f (x :: xs) cy | (Yes prf) | (S k) | (No msg contra)\n              = No (MkError (S k) (S $ found msg))\n                   (shouldHaveOneMore prf contra)\n\n        occurs f (x :: xs) cy | (No contra) with (occurs f xs cy)\n          occurs f (x :: xs) cy | (No contra) | (Yes prf)\n            = Yes (No contra prf)\n\n          occurs f (x :: xs) cy | (No contra) | (No msg g)\n            = No (MkError cy (found msg))\n                 (wrongOccurs g contra)\n\n  namespace Discover\n\n    namespace Exactly\n      export\n      occurs : {type : Type}\n            -> {p    : type -> Type}\n            -> (f    : (this : type) -> Dec (p this))\n            -> (xs   : List type)\n                    -> DPair Nat (Occurs type p xs)\n      occurs f []\n        = MkDPair 0 End\n      occurs f (x :: xs) with (f x)\n        occurs f (x :: xs) | (Yes prf) with (Discover.Exactly.occurs f xs)\n          occurs f (x :: xs) | (Yes prf) | (MkDPair fst snd)\n            = MkDPair (S fst) (Yes prf snd)\n        occurs f (x :: xs) | (No contra) with (Discover.Exactly.occurs f xs)\n          occurs f (x :: xs) | (No contra) | (MkDPair fst snd)\n            = MkDPair fst (No contra snd)\n\nnamespace AtLeast\n\n  public export\n  data Occurs : (type : Type)\n             -> (p    : type -> Type)\n             -> (xs   : List type)\n             -> (ym   : Nat)\n                     -> Type\n    where\n      EndY : (holds : p x) -> AtLeast.Occurs type p (x::xs) (S Z)\n\n      Yes : (holds : p x)\n         -> (rest  : AtLeast.Occurs type p     xs     cy)\n                  -> AtLeast.Occurs type p (x::xs) (S cy)\n\n      No : (nope : Not (p x))\n        -> (rest : AtLeast.Occurs type p     xs  (S cy))\n                -> AtLeast.Occurs type p (x::xs) (S cy)\n\n  export\n  Uninhabited (AtLeast.Occurs type p Nil (S x)) where\n    uninhabited (EndY holds) impossible\n    uninhabited (Yes holds rest) impossible\n    uninhabited (No nope rest) impossible\n\n  export\n  Uninhabited (AtLeast.Occurs type p xs Z) where\n    uninhabited (EndY holds) impossible\n    uninhabited (Yes holds rest) impossible\n    uninhabited (No nope rest) impossible\n\n  namespace Check\n\n    namespace AtLeast\n\n\n      shouldBeAtLeastOne : (AtLeast.Occurs type p       xs 1 -> Void)\n                        -> (p x -> Void)\n                        ->  AtLeast.Occurs type p (x :: xs) 1 -> Void\n      shouldBeAtLeastOne f g (EndY holds) = g holds\n      shouldBeAtLeastOne f g (Yes holds rest) = g holds\n      shouldBeAtLeastOne f g (No nope rest) = f rest\n\n      shouldBeAtLeastOneMore : (AtLeast.Occurs type p    xs        (S k)  -> Void)\n                            -> p x\n                            ->  AtLeast.Occurs type p (x :: xs) (S (S k)) -> Void\n      shouldBeAtLeastOneMore f y (Yes holds rest) = f rest\n      shouldBeAtLeastOneMore f y (No nope rest) = nope y\n\n      shouldBeAtLeastN : (AtLeast.Occurs type p       xs  (S (S k)) -> Void)\n                      -> (p x -> Void)\n                      ->  AtLeast.Occurs type p (x :: xs) (S (S k)) -> Void\n      shouldBeAtLeastN f g (Yes holds rest) = g holds\n      shouldBeAtLeastN f g (No nope rest) = f rest\n\n      export\n      occurs : {type : Type}\n            -> {p    : type -> Type}\n            -> (f    : (this : type) -> Dec (p this))\n            -> (xs   : List type)\n            -> (cy   : Nat)\n                    -> DecInfo (Maybe Occurs.Error)\n                               (AtLeast.Occurs type p xs cy)\n      occurs f xs 0\n        = No Nothing absurd\n\n      occurs f [] (S k)\n        = No (Just (MkError (S k) Z))\n             absurd\n\n      occurs f (x :: xs) (S 0) with (f x)\n        occurs f (x :: xs) (S 0) | (Yes prf)\n          = Yes (EndY prf)\n\n        occurs f (x :: xs) (S 0) | (No contra) with (AtLeast.occurs f xs (S 0))\n          occurs f (x :: xs) (S 0) | (No contra) | (Yes prfWhy)\n            = Yes (No contra prfWhy)\n\n          occurs f (x :: xs) (S 0) | (No contra) | (No msgWhyNot prfWhyNot)\n            = No (map ({ expected := 1}) msgWhyNot)\n                 (shouldBeAtLeastOne prfWhyNot contra)\n\n      occurs f (x :: xs) (S (S k)) with (f x)\n        occurs f (x :: xs) (S (S k)) | (Yes prf) with (AtLeast.occurs f xs (S k))\n          occurs f (x :: xs) (S (S k)) | (Yes prf) | (Yes prfWhy)\n            = Yes (Yes prf prfWhy)\n\n          occurs f (x :: xs) (S (S k)) | (Yes prf) | (No msgWhyNot prfWhyNot)\n            = No (map ({ expected := S (S k), found $= S}) msgWhyNot)\n                 (shouldBeAtLeastOneMore prfWhyNot prf)\n\n        occurs f (x :: xs) (S (S k)) | (No contra) with (AtLeast.occurs f xs (S (S k)))\n          occurs f (x :: xs) (S (S k)) | (No contra) | (Yes prfWhy)\n            = Yes (No contra prfWhy)\n\n          occurs f (x :: xs) (S (S k)) | (No contra) | (No msgWhyNot prfWhyNot)\n            = No (map ({ expected := S (S k)}) msgWhyNot)\n                 (shouldBeAtLeastN prfWhyNot contra)\n\n-- [ EOF ]\n", "meta": {"hexsha": "79a5d6abf48835e2f74bc37978592282208566ea", "size": 7021, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Toolkit/Data/List/Occurs/Does.idr", "max_stars_repo_name": "gallais/linear-circuits", "max_stars_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2021-11-29T17:20:04.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-10T21:41:44.000Z", "max_issues_repo_path": "src/Toolkit/Data/List/Occurs/Does.idr", "max_issues_repo_name": "gallais/linear-circuits", "max_issues_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "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/Toolkit/Data/List/Occurs/Does.idr", "max_forks_repo_name": "gallais/linear-circuits", "max_forks_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-02-09T19:49:11.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-09T19:49:11.000Z", "avg_line_length": 33.9178743961, "max_line_length": 87, "alphanum_fraction": 0.4834069221, "num_tokens": 2131, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7310585669110202, "lm_q2_score": 0.718594386544335, "lm_q1q2_score": 0.5253345824174053}}
{"text": "> module NonNegDouble.Postulates\n\n> import NonNegDouble.Properties\n> import Double.Predicates\n> import Double.Properties\n> import NonNegDouble.NonNegDouble\n> import NonNegDouble.BasicOperations\n> import NonNegDouble.Operations\n> import NonNegDouble.Properties\n> import List.Operations\n\n\n> %default total\n> %access public export\n\n\n* Properties of sums of products:\n\n> using implementation NumNonNegDouble\n>   |||\n>   postulate \n>   mapIdRightMultPreservesPositivity : \n>     {A : Type} ->\n>     (axs : List (A, NonNegDouble)) -> \n>     Positive (toDouble (sumMapSnd axs)) ->\n>     (y : NonNegDouble) -> \n>     Positive (toDouble y) ->\n>     Positive (toDouble (sumMapSnd (mapIdRightMult (axs, y))))\n\n\n> using implementation NumNonNegDouble\n>   ||| \n>   postulate \n>   sumMapSndConsLemma1 : \n>     {A : Type} ->\n>     (a : A) ->\n>     (x : Double) ->\n>     (px : Positive x) ->\n>     (nnx : NonNegative x) ->\n>     (axs : List (A, NonNegDouble)) -> \n>     Positive (toDouble (sumMapSnd ((a, Element x nnx) :: axs)))\n\n\n> using implementation NumNonNegDouble\n>   |||\n>   postulate \n>   mvMultLemma : {A, B : Type} ->\n>                 (axs : List (A, NonNegDouble)) -> \n>                 Positive (toDouble (sumMapSnd axs)) -> \n>                 (f : A -> List (B, NonNegDouble)) -> \n>                 ((a : A) -> Positive (toDouble (sumMapSnd (f a)))) ->\n>                 Positive (toDouble (sumMapSnd (mvMult axs f)))\n\n\n> {-\n\n> ---}\n \n \n \n \n", "meta": {"hexsha": "d0f8faa54b6edf530b1d30c5d63e468f35b05442", "size": 1440, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "NonNegDouble/Postulates.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "NonNegDouble/Postulates.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "NonNegDouble/Postulates.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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.2258064516, "max_line_length": 71, "alphanum_fraction": 0.5902777778, "num_tokens": 423, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438951104066293, "lm_q2_score": 0.6224593312018546, "lm_q1q2_score": 0.5252903860282258}}
{"text": "data Vect : Nat -> Type -> Type where\n     Nil : Vect Z a\n     (::) : a -> Vect k a -> Vect (S k) a\n\nwrong : a -> Vect (S n) a -> Vect (S n) a\nwrong x xs = x :: x\n", "meta": {"hexsha": "fe48b0ec5d6639f33e112801808bbb7706287f64", "size": 163, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/error001/Error.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/error001/Error.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/error001/Error.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 23.2857142857, "max_line_length": 41, "alphanum_fraction": 0.472392638, "num_tokens": 60, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8198933271118221, "lm_q2_score": 0.6406358411176238, "lm_q1q2_score": 0.5252530512410092}}
{"text": "module Halfer\nimport Service\nimport System\nimport Numeric\n\n%default total\n\n-- Helpful type alias for even integers\npublic export\nEvenNumber : Type\nEvenNumber = (n : WFInt ** Parity n 2)\n\n||| Return a Just EvenNumber if the number is even, or Nothing otherwise.\npublic export\nmaybeEven : Integer -> Maybe EvenNumber\n\n||| Round a number down to the nearest even number\npublic export\nforceEven : Integer -> EvenNumber\n\n-- maybeEven a with (mod a 2) proof p\n--   maybeEven a | 0 = Just ((cast a) ** ModIsZero p)\n--   maybeEven a | _ = Nothing\n\n\n-- Run external service\npublic export\nrunHalfer : EvenNumber -> IO Integer\nrunHalfer = do ?run\n\n\npublic export\nhalferContract : (a : EvenNumber) -> Contract (runHalfer a) Integer\nhalferContract a = MkContract (runHalfer a)\n\n\npublic export\nhalferService : EvenNumber -> Service Integer\nhalferService a = Promise (halferContract a)\n", "meta": {"hexsha": "b373991acfc9c397b957c28200ca8cb3faf53676", "size": 871, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "experimental/typed-dsl/Halfer.idr", "max_stars_repo_name": "nunet-io/ai-dsl", "max_stars_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2021-02-17T08:02:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-03T12:52:29.000Z", "max_issues_repo_path": "experimental/typed-dsl/Halfer.idr", "max_issues_repo_name": "nunet-io/ai-dsl", "max_issues_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 15, "max_issues_repo_issues_event_min_datetime": "2021-03-04T10:33:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-16T04:55:50.000Z", "max_forks_repo_path": "experimental/typed-dsl/Halfer.idr", "max_forks_repo_name": "nunet-io/ai-dsl", "max_forks_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2021-02-19T07:58:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-28T18:37:13.000Z", "avg_line_length": 21.775, "max_line_length": 73, "alphanum_fraction": 0.7405281286, "num_tokens": 231, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.853912760387131, "lm_q2_score": 0.6150878555160665, "lm_q1q2_score": 0.5252313685843252}}
{"text": "module SimpleCatenableDeque\n\nimport CatenableDeque\n\n%default total\n%access private\n\nexport\ndata SimpleCatDeque : (Type -> Type) -> Type -> Type where\n  Shallow : d a -> SimpleCatDeque d a\n  Deep : d a -> Lazy (SimpleCatDeque d (d a)) -> d a -> SimpleCatDeque d a\n\ntooSmall : Deque d => d a -> Bool\ntooSmall d = isEmpty d || isEmpty (tail d)\n\ndappendL : Deque d => d a {- tooSmall -} -> d a -> d a\ndappendL d1 d2 = if isEmpty d1 then d2 else cons (head d1) d2\n\ndappendR : Deque d => d a -> d a {- tooSmall -} -> d a\ndappendR d1 d2 = if isEmpty d2 then d1 else snoc d1 (head d2)\n\nexport\nDeque d => Deque (SimpleCatDeque d) where\n  empty = Shallow empty\n  isEmpty (Shallow d) = isEmpty d\n  isEmpty _           = False\n\n  cons x (Shallow d)  = Shallow (cons x d)\n  cons x (Deep f m r) = Deep (cons x f) m r\n\n  head (Shallow d)  = head d\n  head (Deep f m r) = head f\n\n  tail (Shallow d)  = Shallow (tail d)\n  tail (Deep f m r) = let f' = tail f in\n    if not (tooSmall f') then Deep f' m r\n    else if isEmpty m then Shallow (dappendL f' r)\n    else Deep (dappendL f' (head m)) (tail m) r\n\n  snoc (Shallow d) x  = Shallow (snoc d x)\n  snoc (Deep f m r) x = Deep f m (snoc r x)\n\n  last (Shallow d)  = last d\n  last (Deep f m r) = last r\n\n  init (Shallow d) = Shallow (init d)\n  init (Deep f m r) = let r' = init r in\n    if not (tooSmall r') then Deep f m r'\n    else if isEmpty m then Shallow (dappendR f r')\n    else Deep f (init m) (dappendR (last m) r')\n\nexport\nDeque d => CatenableDeque (SimpleCatDeque d) where\n  (Shallow d1) ++ (Shallow d2) =\n    if tooSmall d1 then Shallow (dappendL d1 d2)\n    else if tooSmall d2 then Shallow (dappendR d1 d2)\n    else Deep d1 empty d2\n  (Shallow d) ++ (Deep f m r) =\n    if tooSmall d then Deep (dappendL d f) m r\n    else Deep d (cons f m) r\n  (Deep f m r) ++ (Shallow d) =\n    if tooSmall d then Deep f m (dappendR r d)\n    else Deep f (snoc m r) d\n  (Deep f1 m1 r1) ++ (Deep f2 m2 r2) =\n    let mf = assert_smaller (Deep f1 m1 r2) $ snoc m1 r1\n        mr = assert_smaller (Deep f2 m2 r2) $ cons f2 m2\n    in Deep f1 (mf ++ mr) r2\n", "meta": {"hexsha": "f0c34ff4add6aedf401d830bc1f3ce8f82cabd00", "size": 2071, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/SimpleCatenableDeque.idr", "max_stars_repo_name": "ska80/idris-okasaki-pfds", "max_stars_repo_head_hexsha": "8e80feba2fdcebdf90136ac6633275c896177c77", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-09-08T00:55:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-08T00:55:51.000Z", "max_issues_repo_path": "src/SimpleCatenableDeque.idr", "max_issues_repo_name": "ska80/idris-okasaki-pfds", "max_issues_repo_head_hexsha": "8e80feba2fdcebdf90136ac6633275c896177c77", "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/SimpleCatenableDeque.idr", "max_forks_repo_name": "ska80/idris-okasaki-pfds", "max_forks_repo_head_hexsha": "8e80feba2fdcebdf90136ac6633275c896177c77", "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": 30.4558823529, "max_line_length": 74, "alphanum_fraction": 0.6224046354, "num_tokens": 758, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8104788995148792, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.5250267867935262}}
{"text": "import Data.Nat\nimport Data.Fin\nimport Data.Fin.Extra\nimport Data.Vect\nimport Data.List\nimport Data.List1\n\ninf : Nat\ninf = 1000000\n\ndata Amphipod = A | B | C | D\n\nEq Amphipod where\n  A == A = True\n  B == B = True\n  C == C = True\n  D == D = True\n  _ == _ = False\n\nenergy : Amphipod -> Nat\nenergy A = 1\nenergy B = 10\nenergy C = 100\nenergy D = 1000\n\nroomOf : Amphipod -> Fin 4\nroomOf A = 0\nroomOf B = 1\nroomOf C = 2\nroomOf D = 3\n\nRoom : Nat -> Type\nRoom n = Vect n (Maybe Amphipod)\n\nroomToHall : Fin 4 -> Fin 11\nroomToHall 0 = 2\nroomToHall 1 = 4\nroomToHall 2 = 6\nroomToHall 3 = 8\n\nrecord State (s : Nat) where\n  constructor MkState\n  hall : Room 11\n  rooms : Vect 4 (Room s)\n  energy : Nat\n\nisPod : Amphipod -> Maybe Amphipod -> Bool\nisPod a Nothing = False\nisPod a (Just b) = a == b\n\nisSolved : State n -> Bool\nisSolved (MkState hall [r1,r2,r3,r4] _) =\n  all isNothing hall &&\n  all (isPod A) r1 &&\n  all (isPod B) r2 &&\n  all (isPod C) r3 &&\n  all (isPod D) r4\n\nvalidPlaces : Vect 7 (Fin 11)\nvalidPlaces = [0,1,3,5,7,9,10]\n\nmoveToHall : State n -> List (State n)\nmoveToHall s = join $ moveFromRoom <$> (forget $ allFins 3)\n  where\n    getToMove : Fin 4 -> Maybe (Fin n)\n    getToMove r = do let room = index r s.rooms\n                     if any (not . (==) r . roomOf) $ catMaybes $ toList room\n                        then findIndex isJust room\n                        else Nothing\n\n    pathToHall : Fin 4 -> Fin 11 -> Maybe Nat\n    pathToHall r to = do let from = finToNat $ roomToHall r\n                         let to = finToNat $ to\n                         let (min, max) = if from > to\n                                             then (to, from)\n                                             else (from + 1, to + 1)\n                         let dist = minus max min\n                         if any isJust $ take dist $ drop min $ toList s.hall\n                            then Nothing\n                            else Just dist\n\n    moveFromRoom : Fin 4 -> List (State n)\n    moveFromRoom r = do case getToMove r of\n                          Nothing => []\n                          (Just i) => let a = index i $ index r s.rooms\n                                          en = maybe 0 energy a\n                                          ps = catMaybes $ (\\p => (p,) <$> pathToHall r p) <$> toList validPlaces in\n                                          ps <&> \\(p,n) => {\n                                            hall $= replaceAt p a,\n                                            rooms $= updateAt r (replaceAt i Nothing),\n                                            energy $= (+) (en * (n + (finToNat i) + 1))\n                                          } s\n\nmoveToRoom : {n : Nat} -> State n -> List (State n)\nmoveToRoom s = catMaybes $ toList $ moveToRoom' s <$> validPlaces\n  where\n    pathToRoom : State n -> Fin 11 -> Fin 4 -> Maybe Nat\n    pathToRoom s from r = do let to = finToNat $ roomToHall r\n                             let from = finToNat $ from\n                             let (min, max) = if from > to\n                                                 then (to, from)\n                                                 else (from + 1, to + 1)\n                             let dist = minus max min\n                             if any isJust $ take dist $ drop min $ toList s.hall\n                                then Nothing\n                                else Just dist\n\n    moveInRoom : State n -> Fin 11 -> Fin 4 -> Maybe (Fin n)\n    moveInRoom s h r = do let room = index r s.rooms\n                          if all ((==) r . roomOf) $ catMaybes $ toList room\n                             then do map invFin $ findIndex isNothing $ reverse $ room\n                             else Nothing\n\n    moveToRoom' : State n -> Fin 11 -> Maybe (State n)\n    moveToRoom' s p = do a <- index p s.hall\n                         let r = roomOf a\n                         toRoom <- pathToRoom s p r\n                         inRoom <- moveInRoom s p r\n                         let en = energy a\n                         pure $ {\n                           hall $= replaceAt p Nothing,\n                           rooms $= updateAt r (replaceAt inRoom (Just a)),\n                           energy $= (+) (en * (toRoom + (finToNat inRoom) + 1))\n                         } s\n\nsolve : {n : Nat} -> Nat -> State n -> Nat\nsolve m s = if s.energy > m\n                 then m\n                 else if isSolved s\n                         then s.energy\n                         else let m = foldl solve m (moveToHall s) in\n                                  foldl solve m (moveToRoom s)\n\ninput1 : Vect 4 (Room 2)\ninput1 = [\n  [Just D, Just C],\n  [Just B, Just A],\n  [Just C, Just D],\n  [Just A, Just B]\n  ]\n\npart1 : State 2 -> IO String\npart1 a = pure $ show $ solve inf a\n\ninput2 : Vect 4 (Room 4)\ninput2 = [\n  [Just D, Just D, Just D, Just C],\n  [Just B, Just C, Just B, Just A],\n  [Just C, Just B, Just A, Just D],\n  [Just A, Just A, Just C, Just B]\n  ]\n\npart2 : State 4 -> IO String\npart2 a = pure $ show $ solve inf a\n\nmain : IO ()\nmain = do let s1 = MkState (replicate 11 Nothing) input1 0\n          part1 s1 >>= putStrLn\n          let s2 = MkState (replicate 11 Nothing) input2 0\n          part2 s2 >>= putStrLn\n\n", "meta": {"hexsha": "93c923992ab54c3b23381d75f06e967c5a7034d8", "size": 5216, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "23/Main.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "23/Main.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "23/Main.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.1975308642, "max_line_length": 116, "alphanum_fraction": 0.4612730061, "num_tokens": 1423, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772220439509, "lm_q2_score": 0.600188359260205, "lm_q1q2_score": 0.5246109737652768}}
{"text": "module Main\nimport Data.SortedMap\n\ntest : List Int -> IO ()\ntest xs = do let lst = Data.SortedMap.toList mp\n             if length lst /= n \n                then putStrLn $ \"wrong length for \" ++ show xs\n                else do let res = map (\\x => lookup x mp) xs\n                        let found = mapMaybe id res\n                        if length found /= n \n                           then putStrLn $ \"some lost in \" ++ show xs ++ \": res=\" ++ show res \n                                            ++ \" toList=\" ++ show lst\n                           else pure ()\n\n  where  \n    mp : SortedMap Int ()\n    mp = foldr (\\x => \\m => insert x () m) empty xs\n    n : Nat\n    n = length xs\n\nmain : IO ()\nmain = do test [1,2,3]\n          test [4,3,2,1]\n          test [1,2,3,4]\n", "meta": {"hexsha": "15cffc6e37a02275b187ff28223aec60fc6c88f7", "size": 774, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/reg048/reg048.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/reg048/reg048.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/reg048/reg048.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 30.96, "max_line_length": 94, "alphanum_fraction": 0.4302325581, "num_tokens": 193, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7431680086124812, "lm_q2_score": 0.7057850278370111, "lm_q1q2_score": 0.5245168536461362}}
{"text": "module LetBinders\n\ninfix 1 :::\nrecord List1 (a : Type) where\n  constructor (:::)\n  head : a\n  tail : List a\n\nswap : List1 a -> List1 a\nswap aas =\n  let (a ::: as) := aas in\n  let (b :: bs) = as\n        | [] => a ::: []\n      rest = a :: bs\n  in b ::: rest\n\nidentity : List (Nat, a) -> List (List a)\nidentity =\n  let\n\n    replicate : (n : Nat) -> a -> List a\n    replicate Z a = []\n    replicate (S n) a = a :: replicate n a\n\n    closure := uncurry replicate\n\n  in map closure\n", "meta": {"hexsha": "ac8a898bf4bb58bca809584bee78aab11985c421", "size": 476, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/ideMode/ideMode005/LetBinders.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/ideMode/ideMode005/LetBinders.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/ideMode/ideMode005/LetBinders.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 17.0, "max_line_length": 42, "alphanum_fraction": 0.525210084, "num_tokens": 158, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7799929002541068, "lm_q2_score": 0.672331699179286, "lm_q1q2_score": 0.524413951975623}}
{"text": "import Control.Monad.Error.Either\nimport Control.Monad.Identity\n\n-- Errorful monadic functions --\n\nf1 : Monad m => Int -> m (Either String Int)\nf1 5 = pure $ Right 0\nf1 _ = pure $ Left \"fail 1\"\n\nf2 : Monad m => Int -> m (Either String Int)\nf2 6 = pure $ Right 0\nf2 _ = pure $ Left \"fail 2\"\n\n-- Compositions --\n\nc1 : Monad m => m (Either String Int)\nc1 = f1 1 *> f2 1\n\nc2 : Monad m => m (Either String Int)\nc2 = (f1 1 *> f2 1) @{Applicative.Compose}\n\nc3 : Monad m => m (Either String Int)\nc3 = runEitherT $ MkEitherT {m} (f1 1) *> MkEitherT {m} (f2 1)\n\n-- These checks are meant to be true --\n\nr1 : Bool\nr1 = runIdentity c1 == Left \"fail 2\"\n\nr2 : Bool\nr2 = runIdentity c2 == Left \"fail 1\"\n\nr3 : Bool\nr3 = runIdentity c3 == Left \"fail 1\"\n", "meta": {"hexsha": "3e63aa25830b6216b08d52d4d68ae4658fa1dc43", "size": 736, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "AppComp.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "AppComp.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "AppComp.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 21.0285714286, "max_line_length": 62, "alphanum_fraction": 0.6304347826, "num_tokens": 263, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8006920020959544, "lm_q2_score": 0.6548947425132315, "lm_q1q2_score": 0.5243689825450338}}
{"text": "count : Nat -> Stream Nat\ncount n = n :: count (S n)\n\nbadCount : Nat -> Stream Nat\nbadCount n = n :: map S (badCount n)\n\ndata SP : Type -> Type -> Type where\n  Get : (a -> SP a b) -> SP a b\n  Put : b -> Inf (SP a b) -> SP a b\n\ncopy : SP a a\ncopy = Get (\\x => Put x copy)\n\nprocess : SP a b -> Stream a -> Stream b\nprocess (Get f) (x :: xs) = process (f x) xs\nprocess (Put b sp) xs = b :: process sp xs\n\nbadProcess : SP a b -> Stream a -> Stream b\nbadProcess (Get f) (x :: xs) = badProcess (f x) xs\nbadProcess (Put b sp) xs = badProcess sp xs\n\ndoubleInt : SP Nat Integer\ndoubleInt = Get (\\x => Put (the Integer (cast x))\n                        (Put (the Integer (cast x) * 2) doubleInt))\n\ncountStream : Nat -> Stream Nat\ncountStream x = x :: countStream (x + 1)\n\nmain : IO ()\nmain = printLn (take 10 (process doubleInt (countStream 1)))\n", "meta": {"hexsha": "05d1e043f8808b75c9264f0845d03a49ae998874", "size": 836, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/chez/chez001/Total.idr", "max_stars_repo_name": "boxfire/rapid", "max_stars_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/chez/chez001/Total.idr", "max_issues_repo_name": "boxfire/rapid", "max_issues_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/chez/chez001/Total.idr", "max_forks_repo_name": "boxfire/rapid", "max_forks_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 26.9677419355, "max_line_length": 67, "alphanum_fraction": 0.5933014354, "num_tokens": 269, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7879311956428947, "lm_q2_score": 0.6654105521116445, "lm_q1q2_score": 0.5242977319187268}}
{"text": "import Data.List\nimport Data.Vect\nimport Data.String.Parser\n\nimport System.File\n\nVec3 : Type\nVec3 = Vect 3 Integer\n\nminusV : Vec3 -> Vec3 -> Vec3\nminusV [x1,y1,z1] [x2,y2,z2] = [x1-x2,y1-y2,z1-z2]\n\nmaxV : Vec3 -> Vec3 -> Vec3\nmaxV [x1,y1,z1] [x2,y2,z2] = [max x1 x2, max y1 y2, max z1 z2]\n\nminV : Vec3 -> Vec3 -> Vec3\nminV [x1,y1,z1] [x2,y2,z2] = [min x1 x2, min y1 y2, min z1 z2]\n\nCube : Type\nCube = (Vec3, Vec3)\n\nisCorrect : Cube -> Maybe Cube\nisCorrect c@([x1,y1,z1], [x2,y2,z2]) =\n  if x1 < x2 && y1 < y2 && z1 < z2\n     then Just c\n     else Nothing\nintersect : Cube -> Cube -> Maybe Cube\nintersect (min1, max1) (min2, max2) = isCorrect (maxV min1 min2, minV max1 max2)\n\nvolume : Cube -> Integer\nvolume (min, max) = product $ (abs <$> minusV max min)\n\ndata Command = On Cube | Off Cube\n\nisOn : Command -> Bool\nisOn (On _) = True\nisOn _ = False\n\ninvert : Command -> Command\ninvert (On c) = Off c\ninvert (Off c) = On c\n\ngetCube : Command -> Cube\ngetCube (On c) = c\ngetCube (Off c) = c\n\nInput : Type\nInput = List Command\n\nrangeParser : Parser (Integer, Integer)\nrangeParser = do skip letter\n                 skip $ char '='\n                 min <- integer\n                 token \"..\"\n                 max <- integer\n                 pure (min, max + 1)\n\ncommandParser : Parser Command\ncommandParser = do cmd <- (token \"on\" $> On) <|> (token \"off\" $> Off)\n                   [(xmin, xmax),(ymin,ymax),(zmin,zmax)] <- commaSep rangeParser\n                     | _ => fail \"no ranges\"\n                   pure $ cmd ([xmin,ymin,zmin],[xmax,ymax,zmax])\n\nparser : Parser Input\nparser = some (commandParser <* spaces)\n\nCubes : Type\nCubes = List Cube\n\naddCube' : List Command -> Cube -> (Integer, List Command)\naddCube' [] c = (0, [])\naddCube' ((On c) :: cs) b = case intersect b c of\n                                 Nothing => addCube' cs b\n                                 (Just overlap) => let (v, os) = addCube' cs b in\n                                                       (v - volume overlap, (Off overlap) :: os)\naddCube' ((Off c) :: cs) b = case intersect b c of\n                                  Nothing => addCube' cs b\n                                  (Just overlap) => let (v, os) = addCube' cs b in\n                                                       (v + volume overlap, (On overlap) :: os)\n\naddCube : List Command -> Cube -> (Integer, List Command)\naddCube cs c = case addCube' cs c of\n                    (vol, []) => (vol, cs)\n                    (vol, os) => (vol, os ++ cs)\n\ndoCmd : (Integer, List Command) -> Command -> (Integer, List Command)\ndoCmd (vol, cs) c@(On b) = let (v, cs) = addCube cs b in\n                               (v + vol + volume b, c :: cs)\ndoCmd (vol, cs) (Off b) = mapFst ((+) vol) $ addCube cs b\n\ncmdInBounds : Cube -> Command -> Maybe Command\ncmdInBounds b (On c) = On <$> intersect b c\ncmdInBounds b (Off c) = Off <$> intersect b c\n\npart1 : Input -> IO String\npart1 a = let bound : Cube = ([-50,-50,-50], [51,51,51])\n              cs = catMaybes $ cmdInBounds bound <$> a in\n              pure $ show $ fst $ foldl doCmd (0, []) cs\n\npart2 : Input -> IO String\npart2 a = pure $ show $ fst $ foldl doCmd (0, []) a\n\nmain : IO ()\nmain = do Right input <- readFile \"input.txt\"\n            | Left err => printLn err\n          Right (a, _) <- pure $ parse parser input\n            | Left err => printLn err\n          part1 a >>= putStrLn\n          part2 a >>= putStrLn\n\n", "meta": {"hexsha": "e88b21082e306418efb775d1a8dc47148a8c1396", "size": 3409, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "22/Main.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "22/Main.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "22/Main.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.7117117117, "max_line_length": 96, "alphanum_fraction": 0.5280140804, "num_tokens": 1025, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8840392939666335, "lm_q2_score": 0.5926665999540698, "lm_q1q2_score": 0.5239405625810011}}
{"text": "module Refined \n\n\ndata Vect : (len : Nat) -> (elem : Type) -> Type where\n  Nil  : Vect Z elem\n  (::) : (x : elem) -> (xs : Vect len elem) -> Vect (S len) elem\n\n\n\n-- Definitions \n\ndigits : List Char\ndigits = ['0'..'9']\n\nlowerCase : List Char\nlowerCase = ['a'..'z']\n\nupperCase : List Char\nupperCase = ['A'..'Z']\n\n\n-- Elem property\ndata Elem : a -> List a -> Type where\n  Here : Elem x (x :: xs)\n  There : (later : Elem x xs) -> Elem x (y :: xs)\n\n\n-- Elem examples\n\n\naIsLC : Elem 'a' Refined.lowerCase\n\n\nbIsLC : Elem 'b' Refined.lowerCase\n\n\nkIsLC : Elem 'k' Refined.lowerCase\n\n\n\n\n-- Not true....\n\n\n\n\n\n\n\n\n\n\n\n\n-- Properties\nDigits : Char -> Type \n\n\nLowerCase : Char -> Type\n\n\nUpperCase : Char -> Type\n\n\n\n\n\n\n\n\n\n\n\n\n-- Dependent pairs\nx : (n : Nat ** Vect n Int)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n-- Refinement type \n\n-- x : Refined Char UpperCase \n\n\n\n\n\n\n\n--refbIsLC : Refined Char LowerCase\n\n\n\n\n\n\n\n\n\n\n-- Conversion\n\n--toRefined : { a : Type } -> { P : a -> Type } -> ??? \n\n\n\n\n\n--testRefA : Refined Char LowerCase\n\n\n\n\n\n--testRefB : Char `Refined` LowerCase\n\n\n\n\n\n\n--fromRefined : { P : Char -> Type } -> ??? \n\n\n\n-- Examples\n\n\nprintChar : Char -> IO ()\nprintChar = printLn\n\nmain : IO () \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n{-\n\nIdris Refined\nhttps://github.com/janschultecom/idris-refined\n\n-}\n\n\n\n\n\n", "meta": {"hexsha": "2b9e15bcf76aee79590927ab6b3893524f7e9915", "size": 1249, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Refined.idr", "max_stars_repo_name": "janschultecom/2017-11-20-Lambda-Meetup-Munich", "max_stars_repo_head_hexsha": "45a77d1b3f9a16fa2d32a410729122f30fc5bd76", "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": "Refined.idr", "max_issues_repo_name": "janschultecom/2017-11-20-Lambda-Meetup-Munich", "max_issues_repo_head_hexsha": "45a77d1b3f9a16fa2d32a410729122f30fc5bd76", "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": "Refined.idr", "max_forks_repo_name": "janschultecom/2017-11-20-Lambda-Meetup-Munich", "max_forks_repo_head_hexsha": "45a77d1b3f9a16fa2d32a410729122f30fc5bd76", "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": 7.261627907, "max_line_length": 64, "alphanum_fraction": 0.5556445156, "num_tokens": 369, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7490872131147276, "lm_q2_score": 0.6992544273261175, "lm_q1q2_score": 0.5238025502238562}}
{"text": "module Collections.BSTree.Map.Core\n\nimport Collections.Util.Bnd\nimport Control.Relation\nimport Decidable.Order.Strict\n\n||| A verified binary search tree with erased proofs.\n|||\n||| The keys in the tree are constrained by min/max bounds, which make use of `Bnd` to extend the\n||| tree key type with `Top` and `Bot` values. This allows for a natural way to leave bounds\n||| unconstrained (by having a minimum of `Bot` or a maximum of `Top`).\n|||\n||| @ ord The ordering implementations used in the tree. Since these are w.r.t. a type `kTy`, the\n|||       type of tree keys is defined implicitly by `ord`.\n||| @ vTy The data type to carry in nodes in addition to the key type `kTy`.\n||| @ mn  The minimum value constraint, proving that `rel mn (Mid x)` for all values `x` in the\n|||       tree.\n||| @ mx  The maximum value constraint, proving that `rel (Mid x) mx` for all values `x` in the\n|||       tree.\npublic export\ndata BST : {0 rel : kTy -> kTy -> Type} ->\n           (pre : StrictPreorder kTy rel) ->\n           (tot : StrictOrdered kTy rel) ->\n           (0 vTy : Type) ->\n           (0 mn,mx : Bnd kTy) ->\n           Type where\n  ||| An empty tree node.\n  |||\n  ||| @ prf An ordering proof on the min and max constraints of this node. Since an in-order\n  |||       traversal of a binary tree is an empty-node-empty-... alternation, storing ordering\n  |||       information in the empty nodes is a natural way to store evidence that the nodes are in\n  |||       order.\n  Empty : {pre : StrictPreorder kTy rel} ->\n          {tot : StrictOrdered kTy rel} ->\n          (0 prf : BndLT rel mn mx) ->\n          BST pre tot vTy mn mx\n  ||| A node with a value and with left and right subtrees, each with appropriate bounds relative\n  ||| to the key `k` of the node.\n  |||\n  ||| @ k The key value of the node\n  ||| @ v The data value of the node\n  ||| @ l The left subtree\n  ||| @ r The right subtree\n  Node  : {0 rel : kTy -> kTy -> Type} ->\n          {pre : StrictPreorder kTy rel} ->\n          {tot : StrictOrdered kTy rel} ->\n          (k : kTy) ->\n          (v : vTy) ->\n          (l : BST pre tot vTy mn (Mid k)) ->\n          (r : BST pre tot vTy (Mid k) mx) ->\n          BST pre tot vTy mn mx\n%name BST t,u,v\n\n||| A verified binary search tree with erased proofs.\n|||\n||| This is an alias for the more generic `BST` (which accepts min/max bounds for its contents).\n||| The bounds are necessary for verifying the structure of a tree, but the root node of any\n||| `BST` will always be unconstrained. So generally, `BST` can be considered an implementation\n||| detail.\n|||\n||| @ rel The strict total ordering used in the tree. Since a `StrictOrdered` impl is w.r.t. a type\n|||       `kTy`, the type of tree values is defined implicitly by `ord`.\n||| @ vTy The type for values stored in nodes of the tree.\npublic export\nBSTree : {0 kTy : Type} ->\n         (0 rel : kTy -> kTy -> Type) ->\n         {auto pre : StrictPreorder kTy rel} ->\n         {auto tot : StrictOrdered kTy rel} ->\n         (0 vTy : Type) ->\n         Type\nBSTree rel {pre} {tot} vTy = BST pre tot vTy Bot Top\n%name BSTree t,u,v\n\n||| Proof that the minimum bound can be decreased arbitrarily.\npublic export\nextendMin : {0 rel : kTy -> kTy -> Type} ->\n            {pre : StrictPreorder kTy rel} ->\n            {tot : StrictOrdered kTy rel} ->\n            (0 prf : BndLT rel mn' mn) ->\n            BST pre tot vTy mn mx ->\n            BST pre tot vTy mn' mx\nextendMin {pre} prf (Empty prf')   = Empty $ transitive {x=mn'} {y=mn} {z=mx} prf prf'\nextendMin       prf (Node k v l r) = Node k v (extendMin prf l) r\n\n||| Proof that the maximum bound can be increased arbitrarily.\npublic export\nextendMax : {0 rel : kTy -> kTy -> Type} ->\n            {pre : StrictPreorder kTy rel} ->\n            {tot : StrictOrdered kTy rel} ->\n            (0 prf : BndLT rel mx mx') ->\n            BST pre tot vTy mn mx ->\n            BST pre tot vTy mn mx'\nextendMax {pre} prf (Empty prf')   = Empty $ transitive {x=mn} {y=mx} {z=mx'} prf' prf\nextendMax       prf (Node k v l r) = Node k v l (extendMax prf r)\n", "meta": {"hexsha": "cb3c10a2f45eb4af3752818fc88a190ceb596e05", "size": 4056, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Collections/BSTree/Map/Core.idr", "max_stars_repo_name": "polendri/idris-collections", "max_stars_repo_head_hexsha": "8492ab9ceffdef72d25a65c6b4296e561816f73c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-11-24T10:58:23.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-20T16:16:04.000Z", "max_issues_repo_path": "src/Collections/BSTree/Map/Core.idr", "max_issues_repo_name": "polendri/idris-collections", "max_issues_repo_head_hexsha": "8492ab9ceffdef72d25a65c6b4296e561816f73c", "max_issues_repo_licenses": ["MIT"], "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/Collections/BSTree/Map/Core.idr", "max_forks_repo_name": "polendri/idris-collections", "max_forks_repo_head_hexsha": "8492ab9ceffdef72d25a65c6b4296e561816f73c", "max_forks_repo_licenses": ["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.6947368421, "max_line_length": 99, "alphanum_fraction": 0.6055226824, "num_tokens": 1168, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8175744673038223, "lm_q2_score": 0.640635868562172, "lm_q1q2_score": 0.5237675289754393}}
{"text": "||| Division theorem for (type-level) natural number division\nmodule Data.Nat.Division\n\nimport Syntax.WithProof\nimport Syntax.PreorderReasoning\nimport Syntax.PreorderReasoning.Generic\nimport Data.Nat\nimport Data.Nat.Equational\nimport Data.Nat.Order\nimport Data.Nat.Order.Strict\nimport Data.Nat.Order.Properties\nimport Decidable.Order.Strict\n\nimport Data.Nat.Properties\n\n%default total\n\n-- Division theorem --------------------\n\n-- This is disgusting, but will do for now\n||| Show that, if we have enough fuel, we have enough fuel for the\n||| recursive call in `div'` and `mod'`.\nfuelLemma : (numer, predDenom, fuel : Nat)\n          -> (enough : numer `LTE` (S fuel))\n          -> (recurse : Data.Nat.lte numer predDenom = False)\n          -> (numer `minus` (S predDenom)) `LTE` fuel\nfuelLemma numer predDenom fuel enough recurse =\n  let denom  : Nat\n      denom = S predDenom\n      numer' : Nat\n      numer' = numer `minus` denom\n      -- a bunch of inequational reasoning to show we have enough fuel\n      -- on the recursive call\n      denom_lte_numer : denom `LTE` numer\n      denom_lte_numer = Properties.notlteIsLT numer predDenom recurse\n      numer'_lt_numer : numer' `LT` numer\n      numer'_lt_numer = (minusPosLT denom numer\n                          (LTESucc LTEZero)\n                          denom_lte_numer)\n      succenough : S numer' `LTE` S fuel\n      succenough = transitive {rel = LTE} numer'_lt_numer enough\n  in fromLteSucc succenough\n\n-- equivalence between the duplicate definitions in Data.Nar  ---\n\n-- Internally, we use the two component definitions of divmod'\ndiv'' : (fuel, numer, denom : Nat) -> Nat\ndiv'' fuel numer denom = fst (divmod' fuel numer denom)\n\nmod'' : (fuel, numer, denom : Nat) -> Nat\nmod'' fuel numer denom = snd (divmod' fuel numer denom)\n\n\ndivmod'_eq_div'_mod' : (fuel, numer, denom : Nat)\n            -> (divmod' fuel numer denom) = (div' fuel numer denom, mod' fuel numer denom)\ndivmod'_eq_div'_mod'   0       numer denom = Refl\ndivmod'_eq_div'_mod'  (S fuel) numer denom with (Data.Nat.lte numer denom)\n divmod'_eq_div'_mod' (S fuel) numer denom | True  = Refl\n divmod'_eq_div'_mod' (S fuel) numer denom | False =\n   rewrite divmod'_eq_div'_mod' fuel (numer `minus` (S denom)) denom in\n   Refl\n\ndiv''_eq_div' : (fuel, numer, denom : Nat)\n            -> div'' fuel numer denom = div' fuel numer denom\ndiv''_eq_div' fuel numer denom = cong fst $\n                                       divmod'_eq_div'_mod' fuel numer denom\n\nmod''_eq_mod' : (fuel, numer, denom : Nat)\n            -> mod'' fuel numer denom = mod' fuel numer denom\nmod''_eq_mod' fuel numer denom = cong snd $\n                                       divmod'_eq_div'_mod' fuel numer denom\n\nexport\ndivmodNatNZeqDivMod : (numer, denom : Nat) -> (0 prf1, prf2, prf3 : NonZero denom)\n            -> (divmodNatNZ numer denom prf1) = (divNatNZ numer denom prf2, modNatNZ numer denom prf3)\ndivmodNatNZeqDivMod numer (S denom) prf1 prf2 prf3 = divmod'_eq_div'_mod' numer numer denom\n\nexport\nfstDivmodNatNZeqDiv : (numer, denom : Nat) -> (0 prf1, prf2 : NonZero denom)\n            -> (fst $ divmodNatNZ numer denom prf1) = divNatNZ numer denom prf2\nfstDivmodNatNZeqDiv numer denom prf1 prf2 =\n  rewrite divmodNatNZeqDivMod numer denom prf1 prf2 prf2 in\n  Refl\n\nexport\nsndDivmodNatNZeqMod : (numer, denom : Nat) -> (0 prf1, prf2 : NonZero denom)\n            -> (snd $ divmodNatNZ numer denom prf1) = modNatNZ numer denom prf2\nsndDivmodNatNZeqMod numer denom prf1 prf2 =\n  rewrite divmodNatNZeqDivMod numer denom prf1 prf2 prf2 in\n  Refl\n\n\n-----------------------------------------------------------------------------\nbound_mod'' : (fuel, numer, predDenom : Nat) -> (numer `LTE` fuel)\n           -> (mod'' fuel numer predDenom) `LTE` predDenom\nbound_mod'' 0        0     predDenom LTEZero = LTEZero\nbound_mod'' (S fuel) numer predDenom enough  = case @@(Data.Nat.lte numer predDenom) of\n  (True  ** numer_lte_predn)  => rewrite numer_lte_predn in\n                                 Properties.lteIsLTE _ _ numer_lte_predn\n  (False ** numer_gte_n    )  => rewrite numer_gte_n in\n                                 bound_mod'' fuel (numer `minus` (S predDenom)) predDenom\n                                                  (fuelLemma numer predDenom fuel enough numer_gte_n)\n\nexport\nboundModNatNZ : (numer, denom : Nat) -> (0 denom_nz : NonZero denom)\n              -> (modNatNZ numer denom denom_nz) `LT` denom\nboundModNatNZ numer (S predDenom) denom_nz =\n  LTESucc $\n    rewrite sym $ mod''_eq_mod' numer numer predDenom in\n      bound_mod'' numer numer predDenom $ reflexive {rel = LTE}\ndivisionTheorem' : (numer, predDenom : Nat)\n                -> (fuel : Nat) -> (enough : numer `LTE` fuel)\n                -> numer = (mod'' fuel numer predDenom) + (div'' fuel numer predDenom) * (S predDenom)\n\ndivisionTheorem'  0     predDenom  0       LTEZero = Refl\ndivisionTheorem'  numer predDenom (S fuel) enough with (@@(Data.Nat.lte numer predDenom))\n divisionTheorem' numer predDenom (S fuel) enough | (True ** prf)\n   = rewrite prf in\n     rewrite plusZeroRightNeutral numer in Refl\n divisionTheorem' numer predDenom (S fuel) enough | (False ** prf)\n   = rewrite prf in\n     let denom  : Nat\n         denom = S predDenom\n         numer' : Nat\n         numer' = numer `minus` denom\n         denom_lte_numer : denom `LTE` numer\n         denom_lte_numer = Properties.notlteIsLT numer predDenom prf\n         enough' : numer' `LTE` fuel\n         enough' = fuelLemma numer predDenom fuel enough prf\n\n         inductionHypothesis : (numer'\n                             = (mod'' fuel numer' predDenom) +  (div'' fuel numer' predDenom) * denom)\n         inductionHypothesis = divisionTheorem' numer' predDenom fuel enough'\n     in sym $ Calc $\n     |~ (mod'' fuel numer' predDenom) + (denom + (div'' fuel numer' predDenom) * denom)\n     ~~ (mod'' fuel numer' predDenom) + ((div'' fuel numer' predDenom) * denom + denom)\n               ...(cong ((mod'' fuel numer' predDenom) +) $ plusCommutative\n                                                            denom\n                                                            ((div'' fuel numer' predDenom) * denom))\n     ~~((mod'' fuel numer' predDenom) +  (div'' fuel numer' predDenom) * denom) + denom\n               ...(plusAssociative\n                     (mod'' fuel numer' predDenom)\n                     ((div'' fuel numer' predDenom) * denom)\n                     denom)\n     ~~ numer' + denom ...(cong (+ denom) $ sym inductionHypothesis)\n     ~~ numer ...(plusMinusLte denom numer denom_lte_numer)\n\n\n\nexport\nDivisionTheoremDivMod : (numer, denom : Nat)  -> (0 prf : NonZero denom)\n               -> numer = snd ( divmodNatNZ numer denom prf)\n                       + (fst $ divmodNatNZ numer denom prf)*denom\nDivisionTheoremDivMod numer (S predDenom) prf\n  = divisionTheorem' numer predDenom numer $ reflexive {rel = LTE}\n\nexport\nDivisionTheorem : (numer, denom : Nat) -> (0 prf1, prf2 : NonZero denom)\n               -> numer = (modNatNZ numer denom prf1) + (divNatNZ numer denom prf2)*denom\nDivisionTheorem numer denom prf1 prf2\n  = rewrite sym $ fstDivmodNatNZeqDiv numer denom prf1 prf2 in\n    rewrite sym $ sndDivmodNatNZeqMod numer denom prf1 prf1 in\n    DivisionTheoremDivMod numer denom prf1\n\n\n\ndivmodZeroZero : (denom, fuel : Nat)\n           -> divmod' fuel 0 denom = (0,0)\ndivmodZeroZero denom  0       = Refl\ndivmodZeroZero denom (S fuel) = Refl\n\nmodZeroZero : (denom, fuel : Nat)\n           -> mod'' fuel 0 denom = 0\nmodZeroZero denom fuel = rewrite divmodZeroZero denom fuel in Refl\n\ndivZeroZero : (denom, fuel : Nat)\n           -> div'' fuel 0 denom = 0\ndivZeroZero denom fuel = rewrite divmodZeroZero denom fuel in Refl\n\n\ndivmodFuelLemma : (numer, denom, fuel1, fuel2 : Nat)\n            -> (enough1 : fuel1 `GTE` numer)\n            -> (enough2 : fuel2 `GTE` numer)\n            -> divmod' fuel1 numer denom = divmod' fuel2 numer denom\ndivmodFuelLemma  0 denom 0 fuel2 LTEZero enough2 = rewrite divmodZeroZero denom fuel2 in\n                                                Refl\ndivmodFuelLemma  0 denom (S fuel1) 0 enough1 LTEZero = Refl\ndivmodFuelLemma  numer denom (S fuel1) (S fuel2) enough1 enough2 with (@@(Data.Nat.lte numer denom))\n divmodFuelLemma numer denom (S fuel1) (S fuel2) enough1 enough2 | (True  ** prf)  =\n   rewrite prf in Refl\n divmodFuelLemma numer denom (S fuel1) (S fuel2) enough1 enough2 | (False ** prf) =\n   rewrite prf in\n   rewrite divmodFuelLemma (numer `minus` (S denom)) denom fuel1 fuel2\n             (fuelLemma numer denom fuel1 enough1 prf)\n             (fuelLemma numer denom fuel2 enough2 prf) in\n   Refl\n\n\nmultiplicationLemma : (q, predn, r : Nat) -> q * (S predn) + r `LTE` 0 -> (q = 0, r = 0)\nmultiplicationLemma q predn r bound =\n  let r_eq_z : (r = 0)\n      r_eq_z = zeroPlusRightZero (q * (S predn)) r (sym $ lteZeroIsZero bound)\n      qn_eq_z : (q * (S predn) = 0)\n      qn_eq_z = zeroPlusLeftZero (q * (S predn)) r (sym $ lteZeroIsZero bound)\n      q_eq_z : q = 0\n      q_eq_z = case zeroMultEitherZero q (S predn) qn_eq_z of\n        Left  q_eq_0 => q_eq_0\n        Right spred_eq_z impossible\n  in (q_eq_z, r_eq_z)\n\nmultiplesModuloZero : (fuel, predn, k : Nat)\n       -> (enough : fuel `GTE` k * (S predn) )\n       -> mod' fuel (k * (S predn)) predn = 0\nmultiplesModuloZero 0        predn k enough =\n  let (k_eq_z, _) = multiplicationLemma k predn 0 $\n                    rewrite plusZeroRightNeutral (k * (S predn)) in\n                    enough\n  in rewrite k_eq_z in\n  Refl\nmultiplesModuloZero  (S fuel) predn 0 enough = Refl\nmultiplesModuloZero  (S fuel) predn (S k) enough =\n  let n : Nat\n      n = S predn\n      n_lte_skn : n `LTE` (1 + k)*n\n      n_lte_skn = CalcWith {leq = LTE} $\n        |~ n\n        ~~ n  + 0     ...(sym $ plusZeroRightNeutral n)\n        ~~ (1 + 0)*n ...(Refl)\n        <~ (1 + k)*n   ...(multLteMonotoneLeft (1+0) (1+k) n $\n                           plusLteMonotoneLeft 1 0 k LTEZero)\n  in case @@(Data.Nat.lte ((1 + k)*n) predn) of\n    (True  ** skn_lte_predn) => absurd $ irreflexive {rel = Data.Nat.LT}\n                                       $ CalcWith {leq = LTE} $\n      |~ 1 + predn\n      ~~ n         ...(Refl)\n      ~~ n + 0     ...(sym $ plusZeroRightNeutral n)\n      ~~ (1 + 0)*n ...(Refl)\n      <~ (1 + k)*n ...(multLteMonotoneLeft (1+0) (1+k) n $\n                       LTESucc LTEZero)\n      <~ predn     ...(Properties.lteIsLTE _ _ skn_lte_predn)\n    (False ** prf) =>\n      rewrite prf in\n      let skn_minus_n_eq_kn : ((1 + k)*n `minus` n = k*n)\n          skn_minus_n_eq_kn = Calc $\n            |~ ((1+k)*n `minus` n)\n            ~~ ((1+k)*n `minus` (n + 0)) ...(cong ((1+k)*n `minus`) $ sym $ plusZeroRightNeutral n)\n            ~~ (n + k*n `minus` (n + 0)) ...(Refl)\n            ~~ (k*n `minus` 0)           ...(plusMinusLeftCancel n (k*n) 0)\n            ~~ k*n                       ...(minusZeroRight (k*n))\n      in rewrite skn_minus_n_eq_kn in\n      multiplesModuloZero fuel predn k $\n      (rewrite sym $ skn_minus_n_eq_kn in\n       fuelLemma ((1 + k)*n) predn fuel enough prf)\n\n-- We also want to show uniqueness of this decomposition\n-- This is, of course, quite horrible, but I want this theorem in the stdlib\naddMultipleMod': (fuel1, fuel2, predn, a, b : Nat) -> (enough1 : fuel1 `GTE` b * (S predn) + a)\n                                           -> (enough2 : fuel2 `GTE` a)\n       -> mod'' fuel1 (b * (S predn) + a) predn = mod'' fuel2 a predn\naddMultipleMod' 0         fuel2 predn a b enough1 enough2\n  = let (b_eq_z, a_eq_z) = multiplicationLemma b predn a enough1\n    in rewrite a_eq_z in\n       rewrite b_eq_z in\n       rewrite modZeroZero predn fuel2 in\n       Refl\naddMultipleMod' fuel1@(S _) fuel2 predn a 0 enough1 enough2 =\n  rewrite divmodFuelLemma a predn fuel1 fuel2 enough1 enough2 in\n  Refl\naddMultipleMod' (S fuel1) fuel2 predn a (S k) enough1 enough2 =\n  let n : Nat\n      n = S predn\n      lhsarg_geq_predn : ((1 + k)*n + a) `GT` predn\n      lhsarg_geq_predn = CalcWith {leq = LTE} $\n        |~ n\n        ~~ (1+0)*n     ...(sym $ plusZeroRightNeutral n)\n        <~ (1+k)*n     ...(multLteMonotoneLeft 1 (1+k) n $\n                           LTESucc LTEZero)\n        <~ (1+k)*n + a ...(lteAddRight $ (1+k)*n)\n      prf1 : lte ((1 + k)*n + a) predn = False\n      prf1 = GTIsnotlte ((1 + k)*n + a) predn lhsarg_geq_predn\n      argsimplify : (((1 + k) *n + a ) `minus` n = k*n + a)\n      argsimplify = Calc $\n        |~ (((1+k)*n + a) `minus` n)\n        ~~ (((n + k*n) + a) `minus` n)       ...(Refl)\n        ~~ ((n + (k*n + a)) `minus` (n + 0)) ...(cong2 minus\n                                                   (sym $ plusAssociative n (k*n) a)\n                                                   (sym $ plusZeroRightNeutral n))\n        ~~ ((k*n + a) `minus` 0)             ...(plusMinusLeftCancel n (k*n + a) 0)\n        ~~ k*n + a                           ...(minusZeroRight (k*n + a))\n  in rewrite prf1 in\n     rewrite argsimplify in\n     addMultipleMod' fuel1 fuel2 predn a k\n       (rewrite sym argsimplify in\n        fuelLemma ((1+k)*n + a) predn fuel1 enough1 prf1)\n       enough2\n\naddMultipleMod : (a, b, n : Nat) -> (0 n_neq_z1, n_neq_z2 : NonZero n)\n              -> snd (divmodNatNZ (a*n + b) n n_neq_z1) = snd (divmodNatNZ b n n_neq_z2)\naddMultipleMod a b n@(S predn) n_neq_z1  n_neq_z2 =\n  addMultipleMod' (a*n + b) b predn b a (reflexive {rel = LTE}) (reflexive {rel = LTE})\n\nmodBelowDenom : (r, n : Nat) -> (0 n_neq_z : NonZero n)\n             -> (r `LT` n)\n             -> snd (divmodNatNZ r n n_neq_z)  = r\nmodBelowDenom 0 (S predn) n_neq_0 (LTESucc r_lte_predn) = Refl\nmodBelowDenom r@(S _) (S predn) n_neq_0 (LTESucc r_lte_predn) =\n  rewrite LteIslte r predn r_lte_predn in\n  Refl\n\nmodInjective : (r1, r2, n : Nat) -> (0 n_neq_z1, n_neq_z2 : NonZero n)\n             -> (r1 `LT` n)\n             -> (r2 `LT` n)\n             -> snd (divmodNatNZ r1 n n_neq_z1)  = snd (divmodNatNZ r2 n n_neq_z2)\n             -> r1 = r2\nmodInjective r1 r2 n n_neq_z1 n_neq_z2 r1_lt_n r2_lt_n ri_mod_eq = Calc $\n  |~ r1\n  ~~ snd (divmodNatNZ r1 n n_neq_z1) ...(sym $ modBelowDenom r1 n n_neq_z1 r1_lt_n)\n  ~~ snd (divmodNatNZ r2 n n_neq_z2) ...(ri_mod_eq)\n  ~~ r2                              ...(      modBelowDenom r2 n n_neq_z2 r2_lt_n)\n\n\nstep1 : (numer : Nat) -> (denom : Nat) -> (0 denom_nz : NonZero denom)\n     -> (q, r : Nat) -> (r `LT` denom) -> (numer = q * denom + r)\n     -> snd (divmodNatNZ numer denom denom_nz) = r\nstep1 x n n_nz q r r_lt_n x_eq_qnpr = Calc $\n  |~ snd(divmodNatNZ x         n n_nz)\n  ~~ snd(divmodNatNZ (q*n + r) n n_nz) ...(cong (\\u => snd $ divmodNatNZ u n n_nz) $ x_eq_qnpr)\n  ~~ snd(divmodNatNZ r         n n_nz) ...(addMultipleMod q r n n_nz n_nz)\n  ~~ r                                 ...(modBelowDenom r n n_nz r_lt_n)\n\nstep2 : (numer : Nat) -> (denom : Nat) -> (0 denom_nz : NonZero denom)\n     -> (q, r : Nat) -> (r `LT` denom) -> (numer = q * denom + r)\n     -> fst (divmodNatNZ numer denom denom_nz) = q\nstep2 x n n_nz q r r_lt_n x_eq_qnr =\n  let mod_eq_r : (snd (divmodNatNZ x n n_nz) = r)\n      mod_eq_r = step1 x n n_nz q r r_lt_n x_eq_qnr\n\n      two_decompositions : (fst $ divmodNatNZ x n n_nz) * n + r = q * n + r\n      two_decompositions = Calc $\n        |~ (fst $ divmodNatNZ x n n_nz) * n + r\n        ~~ (fst $ divmodNatNZ x n n_nz) * n + (snd $ divmodNatNZ x n n_nz)\n                                                       ...(cong (\\ u =>\n                                                                (fst $ divmodNatNZ x n n_nz)* n + u)\n                                                                $ sym mod_eq_r)\n        ~~ snd(divmodNatNZ x n n_nz) + fst (divmodNatNZ x n n_nz) * n\n                                                       ...(plusCommutative _ _)\n        ~~ x                                           ...(sym $ DivisionTheoremDivMod x n n_nz)\n        ~~ q*n + r                                     ...(x_eq_qnr)\n\n  in multRightCancel  (fst $ divmodNatNZ x n n_nz) q n n_nz\n   $ plusRightCancel ((fst $ divmodNatNZ x n n_nz)* n) (q*n) r\n   $ two_decompositions\n\nexport\nDivisionTheoremUniquenessDivMod : (numer : Nat) -> (denom : Nat) -> (0 denom_nz : NonZero denom)\n     -> (q, r : Nat) -> (r `LT` denom) -> (numer = q * denom + r)\n     -> divmodNatNZ numer denom denom_nz = (q, r)\nDivisionTheoremUniquenessDivMod numer denom denom_nz q r x prf =\n  rewrite sym $ step1 numer denom denom_nz q r x prf in\n  rewrite sym $ step2 numer denom denom_nz q r x prf in\n  pair_eta _  -- Should idris be able to see this automatically? Maybe only with homogeneous equality?\n  where\n    -- Should this go elsewhere?\n    ||| extensionality law for simple pairs\n    pair_eta : (x : (a,b)) -> x = (fst x, snd x)\n    pair_eta (x,y) = Refl\n\nexport\nDivisionTheoremUniqueness : (numer : Nat) -> (denom : Nat) -> (0 denom_nz : NonZero denom)\n     -> (q, r : Nat) -> (r `LT` denom) -> (numer = q * denom + r)\n     -> (divNatNZ numer denom denom_nz = q, modNatNZ numer denom denom_nz = r)\nDivisionTheoremUniqueness numer denom denom_nz q r x prf =\n  rewrite sym $ fstDivmodNatNZeqDiv numer denom denom_nz denom_nz in\n  rewrite sym $ sndDivmodNatNZeqMod numer denom denom_nz denom_nz in\n  rewrite DivisionTheoremUniquenessDivMod numer denom denom_nz q r x prf in\n  (Refl, Refl)\n", "meta": {"hexsha": "b61327990b0dc7649b3a2f0f4dc1d2db30028807", "size": 17194, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/contrib/Data/Nat/Division.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/contrib/Data/Nat/Division.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/contrib/Data/Nat/Division.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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.6074270557, "max_line_length": 102, "alphanum_fraction": 0.5834593463, "num_tokens": 5382, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673223709251, "lm_q2_score": 0.6442251133170357, "lm_q1q2_score": 0.5236695428661245}}
{"text": "module Quantities.SIDerivedQuantities\n\nimport Quantities.Core\nimport Quantities.SIBaseQuantities\n\n%default total\n%access public export\n\n\n-- Examples of coherent derived units in the SI expressed in terms of base\n-- units\n\nArea : Quantity\nArea = Length ^ 2\n\nVolume : Quantity\nVolume = Length ^ 3\n\nSpeed : Quantity\nSpeed = Length </> Time\n\nVelocity : Quantity\nVelocity = Speed\n\nAcceleration : Quantity\nAcceleration = Speed </> Time\n\nWavenumber : Quantity\nWavenumber = Length ^ (-1)\n\nDensity : Quantity\nDensity = Mass </> Volume\n\nMassDensity : Quantity\nMassDensity = Density\n\nSurfaceDensity : Quantity\nSurfaceDensity = Mass </> Area\n\nSpecificVolume : Quantity\nSpecificVolume = Volume </> Mass\n\nCurrentDensity : Quantity\nCurrentDensity = ElectricCurrent </> Area\n\nMagneticFieldStrength : Quantity\nMagneticFieldStrength = ElectricCurrent </> Length\n\nAmountConcentration : Quantity\nAmountConcentration = AmountOfSubstance </> Volume\n\nConcentration : Quantity\nConcentration = AmountConcentration\n\nMassConcentration : Quantity\nMassConcentration = Mass </> Volume\n\nLuminance : Quantity\nLuminance = LuminousIntensity </> Area\n\nRefractiveIndex : Quantity\nRefractiveIndex = Scalar\n\nRelativePermeability : Quantity\nRelativePermeability = Scalar\n\n\n-- Coherent derived units in the SI with special names and symbols\n\nPlaneAngle : Quantity\nPlaneAngle = Scalar\n\nSolidAngle : Quantity\nSolidAngle = Scalar\n\nFrequency : Quantity\nFrequency = Time ^ (-1)\n\nForce' : Quantity\nForce' = Acceleration <*> Mass\n\nPressure : Quantity\nPressure = Force' </> Area\n\nStress : Quantity\nStress = Pressure\n\nEnergy : Quantity\nEnergy = Force' <*> Length\n\nWork : Quantity\nWork = Energy\n\nAmountOfHeat : Quantity\nAmountOfHeat = Energy\n\nPower : Quantity\nPower = Energy </> Time\n\nRadiantFlux : Quantity\nRadiantFlux = Power\n\nElectricCharge : Quantity\nElectricCharge = Time <*> ElectricCurrent\n\nAmountOfElectricity : Quantity\nAmountOfElectricity = ElectricCharge\n\nElectricPotentialDifference : Quantity\nElectricPotentialDifference = Power </> ElectricCurrent\n\nElectromotiveForce : Quantity\nElectromotiveForce = ElectricPotentialDifference\n\nCapacitance : Quantity\nCapacitance = ElectricCharge </> ElectricPotentialDifference\n\nElectricResistance : Quantity\nElectricResistance = ElectricPotentialDifference </> ElectricCurrent\n\nElectricConductance : Quantity\nElectricConductance = ElectricCurrent </> ElectricPotentialDifference\n\nMagneticFlux : Quantity\nMagneticFlux = Time <*> ElectricPotentialDifference\n\nMagneticFluxDensity : Quantity\nMagneticFluxDensity = MagneticFlux </> Area\n\nInductance : Quantity\nInductance = MagneticFlux </> ElectricCurrent\n\n-- Celsius temperature\n\nLuminousFlux : Quantity\nLuminousFlux = LuminousIntensity <*> SolidAngle\n\nIlluminance : Quantity\nIlluminance = LuminousFlux </> Area\n\nActivityReferredToARadionuclide : Quantity\nActivityReferredToARadionuclide = Time ^ (-1)\n\n-- ... sometimes incorrectly called\nRadioactivity : Quantity\nRadioactivity = ActivityReferredToARadionuclide\n\nAbsorbedDose : Quantity\nAbsorbedDose = Energy </> Mass\n\nSpecificEnergy : Quantity\nSpecificEnergy = AbsorbedDose\n\nKerma : Quantity\nKerma = AbsorbedDose\n\nDoseEquivalent : Quantity\nDoseEquivalent = Energy </> Mass\n\nAmbientDoseEquivalent : Quantity\nAmbientDoseEquivalent = DoseEquivalent\n\nDirectionalDoseEquivalent : Quantity\nDirectionalDoseEquivalent = DoseEquivalent\n\nPersonalDoseEquivalent : Quantity\nPersonalDoseEquivalent = DoseEquivalent\n\nCatalyticActivity : Quantity\nCatalyticActivity = AmountOfSubstance </> Time\n\n\n-- Examples of SI coherent derived units whose names and symbols include SI\n-- coherent derived units with special names and symbols\n\nDynamicViscosity : Quantity\nDynamicViscosity = Stress <*> Time\n\nKinematicViscosity : Quantity\nKinematicViscosity = Area </> Time\n\nMomentOfForce : Quantity\nMomentOfForce = Force' <*> Length\n\nMoment : Quantity\nMoment = MomentOfForce\n\nTorque : Quantity\nTorque = MomentOfForce\n\nSurfaceTension : Quantity\nSurfaceTension = Force' </> Length\n\nAngularVelocity : Quantity\nAngularVelocity = PlaneAngle </> Time\n\nAngularAcceleration : Quantity\nAngularAcceleration = AngularVelocity </> Time\n\nHeatFluxDensity : Quantity\nHeatFluxDensity = Power </> Area\n\nIrradiance : Quantity\nIrradiance = HeatFluxDensity\n\nHeatCapacity : Quantity\nHeatCapacity = Energy </> Temperature\n\nEntropy : Quantity\nEntropy = HeatCapacity\n\nSpecificHeatCapacity : Quantity\nSpecificHeatCapacity = HeatCapacity </> Mass\n\nSpecificEntropy : Quantity\nSpecificEntropy = Entropy </> Mass\n\nThermalConductivity : Quantity\nThermalConductivity = Power </> (Length <*> Temperature)\n\nEnergyDensity : Quantity\nEnergyDensity = Energy </> Volume\n\nElectricFieldStrength : Quantity\nElectricFieldStrength = ElectricPotentialDifference </> Length\n\nElectricChargeDensity : Quantity\nElectricChargeDensity = ElectricCharge </> Volume\n\nSurfaceChargeDensity : Quantity\nSurfaceChargeDensity = ElectricCharge </> Area\n\nElectricFluxDensity : Quantity\nElectricFluxDensity = SurfaceChargeDensity\n\nElectricDisplacement : Quantity\nElectricDisplacement = SurfaceChargeDensity\n\nPermettivity : Quantity\nPermettivity = Capacitance </> Length\n\nPermeability : Quantity\nPermeability = Inductance </> Length\n\nMolarEnergy : Quantity\nMolarEnergy = Energy </> AmountOfSubstance\n\nMolarHeatCapacity : Quantity\nMolarHeatCapacity = MolarEnergy\n\nExposure : Quantity\nExposure = ElectricCharge </> Mass\n\nAbsorbedDoseRate : Quantity\nAbsorbedDoseRate = AbsorbedDose </> Time\n\nRadiantIntensity : Quantity\nRadiantIntensity = Power </> SolidAngle\n\nRadiance : Quantity\nRadiance = RadiantIntensity </> Area\n\nCatalyticActivityConcentration : Quantity\nCatalyticActivityConcentration = CatalyticActivity </> Volume\n", "meta": {"hexsha": "e16d5e37f5e2a3572439a00234b187899032fc1b", "size": 5626, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Quantities/SIDerivedQuantities.idr", "max_stars_repo_name": "timjb/quantities", "max_stars_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 112, "max_stars_repo_stars_event_min_datetime": "2015-01-18T13:52:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-08T14:15:46.000Z", "max_issues_repo_path": "Quantities/SIDerivedQuantities.idr", "max_issues_repo_name": "timjb/quantities", "max_issues_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2015-11-04T08:51:41.000Z", "max_issues_repo_issues_event_max_datetime": "2018-04-17T09:52:29.000Z", "max_forks_repo_path": "Quantities/SIDerivedQuantities.idr", "max_forks_repo_name": "timjb/quantities", "max_forks_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 9, "max_forks_repo_forks_event_min_datetime": "2015-04-28T23:49:30.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-01T17:28:34.000Z", "avg_line_length": 21.2301886792, "max_line_length": 75, "alphanum_fraction": 0.8016352648, "num_tokens": 1328, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673087708699, "lm_q2_score": 0.6442251133170356, "lm_q1q2_score": 0.5236695341046274}}
{"text": "longer : String -> String -> Nat\nlonger word1 word2\n\t= let len1 = length word1 \n\t      len2 = length word2 \n      in if len1 > len2 then len1 else len2", "meta": {"hexsha": "341b439067f810ee3dd25d71e6611b5b34487444", "size": 151, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Let_Where.idr", "max_stars_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_stars_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "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": "Let_Where.idr", "max_issues_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_issues_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Let_Where.idr", "max_forks_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_forks_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "max_forks_repo_licenses": ["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.2, "max_line_length": 43, "alphanum_fraction": 0.6490066225, "num_tokens": 48, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673269042767, "lm_q2_score": 0.6442250928250375, "lm_q1q2_score": 0.5236695291293477}}
{"text": "module Toolkit.Decidable.Equality.Views\n\nimport Decidable.Equality\n\nimport Toolkit.Decidable.Informative\n\n%default total\n\npublic export\ndata AllEqual : (a,b,c : ty) -> Type where\n  AE : AllEqual a a a\n\npublic export\ndata Error = AB | AC\n\nabNotEq : (a = b -> Void) -> AllEqual a b c -> Void\nabNotEq f AE = f Refl\n\nacNotEq : (a = c -> Void) -> AllEqual a b c -> Void\nacNotEq f AE = f Refl\n\nexport\nallEqual : DecEq type\n        => (a,b,c : type)\n                 -> DecInfo (Error) (AllEqual a b c)\nallEqual a b c with (decEq a b)\n  allEqual a a c | (Yes Refl) with (decEq a c)\n    allEqual a a a | (Yes Refl) | (Yes Refl) = Yes AE\n    allEqual a a c | (Yes Refl) | (No contra)\n      = No (AC) (acNotEq contra)\n  allEqual a b c | (No contra)\n    = No (AB) (abNotEq contra)\n\n\n-- [ EOF ]\n", "meta": {"hexsha": "77b4af8d86043687bea0adaf1f3a08ae859b625c", "size": 783, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Toolkit/Decidable/Equality/Views.idr", "max_stars_repo_name": "gallais/linear-circuits", "max_stars_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2020-11-03T11:33:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-14T17:11:38.000Z", "max_issues_repo_path": "src/Toolkit/Decidable/Equality/Views.idr", "max_issues_repo_name": "gallais/linear-circuits", "max_issues_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "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/Toolkit/Decidable/Equality/Views.idr", "max_forks_repo_name": "gallais/linear-circuits", "max_forks_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-02-09T19:49:11.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-09T19:49:11.000Z", "avg_line_length": 21.75, "max_line_length": 53, "alphanum_fraction": 0.6143039591, "num_tokens": 264, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8128672997041659, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.523669522711204}}
{"text": "||| Projection based on Full Merge.\n|||\n||| The Tech Report 'A Linear Decomposition of Multiparty Sessions for Safe Distributed Programming' (DTRS12-2) defines a 'full merge' operation.\n||| This merge operation improves the expressiveness of projection compared to Plain Merge.\n|||\nmodule Sessions.Projection.Full\n\nimport Decidable.Equality\nimport Data.List\nimport Data.List.Elem\n\nimport Data.List1\n\nimport Sessions.Meta\n\nimport Sessions.Global\nimport Sessions.Global.Involved\n\nimport Sessions.Local\nimport Sessions.Local.Same\n\nimport public Sessions.Projection.Error\n\n%default total\n\n\n-- [ EOF ]\n", "meta": {"hexsha": "ca7829de34a7eb8350057d19eaa32c666480f2a6", "size": 597, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Sessions/Projection/Full.idr", "max_stars_repo_name": "DSbD-AppControl/sessions-playground", "max_stars_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-08-19T13:13:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-19T13:13:10.000Z", "max_issues_repo_path": "Sessions/Projection/Full.idr", "max_issues_repo_name": "DSbD-AppControl/sessions-playground", "max_issues_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Sessions/Projection/Full.idr", "max_forks_repo_name": "DSbD-AppControl/sessions-playground", "max_forks_repo_head_hexsha": "d304de2a5bf9a5268f3cd8aef9402face1bc7fdc", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.3214285714, "max_line_length": 145, "alphanum_fraction": 0.7906197655, "num_tokens": 128, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.782662489091802, "lm_q2_score": 0.6688802537704064, "lm_q1q2_score": 0.5235074843203025}}
{"text": "-- ---------------------------------------------- [ DependentStateMachines.idr ]\n-- Module      : Exercises.DependentStateMachines\n-- Description : Solutions to the Chapter 14 exercises in Edwin Brady's\n--               book, \"Type-Driven Development with Idris.\"\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Exercises.DependentStateMachines\n\nimport public Chapter.DependentStateMachines\n\n-- -------------------------------------------------------- [ 14.2.5 Exercises ]\n\n%access public export\n\ndata Access = LoggedOut | LoggedIn\ndata PwdCheck = Correct | Incorrect\n\ndata ShellCmd  : (ty : Type) -> Access -> (ty -> Access) -> Type where\n     Password  : String -> ShellCmd PwdCheck LoggedOut\n                                             (\\res => case res of\n                                                           Correct => LoggedIn\n                                                           Incorrect => LoggedOut)\n     Logout    : ShellCmd () LoggedIn (const LoggedOut)\n     GetSecret : ShellCmd String LoggedIn (const LoggedIn)\n\n     PutStr    : String -> ShellCmd () state (const state)\n     Pure      : (res : ty) -> ShellCmd ty (state_fn res) state_fn\n     (>>=)     : ShellCmd a state1 state2_fn ->\n                 ((res : a) -> ShellCmd b (state2_fn res) state3_fn) ->\n                 ShellCmd b state1 state3_fn\n\n%access export\n\nsession : ShellCmd () LoggedOut (const LoggedOut)\nsession = do Correct <- Password \"wurzel\"\n               | Incorrect => PutStr \"Wrong password\"\n             PutStr $ \"Secret code: \" ++ show !GetSecret ++ \"\\n\"\n             Logout\n\n-- NOTE: The following should not type check.\n{-\nbad_session : ShellCmd () LoggedOut (const LoggedOut)\nbad_session = do Password \"wurzel\"\n                 PutStr $ \"Secret code: \" ++ !GetSecret ++ \"\\n\"\n                 Logout\n\nno_logout : ShellCmd () LoggedOut (const LoggedOut)\nno_logout = do Correct <- Password \"wurzel\"\n                 | Incorrect => PutStr \"Wrong password\"\n               PutStr $ \"Secret code: \" ++ show !GetSecret ++ \"\\n\"\n-}\n\nnamespace DependentVendingMachine\n\n    export\n    VendState : Type\n    VendState = (Nat, Nat)\n\n    public export\n    data Input = COIN\n               | VEND\n               | CHANGE\n               | REFILL Nat\n\n    data CoinResult = Inserted | Rejected\n\n    public export\n    data MachineCmd : (ty : Type) -> VendState -> (ty -> VendState) -> Type where\n\n         InsertCoin : MachineCmd CoinResult (pounds, chocs)\n                                 (\\res => case res of\n                                               Inserted => (S pounds, chocs)\n                                               Rejected => (pounds, chocs))\n\n         Vend : MachineCmd () (S pounds, S chocs) (const (pounds, chocs))\n\n         GetCoins : MachineCmd () (pounds, chocs) (const (Z, chocs))\n\n         Refill : (bars : Nat) -> MachineCmd () (Z, chocs)\n                                             (const (Z, bars + chocs))\n\n         Display : String -> MachineCmd () state (const state)\n\n         GetInput : MachineCmd (Maybe Input) state (const state)\n\n         Pure : (res : ty) -> MachineCmd ty (state_fn res) state_fn\n\n         (>>=) : MachineCmd a state1 state2_fn ->\n                 ((res : a) -> MachineCmd b (state2_fn res) state3_fn) ->\n                 MachineCmd b state1 state3_fn\n\n    public export\n    data MachineIO : VendState -> Type where\n         Do : MachineCmd a state1 state2_fn ->\n              ((res : a) -> Inf (MachineIO (state2_fn res))) -> MachineIO state1\n\nnamespace MachineDo\n\n    public export\n    (>>=) : MachineCmd a state1 state2_fn ->\n            ((res : a) -> Inf (MachineIO (state2_fn res))) -> MachineIO state1\n    (>>=) = Do\n\n-- --------------------------------------- [ 13.1.4 A Verified Vending Machine ]\n\nmutual\n\n  vend : MachineIO (pounds, chocs)\n  vend {pounds = S _} {chocs = S _} = do Vend\n                                         Display \"Enjoy!\"\n                                         machineLoop\n  vend {pounds = Z}                 = do Display \"Insert a coin\"\n                                         machineLoop\n  vend {chocs = Z}                  = do Display \"Out of stock\"\n                                         machineLoop\n\n  refill : (num : Nat) -> MachineIO (pounds, chocs)\n  refill {pounds = Z} num = do Refill num\n                               machineLoop\n  refill _                = do Display \"Can't refill: Coins in machine\"\n                               machineLoop\n\n  machineLoop : MachineIO (pounds, chocs)\n  machineLoop =\n      do Just x <- GetInput\n           | Nothing => do Display \"Invalid input\"\n                           machineLoop\n         case x of\n              COIN       => do Inserted <- InsertCoin\n                                 | Rejected => do Display \"Coin rejected\"\n                                                  machineLoop\n                               Display \"Coin inserted\"\n                               machineLoop\n              VEND       => vend\n              CHANGE     => do GetCoins\n                               Display \"Change returned\"\n                               machineLoop\n              REFILL num => refill num\n\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "ac834c9a2895ca1b7ad7eef4772d94206fd99568", "size": 5257, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Exercises/DependentStateMachines.idr", "max_stars_repo_name": "yurrriq/tdd-with-idris", "max_stars_repo_head_hexsha": "873c6c719706d06179527c5d93982bb7c184da90", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-15T01:29:36.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-15T01:29:36.000Z", "max_issues_repo_path": "src/Exercises/DependentStateMachines.idr", "max_issues_repo_name": "yurrriq/tdd-with-idris", "max_issues_repo_head_hexsha": "873c6c719706d06179527c5d93982bb7c184da90", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2016-11-21T23:42:45.000Z", "max_issues_repo_issues_event_max_datetime": "2016-12-01T05:43:10.000Z", "max_forks_repo_path": "src/Exercises/DependentStateMachines.idr", "max_forks_repo_name": "yurrriq/tdd-with-idris", "max_forks_repo_head_hexsha": "873c6c719706d06179527c5d93982bb7c184da90", "max_forks_repo_licenses": ["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.55, "max_line_length": 82, "alphanum_fraction": 0.4782195168, "num_tokens": 1136, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7217432062975979, "lm_q2_score": 0.7248702702332476, "lm_q1q2_score": 0.5231701929879503}}
{"text": "\nimport Data.Vect\n\nvappend : Vect n a -> Vect m a -> Vect (n+m) a \nvappend [] ys = ys\nvappend (x :: xs) ys = x :: vappend xs ys \n", "meta": {"hexsha": "3de440e0d2f2cca4cccc4c3e70534978453590f0", "size": 129, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "vappend_solution.idr", "max_stars_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_stars_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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": "vappend_solution.idr", "max_issues_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_issues_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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": "vappend_solution.idr", "max_forks_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_forks_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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.4285714286, "max_line_length": 47, "alphanum_fraction": 0.5813953488, "num_tokens": 47, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8031738057795403, "lm_q2_score": 0.6513548646660543, "lm_q1q2_score": 0.5231511655668523}}
{"text": "-- ----------------------------------------------------------------- [ Set.idr ]\n-- Module    : Set.idr\n-- Copyright : (c) 2015,2016 See CONTRIBUTORS.md\n-- License   : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\n||| Implementation of a Set using an AVL Binary Search Tree.\nmodule Data.AVL.Set\n\nimport Data.AVL\n\n%access export\n\n-- ------------------------------------------------------------- [ Definitions ]\n||| An ordered set.\ndata Set : (a : Type) -> Type where\n  MkSet : {a : Type} -> AVLTree n a Unit -> Set a\n\n||| Return a empty set.\nempty : (Ord a) => Set a\nempty = MkSet (Element Empty AVLEmpty)\n\n||| Insert an element into a set.\ninsert : (Ord a) => a -> Set a -> Set a\ninsert a (MkSet m) = MkSet (snd $ AVL.API.insert a () m)\n\n||| Does the set contain the given element.\ncontains : (Ord a) => a -> Set a -> Bool\ncontains a (MkSet m) = isJust (lookup a m)\n\n||| Construct a set that contains all elements in both of the input sets.\nunion : (Ord a) => Set a -> Set a -> Set a\nunion (MkSet m1) (MkSet m2) = MkSet (snd $ AVL.API.foldr insertElement (_ ** m1) m2)\n  where\n    insertElement : (Ord a) => a\n                            -> Unit\n                            -> (h : Nat ** AVLTree h a Unit)\n                            -> (h' : Nat ** AVLTree h' a Unit)\n    insertElement k v m' = AVL.API.insert k v (snd m')\n\n||| Return the size of the Dictionary.\nsize : Set a -> Nat\nsize (MkSet m) = AVL.API.size m\n\n||| Construct a set that contains the elements from the first input\n||| set but not the second.\n|||\n||| *Note* Not an efficient operation as we are constructing a new set\n||| instead of modifying the right one.\ndifference : (Ord a) => Set a -> Set a -> Set a\ndifference (MkSet m1) s2 = AVL.API.foldr (\\e,_,t => if (contains e s2) then t else Set.insert e t) empty $ m1\n\n||| Construct a set that contains common elements of the input sets.\nintersection : (Ord a) => Set a -> Set a -> Set a\nintersection s1 s2 = difference s1 (difference s1 s2)\n\n||| Construct a list using the given set.\ntoList : Set a -> List a\ntoList (MkSet m) = map fst $ AVL.API.toList m\n\n||| Construct a set from the given list.\nfromList : (Ord a) => List a -> Set a\nfromList xs = (foldl (\\t,k => Set.insert k t) empty xs)\n\n-- --------------------------------------------------------- [ Implementations ]\nFoldable Set where\n  foldr f i (MkSet m) = foldr (\\x,_,p => f x p) i m\n\nEq a => Eq (Set a) where\n  (==) (MkSet (Element t _)) (MkSet (Element t' _)) = t == t'\n\nShow a => Show (Set a) where\n  show s = \"{ \" ++ (unwords . intersperse \",\" . map show . Set.toList $ s) ++ \" }\"\n\n\nnamespace Predicate\n\n  export\n  data Elem : (value : type) -> (set : Set type) -> Type where\n    IsElem : (prf : HasKey value tree)\n          -> Elem value (MkSet tree)\n\n  private\n  elemNotInSet : (prfIsNotElem : HasKey value tree -> Void) -> Elem value (MkSet tree) -> Void\n  elemNotInSet prfIsNotElem (IsElem prf) = prfIsNotElem prf\n\n  isElem : DecEq type\n        => (value : type)\n        -> (set   : Set type)\n        -> Dec (Elem value set)\n  isElem value (MkSet tree) with (isKey value tree)\n    isElem value (MkSet tree) | (Yes prf) = Yes (IsElem prf)\n    isElem value (MkSet tree) | (No prfIsNotElem) = No (elemNotInSet prfIsNotElem)\n\nnamespace Quantifier\n\n  data All : (predicate : type -> Type) -> (set : Set type) -> Type where\n    Satisfies : (prf : AllKeys p tree) -> All p (MkSet tree)\n\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "80da638ac6c8a55854a2f8b7bff1f3eaafabfef5", "size": 3496, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/AVL/Set.idr", "max_stars_repo_name": "elba/idris-containers", "max_stars_repo_head_hexsha": "b92d489abcb32774fb6adfd7f26a28c082cc4bef", "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/AVL/Set.idr", "max_issues_repo_name": "elba/idris-containers", "max_issues_repo_head_hexsha": "b92d489abcb32774fb6adfd7f26a28c082cc4bef", "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/AVL/Set.idr", "max_forks_repo_name": "elba/idris-containers", "max_forks_repo_head_hexsha": "b92d489abcb32774fb6adfd7f26a28c082cc4bef", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-05-19T12:29:49.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-19T12:29:49.000Z", "avg_line_length": 34.96, "max_line_length": 109, "alphanum_fraction": 0.5549199085, "num_tokens": 1003, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7279754371026367, "lm_q2_score": 0.7185943805178139, "lm_q1q2_score": 0.523119058256954}}
{"text": "= Imp : Simple Imperative Programs\n\n> module Imp\n\n> import Logic\n\nIn this chapter, we begin a new direction that will continue for the rest of the\ncourse. Up to now most of our attention has been focused on various aspects of\nIdris itself, while from now on we'll mostly be using Idris to formalize other\nthings. (We'll continue to pause from time to time to introduce a few additional\naspects of Idris.)\n\nOur first case study is a _simple imperative programming language_ called Imp,\nembodying a tiny core fragment of conventional mainstream languages such as C\nand Java. Here is a familiar mathematical function written in Imp.\n\n```\n     Z ::= X;;\n     Y ::= 1;;\n     WHILE not (Z == 0) DO\n       Y ::= Y * Z;;\n       Z ::= Z - 1\n     END\n```\n\nThis chapter looks at how to define the _syntax_ and _semantics_ of Imp; the\nchapters that follow develop a theory of _program equivalence_ and introduce\n_Hoare Logic_, a widely used logic for reasoning about imperative programs.\n\n> import Maps\n\n> %hide (\\\\)\n\n> %default total\n> %access public export\n\n\n== Arithmetic and Boolean Expressions\n\nWe'll present Imp in three parts: first a core language of _arithmetic and\nboolean expressions_, then an extension of these expressions with _variables_,\nand finally a language of _commands_ including assignment, conditions,\nsequencing, and loops.\n\n\n=== Syntax\n\nThese two definitions specify the _abstract syntax_ of arithmetic and boolean\nexpressions.\n\n> data AExp0 : Type where\n>   ANum0 : Nat -> AExp0\n>   APlus0 : AExp0 -> AExp0 -> AExp0\n>   AMinus0 : AExp0 -> AExp0 -> AExp0\n>   AMult0 : AExp0 -> AExp0 -> AExp0\n>\n> data BExp0 : Type where\n>   BTrue0 : BExp0\n>   BFalse0 : BExp0\n>   BEq0 : AExp0 -> AExp0 -> BExp0\n>   BLe0 : AExp0 -> AExp0 -> BExp0\n>   BNot0 : BExp0 -> BExp0\n>   BAnd0 : BExp0 -> BExp0 -> BExp0\n\nIn this chapter, we'll elide the translation from the concrete syntax that a\nprogrammer would actually write to these abstract syntax trees \u2014 the process\nthat, for example, would translate the string \\idr{\"1+2*3\"} to the AST\n\n```idris\n      APlus0 (ANum0 1) (AMult0 (ANum0 2) (ANum0 3))\n```\n\nThe optional chapter `ImpParser` develops a simple implementation of a lexical\nanalyzer and parser that can perform this translation. You do _not_ need to\nunderstand that chapter to understand this one, but if you haven't taken a\ncourse where these techniques are covered (e.g., a compilers course) you may\nwant to skim it.\n\nFor comparison, here's a conventional BNF (Backus-Naur Form) grammar defining\nthe same abstract syntax:\n\n```\n    a ::= Nat\n        | a + a\n        | a - a\n        | a * a\n\n    b ::= True\n        | False\n        | a = a\n        | a \u2264 a\n        | not b\n        | b and b\n```\n\nCompared to the Idris version above...\n\n  - The BNF is more informal \u2014 for example, it gives some suggestions about the\n    surface syntax of expressions (like the fact that the addition operation is\n    written \\idr{+} and is an infix symbol) while leaving other aspects of\n    lexical analysis and parsing (like the relative precedence of \\idr{+},\n    \\idr{-}, and \\idr{*}, the use of parens to explicitly group subexpressions,\n    etc.) unspecified. Some additional information (and human intelligence)\n    would be required to turn this description into a formal definition, for\n    example when implementing a compiler.\n\n    The Idris version consistently omits all this information and concentrates\n    on the abstract syntax only.\n\n  - On the other hand, the BNF version is lighter and easier to read. Its\n    informality makes it flexible, a big advantage in situations like\n    discussions at the blackboard, where conveying general ideas is more\n    important than getting every detail nailed down precisely.\n\n    Indeed, there are dozens of BNF-like notations and people switch freely\n    among them, usually without bothering to say which form of BNF they're using\n    because there is no need to: a rough-and-ready informal understanding is all\n    that's important.\n\nIt's good to be comfortable with both sorts of notations: informal ones for\ncommunicating between humans and formal ones for carrying out implementations\nand proofs.\n\n\n=== Evaluation\n\n_Evaluating_ an arithmetic expression produces a number.\n\n> aeval0 : (a : AExp0) -> Nat\n> aeval0 (ANum0 n) = n\n> aeval0 (APlus0 a1 a2) = (aeval0 a1) + (aeval0 a2)\n> aeval0 (AMinus0 a1 a2) = (aeval0 a1) `minus` (aeval0 a2)\n> aeval0 (AMult0 a1 a2) = (aeval0 a1) * (aeval0 a2)\n\n> test_aeval1 : aeval0 (APlus0 (ANum0 2) (ANum0 2)) = 4\n> test_aeval1 = Refl\n\nSimilarly, evaluating a boolean expression yields a boolean.\n\n> beval0 : (b : BExp0) -> Bool\n> beval0 BTrue0 = True\n> beval0 BFalse0 = False\n> beval0 (BEq0 a1 a2) = (aeval0 a1) == (aeval0 a2)\n> beval0 (BLe0 a1 a2) = lte (aeval0 a1) (aeval0 a2)\n> beval0 (BNot0 b1) = not (beval0 b1)\n> beval0 (BAnd0 b1 b2) = (beval0 b1) && (beval0 b2)\n\n=== Optimization\n\nWe haven't defined very much yet, but we can already get some mileage out of the\ndefinitions. Suppose we define a function that takes an arithmetic expression\nand slightly simplifies it, changing every occurrence of \\idr{0+e} (i.e.,\n\\idr{(APlus0 (ANum0 0) e}) into just \\idr{e}.\n\n> optimize_0plus : (a : AExp0) -> AExp0\n> optimize_0plus (ANum0 n) = ANum0 n\n> optimize_0plus (APlus0 (ANum0 Z) e2) =\n>   optimize_0plus e2\n> optimize_0plus (APlus0 e1 e2) =\n>   APlus0 (optimize_0plus e1) (optimize_0plus e2)\n> optimize_0plus (AMinus0 e1 e2) =\n>   AMinus0 (optimize_0plus e1) (optimize_0plus e2)\n> optimize_0plus (AMult0 e1 e2) =\n>   AMult0 (optimize_0plus e1) (optimize_0plus e2)\n\nTo make sure our optimization is doing the right thing we can test it on some\nexamples and see if the output looks OK.\n\n> test_optimize_0plus :\n>   optimize_0plus (APlus0 (ANum0 2)\n>                         (APlus0 (ANum0 0)\n>                                (APlus0 (ANum0 0) (ANum0 1))))\n>   = APlus0 (ANum0 2) (ANum0 1)\n\nBut if we want to be sure the optimization is correct \u2014 i.e., that evaluating an\noptimized expression gives the same result as the original \u2014 we should prove it.\n\n> optimize_0plus_sound : aeval0 (optimize_0plus a) = aeval0 a\n> optimize_0plus_sound {a=ANum0 _} = Refl\n> optimize_0plus_sound {a=APlus0 (ANum0 Z) y} =\n>   optimize_0plus_sound {a=y}\n> optimize_0plus_sound {a=APlus0 (ANum0 (S k)) y} =\n>   cong {f=\\x=>S(k+x)} $ optimize_0plus_sound {a=y}\n> optimize_0plus_sound {a=APlus0 (APlus0 x z) y} =\n>   rewrite optimize_0plus_sound {a=APlus0 x z} in\n>   rewrite optimize_0plus_sound {a=y} in\n>   Refl\n> optimize_0plus_sound {a=APlus0 (AMinus0 x z) y} =\n>   rewrite optimize_0plus_sound {a=x} in\n>   rewrite optimize_0plus_sound {a=y} in\n>   rewrite optimize_0plus_sound {a=z} in\n>   Refl\n> optimize_0plus_sound {a=APlus0 (AMult0 x z) y} =\n>   rewrite optimize_0plus_sound {a=x} in\n>   rewrite optimize_0plus_sound {a=y} in\n>   rewrite optimize_0plus_sound {a=z} in\n>   Refl\n> optimize_0plus_sound {a=AMinus0 x y} =\n>   rewrite optimize_0plus_sound {a=x} in\n>   rewrite optimize_0plus_sound {a=y} in\n>   Refl\n> optimize_0plus_sound {a=AMult0 x y} =\n>   rewrite optimize_0plus_sound {a=x} in\n>   rewrite optimize_0plus_sound {a=y} in\n>   Refl\n\n\n== Coq Automation\n\n\\ \\todo[inline]{Move the whole subsection to \\idr{Pruviloj} chapter?}\n\nThe amount of repetition in this last proof is a little annoying. And if either\nthe language of arithmetic expressions or the optimization being proved sound\nwere significantly more complex, it would start to be a real problem.\n\nSo far, we've been doing all our proofs using just a small handful of Coq's\ntactics and completely ignoring its powerful facilities for constructing parts\nof proofs automatically. This section introduces some of these facilities, and\nwe will see more over the next several chapters. Getting used to them will take\nsome energy \u2014 Coq's automation is a power tool \u2014 but it will allow us to scale\nup our efforts to more complex definitions and more interesting properties\nwithout becoming overwhelmed by boring, repetitive, low-level details.\n\n\n=== Tacticals\n\nTacticals is Coq's term for tactics that take other tactics as arguments \u2014\n\"higher-order tactics,\" if you will.\n\n\n==== The `try` Tactical\n\n\\ \\todo[inline]{Exists in Pruviloj}\n\nIf `T` is a tactic, then `try T` is a tactic that is just like `T` except that,\nif `T` fails, `try T` successfully does nothing at all (instead of failing).\n\n```coq\nTheorem silly1 : forall ae, aeval ae = aeval ae.\nProof. try Refl. (* this just does Refl *) Qed.\n\nTheorem silly2 : forall (P : Type), P -> P.\nProof.\n  intros P HP.\n  try Refl. (* just Refl would have failed *)\n  apply HP. (* we can still finish the proof in some other way *)\nQed.\n```\n\nThere is no real reason to use `try` in completely manual proofs like these, but\nit is very useful for doing automated proofs in conjunction with the `;`\ntactical, which we show next.\n\n\n==== The `;` Tactical (Simple Form)\n\n\\ \\todo[inline]{Approximated by \\idr{andThen} in Pruviloj}\n\nIn its most common form, the `;` tactical takes two tactics as arguments. The\ncompound tactic `T;T'` first performs `T` and then performs `T'` on each subgoal\ngenerated by `T`.\n\nFor example, consider the following trivial lemma:\n\n```coq\nLemma foo : forall n, lte 0 n = True.\nProof.\n  intros.\n  destruct n.\n    (* Leaves two subgoals, which are discharged identically...  *)\n    - (* n=0 *) simpl. Refl.\n    - (* n=Sn' *) simpl. Refl.\nQed.\n```\n\nWe can simplify this proof using the `;` tactical:\n\n```coq\nLemma foo' : forall n, lte 0 n = True.\nProof.\n  intros.\n  (* destruct the current goal *)\n  destruct n;\n  (* then simpl each resulting subgoal *)\n  simpl;\n  (* and do Refl on each resulting subgoal *)\n  Refl.\nQed.\n```\n\nUsing `try` and `;` together, we can get rid of the repetition in the proof that\nwas bothering us a little while ago.\n\n\\ \\todo[inline]{Mention\n\\href{http://docs.idris-lang.org/en/latest/reference/misc.html\\#alternatives}{Alternatives} ?}\n\n```coq\nTheorem optimize_0plus_sound': forall a,\n  aeval (optimize_0plus a) = aeval a.\nProof.\n  intros a.\n  induction a;\n    (* Most cases follow directly by the IH... *)\n    try (simpl; rewrite IHa1; rewrite IHa2; Refl).\n    (* ... but the remaining cases -- ANum and APlus --\n       are different: *)\n  - (* ANum *) Refl.\n  - (* APlus *)\n    destruct a1;\n      (* Again, most cases follow directly by the IH: *)\n      try (simpl; simpl in IHa1; rewrite IHa1;\n           rewrite IHa2; Refl).\n    (* The interesting case, on which the try...\n       does nothing, is when e1 = ANum n. In this\n       case, we have to destruct n (to see whether\n       the optimization applies) and rewrite with the\n       induction hypothesis. *)\n    + (* a1 = ANum n *) destruct n;\n      simpl; rewrite IHa2; Refl. Qed.\n```\n\nCoq experts often use this \"`...; try...`\" idiom after a tactic like `induction`\nto take care of many similar cases all at once. Naturally, this practice has an\nanalog in informal proofs. For example, here is an informal proof of the\noptimization theorem that matches the structure of the formal one:\n\n_Theorem_: For all arithmetic expressions `a`,\n```\n       aeval (optimize_0plus a) = aeval a.\n```\n_Proof_: By induction on `a`. Most cases follow directly from the `IH`. The\nremaining cases are as follows:\n\n  - Suppose `a = ANum n` for some `n`. We must show\n```\n       aeval (optimize_0plus (ANum n)) = aeval (ANum n).\n```\n    This is immediate from the definition of `optimize_0plus`.\n\n  - Suppose `a = APlus a1 a2` for some `a1` and `a2`. We must show\n```\n       aeval (optimize_0plus (APlus a1 a2)) = aeval (APlus a1 a2).\n```\n\n    Consider the possible forms of `a1`. For most of them, `optimize_0plus`\n    simply calls itself recursively for the subexpressions and rebuilds a new\n    expression of the same form as `a1`; in these cases, the result follows\n    directly from the `IH`. The interesting case is when `a1 = ANum n` for some\n    `n`. If `n = ANum 0`, then\n```\n       optimize_0plus (APlus a1 a2) = optimize_0plus a2\n```\n    and the `IH` for `a2` is exactly what we need. On the other hand, if `n = S\n    n'` for some `n'`, then again `optimize_0plus` simply calls itself\n    recursively, and the result follows from the `IH`. $\\square$\n\nHowever, this proof can still be improved: the first case (for `a = ANum n`) is\nvery trivial \u2014 even more trivial than the cases that we said simply followed\nfrom the `IH` \u2014 yet we have chosen to write it out in full. It would be better\nand clearer to drop it and just say, at the top, \"Most cases are either\nimmediate or direct from the `IH`. The only interesting case is the one for\n`APlus...`\" We can make the same improvement in our formal proof too. Here's how\nit looks:\n\n```coq\nTheorem optimize_0plus_sound'': forall a,\n  aeval (optimize_0plus a) = aeval a.\nProof.\n  intros a.\n  induction a;\n    (* Most cases follow directly by the IH *)\n    try (simpl; rewrite IHa1; rewrite IHa2; Refl);\n    (* ... or are immediate by definition *)\n    try Refl.\n  (* The interesting case is when a = APlus a1 a2. *)\n  - (* APlus *)\n    destruct a1; try (simpl; simpl in IHa1; rewrite IHa1;\n                      rewrite IHa2; Refl).\n    + (* a1 = ANum n *) destruct n;\n      simpl; rewrite IHa2; Refl. Qed.\n```\n\n==== The `;` Tactical (General Form)\n\nThe ; tactical also has a more general form than the simple `T;T'` we've seen\nabove. If `T, T1, ..., Tn` are tactics, then\n\n```coq\n      T; [T1 | T2 | ... | Tn]\n```\n\nis a tactic that first performs `T` and then performs `T1` on the first subgoal\ngenerated by `T`, performs `T2` on the second subgoal, etc.\n\nSo `T;T'` is just special notation for the case when all of the `Ti`'s are the\nsame tactic; i.e.,` T;T`' is shorthand for:\n\n```coq\n      T; [T' | T' | ... | T']\n```\n\n==== The `repeat` Tactical\n\n\\ \\todo[inline]{Approximated by \\idr{repeatUntilFail} in Pruviloj}\n\nThe `repeat` tactical takes another tactic and keeps applying this tactic until\nit fails. Here is an example showing that `10` is in a long list using `repeat`.\n\n```coq\nTheorem In10 : In 10 [1;2;3;4;5;6;7;8;9;10].\nProof.\n  repeat (try (left; Refl); right).\nQed.\n```\n\nThe tactic `repeat T` never fails: if the tactic `T` doesn't apply to the\noriginal goal, then repeat still succeeds without changing the original goal\n(i.e., it repeats zero times).\n\n```coq\nTheorem In10' : In 10 [1;2;3;4;5;6;7;8;9;10].\nProof.\n  repeat (left; Refl).\n  repeat (right; try (left; Refl)).\nQed.\n```\n\nThe tactic `repeat T` also does not have any upper bound on the number of times\nit applies `T`. If `T` is a tactic that always succeeds, then `repeat T` will\nloop forever (e.g., `repeat simpl` loops forever, since `simpl` always\nsucceeds). While evaluation in Coq's term language, Gallina, is guaranteed to\nterminate, tactic evaluation is not! This does not affect Coq's logical\nconsistency, however, since the job of `repeat` and other tactics is to guide\nCoq in constructing proofs; if the construction process diverges, this simply\nmeans that we have failed to construct a proof, not that we have constructed a\nwrong one.\n\n\n==== Exercise: 3 stars (optimize_0plus_b)\n\nSince the \\idr{optimize_0plus} transformation doesn't change the value of\n\\idr{AExp}s, we should be able to apply it to all the \\idr{AExp}s that appear in\na \\idr{BExp} without changing the \\idr{BExp}'s value. Write a function which\nperforms that transformation on \\idr{BExp}s, and prove it is sound. Use the\ntacticals we've just seen to make the proof as elegant as possible.\n\n> optimize_0plus_b : (b : BExp0) -> BExp0\n> optimize_0plus_b b = ?optimize_0plus_b_rhs\n\n> optimize_0plus_b_sound : beval0 (optimize_0plus_b b) = beval0 b\n> optimize_0plus_b_sound = ?optimize_0plus_b_sound_rhs\n\n$\\square$\n\n\n==== Exercise: 4 stars, optional (optimizer)\n\n_Design exercise_: The optimization implemented by our \\idr{optimize_0plus}\nfunction is only one of many possible optimizations on arithmetic and boolean\nexpressions. Write a more sophisticated optimizer and prove it correct. (You\nwill probably find it easiest to start small \u2014 add just a single, simple\noptimization and prove it correct \u2014 and build up to something more interesting\nincrementially.)\n\n> --FILL IN HERE\n\n$\\square$\n\n\n=== Defining New Tactic Notations\n\nCoq also provides several ways of \"programming\" tactic scripts.\n\n  - The `Tactic Notation` idiom illustrated below gives a handy way to define\n    \"shorthand tactics\" that bundle several tactics into a single command.\n\n  - For more sophisticated programming, Coq offers a built-in programming\n    language called `Ltac` with primitives that can examine and modify the proof\n    state. The details are a bit too complicated to get into here (and it is\n    generally agreed that `Ltac` is not the most beautiful part of Coq's\n    design!), but they can be found in the reference manual and other books on\n    Coq, and there are many examples of `Ltac` definitions in the Coq standard\n    library that you can use as examples.\n\n  - There is also an OCaml API, which can be used to build tactics that access\n    Coq's internal structures at a lower level, but this is seldom worth the\n    trouble for ordinary Coq users.\n\nThe `Tactic Notation` mechanism is the easiest to come to grips with, and it\noffers plenty of power for many purposes. Here's an example.\n\n```coq\nTactic Notation \"simpl_and_try\" tactic(c) :=\n  simpl;\n  try c.\n```\n\nThis defines a new tactical called `simpl_and_try` that takes one tactic `c` as\nan argument and is defined to be equivalent to the tactic `simpl; try c`. Now\nwriting \"`simpl_and_try Refl.`\" in a proof will be the same as writing \"`simpl;\ntry Refl.`\"\n\n\n=== The `omega` Tactic\n\n\\ \\todo[inline]{Related to https://github.com/forestbelton/cooper}\n\nThe `omega` tactic implements a decision procedure for a subset of first-order\nlogic called _Presburger arithmetic_. It is based on the Omega algorithm\ninvented in 1991 by William Pugh [Pugh 1991].\n\nIf the goal is a universally quantified formula made out of\n\n  - numeric constants, addition (`+` and `S`), subtraction (`-` and `pred`), and\n    multiplication by constants (this is what makes it Presburger arithmetic),\n\n  - equality (`=` and `/=`) and inequality (`<=`), and\n\n  - the logical connectives `/\\`, `\\/`, `Not`, and `->`,\n\nthen invoking `omega` will either solve the goal or tell you that it is actually\nfalse.\n\n```coq\nExample silly_presburger_example : forall m n o p,\n  m + n <= n + o /\\ o + 3 = p + 3 ->\n  m <= p.\nProof.\n  intros. omega.\nQed.\n```\n\n=== A Few More Handy Tactics\n\nFinally, here are some miscellaneous tactics that you may find convenient.\n\n  - `clear H`: Delete hypothesis `H` from the context.\n\n  - `subst x`: Find an assumption `x = e` or `e = x` in the context, replace `x`\n     with `e` throughout the context and current goal, and clear the assumption.\n\n  - `subst`: Substitute away all assumptions of the form `x = e` or `e = x`.\n\n  - `rename... into...`: Change the name of a hypothesis in the proof context.\n    For example, if the context includes a variable named `x`, then `rename x\n    into y` will change all occurrences of `x` to `y`.\n\n  - `assumption`: Try to find a hypothesis `H` in the context that exactly\n    matches the goal; if one is found, behave like `apply H`.\n\n  - `contradiction`: Try to find a hypothesis `H` in the current context that is\n    logically equivalent to `Void`. If one is found, solve the goal.\n\n  - `constructor`: Try to find a constructor `c` (from some `Inductive`\n    definition in the current environment) that can be applied to solve the\n    current goal. If one is found, behave like `apply c`.\n\nWe'll see examples below.\n\n\n== Evaluation as a Relation\n\nWe have presented \\idr{aeval} and \\idr{beval} as functions. Another way to think\nabout evaluation \u2014 one that we will see is often more flexible \u2014 is as a\n_relation_ between expressions and their values. This leads naturally to\n\\idr{data} definitions like the following one for arithmetic expressions...\n\n```idris\ndata AEvalR : AExp0 -> Nat -> Type where\n  E_ANum : (n: Nat) -> AEvalR (ANum n) n\n  E_APlus : (e1, e2 : AExp0) -> (n1, n2 : Nat) ->\n    AEvalR e1 n1 ->\n    AEvalR e2 n2 ->\n    AEvalR (APlus e1 e2) (n1 + n2)\n  E_AMinus : (e1, e2 : AExp0) -> (n1, n2 : Nat) ->\n    AEvalR e1 n1 ->\n    AEvalR e2 n2 ->\n    AEvalR (AMinus0 e1 e2) (n1 `minus` n2)\n  E_AMult : (e1, e2: AExp0) -> (n1, n2 : Nat) ->\n    AEvalR e1 n1 ->\n    AEvalR e2 n2 ->\n    AEvalR (AMult0 e1 e2) (n1 * n2)\n```\n\n\\todo[inline]{Edit}\n\nIt will be convenient to have an infix notation for \\idr{AEvalR}. We'll write\n\\idr{e \\\\ n} to mean that arithmetic expression \\idr{e} evaluates to value\n\\idr{n}.\n\nIn fact, Idris provides a way to use this notation in the definition of\n\\idr{AevalR} itself. This reduces confusion by avoiding situations where we're\nworking on a proof involving statements in the form \\idr{e \\\\ n} but we have to\nrefer back to a definition written using the form \\idr{AEvalR e n}.\n\nWe do this by first \"reserving\" the notation, then giving the definition\ntogether with a declaration of what the notation means.\n\n> data (\\\\) : AExp0 -> (n : Nat) -> Type where\n>   E_ANum : (ANum0 n) \\\\ n\n>   E_APlus : e1 \\\\ n1 -> e2 \\\\ n2 -> n = n1 + n2 ->\n>             (APlus0 e1 e2) \\\\ n\n\n\\todo[inline]{We don't use \\idr{-} since it requires a proof of \\idr{LTE n1 n2}}\n\n>   E_AMinus : e1 \\\\ n1 -> e2 \\\\ n2 -> n = n1 `minus` n2 ->\n>              (AMinus0 e1 e2) \\\\ n\n>   E_AMult : e1 \\\\ n1 -> e2 \\\\ n2 -> n = n1 * n2 ->\n>             (AMult0 e1 e2) \\\\ n\n\n> AEvalR : AExp0 -> Nat -> Type\n> AEvalR = (\\\\)\n\n\n=== Inference Rule Notation\n\n\\ \\todo[inline]{Add hyperlink}\n\nIn informal discussions, it is convenient to write the rules for \\idr{AEvalR}\nand similar relations in the more readable graphical form of inference rules,\nwhere the premises above the line justify the conclusion below the line (we have\nalready seen them in the `IndProp` chapter).\n\nFor example, the constructor \\idr{E_APlus}...\n\n```idris\n  E_APlus : (e1 \\\\ n1) -> (e2 \\\\ n2) -> (n = n1 + n2) ->\n            (APlus0 e1 e2) \\\\ n\n```\n\n...would be written like this as an inference rule:\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{e1 \\\\ n1}}\n    \\hypo{\\idr{e2 \\\\ n2}}\n    \\infer2[\\idr{E_APlus}]{\\idr{APlus e1 e2 \\\\ n1+n2}}\n  \\end{prooftree}\n\\]\n\nFormally, there is nothing deep about inference rules: they are just\nimplications. You can read the rule name on the right as the name of the\nconstructor and read each of the linebreaks between the premises above the line\n(as well as the line itself) as \\idr{->}. All the variables mentioned in the\nrule (\\idr{e1}, \\idr{n1}, etc.) are implicitly bound by universal quantifiers at\nthe beginning. (Such variables are often called _metavariables_ to distinguish\nthem from the variables of the language we are defining. At the moment, our\narithmetic expressions don't include variables, but we'll soon be adding them.)\nThe whole collection of rules is understood as being wrapped in an function\ndeclaration. In informal prose, this is either elided or else indicated by\nsaying something like \"Let \\idr{AEvalR} be the smallest relation closed under\nthe following rules...\".\n\nFor example, \\idr{\\\\} is the smallest relation closed under these rules:\n\n\\[\n  \\begin{prooftree}\n    \\infer0[\\idr{E_ANum}]{\\idr{ANum n \\\\ n}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{e1 \\\\ n1}}\n    \\hypo{\\idr{e2 \\\\ n2}}\n    \\infer2[\\idr{E_APlus}]{\\idr{APlus e1 e2 \\\\ n1+n2}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{e1 \\\\ n1}}\n    \\hypo{\\idr{e2 \\\\ n2}}\n    \\infer2[\\idr{E_AMinus}]{\\idr{AMinus e1 e2 \\\\ n1-n2}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{e1 \\\\ n1}}\n    \\hypo{\\idr{e2 \\\\ n2}}\n    \\infer2[\\idr{E_AMult}]{\\idr{AMult e1 e2 \\\\ n1*n2}}\n  \\end{prooftree}\n\\]\n\n\n=== Equivalence of the Definitions\n\nIt is straightforward to prove that the relational and functional definitions of\nevaluation agree:\n\n> aeval_iff_aevalR : (a \\\\ n) <-> aeval0 a = n\n> aeval_iff_aevalR = (to, fro)\n> where\n>   to : (a \\\\ n) -> aeval0 a = n\n>   to E_ANum = Refl\n>   to (E_APlus x y xy) =\n>     rewrite xy in\n>     rewrite to x in\n>     rewrite to y in Refl\n>   to (E_AMinus x y xy) =\n>     rewrite xy in\n>     rewrite to x in\n>     rewrite to y in Refl\n>   to (E_AMult x y xy) =\n>     rewrite xy in\n>     rewrite to x in\n>     rewrite to y in Refl\n>   fro : (aeval0 a = n) -> (a \\\\ n)\n>   fro {a=ANum0 n} Refl = E_ANum\n>   fro {a=APlus0 x y} prf =\n>     E_APlus (fro Refl) (fro Refl) (sym prf)\n>   fro {a=AMinus0 x y} prf =\n>     E_AMinus (fro Refl) (fro Refl) (sym prf)\n>   fro {a=AMult0 x y} prf =\n>     E_AMult (fro Refl) (fro Refl) (sym prf)\n\nWe can make the proof quite a bit shorter by making more use of tacticals.\n\n```coq\nTheorem aeval_iff_aevalR' : forall a n,\n  (a \\\\ n) <-> aeval a = n.\nProof.\n  (* WORKED IN CLASS *)\n  split.\n  - (* -> *)\n    intros H; induction H; subst; Refl.\n  - (* <- *)\n    generalize dependent n.\n    induction a; simpl; intros; subst; constructor;\n       try apply IHa1; try apply IHa2; Refl.\nQed.\n```\n\n==== Exercise: 3 stars (bevalR)\n\nWrite a relation \\idr{BEvalR} in the same style as \\idr{AEvalR}, and prove that\nit is equivalent to \\idr{beval0}.\n\n> -- data BEvalR : BExp0 -> (b : Bool) -> Type where\n>   -- FILL IN HERE\n>\n> -- beval_iff_bevalR : (BEvalR b bv) <-> beval0 b = bv\n\n$\\square$\n\n\n=== Computational vs. Relational Definitions\n\nFor the definitions of evaluation for arithmetic and boolean expressions, the\nchoice of whether to use functional or relational definitions is mainly a matter\nof taste: either way works.\n\nHowever, there are circumstances where relational definitions of evaluation work\nmuch better than functional ones.\n\nFor example, suppose that we wanted to extend the arithmetic operations by\nconsidering also a division operation:\n\n> namespace AEvalRDiv\n\n>   data AExpD : Type where\n>     ANumD : Nat -> AExpD\n>     APlusD : AExpD -> AExpD -> AExpD\n>     AMinusD : AExpD -> AExpD -> AExpD\n>     AMultD : AExpD -> AExpD -> AExpD\n>     ADivD : AExpD -> AExpD -> AExpD -- <--- new\n\nExtending the definition of \\idr{aeval} to handle this new operation would not\nbe straightforward (what should we return as the result of\n\\idr{ADiv (ANum 5) (ANum 0)}?). But extending \\idr{AEvalR} is straightforward.\n\n>   infix 5 \\\\\\\n\n>   data (\\\\\\) : AExpD -> (n : Nat) -> Type where\n>     E_ANumD : (ANumD n) \\\\\\ n\n>     E_APlusD : e1 \\\\\\ n1 -> e2 \\\\\\ n2 -> n = n1 + n2 ->\n>       (APlusD e1 e2) \\\\\\ n\n>     E_AMinusD : e1 \\\\\\ n1 -> e2 \\\\\\ n2 -> n = n1 `minus` n2 ->\n>       (AMinusD e1 e2) \\\\\\ n\n>     E_AMultD : e1 \\\\\\ n1 -> e2 \\\\\\ n2 -> n = n1 * n2 ->\n>       (AMultD e1 e2) \\\\\\ n\n>     E_ADivD : e1 \\\\\\ n1 -> e2 \\\\\\ n2 -> n2 `GT` 0 -> n1 = n2*n3 ->\n>       (ADivD e1 e2) \\\\\\ n3\n\n>   AEvalRD : AExpD -> Nat -> Type\n>   AEvalRD = (\\\\\\)\n\nSuppose, instead, that we want to extend the arithmetic operations by a\nnondeterministic number generator \\idr{any} that, when evaluated, may yield any\nnumber. (Note that this is not the same as making a _probabilistic_ choice among\nall possible numbers \u2014 we're not specifying any particular distribution of\nresults, but just saying what results are _possible_.)\n\n> namespace AEvalRAny\n\n>   data AExpA : Type where\n>     AAnyA : AExpA -- <--- new\n>     ANumA : Nat -> AExpA\n>     APlusA : AExpA -> AExpA -> AExpA\n>     AMinusA : AExpA -> AExpA -> AExpA\n>     AMultA : AExpA -> AExpA -> AExpA\n\nAgain, extending \\idr{aeval} would be tricky, since now evaluation is _not_ a\ndeterministic function from expressions to numbers, but extending \\idr{AEvalR}\nis no problem:\n\n>   infix 5 \\\\\\\n\n>   data (\\\\\\) : AExpA -> (n : Nat) -> Type where\n>     E_AnyA : AAnyA \\\\\\ n\n>     E_ANumA : (ANumA n) \\\\\\ n\n>     E_APlusA : e1 \\\\\\ n1 -> e2 \\\\\\ n2 -> n = n1 + n2 ->\n>       (APlusA e1 e2) \\\\\\ n\n>     E_AMinusA : e1 \\\\\\ n1 -> e2 \\\\\\ n2 -> n = n1 `minus` n2 ->\n>       (AMinusA e1 e2) \\\\\\ n\n>     E_AMultA : e1 \\\\\\ n1 -> e2 \\\\\\ n2 -> n = n1 * n2 ->\n>       (AMultA e1 e2) \\\\\\ n\n\n>   AEvalRA : AExpA -> Nat -> Type\n>   AEvalRA = (\\\\\\)\n\nAt this point you maybe wondering: which style should I use by default? The\nexamples above show that relational definitions are fundamentally more powerful\nthan functional ones. For situations like these, where the thing being defined\nis not easy to express as a function, or indeed where it is _not_ a function,\nthere is no choice. But what about when both styles are workable?\n\n\\ \\todo[inline]{Edit}\n\nOne point in favor of relational definitions is that some people feel they are\nmore elegant and easier to understand. Another is that Idris automatically\ngenerates nice inversion and induction principles from function definitions.\n\nOn the other hand, functional definitions can often be more convenient:\n\n  - Functions are by definition deterministic and defined on all arguments; for\n    a relation we have to show these properties explicitly if we need them.\n\n  - With functions we can also take advantage of Idris's computation mechanism\n    to simplify expressions during proofs.\n\nFurthermore, functions can be directly \"extracted\" to executable code in C\nor JavaScript.\n\nUltimately, the choice often comes down to either the specifics of a particular\nsituation or simply a question of taste. Indeed, in large Idris developments it\nis common to see a definition given in _both_ functional and relational styles,\nplus a lemma stating that the two coincide, allowing further proofs to switch\nfrom one point of view to the other at will.\n\n\n== Expressions With Variables\n\nLet's turn our attention back to defining Imp. The next thing we need to do is\nto enrich our arithmetic and Boolean expressions with variables. To keep things\nsimple, we'll assume that all variables are global and that they only hold\nnumbers.\n\n\n=== States\n\nSince we'll want to look variables up to find out their current values, we'll\nreuse the type \\idr{Id} from the `Maps` chapter for the type of variables in\nImp.\n\nA _machine state_ (or just _state_) represents the current values of _all_\nvariables at some point in the execution of a program.\n\nFor simplicity, we assume that the state is defined for _all_ variables, even\nthough any given program is only going to mention a finite number of them. The\nstate captures all of the information stored in memory. For Imp programs,\nbecause each variable stores a natural number, we can represent the state as a\nmapping from identifiers to \\idr{Nat}. For more complex programming languages,\nthe state might have more structure.\n\n> State : Type\n> State = TotalMap Nat\n\n> empty_state : State\n> empty_state = t_empty 0\n\n\n=== Syntax\n\nWe can add variables to the arithmetic expressions we had before by simply\nadding one more constructor:\n\n> data AExp : Type where\n>   ANum : Nat -> AExp\n>   AId : Id -> AExp -- <----- NEW\n>   APlus : AExp -> AExp -> AExp\n>   AMinus : AExp -> AExp -> AExp\n>   AMult : AExp -> AExp -> AExp\n\nDefining a few variable names as notational shorthands will make examples easier\nto read:\n\n> W : Id\n> W = MkId \"W\"\n> X : Id\n> X = MkId \"X\"\n> Y : Id\n> Y = MkId \"Y\"\n> Z : Id\n> Z = MkId \"Z\"\n\n\\todo[inline]{Edit}\n\n(This convention for naming program variables (\\idr{X}, \\idr{Y}, \\idr{Z})\nclashes a bit with our earlier use of uppercase letters for types. Since we're\nnot using polymorphism heavily in the chapters devoped to Imp, this overloading\nshould not cause confusion.)\n\nThe definition of \\idr{BExp}s is unchanged (except for using the new\n\\idr{AExp}s):\n\n> data BExp : Type where\n>   BTrue : BExp\n>   BFalse : BExp\n>   BEq : AExp -> AExp -> BExp\n>   BLe : AExp -> AExp -> BExp\n>   BNot : BExp -> BExp\n>   BAnd : BExp -> BExp -> BExp\n\n\n=== Evaluation\n\nThe arith and boolean evaluators are extended to handle variables in the obvious\nway, taking a state as an extra argument:\n\n> aeval : (st : State) -> (a : AExp) -> Nat\n> aeval _ (ANum n) = n\n> aeval st (AId i) = st i\n> aeval st (APlus a1 a2) = (aeval st a1) + (aeval st a2)\n> aeval st (AMinus a1 a2) = (aeval st a1) `minus` (aeval st a2)\n> aeval st (AMult a1 a2) = (aeval st a1) * (aeval st a2)\n>\n> beval : (st : State) -> (b : BExp) -> Bool\n> beval _ BTrue = True\n> beval _ BFalse = False\n> beval st (BEq a1 a2) = (aeval st a1) == (aeval st a2)\n> beval st (BLe a1 a2) = lte (aeval st a1) (aeval st a2)\n> beval st (BNot b1) = not (beval st b1)\n> beval st (BAnd b1 b2) = (beval st b1) && (beval st b2)\n\n> aexp1 : aeval (t_update X 5 Imp.empty_state)\n>               (APlus (ANum 3) (AMult (AId X) (ANum 2)))\n>         = 13\n> aexp1 = Refl\n\n> bexp1 : beval (t_update X 5 Imp.empty_state)\n>               (BAnd BTrue (BNot (BLe (AId X) (ANum 4))))\n>         = True\n> bexp1 = Refl\n\n\n== Commands\n\nNow we are ready define the syntax and behavior of Imp _commands_ (sometimes\ncalled _statements_).\n\n\n=== Syntax\n\nInformally, commands \\idr{c} are described by the following BNF grammar. (We\nchoose this slightly awkward concrete syntax for the sake of being able to\ndefine Imp syntax using Idris's \\idr{syntax} mechanism. In particular, we use\n\\idr{IFB} to avoid conflicting with the \\idr{if} notation from the standard\nlibrary.)\n\n```\n     c ::= SKIP | x ::= a | c ;; c | IFB b THEN c ELSE c FI\n         | WHILE b DO c END\n```\n\nFor example, here's factorial in Imp:\n\n```\n     Z ::= X;;\n     Y ::= 1;;\n     WHILE not (Z = 0) DO\n       Y ::= Y * Z;;\n       Z ::= Z - 1\n     END\n```\n\nWhen this command terminates, the variable \\idr{Y} will contain the factorial of\nthe initial value of \\idr{X}.\n\nHere is the formal definition of the abstract syntax of commands:\n\n> data Com : Type where\n>   CSkip : Com\n>   CAss : Id -> AExp -> Com\n>   CSeq : Com -> Com -> Com\n>   CIf : BExp -> Com -> Com -> Com\n>   CWhile : BExp -> Com -> Com\n\nAs usual, we can use a few `Notation` declarations to make things more readable.\nTo avoid conflicts with Idris's built-in notations, we keep this light \u2014 in\nparticular, we don't introduce any notations for \\idr{AExp}s and \\idr{BExp}s to\navoid confusion with the numeric and boolean operators we've already defined.\n\n\\ \\todo[inline]{Explain do-notation}\n\n> infix 5 ::= \n\n> SKIP : Com\n> SKIP = CSkip\n\n> (::=) : Id -> AExp -> Com\n> (::=) = CAss\n\n> (>>=) : Com -> (() -> Com) -> Com\n> (>>=) c f = CSeq c (f ())\n\n> WHILE : BExp -> Com -> Com\n> WHILE = CWhile\n\n> syntax IFB [c1] THEN [c2] ELSE [c3] FI = CIf c1 c2 c3\n\nFor example, here is the factorial function again, written as a formal\ndefinition to Idris:\n\n> fact_in_idris : Com\n> fact_in_idris = do\n>  Z ::= AId X\n>  Y ::= ANum 1\n>  WHILE (BNot (BEq (AId Z) (ANum 0))) $ do\n>    Y ::= AMult (AId Y) (AId Z)\n>    Z ::= AMinus (AId Z) (ANum 1)\n\n\n=== More Examples\n\n\n==== Assignment:\n\n> plus2 : Com\n> plus2 =\n>  X ::= APlus (AId X) (ANum 2)\n\n> XtimesYinZ : Com\n> XtimesYinZ =\n>  Z ::= AMult (AId X) (AId Y)\n\n> subtract_slowly_body : Com\n> subtract_slowly_body = do\n>   Z ::= AMinus (AId Z) (ANum 1)\n>   X ::= AMinus (AId X) (ANum 1)\n\n\n==== Loops\n\n> subtract_slowly : Com\n> subtract_slowly =\n>  WHILE (BNot (BEq (AId X) (ANum 0))) $ do\n>    subtract_slowly_body\n\n> subtract_3_from_5_slowly : Com\n> subtract_3_from_5_slowly = do\n>   X ::= ANum 3\n>   Z ::= ANum 5\n>   subtract_slowly\n\n\n==== An infinite loop:\n\n> loop : Com\n> loop = WHILE BTrue SKIP\n\n\n== Evaluating Commands\n\nNext we need to define what it means to evaluate an Imp command. The fact that\n\\idr{WHILE} loops don't necessarily terminate makes defining an evaluation\nfunction tricky...\n\n\n=== Evaluation as a Function (Failed Attempt)\n\nHere's an attempt at defining an evaluation function for commands, omitting the\n\\idr{WHILE} case.\n\n> ceval_fun_no_while : (st : State) -> (c : Com) -> State\n> ceval_fun_no_while st CSkip = st\n> ceval_fun_no_while st (CAss x a) = t_update x (aeval st a) st\n> ceval_fun_no_while st (CSeq c1 c2) =\n>   let st' = ceval_fun_no_while st c1\n>   in ceval_fun_no_while st' c2\n> ceval_fun_no_while st (CIf b c1 c2) =\n>   if beval st b\n>     then ceval_fun_no_while st c1\n>     else ceval_fun_no_while st c2\n> ceval_fun_no_while st (CWhile b c) = st   -- bogus\n\nIn a traditional functional programming language like OCaml or Haskell we could\nadd the \\idr{WHILE} case as follows:\n\n```idris\n...\nceval_fun st (CWhile b c) =\n  if (beval st b)\n    then ceval_fun st (CSeq c $ CWhile b c)\n    else st\n```\n\nIdris doesn't accept such a definition (\"Imp.ceval_fun is possibly not total due\nto recursive path Imp.ceval_fun --> Imp.ceval_fun --> Imp.ceval_fun\") because\nthe function we want to define is not guaranteed to terminate. Indeed, it\n_doesn't_ always terminate: for example, the full version of the \\idr{ceval_fun}\nfunction applied to the \\idr{loop} program above would never terminate. Since\nIdris is not just a functional programming language but also a consistent logic,\nany potentially non-terminating function needs to be rejected. Here is an\n(invalid!) program showing what would go wrong if Idris allowed non-terminating\nrecursive functions:\n\n\\ \\todo[inline]{Edit, discuss \\idr{partial}}\n\n```idris\nloop_false : (n : Nat) -> Void\nloop_false n = loop_false n\n```\n\nThat is, propositions like \\idr{Void} would become provable (\\idr{loop_false 0}\nwould be a proof of \\idr{Void}), which would be a disaster for Idris's logical\nconsistency.\n\nThus, because it doesn't terminate on all inputs, \\idr{ceval_fun} cannot be\nwritten in Idris \u2014 at least not without additional tricks and workarounds (see\nchapter `ImpCEvalFun` if you're curious about what those might be).\n\n\n=== Evaluation as a Relation\n\nHere's a better way: define \\idr{CEval} as a _relation_ rather than a _function_\n\u2014 i.e., define it with \\idr{data}, as we did for \\idr{AEvalR} above.\n\nThis is an important change. Besides freeing us from awkward workarounds, it\ngives us a lot more flexibility in the definition. For example, if we add\nnondeterministic features like \\idr{any} to the language, we want the definition\nof evaluation to be nondeterministic \u2014 i.e., not only will it not be total, it\nwill not even be a function!\n\nWe'll use the notation \\idr{c / st \\\\ st'} for the \\idr{CEval} relation:\n\\idr{c / st \\\\ st'} means that executing program \\idr{c} in a starting state\n\\idr{st} results in an ending state \\idr{st'}. This can be pronounced \"\\idr{c}\ntakes state \\idr{st} to \\idr{st'}\".\n\n\n==== Operational Semantics\n\nHere is an informal definition of evaluation, presented as inference rules for\nreadability:\n\n\\[\n  \\begin{prooftree}\n    \\infer0[\\idr{E_Skip}]{\\idr{SKIP / st \\\\ st}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{aeval st a1 = n}}\n    \\infer1[\\idr{E_Ass}]{\\idr{x := a1 / st \\\\ (t_update st x n)}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{c1 / st \\\\ st'}}\n    \\hypo{\\idr{c2 / st' \\\\ st''}}\n    \\infer2[\\idr{E_Seq}]{\\idr{c1;;c2 / st \\\\ st''}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{beval st b1 = True}}\n    \\hypo{\\idr{c1 / st \\\\ st'}}\n    \\infer2[\\idr{E_IfTrue}]{\\idr{IF b1 THEN c1 ELSE c2 FI / st \\\\ st'}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{beval st b1 = False}}\n    \\hypo{\\idr{c2 / st \\\\ st'}}\n    \\infer2[\\idr{E_IfFalse}]{\\idr{IF b1 THEN c1 ELSE c2 FI / st \\\\ st'}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{beval st b = False}}\n    \\infer1[\\idr{E_WhileEnd}]{\\idr{WHILE b DO c END / st \\\\ st}}\n  \\end{prooftree}\n\\]\n\n\\[\n  \\begin{prooftree}\n    \\hypo{\\idr{beval st b = True}}\n    \\hypo{\\idr{c / st \\\\ st'}}\n    \\hypo{\\idr{WHILE b DO c END / st' \\\\ st''}}\n    \\infer3[\\idr{E_WhileLoop}]{\\idr{WHILE b DO c END / st \\\\ st''}}\n  \\end{prooftree}\n\\]\n\nHere is the formal definition. Make sure you understand how it corresponds to\nthe inference rules.\n\n> data CEval : Com -> State -> State -> Type where\n>   E_Skip : CEval CSkip st st\n>   E_Ass : aeval st a1 = n -> CEval (CAss x a1) st (t_update x n st)\n>   E_Seq : CEval c1 st st' -> CEval c2 st' st'' ->\n>     CEval (CSeq c1 c2) st st''\n>   E_IfTrue : beval st b = True -> CEval c1 st st' ->\n>     CEval (CIf b c1 c2) st st'\n>   E_IfFalse : beval st b = False -> CEval c2 st st' ->\n>     CEval (CIf b c1 c2) st st'\n>   E_WhileEnd : beval st b = False ->\n>     CEval (CWhile b c) st st\n>   E_WhileLoop : beval st b = True ->\n>     CEval c st st' -> CEval (CWhile b c) st' st'' ->\n>     CEval (CWhile b c) st st''\n\n> syntax [c1] \"/\" [st] \"\\\\\\\\\" [st'] = CEval c1 st st'\n\nThe cost of defining evaluation as a relation instead of a function is that we\nnow need to construct _proofs_ that some program evaluates to some result state,\nrather than just letting Idris's computation mechanism do it for us.\n\n test : Com\n test = do \n   X ::= ANum 2\n   IFB BLe (AId X) (ANum 1)\n     THEN (Y ::= ANum 3)\n     ELSE (Z ::= ANum 4)\n   FI\n\n\n> ceval_example1 : (do\n>   X ::= ANum 2\n>   IFB BLe (AId X) (ANum 1)\n>     THEN (Y ::= ANum 3)\n>     ELSE (Z ::= ANum 4)\n>   FI) \n>   / Imp.empty_state \n>  \\\\ (t_update Z 4 $ t_update X 2 $ Imp.empty_state)\n> ceval_example1 =\n>   E_Seq\n>     (E_Ass Refl)\n>     (E_IfFalse Refl\n>                (E_Ass Refl))\n\n\n==== Exercise: 2 stars (ceval_example2)\n\n> ceval_example2 : (do \n>    X ::= ANum 0\n>    Y ::= ANum 1\n>    Z ::= ANum 2)\n>    / Imp.empty_state\n>   \\\\ (t_update Z 2 $ t_update Y 1 $ t_update X 0 $ Imp.empty_state)\n> ceval_example2 = ?ceval_example2_rhs\n\n$\\square$\n\n\n==== Exercise: 3 stars, advanced (pup_to_n)\n\nWrite an Imp program that sums the numbers from \\idr{1} to \\idr{X} (inclusive:\n\\idr{1 + 2 + ... + X}) in the variable \\idr{Y}. Prove that this program executes\nas intended for \\idr{X = 2} (this is trickier than you might expect).\n\n> pup_to_n : Com\n> pup_to_n = ?pup_to_n_rhs\n\n> pup_to_2_ceval :\n>   Imp.pup_to_n / (t_update X 2 Imp.empty_state) \\\\\n>    (t_update X 0 $\n>     t_update Y 3 $\n>     t_update X 1 $\n>     t_update Y 2 $\n>     t_update Y 0 $\n>     t_update X 2 $ \n>     Imp.empty_state)\n> pup_to_2_ceval = ?pup_to_2_ceval_rhs\n\n$\\square$\n\n\n=== Determinism of Evaluation\n\nChanging from a computational to a relational definition of evaluation is a good\nmove because it frees us from the artificial requirement that evaluation should\nbe a total function. But it also raises a question: Is the second definition of\nevaluation really a partial function? Or is it possible that, beginning from the\nsame state \\idr{st}, we could evaluate some command \\idr{c} in different ways to\nreach two different output states \\idr{st'} and \\idr{st''}?\n\nIn fact, this cannot happen: \\idr{CEval} _is_ a partial function:\n\n> ceval_deterministic : (c / st \\\\ st1) -> (c / st \\\\ st2) -> st1 = st2\n> ceval_deterministic E_Skip E_Skip = Refl\n> ceval_deterministic (E_Ass aev1) (E_Ass aev2) =\n>   rewrite sym aev1 in\n>   rewrite sym aev2 in Refl\n> ceval_deterministic {st2} (E_Seq cev11 cev12)\n>                           (E_Seq {c2} cev21 cev22) =\n>   let ih = ceval_deterministic cev11 cev21\n>       cev22' = replace (sym ih) cev22 {P=\\x=>CEval c2 x st2}\n>   in ceval_deterministic cev12 cev22'\n> ceval_deterministic (E_IfTrue _ cev1) (E_IfTrue _ cev2) =\n>   ceval_deterministic cev1 cev2\n> ceval_deterministic (E_IfTrue prf1 _) (E_IfFalse prf2 _) =\n>   absurd $ replace prf1 prf2 {P=\\x=>x=False}\n> ceval_deterministic (E_IfFalse prf1 _) (E_IfTrue prf2 _) =\n>   absurd $ replace prf2 prf1 {P=\\x=>x=False}\n> ceval_deterministic (E_IfFalse _ cev1) (E_IfFalse _ cev2) =\n>   ceval_deterministic cev1 cev2\n> ceval_deterministic (E_WhileEnd _) (E_WhileEnd _) = Refl\n> ceval_deterministic (E_WhileEnd prf1) (E_WhileLoop prf2 _ _) =\n>   absurd $ replace prf2 prf1 {P=\\x=>x=False}\n> ceval_deterministic (E_WhileLoop prf1 _ _) (E_WhileEnd prf2) =\n>   absurd $ replace prf1 prf2 {P=\\x=>x=False}\n> ceval_deterministic {st2} (E_WhileLoop _ cev11 cev12)\n>                           (E_WhileLoop {b} {c} _ cev21 cev22) =\n>   let ih = ceval_deterministic cev11 cev21\n>       cev22' = replace (sym ih) cev22 {P=\\x=>CEval (CWhile b c) x st2}\n>   in ceval_deterministic cev12 cev22'\n\n\n== Reasoning About Imp Programs\n\nWe'll get deeper into systematic techniques for reasoning about Imp programs in\nthe following chapters, but we can do quite a bit just working with the bare\ndefinitions. This section explores some examples.\n\n> plus2_spec : st X = n -> (Imp.plus2 / st \\\\ st') -> st' X = n + 2\n\n\\todo[inline]{Edit}\n\nInverting `Heval` essentially forces Idris to expand one step of the \\idr{CEval}\ncomputation \u2014 in this case revealing that \\idr{st'} must be st extended with the\nnew value of \\idr{X}, since \\idr{plus2} is an assignment\n\n> plus2_spec Refl (E_Ass Refl) = Refl\n\n\n==== Exercise: 3 stars, recommendedM (XtimesYinZ_spec)\n\nState and prove a specification of \\idr{XtimesYinZ}.\n\n> -- FILL IN HERE\n\n$\\square$\n\n\n==== Exercise: 3 stars, recommended (loop_never_stops)\n\n> loop_never_stops : Not (Imp.loop / st \\\\ st')\n> loop_never_stops contra = ?loop_never_stops_rhs\n\n\\todo[inline]{Edit the hint}\n\n```coq\nProof.\n  intros st st' contra. unfold loop in contra.\n  remember (WHILE BTrue DO SKIP END) as loopdef\n           eqn:Heqloopdef.\n```\n\nProceed by induction on the assumed derivation showing that loopdef terminates.\nMost of the cases are immediately contradictory (and so can be solved in one\nstep with inversion).\n\n  (* FILL IN HERE *) Admitted.\n\n$\\square$\n\n\n==== Exercise: 3 stars (no_whilesR)\n\nConsider the following function:\n\n> no_whiles : (c : Com) -> Bool\n> no_whiles CSkip = True\n> no_whiles (CAss _ _) = True\n> no_whiles (CSeq c1 c2) = (no_whiles c1) && (no_whiles c2)\n> no_whiles (CIf _ ct cf) = (no_whiles ct) && (no_whiles cf)\n> no_whiles (CWhile _ _) = False\n\nThis predicate yields \\idr{True} just on programs that have no while loops.\nUsing \\idr{data}, write a property \\idr{No_whilesR} such that \\idr{No_whilesR c}\nis provable exactly when \\idr{c} is a program with no while loops. Then prove\nits equivalence with \\idr{no_whiles}.\n\n> data No_whilesR : Com -> Type where\n>   Remove_Me_No_whilesR : No_whilesR CSkip\n\n> no_whiles_eqv : (no_whiles c = True) <-> (No_whilesR c)\n> no_whiles_eqv = ?no_whiles_eqv_rhs\n\n$\\square$\n\n\n==== Exercise: 4 starsM (no_whiles_terminating)\n\nImp programs that don't involve while loops always terminate. State and prove a\ntheorem \\idr{no_whiles_terminating} that says this. Use either \\idr{no_whiles}\nor \\idr{No_whilesR}, as you prefer.\n\n> -- FILL IN HERE\n\n$\\square$\n\n\n== Additional Exercises\n\n\n==== Exercise: 3 stars (stack_compiler)\n\nHP Calculators, programming languages like Forth and Postscript and abstract\nmachines like the Java Virtual Machine all evaluate arithmetic expressions using\na stack. For instance, the expression\n\n```\n      (2*3)+(3*(4-2))\n```\n\nwould be entered as\n\n```\n      2 3 * 3 4 2 - * +\n```\n\nand evaluated like this (where we show the program being evaluated on the right\nand the contents of the stack on the left):\n\n```\n      [ ]           |    2 3 * 3 4 2 - * +\n      [2]           |    3 * 3 4 2 - * +\n      [3, 2]        |    * 3 4 2 - * +\n      [6]           |    3 4 2 - * +\n      [3, 6]        |    4 2 - * +\n      [4, 3, 6]     |    2 - * +\n      [2, 4, 3, 6]  |    - * +\n      [2, 3, 6]     |    * +\n      [6, 6]        |    +\n      [12]          |\n```\n\nThe task of this exercise is to write a small compiler that translates\n\\idr{AExp}s into stack machine instructions.\n\nThe instruction set for our stack language will consist of the following\ninstructions:\n\n  - \\idr{SPush n}: Push the number \\idr{n} on the stack.\n\n  - \\idr{SLoad x}: Load the identifier \\idr{x} from the store and push it on the\n    stack\n\n  - \\idr{SPlus}: Pop the two top numbers from the stack, add them, and push the\n    result onto the stack.\n\n  - \\idr{SMinus}: Similar, but subtract.\n\n  - \\idr{SMult}: Similar, but multiply.\n\n> data SInstr : Type where\n>   SPush : Nat -> SInstr\n>   SLoad : Id -> SInstr\n>   SPlus : SInstr\n>   SMinus : SInstr\n>   SMult : SInstr\n\nWrite a function to evaluate programs in the stack language. It should take as\ninput a state, a stack represented as a list of numbers (top stack item is the\nhead of the list), and a program represented as a list of instructions, and it\nshould return the stack after executing the program. Test your function on the\nexamples below.\n\nNote that the specification leaves unspecified what to do when encountering an\n\\idr{SPlus}, \\idr{SMinus}, or \\idr{SMult} instruction if the stack contains less\nthan two elements. In a sense, it is immaterial what we do, since our compiler\nwill never emit such a malformed program.\n\n> s_execute : (st : State) -> (stack : List Nat) -> (prog : List SInstr) ->\n>             List Nat\n> s_execute st stack prog = ?s_execute_rhs\n\n> s_execute1 : s_execute Imp.empty_state [] [SPush 5, SPush 3, SPush 1, SMinus]\n>              = [2,5]\n> s_execute1 = ?s_execute1_rhs\n\n> s_execute2 : s_execute (t_update X 3 Imp.empty_state) [3,4]\n>                        [SPush 4, SLoad X, SMult, SPlus]\n>              = [15,4]\n> s_execute2 = ?s_execute2_rhs\n\nNext, write a function that compiles an \\idr{AExp} into a stack machine program.\nThe effect of running the program should be the same as pushing the value of the\nexpression on the stack.\n\n> s_compile : (e : AExp) -> List SInstr\n> s_compile e = ?s_compile_rhs\n\nAfter you've defined \\idr{s_compile}, prove the following to test that it works.\n\n> s_compile1 : s_compile (AMinus (AId X) (AMult (ANum 2) (AId Y)))\n>              = [SLoad X, SPush 2, SLoad Y, SMult, SMinus]\n> s_compile1 = ?s_compile1_rhs\n\n$\\square$\n\n\n==== Exercise: 4 stars, advanced (stack_compiler_correct)\n\nNow we'll prove the correctness of the compiler implemented in the previous\nexercise. Remember that the specification left unspecified what to do when\nencountering an \\idr{SPlus}, \\idr{SMinus}, or \\idr{SMult} instruction if the\nstack contains less than two elements. (In order to make your correctness proof\neasier you might find it helpful to go back and change your implementation!)\n\nProve the following theorem. You will need to start by stating a more general\nlemma to get a usable induction hypothesis; the main theorem will then be a\nsimple corollary of this lemma.\n\n\\ \\todo[inline]{Tip: make parameters explicit in general lemma, or Idris will \nget lost}\n\n> s_compile_correct : (st : State) -> (e : AExp) -> s_execute st [] (s_compile e) = [aeval st e]\n> s_compile_correct st e = ?s_compile_correct_rhs\n\n$\\square$\n\n\n==== Exercise: 3 stars, optional (short_circuit)\n\n\\ \\todo[inline]{This already happens since Idris's \\idr{&&} short-circuits}\n\nMost modern programming languages use a \"short-circuit\" evaluation rule for\nboolean \\idr{and}: to evaluate \\idr{BAnd b1 b2}, first evaluate \\idr{b1}. If it\nevaluates to \\idr{False}, then the entire \\idr{BAnd} expression evaluates to\n\\idr{False} immediately, without evaluating \\idr{b2}. Otherwise, \\idr{b2} is\nevaluated to determine the result of the \\idr{BAnd} expression.\n\nWrite an alternate version of \\idr{beval} that performs short-circuit\nevaluation of \\idr{BAnd} in this manner, and prove that it is equivalent to\n\\idr{beval}.\n\n> -- FILL IN HERE\n\n$\\square$\n\n\n==== Exercise: 4 stars, advanced (break_imp)\n\nImperative languages like C and Java often include a \\idr{break} or similar\nstatement for interrupting the execution of loops. In this exercise we consider\nhow to add \\idr{break} to Imp. First, we need to enrich the language of commands\nwith an additional case.\n\n> namespace ComBreak\n\n>   data ComB : Type where\n>     CSkipB : ComB\n>     CBreakB : ComB  -- <-- new\n>     CAssB : Id -> AExp -> ComB\n>     CSeqB : ComB -> ComB -> ComB\n>     CIfB : BExp -> ComB -> ComB -> ComB\n>     CWhileB : BExp -> ComB -> ComB\n\n>   infix 5 ::=\n\n>   SKIP : ComB\n>   SKIP = CSkipB\n\n>   BREAK : ComB\n>   BREAK = CBreakB\n\n>   (::=) : Id -> AExp -> ComB\n>   (::=) = CAssB\n\n>   (>>=) : ComB -> (() -> ComB) -> ComB\n>   (>>=) c f = CSeqB c (f ())\n\n>   WHILE : BExp -> ComB -> ComB\n>   WHILE = CWhileB\n\n>   syntax IFB [c1] THEN [c2] ELSE [c3] FI = CIfB c1 c2 c3\n\nNext, we need to define the behavior of \\idr{BREAK}. Informally, whenever\n\\idr{BREAK} is executed in a sequence of commands, it stops the execution of\nthat sequence and signals that the innermost enclosing loop should terminate.\n(If there aren't any enclosing loops, then the whole program simply terminates.)\nThe final state should be the same as the one in which the \\idr{BREAK} statement\nwas executed.\n\nOne important point is what to do when there are multiple loops enclosing a\ngiven \\idr{BREAK}. In those cases, \\idr{BREAK} should only terminate the\n_innermost_ loop. Thus, after executing the following...\n\n```\n       X ::= 0;;\n       Y ::= 1;;\n       WHILE not (0 == Y) DO\n         WHILE TRUE DO\n           BREAK\n         END;;\n         X ::= 1;;\n         Y ::= Y - 1\n       END\n```\n\n... the value of \\idr{X} should be \\idr{1}, and not \\idr{0}.\n\nOne way of expressing this behavior is to add another parameter to the\nevaluation relation that specifies whether evaluation of a command executes a\n\\idr{BREAK} statement:\n\n>   data Result : Type where\n>     SContinue : Result\n>     SBreak : Result\n\nIntuitively, \\idr{c // st \\\\ s / st'} means that, if \\idr{c} is started in state\n\\idr{st}, then it terminates in state \\idr{st'} and either signals that the\ninnermost surrounding loop (or the whole program) should exit immediately\n(\\idr{s = SBreak}) or that execution should continue normally\n(\\idr{s = SContinue}).\n\nThe definition of the \"\\idr{c // st \\\\ s / st'}\" relation is very similar to the\none we gave above for the regular evaluation relation (\\idr{c / st \\\\ st'}) \u2014\nwe just need to handle the termination signals appropriately:\n\n  - If the command is \\idr{SKIP}, then the state doesn't change and execution of\n    any enclosing loop can continue normally.\n\n  - If the command is \\idr{BREAK}, the state stays unchanged but we signal a\n    \\idr{SBreak}.\n\n  - If the command is an assignment, then we update the binding for that\n    variable in the state accordingly and signal that execution can continue\n    normally.\n\n  - If the command is of the form \\idr{IFB b THEN c1 ELSE c2 FI}, then the state\n    is updated as in the original semantics of Imp, except that we also\n    propagate the signal from the execution of whichever branch was taken.\n\n  - If the command is a sequence \\idr{c1 ;; c2}, we first execute \\idr{c1}. If\n    this yields a \\idr{SBreak}, we skip the execution of \\idr{c2} and propagate\n    the \\idr{SBreak} signal to the surrounding context; the resulting state is\n    the same as the one obtained by executing \\idr{c1} alone. Otherwise, we\n    execute \\idr{c2} on the state obtained after executing \\idr{c1}, and\n    propagate the signal generated there.\n\n  - Finally, for a loop of the form \\idr{WHILE b DO c END}, the semantics is\n    almost the same as before. The only difference is that, when \\idr{b}\n    evaluates to \\idr{True}, we execute \\idr{c} and check the signal that it\n    raises. If that signal is \\idr{SContinue}, then the execution proceeds as in\n    the original semantics. Otherwise, we stop the execution of the loop, and\n    the resulting state is the same as the one resulting from the execution of\n    the current iteration. In either case, since \\idr{BREAK} only terminates the\n    innermost loop, \\idr{WHILE} signals \\idr{SContinue}.\n\nBased on the above description, complete the definition of the \\idr{CEvalB}\nrelation.\n\n>   data CEvalB : ComB -> State -> Result -> State -> Type where\n>     E_SkipB : CEvalB CSkipB st SContinue st\n>     -- FILL IN HERE\n\n>   syntax [c1] \"//\" [st] \"\\\\\\\\\" [s] \"/\" [st'] = CEvalB c1 st s st'\n\nNow prove the following properties of your definition of \\idr{CEvalB}:\n\n>   break_ignore : ((do BREAK; c) // st \\\\ s / st') -> st = st'\n>   break_ignore x = ?break_ignore_rhs\n\n\n>   while_continue : ((WHILE b c) // st \\\\ s / st') -> s = SContinue\n>   while_continue x = ?while_continue_rhs\n\n>   while_stops_on_break : beval st b = True ->\n>                          (c // st \\\\ SBreak / st') ->\n>                          ((WHILE b c) // st \\\\ SContinue / st')\n>   while_stops_on_break prf x = ?while_stops_on_break_rhs\n\n$\\square$\n\n\n==== Exercise: 3 stars, advanced, optional (while_break_true)\n\n>   while_break_true : ((WHILE b c) // st \\\\ SContinue / st') ->\n>                      beval st' b = True ->\n>                      (st'' ** c // st'' \\\\ SBreak / st')\n>   while_break_true x prf = ?while_break_true_rhs\n\n$\\square$\n\n\n==== Exercise: 4 stars, advanced, optional (cevalB_deterministic)\n\nThese will come in handy in the following exercise:\n\n>   Uninhabited (SBreak = SContinue) where\n>     uninhabited Refl impossible\n>\n>   Uninhabited (SContinue = SBreak) where\n>     uninhabited Refl impossible\n\n>   cevalB_deterministic : (c // st \\\\ s1 / st1) ->\n>                          (c // st \\\\ s2 / st2) ->\n>                          (st1 = st2, s1 = s2)\n>   cevalB_deterministic x y = ?cevalB_deterministic_rhs\n\n$\\square$\n\n\n==== Exercise: 4 stars, optional (add_for_loop)\n\nAdd C-style \\idr{for} loops to the language of commands, update the \\idr{CEval}\ndefinition to define the semantics of \\idr{for} loops, and add cases for\n\\idr{for} loops as needed so that all the proofs in this file are accepted by\nIdris.\n\nA \\idr{for} loop should be parameterized by (a) a statement executed initially,\n(b) a test that is run on each iteration of the loop to determine whether the\nloop should continue, (c) a statement executed at the end of each loop\niteration, and (d) a statement that makes up the body of the loop. (You don't\nneed to worry about making up a concrete notation for \\idr{for} loops, but feel\nfree to play with this too if you like.)\n\n> -- FILL IN HERE\n\n$\\square$\n", "meta": {"hexsha": "881f420c4322595b4d824b3fb24c12ab03b41f53", "size": 56984, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "src/Imp.lidr", "max_stars_repo_name": "diseraluca/software-foundations", "max_stars_repo_head_hexsha": "03e178fc616e50019c4168fb488f67fbfb46fafa", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 452, "max_stars_repo_stars_event_min_datetime": "2016-06-23T10:03:29.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T22:25:00.000Z", "max_issues_repo_path": "src/Imp.lidr", "max_issues_repo_name": "diseraluca/software-foundations", "max_issues_repo_head_hexsha": "03e178fc616e50019c4168fb488f67fbfb46fafa", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 53, "max_issues_repo_issues_event_min_datetime": "2016-06-27T07:14:38.000Z", "max_issues_repo_issues_event_max_datetime": "2019-10-23T06:16:57.000Z", "max_forks_repo_path": "src/Imp.lidr", "max_forks_repo_name": "diseraluca/software-foundations", "max_forks_repo_head_hexsha": "03e178fc616e50019c4168fb488f67fbfb46fafa", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 39, "max_forks_repo_forks_event_min_datetime": "2016-11-21T10:55:05.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-30T00:21:55.000Z", "avg_line_length": 32.7494252874, "max_line_length": 96, "alphanum_fraction": 0.6795767233, "num_tokens": 17502, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7310585786300049, "lm_q2_score": 0.7154240018510026, "lm_q1q2_score": 0.523016853910984}}
{"text": "-- Tests to check that casting between integer types works as expected\n-- \n-- This tests in `idris2/basic043`, `chez/chez028` and `node/node022` are the\n-- same and should all have the same output.\n\n--\n-- Widening should not have any effect\n--\n\nbits8WideningNoEffect : List String\nbits8WideningNoEffect = [\n    show $ cast {from = Bits8} {to = Bits16} 123,\n    show $ cast {from = Bits8} {to = Bits32} 123,\n    show $ cast {from = Bits8} {to = Bits64} 123,\n    show $ cast {from = Bits8} {to = Int} 123,\n    show $ cast {from = Bits8} {to = Integer} 123\n]\n\nbits16WideningNoEffect : List String\nbits16WideningNoEffect = [\n    show $ cast {from = Bits16} {to = Bits32} 1234,\n    show $ cast {from = Bits16} {to = Bits64} 1234,\n    show $ cast {from = Bits16} {to = Int} 1234,\n    show $ cast {from = Bits16} {to = Integer} 1234\n]\n\nbits32WideningNoEffect : List String\nbits32WideningNoEffect = [\n    show $ cast {from = Bits32} {to = Bits64} 1234567,\n    show $ cast {from = Bits32} {to = Int} 1234567,\n    show $ cast {from = Bits32} {to = Integer} 1234567\n]\n\n--\n-- Narrowing\n--\n\nb8max : Integer\nb8max = 0x100\n\nb16max : Integer\nb16max = 0x10000\n\nb32max : Integer\nb32max = 0x100000000\n\nb64max : Integer\nb64max = 18446744073709551616 -- 0x10000000000000000\n\n\nnarrowFromInteger : List String\nnarrowFromInteger = [\n    show $ cast {from = Integer} {to = Bits8} (b8max + 134),\n    show $ cast {from = Integer} {to = Bits16} (b16max + 134),\n    show $ cast {from = Integer} {to = Bits32} (b32max + 134),\n    show $ cast {from = Integer} {to = Bits64} (b64max + 134)\n]\n\nnarrowFromInt : List String\nnarrowFromInt = [\n    show $ cast {from = Int} {to = Bits8} (cast (b8max + 134)),\n    show $ cast {from = Int} {to = Bits16} (cast (b16max + 134)),\n    show $ cast {from = Int} {to = Bits32} (cast (b32max + 134)),\n    show $ cast {from = Int} {to = Bits64} (cast (b64max + 134))\n]\n\nnarrowFromBits64 : List String\nnarrowFromBits64 = [\n    show $ cast {from = Bits64} {to = Bits8} (cast (b8max + 134)),\n    show $ cast {from = Bits64} {to = Bits16} (cast (b16max + 134)),\n    show $ cast {from = Bits64} {to = Bits32} (cast (b32max + 134))\n]\n\nnarrowFromBits32 : List String\nnarrowFromBits32 = [\n    show $ cast {from = Bits32} {to = Bits8} (cast (b8max + 134)),\n    show $ cast {from = Bits32} {to = Bits16} (cast (b16max + 134))\n]\n\nnarrowFromBits16 : List String\nnarrowFromBits16 = [\n    show $ cast {from = Bits16} {to = Bits8} (cast (b8max + 134))\n]\n\n--\n-- Negative numbers\n--\n\nnegativeNumberCast : List String\nnegativeNumberCast = [\n    show $ cast {to = Bits8} (-19),\n    show $ cast {to = Bits16} (-19),\n    show $ cast {to = Bits32} (-19),\n    show $ cast {to = Bits64} (-19)\n]\n", "meta": {"hexsha": "1eb595bb0987c5e50b5d575133cb8e44b74133ed", "size": 2672, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/node/node022/BitCasts.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2020-08-25T06:39:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T08:33:15.000Z", "max_issues_repo_path": "idris2/tests/node/node022/BitCasts.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-06-18T02:39:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-18T12:59:50.000Z", "max_forks_repo_path": "idris2/tests/node/node022/BitCasts.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2020-12-25T12:46:26.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-15T04:52:14.000Z", "avg_line_length": 27.8333333333, "max_line_length": 77, "alphanum_fraction": 0.630239521, "num_tokens": 940, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7122321720225278, "lm_q2_score": 0.734119521083126, "lm_q1q2_score": 0.5228635410251726}}
{"text": "-- --------------------------------------------------------------- [ DVect.idr ]\n-- Module    : DVect.idr\n-- Copyright : (c) 2015,2016 See CONTRIBUTORS.md\n-- License   : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\n||| A `list` construct to create lists of dependent types.\n|||\n||| One of the problems with using dependent types is that types\n||| depend on values. This affects the ability to construct lists of\n||| values that have a dependent type. The existing `List` type cannot\n||| be used as it requires all elements to have the same type.\nmodule Toolkit.Data.DVect\n\nimport Data.Nat\nimport Data.String\n\nimport public Data.Vect\nimport public Data.Vect.Elem\n\nimport public Toolkit.Decidable.Equality.Indexed\n\n%default total\n\n\n||| A list construct for dependent types.\n|||\n||| @aTy    The type of the value contained within the list element type.\n||| @len    The length of the list.\n||| @elemTy The type of the elements within the list\n||| @as     The List used to contain the different values within the type.\npublic export\ndata DVect : (aTy : Type)\n          -> (elemTy : aTy -> Type)\n          -> (len : Nat)\n          -> (as : Vect len aTy)\n          -> Type where\n  ||| Create an empty List\n  Nil  : DVect aTy elemTy Z Nil\n  ||| Cons\n  |||\n  ||| @ex The element to add\n  ||| @rest The list for `elem` to be added to.\n  (::) : {x : aTy}\n      -> (ex : elemTy x)\n      -> (rest : DVect aTy elemTy n xs)\n      -> DVect aTy elemTy (S n) (x::xs)\n\npublic export\nsize : DVect a e l as -> Nat\nsize Nil = Z\nsize (x::xs) = 1 + size xs\n\npublic export\nmapToVect : (forall x . e x -> b)\n         -> DVect a e n xs\n         -> Vect n b\nmapToVect _ Nil = Nil\nmapToVect f (x::xs) = f x :: mapToVect f xs\n\ntoList : Vect q a -> List a\ntoList Nil = Nil\ntoList (x::xs) = x :: DVect.toList xs\n\n||| Function to show a `DList`.\n|||\n||| Due to limitations in idris wrt to class instances on dependent\n||| types a generic show instance cannot be defined for\n||| sigmalist. This will cause minor annoyances in its use.\n|||\n||| @showFunc A function to show the elements\n||| @l       The list to be Shown.\npublic export\nshowDVect : (showFunc : forall a . elemTy a -> String)\n         -> (l : DVect aTy elemTy n as)\n         -> String\nshowDVect f xs = \"[\" ++ unwords asList ++ \"]\"\n  where\n    asList : List String\n    asList = DVect.toList $ intersperse \",\" (mapToVect f xs)\n\nnamespace Alternative\n  public export\n  index : DVect aTy elemTy n as\n       -> Elem a as\n       -> elemTy a\n  index (x::xs) Here = x\n  index (x::xs) (There later) = index xs later\n\n  public export\n  update : (vs  : DVect iTy eTy l is)\n        -> (idx : Elem i is)\n        -> (new : eTy i)\n        -> DVect iTy eTy l is\n  update (ex :: rest) Here new = new :: rest\n  update (ex :: rest) (There later) new = ex :: update rest later new\n\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "6d1caef6143c7baffd4b072ae0922148fc8f9e16", "size": 2920, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Toolkit/Data/DVect.idr", "max_stars_repo_name": "gallais/linear-circuits", "max_stars_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2020-11-03T11:33:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-14T17:11:38.000Z", "max_issues_repo_path": "src/Toolkit/Data/DVect.idr", "max_issues_repo_name": "gallais/linear-circuits", "max_issues_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "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/Toolkit/Data/DVect.idr", "max_forks_repo_name": "gallais/linear-circuits", "max_forks_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-02-09T19:49:11.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-09T19:49:11.000Z", "avg_line_length": 29.7959183673, "max_line_length": 80, "alphanum_fraction": 0.5794520548, "num_tokens": 818, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7341195152660687, "lm_q2_score": 0.7122321720225278, "lm_q1q2_score": 0.5228635368820773}}
{"text": "-- a mini prelude\n\nmodule Stuff\n\npublic export\ndata Bool = True | False\n\npublic export\nnot : Bool -> Bool\nnot True = False\nnot False = True\n\npublic export\ndata Maybe a = Nothing | Just a\n\ninfixl 4 &&\n\npublic export\n(&&) : Bool -> Lazy Bool -> Bool\n(&&) True x = x\n(&&) False x = False\n\npublic export\nintToBool : Int -> Bool\nintToBool 0 = False\nintToBool x = True\n\npublic export\nifThenElse : Bool -> Lazy a -> Lazy a -> a\nifThenElse True t e = t\nifThenElse False t e = e\n\npublic export\ndata Nat = Z | S Nat\n\npublic export\nfromInteger : Integer -> Nat\nfromInteger x = ifThenElse (intToBool (prim__eq_Integer x 0))\n                      Z (S (fromInteger (prim__sub_Integer x 1)))\n\npublic export\nplus : Nat -> Nat -> Nat\nplus Z y = y\nplus (S k) y = S (plus k y)\n\ninfixr 5 ::\n\npublic export\ndata List a = Nil | (::) a (List a)\n\npublic export\ndata Equal : a -> b -> Type where\n     Refl : {0 x : a} -> Equal x x\n\npublic export\ndata Unit = MkUnit\n\nnamespace Builtin -- hardcoded into elaborator!\n  public export\n  data Pair : Type -> Type -> Type where\n       MkPair : {0 a, b : Type} -> (1 x : a) -> (1 y : b) -> Pair a b\n\npublic export\nfst : {0 a, b : Type} -> (a, b) -> a\nfst (x, y) = x\n\npublic export\nsnd : {0 a, b : Type} -> (a, b) -> b\nsnd (x, y) = y\n\n%pair Pair fst snd\n\nnamespace DPair\n    public export\n    data DPair : (a : Type) -> (a -> Type) -> Type where\n         MkDPair : (x : a) -> p x -> DPair a p\n\n    fst : DPair a p -> a\n    fst (MkDPair x y) = x\n\n    snd : (x : DPair a p) -> p (fst x)\n    snd (MkDPair x y) = y\n\npublic export\ndata Unrestricted : Type -> Type where\n     Un : (x : a) -> Unrestricted a\n\npublic export\nthe : (a : Type) -> a -> a\nthe _ x = x\n\npublic export\nid : a -> a\nid x = x\n\npublic export\ndata Void : Type where\n\npublic export\ndata Dec : Type -> Type where\n     Yes : a -> Dec a\n     No : (a -> Void) -> Dec a\n\n", "meta": {"hexsha": "1d3da36dff63d2ae2a9cac8987608995d5ab46bc", "size": 1845, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic009/Stuff.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/basic009/Stuff.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/basic009/Stuff.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.7403846154, "max_line_length": 69, "alphanum_fraction": 0.593495935, "num_tokens": 615, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998611746912, "lm_q2_score": 0.6723316926137811, "lm_q1q2_score": 0.5226033313320372}}
{"text": "module Diff\n\n-- Based on https://arxiv.org/pdf/1803.10228.pdf\n\nimport src.Expr\n\n\ninterface DiffSymantics (rep : TypeT -> Type) where\n  d : Double -> rep DoubleT\n  (+) : rep DoubleT -> rep DoubleT -> rep DoubleT\n  (*) : rep DoubleT -> rep DoubleT -> rep DoubleT\n  grad : (rep DoubleT -> rep DoubleT) -> Code (ArrowT DoubleT DoubleT)\n\n\ndata Reverse : TypeT -> Type where\n  R : (((Code DoubleT, Code (VarT DoubleT)) -> Code UnitT) -> Code UnitT) -> Reverse a\n\n\nDiffSymantics Reverse where\n  d x = R (\\k => letVal (double x) (\\x => newVar (double 0) (\\d => k (x, d))))\n\n  (+) (R l) (R r) = R (\\k => l (\\(lv, ld) =>\n                             r (\\(rv, rd) => letVal (lv <+> rv) (\\x =>\n                                             newVar (double 0) (\\d =>\n                                                  seqs [k (x, d),\n                                                  assign (deref ld <+> deref d) ld,\n                                                  assign (deref rd <+> deref d) rd])))))\n\n  (*) (R l) (R r) = R (\\k => l (\\(lv, ld) =>\n                             r (\\(rv, rd) => letVal (lv <*> rv) (\\x =>\n                                             newVar (double 0) (\\d =>\n                                                  seqs [k (x, d),\n                                                  assign ((deref d <*> rv) <+> deref ld) ld,\n                                                  assign ((deref d <*> lv) <+> deref rd) rd])))))\n\n  grad f = lam (\\x =>  newVar (double 0) (\\d => let (R g) = f $ R (\\k => k (x, d)) in\n                                                seq (g (\\(_, d) => assign (double 1) d)) (deref d)))\n\nexample : DiffSymantics rep => rep DoubleT -> rep DoubleT\nexample x = (d 2 * x) + (x * x * x)\n\ntest : String\ntest = compile (grad {rep = Reverse} example)\n", "meta": {"hexsha": "2a18a266471f32ac6ae1f55032a77fd5564173a3", "size": 1779, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Diff.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/Diff.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/Diff.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 40.4318181818, "max_line_length": 100, "alphanum_fraction": 0.3962900506, "num_tokens": 479, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8705972717658209, "lm_q2_score": 0.600188359260205, "lm_q1q2_score": 0.5225223481175388}}
{"text": "-- exercises in \"Type-Driven Development with Idris\"\n-- chapter 6\n\n-- check that all functions are total\n%default total\n\n--\n-- section 6.2\n-- see Matrix.idr\n-- see Printf.idr\n--\n\nTupleVect : (n : Nat) -> Type -> Type\nTupleVect Z t = ()\nTupleVect (S k) t = (t, TupleVect k t)\n\ntest : TupleVect 4 Nat\ntest = (1,2,3,4,())\n\n--\n-- section 6.3\n-- see DataStore.idr\n--\n", "meta": {"hexsha": "2460a7078947cba0e4f16785aadf964b4cbdd54e", "size": 362, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter6/exercises.idr", "max_stars_repo_name": "pascalpoizat/idris-book", "max_stars_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-08-16T00:58:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T01:07:37.000Z", "max_issues_repo_path": "chapter6/exercises.idr", "max_issues_repo_name": "pascalpoizat/idris-book", "max_issues_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "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": "chapter6/exercises.idr", "max_forks_repo_name": "pascalpoizat/idris-book", "max_forks_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-23T03:15:39.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-23T03:15:39.000Z", "avg_line_length": 15.0833333333, "max_line_length": 52, "alphanum_fraction": 0.6298342541, "num_tokens": 122, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7057850278370112, "lm_q2_score": 0.7401743563075446, "lm_q1q2_score": 0.5224039786707623}}
{"text": "occurrences : Eq ty => (item : ty) -> (values : List ty) -> Nat\noccurrences item [] = 0\noccurrences item (x :: xs) = case x == item of\n                                  False => occurrences item xs\n                                  True => 1 + occurrences item xs\n", "meta": {"hexsha": "68da020066c18cb644ae1cefffcc7af78e8dbb63", "size": 264, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter-07/eq.idr", "max_stars_repo_name": "tekerson/type-driven-development", "max_stars_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-23T04:46:42.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-23T04:46:42.000Z", "max_issues_repo_path": "Chapter-07/eq.idr", "max_issues_repo_name": "tekerson/type-driven-development", "max_issues_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter-07/eq.idr", "max_forks_repo_name": "tekerson/type-driven-development", "max_forks_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 44.0, "max_line_length": 65, "alphanum_fraction": 0.4734848485, "num_tokens": 61, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8198933359135361, "lm_q2_score": 0.6370308082623217, "lm_q1q2_score": 0.5222973144658911}}
{"text": "\nmodule R\n\n-- Definition of the logical relation 'R'\n-- that is central to proving normalization\n-- for the simply-typed lambda calculus\n-- (with primitive recursion).\n\n\nimport Determinism\nimport PnP\nimport Step\nimport Term\nimport Typing\n\n\n%default total\n%access export\n\n\n\n---------------------------\n-- Begin: PREDICATE 'HALTS'\n\n-- The predicate 'Halts' defines what it\n-- means that the evaluation of a term 'e'\n-- under 'Step' terminates - namely that\n-- the term 'e' must evaluate to a value:\npublic export\ndata Halts : Term -> Type where\n  H : (e : Term) ->\n      (e' : Term ** (Value e', TransStep e e'))\n      -> Halts e\n\n\n-- For terms 'e1' and 'e2', if one of them steps\n-- to the other, then either both satisfy 'Halts'\n-- or neither term does; in formulae:\n-- \n--   Step e1 e2 => (Halts e1 <=> Halts e2)\n--\n-- The following two lemmas establish this equivalence,\n-- given 'Step e1 e2'.\n-- The next two lemmas then extend this equivalence to\n-- the 'TransStep' relation.\n\nstepPreservesHalts_1 : (e : Term) -> (e' : Term) ->\n                       Step e e' -> Halts e -> Halts e'\nstepPreservesHalts_1 e e' step (H e ev) = case ev of\n  (x ** (vx, tstx)) => case tstx of\n                            (TStRefl e) => absurd $ valueIrreducible e vx step\n                            (TStTrans st tst) => case stepDeterministic step st of\n                                                      Refl => H e' (x ** (vx, tst))\n\n\nstepPreservesHalts_2 : (e : Term) -> (e' : Term) ->\n                       Step e e' -> Halts e' -> Halts e\nstepPreservesHalts_2 e e' step (H e' ev) = case ev of\n  (x ** (vx, tstx)) => H e (x ** (vx, TStTrans step tstx))\n\n\n\ntransStepPreservesHalts_1 : (e : Term) -> (e' : Term) ->\n                          TransStep e e' -> Halts e -> Halts e'\ntransStepPreservesHalts_1 e e  (TStRefl e)       h = h\ntransStepPreservesHalts_1 e e' (TStTrans st tst) h = \n  let h' = stepPreservesHalts_1 _ _ st h\n  in transStepPreservesHalts_1 _ _ tst h'\n\n\ntransStepPreservesHalts_2 : (e : Term) -> (e' : Term) ->\n                          TransStep e e' -> Halts e' -> Halts e\ntransStepPreservesHalts_2 e e (TStRefl e)        h = h\ntransStepPreservesHalts_2 e e' (TStTrans st tst) h = \n  let h' = transStepPreservesHalts_2 _ _ tst h\n  in stepPreservesHalts_2 _ _ st h'\n  \n\n\nhaltsAbs : (e : Term) -> Halts (TAbs e)\nhaltsAbs e = H (TAbs e) (TAbs e ** (VAbs, TStRefl (TAbs e)))\n\n\n\nhaltsZero : Halts TZero\nhaltsZero = H TZero (TZero ** (VZero, TStRefl TZero))\n\n-- End: PREDICATE 'HALTS'\n-------------------------\n\n\n\n\n--------------------------------------\n-- Begin: (UNARY) LOGICAL RELATION 'R'\n\nmutual\n  public export\n  r : (t : Ty) -> (e : Term) -> Type\n  r TyNat       e = (Typing [] e TyNat,    Halts e)\n  r (TyFun s t) e = (Typing [] e (s:->:t), Halts e, rFun s t e)\n\n  public export\n  rFun : (s : Ty) -> (t : Ty) -> (e : Term) -> Type\n  rFun s t e = (y : Term) -> r s y -> r t (TApp e y)\n\n\nrTyping : (e : Term) -> r t e -> Typing [] e t\nrTyping {t = TyNat}         _ r = fst r\nrTyping {t = (TyFun t1 t2)} _ r = fst r\n\n\nrHalts : r t e -> Halts e\nrHalts {t = TyNat}         r = snd r\nrHalts {t = (TyFun t1 t2)} r = fst $ snd r\n\n\nrHalts' : r t e -> (e' : Term ** (Value e', TransStep e e'))\nrHalts' r = case rHalts r of\n                 (H _ ev) => ev\n\n\nrImplication : r (s :->: t) e -> rFun s t e\nrImplication r =  snd $ snd r\n\n\n-- Forward stepping preserves the predicate 'R':\nmutual\n  stepPreservesR_1 : (t : Ty) -> \n                     (e  : Term) -> (e' : Term) ->\n                     Step e e' -> r t e -> r t e'\n  stepPreservesR_1 TyNat       e e' st (ty, h) = \n    let ty' = preservation e ty st\n        h'  = stepPreservesHalts_1 e e' st h\n    in (ty', h')\n  stepPreservesR_1 (TyFun s t) e e' st (ty, h, imp) =\n    let ty'  = preservation e ty st\n        h'   = stepPreservesHalts_1 e e' st h\n        imp' = stepPreservesR_1_Fun s t e e' st imp \n    in (ty', h', imp')\n\n\n  stepPreservesR_1_Fun : (s : Ty) -> (t : Ty) ->\n                         (e  : Term) -> (e' : Term) ->\n                         Step e e' -> rFun s t e -> rFun s t e'\n  stepPreservesR_1_Fun s t e e' st imp y ry = \n    let r'  = imp y ry\n        st' = StApp1 st\n    in stepPreservesR_1 t _ _ st' r'\n\n\n\n-- Backward stepping preserves the predicate 'R',\n-- but an explicit typing of the expression 'e'\n-- (i.e. the expression that steps) must be provided:\n-- (For the forward direction, an explicit typing\n-- argument is not required thanks to 'preservation'.)\nmutual\n  stepPreservesR_2 : (t : Ty) -> \n                     (e  : Term) -> (Typing [] e t) ->\n                     (e' : Term) ->\n                     Step e e' -> r t e' -> r t e\n  stepPreservesR_2 TyNat       e ty e' st (_, h') = \n    let h = stepPreservesHalts_2 e e' st h'\n    in (ty, h)\n  stepPreservesR_2 (TyFun s t) e ty e' st (_, h', imp') = \n    let h   = stepPreservesHalts_2 e e' st h'\n        imp = stepPreservesR_2_Fun s t e ty e' st imp'\n    in (ty, h, imp)\n\n\n  stepPreservesR_2_Fun : (s : Ty) -> (t : Ty) ->\n                         (e  : Term) -> (Typing [] e (s :->: t)) ->\n                         (e' : Term) ->\n                         Step e e' -> rFun s t e' -> rFun s t e\n  stepPreservesR_2_Fun s t e ty e' st imp' y ry = \n    let r   = imp' y ry \n        st' = StApp1 st\n        tyy = rTyping y ry\n        tya = TyApp ty tyy\n    in stepPreservesR_2 t _ tya _ st' r\n\n\n\ntransStepPreservesR_1 : (t : Ty) -> \n                        (e  : Term) -> (e' : Term) ->\n                        TransStep e e' -> r t e -> r t e'\ntransStepPreservesR_1 t e _  (TStRefl _)       re = re\ntransStepPreservesR_1 t e e' (TStTrans st tst) re = let r' = stepPreservesR_1 t _ _ st re\n                                                    in transStepPreservesR_1 t _ _ tst r'\n\n                                               \ntransStepPreservesR_2 : (t : Ty) -> \n                        (e  : Term) -> (Typing [] e t) ->\n                        (e' : Term) ->\n                        TransStep e e' -> r t e' -> r t e\ntransStepPreservesR_2 t e ty _  (TStRefl _)       re' = re'\ntransStepPreservesR_2 t e ty e' (TStTrans st tst) re' = \n  let ty1 = preservation e ty st\n      r'  = transStepPreservesR_2 t _ ty1 _ tst re'\n  in stepPreservesR_2 t _ ty _ st r'\n\n\n\nrZero : r TyNat TZero\nrZero = (TyZero, haltsZero)\n\n-- End: (UNARY) LOGICAL RELATION 'R'\n------------------------------------\n\n\n\n\n-----------------------------------------\n-- Begin: INVERT PREDICATE 'R' OF 'TSucc' \n\ntransStepSuccInjective : TransStep (TSucc e1) (TSucc e2) -> TransStep e1 e2\ntransStepSuccInjective (TStRefl (TSucc e1)) = TStRefl _\ntransStepSuccInjective (TStTrans (StSucc st) tst) = \n  let ih = transStepSuccInjective tst\n  in TStTrans st ih\n\n\ntransStepSuccSucc : TransStep (TSucc e1) e2 -> (e2' : Term ** e2 = TSucc e2')\ntransStepSuccSucc (TStRefl (TSucc e1)) = (e1 ** Refl)\ntransStepSuccSucc (TStTrans (StSucc st) tst) = transStepSuccSucc tst\n\n\nsuccHaltsHalts : Typing ctx (TSucc e) TyNat -> Halts (TSucc e) -> Halts e\nsuccHaltsHalts (TySucc ty) (H (TSucc e) (_ ** (v, tst))) = \n  let ty' = transPreservation (TSucc e) (TySucc ty) tst  \n  in case canonicalNat _ ty' v of\n          (Left Refl) => let (_ ** eq) = transStepSuccSucc tst\n                         in case eq of Refl impossible\n          (Right (_ ** (v', Refl))) => let tst' = transStepSuccInjective tst\n                                       in H _ (_ ** (v', tst'))\n\n\nsuccRR : r TyNat (TSucc e) -> r TyNat e\nsuccRR re = let ty = rTyping _ re\n                h  = rHalts re\n            in case ty of\n                    (TySucc ty') => (ty', succHaltsHalts ty h)\n                \n-- End: INVERT PREDICATE 'R' OF 'TSucc' \n---------------------------------------\n", "meta": {"hexsha": "c4330c45c45414f8ae8be7d0c0b78ea9bd812e89", "size": 7652, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "totality/src/R.idr", "max_stars_repo_name": "normanrink/PCF", "max_stars_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "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": "totality/src/R.idr", "max_issues_repo_name": "normanrink/PCF", "max_issues_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "totality/src/R.idr", "max_forks_repo_name": "normanrink/PCF", "max_forks_repo_head_hexsha": "6b817263fc7d64f0ed0e5535261814d572292192", "max_forks_repo_licenses": ["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.979757085, "max_line_length": 89, "alphanum_fraction": 0.5324098275, "num_tokens": 2539, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8244619177503205, "lm_q2_score": 0.6334102498375401, "lm_q1q2_score": 0.522222629303768}}
{"text": "module GTLC\nimport Data.Fin\nimport Data.Vect\nimport Data.So\n\n%default total\n\n-- The Representation of types\nmutual\n  data Ty  = TyDyn | TyInt | TyBool | TyFun Ty Ty\n \nmutual\n  -- The representation of Dyn values\n  data Dyn : Type where\n    inj : (t : Ty) -> (x : interpTy t) -> Dyn  \n  \n  -- Convert Ty to Type in proof land\n  data Ty2T : Ty -> Type -> Type where\n    d2d : Ty2T TyDyn Dyn\n    i2i : Ty2T TyInt Int\n    b2b : Ty2T TyBool Bool\n    f2f : Ty2T a b -> Ty2T c d -> Ty2T (TyFun a c) (b -> Maybe d)\n  \n  -- Compute the real type of interpreted Ty values\n  total\n  interpTy : Ty -> Type\n  interpTy TyDyn       = Dyn\n  interpTy TyInt       = Int\n  interpTy TyBool      = Bool\n  interpTy (TyFun A T) = (interpTy A) -> Maybe (interpTy T)\n\n  -- Proof that two Types are consistent\ndata consistTy : Ty -> Ty -> Type where\n  refl  : consistTy a     a\n  dynR  : consistTy a     TyDyn\n  dynL  : consistTy TyDyn a\n  funC  : consistTy a b -> consistTy c d -> consistTy (TyFun a c) (TyFun b d)\n\ndata joinTy : Ty -> Ty -> Ty -> Type where\n  const : joinTy a     a     a\n  right : joinTy TyDyn a     a\n  left  : joinTy a     TyDyn a\n  under : joinTy a     b     c -> joinTy d e f -> \n            joinTy (TyFun a d) (TyFun b e) (TyFun c f) \n  \n\n-- I am Interested in how this is implemented but it represents a type index\n-- that allows variables types to be computed computed while typechecking.\nusing (G : Vect n Ty)\n\n-- An index for variable types\n  data HasType : (i : Fin n) -> Vect n Ty -> Ty -> Type where\n    Stop : HasType FZ (t :: G) t\n    Pop  : HasType k G t -> HasType (FS k) (u :: G) t\n\n-- The Explicitly Typed Cast Calculus\n  data Expr : Vect n Ty -> Ty -> Type where\n    Var   : HasType i G t -> Expr G t\n    ValI  : (v : Int)  -> Expr G TyInt\n    ValB  : (v : Bool) -> Expr G TyBool\n    ILam  : Expr (a :: G) t -> Expr G (TyFun a t)\n    IApp  : Expr G (TyFun a t) -> Expr G a -> Expr G t\n    IOp   : (interpTy a -> interpTy b -> interpTy c) ->\n             Expr G a -> Expr G b -> Expr G c\n    IIf   : Expr G TyBool -> Lazy (Expr G a) -> Lazy (Expr G a) -> Expr G a\n    ICast : Expr G t -> (t : Ty) -> (g : Ty) -> Expr G g   \n  \n  mkCast : Expr G t1 -> (t1 : Ty) -> (t2 : Ty) -> (p : consistTy t1 t2) -> Expr G t2\n  mkCast e s t p = (ICast e s t)\n--  mkCast refl s t e = e -- mkCast is really dumb currently\n\n-- Lam is an unannotated lambda\n  Lam : Expr (TyDyn :: G) t -> Expr G (TyFun TyDyn t)\n  Lam = ILam\n-- LamT is a lambda that accecpts a non dynamic type annotation\n  LamT : (t : Ty) -> Expr (t :: G) g -> Expr G (TyFun t g) \n  LamT t = ILam\n  \n-- If is the \"smart\" constructor for if terms  \n  If : Expr G tt -> Lazy (Expr G tc) -> Lazy (Expr G ta) -> \n        {auto ct : consistTy tt TyBool} -> \n        {auto cc : consistTy tc tr} -> \n        {auto ca : consistTy ta tr} -> \n        Expr G tr\n  If {ct=dynL}{cc}{ca} t c a = If {ct=refl}{cc}{ca} (ICast t TyDyn TyBool) c a\n  If {ct=refl}{cc=refl}{ca=refl} t c a = IIf t c a\n  If {ct=refl}{tc}{ta}{tr} t c a = IIf t (ICast c tc tr) (ICast a ta tr)\n\n-- App is the smart constructor for Application terms\n  data AppRule : Ty -> Ty -> Ty -> Type where\n   fApp : AppRule (TyFun a b) a     b\n   dApp : AppRule TyDyn       TyDyn TyDyn\n   \n  App :  Expr G tf -> Expr G ta -> {auto ar : AppRule tf ra rr} -> \n     {auto cf : consistTy tf (TyFun ra rr)} -> {auto ca : consistTy ta ra} -> Expr G rr\n  App f a {cf} {ca} {tf} {ra} {rr} {ta} = IApp (mkCast f tf (TyFun ra rr) cf) \n                                               (mkCast a ta ra ca)\n    \n-- Op is the smart constructor for operators \n\n  Op  : (interpTy oa -> interpTy ob -> interpTy c) -> Expr G aa -> Expr G ab ->\n           {auto pa : consistTy aa oa} -> \n           {auto pb : consistTy ab ob} -> Expr G c\n  Op p a b {pa} {aa} {oa} {pb} {ab} {ob}  = IOp p (mkCast a aa oa pa) (mkCast b ab ob pb)  \n\n\n-- The lexical environment of the interpreter\n  data Env : Vect n Ty -> Type where\n    Nil  : Env Nil\n    (::) : interpTy a -> Env G -> Env (a :: G)\n\n-- Lookup of lexical values in the interpreter    \n  lookup : HasType i G t -> Env G -> interpTy t\n  lookup Stop    (x :: xs) = x\n  lookup (Pop k) (x :: xs) = lookup k xs\n\n  mutual\n-- Cast between types computed in the smart constructors\n    rtCast : (t : Ty) -> (g : Ty) -> (x : interpTy t) -> Maybe (interpTy g)\n    rtCast TyDyn      TyDyn       x          = return x\n    rtCast TyInt      TyInt       x          = return x\n    rtCast TyBool     TyBool      x          = return x\n    rtCast TyDyn      g           (inj t' x) = rtCast t' g x\n    rtCast t'         TyDyn       x          = return (inj t' x)\n    rtCast (TyFun a b)(TyFun c d) f          = \n             return (\\x => rtCast b d !(f !(rtCast c a x)))\n    rtCast _          _         _          = Nothing\n\n  -- The GTLC interpreter    \n    interp : Env G -> Expr G ty -> Maybe (interpTy ty) \n    interp env (Var i)         = return (lookup i env)\n    interp env (ValI x)        = return x\n    interp env (ValB x)        = return x\n    interp env (ICast x r1 r2) = ?ICast --rtCast r1 r2 !(interp env x)\n    interp env (ILam b)        = return (\\x => interp (x :: env) b)\n    interp env (IOp op x y)    = return (op !(interp env x) !(interp env y))\n    interp env (IApp f s)      = (!(interp env f) !(interp env s)) \n    interp env (IIf t c a)     = return (if !(interp env t) \n                                         then !(interp env c) \n                                         else !(interp env a))\n                                                          \n-- unit tests\n-- unit tests for consist\na2 : consistTy TyInt TyInt \na2 = refl\na0 : consistTy TyDyn TyDyn\na0 = refl\na1 : consistTy TyDyn TyBool\na1 = dynL\na3 : consistTy TyInt TyDyn\na3 = dynR\na4 : consistTy (TyFun TyInt TyBool) (TyFun TyInt TyBool)\na4 = refl\na5 : consistTy (TyFun TyInt TyBool) (TyFun TyInt TyBool)\na5 = funC refl refl\na6 : consistTy (TyFun TyDyn TyBool) (TyFun TyInt TyDyn)\na6 = funC dynL dynR\n-- unit tests of coersion calculus forms\nc0 : Expr [] TyInt\nc0 = ValI 1\nc1 : Expr [] TyBool\nc1 = ValB True\n\n-- unit tests of gradually typed forms \nt0 : Expr [] TyInt\nt0 = ValI 1\nt0' : Expr [] TyBool\nt0' = ValB True\nt1 : Expr [] (TyFun TyDyn TyDyn) \nt1 = Lam (Var Stop)                                    \nt2 : Expr [] (TyFun TyInt TyInt)  \nt2 = LamT TyInt (Var Stop)\n-- unit test on the gradual If smart constructor\nt3 : Expr [] TyInt \nt3 = (If (ValB True) (ValI 0) (ValI 1))\nt4 : Expr [TyDyn] TyInt\nt4 = (If (Var Stop) (ValI 0) (ValI 1))\nt5 : Expr [TyDyn] TyInt\nt5 = (If (Var Stop) (Var Stop) (ValI 1))\nt6 : Expr [TyDyn] TyInt\nt6 = (If (Var Stop) (Var Stop) (Var Stop))\nt7 : Expr [TyDyn] TyDyn\nt7 = (If (Var Stop) (ValI 0) (ValB True))\n-- unit tests for the gradual App smart constructor\nt8 : Expr [] TyInt\nt8 = App (LamT TyInt (Var Stop)) (ValI 1)\nt9 : Expr [] TyDyn\nt9 = App (Lam (Var Stop)) (ValI 1)\nt10 : Expr [] TyDyn\nt10 = App (Lam (If (Var Stop) (ValI 0) (Var Stop))) (ValI 1)\n\n\nsub1 : Expr [] (TyFun TyInt TyInt)\nsub1 = LamT TyInt (Op (-) (Var Stop) (ValI 1))\n\nzerop : Expr [] (TyFun TyInt TyBool)\nzerop = LamT TyInt (Op (==) (ValI 0) (Var Stop))\n\n--zerod : Expr [] (TyFun TyDyn TyBool)\n--zerod = Lam (Op (==) (ValI 0) (Var Stop))\n\n{-\nfact : Expr [] (TyFun TyDyn TyInt)\nfact = (Lam (If (App zerop (Var Stop))\n                (ValI 1)\n                (Op (*) (Var Stop) (App fact (App sub1 (Var Stop))))))\n-}\n-- unit tests for the interpreter\ni0 : Maybe Int\ni0 = (interp [] (ValI 0))\ni0p : i0 = Just 0\ni0p = Refl\ni1 : Maybe Bool\ni1 = (interp [] (ValB True))\ni1p : i1 = Just True\ni1p = Refl\n\n\n--main : IO ()\n--main = putStrLn (show i0)\n", "meta": {"hexsha": "4d8c087e86fb6da517afa47abfd2a8eb390114ee", "size": 7551, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris/GTLC.idr", "max_stars_repo_name": "akuhlens/metaprogramming", "max_stars_repo_head_hexsha": "785793afa547bf1e0fa6c856c2fc4a3050e81fae", "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": "idris/GTLC.idr", "max_issues_repo_name": "akuhlens/metaprogramming", "max_issues_repo_head_hexsha": "785793afa547bf1e0fa6c856c2fc4a3050e81fae", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "idris/GTLC.idr", "max_forks_repo_name": "akuhlens/metaprogramming", "max_forks_repo_head_hexsha": "785793afa547bf1e0fa6c856c2fc4a3050e81fae", "max_forks_repo_licenses": ["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.1674208145, "max_line_length": 91, "alphanum_fraction": 0.5621771951, "num_tokens": 2594, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059414036511, "lm_q2_score": 0.6584175139669997, "lm_q1q2_score": 0.5221948422514489}}
{"text": "module Ch6Ex\n\nimport Data.Vect\n\nMatrix : Nat -> Nat -> Type\nMatrix r c = Vect r (Vect c Double)\n\ntestMatrix : Matrix 2 3\ntestMatrix = [[0, 0, 0], [0, 0, 0]]\n\nTupleVect : (numargs : Nat) -> Type -> Type\nTupleVect Z ty = ()\nTupleVect (S k) ty = (ty, TupleVect k ty)\n\ntest : TupleVect 4 Nat\ntest = (1,2,3,4,())\n", "meta": {"hexsha": "f61d2c7871eba5d76af3204d36ef4b9867e71e30", "size": 308, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Ch6Ex.idr", "max_stars_repo_name": "balajisivaraman/idris-book", "max_stars_repo_head_hexsha": "2452de85e54de0242ec074a95762bde6fc4fe672", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2017-12-06T12:38:55.000Z", "max_stars_repo_stars_event_max_datetime": "2017-12-06T12:38:55.000Z", "max_issues_repo_path": "Ch6Ex.idr", "max_issues_repo_name": "balajisivaraman/idris-book", "max_issues_repo_head_hexsha": "2452de85e54de0242ec074a95762bde6fc4fe672", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Ch6Ex.idr", "max_forks_repo_name": "balajisivaraman/idris-book", "max_forks_repo_head_hexsha": "2452de85e54de0242ec074a95762bde6fc4fe672", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-08-04T17:48:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-04T17:48:35.000Z", "avg_line_length": 18.1176470588, "max_line_length": 43, "alphanum_fraction": 0.6168831169, "num_tokens": 115, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.743168019989179, "lm_q2_score": 0.7025300698514778, "lm_q1q2_score": 0.5220978809943824}}
{"text": "module IdrisNet2.PacketLang \nimport Language.Reflection\nimport Data.So\nimport Data.Vect\n\n%access public\n\n-- Propositions about data\ndata Proposition : Type where\n  P_LT : Nat -> Nat -> Proposition\n  P_EQ : DecEq a => a -> a -> Proposition\n  P_BOOL : Bool -> Proposition\n  P_AND : Proposition -> Proposition -> Proposition\n  P_OR : Proposition -> Proposition -> Proposition\n\nLength : Type\nLength = Int\n\n-- grrrrr, hackity hack\nnatToInt : Nat -> Int\nnatToInt Z = 0\nnatToInt (S k) = 1 + (natToInt k)\n\nintToNat : Int -> Nat\nintToNat 0 = Z\nintToNat i = if i < 0 then Z else (assert_total (S (intToNat (i - 1))))\n\nstrLen : String -> Int\nstrLen s = natToInt $ length s\n\ndata Bounded : Nat -> Type where\n  BInt : (x : Int) -> (prf : So (x < (pow 2 i))) -> Bounded i\n\ninstance Show (Bounded i) where\n  show (BInt x _) = show x\n\nval : Bounded i -> Int\nval (BInt i p) = i\n\nmkBounded : (bound : Nat) -> Int -> Maybe (Bounded bound)\nmkBounded b i_n = \n  case choose (i_n < (pow 2 b)) of\n      Left yes => Just (BInt i_n yes)\n      Right _ => Nothing \n\nNonZero : Nat -> Type\nNonZero n = n `GT` 0\n\n-- Primitive Binary Chunks\ndata Chunk : Type where\n  -- Bits must be at least 1 wide\n  Bit : (width : Nat) -> NonZero width -> Chunk\n  -- Boolean value, stored as one bit.\n  -- Convenience, so we can marshal / unmarshal directly as a Bool\n  CBool : Chunk\n  -- Native C String, null terminated\n  CString : Chunk\n  -- String with fixed bounded length\n  LString : Nat -> Chunk\n  -- String with dynamic bounded length\n  --LString : ((length s) ** (s : String)) -> Chunk\n  -- Proposition about data\n  Prop : (P : Proposition) -> Chunk\n  -- Custom chunk of binary data.\n  -- Can be used to make cleverer things without having\n  -- to add to the core PL each time.\n  Decodable : (n : Nat) -> \n              (t : Type) -> \n              (Bounded n -> Maybe t) -> \n              (t -> Bounded n) -> Chunk\n\ninfixl 5 //\n--infixl 5 ##\n\nmutual\n  -- Requires two propositions, and evidence that they're true.\n  -- For example, if we have P_AND P_BOOL P_BOOL, we'd need two 'oh' proofs.\n  -- If we had two P_EQ propositions, we'd need two reflexivity proofs.\n  data Both : Proposition -> Proposition -> Type where\n    MkBoth : (propTy a) -> (propTy b) -> Both a b\n\n  -- Decode propositions into Idris types.\n  propTy : Proposition -> Type\n  propTy (P_LT x y) = LT x y\n  propTy (P_EQ x y) = x=y\n  propTy (P_BOOL b) = So b\n  propTy (P_AND s t) = Both s t\n  propTy (P_OR s t) = Either (propTy s) (propTy t)\n\n-- Decode chunks into Idris types\n-- TODO <<\nchunkTy : Chunk -> Type\nchunkTy (Bit w p) = Bounded w \nchunkTy CString = String\nchunkTy (LString i) = String\nchunkTy (Prop p) = propTy p\nchunkTy (CBool) = Bool\nchunkTy (Decodable n t encode_fn decode_fn) = t\n\n-- Packet Language\nmutual\n  data PacketLang : Type where\n    CHUNK : (c : Chunk) -> PacketLang\n    IF : (test : Bool) -> (yes : PacketLang) -> (no : PacketLang) -> PacketLang\n    -- // : or\n    (//) : PacketLang -> PacketLang -> PacketLang\n    LIST : PacketLang -> PacketLang\n    LISTN : (n : Nat) -> PacketLang -> PacketLang\n    NULL : PacketLang -- Sometimes, we want to signify that there's nothing there\n    (>>=) : (p : PacketLang) -> (mkTy p -> PacketLang) -> PacketLang\n    \n  -- Packet language decoding\n  mkTy : PacketLang -> Type\n  mkTy (CHUNK c) = chunkTy c\n  mkTy (IF x t e) = if x then (mkTy t) else (mkTy e)\n  mkTy (l // r) = Either (mkTy l) (mkTy r)\n  mkTy (LIST x) = List (mkTy x)\n  mkTy (LISTN n a) = Vect n (mkTy a)\n  mkTy NULL = ()\n  mkTy (c >>= k) = (x ** mkTy (k x))\n\n\n{- Chunk length in bits -}\nbitLength : (pl : PacketLang) -> mkTy pl -> Length\nchunkLength : (c : Chunk) -> chunkTy c -> Length\nchunkLength (Bit w p) _ = natToInt w\nchunkLength CBool _ = 1\nchunkLength CString str = 8 * ((strLen str) + 1) \nchunkLength (LString len) str = 8 * (natToInt len)\nchunkLength (Prop _) p = 0 -- Not written to the packet\nchunkLength (Decodable n _ _ _) _ = natToInt n\n\nlistLength : (pl : PacketLang) -> List (mkTy pl) -> Length\nlistLength pl [] = 0\nlistLength pl (x :: xs) = bitLength pl x + (listLength pl xs)\n\nvectLength : (pl : PacketLang) -> Vect n (mkTy pl) -> Length\nvectLength pl [] = 0\nvectLength pl (x :: xs) = bitLength pl x + (vectLength pl xs)\n\nbitLength (CHUNK c) x = chunkLength c x\nbitLength (IF True yes _) x = bitLength yes x\nbitLength (IF False _ no) x = bitLength no x\nbitLength (y // z) x = either (\\l_x => bitLength y l_x) (\\r_x => bitLength z r_x) x\nbitLength (LIST pl) x = listLength pl x\nbitLength (LISTN n pl) x = vectLength pl x\nbitLength NULL _ = 0\nbitLength (c >>= k) (a ** b) = bitLength c a + bitLength (k a) b\n\n\n-- Syntax rules, so it's nicer to write these things...\nbit : (w : Nat) -> {auto p : NonZero w} -> Chunk\nbit w {p} = Bit w p\n\n-- syntax bit [x] = Bit x oh\n--syntax bytes [n] = CHUNK (bit (n * 8))\n--syntax bounded [x] = BInt x oh\n\n-- PacketLang DSL syntax\nsyntax bits [n] = (CHUNK (bit n))\nsyntax check [b] = (CHUNK (Prop (P_BOOL b)))\nsyntax lstring [n] = (CHUNK (LString n))\nsyntax cstring = (CHUNK (CString))\nsyntax listn [n] [t] = (LISTN n t)\nsyntax list [t] = (LIST t)\nsyntax p_if [b1] then [b2] else [b3] = (IF b1 b2 b3)\nsyntax p_either [t1] [t2] = (t1 // t2)\nsyntax bool = (CHUNK (CBool))\nsyntax prop [p] = (CHUNK (Prop p))\nsyntax null = NULL\nsyntax decodable [n] [ty] [fn1] [fn2] = (CHUNK (Decodable n ty fn1 fn2))\n-- Propositions\nsyntax prop_bool [p] = (P_BOOL p)\nsyntax prop_or [p1] [p2] = (P_OR p1 p2)\nsyntax prop_and [p1] [p2] = (P_AND p1 p2)\nsyntax prop_eq [p1] [p2] = (P_EQ p1 p2)\n\n-- Additional sugar\nsyntax [x] \"##\" [y] = (x ** y)\n\n\n", "meta": {"hexsha": "33e528d0775318bed7599238ea145fa7340c0831", "size": 5531, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/IdrisNet/PacketLang.idr", "max_stars_repo_name": "archaeron/IdrisNet2", "max_stars_repo_head_hexsha": "134708e030a693bba692371118079461541a2b60", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2015-02-11T00:30:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-23T20:15:18.000Z", "max_issues_repo_path": "src/IdrisNet/PacketLang.idr", "max_issues_repo_name": "archaeron/IdrisNet2", "max_issues_repo_head_hexsha": "134708e030a693bba692371118079461541a2b60", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2015-02-24T10:18:38.000Z", "max_issues_repo_issues_event_max_datetime": "2018-12-21T20:33:28.000Z", "max_forks_repo_path": "src/IdrisNet/PacketLang.idr", "max_forks_repo_name": "archaeron/IdrisNet2", "max_forks_repo_head_hexsha": "134708e030a693bba692371118079461541a2b60", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2015-02-24T08:30:44.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-13T00:34:24.000Z", "avg_line_length": 30.3901098901, "max_line_length": 83, "alphanum_fraction": 0.6338817574, "num_tokens": 1838, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8056321889812553, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.521887096346915}}
{"text": "module TypeCheck\n\nimport Syntax\n\npublic export\nTypeError : Type\nTypeError = String\n \ntypeError : TypeError -> Either TypeError Ty\ntypeError msg = Left msg\n\n||| Type context.\npublic export\nCtx : Type\nCtx = List (Name, Ty)\n\nmutual\n  check : Ctx -> Ty -> Expr -> Either TypeError Ty\n  check ctx ty e = do\n    ty' <- typeOf ctx e\n    if ty' /= ty \n    then typeError ((show e) ++ \" has type \" ++ (show ty') ++ \" but is used as if it has type \" ++ (show ty))\n    else pure ty\n\n  ||| `typeOf ctx e` computes the type of expression `e` in \n  ||| type context `ctx`. If `e` does not have a type it \n  ||| returns a `TypeError`.\n  export\n  typeOf : Ctx -> Expr -> Either TypeError Ty\n  typeOf ctx e = case e of\n    Var name => case lookup name ctx of\n                  Nothing => typeError (\"unknown variable \" ++ name)\n                  Just ty => Right ty\n    EInt _  => Right TInt\n    EBool _ => Right TBool\n    Times e1 e2 => do check ctx TInt e1\n                      check ctx TInt e2\n                      pure TInt\n    Plus e1 e2  => do check ctx TInt e1\n                      check ctx TInt e2\n                      pure TInt\n    Minus e1 e2 => do check ctx TInt e1\n                      check ctx TInt e2\n                      pure TInt\n    Equal e1 e2 => do check ctx TInt e1\n                      check ctx TInt e2\n                      pure TBool\n    Less e1 e2  => do check ctx TInt e1\n                      check ctx TInt e2\n                      pure TBool\n\n    If e1 e2 e3 => do check ctx TBool e1\n                      ty <- typeOf ctx e2\n                      check ctx ty e3\n                      pure ty\n\n    Fun f x pty rty e => let ectx = (f, TArrow pty rty) :: (x, pty) :: ctx in\n                         do check ectx rty e\n                            pure (TArrow pty rty)\n\n    Apply e1 e2 =>  do ty1 <- typeOf ctx e1\n                       case ty1 of\n                         TArrow pty rty => do check ctx pty e2\n                                              pure rty\n                         ty => typeError $ (show e1) ++ \" is used as a function but its type is \" ++ (show ty)\n", "meta": {"hexsha": "5f29db6d19a0ca68b61f9ae1d2195121623380b0", "size": 2099, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/TypeCheck.idr", "max_stars_repo_name": "steshaw/idris-miniml", "max_stars_repo_head_hexsha": "7c42e3fb87c9f9d40f0944555c312bdaf5b0e943", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2016-07-15T05:15:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-23T01:01:20.000Z", "max_issues_repo_path": "src/TypeCheck.idr", "max_issues_repo_name": "steshaw/idris-miniml", "max_issues_repo_head_hexsha": "7c42e3fb87c9f9d40f0944555c312bdaf5b0e943", "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": "src/TypeCheck.idr", "max_forks_repo_name": "steshaw/idris-miniml", "max_forks_repo_head_hexsha": "7c42e3fb87c9f9d40f0944555c312bdaf5b0e943", "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": 31.803030303, "max_line_length": 110, "alphanum_fraction": 0.4921391139, "num_tokens": 547, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7606506418255927, "lm_q2_score": 0.6859494550081925, "lm_q1q2_score": 0.5217678932118972}}
{"text": "module System.Time\n\nimport Data.Nat\n\nimport System       -- for `sleep` for `IO` implementations\nimport System.Clock -- for `clockTime` for `IO` implementations\n\n%default total\n\n----------------------------------------------------------\n--- Common stuff for absolute time and finite duration ---\n----------------------------------------------------------\n\npublic export %inline\nUntypedTime : Type\nUntypedTime = Nat\n\nexport\ninterface TimeValue a where\n  (.millis)  : UntypedTime -> a\n  (.seconds) : UntypedTime -> a\n  (.minutes) : UntypedTime -> a\n  (.hours)   : UntypedTime -> a\n  (.days)    : UntypedTime -> a\n\n  -- back conversions may lose data\n  (.asMillis)  : a -> UntypedTime\n  (.asSeconds) : a -> UntypedTime\n  (.asMinutes) : a -> UntypedTime\n  (.asHours)   : a -> UntypedTime\n  (.asDays)    : a -> UntypedTime\n\n  -- appropriate components when we represent this time value as `DD HH:MM:SS.ms`\n  (.millisComponent)  : a -> UntypedTime\n  (.secondsComponent) : a -> UntypedTime\n  (.minutesComponent) : a -> UntypedTime\n  (.hoursComponent)   : a -> UntypedTime\n  (.daysComponent)    : a -> UntypedTime\n\n  x.seconds = (1000 * x).millis\n  x.minutes = (60 * x).seconds\n  x.hours   = (60 * x).minutes\n  x.days    = (24 * x).hours\n\n  x.asSeconds = divNatNZ x.asMillis  1000 SIsNonZero\n  x.asMinutes = divNatNZ x.asSeconds 60   SIsNonZero\n  x.asHours   = divNatNZ x.asMinutes 60   SIsNonZero\n  x.asDays    = divNatNZ x.asHours   24   SIsNonZero\n\n  x.millisComponent  = modNatNZ x.asMillis  1000 SIsNonZero\n  x.secondsComponent = modNatNZ x.asSeconds 60   SIsNonZero\n  x.minutesComponent = modNatNZ x.asMinutes 60   SIsNonZero\n  x.hoursComponent   = modNatNZ x.asHours   24   SIsNonZero\n  x.daysComponent    = x.asDays\n\n---------------------\n--- Absolute time ---\n---------------------\n\n-- Well, absolute time is anyway a finite duration from some point in past...\nnamespace AbsTime\n\n  export\n  record Time where\n    constructor MkTime\n    millis : UntypedTime\n\n  export\n  TimeValue Time where\n    (.millis)   = MkTime\n    (.asMillis) = millis\n\n  export\n  Eq Time where\n    (==) = (==) `on` (.asMillis)\n\n  export\n  Ord Time where\n    compare = compare `on` (.asMillis)\n\n----------------------------\n--- Finite time duration ---\n----------------------------\n\nnamespace FiniteDuration\n\n  export\n  record FinDuration where\n    constructor MkFinDuration\n    millis : UntypedTime\n\n  export\n  TimeValue FinDuration where\n    (.millis) = MkFinDuration\n    (.asMillis) = millis\n\n  export\n  Eq FinDuration where\n    (==) = (==) `on` (.asMillis)\n\n  export\n  Ord FinDuration where\n    compare = compare `on` (.asMillis)\n\n  export\n  Semigroup FinDuration where\n    (<+>) = MkFinDuration .: (+) `on` (.asMillis)\n\n  export\n  Monoid FinDuration where\n    neutral = MkFinDuration 0\n\n  export\n  (*) : Nat -> FinDuration -> FinDuration\n  n * d = (n * d.asMillis).millis\n\n  -- May lose data! `z * (d / z)` may be less than `d`\n  export\n  (/) : FinDuration -> (z : Nat) -> (0 _ : NonZero z) => FinDuration\n  d / z = (divNatNZ d.asMillis z %search).millis\n\n------------------------------------------------------------\n--- Operations between absolute time and finite duration ---\n------------------------------------------------------------\n\n-- This is an absolute difference. `y + (x - y)` may be more than `x` if `x < y`\nexport\n(-) : Time -> Time -> FinDuration\nx - y = ((x `max` y).asMillis `minus` (x `min` y).asMillis).millis\n\nexport\n(+) : Time -> FinDuration -> Time\nt + d = (t.asMillis + d.asMillis).millis\n\n------------------\n--- Interfaces ---\n------------------\n\npublic export\ninterface Timed m where\n  currentTime : m Time\n\npublic export\ninterface Timed m => Monad m => CanSleep m where\n  sleepTill : Time -> m Unit\n  sleepTill t = sleepFor $ t - !currentTime\n\n  sleepFor : FinDuration -> m Unit\n  sleepFor d = sleepTill $ !currentTime + d\n\n--------------------------------\n--- Implementations for `IO` ---\n--------------------------------\n\nnamespace Timed\n\n  export\n  [HasIO] HasIO io => Timed io where\n    currentTime = liftIO $ (.millis) . fromInteger . millisOfClock <$> clockTime UTC where\n      millisOfClock : Clock _ -> Integer\n      millisOfClock (MkClock secs nanos) = secs * 1000 + nanos `div` 1000000\n\nnamespace CanSleep\n\n  export\n  [HasIO] HasIO io => CanSleep io using Timed.HasIO where\n    sleepFor d = do\n      sleep $ cast d.asSeconds\n      let (msComp ** _) = toIntWithPrf d.millisComponent\n      usleep msComp\n      where\n        %inline\n        toIntWithPrf : Nat -> (x : Int ** So (x >= 0))\n        toIntWithPrf k = (cast k ** believe_me {- we are converting from `Nat` -} Oh)\n\nexport\nTimed IO where\n  currentTime = currentTime @{HasIO}\n\nexport\nCanSleep IO where\n  sleepFor = sleepFor @{HasIO}\n", "meta": {"hexsha": "78ae20ef1663e4cd2cff7a2dad05d9f23b064922", "size": 4701, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/System/Time.idr", "max_stars_repo_name": "buzden/idris2-coop", "max_stars_repo_head_hexsha": "39c00e062fad115c6fd22c2a229d52e478061bd7", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-02-20T11:06:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-20T11:06:17.000Z", "max_issues_repo_path": "src/System/Time.idr", "max_issues_repo_name": "buzden/idris2-coop", "max_issues_repo_head_hexsha": "39c00e062fad115c6fd22c2a229d52e478061bd7", "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/System/Time.idr", "max_forks_repo_name": "buzden/idris2-coop", "max_forks_repo_head_hexsha": "39c00e062fad115c6fd22c2a229d52e478061bd7", "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.6885245902, "max_line_length": 90, "alphanum_fraction": 0.5943416294, "num_tokens": 1325, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8333245953120233, "lm_q2_score": 0.6261241772283034, "lm_q1q2_score": 0.5217646766038495}}
{"text": "module Verified.Functor.Either\n\nimport Verified.Functor\n\ninstance VerifiedFunctor (Either e) where\n  functorIdentity (Left _) = Refl\n  functorIdentity (Right _) = Refl\n  functorComposition (Left _) g1 g2 = Refl\n  functorComposition (Right _) g1 g2 = Refl\n", "meta": {"hexsha": "281493d1a182966eccb3db875f798cc4d5f20e6e", "size": 255, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Verified/Functor/Either.idr", "max_stars_repo_name": "yurrriq/idris-verified", "max_stars_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "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/Verified/Functor/Either.idr", "max_issues_repo_name": "yurrriq/idris-verified", "max_issues_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "max_issues_repo_licenses": ["MIT"], "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/Verified/Functor/Either.idr", "max_forks_repo_name": "yurrriq/idris-verified", "max_forks_repo_head_hexsha": "10dd99e43824421be94138b5547fed5a294c9cd1", "max_forks_repo_licenses": ["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.5, "max_line_length": 43, "alphanum_fraction": 0.7647058824, "num_tokens": 72, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7799929104825006, "lm_q2_score": 0.6688802735722128, "lm_q1q2_score": 0.5217218713479215}}
{"text": "module DataStore\n\nimport Data.Vect\n\ninfixr 5 .+.\n\npublic export\ndata Schema = SString\n            | SInt\n            | (.+.) Schema Schema\n\npublic export\nSchemaType: Schema -> Type\nSchemaType SString = String\nSchemaType SInt = Int\nSchemaType (x .+. y) = (SchemaType x, SchemaType y)\n\nexport\nrecord DataStore(schema: Schema) where\n  constructor MkData\n  size: Nat\n  items: Vect size (SchemaType schema)\n\nexport\nempty: DataStore schema\nempty = MkData 0 []\n\nexport\naddToStore : (value: SchemaType schema) -> (store: DataStore schema) -> DataStore schema\naddToStore value (MkData size items) = MkData _ (value :: items)\n\npublic export\ndata StoreView : DataStore schema -> Type where\n  SNil : StoreView empty\n  SAdd: (rec: StoreView store) -> StoreView (addToStore value store)\n\nstoreViewHelp : (items: Vect size (SchemaType schema)) -> StoreView (MkData size items)\nstoreViewHelp [] = SNil\nstoreViewHelp (val :: xs) = SAdd (storeViewHelp xs)\n\nexport\nstoreView : (store : DataStore schema) -> StoreView store\nstoreView (MkData size items) = storeViewHelp items\n\nlistItems : DataStore schema -> List (SchemaType schema)\nlistItems input with (storeView input)\n  listItems empty                    |  SNil      = []\n  listItems (addToStore value store) | (SAdd rec) = value :: (listItems store | rec)\n\nfilterKeys : (test : SchemaType schema -> Bool) -> DataStore (SString .+. schema) -> List String\nfilterKeys test input with (storeView input)\n  filterKeys test empty                           |  SNil      = []\n  filterKeys test (addToStore (key, value) store) | (SAdd rec) =\n    if test value\n    then key :: (filterKeys test store | rec)\n    else filterKeys test store | rec\n\ngetValues : DataStore (SString .+. schema) -> List (SchemaType schema)\ngetValues input with (storeView input)\n  getValues input                       |  SNil      = []\n  getValues (addToStore (_, val) store) | (SAdd rec) = val :: (getValues store | rec)\n\ntestStore : DataStore (SString .+. SString .+. SInt)\ntestStore = addToStore (\"Mercury\", \"Mariner 10\",  1974) $\n            addToStore (\"Venus\",   \"Venera\",      1961) $\n            addToStore (\"Uranus\",  \"Voyager 2\",   1986) $\n            addToStore (\"Pluto\",   \"New Horizons\",2015) $\n            empty\n", "meta": {"hexsha": "82a93486905ca03a01c2b651e8e2bc5b9d3393d9", "size": 2229, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "TypedDataStoreV2.idr", "max_stars_repo_name": "coffius/idris-exercises", "max_stars_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "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": "TypedDataStoreV2.idr", "max_issues_repo_name": "coffius/idris-exercises", "max_issues_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TypedDataStoreV2.idr", "max_forks_repo_name": "coffius/idris-exercises", "max_forks_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_forks_repo_licenses": ["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.3043478261, "max_line_length": 96, "alphanum_fraction": 0.6594885599, "num_tokens": 615, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7718434978390747, "lm_q2_score": 0.6757646010190476, "lm_q1q2_score": 0.5215845133663684}}
{"text": "module Adjoint\nimport Data.Morphisms\n\n\ninterface (Functor f, Functor g) => Adjoint (f : Type -> Type) (g : Type -> Type) where\n  unit : a -> g (f a)\n  counit : f (g a) -> a\n\nphi : Adjoint f g => (f a -> b) -> a -> g b\nphi f = map f . unit\n\npsi : Adjoint f g => (a -> g b) -> f a -> b\npsi f = counit . map f\n\nAdjoint (Pair a) (Morphism a) where\n  unit x = Mor (\\y => (y, x))\n  counit (x, Mor f) = f x\n\nrecord Compose (f : Type -> Type) (g : Type -> Type) (a : Type) where\n  constructor Comp\n  getComp : f (g a)\n\n(Functor f, Functor g) => Functor (Compose f g) where\n  map f = Comp . map (map f) . getComp\n\ninterface Functor m => Monad' (m : Type -> Type) where\n  eta : a -> m a\n  mu  : m (m a) -> m a\n\n  (>>=) : m a -> (a -> m b) -> m b\n  ma >>= f = (mu . map f) ma\n\nAdjoint f g => Monad' (Compose g f) where\n  eta x = Comp (unit x)\n  mu = Comp . map (counit . map getComp) . getComp\n\nget : Compose (Morphism s) (Pair s) s\nget = (Comp (Mor (\\st => (st, st))))\n\nset : s -> Compose (Morphism s) (Pair s) ()\nset st = (Comp (Mor (\\_ => (st, ()))))\n\nexample : Monad' (Compose (Morphism Int) (Pair Int)) => Compose (Morphism Int) (Pair Int) ()\nexample = do st <- get\n             set (st + 1)\n             eta ()\n\ntest : Int -> (Int, ())\ntest = applyMor (getComp example)\n", "meta": {"hexsha": "6c007f4c752d6cc973350e34660082426a506fb4", "size": 1265, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Adjoint.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/Adjoint.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/Adjoint.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 25.3, "max_line_length": 92, "alphanum_fraction": 0.5407114625, "num_tokens": 456, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8856314858927011, "lm_q2_score": 0.588889130767832, "lm_q1q2_score": 0.5215387559079763}}
{"text": "\nmodule EnumTypes\n\ndata Day = Monday\n          | Tuesday\n          | Wednesday\n          | Thursday\n          | Friday\n          | Saturday\n          | Sunday\n%name Day day, day1, day2\n\nnextWeekday : Day -> Day\nnextWeekday Monday = Tuesday\nnextWeekday Tuesday = Wednesday\nnextWeekday Wednesday = Thursday\nnextWeekday Thursday = Friday\nnextWeekday Friday = Saturday\nnextWeekday Saturday = Sunday\nnextWeekday Sunday = Monday\n\n\ntestNextWeekday : (nextWeekday (nextWeekday Saturday)) = Monday\ntestNextWeekday = Refl\n", "meta": {"hexsha": "3dc6ff61bb90f73ed0266a690d1f9b80012ab52c", "size": 512, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Answers/Chapter_2/EnumTypes.idr", "max_stars_repo_name": "robkorn/idris-software-foundations-problems", "max_stars_repo_head_hexsha": "bd5b10c9c361ac8feea29f41745f4bb386c3b06d", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Answers/Chapter_2/EnumTypes.idr", "max_issues_repo_name": "robkorn/idris-software-foundations-problems", "max_issues_repo_head_hexsha": "bd5b10c9c361ac8feea29f41745f4bb386c3b06d", "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": "Answers/Chapter_2/EnumTypes.idr", "max_forks_repo_name": "robkorn/idris-software-foundations-problems", "max_forks_repo_head_hexsha": "bd5b10c9c361ac8feea29f41745f4bb386c3b06d", "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": 20.48, "max_line_length": 63, "alphanum_fraction": 0.69140625, "num_tokens": 128, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6825737344123242, "lm_q2_score": 0.7634837527911057, "lm_q1q2_score": 0.5211339563057608}}
{"text": "module Assn\n\nimport Expr\nimport Logic\nimport Maps\n\n%access public export\n\n%default total\n\nAssertion : Type\nAssertion = State -> Type\n\nnamespace ExAssertions\n  as1 : Assertion\n  as1 = \\st => st X = 3\n\n  as2 : Assertion\n  as2 = \\st => LTE (st X) (st Y)\n\n  as3 : Assertion\n  as3 = \\st => Either (st X = 3) (LTE (st X) (st Y))\n\n  as4 : Assertion\n  as4 = \\st => (LTE (st Z * st Z) (st X), Not (LTE (S (st Z) * S (st Z)) (st X)))\n\n  as5 : Assertion\n  as5 = \\st => ()\n\n  as6 : Assertion\n  as6 = \\st => Void\n\nAssertImplies : (p, q : Assertion) -> Type\nAssertImplies p q = (st : State) -> p st -> q st\n\ninfixr 8 ->>\n\n(->>) : (p, q : Assertion) -> Type\n(->>) = AssertImplies\n\nassertImpliesRefl : p ->> p\nassertImpliesRefl _ p_st = p_st\n\nassertImpliesTrans : p ->> q -> q ->> r -> p ->> r\nassertImpliesTrans p_imp_q q_imp_r = \\st, p_st =>\n  q_imp_r st (p_imp_q st p_st)\n\ninfix 8 <<->>\n\n(<<->>) : (p, q : Assertion) -> Type\n(<<->>) p q = (AssertImplies p q, AssertImplies q p)\n\nassertEquivRefl : p <<->> p\nassertEquivRefl = (assertImpliesRefl, assertImpliesRefl)\n\nassertEquivTrans : p <<->> q -> q <<->> r -> p <<->> r\nassertEquivTrans (p_imp_q, q_imp_p) (q_imp_r, r_imp_q) =\n  (assertImpliesTrans p_imp_q q_imp_r, assertImpliesTrans r_imp_q q_imp_p)\n\nAssignSub : (x : Id) -> (a : AExp) -> (p : Assertion) -> Assertion\nAssignSub x a p = \\st => p (t_update x (aeval st a) st)\n\nBAssn : (b : BExp) -> Assertion\nBAssn b = \\st => beval st b = True\n\nbexp_eval_true : beval st b = True -> BAssn b st\nbexp_eval_true prf = prf\n\nbexp_eval_false : beval st b = False -> Not (BAssn b st)\nbexp_eval_false bfalse btrue = absurd $ trans (sym bfalse) btrue\n\nbassn_eval_false : Not (BAssn b st) -> beval st b = False\nbassn_eval_false contra = fst not_true_iff_false contra\n", "meta": {"hexsha": "a9d6def38a52242991a21f1c14d1003b71894508", "size": 1744, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Assn.idr", "max_stars_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_stars_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "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": "Assn.idr", "max_issues_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_issues_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Assn.idr", "max_forks_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_forks_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "max_forks_repo_licenses": ["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.5675675676, "max_line_length": 81, "alphanum_fraction": 0.6313073394, "num_tokens": 637, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7154239836484143, "lm_q2_score": 0.7279754489059775, "lm_q1q2_score": 0.5208110956545572}}
{"text": "module UnderscoredIntegerLiterals\n\n-- grouping decimal numbers by thousands\namount : Integer\namount = 10_000_000_000\n\nequalAmounts : Bool\nequalAmounts = amount == 10000000000\n\n-- grouping hexadecimal addresses by words\naddr : Int\naddr = 0xCAFE_F00D\n\nequalAddrs : Bool\nequalAddrs = addr == 0xCAFEF00D\n\n-- grouping bits into nibbles in a binary literal\nequalFlags : Bool\nequalFlags = 0b0011_1111_0100_1110 == 0b0011111101001110\n\n-- grouping octals\nequalOctals : Bool\nequalOctals = 0o455_777 == 0o455777\n", "meta": {"hexsha": "3803ab34ff4b0e96ddac869ea383e2c82c8fae14", "size": 501, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/interpolation002/basic053/UnderscoredIntegerLiterals.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "tests/idris2/interpolation002/basic053/UnderscoredIntegerLiterals.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "tests/idris2/interpolation002/basic053/UnderscoredIntegerLiterals.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 20.875, "max_line_length": 56, "alphanum_fraction": 0.7924151697, "num_tokens": 162, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7279754371026367, "lm_q2_score": 0.7154239897159439, "lm_q1q2_score": 0.5208110916271765}}
{"text": "module VectMissing\n\nimport Data.Fin\nimport Data.Vect\n\nexport\nshrink : (xs : Vect (S n) a) -> Elem x xs -> Vect n a\nshrink (x :: ys) Here = ys\nshrink (y :: []) (There p) = absurd p\nshrink (y :: (x :: xs)) (There p) = y :: shrink (x :: xs) p\n\n\n", "meta": {"hexsha": "5917aff93e7e1c5c77bea447905b151da10da839", "size": 242, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/effects003/VectMissing.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/effects003/VectMissing.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/effects003/VectMissing.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 18.6153846154, "max_line_length": 59, "alphanum_fraction": 0.5785123967, "num_tokens": 88, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7826624789529375, "lm_q2_score": 0.6654105653819836, "lm_q1q2_score": 0.520791882623339}}
{"text": "--\n-- A module about shapes\n--\n\n||| a Shape\ndata Shape =\n  ||| Triangle with base and heigth\n  Triangle Double Double |\n  ||| Circle with radius\n  Circle Double\n\n||| computes the area of a shape\narea : Shape -> Double\narea (Triangle x y) = 0.5 * x * y\narea (Circle x) = pi * x * x\n                  -- pi is known by idris\n\n{-\ncommented out code\n-}\n", "meta": {"hexsha": "2ce7416d4bcec82e51b8057caa13f0bc3eeec8ee", "size": 349, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "public/cloc-1.82/tests/inputs/idris_block_comments.idr", "max_stars_repo_name": "josema62/Memoria", "max_stars_repo_head_hexsha": "93ebd98095434bc76d85d3fe8f32c913ed451e43", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-12-28T12:50:26.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-28T12:50:26.000Z", "max_issues_repo_path": "tests/samples/count/idris_block_comments.idr/idris_block_comments.idr", "max_issues_repo_name": "0bOne/loci", "max_issues_repo_head_hexsha": "2c71aa0513dd19dbe70ff23fe9de0858a27d7adf", "max_issues_repo_licenses": ["MIT"], "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/samples/count/idris_block_comments.idr/idris_block_comments.idr", "max_forks_repo_name": "0bOne/loci", "max_forks_repo_head_hexsha": "2c71aa0513dd19dbe70ff23fe9de0858a27d7adf", "max_forks_repo_licenses": ["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.619047619, "max_line_length": 41, "alphanum_fraction": 0.5988538682, "num_tokens": 103, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8221891392358015, "lm_q2_score": 0.6334102567576901, "lm_q1q2_score": 0.5207830337867333}}
{"text": "import Stuff\n\nfoo : Int -> Maybe Int\nfoo 0 = Nothing\nfoo x = Just (prim__mul_Int x 2)\n\ntestLet : Int -> Int\ntestLet x = let y = prim__mul_Int x 2\n                Just ans = foo y\n                     | Nothing => 99\n                z = prim__mul_Int ans 2\n              in z\n", "meta": {"hexsha": "bfebf443e46a5cff4ff8a53c924ffc12d1a96de9", "size": 275, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic006/PMLet.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/basic006/PMLet.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/basic006/PMLet.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 21.1538461538, "max_line_length": 39, "alphanum_fraction": 0.5090909091, "num_tokens": 80, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7745833737577158, "lm_q2_score": 0.6723316926137812, "lm_q1q2_score": 0.5207769507490182}}
{"text": "init : a -> c -> List b -> List (a, b, c)\ninit a c = map (uncurry (,)) . map (a,) . map (,c)\n\nunzip : List (a, b) -> (List a, List b)\nunzip [] = ([], [])\nunzip ((a, b) :: abs)\n  = let (as, bs) = unzip abs in\n    (a :: as, b :: bs)\n\nunzip4 : List (a, b, c, d) -> (List a, List b, List c, List d)\nunzip4 [] = ([], [], [], [])\nunzip4 (abcd :: abcds)\n  = let (a, b, c, d) = abcd\n        (as, bs, cs, ds) = unzip4 abcds\n    in (a :: as, b :: bs, c :: cs, d :: ds)\n", "meta": {"hexsha": "60371c52e73b7ec26855d2f688997629d578d0b3", "size": 459, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/ideMode/ideMode005/Tuples.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/ideMode/ideMode005/Tuples.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/ideMode/ideMode005/Tuples.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 28.6875, "max_line_length": 62, "alphanum_fraction": 0.4357298475, "num_tokens": 196, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7122321720225279, "lm_q2_score": 0.7310585727705126, "lm_q1q2_score": 0.5206834351600315}}
{"text": "import Data.List\nimport Data.List.Views\n\n{-\nNote: \nThe | says that, in the recursive calls, \nyou want to bypass constructing the view, \nbecause you already have appropriate views for lefts and rights. \n-}\n\nmergeSort : Ord a => List a -> List a\nmergeSort input with (splitRec input)\n  mergeSort [] | SplitRecNil = []\n  mergeSort [x] | (SplitRecOne x) = [x]\n  mergeSort (lefts ++ rights) | (SplitRecPair lefts rights lrec rrec) \n            = merge (mergeSort lefts | lrec) (mergeSort rights | rrec)\n\n", "meta": {"hexsha": "a9c38bd9c69c53261b9cc470452a6df89f8cba79", "size": 499, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/ch10/MergeSortView.idr", "max_stars_repo_name": "trevarj/tdd_idris_examples", "max_stars_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "max_stars_repo_licenses": ["Unlicense"], "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/ch10/MergeSortView.idr", "max_issues_repo_name": "trevarj/tdd_idris_examples", "max_issues_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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/ch10/MergeSortView.idr", "max_forks_repo_name": "trevarj/tdd_idris_examples", "max_forks_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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": 27.7222222222, "max_line_length": 70, "alphanum_fraction": 0.6913827655, "num_tokens": 140, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7341195269001831, "lm_q2_score": 0.7090191337850932, "lm_q1q2_score": 0.5205047910574903}}
{"text": "module Learn.Elab\n\nimport Language.Reflection.Utils\n\nmkId : Elab ()\nmkId = do x <- gensym \"x\"\n          attack\n          intro x\n          fill (Var x)\n          solve\n          solve\n\n%language ElabReflection\n\nidNat : Nat -> Nat\nidNat = %runElab mkId  \n\nidNat2 : Nat -> Nat\nidNat2 = %runElab (do intro `{{x}}\n                      fill (Var `{{x}})\n                      solve) \n\nidNat3 : Nat -> Nat \nidNat3 = ?myhole\n\n--total                  \nquicksort : List Nat -> List Nat\nquicksort [] = []\nquicksort (x::xs) =\n  quicksort (filter (< x) xs) ++ x :: quicksort (filter (>= x) xs)\n\n---------- Proofs ----------\n\nLearn.Elab.myhole = %runElab (do x <- gensym \"x\"\n                                 attack\n                                 intro x\n                                 fill (Var x)\n                                 solve\n                                 solve)\n                           \ndata QSAcc : List Nat -> Type where\n  QSAccCase0 : QSAcc []\n  QSAccCase1 : QSAcc (filter (< x) xs) ->\n               QSAcc (filter (>= x) xs) ->\n               QSAcc (x :: xs)\n\nqs' : (xs : List Nat) -> QSAcc xs -> List Nat\nqs' [] QSAccCase0 = []\nqs' (x :: xs) (QSAccCase1 l r) =\n  qs' (filter (< x) xs) l ++\n  x :: qs' (filter (>= x) xs) r\n\n{- bc : (inFun, outFun, accPred : TTName) -> Elab ()\nbc inFun outFun accPred = do\n  (inFun', Ref, inTy) <- lookupTyExact inFun\n     | _ => fail [TextPart \"Not a function\"]\n  (_, args, res) <- lookupArgsExact inFun'\n  declareDatatype $ Declare accPred args `(Type)\n  let accArg = MkFunArg `{{acc}}\n                (mkApp (Var accPred)\n                   (map (Var . name) args))\n                Explicit\n                NotErased\n  declareType $\n    Declare outFun (args ++ [accArg]) res\n  DefineFun _ oldClauses <- lookupFunDefnExact inFun'\n  (newClauses, ctors) <-\n    unzip <$> ?processClauses Z oldClauses\n  defineDatatype $ DefineDatatype accPred ctors\n  defineFunction $ DefineFun outFun newClauses\n  \n--%runElab (bc `{quicksort} `{{qs'}} `{{QSAcc}})\n-}\n\n-- foo : Nat -> Nat\n-- foo k = ?foo_rhs\n\n-- getAllNames : TT -> List TTName\n-- getAllNames (P Bound (UN x) tm) = ?getAllNames_rhs_1\n-- getAllNames (P Bound (NS n xs) tm) = ?getAllNames_rhs_13\n-- getAllNames (P Bound (MN x y) tm) = ?getAllNames_rhs_14\n-- getAllNames (P Bound (SN sn) tm) = ?getAllNames_rhs_15\n-- getAllNames (P Ref n tm) = ?getAllNames_rhs_10\n-- getAllNames (P (DCon x y) n tm) = ?getAllNames_rhs_11\n-- getAllNames (P (TCon x y) n tm) = ?getAllNames_rhs_12\n-- getAllNames (V x) = ?getAllNames_rhs_2\n-- getAllNames (Bind n b tm) = ?getAllNames_rhs_3\n-- getAllNames (App tm tm') = ?getAllNames_rhs_4\n-- getAllNames (TConst c) = ?getAllNames_rhs_5\n-- getAllNames Erased = ?getAllNames_rhs_6\n-- getAllNames (TType uexp) = ?getAllNames_rhs_7\n-- getAllNames (UType x) = ?getAllNames_rhs_8\n\ndata Foo = Fee | Food\n", "meta": {"hexsha": "da156bec05b65beb3b3a8fc543ddff7210d87764", "size": 2821, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Learn/Elab.idr", "max_stars_repo_name": "redfish64/NomicCoin201710", "max_stars_repo_head_hexsha": "1bcdcc1bc160aa70dafcff5030077021c61d9c38", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-05-22T03:25:59.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-24T08:57:47.000Z", "max_issues_repo_path": "Learn/Elab.idr", "max_issues_repo_name": "redfish64/AN201710", "max_issues_repo_head_hexsha": "1bcdcc1bc160aa70dafcff5030077021c61d9c38", "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": "Learn/Elab.idr", "max_forks_repo_name": "redfish64/AN201710", "max_forks_repo_head_hexsha": "1bcdcc1bc160aa70dafcff5030077021c61d9c38", "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.6947368421, "max_line_length": 66, "alphanum_fraction": 0.5586671393, "num_tokens": 863, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7662936430859597, "lm_q2_score": 0.6791787056691698, "lm_q1q2_score": 0.520450324673635}}
{"text": "module parser\n\nimport lexer\nimport tipos\n\n%access public export\n\nmutual\n\n--------------------------------- Parser de Express\u00f5es Aritmeticas ---------------------------------\n  num : List Token -> (Maybe AExp, List Token)\n  num ((TokenInt n)::l) = (Just (N n), l)\n  num ((TokenVarId id)::xs) = let (exp, r) = parseId ((TokenVarId id)::xs) in case exp of\n    Nothing => (Nothing, r)\n    Just k => (Just (IdA k), xs)\n  num l = (Nothing, l)\n\n  factor : List Token -> (Maybe AExp, List Token)\n  factor = orParser num parenExp\n\n  parenExp : List Token -> (Maybe AExp, List Token)\n  parenExp ((TokenLParen)::xs) = let (e,r) = arithExp xs in parenExpAux e r where\n    parenExpAux : Maybe AExp -> List Token -> (Maybe AExp, List Token)\n    parenExpAux Nothing r = (Nothing, (TokenLParen::r))\n    parenExpAux (Just e) (TokenRParen::xs) = ((Just e),xs)\n    parenExpAux (Just e) l = (Nothing,(TokenLParen::xs))\n  parenExp l = (Nothing, l)\n\n  mul : List Token -> (Maybe AExp, List Token)\n  mul l = let (exp, r) = factor l in mulAux exp r where\n    mulAux : Maybe AExp -> List Token -> (Maybe AExp, List Token)\n    mulAux Nothing r = (Nothing, r)\n    mulAux (Just e) ((TokenTimes)::xs) = let (exp', r2) = factor xs in case exp' of\n      Nothing => (Just e, (TokenTimes::xs))\n      Just k => mulAux (Just (Mul e k)) r2\n    mulAux (Just e) ((TokenDiv)::xs) = let (exp', r2) = factor xs in case exp' of\n      Nothing => (Just e, (TokenDiv::xs))\n      Just k => mulAux (Just (Div e k)) r2\n    mulAux (Just e) l = ((Just e),l)\n\n  sum : List Token -> (Maybe AExp, List Token)\n  sum l = let (exp, r) = mul l in sumAux exp r where\n    sumAux : Maybe AExp -> List Token -> (Maybe AExp, List Token)\n    sumAux Nothing r = (Nothing, r)\n    sumAux (Just e) ((TokenPlus)::xs) = let (exp', r2) = mul xs in case exp' of\n      Nothing => (Just e, (TokenPlus::xs))\n      Just k => sumAux (Just (Sum e k)) r2\n    sumAux (Just e) ((TokenMinus)::xs) = let (exp', r2) = mul xs in case exp' of\n      Nothing => (Just e, (TokenMinus::xs))\n      Just k => sumAux (Just (Sub e k)) r2\n    sumAux (Just e) l = ((Just e),l)\n\n  arithExp : List Token -> (Maybe AExp, List Token)\n  arithExp = sum\n\n--------------------------------- Parser de Express\u00f5es Booleanas ---------------------------------\n  bool : List Token -> (Maybe BExp, List Token)\n  bool (TokenTrue::xs) = (Just (Boo True), xs)\n  bool (TokenFalse::xs) = (Just (Boo False), xs)\n  bool l = (Nothing, l)\n\n  idBExp : List Token -> (Maybe BExp, List Token)\n  idBExp ((TokenVarId id)::xs) = let (exp, r) = parseId ((TokenVarId id)::xs) in idAux exp r where\n    idAux : Maybe Id -> List Token -> (Maybe BExp, List Token)\n    idAux (Just e) (TokenPlus::xs) = (Nothing, (TokenPlus::xs))\n    idAux (Just e) (TokenMinus::xs) = (Nothing, (TokenMinus::xs))\n    idAux (Just e) (TokenTimes::xs) = (Nothing, (TokenTimes::xs))\n    idAux (Just e) (TokenDiv::xs) = (Nothing, (TokenDiv::xs))\n    idAux (Just e) l = (Just (IdB e), l)\n\n  factorBExp : List Token -> (Maybe BExp, List Token)\n  factorBExp ((TokenVarId id)::xs) = idBExp ((TokenVarId id)::xs)\n  factorBExp (TokenNot::xs) = let (exp, r) = conditExp xs in case exp of\n    Nothing => (Nothing, (TokenNot::xs))\n    Just k => (Just (Not k), r)\n  factorBExp l = orParser bool parenBExp l\n\n  parenBExp : List Token -> (Maybe BExp, List Token)\n  parenBExp ((TokenLParen)::xs) = let (e,r) = boolExp xs in parenBExpAux e r where\n    parenBExpAux : Maybe BExp -> List Token -> (Maybe BExp, List Token)\n    parenBExpAux Nothing r = (Nothing, (TokenLParen::r))\n    parenBExpAux (Just e) (TokenRParen::xs) = ((Just e),xs)\n    parenBExpAux (Just e) l = (Nothing,(TokenLParen::xs))\n  parenBExp l = (Nothing, l)\n\n  conditExp : List Token -> (Maybe BExp, List Token)\n  conditExp = orParser aux factorBExp\n\n  aux : List Token -> (Maybe BExp, List Token)\n  aux l = let (e,r) = arithExp l in conditExpAux e r where\n    conditExpAux : Maybe AExp -> List Token -> (Maybe BExp, List Token)\n    conditExpAux Nothing r = (Nothing, r)\n    conditExpAux (Just e) ((TokenEqual)::xs) = let (exp', r2) = arithExp xs in case exp' of\n      Nothing => (Nothing, (TokenEqual::xs))\n      Just k => ((Just (Equal e k)), r2)\n    conditExpAux (Just e) ((TokenMaior)::xs) = let (exp', r2) = arithExp xs in case exp' of\n      Nothing => (Nothing, (TokenMaior::xs))\n      Just k => ((Just (GT e k)), r2)\n    conditExpAux (Just e) ((TokenMenor)::xs) = let (exp', r2) = arithExp xs in case exp' of\n      Nothing => (Nothing, (TokenMenor::xs))\n      Just k => ((Just (LT e k)), r2)\n    conditExpAux (Just e) ((TokenMaiorIgual)::xs) = let (exp', r2) = arithExp xs in case exp' of\n      Nothing => (Nothing, (TokenMaiorIgual::xs))\n      Just k => ((Just (GE e k)), r2)\n    conditExpAux (Just e) ((TokenMenorIgual)::xs) = let (exp', r2) = arithExp xs in case exp' of\n      Nothing => (Nothing, (TokenMenorIgual::xs))\n      Just k => ((Just (LE e k)), r2)\n    conditExpAux (Just e) l' = (Nothing,l)\n\n  logic : List Token -> (Maybe BExp, List Token)\n  logic l = let (exp, r) = conditExp l in logicAux exp r where\n    logicAux : Maybe BExp -> List Token -> (Maybe BExp, List Token)\n    logicAux Nothing r = (Nothing, r)\n    logicAux (Just e) ((TokenOr)::xs) = let (exp', r2) = conditExp xs in case exp' of\n      Nothing => (Just e, (TokenOr::xs))\n      Just k => logicAux (Just (OR e k)) r2\n    logicAux (Just e) ((TokenAnd)::xs) = let (exp', r2) = conditExp xs in case exp' of\n      Nothing => (Just e, (TokenAnd::xs))\n      Just k => logicAux (Just (And e k)) r2\n    logicAux (Just e) l = ((Just e),l)\n\n  boolExp : List Token -> (Maybe BExp, List Token)\n  boolExp = logic\n\n--------------------------------- Ajustes para Exp ---------------------------------\n  parseBExp : List Token -> (Maybe Exp, List Token)\n  parseBExp l = let (exp, r) = logic l in case exp of\n    Nothing => (Nothing, l)\n    Just k => ((Just (BExpR k)), r)\n\n  parseAExp : List Token -> (Maybe Exp, List Token)\n  parseAExp l = let (exp, r) = arithExp l in case exp of\n    Nothing => (Nothing, l)\n    Just k => ((Just (AExpR k)), r)\n\n  parseExp : List Token -> (Maybe Exp, List Token)\n  parseExp (TokenCommercialE::l') = let (exp', r2) = parseId l' in case exp' of\n    Nothing => (Nothing, l')\n    Just k => (Just (DeRef k), r2)\n  parseExp (TokenTimes::l') = let (exp', r2) = parseId l' in case exp' of\n    Nothing => (Nothing, l')\n    Just k => (Just(ValRef k), r2)\n  parseExp l = orParser parseBExp parseAExp l\n\n--------------------------------- Parser de Comandos ---------------------------------\n  parseId : List Token -> (Maybe Id, List Token)\n  parseId ((TokenVarId id)::xs) = (Just (ValID id), xs)\n  parseId l = (Nothing, l)\n\n  assign : List Token -> (Maybe Cmd, List Token)\n  assign l = let (exp, r) = parseId l in assignAux exp r where\n    assignAux : Maybe Id -> List Token -> (Maybe Cmd, List Token)\n    assignAux Nothing r = (Nothing, r)\n    assignAux (Just e) (TokenAssign::xs) = let (exp', r2) = parseExp xs in case exp' of\n      Nothing => (Nothing, l)\n      Just k => ((Just (Assign e k)), r2)\n    assignAux (Just e) r = (Nothing, l)\n\n  loop : List Token -> (Maybe Cmd, List Token)\n  loop (TokenWhile::xs) = let (exp, r) = boolExp xs in loopAux exp r where\n    loopAux : Maybe BExp -> List Token -> (Maybe Cmd, List Token)\n    loopAux Nothing l = (Nothing, (TokenWhile::xs))\n    loopAux (Just e) (TokenDo::xs) = let (exp', r2) = seq xs in case exp' of\n      Nothing => (Nothing, (TokenDo::xs))\n      Just k => (Just (Loop e k), r2)\n    loopAux (Just e) l = (Nothing, l)\n  loop l = (Nothing, l)\n\n  partials : List Token -> (Maybe Cmd, List Token)\n  partials (TokenElse::xs) = seq xs\n  partials l = (Nothing, l)\n\n  comandCall : List Token -> (Maybe Cmd, List Token)\n  comandCall = orParser call bloc\n\n  auxComand : List Token -> (Maybe Cmd, List Token)\n  auxComand = orParser loop comandCall\n\n  comandUnityAux : List Token -> (Maybe Cmd, List Token)\n  comandUnityAux = orParser assign auxComand\n\n  comandUnity : List Token -> (Maybe Cmd, List Token)\n  comandUnity = orParser cond comandUnityAux\n\n  cond : List Token -> (Maybe Cmd, List Token)\n  cond (TokenIf::xs) = let (exp, r) = boolExp xs in condAux exp r where\n    condAux : Maybe BExp -> List Token -> (Maybe Cmd, List Token)\n    condAux Nothing l = (Nothing, (TokenIf::xs))\n    condAux (Just e) (TokenThen::xs) = let (c1, r2) = seq xs in case c1 of\n      Nothing => (Nothing, (TokenThen::xs))\n      Just k => let (c2, r3) = partials r2 in case c2 of\n        Nothing => (Just (Cond e k NOP), r3)\n        Just p => (Just (Cond e k p), r3)\n    condAux (Just e) l = (Nothing, l)\n  cond l = (Nothing, l)\n\n  seq : List Token -> (Maybe Cmd, List Token)\n  seq l = let (exp, r) = comandUnity l in seqAux exp r where\n    seqAux : Maybe Cmd -> List Token -> (Maybe Cmd, List Token)\n    seqAux Nothing l' = (Nothing, l')\n    seqAux (Just e) (TokenEnd::xs) = ((Just e), xs)\n    seqAux (Just e) l' = let (c2, r2) = seq l' in case c2 of\n      Nothing => ((Just e), l')\n      Just k => (Just (CSeq e k), r2)\n\n  comands : List Token -> (Maybe Cmd, List Token)\n  comands = seq\n\n  declaration : List Token -> (Maybe Dec, List Token)\n  declaration (TokenCons::xs) = const (TokenCons::xs)\n  declaration (TokenVar::xs) = let (exp, r) = parseId xs in declarationAux exp r where\n    declarationAux : Maybe Id -> List Token -> (Maybe Dec, List Token)\n    declarationAux Nothing l' = (Nothing, l')\n    declarationAux (Just e) (TokenAssign::l') = let (exp', r2) = parseExp l' in case exp' of\n      Nothing => (Nothing, l')\n      Just k => (Just (Bind e (Ref k)), r2)\n    declarationAux (Just e) l' = (Nothing, l')\n  declaration l = (Nothing, l)\n\n  const :List Token -> (Maybe Dec, List Token)\n  const (TokenCons::xs) = let (exp, r) = parseId xs in constAux exp r where\n    constAux : Maybe Id -> List Token -> (Maybe Dec, List Token)\n    constAux Nothing l' = (Nothing, l')\n    constAux (Just e) (TokenAssign::l') = let (exp', r2) = parseExp l' in case exp' of\n      Nothing => (Nothing, l')\n      Just k => (Just (Bind e k), r2)\n    constAux (Just e) l' = (Nothing, l')\n  const l = (Nothing, l)\n\n  dec : List Token -> (Maybe Dec, List Token)\n  dec = orParser seqDec function\n\n  bloc : List Token -> (Maybe Cmd, List Token)\n  bloc (TokenLet::xs) = let (dec, r) = dec xs in blocAux dec r where\n    blocAux : Maybe Dec -> List Token -> (Maybe Cmd, List Token)\n    blocAux Nothing l' = (Nothing, l')\n    blocAux (Just c) (TokenIn::xs) = let (c1, r2) = comands xs in case c1 of\n      Nothing => (Nothing, r2)\n      Just k => (Just (Blk c k), r2)\n    blocAux (Just e) l' = (Nothing, l')\n  bloc l = (Nothing, l)\n\n  seqDec : List Token -> (Maybe Dec, List Token)\n  seqDec l = let (exp, r) = declaration l in seqDecAux exp r where\n    seqDecAux : Maybe Dec -> List Token -> (Maybe Dec, List Token)\n    seqDecAux Nothing l' = (Nothing, l')\n    seqDecAux (Just e) l' = let (c2, r2) = seqDec l' in case c2 of\n      Nothing => ((Just e), l')\n      Just k => (Just (DSeq e k), r2)\n\n  ctrlParser : List Token -> (Maybe Ctrl, List Token)\n  ctrlParser l = let (exp, r) = bloc l in case exp of\n    Nothing => (Nothing, l)\n    Just k => ((Just (CtCmd k)), r)\n\n--------------------------------- Parser de Comandos ---------------------------------\n  formals : List Token -> (Maybe Formals, List Token)\n  formals (TokenLParen::xs) = let (list, r) = listaParam xs in formalsAux list r where\n    formalsAux : List Id -> List Token -> (Maybe Formals, List Token)\n    formalsAux list (TokenRParen::xs) = (Just (Form list), xs)\n    formalsAux list r2 = (Nothing, r2)\n  formals l = (Nothing, l)\n\n  listaParam : List Token -> (List Id, List Token)\n  listaParam l = let (id, r) = parseId l in listaParamAux id r [] where\n    listaParamAux : Maybe Id -> List Token -> List Id -> (List Id, List Token)\n    listaParamAux Nothing r2 list = (list, r2)\n    listaParamAux (Just k) r2 list = let (id', r3) = parseId r2 in listaParamAux id' r3 (k::list)\n\n  abst : List Token -> (Maybe Abst, List Token)\n  abst l =  let (f, r) = formals l in abstAux f r where\n    abstAux : Maybe Formals -> List Token -> (Maybe Abst, List Token)\n    abstAux Nothing r2 = (Nothing, r2)\n    abstAux (Just f) (TokenIgual::xs) = let (cm, r3) = comands xs in case cm of\n      Nothing => (Nothing, r3)\n      Just c => (Just (Abstr f c), r3)\n    abstAux (Just f) r2 = (Nothing, r2)\n\n  function : List Token -> (Maybe Dec, List Token)\n  function (TokenRec::TokenFn::xs)=  let (id, r) = parseId xs in case id of\n    Nothing => (Nothing, xs)\n    Just i => let (f, r2) = abst r in case f of\n      Nothing => (Nothing, r2)\n      Just abs => (Just (Rbnd i abs), r2)\n  function (TokenFn::xs)=  let (id, r) = parseId xs in case id of\n    Nothing => (Nothing, xs)\n    Just i => let (f, r2) = abst r in case f of\n      Nothing => (Nothing, r2)\n      Just abs => (Just (BindF i abs), r2)\n  function l = (Nothing, l)\n\n  actuals : List Token -> (Maybe Actuals, List Token)\n  actuals (TokenLParen::xs) = let (list, r) = listaExps xs in actualsAux list r where\n    actualsAux : List Exp -> List Token -> (Maybe Actuals, List Token)\n    actualsAux list (TokenRParen::xs) = (Just (Act list), xs)\n    actualsAux list r2 = (Nothing, r2)\n  actuals l = (Nothing, l)\n\n  listaExps : List Token -> (List Exp, List Token)\n  listaExps l = let (exp, r) = parseExp l in listaExpsAux exp r [] where\n    listaExpsAux : Maybe Exp -> List Token -> List Exp -> (List Exp, List Token)\n    listaExpsAux Nothing r2 list = (list, r2)\n    listaExpsAux (Just k) r2 list = let (exp', r3) = parseExp r2 in listaExpsAux exp' r3 (k::list)\n\n  call : List Token -> (Maybe Cmd, List Token)\n  call l = let (id, r) = parseId l in case id of\n    Nothing => (Nothing, r)\n    Just i => let (act, r2) = actuals r in case act of\n      Nothing => (Nothing, r2)\n      Just k => (Just (Call i k), r2)\n\n-- fun\u00e7ao para tentar parser de AExp e BExp\n-- tenta aplicar o parser1 a lista\n  orParser : (List Token -> (Maybe a, List Token)) -> (List Token -> (Maybe a, List Token)) -> (List Token -> (Maybe a, List Token))\n  orParser parser1 parser2 list = let (exp,r) = parser1 list in orParserAux exp r where\n-- orParserAux verifica se o parser1 falhou (Nothing) ou retornou com sucesso um (exp, resto da lista)\n    orParserAux : Maybe a -> List Token -> (Maybe a, List Token)\n    orParserAux Nothing l = parser2 l\n    orParserAux (Just exp') l = (Just exp', l)\n", "meta": {"hexsha": "94f8119fa0855febd92fbeee9074755d78ccb0f5", "size": 14261, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/parser.idr", "max_stars_repo_name": "RonaldCamp/ImpCompiler", "max_stars_repo_head_hexsha": "b7690dd0bffc97be52f0e64f8e8dead1f240fb87", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-04-15T03:36:44.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-13T22:38:30.000Z", "max_issues_repo_path": "src/parser.idr", "max_issues_repo_name": "RonaldCamp/ImpCompiler", "max_issues_repo_head_hexsha": "b7690dd0bffc97be52f0e64f8e8dead1f240fb87", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2019-04-15T03:44:40.000Z", "max_issues_repo_issues_event_max_datetime": "2019-06-09T23:51:29.000Z", "max_forks_repo_path": "src/parser.idr", "max_forks_repo_name": "RonaldCamp/ImpCompiler", "max_forks_repo_head_hexsha": "b7690dd0bffc97be52f0e64f8e8dead1f240fb87", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-04-15T03:46:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-04-15T03:46:13.000Z", "avg_line_length": 44.565625, "max_line_length": 132, "alphanum_fraction": 0.6030432648, "num_tokens": 4606, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.766293653760418, "lm_q2_score": 0.6791786926816161, "lm_q1q2_score": 0.5204503219712197}}
{"text": "module Text.WebIDL.Types.Numbers\n\nimport Generics.Derive\n\n%default total\n\n%language ElabReflection\n\n||| The default Eq for Nat runs in O(n), which is too slow\n||| if we want to support large natlits in our tests.\nexport\n[FastNatEq] Eq Nat where\n  (==) = (==) `on` natToInteger\n\n--------------------------------------------------------------------------------\n--          IntLit\n--------------------------------------------------------------------------------\n\n||| An integer literal in hexadecimal, octal, or decimal representation.\n||| The code generator will use the same representation when\n||| generating code for constants and default values.\npublic export\ndata IntLit = Hex Nat | Oct Nat | I Integer\n\n%runElab derive \"IntLit\" [Generic,Meta,Show]\n\nexport\nEq IntLit using FastNatEq where (==) = genEq\n\n--------------------------------------------------------------------------------\n--          Parsing Integers\n--------------------------------------------------------------------------------\n\ndigitToInt : Char -> Integer\ndigitToInt c = cast $ if isDigit c\n                         then ord c - ord '0'\n                         else ord (toUpper c) - ord 'A' + 10\n\ncharsToPosInt : (base : Integer) -> List Char -> Maybe Integer\ncharsToPosInt base t = calc <$> traverse readDigit t\n  where readDigit : Char -> Maybe Integer\n        readDigit c = let d = digitToInt c\n                       in if d >= 0 && d < base then Just d else Nothing\n\n        calc : List Integer -> Integer\n        calc = foldl (\\a,e => a * base + e) 0\n\n||| Tries to read an integer literal from a `String`.\nexport\nreadInt : String -> Maybe IntLit\nreadInt s = case fastUnpack s of\n                 '0'::'x'::t => map (Hex . fromInteger) $ charsToPosInt 16 t\n                 '0'::'X'::t => map (Hex . fromInteger) $ charsToPosInt 16 t\n                 '0'::t      => map (Oct . fromInteger) $ charsToPosInt 8  t\n                 '-'::t      => I . negate <$> charsToPosInt 10 t\n                 t           => map I $ charsToPosInt 10 t\n\n--------------------------------------------------------------------------------\n--          Floating Point Literals\n--------------------------------------------------------------------------------\n\n||| The sign of a floating point literal.\npublic export\ndata Signum = Plus | Minus\n\n%runElab derive \"Signum\" [Generic,Meta,Eq,Show]\n\n||| A parsed floating point literal.\n|||\n||| A floating point literal is either one of three\n||| special values (`NaN`, `Infinity`, or `-Infinity`)\n||| or a decimal floating point number (`NoExp`: dot is\n||| mandatory), or a float in scientific notation (`Exp`:\n||| dot is optional).\n|||\n||| The main focus of this data type is one of\n||| preserving information. Encoding a `FloatLit` should\n||| yield (almost) exactly the same literal as the one\n||| encountered during parsin with two minor exceptions:\n||| a) The encoded literal will always use a lowercase 'e' as\n||| the delimiter for the exponent and b) in case of a\n||| positive exponent, there will not be a '+' in the\n||| encoded literal.\npublic export\ndata FloatLit : Type where\n  ||| Floating point number in scientific notation.\n  |||\n  ||| Example: `-12.10e10`\n  Exp :  (signum    : Signum)\n      -> (beforeDot : Nat)\n      -> (afterDot  : Maybe Nat)\n      -> (exp       : Integer)\n      -> FloatLit\n\n  ||| Floating point number without exponent.\n  |||\n  ||| Example: `-12.1002`\n  NoExp :  (signum    : Signum)\n        -> (beforeDot : Nat)\n        -> (afterDot  : Nat)\n        -> FloatLit\n\n  ||| Corresponds to the WebIDL keyword `Infinity`\n  Infinity         : FloatLit\n\n  ||| Corresponds to the WebIDL keyword `-Infinity`\n  NegativeInfinity : FloatLit\n\n  ||| Corresponds to the WebIDL keyword `NaN`\n  NaN              : FloatLit\n\n%runElab derive \"FloatLit\" [Generic,Meta,Show]\n\nexport\nEq FloatLit using FastNatEq where (==) = genEq\n\n--------------------------------------------------------------------------------\n--          Parsing Floats\n--------------------------------------------------------------------------------\n\ncharsToNat : List Char -> Maybe Nat\ncharsToNat = map fromInteger . charsToPosInt 10\n\nbeforeDot : List Char -> (Signum,Maybe Nat)\nbeforeDot ('-'::cs) = (Minus,charsToNat cs)\nbeforeDot cs        = (Plus, charsToNat cs)\n\nexp : String -> Maybe String -> String -> Maybe FloatLit\nexp bds ads es =\n  let (s,bdNat) = beforeDot (fastUnpack bds)\n   in do bd <- bdNat\n         ad <- maybe (Just Nothing) (map Just . charsToNat . fastUnpack) ads\n         e  <- afterExp (fastUnpack es)\n         pure $ Exp s bd ad e\n\n  where afterExp : List Char -> Maybe Integer\n        afterExp ('-'::cs) = negate <$> charsToPosInt 10 cs\n        afterExp ('+'::cs) = charsToPosInt 10 cs\n        afterExp cs        = charsToPosInt 10 cs\n\nnoExp : String -> String -> Maybe FloatLit\nnoExp bds ads =\n  let (s,bdNat) = beforeDot $ fastUnpack bds\n   in do bd <- bdNat\n         ad <- charsToNat $ fastUnpack ads\n         pure $ NoExp s bd ad\n\n\n||| Tries to read a floating point literal\n||| from a `String`.\nexport\nreadFloat : String -> Maybe FloatLit\nreadFloat s =\n  case split (('E' ==) . toUpper) s of\n    -- with exponent, dot is optional\n    h ::: [e] => case split ('.' ==) h of\n      h2 ::: [t2] => exp h2 (Just t2) e\n      h2 ::: []   => exp h2 Nothing e\n      _  ::: _    => Nothing\n\n    -- without exponent, dot is mandatory\n    -- (otherwise it is an integer)\n    h ::: [] => case split ('.' ==) h of\n      h2 ::: [t2] => noExp h2 t2\n      _  ::: _    => Nothing\n\n    -- more than one E in string\n    _ ::: _  => Nothing\n", "meta": {"hexsha": "e094706fd8b4546b15ab2609cf92d590445e9084", "size": 5532, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Text/WebIDL/Types/Numbers.idr", "max_stars_repo_name": "gergoerdi/idris2-webidl", "max_stars_repo_head_hexsha": "52df1a5f0398be636fd1d419e003c97401b8ed99", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2021-03-23T17:13:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-05T12:18:46.000Z", "max_issues_repo_path": "src/Text/WebIDL/Types/Numbers.idr", "max_issues_repo_name": "gergoerdi/idris2-webidl", "max_issues_repo_head_hexsha": "52df1a5f0398be636fd1d419e003c97401b8ed99", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-11-07T09:28:43.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-15T04:49:05.000Z", "max_forks_repo_path": "src/Text/WebIDL/Types/Numbers.idr", "max_forks_repo_name": "gergoerdi/idris2-webidl", "max_forks_repo_head_hexsha": "52df1a5f0398be636fd1d419e003c97401b8ed99", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2021-11-07T15:04:10.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-11T22:08:55.000Z", "avg_line_length": 32.7337278107, "max_line_length": 80, "alphanum_fraction": 0.5379609544, "num_tokens": 1409, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8354835452961425, "lm_q2_score": 0.6224593312018546, "lm_q1q2_score": 0.5200545288351913}}
{"text": "module Main\n\nimport Prelude\n\n-- https://stackoverflow.com/a/11554793/3574379\n\ninterface Twice f where\n  twice : f -> f\n\nTwice (a -> a) where\n  twice f = f . f\n\ninterface Example a where\n  transform : Int -> a\n\nExample Int where\n  transform n = n + 1\n\nExample Char where\n  transform _ = 'x'\n\n-- run in REPL to see that it derives properly:\n\n-- $ idris src/15_EqualityConstraint_Twice_class.idr\n-- *src/15_EqualityConstraint_Twice_class> :t twice transform\n-- twice transform : Int -> Int\n\n-- Summary:\n-- in idris you dont need equality constaint to derive type of such functions properly\n", "meta": {"hexsha": "841f5a3e4cadb6a0b1d6196a954266a137f77eef", "size": 587, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/14_EqualityConstraint_Twice_class.idr", "max_stars_repo_name": "srghma/hask-test", "max_stars_repo_head_hexsha": "12045eac359a1919b16c9a2142a6f45abbe18474", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2017-10-16T12:55:25.000Z", "max_stars_repo_stars_event_max_datetime": "2017-10-16T12:55:25.000Z", "max_issues_repo_path": "src/14_EqualityConstraint_Twice_class.idr", "max_issues_repo_name": "BjornMelgaard/hask-test", "max_issues_repo_head_hexsha": "12045eac359a1919b16c9a2142a6f45abbe18474", "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/14_EqualityConstraint_Twice_class.idr", "max_forks_repo_name": "BjornMelgaard/hask-test", "max_forks_repo_head_hexsha": "12045eac359a1919b16c9a2142a6f45abbe18474", "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.5666666667, "max_line_length": 86, "alphanum_fraction": 0.7206132879, "num_tokens": 161, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6513548646660543, "lm_q2_score": 0.7981867801399695, "lm_q1q2_score": 0.5199028421563034}}
{"text": "module Main\n\nimport Data.Vect\n\ndata DataStore : Type where\n     MkData : (size : Nat) ->\n              (items : Vect size String) ->\n              DataStore\n\ndata Command = Add String\n               | Get Integer\n               | Size\n               | Quit\n\nsize : DataStore -> Nat\nsize (MkData size' items') = size'\n\nitems : (store : DataStore) -> Vect (size store) String\nitems (MkData _ items') = items'\n\naddToStore : DataStore -> String -> DataStore\naddToStore (MkData _ items) item = MkData _ (add item items)\n           where\n            add : String -> Vect old String -> Vect (S old) String\n            add item [] = [item]\n            add item (x :: xs) = x :: add item xs\n\nparseCommand : (cmd : String) -> (args : String) -> Maybe Command\nparseCommand \"add\" str = Just (Add str)\nparseCommand \"get\" val = case all isDigit (unpack val) of\n                              False => Nothing\n                              True => Just (Get (cast val))\nparseCommand \"size\" _ = Just Size\nparseCommand \"quit\" \"\" = Just Quit\nparseCommand _ _ = Nothing\n\n\nparse : (input : String) -> Maybe Command\nparse input = case Strings.span (/= ' ') input of\n              (cmd, args) => parseCommand cmd (Strings.ltrim args)\n\n\ngetEntry : (pos : Integer) -> (store : DataStore) -> Maybe (String, DataStore)\ngetEntry pos store = let store_items = items store in\n                         case integerToFin pos (size store) of\n                              Nothing => Nothing\n                              Just f => Just (index f store_items ++ \"\\n\", store)\n\nprocessInput : DataStore -> String -> Maybe (String, DataStore)\nprocessInput store inp = case parse inp of\n                              Nothing => Just (\"Invalid command\\n\", store)\n                              Just (Add item) => Just (\"ID \" ++ show (size store) ++ \"\\n \", addToStore store item)\n                              Just (Get pos) => getEntry pos store\n                              Just Size => let (MkData size _) = store in Just ((\"Size = \" ++ show size ++ \"\\n\"), store)\n                              Just Quit => Nothing\n\nmain : IO ()\nmain = replWith (MkData _ [\"Moscow\", \"Kurgan\", \"Ekaterinburg\"]) \"Command: \" processInput\n\n\nEnter the sequantally strings and press Enter when input will be compleated.\n", "meta": {"hexsha": "cc1f6c26b19afd86cd14289c8bb62b25aefbe4df", "size": 2259, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "storage/storage.idr", "max_stars_repo_name": "avatar29A/idris-learn", "max_stars_repo_head_hexsha": "8441cc5ccfbafa1670d88f55246f2bb52117cb48", "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": "storage/storage.idr", "max_issues_repo_name": "avatar29A/idris-learn", "max_issues_repo_head_hexsha": "8441cc5ccfbafa1670d88f55246f2bb52117cb48", "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": "storage/storage.idr", "max_forks_repo_name": "avatar29A/idris-learn", "max_forks_repo_head_hexsha": "8441cc5ccfbafa1670d88f55246f2bb52117cb48", "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": 36.435483871, "max_line_length": 120, "alphanum_fraction": 0.5502434706, "num_tokens": 532, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7431680086124811, "lm_q2_score": 0.6992544085240401, "lm_q1q2_score": 0.5196635062963092}}
{"text": "%default partial\n\nfoo : (Nat, Nat) -> Nat\nfoo (Z, Z) = Z\n\nbar : {a : _} -> a -> Nat\nbar Z = Z\nbar (S _) = S Z\n\ncty : (a : Type) -> a -> Nat\ncty Nat Z = Z\ncty Nat (S _) = S Z\ncty _ x = S (S Z)\n\nbadBar : a -> Nat\nbadBar Z = Z\nbadBar (S _) = S Z\n", "meta": {"hexsha": "aab43da674ca78834d48ac334c5f4b988fff8bde", "size": 243, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/coverage003/Cover.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/coverage003/Cover.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/coverage003/Cover.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 13.5, "max_line_length": 28, "alphanum_fraction": 0.4897119342, "num_tokens": 110, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8397339676722394, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5196109487456725}}
{"text": "module Main\n\ndata RLE : Vect n Char -> Type where\n     REnd  : RLE []\n     RChar : {xs : Vect k Char} ->\n             (n : Nat) -> (c : Char) -> (rs : RLE xs) ->\n             RLE (replicate (S n) c ++ xs)\n\n------------\n\nrle : (xs : Vect n Char) -> RLE xs\nrle [] = REnd\nrle (x :: xs) with (rle xs)\n  rle (x :: []) | REnd = RChar 0 x REnd\n  rle (x :: (c :: (replicate n c ++ ys))) | (RChar n c rs) with (decEq x c)\n    rle (x :: (x :: (replicate n x ++ ys))) | (RChar n x rs) | (Yes refl) \n        = RChar (S n) x rs\n    rle (x :: (c :: (replicate n c ++ ys))) | (RChar n c rs) | (No f) \n        = RChar 0 x (RChar n c rs)\n\ncompress : Vect n Char -> String\ncompress xs with (rle xs)\n  compress [] | REnd = \"\"\n  compress (c :: (replicate n c ++ xs1)) | (RChar n c rs) \n       = show (the Integer (cast (S n))) ++\n           strCons c (compress xs1)\n\ncompressString : String -> String\ncompressString xs = compress (fromList (unpack xs))\n\nmain : IO ()\nmain = putStrLn (compressString \"foooobaaaarbaaaz\")\n\n", "meta": {"hexsha": "71ddf9c0463e94872d7df391f41cb8824342f0a0", "size": 1000, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "RLE/rle-vect.idr", "max_stars_repo_name": "silky/idris-demos", "max_stars_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-06-27T11:33:51.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-27T11:33:51.000Z", "max_issues_repo_path": "RLE/rle-vect.idr", "max_issues_repo_name": "silky/idris-demos", "max_issues_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "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": "RLE/rle-vect.idr", "max_forks_repo_name": "silky/idris-demos", "max_forks_repo_head_hexsha": "1cda10e07d9c8205b9dd56048b1c2cc96f8e3e04", "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.4117647059, "max_line_length": 75, "alphanum_fraction": 0.518, "num_tokens": 352, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8397339676722393, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5196109487456724}}
{"text": "module Main\n\ndata Expr = Var String\n          | Val Int\n          | Add Expr Expr\n\ndata Eval : Type -> Type where\n   MkEval : (List (String, Int) -> Maybe a) -> Eval a\n\nfetch : String -> Eval Int\nfetch x = MkEval (\\e => fetchVal e) where\n    fetchVal : List (String, Int) -> Maybe Int\n    fetchVal [] = Nothing\n    fetchVal ((v, val) :: xs) = if (x == v) then (Just val) else (fetchVal xs)\n\nimplementation Functor Eval where\n    map f (MkEval g) = MkEval (\\e => map f (g e))\n\nimplementation Applicative Eval where\n    pure x = MkEval (\\e => Just x)\n\n    (<*>) (MkEval f) (MkEval g) = MkEval (\\x => appAux (f x) (g x)) where\n       appAux : Maybe (a -> b) -> Maybe a -> Maybe b\n       appAux (Just fx) (Just gx) = Just (fx gx)\n       appAux _         _         = Nothing\n\neval : Expr -> Eval Int\neval (Var x)   = fetch x\neval (Val x)   = [| x |]\neval (Add x y) = [| eval x + eval y |]\n\nrunEval : List (String, Int) -> Expr -> Maybe Int\nrunEval env e with (eval e) {\n    | MkEval envFn = envFn env\n}\n\nmain : IO ()\nmain = do printLn [| (\\x => x *2) (Just 4) |]\n          printLn [| plus (Just 4) (Just 5) |]\n          printLn (runEval [(\"x\",21), (\"y\", 20)] (Add (Val 1) (Add (Var \"x\") (Var \"y\"))))\n          printLn (runEval [(\"x\",21)] (Add (Val 1) (Add (Var \"x\") (Var \"y\"))))\n", "meta": {"hexsha": "190143f22ca69eee347071c5c0808d344d2bb185", "size": 1274, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/sugar001/test007.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/sugar001/test007.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/sugar001/test007.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 30.3333333333, "max_line_length": 89, "alphanum_fraction": 0.5361067504, "num_tokens": 427, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8198933183101078, "lm_q2_score": 0.6334102498375401, "lm_q1q2_score": 0.5193288315909352}}
{"text": "> module SequentialDecisionProblems.applications.Main\n\n> import Data.Vect\n> -- import Data.Fin\n> -- import Data.List\n> -- import Data.List.Quantifiers\n> import Data.So\n> import Effects\n> import Effect.Exception\n> import Effect.StdIO\n\n> import SequentialDecisionProblems.CoreTheory\n> import SequentialDecisionProblems.FullTheory\n> import SequentialDecisionProblems.TabBackwardsInduction\n> import SequentialDecisionProblems.Utils\n> import SequentialDecisionProblems.NonDeterministicDefaults\n> import SequentialDecisionProblems.CoreTheoryOptDefaults\n> import SequentialDecisionProblems.FullTheoryOptDefaults\n> import SequentialDecisionProblems.TabBackwardsInductionOptDefaults\n\n> import BoundedNat.BoundedNat\n> -- import FastSimpleProb.SimpleProb\n> -- import FastSimpleProb.BasicOperations\n> -- import FastSimpleProb.BasicProperties\n> -- import FastSimpleProb.MonadicOperations\n> -- import FastSimpleProb.MonadicProperties\n> -- import FastSimpleProb.Measures\n> -- import FastSimpleProb.MeasuresProperties\n> -- import FastSimpleProb.Operations\n> -- import Sigma.Sigma\n> import Double.Predicates\n> -- import Double.Postulates\n> -- import Double.Operations\n> -- import Double.Properties\n> import NonNegDouble.NonNegDouble\n> -- import NonNegDouble.Constants\n> import NonNegDouble.BasicOperations\n> import NonNegDouble.Operations\n> import NonNegDouble.Properties\n> import NonNegDouble.Predicates\n> import NonNegDouble.LTEProperties\n> -- import Finite.Predicates\n> -- import Finite.Operations\n> -- import Finite.Properties\n> -- import Decidable.Predicates\n> -- import Decidable.Properties\n> -- import LocalEffect.Exception\n> -- import LocalEffect.StdIO\n> -- import Fin.Operations\n> -- import List.Operations\n> -- import Unit.Properties\n\n> -- %default total\n> %auto_implicits off\n\n> -- %logging 5\n\n\n* States\n\n> data Tag = V | X | O\n\n> Board : Type\n> Board = Vect 9 Tag\n\n> validBoard : Nat -> Board -> Bool\n\n> data ValidBoard : Nat -> Type where\n>   MkValidBoard : (t : Nat) -> (b : Board) -> validBoard t b = True -> ValidBoard t\n\n> SequentialDecisionProblems.CoreTheory.State = ValidBoard\n\n\n* Controls\n\n> Move : Type\n> Move = Maybe (LTB 9) -- Nothing is for the case the game is over before 5 rounds\n\n> validMove : (t : Nat) -> ValidBoard t -> Move -> Bool\n\n> data ValidMove : (t : Nat) -> ValidBoard t -> Type where\n>   MkValidMove : (t : Nat) -> (b : ValidBoard t) -> (m : Move) -> validMove t b m = True -> ValidMove t b\n\n> SequentialDecisionProblems.CoreTheory.Ctrl = ValidMove\n\n\n* Transition function\n\n> possible : (t : Nat) -> (b : ValidBoard t) -> (m : ValidMove t b) -> List (ValidBoard (S t))\n\n> SequentialDecisionProblems.CoreTheory.nexts t x y = possible t x y\n\n\n* |Val| and |LTE|:\n\n> SequentialDecisionProblems.CoreTheory.Val =\n>   NonNegDouble.NonNegDouble\n \n> SequentialDecisionProblems.CoreTheory.plus =\n>   NonNegDouble.Operations.plus\n\n> SequentialDecisionProblems.CoreTheory.zero =\n>   fromInteger 0\n\n> SequentialDecisionProblems.CoreTheory.LTE =\n>   NonNegDouble.Predicates.LTE\n\n> SequentialDecisionProblems.FullTheory.reflexiveLTE =\n>   NonNegDouble.LTEProperties.reflexiveLTE\n\n> SequentialDecisionProblems.FullTheory.transitiveLTE =\n>   NonNegDouble.LTEProperties.transitiveLTE\n \n> SequentialDecisionProblems.FullTheory.monotonePlusLTE =\n>   NonNegDouble.LTEProperties.monotonePlusLTE\n\n> SequentialDecisionProblems.CoreTheoryOptDefaults.totalPreorderLTE =\n>   NonNegDouble.LTEProperties.totalPreorderLTE\n\n\n* Reward function\n\n> won  : (t : Nat) -> (b : ValidBoard t) -> Bool\n> lost : (t : Nat) -> (b : ValidBoard t) -> Bool\n\n> SequentialDecisionProblems.CoreTheory.reward t x y x' =\n>   if won (S t) x'\n>   then cast 2.0\n>   else if lost (S t) x'\n>        then cast 0.0\n>        else cast 1.0\n\n> {-\n \n* Completing the problem specification\n\nTo be able to apply the verified, generic backwards induction algorithm\nof |CoreTheory| to compute optimal policies for our problem, we have to\nexplain how the decision maker accounts for uncertainties on rewards\ninduced by uncertainties in the transition function. We first assume\nthat the decision maker measures uncertain rewards by their expected\nvalue:\n\n> SequentialDecisionProblems.CoreTheory.meas = expectedValue -- worst -- expectedValue\n> SequentialDecisionProblems.FullTheory.measMon = monotoneExpectedValue -- monotoneWorst -- monotoneExpectedValue\n\nFurther on, we have to implement the notions of viability and\nreachability. We start by positing that all states are viable for any\nnumber of steps:\n\n> -- Viable : (n : Nat) -> State t -> Type\n> SequentialDecisionProblems.CoreTheory.Viable n x = Unit\n\nFrom this definition, it trivially follows that all elements of an\narbitrary list of states are viable for an arbitrary number of steps:\n\n> viableLemma : {t, n : Nat} -> (xs : List (State t)) -> All (Viable n) xs\n> viableLemma  Nil      = Nil\n> viableLemma {t} {n} (x :: xs) = () :: (viableLemma {t} {n} xs)\n\nThis fact and the (less trivial) result that simple probability\ndistributions are never empty, see |nonEmptyLemma| in\n|MonadicProperties| in |SimpleProb|, allows us to show that the above\ndefinition of |Viable| fulfills |viableSpec1|:\n\n> -- viableSpec1 : (x : State t) -> Viable (S n) x -> GoodCtrl t x\n> SequentialDecisionProblems.CoreTheory.viableSpec1 {t} {n} s v =\n>   MkSigma High (ne, av) where\n>     ne : SequentialDecisionProblems.CoreTheory.NotEmpty (nexts t s High)\n>     ne = nonEmptyLemma (nexts t s High)\n>     av : SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} n) (nexts t s High)\n>     av = viableLemma {t = S t} (support (nexts t s High))\n\n> SequentialDecisionProblems.Utils.finiteViable n x = finiteUnit\n\n> SequentialDecisionProblems.Utils.decidableViable n x = decidableUnit\n\nFor reachability, we proceed in a similar way. We say that all states\nare reachable\n\n> -- Reachable : State t' -> Type\n> SequentialDecisionProblems.CoreTheory.Reachable x' = Unit\n\nwhich immediately implies |reachableSpec1|:\n\n> -- reachableSpec1 : (x : State t) -> Reachable {t' = t} x -> (y : Ctrl t x) -> All (Reachable {t' = S t}) (nexts t x y)\n> SequentialDecisionProblems.CoreTheory.reachableSpec1 {t} x r y = all (nexts t x y) where\n>   all : (sp : SimpleProb  (State (S t))) -> SequentialDecisionProblems.CoreTheory.All (Reachable {t' = S t}) sp\n>   all sp = all' (support sp) where\n>     all' : (xs : List (State (S t))) -> Data.List.Quantifiers.All (Reachable {t' = S t}) xs\n>     all' Nil = Nil\n>     all' (x :: xs) = () :: (all' xs)\n\nand decidability of |Reachable|:\n\n> SequentialDecisionProblems.TabBackwardsInduction.decidableReachable x = decidableUnit\n\nFinally, we have to show that controls are finite\n\n> -- finiteCtrl : {t : Nat} -> (x : State t) -> Finite (Ctrl t x)\n> SequentialDecisionProblems.Utils.finiteCtrl _ = finiteLowHigh\n\nand, in order to use the fast, tail-recursive tabulated version of\nbackwards induction, that states are finite:\n\n> SequentialDecisionProblems.TabBackwardsInduction.finiteState t =\n>   finiteTuple4 finiteFin finiteLowHigh finiteAvailableUnavailable finiteGoodBad\n\n\n* Optimal policies, optimal decisions, ...\n\nWe can now apply the results of our |CoreTheory| and of the |FullTheory|\nto compute verified optimal policies, possible state-control sequences,\netc. To this end, we need to be able to show the outcome of the decision\nprocess. This means implemeting functions to print states and controls:\n\n> -- showState : {t : Nat} -> State t -> String\n> SequentialDecisionProblems.Utils.showState {t} (e, High, Unavailable, Good) =\n>   \"(\" ++ show (finToNat e) ++ \",H,U,G)\"\n> SequentialDecisionProblems.Utils.showState {t} (e, High, Unavailable,  Bad) =\n>   \"(\" ++ show (finToNat e) ++ \",H,U,B)\"\n> SequentialDecisionProblems.Utils.showState {t} (e, High,   Available, Good) =\n>   \"(\" ++ show (finToNat e) ++ \",H,A,G)\"\n> SequentialDecisionProblems.Utils.showState {t} (e, High,   Available,  Bad) =\n>   \"(\" ++ show (finToNat e) ++ \",H,A,B)\"\n> SequentialDecisionProblems.Utils.showState {t} (e,  Low, Unavailable, Good) =\n>   \"(\" ++ show (finToNat e) ++ \",L,U,G)\"\n> SequentialDecisionProblems.Utils.showState {t} (e,  Low, Unavailable,  Bad) =\n>   \"(\" ++ show (finToNat e) ++ \",L,U,B)\"\n> SequentialDecisionProblems.Utils.showState {t} (e,  Low,   Available, Good) =\n>   \"(\" ++ show (finToNat e) ++ \",L,A,G)\"\n> SequentialDecisionProblems.Utils.showState {t} (e,  Low,   Available,  Bad) =\n>   \"(\" ++ show (finToNat e) ++ \",L,A,B)\"\n\n> -- showControl : {t : Nat} -> {x : State t} -> Ctrl t x -> String\n> SequentialDecisionProblems.Utils.showCtrl {t} {x}  Low = \"L\"\n> SequentialDecisionProblems.Utils.showCtrl {t} {x} High = \"H\"\n\n> -- ad-hoc trajectories computation\n> adHocPossibleStateCtrlSeqs : {t, n : Nat} -> \n>                              (ps : PolicySeq t n) ->\n>                              (x : State t) -> \n>                              SimpleProb (StateCtrlSeq t n)\n> adHocPossibleStateCtrlSeqs {t} {n = Z}         Nil  x =  \n>   FastSimpleProb.MonadicOperations.ret (Nil x)\n> adHocPossibleStateCtrlSeqs {t} {n = S m} (p :: ps') x =\n> {-  \n>   FastSimpleProb.MonadicOperations.fmap ((MkSigma x y) ::) (FastSimpleProb.MonadicOperations.naivebind mx' f) where\n>     y   :  Ctrl t x\n>     y   =  ctrl (p x () ())\n>     mx' :  SimpleProb (State (S t))\n>     mx' =  nexts t x y\n>     f   :  State (S t) -> M (StateCtrlSeq (S t) m)\n>     f   =  adHocPossibleStateCtrlSeqs {n = m} ps'\n> ---}\n> --{-\n>   let y   = ctrl (p x () ()) in\n>   let mx' =  nexts t x y in\n>   let f   =  adHocPossibleStateCtrlSeqs {n = m} ps' in\n>   FastSimpleProb.MonadicOperations.fmap ((MkSigma x y) ::) (FastSimpleProb.MonadicOperations.naivebind mx' f)\n> ---}\n\n\n> constHigh : (t : Nat) -> (n : Nat) -> PolicySeq t n\n> constHigh t  Z    = Nil\n> constHigh t (S n) = p :: (constHigh (S t) n) where\n>   p : Policy t (S n)\n>   p x r v = MkSigma High (ne, av) where\n>     ne : SequentialDecisionProblems.CoreTheory.NotEmpty (nexts t x High)\n>     ne = nonEmptyLemma (nexts t x High)\n>     av : SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} n) (nexts t x High)\n>     av = viableLemma {t = S t} (support (nexts t x High))\n\n\n> ||| Constant low policy sequences\n> constLow : (t : Nat) -> (n : Nat) -> PolicySeq t n\n> constLow t  Z    = Nil\n> constLow t (S n) = p :: (constLow (S t) n) where\n>   p : Policy t (S n)\n>   p x r v = MkSigma Low (ne, av) where\n>     ne : SequentialDecisionProblems.CoreTheory.NotEmpty (nexts t x Low)\n>     ne = nonEmptyLemma (nexts t x Low)\n>     av : SequentialDecisionProblems.CoreTheory.All (Viable {t = S t} n) (nexts t x Low)\n>     av = viableLemma {t = S t} (support (nexts t x Low))\n\n\n> computation : { [STDIO] } Eff ()\n> computation =\n>   do putStr (\"enter number of steps:\\n\")\n>      nSteps <- getNat\n>      putStrLn \"nSteps (number of decision steps):\"\n>      putStrLn (\"  \" ++ show nSteps)\n>      \n>      putStrLn \"crE (crit. cumulated emissions threshold):\"\n>      putStrLn (\"  \" ++ show crE)\n>      putStrLn \"crN (crit. number of decision steps):\" \n>      putStrLn (\"  \" ++ show crN)\n>      \n>      putStrLn \"pS1 (prob. of staying in a good world, cumulated emissions below crE):\"\n>      putStrLn (\"  \" ++ show pS1)\n>      putStrLn \"pS2 (prob. of staying in a good world, cumulated emissions above crE):\"\n>      putStrLn (\"  \" ++ show pS2)\n>      \n>      putStrLn \"pA1 (prob. of eff. tech. becoming available, number of steps below crN):\" \n>      putStrLn (\"  \" ++ show pA1)\n>      putStrLn \"pA2 (prob. of eff. tech. becoming available, number of steps above crN):\"\n>      putStrLn (\"  \" ++ show pA2)\n>      \n>      putStrLn \"pLL (prob. of low emission policies, emissions low, low selected):\"\n>      putStrLn (\"  \" ++ show pLL)\n>      putStrLn \"pLH (prob. of low emission policies, emissions high, low selected):\"\n>      putStrLn (\"  \" ++ show pLH)\n>      putStrLn \"pHL (prob. of high emission policies, emissions low, high selected):\"\n>      putStrLn (\"  \" ++ show pHL)\n>      putStrLn \"pHH (prob. of high emission policies, emissions high, high selected):\"\n>      putStrLn (\"  \" ++ show pHH) \n>      \n>      putStrLn \"badOverGood (step benefits ratio: bad over good world):\"\n>      putStrLn (\"  \" ++ show badOverGood)\n>      putStrLn \"lowOverGoodUnavailable (benefits ratio: low emissions over step, good world, eff. tech. unavailable):\"\n>      putStrLn (\"  \" ++ show lowOverGoodUnavailable) \n>      putStrLn \"lowOverGoodAvailable (benefits ratio: low emissions over step, good world, eff. tech. available):\"\n>      putStrLn (\"  \" ++ show lowOverGoodAvailable)\n>      putStrLn \"highOverGood (benefits ratio: High emissions over step, good world):\"\n>      putStrLn (\"  \" ++ show highOverGood) \n>                \n>      putStrLn \"computing constHigh policies ...\"\n>      constHigh_ps <- pure (constHigh Z nSteps)\n>\n>      putStrLn \"computing constHigh state-control sequences ...\"\n>      constHigh_mxys <- pure (adHocPossibleStateCtrlSeqs constHigh_ps (FZ, High, Unavailable, Good))\n>      putStrLn \"pairing constHigh state-control sequences with their values ...\"\n>      constHigh_mxysv <- pure (possibleStateCtrlSeqsRewards' constHigh_mxys)\n>      -- putStrLn \"constHigh state-control sequences and their values:\"\n>      -- putStrLn (showlong constHigh_mxysv)  \n>      \n>      putStrLn \"computing (naively) the number of constHigh state-control sequences ...\"\n>      constHigh_n <- pure (length (toList constHigh_mxysv))\n>      putStrLn \"number of constHigh state-control sequences:\"\n>      putStrLn (\"  \" ++ show constHigh_n)\n>                  \n>      putStrLn \"computing (naively) the most probable constHigh state-control sequence ...\"\n>      constHigh_xysv <- pure (naiveMostProbableProb constHigh_mxysv)\n>      putStrLn \"most probable constHigh state-control sequence and its probability:\"\n>      putStrLn (\"  \" ++ show constHigh_xysv)            \n>                  \n>      putStrLn \"sorting (naively) the constHigh state-control sequence ...\"\n>      constHigh_xysvs <- pure (naiveSortToList constHigh_mxysv)\n>      putStrLn \"most probable constHigh state-control sequences (first 3) and their probabilities:\"\n>      putStrLn (showlong (take 3 constHigh_xysvs))\n>                      \n>      putStrLn \"measure of constHigh rewards:\"\n>      putStrLn (\"  \" ++ show (meas (SequentialDecisionProblems.CoreTheory.fmap snd constHigh_mxysv)))            \n>\n>      putStrLn \"computing constLow policies ...\"\n>      constLow_ps <- pure (constLow Z nSteps)\n>\n>      putStrLn \"computing constLow state-control sequences ...\"\n>      constLow_mxys <- pure (adHocPossibleStateCtrlSeqs constLow_ps (FZ, High, Unavailable, Good))\n>      putStrLn \"pairing constLow state-control sequences with their values ...\"\n>      constLow_mxysv <- pure (possibleStateCtrlSeqsRewards' constLow_mxys)\n>      \n>      putStrLn \"computing (naively) the number of constLow state-control sequences ...\"\n>      constLow_n <- pure (length (toList constLow_mxysv))\n>      putStrLn \"number of constLow state-control sequences:\"\n>      putStrLn (\"  \" ++ show constLow_n)\n>                  \n>      putStrLn \"computing (naively) the most probable constLow state-control sequence ...\"\n>      constLow_xysv <- pure (naiveMostProbableProb constLow_mxysv)\n>      putStrLn \"most probable constLow state-control sequence and its probability:\"\n>      putStrLn (\"  \" ++ show constLow_xysv)            \n>                  \n>      putStrLn \"sorting (naively) the constLow state-control sequence ...\"\n>      constLow_xysvs <- pure (naiveSortToList constLow_mxysv)\n>      putStrLn \"most probable constLow state-control sequences (first 3) and their probabilities:\"\n>      putStrLn (showlong (take 3 constLow_xysvs))\n>                      \n>      putStrLn \"measure of constLow rewards:\"\n>      putStrLn (\"  \" ++ show (meas (SequentialDecisionProblems.CoreTheory.fmap snd constLow_mxysv)))            \n>                  \n>      putStrLn \"computing optimal policies ...\"\n>      ps <- pure (tabTailRecursiveBackwardsInduction Z nSteps)\n>            \n>      putStrLn \"computing possible state-control sequences ...\"\n>      mxys <- pure (adHocPossibleStateCtrlSeqs ps (FZ, High, Unavailable, Good))\n>      putStrLn \"pairing possible state-control sequences with their values ...\"\n>      mxysv <- pure (possibleStateCtrlSeqsRewards' mxys)\n>      -- putStrLn \"possible state-control sequences and their values:\"\n>      -- putStrLn (showlong mxysv)  \n>      \n>      putStrLn \"computing (naively) the number of possible state-control sequences ...\"\n>      n <- pure (length (toList mxysv))\n>      putStrLn \"number of possible state-control sequences:\"\n>      putStrLn (\"  \" ++ show n)\n>      \n>      putStrLn \"computing (naively) the most probable state-control sequence ...\"\n>      xysv <- pure (naiveMostProbableProb mxysv)\n>      putStrLn \"most probable state-control sequence and its probability:\"\n>      putStrLn (\"  \" ++ show xysv)\n>                      \n>      putStrLn \"sorting (naively) the possible state-control sequence ...\"\n>      xysvs <- pure (naiveSortToList mxysv)\n>      putStrLn \"most probable state-control sequences (first 3) and their probabilities:\"\n>      putStrLn (showlong (take 3 xysvs))\n>                      \n>      putStrLn \"measure of possible rewards:\"\n>      putStrLn (\"  \" ++ show (meas (SequentialDecisionProblems.CoreTheory.fmap snd mxysv)))\n   \n>      putStrLn \"done!\"\n\n\n> main : IO ()\n> main = run computation\n\n> ---}\n\n\n-- Local Variables:\n-- idris-packages: (\"effects\")\n-- End:\n", "meta": {"hexsha": "fe8160580d90fe8545b5837f430fcbb75fe88e98", "size": 17321, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "SequentialDecisionProblems/applications/TicTacToe.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/applications/TicTacToe.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "SequentialDecisionProblems/applications/TicTacToe.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 41.1425178147, "max_line_length": 121, "alphanum_fraction": 0.6753651637, "num_tokens": 4683, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8244619177503206, "lm_q2_score": 0.6297746074044134, "lm_q1q2_score": 0.5192251805710979}}
{"text": "||| Drawing a Sierpinski triangle\n||| Ported from https://www.linuxjournal.com/content/getting-started-ncurses\n\nmodule Sierpinski\n\nimport Data.Fin\nimport Data.Nat\nimport Data.Vect\nimport Data.String\nimport NCurses\nimport System.Random\n\n%default total\n\nmain : IO ()\nmain = runNCurses $ NCurses.do\n  -- Initialise curses\n  cBreak\n  noEcho\n  clear\n  setCursorVisibility CInvisible\n\n  -- Initialise triangle\n  size <- getSize\n  let maxlines = pred size.height\n  let maxcols = pred size.width\n\n  let p0 = MkPosition { row = 0, col = 0 }\n  let p1 = MkPosition { row = maxlines, col = half maxcols }\n  let p2 = MkPosition { row = 0, col = maxcols }\n  let ps : Vect 3 ? = [p0,p1,p2]\n  for_ @{NCURSES} Fin.range $ \\ k => do\n    let char = assert_total (show k `strIndex` 0)\n    mvAddCh (index k ps) char\n\n  -- Initialise position with random values\n  let p = MkPosition { row = !(lift $ randNat maxlines)\n                     , col = !(lift $ randNat maxcols) }\n  -- Iterate the triangle\n  loop ps 200000 p\n  -- Done\n  mvPrint (MkRow maxlines) \"Press any key to quit\"\n  refresh\n  ignore $ getCh\n\n  where\n\n    half : Nat -> Nat\n    half n = (n `divNatNZ` 2) %search\n\n    -- The bound better be smaller than MAX_INT32\n    randNat : Nat -> IO Nat\n    randNat bnd = do let i : Int32 = !randomIO\n                     pure $ cast (abs i `mod` cast bnd)\n\n    randIndex : (n : Nat) -> {auto 0 _ : NonZero n} -> IO (Fin n)\n    randIndex (S n) = do k <- randNat (S n)\n                         pure (restrict n $ cast k)\n\n    loop : Vect 3 Position -> Nat -> Position ->\n           NCurses Config.init Config.init ()\n    loop ps Z     pi = pure ()\n    loop ps (S n) pi = do\n      k <- lift $ randIndex 3\n      let pk = index k ps\n      let pi' = { row $= \\ xi => half (xi + pk.row)\n                , col $= \\ yi => half (yi + pk.col)\n                } pi\n      mvAddCh pi' '*'\n      refresh\n      loop ps n pi'\n", "meta": {"hexsha": "301182f9dd5ce94c2a956d65d1b4d63976d6aade", "size": 1891, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "examples/Sierpinski.idr", "max_stars_repo_name": "gallais/ncurses-idris", "max_stars_repo_head_hexsha": "f74df1b331f33f5b52816537f378a41427cd1961", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-11-02T18:03:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-02T18:03:30.000Z", "max_issues_repo_path": "examples/Sierpinski.idr", "max_issues_repo_name": "gallais/ncurses-idris", "max_issues_repo_head_hexsha": "f74df1b331f33f5b52816537f378a41427cd1961", "max_issues_repo_licenses": ["MIT"], "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/Sierpinski.idr", "max_forks_repo_name": "gallais/ncurses-idris", "max_forks_repo_head_hexsha": "f74df1b331f33f5b52816537f378a41427cd1961", "max_forks_repo_licenses": ["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.2638888889, "max_line_length": 76, "alphanum_fraction": 0.5906927552, "num_tokens": 575, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8104789086703225, "lm_q2_score": 0.640635854839898, "lm_q1q2_score": 0.5192218484857197}}
{"text": "module Data.Fun\n\nimport public Data.Vect\n\n%default total\n\n||| Build an n-ary function type from a Vect of Types and a result type\npublic export\nFun : Vect n Type -> Type -> Type\nFun [] r = r\nFun (t::ts) r = t -> Fun ts r\n\npublic export\nchain : {ts : Vect n Type} -> Fun [r] r' -> Fun ts r -> Fun ts r'\nchain {ts = []} g r  = g r\nchain {ts = (_::_)} g f = \\ x => chain g (f x)\n\npublic export\n[Nary] {ts : Vect n Type} -> Functor (Fun ts) where\n  map = chain\n\n||| Returns the co-domain of a n-ary function.\npublic export\ntarget : {ts : Vect n Type} -> {r: Type} -> Fun ts r -> Type\ntarget {r} _ = r\n", "meta": {"hexsha": "998713c60bb3a84b71c02622908bb095da99f2b7", "size": 597, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/base/Data/Fun.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/base/Data/Fun.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/base/Data/Fun.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.9615384615, "max_line_length": 71, "alphanum_fraction": 0.608040201, "num_tokens": 199, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7606506526772884, "lm_q2_score": 0.6825737473266735, "lm_q1q2_score": 0.5192001664044168}}
{"text": "module Lexer\n\nimport Lightyear\nimport Lightyear.Char\nimport Lightyear.Strings\n\npublic export\ndata Lexeme\n  = Numeral Integer\n  | Plus\n  | Minus\n  | Times\n  | Divide\n  | LParen\n  | RParen\n  \n-- XXX: deriving Eq?\nexport\nimplementation Eq Lexeme where\n  (Numeral n1) == (Numeral n2) = n1 == n2\n  Plus == Plus = True\n  Minus == Minus = True\n  Times == Times = True\n  Divide == Divide = True\n  LParen == LParen = True\n  RParen == RParen = True\n  _ == _ = False\n  \n-- XXX: deriving Show?\nexport\nimplementation Show Lexeme where\n  show (Numeral n) = \"(Numeral \" ++ show n ++ \")\"\n  show Plus = \"Plus\"\n  show Minus = \"Minus\"\n  show Times = \"Times\"\n  show Divide = \"Divide\"\n  show LParen = \"LParen\"\n  show RParen = \"RParen\"\n\n-- XXX: Data.Fin finToInteger?\ngetInteger : List (Fin 10) -> Integer\ngetInteger = foldl (\\a => \\b => 10 * a + cast b) 0\n\nnumeral : Parser Lexeme\nnumeral = do\n  digits <- some digit\n  pure $ Numeral (getInteger digits)\n\ntok : Parser Lexeme\ntok = numeral\n  <|> ((char '+') *> pure Plus)\n  <|> ((char '-') *> pure Minus)\n  <|> ((char '*') *> pure Times)\n  <|> ((char '/') *> pure Divide)\n  <|> ((char '(') *> pure LParen)\n  <|> ((char ')') *> pure RParen)\n\nexport\nlexer : Parser (List Lexeme)\nlexer = spaces *> (many (tok <* spaces))\n", "meta": {"hexsha": "29a9fc8532eea5f35a398d76667cb4ac94a059ff", "size": 1246, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Lexer.idr", "max_stars_repo_name": "steshaw/idris-calc", "max_stars_repo_head_hexsha": "7bb1d7761e8f0d2764fb2bd8713a57bec06f5fba", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2017-03-17T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-24T09:02:16.000Z", "max_issues_repo_path": "src/Lexer.idr", "max_issues_repo_name": "steshaw/idris-calc", "max_issues_repo_head_hexsha": "7bb1d7761e8f0d2764fb2bd8713a57bec06f5fba", "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": "src/Lexer.idr", "max_forks_repo_name": "steshaw/idris-calc", "max_forks_repo_head_hexsha": "7bb1d7761e8f0d2764fb2bd8713a57bec06f5fba", "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": 20.4262295082, "max_line_length": 50, "alphanum_fraction": 0.6099518459, "num_tokens": 396, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7606506526772883, "lm_q2_score": 0.6825737408694988, "lm_q1q2_score": 0.5192001614927625}}
{"text": "import Data.Either\nimport Data.List\nimport Data.List1\nimport Data.Maybe\nimport Data.String\n\nimport System.File\n\ndata BingoNum = M Nat | U Nat\n\nShow BingoNum where\n  show (M k) = \"m \" ++ show k\n  show (U k) = \"u \" ++ show k\n\nCard : Type\nCard = List (List BingoNum)\n\nparseLines : (String -> Maybe a) -> String -> List a\nparseLines f s = catMaybes $ f <$> lines s\n\ngetNumbers : List String -> Maybe (List Nat, List String)\ngetNumbers [] = Nothing\ngetNumbers (x :: xs) = Just (catMaybes $ parsePositive <$> (forget $ split (== ',') x),  xs)\n\nparseCard : List String -> Card\nparseCard l = (\\s => U <$> (catMaybes $ parsePositive <$> (forget $ split (== ' ') s))) <$> l\n\nparseCards : List String -> List Card\nparseCards [] = []\nparseCards (_ :: xs) = parseCard (take 5 xs) :: parseCards (drop 5 xs)\n\nisMarked : BingoNum -> Bool\nisMarked (M _) = True\nisMarked (U _) = False\n\nwinRow : Card -> Bool\nwinRow [] = False\nwinRow (x :: xs) = all isMarked x || winRow xs\n\nwinColumn : Card -> Bool\nwinColumn c = any id $ foldl (\\a => \\bs => (\\(b1, b2) => b1 && b2) <$> zip a (isMarked <$> bs)) (replicate 5 True) c\n\nwins : Card -> Bool\nwins c = winRow c || winColumn c\n\ndrawNumber : Nat -> Card -> Card\ndrawNumber n [] = []\ndrawNumber n (x :: xs) = ((\\d => case d of\n                                      M m => M m\n                                      U u => if u == n\n                                                then M u\n                                                else U u) <$> x) :: drawNumber n xs\n\ndrawNumbers : List Nat -> List Card -> Maybe (Card, Nat)\ndrawNumbers [] cs = Nothing\ndrawNumbers (x :: xs) [] = Nothing\ndrawNumbers (x :: xs) (c :: []) = let nc = drawNumber x c in\n                                      if wins nc\n                                         then Just (nc, x)\n                                         else drawNumbers xs (nc :: [])\ndrawNumbers (x :: xs) cs = let ncs = drawNumber x <$> cs\n                               losing = filter (not . wins) ncs in\n                               drawNumbers xs losing\n\nscoreOf : Card -> Nat\nscoreOf [] = 0\nscoreOf (x :: xs) = (foldl (\\a => \\b => case b of\n                                             M n => a\n                                             U n => n + a) 0 x) + scoreOf xs\n\nrun : String -> IO ()\nrun s = do let lines = lines s\n           Just (ns, lines) <- pure $ getNumbers lines\n             | Nothing => putStrLn $ \"err\"\n           let cards = parseCards lines\n           Just (win, n) <- pure $ drawNumbers ns cards\n             | Nothing => putStrLn $ \"no win\"\n           let score = n * scoreOf win\n           putStrLn $ show $ score\n\nmain : IO ()\nmain = do Right s <- readFile \"input.txt\"\n            | Left err => putStrLn $ show err\n          run s\n\n", "meta": {"hexsha": "91adf6a65dabda64d8a5e34125374884b27ab18c", "size": 2740, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "04/main+.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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/main+.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "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/main+.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.8604651163, "max_line_length": 116, "alphanum_fraction": 0.4937956204, "num_tokens": 724, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438950868503681, "lm_q2_score": 0.6150878555160665, "lm_q1q2_score": 0.5190696192513375}}
{"text": "module Data.MergeList\n\nimport Decidable.Order\nimport Data.OrderedVect\n\n%default total\n\nexport\ndata MergeList : (rank : Nat) -> (cnt : Nat) -> (constraint : Ordered ty to) -> Type where\n  Nil : MergeList _ Z _\n  Skip : (next : MergeList (n + n) cnt constraint)\n      -> MergeList n cnt constraint\n  (::) : OrderedVect n constraint\n      -> .{cnt : Nat}\n      -> (next : MergeList (n + n) cnt constraint)\n      -> MergeList n (n + cnt) constraint\n\n%name MergeList xs,ys,zs\n\ninsertVect : {constraint : Ordered ty to}\n          -> {n : Nat}\n          -> {cnt : Nat}\n          -> MergeList n cnt constraint\n          -> OrderedVect n constraint\n          -> MergeList n (cnt + n) constraint\ninsertVect {n} {constraint} {cnt=Z} Nil v\n  = rewrite rewriteType in v :: Nil\n      where rewriteType : MergeList n n constraint = MergeList n (n + 0) constraint\n            rewriteType = rewrite sym $ plusZeroRightNeutral n in Refl\ninsertVect {n} {cnt} (Skip next) v = rewrite plusCommutative cnt n in\n                                     v :: next\ninsertVect {n} ((::) v next {cnt}) v'\n  = rewrite sym $ plusCommutative cnt n in\n    rewrite sym $ plusAssociative cnt n n in\n    Skip $ insertVect next (merge n v n v')\n\nexport\nempty : .{auto constraint : Ordered ty to} -> MergeList 1 0 constraint\nempty = []\n\nexport\ninsert : .{constraint : Ordered ty to}\n      -> {cnt : Nat}\n      -> MergeList 1 cnt constraint\n      -> ty\n      -> MergeList 1 (cnt + 1) constraint\ninsert l x = insertVect l [x]\n\nexport\nmergeListToOrderedVect : .{constraint : Ordered ty _}\n                      -> (n : Nat)\n                      -> (cnt : Nat)\n                      -> MergeList n cnt constraint\n                      -> OrderedVect cnt constraint\nmergeListToOrderedVect _ _ Nil = []\nmergeListToOrderedVect n cnt (Skip next) = mergeListToOrderedVect (n + n) cnt next\nmergeListToOrderedVect n (n + nextCnt) (v :: next)\n  = merge n v nextCnt $ mergeListToOrderedVect (n + n) nextCnt next\n\nnamespace CountedMergeList\n  public export\n  CountedMergeList : (n : Nat) -> (constraint: Ordered to rel) -> Type\n  CountedMergeList n constraint = (cnt : Nat ** Lazy $ MergeList n cnt constraint)\n\n  export\n  empty : CountedMergeList 1 constraint\n  empty = (Z ** empty)\n\n  export\n  insert : .{constraint : Ordered ty to} -> CountedMergeList 1 constraint -> ty -> CountedMergeList 1 constraint\n  insert (cnt ** xs) x = (cnt + 1 ** insert xs x)", "meta": {"hexsha": "f122e097dd8e7a90e9809a28b1ec2ec7ee4ad55a", "size": 2403, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/MergeList.idr", "max_stars_repo_name": "jdevuyst/idris-data", "max_stars_repo_head_hexsha": "dab40425d208a09a9cf2ce4dadcf73b053522c1a", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2017-08-02T11:18:49.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-07T12:32:38.000Z", "max_issues_repo_path": "src/Data/MergeList.idr", "max_issues_repo_name": "jdevuyst/idris-data", "max_issues_repo_head_hexsha": "dab40425d208a09a9cf2ce4dadcf73b053522c1a", "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/Data/MergeList.idr", "max_forks_repo_name": "jdevuyst/idris-data", "max_forks_repo_head_hexsha": "dab40425d208a09a9cf2ce4dadcf73b053522c1a", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2020-11-16T09:13:41.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-16T20:00:26.000Z", "avg_line_length": 33.8450704225, "max_line_length": 112, "alphanum_fraction": 0.6229712859, "num_tokens": 658, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8056321796478255, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5190084767224665}}
{"text": "module Data.Verified.Zifunctor\n\nimport Data.Zifunctor\n\n%default total\n%access public export\n\n||| Verified Zifunctor\n||| A Zifunctor for which identity and composition laws are verified\ninterface Zifunctor t => VerifiedZifunctor (t : Type -> Type -> Type -> Type) where\n  zifunctorIdentity : {a : Type} -> {b : Type} -> {c : Type} ->\n                     (x : t a b c) ->\n                     zimap Basics.id Basics.id Basics.id x = x\n  zifunctorComposition : {a : Type} -> {b : Type} -> {c : Type} ->\n                         {a1 : Type} -> {b1 : Type} -> {c1 : Type} ->\n                         (x : t a b c) ->\n                         (fa1 : a1 -> a) -> (fb1 : b -> b1) -> (fc1 : c -> c1) ->\n                         (fa2 : a2 -> a1) -> (fb2 : b1 -> b2) -> (fc2 : c1 -> c2) ->\n                         (zimap (fa1 . fa2) (fb2 . fb1) (fc2 . fc1) x) =\n                         (zimap fa2 fb2 fc2 . zimap fa1 fb1 fc1) x\n", "meta": {"hexsha": "9fd8ac767990395acaaf4d03c6e410d4b8b0299b", "size": 920, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Verified/Zifunctor.idr", "max_stars_repo_name": "lemastero/Idris-Trifunctors", "max_stars_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "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/Data/Verified/Zifunctor.idr", "max_issues_repo_name": "lemastero/Idris-Trifunctors", "max_issues_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-10-13T21:31:36.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-13T21:31:36.000Z", "max_forks_repo_path": "src/Data/Verified/Zifunctor.idr", "max_forks_repo_name": "lemastero/Idris-Trifunctors", "max_forks_repo_head_hexsha": "cb3ccef744904c2aaffcbaf2e27e11fa2195eec6", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-19T04:35:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-19T04:35:47.000Z", "avg_line_length": 43.8095238095, "max_line_length": 84, "alphanum_fraction": 0.4608695652, "num_tokens": 294, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8006920116079209, "lm_q2_score": 0.6477982247516796, "lm_q1q2_score": 0.5186868636924624}}
{"text": "\n-- 7.3 Exercises\n\ndata Vect : Nat -> Type -> Type where\n     Nil  : Vect Z a\n     (::) : (x : a) -> (xs : Vect k a) -> Vect (S k) a\n%name Vect xs, ys, zs\n\nEq a => Eq (Vect n a) where\n     (==) [] [] = True\n     (==) (x :: xs) (y :: ys) = x == y && xs == ys\n     (==) _ _ = False\n\nFoldable (Vect n) where\n     foldr func init [] = init\n     foldr func init (x :: xs) = let acc = func x init in foldr func acc xs\n\nFunctor (Vect n) where\n     map func [] = []\n     map func (x :: xs) = func x :: map func xs\n", "meta": {"hexsha": "7b056cb995392a63d392c5aea076e7a872ef8704", "size": 506, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/ch7/Vect.idr", "max_stars_repo_name": "trevarj/tdd_idris_examples", "max_stars_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "max_stars_repo_licenses": ["Unlicense"], "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/ch7/Vect.idr", "max_issues_repo_name": "trevarj/tdd_idris_examples", "max_issues_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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/ch7/Vect.idr", "max_forks_repo_name": "trevarj/tdd_idris_examples", "max_forks_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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": 24.0952380952, "max_line_length": 75, "alphanum_fraction": 0.4822134387, "num_tokens": 183, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8175744761936438, "lm_q2_score": 0.63341027751814, "lm_q1q2_score": 0.5178600758575639}}
{"text": "module Typing.Term \n\nimport public Syntax.Term \nimport public Loc\n\nmutual \n\n  public export \n  record TyProgram where \n    constructor MkProgram \n    fileName  : String \n    typedDefs : List TyDef\n    dataDefs  : List DataDef    \n    recordDef : List RecordDef \n\n  public export\n  record TyDef where \n    constructor TyDefine \n    name : Name \n    type : Ty\n    value : TyExpr\n\n  record TyPath where \n    constructor MkTypedPath\n    path : Path \n    type : Ty\n\n  public export\n  data TyExpr \n    = TELambda   Range Ty Name TyExpr\n    | TECall     Range Ty TyExpr TyExpr\n    | TEDo       Range Ty (List TyExpr)\n    | TECase     Range Ty TyExpr (List (TyPat, TyExpr))\n    | TEId       Path  Ty \n    | TELit      Range Ty Literal\n    \n  public export\n  data TyPat \n    = TPaId      Name  Ty\n    | TPaList    Range Ty (List TyPat)\n    | TPaHdTl    Range Ty TyPat TyPat\n    | TPaData    Range Ty TyPath (List TyPat)\n    | TPaLit     Range Ty Literal\n\n  public export\n  data Ty\n    = TyPoly     Range Path Ty\n    | TySimple   Range String\n    | TyArrow    Range Ty Ty\n    | TyVar      Range String \n\n  public export\n  data Schema = MkSchema (List String) Ty\n\n  Show TyPath where \n    show (MkTypedPath p _) = show p\n\n  public export \n  Show Ty where \n    show (TyPoly r path ty) = (show path) ++ \" \" ++ show ty \n    show (TySimple r name) = name\n    show (TyVar r name) = name\n    show (TyArrow r a b) = show a ++ \" -> \" ++ show b ", "meta": {"hexsha": "71fc3b7241ee4b235f7806dc8ae3b133682613f3", "size": 1425, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Typing/Term.idr", "max_stars_repo_name": "felipegchi/Yurei", "max_stars_repo_head_hexsha": "de824ff5e1ca1cb68570caf500fdd41fa0a93e43", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-12-14T19:37:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-14T19:37:13.000Z", "max_issues_repo_path": "src/Typing/Term.idr", "max_issues_repo_name": "felipegchi/Yurei", "max_issues_repo_head_hexsha": "de824ff5e1ca1cb68570caf500fdd41fa0a93e43", "max_issues_repo_licenses": ["MIT"], "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/Typing/Term.idr", "max_forks_repo_name": "felipegchi/Yurei", "max_forks_repo_head_hexsha": "de824ff5e1ca1cb68570caf500fdd41fa0a93e43", "max_forks_repo_licenses": ["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.619047619, "max_line_length": 60, "alphanum_fraction": 0.6140350877, "num_tokens": 419, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8175744850834648, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.5178600701729918}}
{"text": "%default total\n\ndata Wrap : Type -> Type where\n  MkWrap : a -> Wrap a\n\nunwrap : Wrap a -> a\nunwrap (MkWrap v) = v\n\ndata F : Type where\n  MkF : Wrap (Not F) -> F\n\nyesF : Not F -> F\nyesF = MkF . MkWrap\n\nnotF : Not F\nnotF (MkF f) = unwrap f (yesF $ unwrap f)\n\nargh : Void\nargh = notF (yesF notF)\n", "meta": {"hexsha": "a6000ba765210f7b34199bb179afeca4942f4838", "size": 293, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/positivity004/Issue1771-3.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "tests/idris2/positivity004/Issue1771-3.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "tests/idris2/positivity004/Issue1771-3.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 14.65, "max_line_length": 41, "alphanum_fraction": 0.6040955631, "num_tokens": 113, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8175744850834648, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.5178600701729918}}
{"text": "module Control.Optics.Setter\n\nimport public Control.Optics.Types\n\nexport\nsets : ((a -> b) -> s -> t) -> Setter s t a b\nsets l (Mor f) = Mor $ Id . l (runIdentity . f)\n\nexport\nmapped : Functor f => Setter (f a) (f b) a b\nmapped = sets map\n\nexport\nover : Setter s t a b -> (a -> b) -> s -> t\nover optic f = runIdentity . applyMor (optic (Mor (Id . f)))\n\nexport\nset : Setter s t a b -> b -> s -> t\nset optic b = over optic (const b)\n\ninfixr 4 .~\nexport\n(.~) : Setter s t a b -> b -> s -> t\n(.~) = set\n\ninfixr 4 %~\nexport\n(%~) : Setter s t a b -> (a -> b) -> s -> t\n(%~) = over\n", "meta": {"hexsha": "2ad90de9fa95c7f0dc5a98e287561535e18ad5e5", "size": 574, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Control/Optics/Setter.idr", "max_stars_repo_name": "tensorknower69/idris2-optics", "max_stars_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "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/Control/Optics/Setter.idr", "max_issues_repo_name": "tensorknower69/idris2-optics", "max_issues_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_issues_repo_licenses": ["MIT"], "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/Control/Optics/Setter.idr", "max_forks_repo_name": "tensorknower69/idris2-optics", "max_forks_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_forks_repo_licenses": ["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.1333333333, "max_line_length": 60, "alphanum_fraction": 0.5592334495, "num_tokens": 208, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7662936430859598, "lm_q2_score": 0.6757646075489392, "lm_q1q2_score": 0.5178341229872305}}
{"text": "%default total\n\ndata F : Type where\n  MkFix : ((0 g : Type -> Type) -> g === Not -> g F) -> F\n\nyesF : Not F -> F\nyesF nf = MkFix (\\ g, Refl => nf)\n\nnotF : Not F\nnotF (MkFix f) =\n  let g = f Not Refl in\n  g (yesF g)\n\nargh : Void\nargh = notF (yesF notF)\n", "meta": {"hexsha": "52a3c0fc7d40a1459e99bf239a9ef03e123fb1fa", "size": 252, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/positivity004/Issue1771-2.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "tests/idris2/positivity004/Issue1771-2.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "tests/idris2/positivity004/Issue1771-2.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 15.75, "max_line_length": 57, "alphanum_fraction": 0.5436507937, "num_tokens": 103, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8221891479496523, "lm_q2_score": 0.6297746074044134, "lm_q1q2_score": 0.5177938478621614}}
{"text": "module Vektoren\n\nimport Data.Vect\n\ndata Vektor : (n:Nat) -> (a:Type) -> Type where\n  Nil : Vektor 0 a\n  (::) : a -> Vektor n a -> Vektor (S n) a\n\n\nconcat : Vektor n a -> Vektor m a -> Vektor (n+m) a\nconcat [] ys = ys\nconcat (x :: xs) ys = x :: concat xs ys\n\n\nfourInts : Vect 4 Int\nfourInts = [0, 1, 2, 3]\n\nsixInts : Vect 6 Int\nsixInts = [4, 5, 6, 7, 8, 9]\n\ntenInts : Vect 10 Int\ntenInts = fourInts ++ sixInts\n", "meta": {"hexsha": "93bb2a0963976a2ea8dc5f96211a1709f55a053c", "size": 409, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Beispiele/Vektoren.idr", "max_stars_repo_name": "CarstenKoenig/DOS2016_IdrisWorkshop", "max_stars_repo_head_hexsha": "f329b584e5ae434f0c52564bf75710070cc247da", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2016-10-14T07:30:59.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-15T09:50:24.000Z", "max_issues_repo_path": "Beispiele/Vektoren.idr", "max_issues_repo_name": "CarstenKoenig/DOS2016_IdrisWorkshop", "max_issues_repo_head_hexsha": "f329b584e5ae434f0c52564bf75710070cc247da", "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": "Beispiele/Vektoren.idr", "max_forks_repo_name": "CarstenKoenig/DOS2016_IdrisWorkshop", "max_forks_repo_head_hexsha": "f329b584e5ae434f0c52564bf75710070cc247da", "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": 17.7826086957, "max_line_length": 51, "alphanum_fraction": 0.5916870416, "num_tokens": 181, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8311430311279742, "lm_q2_score": 0.6224593312018545, "lm_q1q2_score": 0.5173527352890009}}
{"text": "||| A heterogeneous list. This was introduced in\n||| chapter *Functor and Friends* and is also used in\n||| later chapters\nmodule Data.HList\n\nimport Data.Fin\n\n%default total\n\npublic export\ndata HList : (ts : List Type) -> Type where\n  Nil  : HList Nil\n  (::) : (v : t) -> (vs : HList ts) -> HList (t :: ts)\n\npublic export\nhead : HList (t :: ts) -> t\nhead (v :: _) = v\n\npublic export\ntail : HList (t :: ts) -> HList ts\ntail (_ :: t) = t\n\npublic export\n(++) : HList xs -> HList ys -> HList (xs ++ ys)\n[]        ++ ws = ws\n(v :: vs) ++ ws = v :: (vs ++ ws)\n\npublic export\nindexList : (as : List a) -> Fin (length as) -> a\nindexList (x :: _)   FZ    = x\nindexList (_ :: xs) (FS y) = indexList xs y\nindexList []        x impossible\n\npublic export\nindex : (ix : Fin (length ts)) -> HList ts -> indexList ts ix\nindex FZ     (v :: _)  = v\nindex (FS x) (_ :: vs) = index x vs\nindex ix [] impossible\n", "meta": {"hexsha": "fd4e4f2ae35d2449a8c01c34557ab38071e41d2e", "size": 889, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/HList.idr", "max_stars_repo_name": "ska80/idris2-tutorial", "max_stars_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 60, "max_stars_repo_stars_event_min_datetime": "2022-01-13T16:14:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T16:16:57.000Z", "max_issues_repo_path": "src/Data/HList.idr", "max_issues_repo_name": "ska80/idris2-tutorial", "max_issues_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 11, "max_issues_repo_issues_event_min_datetime": "2022-01-14T15:42:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T09:53:16.000Z", "max_forks_repo_path": "src/Data/HList.idr", "max_forks_repo_name": "ska80/idris2-tutorial", "max_forks_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2022-01-14T15:48:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T06:49:13.000Z", "avg_line_length": 22.7948717949, "max_line_length": 61, "alphanum_fraction": 0.5793025872, "num_tokens": 296, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998611746911, "lm_q2_score": 0.665410558746814, "lm_q1q2_score": 0.5172235349380722}}
{"text": "module Main\nimport Data.Vect as V\nimport Prelude.List as L\nimport Prelude.Basics as B\nimport Data.String as S\nimport Utils as U\n\n%default total\n\ndata Player = X | O\n\nother : Player -> Player\nother X = O\nother O = X\n\nShow Player where\n\tshow X = \"X\"\n\tshow O = \"O\"\n\nEq Player where\n\tX == X = True\n\tO == O = True\n\t_ == _ = False\t\n\nrecord Board where \n\tconstructor MkBoard\n\tcolumns : Matrix 7 7 $ Maybe Player\n\nrows : Board -> Matrix 7 7 $ Maybe Player\nrows = transpose . columns\n\nShow Board where\n    show = unlines . map (concat . map (maybe \".\" show)) . L.toList . rows\n\ndiagonals1 : Board -> List $ List $ Maybe Player\ndiagonals1 board = map catMaybes \n                 $ transpose \n                 $ zipWith (++) (take 7 $ iterate (Nothing::) []) (map (map Just) $ U.toList $ columns board)\n\ndiagonals2 : Board -> List $ List $ Maybe Player\ndiagonals2 = diagonals1 . MkBoard . transpose . columns\n\ndraw : Board -> Bool\ndraw = all (all isJust) . rows\n\t\nwinner : Board -> Maybe Player \nwinner board = head'\n             $ catMaybes \n\t         $ mapMaybe head' -- Is there a better way to handle the impossible case [] with a proof?\n\t\t\t $ L.filter (\\x => L.length x >= 4)\n\t\t\t $ concatMap {t = List} {a = List $ Maybe Player} group\n\t\t\t $ concatMap (\\ f => f board) {t = List} {a = Board -> List $ List $ Maybe Player}\n\t\t\t $ [U.toList . rows, U.toList . columns, diagonals1, diagonals2]\n\nlegalMove : (n : Nat) -> Board -> Maybe $ LTE n 6\nlegalMove n board with (natToFin' n 7)\n\t| Nothing = Nothing\n\t| Just (f, p) = map (\\ _ => fromLteSucc p) (V.index f $ V.head $ rows board)\n\t\ndropColumn : Player -> Vect 7 $ Maybe Player -> Vect 7 $ Maybe Player\ndropColumn player column = \n\tlet tmp = V.catMaybes $ (Just player) :: (tail column) in \n\tlet n = fst tmp in\n\tlet xs = snd tmp in\n\tlet p1 = catMaybesLTE {xs = (Just player) :: (tail column)} in\n\tlet p2 : ((minus 7 n) + n = 7) = rewrite plusCommutative (minus 7 n) n in plusMinusNeutral p1 in\n\trewrite sym p2 in\n\t(replicate (minus 7 n) Nothing) ++ (map Just xs)\n\nmove : Player -> Nat -> Board -> Maybe Board\nmove player n board with (legalMove n board)\n    | Nothing = Nothing\n    | Just p = Just board' where \n    \ttmp : (Vect n $ Vect 7 $ Maybe Player, Vect 7 $ Maybe Player, Vect (minus 6 n) $ Vect 7 $ Maybe Player)\n    \ttmp = splitAt' n $ rewrite plusMinusNeutral p in columns board\n\n    \tboard' = let (left, column, right) = tmp in \n    \t\tMkBoard $ \n    \t\treplace {P = \\n => Matrix n 7 $ Maybe Player} (plusMinusNeutral $ lteSuccRight p) $ \n\t\t\trewrite sym $ succMinus p in \n\t        left ++ [dropColumn player column] ++ right\n\nrecord Game where\n\tconstructor MkGame\n\tplayer : Player\n\tboard : Board\n\npartial gameloop : Game -> IO ()\ngameloop game@(MkGame player board) = do\n    putStr $ show player ++ \"s turn: \"\n    line <- getLine\n    case (parsePositive line) >>= (\\n => move player n board) of\n        Nothing => (print board) >>= (\\_ => gameloop game)\n        Just board' => do\n            print board'\n            if draw board\n                then putStrLn \"Draw!\"\n                else case winner board' of\n                    Just player => putStrLn $ show player ++ \" Won!\"\n                    Nothing => gameloop $ MkGame (other player) board'\n\npartial main : IO ()\nmain = do\n    let board = MkBoard (replicate 7 $ replicate 7 Nothing)\n    print board\n    gameloop $ MkGame X board", "meta": {"hexsha": "53b910e493dc4ab355a35504bca44223783c83ae", "size": 3339, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/main.idr", "max_stars_repo_name": "Gwin73/idris-four-in-a-row", "max_stars_repo_head_hexsha": "30d1f8c3fbf71c77385ba2e2edb23ef2ea7c86f5", "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/main.idr", "max_issues_repo_name": "Gwin73/idris-four-in-a-row", "max_issues_repo_head_hexsha": "30d1f8c3fbf71c77385ba2e2edb23ef2ea7c86f5", "max_issues_repo_licenses": ["MIT"], "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.idr", "max_forks_repo_name": "Gwin73/idris-four-in-a-row", "max_forks_repo_head_hexsha": "30d1f8c3fbf71c77385ba2e2edb23ef2ea7c86f5", "max_forks_repo_licenses": ["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.6175501647, "num_tokens": 956, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.86153820232079, "lm_q2_score": 0.600188359260205, "lm_q1q2_score": 0.5170852000909015}}
{"text": "||| Provie `Day` level function.\nmodule Data.Time.Calendar.Days\n\n||| The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.\npublic export\ndata Day = MkModifiedJulianDay Integer\n\nexport\nEq Day where\n  (MkModifiedJulianDay a) == (MkModifiedJulianDay b) = a == b\n\nexport\nOrd Day where\n  compare (MkModifiedJulianDay a) (MkModifiedJulianDay b) = compare a b\n\nexport\ntoInteger : Day -> Integer\ntoInteger (MkModifiedJulianDay x) = x\n\nexport\nEnum Day where\n  pred (MkModifiedJulianDay x) = MkModifiedJulianDay (pred x)\n  toNat (MkModifiedJulianDay x) = toNat x\n  fromNat x = MkModifiedJulianDay (fromNat x)\n\nexport\nrange: (Day, Day) -> List Day\nrange (MkModifiedJulianDay x, MkModifiedJulianDay y) = map (MkModifiedJulianDay) [x .. y]\n\nexport\nindex: (Day, Day) -> Nat -> Maybe Day\nindex (a, b) k =\n  let (MkModifiedJulianDay a1) = a\n      (MkModifiedJulianDay b1) = b\n      range_a_b = range (a, b)\n      inbounds = inBounds k range_a_b\n  in\n    case inbounds of\n         Yes prf => Just (List.index k range_a_b)\n         No  contra => Nothing\n\nexport\ninRange: (Day, Day) -> Day -> Bool\ninRange (a, b) k = elem k (range (a, b))\n\nexport\nrangeSize: (Day, Day) -> Nat\nrangeSize x = List.length (range x)\n\nexport\naddDays: Integer -> Day -> Day\naddDays x (MkModifiedJulianDay y) = MkModifiedJulianDay (x + y)\n\nexport\ndiffDays: Day -> Day -> Integer\ndiffDays (MkModifiedJulianDay x) (MkModifiedJulianDay y) = x - y\n", "meta": {"hexsha": "f683adba6cf600b295cd6873945bea45b0821b9e", "size": 1436, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Time/Calendar/Days.idr", "max_stars_repo_name": "gdevanla/idris-time", "max_stars_repo_head_hexsha": "96a488057863d6c3049f62a1ac70734090e50b66", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-08-18T11:02:58.000Z", "max_stars_repo_stars_event_max_datetime": "2020-08-18T11:02:58.000Z", "max_issues_repo_path": "src/Data/Time/Calendar/Days.idr", "max_issues_repo_name": "gdevanla/idris-time", "max_issues_repo_head_hexsha": "96a488057863d6c3049f62a1ac70734090e50b66", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2020-07-28T21:13:55.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-20T19:56:41.000Z", "max_forks_repo_path": "src/Data/Time/Calendar/Days.idr", "max_forks_repo_name": "gdevanla/idris-time", "max_forks_repo_head_hexsha": "96a488057863d6c3049f62a1ac70734090e50b66", "max_forks_repo_licenses": ["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.1929824561, "max_line_length": 92, "alphanum_fraction": 0.7019498607, "num_tokens": 475, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7690802370707283, "lm_q2_score": 0.6723316926137811, "lm_q1q2_score": 0.5170770175455708}}
{"text": "module Brainfeck.Type\n\nimport Data.Vect\n\n%default total\n\npublic export\nLabel : Nat -> Type\nLabel = Fin\n\npublic export\ndata Token     : Type  where\n  TLeft        : Token -- <\n  TRight       : Token -- >\n  TInc         : Token -- +\n  TDec         : Token -- -\n  TOut         : Token -- .\n  TIn          : Token -- ,\n  TJumpForward : Token -- [\n  TJumpBack    : Token -- ]\n\npublic export\ndata Operation : Nat -> Type where\n  OLeft        : Operation n -- <\n  ORight       : Operation n -- >\n  OInc         : Operation n -- +\n  ODec         : Operation n -- -\n  OOut         : Operation n -- .\n  OIn          : Operation n -- ,\n  OJumpZero    : Label f -> Operation f-- [\n  OJumpNZero   : Label b -> Operation b -- ]\n\nexport\ntokenToS : Token -> String\ntokenToS TLeft = \"<\"\ntokenToS TRight = \">\"\ntokenToS TInc = \"+\"\ntokenToS TDec = \"-\"\ntokenToS TOut = \".\"\ntokenToS TIn = \",\"\ntokenToS TJumpForward = \"[\"\ntokenToS TJumpBack = \"]\"\n\nexport\noperationToS : Operation f -> String\noperationToS OLeft          = \"<\"\noperationToS ORight         = \">\"\noperationToS OInc           = \"+\"\noperationToS ODec           = \"-\"\noperationToS OOut           = \".\"\noperationToS OIn            = \",\"\noperationToS (OJumpZero  l) = \"[ \" ++ show (finToNat l)\noperationToS (OJumpNZero l) = show (finToNat l) ++ \" ]\"\n\npublic export\ndata Location : Type where\n  Loc : (line : Nat) -> (col : Nat) -> Location\n\nexport\nlocToS : Location -> String\nlocToS (Loc l c) = \"Line: \" ++ show l ++ \" Column: \" ++ show c\n\npublic export\nTokens   : Nat -> Type\nTokens n = Vect n (Location, Token)\n%name Tokens tokens\n\n-- TODO: Use a better datatype for this (Brainfeck.Instructions.Instructions?)\n-- This hasn't been profiled, but it seems trivially true that doing \"random\" access indexing\n-- with ineffecient Fin's is going to cause speed problems\n-- Probably wait until its actually an issue first though\npublic export\nInstructions   : Nat -> Type\nInstructions n = Vect n (Operation n)\n%name Instructions instructions\n", "meta": {"hexsha": "e0b1662bb2581f25458b2206d7e0f2375fa69e28", "size": 1972, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "lib/Brainfeck/Type.idr", "max_stars_repo_name": "jhmcstanton/brainfeck", "max_stars_repo_head_hexsha": "96e5224661d794195aafb78c6a47eb5b8256ab55", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-04-26T08:48:48.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-26T08:48:48.000Z", "max_issues_repo_path": "lib/Brainfeck/Type.idr", "max_issues_repo_name": "jhmcstanton/brainfeck", "max_issues_repo_head_hexsha": "96e5224661d794195aafb78c6a47eb5b8256ab55", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/Brainfeck/Type.idr", "max_forks_repo_name": "jhmcstanton/brainfeck", "max_forks_repo_head_hexsha": "96e5224661d794195aafb78c6a47eb5b8256ab55", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-04-26T08:48:50.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-26T08:48:50.000Z", "avg_line_length": 25.9473684211, "max_line_length": 93, "alphanum_fraction": 0.6090263692, "num_tokens": 551, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7981867873410141, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.517063978432429}}
{"text": "module Main\n\nmutual\n  evenT : Nat -> IO Bool\n  evenT Z = pure True\n  evenT (S k) = oddT k\n\n  oddT : Nat -> IO Bool\n  oddT Z = pure False\n  oddT (S k) = evenT k\n\nmain : IO ()\nmain = evenT 99999 >>= printLn\n", "meta": {"hexsha": "e45fcaf3020de7a1a67d1e07dc9980ec062a1ad5", "size": 205, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/tests/trampoline/trampoline.idr", "max_stars_repo_name": "mmhelloworld/idris-jvm-hs", "max_stars_repo_head_hexsha": "4f1856e731cac7bc3318c085002518d77a9dbb5b", "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/tests/trampoline/trampoline.idr", "max_issues_repo_name": "mmhelloworld/idris-jvm-hs", "max_issues_repo_head_hexsha": "4f1856e731cac7bc3318c085002518d77a9dbb5b", "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/tests/trampoline/trampoline.idr", "max_forks_repo_name": "mmhelloworld/idris-jvm-hs", "max_forks_repo_head_hexsha": "4f1856e731cac7bc3318c085002518d77a9dbb5b", "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.6428571429, "max_line_length": 30, "alphanum_fraction": 0.5951219512, "num_tokens": 79, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.835483553488848, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5169808756136824}}
{"text": "module congruences\n\n||| Congruence\npublic export\ncongruence : (ty1, ty2 : Type) -> (a : ty1) -> (b : ty1) -> (f : ty1 -> ty2) -> (a = b) -> ((f a) = (f b))\ncongruence ty1 ty2 a a f Refl = Refl\n", "meta": {"hexsha": "bbd2404e1f6d3f331d4f203c4f6af030e53d32d3", "size": 193, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "_local-site/Code/congruence.idr", "max_stars_repo_name": "anotherArka/LTS2019", "max_stars_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-01-16T18:03:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-13T16:28:41.000Z", "max_issues_repo_path": "_local-site/Code/congruence.idr", "max_issues_repo_name": "anotherArka/LTS2019", "max_issues_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 58, "max_issues_repo_issues_event_min_datetime": "2019-01-08T11:22:38.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-21T10:26:10.000Z", "max_forks_repo_path": "_local-site/Code/congruence.idr", "max_forks_repo_name": "anotherArka/LTS2019", "max_forks_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 22, "max_forks_repo_forks_event_min_datetime": "2019-01-08T05:56:23.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-31T03:58:00.000Z", "avg_line_length": 27.5714285714, "max_line_length": 106, "alphanum_fraction": 0.5544041451, "num_tokens": 85, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7799929002541068, "lm_q2_score": 0.6619228691808011, "lm_q1q2_score": 0.5162951384768528}}
{"text": "import Data.Vect\n\nnums : List (Int, Int)\nnums = [(1, 2), (3, 4), (5, 6)]\n\naddToNums : List (Int, Int) -> List (Int, Int)\naddToNums = map (\\ (x, y) => (x + 1, y + 1))\n\nvects : List (n ** Vect n Int)\nvects = [(_ ** [1,2,3]),\n         (_ ** [1,2,3,4]),\n         (_ ** [1,2,3,4,5])]\n\nlengths : List (n ** Vect n a) -> List Nat\nlengths = map (\\ (len ** xs) => length xs)\n", "meta": {"hexsha": "c3791d5987ea54be2bbc9c81f072ce725483bef4", "size": 366, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic024/PatLam.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/basic024/PatLam.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/basic024/PatLam.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 22.875, "max_line_length": 46, "alphanum_fraction": 0.4672131148, "num_tokens": 153, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7248702761768248, "lm_q2_score": 0.7122321781307375, "lm_q1q2_score": 0.5162759356636492}}
{"text": "data X = A Int\n\n(.la) : X -> Int\n(.la) (A x) = x\n\nf : X -> String\nf x = show x.la\n\n-- Projection does not define the usual function.\n-- `g` does not typecheck without the `la` definition.\n-- Moreover, they may have different implementations.\n\nla : X -> Int\nla $ A x = x + 1\n\ng : X -> String\ng x = show $ la x\n", "meta": {"hexsha": "88515409efc1a3d823299a4ad88457cd723a2413", "size": 309, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Proj.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "Proj.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "Proj.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 17.1666666667, "max_line_length": 54, "alphanum_fraction": 0.6051779935, "num_tokens": 101, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7879311956428946, "lm_q2_score": 0.6548947357776795, "lm_q1q2_score": 0.5160119921815446}}
{"text": "module Syntax\n\n%default total\n\nshowMaybe : {0 a : Type} -> (assumption : Show a) => Maybe a -> String\nshowMaybe x@ma = case map (id . id) ma of\n    Nothing => \"Nothing\"\n    Just a => \"Just \" ++ show a\n\nnats : List Nat\nnats =\n  let n = 5\n      m = 7\n      xs = [id $ id 0]\n      ys = [1, 2, m, n, 3] ++ xs\n  in [n,id $ id m] ++ [1, 2, m, n, 3] ++ xs\n\n\nrecord ANat where\n  constructor MkANat\n  aNat : Nat\n\ndoBlock : Maybe ANat\ndoBlock\n  = do let a = 3\n       let b = 5\n       (c, _) <- Just (7, 9)\n       let (d, e) = (c, c)\n       f <- [| Nothing + Just d |]\n       pure $ MkANat $ sum [a,b,c,d,e,f]\n\nparameters (x, y, z : Nat)\n\n  add3 : Nat\n  add3 = x + y + z\n\nparameters (x, y : Nat) (z, a : Nat)\n\n  add4 : Nat\n  add4 = x + y + z + a\n\nanonLam : Maybe (m : Nat ** n ** m === n)\nanonLam = map (\\m => (m ** m ** Refl))\n        $ map (uncurry $ \\ m, n => m + n)\n        $ map (\\ (m, n) => (n, m))\n        $ map (\\ m => (m, m))\n        $ map (\\ m => S m.aNat)\n        doBlock\n", "meta": {"hexsha": "a489d1af92a24060c10ea8a08b1576958d5b69c0", "size": 972, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/ideMode/ideMode005/Syntax.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/ideMode/ideMode005/Syntax.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/ideMode/ideMode005/Syntax.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 19.8367346939, "max_line_length": 70, "alphanum_fraction": 0.4526748971, "num_tokens": 383, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7879311956428946, "lm_q2_score": 0.6548947290421275, "lm_q1q2_score": 0.5160119868743931}}
{"text": "module Main\n\nimport Data.Vect\n\n-- foldr (::) [] converts to lists\nfoldToList : (Foldable t) => t a -> List a\nfoldToList = foldr (::) [] \n\nshowTestLine : List Int -> Vect n Int -> IO ()\nshowTestLine xs ys =\n  putStrLn $ \"(\" ++ \n    show xs ++ \", \" ++ \n    show ys ++ \") \" ++ \n    \"-> (\" ++ \n    show (foldToList xs) ++ \", \" ++ \n    show (foldToList ys) ++ \")\"\n\nmain : IO ()\nmain = do\n  showTestLine [] []\n  showTestLine [1] [1]\n  showTestLine [1, 2, 3] [1, 2, 3]\n  showTestLine [3, 2, 1] [3, 2, 1]\n\n\n", "meta": {"hexsha": "e448a6c3916e3044c45602d97eaec2c397d60aa6", "size": 499, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/folding001/folding001.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/folding001/folding001.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/folding001/folding001.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 19.1923076923, "max_line_length": 46, "alphanum_fraction": 0.5130260521, "num_tokens": 178, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7057850402140659, "lm_q2_score": 0.7310585669110203, "lm_q1q2_score": 0.5159702000461318}}
{"text": "module Configuration\n\nimport Data.Vect\nimport Data.Fin\n\ndata State = UnOccupied\n           | Occupied\n\ndata Square : Nat -> Type where\n     Create : Vect n (Vect n State) -> Square n\n\ntimes : (n : Nat) -> a -> Vect n a\ntimes Z x = []\ntimes (S k) x = x :: times k x\n\nemptySquare : (n : Nat) -> Vect n (Vect n State)\nemptySquare n = times n (times n UnOccupied)\n\nempty : (n : Nat) -> Square n\nempty n = Create (emptySquare n)\n\nupdate : (Fin n, Fin n) -> State -> Vect n (Vect n State) -> Vect n (Vect n State)\nupdate x y xs = xs\n\n\nplay : (Fin n, Fin n) -> Square n -> Square n\nplay (a, b) (Create xs) = let ys = update (a, b) Occupied xs in\n     Create ys\n", "meta": {"hexsha": "44afb16cf68785fd8715504d0c56a33de63aeedb", "size": 654, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "calculations/configurations/count.idr", "max_stars_repo_name": "dvberkel/pylos", "max_stars_repo_head_hexsha": "bf47ef8b3b8b2b16a5bc9fc11b0d4697db9bacce", "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": "calculations/configurations/count.idr", "max_issues_repo_name": "dvberkel/pylos", "max_issues_repo_head_hexsha": "bf47ef8b3b8b2b16a5bc9fc11b0d4697db9bacce", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "calculations/configurations/count.idr", "max_forks_repo_name": "dvberkel/pylos", "max_forks_repo_head_hexsha": "bf47ef8b3b8b2b16a5bc9fc11b0d4697db9bacce", "max_forks_repo_licenses": ["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.5517241379, "max_line_length": 82, "alphanum_fraction": 0.6116207951, "num_tokens": 207, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8438950868503682, "lm_q2_score": 0.611381973294151, "lm_q1q2_score": 0.515942243451817}}
{"text": "-- examples in \"Type-Driven Development with Idris\"\n-- chapter 14, section 1, Door part\n\n-- check that all functions are total\n%default total\n\ndata DoorResult = OK | Jammed\n\ndata DoorState = DoorClosed |\u00a0DoorOpen\n\ndata DoorCmd : (ty : Type) ->\n               DoorState ->\n               (ty -> DoorState) ->\n               Type where\n  Open :                   DoorCmd DoorResult DoorClosed\n                                              (\\res => case res of\n                                                        OK => DoorOpen\n                                                        Jammed => DoorClosed)\n  Close :                  DoorCmd ()         DoorOpen      (const DoorClosed)\n  RingBell :               DoorCmd ()         DoorClosed    (const DoorClosed)\n  Display :  String ->     DoorCmd ()         state         (const state)\n  Pure :     (res : ty) -> DoorCmd ty         (state res)   state\n  (>>=) :                  DoorCmd a          state1        state2 ->\n             ((res : a) -> DoorCmd b          (state2 res)  state3) ->\n                           DoorCmd b          state1        state3\n\ndoorProg : DoorCmd () DoorClosed (const DoorClosed)\ndoorProg = do RingBell\n              OK <- Open | Jammed => Display \"Door Jammed\"\n              Display \"Door OK\"\n              Close\n\nlogOpen : DoorCmd DoorResult DoorClosed\n                             (\\res => case res of\n                                        OK => DoorOpen\n                                        Jammed => DoorClosed)\nlogOpen = do Display \"Trying to open the door\"\n             OK <- Open | Jammed => do Display \"Jammed\"\n                                       Pure Jammed\n             Display \"Success\"\n             Pure OK\n", "meta": {"hexsha": "61ea91bc5918ba56121e6ead2c8bab30155e0e8b", "size": 1714, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter14/DoorJam.idr", "max_stars_repo_name": "pascalpoizat/idris-book", "max_stars_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-08-16T00:58:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T01:07:37.000Z", "max_issues_repo_path": "chapter14/DoorJam.idr", "max_issues_repo_name": "pascalpoizat/idris-book", "max_issues_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "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": "chapter14/DoorJam.idr", "max_forks_repo_name": "pascalpoizat/idris-book", "max_forks_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-23T03:15:39.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-23T03:15:39.000Z", "avg_line_length": 40.8095238095, "max_line_length": 78, "alphanum_fraction": 0.4381563594, "num_tokens": 349, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7634837635542924, "lm_q2_score": 0.6757646075489392, "lm_q1q2_score": 0.5159353058482534}}
{"text": "module Heap\n\n%default total\n%access private\n\npublic export\ninterface Heap (h : Type -> Type) where\n  empty : Ord a => h a\n  isEmpty : Ord a => h a -> Bool\n\n  insert : Ord a => a -> h a -> h a\n  merge : Ord a => h a -> h a -> h a\n\n  findMin : Ord a => h a -> a\n  deleteMin : Ord a => h a -> h a\n", "meta": {"hexsha": "3d8395b1ae6fbebebc3d509194741c9901de04c6", "size": 294, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Heap.idr", "max_stars_repo_name": "ska80/idris-okasaki-pfds", "max_stars_repo_head_hexsha": "8e80feba2fdcebdf90136ac6633275c896177c77", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-09-08T00:55:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-08T00:55:51.000Z", "max_issues_repo_path": "src/Heap.idr", "max_issues_repo_name": "ska80/idris-okasaki-pfds", "max_issues_repo_head_hexsha": "8e80feba2fdcebdf90136ac6633275c896177c77", "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/Heap.idr", "max_forks_repo_name": "ska80/idris-okasaki-pfds", "max_forks_repo_head_hexsha": "8e80feba2fdcebdf90136ac6633275c896177c77", "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": 18.375, "max_line_length": 39, "alphanum_fraction": 0.5544217687, "num_tokens": 99, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7371581626286834, "lm_q2_score": 0.6992544147913993, "lm_q1q2_score": 0.5154610996176231}}
{"text": "import Data.Either\nimport Data.List\nimport Data.Maybe\nimport Data.String\n\nimport System.File\n\ndata LowPoint = L Nat | N Nat\n\nShow LowPoint where\n  show (L k) = \"L \" ++ show k\n  show (N k) = \"N \" ++ show k\n\nget : LowPoint -> Nat\nget (L k) = k\nget (N k) = k\n\nisLow : LowPoint -> Bool\nisLow (L k) = True\nisLow (N k) = False\n\nparseLines : (String -> Maybe a) -> String -> List a\nparseLines f s = catMaybes $ f <$> lines s\n\nlowPointsRow : Nat -> List Nat -> List LowPoint\nlowPointsRow n [] = []\nlowPointsRow n (x :: []) = if x < n then [L x] else [N x]\nlowPointsRow n (x :: (y :: xs)) = (if x < n && x < y then L x else N x) :: lowPointsRow x (y :: xs)\n\ncomp : Nat -> LowPoint -> LowPoint\ncomp p (L k) = if k < p then L k else N k\ncomp _ (N k) = N k\n\ncomp3 : Nat -> LowPoint -> Nat -> LowPoint\ncomp3 p (L k) n = if k < n && k < p then L k else N k\ncomp3 _ (N k) _ = N k\n\nlowPointsCol : List Nat -> List (List LowPoint) -> List (List LowPoint)\nlowPointsCol prev [] = []\nlowPointsCol prev (row :: []) = [ (\\(p, r) => comp p r) <$> zip prev row ]\nlowPointsCol prev (row :: (next :: rows)) = ((\\(p, r, n) => comp3 p r (get n)) <$> zip3 prev row next) :: lowPointsCol (get <$> row) (next :: rows)\n\nrun : String -> IO ()\nrun s = do let l = (\\l => catMaybes $ parsePositive {a=Nat} . singleton <$> unpack l) <$> lines s\n           let r = lowPointsCol (replicate 100 10) $ lowPointsRow 10 <$> l\n           let s = sum $ S . get <$> (filter isLow $ (join r))\n           putStrLn $ show $ s\n\nmain : IO ()\nmain = do Right s <- readFile \"input.txt\"\n            | Left err => putStrLn $ show err\n          run s\n\n", "meta": {"hexsha": "76a94363b5fa129b5fcba79b870278c72ccbfe9e", "size": 1596, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "09/main.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "09/main.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "09/main.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.5555555556, "max_line_length": 147, "alphanum_fraction": 0.5726817043, "num_tokens": 531, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7956581097540519, "lm_q2_score": 0.6477982179521105, "lm_q1q2_score": 0.5154259055978195}}
{"text": "%default partial\n\nonlyOne : Int -> Int\nonlyOne 1 = 2\n\ncovered : Int -> Int\ncovered 1 = 2\ncovered 2 = 3\ncovered _ = 94\n\ndata IntNat : Integer -> Nat -> Type where\n     IsZero : IntNat 0 Z\n     IsSuc : IntNat 1 (S k)\n\n-- Only identified as covering if 'x' has multiplicity 0 because then it\n-- doesn't show up in the case tree!\nmatchInt : (0 x : Integer) -> (n : Nat) -> IntNat x n -> String\nmatchInt 0 Z IsZero = \"Zero\"\nmatchInt 1 (S k) IsSuc = \"Non Zero\"\n\n-- Should be identified as covering but isn't yet since the checker requires\n-- a catch all case. This does at least test that the declared 'impossible'\n-- case really is impossible; we can update it when the checker improves!\nmatchInt' : (x : Integer) -> (n : Nat) -> IntNat x n -> String\nmatchInt' 0 Z IsZero = \"Zero\"\nmatchInt' 1 (S k) IsSuc = \"Non Zero\"\nmatchInt' 0 (S k) x impossible\n", "meta": {"hexsha": "d6412f525249beb8e488d02962df4bc07cff21da", "size": 844, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/total003/Total.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/total003/Total.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/total003/Total.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 30.1428571429, "max_line_length": 76, "alphanum_fraction": 0.6718009479, "num_tokens": 266, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7549149868676283, "lm_q2_score": 0.6825737279551494, "lm_q1q2_score": 0.5152851368754496}}
{"text": "module Main\n\n%default total\n\n-- Data type\n\ndata BF : Char -> Type where\n  Next : BF '>'\n  Prev : BF '<'\n  Increment : BF '+'\n  Decrement : BF '-'\n  Output : BF '.'\n  Accept : BF ','\n  Forward : BF '['\n  Backward : BF ']'\n\n-- Interpreter\n\ndata Tape a = MkTape (Stream a) a (Stream a)\n\nright : Tape a -> Tape a\nright (MkTape ls c (r :: rs)) = MkTape (c :: ls) r rs\n\nleft : Tape a -> Tape a\nleft (MkTape (l :: ls) c rs) = MkTape ls l (c :: rs)\n\nemptyTape : Tape Int\nemptyTape = MkTape (repeat 0) 0 (repeat 0)\n\nInstruction : Type\nInstruction = Maybe (Sigma Char BF)\n\nmutual\n  partial\n  nextInstruction : Tape Int -> Tape Instruction -> IO ()\n  nextInstruction dat ins = bf' dat (right ins)\n\n  partial\n  runInstruction : Tape Int -> Tape Instruction -> BF c -> IO ()\n\n  runInstruction dat ins Next =\n    nextInstruction (right dat) ins\n\n  runInstruction dat ins Prev =\n    nextInstruction (left  dat) ins\n\n  runInstruction (MkTape ls c rs) ins Increment =\n    nextInstruction (MkTape ls (succ c) rs) ins\n\n  runInstruction (MkTape ls c rs) ins Decrement =\n    nextInstruction (MkTape ls (pred c) rs) ins\n\n  runInstruction dat@(MkTape _ c _) ins Output = do\n    putChar (chr c)\n    nextInstruction dat ins\n\n  runInstruction (MkTape ls _ rs) ins Access = do\n    c <- getChar\n    nextInstruction (MkTape ls (ord c) rs) ins\n\n  runInstruction dat@(MkTape _ n _) ins Forward = do\n    if n == 0\n    then loopRight Z dat ins\n    else nextInstruction dat ins\n\n  runInstruction dat@(MkTape _ n _) ins Backward = do\n    if n /= 0\n    then loopLeft Z dat ins\n    else nextInstruction dat ins\n\n  runInstruction dat ins _ =\n    nextInstruction dat ins\n\n  partial\n  loopRight' : Nat -> Tape Int -> Tape Instruction -> BF c -> IO ()\n  loopRight' (S Z) dat ins Backward =\n    nextInstruction dat ins\n  loopRight' n dat ins Backward =\n    loopRight (pred n) dat (right ins)\n  loopRight' n dat ins Forward =\n    loopRight (succ n) dat (right ins)\n  loopRight' n dat ins _ =\n    loopRight n dat (right ins)\n\n  partial\n  loopRight : Nat -> Tape Int -> Tape Instruction -> IO ()\n  loopRight n dat ins@(MkTape _ (Just p) _) =\n    loopRight' n dat ins (getProof p)\n  loopRight n dat ins =\n    loopRight n dat (right ins)\n\n  partial\n  loopLeft' : Nat -> Tape Int -> Tape Instruction -> BF c -> IO ()\n  loopLeft' (S Z) dat ins Forward =\n    nextInstruction dat ins\n  loopLeft' n dat ins Forward =\n    loopLeft (pred n) dat (left ins)\n  loopLeft' n dat ins Backward =\n    loopLeft (succ n) dat (left ins)\n  loopLeft' n dat ins _ =\n    loopLeft n dat (left ins)\n\n  partial\n  loopLeft : Nat -> Tape Int -> Tape Instruction -> IO ()\n  loopLeft n dat ins@(MkTape _ (Just p) _) =\n    loopLeft' n dat ins (getProof p)\n  loopLeft n dat ins =\n    loopLeft n dat (left ins)\n\n  partial\n  bf' : Tape Int -> Tape Instruction -> IO ()\n  bf' _     (MkTape _ Nothing  _) = return ()\n  bf' dat ins@(MkTape _ (Just p) _) = runInstruction dat ins (getProof p)\n\n-- Literals\n\ndata Every : List a -> Type where\n\npartial\nbf : (s : String) -> { auto p : Every (unpack s) } -> IO ()\n\npartial\nmain : IO ()\nmain = do\n  bf\"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.\"\n", "meta": {"hexsha": "1560bc13b5d00edc46eb6b4ae694cbbe0ab8a21c", "size": 3141, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "speakers/puffnfresh/BF.idr", "max_stars_repo_name": "jamondouglas/lamdaconf2015", "max_stars_repo_head_hexsha": "8363906b10285f78448387ee067fc81542dc9ea1", "max_stars_repo_licenses": ["Artistic-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": "speakers/puffnfresh/BF.idr", "max_issues_repo_name": "jamondouglas/lamdaconf2015", "max_issues_repo_head_hexsha": "8363906b10285f78448387ee067fc81542dc9ea1", "max_issues_repo_licenses": ["Artistic-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": "speakers/puffnfresh/BF.idr", "max_forks_repo_name": "jamondouglas/lamdaconf2015", "max_forks_repo_head_hexsha": "8363906b10285f78448387ee067fc81542dc9ea1", "max_forks_repo_licenses": ["Artistic-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.9285714286, "max_line_length": 82, "alphanum_fraction": 0.6255969436, "num_tokens": 974, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673178375734, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.514878502126596}}
{"text": "%default partial\n\ndata Foo : Int -> Type where\n     FZero : Foo 0\n     FPlus : (x : Int) -> (y : Int) -> Foo (x + y)\n\ntfoo : (x : Int) -> Foo x -> Int\ntfoo 0 FZero = ?bar\ntfoo (x + y) (FPlus x y) = ?baz\n\nfoo : (x : Int) -> Foo x\n\nwfoo : (x : Int) -> Int\nwfoo x with (foo x)\n  wfoo 0 | FZero = ?wfoo_rhs_1\n  wfoo (y + z) | (FPlus y z) = ?wfoo_rhs_2\n\nwbar : (x : Int) -> Int\nwbar x with (foo x)\n  wbar 0 | FZero = ?wbar_rhs_1\n  wbar (1 + z) | (FPlus 1 z) = ?wbar_rhs_2\n\nwbar1 : (x : Int) -> Int\nwbar1 x with (foo x)\n  wbar1 0 | FZero = ?wbar1_rhs_1\n  wbar1 (1 + z) | (FPlus 1 z) = ?wbar1_rhs_2\n  wbar1 (y + z) | (FPlus y z) = ?wbar1_rhs_3\n", "meta": {"hexsha": "6d62afc4503cd4a55890f53abc8a2c73d6152bc2", "size": 637, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/coverage008/wcov.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/coverage008/wcov.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/coverage008/wcov.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 22.75, "max_line_length": 50, "alphanum_fraction": 0.5447409733, "num_tokens": 301, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8577681049901037, "lm_q2_score": 0.600188359260205, "lm_q1q2_score": 0.5148224315597456}}
{"text": "module Flexidisc.OrdList.SubWithKeys\n\nimport Flexidisc.OrdList.Label\nimport Flexidisc.OrdList.Sub\nimport Flexidisc.OrdList.Type\n\nimport Data.List\n\nimport public Data.List\n\n%default total\n\n||| Proof that an `OrdList` has some given `keys` and is a sublist of an other\npublic export\ndata SubWithKeys : (keys : List k) -> (xs, ys : OrdList k v o) -> Type where\n  ||| The empty `Ordlist` is a sublist of the empty `OrdList`\n  Empty : SubWithKeys [] [] []\n  ||| Making the second list larger don't change the property\n  Skip  : SubWithKeys keys xs ys -> SubWithKeys keys xs (y::ys)\n  ||| To add an element to the first list, we need to add it to the second one\n  Keep  : (loc : Elem k keys) -> SubWithKeys (dropElem keys loc) xs ys ->\n          SubWithKeys keys ((k, ty)::xs) ((k, ty)::ys)\n\nUninhabited (SubWithKeys (x::xs) sub []) where\n  uninhabited Empty impossible\n  uninhabited (Skip _) impossible\n  uninhabited (Keep _ _) impossible\n\n%name SubWithKeys sub, issub, ss\n\nexport\ntoSub : SubWithKeys keys xs ys -> Sub xs ys\ntoSub Empty = Empty\ntoSub (Skip sub) = Skip (toSub sub)\ntoSub (Keep x sub) = Keep (toSub sub)\n", "meta": {"hexsha": "4c981682d53b1af0d595bd9f892692fe3aca984a", "size": 1114, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Flexidisc/OrdList/SubWithKeys.idr", "max_stars_repo_name": "berewt/flexidisc", "max_stars_repo_head_hexsha": "8a0c367244229be5d417c04588d8d41b6030dba2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2020-04-02T09:51:01.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-03T05:15:49.000Z", "max_issues_repo_path": "src/Flexidisc/OrdList/SubWithKeys.idr", "max_issues_repo_name": "LIST-LUXEMBOURG/flexidisc", "max_issues_repo_head_hexsha": "f5a9cdc81554359e324b64400d8479494cd45a8c", "max_issues_repo_licenses": ["MIT"], "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/Flexidisc/OrdList/SubWithKeys.idr", "max_forks_repo_name": "LIST-LUXEMBOURG/flexidisc", "max_forks_repo_head_hexsha": "f5a9cdc81554359e324b64400d8479494cd45a8c", "max_forks_repo_licenses": ["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.9444444444, "max_line_length": 78, "alphanum_fraction": 0.7028725314, "num_tokens": 336, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8080672227971211, "lm_q2_score": 0.6370307944803832, "lm_q1q2_score": 0.5147637049320068}}
{"text": "import Data.Vect\n\ntest1 : Vect 4 Int\ntest1 = [1, 2, 3, 4]\n\ntest2: Vect (2 + 2) Int\ntest2 = test1\n", "meta": {"hexsha": "2db12ad8f10c706f94de390bdb993dc9f4e60e86", "size": 97, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "ZPF/Slajdy19/PlikiIdrisa/TCVects.idr", "max_stars_repo_name": "wdomitrz/Coq-Exercises", "max_stars_repo_head_hexsha": "86d6ae9488901a0f61d45234a6b1c2c684cf60ef", "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": "ZPF/Slajdy19/PlikiIdrisa/TCVects.idr", "max_issues_repo_name": "wdomitrz/Coq-Exercises", "max_issues_repo_head_hexsha": "86d6ae9488901a0f61d45234a6b1c2c684cf60ef", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ZPF/Slajdy19/PlikiIdrisa/TCVects.idr", "max_forks_repo_name": "wdomitrz/Coq-Exercises", "max_forks_repo_head_hexsha": "86d6ae9488901a0f61d45234a6b1c2c684cf60ef", "max_forks_repo_licenses": ["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.125, "max_line_length": 23, "alphanum_fraction": 0.618556701, "num_tokens": 46, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.743167997235783, "lm_q2_score": 0.6926419767901475, "lm_q1q2_score": 0.5147493506925676}}
{"text": "module Euler_circuit\n\nimport Data.Fin\nimport Data.Vect as V\n\n  -- data EulerG : Graph n -> Type where\n  --   EulerEmpty : (g: Graph Z)   -> EulerG g\n  --   EulerAddLoop   : (a: Fin k) -> (g: Graph1 k ** EulerG g) -> EulerG (AddEdge a a g)\n  -- \n\ndata Graph1 : (n : Nat) -> Type where\n  WithoutEdge : Graph1 k\n  AddEdge     : (a: Fin k) -> (b: Fin k) -> Graph1 k -> Graph1 k\n\ndata Graph2 : (n : Nat) -> Vect n (List (Fin n)) -> Vect n (List (Fin n)) -> Type where\n  Graph2Empty     : {k: Nat} -> Graph2 k (replicate k Nil) (replicate k Nil)\n  Graph2AddEdge   : (a : Fin k) -> (b : Fin k) -> (g: Graph2 k ies oes)\n                  -> Graph2 k (updateAt b (a::) $ ies)\n                              (updateAt a (b::) $ oes)\n\ndata EqLen : List a -> List a -> Type where\n  EqLenZ : EqLen Nil Nil\n  EqLenS : EqLen xs ys -> a -> b -> EqLen (a::xs) (b::ys)\n\ndata ZipPVect : (P : a -> b -> Type) -> Vect n a -> Vect n b -> Type where\n  ZipPVectZ : {P: a -> b -> Type} -> ZipPVect P Nil Nil\n  ZipPVectS : {P: a -> b -> Type} -> ZipPVect P xs ys -> (x: a) -> (y: b) -> P x y -> ZipPVect P (x::xs) (y::ys)\n\ndata Path : (head: Type) -> head -> Type where\n  PathO : {a: Type} -> (x: a) -> (y: a) -> Path a y\n  PathS : {a: Type} -> Path a x -> (y: a) -> Path a y\n\ndata ContainEdges : Path (Fin n) h -> (g: Graph2 n ies oes) -> Type where\n  ContainEdgesO : (a: Fin n) -> (b: Fin n) -> ContainEdges (PathO a b) (Graph2AddEdge a b Graph2Empty)\n  ContainEdgesS : (es: Path (Fin n) h) -> (g: Graph2 n ies oes) -> ContainEdges es g\n               -> (a: Fin n) -> (b: Fin n) -> h = a -> ContainEdges (PathS es b) (Graph2AddEdge a b g)\n\ndata IsoGraph2 : (g1: Graph2 n1 ies1 oes1) -> (g2: Graph2 n2 ies2 oes2) -> Type where\n  IsoGraph2eq : g1 = g2 -> IsoGraph2 g1 g2\n\ndelete_empty_node : (g: Graph2 (S k) (Nil::ies) (Nil::oes)) -> ZipPVect EqLen ies oes\n                 -> (g': Graph2 k ies' oes' ** ZipPVect EqLen ies' oes')\ndelete_empty_node = ?q1\n\nadd_empty_node : (path: Path (Fin n) h) -> (g: Graph2 n ies oes) -> (contEd: ContainEdges path g') -> (isoG: IsoGraph2 g g')\n              -> (path: Path (Fin n) h ** (ContainEdges path g'', IsoGraph2 g g''))\nadd_empty_node = ?q2\n\ntheorem : {n: Nat} -> (g: Graph2 n ies oes) -> ZipPVect EqLen ies oes\n       -> Maybe (path: Path (Fin n) h ** (ContainEdges path g', IsoGraph2 g' g))\ntheorem Graph2Empty _ = Nothing\ntheorem g (ZipPVectS zipPVect [] [] (EqLenZ)) =\n  let (g' ** zipPVect') = delete_empty_node g zipPVect\n      (path' ** (contEd, isoG)) = case theorem g' zipPVect' of -- TODO: can't match `P path'` and `(A, B)`\n         (Just x) => x\n         Nothing  => absurd\n  in Just $ ?add_empty_node path' g' contEd isoG\n\n-- TODO: prove round trip add/delete empty node\n{-\n g  ~  g'+1\n !      !\ng-1  ~  g'\n-}\n\n", "meta": {"hexsha": "d37b1a55e617d20906ca18937c2f7a40ae61b8d7", "size": 2743, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "proofs/Euler_circuit.idr", "max_stars_repo_name": "GoPavel/idris-proof", "max_stars_repo_head_hexsha": "36f30dc0133d7d968548c50b6aa76f6d6b382c59", "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/Euler_circuit.idr", "max_issues_repo_name": "GoPavel/idris-proof", "max_issues_repo_head_hexsha": "36f30dc0133d7d968548c50b6aa76f6d6b382c59", "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": "proofs/Euler_circuit.idr", "max_forks_repo_name": "GoPavel/idris-proof", "max_forks_repo_head_hexsha": "36f30dc0133d7d968548c50b6aa76f6d6b382c59", "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": 41.5606060606, "max_line_length": 124, "alphanum_fraction": 0.5617936566, "num_tokens": 1023, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8267118111485245, "lm_q2_score": 0.6224593452091673, "lm_q1q2_score": 0.5145944926441954}}
{"text": "module Synchronous\n\nimport Data.Vect\n\n%access export\n%default total\n\ncounterFrom : Num ty => ty -> Stream ty\ncounterFrom = iterate (+1)\n\nsimulate : (Stream a -> Stream b) -> Stream a -> Stream b\nsimulate f xs = f xs\n\npublic export\ndelay : a -> Stream a -> Stream a\ndelay a s = a :: s\n\nmux : Stream Bool -> Stream a -> Stream a -> Stream a\nmux = liftA3 (\\e,a,b=>if e then a else b)\n\nregEn : a -> Stream Bool -> Stream a -> Stream a\nregEn a (False :: xs) (y :: ys) = a :: regEn a xs ys\nregEn a (True  :: xs) (y :: ys) = a :: regEn y xs ys\n\nregMaybe : a -> Stream (Maybe a) -> Stream a\nregMaybe a (Nothing  :: xs) = a :: regMaybe a xs\nregMaybe a ((Just x) :: xs) = a :: regMaybe x xs\n\npublic export\nwindow : (n : Nat) -> a -> Stream a -> Stream (Vect n a)\nwindow Z a xs     = pure []\nwindow (S k) a xs = let dl = scanl (flip delay) xs (replicate (k) a)\n                    in  sequence dl\n\n", "meta": {"hexsha": "dd3bb81f636f2f9ad49fee4c58c2609a5774b877", "size": 887, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Synchronous.idr", "max_stars_repo_name": "cramsay/idris_dsp_circuits", "max_stars_repo_head_hexsha": "d706aec31874ab57b24dd63e37076d3774922b3f", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-06-03T15:50:57.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-03T15:50:57.000Z", "max_issues_repo_path": "src/Synchronous.idr", "max_issues_repo_name": "cramsay/idris_dsp_circuits", "max_issues_repo_head_hexsha": "d706aec31874ab57b24dd63e37076d3774922b3f", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-06-03T16:46:47.000Z", "max_issues_repo_issues_event_max_datetime": "2020-06-03T16:46:47.000Z", "max_forks_repo_path": "src/Synchronous.idr", "max_forks_repo_name": "cramsay/idris_dsp_circuits", "max_forks_repo_head_hexsha": "d706aec31874ab57b24dd63e37076d3774922b3f", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-06-03T16:00:33.000Z", "max_forks_repo_forks_event_max_datetime": "2020-06-03T16:00:33.000Z", "avg_line_length": 25.3428571429, "max_line_length": 68, "alphanum_fraction": 0.5975197294, "num_tokens": 280, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7690802370707283, "lm_q2_score": 0.6688802537704063, "lm_q1q2_score": 0.514422584141673}}
{"text": "module Calc\n\n%default total\n\npublic export\naddInts : Int -> Int -> Int\naddInts x y = x + y\n\npublic export\nsubInts : Int -> Int -> Int\nsubInts x y = x - y\n\npublic export\nmulInts : Int -> Int -> Int\nmulInts x y = x * y\n\npublic export\ndivInts : Int -> Int -> Int\ndivInts x y = x `div` y\n", "meta": {"hexsha": "34b1ccf449bc0ca45f17d79113ef0720157f3e9b", "size": 284, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "getting_started/calc/Calc.idr", "max_stars_repo_name": "timmyjose-study/idris-from-the-docs", "max_stars_repo_head_hexsha": "ea1b7af57245ddb29b5d9d24ae623e37ecc01d12", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "getting_started/calc/Calc.idr", "max_issues_repo_name": "timmyjose-study/idris-from-the-docs", "max_issues_repo_head_hexsha": "ea1b7af57245ddb29b5d9d24ae623e37ecc01d12", "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": "getting_started/calc/Calc.idr", "max_forks_repo_name": "timmyjose-study/idris-from-the-docs", "max_forks_repo_head_hexsha": "ea1b7af57245ddb29b5d9d24ae623e37ecc01d12", "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": 14.2, "max_line_length": 27, "alphanum_fraction": 0.6373239437, "num_tokens": 101, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7690802370707283, "lm_q2_score": 0.6688802537704063, "lm_q1q2_score": 0.514422584141673}}
{"text": "data InfIO: Type where\n  Do: IO a -> (a -> Inf InfIO) -> InfIO\n\n(>>=) : IO a -> (a -> Inf InfIO) -> InfIO\n(>>=) = Do\n\ndata Fuel = Dry | More (Lazy Fuel)\n\nforever: Fuel\nforever = More forever\n\ntank: Nat -> Fuel\ntank Z = Dry\ntank (S k) = More (tank k)\n\nprintLoop: String -> InfIO\nprintLoop msg =\n  do\n    putStrLn msg\n    printLoop msg\n\nrun: InfIO -> IO()\nrun (Do action cont) =\n  do\n    res <- action\n    run (cont res)\n\nrunFuel: Fuel -> InfIO -> IO()\nrunFuel Dry         y                = putStrLn \"Out of fuel\"\nrunFuel (More fuel) (Do action cont) =\n  do\n    res <- action\n    runFuel fuel (cont res)\n", "meta": {"hexsha": "7218477578dbcf523517f4a87c49dfdc801a3c89", "size": 603, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "11_2_InfIO.idr", "max_stars_repo_name": "coffius/idris-exercises", "max_stars_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "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": "11_2_InfIO.idr", "max_issues_repo_name": "coffius/idris-exercises", "max_issues_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "11_2_InfIO.idr", "max_forks_repo_name": "coffius/idris-exercises", "max_forks_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_forks_repo_licenses": ["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.7352941176, "max_line_length": 61, "alphanum_fraction": 0.5754560531, "num_tokens": 196, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7853085708384736, "lm_q2_score": 0.6548947357776795, "lm_q1q2_score": 0.5142944490032093}}
{"text": "module Poker.Deck\n\nimport Control.ST\nimport Control.ST.Random\nimport Data.Fin\nimport Data.Vect\n\n%access public export\n%default total\n\nelemSmallerThanBound : (n : Fin m) -> LT (finToNat n) m\nelemSmallerThanBound FZ = LTESucc LTEZero\nelemSmallerThanBound (FS x) = LTESucc (elemSmallerThanBound x)\n\ndata Suit = Spade | Heart | Diamond | Club\n\nDecEq Suit where\n  decEq Spade Spade = Yes Refl\n  decEq Spade Heart = No $ \\Refl impossible\n  decEq Spade Diamond = No $ \\Refl impossible\n  decEq Spade Club = No $ \\Refl impossible\n  decEq Heart Spade = No $ \\Refl impossible\n  decEq Heart Heart = Yes Refl\n  decEq Heart Diamond = No $ \\Refl impossible\n  decEq Heart Club = No $ \\Refl impossible\n  decEq Diamond Spade = No $ \\Refl impossible\n  decEq Diamond Heart = No $ \\Refl impossible\n  decEq Diamond Diamond = Yes Refl\n  decEq Diamond Club = No $ \\Refl impossible\n  decEq Club Spade = No $ \\Refl impossible\n  decEq Club Heart = No $ \\Refl impossible\n  decEq Club Diamond = No $ \\Refl impossible\n  decEq Club Club = Yes Refl\n\nRank : Type\nRank = Fin 13\n\nrecord Card where\n  constructor MkCard\n  suit : Suit\n  rank : Rank\n\nenumFinHelp : (b : Nat) -> Vect a (Fin a) -> Vect (b + a) (Fin (b + a))\nenumFinHelp Z xs = xs\nenumFinHelp {a} (S k) xs =\n  let  xs' = last :: map weaken xs\n  in rewrite plusSuccRightSucc k a in\n  enumFinHelp k xs'\n\nenumFin : (n : Nat) -> Vect n (Fin n)\nenumFin n =\n  rewrite sym (plusZeroRightNeutral n) in\n  enumFinHelp n []\n\nouterBy : (a -> b -> c) -> Vect m a -> Vect n b -> Vect (m * n) c\nouterBy {m} {n} f xs ys =\n  concat {m = m} {n = n} $ map (\\x => map (f x) ys) xs\n\nsuits : Vect 4 Suit\nsuits = [Spade, Heart, Diamond, Club]\n\nranks : Vect 13 Rank\nranks = enumFin 13\n\nace : Rank\nace = the Rank last\n\nnewDeck : Vect 52 Card\nnewDeck =\n  let ss = suits\n      rs = ranks\n  in outerBy MkCard ss rs\n\ndata Cut : (m : Nat) -> Vect o t -> Type where\n  MkCut : (f : Vect m t) ->\n          (c : t) ->\n          (b : Vect n t) ->\n          Cut m (f ++ c :: b)\n\nplusOnePlusSucc : (m : Nat) -> (i' : Nat) -> plus (plus m 1) i' = S (plus m i')\nplusOnePlusSucc m i' = rewrite plusCommutative m 1 in Refl\n\ncutHelp : (f : Vect m t ) ->\n          (b : Vect (S n) t ) ->\n          (i : Nat) ->\n          (lt : LT i (S n)) ->\n          Cut (m + i) (f ++ b)\ncutHelp {m = m} {n = n} f (c :: b) Z lt =\n  rewrite plusZeroRightNeutral m in\n  MkCut f c b\ncutHelp {m = m} {n = Z} f (c :: b) (S i') (LTESucc lt') = absurd lt'\ncutHelp {m = m} {n = (S n')} f (c :: b) (S i') (LTESucc lt') =\n  let rec = cutHelp (f ++ [c]) b i' lt'\n  in rewrite vectAppendAssociative f [c] b in\n     rewrite sym $ plusSuccRightSucc m i' in\n     rewrite sym $ plusOnePlusSucc m i' in\n     rec\n\ncut : (i : Nat) -> (xs : Vect n t) ->\n      {auto smaller : LT i n} ->\n      Cut i xs\ncut {n = Z} i xs {smaller = smaller} = absurd smaller\ncut {n = (S k)} i xs {smaller = smaller} = cutHelp [] xs i smaller\n\ndata Shuffle : Vect n t -> Type where\n  EmptyShuffle : (xs : Vect Z t) -> Shuffle xs\n  Deal : (c : t) -> Shuffle (f ++ b) -> Shuffle (f ++ c :: b)\n\nmutual\n  shuffleHelp : (rnd : Var) -> (xs : Vect n t) ->\n                (i : Fin n) ->\n                ST m (Shuffle xs) [rnd ::: Random]\n  shuffleHelp {t} rnd xs i with (elemSmallerThanBound i)\n    shuffleHelp {t} rnd xs i | lt with (finToNat i)\n      shuffleHelp {t} rnd xs i | lt | i' with (cut i' xs)\n        shuffleHelp {t} rnd (f ++ c :: b) i | lt | i' | (MkCut f c b) = do\n          rest <- shuffle rnd $ assert_smaller (f ++ c :: b) (f ++ b)\n          pure (Deal {t = t} {f = f} {b = b} c rest)\n\n  shuffle : (rnd : Var) -> (xs : Vect n t) -> ST m (Shuffle xs) [rnd ::: Random]\n  shuffle {n = Z} rnd [] = pure (EmptyShuffle [])\n  shuffle {n = (S n')} rnd xs = do\n    i <- rndFin rnd n'\n    shuffleHelp rnd xs i\n\n-- Local Variables:\n-- idris-load-packages: (\"contrib\")\n-- End:\n", "meta": {"hexsha": "66e2840ea9badacae310f0c4ed3aa81dd9916d38", "size": 3804, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Poker/Deck.idr", "max_stars_repo_name": "farrellm/idris-poker", "max_stars_repo_head_hexsha": "3a729383be701834497e65fe48156e38d7f866d5", "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/Poker/Deck.idr", "max_issues_repo_name": "farrellm/idris-poker", "max_issues_repo_head_hexsha": "3a729383be701834497e65fe48156e38d7f866d5", "max_issues_repo_licenses": ["MIT"], "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/Poker/Deck.idr", "max_forks_repo_name": "farrellm/idris-poker", "max_forks_repo_head_hexsha": "3a729383be701834497e65fe48156e38d7f866d5", "max_forks_repo_licenses": ["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.488372093, "max_line_length": 80, "alphanum_fraction": 0.5878023134, "num_tokens": 1315, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7490872131147275, "lm_q2_score": 0.6859494550081925, "lm_q1q2_score": 0.513835965589653}}
{"text": "{-\nTrue\n0\nFalse\nFalse\n4\n42\n42\nTrue\nFalse\n[33, 42, 42, 42, 42]\n[42, 42, 33, 42, 42]\n[42, 42, 42, 42, 33]\n[33, 42, 42, 42]\n[42, 42, 33, 42]\n[42, 42, 42, 33]\nFalse\nTrue\n-}\n\nimport Data.Vector\n\nmain : IO ()\nmain = do\n  let e = the (Vector Int) empty\n  printLn (null e)\n  printLn (length e)\n  printLn (elem 42 e)\n  let a = replicate 4 (the Int 42)\n  printLn (null a)\n  printLn (length a)\n  printLn (a !! 0)\n  printLn (a !! 3)\n  printLn (elem 42 a)\n  printLn (elem 33 a)\n  printLn (unsafeInsertAt 0 33 a)\n  printLn (unsafeInsertAt 2 33 a)\n  printLn (unsafeInsertAt (length a) 33 a)\n  printLn (unsafeReplaceAt 0 33 a)\n  printLn (unsafeReplaceAt 2 33 a)\n  printLn (maybe a (\\index => unsafeReplaceAt index 33 a) (lastIndex a))\n  printLn (elem 33 a)\n  printLn (elem 33 (singleton 33))\n\n-- Local Variables:\n-- idris-load-packages: (\"cil\")\n-- End:\n", "meta": {"hexsha": "2a9896936aea44753a6b0e1cd06d05375a37a551", "size": 837, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Tests/Vector.idr", "max_stars_repo_name": "timjs/iris-clean", "max_stars_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 146, "max_stars_repo_stars_event_min_datetime": "2015-07-27T12:33:10.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-25T22:26:35.000Z", "max_issues_repo_path": "Tests/Vector.idr", "max_issues_repo_name": "timjs/iris-clean", "max_issues_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 27, "max_issues_repo_issues_event_min_datetime": "2015-09-21T15:08:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-20T13:55:12.000Z", "max_forks_repo_path": "Tests/Vector.idr", "max_forks_repo_name": "timjs/iris-clean", "max_forks_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 14, "max_forks_repo_forks_event_min_datetime": "2015-09-21T12:24:16.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-16T21:10:06.000Z", "avg_line_length": 17.4375, "max_line_length": 72, "alphanum_fraction": 0.6379928315, "num_tokens": 342, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6477982315512488, "lm_q2_score": 0.7931059560743422, "lm_q1q2_score": 0.5137726357777213}}
{"text": "module Quantities.Information\n\nimport Quantities.Core\n\n%default total\n%access public export\n\nInformation : Dimension\nInformation = MkDimension \"Information\"\n\nBit : ElemUnit Information\nBit = MkElemUnit \"bit\" 1\n\nByte : ElemUnit Information\nByte = < one \"byte\" equals 8 Bit >\n\n-- Binary prefixes for multiples of bits/bytes\n-- Based on http://en.wikipedia.org/wiki/Binary_prefix\n\ntwoToTheTen : String -> Nat -> ElemUnit q -> ElemUnit q\ntwoToTheTen pre power (MkElemUnit name f) =\n  < one (pre ++ name) equals (pow 1024.0 power) (MkElemUnit name f) >\n\nkibi : ElemUnit q -> ElemUnit q\nkibi = twoToTheTen \"kibi\" 1\nki : ElemUnit q -> ElemUnit q\nki = kibi\n\nmebi : ElemUnit q -> ElemUnit q\nmebi = twoToTheTen \"mebi\" 2\nmi : ElemUnit q -> ElemUnit q\nmi = mebi\n\ngibi : ElemUnit q -> ElemUnit q\ngibi = twoToTheTen \"gibi\" 3\ngi : ElemUnit q -> ElemUnit q\ngi = gibi\n\ntebi : ElemUnit q -> ElemUnit q\ntebi = twoToTheTen \"tebi\" 4\nti : ElemUnit q -> ElemUnit q\nti = tebi\n\npebi : ElemUnit q -> ElemUnit q\npebi = twoToTheTen \"pebi\" 5\npi : ElemUnit q -> ElemUnit q\npi = pebi\n\nexbi : ElemUnit q -> ElemUnit q\nexbi = twoToTheTen \"exbi\" 6\nei : ElemUnit q -> ElemUnit q\nei = exbi\n\nzebi : ElemUnit q -> ElemUnit q\nzebi = twoToTheTen \"zebi\" 7\nzi : ElemUnit q -> ElemUnit q\nzi = zebi\n\nyobi : ElemUnit q -> ElemUnit q\nyobi = twoToTheTen \"yobi\" 8\nyi : ElemUnit q -> ElemUnit q\nyi = yobi\n\n-- Please Note: kibi byte /= kilo byte\n", "meta": {"hexsha": "5a9dacbc4d88b2bac127044b0b118970a2ac44c5", "size": 1396, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Quantities/Information.idr", "max_stars_repo_name": "timjb/quantities", "max_stars_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 112, "max_stars_repo_stars_event_min_datetime": "2015-01-18T13:52:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-08T14:15:46.000Z", "max_issues_repo_path": "Quantities/Information.idr", "max_issues_repo_name": "timjb/quantities", "max_issues_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2015-11-04T08:51:41.000Z", "max_issues_repo_issues_event_max_datetime": "2018-04-17T09:52:29.000Z", "max_forks_repo_path": "Quantities/Information.idr", "max_forks_repo_name": "timjb/quantities", "max_forks_repo_head_hexsha": "140357c3ec06e5b29b5d369cb59f1f5925f000a5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 9, "max_forks_repo_forks_event_min_datetime": "2015-04-28T23:49:30.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-01T17:28:34.000Z", "avg_line_length": 21.4769230769, "max_line_length": 69, "alphanum_fraction": 0.7005730659, "num_tokens": 479, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7931059609645724, "lm_q2_score": 0.6477982247516797, "lm_q1q2_score": 0.513772633552825}}
{"text": "data Cont : (r : Type) -> (a : Type) -> Type where\n     MkCont : ((k : a -> r) -> r) -> Cont r a\n\ndata ContT : (r : Type) -> (m : Type -> Type) -> (a : Type) -> Type where\n     MkContT : ((k : a -> m r) -> m r) -> ContT r m a\n\ncbind : Cont r a -> (a -> Cont r b) -> Cont r b\n\nctbind : ContT r m a -> (a -> ContT r m b) -> ContT r m b\n\ncallCC : ((a -> ContT r m b) -> ContT r m a) -> ContT r m a\n", "meta": {"hexsha": "6b7cafa66332343bb5068d145f1082cba306a400", "size": 395, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interactive016/Cont.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/tests/idris2/interactive016/Cont.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/tests/idris2/interactive016/Cont.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 32.9166666667, "max_line_length": 73, "alphanum_fraction": 0.4734177215, "num_tokens": 158, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059511841119, "lm_q2_score": 0.6477982179521103, "lm_q1q2_score": 0.5137726218242811}}
{"text": "module Depling\n\nimport Data.Vect\nimport Debug.Trace\nimport Utils\n\ninfixl 10 =!=\nmutual\n\tpublic export\n\tdata DAST : Nat -> Type where\n\t\t\u028c : Fin n -> DAST n\n\t\t\u03bb : DAST n -> DAST (S n) -> DAST n\n\t\t\u03bbT : DAST n -> DAST (S n) -> DAST n\n\t\t(=!=) : DAST n -> DAST n -> DAST n\n\t\t\ud835\udd4b : DAST n\n\t\t\ud835\udd3d : DAST n -> DAST (S n) -> DAST (S$ S$ n) -> DAST n\n\t\t\ud835\udd4c : String -> DAST n -> DAST n\n\t\t\u2102 : DCon a -> Vect a (DAST n) -> DAST n\n\t\t\u2119 : DAST n -> DCon a -> DAST (a + n) -> DAST n -> DAST n\n\t\t\ud835\udd39 : DAST n -> DAST n\n\t\n\tpublic export\n\tdata DCon : Nat -> Type where\n\t\tDConV : String -> DRCtx a 0 -> DAST a -> DCon a\n\t\n\tpublic export\n\tdata DRCtx : Nat -> Nat -> Type where\n\t\tNil : DRCtx Z n\n\t\t(::) : DAST n -> DRCtx l (S n) -> DRCtx (S l) n\n\nShow (Fin n) where\n\tshow = show . finToNat\n\nShow (DAST n) where\n\tshowPrec d (\u028c v) = show v\n\tshowPrec d (\u03bb at b) = showParens (d > Open) $ \"\u03bb\" ++ showPrec Eq at ++ \"=\" ++ showPrec Open b\n\tshowPrec d (\u03bbT at rt) = showParens (d > Open) $ \"\u03bb\" ++ showPrec Eq at ++ \":\" ++ showPrec Open rt\n\tshowPrec d (f =!= a) = showParens (d >= App) $ showPrec Eq f ++ \"!\" ++ showPrec App a\n\tshowPrec d \ud835\udd4b = \"Type\"\n\tshowPrec d (\ud835\udd3d at rt b) = showParens (d > Open) $ \"\ud835\udd3d\" ++ showPrec Eq at ++ \"=\" ++ showPrec Open b\n\tshowPrec d (\ud835\udd4c n t) = showParens (d > Open) $ \"\ud835\udd4c\" ++ n ++ \":\" ++ showPrec Open t\n\tshowPrec d (\u2102 (DConV n ats rt) as) = \"\u2102\" ++ n ++ \"(\" ++ (pack $ intercalate [',', ' '] $ toList $ map (unpack . showPrec Open) as) ++ \")\"\n\tshowPrec d (\u2119 v (DConV n ats rt) t f) = \"\u2119(\" ++ showPrec Eq v ++ \" of \" ++ n ++ \" then \" ++ showPrec Eq t ++ \" else \" ++ showPrec Eq f ++ \")\"\n\tshowPrec d (\ud835\udd39 t) = \"\ud835\udd39(\" ++ showPrec Open t ++ \")\"\n\nmutual\n\texport Eq (DAST n) where\n\t\t(\u028c a) == (\u028c b) = a == b\n\t\t(\u03bb aa ba) == (\u03bb ab bb) = aa == ab && ba == bb\n\t\t(\u03bbT aa ra) == (\u03bbT ab rb) = aa == ab && ra == rb\n\t\t(fa =!= aa) == (fb =!= ab) = fa == fb && aa == ab\n\t\t\ud835\udd4b == \ud835\udd4b = True\n\t\t(\ud835\udd3d aa ra fa) == (\ud835\udd3d ab rb fb) = aa == ab && ra == rb && fa == fb\n\t\t(\ud835\udd4c na ta) == (\ud835\udd4c nb tb) = na == nb && ta == tb\n\t\t(\u2102 {a=aa} cna asa) == (\u2102 {a=ab} cnb asb) = assert_total $ aa == ab && cna == believe_me cnb && asa == believe_me asb\n\t\t(\u2119 {a=aa} va cna ta fa) == (\u2119 {a=ab} vb cnb tb fb) = assert_total $ aa == ab && va == vb && cna == believe_me cnb && ta == believe_me tb && fa == fb\n\t\t(\ud835\udd39 ta) == (\ud835\udd39 tb) = ta == tb\n\t\t_ == _ = False\n\n\texport Eq (DCon a) where\n\t\t(DConV na atsa rta) == (DConV nb atsb rtb) = na == nb && atsa == atsb && rta == rtb\n\t\n\texport Eq (DRCtx l n) where\n\t\tNil == Nil = True\n\t\t(ha :: ta) == (hb :: tb) = assert_total $ ha == hb && ta == tb\n\t\t_ == _ = False\n\ntotal\nexport\ndAppN : DAST n -> List (DAST n) -> DAST n\ndAppN f [] = f\ndAppN f (h :: t) = dAppN (f =!= h) t\n\ntotal\nexport\ndLamN : {a : Nat} -> {n : Nat} -> DRCtx a n -> DAST (a + n) -> DAST n\ndLamN {a=Z} [] rt = rt\ndLamN {a=S a} {n} (h :: t) rt = \u03bb h $ dLamN t $ replace (plusSuccRightSucc a n) $ rt\n", "meta": {"hexsha": "edff4a22f9bff4b5e313e476c78ccd2f24992c08", "size": 2824, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Depling.idr", "max_stars_repo_name": "CoderPuppy/idris-depling", "max_stars_repo_head_hexsha": "5f851559c3ddef33d0204a1b34d698b48f1560ca", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2016-08-16T23:29:06.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-10T07:10:12.000Z", "max_issues_repo_path": "Depling.idr", "max_issues_repo_name": "CoderPuppy/idris-depling", "max_issues_repo_head_hexsha": "5f851559c3ddef33d0204a1b34d698b48f1560ca", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Depling.idr", "max_forks_repo_name": "CoderPuppy/idris-depling", "max_forks_repo_head_hexsha": "5f851559c3ddef33d0204a1b34d698b48f1560ca", "max_forks_repo_licenses": ["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.746835443, "max_line_length": 150, "alphanum_fraction": 0.5219546742, "num_tokens": 1227, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7718434873426302, "lm_q2_score": 0.6654105653819836, "lm_q1q2_score": 0.5135928112990614}}
{"text": "module LongestNonRepeatingSubstring\n\nSet : Type -> Type\nSet = List\n\ncontains : Eq a => a -> Set a -> Bool\ncontains x [] = False\ncontains x (y :: ys) = (x == y) || contains x ys\n\nadd : a -> Set a -> Set a\nadd x xs = x :: xs\n\nemptySet : {0 a : Type} -> Set a\nemptySet = []\n\nlongestHelp : {0 a : Type} -> Eq a => Set a -> Int -> Int -> List a -> Int\nlongestHelp seen count soFar [] = max soFar count\nlongestHelp seen count soFar (x :: xs) =\n  if contains x seen then longestHelp (emptySet {a}) 0 (max soFar count) (x :: xs) else\n  longestHelp (add x seen) (count + 1) soFar xs\n\nlongest : Eq a => List a -> Int\nlongest = longestHelp (emptySet {a}) 0 0\n\ntest1 : longest (unpack \"abcabcbb\") = 3\ntest1 = Refl\ntest2 : longest (unpack \"bbbbb\") = 1\ntest2 = Refl\ntest3 : longest (unpack \"pwwkew\") = 3\ntest3 = Refl\ntest4 : longest (unpack \"\") = 0\ntest4 = Refl\n", "meta": {"hexsha": "fa3e888677e0c8f96ff6100983607ba6fa298c61", "size": 848, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "LongestNonRepeatingSubstring.idr", "max_stars_repo_name": "Smaug123/leetcode-idris", "max_stars_repo_head_hexsha": "6df26ef8875d83443cd2c35a7290d88f071ae33d", "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": "LongestNonRepeatingSubstring.idr", "max_issues_repo_name": "Smaug123/leetcode-idris", "max_issues_repo_head_hexsha": "6df26ef8875d83443cd2c35a7290d88f071ae33d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "LongestNonRepeatingSubstring.idr", "max_forks_repo_name": "Smaug123/leetcode-idris", "max_forks_repo_head_hexsha": "6df26ef8875d83443cd2c35a7290d88f071ae33d", "max_forks_repo_licenses": ["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.696969697, "max_line_length": 87, "alphanum_fraction": 0.6273584906, "num_tokens": 296, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7025300698514778, "lm_q2_score": 0.7310585727705126, "lm_q1q2_score": 0.5135906301939899}}
{"text": "-- by Tojans\n\n-- to run this:\n-- idris 99bottles.idr\n-- > beerSong 1\n-- > beerSong 99\n-- > beerSong 100 -- throws\n\nbeerSong : Fin 100 -> String\nbeerSong x = verses x where\n\n    -- invoke this in the CLI using `bottlesOfBeer (the (Fin 10) 4)`\n    bottlesOfBeer : Fin n -> String\n    bottlesOfBeer fZ      = \"No more bottles of beer\"\n    bottlesOfBeer (fS fZ) = \"1 bottle of beer\"\n    bottlesOfBeer k       = (show (finToInteger k)) ++ \" bottles of beer\"\n\n\n    verse : Fin n -> String \n    verse fZ     = \"\"\n    verse (fS n) = \n        (bottlesOfBeer (fS n)) ++ \" on the wall,\\n\" ++\n        (bottlesOfBeer (fS n)) ++ \"\\n\" ++\n        \"Take one down, pass it around\\n\" ++\n        (bottlesOfBeer n) ++ \" on the wall\\n\"\n\n    verses : Fin n -> String\n    verses fZ     = \"\"\n    verses (fS n) = (verse (fS n)) ++ (verses n)", "meta": {"hexsha": "61d45b1e4093aaf877f5a27e2649e286d0acc68e", "size": 815, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "katas/001/tojans/99bottles.idr", "max_stars_repo_name": "ToJans/idris101", "max_stars_repo_head_hexsha": "c1912a30161be6d9987c40ebe304c8ae7827367e", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 47, "max_stars_repo_stars_event_min_datetime": "2015-01-31T23:32:15.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-22T08:43:07.000Z", "max_issues_repo_path": "katas/001/tojans/99bottles.idr", "max_issues_repo_name": "ToJans/idris101", "max_issues_repo_head_hexsha": "c1912a30161be6d9987c40ebe304c8ae7827367e", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2015-01-02T14:29:31.000Z", "max_issues_repo_issues_event_max_datetime": "2015-03-12T13:49:41.000Z", "max_forks_repo_path": "katas/001/tojans/99bottles.idr", "max_forks_repo_name": "ToJans/idris101", "max_forks_repo_head_hexsha": "c1912a30161be6d9987c40ebe304c8ae7827367e", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-01-09T12:22:53.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-11T09:29:21.000Z", "avg_line_length": 28.1034482759, "max_line_length": 73, "alphanum_fraction": 0.5595092025, "num_tokens": 275, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8152324803738428, "lm_q2_score": 0.6297746004557471, "lm_q1q2_score": 0.5134127096059845}}
{"text": "import Data.Vect\n\ntakeFromStream : List (n ** Vect n Int)\ntakeFromStream = [(n ** take n [3..]) | n <- [0, 1, 5]]\n\nmain : IO ()\nmain = do printLn takeFromStream\n", "meta": {"hexsha": "d0bff97230b94e4fc8d7970cec65eb15124eced7", "size": 161, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/base/data_vect001/Vect.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "tests/base/data_vect001/Vect.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "tests/base/data_vect001/Vect.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 20.125, "max_line_length": 55, "alphanum_fraction": 0.6149068323, "num_tokens": 55, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7634837527911057, "lm_q2_score": 0.6723316926137812, "lm_q1q2_score": 0.5133143237971658}}
{"text": "module Subtyping\n\nimport Expr\nimport Maps\n\n%access public export\n\n%default total\n\ndata Ty : Type where\n  TyTop : Ty\n  TyBool : Ty\n  TyBase : Id -> Ty\n  TyArrow : Ty -> Ty -> Ty\n  TyUnit : Ty\n\nnamespace Types\n  A : Ty\n  A = TyBase A\n\n  B : Ty\n  B = TyBase B\n\n  C : Ty\n  C = TyBase C\n\n  D : Ty\n  D = TyBase D\n\n  E : Ty\n  E = TyBase E\n\n  F : Ty\n  F = TyBase F\n\ndata Tm : Type where\n  Var : Id -> Tm\n  App : Tm -> Tm -> Tm\n  Abs : Id -> Ty -> Tm -> Tm\n  Tru : Tm\n  Fls : Tm\n  Test : Tm -> Tm -> Tm -> Tm\n  Unit : Tm\n\nsubst : (x : Id) -> (s, t : Tm) -> Tm\nsubst x s (Var y) with (decEq x y)\n  subst x s (Var y) | Yes _ = s\n  subst x s (Var y) | No _ = Var y\nsubst x s (App t1 t2) = App (subst x s t1) (subst x s t2)\nsubst x s (Abs y ty t) with (decEq x y)\n  subst x s (Abs y ty t) | Yes _ = Abs y ty t\n  subst x s (Abs y ty t) | No _ = Abs y ty (subst x s t)\nsubst x s Tru = Tru\nsubst x s Fls = Fls\nsubst x s (Test t1 t2 t3) = Test (subst x s t1) (subst x s t2) (subst x s t3)\nsubst x s Unit = Unit\n\ndata Value : Tm -> Type where\n  V_Abs : Value (Abs x ty t)\n  V_Tru : Value Tru\n  V_Fls : Value Fls\n  V_Unit : Value Unit\n\ndata Step : Tm -> Tm -> Type where\n  ST_AppAbs : Value t2 -> Step (App (Abs x ty t1) t2) (subst x t2 t1)\n  ST_App1 : Step t1 t1' -> Step (App t1 t2) (App t1' t2)\n  ST_App2 : Value t1 -> Step t2 t2' -> Step (App t1 t2) (App t1 t2')\n  ST_Test : Step t1 t1' -> Step (Test t1 t2 t3) (Test t1' t2 t3)\n  ST_TestTru : Step (Test Tru t2 t3) t2\n  ST_TestFls : Step (Test Fls t2 t3) t3\n\ninfix 4 -+>\n\n(-+>) : Tm -> Tm -> Type\n(-+>) = Step\n\ndata Subtype : Ty -> Ty -> Type where\n  S_Refl : Subtype ty ty\n  S_Trans : Subtype ty1 ty2 -> Subtype ty2 ty3 -> Subtype ty1 ty3\n  S_Top : Subtype ty TyTop\n  S_Arrow : Subtype ty3 ty1 -> Subtype ty2 ty4 ->\n            Subtype (TyArrow ty1 ty2) (TyArrow ty3 ty4)\n\ninfix 4 <:\n\n(<:) : Ty -> Ty -> Type\n(<:) = Subtype\n\nsubtyping_example_0 : TyArrow C TyBool <: TyArrow C TyTop\nsubtyping_example_0 = S_Arrow S_Refl S_Top\n", "meta": {"hexsha": "47e8dc3c6e27ffa62adbb7a21a118506b0aa28ff", "size": 1962, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Subtyping.idr", "max_stars_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_stars_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "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": "Subtyping.idr", "max_issues_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_issues_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Subtyping.idr", "max_forks_repo_name": "minhnhdo/programming-language-foundations-in-idris", "max_forks_repo_head_hexsha": "0881c34307afa8c90cda2290bf72910be4a1ea57", "max_forks_repo_licenses": ["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.5604395604, "max_line_length": 77, "alphanum_fraction": 0.5876656473, "num_tokens": 809, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7879311956428947, "lm_q2_score": 0.6513548714339145, "lm_q1q2_score": 0.5132228226367482}}
{"text": "over_length : (len : Nat) -> (strs : List String) -> Nat\nover_length len strs = length (filter (\\str => (length str) > len) strs)\n", "meta": {"hexsha": "381edf5d6c896e1aeedb7e663d7a56e001283375", "size": 130, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter2/OverLength.idr", "max_stars_repo_name": "jeremy-miller/type-driven-development", "max_stars_repo_head_hexsha": "8cd1cec8044a10843752e0dabedb0575474e02e6", "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/OverLength.idr", "max_issues_repo_name": "jeremy-miller/type-driven-development", "max_issues_repo_head_hexsha": "8cd1cec8044a10843752e0dabedb0575474e02e6", "max_issues_repo_licenses": ["MIT"], "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/OverLength.idr", "max_forks_repo_name": "jeremy-miller/type-driven-development", "max_forks_repo_head_hexsha": "8cd1cec8044a10843752e0dabedb0575474e02e6", "max_forks_repo_licenses": ["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.3333333333, "max_line_length": 72, "alphanum_fraction": 0.6384615385, "num_tokens": 39, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8056321889812554, "lm_q2_score": 0.6370307944803831, "lm_q1q2_score": 0.5132125134056993}}
{"text": "module Main\n\nimport Data.List\n\nlarge : (a: Type) -> a\n-- integer larger than 64 bits\nlarge Integer = 3518437212345678901234567890123\n-- int close to 2\u02c663\n-- we expect some operations will overflow\nlarge Int = 3518437212345678901234567890\n\nsmall : (a: Type) -> a\nsmall Integer = 437\nsmall Int = 377\n\nnumOps : (Num a) => List ( a -> a -> a )\nnumOps = [ (+), (*) ]\n\nnegOps : (Neg a) => List (a -> a -> a)\nnegOps = [ (-) ]\n\nintegralOps : (Integral a) => List (a -> a -> a)\nintegralOps = [ div, mod ]\n\nbinOps : (Num a, Neg a, Integral a) => List (a -> a -> a)\nbinOps = numOps ++ negOps ++ integralOps\n\nmain : IO ()\nmain = do\n  putStrLn $ show (results Integer)\n  putStrLn $ show (results Int)\n  where\n  results : (a:Type) -> (Num a, Neg a, Integral a) => List a\n  results a = map (\\ op => large a  `op` small a) binOps\n", "meta": {"hexsha": "3da5bf8e010435f00df042a58c55e9c317ed4322", "size": 814, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/chez/chez015/Numbers.idr", "max_stars_repo_name": "boxfire/rapid", "max_stars_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "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": "tests/chez/chez015/Numbers.idr", "max_issues_repo_name": "boxfire/rapid", "max_issues_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "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": "tests/chez/chez015/Numbers.idr", "max_forks_repo_name": "boxfire/rapid", "max_forks_repo_head_hexsha": "91f012caad854dc454cef0375b49bcf9e1af20c7", "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.2571428571, "max_line_length": 60, "alphanum_fraction": 0.6179361179, "num_tokens": 271, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.9124361628580401, "lm_q2_score": 0.5621765008857981, "lm_q1q2_score": 0.5129501693171972}}
{"text": "module IR.Layout\n\nimport IR\nimport IR.StackSet\n\n%default total\n\ncolumn : Rectangle -> (n : Nat) -> Vect n Rectangle\ncolumn r n = column' n r n\n  where column' _ _ Z = []\n        column' n (MkRectangle x y w h) (S m) =\n          let w' = w / fromInteger (toIntegerNat n)\n          in MkRectangle (x + w' * fromInteger (toIntegerNat m)) y w' h :: column' n r m\n\nfullLayout : LayoutF wid\nfullLayout rect s = zip (integrate s) (replicate (stackLength s) rect)\n\ncolumnLayout : LayoutF wid\ncolumnLayout rect s = zip (integrate s) (column rect (stackLength s))\n\nmirrorLayout : LayoutF wid -> LayoutF wid\nmirrorLayout l (MkRectangle x' y' w' h') s = map (\\(wid, MkRectangle x y w h) => (wid, MkRectangle ((y - y') / h' * w' + x') ((x - x') / w' * h' + y') (h / h' * w') (w / w' * h'))) (l (MkRectangle x' y' w' h') s)\n\nsingle : LayoutF wid -> Layout wid\nsingle l = x\n  where x = MkLayout l x\n\nchoose : Vect (S n) (LayoutF wid) -> Layout wid\nchoose {n} {wid} (x::xs) =\n  let xs' : Vect (S n) (LayoutF wid) = rewrite plusCommutative 1 n in xs ++ [x]\n  in MkLayout x (choose xs')\n", "meta": {"hexsha": "bc2aad5b9f1c87b2860159731dc58ac8d723a7aa", "size": 1069, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/IR/Layout.idr", "max_stars_repo_name": "puffnfresh/iridium", "max_stars_repo_head_hexsha": "2dc438475962b62f6ca8d00f0dff3add87418dec", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 133, "max_stars_repo_stars_event_min_datetime": "2015-01-07T20:02:06.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-10T18:09:54.000Z", "max_issues_repo_path": "src/IR/Layout.idr", "max_issues_repo_name": "victoredwardocallaghan/iridium", "max_issues_repo_head_hexsha": "e1fde25ed8a4c601dcdddc5ef81c03bfca8f459a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2016-01-18T01:32:33.000Z", "max_issues_repo_issues_event_max_datetime": "2018-10-09T02:36:06.000Z", "max_forks_repo_path": "src/IR/Layout.idr", "max_forks_repo_name": "victoredwardocallaghan/iridium", "max_forks_repo_head_hexsha": "e1fde25ed8a4c601dcdddc5ef81c03bfca8f459a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2015-11-02T05:18:42.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-29T02:12:48.000Z", "avg_line_length": 33.40625, "max_line_length": 212, "alphanum_fraction": 0.6136576239, "num_tokens": 362, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.82893881677331, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5129311205901026}}
{"text": "module Numeric.Floating\n\npublic export\ninterface Fractional ty => Floating ty where\n  constructor MkFloating\n  pi : ty\n  euler : ty\n  exp : ty -> ty\n  log : ty -> ty\n  pow : ty -> ty -> ty -- (**)\n  sin : ty -> ty\n  cos : ty -> ty\n  tan : ty -> ty\n  asin : ty -> ty\n  acos : ty -> ty\n  atan : ty -> ty\n  sinh : ty -> ty\n  cosh : ty -> ty\n  tanh : ty -> ty\n  sqrt : ty -> ty\n\nexport\nFloating Double where\n  pi = Prelude.Types.pi\n  euler = Prelude.Types.euler\n  exp = Prelude.Types.exp\n  log = Prelude.Types.log\n  pow = Prelude.Types.pow\n  sin = Prelude.Types.sin\n  cos = Prelude.Types.cos\n  tan = Prelude.Types.tan\n  asin = Prelude.Types.asin\n  acos = Prelude.Types.acos\n  atan = Prelude.Types.atan\n  sinh = Prelude.Types.sinh\n  cosh = Prelude.Types.cosh\n  tanh = Prelude.Types.tanh\n  sqrt = Prelude.Types.sqrt\n\n-- export\n-- Floating Double where\n--   pi = 3.14159265358979323846\n--   euler = 2.7182818284590452354\n--   exp x = prim__doubleExp x\n--   log x = prim__doubleLog x\n--   pow x y = exp (y * log x) -- prim__doublePow x y\n--   sin x = prim__doubleSin x\n--   cos x = prim__doubleCos x\n--   tan x = prim__doubleTan x\n--   asin x = prim__doubleASin x\n--   acos x = prim__doubleACos x\n--   atan x = prim__doubleATan x\n--   sinh x = (exp x - exp (-x)) / 2\n--   cosh x = (exp x + exp (-x)) / 2\n--   tanh x = sinh x / cosh x -- can this NaN via cosh = 0? can cosh even be 0?\n--   sqrt x = prim__doubleSqrt x\n--   floor x = prim__doubleFloor x\n--   ceiling x = prim__doubleCeiling x\n", "meta": {"hexsha": "ff889a2da6f809294226c487cbc48ba9bb850322", "size": 1483, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Numeric/Floating.idr", "max_stars_repo_name": "MarcelineVQ/sarray", "max_stars_repo_head_hexsha": "e7728a9b89396ef6241318be9f82c45577969c8c", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2021-09-11T09:00:28.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-08T17:25:53.000Z", "max_issues_repo_path": "src/Numeric/Floating.idr", "max_issues_repo_name": "MarcelineVQ/idris2-sarray", "max_issues_repo_head_hexsha": "e7728a9b89396ef6241318be9f82c45577969c8c", "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/Numeric/Floating.idr", "max_forks_repo_name": "MarcelineVQ/idris2-sarray", "max_forks_repo_head_hexsha": "e7728a9b89396ef6241318be9f82c45577969c8c", "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.1355932203, "max_line_length": 79, "alphanum_fraction": 0.6271072151, "num_tokens": 503, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438950868503681, "lm_q2_score": 0.6076631698328916, "lm_q1q2_score": 0.512803963481898}}
{"text": "module InterfaceWith0s\n\ninterface Lala (a : Type) where\n  f : a -> a\n  z : a -> a -> Bool\n  0 prop : (x : a) -> z (f x) x = True\n", "meta": {"hexsha": "92fed4eac12101d9c4c5eca156ae06ff0aa89b21", "size": 129, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "InterfaceWith0s.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "InterfaceWith0s.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "InterfaceWith0s.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 18.4285714286, "max_line_length": 38, "alphanum_fraction": 0.5348837209, "num_tokens": 52, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8596637361282707, "lm_q2_score": 0.5964331462646254, "lm_q1q2_score": 0.5127319468685873}}
{"text": "top_ten : Ord a => List a -> List a\ntop_ten [] = []\ntop_ten xs =\n  let sortedList = reverse (sort xs) in\n  take 10 sortedList\n", "meta": {"hexsha": "49c72728ef2129261d567f8ebf3f41a6b1aeb3ab", "size": 126, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter2/TopTen.idr", "max_stars_repo_name": "jeremy-miller/type-driven-development", "max_stars_repo_head_hexsha": "8cd1cec8044a10843752e0dabedb0575474e02e6", "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/TopTen.idr", "max_issues_repo_name": "jeremy-miller/type-driven-development", "max_issues_repo_head_hexsha": "8cd1cec8044a10843752e0dabedb0575474e02e6", "max_issues_repo_licenses": ["MIT"], "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/TopTen.idr", "max_forks_repo_name": "jeremy-miller/type-driven-development", "max_forks_repo_head_hexsha": "8cd1cec8044a10843752e0dabedb0575474e02e6", "max_forks_repo_licenses": ["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.0, "max_line_length": 39, "alphanum_fraction": 0.6428571429, "num_tokens": 40, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7549149758396752, "lm_q2_score": 0.679178699175393, "lm_q1q2_score": 0.5127221712788138}}
{"text": "module Data.Profunctor\n\nimport Data.Morphisms\n\npublic export\ninterface Profunctor (0 f : Type -> Type -> Type) where\n  dimap : (a -> a') -> (b -> b') -> f a' b -> f a b'\n  lmap : (a -> a') -> f a' b -> f a b\n  rmap : (b -> b') -> f a b -> f a b'\n\n  dimap pre post = rmap post . lmap pre\n  lmap pre = dimap pre id\n  rmap post = dimap id post\n", "meta": {"hexsha": "007e8e3fd165a56f4190b80d03bd5a38428c4e51", "size": 341, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Profunctor.idr", "max_stars_repo_name": "tensorknower69/idris2-optics", "max_stars_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "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/Profunctor.idr", "max_issues_repo_name": "tensorknower69/idris2-optics", "max_issues_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_issues_repo_licenses": ["MIT"], "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/Profunctor.idr", "max_forks_repo_name": "tensorknower69/idris2-optics", "max_forks_repo_head_hexsha": "df10a006620e30d1a727780d4fb4d62b3e5d9984", "max_forks_repo_licenses": ["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.3571428571, "max_line_length": 55, "alphanum_fraction": 0.5601173021, "num_tokens": 127, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7745833945721303, "lm_q2_score": 0.6619228691808012, "lm_q1q2_score": 0.5127144629549891}}
{"text": "module Main\n\nimport IdrisJvm.IO\nimport Java.Lang\nimport Java.Util\nimport Data.Vect\n\nnumTest : (Num a, Show a) => a -> a -> JVM_IO ()\nnumTest a b = do\n  putStrLn $ show a ++ \" + \" ++ show b ++ \" = \" ++ show (a + b)\n  putStrLn $ show a ++ \" * \" ++ show b ++ \" = \" ++ show (a * b)\n\nintegralTest : (Integral a, Show a) => a -> a -> JVM_IO ()\nintegralTest a b = do\n  putStrLn $ show a ++ \" div \" ++ show b ++ \" = \" ++ show (a `div` b)\n  -- putStrLn $ show a ++ \" mod \" ++ show b ++ \" = \" ++ show (a `mod` b) -- not working due to a defect in Idris portable codegen\n\nfractionalTest : (Fractional a, Show a) => a -> a -> JVM_IO ()\nfractionalTest a b = do\n  putStrLn $ show a ++ \" / \" ++ show b ++ \" = \" ++ show (a / b)\n  putStrLn $ \"recip \" ++ show a ++ \" = \" ++ show (recip a)\n  putStrLn $ \"recip \" ++ show b ++ \" = \" ++ show (recip b)\n\nshowOrdering : Ordering -> String\nshowOrdering EQ = \"EQ\"\nshowOrdering LT = \"LT\"\nshowOrdering GT = \"GT\"\n\nordTest : (Ord a, Show a) => a -> a -> JVM_IO ()\nordTest a b = putStrLn $ \"compare \" ++ show a ++ \" \" ++ show b ++ \" = \" ++ showOrdering (compare a b)\n\nint1 : Int\nint1 = 2147483647\n\nint2 : Int\nint2 = -2147483648\n\nint3 : Int\nint3 = 4\n\ninteger1 : Integer\ninteger1 = 100000000000000009\n\ninteger2 : Integer\ninteger2 = 200000000000000008\n\nbits8_1: Bits8\nbits8_1 = 255\n\nbits8_2: Bits8\nbits8_2 = 255\n\nbits16_1: Bits16\nbits16_1 = 4097\n\nbits16_2: Bits16\nbits16_2 = 512\n\nbits32_1: Bits32\nbits32_1 = 8388608\n\nbits32_2: Bits32\nbits32_2 = 524288\n\nbits64_1: Bits64\nbits64_1 = 9223372036854775807\n\nbits64_2: Bits64\nbits64_2 = 281474976710656\n\ndouble1 : Double\ndouble1 = 24.234234\n\ndouble2 : Double\ndouble2 = 75676.23232\n\nprintHeader : String -> JVM_IO ()\nprintHeader header = do\n  putStrLn \"\"\n  putStrLn header\n  putStrLn $ concat $ List.replicate (length header) \"=\"\n\npythag : Int -> List (Int, Int, Int)\npythag max = [(x, y, z) | z <- [1..max], y <- [1..z], x <- [1..y],\n                          x * x + y * y == z * z]\n\ncompareMaybe : (a, Maybe Int, b) -> (a, Maybe Int, b) -> Ordering\ncompareMaybe (_, Just c1, _) (_, Just c2, _) = compare c1 c2\ncompareMaybe (_, Just _, _) (_, Nothing, _)  = LT\ncompareMaybe (_, Nothing, _) (_, Just _, _)  = GT\ncompareMaybe _ _                             = EQ\n\nmaybeTest1 : Maybe String -> JVM_IO ()\nmaybeTest1 s = putStrLn (maybe \"nothing\" id s)\n\nmaybeTest2 : Maybe String -> JVM_IO ()\nmaybeTest2 Nothing = putStrLn \"nothing\"\nmaybeTest2 _       = putStrLn \"just\"\n\nmaybeTest3 : Maybe String -> JVM_IO ()\nmaybeTest3 (Just _) = putStrLn \"just\"\nmaybeTest3 _        = putStrLn \"nothing\"\n\nmain : JVM_IO ()\nmain = do\n  print \"Hello \"\n  putStrLn \"world!\"\n  printHeader \"numTest on Int\"\n  numTest int1 int2\n\n  printHeader \"numTest on Integer\"\n  numTest integer1 integer2\n\n  printHeader \"numTest on Bits8\"\n  numTest bits8_1 bits8_2\n\n  printHeader \"numTest on Bits16\"\n  numTest bits16_1 bits16_2\n\n  printHeader \"numTest on Bits32\"\n  numTest bits32_1 bits32_2\n\n  printHeader \"numTest on Bits64\"\n  numTest bits64_1 bits64_2\n\n  printHeader \"numTest on Double\"\n  numTest double1 double2\n\n  printHeader \"integralTest on Int\"\n  integralTest int1 int2\n\n  printHeader \"integralTest on Integer\"\n  integralTest integer1 integer2\n\n  printHeader \"integralTest on Bits8\"\n  integralTest bits8_1 bits8_2\n\n  printHeader \"integralTest on Bits16\"\n  integralTest bits16_1 bits16_2\n\n  printHeader \"integralTest on Bits32\"\n  integralTest bits32_1 bits32_2\n\n  printHeader \"integralTest on Bits64\"\n  integralTest bits64_1 bits64_2\n\n  printHeader \"fractionalTest on Double\"\n  fractionalTest double1 double2\n\n  printHeader \"ordTest on Int\"\n  ordTest int1 int2\n\n  printHeader \"ordTest on Integer\"\n  ordTest integer1 integer2\n\n  printHeader \"ordTest on Bits8\"\n  ordTest bits8_1 bits8_2\n\n  printHeader \"ordTest on Bits16\"\n  ordTest bits16_1 bits16_2\n\n  printHeader \"ordTest on Bits32\"\n  ordTest bits32_1 bits32_2\n\n  printHeader \"ordTest on Bits64\"\n  ordTest bits64_1 bits64_2\n\n  printHeader \"ordTest on Double\"\n  ordTest double1 double2\n\n  putStrLn \"\"\n  printLn $ pythag 50\n\n  -- Array tests start\n  printLn !(arrayToVect !(vectToArray ['d', 'c', 'a']))\n  printLn !(arrayToVect !(vectToArray $ the (Vect _ Int) $ [3, 4, 5]))\n  printLn !(arrayToVect !(vectToArray (the (Vect _ Bits8) [2, 4, 6, 5, 3])))\n  printLn !(arrayToVect !(vectToArray (the (Vect _ Bits16) [5, 3])))\n  printLn !(arrayToVect !(vectToArray (the (Vect _ Bits32) [2, 5, 3])))\n  printLn !(arrayToVect !(vectToArray (the (Vect _ Bits64) [2, 4, 6, 5])))\n  printLn !(arrayToVect !(vectToArray [Float 0.5, Float 2.0, Float 4.5]))\n  printLn !(arrayToVect !(vectToArray [1.3, 1.5, 1.9, 2.5]))\n  printLn !(arrayToVect !(vectToArray [\"hello\", \"world\", \"!\"]))\n\n  marr <- newMultiArray (Int -> Int -> Int -> Int -> JVM_IO (JVM_Array (JVM_Array (JVM_Array (JVM_Array String))))) 3 2 2 4\n  setArray (JVM_Array (JVM_Array (JVM_Array (JVM_Array String))) -> Int -> Int -> Int -> Int -> String -> JVM_IO ()) marr 0 0 0 3 \"foo\"\n  printLn !(Arrays.deepToString marr)\n  printLn !(getArray (JVM_Array (JVM_Array (JVM_Array (JVM_Array String))) -> Int -> Int -> Int -> Int -> JVM_IO String) marr 0 0 0 3)\n  printLn !(arrayLength !(getArray (JVM_Array (JVM_Array (JVM_Array (JVM_Array String))) -> Int -> Int -> JVM_IO (JVM_Array (JVM_Array String))) marr 0 0))\n  printLn !(arrayLength marr)\n\n  vectArr2d <- vectToArray2d (the (Vect _ (Vect _ Int)) [[3, 33], [4, 44], [5, 55]])\n  printLn !(Arrays.deepToString vectArr2d)\n  -- Array tests end\n\n  -- Maybe tests\n  maybeTest1 (if Strings.length \"foo\" == 0 then Nothing else Just \"foo\")\n  maybeTest2 (if Strings.length \"\" == 0 then Nothing else Just \"foobar\")\n  maybeTest3 (if Strings.length \"bar\" == 0 then Nothing else Just \"bar\")\n  printLn $ sortBy compareMaybe $ [(\"\", Just 10, \"\"), (\"\", Just 23, \"\"), (\"\", Nothing, \"\"), (\"\", Just 15, \"\")]", "meta": {"hexsha": "a28537183019d074bc1413f74b44fd6157ba5ef3", "size": 5757, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris-jvm-integration-test/src/test/idris/basic/basic.idr", "max_stars_repo_name": "gzoom13/idris-jvm", "max_stars_repo_head_hexsha": "3f63d279231c3d137fab3c311888c77935faad4a", "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": "idris-jvm-integration-test/src/test/idris/basic/basic.idr", "max_issues_repo_name": "gzoom13/idris-jvm", "max_issues_repo_head_hexsha": "3f63d279231c3d137fab3c311888c77935faad4a", "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": "idris-jvm-integration-test/src/test/idris/basic/basic.idr", "max_forks_repo_name": "gzoom13/idris-jvm", "max_forks_repo_head_hexsha": "3f63d279231c3d137fab3c311888c77935faad4a", "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.785, "max_line_length": 155, "alphanum_fraction": 0.6590237971, "num_tokens": 1922, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6442251064863697, "lm_q2_score": 0.7956581049086031, "lm_q1q2_score": 0.5125829273614879}}
{"text": "public export\ninterface Do (m : Type) where\n  Next : m -> Type\n  bind : (x : m) -> Next x\n\npublic export\nMonad m => Do (m a) where\n  Next x = {b : Type} -> (a -> m b) -> m b\n  bind x k = x >>= k\n\nfoo : Maybe Int -> Maybe Int -> Maybe Int\nfoo x y\n   = bind x (\\x' =>\n     bind y (\\y' => Just (x' + y')))\n\n", "meta": {"hexsha": "04a9dce086ea06e6deae464080305026806543e4", "size": 304, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interface004/Do.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/interface004/Do.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/idris2/interface004/Do.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": 42, "alphanum_fraction": 0.5032894737, "num_tokens": 111, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7662936430859597, "lm_q2_score": 0.6688802669716106, "lm_q1q2_score": 0.5125586965659849}}
{"text": "{-\n205\n[]\nTrue\nTrue\n36\n[(1, 5), (1, 6), (2, 5), (2, 6), (11, 5), (11, 6), (11, 7), (12, 4), (12, 8), (13, 3), (13, 9), (14, 3), (14, 9), (15, 6), (16, 4), (16, 8), (17, 5), (17, 6), (17, 7), (18, 6), (21, 3), (21, 4), (21, 5), (22, 3), (22, 4), (22, 5), (23, 2), (23, 6), (25, 1), (25, 2), (25, 6), (25, 7), (35, 3), (35, 4), (36, 3), (36, 4)]\n-}\n\nimport Data.HashSet\n\n%default total\n\ndata CollidingInt = MkCollidingInt Int\n\nEq CollidingInt where\n  (==) (MkCollidingInt i) (MkCollidingInt j) = i == j\n\nHash CollidingInt where\n  hash (MkCollidingInt i) = assert_total (prim__zextInt_B32 (mod i 39))\n\nShow CollidingInt where\n  show (MkCollidingInt i) = show i\n\nCell : Type\nCell = (Int, Int)\n\nCells : Type\nCells = HashSet Cell\n\ngosperGun : Cells\ngosperGun = fromList\n  [(1,5),  (1,6),  (2,5),  (2,6),\n   (11,5), (11,6), (11,7), (12,4), (12,8),\n   (13,3), (13,9), (14,3), (14,9), (15,6),\n   (16,4), (16,8), (17,5), (17,6), (17,7), (18,6),\n   (21,3), (21,4), (21,5), (22,3), (22,4), (22,5),\n   (23,2), (23,6), (25,1), (25,2), (25,6), (25,7),\n   (35,3), (36,3), (35,4), (36,4)]\n\nfor : Monad m => HashSet a -> (a -> m b) -> m (List b)\nfor xs f = foldM (\\acc, e => (:: acc) <$> f e) [] xs\n\nmain : IO ()\nmain = do\n  let keys = MkCollidingInt <$> [0, 5..1024]\n  let set = foldl (flip insert) (the (HashSet CollidingInt) empty) keys\n  printLn (length set)\n  printLn (filter (not . flip member set) keys)\n  printLn (all (flip member set) keys)\n  printLn (all (not . flip member set) (MkCollidingInt <$> [1024, 1033..2048]))\n\n  let cells = gosperGun\n  printLn (length cells)\n  ls <- for cells pure\n  printLn (sort ls)\n\n-- Local Variables:\n-- idris-load-packages: (\"cil\")\n-- End:\n", "meta": {"hexsha": "5de6396bf6e522cd65911eea8a589f75c131e669", "size": 1666, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Tests/HashSet.idr", "max_stars_repo_name": "timjs/iris-clean", "max_stars_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 146, "max_stars_repo_stars_event_min_datetime": "2015-07-27T12:33:10.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-25T22:26:35.000Z", "max_issues_repo_path": "Tests/HashSet.idr", "max_issues_repo_name": "timjs/iris-clean", "max_issues_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 27, "max_issues_repo_issues_event_min_datetime": "2015-09-21T15:08:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-20T13:55:12.000Z", "max_forks_repo_path": "Tests/HashSet.idr", "max_forks_repo_name": "timjs/iris-clean", "max_forks_repo_head_hexsha": "b2ed1f982beec936cb6fe32e8fa6b97a1da4a4f6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 14, "max_forks_repo_forks_event_min_datetime": "2015-09-21T12:24:16.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-16T21:10:06.000Z", "avg_line_length": 27.3114754098, "max_line_length": 320, "alphanum_fraction": 0.5366146459, "num_tokens": 753, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7662936430859597, "lm_q2_score": 0.6688802603710086, "lm_q1q2_score": 0.5125586915079854}}
{"text": "module Cursor\r\n\r\nimport Data.Fin\r\nimport MaybeFin\r\n\r\nimport Movement\r\n\r\n%default total\r\n%access public\r\n\r\nprivate\r\ncrimp : Fin (S (S n)) -> Fin (S n)\r\ncrimp x =\r\n  case (strengthen x) of\r\n       Left _ => last\r\n       Right x' => x'\r\n\r\nprivate\r\nboundedSubtract : Fin (S k) -> Nat -> Fin (S k)\r\nboundedSubtract FZ _ = FZ\r\nboundedSubtract (FS x) Z = (FS x)\r\nboundedSubtract (FS x) (S k) = boundedSubtract (weaken x) k\r\n\r\nprivate\r\nboundedAdd : Fin (S k) -> Nat -> Fin (S k)\r\nboundedAdd x Z = x\r\nboundedAdd x (S k) =\r\n  case strengthen x of\r\n       Left _ => x\r\n       Right x' => boundedAdd (FS x') k\r\n\r\nrecord Cursor (bottomRow : Nat) where\r\n  constructor Cursor'\r\n  rowIndex : Fin (S bottomRow)\r\n  colIndex : Nat\r\n\r\n%name Cursor cursor\r\n\r\nzeroCursor : Cursor n\r\nzeroCursor = Cursor' FZ Z\r\n\r\nprivate\r\nupdateColIndex : (Nat -> Nat) -> Cursor n -> Cursor n\r\nupdateColIndex update cursor = record { colIndex = update $ colIndex cursor } cursor\r\n\r\nprivate\r\nupdateRowIndex : (Fin (S n) -> Fin (S m)) -> Cursor n -> Cursor m\r\nupdateRowIndex update (Cursor' rowIndex colIndex) = Cursor' (update rowIndex) colIndex\r\n\r\nprivate\r\nnatToNullableFin : Nat -> MaybeFin n\r\nnatToNullableFin {n = Z} _ = NoFin\r\nnatToNullableFin {n = (S _)} k = SomeFin $ fromMaybe last $ natToFin k _\r\n\r\ncolumnCursor : Cursor _ -> MaybeFin n\r\ncolumnCursor (Cursor' _ colIndex) = natToNullableFin colIndex\r\n\r\nprivate\r\nmoveByCharInLine : Move ByCharacter -> Nat -> Nat -> Nat\r\nmoveByCharInLine movement Z colIndex = colIndex\r\nmoveByCharInLine (Backward move) (S k) colIndex = minus colIndex move\r\nmoveByCharInLine (Forward move) (S k) colIndex =\r\n  case natToFin colIndex (S k) of\r\n       Nothing => colIndex\r\n       Just fin => finToNat $ boundedAdd fin move\r\n\r\nmoving_within_empty_line_is_idempotent : moveByCharInLine move Z colIndex = colIndex\r\nmoving_within_empty_line_is_idempotent = Refl\r\n\r\n-- TODO further proofs here once I understand how\r\n\r\nmoveByChar : Move ByCharacter -> Nat -> Cursor n -> Cursor n\r\nmoveByChar movement lineLength =\r\n  updateColIndex $ moveByCharInLine movement lineLength\r\n\r\nprivate\r\nmoveRowCursorByLine : Move ByLine -> Fin (S n) -> Fin (S n)\r\nmoveRowCursorByLine (Backward k) rowCursor =\r\n  boundedSubtract rowCursor k\r\nmoveRowCursorByLine (Forward k) rowCursor =\r\n  boundedAdd rowCursor k\r\n\r\nmoveByLine : Move ByLine -> Cursor v -> Cursor v\r\nmoveByLine movement =\r\n  updateRowIndex $ moveRowCursorByLine movement\r\n\r\ndeleteLine : Cursor (S n) -> Cursor n\r\ndeleteLine = updateRowIndex crimp\r\n\r\ninsertLineAbove : Cursor n -> Cursor (S n)\r\ninsertLineAbove = updateRowIndex weaken\r\n\r\n-- TODO should actually truncate to end of line here\r\ninsertAfter : Nat -> Cursor n -> Cursor n\r\ninsertAfter n = updateColIndex (+ n)\r\n\r\n-- TODO should actually behave differently than insertAfter\r\ninsertBefore : Nat -> Cursor n -> Cursor n\r\ninsertBefore k = updateColIndex (+ n)\r\n", "meta": {"hexsha": "9cd6c4c5dd919ba9b81d3290229734aec36a4a37", "size": 2855, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Cursor.idr", "max_stars_repo_name": "PolyglotSymposium/void.idr", "max_stars_repo_head_hexsha": "bdea1aeea6758928d79c47cefc0ac94bb1a7de1e", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2015-12-01T03:17:12.000Z", "max_stars_repo_stars_event_max_datetime": "2015-12-01T03:17:12.000Z", "max_issues_repo_path": "src/Cursor.idr", "max_issues_repo_name": "PolyglotSymposium/void.idr", "max_issues_repo_head_hexsha": "bdea1aeea6758928d79c47cefc0ac94bb1a7de1e", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2016-01-15T02:36:00.000Z", "max_issues_repo_issues_event_max_datetime": "2016-01-15T18:52:24.000Z", "max_forks_repo_path": "src/Cursor.idr", "max_forks_repo_name": "PolyglotSymposium/void.idr", "max_forks_repo_head_hexsha": "bdea1aeea6758928d79c47cefc0ac94bb1a7de1e", "max_forks_repo_licenses": ["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.55, "max_line_length": 87, "alphanum_fraction": 0.7012259194, "num_tokens": 777, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303186696747, "lm_q2_score": 0.6477982247516797, "lm_q1q2_score": 0.512104137046595}}
{"text": "||| WIP: same as Data.List.Quantifiers but for lazy lists\n\nmodule Data.List.Lazy.Quantifiers\n\nimport Data.DPair\nimport Data.List.Lazy\n\n%default total\n\nnamespace Any\n\n  -- Note: it is crucial here that we mark `xs` as `Lazy`, otherwise Idris\n  --  will happily use `Delay` in the return index and give us a badly-behaved\n  -- family!\n  public export\n  data Any : (p : a -> Type) -> (xs : LazyList a) -> Type where\n    Here : {0 xs : Lazy (LazyList a)} -> p x -> Any p (x :: xs)\n    There : {0 xs : Lazy (LazyList a)} -> Any p xs -> Any p (x :: xs)\n\n  public export\n  toExists : Any p xs -> Exists p\n  toExists (Here prf) = Evidence _ prf\n  toExists (There p) = toExists p\n\n  public export\n  toDPair : {xs : LazyList a} -> Any p xs -> DPair a p\n  toDPair (Here prf) = (_ ** prf)\n  toDPair (There p) = toDPair p\n", "meta": {"hexsha": "53caa895d90ae3e9bdba248ade82a90cd8766dfa", "size": 809, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/contrib/Data/List/Lazy/Quantifiers.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "libs/contrib/Data/List/Lazy/Quantifiers.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "libs/contrib/Data/List/Lazy/Quantifiers.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 27.8965517241, "max_line_length": 78, "alphanum_fraction": 0.6378244747, "num_tokens": 265, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7577943712746406, "lm_q2_score": 0.6757646075489391, "lm_q1q2_score": 0.5120906159072025}}
{"text": "import Providers\n-- import Data.HVect\n-- import Data.Fin\n\n\n%default total\n%language TypeProviders\n\n-- Enumerating observations, in order to be able to reason about\n-- sequences, and to avoid introducing contradictory types.\n\n-- Assumptions could depend on a few observations at once, so\n-- something like lists of observations should be used instead of\n-- single ones, and checks against permutations then, perhaps.\n\n-- #, input, output\npostulate blackbox : Integer -> Integer -> Integer\n\n\npartial parseDigit : Char -> Integer\nparseDigit '0' = 0\nparseDigit '1' = 1\nparseDigit '2' = 2\nparseDigit '3' = 3\nparseDigit '4' = 4\nparseDigit '5' = 5\nparseDigit '6' = 6\nparseDigit '7' = 7\nparseDigit '8' = 8\nparseDigit '9' = 9\n\npartial parseInt : String -> Integer\nparseInt s = foldl (\\x,y => 10*x + parseDigit y) 0 (unpack s)\n\npartial parseState : String -> (Integer, Integer)\nparseState s = case (words s) of\n  [w1, w2] => (parseInt w1, parseInt w2)\n\npartial experiment : Integer -> IO (Provider Type)\nexperiment inp = do\n  val <- readFile \"/tmp/black-box-test\"\n  (n, out) <- return $ parseState val\n  fh <- openFile \"/tmp/black-box-test\" Write\n  fwrite fh $ show (n + 1) ++ \" \" ++ show (out + inp)\n  closeFile fh\n  return (Provide (blackbox (n + 1) inp = (out + inp)))\n\n%provide (first : Type) with (experiment 2)\n%provide (second : Type) with (experiment 4)\n%provide (third : Type) with (experiment 1)\n\nalwaysIncreases' : blackbox num1 inp1 = out1 -> blackbox num2 inp2 = out2 -> Type\nalwaysIncreases' {num1} {num2} {out1} {out2} b1 b2 = (if num1 <= num2 then out1 <= out2 else out2 <= out1) = True\n\nincreasesByInput' : blackbox num1 inp1 = out1 -> blackbox num2 inp2 = out2 -> Type\nincreasesByInput' {num1} {num2} {inp1} {inp2} {out1} {out2} b1 b2 = case (num1 == num2 - 1) of\n  True => out2 = out1 + inp2\n  False => case (num1 == num2 + 1) of\n    True => out1 = out2 + inp1\n    False => Unit\n\nc1IncreasesByInput' : (b1:first) -> (b2:second) -> increasesByInput' b1 b2\nc1IncreasesByInput' b1 b2 = Refl\n\nc2IncreasesByInput' : (b1:first) -> (b2:second) -> increasesByInput' b2 b1\nc2IncreasesByInput' b1 b2 = Refl\n\nc3IncreasesByInput' : (b1:first) -> (b3:third) -> increasesByInput' b1 b3\nc3IncreasesByInput' b1 b3 = MkUnit\n\n", "meta": {"hexsha": "61774d5d699eeac16e432ea643ffde739ed9de36", "size": 2217, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Stateful.idr", "max_stars_repo_name": "defanor/black-box-reasoning", "max_stars_repo_head_hexsha": "48bd9f2a383fb0fcf5fbe5f9e866137c35cd54e2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-06-10T20:58:10.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-10T20:58:10.000Z", "max_issues_repo_path": "Stateful.idr", "max_issues_repo_name": "defanor/black-box-reasoning", "max_issues_repo_head_hexsha": "48bd9f2a383fb0fcf5fbe5f9e866137c35cd54e2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Stateful.idr", "max_forks_repo_name": "defanor/black-box-reasoning", "max_forks_repo_head_hexsha": "48bd9f2a383fb0fcf5fbe5f9e866137c35cd54e2", "max_forks_repo_licenses": ["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.2253521127, "max_line_length": 113, "alphanum_fraction": 0.6833558863, "num_tokens": 732, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8080672320414787, "lm_q2_score": 0.6334102567576901, "lm_q1q2_score": 0.5118380729248689}}
{"text": "module Data.List1\n\n%default total\n\ninfixr 7 :::\n\npublic export\nrecord List1 a where\n  constructor (:::)\n  head : a\n  tail : List a\n\n------------------------------------------------------------------------\n-- Conversion\n\n||| Forget that a list is non-empty\npublic export\nforget : (1 xs : List1 a) -> List a\nforget (x ::: xs) = x :: xs\n\n||| Check whether a list is non-empty\nexport\nfromList : (1 xs : List a) -> Maybe (List1 a)\nfromList [] = Nothing\nfromList (x :: xs) = Just (x ::: xs)\n\n------------------------------------------------------------------------\n-- Basic functions\n\npublic export\nsingleton : (1 x : a) -> List1 a\nsingleton a = a ::: []\n\nexport\nlast : List1 a -> a\nlast (x ::: xs) = loop x xs where\n\n  loop : a -> List a -> a\n  loop x [] = x\n  loop _ (x :: xs) = loop x xs\n\nexport\nfoldr1' : (a -> b -> b) -> (a -> b) -> List1 a -> b\nfoldr1' c n (x ::: xs) = loop x xs where\n\n  loop : a -> List a -> b\n  loop a [] = n a\n  loop a (x :: xs) = c a (loop x xs)\n\nexport\nfoldr1 : (a -> a -> a) -> List1 a -> a\nfoldr1 c = foldr1' c id\n\nexport\nfoldl1 : (a -> b) -> (b -> a -> b) -> List1 a -> b\nfoldl1 n c (x ::: xs) = foldl c (n x) xs\n\n------------------------------------------------------------------------\n-- Append\n\nexport\nappendl : (1 xs : List1 a) -> (1 ys : List a) -> List1 a\nappendl (x ::: xs) ys = x ::: xs ++ ys\n\nexport\nappend : (1 xs, ys : List1 a) -> List1 a\nappend xs ys = appendl xs (forget ys)\n\nexport\nlappend : (1 xs : List a) -> (1 ys : List1 a) -> List1 a\nlappend [] ys = ys\nlappend (x :: xs) ys = append (x ::: xs) ys\n\n------------------------------------------------------------------------\n-- Cons/Snoc\n\npublic export\ncons : (1 x : a) -> (1 xs : List1 a) -> List1 a\ncons x xs = x ::: forget xs\n\nexport\nsnoc : (1 xs : List1 a) -> (1 x : a) -> List1 a\nsnoc xs x = append xs (singleton x)\n\n------------------------------------------------------------------------\n-- Reverse\n\npublic export\nreverseOnto : (1 acc : List1 a) -> (1 xs : List a) -> List1 a\nreverseOnto acc [] = acc\nreverseOnto acc (x :: xs) = reverseOnto (x ::: forget acc) xs\n\npublic export\nreverse : (1 xs : List1 a) -> List1 a\nreverse (x ::: xs) = reverseOnto (singleton x) xs\n\n------------------------------------------------------------------------\n-- Instances\n\nexport\nSemigroup (List1 a) where\n  (<+>) = append\n\nexport\nFunctor List1 where\n  map f (x ::: xs) = f x ::: map f xs\n\nexport\nApplicative List1 where\n  pure x = singleton x\n  f ::: fs <*> xs = appendl (map f xs) (fs <*> forget xs)\n\nexport\nMonad List1 where\n  (x ::: xs) >>= f = appendl (f x) (xs >>= forget . f)\n\nexport\nFoldable List1 where\n  foldr c n (x ::: xs) = c x (foldr c n xs)\n\nexport\nShow a => Show (List1 a) where\n  show = show . forget\n\nexport\nEq a => Eq (List1 a) where\n  (x ::: xs) == (y ::: ys) = x == y && xs == ys\n\nexport\nOrd a => Ord (List1 a) where\n  compare xs ys = compare (forget xs) (forget ys)\n\n------------------------------------------------------------------------\n-- Properties\n\nexport\nconsInjective : the (List1 a) (x ::: xs) === (y ::: ys) -> (x === y, xs === ys)\nconsInjective Refl = (Refl, Refl)\n", "meta": {"hexsha": "5644c9d1ece0fa6749c94438b91fff848e860a0c", "size": 3077, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/base/Data/List1.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/base/Data/List1.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/libs/base/Data/List1.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.1366906475, "max_line_length": 79, "alphanum_fraction": 0.476438089, "num_tokens": 938, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7154239957834733, "lm_q2_score": 0.7154239897159438, "lm_q1q2_score": 0.511831489401935}}
{"text": "||| Additional functions about vectors\nmodule Data.Vect.Extra\n\nimport Data.Vect\nimport Data.Fin\nimport Data.Vect.Elem\n\n||| Version of `map` with access to the current position\npublic export\nmapWithPos : (f : Fin n -> a -> b) -> Vect n a -> Vect n b\nmapWithPos f [] = []\nmapWithPos f (x :: xs) = f 0 x :: mapWithPos (f . FS) xs\n\n||| Version of `map` with runtime-irrelevant information that the\n||| argument is an element of the vector\npublic export\nmapWithElem : (xs : Vect n a)\n  -> (f : (x : a) -> (0 pos : x `Elem` xs) -> b)\n  -> Vect n b\nmapWithElem []        f = []\nmapWithElem (x :: xs) f\n  = f x Here :: mapWithElem xs\n                (\\x,pos => f x (There pos))\n", "meta": {"hexsha": "26503b9ac79a302f9eeb0ce72dc3af7dd2376d3b", "size": 670, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/contrib/Data/Vect/Extra.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "libs/contrib/Data/Vect/Extra.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "libs/contrib/Data/Vect/Extra.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 27.9166666667, "max_line_length": 65, "alphanum_fraction": 0.6179104478, "num_tokens": 213, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7461390043208003, "lm_q2_score": 0.6859494550081925, "lm_q1q2_score": 0.5118136433742083}}
{"text": "module Control.Monad.Id\n\n%default total\n%access public export\n\n\ndata Id : (a : Type)-> Type where\n  IdF : (x : a) -> Id a\n\nimplementation Functor Id where\n  map f (IdF a) = IdF (f a)\n\nimplementation Applicative Id where\n    pure a = IdF a\n    (IdF f) <*> (IdF a) = IdF $ f a\n\nimplementation Monad Id where\n  (IdF x) >>= f = f x\n\nimplementation (Show a)=>Show (Id a) where\n  show (IdF a) = show a\n", "meta": {"hexsha": "c1521e300398aabe3d0d9febff757ad7ddbb8919", "size": 396, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Control/Monad/Id.idr", "max_stars_repo_name": "idris-industry/idris-free", "max_stars_repo_head_hexsha": "224da5ed197f1ca2729450cecd4f07b4ac78bcc5", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-08-11T15:40:35.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-18T01:43:22.000Z", "max_issues_repo_path": "Control/Monad/Id.idr", "max_issues_repo_name": "idris-industry/idris-free", "max_issues_repo_head_hexsha": "224da5ed197f1ca2729450cecd4f07b4ac78bcc5", "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": "Control/Monad/Id.idr", "max_forks_repo_name": "idris-industry/idris-free", "max_forks_repo_head_hexsha": "224da5ed197f1ca2729450cecd4f07b4ac78bcc5", "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.0, "max_line_length": 42, "alphanum_fraction": 0.6313131313, "num_tokens": 131, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.746138993030751, "lm_q2_score": 0.6859494550081925, "lm_q1q2_score": 0.5118136356298052}}
{"text": "nats : List Nat -> List Nat\nnats = the (List Nat)\n\nsingletonRange : nats [1..1] = nats [1]\nsingletonRange = Refl\n\nbasicIncreasingRange : nats [1..3] = nats [1, 2 , 3]\nbasicIncreasingRange = Refl\n\nbasicDecreasingRange : nats [3..1] = nats [3, 2, 1]\nbasicDecreasingRange = Refl\n\n\nincreasingRangeWithStep : nats [3, 5..11] = nats [3, 5, 7, 9, 11]\nincreasingRangeWithStep = Refl\n\nincreaingRangeWithStepEmpty : nats [3, 5..1] = nats []\nincreaingRangeWithStepEmpty = Refl\n\nsingletonRangeWithStep : nats [3, 4..3] = nats [3]\nsingletonRangeWithStep = Refl\n\nzeroStepEmptyList : nats [3, 3..5] = nats []\nzeroStepEmptyList = Refl\n\nzeroStepWhenBoundEqual : nats [1, 1..1] = nats [1]\nzeroStepWhenBoundEqual = Refl\n\ndecreasingRangeWithStep : nats [11, 8..1] = nats [11, 8, 5, 2]\ndecreasingRangeWithStep = Refl\n\ndecreasingRangeWithStepEmpty : nats [9, 8..10] = nats []\ndecreasingRangeWithStepEmpty = Refl\n\ndecreasingSingletonRangeWithStep : nats [9, 8..9] = nats [9]\ndecreasingSingletonRangeWithStep = Refl\n", "meta": {"hexsha": "3979b3e52687b2e5d285fb7a0c0a66f204f79d00", "size": 992, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/prelude/nat001/nats.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "tests/prelude/nat001/nats.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "tests/prelude/nat001/nats.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 26.8108108108, "max_line_length": 65, "alphanum_fraction": 0.7197580645, "num_tokens": 368, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7461389817407016, "lm_q2_score": 0.6859494614282922, "lm_q1q2_score": 0.5118136326756886}}
{"text": "import Data.Vect\n\nmy_length : List a -> Nat\nmy_length [] = 0\nmy_length (x :: xs) = 1 + my_length xs\n\nmy_reverse : List a -> List a\nmy_reverse [] = []\nmy_reverse (x :: xs) = (my_reverse xs) ++ [x]\n\nmy_map : (a -> b) -> List a -> List b\nmy_map f [] = []\nmy_map f (x :: xs) = f x :: my_map f xs\n\nmy_map2 : (a -> b) -> Vect n a -> Vect n b\nmy_map2 f [] = []\nmy_map2 f (x :: xs) = f x :: my_map2 f xs\n", "meta": {"hexsha": "2a9dd4fbf6447e6049e96aaadc1092a146756cf7", "size": 396, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Exercises_ch2.idr", "max_stars_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_stars_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "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": "Exercises_ch2.idr", "max_issues_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_issues_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Exercises_ch2.idr", "max_forks_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_forks_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "max_forks_repo_licenses": ["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": 45, "alphanum_fraction": 0.553030303, "num_tokens": 148, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7185943805178139, "lm_q2_score": 0.7122321903471565, "lm_q1q2_score": 0.5118060496073606}}
{"text": "module Parcomb\n\ndata Parser a = MkParser (Lazy (String -> (Maybe a, String)))\n\nparse : Parser a -> String -> (Maybe a, String)\nparse p = case p of\n  MkParser x => x\n  \nclass Applicative f => LazyAlternative (f : Type -> Type) where\n    empty : f a\n    alt : Lazy (f a) -> Lazy (f a) -> f a\n\n\ninstance Functor Parser where\n  map f p = MkParser $ \\str => case (parse p str) of\n    (Nothing, rest) => (Nothing, rest)\n    (Just x, rest) => (Just (f x), rest)\n\nmutual\n  instance Applicative Parser where\n    pure a = MkParser $ \\str => (Just a, str)\n    mf <$> mp = do\n      p <- mp\n      f <- mf\n      return (f p)\n\n  instance Monad Parser where\n    p >>= g = MkParser $ \\str => case (parse p str) of\n      (Nothing, rest) => (Nothing, rest)\n      (Just x, rest) => parse (g x) rest\n      \ninstance LazyAlternative Parser where\n  empty = MkParser $ \\str => (Nothing, str)\n  alt f s = MkParser $ \\str => case (parse f str) of\n    (Nothing, rest) => parse s str\n    (Just x, rest) => (Just x, rest)\n\nfail : Parser a\nfail = MkParser $ \\str => (Nothing, \"\")\n\nitem : Parser Char\nitem = MkParser $ \\str =>\n  case str of\n    \"\" => (Nothing, \"\")\n    _ => (Just (strHead str), strTail str)\n\nsat : (Char -> Bool) -> Parser Char\nsat p = do\n  c <- item\n  if p c\n  then return c\n  else fail\n\nchar : Char -> Parser Char\nchar c = sat (c ==)\n\nstring : String -> Parser String\nstring \"\" = return \"\"\nstring str = do\n  char c\n  string cs\n  return str\nwhere c = strHead str\n      cs = strTail str\n\nmutual\n  many : Parser a -> (Parser (List a))\n  many p = alt (some p) (return [])\n\n  some : Parser a -> (Parser (List a))\n  some p = do\n    a <- p\n    as <- many p\n    return (a :: as)\n\nnamespace Main\n  main : IO ()\n  main = putStrLn . show $ parse (many $ char 'p') \"pppa\"\n", "meta": {"hexsha": "0446ccfd835da625a4d4be94d84dab5896079315", "size": 1748, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "playing-around/Parcomb.idr", "max_stars_repo_name": "defanor/parcomb", "max_stars_repo_head_hexsha": "64e69395b6580cd0a9cc973cd2b3c8d04b5d1a89", "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": "playing-around/Parcomb.idr", "max_issues_repo_name": "defanor/parcomb", "max_issues_repo_head_hexsha": "64e69395b6580cd0a9cc973cd2b3c8d04b5d1a89", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "playing-around/Parcomb.idr", "max_forks_repo_name": "defanor/parcomb", "max_forks_repo_head_hexsha": "64e69395b6580cd0a9cc973cd2b3c8d04b5d1a89", "max_forks_repo_licenses": ["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.1265822785, "max_line_length": 63, "alphanum_fraction": 0.5760869565, "num_tokens": 544, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7690802370707281, "lm_q2_score": 0.6654105454764747, "lm_q1q2_score": 0.5117541000644097}}
{"text": "import Data.List.Views\n\n-- total\nisSuffix : Eq a => List a -> List a -> Bool\nisSuffix input1 input2 with (MkPair (snocList input1) (snocList input2))\n  isSuffix [] input2 | (Empty, s) = True\n  isSuffix input1 [] | (s, Empty) = False\n  isSuffix (xs ++ [x]) (ys ++ [y]) | (MkPair (Snoc x xs xsrec) (Snoc y ys ysrec))\n     = if x == y\n          then isSuffix xs ys | (MkPair xsrec ysrec)\n          else False\n", "meta": {"hexsha": "be02b403f19f41a18e4e40c5b93907d4354c8203", "size": 406, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/typedd-book/chapter10/IsSuffix.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/typedd-book/chapter10/IsSuffix.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/typedd-book/chapter10/IsSuffix.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.8333333333, "max_line_length": 81, "alphanum_fraction": 0.6034482759, "num_tokens": 140, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7090191460821871, "lm_q2_score": 0.7217432003123989, "lm_q1q2_score": 0.511729747576122}}
{"text": "module Data.Tree\n\nimport Data.List\nimport Data.List1\nimport Data.String\n\n%default total\n\n--------------------------------------------------------------------------------\n--          Finite Trees\n--------------------------------------------------------------------------------\n\nmutual\n\n  ||| A finite rose tree\n  public export\n  record Tree (a : Type) where\n    constructor MkTree\n    value : a\n    forest : Forest a\n\n  ||| A finite forest of trees\n  public export\n  Forest : Type -> Type\n  Forest = List . Tree\n\n--------------------------------------------------------------------------------\n--          Creating Trees\n--------------------------------------------------------------------------------\n\npublic export\nsingleton : a -> Tree a\nsingleton a = MkTree a []\n\npublic export\nreplicate : (width : Nat) -> (depth : Nat) -> a -> Tree a\nreplicate _         0 x = MkTree x []\nreplicate width (S k) x = MkTree x $ replicate width (replicate width k x)\n\n||| Unfold a tree up to the given depth.\npublic export\nunfold : (depth : Nat) -> (f : s -> (a,List s)) -> s -> Tree a\nunfold 0     f s = MkTree (fst $ f s) []\nunfold (S k) f s = let (a,ss) = f s\n                    in MkTree a (map (unfold k f) ss)\n\n--------------------------------------------------------------------------------\n--          Flattening Trees\n--------------------------------------------------------------------------------\n\nzipWithKeep : (a -> a -> a) -> List a -> List a -> List a\nzipWithKeep f [] ys = ys\nzipWithKeep f xs [] = xs\nzipWithKeep f (x :: xs) (y :: ys) = f x y :: zipWithKeep f xs ys\n\npublic export\nflatten : Tree a -> List a\nflatten (MkTree v vs) = v :: flattenF vs\n  where flattenF : Forest a -> List a\n        flattenF []        = Nil\n        flattenF (x :: xs) = flatten x ++ flattenF xs\n\npublic export\nlayers : Tree a -> List (List a)\nlayers (MkTree v vs) = [v] :: layersF vs\n  where layersF : Forest a -> List (List a)\n        layersF []        = Nil\n        layersF (x :: xs) = zipWithKeep (++) (layers x) (layersF xs)\n\n--------------------------------------------------------------------------------\n--          Accessing Elements\n--------------------------------------------------------------------------------\n\npublic export\nindex : List Nat -> Tree a -> Maybe a\nindex []        x = Just x.value\nindex (y :: ys) x = ix y x.forest >>= index ys\n  where ix : Nat -> List b -> Maybe b\n        ix _ []            = Nothing\n        ix 0     (z :: _)  = Just z\n        ix (S k) (_ :: zs) = ix k zs\n\n--------------------------------------------------------------------------------\n--          Functor and Monad Implementations\n--------------------------------------------------------------------------------\n\n-- All implementations are boilerplaty to satisfy the totality checker.\nfoldlTree : (a -> e -> a) -> a -> Tree e -> a\nfoldlTree f acc (MkTree v vs) = foldlF (f acc v) vs\n  where foldlF : a -> Forest e -> a\n        foldlF y []        = y\n        foldlF y (x :: xs) = foldlF (foldlTree f y x) xs\n\nfoldrTree : (e -> a -> a) -> a -> Tree e -> a\nfoldrTree f acc (MkTree v vs) = f v (foldrF acc vs)\n  where foldrF : a -> Forest e -> a\n        foldrF y []        = y\n        foldrF y (x :: xs) = foldrTree f (foldrF y xs) x\n\ntraverseTree : Applicative f => (a -> f b) -> Tree a -> f (Tree b)\ntraverseTree fun (MkTree v vs) = [| MkTree (fun v) (traverseF vs) |]\n  where traverseF : Forest a -> f (Forest b)\n        traverseF []        = pure []\n        traverseF (x :: xs) = [| traverseTree fun x :: traverseF xs |]\n\nmapTree : (a -> b) -> Tree a -> Tree b\nmapTree f (MkTree v vs) = MkTree (f v) (mapF vs)\n  where mapF : Forest a -> Forest b\n        mapF []       = []\n        mapF (h :: t) = mapTree f h :: mapF t\n\nbindTree : Tree a -> (a -> Tree b) -> Tree b\nbindTree (MkTree va tas) f =\n  let MkTree vb tbs = f va\n   in MkTree vb (tbs ++ bindF tas)\n\n  where bindF : Forest a -> Forest b\n        bindF []        = []\n        bindF (x :: xs) = bindTree x f :: bindF xs\n\napTree : Tree (a -> b) -> Tree a -> Tree b\napTree tf ta = bindTree tf $ \\f => mapTree (apply f) ta\n\njoinTree : Tree (Tree a) -> Tree a\njoinTree (MkTree (MkTree va tas) ftas) =\n  MkTree va $ tas ++ joinF ftas\n\n  where joinF : Forest (Tree a) -> Forest a\n        joinF []        = []\n        joinF (x :: xs) = joinTree x :: joinF xs\n\neqTree : Eq a => Tree a -> Tree a -> Bool\neqTree (MkTree x xs) (MkTree y ys) = x == y && eqF xs ys\n  where eqF : Forest a -> Forest a -> Bool\n        eqF [] []       = True\n        eqF [] (_ :: _) = False\n        eqF (_ :: _) [] = False\n        eqF (x :: xs) (y :: ys) = eqTree x y && eqF xs ys\n\n--------------------------------------------------------------------------------\n--          Visualizing Trees\n--------------------------------------------------------------------------------\n\nexport\ndrawTree : Tree String -> String\ndrawTree  = unlines . draw\n  where\n    drawForest : Forest String -> String\n    drawForest  = unlines . map drawTree\n\n    draw : Tree String -> List String\n    draw (MkTree x ts0) = lines x ++ subTrees ts0\n      where\n        shift : String -> String -> List String -> List String\n        shift first other tails =\n          zipWith (++) (first :: replicate (length tails) other) tails\n\n        subTrees : Forest String -> List String\n        subTrees []      = []\n        subTrees [t]     = \"\u2502\" :: shift \"\u2514\u257c\" \"  \" (draw t)\n        subTrees (t::ts) = \"\u2502\" :: shift \"\u251c\u257c\" \"\u2502 \" (draw t) ++ subTrees ts\n\n--------------------------------------------------------------------------------\n--          Interfaces\n--------------------------------------------------------------------------------\n\npublic export %inline\nEq a => Eq (Tree a) where\n  (==) = eqTree\n\npublic export %inline\nFoldable Tree where\n  foldl  = foldlTree\n  foldr  = foldrTree\n  null _ = False\n\npublic export %inline\nFunctor Tree where\n  map = mapTree\n\npublic export %inline\nApplicative Tree where\n  pure a = MkTree a Nil\n  (<*>)  = apTree\n\npublic export %inline\nMonad Tree where\n  (>>=) = bindTree\n  join  = joinTree\n\npublic export %inline\nTraversable Tree where\n  traverse = traverseTree\n", "meta": {"hexsha": "47a39dd5b3d3f169682459821c3f640252e1d874", "size": 6065, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Tree.idr", "max_stars_repo_name": "buzden/idris2-hedgehog", "max_stars_repo_head_hexsha": "e9858609ea79f0d2e36e66bfb9a2dbceba7771cc", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 22, "max_stars_repo_stars_event_min_datetime": "2021-03-04T18:53:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-22T08:07:54.000Z", "max_issues_repo_path": "src/Data/Tree.idr", "max_issues_repo_name": "buzden/idris2-hedgehog", "max_issues_repo_head_hexsha": "e9858609ea79f0d2e36e66bfb9a2dbceba7771cc", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-07-19T14:24:53.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-31T22:59:07.000Z", "max_forks_repo_path": "src/Data/Tree.idr", "max_forks_repo_name": "buzden/idris2-hedgehog", "max_forks_repo_head_hexsha": "e9858609ea79f0d2e36e66bfb9a2dbceba7771cc", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-10-13T20:47:53.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-13T20:47:53.000Z", "avg_line_length": 31.2628865979, "max_line_length": 80, "alphanum_fraction": 0.4586974444, "num_tokens": 1598, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7090191337850932, "lm_q2_score": 0.7217432122827968, "lm_q1q2_score": 0.5117297471880192}}
{"text": "           module UninhIndent\n\n           data MyElem : a -> List a -> Type where\n             MyHere : MyElem x (x :: xs)\n             MyThere : (later : MyElem x xs) -> MyElem x (y :: xs)\n\n           Uninhabited (MyElem a []) where\n             uninhabited c = ?uninhabited_rhs\n\n", "meta": {"hexsha": "e3af043c1f304c017ef52a1418cac63109aa3a92", "size": 281, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/interactive033/UninhIndent.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/interactive033/UninhIndent.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/interactive033/UninhIndent.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 28.1, "max_line_length": 66, "alphanum_fraction": 0.4946619217, "num_tokens": 77, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8031737869342624, "lm_q2_score": 0.6370307806984444, "lm_q1q2_score": 0.5116464245272593}}
{"text": "module Graphics.Util.Mesh\n\nimport Data.Vect \n\n%access public export\n%default total\nVec2 : Type\nVec2 = Vect 2 Double\n\nVec3 : Type\nVec3 = Vect 3 Double\n\nVec4 : Type\nVec4 = Vect 4 Double\n\n||| a data type for meshes.\n|||\n||| a mesh is a collection of positions, of UV texture coordinates, vertex normals and indices\n||| \ndata Mesh : Type where\n  UvMesh :  (positions: Vect n Vec3)\n         -> (normals: Vect n Vec3) \n         -> (uvs: Vect n Vec2)\n         -> (indices: List Int)\n         -> Mesh\n\npositions : Mesh -> List Vec3\npositions (UvMesh p _ _ _) = toList p\n\nindices : Mesh -> List Int\nindices (UvMesh _ _ _ xs) = xs\n", "meta": {"hexsha": "3646a3f572d4ee0f4f73f70835107e0ec1babeaa", "size": 621, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Graphics/Util/Mesh.idr", "max_stars_repo_name": "spearman/gl-idris", "max_stars_repo_head_hexsha": "e207ae1cbe3f67f9561db2c0175d020dc91fca89", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 17, "max_stars_repo_stars_event_min_datetime": "2015-06-29T11:36:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-02T22:32:03.000Z", "max_issues_repo_path": "src/Graphics/Util/Mesh.idr", "max_issues_repo_name": "spearman/gl-idris", "max_issues_repo_head_hexsha": "e207ae1cbe3f67f9561db2c0175d020dc91fca89", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-06-01T13:01:39.000Z", "max_issues_repo_issues_event_max_datetime": "2019-06-01T13:01:39.000Z", "max_forks_repo_path": "src/Graphics/Util/Mesh.idr", "max_forks_repo_name": "spearman/gl-idris", "max_forks_repo_head_hexsha": "e207ae1cbe3f67f9561db2c0175d020dc91fca89", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2016-04-21T22:11:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-20T02:23:06.000Z", "avg_line_length": 19.40625, "max_line_length": 94, "alphanum_fraction": 0.6425120773, "num_tokens": 188, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7981867777396211, "lm_q2_score": 0.640635854839898, "lm_q1q2_score": 0.5113470686791258}}
{"text": "||| Axioms and propsitions for primitive types with an\n||| `Ord` implementation.\nmodule Data.Prim.Ord\n\nimport public Data.Trichotomy\n\n%default total\n\n||| Similar to `Either` but with erased fields.\npublic export\ndata Either0 : Type -> Type -> Type where\n  Left0  : (0 v : a) -> Either0 a b\n  Right0 : (0 v : b) -> Either0 a b\n\n||| We often don't trust values of type `a === b`, as they might\n||| have been magically crafted using `believe_me` or `assert_total`\n||| followed by `idris_crash`. If a value of another type follows\n||| from a (potentially) magically crafted one, we only want the\n||| second value to reduce at compile time, if the first value\n||| reduces to `Refl`. Otherwise, we risk blowing up the compiler\n||| in an absurd context.\nexport\nstrictRefl : (0 prf : a === b) -> Lazy c -> c\nstrictRefl Refl x = x\n\n--------------------------------------------------------------------------------\n--          Interface\n--------------------------------------------------------------------------------\n\n||| This interface is a witness that the given primitive type\n||| comes with a relation `lt`, with `lt` being a strict total order.\n||| We typically define the following aliases\n||| (or name the relation accordingly):\n|||\n|||   `m < n`  := lt m n\n|||   `m > n`  := lt n m\n|||   `m <= n` := Either (lt m n) (m === n)\n|||   `m >= n` := Either (lt n m) (n === m)\n|||   `m /= n` := Either (lt m n) (lt n m)\n|||\n||| The following axioms must hold:\n|||   1. (<) is transitive: From `k < m` and `m < n` follows `k < n`.\n|||\n|||   2. Trichotomy: For all values `m` and `n` exactly one of the\n|||      following holds: `m < n`, `m === n`, or `n < m`.\n|||\n||| It is in the nature of a primitive that we can't proof these axioms\n||| in Idris itself. We must therefore assume that they hold on all backends,\n||| and it is the responsibility of programmers implementing\n||| interface `Total` to make sure that the axioms actually hold.\npublic export\ninterface Total (0 a : Type) (0 lt : a -> a -> Type) | lt where\n  ||| Axiom I: `<` is transitive.\n  0 transLT : {k,m,n : a} -> lt k m -> lt m n -> lt k n\n\n  ||| Axiom II: Trichotomy of `<`, `===`, and `>`.\n  trichotomy : (m,n : a) -> Trichotomy lt m n\n\n||| Tests if the first value is strictly less than the second or not\nexport\ntestLT : Total a lt => (x,y : a) -> Either0 (lt x y) (Either (lt y x) (y === x))\ntestLT x y = case trichotomy {lt} x y of\n  LT p _ _ => Left0 p\n  EQ _ p _ => Right0 (Right $ sym p)\n  GT _ _ p => Right0 (Left p)\n\n||| Tests if the first value is strictly greater than the second or not\nexport\ntestGT : Total a lt => (x,y : a) -> Either0 (lt y x) (Either (lt x y) (x === y))\ntestGT x y = case trichotomy {lt} x y of\n  GT _ _ p => Left0 p\n  LT p _ _ => Right0 (Left p)\n  EQ _ p _ => Right0 (Right p)\n\n||| Tests if the two values are provably equal or not\nexport\ntestEQ : Total a lt => (x,y : a) -> Either0 (x === y) (Either (lt x y) (lt y x))\ntestEQ x y = case trichotomy {lt} x y of\n  EQ _ p _ => Left0 p\n  LT p _ _ => Right0 (Left p)\n  GT _ _ p => Right0 (Right p)\n\n--------------------------------------------------------------------------------\n--          Corollaries\n--------------------------------------------------------------------------------\n\n||| `<` is irreflexive.\nexport\n0 irrefl : Total a lt => Not (lt m m)\nirrefl x = case trichotomy m m of\n  LT y _ f => f y\n  EQ f _ _ => f x\n  GT f _ y => f y\n\n--------------------------------------------------------------------------------\n--          Transitivities\n--------------------------------------------------------------------------------\n\nnamespace LT\n\n  ||| This is an alias for `transLT`\n  export\n  0 trans : Total a lt => lt k m -> lt m n -> lt k n\n  trans = transLT\n\n||| `k === m` and `m /= n` implies `k /= n`.\nexport\n0 trans_EQ_NEQ :  Total a lt\n               => k === m\n               -> Either (lt m n) (lt n m)\n               -> Either (lt k n) (lt n k)\ntrans_EQ_NEQ eqv neq  = rewrite eqv in neq\n\n||| `k === m` and `m /= n` implies `k /= n`.\nexport\n0 trans_NEQ_EQ :  Total a lt\n               => Either (lt k m) (lt m k)\n               -> m === n\n               -> Either (lt k n) (lt n k)\ntrans_NEQ_EQ neq eqv = rewrite (sym eqv) in neq\n\n||| `k < m` and `m === n` implies `k < n`\nexport\n0 trans_LT_EQ : Total a lt => lt k m -> m === n -> lt k n\ntrans_LT_EQ p eqv = rewrite sym eqv in p\n\n||| `k === m` and `m < n` implies `k < n`\nexport\n0 trans_EQ_LT : Total a lt => k === m -> lt m n -> lt k n\ntrans_EQ_LT eqv q = rewrite eqv in q\n\n||| `k <= m` and `m < n` implies `k < n`\nexport\n0 trans_LTE_LT : Total a lt => Either (lt k m) (k === m) -> lt m n -> lt k n\ntrans_LTE_LT x y = either (`trans` y) (`trans_EQ_LT` y) x\n\n||| `k < m` and `m <= n` implies `k < n`\nexport\n0 trans_LT_LTE : Total a lt => lt k m -> Either (lt m n) (m === n) -> lt k n\ntrans_LT_LTE x = either (trans x) (trans_LT_EQ x)\n\n||| `k > m` and `m === n` implies `k > n`\nexport\n0 trans_GT_EQ : Total a lt => lt m k -> m === n -> lt n k\ntrans_GT_EQ p eqv = rewrite sym eqv in p\n\n||| `k === m` and `m > n` implies `k > n`\nexport\n0 trans_EQ_GT : Total a lt => k === m -> lt n m -> lt n k\ntrans_EQ_GT eqv q = rewrite eqv in q\n\n||| `k >= m` and `m > n` implies `k > n`\nexport\n0 trans_GTE_GT : Total a lt => Either (lt m k) (m === k) -> lt n m -> lt n k\ntrans_GTE_GT x y = either (trans y) (\\v => trans_EQ_GT (sym v) y) x\n\n||| `k > m` and `m >= n` implies `k > n`\nexport\n0 trans_GT_GTE : Total a lt => lt m k -> Either (lt n m) (n === m) -> lt n k\ntrans_GT_GTE x (Left y)  = trans y x\ntrans_GT_GTE x (Right y) = trans_GT_EQ x (sym y)\n\nnamespace LTE\n\n  ||| `<=` is reflexive.\n  export\n  0 refl : Total a lt => Either (lt m m) (m === m)\n  refl = Right Refl\n\n  ||| `<=` is transitive.\n  export\n  0 trans :  Total a lt\n          => Either (lt k m) (k === m)\n          -> Either (lt m n) (m === n)\n          -> Either (lt k n) (k === n)\n  trans (Left x)  y         = Left (trans_LT_LTE x y)\n  trans (Right x) (Left y)  = Left (trans_EQ_LT x y)\n  trans (Right x) (Right y) = Right (trans x y)\n\n  ||| `<=` is antisymmetric.\n  export\n  0 antisym :  Total a lt\n            => Either (lt m n) (m === n)\n            -> Either (lt n m) (m === n)\n            -> m === n\n  antisym (Right x) _         = x\n  antisym (Left x)  (Right y) = y\n  antisym (Left x)  (Left y)  = void (irrefl $ trans x y)\n\n||| `k <= m` and `m === n` implies `k <= n`\nexport\n0 trans_LTE_EQ :  Total a lt\n               => Either (lt k m) (k === m)\n               -> m === n\n               -> Either (lt k n) (k === n)\ntrans_LTE_EQ lte eq = trans lte (Right eq)\n\n||| `k === m` and `m <= n` implies `(k <= n)`\nexport\n0 trans_EQ_LTE :  Total a lt\n               => k === m\n               -> Either (lt m n) (m === n)\n               -> Either (lt k n) (k === n)\ntrans_EQ_LTE eq lte = trans (Right eq) lte\n\nnamespace GTE\n\n  ||| `>=` is transitive.\n  export\n  0 trans :  Total a lt\n          => Either (lt m k) (m === k)\n          -> Either (lt n m) (n === m)\n          -> Either (lt n k) (n === k)\n  trans (Left x)  y         = Left (trans_GT_GTE x y)\n  trans (Right x) (Left y)  = Left (trans_EQ_GT (sym x) y)\n  trans (Right x) (Right y) = Right (trans y x)\n\n  ||| `>=` is antisymmetric.\n  export\n  0 antisym :  Total a lt\n            => Either (lt n m) (m === n)\n            -> Either (lt m n) (m === n)\n            -> m === n\n  antisym (Right x) _         = x\n  antisym (Left x)  (Right y) = y\n  antisym (Left x)  (Left y)  = void (irrefl $ trans x y)\n\n||| `k >= m` and `m === n` implies `k >= n`\nexport\n0 trans_GTE_EQ :  Total a lt\n               => Either (lt m k) (m === k)\n               -> m === n\n               -> Either (lt n k) (n === k)\ntrans_GTE_EQ gte eq = trans gte (Right $ sym eq)\n\n||| `k === m` and `m <= n` implies `(k <= n)`\nexport\n0 trans_EQ_GTE :  Total a lt\n               => k === m\n               -> Either (lt n m) (n === m)\n               -> Either (lt n k) (n === k)\ntrans_EQ_GTE eq gte = trans (Right $ sym eq) gte\n\n--------------------------------------------------------------------------------\n--          Conversions\n--------------------------------------------------------------------------------\n\n||| `m < n` implies `Not (m > n)`.\nexport\n0 LT_not_GT : Total a lt => lt m n -> Not (lt n m)\nLT_not_GT isLT isGT = case trichotomy m n of\n  LT _ _ g => g isGT\n  EQ _ _ g => g isGT\n  GT f _ _ => f isLT\n\n||| `m < n` implies `Not (m === n)`.\nexport\n0 LT_not_EQ : Total a lt => lt m n -> Not (m === n)\nLT_not_EQ isLT isEQ = case trichotomy m n of\n  LT _ g _ => g isEQ\n  EQ f _ _ => f isLT\n  GT _ g _ => g isEQ\n\n||| `m < n` implies `Not (m >= n)`.\nexport\n0 LT_not_GTE : Total a lt => lt m n -> Not (Either (lt n m) (n === m))\nLT_not_GTE l = either (LT_not_GT l) (\\e => LT_not_EQ l (sym e))\n\n||| `Not (m < n)` implies `m >= n`.\nexport\n0 Not_LT_to_GTE : Total a lt => Not (lt m n) -> Either (lt n m) (n === m)\nNot_LT_to_GTE f = case trichotomy m n of\n  LT x _ _ => void (f x)\n  EQ _ x _ => Right (sym x)\n  GT _ _ x => Left x\n\n||| `m === n` implies `Not (m < n)`.\nexport\n0 EQ_not_LT : Total a lt => m === n -> Not (lt m n)\nEQ_not_LT = flip LT_not_EQ\n\n||| `m === n` implies `Not (m > n)`.\nexport\n0 EQ_not_GT : Total a lt => m === n -> Not (lt n m)\nEQ_not_GT isEQ = EQ_not_LT (sym isEQ)\n\n||| `m === n` implies `Not (m /= n)`.\nexport\n0 EQ_not_NEQ : Total a lt => m === n -> Not (Either (lt m n) (lt n m))\nEQ_not_NEQ isEQ = either (EQ_not_LT isEQ) (EQ_not_GT isEQ)\n\n||| `Not (m < n)` implies `m /= n`.\nexport\n0 Not_EQ_to_NEQ : Total a lt => Not (m === n) -> Either (lt m n) (lt n m)\nNot_EQ_to_NEQ f = case trichotomy m n of\n  LT x _ _ => Left x\n  EQ _ x _ => void (f x)\n  GT _ _ x => Right x\n\n||| `m > n` implies `Not (m < n)`.\nexport\n0 GT_not_LT : Total a lt => lt n m -> Not (lt m n)\nGT_not_LT = LT_not_GT\n\n||| `m > n` implies `Not (m === n)`.\nexport\n0 GT_not_EQ : Total a lt => lt n m -> Not (m === n)\nGT_not_EQ = flip EQ_not_GT\n\n||| `m > n` implies `Not (m <= n)`.\nexport\n0 GT_not_LTE : Total a lt => lt n m -> Not (Either (lt m n) (m === n))\nGT_not_LTE gt = either (GT_not_LT gt) (GT_not_EQ gt)\n\n||| `Not (m > n)` implies `m <= n`.\nexport\n0 Not_GT_to_LTE : Total a lt => Not (lt n m) -> Either (lt m n) (m === n)\nNot_GT_to_LTE f = case trichotomy m n of\n  LT x _ _ => Left x\n  EQ _ x _ => Right x\n  GT _ _ x => void (f x)\n\n||| `m <= n` implies `Not (m > n)`.\nexport\n0 LTE_not_GT : Total a lt => (Either (lt m n) (m === n)) -> Not (lt n m)\nLTE_not_GT = either LT_not_GT EQ_not_GT\n\n||| `Not (m <= n)` implies `m > n`.\nexport\n0 Not_LTE_to_GT : Total a lt => Not (Either (lt m n) (m === n)) -> lt n m\nNot_LTE_to_GT f = case trichotomy m n of\n  LT x _ _ => void (f $ Left x)\n  EQ _ x _ => void (f $ Right x)\n  GT _ _ x => x\n\n||| `m <= n` and `m >= n` implies `m === n`.\nexport\n0 LTE_and_GTE_to_EQ :  Total a lt\n                    => Either (lt m n) (m === n)\n                    -> Either (lt n m) (n === m)\n                    -> m === n\nLTE_and_GTE_to_EQ (Left x)  (Right y) = sym y\nLTE_and_GTE_to_EQ (Right x) _         = x\nLTE_and_GTE_to_EQ (Left x)  (Left y)  = void (LT_not_GT x y)\n\n||| `m <= n` and `m /= n` implies `m < n`.\nexport\n0 LTE_and_NEQ_to_LT :  Total a lt\n                    => Either (lt m n) (m === n)\n                    -> Either (lt m n) (lt n m)\n                    -> lt m n\nLTE_and_NEQ_to_LT (Left x)  _         = x\nLTE_and_NEQ_to_LT (Right _) (Left x)  = x\nLTE_and_NEQ_to_LT (Right x) (Right y) = void (EQ_not_GT x y)\n\n||| `m /= n` implies `Not (m === n)`.\nexport\n0 NEQ_not_EQ : Total a lt => Either (lt m n) (lt n m) -> Not (m === n)\nNEQ_not_EQ = either LT_not_EQ GT_not_EQ\n\n||| `Not (m /= n)` implies `m === n`.\nexport\n0 Not_NEQ_to_EQ : Total a lt => Not (Either (lt m n) (lt n m)) -> m === n\nNot_NEQ_to_EQ f = case trichotomy m n of\n  LT x _ _ => void (f $ Left x)\n  EQ _ x _ => x\n  GT _ _ x => void (f $ Right x)\n\n||| `m /= n` and `m <= n` implies `m < n`.\nexport\n0 NEQ_and_LTE_to_LT :  Total a lt\n                    => Either (lt m n) (lt n m)\n                    -> Either (lt m n) (m === n)\n                    -> lt m n\nNEQ_and_LTE_to_LT = flip LTE_and_NEQ_to_LT\n\n||| `m /= n` and `m <= n` implies `m < n`.\nexport\n0 NEQ_and_GTE_to_GT :  Total a lt\n                    => Either (lt m n) (lt n m)\n                    -> Either (lt n m) (n === m)\n                    -> lt n m\nNEQ_and_GTE_to_GT (Right x) _         = x\nNEQ_and_GTE_to_GT (Left _)  (Left y)  = y\nNEQ_and_GTE_to_GT (Left x)  (Right y) = void (GT_not_EQ x y)\n\n||| `m >= n` implies `Not (m < n)`.\nexport\n0 GTE_not_LT : Total a lt => Either (lt n m) (n === m) -> Not (lt m n)\nGTE_not_LT = either GT_not_LT EQ_not_GT\n\n||| `Not (m >= n)` implies `m < n`.\nexport\n0 Not_GTE_to_LT : Total a lt => Not (Either (lt n m) (n === m)) -> lt m n\nNot_GTE_to_LT f = case trichotomy m n of\n  LT x _ _ => x\n  EQ _ x _ => void (f $ Right (sym x))\n  GT _ _ x => void (f $ Left x)\n\n||| `m >= n` and `m <= n` implies `m === n`.\nexport\n0 GTE_and_LTE_to_EQ :  Total a lt\n                    => Either (lt n m) (n === m)\n                    -> Either (lt m n) (m === n)\n                    -> m === n\nGTE_and_LTE_to_EQ = flip LTE_and_GTE_to_EQ\n\n||| `m >= n` and `m /= n` implies `m > n`.\nexport\n0 GTE_and_NEQ_to_GT :  Total a lt\n                    => Either (lt n m) (n === m)\n                    -> Either (lt m n) (lt n m)\n                    -> lt n m\nGTE_and_NEQ_to_GT = flip NEQ_and_GTE_to_GT\n", "meta": {"hexsha": "26c0ac518b45d6a97e513d65d664b130ecaee1a8", "size": 13251, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Prim/Ord.idr", "max_stars_repo_name": "stefan-hoeck/idris2-prim", "max_stars_repo_head_hexsha": "d342072f3b30f7930221bab620a836e0e67c2374", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2022-03-13T22:37:25.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T22:22:30.000Z", "max_issues_repo_path": "src/Data/Prim/Ord.idr", "max_issues_repo_name": "stefan-hoeck/idris2-prim", "max_issues_repo_head_hexsha": "d342072f3b30f7930221bab620a836e0e67c2374", "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/Data/Prim/Ord.idr", "max_forks_repo_name": "stefan-hoeck/idris2-prim", "max_forks_repo_head_hexsha": "d342072f3b30f7930221bab620a836e0e67c2374", "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": 31.9301204819, "max_line_length": 80, "alphanum_fraction": 0.5087163233, "num_tokens": 4515, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7931059511841119, "lm_q2_score": 0.6442250928250375, "lm_q1q2_score": 0.5109387550216741}}
{"text": "-- Primitive Imperative Language --\nmodule Example.Pil\n\nimport Data.List\nimport Data.List.Elem\nimport Data.Maybe\n\n%default total\n\n------------------------------------------------------\n--- Auxiliary data definitions and their instances ---\n------------------------------------------------------\n\nexport\ndata Name = MkName String\n\n%name Name n, m\n\nexport\nFromString Name where\n  fromString = MkName\n\nexport\nEq Name where\n  MkName n == MkName m = n == m\n\n--- Static context in terms of which we are formulating an invariant ---\n\npublic export\nContext : Type\nContext = List (Name, Type)\n\n%name Context ctx\n\n-----------------------------------------------\n--- List lookup with propositional equality ---\n-----------------------------------------------\n\npublic export\ndata Lookup : a -> List (a, b) -> Type where\n  There : Lookup z xys -> Lookup z $ (x, y)::xys\n  Here : (y : b) -> Lookup x $ (x, y)::xys\n  -- !!! Idris searches from the bottom !!!\n\npublic export\nreveal : Lookup {b} x xys -> b\nreveal (Here y) = y\nreveal (There subl) = reveal subl\n\n-----------------------------------\n--- The main language structure ---\n-----------------------------------\n\npublic export\ndata Expression : (ctx : Context) -> (res : Type) -> Type where\n  -- Constant expression\n  C : (x : ty) -> Expression ctx ty\n  -- Value of the variable\n  V : (n : Name) -> (0 ty : Lookup n ctx) => Expression ctx $ reveal ty\n  -- Unary operation over the result of another expression\n  U : (f : a -> b) -> Expression ctx a -> Expression ctx b\n  -- Binary operation over the results of two another expressions\n  B : (f : a -> b -> c) -> Expression ctx a -> Expression ctx b -> Expression ctx c\n\ninfix 2 #=, ?#=\ninfixr 1 *>\n\npublic export\ndata Statement : (pre : Context) -> (post : Context) -> Type where\n  nop  : Statement ctx ctx\n  (.)  : (0 ty : Type) -> (n : Name) -> Statement ctx $ (n, ty)::ctx\n  (#=) : (n : Name) -> (0 ty : Lookup n ctx) => (v : Expression ctx $ reveal ty) -> Statement ctx ctx\n  for  : (init : Statement outer_ctx inside_for)  -> (cond : Expression inside_for Bool)\n      -> (upd  : Statement inside_for inside_for) -> (body : Statement inside_for after_body)\n      -> Statement outer_ctx outer_ctx\n  if__ : (cond : Expression ctx Bool) -> Statement ctx ctx_then -> Statement ctx ctx_else -> Statement ctx ctx\n  (*>) : Statement pre mid -> Statement mid post -> Statement pre post\n  block : Statement outer inside -> Statement outer outer\n  print : Show ty => Expression ctx ty -> Statement ctx ctx\n\npublic export %inline\n(>>=) : Statement pre mid -> (Unit -> Statement mid post) -> Statement pre post\na >>= f = a *> f ()\n\npublic export %inline\nif_  : (cond : Expression ctx Bool) -> Statement ctx ctx_then -> Statement ctx ctx\nif_ c t = if__ c t nop\n\npublic export %inline\nwhile : Expression ctx Bool -> Statement ctx after_body -> Statement ctx ctx\nwhile cond = for nop cond nop\n\n-- Define with derived type and assign immediately\npublic export %inline\n(?#=) : (n : Name) -> Expression ((n, ty)::ctx) ty -> Statement ctx $ (n, ty)::ctx\nn ?#= v = ty. n *> n #= v\n\nnamespace AlternativeDefineAndAssign\n\n  public export %inline\n  (#=) : (p : (Name, Type)) -> Expression (p::ctx) (snd p) -> Statement ctx $ p::ctx\n  (n, _) #= v = n ?#= v\n\n  public export %inline\n  (.) : a -> b -> (b, a)\n  (.) a b = (b, a)\n\n-------------------------\n--- Examples of usage ---\n-------------------------\n\n--- Functions lifted to the expression level ---\n\nexport %inline\n(+) : Expression ctx Int -> Expression ctx Int -> Expression ctx Int\n(+) = B (+)\n\nexport %inline\ndiv : Expression ctx Int -> Expression ctx Int -> Expression ctx Int\ndiv = B div\n\nexport %inline\nmod : Expression ctx Int -> Expression ctx Int -> Expression ctx Int\nmod = B mod\n\nexport %inline\n(<) : Expression ctx Int -> Expression ctx Int -> Expression ctx Bool\n(<) = B (<)\n\nexport %inline\n(>) : Expression ctx Int -> Expression ctx Int -> Expression ctx Bool\n(>) = B (>)\n\nexport %inline\n(==) : Eq a => Expression ctx a -> Expression ctx a -> Expression ctx Bool\n(==) = B (==)\n\nexport %inline\n(/=) : Eq a => Expression ctx a -> Expression ctx a -> Expression ctx Bool\n(/=) = B (/=)\n\nexport %inline\n(&&) : Expression ctx Bool -> Expression ctx Bool -> Expression ctx Bool\n(&&) = B (\\a, b => a && b) -- recoded because of laziness\n\nexport %inline\n(++) : Expression ctx String -> Expression ctx String -> Expression ctx String\n(++) = B (++)\n\nexport %inline\nshow : Show ty => Expression ctx ty -> Expression ctx String\nshow = U show\n\n--- Example statements ---\n\nsimple_ass : Statement ctx $ (\"x\", Int)::ctx\nsimple_ass = do\n  Int. \"x\"\n  \"x\" #= C 2\n\nlost_block : Statement ctx ctx\nlost_block = do\n  block $ do\n    Int. \"x\"\n    \"x\" #= C 2\n    Int. \"y\" #= V \"x\"\n    Int. \"z\" #= C 3\n    print $ V \"y\" + V \"z\" + V \"x\"\n\nsome_for : Statement ctx ctx\nsome_for = for (do Int. \"x\" #= C 0; Int. \"y\" #= C 0) (V \"x\" < C 5 && V \"y\" < C 10) (\"x\" #= V \"x\" + C 1) $ do\n             \"y\" #= V \"y\" + V \"x\" + C 1\n\n--bad_for : Statement ctx ctx\n--bad_for = for (do Int. \"x\" #= C 0; Int. \"y\" #= C 0)\n--                (V \"y\")\n--                  (\"x\" #= V \"x\" + C 1) $ do\n--             \"y\" #= V \"y\" `div` V \"x\" + C 1\n\neuc : {0 ctx : Context} -> let c = (\"a\", Int)::(\"b\", Int)::ctx in Statement c $ (\"res\", Int)::c\neuc = do\n  while (V \"a\" /= C 0 && V \"b\" /= C 0) $ do\n    if__ (V \"a\" > V \"b\")\n      (\"a\" #= V \"a\" `mod` V \"b\")\n      (\"b\" #= V \"b\" `mod` V \"a\")\n  Int. \"res\" #= V \"a\" + V \"b\"\n\nname_shadowing : Statement ctx ctx\nname_shadowing = block $ do\n  Int. \"x\" #= C 0\n  block $ do\n    Int. \"x\" #= C 3\n    Int. \"y\" #= V \"x\" + C 2\n    String. \"x\" #= C \"foo\"\n    print $ V \"x\" ++ C \"bar\" ++ show (V \"y\")\n  Int. \"z\" #= V \"x\" + C 2\n", "meta": {"hexsha": "34db73ebdcb8c7961138e6317235618db4e51a36", "size": 5643, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil.idr", "max_stars_repo_name": "buzden/code-in-lectures", "max_stars_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-02-17T07:01:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-17T07:01:15.000Z", "max_issues_repo_path": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil.idr", "max_issues_repo_name": "buzden/code-in-lectures", "max_issues_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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": "2020.11.24-to-complex-data-gen-presentation/src/Example/Pil.idr", "max_forks_repo_name": "buzden/code-in-lectures", "max_forks_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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.6446700508, "max_line_length": 110, "alphanum_fraction": 0.5619351409, "num_tokens": 1676, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7634837635542924, "lm_q2_score": 0.6688802471698041, "lm_q1q2_score": 0.5106792084763273}}
{"text": "module Main\nimport Lib\nimport Prelude.List as lst\nimport Data.List\n\ndataset : List String\ndataset = [ \"The future king is the prince\", \n--           \"Daughter is the princess.\",\n--           \"Son is the prince.\",\n--           \"Only a man can be a king\",\n--           \"Only a woman can be a queen\",\n--           \"The princess will be a queen\",\n--           \"Queen and king rule the realm\",\n--           \"The prince is a strong man\",\n--           \"The princess is a beautiful woman\",\n--           \"The royal family is the king and queen and their children\",\n--           \"Prince is only a boy now\",\n           \"A boy will be a man\"]\n\nindex : String -> List (String, Nat) ->  Nat\nindex x dict = (\\(Just i) => i ) $ lookup x dict\n\nget_indices : List String -> List (String,Nat) -> List Nat\nget_indices vocabs dict = foldr (\\x, acc => (index x  dict)::acc) [] vocabs\n\nzeros : List String -> List (String, Nat) -> List Double\nzeros vocabs dict = replicate ( lst.length $ get_indices vocabs dict ) 0\n\ncleaned : List String\ncleaned = rawToCleaned dataset\n\npaired : List (String, String)\npaired = makeWordPairs cleaned\n\ndict : List (String,Nat)\ndict = createDictionary cleaned\n\ninput : List String\ninput = xss paired\n\ntarget : List String\ntarget = yss paired\n\nzs : List Double\nzs = zeros cleaned dict\n\nran_wht : List Double\nran_wht = replicate (length $ get_indices input dict) 0.06\n\nxss_index : List Nat\nxss_index = get_indices input dict\n\nyss_index : List Nat\nyss_index = get_indices target dict\n\nweights : List (List Double)\nweights = matrix_gen ran_wht zs\n\nen_inputs : List (List Double)\nen_inputs = oneHotEncoder xss_index zs\n\nen_targets : List  (List Double)\nen_targets = oneHotEncoder yss_index zs\n\nbias : Double\nbias = 0.3\n\n-- TODO insertAt inserts extra zeros\nmain : IO ()\nmain = let classifier = model weights en_inputs en_targets 0.001 0.9 0.999 0.00000001 2\n       in print $ classifier\n\n", "meta": {"hexsha": "9d395461617f5caf6f70c575e06f85e77c7a384c", "size": 1891, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "experimental/ai-algorithms/NeuralNets/Main.idr", "max_stars_repo_name": "nunet-io/ai-dsl", "max_stars_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2021-02-17T08:02:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-03T12:52:29.000Z", "max_issues_repo_path": "experimental/ai-algorithms/NeuralNets/Main.idr", "max_issues_repo_name": "nunet-io/ai-dsl", "max_issues_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 15, "max_issues_repo_issues_event_min_datetime": "2021-03-04T10:33:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-16T04:55:50.000Z", "max_forks_repo_path": "experimental/ai-algorithms/NeuralNets/Main.idr", "max_forks_repo_name": "nunet-io/ai-dsl", "max_forks_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2021-02-19T07:58:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-28T18:37:13.000Z", "avg_line_length": 25.904109589, "max_line_length": 87, "alphanum_fraction": 0.6689582232, "num_tokens": 502, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8615382165412809, "lm_q2_score": 0.5926665999540698, "lm_q1q2_score": 0.5106049255280141}}
{"text": "module Data.List.Quantifiers\n\nimport Data.DPair\n\nimport Data.List.Elem\n\n%default total\n\n------------------------------------------------------------------------\n-- Types and basic properties\n\nnamespace Any\n\n  ||| A proof that some element of a list satisfies some property\n  |||\n  ||| @ p the property to be satisfied\n  public export\n  data Any : (0 p : a -> Type) -> List a -> Type where\n    ||| A proof that the satisfying element is the first one in the `List`\n    Here  : {0 xs : List a} -> p x -> Any p (x :: xs)\n    ||| A proof that the satisfying element is in the tail of the `List`\n    There : {0 xs : List a} -> Any p xs -> Any p (x :: xs)\n\n  export\n  Uninhabited (Any p Nil) where\n    uninhabited (Here _) impossible\n    uninhabited (There _) impossible\n\n  export\n  {0 p : a -> Type} -> Uninhabited (p x) => Uninhabited (Any p xs) => Uninhabited (Any p $ x::xs) where\n    uninhabited (Here y) = uninhabited y\n    uninhabited (There y) = uninhabited y\n\n  ||| Modify the property given a pointwise function\n  export\n  mapProperty : (f : {0 x : a} -> p x -> q x) -> Any p l -> Any q l\n  mapProperty f (Here p) = Here (f p)\n  mapProperty f (There p) = There (mapProperty f p)\n\n  ||| Given a decision procedure for a property, determine if an element of a\n  ||| list satisfies it.\n  |||\n  ||| @ p the property to be satisfied\n  ||| @ dec the decision procedure\n  ||| @ xs the list to examine\n  export\n  any : (dec : (x : a) -> Dec (p x)) -> (xs : List a) -> Dec (Any p xs)\n  any _ Nil = No uninhabited\n  any p (x::xs) with (p x)\n    any p (x::xs) | Yes prf = Yes (Here prf)\n    any p (x::xs) | No ctra =\n      case any p xs of\n        Yes prf' => Yes (There prf')\n        No ctra' => No $ \\case\n          Here px => ctra px\n          There pxs => ctra' pxs\n\n  ||| Forget the membership proof\n  export\n  toExists : Any p xs -> Exists p\n  toExists (Here prf) = Evidence _ prf\n  toExists (There prf) = toExists prf\n\nnamespace All\n\n  ||| A proof that all elements of a list satisfy a property. It is a list of\n  ||| proofs, corresponding element-wise to the `List`.\n  public export\n  data All : (0 p : a -> Type) -> List a -> Type where\n    Nil  : All p Nil\n    (::) : {0 xs : List a} -> p x -> All p xs -> All p (x :: xs)\n\n  Either (Uninhabited $ p x) (Uninhabited $ All p xs) => Uninhabited (All p $ x::xs) where\n    uninhabited @{Left  _} (px::pxs) = uninhabited px\n    uninhabited @{Right _} (px::pxs) = uninhabited pxs\n\n  ||| Modify the property given a pointwise function\n  export\n  mapProperty : (f : {0 x : a} -> p x -> q x) -> All p l -> All q l\n  mapProperty f [] = []\n  mapProperty f (p::pl) = f p :: mapProperty f pl\n\n  ||| Modify the property given a pointwise interface function\n  public export\n  imapProperty : (0 i : Type -> Type)\n              -> (f : {0 a : Type} -> i a => p a -> q a)\n              -> {0 types : List Type}\n              -> All i types => All p types -> All q types\n  imapProperty i f @{[]} [] = []\n  imapProperty i f @{ix :: ixs} (x :: xs) = f @{ix} x :: imapProperty i f @{ixs} xs\n\n  ||| Forget property source for a homogeneous collection of properties\n  public export\n  forget : All (const type) types -> List type\n  forget [] = []\n  forget (x :: xs) = x :: forget xs\n\n  ||| Given a decision procedure for a property, decide whether all elements of\n  ||| a list satisfy it.\n  |||\n  ||| @ p the property\n  ||| @ dec the decision procedure\n  ||| @ xs the list to examine\n  export\n  all : (dec : (x : a) -> Dec (p x)) -> (xs : List a) -> Dec (All p xs)\n  all _ Nil = Yes Nil\n  all d (x::xs) with (d x)\n    all d (x::xs) | No ctra = No $ \\(p::_) => ctra p\n    all d (x::xs) | Yes prf =\n      case all d xs of\n        Yes prf' => Yes (prf :: prf')\n        No ctra' => No $ \\(_::ps) => ctra' ps\n\n  export\n  zipPropertyWith : (f : {0 x : a} -> p x -> q x -> r x) ->\n                    All p xs -> All q xs -> All r xs\n  zipPropertyWith f [] [] = []\n  zipPropertyWith f (px :: pxs) (qx :: qxs)\n    = f px qx :: zipPropertyWith f pxs qxs\n\n  export\n  All Show (map p xs) => Show (All p xs) where\n    show pxs = \"[\" ++ show' \"\" pxs ++ \"]\"\n      where\n        show' : String -> All Show (map p xs') => All p xs' -> String\n        show' acc @{[]} [] = acc\n        show' acc @{[_]} [px] = acc ++ show px\n        show' acc @{_ :: _} (px :: pxs) = show' (acc ++ show px ++ \", \") pxs\n\n  ||| A heterogeneous list of arbitrary types\n  public export\n  HList : List Type -> Type\n  HList = All id\n\n------------------------------------------------------------------------\n-- Relationship between all and any\n\n||| If there does not exist an element that satifies the property, then it is\n||| the case that all elements do not satisfy it.\nexport\nnegAnyAll : {xs : List a} -> Not (Any p xs) -> All (Not . p) xs\nnegAnyAll {xs=Nil}   _ = Nil\nnegAnyAll {xs=x::xs} f = (f . Here) :: negAnyAll (f . There)\n\n||| If there exists an element that doesn't satify the property, then it is\n||| not the case that all elements satisfy it.\nexport\nanyNegAll : Any (Not . p) xs -> Not (All p xs)\nanyNegAll (Here ctra) (p::_)  = ctra p\nanyNegAll (There np)  (_::ps) = anyNegAll np ps\n\n||| If none of the elements satisfy the property, then not any single one can.\nexport\nallNegAny : All (Not . p) xs -> Not (Any p xs)\nallNegAny [] p = absurd p\nallNegAny (np :: npxs) (Here p) = absurd (np p)\nallNegAny (np :: npxs) (There p) = allNegAny npxs p\n\n||| Given a proof of membership for some element, extract the property proof for it\npublic export\nindexAll : Elem x xs -> All p xs -> p x\nindexAll  Here     (p::_  ) = p\nindexAll (There e) ( _::ps) = indexAll e ps\n\n--- Relations between listwise `All` and elementwise `Subset` ---\n\n||| Push in the property from the list level with element level\npublic export\npushIn : (xs : List a) -> (0 _ : All p xs) -> List $ Subset a p\npushIn []      []      = []\npushIn (x::xs) (p::ps) = Element x p :: pushIn xs ps\n\n||| Pull the elementwise property out to the list level\npublic export\npullOut : (xs : List $ Subset a p) -> Subset (List a) (All p)\npullOut [] = Element [] []\npullOut (Element x p :: xs) = let Element ss ps = pullOut xs in Element (x::ss) (p::ps)\n\nexport\npushInOutInverse : (xs : List a) -> (0 prf : All p xs) -> pullOut (pushIn xs prf) = Element xs prf\npushInOutInverse [] [] = Refl\npushInOutInverse (x::xs) (p::ps) = rewrite pushInOutInverse xs ps in Refl\n\nexport\npushOutInInverse : (xs : List $ Subset a p) -> uncurry Quantifiers.pushIn (pullOut xs) = xs\npushOutInInverse [] = Refl\npushOutInInverse (Element x p :: xs) with (pushOutInInverse xs)\n  pushOutInInverse (Element x p :: xs) | subprf with (pullOut xs)\n    pushOutInInverse (Element x p :: xs) | subprf | Element ss ps = rewrite subprf in Refl\n", "meta": {"hexsha": "bb98c7aa45e91d1ae0891d10e249ab94c7350df2", "size": 6656, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/libs/base/Data/List/Quantifiers.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/libs/base/Data/List/Quantifiers.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/libs/base/Data/List/Quantifiers.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 35.0315789474, "max_line_length": 103, "alphanum_fraction": 0.5887920673, "num_tokens": 2103, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6926419831347362, "lm_q2_score": 0.7371581626286834, "lm_q1q2_score": 0.5105866916470897}}
{"text": "-- examples in \"Type-Driven Development with Idris\"\n-- chapter 13, section 2, Stack part\n\nimport Data.Vect\n\n-- check that all functions are total\n%default total\n\ndata StackCmd : Type -> Nat -> Nat -> Type where\n  Push : Integer -> StackCmd () height (S height)\n  Pop : StackCmd Integer (S height) height\n  Top : StackCmd Integer (S height) (S height)\n  GetStr : StackCmd String height height\n  PutStr : String -> StackCmd () height height\n  Pure : ty -> StackCmd ty s s\n  (>>=) : StackCmd a s1 s2 ->\n          (a -> StackCmd b s2 s3) ->\n          StackCmd b s1 s3\n\nrunStack : (stk : Vect inHeight Integer) ->\n           StackCmd ty inHeight outHeight ->\n           IO (ty, Vect outHeight Integer)\nrunStack stk (Push x) = pure ((), x :: stk)\nrunStack (x :: xs) Pop = pure (x, xs)\nrunStack (x :: xs) Top = pure (x, x :: xs)\nrunStack stk (Pure x) = pure (x, stk)\nrunStack stk (x >>= f) = do (res, stk') <- runStack stk x\n                            runStack stk' (f res)\nrunStack stk GetStr = do val <- getLine\n                         pure (val, stk)\nrunStack stk (PutStr val) = do putStr val\n                               pure ((), stk)\n\n\ndoAdd : StackCmd () (S (S height)) (S height)\ndoAdd = do val1 <- Pop\n           val2 <- Pop\n           Push $ val1 + val2\n\ndata StackIO : Nat -> Type where\n  Do : StackCmd a h1 h2 ->\n       (a -> Inf (StackIO h2)) -> StackIO h1\n\nnamespace StackDo\n  (>>=) : StackCmd a h1 h2 ->\n          (a -> Inf (StackIO h2)) -> StackIO h1\n  (>>=) = Do\n\ndata Fuel = Dry |\u00a0More (Lazy Fuel)\n\npartial\nforever : Fuel\nforever = More forever\n\nrun : Fuel -> Vect h Integer -> StackIO h -> IO ()\nrun (More fuel) stk (Do c f)\n  = do (res, stk') <- runStack stk c\n       run fuel stk' (f res)\nrun Dry stk p = pure ()\n\ndata StkInput = Number Integer\n              | Add\n\nstrToInput : String -> Maybe StkInput\nstrToInput \"\" = Nothing\nstrToInput \"add\" = Just Add\nstrToInput x = if all isDigit (unpack x)\n                then Just (Number (cast x))\n                else Nothing\n\nmutual\n  tryAdd : StackIO h\n  tryAdd {h = (S (S k))}\n    = do doAdd\n         result <- Top\n         PutStr (show result ++ \"\\n\")\n         stackCalc\n  tryAdd\n    = do PutStr \"Fewer than two items on the stack\\n\"\n         stackCalc\n\n  stackCalc : StackIO h\n  stackCalc = do PutStr \"> \"\n                 input <- GetStr\n                 case strToInput input of\n                   Nothing => do PutStr \"Invalid input\\n\"\n                                 stackCalc\n                   Just (Number x) => do Push x\n                                         stackCalc\n                   Just Add => tryAdd\n\npartial\nmain : IO ()\nmain = run forever [] stackCalc\n", "meta": {"hexsha": "c40e8508b50e3c718eb36328d5c672d7153dac55", "size": 2640, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "chapter13/StackIO.idr", "max_stars_repo_name": "pascalpoizat/idris-book", "max_stars_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2018-08-16T00:58:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T01:07:37.000Z", "max_issues_repo_path": "chapter13/StackIO.idr", "max_issues_repo_name": "pascalpoizat/idris-book", "max_issues_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "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": "chapter13/StackIO.idr", "max_forks_repo_name": "pascalpoizat/idris-book", "max_forks_repo_head_hexsha": "f1ef0ed0a8b8c1690d7ce65258f04322b37ff956", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-23T03:15:39.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-23T03:15:39.000Z", "avg_line_length": 27.7894736842, "max_line_length": 57, "alphanum_fraction": 0.5492424242, "num_tokens": 743, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8104789269812082, "lm_q2_score": 0.6297746213017459, "lm_q1q2_score": 0.5104190593126358}}
{"text": "module Main\n\nimport Debug.Trace\n\n{- Image -}\n\nimageWidth : Nat\nimageWidth = 256\n\nimageHeight : Nat\nimageHeight = 256\n\n{- Render -}\n\nmain : IO ()\nmain =\n  do\n    _ <- fPutStr stdout $ \"P3\\n\" ++ (show imageWidth) ++ \" \" ++ (show imageHeight) ++ \"\\n255\\n\"\n    _ <- renderRows imageHeight\n    pure ()\n\n  where\n\n    renderCells : (i : Nat) -> (j : Nat) -> IO (Either FileError ())\n    renderCells Z _ = pure (Right ())\n    renderCells (S i) j = do\n      let i' : Nat = minus imageWidth (i + 1)\n      let r : Double = (cast i') / (cast (minus imageWidth 1))\n      let g : Double = (cast j) / (cast (minus imageHeight 1))\n      let b : Double = 0.25\n\n      let ir : Int = cast (255.99 * r)\n      let ig : Int = cast (255.99 * g)\n      let ib : Int = cast (255.99 * b)\n\n      _ <- fPutStrLn stdout $ (show ir) ++ \" \" ++ (show ig) ++ \" \" ++ (show ib)\n\n      renderCells i j\n\n    renderRows : (j : Nat) -> IO (Either FileError ())\n    renderRows Z = pure (Right ())\n    renderRows (S j) = do\n      _ <- trace (\"Scanlines remaining: \" ++ (show (j + 1))) $ pure ()\n      _ <- renderCells imageWidth j\n      renderRows j\n", "meta": {"hexsha": "86ccb3bd4f47056bf0558334bca2974e2757f064", "size": 1108, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "book1/src/Main.idr", "max_stars_repo_name": "witt3rd/idris-ray", "max_stars_repo_head_hexsha": "a61704e08f8afc7a6379067a87c0cc9e64c6d2e8", "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": "book1/src/Main.idr", "max_issues_repo_name": "witt3rd/idris-ray", "max_issues_repo_head_hexsha": "a61704e08f8afc7a6379067a87c0cc9e64c6d2e8", "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": "book1/src/Main.idr", "max_forks_repo_name": "witt3rd/idris-ray", "max_forks_repo_head_hexsha": "a61704e08f8afc7a6379067a87c0cc9e64c6d2e8", "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": 24.0869565217, "max_line_length": 95, "alphanum_fraction": 0.5424187726, "num_tokens": 351, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8104788903594354, "lm_q2_score": 0.6297745935070806, "lm_q1q2_score": 0.5104190137221832}}
{"text": "module Main\n\nimport System\n\nreadNum : IO (Maybe Nat)\nreadNum = do\n  input <- getLine\n  let output =  if all isDigit (unpack input)\n    then (Just (cast input))\n    else Nothing\n  pure output\n\ntakeGuess : (target : Nat) -> IO (Maybe Ordering)\ntakeGuess target = do\n  Just g <- readNum\n    | Nothing => pure Nothing\n  pure (Just (compare g target))\n\nguess : (target : Nat) -> (guesses : Nat) -> IO ()\nguess target guesses = do\n  putStr ((show guesses) ++ \": Guess? \")\n  result <- takeGuess target\n  case result of\n    Just EQ => putStrLn \"Got it!\"\n    Nothing => putStrLn \"Invalid Number\" >>= \\_ => guess target (S guesses)\n    Just LT => putStrLn \"Too Low\" >>= \\_ => guess target (S guesses)\n    Just GT => putStrLn \"Too High\" >>= \\_ => guess target (S guesses)\n\nmain : IO ()\nmain = do\n  t <- time\n  let target = mod t 100\n  guess (cast target) Z\n", "meta": {"hexsha": "a180922145b95d3647dcc26c3ac5874a1c5afa93", "size": 846, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter-05/guess.idr", "max_stars_repo_name": "tekerson/type-driven-development", "max_stars_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-10-23T04:46:42.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-23T04:46:42.000Z", "max_issues_repo_path": "Chapter-05/guess.idr", "max_issues_repo_name": "tekerson/type-driven-development", "max_issues_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter-05/guess.idr", "max_forks_repo_name": "tekerson/type-driven-development", "max_forks_repo_head_hexsha": "52f1cf8dddd90c3306e8ded109bc4a3eff03b1b1", "max_forks_repo_licenses": ["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.8823529412, "max_line_length": 75, "alphanum_fraction": 0.6264775414, "num_tokens": 239, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8198933359135361, "lm_q2_score": 0.6224593312018545, "lm_q1q2_score": 0.5103502575295971}}
{"text": "1 f : (1 _ : Nat) -> Nat\nf x = S x -- + 1 -- !! Wow, `+` is not linear! I can't use it here!\n\ng : Nat -> Nat\ng x = f x\n\nh : Nat -> Nat\nh x = let fx = f x in ?foo -- fx is linear because the whole function is!\n\n--- Passing the functions ---\n\n-- Like `f` but without `1` quantity on the whole function.\nf' : (1 _ : Nat) -> Nat\nf' x = S x\n\nfi : (1 f : (1 _ : Nat) -> Nat) -> Nat -> Nat\nfi f x = let fx = f x in fx -- ?foo_fi -- fx is linear like above\n\nfi_f : Nat -> Nat\nfi_f = fi f\n\nfi_f' : Nat -> Nat\nfi_f' = fi f'\n\nfj : (f : (1 _ : Nat) -> Nat) -> Nat -> Nat\nfj f x = let fx = f x in ?foo_fj -- fx is NOT linear\n\nfj_f' : Nat -> Nat\nfj_f' = fj f'\n\nuseTwice : Nat -> Nat -> Nat\nuseTwice x y = let fx = f x\n                   fy = f y\n                   xx = f\n               in ?foo_twice\n\nfj_f : Nat -> Nat\nfj_f = fj ?foo_f -- if we try `f` here, we get \"trying to use f in non-linear context\"\n\n------\n\nlocal : Nat -> Nat\nlocal x = let 1 foj : (1 _ : Nat) -> Nat\n              foj x = S x in\n          let 1 foy : (1 _ : Nat) -> Nat\n              foy = foj in\n          --let 1 fox = foj in\n          x\n  where\n    1 foo : (1 _ : Nat) -> Nat\n    foo x = S x\n", "meta": {"hexsha": "37970b36c9ee2deaed9ff6de5112e7e05e7118e0", "size": 1157, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Functon1.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "Functon1.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "Functon1.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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.25, "max_line_length": 86, "alphanum_fraction": 0.4848746759, "num_tokens": 421, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8056321889812554, "lm_q2_score": 0.6334102775181399, "lm_q1q2_score": 0.5102957084001636}}
{"text": "-- This test ensures that implicits bound on the RHS of a\n-- record update field are correctly bound by the compiler.\n\n\nrecord Rec where\n    n : Nat\n\n\ndata T : Rec -> Type where\n    C : T ({ n := Z } r)\n\n\ndata U : Rec -> Type where\n    D : U ({ n $= S } r)\n", "meta": {"hexsha": "8782a6cb2e0adcd8235c6604cdb5222c48021660", "size": 257, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/record010/record.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/tests/idris2/record010/record.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/tests/idris2/record010/record.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 17.1333333333, "max_line_length": 59, "alphanum_fraction": 0.5953307393, "num_tokens": 73, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8056321796478255, "lm_q2_score": 0.6334102636778401, "lm_q1q2_score": 0.5102956913380823}}
{"text": "> module Ordering.Properties\n\n> %default total\n> %access public export\n> %auto_implicits on\n\n\n> |||\n> Uninhabited (LT = EQ) where                                                                                               \n>   uninhabited Refl impossible\n\n> |||\n> Uninhabited (Prelude.Interfaces.LT = GT) where\n>   uninhabited Refl impossible\n\n> |||\n> Uninhabited (EQ = GT) where\n>   uninhabited Refl impossible\n\n> |||\n> Uninhabited (EQ = LT) where\n>   uninhabited Refl impossible\n\n> |||\n> Uninhabited (Prelude.Interfaces.GT = LT) where\n>   uninhabited Refl impossible\n\n> |||\n> Uninhabited (GT = EQ) where\n>   uninhabited Refl impossible\n\n", "meta": {"hexsha": "9014e02b41f0334796245e763d6fe7fc33dc08c4", "size": 641, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "Ordering/Properties.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Ordering/Properties.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "Ordering/Properties.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": 20.03125, "max_line_length": 124, "alphanum_fraction": 0.5834633385, "num_tokens": 177, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7826624789529375, "lm_q2_score": 0.6513548646660542, "lm_q1q2_score": 0.5097910130575891}}
{"text": "module Control.Comonad.Store.Store\n\nimport Control.Comonad\nimport Control.Comonad.Trans\nimport Control.Monad.Identity\n\n%default total\n\npublic export\nrecord StoreT (s : Type) (w : Type -> Type) (a : Type) where\n  constructor MkStoreT\n  run : w (s -> a)\n  val : s\n\npublic export\nStore : (s : Type) -> (a : Type) -> Type\nStore s = StoreT s Identity\n\n||| Create a Store using an accessor function and a stored value\npublic export\nstore : (s -> a) -> s -> Store s a\nstore f s = MkStoreT (Id f) s\n\npublic export\nrunStore : Store s a -> (s -> a, s)\nrunStore (MkStoreT (Id f) s) = (f, s)\n\npublic export\nrunStoreT : StoreT s w a -> (w (s -> a), s)\nrunStoreT (MkStoreT wf s) = (wf, s)\n\n--------------------------------------------------------------------------------\n--          Interface Implementations\n--------------------------------------------------------------------------------\n\npublic export\nFunctor w => Functor (StoreT s w) where\n  map f = record { run $= map (f .) }\n\nappEnv : (s -> a -> b) -> (s -> a) -> s -> b\nappEnv ff fa s = ff s (fa s)\n\npublic export\n(Monoid s, Applicative w) => Applicative (StoreT s w) where\n  pure a = MkStoreT (pure $ const a) neutral\n  MkStoreT f m <*> MkStoreT a n = MkStoreT [| appEnv f a |]  (m <+> n)\n\npublic export\nComonad w => Comonad (StoreT s w) where\n  extract (MkStoreT wf s)   = extract wf s\n  duplicate (MkStoreT wf s) = MkStoreT (extend MkStoreT wf) s\n  extend f (MkStoreT wf s)  =\n    MkStoreT (extend (\\wf',s' => f (MkStoreT wf' s')) wf) s\n\npublic export\nComonadTrans (StoreT s) where\n  lower (MkStoreT f s) = map ($ s) f\n\npublic export\n(ComonadApply w, Semigroup s) => ComonadApply (StoreT s w) where\n  MkStoreT f m <@> MkStoreT a n = MkStoreT (map appEnv f <@> a) (m <+> n)\n", "meta": {"hexsha": "f2b4bc19750def41a7e2f3ce10093dbc5248ea11", "size": 1721, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Control/Comonad/Store/Store.idr", "max_stars_repo_name": "pnotequalnp/idris2-comonad", "max_stars_repo_head_hexsha": "a81d5ae244dc6e36e36093b033f11878e59b3dd9", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2021-01-26T16:55:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-30T19:25:02.000Z", "max_issues_repo_path": "src/Control/Comonad/Store/Store.idr", "max_issues_repo_name": "pnotequalnp/idris2-comonad", "max_issues_repo_head_hexsha": "a81d5ae244dc6e36e36093b033f11878e59b3dd9", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-28T09:56:38.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-28T09:56:38.000Z", "max_forks_repo_path": "src/Control/Comonad/Store/Store.idr", "max_forks_repo_name": "pnotequalnp/idris2-comonad", "max_forks_repo_head_hexsha": "a81d5ae244dc6e36e36093b033f11878e59b3dd9", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-27T16:09:14.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-27T16:09:14.000Z", "avg_line_length": 27.7580645161, "max_line_length": 80, "alphanum_fraction": 0.5816385822, "num_tokens": 552, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7826624789529376, "lm_q2_score": 0.6513548646660542, "lm_q1q2_score": 0.5097910130575891}}
{"text": "||| Spec: https://webassembly.github.io/spec/core/syntax/modules.html#element-segments\nmodule WebAssembly.Structure.Modules.ElementSegments\n\nimport WebAssembly.Structure.Types\nimport WebAssembly.Structure.Instructions\nimport WebAssembly.Structure.Modules.Indices\n\nimport Decidable.Equality\n\n-- Definition\n\npublic export\nrecord Elem where\n  constructor MkElem\n  table   : TableIdx\n  offset : Expr\n  init   : List FuncIdx\n\n-- Equality\n\ntotal public export\nlemma_elem__table_injective : ((t1 = t2) -> Void) -> (MkElem t1 o1 i1 = MkElem t2 o2 i2) -> Void\nlemma_elem__table_injective t1_not_t2 Refl = t1_not_t2 Refl\n\ntotal public export\nlemma_elem__offset_injective : ((o1 = o2) -> Void) -> (MkElem t1 o1 i1 = MkElem t2 o2 i2) -> Void\nlemma_elem__offset_injective o1_not_o2 Refl = o1_not_o2 Refl\n\ntotal public export\nlemma_elem__init_injective : ((i1 = i2) -> Void) -> (MkElem t1 o1 i1 = MkElem t2 o2 i2) -> Void\nlemma_elem__init_injective i1_not_i2 Refl = i1_not_i2 Refl\n\n-- Dedidable Equality\n\npublic export\nimplementation DecEq Elem where\n  decEq (MkElem t1 o1 i1) (MkElem t2 o2 i2) = case decEq t1 t2 of\n    No t1_not_t2 => No $ lemma_elem__table_injective t1_not_t2\n    Yes Refl     => case decEq o1 o2 of\n      No o1_not_o2 => No $ lemma_elem__offset_injective o1_not_o2\n      Yes Refl     => case decEq i1 i2 of\n        No i1_not_i2 => No $ lemma_elem__init_injective i1_not_i2\n        Yes Refl     => Yes Refl\n", "meta": {"hexsha": "8ccc57cff8dd4bd0b0499c9ee0fb8b6ea542ae36", "size": 1413, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "WebAssembly/Structure/Modules/ElementSegments.idr", "max_stars_repo_name": "RaoulSchaffranek/idris-webassembly", "max_stars_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-11-07T16:03:42.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-07T16:03:42.000Z", "max_issues_repo_path": "WebAssembly/Structure/Modules/ElementSegments.idr", "max_issues_repo_name": "RaoulSchaffranek/idris-webassembly", "max_issues_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "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": "WebAssembly/Structure/Modules/ElementSegments.idr", "max_forks_repo_name": "RaoulSchaffranek/idris-webassembly", "max_forks_repo_head_hexsha": "ce77f5a5b612aad85eefe2374d22456d7d1edbb5", "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": 32.1136363636, "max_line_length": 97, "alphanum_fraction": 0.7452229299, "num_tokens": 454, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7826624890918019, "lm_q2_score": 0.6513548511303338, "lm_q1q2_score": 0.5097910090676872}}
{"text": "module TestIntegers\n\nimport Data.Bits\nimport Data.List.Quantifiers\n\nput : Show a => a -> IO ()\nput = putStrLn . show\n\ncastAllTo : (to : Type)\n         -> {0 types : List Type}\n         -> All (flip Cast to) types => HList types -> List to\ncastAllTo to = forget . imapProperty (flip Cast to) (cast {to})\n\ninterface Num a => Bits a => SomeBits a where\n    one : Index {a}\n\nSomeBits Bits8 where\n    one = fromNat 1\n\nSomeBits Bits16 where\n    one = fromNat 1\n\nSomeBits Bits32 where\n    one = fromNat 1\n\nSomeBits Bits64 where\n    one = fromNat 1\n\nSomeBits Int8 where\n    one = fromNat 1\n\nSomeBits Int16 where\n    one = fromNat 1\n\nSomeBits Int32 where\n    one = fromNat 1\n\nSomeBits Int64 where\n    one = fromNat 1\n\nSomeBits Int where\n    one = fromNat 1\n\nSomeBits Integer where\n    one = 1\n\ninterface Num a => Ord a => NumOrd a where\n\nNum a => Ord a => NumOrd a where\n\nmain : IO ()\nmain = do\n    let ints = the (HList _) [\n        the Bits8 0, -- Bits8 min\n        the Bits8 50,\n        the Bits8 255, -- Bits8 max\n        the Bits16 0, -- Bits16 min\n        the Bits16 10000,\n        the Bits16 65535, -- Bits16 max\n        the Bits32 0, -- Bits32 min\n        the Bits32 1000000000,\n        the Bits32 4294967295, -- Bits32 max\n        the Bits64 0, -- Bits64 min\n        the Bits64 5000000000000000000,\n        the Bits64 18446744073709551615, -- Bits64 max\n        the Int8 $ -128, -- Int8 min\n        the Int8 50,\n        the Int8 127, -- Int8 max\n        the Int16 $ -32768, -- Int16 min\n        the Int16 10000,\n        the Int16 32767, -- Int16 max\n        the Int32 $ -2147483648, -- Int32 min\n        the Int32 500000000,\n        the Int32 2147483647, -- Int32 max\n        the Int64 $ -9223372036854775808, -- Int64 min\n        the Int64 1000000000000000000,\n        the Int64 9223372036854775807, -- Int64 max\n        the Int $ -9223372036854775808, -- Int min\n        the Int 1000000000000000000,\n        the Int 9223372036854775807, -- Int max\n        the Integer $ -9223372036854775809, -- Int min - 1\n        the Integer 0,\n        the Integer 9223372036854775808 -- Int max + 1\n    ]\n\n    putStrLn \"Cast to String:\"\n    put ints\n\n    putStrLn \"Cast to Bits8:\"\n    put $ castAllTo Bits8 ints\n\n    putStrLn \"Cast to Bits16:\"\n    put $ castAllTo Bits16 ints\n\n    putStrLn \"Cast to Bits32:\"\n    put $ castAllTo Bits32 ints\n\n    putStrLn \"Cast to Bits64:\"\n    put $ castAllTo Bits64 ints\n\n    putStrLn \"Cast to Int:\"\n    put $ castAllTo Int ints\n\n    putStrLn \"Cast to Integer:\"\n    put $ castAllTo Integer ints\n\n    putStrLn \"Add:\"\n    put $ imapProperty Num (+ 1) ints\n\n    putStrLn \"Subtract:\"\n    put $ imapProperty Neg (flip (-) 1) ints\n\n    putStrLn \"Negate:\"\n    put $ imapProperty Neg negate ints\n\n    putStrLn \"Multiply:\"\n    put $ imapProperty Num (* 2) ints\n\n--    putStrLn \"Divide:\"\n--    put $ imapProperty Integral (`div` 3) ints\n--    put $ imapProperty Integral (`div` -3) ints\n--\n--    putStrLn \"Mod:\"\n--    put $ imapProperty Integral (`mod` 17) ints\n--    put $ imapProperty Integral (`mod` -17) ints\n--\n--    putStrLn \"Division Euclidean:\"\n--    put $ imapProperty Integral (\\x => (x `div` 19) * 19 + (x `mod` 19)) ints\n--    put $ imapProperty Integral (\\x => (x `div` -19) * -19 + (x `mod` -19)) ints\n\n    putStrLn \"Shift:\"\n    put $ imapProperty SomeBits (`shiftL` one) ints\n    put $ imapProperty SomeBits (`shiftR` one) ints\n\n    putStrLn \"Bit Ops:\"\n    put $ imapProperty SomeBits (.&. 0xAA) ints\n    put $ imapProperty SomeBits (.|. 0xAA) ints\n    put $ imapProperty SomeBits (`xor` 0xAA) ints\n\n    putStrLn \"Comparisons:\"\n    put $ imapProperty NumOrd (< 0) ints\n    put $ imapProperty NumOrd (< 1) ints\n    put $ imapProperty NumOrd (> 0) ints\n    put $ imapProperty NumOrd (> 1) ints\n    put $ imapProperty NumOrd (== 0) ints\n    put $ imapProperty NumOrd (<= 0) ints\n    put $ imapProperty NumOrd (<= 1) ints\n    put $ imapProperty NumOrd (>= 0) ints\n    put $ imapProperty NumOrd (>= 1) ints\n", "meta": {"hexsha": "a85e2315e76284c394be69822b801607f924f333", "size": 3928, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/chez/integers/TestIntegers.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "tests/chez/integers/TestIntegers.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "tests/chez/integers/TestIntegers.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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.1866666667, "max_line_length": 82, "alphanum_fraction": 0.616089613, "num_tokens": 1222, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7956581000631542, "lm_q2_score": 0.6406358479787609, "lm_q1q2_score": 0.5097271016351286}}
{"text": "module Cordial.Model.Common.Label\n\n%default total\n%access public export\n\ndata LabelKind = ANY | NAMED | INDEXED\n\n||| Named labels for signals.\n|||\n||| @kind   The kind of label.\n||| @ty The type associated with each label.\ndata Label : (kind : LabelKind) -> (ty : Type) -> Type where\n  ||| Represents 'Any' label.\n  A : Label ANY ty\n  ||| Represents a 'Named' label.\n  N : ty -> Label NAMED ty\n  ||| Represents an indexed 'Named' label.\n  I : ty -> Nat -> Label INDEXED ty\n\nShow rTy => Show (Label kind rTy) where\n  show A       = \"any\"\n  show (N x)   = show x\n  show (I x k) = show x <+> \"_\" <+> show k\n", "meta": {"hexsha": "ccc838ffe528e89aad08cc39bc2a830312428cb7", "size": 604, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Cordial/Model/Common/Label.idr", "max_stars_repo_name": "border-patrol/cordial", "max_stars_repo_head_hexsha": "7d1d885f7cb2ab66878dc93042177e1043cb13de", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2020-01-12T23:36:38.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-13T07:09:42.000Z", "max_issues_repo_path": "src/Cordial/Model/Common/Label.idr", "max_issues_repo_name": "border-patrol/cordial", "max_issues_repo_head_hexsha": "7d1d885f7cb2ab66878dc93042177e1043cb13de", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "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/Cordial/Model/Common/Label.idr", "max_forks_repo_name": "border-patrol/cordial", "max_forks_repo_head_hexsha": "7d1d885f7cb2ab66878dc93042177e1043cb13de", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.1666666667, "max_line_length": 60, "alphanum_fraction": 0.619205298, "num_tokens": 186, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7154239957834734, "lm_q2_score": 0.7122321903471563, "lm_q1q2_score": 0.5095479995437779}}
{"text": "module GenericZipWith\n\nimport Data.Vect\n\nId : Type -> Type\nId x = x\n\nFunc : (args : Vect n Type) -> (ret : Type) -> (Type -> Type) -> Type\nFunc [] r f = f r\nFunc (x :: xs) r f = (a : f x) -> Func xs r f\n\ngApp : Applicative f => f (Func v r Id) -> Func v r f\ngApp {v = []} fs = fs\ngApp {v = (x :: xs)} fs = \\vs => gApp (fs <*> vs)\n\ngZipWith : Applicative f => Func v r Id -> Func v r f\ngZipWith {f} f' = gApp {f = f} (pure f')\n\nzipWith' : (a -> b -> c) -> Vect n a -> Vect n b -> Vect n c\nzipWith' f = gZipWith {v = [a, b]} f\n\nzipWith3' : (a -> b -> c -> d) -> Vect n a -> Vect n b -> Vect n c -> Vect n d\nzipWith3' f = gZipWith {v = [a, b, c]} f\n\nmap' : (a -> b) -> Vect n a -> Vect n b\nmap' f = gZipWith {v = [a]} f\n\nrepeat' : b -> Vect n b\nrepeat' b = gZipWith {v = []} b\n\nexample : Vect 2 (Int, Bool)\nexample = zipWith' (\\i, b => (i, b)) [1, 2] [True, False]\n", "meta": {"hexsha": "d311bcf21e991a2b95c6950abb8e68a093020e23", "size": 862, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/GenericZipWith.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/GenericZipWith.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/GenericZipWith.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 26.1212121212, "max_line_length": 78, "alphanum_fraction": 0.5162412993, "num_tokens": 350, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303186696747, "lm_q2_score": 0.6442251201477016, "lm_q1q2_score": 0.509279489525372}}
{"text": "ones : Stream Integer\nones = num :: ones\n  where\n    num : Integer -- gratuitous where for a regression test!\n    num = 1\n\nreadNat : IO Nat\nreadNat = pure $ -- sprinkle some IO to prevent inlining\n  case !getLine of\n    \"42\" => Z\n    _ => S (S (S (S Z)))\n\nmain : IO ()\nmain = do\n  n <- readNat\n  print (take n ones)\n", "meta": {"hexsha": "c331720ccd2972d90ef6fc6dcf7800e0910fcbe9", "size": 316, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/dart/lazy001/Lazy.idr", "max_stars_repo_name": "rafaelprev/idris2dart", "max_stars_repo_head_hexsha": "64509c6731d7d0963bd27be31d9d0c9ff15da08c", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 44, "max_stars_repo_stars_event_min_datetime": "2020-09-09T08:11:00.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-30T09:52:11.000Z", "max_issues_repo_path": "tests/dart/lazy001/Lazy.idr", "max_issues_repo_name": "rafaelprev/idris2dart", "max_issues_repo_head_hexsha": "64509c6731d7d0963bd27be31d9d0c9ff15da08c", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2020-09-17T03:43:02.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-14T19:11:06.000Z", "max_forks_repo_path": "tests/dart/lazy001/Lazy.idr", "max_forks_repo_name": "rafaelprev/idris2dart", "max_forks_repo_head_hexsha": "64509c6731d7d0963bd27be31d9d0c9ff15da08c", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2020-12-10T05:34:10.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-28T23:32:46.000Z", "avg_line_length": 18.5882352941, "max_line_length": 60, "alphanum_fraction": 0.6012658228, "num_tokens": 100, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7690802370707281, "lm_q2_score": 0.6619228691808011, "lm_q1q2_score": 0.5090717971521072}}
{"text": "module IntegerArith\n\nimport IntegerOrdering\nimport IntegerGroupTheory\n\n\n\n{-\nStrategy (<) type:\n\nTo handle case a (-a)\nautogen a type which is either a<b or a>b and a proof of it.\nmatch on the with of the generating function, so that you can have distinct cases of the inequality treated as creating different assumptions about the values a and b.\nuse this pattern matching structure in the definition of gcdBigInt itself.\nReflection shouldn't be needed, then, except maybe for gcdBigInt a 0.\n\nWe can implement this inequality type (which mirrors LTE for Nats) using recursion, even though we aren't given a fixed enumeration of Integer, because we have decEq.\n\n\tdecEq 5 3 = No ( _ 5 3 ) : Dec (5 = 3)\n\tdecEq 5 5 = Yes Refl : (5=5)\n\nAlthough actually, a case expression on (decEq a b) may be enough instead of a dependent pattern match, because the case matched on itself has a proof, and one might be able to reuse that...\n\n=======\n\nStrategy rewrite case argument:\n\nIf the function you're trying to prove matches an equality has a case expression or equivalent in it, we can show that the function can be computed by assuming this has a particular value, and thus when we can take the case expression outside the equality and the cases being matched on include a proof of something which determines the value of the case argument, we can apply a function using this proof to obtain a proof that the case argument is the required value.\n\nSo if our case argument is (decLT (a*b) 0) then we can get a\n\n\t(decLT (a*b) 0 = Yes pr)\n\nfrom the (Yes pr : DecLT (a*b) 0) that one is pattern matching on when trying to generate the equality of gcdBigInt with its definition, by a function which manually constructs the proof from (pr) if Refl won't be recognized.\n\nOnce that (decLT (a*b) 0 = Yes pr) is used to rewrite the case argument of the equality-with-definition generator from (decLT (a*b) 0) to one of the cases (Yes _) of the case expressions in the gcdBigInt definition, we should be able to use compute to collapse the case expression and obtain the desired equality.\n\n=======\n\nStrategy recursion:\n\ngcdBigInt can probably be reduced to a single case expression step followed by the usual gcd on nonnegative numbers, which by not having a case expression can be proved total just like gcd can. So gcdBigInt could be proved total simply by factorization.\n\n-}\n\n\n\n{-\n-- IntegerArith.gcdBigInt is possibly not total due to recursive path IntegerArith.gcdBigInt\n-- %reflection\ntotal\ngcdBigInt : Integer -> Integer -> Integer\ngcdBigInt a 0 = a\ngcdBigInt a b = if a*b<0 then gcdBigInt (abs a) (abs b) else assert_total (gcdBigInt b (modBigInt a b))\n-}\n\n{-\n-- IntegerArith.gcdBigInt is possibly not total due to: IntegerArith.case block in gcdBigInt\n\ntotal\ngcdBigInt : Integer -> Integer -> Integer\ngcdBigInt a 0 = a\ngcdBigInt a b = case ( decLT (a*b) 0 ) of\n\t\tYes pr => gcdBigInt (abs a) (abs b)\n\t\totherwise => gcdBigInt b (modBigInt a b)\n-}\n\n{-\n-- IntegerArith.gcdBigInt is possibly not total due to: with block in IntegerArith.gcdBigInt\n\ntotal\ngcdBigInt : Integer -> Integer -> Integer\ngcdBigInt a 0 = a\ngcdBigInt a b with ( decLT (a*b) 0 )\n\t| Yes pr = gcdBigInt (abs a) (abs b)\n\t| otherwise = gcdBigInt b (modBigInt a b)\n-}\n\n\n\n{-\n%reflection\ntotal\ngcdType : Integer -> Integer -> Type\ngcdType a 0 = ( gcdBigInt a 0 = a )\ngcdType a b with (decEq a (-b))\n\t| Yes pr = \n\t| No pr = \n-}\n{-\ngcdType a b = ( gcdBigInt a b = if a*b<0 then gcdBigInt (abs a) (abs b) else assert_total (gcdBigInt b (modBigInt a b)) )\n-}\n{-\ngcdType a b = if a*b<0 then ( gcdBigInt a b = gcdBigInt (abs a) (abs b) ) else ( gcdBigInt a b = gcdBigInt b (modBigInt a b) )\n-}\n\n{-\ngcddefBigInt : (a : Integer) -> (b : Integer) -> gcdType a b\ngcddefBigInt a 0 = Refl\ngcddefBigInt a b = if a*b<0 then the ( gcdBigInt a b = gcdBigInt (abs a) (abs b) ) gcddefBigIntZeroPr else gcddefBigIntPr -- believe_me \"by definition\"\n\twhere\n\t\tgcddefBigIntZeroPr = ?gcddefBigIntZeroPr'\n\t\tgcddefBigIntPr = ?gcddefBigIntPr'\n-}\n\n\n\ntotal\nmodBigInt_total : Integer -> Integer -> Integer\nmodBigInt_total a 0 = a\n-- This is wrong too, in fact (div 5 (-2) = -3), so not even close.\n-- I suspect we must define remainders as coset representatives or by long division.\nmodBigInt_total a b = a - div a b\n\n{-\nWould have said\n\n\tmodBigInt_total a b = prim__sremBigInt a b\n\nbut need to be able to prove modEqBigInt.\nIf we can't prove this, we might as well switch to a definition of div in.\n-}\nmodEqRem : (a : Integer) -> (b : Integer) -> (nzpr : Not (b=0)) -> (a - div a b = prim__sremBigInt a b)\n\n\n\n{-\nmodeqBigInt : (a : Integer) -> (b : Integer) -> (nzpr : Not (b=0))\n\t-> mod a b + (div (a - mod a b) b)*b = a\n-}\n\nmodeqBigInt : (a : Integer) -> (b : Integer) -> (nzpr : Not (b=0))\n\t-> modBigInt_total a b + (div (a - modBigInt_total a b) b)*b = a\nmodeqBigInt a b pr = ?modeqBigIntHole\n", "meta": {"hexsha": "ede6eb12cebddb54a73744a0fc76fecfeb64b450", "size": 4815, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "_Archive/OldGCDAttempts/IntegerArith.idr", "max_stars_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_stars_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2016-07-12T15:25:52.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-14T05:43:48.000Z", "max_issues_repo_path": "_Archive/OldGCDAttempts/IntegerArith.idr", "max_issues_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_issues_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": 16, "max_issues_repo_issues_event_min_datetime": "2016-06-10T02:31:24.000Z", "max_issues_repo_issues_event_max_datetime": "2018-01-07T16:16:50.000Z", "max_forks_repo_path": "_Archive/OldGCDAttempts/IntegerArith.idr", "max_forks_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_forks_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "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.6666666667, "max_line_length": 469, "alphanum_fraction": 0.7163032191, "num_tokens": 1356, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998508568416, "lm_q2_score": 0.6548947425132315, "lm_q1q2_score": 0.5090495856824646}}
{"text": "module Data.LeftPad\n\nimport Data.List\nimport Data.List.Predicates.Interleaving\n\n%default total\n%access public export\n\ndata Padding : (s : List Char) -> (target : Nat) -> Type where\n  Pad : (pad : Nat) -> Padding s (length s + pad)\n  Nop : Padding (ys ++ x :: xs) (length ys)\n\npadding : (s : List Char) -> (target : Nat) -> Padding s target\npadding       []     t  = Pad t\npadding (x :: xs)    Z  = Nop {ys = []}\npadding (x :: xs) (S t) with (padding xs t)\n  padding (x :: xs) (S (plus (length xs) p))   | Pad p = Pad p\n  padding (y :: ys ++ z :: zs) (S (length ys)) | Nop   = Nop {ys=y::ys}\n\npad : (s : List Char) -> (c : Char) -> (target : Nat) -> List Char\npad s c target with (padding s target)\n  pad s c (length s + pad)          | Pad pad  = replicate pad c ++ s\n  pad (ys ++ x :: xs) c (length ys) | Nop {ys} = ys ++ x :: xs\n\n\nnamespace MorePad\n  Pad : (s : List Char) -> (c : Char) -> (target : Nat) -> Type\n  Pad s c target with (padding s target)\n    Pad s c ((length s) + pad) | (Pad pad) = let ps = replicate pad c in Interleaving ps s (ps ++ s)\n\n    Pad (ys ++ (x :: xs)) c (length ys) | Nop = Interleaving Nil (ys ++ (x :: xs)) (ys ++ (x :: xs))\n\n  noPad : (s : List Char) -> Interleaving Nil s s\n  noPad [] = Empty\n  noPad (x :: xs) = RightAdd x (noPad xs)\n\n  addPadd : (pad : List Char) -> (s : List Char) -> Interleaving pad s (pad ++ s)\n  addPadd [] s = noPad s\n  addPadd (x :: xs) s = LeftAdd x (addPadd xs s)\n\n  pad : (s : List Char) -> (c : Char) -> (target : Nat) -> Pad s c target\n  pad s c target with (padding s target)\n    pad s c ((length s) + pad) | (Pad pad) = let ps = replicate pad c in addPadd ps s\n    pad (ys ++ (x :: xs)) c (length ys) | Nop = noPad (ys ++ (x::xs))\n", "meta": {"hexsha": "98d5b000402299129ed290d0c8bfb77b70cb170a", "size": 1700, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/LeftPad.idr", "max_stars_repo_name": "MarcelineVQ/idris-containers", "max_stars_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "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/LeftPad.idr", "max_issues_repo_name": "MarcelineVQ/idris-containers", "max_issues_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "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/LeftPad.idr", "max_forks_repo_name": "MarcelineVQ/idris-containers", "max_forks_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "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.7777777778, "max_line_length": 100, "alphanum_fraction": 0.5582352941, "num_tokens": 592, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998714925402, "lm_q2_score": 0.6548947155710233, "lm_q1q2_score": 0.5090495782545}}
{"text": "module Data.Vect.Extras\n\nimport Data.Vect\nimport Data.Vect.Views\n\n%default total\n%access export\n\n\n\nfoldrM :  Monad m => (func : elem -> acc -> m acc) -> (init : acc) -> (input : Vect n elem) -> m acc\nfoldrM func init input with (snocVect input)\n    foldrM _ init [] | Empty = pure init\n    foldrM func init (xs ++ [x]) | Snoc rec = foldrM func !(func x init) xs | rec\n\nmapM : Monad m => (func : elem -> m r) -> (input : Vect n elem) -> m (Vect n r)\nmapM = helper []\nwhere helper :  Monad m => Vect n r -> (elem -> m r) ->  Vect n' elem -> m (Vect (n + n') r)\n      helper {n} acc func [] =\n          rewrite plusZeroRightNeutral n in\n          pure acc\n      helper {n} {n' = S k} acc func (x :: xs) =\n          rewrite sym $ plusSuccRightSucc n k in\n          do helper (!(func x) :: acc) func xs\n", "meta": {"hexsha": "3e82abc15a6a20fc2872b29652f88570fef08c35", "size": 798, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Vect/Extras.idr", "max_stars_repo_name": "jheiling/idris-extras", "max_stars_repo_head_hexsha": "20e79087043ddb00301cdc3036964a2b1c5b1c5f", "max_stars_repo_licenses": ["Unlicense"], "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/Vect/Extras.idr", "max_issues_repo_name": "jheiling/idris-extras", "max_issues_repo_head_hexsha": "20e79087043ddb00301cdc3036964a2b1c5b1c5f", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2017-08-25T13:49:56.000Z", "max_issues_repo_issues_event_max_datetime": "2017-09-05T06:51:42.000Z", "max_forks_repo_path": "src/Data/Vect/Extras.idr", "max_forks_repo_name": "jheiling/idris-extras", "max_forks_repo_head_hexsha": "20e79087043ddb00301cdc3036964a2b1c5b1c5f", "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.92, "max_line_length": 100, "alphanum_fraction": 0.5739348371, "num_tokens": 255, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8128673269042767, "lm_q2_score": 0.6261241772283034, "lm_q1q2_score": 0.5089558862537106}}
{"text": "module Control.Monad.Indexed\n\nimport Control.Functor.Indexed\nimport Control.Applicative.Indexed\n\ninfixl 1 >>>=, =<<<, >>>, >>=>, <=<<\n\npublic export\ninterface IndexedApplicative z m => IndexedMonad z m | m where\n  total\n  bind : {0 i,j,k : z} -> m a i j -> (a -> m b j k) -> m b i k\n\n  total\n  join : {0 i,j,k : z} -> m (m a j k) i j -> m a i k\n\n  -- default implementations\n  bind x f = join (map f x)\n  join x = bind x id\n\npublic export\n(>>>=) : IndexedMonad z m => m a i j -> (a -> m b j k) -> m b i k\n(>>>=) = bind\n\n||| Flipped version of `>>>=`\npublic export\n(=<<<) : IndexedMonad z m => (a -> m b j k) -> m a i j -> m b i k\n(=<<<) = flip (>>>=)\n\n||| Sequence effects taking the value of the second.\npublic export\n(>>>) : IndexedMonad z m => m () i j -> Lazy (m b j k) -> m b i k\n(>>>) x y = x >>>= \\_ => y\n\n||| Left-to-right Kleisli composition of indexed monads.\npublic export\n(>>=>) : IndexedMonad z m => (a -> m b i j) -> (b -> m c j k) -> (a -> m c i k)\n(>>=>) f g x = f x >>>= g\n\n||| Right-to-left Kleisli composition of indexed monads, flipped version of `>=>`.\npublic export\n(<=<<) : IndexedMonad z m => (b -> m c j k) -> (a -> m b i j) -> (a -> m c i k)\n(<=<<) = flip (>>=>)\n", "meta": {"hexsha": "bcd612a709fe63e7b0a24b9b4aece998d19a264a", "size": 1189, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Control/Monad/Indexed.idr", "max_stars_repo_name": "mattpolzin/idris-indexed", "max_stars_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "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/Control/Monad/Indexed.idr", "max_issues_repo_name": "mattpolzin/idris-indexed", "max_issues_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-12-05T08:05:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-15T07:26:51.000Z", "max_forks_repo_path": "src/Control/Monad/Indexed.idr", "max_forks_repo_name": "mattpolzin/idris-indexed", "max_forks_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "max_forks_repo_licenses": ["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.6511627907, "max_line_length": 82, "alphanum_fraction": 0.5349032801, "num_tokens": 429, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677506936878, "lm_q2_score": 0.600188359260205, "lm_q1q2_score": 0.508940372994411}}
{"text": "||| Using single machine-word as Bitarray.\n|||\n||| Copyright 2021, HATTORI, Hiroki\n||| This file is released under the MIT license, see LICENSE for more detail.\n|||\nmodule Data.Container.IntSet\n\nimport Data.Container.Interfaces\n\nimport Data.Bits\nimport Data.Maybe               -- fromMaybe\nimport Data.So\nimport Data.SortedMap as M      -- mergeWith, empty\nimport Decidable.Equality\n\n%default total\n\n-- --------------------------------------------------------------------------\n\n-- 0 decideTiny : (n:Nat) -> Dec ((n <= 32) = True)\ndecideTiny : (n:Nat) -> Dec ((n <= 32) = True)\ndecideTiny n = decEq (n <= 32) True\n\nexport IntSet : (N:Nat) -> Type\nIntSet n with (decideTiny n)\n  IntSet _ | Yes _ = Bits32\n  IntSet _ | No _  = M.SortedMap Integer Bits32\n\n-- --------------------------------------------------------------------------\n\nexport\n(n:Nat) => Semigroup (IntSet n) where\n  x <+> y with (decideTiny n)\n    x <+> y | Yes _ = prim__or_Bits32 x y\n    x <+> y | No _  = M.mergeWith prim__or_Bits32 x y\n\nexport\n(n:Nat) => Semigroup (IntSet n) => Monoid (IntSet n) where\n  neutral with (decideTiny n)\n    neutral | Yes _ = 0\n    neutral | No _  = M.empty\n\n-- --------------------------------------------------------------------------\n\nkeyix : Integer -> (Integer, Bits32)\nkeyix k =\n  let i = if k >= 0 then (k `div` 32) else (negate $ (k - 1) `div` 32)\n      b = fromInteger $ abs $ k `mod` 32\n   in (i, b)\n\n\nexport\n{n:Nat} -> Container (IntSet n) where\n  KeyTy = Integer\n  null xs with (decideTiny n)\n    null xs | Yes _ = xs == 0\n    null xs | No _  = null xs\n  count xs with (decideTiny n)\n    count xs | Yes _ = popCount xs\n    count xs | No _  = foldl (\\acc, b => acc + popCount b) 0 xs\n  contains k xs with (decideTiny n)\n    contains k xs | Yes _ =\n      if k >= 0 && k < 32\n        then 0 /= (prim__and_Bits32 xs $ prim__shl_Bits32 1 $ fromInteger k)\n        else False\n    contains k xs | No  _ =\n      let (i, b) = keyix k\n       in maybe False (\\ys => 0 /= (prim__and_Bits32 ys $ prim__shl_Bits32 1 b))\n                (M.lookup i xs)\n  delete k xs with (decideTiny n)\n    delete k xs | Yes _ =\n      if k >= 0 && k < 32\n         then prim__and_Bits32 xs $ prim__xor_Bits32 0xffffffff $ prim__shl_Bits32 1 $ fromInteger k\n         else xs\n    delete k xs | No _  =\n      let (i, b) = keyix k\n       in maybe xs (\\ys => M.insert i (prim__and_Bits32 ys $ prim__xor_Bits32 0xffffffff $ prim__shl_Bits32 1 b) xs)\n                (M.lookup i xs)\n\nexport\n(n:Nat) => (Container (IntSet n)) => Set (IntSet n) where\n  KeyTy = Integer\n  insert k xs with (decideTiny n)\n    insert k xs | Yes _ =\n      if k >= 0 && k < 32\n         then prim__or_Bits32 xs $ prim__shl_Bits32 1 $ fromInteger k\n         else xs\n    insert k xs | No  _ =\n      let (i, b) = keyix k\n       in M.insert i\n                   (prim__or_Bits32 (fromMaybe 0 (M.lookup i xs)) $ prim__shl_Bits32 1 b)\n                   xs\n\n\n\n\n-- --------------------------------------------------------------------------\n-- vim: tw=80 sw=2 expandtab :\n", "meta": {"hexsha": "8f644b4506d84a6ca189c34288a29af81c486fd1", "size": 3008, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Container/IntSet.idr", "max_stars_repo_name": "seagull-kamome/idris2-missing", "max_stars_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "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/Container/IntSet.idr", "max_issues_repo_name": "seagull-kamome/idris2-missing", "max_issues_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-02-03T11:05:02.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-01T12:42:01.000Z", "max_forks_repo_path": "src/Data/Container/IntSet.idr", "max_forks_repo_name": "seagull-kamome/idris2-missing", "max_forks_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_forks_repo_licenses": ["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.3838383838, "max_line_length": 116, "alphanum_fraction": 0.5355718085, "num_tokens": 929, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8175744761936437, "lm_q2_score": 0.6224593171945417, "lm_q1q2_score": 0.5089068502071805}}
{"text": "module Main\n\n-- base\nimport Control.Monad.State\nimport Data.List\nimport Data.Nat\nimport Data.Vect\nimport System.File\n\n-- contrib\nimport Data.SortedMap\nimport Text.Lexer\nimport Text.Lexer.Core\nimport Text.Parser\nimport Text.Parser.Core\nimport Text.Token\n\n----------------------------------------------------------------------------------------------------\n\nResolution1D : Nat\nResolution1D = 10\n\nTiling : Type\nTiling = Vect Resolution1D $ Vect Resolution1D Bool\n\ntilingOrientations : Tiling -> Vect 16 Tiling\ntilingOrientations tiling = concat $ tilingRotations <$> tilingFlippings tiling where\n  tilingFlippings : Tiling -> Vect 4 Tiling\n  tilingFlippings tiling =\n    [ tiling\n    , reverse tiling\n    , reverse <$> tiling\n    , reverse <$> reverse tiling\n    ]\n  tilingRotations : Tiling -> Vect 4 Tiling\n  tilingRotations tiling =\n    [ tiling\n    , rotate90 tiling\n    , rotate90 $ rotate90 tiling\n    , rotate90 $ rotate90 $ rotate90 tiling\n    ] where\n      rotate90 : Tiling -> Tiling\n      rotate90 = reverse . transpose\n\nrecord Tile where\n  constructor MkTile\n  id : Nat\n  tiling : Tiling\n\nShow Tile where\n  show (MkTile id tiling) = \"Tile \" ++ show id ++ \" \" ++ show tiling\n\nTilingMap : Type\nTilingMap = SortedMap Nat Tiling\n\ncreateTilingMap : List Tile -> TilingMap\ncreateTilingMap = fromList . map f where\n  f : Tile -> (Nat, Tiling)\n  f (MkTile id tiling) = (id, tiling)\n\n-- from square root of `length tiles`\nResolution1DImage : Nat\nResolution1DImage = 12\n\nArrangement : Type\nArrangement = Vect Resolution1DImage $ Vect Resolution1DImage $ Maybe Nat\n\nnextCoordinate : {n : Nat} -> (x : Fin $ S n) -> Fin $ S n\nnextCoordinate x with (strengthen x)\n  nextCoordinate x | (Left y) = FZ\n  nextCoordinate x | (Right y) = FS y\n\nnextCoordinates : {n : Nat} ->\n                  (x : Fin n) ->\n                  (y : Fin n) ->\n                  Maybe (Fin n, Fin n)\nnextCoordinates x y with (n)\n  nextCoordinates x y | Z = Nothing\n  nextCoordinates x y | (S k) =\n    if x == last\n       then if y == last\n               then Nothing\n               else Just (FZ, nextCoordinate y)\n       else Just (nextCoordinate x, nextCoordinate y)\n\ndata Direction = DirectionLeft\n               | DirectionUp\n\nneighborsToCheck : {n : Nat} ->\n                   (x : Fin n) ->\n                   (y : Fin n) ->\n                   List ((Fin n, Fin n), Direction)\nneighborsToCheck x y = [ ((pred x, y), DirectionUp), ((x, pred y), DirectionLeft) ] where\n  pred : {n : Nat} -> (x : Fin n) -> Fin n\n  pred FZ = last -- this is additional and not necessary, but allows returning Vect\n  pred (FS k) = weaken k\n\nneighborsToCheck' : (arrangement : Arrangement) ->\n                    (x : Fin Resolution1DImage) ->\n                    (y : Fin Resolution1DImage) ->\n                    List (Nat, Direction)\nneighborsToCheck' arrangement x y = do\n  ((x', y'), d') <- neighborsToCheck x y\n  let n = index x' $ index y' arrangement\n  case n of\n       Nothing => []\n       Just n' => pure (n', d')\n\ncheckTiling : Direction -> (new : Tiling) -> (old : Tiling) -> Bool\ncheckTiling DirectionLeft new old = (index last <$> old) == (index FZ <$> new)\ncheckTiling DirectionUp new old = index last old == index FZ new\n\ncheckNeighbors : (tilingMap : TilingMap) ->\n                 (new : Tiling) ->\n                 List (Nat, Direction) ->\n                 Bool\ncheckNeighbors tilingMap new [] = True\ncheckNeighbors tilingMap new ((n, d) :: xs) =\n  case lookup n tilingMap of\n       Nothing => ?keysShouldMatch\n       Just old => if checkTiling d new old\n                      then checkNeighbors tilingMap new xs\n                      else False\n\ncheckNeighbors' : (tilingMap : TilingMap) ->\n                  (arrangement : Arrangement) ->\n                  (new : Tiling) ->\n                  (x : Fin Resolution1DImage) ->\n                  (y : Fin Resolution1DImage) ->\n                  Bool\ncheckNeighbors' tilingMap arrangement new x y =\n  checkNeighbors tilingMap new $ neighborsToCheck' arrangement x y\n\nfilterTilings : (tilingMap : TilingMap) ->\n                (arrangement : Arrangement) ->\n                (tilings : List (Nat, Tiling)) ->\n                (x : Fin Resolution1DImage) ->\n                (y : Fin Resolution1DImage) ->\n                List (Nat, Tiling)\nfilterTilings tilingMap arrangement tilings x y =\n  filter (\\(_,t) => checkNeighbors' tilingMap arrangement t x y) tilings\n\ntryTilings : (tilingMap : TilingMap) ->\n             (arrangement : Arrangement) ->\n             (x : Fin Resolution1DImage) ->\n             (y : Fin Resolution1DImage) ->\n             List Arrangement\ntryTilings tilingMap arrangement x y = ?tryTilings_rhs where\n  tilingsToTry : List (Nat, Tiling)\n  tilingsToTry = do\n    (n, t) <- Data.SortedMap.toList tilingMap\n    t' <- toList $ tilingOrientations t\n    pure (n, t')\n  possibleTilings : List (Nat, Tiling)\n  possibleTilings = filterTilings tilingMap arrangement tilingsToTry x y\n  nextTry : (Nat, Tiling) -> List Arrangement\n  nextTry (n, t) = case nextCoordinates x y of\n                        Nothing => pure newArrangement\n                        Just (x',y') => tryTilings newTilingMap newArrangement x' y'\n                        where\n                          newTilingMap : TilingMap\n                          newTilingMap = insert n t tilingMap\n                          newArrangement : Arrangement\n                          newArrangement = replaceAt y (replaceAt x (Just n) $ index y arrangement) arrangement\n\nfindTilings : (tilingMap : TilingMap) ->\n              List Arrangement\nfindTilings tilingMap = tryTilings tilingMap (pure $ pure Nothing) FZ FZ\n\n----------------------------------------------------------------------------------------------------\n\nnamespace Parsing\n\n  data DataKind = DKTile\n                | DKSpace\n                | DKNum\n                | DKColon\n                | DKNewline\n                | DKDot\n                | DKHash\n\n  Eq DataKind where\n    DKTile == DKTile = True\n    DKSpace == DKSpace = True\n    DKNum == DKNum = True\n    DKColon == DKColon = True\n    DKNewline == DKNewline = True\n    DKDot == DKDot = True\n    DKHash == DKHash = True\n    _ == _ = False\n\n  TokenKind DataKind where\n    TokType DKNum = Nat\n    TokType _ = ()\n    tokValue DKNum x = integerToNat $ cast x\n    tokValue DKTile _ = ()\n    tokValue DKSpace _ = ()\n    tokValue DKColon _ = ()\n    tokValue DKNewline _ = ()\n    tokValue DKDot _ = ()\n    tokValue DKHash _ = ()\n\n  tokenMap : TokenMap $ Token DataKind\n  tokenMap = toTokenMap\n    [ (digits, DKNum)\n    , (is '.', DKDot)\n    , (is '#', DKHash)\n    , (exact \"Tile\", DKTile)\n    , (newline, DKNewline)\n    , (space, DKSpace)\n    , (is ':', DKColon)\n    ]\n\n  countExactly : (n : Nat) -> (p : Grammar tok True a) -> Grammar tok (isSucc n) (Vect n a)\n  countExactly Z p = Empty []\n  countExactly (S k) p = [| p :: countExactly k p |]\n\n  grammarTiles : Grammar (Token DataKind) True (List Tile)\n  grammarTiles = sepBy1 (match DKNewline) grammarTile where\n    grammarPixel : Grammar (Token DataKind) True Bool\n    grammarPixel = match DKDot $> False <|> match DKHash $> True\n    grammarTiling : Grammar (Token DataKind) True Tiling\n    grammarTiling =\n      countExactly Resolution1D $ countExactly Resolution1D grammarPixel <* match DKNewline\n    grammarTile : Grammar (Token DataKind) True Tile\n    grammarTile = do\n      match DKTile\n      match DKSpace\n      id <- match DKNum\n      match DKColon\n      match DKNewline\n      tiling <- grammarTiling\n      pure $ MkTile id tiling\n\n  export\n  readData : String -> Maybe $ List Tile\n  readData str = do\n    let (tokens, debugLexed) = lex tokenMap str\n        parsed = parse grammarTiles $ tok <$> tokens\n    case parsed of\n         Left _ => Nothing\n         Right (rule, _) => Just rule\n\n----------------------------------------------------------------------------------------------------\n\nmain : IO ()\nmain = do\n  inputData <- readFile \"./data\"\n  case inputData of\n       Left err => print err\n       Right dat => do\n         case readData dat of\n              Nothing => pure ()\n              Just tiles => do\n                let tilingMap = createTilingMap tiles\n                print $ findTilings tilingMap\n  pure ()\n", "meta": {"hexsha": "cb47cd3b5f825a94440142802484686a26256936", "size": 8182, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "20/Main.idr", "max_stars_repo_name": "jumper149/AoC2020", "max_stars_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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": "20/Main.idr", "max_issues_repo_name": "jumper149/AoC2020", "max_issues_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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": "20/Main.idr", "max_forks_repo_name": "jumper149/AoC2020", "max_forks_repo_head_hexsha": "a392b82234fb762278498ec637da871e9debf513", "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": 31.7131782946, "max_line_length": 111, "alphanum_fraction": 0.577487167, "num_tokens": 2149, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8080672227971211, "lm_q2_score": 0.6297746213017459, "lm_q1q2_score": 0.5089002292234104}}
{"text": "data DoorState = DoorClosed | DoorOpen\n\ndata DoorCmd : Type -> \n               DoorState ->\n               DoorState ->\n               Type where\n  Open : DoorCmd () DoorClosed DoorOpen\n  Close : DoorCmd () DoorOpen DoorClosed\n  RingBell : DoorCmd () DoorClosed DoorClosed\n\n  Pure : ty -> DoorCmd ty state state\n  (>>=) : DoorCmd a state1 state2 ->\n       (a -> DoorCmd b state2 state3) ->\n       DoorCmd b state1 state3\n\n\ndoorProg : DoorCmd () DoorClosed DoorClosed\ndoorProg = do RingBell\n              Open\n              Close\n\n{-doorProgBad : DoorCmd ()\ndoorProgBad = do Open\n                 Open\n                 RingBell-}\n\n\n\n\n\n", "meta": {"hexsha": "808e438e61479e90aa7b8b262cce2d5c731261fc", "size": 634, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type_driven_book/chp13/Door.idr", "max_stars_repo_name": "Ryxai/idris_book_notes", "max_stars_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "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_driven_book/chp13/Door.idr", "max_issues_repo_name": "Ryxai/idris_book_notes", "max_issues_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_issues_repo_licenses": ["MIT"], "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_driven_book/chp13/Door.idr", "max_forks_repo_name": "Ryxai/idris_book_notes", "max_forks_repo_head_hexsha": "3927f9d72eafe8b8ef8b08280dafe5592084eb18", "max_forks_repo_licenses": ["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.4516129032, "max_line_length": 45, "alphanum_fraction": 0.570977918, "num_tokens": 157, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7310585669110202, "lm_q2_score": 0.6959583187272712, "lm_q1q2_score": 0.5087862911185619}}
{"text": "module Data.Time.LocalTime.Internal.LocalTime\n\nimport Data.Time.Calendar.Days\nimport Data.Time.Calendar.Gregorian\nimport Data.Time.Clock.DiffTime\nimport Data.Time.Clock.Internal.UTCTime\nimport Data.Time.LocalTime.TimeZone\nimport Data.Time.LocalTime.TimeOfDay\n\nimport Generics.Derive\n\n%default total\n%language ElabReflection\n\n-- --------------------------------------------------------------------------\n\n||| A simple day and time aggregate, where the day is of the specified parameter,\n||| and the time is a TimeOfDay.\n||| Conversion of this (as local civil time) to UTC depends on the time zone.\n||| Conversion of this (as local mean time) to UT1 depends on the longitude.\npublic export\nrecord LocalTime where\n  constructor MkLocalTime\n  localDay : Day\n  localTimeOfDay : TimeOfDay\n%runElab derive \"LocalTime\" [Generic, Eq, Ord, DecEq]\n\npublic export\nShow LocalTime where\n  show x = show x.localDay ++ \" \" ++ show x.localTimeOfDay\n\n-- --------------------------------------------------------------------------\n\n||| Get the local time of a UTC time in a time zone.\nexport utcToLocalTime : TimeZone -> UTCTime -> LocalTime\nutcToLocalTime tz (MkUTCTime day dt) = let\n  (i, tod) = utcToLocalTimeOfDay tz (timeToTimeOfDay dt)\n  in MkLocalTime (addDays i day) tod\n\n||| Get the UTC time of a local time in a time zone.\nexport localTimeToUTC : TimeZone -> LocalTime -> UTCTime\nlocalTimeToUTC tz (MkLocalTime day tod) = let\n  (i, todUTC) = localToUTCTimeOfDay tz tod\n  in MkUTCTime (addDays i day) (timeOfDayToTime todUTC)\n\n\n\n-- --------------------------------------------------------------------------\n-- vim: tw=80 sw=2 expandtab :", "meta": {"hexsha": "0915ddc23fc3c453f912011aa4078925a32578c4", "size": 1626, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "time-calendar-clock/src/Data/Time/LocalTime/Internal/LocalTime.idr", "max_stars_repo_name": "seagull-kamome/idris2-missing", "max_stars_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "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": "time-calendar-clock/src/Data/Time/LocalTime/Internal/LocalTime.idr", "max_issues_repo_name": "seagull-kamome/idris2-missing", "max_issues_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-02-03T11:05:02.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-01T12:42:01.000Z", "max_forks_repo_path": "time-calendar-clock/src/Data/Time/LocalTime/Internal/LocalTime.idr", "max_forks_repo_name": "seagull-kamome/idris2-missing", "max_forks_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_forks_repo_licenses": ["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.1836734694, "max_line_length": 81, "alphanum_fraction": 0.6506765068, "num_tokens": 393, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7490872243177518, "lm_q2_score": 0.6791787056691698, "lm_q1q2_score": 0.5087640914454418}}
{"text": "import Control.Monad.Identity\n\n%default total\n\n-- Validated - an Either with a monoidal error --\n\npublic export\ndata Validated e a = Valid a | Invalid e\n\npublic export\n(Eq e, Eq a) => Eq (Validated e a) where\n  Valid x   == Valid y   = x == y\n  Invalid e == Invalid f = e == f\n  _ == _ = False\n\nexport\n(Show e, Show a) => Show (Validated e a) where\n  showPrec d $ Valid   x = showCon d \"Valid\" $ showArg x\n  showPrec d $ Invalid e = showCon d \"Invalid\" $ showArg e\n\npublic export\nFunctor (Validated e) where\n  map f $ Valid x   = Valid $ f x\n  map _ $ Invalid e = Invalid e\n\npublic export\nBifunctor Validated where\n  bimap _ s $ Valid x   = Valid   $ s x\n  bimap f _ $ Invalid e = Invalid $ f e\n\n-- Composition preserves invalidity\npublic export\nSemigroup e => Applicative (Validated e) where\n  pure = Valid\n\n  Valid f    <*> Valid x    = Valid $ f x\n  Invalid e1 <*> Invalid e2 = Invalid $ e1 <+> e2\n  Invalid e  <*> Valid _    = Invalid e\n  Valid _    <*> Invalid e  = Invalid e\n\n-- Composition preserves validity\npublic export\nSemigroup e => Semigroup (Validated e a) where\n  l@(Valid _) <+> _           = l\n  _           <+> r@(Valid _) = r\n  Invalid e1  <+> Invalid e2  = Invalid $ e1 <+> e2\n\npublic export\nMonoid e => Monoid (Validated e a) where\n  neutral = Invalid neutral\n\n-- Composition preserves validity\npublic export\nMonoid e => Alternative (Validated e) where\n  empty = neutral\n  (<|>) = (<+>)\n\npublic export\nFoldable (Validated e) where\n  foldr op init $ Valid x   = x `op` init\n  foldr _  init $ Invalid _ = init\n\n  foldl op init $ Valid x   = init `op` x\n  foldl _  init $ Invalid _ = init\n\n  null $ Valid _   = False\n  null $ Invalid _ = True\n\npublic export\nTraversable (Validated e) where\n  traverse f $ Valid x   = Valid <$> f x\n  traverse _ $ Invalid e = pure $ Invalid e\n\npublic export %inline\nValidatedL : Type -> Type -> Type\nValidatedL e a = Validated (List e) a\n\npublic export %inline\noneInvalid : e -> Applicative f => Validated (f e) a\noneInvalid x = Invalid $ pure x\n\npublic export %inline\nfromEither : Either e a -> Validated e a\nfromEither $ Right x = Valid x\nfromEither $ Left  e = Invalid e\n\npublic export %inline\nfromEitherL : Either e a -> ValidatedL e a\nfromEitherL $ Right x = Valid x\nfromEitherL $ Left  e = oneInvalid e\n\npublic export %inline\ntoEither : Validated e a -> Either e a\ntoEither $ Valid   x = Right x\ntoEither $ Invalid e = Left e\n\n-- Errorful monadic functions --\n\nf1 : Monad m => Int -> m $ ValidatedL String Int\nf1 5 = pure $ pure 0\nf1 _ = pure $ oneInvalid \"fail 1\"\n\nf2 : Monad m => Int -> m $ ValidatedL String Int\nf2 6 = pure $ pure 0\nf2 _ = pure $ oneInvalid \"fail 2\"\n\n-- Compositions --\n\nc1 : Monad m => m (ValidatedL String Int)\nc1 = f1 1 *> f2 1\n\nc2 : Monad m => m (ValidatedL String Int)\nc2 = (f1 1 *> f2 1) @{Applicative.Compose}\n\n-- These checks are meant to be true --\n\nr1 : Bool\nr1 = runIdentity c1 == Invalid [\"fail 2\"]\n\nr2 : Bool\nr2 = runIdentity c2 == Invalid [\"fail 1\", \"fail 2\"]\n", "meta": {"hexsha": "d6ce386fe85f52fca8209febf35e50d6168c138b", "size": 2950, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "AppComp2.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "AppComp2.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "AppComp2.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 24.1803278689, "max_line_length": 58, "alphanum_fraction": 0.6508474576, "num_tokens": 926, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031737963569016, "lm_q2_score": 0.63341027751814, "lm_q1q2_score": 0.5087385372457232}}
{"text": "-- DataStore.idr\n--\n-- A simple Vect-based data store with\n-- integer key and string values\n\nmodule Main\n\nimport Data.Vect\n\ninfix 5 .+.\n\ndata Schema = SString\n            | SInt\n            | (.+.) Schema Schema\n\nSchemaType : Schema -> Type\nSchemaType SString = String\nSchemaType SInt = Int\nSchemaType (x .+. y) = (SchemaType x, SchemaType y)\n\n||| A record-style DataStore type\nrecord DataStore where\n       constructor MkData \n       schema : Schema\n       size : Nat\n       items : Vect size (SchemaType schema)\n\n{-\naddToStore : DataStore -> String -> DataStore\naddToStore (MkData size items) newItem = MkData _ (addToData items)\n  where\n    addToData : Vect old String -> Vect (S old) String\n    addToData [] = [newItem]\n    addToData (x :: xs) = x :: (addToData xs)\n\n\n||| commands for data store\ndata Command = Add String\n             | Get Integer\n             | Search String\n             | Size\n             | Quit\n\n\nparseCommand : (cmd : String) -> (args : String) -> Maybe Command\nparseCommand \"add\" str = Just (Add str)\nparseCommand \"get\" val = case all isDigit (unpack val) of\n                              False => Nothing\n                              True => Just (Get (cast val))\nparseCommand \"search\" str = Just (Search str)\nparseCommand \"size\" \"\" = Just Size\nparseCommand \"quit\" \"\" = Just Quit\nparseCommand _ _ = Nothing\n\n||| Parses given string and returns matching command\n||| if sucessful (or Nothing in case of invalid string)\nparse : (input : String) -> Maybe Command\nparse input = case span (/= ' ') input of\n                   (cmd, args) => parseCommand cmd (ltrim args)\n\n\n\ngetEntry : (pos : Integer) -> (store : DataStore) -> Maybe (String, DataStore)\ngetEntry pos store = let store_items = items store in\n                         case integerToFin pos (size store) of\n                              Nothing => Just (\"Out of range\\n\", store)\n                              (Just id) => Just (index id store_items ++ \"\\n\", store)\n\n\nfindEntriesString : (idx : Nat) -> (str : String) -> (items : Vect len String) -> String\nfindEntriesString idx str [] = \"\\n\"\nfindEntriesString idx str (x :: xs) = if (isInfixOf str x)\n                                         then (show idx) ++ \": \" ++ x ++ \"\\n\" ++ findEntriesString (idx + 1) str xs \n                                         else findEntriesString (idx + 1) str xs\n\nfindEntries : (str : String) -> (store : DataStore) -> String\nfindEntries str store = findEntriesString Z str (items store)\n\nconcatStringVect : (p : Nat ** Vect p (Nat, String)) -> String\nconcatStringVect (Z ** []) = \"\\n\"\nconcatStringVect (S x ** ((id, str) :: items)) = (show id) ++ \": \" ++ str ++ \"\\n\" ++ concatStringVect (x ** items)\n\n||| Processes given String command\nprocessInput : DataStore -> String -> Maybe (String, DataStore)\nprocessInput store input = case parse input of\n                                Nothing => Just (\"Unknown command: \" ++ input ++ \"\\n\", store)\n                                Just (Add item) =>\n                                  Just (\"ID \" ++ show (size store) ++ \"\\n\", addToStore store item)\n                                Just (Get pos) => getEntry pos store\n                                Just (Search str) =>\n                                  Just (findEntries str store, store)\n                                Just Size =>\n                                  Just (\"Size: \" ++ cast (size store) ++ \"\\n\", store)\n                                Just Quit => Nothing\n\n-- entry point\nmain : IO ()\nmain = replWith (MkData 0 []) \"Command: \" processInput\n\n-}\n\n\n", "meta": {"hexsha": "abe490cdcfa2382bd6b32ad07773f163e45c1e17", "size": 3532, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Idris/TDD/Chapter_6/DataStore.idr", "max_stars_repo_name": "kkirstein/proglang-playground", "max_stars_repo_head_hexsha": "d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd", "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": "Idris/TDD/Chapter_6/DataStore.idr", "max_issues_repo_name": "kkirstein/proglang-playground", "max_issues_repo_head_hexsha": "d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Idris/TDD/Chapter_6/DataStore.idr", "max_forks_repo_name": "kkirstein/proglang-playground", "max_forks_repo_head_hexsha": "d00be09ba2bb2351c6f5287cc4d93fcaf21f75fd", "max_forks_repo_licenses": ["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.2912621359, "max_line_length": 116, "alphanum_fraction": 0.548414496, "num_tokens": 841, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031737775116229, "lm_q2_score": 0.6334102567576902, "lm_q1q2_score": 0.5087385086346811}}
{"text": "\ntwoPlusTwoNotFive : 2 + 2 = 5 -> Void\ntwoPlusTwoNotFive Refl impossible", "meta": {"hexsha": "8974c1ae7f77f6f7be90005f60e2b7acf8e67d97", "size": 72, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/ch8/Void.idr", "max_stars_repo_name": "trevarj/tdd_idris_examples", "max_stars_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "max_stars_repo_licenses": ["Unlicense"], "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/ch8/Void.idr", "max_issues_repo_name": "trevarj/tdd_idris_examples", "max_issues_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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/ch8/Void.idr", "max_forks_repo_name": "trevarj/tdd_idris_examples", "max_forks_repo_head_hexsha": "63a7128a797b64cb0ba54562778cdf9712b4d9f5", "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": 24.0, "max_line_length": 37, "alphanum_fraction": 0.7638888889, "num_tokens": 26, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8031737775116229, "lm_q2_score": 0.6334102567576901, "lm_q1q2_score": 0.508738508634681}}
{"text": "module LazyListTrav\n\nimport Data.List.Lazy\n\nimport Debug.Trace\n\n%default total\n\npublic export\nTraversable LazyList where\n  traverse = map force .: tr where\n    tr : (a -> f b) -> LazyList a -> f (Lazy (LazyList b))\n    tr g [] = pure []\n    tr g (x::xs) = [| g x :: tr g xs |] where\n      (::) : forall a. a -> Lazy (LazyList a) -> Lazy (LazyList a)\n      (::) x xs = delay $ Lazy.(::) x xs\n\ndebugList : Nat -> LazyList Nat\ndebugList n = iterateN n f 1 where\n  f : Nat -> Nat\n  f x = trace \"arg: \\{show x}\" $ x + 1\n\nd : Applicative f => f $ LazyList Nat\nd = map (Lazy.take 3) $ traverse pure $ debugList 500\n", "meta": {"hexsha": "1bad2b24310ff50802a3aa43c83ab918c288012d", "size": 608, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "LazyListTrav.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "LazyListTrav.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "LazyListTrav.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 24.32, "max_line_length": 66, "alphanum_fraction": 0.5921052632, "num_tokens": 202, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7981867777396211, "lm_q2_score": 0.6370307875894139, "lm_q1q2_score": 0.5084695516669273}}
{"text": "\nmodule Arith\n\nimport Data.Primitives.Views\n\npublic export\nrandoms : Int -> Stream Int\nrandoms seed = let seed' = 1664525 * seed + 1013904223 in\n                   (seed' `shiftR` 2) :: randoms seed'\npublic export\narithInputs : Int -> Stream Int\narithInputs seed = map bound (randoms seed)\n  where bound : Int -> Int\n        bound x with (divides x 12)\n          bound ((12 * div) + rem) | (DivBy prf) = rem + 1\n\n\nquiz : Stream Int -> (score : Nat) -> IO ()\nquiz (n1 :: n2 :: ns) score =\n     do putStrLn $ \"Thy score: \" ++ show score\n        putStr $ show n1 ++ \" * \" ++ show n2 ++ \"? \"\n        answer <- getLine\n        if cast answer == n1 * n2\n           then putStrLn \"Correct\" >>= \\_ => quiz ns $ score + 1\n           else putStrLn (\"Wrong. Answer is: \" ++ show (n1 * n2)) >>= \\_ => quiz ns score\n\n\n-- 11.1 Ex. # 1\nevery_other : Stream ty -> Stream ty\nevery_other (v1 :: v2 :: vs) = v2 :: every_other vs\n\n", "meta": {"hexsha": "451048835d838aab89f853232a7d6f96212a14f1", "size": 911, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter 11/Arith.idr", "max_stars_repo_name": "robkorn/idris-type-driven-development-exercises", "max_stars_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-12-18T12:54:01.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-28T09:54:21.000Z", "max_issues_repo_path": "Chapter 11/Arith.idr", "max_issues_repo_name": "robkorn/idris-type-driven-development-exercises", "max_issues_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "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": "Chapter 11/Arith.idr", "max_forks_repo_name": "robkorn/idris-type-driven-development-exercises", "max_forks_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-12-18T12:54:05.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-18T12:54:05.000Z", "avg_line_length": 28.46875, "max_line_length": 89, "alphanum_fraction": 0.5642151482, "num_tokens": 282, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7371581741774411, "lm_q2_score": 0.6893056104028797, "lm_q1q2_score": 0.5081272652148534}}
{"text": "||| [specification](http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf)\nmodule Data.Crypto.Hash.SHS\n\nimport Data.Bits\nimport Data.Crypto.Hash\nimport Data.Crypto.Util\nimport Data.Fin\nimport Data.Mod\nimport Data.Vect\n\n\n-- Functions\n\nch : Bits n -> Bits n -> Bits n -> Bits n\nch x y z = (x `and` y) `xor` (complement x `and` z)\n\nparity : Bits n -> Bits n -> Bits n -> Bits n\nparity x y z = (x `xor` y) `xor` z\n\nmaj : Bits n -> Bits n -> Bits n -> Bits n\nmaj x y z = ((x `and` y) `xor` (x `and` z)) `xor` (y `and` z)\n\nf : Fin 80 -> Bits 32 -> Bits 32 -> Bits 32 -> Bits 32\nf t = if t <= 19 then ch\n else if t <= 39 then parity\n else if t <= 59 then maj\n                 else parity\n\n\u03a3256_0 : Bits 32 -> Bits 32\n\u03a3256_0 x = (rotateRight 2 x `xor` rotateRight 13 x) `xor` rotateRight 22 x\n\n\u03a3256_1 : Bits 32 -> Bits 32\n\u03a3256_1 x = (rotateRight 6 x `xor` rotateRight 11 x) `xor` rotateRight 25 x\n\n\u03c3256_0 : Bits 32 -> Bits 32\n\u03c3256_0 x = (rotateRight 7 x `xor` rotateRight 18 x) `xor` shiftRightLogical x (intToBits 3)\n\n\u03c3256_1 : Bits 32 -> Bits 32\n\u03c3256_1 x = (rotateRight 17 x `xor` rotateRight 19 x) `xor` shiftRightLogical x (intToBits 10)\n\n\u03a3512_0 : Bits 64 -> Bits 64\n\u03a3512_0 x = (rotateRight 28 x `xor` rotateRight 34 x) `xor` rotateRight 39 x\n\n\u03a3512_1 : Bits 64 -> Bits 64\n\u03a3512_1 x = (rotateRight 14 x `xor` rotateRight 18 x) `xor` rotateRight 41 x\n\n\u03c3512_0 : Bits 64 -> Bits 64\n\u03c3512_0 x = (rotateRight 1 x `xor` rotateRight 8 x) `xor` shiftRightLogical x (intToBits 7)\n\n\u03c3512_1 : Bits 64 -> Bits 64\n\u03c3512_1 x = (rotateRight 19 x `xor` rotateRight 61 x) `xor` shiftRightLogical x (intToBits 6)\n\n-- Constants\n\nconst1 : Vect 80 (Bits 32)\nconst1 = concat (map (replicate 20 . intToBits)\n                     [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6])\n\nconst256 : Vect 64 (Bits 32)\nconst256 = map intToBits\n               [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n                0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n                0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n                0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n                0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n                0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n                0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n                0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]\n                \nconst512 : Vect 80 (Bits 64)\nconst512 = map intToBits\n               [0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc,\n                0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118,\n                0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2,\n                0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235, 0xc19bf174cf692694,\n                0xe49b69c19ef14ad2, 0xefbe4786384f25e3, 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65,\n                0x2de92c6f592b0275, 0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5,\n                0x983e5152ee66dfab, 0xa831c66d2db43210, 0xb00327c898fb213f, 0xbf597fc7beef0ee4,\n                0xc6e00bf33da88fc2, 0xd5a79147930aa725, 0x06ca6351e003826f, 0x142929670a0e6e70,\n                0x27b70a8546d22ffc, 0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed, 0x53380d139d95b3df,\n                0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6, 0x92722c851482353b,\n                0xa2bfe8a14cf10364, 0xa81a664bbc423001, 0xc24b8b70d0f89791, 0xc76c51a30654be30,\n                0xd192e819d6ef5218, 0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8,\n                0x19a4c116b8d2d0c8, 0x1e376c085141ab53, 0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8,\n                0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb, 0x5b9cca4f7763e373, 0x682e6ff3d6b2b8a3,\n                0x748f82ee5defb2fc, 0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec,\n                0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915, 0xc67178f2e372532b,\n                0xca273eceea26619c, 0xd186b8c721c0c207, 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178,\n                0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b,\n                0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c,\n                0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817]\n\n-- Preprocessing\n\npad512 : Bits l -> Bits ((div l 512 + 1) * 512)\npad512 {l=l} message = append message\n                              (append (intToBits 1)\n                                      (append (the (Bits (modToNat (the (Mod 512) (448 - (natToMod l + 1))))) (intToBits 0))\n                                              (the (Bits 64) (intToBits (cast l)))))\n\npad1024 : Bits l -> Bits ((div l 1024 + 1) * 1024)\npad1024 {l=l} message = append message\n                               (append (intToBits 1)\n                                       (append (the (Bits (modToNat (the (Mod 1024) (896 - (natToMod l + 1))))) (intToBits 0))\n                                               (the (Bits 128) (intToBits (cast l)))))\n\nparse512 : Bits (n * 512) -> Vect n (Bits 512)\nparse512 = partition\n\nparse1024 : Bits (n * 1024) -> Vect n (Bits 1024)\nparse1024 = partition\n\n-- Algorithms\n\ndata SecureHashAlgorithm1 : Type where\n  SHA1 : Vect 5 (Bits 32) -> SecureHashAlgorithm1\n\nvectIndex : (i : Nat) -> Vect (S n) a -> LTE i n -> a\nvectIndex i v lte = index (natToFi i lte) v\n\nsha1sched' : Vect 16 (Bits 32) -> Vect t (Bits 32) -> Bits 32\nsha1sched' {t=t} M W =\n  case isLTE t 15 of\n    Yes lte => vectIndex t M lte\n    No gt => rotateLeft 1 (foldl1 xor\n                          --         (map (\\off -> index (weakenN' (strMinus (natToFi t lteRefl) off)) W)\n                          --              [3, 8, 14, 16]))\n            [Vect.index (weakenN' (strMinus (natToFi t lteRefl)  3)) W,\n             Vect.index (weakenN' (strMinus (natToFi t lteRefl)  8)) W,\n             Vect.index (weakenN' (strMinus (natToFi t lteRefl) 14)) W,\n             Vect.index (weakenN' (strMinus (natToFi t lteRefl) 16)) W])\n\n-- NB: `foldl` doesn\u2019t work here. Can we make something like `foldl`, but each\n--      step is one element, and we get a Vect of elements back at the end?  \nsha1sched : Vect 16 (Bits 32) -> Vect 80 (Bits 32)\nsha1sched mpart = foldl (\\W, t => sha1sched' {t=t} mpart W) [] [0..79]\n\nimplementation Hash SecureHashAlgorithm1 512 160 where\n  initialize _ = toList . parse512 . pad512 . Util.concat\n  initialContext _ = SHA1 (map intToBits\n                               [0x67452301,\n                                0xefcdab89,\n                                0x98badcfe,\n                                0x10325476,\n                                0xc3d2e1f0])\n  updateContext (SHA1 v) block = SHA1 (zipWith plus (foldl for v [0..79]) v) where\n    -- seems like we could do this in one pass\n    W : Vect 80 (Bits 32)\n    W = sha1sched (partition block)\n    for : Vect 5 (Bits 32) -> Fin 80 -> Vect 5 (Bits 32)\n    for [a, b, c, d, e] t =\n      [Vect.foldl1 plus [rotateLeft 5 a, f t b c d, e, index t const1, index t W],\n       a,\n       rotateLeft 30 b,\n       c,\n       d]\n  finalize (SHA1 v) = concat v\n\ndata SecureHashAlgorithm256 : Type where\n  SHA256 : Vect 8 (Bits 32) -> SecureHashAlgorithm256\n\nhash256 : Vect 8 (Bits 32) -> Bits 512 -> Vect 8 (Bits 32)\n\nimplementation Hash SecureHashAlgorithm256 512 256 where\n  initialize _ = toList . parse512 . pad512 . Util.concat\n  initialContext _ = SHA256 (map intToBits\n                                 [0x6a09e667,\n                                  0xbb67ae85,\n                                  0x3c6ef372,\n                                  0xa54ff53a,\n                                  0x510e527f,\n                                  0x9b05688c,\n                                  0x1f83d9ab,\n                                  0x5be0cd19])\n  updateContext (SHA256 v) = SHA256 . hash256 v\n  finalize (SHA256 v) = concat v\n\ndata SecureHashAlgorithm224 : Type where\n  SHA224 : Vect 8 (Bits 32) -> SecureHashAlgorithm224\n\nimplementation Hash SecureHashAlgorithm224 512 224 where\n  initialize _ = toList . parse512 . pad512 . Util.concat\n  initialContext _ = SHA224 (map intToBits\n                                 [0xc1059ed8,\n                                  0x367cd507,\n                                  0x3070dd17,\n                                  0xf70e5939,\n                                  0xffc00b31,\n                                  0x68581511,\n                                  0x64f98fa7,\n                                  0xbefa4fa4])\n  updateContext (SHA224 v) = SHA224 . hash256 v\n  finalize (SHA224 v) = concat (take 7 v)\n\ndata SecureHashAlgorithm512 : Type where\n  SHA512 : Vect 8 (Bits 64) -> SecureHashAlgorithm512\n  \nhash512 : Vect 8 (Bits 64) -> Bits 1024 -> Vect 8 (Bits 64)\n\nimplementation Hash SecureHashAlgorithm512 1024 512 where\n  initialize _ = toList . parse1024 . pad1024 . Util.concat\n  initialContext _ = SHA512 (map intToBits\n                                 [0x6a09e667f3bcc908,\n                                  0xbb67ae8584caa73b,\n                                  0x3c6ef372fe94f82b,\n                                  0xa54ff53a5f1d36f1,\n                                  0x510e527fade682d1,\n                                  0x9b05688c2b3e6c1f,\n                                  0x1f83d9abfb41bd6b,\n                                  0x5be0cd19137e2179])\n  updateContext (SHA512 v) = SHA512 . hash512 v\n  finalize (SHA512 v) = concat v\n\ndata SecureHashAlgorithm512_224 : Type where\n  SHA512_224 : Vect 8 (Bits 64) -> SecureHashAlgorithm512_224\n\nimplementation Hash SecureHashAlgorithm512_224 1024 224 where\n  initialize _ = toList . parse1024 . pad1024 . Util.concat\n  initialContext _ = SHA512_224 (map intToBits\n                                     [0x8C3D37C819544DA2,\n                                      0x73E1996689DCD4D6,\n                                      0x1DFAB7AE32FF9C82, \n                                      0x679DD514582F9FCF,\n                                      0x0F6D2B697BD44DA8,\n                                      0x77E36F7304C48942,\n                                      0x3F9D85A86A1D36C8,\n                                      0x1112E6AD91D692A1])\n  updateContext (SHA512_224 v) = SHA512_224 . hash512 v\n  finalize (SHA512_224 v) = truncate (concat (take 4 v))\n\ndata SecureHashAlgorithm512_256 : Type where\n  SHA512_256 : Vect 8 (Bits 64) -> SecureHashAlgorithm512_256\n\nimplementation Hash SecureHashAlgorithm512_256 1024 256 where\n  initialize _ = toList . parse1024 . pad1024 . Util.concat\n  initialContext _ = SHA512_256 (map intToBits\n                                     [0x22312194FC2BF72C,\n                                      0x9F555FA3C84C64C2,\n                                      0x2393B86B6F53B151,\n                                      0x963877195940EABD,\n                                      0x96283EE2A88EFFE3,\n                                      0xBE5E1E2553863992,\n                                      0x2B0199FC2C85B8AA,\n                                      0x0EB72DDC81C52CA2])\n  updateContext (SHA512_256 v) = SHA512_256 . hash512 v\n  finalize (SHA512_256 v) = concat (take 4 v)\n\ndata SecureHashAlgorithm384 : Type where\n  SHA384 : Vect 8 (Bits 64) -> SecureHashAlgorithm384\n\nimplementation Hash SecureHashAlgorithm384 1024 384 where\n  initialize _ = toList . parse1024 . pad1024 . Util.concat\n  initialContext _ = SHA384 (map intToBits\n                                 [0xcbbb9d5dc1059ed8,\n                                  0x629a292a367cd507,\n                                  0x9159015a3070dd17,\n                                  0x152fecd8f70e5939,\n                                  0x67332667ffc00b31,\n                                  0x8eb44a8768581511,\n                                  0xdb0c2e0d64f98fa7,\n                                  0x47b5481dbefa4fa4])\n  updateContext (SHA384 v) = SHA384 . hash512 v\n  finalize (SHA384 v) = concat (take 6 v)\n", "meta": {"hexsha": "fee55ea75ce53821efeae5805199d03bdd5182a1", "size": 12299, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Crypto/Hash/SHS.idr", "max_stars_repo_name": "idris-hackers/idris-crypto", "max_stars_repo_head_hexsha": "0fb69b76e399f2fa72f338e410504323751843e7", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 79, "max_stars_repo_stars_event_min_datetime": "2015-01-11T20:37:05.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-10T07:41:27.000Z", "max_issues_repo_path": "src/Data/Crypto/Hash/SHS.idr", "max_issues_repo_name": "idris-hackers/idris-crypto", "max_issues_repo_head_hexsha": "0fb69b76e399f2fa72f338e410504323751843e7", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2015-09-10T20:32:40.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-18T16:27:23.000Z", "max_forks_repo_path": "src/Data/Crypto/Hash/SHS.idr", "max_forks_repo_name": "idris-hackers/idris-crypto", "max_forks_repo_head_hexsha": "0fb69b76e399f2fa72f338e410504323751843e7", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 12, "max_forks_repo_forks_event_min_datetime": "2015-04-23T23:09:48.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-10T22:30:23.000Z", "avg_line_length": 46.5871212121, "max_line_length": 126, "alphanum_fraction": 0.5877713635, "num_tokens": 4514, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8976952866333484, "lm_q2_score": 0.5660185351961015, "lm_q1q2_score": 0.5081121711926523}}
{"text": "import Data.Either\nimport Data.List\nimport Data.Maybe\nimport Data.String\nimport Data.Binary\nimport Data.Binary.Digit\n\nimport System.File\n\nEq Digit where\n  I == I = True\n  O == O = True\n  I == O = False\n  O == I = False\n\nlookupMaybe : Nat -> List a -> Maybe a\nlookupMaybe _ [] = Nothing\nlookupMaybe Z (x :: _) = Just x\nlookupMaybe (S n) (_ :: l) = lookupMaybe n l\n\nsignificant : (Nat, Nat) -> Bin -> (Nat, Nat)\nsignificant (n, c) b = case lookupMaybe n b of\n                            Just d => case d of\n                                           I => (n, c + 1)\n                                           O => (n, c)\n                            Nothing => (n, c)\n\ntoBin : String -> Bin\ntoBin s = (\\c => if c == '1' then I else O) <$> unpack s\n\noxygen2 : Nat -> List Bin -> Bin\noxygen2 n [] = []\noxygen2 n (b :: []) = b\noxygen2 n l@(_ :: _ :: _) = let len = length l\n                                (_, c) = foldl significant (n, 0) l\n                                d = if c + c >= len then I else O in\n                                oxygen2 (n + 1) $ filter (\\b => case lookupMaybe n b of\n                                                                     Just d2 => d == d2\n                                                                     Nothing => False) $ l\n\noxygen : List Bin -> Bin\noxygen l = oxygen2 0 l\n\nscrubber2 : Nat -> List Bin -> Bin\nscrubber2 n [] = []\nscrubber2 n (b :: []) = b\nscrubber2 n l@(_ :: _ :: _) = let len = length l\n                                  (_, c) = foldl significant (n, 0) l\n                                  d = if c + c >= len then O else I in\n                                  scrubber2 (n + 1) $ filter (\\b => case lookupMaybe n b of\n                                                                         Just d2 => d == d2\n                                                                         Nothing => False) $ l\n\nscrubber : List Bin -> Bin\nscrubber l = scrubber2 0 l\n\nrun : String -> IO ()\nrun s = do let lines = toBin <$> (lines $ trim $ s)\n           let o = toNat $ reverse $ oxygen $ lines\n           let s = toNat $ reverse $ scrubber $ lines\n           putStrLn $ show $ s * o\n\nmain : IO ()\nmain = do Right s <- readFile \"input.txt\"\n            | Left err => putStrLn $ show err\n          run s\n\n", "meta": {"hexsha": "5cd6e82f6a546d46750f8bfcbb3a9125e653bb31", "size": 2262, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "03/main+.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "03/main+.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "03/main+.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.2647058824, "max_line_length": 94, "alphanum_fraction": 0.4173297966, "num_tokens": 562, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059414036511, "lm_q2_score": 0.640635868562172, "lm_q1q2_score": 0.5080921136329472}}
{"text": "||| Example Queries over AList implemented graphs.\n|||\n||| TODO make query higher-order.\nmodule Data.Graph.AList.Query\n\nimport Effects\nimport Effect.State\nimport Effect.StdIO\n\nimport Data.Graph.AList\n\nimport Data.Queue\nimport Data.Stack\n\n%access public\n\n-- --------------------------------------------------------------------- [ BFS ]\n||| The effects used in a BFS.\nBfsEffs : List EFFECT\nBfsEffs = [ 'next ::: STATE (Queue Node),\n            'seen ::: STATE (List Node),\n            STDIO]\n\n||| Traverse the given graph using a BFS, printing the visited nodes\n||| in order of visit.\nprivate\ndoTraceBFS : (Ord n, Show n) => Graph n e -> Eff () BfsEffs\ndoTraceBFS g = do\n   q <- 'next :- get\n   case popQ q of\n     Nothing         => pure () -- Stop if all nodes have been traversed.\n     Just (curr, q') => do\n       'next :- put q'\n       -- Do the thing we do at the nodes.\n       putStrLn $ show curr\n\n       -- Move on\n       let es = getSuccs curr g\n       doMoves es\n\n       -- Repeat\n       doTraceBFS g\n  where\n    doMove : Node -> Eff () BfsEffs\n    doMove n = do\n      visited <- 'seen :- get\n      case elem n visited of\n        True => pure ()\n        False => do\n          'seen :- update (\\xs => [n] ++ xs)\n          'next :- update (\\xs => pushQ n xs)\n\n    doMoves : Maybe (List Node) -> Eff () BfsEffs\n    doMoves Nothing = pure ()\n    doMoves (Just Nil) = pure ()\n    doMoves (Just (e::es)) = do\n       doMove e\n       doMoves (Just es)\n\n||| Traverse the given graph using a BFS, printing the visited nodes\n||| in order of visit.\ntraceBfsIO : (Ord v, Show v) => Node -> Graph v e -> IO ()\ntraceBfsIO n g = runInit ['next := initQ n, 'seen := List.Nil, ()] $ doTraceBFS g\n\n-- --------------------------------------------------------------------- [ DFS ]\n||| The Effects used in a DFS.\nDfsEffs : List EFFECT\nDfsEffs = [ 'next ::: STATE (Stack Node),\n            'seen ::: STATE (List Node),\n            STDIO]\n\n||| Traverse the given graph using a DFS, printing the visited nodes\n||| in order of visit.\ndoTraceDFS : (Ord n, Show n) => Graph n e -> Eff () DfsEffs\ndoTraceDFS g = do\n    s <- 'next :- get\n    case popS s of\n      Nothing         => pure ()\n      Just (curr, s') => do\n        'next :- put s'\n        visited <- 'seen :- get\n        case elem curr visited of\n          True  => pure ()\n          False => do\n            putStrLn $ show curr\n            let es = getSuccs curr g\n            'seen :- update (\\xs => [curr] ++ xs)\n            'next :- update (\\xs => pushSThings (fromMaybe Nil es) s)\n            doTraceDFS g\n\n||| Traverse the given graph using a DFS, printing the visited nodes\n||| in order of visit.\ntraceDfsIO : (Ord v, Show v) => Node -> Graph v e -> IO ()\ntraceDfsIO n g = runInit ['next := initS n, 'seen := List.Nil, ()] $ doTraceDFS g\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "5607c533fa71aeaecb7920f030a226cb46d2a022", "size": 2866, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "examples/GraphQueries.idr", "max_stars_repo_name": "MarcelineVQ/idris-containers", "max_stars_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 99, "max_stars_repo_stars_event_min_datetime": "2015-03-01T20:22:37.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-01T02:17:39.000Z", "max_issues_repo_path": "examples/GraphQueries.idr", "max_issues_repo_name": "MarcelineVQ/idris-containers", "max_issues_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 30, "max_issues_repo_issues_event_min_datetime": "2015-03-23T19:17:35.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-01T13:05:44.000Z", "max_forks_repo_path": "examples/GraphQueries.idr", "max_forks_repo_name": "MarcelineVQ/idris-containers", "max_forks_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 26, "max_forks_repo_forks_event_min_datetime": "2015-06-02T17:20:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-13T14:51:07.000Z", "avg_line_length": 29.8541666667, "max_line_length": 81, "alphanum_fraction": 0.5240753664, "num_tokens": 768, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7401743620390163, "lm_q2_score": 0.6859494678483918, "lm_q1q2_score": 0.5077222097556862}}
{"text": "> module NonNegRational.open_issues.Main\n\n> import NonNegRational.NonNegRational\n> import NonNegRational.BasicOperations\n> import NonNegRational.BasicProperties\n> import Fraction.Fraction\n> import PNat.PNat\n> import Nat.Positive\n\n> %default total\n> %auto_implicits off\n\n> n : Nat\n> n = 1\n\n> x : NonNegRational\n> x = fromFraction (1, Element (S n) MkPositive)\n\n> y : NonNegRational\n> y = fromFraction (n, Element (S n) MkPositive)\n\n> q : x + y = 1\n> q = Refl\n\n> main : IO ()\n> main = do putStrLn (\"x           = \" ++ show x)\n>           putStrLn (\"y           = \" ++ show y)\n>           putStrLn (\"x + y       = \" ++ show (x + y))\n\nFor small |n|, type checking time is roughly constant in |n| and\nexecution time is roughly linear in |n| as one would expect. But:\n\n1) For |n > 399| the computation segfaults\n\n2) Uncommenting lines 22-23 (the computation of |q|) yields unacceptable\n   type checking times even for very small |n|:\n\n     n = 1  ->   16 sec.\n     n = 2  ->   18 sec.\n     n = 3  ->   20 sec.\n     n = 4  ->   28 sec.\n     n = 5  ->   47 sec.\n     n = 6  ->   88 sec.\n     n = 7  ->  188 sec.\n     n = 8  ->  647 sec.\n     n = 9  ->  killed\n\n\n\n", "meta": {"hexsha": "9297d47da1288b4d6540626667c7c38e06624cd4", "size": 1155, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "NonNegRational/open_issues/rt_vs_tct_costs.lidr", "max_stars_repo_name": "zenntenn/IdrisLibs", "max_stars_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "NonNegRational/open_issues/rt_vs_tct_costs.lidr", "max_issues_repo_name": "zenntenn/IdrisLibs", "max_issues_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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": "NonNegRational/open_issues/rt_vs_tct_costs.lidr", "max_forks_repo_name": "zenntenn/IdrisLibs", "max_forks_repo_head_hexsha": "a81c3674273a4658cd205e9bd1b6f95163cefc3e", "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.1, "max_line_length": 72, "alphanum_fraction": 0.5835497835, "num_tokens": 380, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7879311956428947, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5076050584169765}}
{"text": "module Control.Applicative.Indexed\n\nimport Control.Functor.Indexed\n\ninfixl 3 <<*>>, <<*, *>>\n\npublic export\ninterface IndexedFunctor z z f => IndexedApplicative z f | f where\n  total\n  pure : {0 i : z} -> (x : a) -> f a i i\n\n  total\n  ap : {0 i,j,k : z} -> f (a -> b) i j -> f a j k -> f b i k\n\npublic export\n(<<*>>) : IndexedApplicative z f => f (a -> b) i j -> f a j k -> f b i k\n(<<*>>) = ap\n\npublic export\n(<<*) : IndexedApplicative z f => f a i j -> f b j k -> f a i k\nx <<* y = map const x <<*>> y\n\npublic export\n(*>>) : IndexedApplicative z f => f a i j -> f b j k -> f b i k\nx *>> y = map (const id) x <<*>> y\n\n||| Conditionally execute an applicative expression when the boolean is true.\npublic export\nwhen : IndexedApplicative z f => Bool -> Lazy (f () i i) -> f () i i\nwhen True y  = y\nwhen False y = pure ()\n\n||| Execute an applicative expression unless the boolean is true.\n%inline\npublic export\nunless : IndexedApplicative z f => Bool -> Lazy (f () i i) -> f () i i\nunless = when . not\n\n||| Map each element of a structure to a computation, evaluate those\n||| computations and discard the results.\npublic export\ntraverse_ : (Foldable t, IndexedApplicative z f) => (a -> f b i i) -> t a -> f () i i\ntraverse_ f = foldr ((*>>) . f) (pure ())\n\n||| Evaluate each computation in a structure and discard the results.\npublic export\nsequence_ : (Foldable t, IndexedApplicative z f) => t (f a i i) -> f () i i\nsequence_ = foldr (*>>) (pure ())\n\n||| Like `traverse_` but with the arguments flipped.\npublic export\nfor_ : (Foldable t, IndexedApplicative z f) => t a -> (a -> f b i i) -> f () i i\nfor_ = flip traverse_\n\n", "meta": {"hexsha": "0075ecb3b324cf7c0362b18cd026deb50ffe7db2", "size": 1621, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Control/Applicative/Indexed.idr", "max_stars_repo_name": "mattpolzin/idris-indexed", "max_stars_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "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/Control/Applicative/Indexed.idr", "max_issues_repo_name": "mattpolzin/idris-indexed", "max_issues_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-12-05T08:05:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-15T07:26:51.000Z", "max_forks_repo_path": "src/Control/Applicative/Indexed.idr", "max_forks_repo_name": "mattpolzin/idris-indexed", "max_forks_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "max_forks_repo_licenses": ["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.4727272727, "max_line_length": 85, "alphanum_fraction": 0.6169031462, "num_tokens": 516, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7879311956428947, "lm_q2_score": 0.6442250928250375, "lm_q1q2_score": 0.5076050476527866}}
{"text": "module Main\n\nimport Data.Vect\nimport System.REPL\nimport Data.String\n\ninfixr 5 .+.\n\ndata Schema = SString\n            | SInt\n            | (.+.) Schema Schema\n\nSchemaType : Schema -> Type\nSchemaType SString = String\nSchemaType SInt = Int\nSchemaType (x .+. y) = (SchemaType x, SchemaType y)\n\nrecord DataStore where\n  constructor MkData\n  schema : Schema\n  size : Nat\n  items : Vect size (SchemaType schema)\n\nitems : (store : DataStore) -> Vect (size store) (SchemaType (schema store))\nitems (MkData _ _ items') = items'\n\n-- addToStore : DataStore -> String -> DataStore\n-- addToStore (MkData _ items) newitem = MkData _ (addToData items)\n--   where\n--     addToData : Vect old String -> Vect (S old) String\n--     addToData [] = [newitem]\n--     addToData (item :: items) = item :: addToData items\n\n-- data Command = Add String\n--              | Get Integer\n--              | Quit\n\n-- parseCommand : String -> String -> Maybe Command\n-- parseCommand \"add\" str = Just (Add str)\n-- parseCommand \"get\" val = case all isDigit (unpack val) of\n--                               False => Nothing\n--                               True => Just (Get (cast val))\n-- parseCommand \"quit\" \"\" = Just Quit\n-- parseCommand _ _ = Nothing\n\n-- parse : (input : String) -> Maybe Command\n-- parse input = let (cmd, args) = span (/= ' ') input in\n--                   parseCommand cmd (ltrim args)\n\n-- getEntry : Integer -> DataStore -> Maybe (String, DataStore)\n-- getEntry pos store = let storeItems = items store in\n--                          case integerToFin pos (size store) of\n--                               Nothing => Just (\"Out of range\\n\", store)\n--                               Just id => Just (index id storeItems ++ \"\\n\", store)\n\n-- processCommand : DataStore -> Command -> Maybe (String, DataStore)\n-- processCommand store (Add item) = Just (\"ID \" ++ show (size store) ++ \"\\n\", addToStore store item)\n-- processCommand store (Get pos) = getEntry pos store\n-- processCommand store Quit = Nothing\n\n-- processInput : DataStore -> String -> Maybe (String, DataStore)\n-- processInput store input = case parse input of\n--                                 Nothing => Just (\"Invalid command\\n\", store)\n--                                 Just cmd => processCommand store cmd\n\n-- main : IO ()\n-- main = replWith (MkData _ []) \"Command: \" processInput\n", "meta": {"hexsha": "69e4a5a64fe0a0fd71beb7b9f3b83315d4a83068", "size": 2332, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "DataStore.idr", "max_stars_repo_name": "brunoflores/type-driven-with-idris", "max_stars_repo_head_hexsha": "52bb008df2c34bdecab4a37aea626be33042e611", "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": "DataStore.idr", "max_issues_repo_name": "brunoflores/type-driven-with-idris", "max_issues_repo_head_hexsha": "52bb008df2c34bdecab4a37aea626be33042e611", "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": "DataStore.idr", "max_forks_repo_name": "brunoflores/type-driven-with-idris", "max_forks_repo_head_hexsha": "52bb008df2c34bdecab4a37aea626be33042e611", "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": 34.2941176471, "max_line_length": 101, "alphanum_fraction": 0.5904802744, "num_tokens": 573, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7745833841649233, "lm_q2_score": 0.6548947357776795, "lm_q1q2_score": 0.5072705807104683}}
{"text": "\nmodule Main\n\nimport System\n\ncountdown : (secs : Nat) -> IO ()\ncountdown Z = putStrLn \"Kaboom\"\ncountdown secs@(S k) = do putStrLn $ show secs\n                          usleep 1000000\n                          countdown k\n", "meta": {"hexsha": "2e70b5ba8fbd018c5e6f6a31e4f3a6fb6d9b4367", "size": 221, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Chapter5/Loops.idr", "max_stars_repo_name": "robkorn/idris-type-driven-development-exercises", "max_stars_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-12-18T12:54:01.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-28T09:54:21.000Z", "max_issues_repo_path": "Chapter5/Loops.idr", "max_issues_repo_name": "robkorn/idris-type-driven-development-exercises", "max_issues_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "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": "Chapter5/Loops.idr", "max_forks_repo_name": "robkorn/idris-type-driven-development-exercises", "max_forks_repo_head_hexsha": "d3dcf7e0e0707c991a20c020e671e6e0aa21cf84", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-12-18T12:54:05.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-18T12:54:05.000Z", "avg_line_length": 20.0909090909, "max_line_length": 46, "alphanum_fraction": 0.5429864253, "num_tokens": 53, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7662936324115011, "lm_q2_score": 0.6619228691808011, "lm_q1q2_score": 0.507227279800799}}
{"text": "module Main\n\nimport Effects\nimport Effect.State\n\n\ndata BTree a = Leaf\n             | Node (BTree a) a (BTree a)\n\nShow a => Show (BTree a) where\n    show Leaf = \"[]\"\n    show (Node l x r) = \"[\" ++ show l ++ \" \"\n                            ++ show x ++ \" \"\n                            ++ show r ++ \"]\"\n\ntestTree : BTree String\ntestTree = Node (Node Leaf \"Jim\" Leaf)\n                \"Fred\"\n                (Node (Node Leaf \"Alice\" Leaf)\n                      \"Sheila\"\n                      (Node Leaf \"Bob\" Leaf))\n\n-- treeTag : (i : Int) -> BTree a -> BTree (Int, a)\n\n-- treeTagAux : (i : Int) -> BTree a -> (Int, BTree (Int, a))\n-- treeTagAux i Leaf = (i, Leaf)\n-- treeTagAux i (Node l x r)\n--        = let (i', l') = treeTagAux i l in\n--          let x' = (i', x) in\n--          let (i'', r') = treeTagAux (i' + 1) r in\n--              (i'', Node l' x' r')\n\ntreeTagAux : BTree a -> Eff (BTree (Int, a)) [STATE Int]\ntreeTagAux Leaf = pure Leaf\ntreeTagAux (Node l x r)\n    = do l' <- treeTagAux l\n         i <- get\n         put (i + 1)\n         r' <- treeTagAux r\n         pure (Node l' (i, x) r')\n\n\n-- treeTag : (i : Int) -> BTree a -> BTree (Int, a)\n-- treeTag i x = snd (treeTagAux i x)\n\ntreeTag : (i : Int) -> BTree a -> BTree (Int, a)\ntreeTag i x = runPure (do put i\n                          treeTagAux x)\n\n\nmain : IO ()\nmain = print (treeTag 1 testTree)\n", "meta": {"hexsha": "7f1f216aff77c3d09d5dbc1adb527061e728718d", "size": 1358, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Trees.idr", "max_stars_repo_name": "asmodehn/idris-playground", "max_stars_repo_head_hexsha": "d9300213e5a688c455c03fecdc3fd30417945cb9", "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": "Trees.idr", "max_issues_repo_name": "asmodehn/idris-playground", "max_issues_repo_head_hexsha": "d9300213e5a688c455c03fecdc3fd30417945cb9", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Trees.idr", "max_forks_repo_name": "asmodehn/idris-playground", "max_forks_repo_head_hexsha": "d9300213e5a688c455c03fecdc3fd30417945cb9", "max_forks_repo_licenses": ["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.6226415094, "max_line_length": 61, "alphanum_fraction": 0.4639175258, "num_tokens": 432, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7185943925708561, "lm_q2_score": 0.7057850278370112, "lm_q1q2_score": 0.5071731633641419}}
{"text": "--\n-- Primitive casts: Specification\n--\n-- a. Unsigned integers\n--\n--    Unsigned integers with a precision of x bit have a valid\n--    range of [0,2^x - 1]. When casting from another integral type of value y,\n--    the value is checked for being in bounds, and if it is not, the\n--    unsigned remainder modulo 2^x of y is returned.\n--\n--    When casting from a `Double`, the value is first truncated towards 0,\n--    before applying the inbounds check and (if necessary) calculating\n--    the unsigned remainder modulo 2^x.\n--\n--    When casting from a `String`, the value is first converted to a floating\n--    point number by the backend and then truncated as described above.\n--\n--    Example: For `Bits8` the valid range is [0,255]. Below are some\n--             example casts.\n--\n--               cast {from = Integer} {to = Bits8} 12   = 12\n--               cast {from = Integer} {to = Bits8} 256  = 0\n--               cast {from = Integer} {to = Bits8} 259  = 3\n--               cast {from = Integer} {to = Bits8} (-2) = 254\n--               cast {from = Double} {to = Bits8} (-12.001) = 244\n--               cast {from = Double} {to = Bits8} (\"-12.001\") = 244\n--\n-- b. Signed integers\n--\n--    Signed integers with a precision of x bit have a valid\n--    range of [-2^(x-1),2^(x-1) - 1]. When casting from another\n--    integral type of value y, the unsigned remainder module 2^x\n--    is calculated. If the result is >= 2^(x-1), 2^x is subtracted\n--    from the result. This is the same behavior as for instance in Haskell.\n--\n--    When casting from a `Double`, the value is first truncated towards 0,\n--    before applying the inbounds check and (if necessary) truncating\n--    the value.\n--\n--    When casting from a `String`, the value is first converted to a floating\n--    point number by the backend and then truncated as described above.\n--\n--    Example: For `Int8` the valid range is [-128,127]. Below are some\n--             example casts.\n--\n--               cast {from = Integer} {to = Int8} 12   = 12\n--               cast {from = Integer} {to = Int8} 256  = 0\n--               cast {from = Integer} {to = Int8} 259  = 4\n--               cast {from = Integer} {to = Int8} (-128) = (-128)\n--               cast {from = Integer} {to = Int8} (-129) = 127\n--               cast {from = Double}  {to = Int8} (-12.001) = (-12)\n--               cast {from = Double}  {to = Int8} (\"-12.001\") = (-12)\n--\n-- c. Characters\n--\n--    Casts from all integral types to `Char` are supported. Note however,\n--    that only casts in the non-surrogate range are supported, that is\n--    values in the ranges [0,0xd7ff] and [0xe000,0x10ffff], or, in decimal\n--    notation, [0,55295] and [57344,1114111].\n--\n--    All casts from integer types to `Char` are therefore submitted to a\n--    bounds check, and, in case the value is out of bounds, are converted to `'\\0'`.\n--\n--\n-- Test all casts from and to integral types.\n-- The `Cast` implementations in here should go to `Prelude`, once\n-- a new minor version of the compiler is released.\n--\n-- These tests verify also that the full range of integer literals\n-- is supported for every integral type.\n--\n-- Nothing fancy is being done here:\n-- All test cases have been hand-written.\n\nimport Data.List\n\n--------------------------------------------------------------------------------\n--          Int8\n--------------------------------------------------------------------------------\n\nShow Int8 where\n  show = prim__cast_Int8String\n\npublic export\nEq Int8 where\n  x == y = intToBool (prim__eq_Int8 x y)\n\nNum Int8 where\n  (+) = prim__add_Int8\n  (*) = prim__mul_Int8\n  fromInteger = prim__cast_IntegerInt8\n\nNeg Int8 where\n  (-)    = prim__sub_Int8\n  negate = prim__sub_Int8 0\n\nCast Int8 Bits8 where\n  cast = prim__cast_Int8Bits8\n\nCast Int8 Bits16 where\n  cast = prim__cast_Int8Bits16\n\nCast Int8 Bits32 where\n  cast = prim__cast_Int8Bits32\n\nCast Int8 Bits64 where\n  cast = prim__cast_Int8Bits64\n\nCast Int8 Int16 where\n  cast = prim__cast_Int8Int16\n\nCast Int8 Int32 where\n  cast = prim__cast_Int8Int32\n\nCast Int8 Int64 where\n  cast = prim__cast_Int8Int64\n\nCast Int8 Int where\n  cast = prim__cast_Int8Int\n\nCast Int8 Integer where\n  cast = prim__cast_Int8Integer\n\nCast Int8 String where\n  cast = prim__cast_Int8String\n\nCast Int8 Char where\n  cast = prim__cast_Int8Char\n\nCast Int8 Double where\n  cast = prim__cast_Int8Double\n\n--------------------------------------------------------------------------------\n--          Int16\n--------------------------------------------------------------------------------\n\npublic export\nEq Int16 where\n  x == y = intToBool (prim__eq_Int16 x y)\n\nShow Int16 where\n  show = prim__cast_Int16String\n\nNum Int16 where\n  (+) = prim__add_Int16\n  (*) = prim__mul_Int16\n  fromInteger = prim__cast_IntegerInt16\n\nNeg Int16 where\n  (-)    = prim__sub_Int16\n  negate = prim__sub_Int16 0\n\nCast Int16 Bits8 where\n  cast = prim__cast_Int16Bits8\n\nCast Int16 Bits16 where\n  cast = prim__cast_Int16Bits16\n\nCast Int16 Bits32 where\n  cast = prim__cast_Int16Bits32\n\nCast Int16 Bits64 where\n  cast = prim__cast_Int16Bits64\n\nCast Int16 Int8 where\n  cast = prim__cast_Int16Int8\n\nCast Int16 Int32 where\n  cast = prim__cast_Int16Int32\n\nCast Int16 Int64 where\n  cast = prim__cast_Int16Int64\n\nCast Int16 Int where\n  cast = prim__cast_Int16Int\n\nCast Int16 Integer where\n  cast = prim__cast_Int16Integer\n\nCast Int16 String where\n  cast = prim__cast_Int16String\n\nCast Int16 Char where\n  cast = prim__cast_Int16Char\n\nCast Int16 Double where\n  cast = prim__cast_Int16Double\n\n--------------------------------------------------------------------------------\n--          Int32\n--------------------------------------------------------------------------------\n\nShow Int32 where\n  show = prim__cast_Int32String\n\npublic export\nEq Int32 where\n  x == y = intToBool (prim__eq_Int32 x y)\n\nNum Int32 where\n  (+) = prim__add_Int32\n  (*) = prim__mul_Int32\n  fromInteger = prim__cast_IntegerInt32\n\nNeg Int32 where\n  (-)    = prim__sub_Int32\n  negate = prim__sub_Int32 0\n\nCast Int32 Bits8 where\n  cast = prim__cast_Int32Bits8\n\nCast Int32 Bits16 where\n  cast = prim__cast_Int32Bits16\n\nCast Int32 Bits32 where\n  cast = prim__cast_Int32Bits32\n\nCast Int32 Bits64 where\n  cast = prim__cast_Int32Bits64\n\nCast Int32 Int8 where\n  cast = prim__cast_Int32Int8\n\nCast Int32 Int16 where\n  cast = prim__cast_Int32Int16\n\nCast Int32 Int64 where\n  cast = prim__cast_Int32Int64\n\nCast Int32 Int where\n  cast = prim__cast_Int32Int\n\nCast Int32 Integer where\n  cast = prim__cast_Int32Integer\n\nCast Int32 String where\n  cast = prim__cast_Int32String\n\nCast Int32 Char where\n  cast = prim__cast_Int32Char\n\nCast Int32 Double where\n  cast = prim__cast_Int32Double\n\n--------------------------------------------------------------------------------\n--          Int64\n--------------------------------------------------------------------------------\n\nShow Int64 where\n  show = prim__cast_Int64String\n\npublic export\nEq Int64 where\n  x == y = intToBool (prim__eq_Int64 x y)\n\nNum Int64 where\n  (+) = prim__add_Int64\n  (*) = prim__mul_Int64\n  fromInteger = prim__cast_IntegerInt64\n\nNeg Int64 where\n  (-)    = prim__sub_Int64\n  negate = prim__sub_Int64 0\n\nCast Int64 Bits8 where\n  cast = prim__cast_Int64Bits8\n\nCast Int64 Bits16 where\n  cast = prim__cast_Int64Bits16\n\nCast Int64 Bits32 where\n  cast = prim__cast_Int64Bits32\n\nCast Int64 Bits64 where\n  cast = prim__cast_Int64Bits64\n\nCast Int64 Int8 where\n  cast = prim__cast_Int64Int8\n\nCast Int64 Int16 where\n  cast = prim__cast_Int64Int16\n\nCast Int64 Int32 where\n  cast = prim__cast_Int64Int32\n\nCast Int64 Int where\n  cast = prim__cast_Int64Int\n\nCast Int64 Integer where\n  cast = prim__cast_Int64Integer\n\nCast Int64 String where\n  cast = prim__cast_Int64String\n\nCast Int64 Char where\n  cast = prim__cast_Int64Char\n\nCast Int64 Double where\n  cast = prim__cast_Int64Double\n\n--------------------------------------------------------------------------------\n--          Int\n--------------------------------------------------------------------------------\n\nCast Int Int8 where\n  cast = prim__cast_IntInt8\n\nCast Int Int16 where\n  cast = prim__cast_IntInt16\n\nCast Int Int32 where\n  cast = prim__cast_IntInt32\n\nCast Int Int64 where\n  cast = prim__cast_IntInt64\n\n--------------------------------------------------------------------------------\n--          Integer\n--------------------------------------------------------------------------------\n\nCast Integer Int8 where\n  cast = prim__cast_IntegerInt8\n\nCast Integer Int16 where\n  cast = prim__cast_IntegerInt16\n\nCast Integer Int32 where\n  cast = prim__cast_IntegerInt32\n\nCast Integer Int64 where\n  cast = prim__cast_IntegerInt64\n\nCast Integer Char where\n  cast = prim__cast_IntegerChar\n\n--------------------------------------------------------------------------------\n--          Bits8\n--------------------------------------------------------------------------------\n\nCast Bits8 Int8 where\n  cast = prim__cast_Bits8Int8\n\nCast Bits8 Int16 where\n  cast = prim__cast_Bits8Int16\n\nCast Bits8 Int32 where\n  cast = prim__cast_Bits8Int32\n\nCast Bits8 Int64 where\n  cast = prim__cast_Bits8Int64\n\nCast Bits8 String where\n  cast = prim__cast_Bits8String\n\nCast Bits8 Char where\n  cast = prim__cast_Bits8Char\n\nCast Bits8 Double where\n  cast = prim__cast_Bits8Double\n\n--------------------------------------------------------------------------------\n--          Bits16\n--------------------------------------------------------------------------------\n\nCast Bits16 Int8 where\n  cast = prim__cast_Bits16Int8\n\nCast Bits16 Int16 where\n  cast = prim__cast_Bits16Int16\n\nCast Bits16 Int32 where\n  cast = prim__cast_Bits16Int32\n\nCast Bits16 Int64 where\n  cast = prim__cast_Bits16Int64\n\nCast Bits16 String where\n  cast = prim__cast_Bits16String\n\nCast Bits16 Char where\n  cast = prim__cast_Bits16Char\n\nCast Bits16 Double where\n  cast = prim__cast_Bits16Double\n\n--------------------------------------------------------------------------------\n--          Bits32\n--------------------------------------------------------------------------------\n\nCast Bits32 Int8 where\n  cast = prim__cast_Bits32Int8\n\nCast Bits32 Int16 where\n  cast = prim__cast_Bits32Int16\n\nCast Bits32 Int32 where\n  cast = prim__cast_Bits32Int32\n\nCast Bits32 Int64 where\n  cast = prim__cast_Bits32Int64\n\nCast Bits32 String where\n  cast = prim__cast_Bits32String\n\nCast Bits32 Char where\n  cast = prim__cast_Bits32Char\n\nCast Bits32 Double where\n  cast = prim__cast_Bits32Double\n\n--------------------------------------------------------------------------------\n--          Bits64\n--------------------------------------------------------------------------------\n\nCast Bits64 Int8 where\n  cast = prim__cast_Bits64Int8\n\nCast Bits64 Int16 where\n  cast = prim__cast_Bits64Int16\n\nCast Bits64 Int32 where\n  cast = prim__cast_Bits64Int32\n\nCast Bits64 Int64 where\n  cast = prim__cast_Bits64Int64\n\nCast Bits64 String where\n  cast = prim__cast_Bits64String\n\nCast Bits64 Char where\n  cast = prim__cast_Bits64Char\n\nCast Bits64 Double where\n  cast = prim__cast_Bits64Double\n\n--------------------------------------------------------------------------------\n--          String\n--------------------------------------------------------------------------------\n\nCast String Bits8 where\n  cast = prim__cast_StringBits8\n\nCast String Bits16 where\n  cast = prim__cast_StringBits16\n\nCast String Bits32 where\n  cast = prim__cast_StringBits32\n\nCast String Bits64 where\n  cast = prim__cast_StringBits64\n\nCast String Int8 where\n  cast = prim__cast_StringInt8\n\nCast String Int16 where\n  cast = prim__cast_StringInt16\n\nCast String Int32 where\n  cast = prim__cast_StringInt32\n\nCast String Int64 where\n  cast = prim__cast_StringInt64\n\n--------------------------------------------------------------------------------\n--          Double\n--------------------------------------------------------------------------------\n\nCast Double Bits8 where\n  cast = prim__cast_DoubleBits8\n\nCast Double Bits16 where\n  cast = prim__cast_DoubleBits16\n\nCast Double Bits32 where\n  cast = prim__cast_DoubleBits32\n\nCast Double Bits64 where\n  cast = prim__cast_DoubleBits64\n\nCast Double Int8 where\n  cast = prim__cast_DoubleInt8\n\nCast Double Int16 where\n  cast = prim__cast_DoubleInt16\n\nCast Double Int32 where\n  cast = prim__cast_DoubleInt32\n\nCast Double Int64 where\n  cast = prim__cast_DoubleInt64\n\n--------------------------------------------------------------------------------\n--          Tests\n--------------------------------------------------------------------------------\n\nshowTpe : Type -> String\nshowTpe Bits16  = \"Bits16\"\nshowTpe Bits32  = \"Bits32\"\nshowTpe Bits64  = \"Bits64\"\nshowTpe Bits8   = \"Bits8\"\nshowTpe Char    = \"Char\"\nshowTpe Double  = \"Double\"\nshowTpe Int     = \"Int\"\nshowTpe Int16   = \"Int16\"\nshowTpe Int32   = \"Int32\"\nshowTpe Int64   = \"Int64\"\nshowTpe Int8    = \"Int8\"\nshowTpe Integer = \"Integer\"\nshowTpe String  = \"String\"\nshowTpe _       = \"unknown type\"\n\ntestCasts : (a: Type) -> (b : Type) -> (Cast a b, Show a, Show b, Eq b) =>\n            List (a,b) -> List String\ntestCasts a b = mapMaybe doTest\n  where doTest : (a,b) -> Maybe String\n        doTest (x,y) =\n          let y2 = cast {to = b} x\n           in if y == y2 then Nothing\n              else Just $  #\"Invalid cast from \\#{showTpe a} to \\#{showTpe b}: \"#\n                        ++ #\"expected \\#{show y} but got \\#{show y2} when casting from \\#{show x}\"#\n\nmaxBits8 : Bits8\nmaxBits8 = 0xff\n\nmaxBits16 : Bits16\nmaxBits16 = 0xffff\n\nmaxBits32 : Bits32\nmaxBits32 = 0xffffffff\n\nmaxBits64 : Bits64\nmaxBits64 = 0xffffffffffffffff\n\nresults : List String\nresults =  testCasts Int8 Int16   [(-129,127),(-128,-128),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Int32   [(-129,127),(-128,-128),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Int64   [(-129,127),(-128,-128),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Int     [(-129,127),(-128,-128),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Double  [(-129,127),(-128,-128),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 String  [(-129,\"127\"),(-128,\"-128\"),(0,\"0\"),(127,\"127\"),(128,\"-128\")]\n        ++ testCasts Int8 Integer [(-129,127),(-128,-128),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Bits8   [(-129,127),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Bits16  [(-129,127),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Bits32  [(-129,127),(0,0),(127,127),(128,-128)]\n        ++ testCasts Int8 Bits64  [(-129,127),(0,0),(127,127),(128,-128)]\n\n        ++ testCasts Int16 Int8    [(-32769,32767),(-32768,0),(0,0),(32767,-1),(32768,0)]\n        ++ testCasts Int16 Int32   [(-32769,32767),(-32768,-32768),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 Int64   [(-32769,32767),(-32768,-32768),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 Int     [(-32769,32767),(-32768,-32768),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 Double  [(-32769,32767),(-32768,-32768),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 String  [(-32769,\"32767\"),(-32768,\"-32768\"),(0,\"0\"),(32767,\"32767\"),(32768,\"-32768\")]\n        ++ testCasts Int16 Integer [(-32769,32767),(-32768,-32768),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 Bits8   [(-32769,32767),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 Bits16  [(-32769,32767),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 Bits32  [(-32769,32767),(0,0),(32767,32767),(32768,-32768)]\n        ++ testCasts Int16 Bits64  [(-32769,32767),(0,0),(32767,32767),(32768,-32768)]\n\n        ++ testCasts Int32 Int8    [(-2147483649,2147483647),(-2147483648,0),(0,0),(2147483647,-1),(2147483648,0)]\n        ++ testCasts Int32 Int16   [(-2147483649,2147483647),(-2147483648,0),(0,0),(2147483647,-1),(2147483648,0)]\n        ++ testCasts Int32 Int64   [(-2147483649,2147483647),(-2147483648,-2147483648),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n        ++ testCasts Int32 Int     [(-2147483649,2147483647),(-2147483648,-2147483648),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n        ++ testCasts Int32 Double  [(-2147483649,2147483647),(-2147483648,-2147483648),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n        ++ testCasts Int32 String  [(-2147483649,\"2147483647\"),(-2147483648,\"-2147483648\"),(0,\"0\"),(2147483647,\"2147483647\"),(2147483648,\"-2147483648\")]\n        ++ testCasts Int32 Integer [(-2147483649,2147483647),(-2147483648,-2147483648),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n        ++ testCasts Int32 Bits8   [(-2147483649,2147483647),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n        ++ testCasts Int32 Bits16  [(-2147483649,2147483647),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n        ++ testCasts Int32 Bits32  [(-2147483649,2147483647),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n        ++ testCasts Int32 Bits64  [(-2147483649,2147483647),(0,0),(2147483647,2147483647),(2147483648,-2147483648)]\n\n        ++ testCasts Int64 Int8    [(-9223372036854775809,9223372036854775807),(-9223372036854775808,0),(0,0),(9223372036854775807,-1),(9223372036854775808,0)]\n        ++ testCasts Int64 Int16   [(-9223372036854775809,9223372036854775807),(-9223372036854775808,0),(0,0),(9223372036854775807,-1),(9223372036854775808,0)]\n        ++ testCasts Int64 Int32   [(-9223372036854775809,9223372036854775807),(-9223372036854775808,0),(0,0),(9223372036854775807,-1),(9223372036854775808,0)]\n        ++ testCasts Int64 Int     [(-9223372036854775809,9223372036854775807),(-9223372036854775808,-9223372036854775808),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n        ++ testCasts Int64 Double  [(-9223372036854775809,9223372036854775807),(-9223372036854775808,-9223372036854775808),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n        ++ testCasts Int64 String  [(-9223372036854775809,\"9223372036854775807\"),(-9223372036854775808,\"-9223372036854775808\"),(0,\"0\"),(9223372036854775807,\"9223372036854775807\"),(9223372036854775808,\"-9223372036854775808\")]\n        ++ testCasts Int64 Integer [(-9223372036854775809,9223372036854775807),(-9223372036854775808,-9223372036854775808),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n        ++ testCasts Int64 Bits8   [(-9223372036854775809,255),(0,0),(9223372036854775807,0xff),(9223372036854775808,0)]\n        ++ testCasts Int64 Bits16  [(-9223372036854775809,65535),(0,0),(9223372036854775807,0xffff),(9223372036854775808,0)]\n        ++ testCasts Int64 Bits32  [(-9223372036854775809,4294967295),(0,0),(9223372036854775807,0xffffffff),(9223372036854775808,0)]\n        ++ testCasts Int64 Bits64  [(-9223372036854775809,9223372036854775807),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n\n        ++ testCasts Int Int8    [(-9223372036854775809,9223372036854775807),(-9223372036854775808,0),(0,0),(9223372036854775807,-1),(9223372036854775808,0)]\n        ++ testCasts Int Int16   [(-9223372036854775809,9223372036854775807),(-9223372036854775808,0),(0,0),(9223372036854775807,-1),(9223372036854775808,0)]\n        ++ testCasts Int Int32   [(-9223372036854775809,9223372036854775807),(-9223372036854775808,0),(0,0),(9223372036854775807,-1),(9223372036854775808,0)]\n        ++ testCasts Int Int64   [(-9223372036854775809,9223372036854775807),(-9223372036854775808,-9223372036854775808),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n        ++ testCasts Int Double  [(-9223372036854775809,9223372036854775807),(-9223372036854775808,-9223372036854775808),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n        ++ testCasts Int String  [(-9223372036854775809,\"9223372036854775807\"),(-9223372036854775808,\"-9223372036854775808\"),(0,\"0\"),(9223372036854775807,\"9223372036854775807\"),(9223372036854775808,\"-9223372036854775808\")]\n        ++ testCasts Int Integer [(-9223372036854775809,9223372036854775807),(-9223372036854775808,-9223372036854775808),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n        ++ testCasts Int Bits8   [(-9223372036854775809,255),(0,0),(9223372036854775807,0xff),(9223372036854775808,0)]\n        ++ testCasts Int Bits16  [(-9223372036854775809,65535),(0,0),(9223372036854775807,0xffff),(9223372036854775808,0)]\n        ++ testCasts Int Bits32  [(-9223372036854775809,4294967295),(0,0),(9223372036854775807,0xffffffff),(9223372036854775808,0)]\n        ++ testCasts Int Bits64  [(-9223372036854775809,9223372036854775807),(0,0),(9223372036854775807,9223372036854775807),(9223372036854775808,-9223372036854775808)]\n\n        ++ testCasts Integer Int8    [(-170141183460469231731687303715884105729,-1),(-170141183460469231731687303715884105728,0),(0,0),(170141183460469231731687303715884105727,-1),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer Int16   [(-170141183460469231731687303715884105729,-1),(-170141183460469231731687303715884105728,0),(0,0),(170141183460469231731687303715884105727,-1),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer Int32   [(-170141183460469231731687303715884105729,-1),(-170141183460469231731687303715884105728,0),(0,0),(170141183460469231731687303715884105727,-1),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer Int64   [(-170141183460469231731687303715884105729,-1),(-170141183460469231731687303715884105728,0),(0,0),(170141183460469231731687303715884105727,-1),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer Int     [(-170141183460469231731687303715884105729,-1),(-170141183460469231731687303715884105728,0),(0,0),(170141183460469231731687303715884105727,-1),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer String  [(-170141183460469231731687303715884105729,\"-170141183460469231731687303715884105729\"),(-170141183460469231731687303715884105728,\"-170141183460469231731687303715884105728\"),(0,\"0\"),(170141183460469231731687303715884105727,\"170141183460469231731687303715884105727\"),(170141183460469231731687303715884105728,\"170141183460469231731687303715884105728\")]\n        ++ testCasts Integer Bits8   [(-170141183460469231731687303715884105729,maxBits8),(0,0),(170141183460469231731687303715884105727,0xff),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer Bits16  [(-170141183460469231731687303715884105729,maxBits16),(0,0),(170141183460469231731687303715884105727,0xffff),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer Bits32  [(-170141183460469231731687303715884105729,maxBits32),(0,0),(170141183460469231731687303715884105727,0xffffffff),(170141183460469231731687303715884105728,0)]\n        ++ testCasts Integer Bits64  [(-170141183460469231731687303715884105729,maxBits64),(0,0),(170141183460469231731687303715884105727,0xffffffffffffffff),(170141183460469231731687303715884105728,0)]\n\n        ++ testCasts Bits8 Int8    [(0,0),(255,-1),(256,0)]\n        ++ testCasts Bits8 Int16   [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 Int32   [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 Int64   [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 Int     [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 Double  [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 String  [(0,\"0\"),(255,\"255\"),(256,\"0\")]\n        ++ testCasts Bits8 Integer [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 Bits16  [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 Bits32  [(0,0),(255,255),(256,0)]\n        ++ testCasts Bits8 Bits64  [(0,0),(255,255),(256,0)]\n\n        ++ testCasts Bits16 Int8    [(0,0),(0xffff,-1),(0x10000,0)]\n        ++ testCasts Bits16 Int16   [(0,0),(0xffff,-1),(0x10000,0)]\n        ++ testCasts Bits16 Int32   [(0,0),(0xffff,0xffff),(0x10000,0)]\n        ++ testCasts Bits16 Int64   [(0,0),(0xffff,0xffff),(0x10000,0)]\n        ++ testCasts Bits16 Int     [(0,0),(0xffff,0xffff),(0x10000,0)]\n        ++ testCasts Bits16 Double  [(0,0),(0xffff,0xffff),(0x10000,0)]\n        ++ testCasts Bits16 String  [(0,\"0\"),(0xffff,\"65535\"),(0x10000,\"0\")]\n        ++ testCasts Bits16 Integer [(0,0),(0xffff,0xffff),(0x10000,0)]\n        ++ testCasts Bits16 Bits8   [(0,0),(0xffff,0xff),(0x10000,0)]\n        ++ testCasts Bits16 Bits32  [(0,0),(0xffff,0xffff),(0x10000,0)]\n        ++ testCasts Bits16 Bits64  [(0,0),(0xffff,0xffff),(0x10000,0)]\n\n        ++ testCasts Bits32 Int8    [(0,0),(0xffffffff,-1),(0x100000000,0)]\n        ++ testCasts Bits32 Int16   [(0,0),(0xffffffff,-1),(0x100000000,0)]\n        ++ testCasts Bits32 Int32   [(0,0),(0xffffffff,-1),(0x100000000,0)]\n        ++ testCasts Bits32 Int64   [(0,0),(0xffffffff,0xffffffff),(0x100000000,0)]\n        ++ testCasts Bits32 Int     [(0,0),(0xffffffff,0xffffffff),(0x100000000,0)]\n        ++ testCasts Bits32 Double  [(0,0),(0xffffffff,0xffffffff),(0x100000000,0)]\n        ++ testCasts Bits32 String  [(0,\"0\"),(0xffffffff,\"4294967295\"),(0x100000000,\"0\")]\n        ++ testCasts Bits32 Integer [(0,0),(0xffffffff,0xffffffff),(0x100000000,0)]\n        ++ testCasts Bits32 Bits8   [(0,0),(0xffffffff,0xff),(0x100000000,0)]\n        ++ testCasts Bits32 Bits16  [(0,0),(0xffffffff,0xffff),(0x100000000,0)]\n        ++ testCasts Bits32 Bits64  [(0,0),(0xffffffff,0xffffffff),(0x100000000,0)]\n\n        ++ testCasts Bits64 Int8    [(0,0),(0xffffffffffffffff,-1),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Int16   [(0,0),(0xffffffffffffffff,-1),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Int32   [(0,0),(0xffffffffffffffff,-1),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Int64   [(0,0),(0xffffffffffffffff,-1),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Int     [(0,0),(0xffffffffffffffff,-1),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Double  [(0,0),(0xffffffffffffffff,0xffffffffffffffff),(0x10000000000000000,0)]\n        ++ testCasts Bits64 String  [(0,\"0\"),(0xffffffffffffffff,\"18446744073709551615\"),(0x10000000000000000,\"0\")]\n        ++ testCasts Bits64 Integer [(0,0),(0xffffffffffffffff,0xffffffffffffffff),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Bits8   [(0,0),(0xffffffffffffffff,0xff),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Bits16  [(0,0),(0xffffffffffffffff,0xffff),(0x10000000000000000,0)]\n        ++ testCasts Bits64 Bits32  [(0,0),(0xffffffffffffffff,0xffffffff),(0x10000000000000000,0)]\n\n        ++ testCasts String Int8    [(\"-129\",127),(\"-128\",-128),(\"0\",0),(\"127\",127), (\"128\",-128)]\n        ++ testCasts String Int16   [(\"-32769\",32767),(\"-32768\",-32768),(\"0\",0),(\"32767\",32767), (\"32768\",-32768)]\n        ++ testCasts String Int32   [(\"-2147483649\",2147483647),(\"-2147483648\",-2147483648),(\"0\",0),(\"2147483647\",2147483647), (\"2147483648\",-2147483648)]\n        ++ testCasts String Int64   [(\"-9223372036854775809\",9223372036854775807),(\"-9223372036854775808\",-9223372036854775808),(\"0\",0),(\"9223372036854775807\",9223372036854775807), (\"9223372036854775808\",-9223372036854775808)]\n        ++ testCasts String Int     [(\"-9223372036854775809\",9223372036854775807),(\"-9223372036854775808\",-9223372036854775808),(\"0\",0),(\"9223372036854775807\",9223372036854775807), (\"9223372036854775808\",-9223372036854775808)]\n        ++ testCasts String Integer [(\"-170141183460469231731687303715884105728\",-170141183460469231731687303715884105728),(\"-170141183460469231731687303715884105728\",-170141183460469231731687303715884105728),(\"0\",0),(\"170141183460469231731687303715884105728\",170141183460469231731687303715884105728)]\n        ++ testCasts String Bits8   [(\"0\",0),(\"255\",255), (\"256\",0)]\n        ++ testCasts String Bits16  [(\"0\",0),(\"65535\",65535), (\"65536\",0)]\n        ++ testCasts String Bits32  [(\"0\",0),(\"4294967295\",4294967295), (\"4294967296\",0)]\n        ++ testCasts String Bits64  [(\"0\",0),(\"18446744073709551615\",18446744073709551615), (\"18446744073709551616\",0)]\n\n        ++ testCasts Double Int8    [(-129.0, 127),(-128.0,-128),(-12.001,-12),(12.001,12),(127.0,127),(128.0,-128)]\n        ++ testCasts Double Int16   [(-32769.0, 32767),(-32768.0,-32768),(-12.001,-12),(12.001,12),(32767.0,32767),(32768.0,-32768)]\n        ++ testCasts Double Int32   [(-2147483649.0,2147483647),(-2147483648.0,-2147483648),(-12.001,-12),(12.001,12),(2147483647.0,2147483647),(2147483648.0,-2147483648)]\n        ++ testCasts Double Int64   [(-9223372036854775808.0,-9223372036854775808),(-12.001,-12),(12.001,12),(9223372036854775808.0,-9223372036854775808)]\n        ++ testCasts Double Int     [(-9223372036854775808.0,-9223372036854775808),(-12.001,-12),(12.001,12),(9223372036854775808.0,-9223372036854775808)]\n        ++ testCasts Double Bits8   [(0.0,0),(255.0,255), (256.0,0)]\n        ++ testCasts Double Bits16  [(0.0,0),(65535.0,65535), (65536.0,0)]\n        ++ testCasts Double Bits32  [(0.0,0),(4294967295.0,4294967295), (4294967296.0,0)]\n        ++ testCasts Double Bits64  [(0.0,0),(18446744073709551616.0,0)]\n\n        ++ testCasts Int8 Char    [(-1, '\\x0'), (80, 'P')]\n        ++ testCasts Int16 Char   [(-1, '\\x0'), (80, 'P')]\n        ++ testCasts Int32 Char   [(-1, '\\x0'), (80, 'P'), (55295, '\\xd7ff'), (55296, '\\x0'), (57344, '\\xe000'), (1114111, '\\x10ffff'), (1114112, '\\x0')]\n        ++ testCasts Int64 Char   [(-1, '\\x0'), (80, 'P'), (55295, '\\xd7ff'), (55296, '\\x0'), (57344, '\\xe000'), (1114111, '\\x10ffff'), (1114112, '\\x0')]\n        ++ testCasts Int   Char   [(-1, '\\x0'), (80, 'P'), (55295, '\\xd7ff'), (55296, '\\x0'), (57344, '\\xe000'), (1114111, '\\x10ffff'), (1114112, '\\x0')]\n        ++ testCasts Bits8 Char   [(80, 'P')]\n        ++ testCasts Bits16 Char  [(80, 'P'), (55295, '\\xd7ff'), (55296, '\\x0'), (57344, '\\xe000')]\n        ++ testCasts Bits32 Char  [(80, 'P'), (55295, '\\xd7ff'), (55296, '\\x0'), (57344, '\\xe000'), (1114111, '\\x10ffff'), (1114112, '\\x0')]\n        ++ testCasts Bits64 Char  [(80, 'P'), (55295, '\\xd7ff'), (55296, '\\x0'), (57344, '\\xe000'), (1114111, '\\x10ffff'), (1114112, '\\x0')]\n        ++ testCasts Integer Char [(-1, '\\x0'), (80, 'P'), (55295, '\\xd7ff'), (55296, '\\x0'), (57344, '\\xe000'), (1114111, '\\x10ffff'), (1114112, '\\x0')]\n\n--------------------------------------------------------------------------------\n--          Main\n--------------------------------------------------------------------------------\n\nmain : IO ()\nmain = traverse_ putStrLn results\n", "meta": {"hexsha": "543e59c36963bf074930be8f11ab5974b56e2275", "size": 30318, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/chez/casts/Casts.idr", "max_stars_repo_name": "mmhelloworld/idris-jvm", "max_stars_repo_head_hexsha": "cb0c87d0f65c86636322224d496fef55af92d6b1", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/node/casts/Casts.idr", "max_issues_repo_name": "mmhelloworld/idris-jvm", "max_issues_repo_head_hexsha": "cb0c87d0f65c86636322224d496fef55af92d6b1", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/chez/casts/Casts.idr", "max_forks_repo_name": "mmhelloworld/idris-jvm", "max_forks_repo_head_hexsha": "cb0c87d0f65c86636322224d496fef55af92d6b1", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 43.8121387283, "max_line_length": 386, "alphanum_fraction": 0.6377729402, "num_tokens": 9761, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7217432062975979, "lm_q2_score": 0.7025300573952054, "lm_q1q2_score": 0.507046296144851}}
{"text": "module Data.IntMap\n\n-- Hand specialised map, for efficiency...\n\n%default total\n\nKey : Type\nKey = Int\n\n-- TODO: write split\n\nprivate\ndata Tree : Nat -> Type -> Type where\n  Leaf : Key -> v -> Tree Z v\n  Branch2 : Tree n v -> Key -> Tree n v -> Tree (S n) v\n  Branch3 : Tree n v -> Key -> Tree n v -> Key -> Tree n v -> Tree (S n) v\n\nbranch4 :\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v ->\n  Tree (S (S n)) v\nbranch4 a b c d e f g =\n  Branch2 (Branch2 a b c) d (Branch2 e f g)\n\nbranch5 :\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v ->\n  Tree (S (S n)) v\nbranch5 a b c d e f g h i =\n  Branch2 (Branch2 a b c) d (Branch3 e f g h i)\n\nbranch6 :\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v ->\n  Tree (S (S n)) v\nbranch6 a b c d e f g h i j k =\n  Branch3 (Branch2 a b c) d (Branch2 e f g) h (Branch2 i j k)\n\nbranch7 :\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v -> Key ->\n  Tree n v ->\n  Tree (S (S n)) v\nbranch7 a b c d e f g h i j k l m =\n  Branch3 (Branch3 a b c d e) f (Branch2 g h i) j (Branch2 k l m)\n\nmerge1 : Tree n v -> Key -> Tree (S n) v -> Key -> Tree (S n) v -> Tree (S (S n)) v\nmerge1 a b (Branch2 c d e) f (Branch2 g h i) = branch5 a b c d e f g h i\nmerge1 a b (Branch2 c d e) f (Branch3 g h i j k) = branch6 a b c d e f g h i j k\nmerge1 a b (Branch3 c d e f g) h (Branch2 i j k) = branch6 a b c d e f g h i j k\nmerge1 a b (Branch3 c d e f g) h (Branch3 i j k l m) = branch7 a b c d e f g h i j k l m\n\nmerge2 : Tree (S n) v -> Key -> Tree n v -> Key -> Tree (S n) v -> Tree (S (S n)) v\nmerge2 (Branch2 a b c) d e f (Branch2 g h i) = branch5 a b c d e f g h i\nmerge2 (Branch2 a b c) d e f (Branch3 g h i j k) = branch6 a b c d e f g h i j k\nmerge2 (Branch3 a b c d e) f g h (Branch2 i j k) = branch6 a b c d e f g h i j k\nmerge2 (Branch3 a b c d e) f g h (Branch3 i j k l m) = branch7 a b c d e f g h i j k l m\n\nmerge3 : Tree (S n) v -> Key -> Tree (S n) v -> Key -> Tree n v -> Tree (S (S n)) v\nmerge3 (Branch2 a b c) d (Branch2 e f g) h i = branch5 a b c d e f g h i\nmerge3 (Branch2 a b c) d (Branch3 e f g h i) j k = branch6 a b c d e f g h i j k\nmerge3 (Branch3 a b c d e) f (Branch2 g h i) j k = branch6 a b c d e f g h i j k\nmerge3 (Branch3 a b c d e) f (Branch3 g h i j k) l m = branch7 a b c d e f g h i j k l m\n\ntreeLookup : Key -> Tree n v -> Maybe v\ntreeLookup k (Leaf k' v) =\n  if k == k' then\n    Just v\n  else\n    Nothing\ntreeLookup k (Branch2 t1 k' t2) =\n  if k <= k' then\n    treeLookup k t1\n  else\n    treeLookup k t2\ntreeLookup k (Branch3 t1 k1 t2 k2 t3) =\n  if k <= k1 then\n    treeLookup k t1\n  else if k <= k2 then\n    treeLookup k t2\n  else\n    treeLookup k t3\n\ntreeInsert' : Key -> v -> Tree n v -> Either (Tree n v) (Tree n v, Key, Tree n v)\ntreeInsert' k v (Leaf k' v') =\n  case compare k k' of\n    LT => Right (Leaf k v, k, Leaf k' v')\n    EQ => Left (Leaf k v)\n    GT => Right (Leaf k' v', k', Leaf k v)\ntreeInsert' k v (Branch2 t1 k' t2) =\n  if k <= k' then\n    case treeInsert' k v t1 of\n      Left t1' => Left (Branch2 t1' k' t2)\n      Right (a, b, c) => Left (Branch3 a b c k' t2)\n  else\n    case treeInsert' k v t2 of\n      Left t2' => Left (Branch2 t1 k' t2')\n      Right (a, b, c) => Left (Branch3 t1 k' a b c)\ntreeInsert' k v (Branch3 t1 k1 t2 k2 t3) =\n  if k <= k1 then\n    case treeInsert' k v t1 of\n      Left t1' => Left (Branch3 t1' k1 t2 k2 t3)\n      Right (a, b, c) => Right (Branch2 a b c, k1, Branch2 t2 k2 t3)\n  else\n    if k <= k2 then\n      case treeInsert' k v t2 of\n        Left t2' => Left (Branch3 t1 k1 t2' k2 t3)\n        Right (a, b, c) => Right (Branch2 t1 k1 a, b, Branch2 c k2 t3)\n    else\n      case treeInsert' k v t3 of\n        Left t3' => Left (Branch3 t1 k1 t2 k2 t3')\n        Right (a, b, c) => Right (Branch2 t1 k1 t2, k2, Branch2 a b c)\n\ntreeInsert : Key -> v -> Tree n v -> Either (Tree n v) (Tree (S n) v)\ntreeInsert k v t =\n  case treeInsert' k v t of\n    Left t' => Left t'\n    Right (a, b, c) => Right (Branch2 a b c)\n\ndelType : Nat -> Type -> Type\ndelType Z v = ()\ndelType (S n) v = Tree n v\n\ntreeDelete : {n : _} -> Key -> Tree n v -> Either (Tree n v) (delType n v)\ntreeDelete k (Leaf k' v) =\n  if k == k' then\n    Right ()\n  else\n    Left (Leaf k' v)\ntreeDelete {n=S Z} k (Branch2 t1 k' t2) =\n  if k <= k' then\n    case treeDelete k t1 of\n      Left t1' => Left (Branch2 t1' k' t2)\n      Right () => Right t2\n  else\n    case treeDelete k t2 of\n      Left t2' => Left (Branch2 t1 k' t2')\n      Right () => Right t1\ntreeDelete {n=S Z} k (Branch3 t1 k1 t2 k2 t3) =\n  if k <= k1 then\n    case treeDelete k t1 of\n      Left t1' => Left (Branch3 t1' k1 t2 k2 t3)\n      Right () => Left (Branch2 t2 k2 t3)\n  else if k <= k2 then\n    case treeDelete k t2 of\n      Left t2' => Left (Branch3 t1 k1 t2' k2 t3)\n      Right () => Left (Branch2 t1 k1 t3)\n  else\n    case treeDelete k t3 of\n      Left t3' => Left (Branch3 t1 k1 t2 k2 t3')\n      Right () => Left (Branch2 t1 k1 t2)\ntreeDelete {n=S (S _)} k (Branch2 t1 k' t2) =\n  if k <= k' then\n    case treeDelete k t1 of\n      Left t1' => Left (Branch2 t1' k' t2)\n      Right t1' =>\n        case t2 of\n          Branch2 a b c => Right (Branch3 t1' k' a b c)\n          Branch3 a b c d e => Left (branch4 t1' k' a b c d e)\n  else\n    case treeDelete k t2 of\n      Left t2' => Left (Branch2 t1 k' t2')\n      Right t2' =>\n        case t1 of\n          Branch2 a b c => Right (Branch3 a b c k' t2')\n          Branch3 a b c d e => Left (branch4 a b c d e k' t2')\ntreeDelete {n=(S (S _))} k (Branch3 t1 k1 t2 k2 t3) =\n  if k <= k1 then\n    case treeDelete k t1 of\n      Left t1' => Left (Branch3 t1' k1 t2 k2 t3)\n      Right t1' => Left (merge1 t1' k1 t2 k2 t3)\n  else if k <= k2 then\n    case treeDelete k t2 of\n      Left t2' => Left (Branch3 t1 k1 t2' k2 t3)\n      Right t2' => Left (merge2 t1 k1 t2' k2 t3)\n  else\n    case treeDelete k t3 of\n      Left t3' => Left (Branch3 t1 k1 t2 k2 t3')\n      Right t3' => Left (merge3 t1 k1 t2 k2 t3')\n\ntreeToList : Tree n v -> List (Key, v)\ntreeToList = treeToList' []\n  where\n    treeToList' : forall n . List (Key, v) -> Tree n v -> List (Key, v)\n    treeToList' rest (Leaf k v) = (k, v) :: rest\n    treeToList' rest (Branch2 t1 _ t2)\n        = treeToList' (treeToList' rest t2) t1\n    treeToList' rest (Branch3 t1 _ t2 _ t3)\n        = treeToList' (treeToList' (treeToList' rest t3) t2) t1\n\nexport\ndata IntMap : Type -> Type where\n  Empty : IntMap v\n  M : (n : Nat) -> Tree n v -> IntMap v\n\nexport\nempty : IntMap v\nempty = Empty\n\nexport\nlookup : Int -> IntMap v -> Maybe v\nlookup _ Empty = Nothing\nlookup k (M _ t) = treeLookup k t\n\nexport\ninsert : Int -> v -> IntMap v -> IntMap v\ninsert k v Empty = M Z (Leaf k v)\ninsert k v (M _ t) =\n  case treeInsert k v t of\n    Left t' => (M _ t')\n    Right t' => (M _ t')\n\nexport\ninsertFrom : List (Int, v) -> IntMap v -> IntMap v\ninsertFrom = flip $ foldl $ flip $ uncurry insert\n\nexport\ndelete : Int -> IntMap v -> IntMap v\ndelete _ Empty = Empty\ndelete k (M Z t) =\n  case treeDelete k t of\n    Left t' => (M _ t')\n    Right () => Empty\ndelete k (M (S _) t) =\n  case treeDelete k t of\n    Left t' => (M _ t')\n    Right t' => (M _ t')\n\nexport\nfromList : List (Int, v) -> IntMap v\nfromList l = foldl (flip (uncurry insert)) empty l\n\nexport\ntoList : IntMap v -> List (Int, v)\ntoList Empty = []\ntoList (M _ t) = treeToList t\n\n||| Gets the Keys of the map.\nexport\nkeys : IntMap v -> List Int\nkeys = map fst . toList\n\n||| Gets the values of the map. Could contain duplicates.\nexport\nvalues : IntMap v -> List v\nvalues = map snd . toList\n\ntreeMap : (a -> b) -> Tree n a -> Tree n b\ntreeMap f (Leaf k v) = Leaf k (f v)\ntreeMap f (Branch2 t1 k t2) = Branch2 (treeMap f t1) k (treeMap f t2)\ntreeMap f (Branch3 t1 k1 t2 k2 t3)\n    = Branch3 (treeMap f t1) k1 (treeMap f t2) k2 (treeMap f t3)\n\nexport\nimplementation Functor IntMap where\n  map _ Empty = Empty\n  map f (M n t) = M _ (treeMap f t)\n\n||| Merge two maps. When encountering duplicate keys, using a function to combine the values.\n||| Uses the ordering of the first map given.\nexport\nmergeWith : (v -> v -> v) -> IntMap v -> IntMap v -> IntMap v\nmergeWith f x y = insertFrom inserted x where\n  inserted : List (Key, v)\n  inserted = do\n    (k, v) <- toList y\n    let v' = (maybe id f $ lookup k x) v\n    pure (k, v')\n\n||| Merge two maps using the Semigroup (and by extension, Monoid) operation.\n||| Uses mergeWith internally, so the ordering of the left map is kept.\nexport\nmerge : Semigroup v => IntMap v -> IntMap v -> IntMap v\nmerge = mergeWith (<+>)\n\n||| Left-biased merge, also keeps the ordering specified  by the left map.\nexport\nmergeLeft : IntMap v -> IntMap v -> IntMap v\nmergeLeft = mergeWith const\n\n-- TODO: is this the right variant of merge to use for this? I think it is, but\n-- I could also see the advantages of using `mergeLeft`. The current approach is\n-- strictly more powerful I believe, because `mergeLeft` can be emulated with\n-- the `First` monoid. However, this does require more code to do the same\n-- thing.\nexport\nSemigroup v => Semigroup (IntMap v) where\n  (<+>) = merge\n\nexport\n(Semigroup v) => Monoid (IntMap v) where\n  neutral = empty\n", "meta": {"hexsha": "1adf74868eeb3f9084e58ce5ca899801f123322c", "size": 9236, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/src/Data/IntMap.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/src/Data/IntMap.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/src/Data/IntMap.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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.1830065359, "max_line_length": 93, "alphanum_fraction": 0.5873754872, "num_tokens": 3410, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7956580903722561, "lm_q2_score": 0.6370308082623217, "lm_q1q2_score": 0.5068587164102937}}
{"text": "module Select\n\n-- Based on http://eptcs.web.cse.unsw.edu.au/paper.cgi?MSFP2014.3.pdf\n--          https://downloads.haskell.org/~ghc/latest/docs/html/libraries/transformers-0.5.6.2/src/Control-Monad-Trans-Select.html#SelectT\n\nimport Data.Vect\nimport Control.Monad.Identity\nimport Control.Monad.Trans\n\ndata SelectT : (r : Type) -> (m : Type -> Type) -> (a : Type) -> Type where\n  Sel : ((a -> m r) -> m a) -> SelectT r m a\n\nSelect : Type -> Type -> Type\nSelect a r = SelectT r Identity a\n\nFunctor m => Functor (SelectT r m) where\n  map f (Sel g) = Sel (\\k => map f $ g (k . f))\n\nMonad m => Applicative (SelectT r m) where\n  pure a = Sel (\\k => pure a)\n\n  (Sel gf) <*> (Sel g) = Sel $ \\k => do f <- gf (\\f => h f k >>= k)\n                                        h f k\n    where\n     h : (a -> b) -> (b -> m r) -> m b\n     h f k = map f $ g (k . f)\n\nMonad m => Monad (SelectT r m) where\n  (Sel g) >>= f = Sel $ \\k => do a <- g (\\a => h a k >>= k)\n                                 h a k\n    where\n      h : a -> (b -> m r) -> m b\n      h a k = let (Sel g') = f a in g' k\n\nMonadTrans (SelectT r) where\n  lift m = Sel (\\k => m)\n\nboundedBinarySearch : Monad m => (n : Nat) -> SelectT Bool m (Vect n Bool)\nboundedBinarySearch n = sequence $ replicate n $ Sel (\\k => k True)\n", "meta": {"hexsha": "3e72d6034686b0bf9f7adf361f0a9cebb2f79f36", "size": 1265, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Select.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/Select.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/Select.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 31.625, "max_line_length": 138, "alphanum_fraction": 0.5335968379, "num_tokens": 417, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7461389817407016, "lm_q2_score": 0.679178699175393, "lm_q1q2_score": 0.506761703022702}}
{"text": "||| Primitive operations for fixed size, unsigned integers. \nmodule Primitives.UInt\n\nimport Primitives.Common\nimport Core.Context\nimport CairoCode.CairoCode\nimport Data.SortedSet\nimport Data.SortedMap\nimport CommonDef\nimport CodeGen.CodeGenHelper\n\n---------------------------------------------------------------------------------------------------\n-- UINT ADD\n---------------------------------------------------------------------------------------------------\nadd_uintX_name : Nat -> Name\nadd_uintX_name nBits = makeBuiltinName \"add_uint\\{show nBits}\"\n\nadd_uintX_code : Name -> Nat -> String\nadd_uintX_code name nBits = \"\"\"\n    # Adds two uints\n    # Returns the result as a uint\n    func \\{cairoName name}(range_check_ptr, a : felt, b : felt) -> (res : felt, range_check_ptr):\n        alloc_locals\n        local res : felt\n        local carry : felt\n        %{ (ids.carry, ids.res) = divmod(ids.a + ids.b, \\{show shift}) %}\n\n        assert carry * carry = carry  # carry is 0 or 1\n        assert res = a + b - carry * \\{show shift}\n        \n        # inlined uint_check(res)\n        assert [range_check_ptr] = res\n        assert [range_check_ptr+1] = \\{show (shift - 1)} - res\n        let range_check_ptr = range_check_ptr+2\n        \n        return (res, range_check_ptr)\n    end\n\"\"\"\n  where shift : Integer\n        shift = pow2 nBits\n\nadd_uintX : Nat -> (Name, Lazy CairoDef)\nadd_uintX nBits = (name, def)\n  where name : Name\n        name = add_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (add_uintX_code name nBits)) 2 1\n\nexport\n[add_uint8] PrimFn where\n    eval [_, ConstValue (B8 0)] = Just $ ArgValue 0\n    eval [ConstValue (B8 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (a+b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [add_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (add_uintX_name 8) args]\n\nexport\n[add_uint16] PrimFn where\n    eval [_, ConstValue (B16 0)] = Just $ ArgValue 0\n    eval [ConstValue (B16 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (a+b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [add_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (add_uintX_name 16) args]\n\nexport\n[add_uint32] PrimFn where\n    eval [_, ConstValue (B32 0)] = Just $ ArgValue 0\n    eval [ConstValue (B32 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (a+b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [add_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (add_uintX_name 32) args]\n\nexport\n[add_uint64] PrimFn where\n    eval [_, ConstValue (B64 0)] = Just $ ArgValue 0\n    eval [ConstValue (B64 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (a+b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [add_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (add_uintX_name 64) args]\n\n---------------------------------------------------------------------------------------------------\n-- UINT SUB\n---------------------------------------------------------------------------------------------------\nsub_uintX_name : Nat -> Name\nsub_uintX_name nBits = makeBuiltinName \"sub_uint\\{show nBits}\"\n\nsub_uintX_code : Name -> Nat -> String\nsub_uintX_code name nBits = \"\"\"\n    # Subtracts two integers.\n    # Returns the result as a uint.\n    func \\{cairoName name}(range_check_ptr, a : felt, b : felt) -> (res : felt, range_check_ptr):\n        alloc_locals\n        local res : felt\n        local borrow : felt\n        %{\n            (carry, ids.res) = divmod(ids.a - ids.b, \\{show shift}) \n            ids.borrow = -carry  # if b > a then carry is -1\n        %}\n\n        assert borrow * borrow = borrow  # borrow is 0 or 1\n        assert res = a - b + borrow * \\{show shift}\n        # inlined uint_check(res)\n        assert [range_check_ptr] = res\n        assert [range_check_ptr+1] = \\{show (shift - 1)} - res\n        let range_check_ptr = range_check_ptr+2\n        \n        return (res, range_check_ptr)\n    end\n\"\"\"\n  where shift : Integer\n        shift = pow2 nBits\n\nsub_uintX : Nat -> (Name, Lazy CairoDef)\nsub_uintX nBits = (name, def)\n  where name : Name\n        name = sub_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (sub_uintX_code name nBits)) 2 1\n\nexport\n[sub_uint8] PrimFn where\n    eval [_, ConstValue (B8 0)] = Just $ ArgValue 0\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (a-b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [sub_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (sub_uintX_name 8) args]\n\nexport\n[sub_uint16] PrimFn where\n    eval [_, ConstValue (B16 0)] = Just $ ArgValue 0\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (a-b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [sub_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (sub_uintX_name 16) args]\n\nexport\n[sub_uint32] PrimFn where\n    eval [_, ConstValue (B32 0)] = Just $ ArgValue 0\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (a-b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [sub_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (sub_uintX_name 32) args]\n\nexport\n[sub_uint64] PrimFn where\n    eval [_, ConstValue (B64 0)] = Just $ ArgValue 0\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (a-b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [sub_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (sub_uintX_name 64) args]\n\n\n---------------------------------------------------------------------------------------------------\n-- UINT MUL\n---------------------------------------------------------------------------------------------------\nmul_uintX_name : Nat -> Name\nmul_uintX_name nBits = makeBuiltinName \"mul_uint\\{show nBits}\"\n\nmul_uintX_code : Name -> Nat -> String\nmul_uintX_code name nBits = \"\"\"\n    # Multiplies two uint.\n    # Returns the result\n    func \\{cairoName name}(range_check_ptr, a : felt, b : felt) -> (res : felt, range_check_ptr):\n        alloc_locals\n        local res : felt\n        local offset : felt\n        %{ (ids.offset, ids.res) = divmod(ids.a * ids.b, \\{show shift}) %}\n\n        # Check offset can not trigger overflow / underflow\n        #  to trigger overflow offset*SHIFT must be negative\n        #  to trigger underflow offset*SHIFT must be > PRIME - (SHIFT-1)**2\n        #    Note: 2**128 (rangecheck) < PRIME - (SHIFT-1)**2 (e.g: 64 => approx 2**128 < 2**192? - 2**128) \n        #    Note: Max needed offset*SHIFT = (SHIFT-1)*(SHIFT-1)- SHIFT = (SHIFT-2)*(SHIFT-1) < SHIFT**2\n        #\t Note: for SHIFT = 2 ** 64 => offset*SHIFT < 2**128 ((2**64)**2)\n        tempvar realOffset = offset * \\{show shift}\n        assert [range_check_ptr] = realOffset # is positive & smaller 2**128 (this is exactly range_check semantic)\n        assert res = a * b - realOffset\n        \n        # inlined uint_check(res)\n        assert [range_check_ptr+1] = res\n        assert [range_check_ptr+2] = \\{show (shift - 1)} - res\n        let range_check_ptr = range_check_ptr+3\n        \n        return (res, range_check_ptr)\n    end\n\"\"\"\n  where shift : Integer\n        shift = pow2 nBits\n\nmul_uintX : Nat -> (Name, Lazy CairoDef)\nmul_uintX nBits = (name, def)\n  where name : Name\n        name = mul_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (mul_uintX_code name nBits)) 2 1\n\nexport\n[mul_uint8] PrimFn where\n    eval [_, ConstValue (B8 1)] = Just $ ArgValue 0\n    eval [ConstValue (B8 1), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B8 0)] = Just $ NewValue $ ConstValue $ B8 0\n    eval [ConstValue (B8 0), _] = Just $ NewValue $ ConstValue $ B8 0\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (a*b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mul_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mul_uintX_name 8) args]\n\nexport\n[mul_uint16] PrimFn where\n    eval [_, ConstValue (B16 1)] = Just $ ArgValue 0\n    eval [ConstValue (B16 1), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B16 0)] = Just $ NewValue $ ConstValue $ B16 0\n    eval [ConstValue (B16 0), _] = Just $ NewValue $ ConstValue $ B16 0\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (a*b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mul_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mul_uintX_name 16) args]\n\nexport\n[mul_uint32] PrimFn where\n    eval [_, ConstValue (B32 1)] = Just $ ArgValue 0\n    eval [ConstValue (B32 1), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B32 0)] = Just $ NewValue $ ConstValue $ B32 0\n    eval [ConstValue (B32 0), _] = Just $ NewValue $ ConstValue $ B32 0\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (a*b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mul_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mul_uintX_name 32) args]\n\nexport\n[mul_uint64] PrimFn where\n    eval [_, ConstValue (B64 1)] = Just $ ArgValue 0\n    eval [ConstValue (B64 1), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B64 0)] = Just $ NewValue $ ConstValue $ B64 0\n    eval [ConstValue (B64 0), _] = Just $ NewValue $ ConstValue $ B64 0\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (a*b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mul_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mul_uintX_name 64) args]\n\n\n\n---------------------------------------------------------------------------------------------------\n-- UINT DIV\n---------------------------------------------------------------------------------------------------\ndiv_uintX_name : Nat -> Name\ndiv_uintX_name nBits = makeBuiltinName \"div_uint\\{show nBits}\"\n\ndiv_uintX_code : Name -> Nat -> String\ndiv_uintX_code name nBits = \"\"\"\n    # Division between uint.\n    # Returns the quotient.\n    # Conforms to Idris specifications: division by 0 yields error.\n    func \\{cairoName name}(range_check_ptr, a : felt, b : felt) -> (quotient : felt, range_check_ptr):\n        alloc_locals\n        local res : felt\n        local rem : felt\n        #Note fails if b = 0, which is ok as this is expected (Hint can not find a solution)\n        # Question: is it ok to fail in hint or is a check with assert 0 =  1 needed\n        %{ (ids.res, ids.rem) = divmod(ids.a, ids.b) %}\n\n        # Check res * b + rem can not trigger overflow / underflow\n        #  Note: 0 < b < 2**64 -- given by semantics\n        #  Note: 0 <= res < 2**64 -- checked by uint_check\n        #  Implies: 0 <= res * b < 2**128\n        #  Note: 0 < rem < 2**64 -- (must be checked -- as hint can lie)\n        #  If we weaken to: 0 < rem < 2**128 (rangecheck)\n        #  then still: 0 < res * b + rem < 2**129 < PRIME / 2 (positive numbers)\n        \n        assert [range_check_ptr] = rem \t\t\t\t# is positive & smaller 2**128 (this is exactly range_check semantic)\n        # Note: will fail if b = 0 which is the expected behaviour\n        assert [range_check_ptr+1] = b - rem - 1\t# rem < b \n        assert res * b + rem = a\n        \n        # inlined uint_check(res) -- implied as res must be between 0 and a to pass the checks & a is valid (input)\n        # assert [range_check_ptr+2] = res\n        # assert [range_check_ptr+3] = \\{show (shift - 1)} - res\n        let range_check_ptr = range_check_ptr+2\n        \n        return (res, range_check_ptr)\n    end\n\"\"\"\n  where shift : Integer\n        shift = pow2 nBits\n\ndiv_uintX : Nat -> (Name, Lazy CairoDef)\ndiv_uintX nBits = (name, def)\n  where name : Name\n        name = div_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (div_uintX_code name nBits)) 2 1\n\nexport\n[div_uint8] PrimFn where\n    eval [_, ConstValue (B8 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [_, ConstValue (B8 1)] = Just $ ArgValue 0\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (a `div` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [div_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (div_uintX_name 8) args]\n\nexport\n[div_uint16] PrimFn where\n    eval [_, ConstValue (B16 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [_, ConstValue (B16 1)] = Just $ ArgValue 0\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (a `div` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [div_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (div_uintX_name 16) args]\n\nexport\n[div_uint32] PrimFn where\n    eval [_, ConstValue (B32 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [_, ConstValue (B32 1)] = Just $ ArgValue 0\n    eval [ConstValue (B32 a), ConstValue (B32 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (a `div` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [div_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (div_uintX_name 32) args]\n\nexport\n[div_uint64] PrimFn where\n    eval [_, ConstValue (B64 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [_, ConstValue (B64 1)] = Just $ ArgValue 0\n    eval [ConstValue (B64 a), ConstValue (B64 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (a `div` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [div_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (div_uintX_name 64) args] \n\n---------------------------------------------------------------------------------------------------\n-- UINT MOD\n---------------------------------------------------------------------------------------------------\nmod_uintX_name : Nat -> Name\nmod_uintX_name nBits = makeBuiltinName \"mod_uint\\{show nBits}\"\n\nmod_uintX_code : Name -> Nat -> String\nmod_uintX_code name nBits = \"\"\"\n    # Division between uint.\n    # Returns the remainder.\n    # Conforms to Idris specifications: division by 0 yields error.\n    func \\{cairoName name}(range_check_ptr, a : felt, b : felt) -> (remainder : felt, range_check_ptr):\n        alloc_locals\n        local res : felt\n        local rem : felt\n        #Note fails if b = 0, which is ok as this is expected (Hint can not find a solution)\n        # Question: is it ok to fail in hint or is a check with assert 0 =  1 needed\n        %{ (ids.res, ids.rem) = divmod(ids.a, ids.b) %}\n\n        # Check res * b + rem can not trigger overflow / underflow\n        #  Note: 0 < b < 2**64 -- given by semantics\n        #  Note: 0 <= res < 2**64 -- checked by uint_check\n        #  Implies: 0 <= res * b < 2**128\n        #  Note: 0 < rem < 2**64 -- (must be checked -- as hint can lie)\n        #  If we weaken to: 0 < rem < 2**128 (rangecheck)\n        #  then still: 0 < res * b + rem < 2**129 < PRIME / 2 (positive numbers)\n        \n        assert [range_check_ptr] = rem \t\t\t\t# is positive & smaller 2**128 (this is exactly range_check semantic)\n        # Note: will fail if b = 0 which is the expected behaviour\n        assert [range_check_ptr+1] = b - rem - 1\t# rem < b \n        assert res * b + rem = a\n        \n        # inlined uint_check(res) -- implied as res must be between 0 and a to pass the checks & a is valid (input)\n        # assert [range_check_ptr+2] = res\n        # assert [range_check_ptr+3] = \\{show (shift - 1)} - res\n        let range_check_ptr = range_check_ptr+2\n        \n        return (rem, range_check_ptr)\n    end\n\"\"\"\n  where shift : Integer\n        shift = pow2 nBits\n\nmod_uintX : Nat -> (Name, Lazy CairoDef)\nmod_uintX nBits = (name, def)\n  where name : Name\n        name = mod_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (mod_uintX_code name nBits)) 2 1\n\nexport\n[mod_uint8] PrimFn where\n    eval [_, ConstValue (B8 1)] = Just $ NewValue $ ConstValue $ B8 0\n    eval [_, ConstValue (B8 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (a `mod` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mod_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mod_uintX_name 8) args]\n\nexport\n[mod_uint16] PrimFn where\n    eval [_, ConstValue (B16 1)] = Just $ NewValue $ ConstValue $ B16 0\n    eval [_, ConstValue (B16 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (a `mod` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mod_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mod_uintX_name 16) args]\n\nexport\n[mod_uint32] PrimFn where\n    eval [_, ConstValue (B32 1)] = Just $ NewValue $ ConstValue $ B32 0\n    eval [_, ConstValue (B32 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (a `mod` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mod_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mod_uintX_name 32) args]\n\nexport\n[mod_uint64] PrimFn where\n    eval [_, ConstValue (B64 1)] = Just $ NewValue $ ConstValue $ B64 0\n    eval [_, ConstValue (B64 0)] = Just $ Failure \"Division by zero is not defined\"\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (a `mod` b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [mod_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (mod_uintX_name 64) args]\n\n\n---------------------------------------------------------------------------------------------------\n-- UINT NEG:\n---------------------------------------------------------------------------------------------------\nneg_uintX_name : Nat -> Name\nneg_uintX_name nBits = makeBuiltinName \"neg_uint\\{show nBits}\"\n\nneg_uintX_code : Name -> Nat -> String\nneg_uintX_code name nBits = \"\"\"\n    # Returns -x the negation of x, in the sense that it is that number such that x + -x = 0, if addition wraps around such that 255+1=0.\n    # Note that -128 is 128, since 128+128=0.\n    func \\{cairoName name}(range_check_ptr, b : felt) -> (res : felt, range_check_ptr):\n        alloc_locals\n        local res : felt\n        local borrow : felt\n        %{\n            (carry, ids.res) = divmod(0 - ids.b, \\{show shift}) \n            ids.borrow = -carry  # if b > 0 then carry is -1\n        %}\n\n        assert borrow * borrow = borrow  # borrow is 0 or 1\n        assert res = - b + borrow * \\{show shift}\n        # inlined uint_check(res)\n        assert [range_check_ptr] = res\n        assert [range_check_ptr+1] = \\{show (shift - 1)} - res\n        let range_check_ptr = range_check_ptr+2\n        \n        return (res, range_check_ptr)\n    end\n\"\"\"\n  where shift : Integer\n        shift = pow2 nBits\n\nneg_uintX : Nat -> (Name, Lazy CairoDef)\nneg_uintX nBits = (name, def)\n  where name : Name\n        name = neg_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (neg_uintX_code name nBits)) 1 1\n\nexport\n[neg_uint8] PrimFn where\n    eval [ConstValue (B8 a)] = Just $ NewValue $ ConstValue $ B8 (-a)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [neg_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (neg_uintX_name 8) args]\n\nexport\n[neg_uint16] PrimFn where\n    eval [ConstValue (B16 a)] = Just $ NewValue $ ConstValue $ B16 (-a)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [neg_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (neg_uintX_name 16) args]\n\nexport\n[neg_uint32] PrimFn where\n    eval [ConstValue (B32 a)] = Just $ NewValue $ ConstValue $ B32 (-a)\n    eval _ = Nothing\n    \n    implicits = singleton range_check_builtin\n    dependencies = fromList [neg_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (neg_uintX_name 32) args]\n\nexport\n[neg_uint64] PrimFn where\n    eval [ConstValue (B64 a)] = Just $ NewValue $ ConstValue $ B64 (-a)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [neg_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (neg_uintX_name 64) args]\n\n\n---------------------------------------------------------------------------------------------------\n-- UINT SHL\n---------------------------------------------------------------------------------------------------\nshl_uintX_name : Nat -> Name\nshl_uintX_name nBits = makeBuiltinName \"shl_uint\\{show nBits}\"\n\n-- Todo: Analyze complexity of pow and see if a bitpattern based mult is more efficient\nshl_uintX_code : Name -> Nat -> String\nshl_uintX_code name nBits = \"\"\"\n    # Computes the logical left shift of a uint.\n    #  Note: We should consider not supporting these\n    #  Reason: Programmers expect them to be quick and often try to optimize by replacing some *,/ with <<, >>\n    #          But in cairo these are horrendibly slow\n    #\t\t   Inconviniently these are the only one requiring imports and they are the only one that are not ap stable\n    func \\{cairoName name}(range_check_ptr, a : felt,  b : felt) -> (res : felt, range_check_ptr):\n        \n        #inlined uint_pow2\n        # If b >= BIT_LENGTH, the result will be zero modulo 2**BIT_LENGTH.\n        tempvar res\n        %{ids.res = 1 if ids.b < \\{show nBits} else 0 %}\n        # b < 2**128 & a < 2**128 is given by semantics\n        # BIT_LENGTH <= b\n        if res == 0: \n            assert [range_check_ptr] = b - \\{show nBits}\n            let range_check_ptr = range_check_ptr + 1\n            return (0, range_check_ptr)\n        #b < BIT_LENGTH\n        else:\n            assert [range_check_ptr] = \\{show (nBits `minus` 1)} - b\n            let range_check_ptr = range_check_ptr + 1\n            let (c) = pow{range_check_ptr=range_check_ptr}(2, b)\n            \\{cairoName (mul_uintX_name nBits)}(range_check_ptr, a, c)\n            ret\n        end\n    end\n\"\"\"\n\n\nshl_uintX : Nat -> (Name, Lazy CairoDef)\nshl_uintX nBits = (name, def)\n  where name : Name\n        name = shl_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (shl_uintX_code name nBits)) 2 1\n\nshl_uintX_imports : SortedSet Import\nshl_uintX_imports = singleton (MkImport \"starkware.cairo.common.pow\" \"pow\")\n\nexport\n[shl_uint8] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B8 0)] = Just $ ArgValue 0\n    eval [ConstValue (B8 a), ConstValue(B8 b)] = Just $ NewValue $ ConstValue $ B8 (prim__shl_Bits8 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shl_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shl_uintX 8, mul_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shl_uintX_name 8) args]\n\nexport\n[shl_uint16] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B16 0)] = Just $ ArgValue 0\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (prim__shl_Bits16 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shl_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shl_uintX 16, mul_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shl_uintX_name 16) args]\n\nexport\n[shl_uint32] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B32 0)] = Just $ ArgValue 0\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (prim__shl_Bits32 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shl_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shl_uintX 32, mul_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shl_uintX_name 32) args]\n\nexport\n[shl_uint64] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B64 0)] = Just $ ArgValue 0\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (prim__shl_Bits64 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shl_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shl_uintX 64, mul_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shl_uintX_name 64) args] \n\n\n---------------------------------------------------------------------------------------------------\n-- UINT SHR\n---------------------------------------------------------------------------------------------------\nshr_uintX_name : Nat -> Name\nshr_uintX_name nBits = makeBuiltinName \"shr_uint\\{show nBits}\"\n\n-- Todo: Analyze complexity of pow and see if a bitpattern based div is more efficient\nshr_uintX_code : Name -> Nat -> String\nshr_uintX_code name nBits = \"\"\"\n    # Computes the logical right shift of a uint.\n    #  Reason: Programmers expect them to be quick and often try to optimize by replacing some *,/ with <<, >>\n    #          But in cairo these are horrendibly slow\n    #\t\t   Inconviniently these are the only one requiring imports and they are the only one that are not ap stable\n    func \\{cairoName name}(range_check_ptr, a : felt,  b : felt) -> (res : felt, range_check_ptr):\n        #inlined uint_pow2\n        # If b >= BIT_LENGTH, the result will be zero modulo 2**BIT_LENGTH.\n        tempvar res\n        %{ids.res = 1 if ids.b < \\{show nBits} else 0 %}\n        # b < 2**128 & a < 2**128 is given by semantics\n        # BIT_LENGTH <= b\n        if res == 0: \n            assert [range_check_ptr] = b - \\{show nBits}\n            let range_check_ptr = range_check_ptr + 1\n            return (0, range_check_ptr)\n        #b < BIT_LENGTH\n        else:\n            assert [range_check_ptr] = \\{show (nBits `minus` 1)} - b\n            let range_check_ptr = range_check_ptr + 1\n            let (c) = pow{range_check_ptr=range_check_ptr}(2, b)\n            \\{cairoName (div_uintX_name nBits)}(range_check_ptr, a, c)\n            ret\n        end\n    end\n\"\"\"\n\n\nshr_uintX : Nat -> (Name, Lazy CairoDef)\nshr_uintX nBits = (name, def)\n  where name : Name\n        name = shr_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (shr_uintX_code name nBits)) 2 1\n\nshr_uintX_imports : SortedSet Import\nshr_uintX_imports = singleton (MkImport \"starkware.cairo.common.pow\" \"pow\")\n\n\nexport\n[shr_uint8] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B8 0)] = Just $ ArgValue 0\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (prim__shr_Bits8 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shr_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shr_uintX 8, div_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shr_uintX_name 8) args]\n\nexport\n[shr_uint16] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B16 0)] = Just $ ArgValue 0\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (prim__shr_Bits16 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shr_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shr_uintX 16, div_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shr_uintX_name 16) args]\n\nexport\n[shr_uint32] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B32 0)] = Just $ ArgValue 0\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (prim__shr_Bits32 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shr_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shr_uintX 32, div_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shr_uintX_name 32) args]\n\nexport\n[shr_uint64] PrimFn where\n    apStable = False\n\n    eval [_, ConstValue(B64 0)] = Just $ ArgValue 0\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (prim__shr_Bits64 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = shr_uintX_imports\n    implicits = singleton range_check_builtin\n    dependencies = fromList [shr_uintX 64, div_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (shr_uintX_name 64) args]  \n\n\n---------------------------------------------------------------------------------------------------\n-- UINT AND\n{- \nfunc bitwise_and{bitwise_ptr : BitwiseBuiltin*}(x : felt, y : felt) -> (x_and_y : felt):\n    bitwise_ptr.x = x\n    bitwise_ptr.y = y\n    let x_and_y = bitwise_ptr.x_and_y\n    let x_xor_y = bitwise_ptr.x_xor_y\n    let x_or_y = bitwise_ptr.x_or_y\n    let bitwise_ptr = bitwise_ptr + BitwiseBuiltin.SIZE\n    return (x_and_y=x_and_y)\nend\n\nstruct BitwiseBuiltin:\n    member x : felt\n    member y : felt\n    member x_and_y : felt\n    member x_xor_y : felt\n    member x_or_y : felt\nend\n-}\n---------------------------------------------------------------------------------------------------\n\nand_uintX_code : CairoReg -> CairoReg -> CairoReg -> CairoReg -> CairoReg -> String\nand_uintX_code r bitwise_ptr_in bitwise_ptr_out x y = \"\"\"\n    assert [\\{compileReg bitwise_ptr_in}] = \\{compileReg x}  \n    assert [\\{compileReg bitwise_ptr_in}+1] = \\{compileReg y}\n    \\{ compileRegDecl bitwise_ptr_out} = \\{compileReg bitwise_ptr_in} + BitwiseBuiltin.SIZE\n    \\{ compileRegDecl r } = [\\{compileReg bitwise_ptr_in}+2]\n\n\"\"\"\n\nand_uintX : Nat -> CairoReg -> List CairoReg -> LinearImplicitArgs -> PrimFnCode\nand_uintX _ res [a,b] implicits = \n  case lookup bitwise_builtin implicits of\n        Just (bw_in, bw_out) => Raw $ and_uintX_code res bw_in bw_out a b\n        Nothing => assert_total $ idris_crash \"bitwise_ptr not found\"\nand_uintX nBits _ _ _ = assert_total $ idris_crash \"Bad arguments to generateCode and_uint\\{show nBits}\"\n\nexport\n[and_uint8] PrimFn where\n    eval [_, ConstValue (B8 0)] = Just $ NewValue $ ConstValue $ B8 0\n    eval [ConstValue (B8 0), _] = Just $ NewValue $ ConstValue $ B8 0\n    eval [_, ConstValue (B8 255)] = Just $ ArgValue 0\n    eval [ConstValue (B8 255), _] = Just $ ArgValue 1\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (prim__and_Bits8 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = and_uintX 8\n\nexport\n[and_uint16] PrimFn where\n    eval [_, ConstValue (B16 0)] = Just $ NewValue $ ConstValue $ B16 0\n    eval [ConstValue (B16 0), _] = Just $ NewValue $ ConstValue $ B16 0\n    eval [_, ConstValue (B16 65535)] = Just $ ArgValue 0\n    eval [ConstValue (B16 65535), _] = Just $ ArgValue 1\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (prim__and_Bits16 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = and_uintX 16\n\nexport\n[and_uint32] PrimFn where\n    eval [_, ConstValue (B32 0)] = Just $ NewValue $ ConstValue $ B32 0\n    eval [ConstValue (B32 0), _] = Just $ NewValue $ ConstValue $ B32 0\n    eval [_, ConstValue (B32 4294967295)] = Just $ ArgValue 0\n    eval [ConstValue (B32 4294967295), _] = Just $ ArgValue 1\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (prim__and_Bits32 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = and_uintX 32\n\nexport\n[and_uint64] PrimFn where\n    eval [_, ConstValue (B64 0)] = Just $ NewValue $ ConstValue $ B64 0\n    eval [ConstValue (B64 0), _] = Just $ NewValue $ ConstValue $ B64 0\n    eval [_, ConstValue (B64 18446744073709551615)] = Just $ ArgValue 0\n    eval [ConstValue (B64 18446744073709551615), _] = Just $ ArgValue 1\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (prim__and_Bits64 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = and_uintX 64\n\n\n---------------------------------------------------------------------------------------------------\n-- UINT OR\n---------------------------------------------------------------------------------------------------\nor_uintX_code : CairoReg -> CairoReg -> CairoReg -> CairoReg -> CairoReg -> String\nor_uintX_code r bitwise_ptr_in bitwise_ptr_out x y = \"\"\"\n    assert [\\{compileReg bitwise_ptr_in}] = \\{compileReg x}  \n    assert [\\{compileReg bitwise_ptr_in}+1] = \\{compileReg y}\n    \\{ compileRegDecl bitwise_ptr_out} = \\{compileReg bitwise_ptr_in} + BitwiseBuiltin.SIZE\n    \\{ compileRegDecl r } = [\\{compileReg bitwise_ptr_in}+4]\n\n\"\"\"\n\nor_uintX : Nat -> CairoReg -> List CairoReg -> LinearImplicitArgs -> PrimFnCode\nor_uintX _ res [a,b] implicits = \n  case lookup bitwise_builtin implicits of\n        Just (bw_in, bw_out) => Raw $ or_uintX_code res bw_in bw_out a b\n        Nothing => assert_total $ idris_crash \"bitwise_ptr not found\"\nor_uintX nBits _ _ _ = assert_total $ idris_crash \"Bad arguments to generateCode or_uint\\{show nBits}\"\n\n\nexport\n[or_uint8] PrimFn where\n    eval [_, ConstValue (B8 0)] = Just $ ArgValue 0\n    eval [ConstValue (B8 0), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B8 255)] = Just $ NewValue $ ConstValue $ B8 255\n    eval [ConstValue (B8 255), _] = Just $ NewValue $ ConstValue $ B8 255\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (prim__or_Bits8 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = or_uintX 8\n\nexport\n[or_uint16] PrimFn where\n    eval [_, ConstValue (B16 0)] = Just $ ArgValue 0\n    eval [ConstValue (B16 0), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B16 65535)] = Just $ NewValue $ ConstValue $ B16 65535\n    eval [ConstValue (B16 65535), _] = Just $ NewValue $ ConstValue $ B16 65535\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (prim__or_Bits16 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = or_uintX 16\n\nexport\n[or_uint32] PrimFn where\n    eval [_, ConstValue (B32 0)] = Just $ ArgValue 0\n    eval [ConstValue (B32 0), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B32 4294967295)] = Just $ NewValue $ ConstValue $ B32 4294967295\n    eval [ConstValue (B32 4294967295), _] = Just $ NewValue $ ConstValue $ B32 4294967295\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (prim__or_Bits32 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = or_uintX 32\n\nexport\n[or_uint64] PrimFn where\n    eval [_, ConstValue (B64 0)] = Just $ ArgValue 0\n    eval [ConstValue (B64 0), _] = Just $ ArgValue 1\n    eval [_, ConstValue (B64 18446744073709551615)] = Just $ NewValue $ ConstValue $ B64 18446744073709551615\n    eval [ConstValue (B64 18446744073709551615), _] = Just $ NewValue $ ConstValue $ B64 18446744073709551615\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (prim__or_Bits64 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = or_uintX 64\n\n---------------------------------------------------------------------------------------------------\n-- UINT XOR\n---------------------------------------------------------------------------------------------------\nxor_uintX_code : CairoReg -> CairoReg -> CairoReg -> CairoReg -> CairoReg -> String\nxor_uintX_code r bitwise_ptr_in bitwise_ptr_out x y = \"\"\"\n    assert [\\{compileReg bitwise_ptr_in}] = \\{compileReg x}  \n    assert [\\{compileReg bitwise_ptr_in}+1] = \\{compileReg y}\n    \\{ compileRegDecl bitwise_ptr_out} = \\{compileReg bitwise_ptr_in} + BitwiseBuiltin.SIZE\n    \\{ compileRegDecl r } = [\\{compileReg bitwise_ptr_in}+3]\n\n\"\"\"\n\nxor_uintX : Nat -> CairoReg -> List CairoReg -> LinearImplicitArgs -> PrimFnCode\nxor_uintX _ res [a,b] implicits = \n  case lookup bitwise_builtin implicits of\n        Just (bw_in, bw_out) => Raw $ xor_uintX_code res bw_in bw_out a b\n        Nothing => assert_total $ idris_crash \"bitwise_ptr not found\"\nxor_uintX nBits _ _ _ = assert_total $ idris_crash \"Bad arguments to generateCode xor_uint\\{show nBits}\"\n\nexport\n[xor_uint8] PrimFn where\n    eval [_, ConstValue (B8 0)] = Just $ ArgValue 0\n    eval [ConstValue (B8 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ B8 (prim__xor_Bits8 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = xor_uintX 8\n\nexport\n[xor_uint16] PrimFn where\n    eval [_, ConstValue (B16 0)] = Just $ ArgValue 0\n    eval [ConstValue (B16 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ B16 (prim__xor_Bits16 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = xor_uintX 16\n\nexport\n[xor_uint32] PrimFn where\n    eval [_, ConstValue (B32 0)] = Just $ ArgValue 0\n    eval [ConstValue (B32 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ B32 (prim__xor_Bits32 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = xor_uintX 32\n\nexport\n[xor_uint64] PrimFn where\n    eval [_, ConstValue (B64 0)] = Just $ ArgValue 0\n    eval [ConstValue (B64 0), _] = Just $ ArgValue 1\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ B64 (prim__xor_Bits64 (cast a) (cast b))\n    eval _ = Nothing\n\n    imports = singleton $ bitwiseBuiltinImport\n    implicits = singleton bitwise_builtin\n    generateCode = xor_uintX 64\n\n\n---------------------------------------------------------------------------------------------------\n-- UINT LT\n---------------------------------------------------------------------------------------------------\nlt_uintX_name : Name\nlt_uintX_name = makeBuiltinName \"lt_uint\"\n\nlt_uintX_code : Name -> String\nlt_uintX_code name = \"\"\"\n    # Returns 1 if the first unsigned integer is less than the second unsigned integer, otherwise returns 0.\n    func \\{cairoName name}(range_check_ptr, a : felt, b : felt) -> (res, range_check_ptr):\n        tempvar res\n        %{ids.res = 1 if ids.a < ids.b else 0 %}\n        # b < 2**128 & a < 2**128 is given by semantics\n        # b <= a\n        if res == 0: \n            assert [range_check_ptr] = a - b - 0 # - 0 is for ap stability improves worse case in code gen\n            let range_check_ptr = range_check_ptr + 1\n            return (0, range_check_ptr)\n        #a < b\n        else:\n            assert [range_check_ptr] = b - a - 1\n            let range_check_ptr = range_check_ptr + 1\n            return (1, range_check_ptr)\n        end\n    end\n\"\"\"\n\nlt_uintX : (Name, Lazy CairoDef)\nlt_uintX = (lt_uintX_name, def)\n  where def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (lt_uintX_code lt_uintX_name)) 2 1\n\ngenerateLtCallCode : CairoReg -> List CairoReg -> LinearImplicitArgs -> PrimFnCode\ngenerateLtCallCode res args implicits = Instructions [CALL [res] implicits lt_uintX_name args] \n\nexport\n[lt_uint8] PrimFn where\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ toInt (a<b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateLtCallCode\n\nexport\n[lt_uint16] PrimFn where\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ toInt (a<b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateLtCallCode\n\nexport\n[lt_uint32] PrimFn where\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ toInt (a<b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateLtCallCode\n\nexport\n[lt_uint64] PrimFn where\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ toInt (a<b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateLtCallCode\n\n---------------------------------------------------------------------------------------------------\n-- UINT LTE\n---------------------------------------------------------------------------------------------------\nlte_uintX_name : Name\nlte_uintX_name = makeBuiltinName \"lte_uint\"\n\nlte_uintX_code : Name -> String\nlte_uintX_code name = \"\"\"\n    # Returns 1 if the first unsigned integer is less than or equal to the second unsigned integer, otherwise returns 0.\n    func \\{cairoName name}(range_check_ptr, a : felt, b : felt) -> (res, range_check_ptr):\n        tempvar res\n        %{ids.res = 1 if ids.a <= ids.b else 0 %}\n        # b < 2**128 & a < 2**128 is given by semantics\n        # b < a\n        if res == 0: \n            assert [range_check_ptr] = a - b - 1\t\n            let range_check_ptr = range_check_ptr + 1\n            return (0, range_check_ptr)\n        #a <= b\n        else:\n            assert [range_check_ptr] = b - a - 0\t#+0 is for ap stability improves worse case in code gen\n            let range_check_ptr = range_check_ptr + 1\n            return (1, range_check_ptr)\n        end\n    end\n\"\"\"\n\nlte_uintX : (Name, Lazy CairoDef)\nlte_uintX = (lte_uintX_name, def)\n  where def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (lte_uintX_code lte_uintX_name)) 2 1\n\ngenerateLteCallCode : CairoReg -> List CairoReg -> LinearImplicitArgs -> PrimFnCode\ngenerateLteCallCode res args implicits = Instructions [CALL [res] implicits lte_uintX_name args] \n\n\nexport\n[lte_uint8] PrimFn where\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ toInt (a<=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateLteCallCode\n\nexport\n[lte_uint16] PrimFn where\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ toInt (a<=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateLteCallCode\n\nexport\n[lte_uint32] PrimFn where\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ toInt (a<=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateLteCallCode\n\nexport\n[lte_uint64] PrimFn where\n    eval [ ConstValue (B64 a),  ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ toInt (a<=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateLteCallCode\n\n---------------------------------------------------------------------------------------------------\n-- UINT EQ\n---------------------------------------------------------------------------------------------------\nexport\n[eq_uint8] PrimFn where\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ toInt (a==b)\n    eval _ = Nothing\n\n    generateCode r a i = Raw $ compileEqOp \"eq_uint8\" r a i\n\nexport\n[eq_uint16] PrimFn where\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ toInt (a==b)\n    eval _ = Nothing\n\n    generateCode r a i = Raw $ compileEqOp \"eq_uint16\" r a i\n\nexport\n[eq_uint32] PrimFn where\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ toInt (a==b)\n    eval _ = Nothing\n\n    generateCode r a i = Raw $ compileEqOp \"eq_uint32\" r a i\n\nexport\n[eq_uint64] PrimFn where\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ toInt (a==b)\n    eval _ = Nothing\n\n    generateCode r a i = Raw $ compileEqOp \"eq_uint64\" r a i\n\n---------------------------------------------------------------------------------------------------\n-- UINT GTE\n-- Implementation uses flipped arguments to lte\n---------------------------------------------------------------------------------------------------\n\ngenerateGteCallCode : CairoReg -> List CairoReg -> LinearImplicitArgs -> PrimFnCode\ngenerateGteCallCode res [a,b] implicits = Instructions [CALL [res] implicits lte_uintX_name [b,a]] -- Flipped arguments\ngenerateGteCallCode _ _ _ = assert_total $ idris_crash \"Bad arguments to generateCode gte_uintX\"\n\nexport\n[gte_uint8] PrimFn where\n    eval [ConstValue (B8 a), ConstValue (B8 b)] = Just $ NewValue $ ConstValue $ toInt (a>=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateGteCallCode\n\nexport\n[gte_uint16] PrimFn where\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ toInt (a>=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateGteCallCode\n\nexport\n[gte_uint32] PrimFn where\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ toInt (a>=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateGteCallCode\n\nexport\n[gte_uint64] PrimFn where\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ toInt (a>=b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lte_uintX]\n    generateCode = generateGteCallCode\n\n---------------------------------------------------------------------------------------------------\n-- UINT GT\n-- Implementation uses flipped arguments to lt\n---------------------------------------------------------------------------------------------------\n\ngenerateGtCallCode : CairoReg -> List CairoReg -> LinearImplicitArgs -> PrimFnCode\ngenerateGtCallCode res [a,b] implicits = Instructions [CALL [res] implicits lt_uintX_name [b,a]] -- Flipped arguments\ngenerateGtCallCode _ _ _ = assert_total $ idris_crash \"Bad arguments to generateCode gt_uintX\"\n\nexport\n[gt_uint8] PrimFn where\n    eval [ConstValue (B8 a), ConstValue (B8 b)] =Just $ NewValue $ ConstValue $ toInt (a>b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateGtCallCode\n\nexport\n[gt_uint16] PrimFn where\n    eval [ConstValue (B16 a), ConstValue (B16 b)] = Just $ NewValue $ ConstValue $ toInt (a>b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateGtCallCode\n\nexport\n[gt_uint32] PrimFn where\n    eval [ConstValue (B32 a), ConstValue (B32 b)] = Just $ NewValue $ ConstValue $ toInt (a>b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateGtCallCode\n\nexport\n[gt_uint64] PrimFn where\n    eval [ConstValue (B64 a), ConstValue (B64 b)] = Just $ NewValue $ ConstValue $ toInt (a>b)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [lt_uintX]\n    generateCode = generateGtCallCode\n\n---------------------------------------------------------------------------------------------------\n-- UINT CAST\n---------------------------------------------------------------------------------------------------\ncast_uintX_name : Nat -> Name\ncast_uintX_name nBits = makeBuiltinName \"cast_uint\\{show nBits}\"\n\ncast_uintX_code : Name -> Nat -> String\ncast_uintX_code name nBits = \"\"\"\n    # Casts to uint\\{show nBits}\n    # Returns the result as uint\\{show nBits}.\n    func \\{cairoName name}(range_check_ptr, a : felt) -> (res : felt, range_check_ptr):\n        alloc_locals\n        local res : felt\n        local offset : felt\n        %{ (ids.offset, ids.res) = divmod(ids.a, \\{show shift}) %}\n\n        # Check offset can not trigger overflow / underflow\n        #  to trigger overflow offset*SHIFT must be negative\n        #  to trigger underflow offset*SHIFT must be > PRIME - (SHIFT-1)**2\n        #    Note: 2**128 (rangecheck) < PRIME - (SHIFT-1)**2 (e.g: 64 => approx 2**128 < 2**192? - 2**128) \n        #    Note: Max needed offset*SHIFT = (SHIFT-1)*(SHIFT-1)- SHIFT = (SHIFT-2)*(SHIFT-1) < SHIFT**2\n        #\t Note: for SHIFT = 2 ** 64 => offset*SHIFT < 2**128 ((2**64)**2)\n        tempvar realOffset = offset * \\{show shift}\n        assert [range_check_ptr] = realOffset # is positive & smaller 2**128 (this is exactly range_check semantic)\n        assert res = a - realOffset\n        \n        # inlined uint_check(res)\n        assert [range_check_ptr+1] = res\n        assert [range_check_ptr+2] = \\{show (shift - 1)} - res\n        let range_check_ptr = range_check_ptr+3\n        \n        return (res, range_check_ptr)\n    end\n\"\"\"\n  where shift : Integer\n        shift = pow2 nBits\n\ncast_uintX : Nat -> (Name, Lazy CairoDef)\ncast_uintX nBits = (name, def)\n  where name : Name\n        name = cast_uintX_name nBits\n        def : CairoDef\n        def = ForeignDef (MkForeignInfo True Nothing [range_check_builtin] empty (cast_uintX_code name nBits)) 1 1\n\nexport\n[cast_to_uint8] PrimFn where\n    eval [ConstValue c] = map (\\i => NewValue $ ConstValue $ B8 $ cast i) (constToInteger c)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [cast_uintX 8]\n    generateCode res args implicits = Instructions [CALL [res] implicits (cast_uintX_name 8) args]\n\nexport\n[cast_to_uint16] PrimFn where\n    eval [ConstValue c] = map (\\i => NewValue $ ConstValue $ B16 $ cast i) (constToInteger c)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [cast_uintX 16]\n    generateCode res args implicits = Instructions [CALL [res] implicits (cast_uintX_name 16) args]\n\nexport\n[cast_to_uint32] PrimFn where\n    eval [ConstValue c] = map (\\i => NewValue $ ConstValue $ B32 $ cast i) (constToInteger c)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [cast_uintX 32]\n    generateCode res args implicits = Instructions [CALL [res] implicits (cast_uintX_name 32) args]\n\nexport\n[cast_to_uint64] PrimFn where\n    eval [ConstValue c] = map (\\i => NewValue $ ConstValue $ B64 $ cast i) (constToInteger c)\n    eval _ = Nothing\n\n    implicits = singleton range_check_builtin\n    dependencies = fromList [cast_uintX 64]\n    generateCode res args implicits = Instructions [CALL [res] implicits (cast_uintX_name 64) args]\n", "meta": {"hexsha": "25ba239135754ace7cc18208d4b14d4f2cc8f85e", "size": 52848, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Primitives/UInt.idr", "max_stars_repo_name": "skyro-compiler/skyro", "max_stars_repo_head_hexsha": "9ae15463ff46d8b6a3cd3ec8061ba81174614cf0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 20, "max_stars_repo_stars_event_min_datetime": "2022-03-10T13:35:21.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-15T13:05:54.000Z", "max_issues_repo_path": "src/Primitives/UInt.idr", "max_issues_repo_name": "skyro-compiler/skyro", "max_issues_repo_head_hexsha": "9ae15463ff46d8b6a3cd3ec8061ba81174614cf0", "max_issues_repo_licenses": ["MIT"], "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/Primitives/UInt.idr", "max_forks_repo_name": "skyro-compiler/skyro", "max_forks_repo_head_hexsha": "9ae15463ff46d8b6a3cd3ec8061ba81174614cf0", "max_forks_repo_licenses": ["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.3419847328, "max_line_length": 137, "alphanum_fraction": 0.6283113836, "num_tokens": 14778, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7905303285397349, "lm_q2_score": 0.6406358617010351, "lm_q1q2_score": 0.5064420782248555}}
{"text": "||| Format decimal number into string.\n||| \n||| Copyright 2021, HATTORI, Hiroki\n||| This file is released under the MIT license, see LICENSE for more detail.\n||| \nmodule Text.Format.Digits\n\nimport Data.Nat\nimport Data.Fin\nimport Data.Primitives.Views\n\n%default total\n\n-- --------------------------------------------------------------------------\n\npublic export Digits : (base:Nat) -> Type\nDigits base = (n:Int) -> {auto ok:n >= 0 && n < (cast base) = True} -> Char\n\n\nupperHexdigit : Digits 16\nupperHexdigit 0 = '0'\nupperHexdigit 1 = '1'\nupperHexdigit 2 = '2'\nupperHexdigit 3 = '3'\nupperHexdigit 4 = '4'\nupperHexdigit 5 = '5'\nupperHexdigit 6 = '6'\nupperHexdigit 7 = '7'\nupperHexdigit 8 = '8'\nupperHexdigit 9 = '9'\nupperHexdigit 10 = 'A'\nupperHexdigit 11 = 'B'\nupperHexdigit 12 = 'C'\nupperHexdigit 13 = 'D'\nupperHexdigit 14 = 'E'\nupperHexdigit 15 = 'F'\nupperHexdigit _ = '_' -- why i need this?\n\n\nlowerHexdigit : Digits 16\nlowerHexdigit 0 = '0'\nlowerHexdigit 1 = '1'\nlowerHexdigit 2 = '2'\nlowerHexdigit 3 = '3'\nlowerHexdigit 4 = '4'\nlowerHexdigit 5 = '5'\nlowerHexdigit 6 = '6'\nlowerHexdigit 7 = '7'\nlowerHexdigit 8 = '8'\nlowerHexdigit 9 = '9'\nlowerHexdigit 10 = 'a'\nlowerHexdigit 11 = 'b'\nlowerHexdigit 12 = 'c'\nlowerHexdigit 13 = 'd'\nlowerHexdigit 14 = 'e'\nlowerHexdigit 15 = 'f'\nlowerHexdigit _ = '_'  -- also this\n\n\n\nintToDigits : (base:Nat)\n            -> {base':Nat} -> {auto ok:base <= base' = True} -> Digits base'\n            -> Int -> String\nintToDigits base digits n = if n < 0 then pack $ go n [] else \"0\"\n  where\n    base_i : Int\n    base_i = cast base\n\n    go : Int -> List Char -> List Char\n    go 0 xs = xs\n    go m xs with (m `divides` base_i)\n      go (_ * d + r) xs | DivBy d r prf =\n        let prf' = believe_me prf\n            in go (assert_smaller n d) (digits {ok=prf'} r :: xs)\n\n\n\n-- --------------------------------------------------------------------------\n\npublic export DigitNum : (base:Nat) -> Type\nDigitNum base = Char -> Maybe Int\n\nhexNum : DigitNum 16\nhexNum '0' = Just 0\nhexNum '1' = Just 1\nhexNum '2' = Just 2\nhexNum '3' = Just 3\nhexNum '4' = Just 4\nhexNum '5' = Just 5\nhexNum '6' = Just 6\nhexNum '7' = Just 7\nhexNum '8' = Just 8\nhexNum '9' = Just 9\nhexNum 'a' = Just 10\nhexNum 'A' = Just 10\nhexNum 'b' = Just 11\nhexNum 'B' = Just 11\nhexNum 'c' = Just 12\nhexNum 'C' = Just 12\nhexNum 'd' = Just 13\nhexNum 'D' = Just 13\nhexNum 'e' = Just 14\nhexNum 'E' = Just 14\nhexNum 'f' = Just 15\nhexNum 'F' = Just 15\nhexNum _ = Nothing\n\n\ndigitsToInt : (base:Nat)\n           -> {base':Nat} -> {auto ok:base <= base' = True} -> Digits base'\n           -> String -> Maybe Int\ndigitsToInt base digits str = go 0 $ unpack str where\n  base_i : Int\n  base_i = cast base\n\n  go : Int -> List Char -> Maybe Int\n  go ans [] = Just ans\n  go ans (x::xs) with (hexNum x)\n    go ans (x::xs) | Just x' = go (ans * base_i + x') xs\n    go ans (x::xs) | Nothing = Nothing\n\n\n-- --------------------------------------------------------------------------\n-- vim: tw=80 sw=2 expandtab :\n", "meta": {"hexsha": "a7b71169d3555564d84872a2cf51e86af7a2db7b", "size": 2981, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2-missing-numeric/src/Text/Format/Digits.idr", "max_stars_repo_name": "seagull-kamome/idris2-missing", "max_stars_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "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": "idris2-missing-numeric/src/Text/Format/Digits.idr", "max_issues_repo_name": "seagull-kamome/idris2-missing", "max_issues_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-02-03T11:05:02.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-01T12:42:01.000Z", "max_forks_repo_path": "idris2-missing-numeric/src/Text/Format/Digits.idr", "max_forks_repo_name": "seagull-kamome/idris2-missing", "max_forks_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_forks_repo_licenses": ["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.848, "max_line_length": 77, "alphanum_fraction": 0.5756457565, "num_tokens": 1014, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303087996143, "lm_q2_score": 0.640635868562172, "lm_q1q2_score": 0.506442071002563}}
{"text": "module Main\n\nimport Data.Vect\n\n-- data DataStore: Type -> Type where\n--   MkData : (size : Nat) -> (items : Vect size schema) -> DataStore schema\n\ninfixr 5 .+.\n\ndata Schema = SString\n     | SInt\n     | (.+.) Schema Schema\n\nSchemaType : Schema -> Type\nSchemaType SString = String\nSchemaType SInt = Int\nSchemaType (x .+. y) = (SchemaType x, SchemaType y)\n\ndata DataStore : Type where\n  MkData : (schema : Schema) -> (size : Nat) -> (items  : Vect size (SchemaType schema)) -> DataStore\n\nsize : DataStore -> Nat\nsize (MkData schema' size' items') = size'\n\nschema : DataStore -> Schema\nschema (MkData schema' _ _) = schema'\n\nitems : (store: DataStore) -> Vect (size store) (SchemaType (schema store))\nitems (MkData _ _ items') = items'\n\naddToStore : (store: DataStore) -> (SchemaType (schema store)) -> DataStore\naddToStore (MkData schema size items) newitem = MkData schema _ (addToData items) where\n  addToData : Vect old (SchemaType schema) -> Vect (S old) (SchemaType schema)\n  addToData [] = [newitem]\n  addToData (x :: xs) = x :: addToData xs\n\ndisplay: SchemaType schema -> String\ndisplay {schema = SString} item = show item\ndisplay {schema = SInt} item = show item\ndisplay {schema = (x .+. y)} (item1, item2) =\n  (display item1) ++ \", \" ++ (display item2)\n\n\nparsePrefix : (schema: Schema) -> String -> Maybe (SchemaType schema, String)\nparsePrefix SString x = getQuoted (unpack x) where\n  getQuoted : List Char -> Maybe (String, String)\n  getQuoted ('\"':: xs) = case span (/= '\"') xs of\n    (quoted, '\"':: rest) => Just (pack quoted, ltrim (pack rest))\n    _ => Nothing\nparsePrefix SInt x = case Prelude.Strings.span isDigit x of\n  (\"\", rest) => Nothing\n  (num, rest) => Just (cast num, ltrim rest)\nparsePrefix (y .+. z) x = do\n  (res1, rest) <- parsePrefix y x\n  (res2, rest') <- parsePrefix z rest\n  pure ((res1, res2), rest')\n\n\nparseBySchema : (schema: Schema) -> String -> Maybe (SchemaType schema)\nparseBySchema schema str = case parsePrefix schema str of\n  Just (res, \"\") => Just res\n  Just _ => Nothing\n  Nothing => Nothing\n\ngetEntry : (pos: Integer) -> (store: DataStore) -> Maybe (String, DataStore)\ngetEntry pos store = let store_items = items store in\n  case integerToFin pos (size store) of\n    Nothing => Just (\"out of range\\n\", store)\n    Just id => Just (display (index id store_items), store)\n\ndata Command : Schema -> Type where\n  Add : (SchemaType schema) -> Command schema\n  Get : Integer -> Command a\n  Quit: Command a\n\nparseCommand : (schema: Schema) -> String -> String -> Maybe (Command schema)\nparseCommand schema \"add\" str = case parseBySchema schema str of\n  Just restok => Just (Add restok)\n  Nothing => Nothing\nparseCommand schema \"get\" val = case all isDigit (unpack val) of\n  False => Nothing\n  True => Just (Get (cast val))\nparseCommand schema \"quit\" _ = Just Quit\nparseCommand _ _ _ = Just Quit\n\n\n\n\n\n-- processCommand : Command schema -> DataStore -> Maybe (String, DataStore)\n-- processCommand (Add x) ds = Just (?show_size, addToStore ds x)\n-- processCommand (Get x) ds = getEntry x ds\n-- processCommand Quit _ = Nothing\n\n-- processInput : DataStore -> String -> Maybe (String, DataStore)\n-- processInput ds s = case parse s of\n--   Nothing => Just (\"Invalid command \" ++ s ++ \"\\n\", ds)\n--   Just command => processCommand command ds\n", "meta": {"hexsha": "cca12f50b6591972b6350d4bff52c71b05d76489", "size": 3271, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "DataStore.idr", "max_stars_repo_name": "gdevanla/idris-learn", "max_stars_repo_head_hexsha": "3348f611f6807e3e88dcd63951c713a327325c2a", "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": "DataStore.idr", "max_issues_repo_name": "gdevanla/idris-learn", "max_issues_repo_head_hexsha": "3348f611f6807e3e88dcd63951c713a327325c2a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "DataStore.idr", "max_forks_repo_name": "gdevanla/idris-learn", "max_forks_repo_head_hexsha": "3348f611f6807e3e88dcd63951c713a327325c2a", "max_forks_repo_licenses": ["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.0404040404, "max_line_length": 101, "alphanum_fraction": 0.671048609, "num_tokens": 930, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303186696747, "lm_q2_score": 0.6406358479787609, "lm_q1q2_score": 0.5064420610538671}}
{"text": "module SudokuSMT\n\nimport Data.Vect\nimport src.SMTLib\nimport src.Tensor\n\n\npuzzle :  Tensor [3, 3, 3, 3] Int\npuzzle = toTensor\n           [ [matrix00, matrix01, matrix02],\n             [matrix10, matrix11, matrix12],\n             [matrix20, matrix21, matrix22] ]\n    where\n      matrix00 : Vect 3 (Vect 3 Int)\n      matrix00 = [ [5, 3, 0],\n                   [6, 0, 0],\n                   [0, 9, 8] ]\n      matrix01 : Vect 3 (Vect 3 Int)\n      matrix01 = [ [0, 7, 0],\n                   [1, 9, 5],\n                   [0, 0, 0] ]\n      matrix02 : Vect 3 (Vect 3 Int)\n      matrix02 = [ [0, 0, 0],\n                   [0, 0, 0],\n                   [0, 6, 0] ]\n      matrix10 : Vect 3 (Vect 3 Int)\n      matrix10 = [ [8, 0, 0],\n                   [4, 0, 0],\n                   [7, 0, 0] ]\n      matrix11 : Vect 3 (Vect 3 Int)\n      matrix11 = [ [0, 6, 0],\n                   [8, 0, 3],\n                   [0, 2, 0] ]\n      matrix12 : Vect 3 (Vect 3 Int)\n      matrix12 = [ [0, 0, 3],\n                   [0, 0, 1],\n                   [0, 0, 6] ]\n      matrix20 : Vect 3 (Vect 3 Int)\n      matrix20 = [ [0, 6, 0],\n                   [0, 0, 0],\n                   [0, 0, 0] ]\n      matrix21 : Vect 3 (Vect 3 Int)\n      matrix21 = [ [0, 0, 0],\n                   [4, 1, 9],\n                   [0, 8, 0] ]\n      matrix22 : Vect 3 (Vect 3 Int)\n      matrix22 = [ [2, 8, 0],\n                   [0, 0, 5],\n                   [0, 7, 9] ]\n\nvars : Tensor [3, 3, 3, 3] String\nvars = toTensor\n        [ [ [ [\"x_\" ++ show i0 ++ \"_\" ++ show i1 ++ \"_\" ++ show i2 ++ \"_\" ++ show i3\n             | i3 <- [0, 1, 2]]\n             | i2 <- [0, 1, 2]]\n             | i1 <- [0, 1, 2]]\n             | i0 <- [0, 1, 2]]\n\ncells : Tensor [3, 3, 3, 3] (Expr (NumT IntT)) -> Expr BoolT\ncells ts with (toVect ts)\n  cells ts | xssss = let xs = concat $ concat $ concat xssss in\n                    and $ map (\\x => (int 1) <= x && x <= (int 9)) xs\n\nrows : Tensor [3, 3, 3, 3] (Expr (NumT IntT)) -> Expr BoolT\nrows ts with (toVect ts)\n  rows ts | xssss = let rs = concat $ map zipRows xssss in\n                    and $ map distinct rs\n  where\n    zipRows : Vect 3 (Vect 3 (Vect 3 (Expr (NumT IntT)))) -> Vect 3 (Vect 9 (Expr (NumT IntT)))\n    zipRows xsss = zipWith3 (\\xs, ys, zs => xs ++ ys ++ zs) (index 0 xsss) (index 1 xsss) (index 2 xsss)\n\ncols : Tensor [3, 3, 3, 3] (Expr (NumT IntT)) -> Expr BoolT\ncols ts with (toVect ts)\n  cols ts | xssss = let rs = concat $ map zipCols $ map (map transpose) $ transpose xssss in\n                        and $ map distinct rs\n  where\n    zipCols : Vect 3 (Vect 3 (Vect 3 (Expr (NumT IntT)))) -> Vect 3 (Vect 9 (Expr (NumT IntT)))\n    zipCols xsss = zipWith3 (\\xs, ys, zs => xs ++ ys ++ zs) (index 0 xsss) (index 1 xsss) (index 2 xsss)\n\nsquare : Tensor [3, 3, 3, 3] (Expr (NumT IntT)) -> Expr BoolT\nsquare ts with (toVect ts)\n  square ts | xssss = and $ map (\\xss => distinct (concat xss)) $ concat xssss\n\ninstanceCheck : Tensor [3, 3, 3, 3] Int -> Tensor [3, 3, 3, 3] (Expr (NumT IntT)) -> Expr BoolT\ninstanceCheck insts vars with (toVect insts, toVect vars)\n  instanceCheck insts vars | (insts', vars') = let insts'' = concat $ concat $ concat insts' in\n                                               let vars'' = concat $ concat $ concat vars' in\n                                               and $ zipWith (\\inst, var => ite ((int inst) == (int 0)) (bool True) ((int inst) == var)) insts'' vars''\n\nsudoku : Smt ()\nsudoku = do vars <- declareVars vars (NumT IntT)\n            assert $ cells vars\n            assert $ rows vars\n            assert $ cols vars\n            assert $ square vars\n            assert $ instanceCheck puzzle vars\n            checkSat\n            getModel\n            end\n", "meta": {"hexsha": "138543a16c89e2cc3486aa99887462a06e1431bb", "size": 3703, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/SudokuSMT.idr", "max_stars_repo_name": "vikfret/idris-snippets", "max_stars_repo_head_hexsha": "ae006f79275bf5df2d9152f0f12f8e961492972c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-09-20T00:29:09.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-20T00:29:09.000Z", "max_issues_repo_path": "src/SudokuSMT.idr", "max_issues_repo_name": "vikfret/idris-snippets", "max_issues_repo_head_hexsha": "ae006f79275bf5df2d9152f0f12f8e961492972c", "max_issues_repo_licenses": ["MIT"], "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/SudokuSMT.idr", "max_forks_repo_name": "vikfret/idris-snippets", "max_forks_repo_head_hexsha": "ae006f79275bf5df2d9152f0f12f8e961492972c", "max_forks_repo_licenses": ["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.03, "max_line_length": 151, "alphanum_fraction": 0.4609775857, "num_tokens": 1278, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998611746912, "lm_q2_score": 0.6513548646660542, "lm_q1q2_score": 0.5062980458803837}}
{"text": "module BezoutsIdentity\n\nimport Data.Vect\n\n{-\n\nNOTES\n\n\n\nThough the assumptions seem so obvious you shouldn't have to prove them,\neither they're wrong together or Idris is very broken, because we've\nproven (6 = 2) by proving (a, b)===(0, 1) satisfies a*4+b*6 = gcd 4 6.\nI suspect the error is `subtractionexchangepr` and subtraction of Nats\nis broken, but it could also be `gcddef`, which shows up in the\nexpression for the proof of this fact a few times (and shows up\nin the correct computations we've seen as well).\n\nFurther, the linear combination can't be right, because the only solutions\nhave negative coefficients in them.\n\nOh! No, it's clearly modeqpr that's wrong. It assumes (+k).(-k) = id.\nBut subtractionexchangepr might still be wrong for the same reason.\n\n===========================================\n\nTODO\n\n\n\nProve bezoutsIdentityNat rigorously and over ZZ. Find the contradiction\n\n\t> bezoutsIdentityNat 4 6\n\nis false while\n\n\t> bezoutsIdentityNat 4 2\n\nis true.\n\nBut we CAN'T just do it over ZZ, because `gcd` is not defined for it (what??).\nWe need to use Int or Integral or (Integral a, Quasigroup a) => a, but be warned\nthis algorithm will still fail if the number system has Integral instantiated but\nit is not either one of those two or a Euclidean domain.\n\n\tPrelude.Nat.toIntNat : Nat -> Int\n\tTail recursive cast Nat to Int Note that this can overflow\n\n\tPrelude.Nat.toIntegerNat : Nat -> Integer\n\tConvert a Nat to an Integer\n\nSo we want to use Integer instead of Int.\n\n\tPrelude.Nat.fromIntegerNat : Integer -> Nat\n\tConvert an Integer to a Nat, mapping negative numbers to 0\n\nWe can use this to build a nice `abs`.\n\n\n\nRemove gcddef by proving this trivial lemma\n\n\n\nRemove junk from lemma_gcdrecpr by inspecting the proof\nSee if it can't be done in a more uniform style\n style 1a) more letting things be the Refl ComputableThm\n style 1b) more claims of equalities combined combinatorially\n style 2) more functional, creating intermediate assumptions by applying\n \tClearly gluemap is the wrong kind of function.\n \tOn the other hand, we described how to express the proof maneuvers as plumbing.\n \tMaybe we could extend the plumbing to where we don't need some of the proof hints,\n \tsay by replacing the value whose equal expression needs to be hinted at being\n \twrapped in a function definition with a relative derivation by some other function\n \tthat rewrite w/ cong will be happy to recognize, such as so factorizing the thm at claim.\n\n\n\nExpressions of the plumbing being performed that are more generally are desired\n\n\n\nPerhaps we should call what we're proving now the Euclidean division algorithm,\nand call the witness-erased form, corresponding to the existential form of the\nconclusion, the true Bezout's theorem.\n> :apropos Exists\n\n\n\nRefactor into modules based on independence of origins.\n\n===========================================\n\nIMPACT OF LANGUAGE GAPS ON CODE\n\n\n\nHere's some semantics errors within rewrite, possibly due to misscoping.\nThis was found in lemma_gcdrecpr, right where ?subtractionexchange is made.\n\n> rewrite sym ( ( the ( (a : Nat) -> (b : Nat) -> (c : Nat) -> (a-b)+c = a+(c-b) ) ?subtractionexchange ) $ ( a*d ) $ ( (b*(div (c-r) d))*d ) $ ( b*c ) )\n\tError: Perhaps a is applied to too many arguments\n> rewrite sym ( ( the ( (x : Nat) -> (y : Nat) -> (z : Nat) -> (x-y)+z = x+(z-y) ) ?subtractionexchange ) ( a*d ) ( (b*(div (c-r) d))*d ) ( b*c ) )\n\tError: No such variable x\n\n\n\nSome things can't be made private even though they shouldn't be used outside this module,\nbecause doing so will change how things in this module that use them typecheck, creating\na bug which allows a using function's type to be checked but appears undeclared when called.\nThis was found by making gcdwzeroproof private and checking the type of bezoutsIdentityNat 1.\n\nMaking gcdwzeroproof private also prevents gcdnormally=?gcdnormallyproof from being able to access\nall the variables from the environment that are involved.\n\n\n\nIt would be nice if we knew how to use a proof of equality of types to refine a goal.\nMaybe it would use refine.\nWe need to prove the type of the goal matches what we have,\nnot that we have a value of the goal type.\n\nThen we could replace (bezeqty c d nn) with\n\tlet (a,b)=nn in a*c+b*d = gcd c d\nor\t(\\(a,b) => a*c+b*d = gcd c d) nn\n\n-}\n\n\n\ngcdwzeroproof : (cc : Nat) -> plus (plus cc 0) 0 = cc\ngcdwzeroproof = proof\n\tintro\n\trewrite sym (plusCommutative cc 0)\n\trewrite sym (plusCommutative cc 0)\n\ttrivial\n\ngcddef : (a : Nat) -> (b : Nat) -> ( gcd a b = assert_total (gcd b (modNat a b)) )\n-- Type mismatch on the equality, even though the things are equal by def.\n-- gcddef a b = Refl\ngcddef a b = believe_me \"by definition\"\n\n{-\n\nProof sketch\nIn this style, some of the arrows are tautological from prior knowledge\nIf the use of `r` for `modNat c d` til the conclusion were followed,\nthe actual proof would be easier to follow and more elegantly written.\n\nlemma_gcdrec : (c : Nat) -> (d : Nat) -> (r : Nat) -> (a : Nat) -> (b : Nat)\n\t-> (r = modNat c d)\n\t-> (a*d+b*r = gcd d r)\n\t-> ( gcd d r = gcd c d ) --by def of gcd\n\t-> ( a*d + b*r = gcd c d ) -- by subst b-n previous two\n\n\t-> ( r+(div (c-r) d)d = c ) -- Solution exists by lifting r over multiples of d to c. Namely, d | c-r.\n\t-> ( r = c-(div (c-r) d)d ) -- by cong on subtraction\n\t-> ( (a*d + b*(c-(div (c-r) d)*d)) = gcd c d ) -- by subst b-n prev 3\n\t-> ( ((a-b*(div (c-r) d))*d + b*c) = gcd c d ) -- by distrib then assoc then distrib\n\n-}\n\n\n\nlemma_gcdrec : (c : Nat) -> (d : Nat) -> (a : Nat) -> (b : Nat)\n\t-> ( gcdformknown : a*d+b*(modNat c d) = gcd d (modNat c d))\n\t-> ( ((a-b*(div (c-(modNat c d)) d))*d + b*c) = gcd c d )\nlemma_gcdrec = ?lemma_gcdrecpr\n\n-- A bunch of this is junk. If we try again, we can cut that out.\nlemma_gcdrecpr = proof\n  intros\n  claim lincombformknown ( a*d+b*(modNat c d) = gcd c d )\n  unfocus\n  claim modeq ( modNat c d = c-(div (c-(modNat c d)) d)*d )\n  unfocus\n  claim substform ( ((a-b*(div (c-(modNat c d)) d))*d + b*c) = gcd c d )\n  unfocus\n  rewrite sym ( multDistributesOverMinusLeft a (b*(div (c-(modNat c d)) d)) d )\n  claim subtractionexchange (x : Nat) -> (y : Nat) -> (z : Nat) -> plus (minus x y) z = plus x (minus z y)\n  unfocus\n  rewrite sym ( subtractionexchange (a*d) ( (b*(div (c-(modNat c d)) d))*d ) ( b*c ) )\n  rewrite sym (sym $ multAssociative b (div (c-(modNat c d)) d) d)\n  rewrite sym (sym $ multDistributesOverMinusRight b c ((div (c-(modNat c d)) d)*d))\n  claim substform' ( (a*d + b*(c-(div (c-(modNat c d)) d)*d)) = gcd c d )\n  unfocus\n  exact substform'\n  rewrite sym (gcddef c d)\n  exact gcdformknown\n  unfocus\n  exact (believe_me \"Rm this junk\")\n  exact ?subtractionexchangepr\n  rewrite sym (gcddef c d)\n  -- rewrite sym (sym modeq) is no-opping, but should solve the main thm\n  --    REDO: Maybe we just need to use compute to normalize the goal terms beforehand?\n  -- So, we have to add hints, namely factoring through what we call\n  -- reachfortheglue and applying cong and trans.\n  -- The type of such a maneuver is roughly {a : A} -> {b : A} -> {c : B} -> (a = b) -> { f : A -> B } -> ( f b = c ) -> ( f a = c )\n  -- This gluemap map is junk we recreate later.\n  claim gluemap ( gf : plus (mult a d) (mult b (modNat c d)) = gcd d (modNat c d) ) -> ( me : modNat c d = c - div (c - modNat c d) d * d ) -> a * d + b * (c - div (c - modNat c d) d * d) = gcd d (modNat c d)\n  intros\n  let reachfortheglue = \\v => plus (mult a d) (mult b v)\n  let rftgv = cong {f=reachfortheglue} me\n  let fv = the ( reachfortheglue ( c - div (c - modNat c d) d * d ) = plus (mult a d) (mult b $ c - div (c - modNat c d) d * d) ) Refl\n  let t_rftgv_fv = trans rftgv fv\n  let t_trftgvfg_gf = trans (sym t_rftgv_fv) gf\n  exact t_trftgvfg_gf\n  let reachfortheglue = \\v => plus (mult a d) (mult b v)\n  let rftgv = cong {f=reachfortheglue} modeq\n  let fv = the ( reachfortheglue ( c - div (c - modNat c d) d * d ) = plus (mult a d) (mult b $ c - div (c - modNat c d) d * d) ) Refl\n  let t_rftgv_fv = trans rftgv fv\n  let t_trftgvfg_gf = trans (sym t_rftgv_fv) gcdformknown\n  exact t_trftgvfg_gf\n  exact (?modeqpr c d)\n\n\n\ntotal\nbezeqty : Nat -> Nat -> (Nat,Nat) -> Type\nbezeqty c d (a,b) = a*c+b*d = gcd c d\n\nlemma_gcdrecdepparout : (c : Nat) -> (d : Nat) -> (a : Nat) -> (b : Nat)\n\t-> ( gcdformknown : bezeqty d (modNat c d) (a,b))\n\t-> ( nn:(Nat,Nat) ** bezeqty c d nn )\nlemma_gcdrecdepparout = ?lemma_gcdrecdepparoutpr\n\nlemma_gcdrecdepparoutpr = proof\n  intros\n  claim imedeq ( b*c + (a-b*(div (c-(modNat c d)) d))*d = gcd c d )\n  unfocus\n  exact ( (b, (a - b * div (c - modNat c d) d)) ** imedeq )\n  -- here we see the sum in the conclusion of lemma_gcdrec\n  -- differs in term order from that needed\n  rewrite sym (sym $ lemma_gcdrec c d a b gcdformknown)\n  compute\n  rewrite sym ( plusCommutative (mult b c) (mult (minus a (mult b (div (minus c (modNat c d)) d))) d) )\n  exact Refl\n\n\n\nbezoutsIdentityNat : (c:Nat) -> (d:Nat)\n\t-> ( nn : (Nat,Nat) ** bezeqty c d nn )\nbezoutsIdentityNat c Z = ((1,0) ** gcdwzero)\n\twhere\n\t\tgcdwzero = gcdwzeroproof c\nbezoutsIdentityNat c d with (bezoutsIdentityNat d (modNat c d))\n\t| ((a,b) ** oldpr) = lemma_gcdrecdepparout c d a b oldpr\n", "meta": {"hexsha": "7abafc5b2a9031ce0ce13b7907e164a1194da9bf", "size": 9125, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "_Archive/OldGCDAttempts/BezoutsIdentity.idr", "max_stars_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_stars_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "max_stars_repo_licenses": ["CC-BY-4.0"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2016-07-12T15:25:52.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-14T05:43:48.000Z", "max_issues_repo_path": "_Archive/OldGCDAttempts/BezoutsIdentity.idr", "max_issues_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_issues_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "max_issues_repo_licenses": ["CC-BY-4.0"], "max_issues_count": 16, "max_issues_repo_issues_event_min_datetime": "2016-06-10T02:31:24.000Z", "max_issues_repo_issues_event_max_datetime": "2018-01-07T16:16:50.000Z", "max_forks_repo_path": "_Archive/OldGCDAttempts/BezoutsIdentity.idr", "max_forks_repo_name": "runKleisli/verified-integer-gaussian-elimination", "max_forks_repo_head_hexsha": "cbaed9c2d8d77db25bd13c8c53beea8ac320855c", "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": 36.7943548387, "max_line_length": 208, "alphanum_fraction": 0.6690410959, "num_tokens": 2877, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998560157665, "lm_q2_score": 0.6513548646660543, "lm_q1q2_score": 0.506298042520093}}
{"text": "import IsEven\nimport Matrix\nimport VecSort\nimport Vectors\nimport WordLength\nimport WordLength_vec\nimport XOR\n\n", "meta": {"hexsha": "fe26a12e75f2cabfd8dc1c4cb2123fcaf4bd5913", "size": 110, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/typedd-book/chapter03/All.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/typedd-book/chapter03/All.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": "idris2/tests/typedd-book/chapter03/All.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "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": 12.2222222222, "max_line_length": 21, "alphanum_fraction": 0.8636363636, "num_tokens": 27, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7606506526772883, "lm_q2_score": 0.665410558746814, "lm_q1q2_score": 0.5061449758091231}}
{"text": "||| This module can be used to run an SF for a long time\n||| as quickly as possible to check for memory leaks.\nmodule Test.Leak\n\nimport Control.ANSI.CSI\nimport Control.Monad.Identity\nimport Control.Monad.Reader\nimport Control.MonadRec\nimport Data.Fuel\nimport Data.Iterable\nimport Data.MSF\nimport Data.MSF.Running\nimport Data.MSF.Switch\nimport Data.MSF.Trans\nimport Data.String\n\n%default total\n\n--------------------------------------------------------------------------------\n--          Some FRP primitives\n--------------------------------------------------------------------------------\n\nDTime : Type\nDTime = Double\n\nSF : Type -> Type -> Type\nSF = MSF (ReaderT DTime Identity)\n\nVelocity : Type\nVelocity = Double\n\nAcceleration : Type\nAcceleration = Double\n\nintegralFrom : (v0 : Double) -> SF Double Double\nintegralFrom v0 = fan [id, iPre v0, ask] >>> accumulateWith next 0\n  where next : NP I [Double,Double,DTime] -> Double -> Double\n        next [new,old,dt] acc = acc + (dt / 2 * (new + old))\n\nacc : Acceleration\nacc = -9.81\n\nvelocity : (v0 : Velocity) -> (a0 : Acceleration) -> SF Acceleration Velocity\nvelocity v0 a0 = integralFrom a0 >>^ (+ v0)\n\nposition : (p0 : Double) -> (v0 : Velocity) -> SF Velocity Double\nposition p0 v0 = integralFrom v0 >>^ (+ p0)\n\n--------------------------------------------------------------------------------\n--          Bouncing Ball\n--------------------------------------------------------------------------------\n\nrecord Ball where\n  constructor MkBall\n  pos : Double\n  vel : Velocity\n\ndispBall : NP I [Ball,Nat] -> String\ndispBall [b,n] =\n  let char = if b.vel <= 0 then '<' else '>'\n   in    cursorUp1\n      ++ eraseLine End\n      ++ padLeft 9 ' ' (show n)\n      ++ \"  \"\n      ++ replicate (cast b.pos) char\n\nballFrom : Ball -> SF i Ball\nballFrom (MkBall p0 v0) =\n      const acc\n  >>> velocity v0 acc\n  >>> fan [position p0 v0, id]\n  >>^ \\[p,v] => MkBall p v\n\nbounce : Ball -> Event (SF i Ball)\nbounce (MkBall y vy) =\n  if y <= 0 then Ev . ballFrom $ MkBall y (-vy) else NoEv\n\nballGame : Ball -> SF i Ball\nballGame b0 = feedback NoEv $ rSwitch (ballFrom b0) >>> fan [arr bounce, id]\n\ngame : MSF Identity () Ball\ngame = const 0.0001 >>> fromReader_ (ballGame $ MkBall 80 0)\n\ncontroller : MSF IO () ()\ncontroller = morph (pure . runIdentity) (fan [game,count]) >>! putStrLn . dispBall\n\nrun : Fuel -> IO ()\nrun f = iterM (\\_,sf => snd <$> step sf ()) (const ()) controller f\n\n||| This uses monad morphisms and recursive switches under the hood,\n||| which were problematic in earlier implementations. Hence this test\n||| that they behave correctly over a prolonged period of time.\npartial\nmain : IO ()\nmain = run (limit 10000000)\n", "meta": {"hexsha": "1967f95b18f656be4612df0f9fd8b8c2299c1ae5", "size": 2667, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Test/Leak.idr", "max_stars_repo_name": "stefan-hoeck/idris2-rhone", "max_stars_repo_head_hexsha": "be8f65a096cfb17f62282df45b1a3f6617138438", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2021-07-25T08:43:28.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-11T23:21:44.000Z", "max_issues_repo_path": "src/Test/Leak.idr", "max_issues_repo_name": "stefan-hoeck/idris2-rhone", "max_issues_repo_head_hexsha": "be8f65a096cfb17f62282df45b1a3f6617138438", "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/Test/Leak.idr", "max_forks_repo_name": "stefan-hoeck/idris2-rhone", "max_forks_repo_head_hexsha": "be8f65a096cfb17f62282df45b1a3f6617138438", "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": 27.78125, "max_line_length": 82, "alphanum_fraction": 0.5819272591, "num_tokens": 701, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8539127529517043, "lm_q2_score": 0.5926665999540698, "lm_q1q2_score": 0.5060855679493061}}
{"text": "module Main\n\n-- Test wraparound from upper bounds of Bits types\nmain : IO ()\nmain = do putStrLn (show $ the Bits16 maxBound)\n          putStrLn (show $ the Bits16 maxBound + 1)\n          putStrLn (show $ the Bits32 maxBound)\n          putStrLn (show $ the Bits32 maxBound + 1)\n          putStrLn (show $ the Bits64 maxBound)\n          putStrLn (show $ the Bits64 maxBound + 1)\n", "meta": {"hexsha": "1617a29aa7c02ed3490a23142d1087bd47f12238", "size": 377, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/bounded001/bounded001.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/bounded001/bounded001.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/bounded001/bounded001.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 34.2727272727, "max_line_length": 51, "alphanum_fraction": 0.6339522546, "num_tokens": 95, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.785308580887758, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5059155041470758}}
{"text": "module Crypto.ECDH\n\nimport Crypto.Random\nimport Crypto.Curve.XCurves\nimport Crypto.Curve\nimport Data.Vect\nimport Utils.Misc\nimport Utils.Bytes\n\npublic export\ninterface ECDHCyclicGroup (0 a : Type) where\n  Scalar : Type\n  Element : Type\n  diffie_hellman : Scalar -> Element -> Maybe (List Bits8)\n  generate_key_pair : MonadRandom m => m (Scalar,Element)\n\n  deserialize_pk : List Bits8 -> Maybe Element\n  serialize_pk : Element -> List Bits8\n\npublic export\ndeserialize_then_dh : ECDHCyclicGroup dh => Scalar {a=dh} -> List Bits8 -> Maybe (List Bits8)\ndeserialize_then_dh sk pk = (deserialize_pk {a=dh} pk) >>= (diffie_hellman sk)\n\npublic export\ndata X25519_DH : Type where\n\npublic export\nECDHCyclicGroup X25519_DH where\n  Scalar = Vect 32 Bits8\n  Element = Vect 32 Bits8\n  diffie_hellman sk pk = map toList (XCurves.mul x25519 sk pk)\n  generate_key_pair = do\n    sk <- random_bytes 32\n    let Just pk = derive_public_key x25519 sk\n    | Nothing => generate_key_pair {a=X25519_DH}\n    pure (sk,pk)\n  deserialize_pk content = exactLength 32 $ fromList content\n  serialize_pk = toList\n\npublic export\ndata X448_DH : Type where\n\npublic export\nECDHCyclicGroup X448_DH where\n  Scalar = Vect 56 Bits8\n  Element = Vect 56 Bits8\n  diffie_hellman sk pk = map toList (XCurves.mul x448 sk pk)\n  generate_key_pair = do\n    sk <- random_bytes 56\n    let Just pk = derive_public_key x448 sk\n    | Nothing => generate_key_pair {a=X448_DH}\n    pure (sk,pk)\n  deserialize_pk content = exactLength 56 $ fromList content\n  serialize_pk = toList\n\npublic export\n{p : _} -> Point p => ECDHCyclicGroup p where\n  Scalar = Integer\n  Element = p\n  diffie_hellman sk pk =\n    let (x, _) = to_affine $ mul sk pk\n        bytes = divCeilNZ (bits {p=p}) 8 SIsNonZero\n    in Just $ toList $ integer_to_be bytes x\n  generate_key_pair = do\n    sk <- uniform_random' 2 (order {p=p} - 1)\n    let pk = mul sk $ generator {p=p}\n    pure (sk,pk)\n  deserialize_pk = decode {p=p}\n  serialize_pk = encode {p=p}\n", "meta": {"hexsha": "8479c6ba2705f0d4f21b528178dc3564ae182c9a", "size": 1965, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Crypto/ECDH.idr", "max_stars_repo_name": "octeep/idris2-tls", "max_stars_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_stars_repo_licenses": ["ISC"], "max_stars_count": 28, "max_stars_repo_stars_event_min_datetime": "2021-12-23T15:57:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T11:00:15.000Z", "max_issues_repo_path": "src/Crypto/ECDH.idr", "max_issues_repo_name": "octeep/idris2-tls", "max_issues_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_issues_repo_licenses": ["ISC"], "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/Crypto/ECDH.idr", "max_forks_repo_name": "octeep/idris2-tls", "max_forks_repo_head_hexsha": "951bef674c41f059d5ccddf568b45588b5dbceee", "max_forks_repo_licenses": ["ISC"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.0714285714, "max_line_length": 93, "alphanum_fraction": 0.7180661578, "num_tokens": 592, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8479677506936878, "lm_q2_score": 0.5964331462646254, "lm_q1q2_score": 0.5057560734771737}}
{"text": "data Foo : Nat -> Type where\n\n0 G : (0 yv : Nat) -> Type\nG yv = Foo yv -> Bool\n\npartial\nf : (0 x : Nat) -> Nat\nf x = case G x of\n           (Foo x' -> _) => x'\n", "meta": {"hexsha": "bbe2df5f59d91cd64596c273cd965482c6d5e0dc", "size": 160, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/reg038/Test2.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/reg038/Test2.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/reg038/Test2.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 16.0, "max_line_length": 30, "alphanum_fraction": 0.46875, "num_tokens": 62, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8221891392358015, "lm_q2_score": 0.6150878555160665, "lm_q1q2_score": 0.5057185544811498}}
{"text": "module Main\n\nnext : Nat -> Stream Nat\nnext n = (n :: Delay (next (S n)))\n\ndata InfIO : Type where\n  Do : IO a -> (a -> Inf InfIO) -> InfIO\n\n-- sugar me with do-notation\n(>>=) : IO a -> (a -> Inf InfIO) -> InfIO\n(>>=) = Do\n\n-- First try, infinite IO with partial run\n\nloopPrint : Nat -> InfIO\nloopPrint x = do putStrLn (show x)\n                 loopPrint (S x)\n\nrun : InfIO -> IO ()\nrun (Do x f) = do res <- x\n                  run (f res)\n\n-- Second try, finine infinite IO with total run\n\ndata Fuel : Type where\n  Dry : Fuel\n  More : Fuel -> Fuel\n\ntank : Nat -> Fuel\ntank Z = Dry\ntank (S k) = More (tank k)\n\ntotal runTank : Fuel -> InfIO -> IO ()\nrunTank Dry _ = putStrLn \"Out of Fuel\"\nrunTank (More fuel) (Do c f) = do res <- c\n                                  runTank fuel (f res)\n\n-- Third try, Lazy Fuel for infinite infinite IO with a total run\n\ndata Gas : Type where\n  Empty : Gas\n  Some : Lazy Gas -> Gas\n\ndata Run : Type where\n  Stop : Run\n  Step : Lazy Run -> Run\n\ntotal runEngine : Gas -> InfIO -> IO ()\nrunEngine Empty y = putStrLn \"Out of fuel\"\nrunEngine (Some x) (Do y f) = y >>= \\res => runEngine x (f res)\n\nfreeGas : Gas\nfreeGas = Some freeGas\n\nmain : IO ()\nmain = runEngine freeGas (loopPrint 0)\n\nh : Nat -> () -> Nat\nh x = \\_ => (+) x 1\n\nh' : Nat -> Lazy Nat\nh' x = (+) x 1\n", "meta": {"hexsha": "327ee48adc27966970ed07a7c0e7957440bb7583", "size": 1293, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris/11.2-InfiniteIO.idr", "max_stars_repo_name": "ostera/asdf", "max_stars_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2017-03-02T22:25:19.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-30T18:22:11.000Z", "max_issues_repo_path": "idris/11.2-InfiniteIO.idr", "max_issues_repo_name": "ostera/asdf", "max_issues_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2019-12-05T22:45:56.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-05T22:45:58.000Z", "max_forks_repo_path": "idris/11.2-InfiniteIO.idr", "max_forks_repo_name": "ostera/asdf", "max_forks_repo_head_hexsha": "adec59de04ce1c2994db60b92f693e621bf68850", "max_forks_repo_licenses": ["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.5238095238, "max_line_length": 65, "alphanum_fraction": 0.5730858469, "num_tokens": 405, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7981867777396212, "lm_q2_score": 0.6334102567576901, "lm_q1q2_score": 0.5055796918286468}}
{"text": "module Patricia.IntSet\n\nimport Patricia.IntMap\n\n%default total\n%access export\n\npublic export\ndata IntBitSet : (bits : Nat) -> Type where\n  MkIntSet : IntBitMap bits Unit -> IntBitSet bits\n\n||| Integer set with 32 bits integers as an element.\npublic export\nInt32Set : Type\nInt32Set = IntBitSet 32\n\n||| `O(n)`. Number of elements in `IntBitSet`.\npublic export\nsize : IntBitSet (S n) -> Nat\nsize (MkIntSet t) = size t\n\n||| `O(min(n, W))`. Check if the value is in the `IntBitSet`.\npublic export\nmember : Integer -> IntBitSet (S n) -> Bool\nmember x (MkIntSet t) = isJust (lookup x t)\n\n||| `O(min(n,W))`. Insert a new `value` in the `IntBitSet`.\n||| If the value is already present in the set, the tree isn't changed.\npublic export\ninsert : Integer -> IntBitSet (S n) -> IntBitSet (S n)\ninsert x (MkIntSet t) = MkIntSet (insert x () t)\n\n||| `O(min(n,W))`. Delete the `value` from `IntBitSet`.\n||| If the value is not present in the set, the tree isn't changed.\npublic export\ndelete : Integer -> IntBitSet (S n) -> IntBitSet (S n)\ndelete x (MkIntSet t) = MkIntSet (delete x t)\n\n||| Create `IntBitSet` from list of `value`.\npublic export\nfromList : List Integer -> IntBitSet (S n)\nfromList = MkIntSet . fromList . map (\\x => (x, ()))\n", "meta": {"hexsha": "f2a8e653485d7ee092aff81e7160d577c9a2cb02", "size": 1227, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Patricia/IntSet.idr", "max_stars_repo_name": "ChShersh/idris-persistent-array", "max_stars_repo_head_hexsha": "78ed6da63b05fdc19a107a70c595c65bc0a48f51", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 11, "max_stars_repo_stars_event_min_datetime": "2018-10-15T07:09:58.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-29T14:39:32.000Z", "max_issues_repo_path": "Patricia/IntSet.idr", "max_issues_repo_name": "ChShersh/idris-patricia", "max_issues_repo_head_hexsha": "78ed6da63b05fdc19a107a70c595c65bc0a48f51", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2017-10-12T17:43:01.000Z", "max_issues_repo_issues_event_max_datetime": "2017-10-27T19:58:46.000Z", "max_forks_repo_path": "Patricia/IntSet.idr", "max_forks_repo_name": "ChShersh/idris-persistent-array", "max_forks_repo_head_hexsha": "78ed6da63b05fdc19a107a70c595c65bc0a48f51", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2017-10-27T13:11:19.000Z", "max_forks_repo_forks_event_max_datetime": "2017-10-27T17:27:18.000Z", "avg_line_length": 28.5348837209, "max_line_length": 71, "alphanum_fraction": 0.6813365933, "num_tokens": 390, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7634837527911056, "lm_q2_score": 0.66192288918838, "lm_q1q2_score": 0.5053673714958755}}
{"text": "%default total\n\n--------------------------------------------------------\n-- Shrunk\n\ndata D : List (List a) -> Type where\n  C1 : D [ts]\n  C2 : D [ts]\n\nf : D [[Maybe a]] -> Nat\nf C1 = 0\nf C2 = 0\n\n--------------------------------------------------------\n-- Original bug report\n\ndata NP : (ts : List Type) -> Type where\n  Nil  : NP []\n  (::) : (v : t) -> (vs : NP ts) -> NP (t :: ts)\n\ndata NS : (kss : List $ List Type) -> Type where\n  Z : (vs : NP ts) -> NS (ts :: tss)\n  S : NS tss -> NS (ts :: tss)\n\nUninhabited (NS []) where\n  uninhabited (Z _) impossible\n  uninhabited (S _) impossible\n\ndata Funny : (a : Type) -> (f : Type -> Type) -> Type where\n  A : List a -> f a -> Funny a f\n  B : Funny a f\n\ndecode : NS [[List a, f a], []] -> Funny a f\ndecode (Z [a,b])  = A a b\ndecode (S (Z [])) = B\n", "meta": {"hexsha": "4ec21e602600d28a79222877269bfb873de6eee2", "size": 791, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/coverage015/Issue1366.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/coverage015/Issue1366.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/coverage015/Issue1366.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 21.9722222222, "max_line_length": 59, "alphanum_fraction": 0.4412136536, "num_tokens": 265, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059609645724, "lm_q2_score": 0.6370307944803832, "lm_q1q2_score": 0.5052329204203894}}
{"text": "-- --------------------------------------------------------------- [ Day08.idr ]\n-- Module      : Data.Advent.Day08\n-- Description : My solution to the Day 8 puzzle of the 2016 Advent of Code.\n-- Copyright   : Copyright (c) 2016, Eric Bailey\n-- License     : MIT\n-- Link        : http://adventofcode.com/2016/day/7\n-- --------------------------------------------------------------------- [ EOH ]\n||| Day 8: Two-Factor Authentication\nmodule Data.Advent.Day08\n\nimport Data.Vect\n\nimport public Lightyear\nimport public Lightyear.Char\nimport public Lightyear.Strings\nimport public Lightyear.StringFile\n\n%default total\n\n-- -------------------------------------------------------------- [ Data Types ]\n\n%access public export\n\ndata Pixel = Off | On\n\nimplementation Eq Pixel where\n    On  == On  = True\n    Off == Off = True\n    px1 == px2 = False\n\nimplementation Show Pixel where\n    show Off = \".\"\n    show On  = \"#\"\n\nScreen : Nat -> Nat -> Type\nScreen w h = Vect h (Vect w Pixel)\n\nimplementation [showScreen] Show (Screen w h) where\n    show = unlines . toList . map (concatMap show)\n\ndata Rect : Nat -> Nat -> Type where\n     MkRect : Fin w -> Fin h -> Rect w h\n\nimplementation Show (Fin n) where\n    show = show . finToNat\n\n-- showFin : Fin n -> String\n-- showFin = show . finToNat\n\nimplementation Show (Rect w h) where\n    show (MkRect w h) = \"rect \" ++ show w ++ \"x\" ++ show h\n\ndata Rotate : Nat -> Nat -> Type where\n     Row : Fin w -> Fin h -> Rotate h w\n     Col : Fin w -> Fin h -> Rotate w h\n\nimplementation Show (Rotate xy by) where\n    show (Row y by) = \"rotate row y=\" ++ show y ++ \" by \" ++ show by\n    show (Col x by) = \"rotate column x=\" ++ show x ++ \" by \" ++ show by\n\n-- ----------------------------------------------------------------- [ Parsers ]\n\n%access export\n\npartial\nside : (n : Nat) -> Parser (Fin n)\nside n = do Just len <- (\\m => integerToFin m n) <$> integer\n              | Nothing => fail \"out of bounds\"\n            pure len\n\npartial\nrect : Parser (Rect w h)\nrect = liftA2 MkRect (token \"rect\" *> side w)\n                     (token \"x\"    *> side h)  <?> \"rect AxB\"\n\npartial\nmaybeFin : (n : Nat) -> Parser (Maybe (Fin n))\nmaybeFin n = marshal <$> integer <* spaces <?>\n             \"a number strictly less than \" ++ show n\n  where\n    marshal : Integer -> Maybe (Fin n)\n    marshal m = integerToFin m n\n\npartial\nrow : Parser (Rotate w h)\nrow {w} {h} = do Just y  <- token \"rotate row y=\" *> maybeFin h\n                 Just by <- token \"by\" *> maybeFin w\n                 pure $ Row y by\n\npartial\ncolumn : Parser (Rotate w h)\ncolumn {w} {h} = do Just x  <- token \"rotate column x=\" *> maybeFin w\n                    Just by <- token \"by\" *> maybeFin h\n                    pure $ Col x by\n\npartial\nrotation : Parser (Rotate w h)\nrotation = row <|> column <?> \"a rotation\"\n\npartial\nrectOrRotation : Parser (Either (Rect w h) (Rotate w h))\nrectOrRotation {w} {h} = case !(opt (rect {w} {h})) of\n                              Just rec => pure $ Left rec\n                              Nothing  => Right <$> rotation {w} {h}\n\n-- ----------------------------------------------------------------- [ Helpers ]\n\n%access private\n\nmapIndexed : (f : (a, Nat) -> a) -> Vect n a -> Vect n a\nmapIndexed f xs {n} = map f (zip xs (go n Z))\n  where\n    go : (m : Nat) -> Nat -> Vect m Nat\n    go Z _     = []\n    go (S k) x = x :: go k (S x)\n\n-- ------------------------------------------------------------------ [ Proofs ]\n\n%access private\n\nfinToLTE : (f : Fin n) -> LTE (finToNat f) n\nfinToLTE FZ               = LTEZero\nfinToLTE (FS _) {n = S _} = LTESucc (finToLTE _)\n\ntotal compositeLemma : (left, right : Nat) -> {auto smaller : LTE left right} ->\n  (k : Nat ** right = left + k)\ncompositeLemma left right = (right - left ** go left right)\n  where\n    go : (left, right : Nat) -> {auto smaller : LTE left right} ->\n      right = left + (right - left)\n    go Z right        = rewrite minusZeroRight right in Refl\n    go (S k) (S j) {smaller} =\n        let inductiveHypothesis = go k j {smaller = fromLteSucc smaller} in\n            eqSucc j (k + (minus j k)) inductiveHypothesis\n\ntotal updateLemma : (prf : n = finToNat by + m) -> n = m + finToNat by\nupdateLemma {by} {m} prf = rewrite plusCommutative m (finToNat by) in prf\n\n-- -- ---------------------------------------------------------------- [ Logic ]\n\nturnOn : Rect sw sh -> Screen sw sh -> Screen sw sh\nturnOn (MkRect w h) = mapIndexed f\n  where\n    g : (Pixel, Nat) -> Pixel\n    g (col, x) = if x < (finToNat w) then On else col\n    f : (Vect m Pixel, Nat) -> Vect m Pixel\n    f (row, y) = if y < (finToNat h) then mapIndexed g row else row\n\nnamespace Vect\n\n  rotate : (by : Fin n) -> Vect (finToNat by + m) a ->\n           (m ** Vect (m + finToNat by) a)\n  rotate by xs {m} = let (ys,zs) = splitAt (finToNat by) xs in\n                         (m ** zs ++ ys)\n\nupdateRow : (by : Fin n) -> (row : Vect n Pixel) -> Vect n Pixel\nupdateRow {n} by row =\n    let (m ** prf)    = compositeLemma (finToNat by) n {smaller = finToLTE by}\n        (_ ** newRow) = rotate by $ the (Vect (finToNat by + m) _) $\n                        rewrite sym prf in row in\n                        rewrite updateLemma prf in\n                                newRow\n\nnamespace Fin\n\n    rotate : Fin n -> Fin n\n    rotate f {n} = let x = (-) n (finToNat f) {smaller = finToLTE f} in\n                       fromMaybe f (natToFin x n) -- HACK\n\nnamespace Screen\n\n  empty : {w, h : Nat} -> Screen w h\n  empty {w} {h} = replicate h (replicate w Off)\n\n  rotate : (Rotate w h) -> Screen w h -> Screen w h\n  rotate (Row y by) screen     = updateAt y (updateRow (rotate by)) screen\n  rotate (Col x by) screen {h} = transpose $\n                                 updateAt x (updateRow (rotate by)) $\n                                 transpose screen\n\nhowManyLit : Screen w h -> Nat\nhowManyLit = foldr ((+) . foldr go Z) Z\n  where\n    go : Pixel -> Nat -> Nat\n    go On  = S\n    go Off = id\n\njustDoIt : List (Either (Rect w h) (Rotate w h)) -> Screen w h\njustDoIt = foldl (\\s => either (flip turnOn s) (flip rotate s)) empty\n\n-- ---------------------------------------------------------------- [ Examples ]\n\nex1 : Screen 7 3\nex1 = turnOn (MkRect 3 2) empty\n\nex2 : Screen 7 3\nex2 = rotate (Col 1 1) ex1\n\nex3 : Screen 7 3\nex3 = rotate (Row 0 4) ex2\n\nex4 : Screen 7 3\nex4 = rotate (Col 1 1) ex3\n\npartial\nexamples : Either String (List (Either (Rect 7 3) (Rotate 7 3)))\nexamples = parse (some (rectOrRotation <* spaces)) $ unlines [\n             \"rect 3x2\",\n             \"rotate column x=1 by 1\",\n             \"rotate row y=0 by 4\",\n             \"rotate column x=1 by 1\"\n           ]\n\n||| Convenient representation of Part One examples for the REPL.\npartial\nprettyExamples : Either String (List (List String))\nprettyExamples = transpose .\n                 map (lines . show @{showScreen}) .\n                 scanl (\\s => either (flip turnOn s) (flip rotate s)) empty <$>\n                 examples\n\n-- -------------------------------------------------------------- [ Main Logic ]\n\n%access export\n\nmain' : Parser a -> (a -> String) -> IO ()\nmain' p f =\n    either putStrLn (putStrLn . f)\n           !(run $ parseFile (const show) (const id) p \"input/day08.txt\")\n\n-- ---------------------------------------------------------------- [ Part One ]\n\nnamespace PartOne\n\n    partial main : IO ()\n    main = main' (some (rectOrRotation {w=50} {h=6} <* spaces))\n                 (show . howManyLit . justDoIt)\n\n-- ---------------------------------------------------------------- [ Part Two ]\n\nnamespace PartTwo\n\n    partial main : IO ()\n    main = main' (some (rectOrRotation {w=50} {h=6} <* spaces))\n                 (show @{showScreen} . justDoIt)\n\n-- -------------------------------------------------------------------- [ Main ]\n\nnamespace Main\n\n    partial main : IO ()\n    main = putStr   \"Part One: \" *> PartOne.main *>\n           putStrLn \"Part Two:\"  *> PartTwo.main\n\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "92f79a5989ae8eb3b1a6d90f654184bf69e22c26", "size": 7969, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Advent/Day08.idr", "max_stars_repo_name": "yurrriq/advent-of-code", "max_stars_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-11-04T10:32:47.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-05T07:36:22.000Z", "max_issues_repo_path": "src/Data/Advent/Day08.idr", "max_issues_repo_name": "yurrriq/aoc19", "max_issues_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_issues_repo_licenses": ["MIT"], "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/Advent/Day08.idr", "max_forks_repo_name": "yurrriq/aoc19", "max_forks_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-02-26T19:27:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-26T19:27:21.000Z", "avg_line_length": 31.12890625, "max_line_length": 80, "alphanum_fraction": 0.5043292759, "num_tokens": 2161, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7931059511841119, "lm_q2_score": 0.6370307875894139, "lm_q1q2_score": 0.5052329087246661}}
{"text": "module InsertionProof\n\nimport Data.Vect\nimport congruence\nimport Data.Fin\nimport Permutation\nimport PermCons\nimport Finite\nimport DecOrderNat\nimport LTE_Properties\nimport SortingWithProof\nimport InsertionSort\nimport InsertionHelpers\nimport PermConsProperties\n\n%access public export\n%default total\n\ninsertProof : (n : Nat) -> (a : Nat) -> (xs : (Vect n Nat)) ->\n              (SortedVect n xs) -> (SortedVect (S n) (a :: xs))\n\ninsertProof Z a Nil sorted_Nil =\n    ( [a] ** ((Idt (S Z) ** (Refl, (insertHelper8 a)))))\n\ninsertProof (S Z) a [x] sorted_x = case (decMin a x) of\n    (Left pfLTE) => let\n        pf = insertHelper8 x\n        in\n        ( [a, x] ** ((Idt 2) ** (Refl, (insertHelper1 Z a x Nil pfLTE pf))))\n    (Right pfLTE) => let\n        pf = insertHelper8 a\n        in\n        ( [x, a] ** ((Swap 2 FZ) ** (Refl, (insertHelper1 Z x a Nil pfLTE pf))))\n\ninsertProof (S (S n)) a xs sorted_xs = let\n    {-\n    (x :: u) = (fst sorted_xs)\n    perm_xs = (fst (snd sorted_xs))\n    pf_total_xs = (snd (snd sorted_xs))\n    pf_perm_xs = fst pf_total_xs  -- perm_xs xs = (x :: u)\n    pf_sorted_xs = snd pf_total_xs\n\n    in\n\n    case (decMin a (head (fst sorted_xs))) of\n\n        (Left pfLTE) => let\n\n            perm = includePerm (S (S n)) (fst (snd sorted_xs)) -- perm_xs as a permutation of a :: xs\n\n            pf1_1 = PermC_prp_1 (S (S n)) a xs (fst (snd sorted_xs))\n            -- ( (a :: (applyPerm n Nat perm xs)) = (applyPerm (S n) Nat (includePerm n perm) (a :: xs)))\n\n            pf1_2 = congruence (Vect (S (S n)) Nat) (Vect (S (S (S n))) Nat)\n                (fst sorted_xs) (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs)\n                (\\k => (a :: k)) (sym pf_perm_xs)\n            -- a :: fst sorted_xs = a :: applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs\n\n\n            pf1_3 = sym (trans pf1_2 pf1_1)\n            -- applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs) = a :: fst sorted_xs\n\n            pf1_5 = (\\k => (insertHelper10 (S n) (fst sorted_xs) k (pf_sorted_xs k)))\n\n            pf1_4 = insertHelper1 (S n) a (head (fst sorted_xs)) (tail (fst sorted_xs)) pfLTE pf1_5\n\n            in\n            ((a :: (fst sorted_xs)) ** (perm ** (pf1_3, ?rhs)))\n\n        (Right pfLTE) => ?rhs2\n      -}\n\n    (x1 :: v1) = (fst sorted_xs)\n    x = (head (fst sorted_xs))\n    u = (tail (fst sorted_xs))\n    perm_xs = (fst (snd sorted_xs))\n    pf_total_xs = (snd (snd sorted_xs))\n    pf_perm_xs = fst pf_total_xs  -- perm_xs xs = v\n    pf_sorted_xs = snd pf_total_xs\n    pf1_5 = (\\k => (insertHelper10 (S n) (fst sorted_xs) k (pf_sorted_xs k)))\n\n    -- IsSorted (S (S n)) (head (fst sorted_xs) :: tail (fst sorted_xs)) :=\n\n    --  (k16 : Fin (S (S n))) ->\n    --      LTE (index (Data.Fin.Fin (S n) implementation of Prelude.Enum, method pred k16)\n    --          (head (fst sorted_xs) :: tail (fst sorted_xs)))\n    --              (index k16 (head (fst sorted_xs) :: tail (fst sorted_xs)))\n\n    in\n\n    case (decMin a (head (fst sorted_xs))) of\n\n        (Left pfLTE) =>\n        let\n            perm = includePerm (S (S n)) (fst (snd sorted_xs))\n\n            pf1_1 = PermC_prp_1 (S (S n)) a xs (fst (snd sorted_xs))\n            -- a :: applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs =\n            --    applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)\n\n            pf1_2 = congruence (Vect (S (S n)) Nat) (Vect (S (S (S n))) Nat)\n                (fst sorted_xs) (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs)\n                (\\k => (a :: k)) (sym pf_perm_xs)\n            -- a :: fst sorted_xs = a :: applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs\n\n            pf1_3 = sym (trans pf1_2 pf1_1)\n            -- applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs) = a :: fst sorted_xs\n\n            pf1_4 = insertHelper1 (S n) a (head (fst sorted_xs)) (tail (fst sorted_xs)) pfLTE pf1_5 --pf_sorted_xs\n\n            -- IsSorted (S (S (S n))) (a :: (head (fst sorted_xs) :: tail (fst sorted_xs))) :=\n\n            --(k : Fin (S (S (S n)))) ->\n            --    LTE (index (Data.Fin.Fin (S n) implementation of Prelude.Enum, method pred k)\n            --        (a :: head (fst sorted_xs) :: tail (fst sorted_xs)))\n            --            (index k (a :: head (fst sorted_xs) :: tail (fst sorted_xs)))\n\n            pf1_7 = vect_prp1 (S n) (fst sorted_xs)\n            -- fst sorted_xs = head (fst sorted_xs) :: tail (fst sorted_xs)\n\n\n            pf1_8 = congruence (Vect (S (S n)) Nat) (Vect (S (S (S n))) Nat) (fst sorted_xs)\n                ((head (fst sorted_xs)) :: (tail (fst sorted_xs))) (\\k => (a :: k)) pf1_7\n            -- a :: fst sorted_xs = a :: head (fst sorted_xs) :: tail (fst sorted_xs)\n\n            pf1_6 = insertHelper11 (S (S n)) (a :: head (fst sorted_xs) :: tail (fst sorted_xs))\n                (a :: (fst sorted_xs)) (sym pf1_8) pf1_4\n            -- IsSorted (S (S (S n))) (a :: (fst sorted_xs)) :=\n\n            --(k : Fin (S (S (S n)))) ->\n            --    LTE (index (Data.Fin.Fin (S n) implementation of Prelude.Enum, method pred k) (a :: fst sorted_xs))\n            --        (index k (a :: fst sorted_xs))\n\n\n            in\n            ( (a :: (fst sorted_xs)) ** (perm ** (pf1_3, pf1_6)))\n\n\n        (Right pfLTE) =>\n\n        let\n\n            pf2_1 = insertHelper9 (S n) (head (fst sorted_xs)) (tail (fst sorted_xs)) pf1_5\n            -- IsSorted (S n) (tail (fst sorted_xs))\n\n            pf2_2 = PermC_prp_2 (S n) (tail (fst sorted_xs))\n            -- applyPerm (S n) Nat (Idt (S n)) (tail (fst sorted_xs)) = tail (fst sorted_xs)\n\n            -- (k : Fin (S n)) ->\n            --     LTE (index (Data.Fin.Fin (S n) implementation of Prelude.Enum, method pred k) (tail (fst sorted_xs)))\n            --         (index k (tail (fst sorted_xs)))\n\n            sorted_a_xs = insertProof (S n) a (tail (fst sorted_xs))\n                ((tail (fst sorted_xs)) ** ((Idt (S n)) ** (pf2_2, pf2_1)))\n\n            perm_a_xs = (fst (snd (sorted_a_xs)))\n\n            perm = CPerm (S (S (S n)))\n                (CPerm (S (S (S n))) (includePerm (S (S n)) (fst (snd (sorted_a_xs)))) (Swap (S (S (S n))) FZ) )\n                (includePerm (S (S n)) (fst (snd (sorted_xs))))\n\n            pf2_3 = PermC_prp_1 (S (S n)) a xs (fst (snd sorted_xs))\n            -- a :: applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs =\n            --     applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)\n\n            pf2_4 = congruence (Vect (S (S (S n))) Nat) Nat\n                    (a :: (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs))\n                    (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))\n                     (\\k => (index FZ k)) pf2_3\n            -- a = index FZ (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))\n\n            pf2_5 = PermC_prp_1 (S (S n))\n\n                       (index (FS FZ) (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)))\n\n                       ((index FZ (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))) ::\n                        (tail (tail (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)))))\n\n                        (fst (snd (insertProof (S n) a\n                                                      (tail (fst sorted_xs))\n                                                      (tail (fst sorted_xs) **\n                                                      (Idt (S n)) **\n                                                      ( (PermC_prp_2 (S n) (tail (fst sorted_xs))),\n                                                        (insertHelper9 (S n) (head (fst sorted_xs)) (tail (fst sorted_xs)) pf1_5))))))\n\n            -- now want to prove that x = (index (FS FZ) (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)))\n\n            pf2_6 = congruence (Vect (S (S (S n))) Nat) Nat\n\n                        (a :: applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs)\n\n                        (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))\n\n                        (\\us => (index (FS FZ) us))\n\n                        pf2_3\n\n            -- index FZ (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs) =\n            --     index (FS FZ) (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))\n\n            pf2_7 = congruence (Vect (S (S n)) Nat) Nat\n\n                    (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs)\n\n                    (fst (sorted_xs))\n\n                    (\\us => ((index FZ) us))\n\n                    pf_perm_xs\n\n             -- index FZ (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs) = index FZ (fst sorted_xs)\n\n            pf2_8 = trans (sym pf2_6) pf2_7\n\n            -- index (FS FZ) (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)) =\n            --    index FZ (fst sorted_xs)\n\n            pf2_10 = insertHelper12 (S n) (fst sorted_xs)\n\n            -- ((index FZ (fst (sorted_xs))) = (head (fst sorted_xs)))\n\n            pf2_11 = trans pf2_8 pf2_10\n\n            -- index (FS FZ) (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)) =\n            -- head (fst sorted_xs)\n\n            pf2_9 = congruence Nat (Vect (S (S (S n))) Nat)\n\n                    (index (FS FZ) (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)))\n\n                    (head (fst sorted_xs)) --(index FZ (fst sorted_xs))\n\n                    (\\z => (z :: (fst (insertProof (S n)\n                          a\n                         (tail (fst sorted_xs))\n                         (tail (fst sorted_xs) **\n                          Idt (S n) **\n                          (PermC_prp_2 (S n) (tail (fst sorted_xs)), insertHelper9 (S n) (head (fst sorted_xs)) (tail (fst sorted_xs)) pf1_5))))))\n\n                    pf2_11\n\n            -- ||||||||||||   code is running but taking too long\n\n            {-\n\n            pf_sorted_a_xs_total = (snd (snd sorted_a_xs))\n\n            pf_perm_a_xs = (fst pf_sorted_a_xs_total)\n\n            pf2_12 = congruence Nat (Vect (S (S n)) Nat) a\n\n\n                (index FZ (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)))\n\n\n                (\\s => (s :: (tail (fst sorted_xs))))\n\n                pf2_4\n\n            -- a :: tail (fst sorted_xs) =\n            -- index FZ (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)) :: tail (fst sorted_xs)\n\n            -- want to prove\n            -- (index FZ (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)) ::\n            --     tail (tail (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)))) =\n            -- (a :: tail (fst sorted_xs))\n\n            -- check pf2_4\n\n            -- want to prove\n            -- (tail (fst sorted_xs)) = (tail (tail (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))))\n\n\n            pf2_13 = PermC_prp_1 (S (S n)) a xs (fst (snd sorted_xs))\n\n            --  a :: applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs =\n            -- applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs)\n\n            pf2_14 = insertHelper13 (S (S n)) a (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs)\n\n            pf2_15 = congruence (Vect (S (S (S n))) Nat) (Vect (S (S n)) Nat)\n                (a :: (applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs))\n                (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))\n                (\\v => (tail v))\n                pf2_13\n\n            -- applyPerm (S (S n)) Nat (fst (snd sorted_xs)) xs =\n            -- tail (applyPerm (S (S (S n))) Nat (includePerm (S (S n)) (fst (snd sorted_xs))) (a :: xs))\n\n            pf2_16 = trans (sym pf_perm_xs) pf2_15\n            -}\n\n\n            in\n            (((head (fst sorted_xs)) :: (fst sorted_a_xs)) ** (perm ** ((trans (trans (sym pf2_5) ?rhs21) pf2_9), ?rhs22)))\n", "meta": {"hexsha": "41f1eafcece54b52eec4bfe3481a5eac3cb02fd5", "size": 12166, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Code/InsertionProof.idr", "max_stars_repo_name": "anotherArka/LTS2019", "max_stars_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2019-01-16T18:03:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-13T16:28:41.000Z", "max_issues_repo_path": "Code/InsertionProof.idr", "max_issues_repo_name": "anotherArka/LTS2019", "max_issues_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 58, "max_issues_repo_issues_event_min_datetime": "2019-01-08T11:22:38.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-21T10:26:10.000Z", "max_forks_repo_path": "Code/InsertionProof.idr", "max_forks_repo_name": "anotherArka/LTS2019", "max_forks_repo_head_hexsha": "a3cd249d7ae85301ef8c1bbc363998f74221ca4d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 22, "max_forks_repo_forks_event_min_datetime": "2019-01-08T05:56:23.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-31T03:58:00.000Z", "avg_line_length": 41.1013513514, "max_line_length": 146, "alphanum_fraction": 0.4816702285, "num_tokens": 3777, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8311430311279739, "lm_q2_score": 0.6076631698328916, "lm_q1q2_score": 0.5050550088797423}}
{"text": "module Main\n\nid' : t -> t\nid' x = x\n\n-- type Dependent version of id\n-- taking an explicit type as its first argument\nthe' : (t : Type) -> t -> t\nthe' t x = x\n\n-- *hai> the' (Int)\n-- the' Int : Int -> Int\n-- *hai> the' (Int) 1\n-- 1 : Int\n-- *hai> id' 1\n-- 1 : Integer\n\nmain : IO ()\nmain = putStrLn \"Oh, hai\"\n\nStringOrIntType : Bool -> Type\nStringOrIntType x = case x of\n                  True => Int\n                  False => String\n\nstringOrIntVal : (x : Bool) -> StringOrIntType x\nstringOrIntVal x = case x of\n                      True => 7\n                      False => \"Seven\"\n\nvalToString : (x : Bool) -> StringOrIntType x -> String\nvalToString x val = case x of\n                        True => cast val\n                        False => val\n\nvalToStringWithHole : (x : Bool) -> StringOrIntType x -> String\nvalToStringWithHole x val = case x of\n                        True => ?xTrueType -- holes\n                        False => ?xFalseType -- ctrl + alt + t\n\n-- idris hai.idr\n-- hai> valToString False \"yaay\"\n-- \"yaay\" : String\n-- *hai> valToString True 2\n-- \"2\" : String\n", "meta": {"hexsha": "ba4cd8f3fdff4ae77e03c89ccc5912f7e7cf7580", "size": 1081, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "starting/hai.idr", "max_stars_repo_name": "prt2121/tdd-playground", "max_stars_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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": "starting/hai.idr", "max_issues_repo_name": "prt2121/tdd-playground", "max_issues_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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": "starting/hai.idr", "max_forks_repo_name": "prt2121/tdd-playground", "max_forks_repo_head_hexsha": "6178c6ff150b11a462d40f0f3a0fd3ccc8d5ffb0", "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.5, "max_line_length": 63, "alphanum_fraction": 0.5272895467, "num_tokens": 320, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.705785040214066, "lm_q2_score": 0.7154239957834733, "lm_q1q2_score": 0.5049355536341464}}
{"text": "module Flexidisc.Header.Label\n\nimport Flexidisc.Header.Type\nimport Flexidisc.OrdList\n\n%default total\n%access public export\n\n||| Proof that a label is in an `Header'`\ndata Label : (l : k) -> (xs : Header' k a) -> Type where\n  ||| A wrapper for an `OrdLabel`\n  L : {xs : OrdList k o a} -> OrdLabel l xs -> Label l (H xs)\n\n%name Label lbl, loc, prf, e, elem\n\n||| Decide whether a label is in a list or not\ndecLabel : DecEq k => (l : k) -> (xs : Header' k a) -> Dec (Label l xs)\ndecLabel l (H xs) with (decLabel l xs)\n  | (Yes prf) = Yes (L prf)\n  | (No contra) = No (\\(L p) => contra p)\n\n||| Given a proof that a label is in the list, get the corresponding value back\natLabel : (xs : Header' l a) -> (loc : Label k xs) -> a\natLabel (H xs) (L loc) = atLabel xs loc\n\n||| Given a proof that an element is in a vector, remove it\ndropLabel : (xs : Header' k a) -> (loc : Label l xs) -> Header' k a\ndropLabel (H xs) (L loc) = H (dropLabel xs loc)\n\n||| Update a value in the `Header'` given it's location and a new value\nchangeType : (xs : Header' k a) -> (loc : Label l xs) -> (new : a) ->\n             Header' k a\nchangeType (H xs) (L loc) = H . changeValue xs loc\n", "meta": {"hexsha": "7134e1c52ece039752f24451ebe4eb56088bbada", "size": 1157, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Flexidisc/Header/Label.idr", "max_stars_repo_name": "berewt/flexidisc", "max_stars_repo_head_hexsha": "8a0c367244229be5d417c04588d8d41b6030dba2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2020-04-02T09:51:01.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-03T05:15:49.000Z", "max_issues_repo_path": "src/Flexidisc/Header/Label.idr", "max_issues_repo_name": "LIST-LUXEMBOURG/flexidisc", "max_issues_repo_head_hexsha": "f5a9cdc81554359e324b64400d8479494cd45a8c", "max_issues_repo_licenses": ["MIT"], "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/Flexidisc/Header/Label.idr", "max_forks_repo_name": "LIST-LUXEMBOURG/flexidisc", "max_forks_repo_head_hexsha": "f5a9cdc81554359e324b64400d8479494cd45a8c", "max_forks_repo_licenses": ["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.0294117647, "max_line_length": 79, "alphanum_fraction": 0.6231633535, "num_tokens": 386, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7879312056025699, "lm_q2_score": 0.640635868562172, "lm_q1q2_score": 0.5047769922684417}}
{"text": "import Data.List\nimport Data.List.Elem\n\n%search_timeout 1000\n\n||| A Place has an ID and a number of tokens\ndata Place : Type where\n  MkPlace : (i : Nat) -> (nTokens : Nat) -> Place\n\n||| A transition has a name\ndata Transition : Type where\n  MkTransition : String -> Transition\n\n||| An Input links a Place and a Transition...\ndata Input : Type where\n  MkInput : (from : Place) -> (to : Transition) -> Input\n\n-- Accessor functions for proof\n0 inputFrom : Input -> Place\ninputFrom (MkInput p t) = p\n\n0 inputTo : Input -> Transition\ninputTo (MkInput p t) = t\n\ndata SoundInputFrom : Input -> List Place -> Type where\n  MkSoundInputFrom : (i : Input)\n                     -> (ps : List Place)\n                     -> (prf : Elem (inputFrom i) ps)\n                     -> SoundInputFrom i ps\n\ndata SoundInputTo : Input -> List Transition -> Type where\n  MkSoundInputTo : (i : Input)\n                   -> (ts : List Transition)\n                   -> (prf : Elem (inputTo i) ts)\n                   -> SoundInputTo i ts\n\ndata SoundInput : Input -> List Place -> List Transition -> Type where\n  MkSoundInput : (i : Input)\n                 -> (ps : List Place)\n                 -> (ts : List Transition)\n                 -> (fromOK : SoundInputFrom i ps)\n                 -> (toOK   : SoundInputTo   i ts)\n                 -> SoundInput i ps ts\n\ndata AllInputsSound : List Input -> List Place -> List Transition -> Type where\n  NilInputsIsSound : AllInputsSound [] _ _\n  ConsIsSound : (headIsSound : SoundInput i ps ts)\n                -> (tailIsSound : AllInputsSound is ps ts)\n                -> AllInputsSound (i :: is) ps ts\n\n-- Searching here finds the right answer immediately, but then if we don't\n-- have a timeout, it takes ages to explore more non-solutions! So we cut off\n-- after a second\ntailIsNotSound : (contra : (AllInputsSound is ps ts -> Void))\n                 -> AllInputsSound (i :: is) ps ts\n                 -> Void\n", "meta": {"hexsha": "bf93ca69e3b312d3c9126cb1a178baf37150f570", "size": 1928, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interactive034/timeout.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/tests/idris2/interactive034/timeout.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/tests/idris2/interactive034/timeout.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 33.8245614035, "max_line_length": 79, "alphanum_fraction": 0.5881742739, "num_tokens": 490, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7879311956428946, "lm_q2_score": 0.640635854839898, "lm_q1q2_score": 0.5047769750757087}}
{"text": "\nimport Control.Indexed\nimport Control.Monad.Indexed.State\n\ndata State = One | Two | Three\n\ndata Transition : Type -> State -> State -> Type where\n  Pure : (x : a) -> Transition a s s\n  First : Transition () One Two\n  Second : Transition () Two Three\n  Third : Transition () Three One\n  Bind : Transition a x y -> (a -> Transition b y z) -> Transition b x z\n\nIndexedFunctor State State Transition where\n  map f (Pure x)   = Pure (f x)\n  map f First      = Bind First  (Pure . f)\n  map f Second     = Bind Second (Pure . f)\n  map f Third      = Bind Third  (Pure . f)\n  map f (Bind x g) = Bind x (\\x' => map f (g x'))\n\n[n1] IndexedApplicative State Transition where\n  pure = Pure\n  ap (Pure f) x = map f x\n  ap (Bind y f) x = \n    Bind y $ \\y' =>\n      Bind (f y') $ \\f' =>\n        Bind x (\\x' => Pure (f' x'))\n\nIndexedMonad State Transition using n1 where\n  bind = Bind\n\ndata Meta = Description String\n\n||| A Transition plus some metadata\nTransitionPlus : Type -> State -> State -> Type\nTransitionPlus = IndexedStateT Meta State State Transition\n\nmain : TransitionPlus () One One\nmain = do\n  put $ Description \"meta text\"\n  lift $ do\n    First\n    Second\n  x <- get\n  lift $ do\n    Indexed.ignore $ Pure x\n    Third\n\n", "meta": {"hexsha": "8acf90c4a6faed567cdd483685b97d145ad59278", "size": 1217, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/examples/state_t/StateTransformer.idr", "max_stars_repo_name": "mattpolzin/idris-indexed", "max_stars_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "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": "tests/examples/state_t/StateTransformer.idr", "max_issues_repo_name": "mattpolzin/idris-indexed", "max_issues_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-12-05T08:05:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-15T07:26:51.000Z", "max_forks_repo_path": "tests/examples/state_t/StateTransformer.idr", "max_forks_repo_name": "mattpolzin/idris-indexed", "max_forks_repo_head_hexsha": "21e448e4da193425336ae150bc55e015c6445415", "max_forks_repo_licenses": ["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.8367346939, "max_line_length": 72, "alphanum_fraction": 0.6277732128, "num_tokens": 348, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8740772417253256, "lm_q2_score": 0.5774953651858118, "lm_q1q2_score": 0.504775555910774}}
{"text": "module TypedContainers.LawfulOrd\n\n%default total\n\npublic export\ninterface LawfulOrd a where\n  compare : a -> a -> Ordering\n  0 reflexivity : (x : a) -> (compare x x = EQ)\n  0 reversion1 : (x : a) -> (y : a) -> (compare x y = LT) -> (compare y x = GT)\n  0 reversion2 : (x : a) -> (y : a) -> (compare x y = GT) -> (compare y x = LT)\n  0 reversion3 : (x : a) -> (y : a) -> (compare x y = EQ) -> (compare y x = EQ)\n  0 transitivity : (x : a) -> (y : a) -> (z : a) -> (compare x y = LT) -> (compare y z = LT) -> (compare x z = LT)\n  0 equality1 : (x : a) -> (y : a) -> (z : a) -> (compare x y = EQ) -> (compare x z = compare y z)\n  0 equality2 : (x : a) -> (y : a) -> (z : a) -> (compare x y = EQ) -> (compare z x = compare z y)\n\npublic export\ninterface LawfulOrd a => LawfullerOrd a where\n  -- `compare` needs to be unambigious here because the name is\n  -- seemingly resolved where the instances are defined...\n  0 realEquality : (x : a) -> (y : a) -> (TypedContainers.LawfulOrd.compare x y = EQ) -> (x = y)\n\npublic export\n(==) : LawfulOrd a => a -> a -> Bool\nx == y = case compare x y of { EQ => True; _ => False }\n\npublic export\n(<) : LawfulOrd a => a -> a -> Bool\nx < y = case compare x y of { LT => True; _ => False }\n\npublic export\n(>) : LawfulOrd a => a -> a -> Bool\nx > y = case compare x y of { GT => True; _ => False }\n\npublic export\nconvLT : LawfulOrd a => (x : a) -> (y : a) -> (x < y = True) -> (compare x y = LT)\nconvLT x y p with (compare x y)\n  convLT x y Refl | GT impossible\n  convLT x y Refl | EQ impossible\n  convLT x y Refl | LT = Refl\n\npublic export\nconvGT : LawfulOrd a => (x : a) -> (y : a) -> (x > y = True) -> (compare x y = GT)\nconvGT x y p with (compare x y)\n  convGT x y Refl | GT = Refl\n  convGT x y Refl | EQ impossible\n  convGT x y Refl | LT impossible\n\npublic export\nconvEQ : LawfulOrd a => (x : a) -> (y : a) -> (x == y = True) -> (compare x y = EQ)\nconvEQ x y p with (compare x y)\n  convEQ x y Refl | GT impossible\n  convEQ x y Refl | EQ = Refl\n  convEQ x y Refl | LT impossible\n", "meta": {"hexsha": "f916bd38da1b40bd7967c88c7272423b615f025c", "size": 2010, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "TypedContainers/LawfulOrd.idr", "max_stars_repo_name": "L-as/idris-rbtree", "max_stars_repo_head_hexsha": "1c9bab3c5f54ab431c379bf54cec5b548e09f0d3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2021-08-25T15:48:22.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-10T05:31:53.000Z", "max_issues_repo_path": "TypedContainers/LawfulOrd.idr", "max_issues_repo_name": "L-as/idris-rbtree", "max_issues_repo_head_hexsha": "1c9bab3c5f54ab431c379bf54cec5b548e09f0d3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TypedContainers/LawfulOrd.idr", "max_forks_repo_name": "L-as/idris-rbtree", "max_forks_repo_head_hexsha": "1c9bab3c5f54ab431c379bf54cec5b548e09f0d3", "max_forks_repo_licenses": ["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.2222222222, "max_line_length": 114, "alphanum_fraction": 0.571641791, "num_tokens": 718, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7217432182679957, "lm_q2_score": 0.6992544147913993, "lm_q1q2_score": 0.5046821317196485}}
{"text": "module Prelude.Interfaces\n\nimport Builtin\nimport Prelude.Basics\nimport Prelude.EqOrd\nimport Prelude.Num\nimport Prelude.Ops\n\n%default total\n\n-------------\n-- ALGEBRA --\n-------------\n\n||| Sets equipped with a single binary operation that is associative.  Must\n||| satisfy the following laws:\n|||\n||| + Associativity of `<+>`:\n|||     forall a b c, a <+> (b <+> c) == (a <+> b) <+> c\npublic export\ninterface Semigroup ty where\n  constructor MkSemigroup\n  (<+>) : ty -> ty -> ty\n\n||| Sets equipped with a single binary operation that is associative, along with\n||| a neutral element for that binary operation.  Must satisfy the following\n||| laws:\n|||\n||| + Associativity of `<+>`:\n|||     forall a b c, a <+> (b <+> c) == (a <+> b) <+> c\n||| + Neutral for `<+>`:\n|||     forall a, a <+> neutral == a\n|||     forall a, neutral <+> a == a\npublic export\ninterface Semigroup ty => Monoid ty where\n  constructor MkMonoid\n  neutral : ty\n\npublic export\nSemigroup () where\n  _ <+> _ = ()\n\npublic export\nMonoid () where\n  neutral = ()\n\npublic export\nSemigroup a => Semigroup b => Semigroup (a, b) where\n  (x, y) <+> (v, w) = (x <+> v, y <+> w)\n\npublic export\nMonoid a => Monoid b => Monoid (a, b) where\n  neutral = (neutral, neutral)\n\npublic export\nSemigroup Ordering where\n  LT <+> _ = LT\n  GT <+> _ = GT\n  EQ <+> o =  o\n\npublic export\nMonoid Ordering where\n  neutral = EQ\n\npublic export\nSemigroup b => Semigroup (a -> b) where\n  (f <+> g) x = f x <+> g x\n\npublic export\nMonoid b => Monoid (a -> b) where\n  neutral _ = neutral\n\n---------------------------------------------------------\n-- FUNCTOR, BIFUNCTOR, APPLICATIVE, ALTERNATIVE, MONAD --\n---------------------------------------------------------\n\n||| Functors allow a uniform action over a parameterised type.\n||| @ f a parameterised type\npublic export\ninterface Functor f where\n  constructor MkFunctor\n  ||| Apply a function across everything of type 'a' in a parameterised type\n  ||| @ f the parameterised type\n  ||| @ func the function to apply\n  map : (func : a -> b) -> f a -> f b\n\n||| An infix alias for `map`, applying a function across everything of type 'a'\n||| in a parameterised type.\n||| @ f the parameterised type\n||| @ func the function to apply\npublic export\n(<$>) : Functor f => (func : a -> b) -> f a -> f b\n(<$>) func x = map func x\n\n||| Flipped version of `<$>`, an infix alias for `map`, applying a function across\n||| everything of type 'a' in a parameterised type.\n||| @ f the parameterised type\n||| @ func the function to apply\npublic export\n(<&>) : Functor f => f a -> (func : a -> b) -> f b\n(<&>) x func = map func x\n\n||| Run something for effects, replacing the return value with a given parameter.\npublic export\n(<$) : Functor f => b -> f a -> f b\n(<$) b = map (const b)\n\n||| Flipped version of `<$`.\npublic export\n($>) : Functor f => f a -> b -> f b\n($>) fa b = map (const b) fa\n\n||| Run something for effects, throwing away the return value.\n%inline\npublic export\nignore : Functor f => f a -> f ()\nignore = map (const ())\n\nnamespace Functor\n  ||| Composition of functors is a functor.\n  public export\n  [Compose] (Functor f, Functor g) => Functor (f . g) where\n    map = map . map\n\n||| Bifunctors\n||| @f The action of the Bifunctor on pairs of objects\npublic export\ninterface Bifunctor f where\n  constructor MkBifunctor\n  ||| The action of the Bifunctor on pairs of morphisms\n  |||\n  ||| ````idris example\n  ||| bimap (\\x => x + 1) reverse (1, \"hello\") == (2, \"olleh\")\n  ||| ````\n  |||\n  bimap : (a -> c) -> (b -> d) -> f a b -> f c d\n  bimap f g = mapFst f . mapSnd g\n\n  ||| The action of the Bifunctor on morphisms pertaining to the first object\n  |||\n  ||| ````idris example\n  ||| mapFst (\\x => x + 1) (1, \"hello\") == (2, \"hello\")\n  ||| ````\n  |||\n  mapFst : (a -> c) -> f a b -> f c b\n  mapFst f = bimap f id\n\n  ||| The action of the Bifunctor on morphisms pertaining to the second object\n  |||\n  ||| ````idris example\n  ||| mapSnd reverse (1, \"hello\") == (1, \"olleh\")\n  ||| ````\n  |||\n  mapSnd : (b -> d) -> f a b -> f a d\n  mapSnd = bimap id\n\npublic export\nmapHom : Bifunctor f => (a -> b) -> f a a -> f b b\nmapHom f = bimap f f\n\npublic export\ninterface Functor f => Applicative f where\n  constructor MkApplicative\n  pure : a -> f a\n  (<*>) : f (a -> b) -> f a -> f b\n\npublic export\n(<*) : Applicative f => f a -> f b -> f a\na <* b = map const a <*> b\n\npublic export\n(*>) : Applicative f => f a -> f b -> f b\na *> b = map (const id) a <*> b\n\n%allow_overloads pure\n%allow_overloads (<*)\n%allow_overloads (*>)\n\nnamespace Applicative\n  ||| Composition of applicative functors is an applicative functor.\n  public export\n  [Compose] (Applicative f, Applicative g) => Applicative (f . g)\n    using Functor.Compose where\n      pure = pure . pure\n      fun <*> x = [| fun <*> x |]\n\npublic export\ninterface Applicative f => Alternative f where\n  constructor MkAlternative\n  empty : f a\n  (<|>) : f a -> Lazy (f a) -> f a\n\npublic export\ninterface Applicative m => Monad m where\n  constructor MkMonad\n  ||| Also called `bind`.\n  (>>=) : m a -> (a -> m b) -> m b\n\n  ||| Also called `flatten` or mu.\n  join : m (m a) -> m a\n\n  -- default implementations\n  (>>=) x f = join (f <$> x)\n  join x = x >>= id\n\n%allow_overloads (>>=)\n\n||| Right-to-left monadic bind, flipped version of `>>=`.\npublic export\n(=<<) : Monad m => (a -> m b) -> m a -> m b\n(=<<) = flip (>>=)\n\n||| Sequencing of effectful composition\npublic export\n(>>) : Monad m => m () -> Lazy (m b) -> m b\na >> b = a >>= \\_ => b\n\n||| Left-to-right Kleisli composition of monads.\npublic export\n(>=>) : Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)\n(>=>) f g = \\x => f x >>= g\n\n||| Right-to-left Kleisli composition of monads, flipped version of `>=>`.\npublic export\n(<=<) : Monad m => (b -> m c) -> (a -> m b) -> (a -> m c)\n(<=<) = flip (>=>)\n\n||| `guard a` is `pure ()` if `a` is `True` and `empty` if `a` is `False`.\npublic export\nguard : Alternative f => Bool -> f ()\nguard x = if x then pure () else empty\n\n||| Conditionally execute an applicative expression when the boolean is true.\npublic export\nwhen : Applicative f => Bool -> Lazy (f ()) -> f ()\nwhen True f = f\nwhen False f = pure ()\n\n||| Execute an applicative expression unless the boolean is true.\n%inline public export\nunless : Applicative f => Bool -> Lazy (f ()) -> f ()\nunless = when . not\n\n---------------------------\n-- FOLDABLE, TRAVERSABLE --\n---------------------------\n\n||| The `Foldable` interface describes how you can iterate over the elements in\n||| a parameterised type and combine the elements together, using a provided\n||| function, into a single result.\n||| @ t The type of the 'Foldable' parameterised type.\npublic export\ninterface Foldable t where\n  constructor MkFoldable\n  ||| Successively combine the elements in a parameterised type using the\n  ||| provided function, starting with the element that is in the final position\n  ||| i.e. the right-most position.\n  ||| @ func  The function used to 'fold' an element into the accumulated result\n  ||| @ init  The starting value the results are being combined into\n  ||| @ input The parameterised type\n  foldr : (func : elem -> acc -> acc) -> (init : acc) -> (input : t elem) -> acc\n\n  ||| The same as `foldr` but begins the folding from the element at the initial\n  ||| position in the data structure i.e. the left-most position.\n  ||| @ func  The function used to 'fold' an element into the accumulated result\n  ||| @ init  The starting value the results are being combined into\n  ||| @ input The parameterised type\n  foldl : (func : acc -> elem -> acc) -> (init : acc) -> (input : t elem) -> acc\n  foldl f z t = foldr (flip (.) . flip f) id t z\n\n  ||| Test whether the structure is empty.\n  ||| @ acc The accumulator value which is specified to be lazy\n  null : t elem -> Lazy Bool\n  null = foldr {acc = Lazy Bool} (\\ _,_ => False) True\n\n  ||| Similar to `foldl`, but uses a function wrapping its result in a `Monad`.\n  ||| Consequently, the final value is wrapped in the same `Monad`.\n  foldlM : Monad m => (funcM : acc -> elem -> m acc) -> (init : acc) -> (input : t elem) -> m acc\n  foldlM fm a0 = foldl (\\ma, b => ma >>= flip fm b) (pure a0)\n\n  ||| Produce a list of the elements contained in the parametrised type.\n  toList : t elem -> List elem\n  toList = foldr (::) []\n\n  ||| Maps each element to a value and combine them.\n  ||| For performance reasons, this should wherever\n  ||| be implemented with tail recursion.\n  ||| @ f The function to apply to each element.\n  foldMap : Monoid m => (f : a -> m) -> t a -> m\n  foldMap f = foldr ((<+>) . f) neutral\n\n||| Combine each element of a structure into a monoid.\npublic export\nconcat : (Foldable t, Monoid a) => t a -> a\nconcat = foldMap id\n\n||| Combine into a monoid the collective results of applying a function to each\n||| element of a structure.\npublic export\nconcatMap : (Foldable t, Monoid m) => (a -> m) -> t a -> m\nconcatMap = foldMap\n\nnamespace Bool.Lazy\n  namespace Semigroup\n    public export\n    [Any] Semigroup (Lazy Bool) where\n      x <+> y = force x || y\n\n    public export\n    [All] Semigroup (Lazy Bool) where\n      x <+> y = force x && y\n\n  namespace Monoid\n    public export\n    [Any] Monoid (Lazy Bool) using Semigroup.Any where\n      neutral = delay False\n\n    public export\n    [All] Monoid (Lazy Bool) using Semigroup.All where\n      neutral = delay True\n\n||| The conjunction of all elements of a structure containing lazy boolean\n||| values.  `and` short-circuits from left to right, evaluating until either an\n||| element is `False` or no elements remain.\npublic export\nand : Foldable t => t (Lazy Bool) -> Bool\nand = force . concat @{(%search, All)}\n\n||| The disjunction of all elements of a structure containing lazy boolean\n||| values.  `or` short-circuits from left to right, evaluating either until an\n||| element is `True` or no elements remain.\npublic export\nor : Foldable t => t (Lazy Bool) -> Bool\nor = force . concat @{(%search, Any)}\n\nnamespace Bool\n  namespace Semigroup\n    public export\n    [Any] Semigroup Bool where\n      x <+> y = x || delay y\n\n    public export\n    [All] Semigroup Bool where\n      x <+> y = x && delay y\n\n  namespace Monoid\n    public export\n    [Any] Monoid Bool using Bool.Semigroup.Any where\n      neutral = False\n\n    public export\n    [All] Monoid Bool using Bool.Semigroup.All where\n      neutral = True\n\n||| The disjunction of the collective results of applying a predicate to all\n||| elements of a structure.  `any` short-circuits from left to right.\npublic export\nany : Foldable t => (a -> Bool) -> t a -> Bool\nany = foldMap @{%search} @{Any}\n\n||| The disjunction of the collective results of applying a predicate to all\n||| elements of a structure.  `all` short-circuits from left to right.\npublic export\nall : Foldable t => (a -> Bool) -> t a -> Bool\nall = foldMap @{%search} @{All}\n  where\n    monoid : Monoid Bool\n    monoid = MkMonoid @{MkSemigroup (\\x, y => x && y)} True\n\nnamespace Num\n  namespace Semigroup\n    public export\n    [Additive] Num a => Semigroup a where\n      (<+>) = (+)\n\n    public export\n    [Multiplicative] Num a => Semigroup a where\n      (<+>) = (*)\n\n  namespace Monoid\n    public export\n    [Additive] Num a => Monoid a using Semigroup.Additive where\n      neutral = 0\n\n    public export\n    [Multiplicative] Num a => Monoid a using Semigroup.Multiplicative where\n      neutral = 1\n\n||| Add together all the elements of a structure.\npublic export\nsum : (Foldable t, Num a) => t a -> a\nsum = concat @{(%search, Additive)}\n\n||| Add together all the elements of a structure.\n||| Same as `sum` but tail recursive.\nexport\nsum' : (Foldable t, Num a) => t a -> a\nsum' = sum\n\n||| Multiply together all elements of a structure.\npublic export\nproduct : (Foldable t, Num a) => t a -> a\nproduct = concat @{(%search, Multiplicative)}\n\n||| Multiply together all elements of a structure.\n||| Same as `product` but tail recursive.\nexport\nproduct' : (Foldable t, Num a) => t a -> a\nproduct' = product\n\n||| Map each element of a structure to a computation, evaluate those\n||| computations and discard the results.\npublic export\ntraverse_ : (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()\ntraverse_ f = foldr ((*>) . f) (pure ())\n\n||| Evaluate each computation in a structure and discard the results.\npublic export\nsequence_ : (Foldable t, Applicative f) => t (f a) -> f ()\nsequence_ = foldr (*>) (pure ())\n\n||| Like `traverse_` but with the arguments flipped.\npublic export\nfor_ : (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()\nfor_ = flip traverse_\n\nnamespace Lazy\n  public export\n  [SemigroupAlternative] Alternative f => Semigroup (Lazy (f a)) where\n    x <+> y = force x <|> y\n\n  public export\n  [MonoidAlternative] Alternative f => Monoid (Lazy (f a)) using Lazy.SemigroupAlternative where\n    neutral = delay empty\n\npublic export\n[SemigroupAlternative] Alternative f => Semigroup (f a) where\n  x <+> y = x <|> delay y\n\npublic export\n[MonoidAlternative] Alternative f => Monoid (f a) using Interfaces.SemigroupAlternative where\n  neutral = empty\n\n||| Fold using Alternative.\n|||\n||| If you have a left-biased alternative operator `<|>`, then `choice` performs\n||| left-biased choice from a list of alternatives, which means that it\n||| evaluates to the left-most non-`empty` alternative.\n|||\n||| If the list is empty, or all values in it are `empty`, then it evaluates to\n||| `empty`.\n|||\n||| Example:\n|||\n||| ```\n||| -- given a parser expression like:\n||| expr = literal <|> keyword <|> funcall\n|||\n||| -- choice lets you write this as:\n||| expr = choice [literal, keyword, funcall]\n||| ```\n|||\n||| Note: In Haskell, `choice` is called `asum`.\npublic export\nchoice : (Foldable t, Alternative f) => t (Lazy (f a)) -> f a\nchoice = force . concat @{(%search, Lazy.MonoidAlternative)}\n\n||| A fused version of `choice` and `map`.\npublic export\nchoiceMap : (Foldable t, Alternative f) => (a -> f b) -> t a -> f b\nchoiceMap = foldMap @{%search} @{MonoidAlternative}\n\nnamespace Foldable\n  ||| Composition of foldables is foldable.\n  public export\n  [Compose] (Foldable t, Foldable f) => Foldable (t . f) where\n    foldr = foldr . flip . foldr\n    foldl = foldl . foldl\n    null tf = null tf || all (force . null) tf\n    foldMap = foldMap . foldMap\n\n||| `Bifoldable` identifies foldable structures with two different varieties\n||| of elements (as opposed to `Foldable`, which has one variety of element).\n||| Common examples are `Either` and `Pair`.\npublic export\ninterface Bifoldable p where\n  constructor MkBifoldable\n  bifoldr : (a -> acc -> acc) -> (b -> acc -> acc) -> acc -> p a b -> acc\n\n  bifoldl : (acc -> a -> acc) -> (acc -> b -> acc) -> acc -> p a b -> acc\n  bifoldl f g z t = bifoldr (flip (.) . flip f) (flip (.) . flip g) id t z\n\n  binull : p a b -> Lazy Bool\n  binull = bifoldr {acc = Lazy Bool} (\\ _,_ => False) (\\ _,_ => False) True\n\npublic export\ninterface (Functor t, Foldable t) => Traversable t where\n  constructor MkTraversable\n  ||| Map each element of a structure to a computation, evaluate those\n  ||| computations and combine the results.\n  traverse : Applicative f => (a -> f b) -> t a -> f (t b)\n\n||| Evaluate each computation in a structure and collect the results.\npublic export\nsequence : (Traversable t, Applicative f) => t (f a) -> f (t a)\nsequence = traverse id\n\n||| Like `traverse` but with the arguments flipped.\npublic export\nfor : (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)\nfor = flip traverse\n\npublic export\ninterface (Bifunctor p, Bifoldable p) => Bitraversable p where\n  constructor MkBitraversable\n  ||| Map each element of a structure to a computation, evaluate those\n  ||| computations and combine the results.\n  bitraverse : Applicative f => (a -> f c) -> (b -> f d) -> p a b -> f (p c d)\n\n||| Evaluate each computation in a structure and collect the results.\npublic export\nbisequence : (Bitraversable p, Applicative f) => p (f a) (f b) -> f (p a b)\nbisequence = bitraverse id id\n\n||| Like `bitraverse` but with the arguments flipped.\npublic export\nbifor :  (Bitraversable p, Applicative f)\n      => p a b\n      -> (a -> f c)\n      -> (b -> f d)\n      -> f (p c d)\nbifor t f g = bitraverse f g t\n\nnamespace Traversable\n  ||| Composition of traversables is traversable.\n  public export\n  [Compose] (Traversable t, Traversable f) => Traversable (t . f)\n    using Foldable.Compose Functor.Compose where\n      traverse = traverse . traverse\n\nnamespace Monad\n  ||| Composition of a traversable monad and a monad is a monad.\n  public export\n  [Compose] (Monad m, Monad t, Traversable t) => Monad (m . t)\n    using Applicative.Compose where\n      a >>= f = a >>= map join . traverse f\n", "meta": {"hexsha": "eddb1e42aaac17507e75fc6dcb434d94ed670bff", "size": 16560, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/prelude/Prelude/Interfaces.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/prelude/Prelude/Interfaces.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/prelude/Prelude/Interfaces.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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.2742230347, "max_line_length": 97, "alphanum_fraction": 0.6323067633, "num_tokens": 4862, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.766293653760418, "lm_q2_score": 0.6584174938590246, "lm_q1q2_score": 0.5045411470690095}}
{"text": "||| The content of this module is based on the paper\n||| Applications of Applicative Proof Search\n||| by Liam O'Connor\n\nmodule Search.HDecidable\n\nimport Data.List.Lazy\nimport Data.List.Lazy.Quantifiers\nimport Data.List.Quantifiers\nimport Data.So\n\nimport Search.Negation\n\n%default total\n\n------------------------------------------------------------------------\n-- Type, basic functions, and interface\n\n||| Half a decider: when the search succeeds we bother building the proof\npublic export\nrecord HDec (a : Type) where\n  constructor MkHDec\n  isTrue   : Bool\n  evidence : So isTrue -> a\n\n||| Happy path: we have found a proof!\npublic export\nyes : a -> HDec a\nyes = MkHDec True . const\n\n||| Giving up\npublic export\nno : HDec a\nno = MkHDec False absurd\n\npublic export\nfromDec : Dec a -> HDec a\nfromDec (Yes p) = yes p\nfromDec (No _) = no\n\npublic export\nfromMaybe : Maybe a -> HDec a\nfromMaybe = maybe no yes\n\npublic export\ntoMaybe : HDec a -> Maybe a\ntoMaybe (MkHDec True p) = Just (p Oh)\ntoMaybe (MkHDec False _) = Nothing\n\n||| A type constructor satisfying AnHdec is morally an HDec i.e. we can\n||| turn values of this type constructor into half deciders\n||| It may be more powerful (like Dec) or more basic (like Maybe).\n\npublic export\ninterface AnHDec (0 t : Type -> Type) where\n  toHDec : t a -> HDec a\n\npublic export AnHDec Dec where toHDec = fromDec\npublic export AnHDec HDec where toHDec = id\npublic export AnHDec Maybe where toHDec = fromMaybe\n\n------------------------------------------------------------------------\n-- Implementations\n\npublic export\nFunctor HDec where\n  map f (MkHDec b prf) = MkHDec b (f . prf)\n\npublic export\nApplicative HDec where\n  pure = yes\n  MkHDec False prff <*> _ = MkHDec False absurd\n  _ <*> MkHDec False _ = MkHDec False absurd\n  MkHDec True prff <*> MkHDec True prfx\n    = yes (prff Oh (prfx Oh))\n\n||| Lazy in the second argument\npublic export\nAlternative HDec where\n  empty = no\n  p@(MkHDec True _) <|> _ = p\n  _ <|> q = q\n\npublic export\nMonad HDec where\n  MkHDec True x >>= f = f (x Oh)\n  _ >>= _ = no\n\npublic export\nShow f => Show (HDec f) where\n  show (MkHDec True p) = \"True: \" ++ show (p Oh)\n  show _ = \"False\"\n\n------------------------------------------------------------------------\n-- Combinators\n\n||| Half deciders are closed under product\npublic export\n(&&) : (AnHDec l, AnHDec r) => l a -> r b -> HDec (a, b)\np && q = [| (toHDec p, toHDec q) |]\n\n||| Half deciders are closed under sum\npublic export\n(||) : (AnHDec l, AnHDec r) => l a -> r b -> HDec (Either a b)\np || q = [| Left (toHDec p) |] <|> [| Right (toHDec q) |]\n\n\n||| Half deciders are closed negation. Here we use the `Negates` interface\n||| so that we end up looking for *positive* evidence of something which is\n||| much easier to find than negative one.\npublic export\nnot : (AnHDec l, Negates na a) => l na -> HDec (Not a)\nnot p = [| toNegation (toHDec p) |]\n\n\ninfixr 3 ==>\n\n||| Half deciders are closed under implication\npublic export\n(==>) : (AnHDec l, AnHDec r, Negates na a) => l na -> r b -> HDec (a -> b)\np ==> q = [| contra (not p) |] <|> [| const (toHDec q) |] where\n  contra : Not a -> a -> b\n  contra na a = void (na a)\n\n\nnamespace List\n\n  ||| Half deciders are closed under the list quantifier any\n  public export\n  any : AnHDec l => (xs : List a) -> ((x : a) -> l (p x)) -> HDec (Any p xs)\n  any [] p = no\n  any (x :: xs) p = [| Here (toHDec (p x)) |] <|> [| There (any xs p) |]\n\n  ||| Half deciders are closed under the list quantifier all\n  public export\n  all : AnHDec l => (xs : List a) -> ((x : a) -> l (p x)) -> HDec (All p xs)\n  all [] p = yes []\n  all (x :: xs) p = [| toHDec (p x) :: all xs p |]\n\nnamespace LazyList\n\n  ||| Half deciders are closed under the lazy list quantifier any\n  public export\n  any : AnHDec l => (xs : LazyList a) -> ((x : a) -> l (p x)) -> HDec (Any p xs)\n  any [] p = no\n  any (x :: xs) p = [| Here (toHDec (p x)) |] <|> [| There (any xs p) |]\n", "meta": {"hexsha": "a9d15b1b10868f0472b252eec6760d7217080182", "size": 3901, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/contrib/Search/HDecidable.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "libs/contrib/Search/HDecidable.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "libs/contrib/Search/HDecidable.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 26.537414966, "max_line_length": 80, "alphanum_fraction": 0.60702384, "num_tokens": 1224, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6959583250334526, "lm_q2_score": 0.7248702702332475, "lm_q1q2_score": 0.504479499138077}}
{"text": "module Main\n\nimport Data.Vect\n\n-- let .. in defines local variables\n-- where .. allows for local function definitions\n\n-- Nat is a natural number type, non-negative integers.\n-- ++ is for appending Strings or Lists to each other.\n-- words : String -> List String -- splits on a space\naverage : (str : String) -> Double\naverage str =\n  let\n    numWords = wordCount str\n    totalLength = sum (allLengths (words str)) in\n    cast totalLength / cast numWords -- this line is the result.\n  where\n    wordCount : String -> Nat\n    wordCount str = length (words str)\n\n    allLengths : List String -> List Nat\n    allLengths strs = map length strs\n\nshowAverage : String -> String\nshowAverage str =\n  \"Average word lenth: \" ++\n  show (average str) ++ \"\\n\"\n\nmain : IO ()\nmain = repl \"Enter a string: \" showAverage\n-- repl displays a prompt, reads a String from the console and displays the\n-- result of running a function on that String, forever.\n\n-- Where an expression can be one of several types, you can declare which\n-- inline with the function 'the'\n-- the Int 45 yields an Int with the value 45. This is not syntax sugar, 'the'\n-- is an ordinary function.\n-- the : (a: Type) -> a -> a\n-- Given a type, a, and a value of that type, 'the' returns the value. The\n-- implementation might look like the type = id -- identity\n\n-- Can partially apply functions\nadd : Num a => a -> a -> a\nadd x y = x + y\n--\nadd3 : Int -> Int\nadd3 = add 3\n\nnine : Int\nnine = add3 6\n\n-- <T> T identity(T t) { return t; }\nidentity : ty -> ty\nidentity x = x\n\n-- If we want to write a function that can add a number to itself, this won't\n-- work:\n-- bad_double : ty -> ty\n-- bad_double x = x + x\n-- \"ty is not a numeric type\"\n-- => means we're setting a restriction on a\ndouble : Num ty => ty -> ty\ndouble x = x + x\n\n-- Defining a function that executes a function twice over a value\ntwice : (a -> a) -> a -> a\ntwice f x = f (f x)\n\nquadruple : Num a => a -> a\nquadruple x = double (double x)\n\n-- lambda is \\arg => result\nsquared_twice : Integer\nsquared_twice = twice (\\x => x * x) 2 -- 16\n\n-- :t \\x => x * x -- Integer -> Integer\n\n-- :t \\x : Int, y : Int => x + y -- Int -> Int\n\n-- Tuples are nested pairs\ntuples_are_nested_pairs : Bool\ntuples_are_nested_pairs = (1, (2, (3, (4)))) == (1, 2, 3, 4)\n\n-- Lists use []. Appending two lists:\none_to_seven : List Integer\none_to_seven = [1, 2, 3] ++ [4, 5, 6, 7]\n\n-- Prepending (consing) to a list is (::)\nzero_to_seven : List Integer\nzero_to_seven = 0 :: one_to_seven\n\none_to_four : List Integer\none_to_four = 1 :: 2 :: 3 :: 4 :: []\n\none_to_a_hundred : List Integer\none_to_a_hundred = [1..100]\n\n-- module Xyz at the top of the file, generally matches Xyz.idr in the filename\n-- import Foo looks for Foo.idr in the same directory or elsewhere that Idris\n-- can find.\n\n{- Multiline\ncomment -}\n\n||| Documentation comment for foo\nfoo : String\n-- can be viewed with :doc foo or Ctrl-Alt-D in Atom\n\n-- Exercises\n-- 1. Types of\n-- (\"A\", \"B\", \"C\") -- (String, String, String)\n-- [\"A\", \"B\", \"C\"] -- List String\n-- ((\"A\", \"B\"), \"C\") -- ((String, String), String)\n\n-- Given a natural number, min, and a String, str, convert str to lowercase and\n-- return true if it's the same forwards as backwards, as long as it's over the\n-- length 'min'.\npalindrome : Nat -> String -> Bool\npalindrome min str = if (length str > min) then\n    (let lstr = toLower str in reverse lstr == lstr)\n  else False\n\n-- (x, y) is a tuple of an x and a y. (Nat, Nat) is a type, two natural numbers.\n-- (length (words str), length str) is a value of that type.\ncounts : String -> (Nat, Nat)\ncounts str = (length (words str), length str)\n\n-- Ord is an interface something like Java's Comparable.\n-- <A extends Comparable<A>> List<A> topTen(List<A> list)\ntop_ten : Ord a => List a -> List a\ntop_ten list = take 10 (reverse (sort list))\n\nover_length : Nat -> List String -> Nat\nover_length len list = length (filter (\\str => length str > len) list)\n", "meta": {"hexsha": "4ea6424c7ed08f451c6346ddfe3b7e8ce0f8aa3e", "size": 3920, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tdd/Chapter2.idr", "max_stars_repo_name": "rickyclarkson/idris-playground", "max_stars_repo_head_hexsha": "3bd9b5fd76df4b2a6c0cf40fa537624e7b692e21", "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": "tdd/Chapter2.idr", "max_issues_repo_name": "rickyclarkson/idris-playground", "max_issues_repo_head_hexsha": "3bd9b5fd76df4b2a6c0cf40fa537624e7b692e21", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tdd/Chapter2.idr", "max_forks_repo_name": "rickyclarkson/idris-playground", "max_forks_repo_head_hexsha": "3bd9b5fd76df4b2a6c0cf40fa537624e7b692e21", "max_forks_repo_licenses": ["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.037037037, "max_line_length": 80, "alphanum_fraction": 0.6558673469, "num_tokens": 1154, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6959583124210897, "lm_q2_score": 0.724870282120402, "lm_q1q2_score": 0.5044794982687142}}
{"text": "module Libraries.Data.List.Extra\n\nimport public Data.List\nimport Data.List1\n\n%default total\n\nexport\nminimum : Ord a => (xs : List a) -> {auto 0 _ : NonEmpty xs} -> a\nminimum (x :: xs) = foldl min x xs\n\n||| Fetches the element at a given position.\n||| Returns `Nothing` if the position beyond the list's end.\npublic export\nelemAt : List a -> Nat -> Maybe a\nelemAt []        _     = Nothing\nelemAt (l :: _)  Z     = Just l\nelemAt (_ :: ls) (S n) = elemAt ls n\n\nexport\nfindBy : (a -> Maybe b) -> List a -> Maybe b\nfindBy p [] = Nothing\nfindBy p (x :: xs)\n  = case p x of\n      Nothing => findBy p xs\n      Just win => pure win\n\nexport\nbreakAfter : (a -> Bool) -> List a -> (List a, List a)\nbreakAfter p [] = ([], [])\nbreakAfter p (x::xs)\n    = if p x\n         then ([x], xs)\n         else let (ys, zs) = breakAfter p xs in (x::ys, zs)\n\nexport\nsplitAfter : (a -> Bool) -> List a -> List1 (List a)\nsplitAfter p xs\n    = case breakAfter p xs of\n           (chunk, []) => singleton chunk\n           (chunk, rest@(_::_)) => cons chunk (splitAfter p (assert_smaller xs rest))\n\nexport\nzipMaybe : List a -> List b -> Maybe (List (a, b))\nzipMaybe [] [] = pure []\nzipMaybe (a::as) (b::bs) = ((a, b) ::) <$> zipMaybe as bs\nzipMaybe _ _ = Nothing\n\nexport\nfindBy' : (a -> Bool) -> List a -> (List a, Maybe a, List a)\nfindBy' f [] = ([], Nothing, [])\nfindBy' f (x :: xs) =\n  case f x of\n    True  => ([], Just x, xs)\n    False =>\n      let (pre, mb, post) = findBy' f xs in\n      (x :: pre, mb, post)\n\n||| Compute the difference of two lists by the given predicate.\n||| Lists are treated as bags.\nexport\ndiffBy : (a -> a -> Bool)\n      -> List a\n      -> List a\n      -> List a\ndiffBy f [] ys = []\ndiffBy f (x :: xs) ys =\n  let whole@(pre, mb, post) = findBy' (f x) ys\n      ys' = pre ++ post in\n  case mb of\n    Just _  =>      diffBy f xs ys'\n    Nothing => x :: diffBy f xs ys'\n\n||| Remove adjacent duplicates\nexport\ndedup : Eq a => List a -> List a\ndedup (a :: xs@(b :: _)) = if a == b then dedup xs else a :: dedup xs\ndedup xs                = xs\n\n||| O(n * log(n)). Sort a list and remove duplicates\nexport\nsortedNub : Ord a => List a -> List a\nsortedNub = dedup . sort\n\n||| TODO: use the version in `Data.List1` in base after the next release.\nexport\ngroupBy : (a -> a -> Bool) -> List a -> List (List1 a)\ngroupBy _ [] = []\ngroupBy eq (h :: t) = let (ys,zs) = go h t\n                       in ys :: zs\n\n  where go : a -> List a -> (List1 a, List (List1 a))\n        go v [] = (singleton v,[])\n        go v (x :: xs) = let (ys,zs) = go x xs\n                          in if eq v x\n                                then (cons v ys, zs)\n                                else (singleton v, ys :: zs)\n\n||| TODO: use the version in `Data.List1` in base after the next release.\nexport\ngroup : Eq a => List a -> List (List1 a)\ngroup = Libraries.Data.List.Extra.groupBy (==)\n\n||| TODO: use the version in `Data.List1` in base after the next release.\nexport\ngroupWith : Eq b => (a -> b) -> List a -> List (List1 a)\ngroupWith f = Libraries.Data.List.Extra.groupBy (\\x,y => f x == f y)\n\n||| TODO: use the version in `Data.List1` in base after the next release.\nexport\ngroupAllWith : Ord b => (a -> b) -> List a -> List (List1 a)\ngroupAllWith f = Libraries.Data.List.Extra.groupWith f . sortBy (comparing f)\n", "meta": {"hexsha": "135cbbef61201905a0469b1d576f66354108d8da", "size": 3281, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/src/Libraries/Data/List/Extra.idr", "max_stars_repo_name": "chrrasmussen/Idris2-Erlang", "max_stars_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/src/Libraries/Data/List/Extra.idr", "max_issues_repo_name": "chrrasmussen/Idris2-Erlang", "max_issues_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/src/Libraries/Data/List/Extra.idr", "max_forks_repo_name": "chrrasmussen/Idris2-Erlang", "max_forks_repo_head_hexsha": "dfa38cd866fd683d4bdda49fc0bf2f860de273b4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 29.0353982301, "max_line_length": 85, "alphanum_fraction": 0.561414203, "num_tokens": 1012, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6959583250334526, "lm_q2_score": 0.7248702642896702, "lm_q1q2_score": 0.504479495001595}}
{"text": "\nimport Data.Vect\n\n\nvtake : (n : Nat) -> Vect (n+m) a -> Vect n a \nvtake Z xs = []\nvtake (S k) (x :: xs) = x :: vtake k xs\n\n\nnumbers : Vect 3 Int\nnumbers = [1,2,3]\n\nmain : IO ()\nmain = printLn ( vtake 3 numbers ) \n", "meta": {"hexsha": "a0436fcaee059c89fe231047a950dd1d15987f2d", "size": 214, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "vtake_solution.idr", "max_stars_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_stars_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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": "vtake_solution.idr", "max_issues_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_issues_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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": "vtake_solution.idr", "max_forks_repo_name": "janschultecom/2019-02-21-coding-for-students", "max_forks_repo_head_hexsha": "3e19cb95afa939ef0803ae2a41150ea83edd9d52", "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": 14.2666666667, "max_line_length": 46, "alphanum_fraction": 0.5514018692, "num_tokens": 83, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8006920020959544, "lm_q2_score": 0.6297745935070806, "lm_q1q2_score": 0.5042554801443502}}
{"text": "hours : List Nat\nhours = [1..12]\n\nnats : Stream Nat\nnats = [0,1..]\n", "meta": {"hexsha": "869a0c471e7e63b10e60ccc57cf88f08ff00eb54", "size": 67, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/ideMode/ideMode005/Ranges.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/ideMode/ideMode005/Ranges.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/ideMode/ideMode005/Ranges.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 11.1666666667, "max_line_length": 17, "alphanum_fraction": 0.5820895522, "num_tokens": 27, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.6926419831347361, "lm_q2_score": 0.7279754548076477, "lm_q1q2_score": 0.5042263626913805}}
{"text": "module Main\n\nimport Data.So\n\ntotal\nlem1 : So x -> So (not x) -> Void\nlem1 Oh Oh impossible\n\nfoo : Nat -> Int\nfoo z = 94\n  where\n    lem2 : So x -> So (not x) -> Void\n    lem2 Oh Oh impossible\n", "meta": {"hexsha": "33a200e6b17d3e349bcc4ad5dd0a11c7f32b1633", "size": 192, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/reg027/pwhere.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/reg027/pwhere.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/reg027/pwhere.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 13.7142857143, "max_line_length": 37, "alphanum_fraction": 0.609375, "num_tokens": 66, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7826624789529375, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5042108188463422}}
{"text": "-- --------------------------------------------------------------- [ PList.idr ]\n-- Module    : PList.idr\n-- Copyright : (c) 2015,2016 See CONTRIBUTORS.md\n-- License   : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\n||| A `list` construct to create lists with with values that satisfy\n||| some predicate..\n|||\n||| The list quantifier `All` in idris is an external proof for a list\n||| with type `List a`.  `PList` is a proof-carrying data structure\n||| that only allows for lists to be constructed if they satisfy the\n||| predicate.\nmodule Data.PList\n\nimport public Data.List\nimport public Data.DList\n\n%access export\n%default total\n\npublic export\ndata PList : (aTy    : Type)\n          -> (elemTy : aTy -> Type)\n          -> (predTy : aTy -> Type)\n          -> (as     : List aTy)\n          -> (prf    : DList aTy predTy as)\n          -> Type\n  where\n    ||| Create an empty List\n    Nil  : PList aTy elemTy predTy Nil Nil\n\n    ||| Cons\n    |||\n    ||| @elem The element to add and proof that the element's type satisfies a certain predicate.\n    ||| @rest The list for `elem` to be added to.\n    (::) : (elem : elemTy x)\n        -> {prf : predTy x}\n        -> (rest : PList aTy elemTy predTy xs prfs)\n        -> PList aTy elemTy predTy (x :: xs) (prf :: prfs)\n\n(++) : PList aTy eTy pTy as pAs\n    -> PList aTy eTy pTy bs pBs\n    -> PList aTy eTy pTy (as ++ bs) (pAs ++ pBs)\n(++) [] ys = ys\n(++) (elem :: rest) ys = elem :: rest ++ ys\n\nempty : PList aTy eTy pTy Nil Nil\nempty = Nil\n\nadd  : (elem : elemTy x)\n    -> {auto prf : predTy x}\n    -> (rest : PList aTy elemTy predTy xs prfs)\n    -> PList aTy elemTy predTy (x :: xs) (prf :: prfs)\nadd x {prf} rest = x :: rest\n\n-- -------------------------------------------------------------- [ Form Tests ]\nisNil : PList aTy eTy p as prfs -> Bool\nisNil [] = True\nisNil (elem :: rest) = False\n\nisCons : PList aTy eTy p as prfs -> Bool\nisCons l = isNil l == False\n\n-- ------------------------------------------------------------------ [ Length ]\n\nlength : PList aTy eTy p as prfs -> Nat\nlength Nil     = Z\nlength (x::xs) = (S Z) + length xs\n\nSized (PList aTy eTy pTy as prfs) where\n  size = length\n\neqPList : ({a,b : aTy} -> elemTy a -> elemTy b -> Bool)\n       -> PList aTy elemTy predTy as aPrfs\n       -> PList aTy elemTy predTy bs bPrfs\n       -> Bool\neqPList _ Nil     Nil     = True\neqPList p (x::xs) (y::ys) =\n  if p x y\n    then eqPList p xs ys\n    else False\neqPList _ _       _       = False\n\n\n-- ---------------------------------------------- [ List-Based Transformations ]\n\ntoDList : PList aTy eTy p as prfs -> DList aTy eTy as\ntoDList Nil     = Nil\ntoDList (elem::xs) = elem :: toDList xs\n\ntoList : PList aTy eTy pTy as prfs -> List (a : aTy ** prf : pTy a ** eTy a)\ntoList [] = []\ntoList ((::) elem {x} {prf} rest) = (x ** prf ** elem) :: toList rest\n\nfromDList : (xs   : DList aTy eTy as)\n         -> (prfs : DList aTy pTy as)\n         -> PList aTy eTy pTy as prfs\nfromDList [] [] = []\nfromDList (elem :: rest) (prf :: prfs) = elem :: fromDList rest prfs\n\nfromList : (prf : predTy a)\n        -> (xs  : List $ elemTy a)\n        -> PList aTy elemTy predTy (replicate (length xs) a)\n                                   (replicate (length xs) prf)\nfromList prf [] = []\nfromList prf (x :: xs) = x :: fromList prf xs\n\n-- ---------------------------------------------------------------- [ Indexing ]\n\npublic export\ndata NonEmpty : (xs : PList aTy eTy pTy as prfs) -> Type where\n  IsNonEmpty : PList.NonEmpty (x::rest)\n\nUninhabited (PList.NonEmpty []) where\n  uninhabited IsNonEmpty impossible\n\nnonEmpty : (xs : PList aTy eTy pTy as prfs) -> Dec (NonEmpty xs)\nnonEmpty [] = No absurd\nnonEmpty (elem :: rest) = Yes IsNonEmpty\n\npublic export\ndata InBounds : (idx : Nat)\n             -> (xs : PList aTy eTy pTy as prfs)\n             -> Type\n  where\n    InFirst : PList.InBounds Z (x::rest)\n    InLater : (later : PList.InBounds idx rest)\n           -> PList.InBounds (S idx) (x::rest)\n\nUninhabited (PList.InBounds idx []) where\n  uninhabited InFirst impossible\n  uninhabited (InLater _) impossible\n\ninBounds : (idx : Nat)\n        -> (xs  : PList aTy eTy pTy as prfs)\n        -> Dec (InBounds idx xs)\ninBounds idx Nil = No uninhabited\ninBounds Z (elem :: rest) = Yes InFirst\ninBounds (S k) (elem :: rest) with (inBounds k rest)\n  inBounds (S k) (elem :: rest) | (Yes prf) = Yes $ InLater prf\n  inBounds (S k) (elem :: rest) | (No contra) =\n      No (\\p => case p of\n                   InLater y => contra y)\n\nindex : (idx : Nat)\n     -> (xs : PList aTy eTy pTy as prfs)\n     -> {auto ok   : InBounds idx xs}\n     -> {auto ok'  : InBounds idx as}\n     -> {auto ok'' : InBounds idx prfs}\n     -> eTy (index idx as)\nindex Z (y :: rest) {ok = InFirst} = y\nindex (S k) (y :: rest) {ok = (InLater later)} {ok' = (InLater later')} {ok'' = (InLater later'')} = PList.index k rest\n\nhead : (xs : PList aTy eTy pTy (a::as) prfs)\n    -> {auto ok   : NonEmpty xs}\n    -> {auto ok'  : NonEmpty (a::as)}\n    -> {auto ok'' : NonEmpty prfs}\n    -> eTy a\nhead (elem :: rest) = elem\n\ntail : (xs : PList aTy eTy pTy (a::as) (p::prfs))\n    -> {auto ok   : NonEmpty xs}\n    -> {auto ok'  : NonEmpty (a::as)}\n    -> {auto ok'' : NonEmpty (p::prfs)}\n    -> PList aTy eTy pTy as prfs\ntail (elem :: rest) = rest\n\nlast : (xs : PList aTy eTy pTy as prfs)\n    -> {auto ok   : NonEmpty xs}\n    -> {auto ok'  : NonEmpty as}\n    -> {auto ok'' : NonEmpty prfs}\n    -> eTy (last as)\nlast [] {ok = IsNonEmpty} impossible\nlast (elem :: []) {ok = ok} {ok' = ok'} {ok'' = ok''} = elem\nlast (elem :: ((::) {prf} y rest)) {ok = ok} {ok' = ok'} {ok'' = ok''} = last $ (::) y rest {prf=prf}\n\ninit : (xs : PList aTy eTy pTy as prfs)\n    -> {auto ok   : NonEmpty xs}\n    -> {auto ok'  : NonEmpty as}\n    -> {auto ok'' : NonEmpty prfs}\n    -> PList aTy eTy pTy (init as) (init {ok=ok''} prfs)\ninit (y :: []) {ok = IsNonEmpty} {ok' = IsNonEmpty} {ok'' = IsNonEmpty} = []\ninit (y :: ((::) {prf} elem rest)) {ok = IsNonEmpty} {ok' = IsNonEmpty} {ok'' = IsNonEmpty} = y :: init (elem :: rest)\n\npublic export\ndata Elem : (aTy    : Type)\n         -> (elemTy : aTy -> Type)\n         -> (predTy : aTy -> Type)\n         -> (a : aTy)\n         -> (x : elemTy a)\n         -> (prf : predTy a)\n         -> (xs   : PList aTy elemTy predTy as prfs)\n         -> (prfA : Elem a as)\n         -> (prfP : DElem aTy predTy prf prfs prfA)\n         -> Type\n  where\n    Hier  : PList.Elem aTy eTy pTy a x p (x::xs) Here Hier\n    Er    : (rest : PList.Elem aTy eTy pTy a x p xs prfA prfP)\n         -> PList.Elem aTy eTy pTy a x p (x'::xs) (There prfA) (DList.Er prfP)\n\nUninhabited (PList.Elem aTy eTy pTy a x prf Nil prfA prfP) where\n  uninhabited Hier impossible\n  uninhabited (Er _) impossible\n\ndropElem : (as   : PList iTy elemTy predTy is prfs)\n        -> (idxP : Elem iTy elemTy predTy i e prf as prfA prfP)\n        -> PList iTy elemTy predTy (dropElem is prfA) (dropElem prfs prfP)\ndropElem (e :: x) Hier = x\ndropElem (x :: z) (Er rest) = x :: dropElem z rest\n\ndelete' : (x  : elemTy i)\n       -> (xs : PList iTy elemTy predTy is prfs)\n       -> (idxVal : Elem i is)\n       -> (idxPrf : DElem iTy predTy prf prfs idxVal)\n       -> PList iTy elemTy predTy (dropElem is idxVal) (dropElem prfs idxPrf)\ndelete' x (elem :: rest) Here Hier = rest\ndelete' x (elem :: rest) (There later) (Er komst) = elem :: delete' x rest later komst\n\ndelete : (x  : elemTy i)\n      -> (xs : PList iTy elemTy predTy is prfs)\n      -> {auto idxVal : Elem i is}\n      -> {auto idxPrf : DElem iTy predTy prf prfs idxVal}\n      -> PList iTy elemTy predTy (dropElem is idxVal) (dropElem prfs idxPrf)\ndelete x xs {idxVal} {idxPrf} = delete' x xs idxVal idxPrf\n\n\n-- --------------------------------------------------------- [ Bob The Builder ]\n\n-- TODO append\n-- TODO replicate\n\n-- ---------------------------------------------------------------- [ SubLists ]\n\ntake : (n : Nat)\n    -> (xs : PList aTy elemTy predTy as prfs)\n    -> PList aTy elemTy predTy (take n as) (take n prfs)\ntake Z     xs             = Nil\ntake (S k) []             = Nil\ntake (S k) (elem :: rest) = elem :: take k rest\n\n-- TODO takeWhile\n\n-- TODO drop\ndrop : (n : Nat)\n    -> (xs : PList aTy elemTy predTy as prfs)\n    -> PList aTy elemTy predTy (drop n as) (drop n prfs)\ndrop Z     rest           = rest\ndrop (S k) []             = Nil\ndrop (S k) (elem :: rest) = drop k rest\n\n-- TODO dropWhile\n\n-- ---------------------------------------------------------------- [ Equality ]\n-- TODO eqPList\n\n-- ------------------------------------------------------------------- [ Order ]\n-- TODO cmpPList\n\n-- ----------------------------------------------------------------- [ Folding ]\n-- TODO foldr and foldl\nfoldr : ({a : aTy} -> elemTy a -> p -> p)\n     -> p\n     -> PList aTy elemTy predTy as prfs\n     -> p\nfoldr f init Nil     = init\nfoldr f init (x::xs) = f x (PList.foldr f init xs)\n\nfoldl : ({a : aTy} -> p -> elemTy a -> p)\n      -> p\n      -> PList aTy elemTy predTy as prfs\n      -> p\nfoldl f init Nil = init\nfoldl f init (x::xs) = PList.foldl f (f init x) xs\n\n-- ----------------------------------------------------------------- [ Functor ]\n\nmap : ({a : aTy} -> elemTy a -> b)\n   -> PList aTy elemTy predTy as prf\n   -> List b\nmap f Nil     = List.Nil\nmap f (x::xs) = with List f x :: map f xs\n\n\nmapMaybe : ({a : aTy} -> elemTy a -> Maybe b)\n         -> PList aTy elemTy predTy as prfs\n         -> List b\nmapMaybe f Nil     = Nil\nmapMaybe f (x::xs) =\n  case f x of\n    Nothing => mapMaybe f xs\n    Just y  => y :: mapMaybe f xs\n\nconcatMap : Monoid m\n         => (func : {a : aTy} -> elemTy a -> m)\n         -> (xs : PList aTy elemTy predTy as prfs)\n         -> m\nconcatMap f = foldr (\\e, res => f e <+> res) neutral\n\n\n-- -------------------------------------------------------- [ Membership Tests ]\n-- TODO make deceq tests\n-- TODO any\n-- TODO all\n-- TODO elemBy\n-- TODO elem\n-- TODO hasAnyBy\n-- TODO hasAny\n\n-- --------------------------------------------------------------- [ Searching ]\n\n-- TODO find\n\n-- ------------------------------------------------------------- [ Conversions ]\n-- TODO\n\n-- ----------------------------------------------------------------- [ Filters ]\n-- TODO\n\n-- ------------------------------------------------------------ [ Partitioning ]\n-- TODO\n\n-- ----------------------------------------------------------------- [ Zipping ]\n-- TODO\n\n-- -------------------------------------------------------------- [ Predicates ]\n-- TODO\n\n-- ----------------------------------------------------------------- [ Sorting ]\n-- TODO\n\n-- -------------------------------------------------------------------- [ Show ]\n\nprivate\ndoPListShow : ({a : aTy} -> elemTy a -> String)\n           -> PList aTy elemTy predTy as prfs\n           -> List String\ndoPListShow _  Nil     = Nil\ndoPListShow f  (x::xs) = (f x) :: doPListShow f xs\n\nshowPList : (showFunc : {a : aTy} -> elemTy a -> String)\n         -> (l : PList aTy elemTy predTy as prfs)\n         -> String\nshowPList f xs = \"[\" ++ unwords (intersperse \",\" (doPListShow f xs)) ++ \"]\"\n\n-- --------------------------------------------------------------------- [ EOF ]\n", "meta": {"hexsha": "20ec1b781d3855c74c579f4037b1c59b59277f24", "size": 11092, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Data/PList.idr", "max_stars_repo_name": "MarcelineVQ/idris-containers", "max_stars_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "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/PList.idr", "max_issues_repo_name": "MarcelineVQ/idris-containers", "max_issues_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "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/PList.idr", "max_forks_repo_name": "MarcelineVQ/idris-containers", "max_forks_repo_head_hexsha": "3cca9329e5eaa04a98fc3ab521986b8d3c035567", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-05-19T12:29:49.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-19T12:29:49.000Z", "avg_line_length": 32.0578034682, "max_line_length": 119, "alphanum_fraction": 0.4940497656, "num_tokens": 3406, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6893056295505783, "lm_q2_score": 0.731058584489497, "lm_q1q2_score": 0.5039227978198874}}
{"text": "module Data.Time.Clock.AbsoluteTime\n\nimport Data.Fixed\nimport Data.Time.Calendar.Days\nimport Data.Time.Clock.DiffTime\n\nimport Generics.Derive\n\n%default total\n%language ElabReflection\n\n-- --------------------------------------------------------------------------\n\nexport data AbsoluteTime = MkAbsoluteTime DiffTime\n%runElab derive \"AbsoluteTime\" [Generic, Eq, Ord, DecEq]\n\n\n||| The epoch of TAI, which is 1858-11-17 00:00:00 TAI.\nexport taiEpoch : AbsoluteTime\ntaiEpoch = MkAbsoluteTime 0\n\n\nexport taiNominalDayStart : Day -> AbsoluteTime\ntaiNominalDayStart day =\n  MkAbsoluteTime $ SecondsToDiffTime $ cast $ day.modifiedJulianDay * 86400\n\n||| addAbsoluteTime a b = a + b\nexport addAbsoluteTime : DiffTime -> AbsoluteTime -> AbsoluteTime\naddAbsoluteTime t (MkAbsoluteTime a) = MkAbsoluteTime (a + t)\n\n||| diffAbsoluteTime a b = a - b\nexport diffAbsoluteTime : AbsoluteTime -> AbsoluteTime -> DiffTime\ndiffAbsoluteTime (MkAbsoluteTime a) (MkAbsoluteTime b) = a - b\n\n\n-- --------------------------------------------------------------------------\n-- vim: tw=80 sw=2 expandtab :", "meta": {"hexsha": "88856af60b6fe63b95bcf80915e7d8abc9cb1ed3", "size": 1074, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "time-calendar-clock/src/Data/Time/Clock/AbsoluteTime.idr", "max_stars_repo_name": "seagull-kamome/idris2-missing", "max_stars_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "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": "time-calendar-clock/src/Data/Time/Clock/AbsoluteTime.idr", "max_issues_repo_name": "seagull-kamome/idris2-missing", "max_issues_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-02-03T11:05:02.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-01T12:42:01.000Z", "max_forks_repo_path": "time-calendar-clock/src/Data/Time/Clock/AbsoluteTime.idr", "max_forks_repo_name": "seagull-kamome/idris2-missing", "max_forks_repo_head_hexsha": "ef0355d0ce0a7381e30b752e25c0aa6319f7a81a", "max_forks_repo_licenses": ["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.027027027, "max_line_length": 77, "alphanum_fraction": 0.656424581, "num_tokens": 268, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7606506635289835, "lm_q2_score": 0.661922862511608, "lm_q1q2_score": 0.5034920645744587}}
{"text": "module Main\n\nimport Oyster.Core\n\n%default total\n\n{-\n  EBNF grammar:\n\n  expr ::= term ( + expr | - expr | epsilon )\n  term ::= factor ( * expr | / expr | epsilon )\n  factor ::= ( expr ) | integer\n  integer ::= ... -2 | -1 | 0 | 1 | 2 | ...\n-}\n\nmutual\n  partial\n  expr : Parser Int\n  expr = do t <- term\n            do symbol \"+\"\n               e <- expr\n               pure (t + e)\n             <|> do symbol \"-\"\n                    e <- expr\n                    pure (t - e)\n             <|> pure t\n\n\n  partial\n  term : Parser Int\n  term = do f <- factor\n            do symbol \"*\"\n               t <- term\n               pure (f * t)\n             <|> do symbol \"/\"\n                    t <- term\n                    pure (f `div` t)\n             <|> pure f\n\n  partial\n  factor : Parser Int\n  factor = do symbol \"(\"\n              e <- expr\n              symbol \")\"\n              pure e\n            <|> integer\n\neval : String -> Maybe Int\neval inp = case parse expr inp of\n                [(n, \"\")] => Just n\n                _ => Nothing\n\nmain : IO ()\nmain = do expr <- getLine\n          pure ()\n", "meta": {"hexsha": "edf58b291d6b8b39316ffe6936d86db7e45a22e0", "size": 1093, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "samples/ArithExpr.idr", "max_stars_repo_name": "timmyjose-compilers/oyster", "max_stars_repo_head_hexsha": "ba010a29636fbb498e53acdd1763d575a87c082a", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "samples/ArithExpr.idr", "max_issues_repo_name": "timmyjose-compilers/oyster", "max_issues_repo_head_hexsha": "ba010a29636fbb498e53acdd1763d575a87c082a", "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": "samples/ArithExpr.idr", "max_forks_repo_name": "timmyjose-compilers/oyster", "max_forks_repo_head_hexsha": "ba010a29636fbb498e53acdd1763d575a87c082a", "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": 19.5178571429, "max_line_length": 47, "alphanum_fraction": 0.3915827996, "num_tokens": 277, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8438951182587158, "lm_q2_score": 0.5964331462646255, "lm_q1q2_score": 0.5033270205004041}}
{"text": "import System\nimport Data.List.Views\n\ndata Palindrome : List a -> Type where\n     PNil : Palindrome []\n     POne : Palindrome [x]\n     PRec : Palindrome xs -> Palindrome (x :: xs ++ [x])\n\ntotal\npalindrome : DecEq a => (xs : List a) -> Maybe (Palindrome xs)\npalindrome xs with (vList xs)\n  palindrome [] | VNil = Just PNil\n  palindrome [x] | VOne = Just POne\n  palindrome (x :: (ys ++ [y])) | (VCons z) with (decEq x y)\n    palindrome (y :: (ys ++ [y])) | (VCons urec) | (Yes Refl)\n       = case palindrome ys | urec of\n              Nothing => Nothing\n              Just x => Just (PRec x)\n    palindrome (x :: (ys ++ [y])) | (VCons z) | (No contra)\n       = Nothing\n\npalinBool : DecEq a => List a -> Bool\npalinBool xs = case palindrome xs of\n                    Nothing => False\n                    Just _ => True\n\nmain : IO ()\nmain = do getArgs >>= printLn\n          [_, num] <- getArgs\n          let list = replicate (cast num) 'a'\n          printLn (palinBool list)\n\n", "meta": {"hexsha": "c89c5ad7da7707409a2eb402e71c90028ee58982", "size": 971, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "test/idris-dev/views003/views003.idr", "max_stars_repo_name": "grin-compiler/idris-grin", "max_stars_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2019-06-06T10:35:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T08:48:30.000Z", "max_issues_repo_path": "test/idris-dev/views003/views003.idr", "max_issues_repo_name": "grin-compiler/idris-grin", "max_issues_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-11-21T20:45:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T12:29:23.000Z", "max_forks_repo_path": "test/idris-dev/views003/views003.idr", "max_forks_repo_name": "grin-compiler/idris-grin", "max_forks_repo_head_hexsha": "0514e4d41933143223cb685e23f450dcbf3d5593", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-06-14T13:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-07T06:20:45.000Z", "avg_line_length": 29.4242424242, "max_line_length": 62, "alphanum_fraction": 0.5478887745, "num_tokens": 282, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8333245787544825, "lm_q2_score": 0.6039318337259584, "lm_q1q2_score": 0.5032712409361064}}
{"text": "double : Num ty => ty -> ty\ndouble x = x + x", "meta": {"hexsha": "c5f1186636cc85bfe3c617df5f481e1904404724", "size": 44, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Double.idr", "max_stars_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_stars_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "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": "Double.idr", "max_issues_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_issues_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Double.idr", "max_forks_repo_name": "bkaflowski/tdd_with_idris_excercises", "max_forks_repo_head_hexsha": "3f6ecd4fdd05ef70363203ecb5a8915fae5f4835", "max_forks_repo_licenses": ["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": 27, "alphanum_fraction": 0.5454545455, "num_tokens": 15, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.785308580887758, "lm_q2_score": 0.640635854839898, "lm_q1q2_score": 0.503096834030136}}
{"text": "total twoPlusTwoNotFive: 2 + 2 = 5 -> Void\ntwoPlusTwoNotFive Refl impossible\n", "meta": {"hexsha": "fa92e6c81c48fbb19439ffd5aab24843b416f54d", "size": 77, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Void.idr", "max_stars_repo_name": "coffius/idris-exercises", "max_stars_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "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": "Void.idr", "max_issues_repo_name": "coffius/idris-exercises", "max_issues_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Void.idr", "max_forks_repo_name": "coffius/idris-exercises", "max_forks_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_forks_repo_licenses": ["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.6666666667, "max_line_length": 42, "alphanum_fraction": 0.7792207792, "num_tokens": 27, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.785308580887758, "lm_q2_score": 0.640635854839898, "lm_q1q2_score": 0.503096834030136}}
{"text": "module Fractions\n\n%default total\n\nrecord Fraction : Type where\n  F : (top : Nat) -> (bottom : Nat) -> Fraction\n  \ncorecord Tree : Type -> Type where\n  value : Tree a -> a\n  left : Tree a -> Tree a\n  right : Tree a -> Tree a\n  constructor MkTree\n  \nfracSum : Fraction -> Nat\nfracSum (F top bottom) = top + bottom\n\nleftFrac : Fraction -> Fraction\nleftFrac f = F (top f) (fracSum f)\n\nrightFrac : Fraction -> Fraction\nrightFrac f = F (fracSum f) (bottom f)\n\ntotal causal flattenTree : Tree a -> Stream a\nflattenTree t = ft []\n  where\n    total causal ft : List (Tree a) -> Stream a\n    ft [] = (value t) :: (ft [left t, right t])\n    ft (tree :: xs) = (value tree) :: (ft (xs ++ [left tree, right tree]))\n        \ntotal causal rationalTree : Tree Fraction\nrationalTree = rt $ F (S Z) (S Z)\n  where\n    total causal rt : Fraction -> Tree Fraction\n    rt f = MkTree f (rt $ leftFrac f) (rt $ rightFrac f)\n\n--total causal rationals : Stream Fraction\n--rationals = flattenTree $ rationalTree\n", "meta": {"hexsha": "37170e34b4af0e6bec4f15d819d67d9c3f204ef6", "size": 984, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "examples/Fractions.idr", "max_stars_repo_name": "sualitu/thesis", "max_stars_repo_head_hexsha": "22d2cb4f21dc7c2dab011da5bb560c003650a2bc", "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/Fractions.idr", "max_issues_repo_name": "sualitu/thesis", "max_issues_repo_head_hexsha": "22d2cb4f21dc7c2dab011da5bb560c003650a2bc", "max_issues_repo_licenses": ["MIT"], "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/Fractions.idr", "max_forks_repo_name": "sualitu/thesis", "max_forks_repo_head_hexsha": "22d2cb4f21dc7c2dab011da5bb560c003650a2bc", "max_forks_repo_licenses": ["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.8947368421, "max_line_length": 74, "alphanum_fraction": 0.6392276423, "num_tokens": 292, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8080672227971211, "lm_q2_score": 0.6224593312018546, "lm_q1q2_score": 0.502988983068436}}
{"text": "import Data.List\nimport Data.Nat\nimport Data.SortedMap\nimport Control.Monad.State\nimport Control.Monad.State.State\nimport Control.Monad.State.Interface\n\nrecord Player where\n  constructor MkPlayer\n  score : Nat\n  pos : Nat\n\nEq Player where\n  p1 == p2 = p1.score == p2.score && p1.pos == p2.pos\n\nOrd Player where\n  compare p1 p2 = compare (p1.score, p1.pos) (p2.score, p2.pos)\n\ndata Turn = P1 | P2\n\nEq Turn where\n  P1 == P1 = True\n  P2 == P2 = True\n  _  == _  = False\n\nOrd Turn where\n  compare P1 P1 = EQ\n  compare P1 P2 = LT\n  compare P2 P1 = GT\n  compare P2 P2 = EQ\n\nnext : Turn -> Turn\nnext P1 = P2\nnext P2 = P1\n\nrecord Game where\n  constructor MkGame\n  player1, player2 : Player\n  turn : Turn\n  rolls : Nat\n\nfromStart : Nat -> Nat -> Game\nfromStart p1 p2 = MkGame (MkPlayer 0 p1) (MkPlayer 0 p2) P1 0\n\nscore : Game -> Nat\nscore (MkGame p1 p2 _ rolls) = (*) rolls $ max p1.score  p2.score\n\nrollDet : State Game Nat\nrollDet = do rolls <- gets (.rolls)\n             modify { rolls $= S }\n             pure $ 1 + (modNatNZ rolls 100 SIsNonZero)\n\nmovePlayer : Nat -> Player -> Player\nmovePlayer m (MkPlayer score pos) = let npos = (modNatNZ (pos + m) 10 SIsNonZero) in\n                                         MkPlayer (score + npos + 1) npos\n\nplayDet : State Game ()\nplayDet = do rolls <- sequence $ replicate 3 rollDet\n             let r = sum rolls\n             turn <- gets (.turn)\n             case turn of\n                  P1 => modify { player1 $= movePlayer r }\n                  P2 => modify { player2 $= movePlayer r }\n             s1 <- gets (.player1.score)\n             s2 <- gets (.player2.score)\n             if s1 >= 1000 || s2 >= 1000\n                then pure ()\n                else modify { turn $= next } *> playDet\n\npart1 : Game -> IO String\npart1 a = do let g = execState a playDet\n             pure $ show $ score g\n\n\nMemoize : Type\nMemoize = SortedMap (Player, Player, Turn) (Nat, Nat)\n\naddPair : Num a => (a, a) -> (a, a) -> (a, a)\naddPair (x, y) (z, w) = (x + z, y + w)\n\nwins : Player -> Bool\nwins (MkPlayer score pos) = score >= 21\n\nplayDirac : Nat -> Memoize -> Game -> ((Nat, Nat), Memoize)\nplayDirac _ m (MkGame p1 p2 turn 0) = case lookup (p1, p2, turn) m of\n                                           (Just w) => (w, m)\n                                           Nothing => let (w, m) = foldl (\\(w, m) => \\d => mapFst (addPair w) $ playDirac d m (MkGame p1 p2 turn 1)) ((0, 0), m) $ [1,2,3] in\n                                                          (w, insert (p1, p2, turn) w m)\nplayDirac s m (MkGame p1 p2 P1 3) = let p1' = movePlayer s p1 in\n                                        if wins p1'\n                                           then ((1, 0), m)\n                                           else playDirac 0 m (MkGame p1' p2 P2 0)\nplayDirac s m (MkGame p1 p2 P2 3) = let p2' = movePlayer s p2 in\n                                        if wins p2'\n                                           then ((0, 1), m)\n                                           else playDirac 0 m (MkGame p1 p2' P1 0)\nplayDirac s m (MkGame p1 p2 turn r) = foldl (\\(w, m) => \\d => mapFst (addPair w) $ playDirac (s + d) m (MkGame p1 p2 turn (1 + r))) ((0, 0), m) $ [1,2,3]\n\npart2 : Game -> IO String\npart2 a = do let (wins, _) = playDirac 0 empty a\n             pure $ show $ (uncurry max) wins\n\n\nmain : IO ()\nmain = do let g = fromStart 2 9\n          part1 g >>= putStrLn\n          part2 g >>= putStrLn\n\n", "meta": {"hexsha": "6b39b2f9e67f6ec28364a9d3584c3f35456e25df", "size": 3420, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "21/Main.idr", "max_stars_repo_name": "Olavhaasie/aoc-2021", "max_stars_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "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": "21/Main.idr", "max_issues_repo_name": "Olavhaasie/aoc-2021", "max_issues_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "21/Main.idr", "max_forks_repo_name": "Olavhaasie/aoc-2021", "max_forks_repo_head_hexsha": "0a0b293bd9c41da785f4a1a0207a72a823944b1c", "max_forks_repo_licenses": ["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.376146789, "max_line_length": 173, "alphanum_fraction": 0.5131578947, "num_tokens": 1075, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8128673178375735, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.5029863915077337}}
{"text": "-- Idris implementation of a type-correct, stack-safe\n-- compiler including exception handling.\n--\n-- Morten S. Knudsen, Jeppe Vinberg, Francisco M. Lasaca\n\nimport Data.List\n\n%default total\n\ndata TyExp = NatTy | BoolTy\n\nVariableId : Type\nVariableId = String\n\nmutual\n  StackType : Type\n  StackType = List Ty\n\n  HeapType : Type\n  HeapType = List (VariableId, TyExp)\n\n  data Ty = Han StackType StackType HeapType HeapType | Val TyExp\n\ndata V : TyExp -> Type where\n  VNat : Nat -> V NatTy\n  VBool : Bool -> V BoolTy\n\ndata Exp : Bool -> TyExp -> List (VariableId, TyExp) -> Type where\n  VarExp : (vId : VariableId) -> {auto p : Elem (vId, ty) env} -> Exp False ty env\n  SingleExp : (v : V t) -> Exp False t env\n  PlusExp : (x : Exp a NatTy env) -> (y : Exp b NatTy env) -> Exp (a || b) NatTy env\n  IfExp : (cond : Exp a BoolTy env) -> (x : Exp b t env) -> (y : Exp c t env) -> Exp (a || b || c) t env\n  ThrowExp : Exp True t env\n  CatchExp : (x : Exp a t env) -> (h : Exp b t env) -> Exp (a && b) t env\n\ndata Program : List (VariableId, TyExp) -> List (VariableId, TyExp) -> Type where\n  EmptyProgram : Program env env\n  Declaration : (vId : VariableId) ->\n                (exp : Exp b t env) ->\n                {auto expExecutable : b = False}\u00a0->\n                (continuing : Program ((vId, t) :: env) env') ->\n                (Program env env')\n  Assignment : (vId : VariableId) ->\n               (exp : Exp b t env) ->\n               {auto expExecutable : b = False} ->\n               (continuing : Program ((vId, t) :: env) env') ->\n               {auto prf' : Elem (vId, t) env} ->\n               (Program env env')\n\ndata ValuesEnv : List (VariableId, TyExp) -> Type where\n  EmptyValuesEnv : ValuesEnv []\n  MoreValuesEnv : (vId: VariableId) -> V ty -> ValuesEnv envTy\n                  -> ValuesEnv ((vId, ty) :: envTy)\n\nmutual\n  evalVarExp : (x : ValuesEnv tEnv) -> (p : Elem (vId, ty) tEnv)  -> V ty\n  evalVarExp (MoreValuesEnv _ val _) Here = val\n  evalVarExp (MoreValuesEnv _ _ valueEnv) (There later) = evalVarExp valueEnv later\n\n  evalPlusExp : (x : Exp a NatTy tEnv) -> (y : Exp b NatTy tEnv) -> (valuesEnv : ValuesEnv tEnv) -> (prf : (a || (Delay b)) = False) -> V NatTy\n  evalPlusExp x y valuesEnv prf {a = False} {b = False} =\n    case eval x valuesEnv of\n          (VNat x') => case eval y valuesEnv of\n                             (VNat y') => VNat (x' + y')\n  evalPlusExp _ _ _ Refl {a = False} {b = True} impossible\n  evalPlusExp _ _ _ Refl {a = True} {b = _} impossible\n\n  evalIfExp : (cond : Exp a BoolTy tEnv) -> (x : Exp b t tEnv) -> (y : Exp c t tEnv) -> (valuesEnv : ValuesEnv tEnv) -> (prf : (a || (Delay (b || (Delay c)))) = False) -> V t\n  evalIfExp cond x y valuesEnv prf {a = False} {b = False}\u00a0{c = False} =\n    case eval cond valuesEnv of\n          VBool True => eval x valuesEnv\n          VBool False => eval y valuesEnv\n  evalIfExp _ _ _ _ Refl {a = False} {b = False}\u00a0{c = True} impossible\n  evalIfExp _ _ _ _ Refl {a = False} {b = False}\u00a0{c = True} impossible\n  evalIfExp _ _ _ _ Refl {a = True} {b = _}\u00a0{c = _} impossible\n\n  evalCatchExp : (x : Exp a t tEnv) -> (h : Exp b t tEnv) -> (valuesEnv : ValuesEnv tEnv) ->(prf : (a && (Delay b)) = False) -> V t\n  evalCatchExp x h valuesEnv prf {a = False} = eval x valuesEnv\n  evalCatchExp x h valuesEnv prf {a = True}\u00a0{b = False} = eval h valuesEnv\n  evalCatchExp _ _ _ Refl {a = True}\u00a0{b = True} impossible\n\n  eval : (e : Exp b t tEnv) -> (valuesEnv : ValuesEnv tEnv) -> {auto prf : b = False} -> V t\n  eval (VarExp vId {p}) valuesEnv = evalVarExp valuesEnv p\n  eval (SingleExp v) valuesEnv = v\n  eval (PlusExp x y) valuesEnv {prf} = evalPlusExp x y valuesEnv prf\n  eval (IfExp cond x y) valuesEnv {prf} = evalIfExp cond x y valuesEnv prf\n  eval ThrowExp _ {prf = Refl} impossible\n  eval (CatchExp x h) valuesEnv {prf}= evalCatchExp x h valuesEnv prf\n\nevPro : (p : Program env env') -> (valueEnv : ValuesEnv env) -> ValuesEnv env'\nevPro EmptyProgram valueEnv = valueEnv\nevPro (Declaration vId exp continuing) valueEnv =\n  let evaluated = eval exp valueEnv in\n  evPro continuing (MoreValuesEnv vId evaluated valueEnv)\nevPro (Assignment vId exp continuing) valueEnv =\n  let evaluated = eval exp valueEnv in\n  evPro continuing (MoreValuesEnv vId evaluated valueEnv)\nevalProgram : (p : Program [] env') -> ValuesEnv env'\nevalProgram p = evPro p EmptyValuesEnv\n\nmutual\n  El : Ty -> Type\n  El (Han t t' h h') = Code t t' h h'\n  El (Val NatTy) = Nat\n  El (Val BoolTy) = Bool\n\n  data Code : (s : StackType) -> (s' : StackType) -> (h: HeapType) -> (h': HeapType) -> Type where\n    STORE : (vId: VariableId) -> (c: Code s s' ((vId, ty)::h) h') -> Code ((Val ty)::s) s' h h'\n    LOAD : (vId: VariableId) -> {auto prf: Elem (vId, ty) h} -> (c: Code ((Val ty)::s) s' h h') -> Code s s' h h'\n    PUSH : V tyExp -> Code (Val tyExp :: s) s' h h' -> Code s s' h h'\n    ADD : Code (Val NatTy :: s) s' h h' -> Code (Val NatTy :: Val NatTy :: s) s' h h'\n    IF : (c1 : Code s s' h h') -> (c2 : Code s s' h h') -> Code (Val BoolTy :: s) s' h h'\n    THROW : Code (s'' ++ (Han s s' h h') :: s) s' h h'\n    MARK : (han : Code s s' h h') -> (c : Code ((Han s s' h h') :: s) s' h h') -> Code s s' h h'\n    UNMARK : Code (t :: s) s' h h' -> Code (t :: (Han s s' h h') :: s) s' h h'\n    HALT : Code s s h h\n\nmutual\n  compCatch : Exp b ty tenv -> Code (Val ty :: (s'' ++ (Han s s' tenv h') :: s)) s' tenv h' -> Code (s'' ++ (Han s s' tenv h') :: s) s' tenv h'\n  compCatch (VarExp vId) c = LOAD vId c\n  compCatch (SingleExp v) c = PUSH v c\n  compCatch (PlusExp x y) c = compCatch x (compCatch {s'' = Val NatTy :: _} y (ADD c))\n  compCatch {s} {s''} (IfExp cond x y) c = compCatch cond (IF (compCatch x c) (compCatch y c))\n  compCatch ThrowExp c = THROW\n  compCatch (CatchExp x h) c = MARK (compCatch h c) (compCatch {s'' = []} x (UNMARK c))\n\n  compPlusExp : (p : (a || b) = False) -> (x : Exp a NatTy tenv) ->  (y : Exp b NatTy tenv) -> (c : Code ((Val NatTy) :: s) s' tenv h') -> Code s s' tenv h'\n  compPlusExp {a = False} {b = False} Refl x y c = comp Refl x (comp Refl y (ADD c))\n  compPlusExp {a = False} {b = True} Refl _ _ _ impossible\n  compPlusExp {a = True} {b = _} Refl _ _ _ impossible\n\n  compCatchExp : (p : (a && b) = False) -> (x : Exp a ty tenv) -> (handler : Exp b ty tenv) -> (c : Code ((Val ty) :: s) s' tenv h') -> Code s s' tenv h'\n  compCatchExp {a = False} Refl x handler c = comp Refl x c\n  compCatchExp {a = True} {b = False} p x handler c = MARK (comp Refl handler c) (compCatch {s'' = []} x (UNMARK c))\n  compCatchExp {a = True} {b = True} Refl _ _ _ impossible\n\n  compIfExp : (p : (a || b || c) = False) -> (cond : Exp a BoolTy tenv) ->(x : Exp b ty tenv) -> (y : Exp c ty tenv) -> (co : Code ((Val ty) :: s) s' tenv h') -> Code s s' tenv h'\n  compIfExp {a = False} {b = False} {c = False} Refl cond x y co = comp Refl cond (IF (comp Refl x co) (comp Refl y co))\n  compIfExp {a = False} {b = False} {c = True} Refl _ _ _ _ impossible\n  compIfExp {a = False} {b = False} {c = True} Refl _ _ _ _ impossible\n  compIfExp {a = True} Refl _ _ _ _ impossible\n\n  comp : (b = False) -> Exp b ty tenv -> Code (Val ty :: s) s' tenv h' -> Code s s' tenv h'\n  comp _ (VarExp {p} vId) {tenv} c = LOAD vId c\n  comp p (SingleExp v) c = PUSH v c\n  comp p (PlusExp x y) c = compPlusExp p x y c\n  comp p (IfExp cond x y) co = compIfExp p cond x y co\n  comp p (CatchExp x h) c = compCatchExp p x h c\n  comp Refl ThrowExp _ impossible\n\n  partial\n  compile : (prog: Program tenv tenv') -> Code [] [] tenv tenv'\n  compile (Declaration vId exp {expExecutable} continuing) =\n    comp expExecutable exp (STORE vId (compile continuing))\n  compile (Assignment vId exp {expExecutable} continuing) =\n    comp expExecutable exp (STORE vId (compile continuing))\n  compile EmptyProgram = HALT\n\ndata Stack : (s : StackType) -> Type where\n  Nil : Stack []\n  (::) : El t -> Stack s -> Stack (t :: s)\n\ndata Heap : (h : HeapType) -> Type where\n  HeapNil : Heap []\n  HeapCons : (vId: VariableId) -> V t -> Heap h -> Heap ((vId, t) :: h)\n\nmutual\n\n  lookup: Heap h -> (p: Elem (vId, ty) h) -> V ty\n  lookup (HeapCons vId val tl) Here = val\n  lookup (HeapCons _ _ tl) (There later) = lookup tl later\n\n  partial\n  exec : Code s s' h h' -> Stack s -> Heap h -> (Stack s', Heap h')\n  exec (LOAD {prf} vId c) s h = case lookup h prf of\n    (VNat v) => exec c (v :: s) h\n    (VBool v) => exec c (v :: s) h\n  exec (STORE vId c) {s=(Val NatTy)::_} (x :: tl) h = exec c tl (HeapCons vId (VNat x) h)\n  exec (STORE vId c) {s=(Val BoolTy)::_} (x :: tl) h = exec c tl (HeapCons vId (VBool x) h)\n  exec (PUSH (VNat x) c) s h = exec c (x :: s) h\n  exec (PUSH (VBool x) c) s h = exec c (x :: s) h\n  exec (ADD c) (m :: n :: s) h = exec c ((n + m) :: s) h\n  exec (IF c1 c2) (True :: s) h = exec c1 s h\n  exec (IF c1 c2) (False :: s) h = exec c2 s h\n  exec THROW s h = fail s h\n  exec (MARK handler c) s h = exec c (handler :: s) h\n  exec (UNMARK c) (x :: handler :: s) h = exec c (x :: s) h\n  exec HALT s h = (s, h)\n\n  partial\n  fail : Stack (s'' ++ Han s s' h h' :: s) -> Heap h -> (Stack s', Heap h')\n  fail {s'' = []} (handler' :: s) h = exec handler' s h\n  fail {s'' = (_ :: _)} (_ :: s) h = fail s h\n\n\n-- Example of an entire program\n-- `entireProgram`\n\n-- x <- 3           -- []\n-- x <- x + 1       -- [x <- 3]\n-- y <- x + 2       -- [x <- 4]\n-- emptyProgram     -- [y <- 6, x <- 4]\n\nmyEmpty : Program [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)] [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)]\nmyEmpty = EmptyProgram\n\nyEqualsXPlusTwo : Program [(\"x\", NatTy), (\"x\", NatTy)] [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)]\nyEqualsXPlusTwo = Declaration \"y\" (PlusExp (VarExp \"x\") (SingleExp (VNat 2))) myEmpty\n\nxEqualsXPlusOne : Program [(\"x\", NatTy)] [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)]\nxEqualsXPlusOne = Assignment \"x\" (PlusExp (VarExp \"x\") (SingleExp (VNat 1))) yEqualsXPlusTwo\n\nentireProgram : Program [] [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)]\nentireProgram = Declaration \"x\" (SingleExp (VNat 3)) xEqualsXPlusOne\n\nevaluatedProgram : ValuesEnv [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)]\nevaluatedProgram = evalProgram entireProgram\n\ncompiledProgram :  Code [] [] [] [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)]\ncompiledProgram = compile entireProgram\n\npartial\nexecutedProgram : (Stack [], Heap [(\"y\", NatTy), (\"x\", NatTy), (\"x\", NatTy)])\nexecutedProgram = exec (compiledProgram) [] HeapNil\n", "meta": {"hexsha": "6c565b673933ebf7377d93e6e25cf1a6b8279e27", "size": 10312, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "throw.idr", "max_stars_repo_name": "JnxF/idris-epigram", "max_stars_repo_head_hexsha": "a12ef1378b8080549fcd5e6aa259179cdd31639b", "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": "throw.idr", "max_issues_repo_name": "JnxF/idris-epigram", "max_issues_repo_head_hexsha": "a12ef1378b8080549fcd5e6aa259179cdd31639b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "throw.idr", "max_forks_repo_name": "JnxF/idris-epigram", "max_forks_repo_head_hexsha": "a12ef1378b8080549fcd5e6aa259179cdd31639b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.8311111111, "max_line_length": 179, "alphanum_fraction": 0.5855314197, "num_tokens": 3667, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8031737963569016, "lm_q2_score": 0.6261241702517976, "lm_q1q2_score": 0.5028865268119512}}
{"text": "module Props.Util\n\nimport public Data.List\n\n%access public export\n\nprivate\nmkNo : {xs' : List a} ->\n       ((x' = y') -> Void) ->\n       (Elem x' xs' -> Void) ->\n       Elem x' (y' :: xs') -> Void\nmkNo f g Here = f Refl\nmkNo f g (There x) = g x\n\n-- Use this until https://github.com/idris-lang/Idris-dev/issues/4161\nfastIsElem : DecEq a => (x : a) -> (xs : List a) -> Dec (Elem x xs)\nfastIsElem x [] = No absurd\nfastIsElem x (y :: xs) with (decEq x y)\n  fastIsElem x (x :: xs) | (Yes Refl) = Yes Here\n  fastIsElem x (y :: xs) | (No contra) with (fastIsElem x xs)\n    fastIsElem x (y :: xs) | (No contra) | (Yes prf) = Yes (There prf)\n    fastIsElem x (y :: xs) | (No contra) | (No f) = No (mkNo contra f)\n\nusing (a: Type, P : a -> Type, Q: a -> Type)\n\n  data EitherK : { a : Type } -> ( P : a -> Type ) -> ( Q : a -> Type) -> a -> Type where\n    LeftK : ( prf : P c ) -> EitherK P Q c\n    RightK : ( prf : Q c ) -> EitherK P Q c\n\n-- Add these to not depend on contrib\ndata Given : Dec x -> Type where\n  Always : Given (Yes prf)\n\ndata Denied : Dec x -> Type where\n  Never : Denied (No contra)\n", "meta": {"hexsha": "a2c41a83dae55f2a98120956305852ef29bbb238", "size": 1092, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Props/Util.idr", "max_stars_repo_name": "janschultecom/idris-refined", "max_stars_repo_head_hexsha": "b717c4c6ac9b678ddd0b395e6a4bf1ff69ee860a", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2017-11-13T16:18:04.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-16T18:47:31.000Z", "max_issues_repo_path": "Props/Util.idr", "max_issues_repo_name": "janschultecom/idris-refined", "max_issues_repo_head_hexsha": "b717c4c6ac9b678ddd0b395e6a4bf1ff69ee860a", "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": "Props/Util.idr", "max_forks_repo_name": "janschultecom/idris-refined", "max_forks_repo_head_hexsha": "b717c4c6ac9b678ddd0b395e6a4bf1ff69ee860a", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2017-12-28T18:43:37.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-13T00:16:06.000Z", "avg_line_length": 30.3333333333, "max_line_length": 89, "alphanum_fraction": 0.5631868132, "num_tokens": 385, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7718434978390747, "lm_q2_score": 0.651354857898194, "lm_q1q2_score": 0.5027440118546155}}
{"text": "module Solutions.Predicates\n\nimport Data.Vect\nimport Decidable.Equality\n\n%default total\n\n--------------------------------------------------------------------------------\n--          Preconditions\n--------------------------------------------------------------------------------\n\ndata NonEmpty : (as : List a) -> Type where\n  IsNonEmpty : NonEmpty (h :: t)\n\n-- 1\n\ntail : (as : List a) -> (0 _ : NonEmpty as) => List a\ntail (_ :: xs) = xs\ntail [] impossible\n\n-- 2\n\nconcat1 : Semigroup a => (as : List a) -> (0 _ : NonEmpty as) => a\nconcat1 (h :: t) = foldl (<+>) h t\n\nfoldMap1 : Semigroup m => (a -> m) -> (as : List a) -> (0 _ : NonEmpty as) => m\nfoldMap1 f (h :: t) = foldl (\\x,y => x <+> f y) (f h) t\n\n-- 3\n\nmaximum : Ord a => (as : List a) -> (0 _ : NonEmpty as) => a\nmaximum (x :: xs) = foldl max x xs\n\nminimum : Ord a => (as : List a) -> (0 _ : NonEmpty as) => a\nminimum (x :: xs) = foldl min x xs\n\n-- 4\n\ndata Positive : Nat -> Type where\n  IsPositive : Positive (S n)\n\nsaveDiv : (m,n : Nat) -> (0 _ : Positive n) => Nat\nsaveDiv m (S k) = go 0 m k\n  where go : (res, rem, sub : Nat) -> Nat\n        go res 0       _     = res\n        go res (S rem) 0     = go (res + 1) rem k\n        go res (S rem) (S x) = go res rem x\n\n-- 5\n\ndata IJust : Maybe a -> Type where\n  ItIsJust : IJust (Just v)\n\nUninhabited (IJust Nothing) where\n  uninhabited ItIsJust impossible\n\nisJust : (m : Maybe a) -> Dec (IJust m)\nisJust Nothing  = No uninhabited\nisJust (Just x) = Yes ItIsJust\n\nfromJust : (m : Maybe a) -> (0 _ : IJust m) => a\nfromJust (Just x) = x\nfromJust Nothing  impossible\n\n-- 6\n\ndata IsLeft : Either e a -> Type where\n  ItIsLeft : IsLeft (Left v)\n\nUninhabited (IsLeft $ Right w) where\n  uninhabited ItIsLeft impossible\n\nisLeft : (v : Either e a) -> Dec (IsLeft v)\nisLeft (Right _) = No uninhabited\nisLeft (Left x)  = Yes ItIsLeft\n\ndata IsRight : Either e a -> Type where\n  ItIsRight : IsRight (Right v)\n\nUninhabited (IsRight $ Left w) where\n  uninhabited ItIsRight impossible\n\nisRight : (v : Either e a) -> Dec (IsRight v)\nisRight (Left _)  = No uninhabited\nisRight (Right x) = Yes ItIsRight\n\nfromLeft : (v : Either e a) -> (0 _ : IsLeft v) => e\nfromLeft (Left x) = x\nfromLeft (Right x) impossible\n\nfromRight : (v : Either e a) -> (0 _ : IsRight v) => a\nfromRight (Right x) = x\nfromRight (Left x) impossible\n\n--------------------------------------------------------------------------------\n--          Contracts between Values\n--------------------------------------------------------------------------------\n\ndata ColType = I64 | Str | Boolean | Float\n\nIdrisType : ColType -> Type\nIdrisType I64     = Int64\nIdrisType Str     = String\nIdrisType Boolean = Bool\nIdrisType Float   = Double\n\nrecord Column where\n  constructor MkColumn\n  name : String\n  type : ColType\n\ninfixr 8 :>\n\n(:>) : String -> ColType -> Column\n(:>) = MkColumn\n\nSchema : Type\nSchema = List Column\n\ndata Row : Schema -> Type where\n  Nil  : Row []\n  (::) :  {0 name : String}\n       -> {0 type : ColType}\n       -> (v : IdrisType type)\n       -> Row ss\n       -> Row (name :> type :: ss)\n\ndata InSchema :  (name    : String)\n              -> (schema  : Schema)\n              -> (colType : ColType)\n              -> Type where\n  [search name schema]\n  IsHere  : InSchema n (n :> t :: ss) t\n  IsThere : InSchema n ss t -> InSchema n (fld :: ss) t\n\ngetAt :  {0 ss   : Schema}\n      -> (name : String)\n      -> Row ss\n      -> (prf : InSchema name ss c)\n      => IdrisType c\ngetAt name (v :: vs) {prf = IsHere}    = v\ngetAt name (_ :: vs) {prf = IsThere p} = getAt name vs\n\n-- 1\n\nUninhabited (InSchema n [] c) where\n  uninhabited IsHere impossible\n  uninhabited (IsThere _) impossible\n\ninSchema : (ss : Schema) -> (n : String) -> Dec (c ** InSchema n ss c)\ninSchema []                    _ = No $ \\(_ ** prf) => uninhabited prf\ninSchema (MkColumn cn t :: xs) n = case decEq cn n of\n  Yes Refl   => Yes (t ** IsHere)\n  No  contra => case inSchema xs n of\n    Yes (t ** prf) => Yes (t ** IsThere prf)\n    No  contra2    => No $ \\case (_ ** IsHere)    => contra Refl\n                                 (t ** IsThere p) => contra2 (t ** p)\n\n-- 2\n\nupdateAt : (name : String)\n         -> Row ss\n         -> (prf : InSchema name ss c)\n         => (f : IdrisType c -> IdrisType c)\n         -> Row ss\nupdateAt name (v :: vs) {prf = IsHere}    f = f v :: vs\nupdateAt name (v :: vs) {prf = IsThere p} f = v :: updateAt name vs f\n\n-- 3\n\npublic export\ndata Elems : (xs,ys : List a) -> Type where\n  ENil   : Elems [] ys\n  EHere  : Elems xs ys -> Elems (x :: xs) (x :: ys)\n  EThere : Elems xs ys -> Elems xs (y :: ys)\n\nextract :  (0 s1 : Schema)\n        -> (row : Row s2)\n        -> (prf : Elems s1 s2)\n        => Row s1\nextract []       _         {prf = ENil}     = []\nextract (_ :: t) (v :: vs) {prf = EHere x}  = v :: extract t vs\nextract s1       (v :: vs) {prf = EThere x} = extract s1 vs\n\n-- 4\n\nnamespace AllInSchema\n  public export\n  data AllInSchema :  (names : List String)\n                   -> (schema : Schema)\n                   -> (result : Schema)\n                   -> Type where\n    [search names schema]\n    Nil  :  AllInSchema [] s []\n    (::) :  InSchema n s c\n         -> AllInSchema ns s res\n         -> AllInSchema (n :: ns) s (n :> c :: res)\n\ngetAll :  {0 ss  : Schema}\n       -> (names : List String)\n       -> Row ss\n       -> (prf : AllInSchema names ss res)\n       => Row res\ngetAll []        _   {prf = []}     = []\ngetAll (n :: ns) row {prf = _ :: _} = getAt n row :: getAll ns row\n\n--------------------------------------------------------------------------------\n--          Use Case: Flexible Error Handling\n--------------------------------------------------------------------------------\n\ndata Has :  (v : a) -> (vs  : Vect n a) -> Type where\n  Z : Has v (v :: vs)\n  S : Has v vs -> Has v (w :: vs)\n\nUninhabited (Has v []) where\n  uninhabited Z impossible\n  uninhabited (S _) impossible\n\ndata Union : Vect n Type -> Type where\n  U : {0 ts : _} -> (ix : Has t ts) -> (val : t) -> Union ts\n\nUninhabited (Union []) where\n  uninhabited (U ix _) = absurd ix\n\n0 Err : Vect n Type -> Type -> Type\nErr ts t = Either (Union ts) t\n\n-- 1\n\nproject : (0 t : Type) -> (prf : Has t ts) => Union ts -> Maybe t\nproject t {prf = Z}   (U Z val)     = Just val\nproject t {prf = S p} (U (S x) val) = project t (U x val)\nproject t {prf = Z}   (U (S x) val) = Nothing\nproject t {prf = S p} (U Z val)     = Nothing\n\nproject1 : Union [t] -> t\nproject1 (U Z val) = val\nproject1 (U (S x) val) impossible\n\nsafe : Err [] a -> a\nsafe (Right x) = x\nsafe (Left x)  = absurd x\n\n-- 2\n\nweakenHas : Has t ts -> Has t (ts ++ ss)\nweakenHas Z     = Z\nweakenHas (S x) = S (weakenHas x)\n\nweaken : Union ts -> Union (ts ++ ss)\nweaken (U ix val) = U (weakenHas ix) val\n\nextendHas : {m : _} -> {0 pre : Vect m a} -> Has t ts -> Has t (pre ++ ts)\nextendHas {m = Z}   {pre = []}     x = x\nextendHas {m = S p} {pre = _ :: _} x = S (extendHas x)\n\nextend : {m : _} -> {0 pre : Vect m _} -> Union ts -> Union (pre ++ ts)\nextend (U ix val) = U (extendHas ix) val\n\n-- 3\n\n0 Errs : Vect m Type -> Vect n Type -> Type\nErrs []        _  = ()\nErrs (x :: xs) ts = (Has x ts, Errs xs ts)\n\ninject : Has t ts => (v : t) -> Union ts\ninject v = U %search v\n\nembed : (prf : Errs ts ss) => Union ts -> Union ss\nembed (U Z val)     = inject val\nembed (U (S x) val) = embed (U x val)\n\n-- 4\n\ndata Rem : (v : a) -> (vs : Vect (S n) a) -> (rem : Vect n a) -> Type where\n  [search v vs]\n  RZ : Rem v (v :: rem) rem\n  RS : Rem v vs rem -> Rem v (w :: vs) (w :: rem)\n\nsplit : (prf : Rem t ts rem) => Union ts -> Either t (Union rem)\nsplit {prf = RZ}   (U Z     val) = Left val\nsplit {prf = RZ}   (U (S x) val) = Right (U x val)\nsplit {prf = RS p} (U Z     val) = Right (U Z val)\nsplit {prf = RS p} (U (S x) val) = case split {prf = p} (U x val) of\n  Left vt        => Left vt\n  Right (U ix y) => Right $ U (S ix) y\n\nhandle :  Applicative f\n       => Rem t ts rem\n       => (h : t -> f (Err rem a))\n       -> Err ts a\n       -> f (Err rem a)\nhandle h (Left x)  = case split x of\n  Left v    => h v\n  Right err => pure $ Left err\nhandle _ (Right x) = pure $ Right x\n\n--------------------------------------------------------------------------------\n--          Tests\n--------------------------------------------------------------------------------\n\nEmployeeSchema : Schema\nEmployeeSchema = [ \"firstName\"  :> Str\n                 , \"lastName\"   :> Str\n                 , \"email\"      :> Str\n                 , \"age\"        :> I64\n                 , \"salary\"     :> Float\n                 , \"management\" :> Boolean\n                 ]\n\n0 Employee : Type\nEmployee = Row EmployeeSchema\n\nhock : Employee\nhock = [ \"Stefan\", \"H\u00f6ck\", \"hock@foo.com\", 46, 5443.2, False ]\n\nshoeck : String\nshoeck = getAt \"firstName\" hock ++ \" \" ++ getAt \"lastName\" hock\n\nshoeck2 : String\nshoeck2 = case getAll [\"firstName\", \"lastName\", \"age\"] hock of\n  [fn,ln,a] => \"\\{fn} \\{ln}: \\{show a} years old.\"\n\nembedTest :  Err [Nat,Bits8] a\n          -> Err [String, Bits8, Int32, Nat] a\nembedTest = mapFst embed\n", "meta": {"hexsha": "455153253d50e2fc12d5e79500d082027d8a159a", "size": 8974, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Solutions/Predicates.idr", "max_stars_repo_name": "ska80/idris2-tutorial", "max_stars_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 60, "max_stars_repo_stars_event_min_datetime": "2022-01-13T16:14:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T16:16:57.000Z", "max_issues_repo_path": "src/Solutions/Predicates.idr", "max_issues_repo_name": "ska80/idris2-tutorial", "max_issues_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 11, "max_issues_repo_issues_event_min_datetime": "2022-01-14T15:42:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T09:53:16.000Z", "max_forks_repo_path": "src/Solutions/Predicates.idr", "max_forks_repo_name": "ska80/idris2-tutorial", "max_forks_repo_head_hexsha": "ab7c83cfea6761f2fd29841593c92e78c7dfc958", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2022-01-14T15:48:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T06:49:13.000Z", "avg_line_length": 27.4434250765, "max_line_length": 80, "alphanum_fraction": 0.5041230221, "num_tokens": 2908, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7401743620390162, "lm_q2_score": 0.6791787121629465, "lm_q1q2_score": 0.5027106699856895}}
{"text": "||| Reexporting `Data.Subset.Interfaces` and `Data.Subset.Predicates`\n||| plus some utility functions.\nmodule Data.Subset\n\nimport public Data.Subset.Interfaces\nimport public Data.Subset.Predicates\nimport public Data.Maybe\n\n%default total\n\n||| Compile time refinement of values\n||| If this does not work, the predicate in question\n||| might contain a negation. If that's the case, try `refine'`.\npublic export\nrefine : (v : t) -> {auto 0 prf : p v} -> Subset t p\nrefine v = Element v prf\n\n||| Like `Data.Subset.refine` but goes via a propsition's `Predicate`\n||| instance. This is necessary for instance for\n||| compiletime verification of negations, for which\n||| Idris2 is to able to come up with a value otherwise.\npublic export\nrefine' :  {0 t : Type} -> {0 p : t -> Type}\n        -> Predicate t p\n        => (v : t)\n        -> {auto prf : IsJust (refineMay {p = p} v)}\n        -> Subset t p\nrefine' v = fromJust (refineMay {p = p} v)\n\npublic export\nfromInteger :  Num t\n            => (v : Integer)\n            -> {auto 0 prf : p (fromInteger v)}\n            -> Subset t p\nfromInteger v = refine (fromInteger v)\n\npublic export\nfromString :  FromString t\n           => (v : String)\n           -> {auto 0 prf : p (fromString v)}\n           -> Subset t p\nfromString v = refine (fromString v)\n", "meta": {"hexsha": "f0a23032086adecf53b9aa0874fcb3a36be8f01e", "size": 1293, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/Subset.idr", "max_stars_repo_name": "stefan-hoeck/idris2-subsets", "max_stars_repo_head_hexsha": "ec2da829c6e250b9f21659f822f3df1cffa69ee7", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-12-30T09:53:06.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-19T19:06:24.000Z", "max_issues_repo_path": "src/Data/Subset.idr", "max_issues_repo_name": "stefan-hoeck/idris2-subsets", "max_issues_repo_head_hexsha": "ec2da829c6e250b9f21659f822f3df1cffa69ee7", "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": "src/Data/Subset.idr", "max_forks_repo_name": "stefan-hoeck/idris2-subsets", "max_forks_repo_head_hexsha": "ec2da829c6e250b9f21659f822f3df1cffa69ee7", "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": 30.0697674419, "max_line_length": 69, "alphanum_fraction": 0.6372776489, "num_tokens": 371, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7401743505760728, "lm_q2_score": 0.6791787056691698, "lm_q1q2_score": 0.5027106573937755}}
{"text": "> data Vect : Nat -> Type -> Type where\n>      Nil : Vect Z a\n>      (::) : a -> Vect k a -> Vect (S k) a\n\n> %name Vect xs, ys, zs\n\n> append : Vect n a -> Vect m a -> Vect (n + m) a\n> append xs ys\n>     = case xs of\n>            foo => ?bar\n\n> data Foo a = MkFoo a | MkBar (a -> a)\n\n> Functor Foo where\n>   map f thing = ?baz\n", "meta": {"hexsha": "d5bd20490e1827010fddfbbaa26ffe5f63c35fdb", "size": 326, "ext": "lidr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/literate002/IEdit.lidr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/literate002/IEdit.lidr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/literate002/IEdit.lidr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 20.375, "max_line_length": 49, "alphanum_fraction": 0.4846625767, "num_tokens": 115, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7634837635542924, "lm_q2_score": 0.6584174938590245, "lm_q1q2_score": 0.5026910662014732}}
{"text": "module Wheres\n\nimport Stuff\n\nreverse : List a -> List a\nreverse xs = rev' Nil xs\n  where\n    rev' : List a -> List a -> List a\n    rev' acc Nil = acc\n    rev' acc (x :: xs) = rev' (x :: acc) xs\n\nfoo : Int -> Int\nfoo x = case isLT of\n            Yes => prim__mul_Int x 2\n            No => prim__mul_Int x 4\n  where\n    data MyLT = Yes | No\n\n    isLT : MyLT\n    isLT = ifThenElse (intToBool (prim__lt_Int x 20)) Yes No\n", "meta": {"hexsha": "35bf7d3cb025f7105e4897fd7e753e373d7b7447", "size": 417, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/basic004/Wheres.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/basic004/Wheres.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/basic004/Wheres.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 19.8571428571, "max_line_length": 60, "alphanum_fraction": 0.5683453237, "num_tokens": 144, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7154239957834733, "lm_q2_score": 0.702530051167069, "lm_q1q2_score": 0.5026068563639124}}
{"text": "module UserApi\n\nimport Control.Monad.Freer\nimport Debug.Trace\nimport Control.Monad.Id\n\n%access public export\n%default total\n\ndata Tensor : Type where\n  DoubleT : Double -> Tensor\n\nimplementation Show Tensor where\n  show (DoubleT x) = show x\n  \n-- temporary\ndata Shape\n\ndata GraphData : Type -> Type where \n  Mul : Tensor -> Tensor -> GraphData Tensor\n  Placeholder : GraphData Tensor\n  Constant : Double -> GraphData Tensor\n\nFreeGraph : Type --type of computation graph ,freer graph\nFreeGraph = Freer GraphData Tensor\n\nimplicit gt2fg : GraphData Tensor -> FreeGraph\ngt2fg = liftF\n\nnewPlaceholder : FreeGraph\nnewPlaceholder = liftF Placeholder\n\nexampleGraph : FreeGraph\nexampleGraph = do \n  t<-newPlaceholder\n  a<-liftF Placeholder -- same\n  b<-Placeholder -- same\n  liftF (Mul t a)\n\nconst1 : GraphData Tensor\nconst1 = Constant 1\n\nmulG : FreeGraph\nmulG = do\n  x<-liftF $ Constant 1\n  y<-liftF $ Constant 3\n  liftF $ Mul x y\n\nnumericGradId : {x : Type}->  GraphData Tensor->GraphData x -> Id x\nnumericGradId Placeholder (Mul x y) =  pure $ DoubleT  2.0\nnumericGradId (Constant z) (Mul (DoubleT x) (DoubleT y)) =  \n  let res : Double =(x*y + 0.1)/(z+0.1) in\n  pure $ trace (show z ++ \",\" ++show x) $ DoubleT res\nnumericGradId (Mul x y) (Mul (DoubleT z) (DoubleT w)) = pure $ DoubleT 3.0\nnumericGradId _ (Constant x) = pure $ DoubleT 3.0\nnumericGradId _ Placeholder = pure $ DoubleT 4.0\n\n\nmainGradId : Id String\nmainGradId = do \n  x <- (foldFreer ((trace \"xxx\" numericGradId) const1) mulG) \n  --print x\n  pure $ show x\n\n", "meta": {"hexsha": "bdbb172b19a32d5875afbecc7f6f058d60531eee", "size": 1516, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "UserApi.idr", "max_stars_repo_name": "justjoheinz/tensorflow-idris", "max_stars_repo_head_hexsha": "ee4161e704b0c45129ba6802139c0d18c6042e11", "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": "UserApi.idr", "max_issues_repo_name": "justjoheinz/tensorflow-idris", "max_issues_repo_head_hexsha": "ee4161e704b0c45129ba6802139c0d18c6042e11", "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": "UserApi.idr", "max_forks_repo_name": "justjoheinz/tensorflow-idris", "max_forks_repo_head_hexsha": "ee4161e704b0c45129ba6802139c0d18c6042e11", "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.3230769231, "max_line_length": 74, "alphanum_fraction": 0.7058047493, "num_tokens": 463, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8757869851639067, "lm_q2_score": 0.5736784074525098, "lm_q1q2_score": 0.5024200829164648}}
{"text": "-- Enumerated type example.\ndata Direction = North\n               | East\n               | South\n               | West\n\nturnClockwise : Direction -> Direction\nturnClockwise North = East\nturnClockwise East = South\nturnClockwise South = West\nturnClockwise West = North\n", "meta": {"hexsha": "d3272776e2de0627dee71082c218b68093f2992e", "size": 266, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "TypeDrivenDevelopment/Chapter04/Direction.idr", "max_stars_repo_name": "lambdaxymox/type-driven-development-with-idris", "max_stars_repo_head_hexsha": "e5e55715cd7418f3e6fab8e5658d7518da3fdce7", "max_stars_repo_licenses": ["Apache-2.0", "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": "TypeDrivenDevelopment/Chapter04/Direction.idr", "max_issues_repo_name": "lambdaxymox/type-driven-development-with-idris", "max_issues_repo_head_hexsha": "e5e55715cd7418f3e6fab8e5658d7518da3fdce7", "max_issues_repo_licenses": ["Apache-2.0", "MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TypeDrivenDevelopment/Chapter04/Direction.idr", "max_forks_repo_name": "lambdaxymox/type-driven-development-with-idris", "max_forks_repo_head_hexsha": "e5e55715cd7418f3e6fab8e5658d7518da3fdce7", "max_forks_repo_licenses": ["Apache-2.0", "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.1666666667, "max_line_length": 38, "alphanum_fraction": 0.6428571429, "num_tokens": 60, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7248702761768249, "lm_q2_score": 0.6926419958239132, "lm_q1q2_score": 0.5020755948045471}}
{"text": "module RLE\n\nimport Decidable.Equality\n\nrep : Nat -> a -> List a\n\ndata RunLength : List a -> Type where\n     Empty : RunLength []\n     Run : (n : Nat) -> (x : a) -> (rest : RunLength more) ->\n           RunLength (rep n x ++ more)\n\ndata Singleton : a -> Type where\n     Val : (x : a) -> Singleton x\n\nuncompress : RunLength xs -> Singleton xs\n\n\n\n\n\n\n\n\n\n\n\n\n{-\n\nrle : DecEq a => (xs : List a) -> RLE xs\nrle [] = Empty\nrle (x :: xs) with (rle xs)\n  rle (x :: []) | Empty = Run 1 x Empty\n  rle (x :: (rep n y ++ more)) | (Run n y comp) with (decEq x y)\n    rle (y :: (rep n y ++ more)) | (Run n y comp) | (Yes Refl)\n        = Run (S n) y comp\n    rle (x :: (rep n y ++ more)) | (Run n y comp) | (No contra)\n        = Run 1 x $ Run n y comp\n\ndata Singleton : a -> Type where\n     Val : (x : a) -> Singleton x\n\nuncompress : RLE xs -> Singleton xs\n\n-- uncompress Empty = Val []\n-- uncompress (Run n x comp)\n--     = let Val rec = uncompress comp in\n--           Val (rep n x ++ rec)\n\nuncompressHelp : (x : a) -> RLE more -> (n : Nat) -> Singleton more -> Singleton (rep n x ++ more)\nuncompressHelp x comp n (Val _) = Val (rep n x ++ more)\n\nuncompress' : RLE xs -> Singleton xs\nuncompress' Empty = Val []\nuncompress' (Run n x comp)\n    = let rec = uncompress' comp in\n          uncompressHelp x comp n rec\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n{-\nrle [] = Empty\nrle (x :: xs) with (rle xs)\n  rle (x :: []) | Empty = Run 1 x Empty\n  rle (x :: (rep n y ++ more)) | (Run n y comp) with (decEq x y)\n    rle (y :: (rep n y ++ more)) | (Run n y comp) | (Yes Refl)\n        = Run (S n) y comp\n    rle (x :: (rep n y ++ more)) | (Run n y comp) | (No contra)\n        = Run 1 x $ Run n y comp\n\nuncompress Empty = Val []\nuncompress (Run n x comp)\n   = let Val uncomp = uncompress comp in\n         Val (rep n x ++ uncomp)\n-}\n-}\n", "meta": {"hexsha": "a60ba3caf4da13d3835d5fd53deddfcb90474763", "size": 1788, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/interactive017/RLE.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 128, "max_stars_repo_stars_event_min_datetime": "2020-06-09T21:25:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:50:24.000Z", "max_issues_repo_path": "idris2/tests/idris2/interactive017/RLE.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2020-08-26T03:38:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-23T21:32:49.000Z", "max_forks_repo_path": "idris2/tests/idris2/interactive017/RLE.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2020-08-28T04:16:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-20T12:47:16.000Z", "avg_line_length": 18.625, "max_line_length": 98, "alphanum_fraction": 0.533557047, "num_tokens": 594, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7577943712746406, "lm_q2_score": 0.661922862511608, "lm_q1q2_score": 0.5016014194292944}}
{"text": "module Twist.Rotation\n\nimport Control.Algebra\n\nimport Twist.Cycle\nimport Twist.Face\nimport Twist.Util\n\n%default total\n%access export\n\n\ndata Rotation : (f : Type) -> (c : Type) -> (face : f) -> Type where\n  Rot : (face : (Face (S k))) -> (c : Cycle (S j)) -> Rotation (Face (S k)) (Cycle (S j)) face\n\nEq c => Eq (Rotation f c face) where\n  (Rot face cx) == (Rot face cy) = cx == cy\n\nShow (Rotation f c face) where\n  show (Rot face x) = show face ++ show x\n\ncw : (Rotation f c face) -> (Rotation f c face)\ncw (Rot face cx) = Rot face (next cx)\n\nccw : (Rotation f c face) -> (Rotation f c face)\nccw (Rot face cx) = Rot face (prev cx)\n\nSemigroup (Rotation f c face) where\n  (Rot face cx) <+> (Rot face cy) = Rot face (cx <+> cy)\n\nrotateZ : (face : Face (S k)) -> Rotation (Face (S k)) (Cycle (S j)) face\nrotateZ x = Rot x neutral\n\nrotate : (face : Face (S k)) -> Rotation (Face (S k)) (Cycle (S j)) face\nrotate x = Rot x (next neutral)\n\nrotate' : (face : Face (S k)) -> Rotation (Face (S k)) (Cycle (S j)) face\nrotate' x = Rot x (prev neutral)\n\nMonoid (Rotation (Face (S k)) (Cycle (S j)) face) where\n  neutral = Rot face neutral\n\nGroup (Rotation (Face (S k)) (Cycle (S j)) face) where\n  inverse (Rot face cx) = Rot face (inverse cx)\n\n", "meta": {"hexsha": "70db08e5921f03dbc64ae7927378ef461a51ce62", "size": 1231, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Twist/Rotation.idr", "max_stars_repo_name": "msmorgan/idris-twist", "max_stars_repo_head_hexsha": "9092654df1f5f4bdbd8230e794e034b7a05fd9ae", "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": "Twist/Rotation.idr", "max_issues_repo_name": "msmorgan/idris-twist", "max_issues_repo_head_hexsha": "9092654df1f5f4bdbd8230e794e034b7a05fd9ae", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Twist/Rotation.idr", "max_forks_repo_name": "msmorgan/idris-twist", "max_forks_repo_head_hexsha": "9092654df1f5f4bdbd8230e794e034b7a05fd9ae", "max_forks_repo_licenses": ["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.7608695652, "max_line_length": 94, "alphanum_fraction": 0.6198212835, "num_tokens": 401, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.810478926981208, "lm_q2_score": 0.6187804337438501, "lm_q1q2_score": 0.501508501977682}}
{"text": "--- Data declarations ---\n\ninfix 0 =%=\n\npublic export\ndata (=%=) : (a -> b) -> (a -> b) -> Type where\n  ExtEq : {0 f, g : a -> b} -> ((x : a) -> f x = g x) -> f =%= g\n\ninfix 0 %%\n\npublic export\ndata (%%) a b = Equs (a = b) (b = a)\n\n--- Records ---\n\ninfix 0 =%%=\n\npublic export\nrecord (=%%=) {a : Type} {b : Type} (f : a -> b) (g : a -> b) where\n  constructor ExtEqR\n  fa : (x : a) -> f x = g x\n\n--- Interfaces ---\n\ninfix 0 =%%%=\n\npublic export\ninterface (=%%%=) (x : a) (y : a) (b : Type) (i : Type) where\n  idx : a -> i -> b\n  eq : (ix : i) -> idx x ix = idx y ix\n", "meta": {"hexsha": "36ac4e26ffcca7104cfe2ce138371836d5d1efe6", "size": 565, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/basic058/DataTypeOp.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/basic058/DataTypeOp.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/basic058/DataTypeOp.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 18.2258064516, "max_line_length": 67, "alphanum_fraction": 0.4548672566, "num_tokens": 231, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8056321889812553, "lm_q2_score": 0.6224593312018546, "lm_q1q2_score": 0.5014732735479583}}
{"text": "module Syntax.PreorderReasoning.Generic\n\nimport Control.Relation\nimport Control.Order\ninfixl 0  ~~\ninfixl 0  <~\nprefix 1  |~\ninfix  1  ...\n\npublic export\ndata Step : (leq : a -> a -> Type) -> a -> a -> Type where\n  (...) : (y : a) -> x `leq` y -> Step leq x y\n\npublic export\ndata FastDerivation : (leq : a -> a -> Type) -> (x : a) -> (y : a) -> Type where\n  (|~) : (x : a) -> FastDerivation leq x x\n  (<~) : {x, y : a}\n         -> FastDerivation leq x y -> {z : a} -> (step : Step leq y z)\n         -> FastDerivation leq x z\n\npublic export\nCalcWith : Preorder dom leq => {0 x : dom} -> {0 y : dom} -> FastDerivation leq x y -> x `leq` y\nCalcWith (|~ x) = reflexive {rel = leq}\nCalcWith ((<~) der (z ... step)) = transitive {rel = leq} (CalcWith der) step\n\npublic export\n(~~) : {0 x : dom} -> {0 y : dom}\n         -> FastDerivation leq x y -> {z : dom} -> (step : Step Equal y z)\n         -> FastDerivation leq x z\n(~~) der (z ... Refl) = der\n", "meta": {"hexsha": "7060d534731dc4c9d0f1c6346c0d0ccb3e50c97f", "size": 942, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "libs/contrib/Syntax/PreorderReasoning/Generic.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/contrib/Syntax/PreorderReasoning/Generic.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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": "libs/contrib/Syntax/PreorderReasoning/Generic.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "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.3870967742, "max_line_length": 96, "alphanum_fraction": 0.5477707006, "num_tokens": 345, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8152325073083131, "lm_q2_score": 0.6150878555160665, "lm_q1q2_score": 0.5014396146672563}}
{"text": "module TypedNBE\n\n-- Typed NBE, based on https://hal.inria.fr/hal-01397929/document\n\nimport Data.Vect\n\ndata Ty = Base String | Arrow Ty Ty\n\ndata Syn : Vect n Ty -> Ty -> Type where\n  Var : Elem a ctx -> Syn ctx a\n  Lam : Syn (a :: ctx) b -> Syn ctx (Arrow a b)\n  App : Syn ctx (Arrow a b) -> Syn ctx a -> Syn ctx b\n\nV : Ty -> Type\n\nmutual\n  data Nf : Ty -> Type where\n    NLam : (V a -> Nf b) -> Nf (Arrow a b)\n    NAt : At (Base a) -> Nf (Base a)\n\n  data At : Ty -> Type where\n    AApp : At (Arrow a b) -> Nf a -> At b\n    AVar : V a -> At a\n\ndata Sem : Ty -> Type where\n  Fun : (Sem a -> Sem b) -> Sem (Arrow a b)\n  Base' : At (Base a) -> Sem (Base a)\n\ndata Env : Vect n Ty -> Type where\n  Nil  : Env Nil\n  (::) : Sem ty -> Env ctx -> Env (ty :: ctx)\n\nlookup' : Elem ty ctx -> Env ctx -> Sem ty\nlookup' Here (x :: _) = x\nlookup' (There later) (x :: xs) = lookup' later xs\n\neval : Env ctx -> Syn ctx ty -> Sem ty\neval env (Var x) = lookup' x env\neval env (Lam body) = Fun (\\x => eval (x :: env) body)\neval env (App f x) with (eval env f)\n  eval env (App f x) | (Fun f') = f' (eval env x)\n\nmutual\n  reflect : At ty -> Sem ty\n  reflect {ty = (Base _)} at = Base' at\n  reflect {ty = (Arrow a b)} at = Fun (\\x => reflect (AApp at (reify x)))\n\n  reify : Sem ty -> Nf ty\n  reify {ty = (Base _)} (Base' base) = NAt base\n  reify {ty = (Arrow a b)} (Fun f) = NLam (\\x => reify (f (reflect (AVar x))))\n\nnbe : Syn [] ty -> Nf ty\nnbe syn = reify (eval [] syn)\n\nexample : Syn [] (Arrow (Base \"a\") (Base \"a\"))\nexample = Lam (App (Lam (Var Here)) (Var Here))\n\ntest : Nf (Arrow (Base \"a\") (Base \"a\"))\ntest = nbe example\n", "meta": {"hexsha": "2fdc849e0d321661bbca7f86ad60abcfcba3d95b", "size": 1604, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/TypedNBE.idr", "max_stars_repo_name": "STELIORD/idris-snippets", "max_stars_repo_head_hexsha": "f5ca6fa86370d24587040af9871ae850bbc630c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-11-21T22:28:51.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-05T18:25:18.000Z", "max_issues_repo_path": "src/TypedNBE.idr", "max_issues_repo_name": "stjordanis/idris-snippets", "max_issues_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_issues_repo_licenses": ["MIT"], "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/TypedNBE.idr", "max_forks_repo_name": "stjordanis/idris-snippets", "max_forks_repo_head_hexsha": "d92734b8624ae27be21a63fcb041077b38eaaecb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-05-06T13:39:44.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T15:39:16.000Z", "avg_line_length": 26.7333333333, "max_line_length": 78, "alphanum_fraction": 0.5604738155, "num_tokens": 576, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7826624789529376, "lm_q2_score": 0.640635854839898, "lm_q1q2_score": 0.501401646255129}}
{"text": "-- Small (and obsolete) prototype of a cost-based computational\n-- eDLS. Each operation has a cost. Functions take a lifted type,\n-- FndType, that includes a fund. The output type of each lifted\n-- operation contains the remaining fund after the operation.  It is\n-- planned to be replaced by function realization described in\n-- https://blog.singularitynet.io/ai-dsl-toward-a-general-purpose-description-language-for-ai-agents-21459f691b9e\n-- but is kept here for future references.\n\nmodule FndType\n\n-- Funded type\npublic export\ndata FndType : Nat -> Type -> Type where\n  FT : {fund : Nat} -> (datum : a) -> (FndType fund a)\n\n-- Overload show for FndType\nexport\nshow : (FndType fund Int) -> String\nshow (FT datum) = \"FT \" ++ (show fund) ++ \" \" ++ (show datum)\n\n-- Fund accessor\nexport\ngetFund : (FndType fund a) -> Nat\ngetFund (FT datum) = fund\n\n-- Datum accessor\nexport\ngetDatum : (FndType fund a) -> a\ngetDatum (FT datum) = datum\n\n-- Uplift function as to use FndType, with cost of 1.\nexport\nupliftFun : {fund : Nat} -> {cost : Nat} -> (a -> b) -> (FndType (cost + fund) a) -> (FndType fund b)\nupliftFun f = (\\x => (FT (f (getDatum x))))\n\n-- Downlift function as to run over datum rather than FndType.\nexport\ndownliftFun : {infund : Nat} -> ((FndType infund a) -> (FndType outfund b)) -> a -> b\ndownliftFun f = (\\x => (getDatum (f (FT x))))\n\n-- Lifted composition. Takes 2 filted functions and compose them\nexport\ncompose : ((FndType fund_b b) -> (FndType fund_c c))\n        -> ((FndType fund_a a) -> (FndType fund_b b))\n        -> (FndType fund_a a) -> (FndType fund_c c)\ncompose f g = (\\x => (f (g x)))\n", "meta": {"hexsha": "0da6d382bd36cb0dfa7162571d5bf8fc2bce351e", "size": 1608, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "experimental/realized-function/FndType.idr", "max_stars_repo_name": "nunet-io/ai-dsl", "max_stars_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2021-02-17T08:02:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-03T12:52:29.000Z", "max_issues_repo_path": "experimental/realized-function/FndType.idr", "max_issues_repo_name": "nunet-io/ai-dsl", "max_issues_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 15, "max_issues_repo_issues_event_min_datetime": "2021-03-04T10:33:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-16T04:55:50.000Z", "max_forks_repo_path": "experimental/realized-function/FndType.idr", "max_forks_repo_name": "nunet-io/ai-dsl", "max_forks_repo_head_hexsha": "cdcb630c6ea1785f8237c700621555046437d212", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2021-02-19T07:58:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-28T18:37:13.000Z", "avg_line_length": 34.2127659574, "max_line_length": 113, "alphanum_fraction": 0.6722636816, "num_tokens": 495, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998508568417, "lm_q2_score": 0.6442251201477016, "lm_q1q2_score": 0.5007560898090394}}
{"text": "module Schema\n\nimport SQLiteTypes\n\nimport Decidable.Equality\nimport Language.Reflection\n\n%access public export\n%default total\n\n%auto_implicits on\n\ninfix 5 :::\ndata Attribute = (:::) String SQLiteType\n%name Attribute attr,attr'\n\ngetName : Attribute -> String\ngetName (c:::_) = c\n\ngetTy : Attribute -> SQLiteType\ngetTy (_:::t) = t\n\nattrEta : (attr : Attribute) -> (getName attr ::: getTy attr) = attr\nattrEta (x ::: y) = Refl\n\nattrInj : (c ::: t = c' ::: t') -> (c=c', t=t')\nattrInj Refl = (Refl, Refl)\n\n-- the first case forces it to get stuck if the constants are not in canonical form\nfoo : (x : String) -> (y : String) -> Dec (x = y)\nfoo \"\" \"\" = Yes Refl\nfoo x y with (decEq x y)\n  foo x y | Yes _ = Yes (really_believe_me (Refl {x}))\n  foo x y | No urgh = No urgh\n\n\nimplementation DecEq Attribute where\n  decEq (x ::: y) (z ::: w) with (foo x z, decEq y w)\n    decEq (x ::: y) (x ::: y) | (Yes Refl, Yes Refl) = Yes Refl\n    decEq (x ::: y) (x ::: w) | (Yes Refl, No prf) = No $ prf . snd . attrInj\n    decEq (x ::: y) (z ::: w) | (No prf, _) = No $ prf . fst . attrInj\n\ndata Schema = Nil | (::) Attribute Schema\n%name Schema s,s'\n\nappend : (s1, s2 : Schema) -> Schema\nappend [] s2 = s2\nappend (attr :: s) s2 = attr :: (append s s2)\n\nnames : Schema -> List String\nnames [] = []\nnames ((n ::: _) :: s) = n :: names s\n\n\ndata HasCol : Schema -> Attribute -> Type where\n  Here : HasCol (attr::s) attr\n  There : HasCol s attr -> HasCol (attr'::s) attr\n\nHasColNotEmpty : HasCol [] a -> Void\nHasColNotEmpty Here impossible\nHasColNotEmpty (There _) impossible\n\nimplementation Uninhabited (HasCol [] a) where\n  uninhabited x = HasColNotEmpty x\n\ndecHasColLemma :  (HasCol s attr -> Void) ->\n                  (attr' = attr -> Void) ->\n                  HasCol (attr' :: s) attr -> Void\ndecHasColLemma h1 h2 Here = h2 Refl\ndecHasColLemma h1 h2 (There x) = h1 x\n\ndecHasCol : (s : Schema) -> (attr : Attribute) -> Dec (HasCol s attr)\ndecHasCol [] attr = No HasColNotEmpty\ndecHasCol (attr' :: s) attr with (decEq attr' attr)\n  decHasCol (attr' :: s) attr' | (Yes Refl) = Yes Here\n  decHasCol (attr' :: s) attr | (No f) with (decHasCol s attr)\n    decHasCol (attr' :: s) attr | (No f) | (Yes x) = Yes (There x)\n    decHasCol (attr' :: s) attr | (No f) | (No g) = No $ \\h => decHasColLemma g f h\n\n\ndata SubSchema : Schema -> Schema -> Type where\n  Empty : SubSchema [] s\n  Head : (tailSub : SubSchema small large) ->\n         (alsoThere : HasCol large attr) ->\n         SubSchema (attr :: small) large\n\nHasColNamed : Schema -> String -> Type\nHasColNamed s col = (t : SQLiteType ** HasCol s (col ::: t))\n\ndecHasColNamed_lemma : ((HasColNamed s col) -> Void) -> ((col' = col) -> Void) ->\n                       (t ** HasCol ((col' ::: ty) :: s) (col ::: t)) -> Void\ndecHasColNamed_lemma notThere notHere (ty ** Here)         = notHere Refl\ndecHasColNamed_lemma notThere notHere (ty ** (There more)) = notThere (ty ** more)\n\n\ndecHasColNamed : (s : Schema) -> (col : String) -> Dec (HasColNamed s col)\ndecHasColNamed [] col = No $ \\h => HasColNotEmpty (snd h)\ndecHasColNamed ((col' ::: ty) :: s) col with (decEq col' col)\n  decHasColNamed ((col ::: ty) :: s)  col | (Yes Refl) = Yes (ty ** Here)\n  decHasColNamed ((col' ::: ty) :: s) col | (No f) with (decHasColNamed s col)\n    decHasColNamed ((col' ::: ty) :: s) col | (No f) | (Yes x) =\n      Yes (fst x ** There (snd x))\n    decHasColNamed ((col' ::: ty) :: s) col | (No f) | (No g) = No (decHasColNamed_lemma g f)\n\ncolNames : Schema -> List String\ncolNames [] = []\ncolNames ((col ::: _) :: s) = col :: colNames s\n\ndata Disjointness : Type where\n  Disjoint : Disjointness\n  Overlap : (attr : Attribute) -> Disjointness\n\nisDisjoint : (s1, s2 : Schema) -> Disjointness\nisDisjoint [] s2 = Disjoint\nisDisjoint (attr :: s) s2 with (decHasColNamed s2 (getName attr))\n  isDisjoint (attr :: s) s2 | (Yes x) = Overlap attr\n  isDisjoint (attr :: s) s2 | (No f) = isDisjoint s s2\n\n\n", "meta": {"hexsha": "bc39f1e3add97b292a27d9b865defb800df6ea40", "size": 3908, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "type-provider/Schema.idr", "max_stars_repo_name": "ethansr/IdrisSqlite", "max_stars_repo_head_hexsha": "72a3c934401ccc08f27cd1ea32e4beedc994de65", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 28, "max_stars_repo_stars_event_min_datetime": "2015-01-22T10:54:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-01T02:18:05.000Z", "max_issues_repo_path": "type-provider/Schema.idr", "max_issues_repo_name": "ethansr/IdrisSqlite", "max_issues_repo_head_hexsha": "72a3c934401ccc08f27cd1ea32e4beedc994de65", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2015-09-20T17:40:14.000Z", "max_issues_repo_issues_event_max_datetime": "2017-08-07T20:03:24.000Z", "max_forks_repo_path": "type-provider/Schema.idr", "max_forks_repo_name": "ethansr/IdrisSqlite", "max_forks_repo_head_hexsha": "72a3c934401ccc08f27cd1ea32e4beedc994de65", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2015-09-30T20:53:19.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-07T13:41:23.000Z", "avg_line_length": 32.5666666667, "max_line_length": 93, "alphanum_fraction": 0.6072159672, "num_tokens": 1300, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7772998611746912, "lm_q2_score": 0.6442251064863697, "lm_q1q2_score": 0.5007560858371057}}
{"text": "import Data.Vect\n\ndata WordState: (guesses_remaining: Nat) -> (letters: Nat) -> Type where\n  MkWordState: (word: String) -> (missing: Vect letters Char) -> WordState guesses_remaining letters\n\ndata Finished: Type where\n  Lost: (game: WordState 0 (S letters))   -> Finished\n  Won:  (game: WordState (S remaining) 0) -> Finished\n\ndata ValidInput: List Char -> Type where\n  Letter: (c: Char) -> ValidInput [c]\n\ntotal emptyNotValidInput : ValidInput [] -> Void\nemptyNotValidInput (Letter _) impossible\n\ntotal tooManyChars : ValidInput (x :: (y :: xs)) -> Void\ntooManyChars (Letter _) impossible\n\ntotal isValidInput: (chars: List Char) -> Dec (ValidInput chars)\nisValidInput [] = No emptyNotValidInput\nisValidInput (x :: []) = Yes(Letter x)\nisValidInput (x :: (y :: xs)) = No tooManyChars\n\nisValidString: (s: String) -> Dec(ValidInput(unpack s))\nisValidString s = isValidInput (unpack s)\n\nreadGuess: IO (x ** ValidInput x)\nreadGuess = do\n  putStr \"Guess: \"\n  userGuess <- getLine\n  case isValidString (toUpper userGuess) of\n    (Yes prf) => pure (_ ** prf)\n    (No contra) => do\n      putStrLn (\"Invalid guess = [\" ++ userGuess ++\"]\")\n      readGuess\n\nremoveElem: (value: a) -> (xs: Vect (S n) a) -> {auto prf: Elem value xs} -> Vect n a\nremoveElem             value (value :: ys) {prf = Here}          = ys\nremoveElem {n = Z}     value (y     :: []) {prf = (There later)} = absurd later\nremoveElem {n = (S k)} value (y     :: ys) {prf = (There later)} = y :: removeElem value ys\n\nprocessGuess: (letter: Char) ->\n              WordState (S guesses) (S letters) ->\n              Either (WordState guesses (S letters))\n                     (WordState (S guesses) letters)\nprocessGuess letter (MkWordState word missing) = case isElem letter missing of\n  (Yes prf) => Right (MkWordState word (removeElem letter missing))\n  (No contra) => Left (MkWordState word missing)\n\ngame: (state: WordState (S guesses) (S letters)) -> IO Finished\ngame {guesses} {letters} state = do\n  ([input] ** Letter input) <- readGuess\n  case processGuess input state of\n    (Left l) => do\n      putStrLn \"Wrong!\"\n      case guesses of\n        Z   => pure (Lost l)\n        S k => game l\n    (Right r) => do\n      putStrLn \"Right!\"\n      case letters of\n        Z => pure (Won r)\n        (S k) => game r\n\nmain: IO ()\nmain = \n  let\n    wordToGuess = MkWordState \"Test\" ['T', 'E', 'S']\n  in\n    do\n      result <- game {guesses=2} wordToGuess\n      case result of\n        (Lost (MkWordState word missing)) => putStrLn (\"You lost. The word was\" ++ word)\n        (Won game) => putStrLn \"You win\"\n", "meta": {"hexsha": "5f687a6cc0da5ebfd6b8bc538423664bc9c63c59", "size": 2558, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Hangman.idr", "max_stars_repo_name": "coffius/idris-exercises", "max_stars_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "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": "Hangman.idr", "max_issues_repo_name": "coffius/idris-exercises", "max_issues_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Hangman.idr", "max_forks_repo_name": "coffius/idris-exercises", "max_forks_repo_head_hexsha": "77cb2ab7247890ba38376b753611284458cece17", "max_forks_repo_licenses": ["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.1066666667, "max_line_length": 100, "alphanum_fraction": 0.6227521501, "num_tokens": 743, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303285397349, "lm_q2_score": 0.6334102567576901, "lm_q1q2_score": 0.5007300183750947}}
{"text": "module Toolkit.Data.List.Subset\n\nimport Toolkit.Decidable.Informative\n\n%default total\n\n\npublic export\ndata Subset : (eq   : a -> b -> Type)\n           -> (this : List a)\n           -> (that : List b)\n                   -> Type\n  where\n    Empty : Subset eq Nil Nil\n\n    EmptyThis : Subset eq Nil xs\n\n    Keep : {eq : a -> b -> Type}\n        -> (prf  :        eq  x       y)\n        -> (rest : Subset eq    xs      ys)\n                -> Subset eq (x::xs) (y::ys)\n\n    Skip : (rest : Subset eq xs     ys)\n                -> Subset eq xs (y::ys)\n\n\npublic export\ndata Error : Type -> Type where\n  EmptyThat : Error a\n  Fail : a -> Error a\n  FailThere : Error a -> Error a\n\nemptyThat : Subset eq (x :: xs) [] -> Void\nemptyThat Empty impossible\n\nyesButNo : {eq : a -> b -> Type}\n        -> {x : a} -> {xs : List a}\n        -> {y : b} -> {ys : List b}\n        -> (h : Subset eq     xs       ys -> Void)\n        -> (t : Subset eq (x::xs)      ys -> Void)\n             -> Subset eq (x::xs) (y::ys)\n             -> Void\nyesButNo h t (Keep prf rest) = h rest\nyesButNo h t (Skip rest) = t rest\n\njustNot : {eq : a -> b -> Type}\n       -> {x : a} -> {xs : List a}\n       -> {y : b} -> {ys : List b}\n       -> (eq x y -> Void)\n       -> (Subset eq (x :: xs) ys -> Void   )\n       -> Subset eq (x :: xs) (y :: ys)\n       -> Void\njustNot f g (Keep prf rest) = f prf\njustNot f g (Skip rest) = g rest\n\nexport\nsubset : {eq   : a -> b -> Type}\n      -> (test : (x : a) -> (y : b) -> DecInfo err (eq x y))\n      -> (this : List a)\n      -> (that : List b)\n              -> DecInfo (Error err) (Subset eq this that)\nsubset test [] []\n  = Yes Empty\n\nsubset test [] (x :: xs)\n  = Yes EmptyThis\n\nsubset test (x :: xs) []\n  = No EmptyThat emptyThat\n\nsubset test (x :: xs) (y :: ys) with (test x y)\n  subset test (x :: xs) (y :: ys) | (Yes prfHere) with (subset test xs ys)\n    subset test (x :: xs) (y :: ys) | (Yes prfHere) | (Yes prfThere)\n      = Yes (Keep prfHere prfThere)\n    subset test (x :: xs) (y :: ys) | (Yes prfHere) | (No msgWhyNot prfWhyNot) with (subset test (x::xs) ys)\n      subset test (x :: xs) (y :: ys) | (Yes prfHere) | (No msgWhyNot prfWhyNot) | (Yes prfThere)\n        = Yes (Skip prfThere)\n      subset test (x :: xs) (y :: ys) | (Yes prfHere) | (No msgWhyNotHere prfWhyNotHere) | (No msgWhyNotThere prfWhyNotThere)\n        = No (FailThere msgWhyNotThere)\n             (yesButNo prfWhyNotHere prfWhyNotThere)\n\n  subset test (x :: xs) (y :: ys) | (No msgWhyNotHere prfWhyNotHere) with (subset test (x::xs) ys)\n    subset test (x :: xs) (y :: ys) | (No msgWhyNotHere prfWhyNotHere) | (Yes prfThere)\n      = Yes (Skip prfThere)\n    subset test (x :: xs) (y :: ys) | (No msgWhyNotHere prfWhyNotHere) | (No msgWhyNotThere prfWhyNotThere)\n      = No (FailThere msgWhyNotThere)\n           (justNot prfWhyNotHere prfWhyNotThere)\n", "meta": {"hexsha": "214e753118cbd871d940d7632521eae6d7cc2a37", "size": 2820, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Toolkit/Data/List/Subset.idr", "max_stars_repo_name": "gallais/linear-circuits", "max_stars_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2020-11-03T11:33:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-14T17:11:38.000Z", "max_issues_repo_path": "src/Toolkit/Data/List/Subset.idr", "max_issues_repo_name": "gallais/linear-circuits", "max_issues_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "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/Toolkit/Data/List/Subset.idr", "max_forks_repo_name": "gallais/linear-circuits", "max_forks_repo_head_hexsha": "5d13d955eafc2d92beae363e96d3cec8695830f2", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-02-09T19:49:11.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-09T19:49:11.000Z", "avg_line_length": 32.0454545455, "max_line_length": 125, "alphanum_fraction": 0.5255319149, "num_tokens": 929, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7905303186696747, "lm_q2_score": 0.6334102498375401, "lm_q1q2_score": 0.5007300066527088}}
{"text": "import Data.Vect\n\n%default total\n\ninfix 3 .<=.\n(.<=.) : Int -> Int -> Bool\n(.<=.) p q = case (p, q) of\n  (0, _) => True\n  _ => False\n\ncountGreater : (thr : Int) -> (ctx : Vect n Int) -> Nat\ncountGreater thr [] = Z\ncountGreater thr (x :: xs) with (x .<=. thr)\n  countGreater thr (x :: xs) | True = countGreater thr xs\n  countGreater thr (x :: xs) | False = S $ countGreater thr xs\n\n-- map a variable from the old context to the erased context\n-- where we erase all bindings less than or equal to the threshold\neraseVar : (thr : Int) -> (ctx : Vect n Int) -> Fin n -> Maybe (Fin (countGreater thr ctx))\neraseVar thr (x :: xs) j with (x .<=. thr)\n  eraseVar thr (x :: xs) FZ | True = Nothing\n  eraseVar thr (x :: xs) FZ | False = Just FZ\n  eraseVar thr (x :: xs) (FS i) | True = FS <$> eraseVar thr xs i\n  eraseVar thr (x :: xs) (FS i) | False = FS <$> eraseVar thr xs i\n\nboom : Maybe (Fin 1)\nboom = eraseVar 0 [0, 1] (FS FZ)\n", "meta": {"hexsha": "f740e38a020f8240aae41f4fa5e7b2d80a0420fe", "size": 923, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "idris2/tests/idris2/reg023/boom.idr", "max_stars_repo_name": "Qqwy/Idris2-Erlang", "max_stars_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "idris2/tests/idris2/reg023/boom.idr", "max_issues_repo_name": "Qqwy/Idris2-Erlang", "max_issues_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "idris2/tests/idris2/reg023/boom.idr", "max_forks_repo_name": "Qqwy/Idris2-Erlang", "max_forks_repo_head_hexsha": "945f9c12d315d73bfda2d441bc5f9f20696b5066", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 32.9642857143, "max_line_length": 91, "alphanum_fraction": 0.602383532, "num_tokens": 311, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.8670357460591568, "lm_q2_score": 0.5774953651858118, "lm_q1q2_score": 0.5007091247995855}}
{"text": "module Example.Qtt.Zero\n\nimport Control.Monad.State\n\nimport Data.List\nimport Data.List.Quantifiers\n\nimport Data.Maybe\n\nimport Syntax.WithProof\n\n%default total\n\n-------------------------\n--- Bounded arguments ---\n-------------------------\n\nnamespace BoundedArgumentW\n\n  total\n  head : (l : List a) -> NonEmpty l => a\n  head (x::_) = x\n\nnamespace BoundedArgumentW_auto\n\n  total\n  head : (l : List a) -> {auto _ : NonEmpty l} -> a\n  head (x::_) = x\n\nnamespace BoundedArgument0_auto\n\n  total\n  head : (l : List a) -> {auto 0 _ : NonEmpty l} -> a\n  head (x::_) = x\n\nnamespace BoundedArgument0\n\n  total\n  head : (l : List a) -> (0 _ : NonEmpty l) => a\n  head (x::_) = x\n\n------------------------------------\n--- Meta-parameters in the \"the\" ---\n------------------------------------\n\nnamespace TheUsage\n\n  f : (MonadState Int m, MonadState Nat m, Monad m) => m Integer\n  f = put (the Int 0) *> natToInteger <$> get\n\n  Monad m => MonadState a (StateT (a, b) m) where\n    get = Builtin.fst <$> get\n    put x = put (x, !(snd <$> get))\n\n  Monad m => MonadState b (StateT (a, b) m) where\n    get = snd <$> get\n    put x = put (!(Builtin.fst <$> get), x)\n\n  f_mono : State (Int, Nat) Integer\n  f_mono = f\n\n  f_run : ((Int, Nat), Integer)\n  f_run = runState (1, 2) f\n\n---------------------------\n--- Proof-carrying code ---\n---------------------------\n\nnamespace SubsetAsLib\n\n  data Subset : (type : Type)\n             -> (pred : type -> Type)\n             -> Type\n    where\n      Element : (value : type)\n             -> (0 prf : pred value)\n             -> Subset type pred\n\nnamespace SubsetAsRecord\n\n  public export\n  record Subset type pred where\n    constructor Element\n    value : type\n    0 prf : pred value\n\nnamespace FiltersDPair\n\n  filt : (p : a -> Bool) -> List a -> List (x : a ** p x = True)\n  filt p [] = []\n  filt p (x::xs) = case @@ p x of\n    (True  ** prf) => (x ** prf) :: filt p xs\n    (False ** _)   => filt p xs\n\nnamespace FiltersSubset\n\n  filt : (p : a -> Bool) -> List a -> List $ Subset a (\\x => p x = True)\n  filt p [] = []\n  filt p (x::xs) = case @@ p x of\n    (True  ** prf) => Element x prf :: filt p xs\n    (False ** _)   => filt p xs\n\n-----------------------\n--- Match on erased ---\n-----------------------\n\npushIn : (xs : List a) -> (0 _ : All p xs) -> List $ Subset a p\npushIn []      []      = []\npushIn (x::xs) (p::ps) = Element x p :: pushIn xs ps\n\n---------------------\n--- Parametricity ---\n---------------------\n\nnamespace WithoutAsq\n\n  id : a -> a\n  id x = x\n\nnamespace WithForall\n\n  id : forall a. a -> a\n  id x = x\n\nnamespace WithWType\n\n  id : {a : Type} -> a -> a\n  id x = x\n\n  nonid : {a : Type} -> a -> a\n  nonid {a=Int}    x = x + 1\n  nonid {a=String} x = x ++ \"a\"\n  nonid x = x\n\nnamespace With0Type\n\n  id : {0 a : Type} -> a -> a\n  id x = x\n\n--------------------------------------\n--- Need to not to have at runtime ---\n--------------------------------------\n\nnamespace NotAtRuntime\n\n  -- data Nat = Z | S Nat\n\n  namespace Hiding\n\n    data BNat : Nat -> Type where\n      BZ : BNat 0\n      B0 : BNat n -> BNat (2*n)\n      B1 : BNat n -> BNat (1 + 2*n)\n\n    (+) : BNat n -> BNat m -> BNat (n + m)\n\n    toNat' : {n : Nat} -> BNat n -> Subset Nat (\\k => k = n)\n    toNat' x = Element n Refl\n\n    toNat : BNat n -> Subset Nat (\\k => k = n)\n    toNat BZ     = Element 0 Refl\n    toNat (B0 x) = let Element s prf = toNat x in\n                   Element (2*s) rewrite prf in Refl\n    toNat (B1 x) = let Element s prf = toNat x in\n                   Element (1 + 2*s) rewrite prf in Refl\n\n  namespace Exposing\n\n    data BNat : Nat -> Type where\n      BZ : BNat 0\n      B0 : {n : Nat} -> BNat n -> BNat (2*n)\n      B1 : {n : Nat} -> BNat n -> BNat (1 + 2*n)\n\n    toNat : BNat n -> Subset Nat (\\k => k = n)\n    toNat BZ         = Element 0 Refl\n    toNat (B0 {n} _) = Element (2*n) Refl\n    toNat (B1 {n} _) = Element (1 + 2*n) Refl\n", "meta": {"hexsha": "55100e45910d6f48ac58c2bd8cb9532c75ecc7a9", "size": 3855, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "2021.02.03-to-qtt-lecture/src/Example/Qtt/Zero.idr", "max_stars_repo_name": "buzden/code-in-lectures", "max_stars_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-02-17T07:01:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-17T07:01:15.000Z", "max_issues_repo_path": "2021.02.03-to-qtt-lecture/src/Example/Qtt/Zero.idr", "max_issues_repo_name": "buzden/code-in-lectures", "max_issues_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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": "2021.02.03-to-qtt-lecture/src/Example/Qtt/Zero.idr", "max_forks_repo_name": "buzden/code-in-lectures", "max_forks_repo_head_hexsha": "282eb243b1474a99a4d34c207bf40d4627fcc9d6", "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.6573033708, "max_line_length": 72, "alphanum_fraction": 0.491309987, "num_tokens": 1229, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.6791787121629466, "lm_q2_score": 0.7371581510799253, "lm_q1q2_score": 0.5006621237108825}}
{"text": "-- Non-strictly-positive recursion\ndata La : Type where\n  Lam : (La -> La) -> La\n\napp : La -> La -> La\napp (Lam f) x = f x\n\nselfApp : La\nselfApp = Lam \\x => app x x\n\nom : La\nom = app selfApp selfApp\n", "meta": {"hexsha": "ec446ee0a81c04d9f8cbb7f653a1da04a76d0704", "size": 199, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "NonPositiveRec.idr", "max_stars_repo_name": "buzden/idris-playground", "max_stars_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-01-23T08:24:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-27T02:45:50.000Z", "max_issues_repo_path": "NonPositiveRec.idr", "max_issues_repo_name": "buzden/idris-playground", "max_issues_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": "NonPositiveRec.idr", "max_forks_repo_name": "buzden/idris-playground", "max_forks_repo_head_hexsha": "414729c5dbd665fdb05cdfe5318f972fb277a726", "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": 15.3076923077, "max_line_length": 34, "alphanum_fraction": 0.5979899497, "num_tokens": 72, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.8289388083214156, "lm_q2_score": 0.6039318337259584, "lm_q1q2_score": 0.5006225345561632}}
{"text": "||| An expression language with mechanical proof of type-safety.\n|||\n||| `Variant` is an expression language supporting Let-bindings, and\n||| type unsafe variants.  Standard constructions are used to\n||| represent the language as an EDSL, together with proof of progress\n||| taken from PLFA Part 2.\n|||\n||| This module compliments Section 4.1 of the Functional Pearl.\n|||\nmodule Razor.Variant\n\nimport Razor.Common\n\n%default total\n\nnamespace Types\n\n  public export\n  data Ty = TyInt\n          | TyChar\n          | TyVariant (Vect (S n) (Pair String Ty))\n\nnamespace Terms\n  mutual\n    public export\n    data Case : (ctxt  : List Ty)\n             -> (label : String)\n             -> (type  : Ty)\n             -> (body  : Ty)\n             -> Type\n      where\n        MkCase : (label  : String)\n              -> (branch : Variant (ctxt +=    type) body)\n                        -> Case     ctxt label type body\n\n    public export\n    data Cases : (ctxt  : List Ty)\n              -> (types : Vect (S n) (Pair String Ty))\n              -> (body  : Ty)\n              -> Type\n      where\n          Singleton : (branch : Case  g   label  ty   b)\n                             -> Cases g [(label, ty)] b\n\n          Extend : (branch : Case  g   label  ty          b)\n                -> (rest   : Cases g                 kvs  b)\n                          -> Cases g ((label, ty) :: kvs) b\n\n\n    public export\n    data Variant : List Ty -> Ty -> Type where\n      -- Let-Binding & Variables\n      Var : Elem ty g -> Variant g ty\n\n      Let : {expr, body : Ty}\n         -> (this     : Variant        g  expr)\n         -> (beInThis : Variant (expr::g) body)\n                     -> Variant        g  body\n\n      -- Base Values\n      I : Int  -> Variant g TyInt\n      C : Char -> Variant g TyChar\n\n      -- Variants & Accessors\n      Tag : {kvs : Vect (S n) (Pair String Ty)}\n         -> (label : String)\n         -> (value : Variant g ty)\n         -> (prf   : Elem (label, ty) kvs)\n                  -> Variant g (TyVariant kvs)\n\n      Match : {kvs : Vect (S n) (Pair String Ty)}\n           -> {b : Ty}\n           -> (value : Variant g (TyVariant kvs))\n           -> (cases : Cases   g            kvs   b)\n                    -> Variant g                  b\n\n\nnamespace Renaming\n  public export\n  weaken : forall type\n         . (Contains  old           type -> Contains  new           type)\n        -> (Contains (old += type') type -> Contains (new += type') type)\n\n  weaken func Here         = Here\n  weaken func (There rest) = There (func rest)\n\n  mutual\n    namespace Case\n\n      public export\n      rename : (forall type . Contains old type -> Contains new type)\n            -> (forall type, body . Case old label type body\n                                 -> Case new label type body)\n      rename f (MkCase label branch)\n        = MkCase label (rename (weaken f) branch)\n\n    namespace Cases\n      public export\n      rename : (forall type . Contains (old) type -> Contains (new) type)\n            -> (forall types, type . Cases old types type\n                                  -> Cases new types type)\n      rename f (Singleton branch)\n        = Singleton (Case.rename f branch)\n      rename f (Extend branch rest)\n        = Extend (Case.rename f branch) (rename f rest)\n\n    public export\n    rename : (forall type . Contains old type -> Contains new type)\n          -> (forall type . Variant  old type -> Variant  new type)\n    -- Let-Bindings & Variables\n    rename f (Var x) = Var (f x)\n    rename f (Let this beInThis)\n      = Let (rename f this)\n            (rename (weaken f) beInThis)\n\n    -- Base Variables\n    rename f (I x) = I x\n    rename f (C x) = C x\n\n    -- Variants & Accesors\n    rename f (Tag label value prf) = Tag label (rename f value) prf\n    rename f (Match value cases) = Match (rename f value)\n                                         (Cases.rename f cases)\n\n\nnamespace Substitution\n  public export\n  weakens : forall old, new\n          . (f : forall type\n               . Contains old type\n              -> Variant  new type)\n         -> (forall type . Contains (old += type') type\n                        -> Variant  (new += type') type)\n  weakens f Here         = Var Here\n  weakens f (There rest) = rename There (f rest)\n\n  namespace General\n    mutual\n      namespace Case\n        public export\n        subst : (f : forall type\n                   . Contains old type\n                  -> Variant  new type)\n             -> (forall type, body . Case old label type body\n                                  -> Case new label type body)\n        subst f (MkCase label branch)\n          = MkCase label (subst (weakens f) branch)\n\n      namespace Cases\n        public export\n        subst : (f : forall type\n                   . Contains old type\n                  -> Variant new type)\n             -> (forall types, type . Cases old types type\n                                   -> Cases new types type)\n        subst f (Singleton branch)\n          = Singleton (Case.subst f branch)\n        subst f (Extend branch rest)\n          = Extend (Case.subst f branch) (subst f rest)\n\n\n      public export\n      subst : (forall type . Contains old type -> Variant new type)\n           -> (forall type . Variant  old type -> Variant new type)\n      -- Let-Bindings & Variables\n      subst f (Var x) = f x\n      subst f (Let this beInThis)\n        = Let (subst f this) (subst (weakens f) beInThis)\n\n      -- Base Values\n      subst f (I x) = I x\n      subst f (C x) = C x\n\n      -- Variants & Accessors\n      subst f (Tag label value prf)\n        = Tag label (subst f value) prf\n      subst f (Match value cases)\n        = Match (subst f value) (subst f cases)\n\n  namespace Single\n    public export\n    apply : (this : Variant ctxt typeB)\n         -> (idx  : Contains (ctxt += typeB) typeA)\n                 -> Variant ctxt typeA\n    apply this Here         = this\n    apply this (There rest) = Var rest\n\n    public export\n    subst : (this   : Variant  ctxt           typeB)\n         -> (inThis : Variant (ctxt += typeB) typeA)\n                   -> Variant  ctxt           typeA\n    subst {ctxt} {typeA} {typeB} this inThis\n       = General.subst (apply this) inThis\n\n\nnamespace Values\n\n  public export\n  data Value : Variant ctxt type -> Type where\n    -- Base Values\n    IV : Value (I i)\n    CV : Value (C c)\n\n    -- Variants\n    MkTagV : {kvs    : Vect (S n) (Pair String Ty)}\n          -> {value' : Variant Nil type}\n          -> (value  : Value value')\n          -> {prf    : Elem (label, type) kvs}\n                    -> Value (Tag label value' prf)\n\n\nnamespace Reduction\n\n  namespace Cases\n    public export\n    data Redux : (value  : Variant g type)\n              -> (cases  : Cases g kvs body)\n              -> (idx    : Elem (label, type) kvs)\n              -> (result : Variant g body)\n              -> Type\n      where\n        ReduceSingleton : {value : Variant g type}\n                                -> Value value\n                                -> Redux value\n                                         (Singleton (MkCase label branch))\n                                         Here\n                                         (subst value branch)\n        ReduceExtend : {value : Variant g type}\n                    -> {rest  : Cases g kvs body}\n                    -> Value value\n                    -> Redux value\n                             (Extend (MkCase label branch) rest)\n                             Here\n                             (Single.subst value branch)\n        SkipThis : Redux value rest later result\n                -> Redux value\n                         (Extend branch rest)\n                         (There later)\n                         result\n\n  public export\n  data Redux : (this, that : Variant ctxt type) -> Type where\n    -- Let Bindings\n    SimplifyLetValue : Redux this that\n                    -> Redux (Let this body)\n                             (Let that body)\n    ReduceLetBody : Value value\n                 -> Redux (Let value body)\n                          (subst value body)\n\n    -- Variants & Accessors\n    SimplifyTag : {kvs   : Vect (S n) (Pair String Ty)}\n               -> {prf   : Elem (label, type) kvs}\n               -> (redux : Redux this that)\n                        -> Redux (Tag label this prf) (Tag label that prf)\n\n    SimplifyMatchCase : {cases : Cases _ kvs type}\n                     -> (redux : Redux this that)\n                              -> Redux (Match this cases) (Match that cases)\n\n    ReduceCases : {kvs   : Vect (S n) (Pair String Ty)}\n               -> {idx   : Elem (label, type') kvs}\n               -> {value : Variant g type'}\n               -> {this  : Cases g kvs type}\n               -> {that  : Variant g type}\n               -> (prf   : Value value)\n               -> (redux : Redux value this idx that)\n                        -> Redux (Match (Tag label value idx) this)\n                                 that\n\n\nnamespace Progress\n\n  public export\n  data Progress : (term : Variant Nil type)\n                       -> Type\n    where\n      Done : {term  : Variant Nil type}\n          -> (value : Value term)\n                   -> Progress term\n\n      Step : {type       : Ty}\n          -> {this, that : Variant Nil type}\n          -> (step       : Redux this that)\n                        -> Progress this\n\n  namespace Cases\n    public export\n    data Progress : (label : String)\n                 -> (value : Variant Nil type)\n                 -> (idx   : Elem (label, type) kvs)\n                 -> (term  : Cases Nil kvs body)\n                 -> Type\n      where\n        Step : {value : Variant Nil type'}\n            -> {idx   : Elem (label, type') kvs}\n            -> {cases : Cases Nil kvs type}\n            -> {that  : Variant Nil type}\n            -> (step  : Redux value cases idx that)\n                    -> Progress label value idx cases\n  mutual\n    namespace Cases\n      public export\n      progress : {value' : Variant Nil type}\n              -> (idx    : Elem (label, type) kvs)\n              -> (value  : Value value')\n              -> (term   : Cases Nil kvs body)\n                        -> Progress label value' idx term\n      progress Here value (Singleton (MkCase label branch))\n        = Step (ReduceSingleton value)\n      progress Here value (Extend (MkCase label branch) rest)\n        = Step (ReduceExtend value)\n      progress (There later) value (Extend branch rest) with (progress later value rest)\n        progress (There later) value (Extend branch rest) | Step step\n          = Step (SkipThis step)\n\n\n\n    public export\n    progress : forall type . (term : Variant Nil type) -> Progress term\n    -- Let-Bindings & Variables\n    progress (Var _) impossible\n\n    progress (Let this beInThis) with (progress this)\n      progress (Let this beInThis) | (Done value) = Step (ReduceLetBody value)\n      progress (Let this beInThis) | (Step step) = Step (SimplifyLetValue step)\n\n    -- Base Values\n    progress (I x) = Done IV\n    progress (C x) = Done CV\n\n    -- Variants & Accessors\n    progress (Tag label value prf) with (progress value)\n      progress (Tag label value prf) | (Done value') = Done (MkTagV value')\n      progress (Tag label value prf) | (Step step) = Step (SimplifyTag step)\n\n    progress (Match value cases) with (progress value)\n      progress (Match (Tag label value' prf) cases) | (Done (MkTagV x)) with (progress prf x cases)\n        progress (Match (Tag label value' prf) cases) | (Done (MkTagV x)) | (Step step)\n          = Step (ReduceCases x step)\n      progress (Match value cases) | (Step step) = Step (SimplifyMatchCase step)\n\n\nnamespace Evaluation\n\n  public export\n  data Reduces : (this : Variant ctxt type)\n              -> (that : Variant ctxt type)\n              -> Type\n    where\n      Refl  : {this : Variant ctxt type}\n                   -> Reduces this this\n      Trans : {this, that, end : Variant ctxt type}\n           -> Redux this that\n           -> Reduces that end\n           -> Reduces this end\n\n  public export\n  data Finished : (term : Variant ctxt type)\n                       -> Type\n    where\n      Normalised : {term : Variant ctxt type}\n                -> (this : Value term)\n                        -> Finished term\n      OOF : Finished term\n\n  public export\n  data Evaluate : (term : Variant Nil type) -> Type where\n    RunEval : {this, that : Variant Nil type}\n           -> (steps      : Inf (Reduces this that))\n           -> (result     : Finished that)\n                         -> Evaluate this\n\n  public export\n  data Fuel = Empty | More (Lazy Fuel)\n\n  public export\n  covering\n  forever : Fuel\n  forever = More forever\n\n  public export\n  compute : (fuel : Fuel)\n         -> (term : Variant Nil type)\n                 -> Evaluate term\n  compute Empty term = RunEval Refl OOF\n  compute (More fuel) term with (progress term)\n    compute (More fuel) term | (Done value) = RunEval Refl (Normalised value)\n    compute (More fuel) term | (Step step {that}) with (compute fuel that)\n      compute (More fuel) term | (Step step {that = that}) | (RunEval steps result)\n        = RunEval (Trans step steps) result\n\npublic export\ncovering\nrun : (this : Variant Nil type)\n           -> Maybe (Subset (Variant Nil type) (Reduces this))\nrun this with (compute forever this)\n  run this | (RunEval steps (Normalised {term} x)) = Just (Element term steps)\n  run this | (RunEval steps OOF) = Nothing\n\n\nnamespace Examples\n\n  public export\n  ici : Variant Nil (TyVariant [(\"int\", TyInt), (\"char\", TyChar)])\n  ici = Tag \"int\" (I 1) Here\n\n  public export\n  icc : Variant Nil (TyVariant [(\"int\", TyInt), (\"char\", TyChar)])\n  icc = Tag \"char\" (C 'c') (There Here)\n\n  public export\n  iciM : Variant Nil TyInt\n  iciM = Match ici (Extend (MkCase \"int\" (Var Here)) (Singleton (MkCase \"char\" $ I 2)))\n\n  public export\n  iccM : Variant Nil TyInt\n  iccM = Match icc (Extend (MkCase \"int\" $ Var Here) (Singleton (MkCase \"char\" $ I 2)))\n\n{-\n  public export\n  snip : Variant Nil TyInt\n  snip = (Match (Tag \"int\" (I 1) Here) (Extend (MkCase \"int\" (Var Here))\n                                       (Singleton (MkCase \"char\" (I 2)))))\n-}\n", "meta": {"hexsha": "ab49c0da4716c7810986009e1da566be1286a124", "size": 14087, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Razor/Variant.idr", "max_stars_repo_name": "border-patrol/pearly-razors", "max_stars_repo_head_hexsha": "bc2677dda9171f8043e6cfb62ef4153e92c15714", "max_stars_repo_licenses": ["BSD-3-Clause-Clear"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-09-29T16:07:47.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-22T09:12:24.000Z", "max_issues_repo_path": "Razor/Variant.idr", "max_issues_repo_name": "border-patrol/pearly-razors", "max_issues_repo_head_hexsha": "bc2677dda9171f8043e6cfb62ef4153e92c15714", "max_issues_repo_licenses": ["BSD-3-Clause-Clear"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Razor/Variant.idr", "max_forks_repo_name": "border-patrol/pearly-razors", "max_forks_repo_head_hexsha": "bc2677dda9171f8043e6cfb62ef4153e92c15714", "max_forks_repo_licenses": ["BSD-3-Clause-Clear"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.0680751174, "max_line_length": 99, "alphanum_fraction": 0.5206218499, "num_tokens": 3426, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7520125737597972, "lm_q2_score": 0.6654105521116443, "lm_q1q2_score": 0.5003971019004053}}
{"text": "test : Nat -> Int\ntest n =\n  let c = if n == Z then 0 else 1\n  in c\n", "meta": {"hexsha": "8278a16ae29df4a3a147d4f2f4741ba88e56af10", "size": 68, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "tests/idris2/error017/Issue962-case.idr", "max_stars_repo_name": "ska80/idris-jvm", "max_stars_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 396, "max_stars_repo_stars_event_min_datetime": "2016-07-17T08:00:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T22:47:13.000Z", "max_issues_repo_path": "tests/idris2/error017/Issue962-case.idr", "max_issues_repo_name": "ska80/idris-jvm", "max_issues_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2016-08-04T06:13:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-03T04:00:31.000Z", "max_forks_repo_path": "tests/idris2/error017/Issue962-case.idr", "max_forks_repo_name": "ska80/idris-jvm", "max_forks_repo_head_hexsha": "66223d026d034578876b325e9fcd95874faa6052", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 28, "max_forks_repo_forks_event_min_datetime": "2016-09-15T15:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-27T13:05:48.000Z", "avg_line_length": 13.6, "max_line_length": 33, "alphanum_fraction": 0.5294117647, "num_tokens": 28, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7025300573952052, "lm_q2_score": 0.7122321842389469, "lm_q1q2_score": 0.5003645172720997}}
{"text": "-- f1 : (a:Type) -> (x:a) -> (y:x) -> x\n-- f1 a x y = y\n\nhej : (tyOp : List Type -> Type) -> Type\nhej tyOp = tyOp [Int, Bool]\n\nhej2 : List Type -> Type\nhej2 (t :: ts) = t\n\ntest21 : Type\ntest21 = hej2 [Type]  -- test21 == Type\n\ntest22 : Type\ntest22 = hej2 [Int]   -- test22 == Int\n", "meta": {"hexsha": "8cacd3225cd275bb87541fe362a6a76be634f2b2", "size": 280, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "univ.idr", "max_stars_repo_name": "hjorthjort/IdrisToAgda", "max_stars_repo_head_hexsha": "a5f65e28cc9fdfefde49e7d8cf84486601b9e7b1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-02-16T23:22:50.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-29T20:42:43.000Z", "max_issues_repo_path": "univ.idr", "max_issues_repo_name": "hjorthjort/IdrisToAgda", "max_issues_repo_head_hexsha": "a5f65e28cc9fdfefde49e7d8cf84486601b9e7b1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-11-28T17:52:42.000Z", "max_issues_repo_issues_event_max_datetime": "2019-11-28T17:52:42.000Z", "max_forks_repo_path": "univ.idr", "max_forks_repo_name": "hjorthjort/IdrisToAgda", "max_forks_repo_head_hexsha": "a5f65e28cc9fdfefde49e7d8cf84486601b9e7b1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-27T16:25:18.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-27T16:25:18.000Z", "avg_line_length": 18.6666666667, "max_line_length": 40, "alphanum_fraction": 0.5321428571, "num_tokens": 120, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7853085909370422, "lm_q2_score": 0.6370307944803832, "lm_q1q2_score": 0.5002657555968942}}
{"text": "module Control.Monad.Indexed\n\n%access public\n%default total\n\n\nclass IndexedFunctor (f : Type -> Type -> Type -> Type) where\n  imap : (a -> b) -> f i i a -> f i i b\n\n-- f\u304cIndexedFunctor\u306a\u6642\u70b9\u3067\u3001f\u306e\u7a2e\u306f\u78ba\u5b9a\u3059\u308b\u3068\u601d\u3046\u306e\u3060\u304c\u3001\u660e\u793a\u3057\u306a\u3044\u3068\u53d7\u3051\u4ed8\u3051\u3066\u304f\u308c\u306a\u3044...\ninfixl 2 <:$>\nclass IndexedFunctor f => IndexedApplicative (f : Type -> Type -> Type -> Type) where\n  ipure : a -> f i i a\n  (<:$>) : f i i (a -> b) -> f i i a -> f i i b\n\ninfixl 2 :>>=\nclass IndexedApplicative f => IndexedMonad (f : Type -> Type -> Type -> Type) where\n  (:>>=) : f j k x -> (x -> f j k a) -> f i k a\n\niflatten : IndexedMonad f => f i j (f i j a) -> f i j a\niflatten a = a :>>= id\n\nireturn : IndexedMonad f => a -> f i i a\nireturn = ipure\n\n", "meta": {"hexsha": "f5d58c09017d1491d005413ebc09a00447d9f1b9", "size": 680, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "Control/Monad/Indexed.idr", "max_stars_repo_name": "seagull-kamome/idris-toy", "max_stars_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-06-04T16:11:33.000Z", "max_stars_repo_stars_event_max_datetime": "2016-06-04T16:11:33.000Z", "max_issues_repo_path": "Control/Monad/Indexed.idr", "max_issues_repo_name": "seagull-kamome/idris-toy", "max_issues_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "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": "Control/Monad/Indexed.idr", "max_forks_repo_name": "seagull-kamome/idris-toy", "max_forks_repo_head_hexsha": "5e4b7c5969fab57dedac314d972211affc6e4785", "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": 26.1538461538, "max_line_length": 85, "alphanum_fraction": 0.5911764706, "num_tokens": 267, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.785308580887758, "lm_q2_score": 0.6370307944803832, "lm_q1q2_score": 0.5002657491951908}}
{"text": "module Tests.Array\n\nimport TypeTrans.Array\nimport Data.Vect\n\nassertEq : Eq a => (given : a) -> (expected : a) -> IO ()\nassertEq g e = if g == e\n    then putStrLn \"Test Passed\"\n    else putStrLn \"Test Failed\"\n\nassertNotEq : Eq a => (given : a) -> (expected : a) -> IO ()\nassertNotEq g e = if not (g == e)\n    then putStrLn \"Test Passed\"\n    else putStrLn \"Test Failed\"\n\nassertTrue : Bool -> IO ()\nassertTrue b = if b\n                then putStrLn \"Test Passed\"\n                else putStrLn \"Test Failed\"\n\nassertFalse : Bool -> IO ()\nassertFalse b = assertTrue (not b)\n\n\ntestRedDim : IO ()\ntestRedDim = assertEq (redDim arr) reducedArr\n\n  where arr : Array [3, 3] Int\n        arr = [[2,3,7], [4,2,6], [5,7,9]]\n\n        reducedArr : Array [9] Int\n        reducedArr = [2,3,7,4,2,6,5,7,9]\n\n        \n\ntestIncDim : IO ()\ntestIncDim = assertEq (incDim arr) incArr\n\n  where arr : Array [2 * 2] Int\n        arr = [2, 3, 4, 5]\n\n        incArr : Array [2,2] Int\n        incArr = [[2, 3], [4, 5]]\n\n\ntestIncDimFactor : IO ()\ntestIncDimFactor = assertEq (incDim $ reshapeByFactor 3 arr) incArr\n    \n    where arr : Array [3] Int\n          arr = [27, 10, 2]\n\n          incArr : Array [3, 1] Int\n          incArr = [[27], [10], [2]]\n\n\n-- Test reducing dimensions, and then increasing\n-- results in the same initial Array\ntestRedInc : IO ()\ntestRedInc = assertEq (incDim $ redDim arr') arr'\n \n  where arr' : Array [3, 3] Int\n        arr' = [[1,3,7], [4,2,6], [5,7,9]]\n\n\n-- Test increasing dimensions and then reducing\n-- results in the same initial Array\ntestIncRed : IO ()\ntestIncRed = assertEq (redDim $ incDim $ reshapeByFactor 3 arr) arr\n             \n where \n       arr : Array [3] Int\n       arr = [27, 10, 2]\n\n{-\ntestIncFactors : IO ()\ntestIncFactors = do\n    assertTrue res0\n\n  where arr : Array [8] Int\n        arr = [1, 2, 3, 4, 5, 6, 7, 8]\n        \n        arr0 : Array [1, 8] Int\n        arr0 = [[1, 2, 3, 4, 5, 6, 7, 8]]\n\n        res0 : Bool\n        res0  with (splitNFactor 0 arr) \n                | (_ ** xs) = xs == arr0  \n-}\n\n\n\ntestSplitting : IO ()\ntestSplitting = do \n                  printSplitArr\n  where\n\n    arr : Array [20] Int\n    arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];\n\n    arr2 : (xs ** Array (1::xs) Int)\n    arr2 = ([1,1] ** [[[1]]])\n\n    liftArr : Array [S x] Int -> (xs ** Array ((S x)::xs) Int)\n    liftArr vs = ([] ** vs)\n\n    printSplitArr : IO()\n    printSplitArr with  (liftArr arr)\n      | (vs ** xs) = printArrs (splitFactorsGeneric xs) {t=Int} \n\n    test20 : Array (x::xs) t -> IO ()\n    test20 a = print \"todo\"\n\n    test10 : IO ()\n    test10 with (arr2) \n      | (_ ** xs) = test20 xs\n", "meta": {"hexsha": "7fc0374098a35f31f2535a62c7af68da0a47c662", "size": 2650, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Tests/Array.idr", "max_stars_repo_name": "RossMeikleham/MSci-Project", "max_stars_repo_head_hexsha": "4e1e3e08bf8440add18b4a87b96ca42920336e14", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2015-10-20T11:17:45.000Z", "max_stars_repo_stars_event_max_datetime": "2015-10-20T11:17:45.000Z", "max_issues_repo_path": "src/Tests/Array.idr", "max_issues_repo_name": "RossMeikleham/MSci-Project", "max_issues_repo_head_hexsha": "4e1e3e08bf8440add18b4a87b96ca42920336e14", "max_issues_repo_licenses": ["MIT"], "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/Tests/Array.idr", "max_forks_repo_name": "RossMeikleham/MSci-Project", "max_forks_repo_head_hexsha": "4e1e3e08bf8440add18b4a87b96ca42920336e14", "max_forks_repo_licenses": ["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.8448275862, "max_line_length": 82, "alphanum_fraction": 0.541509434, "num_tokens": 914, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES", "lm_q1_score": 0.7154240079185318, "lm_q2_score": 0.6992544085240401, "lm_q1q2_score": 0.5002633915009711}}
{"text": "module Data.SOP.NP\n\nimport Data.List.Elem\nimport Data.SOP.Utils\nimport Data.SOP.Interfaces\n\nimport Decidable.Equality\n\n%default total\n\n||| An n-ary product.\n|||\n||| The product is parameterized by a type constructor f and indexed by a\n||| type-level list ks. The length of the list determines the number of\n||| elements in the product, and if the i-th element of the list is of type k,\n||| then the i-th element of the product is of type f k.\n|||\n||| Two common instantiations of f are the identity functor I and the constant\n||| functor K. For I, the product becomes a heterogeneous list, where the\n||| type-level list describes the types of its components.  For K a, the product\n||| becomes a homogeneous list, where the contents of the type-level list are\n||| ignored, but its length still specifies the number of elements.\n|||\n||| In the context of the SOP approach to generic programming, an n-ary product\n||| describes the structure of the arguments of a single data constructor.\n|||\n||| Note: `NP_` takes an additional type parameter `k` to simulate\n|||       Haskell's kind polymorphism. In theory, this could be left\n|||       as an implicit argument. However, type-inference when calling\n|||       interface functions like `hpure` was rather poor with `k`\n|||       being implicit.\n|||\n|||       We therefore made `k` explicit and added a type alias `NP`\n|||       to be used in those occasions when `k` can be inferred.\n|||\n||| Examples:\n|||\n||| ```idris example\n||| ex1 : NP I [Char,Bool]\n||| ex1 = ['c',False]\n|||\n||| ex2 : NP (K String) [Char,Bool,Int]\n||| ex2 = [\"Hello\",\"World\",\"!\"]\n|||\n||| ex3 : NP Maybe [Char,Bool,Int]\n||| ex3 = [Just 'x', Nothing, Just 1]\n||| ```\npublic export\ndata NP_ : (k : Type) -> (f : k -> Type) -> (ks : List k) -> Type where\n  Nil  : NP_ k f []\n  (::) : (v : f t) -> (vs : NP_ k f ks) -> NP_ k f (t :: ks)\n\n||| Type alias for `NP_` with type parameter `k` being\n||| implicit. This reflects the kind-polymorphic data type\n||| in Haskell.\npublic export\nNP : {k : Type} -> (f : k -> Type) -> (ks : List k) -> Type\nNP = NP_ k\n\n||| Changes an n-ary product to the identity context `I`\n||| by adjusting the types of stored values accordingly.\npublic export\ntoI : NP_ k f ks -> NP I (map f ks)\ntoI []       = []\ntoI (h :: t) = h :: toI t\n\n--------------------------------------------------------------------------------\n--          Specialized Interface Functions\n--------------------------------------------------------------------------------\n\n||| Specialiced version of `hmap`\npublic export\nmapNP : (fun : forall a . f a -> g a) -> NP f ks -> NP g ks\nmapNP fun []        = []\nmapNP fun (v :: vs) = fun v :: mapNP fun vs\n\n||| Specialization of `hpure`.\npublic export\npureNP : {ks : _} -> (forall a . f a) -> NP f ks\npureNP {ks = []}     _ = []\npureNP {ks = _ :: _} f = f :: pureNP f\n\n||| Specialization of `hap`.\npublic export\nhapNP : NP (\\a => f a -> g a) ks -> NP f ks -> NP g ks\nhapNP []        []        = []\nhapNP (f :: fs) (v :: vs) = f v :: hapNP fs vs\n\n||| Specialization of `hfoldl`\npublic export\nfoldlNP : (fun : acc -> el -> acc) -> acc -> NP (K el) ks -> acc\nfoldlNP _   acc []        = acc\nfoldlNP fun acc (v :: vs) = foldlNP fun (fun acc v) vs\n\n||| Specialization of `hfoldr`\npublic export\nfoldrNP : (fun : el -> Lazy acc -> acc) -> Lazy acc -> NP (K el) ks -> acc\nfoldrNP _   acc []        = acc\nfoldrNP fun acc (v :: vs) = fun v (foldrNP fun acc vs)\n\n||| Specialization of `hsequence`\npublic export\nsequenceNP : Applicative g => NP (\\a => g (f a)) ks -> g (NP f ks)\nsequenceNP []        = pure []\nsequenceNP (v :: vs) = [| v :: sequenceNP vs |]\n\n||| Specialization of `hcollapse`\npublic export\ncollapseNP : NP (K a) ks -> List a\ncollapseNP []        = []\ncollapseNP (v :: vs) = v :: collapseNP vs\n\n--------------------------------------------------------------------------------\n--          Core Functions\n--------------------------------------------------------------------------------\n\n||| Returns the head of a non-empty n-ary product\npublic export\nhd : NP f (k :: ks) -> f k\nhd (v :: _) = v\n\n||| Returns the tail of a non-empty n-ary product\npublic export\ntl : NP f (k :: ks) -> NP f ks\ntl (_ :: vs) = vs\n\n||| Tries to creates a homogeneous n-ary product of the given\n||| shape from a list of values.\npublic export\nfromListNP : NP f ks -> List a -> Maybe (NP (K a) ks)\nfromListNP []       []        = Just []\nfromListNP []       (_ :: _)  = Nothing\nfromListNP (_ :: _) []        = Nothing\nfromListNP (_ :: t) (x :: xs) = (x ::) <$> fromListNP t xs\n\n||| Like `fromListNP` but takes the shape from the implicit\n||| list of types.\npublic export\nfromList : {ks : _} -> List a -> Maybe (NP (K a) ks)\nfromList = fromListNP (pureNP ())\n\n||| Creates a homogeneous n-ary product of the given\n||| shape by repeatedly applying a function to a seed value.\npublic export\nunfoldNP : NP f ks -> (s -> (s,a)) -> s -> NP (K a) ks\nunfoldNP []       _ _ = []\nunfoldNP (_ :: t) g s = let (s2,v) = g s\n                         in v :: unfoldNP t g s2\n\n||| Like `unfoldNP` but takes the shape from the implicit\n||| list of types.\npublic export\nunfold : {ks : _} -> (s -> (s,a)) -> s -> NP (K a) ks\nunfold = unfoldNP (pureNP ())\n\n||| Creates a homogeneous n-ary product of the given\n||| shape using an initial value and a function for\n||| generating the next value.\npublic export\niterateNP : NP f ks -> (a -> a) -> a -> NP (K a) ks\niterateNP np f = unfoldNP np (\\v => (f v, v))\n\n||| Like `iterate` but takes the shape from the implicit\n||| list of types.\npublic export\niterate : {ks : _} -> (a -> a) -> a -> NP (K a) ks\niterate = iterateNP (pureNP ())\n\n||| A projection of an n-ary product p extracts the\n||| value of p at a certain position.\npublic export\n0 Projection : (f : k -> Type) -> (ks : List k) -> (v : k) -> Type\nProjection f ks v = NP f ks -> f v\n\n||| The set of projections of an n-ary product `NP f ks` can\n||| itself be wrapped in an n-ary product of the same shape.\npublic export\nprojections : {ks : _} -> NP (Projection f ks) ks\nprojections {ks = []}       = []\nprojections {ks = (_ :: _)} = hd :: mapNP (. tl) projections\n\n--------------------------------------------------------------------------------\n--          Accessing Values\n--------------------------------------------------------------------------------\n\n||| Access the first element of the given type in\n||| an n-ary product\npublic export\nget : (0 t : k) -> {auto prf : Elem t ks} -> NP_ k f ks -> f t\nget t {prf = Here}    (v :: _) = v\nget t {prf = There _} (_ :: vs) = get t vs\n\n--------------------------------------------------------------------------------\n--          Modifying Values\n--------------------------------------------------------------------------------\n\n||| Modify a single element of the given type\n||| in an n-ary product, thereby possibly changing the\n||| types of stored values.\npublic export\nmodify :  (fun : f t -> f t')\n       -> {auto prf : UpdateOnce t t' ks ks'}\n       -> NP_ k f ks\n       -> NP_ k f ks'\nmodify fun {prf = UpdateHere}    (v :: vs) = fun v :: vs\nmodify fun {prf = UpdateThere _} (v :: vs) = v :: modify fun vs\n\n||| Modify a single element of the given type\n||| in an n-ary product by applying an effectful\n||| function.\n|||\n||| This is the effectful version of `modify`.\npublic export\nmodifyF :  Functor g\n        => (fun : f t -> g (f t'))\n        -> {auto prf : UpdateOnce t t' ks ks'}\n        -> NP_ k f ks\n        -> g (NP_ k f ks')\nmodifyF fun {prf = UpdateHere}    (v :: vs) = (:: vs) <$> fun v\nmodifyF fun {prf = UpdateThere _} (v :: vs) = (v ::)  <$> modifyF fun vs\n\n||| Modify several elements of the given type\n||| in an n-ary product, thereby possibly changing the\n||| types of stored values.\npublic export\nmodifyMany :  (fun : f t -> f t')\n           -> {auto prf : UpdateMany t t' ks ks'}\n           -> NP_ k f ks\n           -> NP_ k f ks'\nmodifyMany f {prf = UMNil}        []      = []\nmodifyMany f {prf = UMConsSame x} (v::vs) = f v :: modifyMany f vs\nmodifyMany f {prf = UMConsDiff x} (v::vs) = v   :: modifyMany f vs\n\n||| Modify several elements of the given type\n||| in an n-ary product by applying an effectful function.\n|||\n||| This is the effectful version of `modifyMany`.\npublic export\nmodifyManyF :  Applicative g\n            => (fun : f t -> g (f t'))\n            -> {auto prf : UpdateMany t t' ks ks'}\n            -> NP_ k f ks\n            -> g (NP_ k f ks')\nmodifyManyF f {prf = UMNil}        []      = pure []\nmodifyManyF f {prf = UMConsSame x} (v::vs) = [| f v :: modifyManyF f vs |]\nmodifyManyF f {prf = UMConsDiff x} (v::vs) = (v ::) <$> modifyManyF f vs\n\n||| Replaces the first element of the given type\n||| in an n-ary product, thereby possibly changing the\n||| types of stored values.\npublic export %inline\nsetAt :  (0 t : k)\n      -> (v' : f t')\n      -> {auto prf : UpdateOnce t t' ks ks'}\n      -> NP_ k f ks\n      -> NP_ k f ks'\nsetAt t v' = modify {t = t} (const v')\n\n||| Replaces several elements of the given type\n||| in an n-ary product, thereby possibly changing the\n||| types of stored values.\npublic export %inline\nsetAtMany :  (0 t : k)\n          -> (v' : f t')\n          -> {auto prf : UpdateMany t t' ks ks'}\n          -> NP_ k f ks\n          -> NP_ k f ks'\nsetAtMany t v' = modifyMany {t = t} (const v')\n\n||| Alias for `setAt` for those occasions when\n||| Idris cannot infer the type of the new value.\npublic export %inline\nsetAt' :  (0 t  : k)\n       -> (0 t' : k)\n       -> (v' : f t')\n       -> {auto prf : UpdateOnce t t' ks ks'}\n       -> NP_ k f ks\n       -> NP_ k f ks'\nsetAt' t _ v' np = setAt t v' np\n\n||| Alias for `setAtMany` for those occasions when\n||| Idris cannot infer the type of the new value.\npublic export %inline\nsetAtMany' :  (0 t  : k)\n           -> (0 t' : k)\n           -> (v' : f t')\n           -> {auto prf : UpdateMany t t' ks ks'}\n           -> NP_ k f ks\n           -> NP_ k f ks'\nsetAtMany' t _ v' np = setAtMany t v' np\n\n--------------------------------------------------------------------------------\n--          Narrowing and expanding products\n--------------------------------------------------------------------------------\n\n||| Extracts a subset of values from an n-ary product.\n||| The values must appear in the same order in both lists.\npublic export\nnarrow : NP f ks -> {auto prf: Sublist ks' ks} -> NP f ks'\nnarrow x         {prf = SLNil}    = []\nnarrow (v :: vs) {prf = SLSame y} = v :: narrow vs\nnarrow (_ :: vs) {prf = SLDiff y} = narrow vs\n\n||| Appends two n-ary products.\npublic export\nappend : NP f ks -> NP f ks' -> NP f (ks ++ ks')\nappend []        y = y\nappend (v :: vs) y = v :: append vs y\n\n||| Expands an n-ary product by filling missing\n||| values with the given default-generating function.\npublic export\nexpand :  {ks' : List k}\n       -> (forall k . f k)\n       -> NP f ks\n       -> {auto prf : Sublist ks ks'}\n       -> NP f ks'\nexpand f []                         = pureNP f\nexpand f (v :: vs) {prf = SLSame x} = v :: expand f vs\nexpand f vs        {prf = SLDiff x} = f :: expand f vs\n\n||| Expands an n-ary product by filling missing\n||| values with the given default-generating function.\n|||\n||| This is the constrained version of `expand`.\npublic export\ncexpand :  (0 c : k -> Type)\n        -> (cs : NP c ks')\n        => (forall k . c k => f k)\n        -> {auto prf : Sublist ks ks'}\n        -> NP_ k f ks\n        -> NP_ k f ks'\ncexpand c {cs = []}   f []                         = []\ncexpand c {cs = _::_} f []                         = f :: cexpand c f []\ncexpand c {cs = _::_} f (v :: vs) {prf = SLSame x} = v :: cexpand c f vs\ncexpand c {cs = _::_} f vs        {prf = SLDiff x} = f :: cexpand c f vs\n\n--------------------------------------------------------------------------------\n--          Interface Conversions\n--------------------------------------------------------------------------------\n\n||| This is needed to implement `Ord` below.\npublic export %hint\nordToEqNP : NP (Ord . f) ks -> NP (Eq . f) ks\nordToEqNP = mapNP (\\_ => materialize Eq)\n\n||| This is needed to implement `Monoid` below.\npublic export %hint\nmonoidToSemigroupNP : NP (Monoid . f) ks -> NP (Semigroup . f) ks\nmonoidToSemigroupNP = mapNP (\\_ => materialize Semigroup)\n\n--------------------------------------------------------------------------------\n--          Implementations\n--------------------------------------------------------------------------------\n\npublic export %inline\nHPure k (List k) (NP_ k) where hpure  = pureNP\n\npublic export %inline\nHFunctor k (List k) (NP_ k) where hmap  = mapNP\n\npublic export %inline\nHAp k (List k) (NP_ k) (NP_ k) where hap = hapNP\n\npublic export %inline\nHFold k (List k) (NP_ k) where\n  hfoldl = foldlNP\n  hfoldr = foldrNP\n\npublic export %inline\nHCollapse k (List k) (NP_ k) List where hcollapse = collapseNP\n\npublic export %inline\nHSequence k (List k) (NP_ k) where hsequence = sequenceNP\n\npublic export\n(all : NP (Eq . f) ks) => Eq (NP_ k f ks) where\n  (==) {all = []}     [] []               = True\n  (==) {all = _ :: _} (v :: vs) (w :: ws) = v == w && vs == ws\n\npublic export\n(all : NP (Ord . f) ks) => Ord (NP_ k f ks) where\n  compare {all = []}     [] []               = EQ\n  compare {all = _ :: _} (v :: vs) (w :: ws) = compare v w <+> compare vs ws\n\npublic export\n(all : NP (Semigroup . f) ks) => Semigroup (NP_ k f ks) where\n  (<+>) {all = []}     [] []               = []\n  (<+>) {all = _ :: _} (v :: vs) (w :: ws) = (v <+> w) :: (vs <+> ws)\n\npublic export\n(all : NP (Monoid . f) ks) => Monoid (NP_ k f ks) where\n  neutral {all = []}     = []\n  neutral {all = _ :: _} = neutral :: neutral\n\npublic export\n(all : NP (Show . f) ks) => Show (NP_ k f ks) where\n  show =  dispStringList . hcollapse . hcmap (Show . f) show\n\nprivate\nconsInjective : Data.SOP.NP.(::) a b = Data.SOP.NP.(::) c d -> (a = c, b = d)\nconsInjective Refl = (Refl, Refl)\n\npublic export\n(all : NP (DecEq . f) ks) => DecEq (NP_ k f ks) where\n  decEq {all = []}     []        []        = Yes Refl\n  decEq {all = _::_} (v::vs) (w::ws) with (decEq v w)\n    decEq {all = _::_} (v::vs) (w::ws) | (No contra) =\n      No $ contra . fst . consInjective\n    decEq {all = _::_} (v::vs) (v::ws) | (Yes Refl) with (decEq vs ws)\n      decEq {all = _::_} (v::vs) (v::vs) | (Yes Refl) | (Yes Refl) = Yes Refl\n      decEq {all = _::_} (v::vs) (v::ws) | (Yes Refl) | (No contra) =\n        No $ contra . snd . consInjective\n\n--------------------------------------------------------------------------------\n--          Examples and Tests\n--------------------------------------------------------------------------------\n\nEx1 : NP I [Char,Bool]\nEx1 = ['c',True]\n\nEx2 : NP Maybe [Int,Int,Int]\nEx2 = [Nothing,Nothing,Just 2]\n\nEx3 : NP (K String) [Char,Bool,Int]\nEx3 = [\"Hello\",\"World\",\"!\"]\n\nEqTest1 : Ex1 == Ex1 = True\nEqTest1 = Refl\n\nEqTest2 : Ex1 == ['x',False] = False\nEqTest2 = Refl\n\nOrdTest1 : compare Ex1 Ex1 = EQ\nOrdTest1 = Refl\n\nOrdTest2 : compare Ex1 ['x',False] = LT\nOrdTest2 = Refl\n\nHdTest : hd Ex1 = 'c'\nHdTest = Refl\n\nTlTest : tl Ex1 = [True]\nTlTest = Refl\n\nSemiTest : the (NP I [String]) [\"hello\"] <+> [\"world\"] = [\"helloworld\"]\nSemiTest = Refl\n\nNeutralTest : the (NP I [String,List Int]) Prelude.neutral = [\"\",[]]\nNeutralTest = Refl\n\nHMapTest : hmap Just Ex1 = [Just 'c', Just True]\nHMapTest = Refl\n\nHCMapRes : NP (K String) [Char,Bool]\nHCMapRes = hcmap Show show Ex1\n\nHPureTest : NP Maybe [String,Int]\nHPureTest = hpure Nothing\n\nCPureNeutralTest : NP I [String,String]\nCPureNeutralTest = hcpure Monoid neutral\n\nPerson : (f : Type -> Type) -> Type\nPerson f = NP f [String,Int]\n\ntoPersonMaybe : Person I -> Person Maybe\ntoPersonMaybe = hmap Just\n\npersonShowValues : Person I -> Person (K String)\npersonShowValues = hcmap Show show\n\nemptyPerson : Person Maybe\nemptyPerson = hpure Nothing\n\nfooPerson : Person (K String)\nfooPerson = hconst \"foo\"\n\nFoo : (f : Type -> Type) -> Type\nFoo f = NP f [String,String,List Int]\n\nneutralFoo : Foo I\nneutralFoo = hcpure Monoid neutral\n\nupdate : forall a . Maybe a -> I a -> I a\nupdate (Just a) _ = a\nupdate Nothing  a = a\n\nupdatePerson : Person (\\a => a -> a)\nupdatePerson = hmap update [Just \"foo\", Nothing]\n\nupdatedPerson : Person I\nupdatedPerson = hap updatePerson [\"bar\",12]\n\nseqMaybe : NP Maybe [Int,String] -> Maybe (NP I [Int,String])\nseqMaybe = hsequence\n\nhtraverseEx : NP (Either String) [Int,String] -> Maybe (NP I [Int,String])\nhtraverseEx = htraverse (either (const Nothing) Just)\n\ninterface Read a where\n  read : String -> Maybe a\n\nhctraverseEx : NP Read [Int,String] => NP (K String) [Int,String] -> Maybe (NP I [Int,String])\nhctraverseEx = hctraverse Read read\n\nsubproductEx : NP I [Int,String,Bool,Maybe Bool] -> NP I [Int,Bool]\nsubproductEx np = narrow np\n", "meta": {"hexsha": "35b534229daf05ed9df437f042304c148e4e69ca", "size": 16566, "ext": "idr", "lang": "Idris", "max_stars_repo_path": "src/Data/SOP/NP.idr", "max_stars_repo_name": "buzden/idris2-sop", "max_stars_repo_head_hexsha": "af9224510f5c283f3b3c8293524e51c225617658", "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/Data/SOP/NP.idr", "max_issues_repo_name": "buzden/idris2-sop", "max_issues_repo_head_hexsha": "af9224510f5c283f3b3c8293524e51c225617658", "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": "src/Data/SOP/NP.idr", "max_forks_repo_name": "buzden/idris2-sop", "max_forks_repo_head_hexsha": "af9224510f5c283f3b3c8293524e51c225617658", "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": 32.5461689587, "max_line_length": 94, "alphanum_fraction": 0.5455752747, "num_tokens": 4963, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. YES\n2. YES\n\n", "lm_q1_score": 0.7154239957834733, "lm_q2_score": 0.6992544147913994, "lm_q1q2_score": 0.5002633874992972}}
