두 가지 자연스러운 주장을 취하고 어쩌면 평등성을 증명하는 함수를 작성하고 싶습니다.이드리스 (Idris) - 두 숫자의 동등성 확인
나는
equal : (a: Nat) -> (b: Nat) -> Maybe ((a == b) = True)
equal a b = case (a == b) of
True => Just Refl
False => Nothing
으로 노력하고 있지만 다음과 같은 오류이 작업을 수행하는 올바른 방법입니다
When checking argument x to constructor Prelude.Maybe.Just:
Type mismatch between
True = True (Type of Refl)
and
Prelude.Nat.Nat implementation of Prelude.Interfaces.Eq, method == a
b =
True (Expected type)
Specifically:
Type mismatch between
True
and
Prelude.Nat.Nat implementation of Prelude.Interfaces.Eq, method == a
b
를 얻을?
또한, 보너스 질문으로, 내가 할 경우
equal : (a: Nat) -> (b: Nat) -> Maybe ((a == b) = True)
equal a b = case (a == b) of
True => proof search
False => Nothing
나는
INTERNAL ERROR: Proof done, nothing to run tactic on: Solve
pat {a_504} : Prelude.Nat.Nat. pat {b_505} : Prelude.Nat.Nat. Prelude.Maybe.Nothing (= Prelude.Bool.Bool Prelude.Bool.Bool (Prelude.Interfaces.Prelude.Nat.Nat implementation of Prelude.Interfaces.Eq, method == {a_504} {b_505}) Prelude.Bool.True)
This is probably a bug, or a missing error message.
Please consider reporting at https://github.com/idris-lang/Idris-dev/issues
는 알려진 문제입니다 얻거나 나는 그것을보고해야합니까?
문제를보고하기로 결정하는 동안 전술 기반 교정은 Idris에서 더 이상 사용되지 않습니다. –
'decEq'을 사용하는 것이 좋습니다. – 2426021684