idris

    2熱度

    1回答

    根據https://homes.cs.washington.edu/~jrw12/InductionExercises.html我試圖證明sum和sum_cont是等價的。我到: sum : List Nat -> Nat sum [] = 0 sum (x :: xs) = x + sum xs sum_cont' : {a : Type} -> List Nat -> (Nat ->

    3熱度

    1回答

    我預計今年以評估3,但得到了一個錯誤,而不是: Idris> :let x = Just 2 Idris> 1 + !x (input):1:3-4:When checking an application of function Prelude.Interfaces.+: Type mismatch between Integer (Type of (_bindA

    1熱度

    1回答

    考慮: *section3> :module Data.Vect *section3> :let e = the (Vect 0 Int) [] *section3> :let xs = the (Vect _ _) [1,2] *section3> decEq xs e (input):1:7:When checking argument x2 to function Decidab

    1熱度

    1回答

    我試圖執行以下操作: headEqual : DecEq a => (x : a) -> (y : a) -> Maybe (Dec (x = y)) headEqual x y = case decEq x y of Yes Refl => Just (Yes Refl) No contra => Nothing vectEqual : DecEq a

    1熱度

    1回答

    在我探索伊德里斯的旅程中,我試圖用「慣用」的方式編寫一個小日期處理模塊。這是我到目前爲止。 首先,我有一些基本的類型來表示天,月,年: module Date import Data.Fin Day : Type Day = Fin 32 data Month : Type where January : Month February : Month .

    1熱度

    1回答

    當我打開這個文件: %default total data Parity = Even | Odd opposite: Parity -> Parity opposite Even = Odd opposite Odd = Even data PNat : Parity -> Type where PZ : PNat Even PS : PNat p -> PN

    3熱度

    1回答

    我希望能夠說,對於簽名t-> t的f的函數,對於t中的所有x,f(f(x))= x。 當我運行此: %default total -- The type of parity values - either Even or Odd data Parity = Even | Odd -- Even is the opposite of Odd and Odd is the opposite

    4熱度

    1回答

    我想要設置類型(x, y)與x /= y。 我的想法是定義NEqPa : Type -> Type這樣NEqPa a應該包含所有的元素((x,y), p)與x : a,y : a和p : (x = y) -> Void。我嘗試了以下兩個版本: NEqPa a = ((x, y) : (a, a) ** (x = y) -> Void) NEqPa a = ((x : a, y : a) **

    12熱度

    1回答

    List有filter : (a -> Bool) -> List a -> List a,但Stream沒有filter : (a -> Bool) -> Stream a -> Stream a,爲什麼? 是否有一些替代方案可以做類似的工作?在伊德里斯

    4熱度

    1回答

    我定義我自己的Vect數據類型如下 data MyVect : (n : Nat) -> (t : Type) -> Type where Nil : MyVect Z t (::) : (x : t) -> (xs : MyVect n t) -> MyVect (S n) t 然後開始實施的數據類型 Foldable MyVect where foldr =