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