我如何讓Idris自動證明兩個值不相等? p : Not (Int = String)
p = \Refl impossible
我該如何讓Idris自動生成此證明? auto似乎不能證明涉及Not的陳述。我的最終目標是讓Idris自動證明矢量中的所有元素都是唯一的,並且兩個矢量不相交。 namespace IsSet
data IsSet : List t -> Type whe
我試圖計算奇偶校驗與半的地板一起,在自然數: 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
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'
我讀Type driven development with Idris,和的一個練習要求讀者限定,使得隨着一個矢量可以表示一個類型TupleVect,: TupleVect 2 ty = (ty, (ty,()))
我解決它通過定義以下類型: TupleVect : Nat -> Type -> Type
TupleVect Z ty =()
TupleVect (S k) ty = (
這種失敗: > 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
當我嘗試編譯這個例子 record R where
f:() -> {t: Type} -> t
我得到這個錯誤: Type mismatch between
() -> t1 (Type of f)
and
() -> t (Expected type)
Specifically:
Type mismatch between