Created
November 9, 2017 19:34
-
-
Save yksym/d385530dd51f683775d35a08670b65fc to your computer and use it in GitHub Desktop.
Idris勉強会で出た疑問
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ref: https://github.com/idris-lang/Idris-dev/blob/0d3d2d66796b172e9933360aee51993a4abc624d/test/totality006/totality006.idr | |
import Data.So | |
antitrue : So False -> a | |
antitrue Oh impossible | |
total | |
eqNat : (n : Nat) -> (m : Nat) -> So (n == m) -> (n = m) | |
eqNat Z Z Oh = Refl | |
eqNat (S k) Z um = antitrue um -- なぜここでimpossibleが出来ない? | |
eqNat Z (S k) um = antitrue um | |
eqNat (S k) (S l) um = cong $ eqNat k l um -- なぜumが使える?型が違うはずでは?? | |
total | |
gtNat : (a:Nat) -> (b:Nat) -> So (a > b) -> GT a b | |
gtNat Z Z Oh impossible | |
gtNat Z (S k) um = antitrue um | |
gtNat (S k) Z um = LTESucc LTEZero | |
gtNat (S k) (S j) um = LTESucc $ gtNat k j ?um -- どうやって?umを作る?with?? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
um : S n == S m は == の定義から um : n == m に簡約される模様