idris

    8熱度

    1回答

    我如何讓Idris自動證明兩個值不相等? p : Not (Int = String) p = \Refl impossible 我該如何讓Idris自動生成此證明? auto似乎不能證明涉及Not的陳述。我的最終目標是讓Idris自動證明矢量中的所有元素都是唯一的,並且兩個矢量不相交。 namespace IsSet data IsSet : List t -> Type whe

    2熱度

    1回答

    我試圖計算奇偶校驗與半的地板一起,在自然數: data IsEven : Nat -> Nat -> Type where Times2 : (n : Nat) -> IsEven (n + n) n data IsOdd : Nat -> Nat -> Type where Times2Plus1 : (n : Nat) -> IsOdd (S (n + n)) n

    3熱度

    1回答

    import Data.Vect import Data.Vect.Quantifiers sameKeys : Vect n (lbl, Type) -> Vect n (lbl, Type) -> Type sameKeys xs ys = All (uncurry (=)) (zip (map fst xs) (map fst ys)) g : {xs,ys : Vect n (

    4熱度

    1回答

    證明考慮下面的函數 tryMove : (diskNumber : Nat) -> (from: Peg) -> (to: Peg)-> {default Oh prf: So (from /= to)} -> Disposition diskNumber -> Maybe (Disposition diskNumber) tryMove Z from to [] = Nothing tryM

    1熱度

    1回答

    inf : Nat inf = S inf minimum' : Lazy Nat -> Lazy Nat -> Lazy Nat minimum' Z b = Z minimum' b Z = Z minimum' (S a) (S b) = S (minimum' a b) main : IO() main = do print $ Force $ minimum'

    6熱度

    1回答

    我讀Type driven development with Idris,和的一個練習要求讀者限定,使得隨着一個矢量可以表示一個類型TupleVect,: TupleVect 2 ty = (ty, (ty,())) 我解決它通過定義以下類型: TupleVect : Nat -> Type -> Type TupleVect Z ty =() TupleVect (S k) ty = (

    3熱度

    1回答

    考慮此程序: module test import Effects import Effect.StdIO (>>==) : Maybe a -> Lazy (a -> Maybe b) -> Maybe b (>>==) Nothing (Delay map) = Nothing (>>==) (Just x) (Delay map) = map x nothing : Str

    2熱度

    1回答

    這種失敗: > the ({A : Type} -> A -> {B : Type} -> B -> (A, B)) MkPair (input):1:5:When checking argument value to function Prelude.Basics.the: Type mismatch between A -> B1 -> (A, B1) (Type

    1熱度

    1回答

    我試圖在我的定義的數據類型中的一種證明屬性如下應用證明: reverseProof' : (inputBlock : Block iType iSize iInputs) -> (ind : Fin rSize) -> (rInputs : Vect rSize Ty) -> (receiveBlock : Block rType rSize rInput

    3熱度

    1回答

    當我嘗試編譯這個例子 record R where f:() -> {t: Type} -> t 我得到這個錯誤: Type mismatch between () -> t1 (Type of f) and () -> t (Expected type) Specifically: Type mismatch between