Agdaã¯ããŸãã«ãäž»æµã§ãïŒ
ãå
èŠæ§ã
ãã·ã¢èªã®ã€ããªã¹èšèªã«é¢ããè³æã¯ã»ãšãã©ãããŸãããç°¡åãªæŠèŠã§ãããä¿®æ£ããããšããŸãã ãŸããç§ã¯ãåå¿è ãæ©èœçã§ã¯ãªããäŸååã®ããã°ã©ããŒã«éŠŽæã¿ã®ãªã人ã«ãããã¹ããç解ã§ããããã«ããŸãããããã£ãŠããã®ãããªèšèªã«ç²ŸéããŠãã人ã«ãšã£ãŠã¯ãæåŸãŸã§å·»ãæ»ããããå ¬åŒããã¥ã¡ã³ããããã«èªãã ãããæ¹ãç°¡åãããããŸããã ç§ã¯èšèªãšçè«ã®çå£ãªçŽ¹ä»ãæžãããšãæ³å®ããŠããŸããããããããã¹ãŠã§ãããã®ã瀺ãããšãæã¿ãŸãã
ãããã£ãŠãã€ããªã¹ã¯ãäŸååãæã€çŽç²ãªé¢æ°åæ±çšããã°ã©ãã³ã°èšèªã§ãã
ããã¯ãªãã§ããïŒ
ç°¡åãªçããšããŠããã€ã¯ã¹ãã©ã®æåãªåŒçšãé©åã§ãã ãã以æ¥ã¢ãããŒãã¯å€æŽãããŸããããç®æšã¯åããŸãŸã§ãã
ããã°ã©ãã®è£œåã¯åœŒããæžãããã°ã©ã ã ãšèããŠãã人ã¯ãæ·±ãééã£ãŠããŸãã ããã°ã©ããŒã¯ãä¿¡é Œã§ãã決å®ãäœæãã説åŸåã®ããè°è«ã®åœ¢ã§ããããæ瀺ãã矩åããããæžãããããã°ã©ã ã®ããã¹ãã¯ããã®èšŒæ ãé©çšãããè³æã®ã¿ããµããŒãããŠããŸãã
ããæ£ç¢ºã«èšããšãäœæããŠäœ¿çšããçç±ã¯ããã€ããããŸããèè ã®Edwin Bradyã¯ãããã䜿çšããŠãäŸååã®ã¢ããªã±ãŒã·ã§ã³ããã°ã©ãã³ã°ãç 究ããŸãã ç§ã®ããã«ãå€ãã®äººãæ£ç¢ºãªããã°ã©ã ä»æ§ãã³ã³ãã€ã«ããæ©èœã奜ãã§ãã ãŸããæ£åŒãªæ€èšŒãéããŠã¢ããªã±ãŒã·ã§ã³ããã°ã©ã ã®ãããã°æéãå€§å¹ ã«ççž®ããããšèããŠããŸãã ãããŠãããã§2çªç®ã®åŒçšãé Œã¿ãŸãïŒ
ããã°ã©ã ããã¹ããããšããšã©ãŒã®ååšãéåžžã«å¹æçã«å®èšŒã§ããŸããããšã©ãŒããªãããšãå®èšŒããã«ã¯çµ¶æçã«äžååã§ãã
éçåä»ããšäŸåå
ããã°ã©ãã³ã°èšèªã®ã¿ã€ãã³ã°ãåé¡ããæ¹æ³ã®1ã€ã¯ããããéçãšåçã«åããããšã§ãã åçåä»ãã§ã¯ãåã¯ã³ã³ãã€ã«æã«äžæã§ããããããã§ãã¯ã§ããŸããã ããã¯ããã°ã©ã ãããéãæžãã®ã«åœ¹ç«ã¡ãŸãããåæã«ããã°ã©ã ã®å®è¡äžã«æ€åºãããé¡ååãšã©ãŒã®ã¯ã©ã¹ãè¿œå ããŸãããããã¯éåžžããŸãå¿«é©ã§ã¯ãããŸããã Idrisã¯éçåä»ãã䜿çšããŠãããããããã«ã€ããŠã®ã¿ä»¥äžã§èª¬æããŸãã ããããåçåä»ãã«æ £ããŠãã人ãæããããªãããã«ã åæšè«ã䜿çšãããŠããããšã«ããã«æ°ä»ããŸãã ã³ã³ããã¹ãããã³ã³ãã€ã©ã«æãããªåã¯ãæ瀺çã«çç¥ã§ããŸãã
å ¥åã¯ãæååãæ°å€ãæµ®åå°æ°ç¹æ°ãªã©ãããã€ãã®ããªããã£ãåã«å¶éã§ããŸãã ããå€ã®ã¿ã€ãïŒããšãã°ãé¢æ°ã®åŒæ°ããŸãã¯ããã«ãã£ãŠè¿ãããå€ïŒã«ã€ããŠãèšããããšãã§ããã®ã¯ã ãstringã ã ãnumberã ã ãfloating point numberãã ãã§ãã ããããããã¯éåžžãæ§é ã®ãããªãã®ã§è£å®ãããŸãïŒåçŽãªCã®ãããªæ§é ãã¯ã©ã¹ãïŒäžè¬åãããïŒä»£æ°ããŒã¿åãªã©ãåæã«åïŒCã®
typedef
ãHaskellã®
type
ïŒãšå矩ã§ãããšãã°ãèšããããšãã§ããŸãã ãDateã ããdateãã®æ§é ãã¯ã©ã¹ããŸãã¯ã¿ã€ããäºåã«å®çŸ©æžã¿ã
ãããããã€ã³ã¿ãŒããšãããã¬ãŒãºã§è£è¶³ã§ããŸãããåæã«é åã䜿çšã§ããŸãããé«ã¬ãã«èšèªã§ã¯ã äžè¬çãªããã°ã©ãã³ã° ïŒC ++ã®ãã³ãã¬ãŒããJavaã®ãžã§ããªãã¯ïŒãããé »ç¹ã«ãµããŒããããæ¢ã«ãæ¥ä»ãªã¹ãã ã ãéè·¯ã°ã©ãããªã©ã®ãã¬ãŒãºãäœæã§ããŸã" ã "ã€ãã³ãããªãŒ " ã ã€ãŸããåã¯ä»ã®åã«ãã£ãŠãã©ã¡ãŒã¿ãŒåã§ããŸãã
ãããŠæåŸã«ãå€ã§åããã©ã¡ãŒã¿ãŒåã§ããŸããããã«ããã ã 5è¡ã®ãªã¹ãã ã ãVasilyã«ãã£ãŠçœ²åãããã¡ãã»ãŒãžã ã é¢æ°ã¿ã€ãã¯ãããäžè¬çãªãã¡ãã»ãŒãžãåä¿¡ããŠââãŠãŒã¶ãŒããŒã¿ãè¿ãé¢æ° ãã§ã¯ãªãã ãç¹å®ã®ãŠãŒã¶ãŒã«ãã£ãŠçœ²åãããã¡ãã»ãŒãžãåä¿¡ãããã®ãŠãŒã¶ãŒã®ããŒã¿ãè¿ãé¢æ°ããšãã圢åŒãåãããšãã§ããŸã ã ããã«ãããã¯ãããã°ãäž»èªããè¿°èªãžã®åãæ¿ãããã¿ã€ããšããŠã®çºèšãã®ååã䜿çšããããšãå¯èœã«ããŸãïŒ ã5ã¯3ãã倧ããã ã ã5ã¯3ãã倧ããããšã¯äºå®ã§ã¯ãããŸããã ã ã7ã¯çŽ æ°ã ã ãVasily received 2ãã¡ãã»ãŒãž ã ãããã¯ãå¶ç¶ãä»ã®ããã€ãã®èšèªïŒAgdaãCoqãEpigramãªã©ïŒã§Idrisã«å®è£ ãããŠããäŸååã§ãããIdrisã¯çŸä»£ã®å¿çšèšèªã«ãªããããšãã欲æ±ã«ãã£ãŠããããšåºå¥ãããŸãã
ãŸããå®å šãªé¢æ°åããã°ã©ãã³ã°ã®æ¡ä»¶äžã§ã¯ãã³ã³ãã¥ãŒã¿ãŒããã°ã©ã ãšæ°åŠç蚌æã®éã®å¯Ÿå¿ã䜿çšã§ããŸãïŒ ã«ã¬ãŒ-ãã¯ãŒãå¯Ÿå¿ ïŒãããšãã°ã ãAã¯BæªæºãBã¯CæªæºãAã¯CæªæºããŸãã¯ãã¡ãã»ãŒãžãéä¿¡ãããŸãããäžéšã®ãŠãŒã¶ãŒã«ãšã£ãŠãããã¯ãã®ãŠãŒã¶ãŒããã®ã¡ãã»ãŒãžã«ã¢ã¯ã»ã¹ã§ããããšãæå³ããŸãâ ; 次ã«ãé¢æ°ã®æ¬äœã蚌æã«ãªããŸãã蚌æã¯ãæå®ãããåã®å€ãè¿ãã ãã§ã蚌æã®èšŒæã¯åãã§ãã¯ã§ãã
ããŒã¿ã«æ©èœããã°ã©ãã³ã°
åè¿°ã®ããã«ãã€ããªã¹ã¯çŽç²ãªé¢æ°åèšèªã§ãã ãã ããé¢æ°ã®totalityããããã£ã®ãªãã·ã§ã³èŠä»¶ããµããŒããããŠããŸããããã¯ã2ã€ã®ããããã£ãæå³ããŸãã
- 確å®æ§ã¯ã©ãã«ã§ããããŸãïŒé¢æ°ã¯å ¥åã«å¯ŸããŠå®çŸ©ãããªããã°ãªããŸããã çŽç²ãªèšèªã§ã¯ããã®ããããã£ãååšããªãããšããããã°ã©ã ããèœã¡ããããã®ã»ãšãã©å¯äžã®æ¹æ³ã§ãïŒç¹ã«IOã®å Žåã¯ããã®ã¢ã¯ã·ã§ã³ã®äžéšãšèããããã³ã³ãã€ã©ã®ãã°ã®ããã«ã·ã¹ãã ã«ããããã»ã¹ã匷å¶çµäºããŸãïŒã
- å³å¯ãªæ£èŠåïŒååž°çãªé¢æ°åŒã³åºãäžã«ããã®åŒæ°ã®å°ãªããšã1ã€ãå³å¯ã«ïŒæ§é çã«ïŒæžããããé¢æ°ãåå埩ã§çç£çã§ãªããã°ãªããŸãã-ã€ãŸã çµæã®äžéšãšã次ã®å埩èšç®ã®çŽæãè¿ããŸãã åè ã®å Žåãããã¯åæ¢åé¡ãåé¿ããŠæ©èœã®å®äºãä¿èšŒããåŸè ã®å Žåãæéé·ã§ä»»æã®é·ãã®æçµãã¬ãã£ãã¯ã¹ãèªã¿åãæ©èœãä¿èšŒããŸãã
ããã¯ããŸã蚌æ ãæ§ç¯ããããã«éèŠã§ãããç§ã®èŠ³å¯ããå€æãããšãéåžžã®ããã°ã©ã ã®æ£ç¢ºãã¯æçã§ãã ã¡ãªã¿ã«ããã®ããããã£ã®ååšã«ããããã®é¢æ°ã®é 延èšç®ãšè²ªæ¬²ãªèšç®ã®çµæãåãã«ãªãããšãä¿èšŒãããIdrisã®èšç®ã¯ããã©ã«ãã§è²ªæ¬²ã§ãããåŒæ°ãé 延ãããããšãã§ããŸãã
ãã®ãªãã·ã§ã³ã¯ãåã ã®é¢æ°ããã¡ã€ã«ããŸãã¯ã³ã³ãã€ã©ã®ãã©ã°ã§æå¹ã«ã§ããŸãã
äŸ
ç°åžžãªæ§æã¯ãèšè¿°ãããŠããå 容ã®æ¬è³ªãã泚æããããããã«æããããããæ§æã«ã€ããŠã¯èª¬æããŸããã ã³ãŒãäŸã¯MLãã¡ããªãŒã®èšèªã«ç²ŸéããŠãã人åãã«æäŸãããŠãããæ®ãã®éšåã«ã€ããŠã¯ããããã®äŸã®åã«ããã¹ãã®èª¬æããããŸãã
éšé
ã»ãšãã©ãã¹ãŠã®ããã°ã©ãã³ã°èšèªïŒãŸãã¯æšæºã©ã€ãã©ãªïŒã§å©çšå¯èœãªã誰ãã䜿ãæ £ããæäœã¯éšéã§ãã ãããã0ã§å²ãããšã¯çŠæ¢ãããŠãããããŸããŸãªè°è«ã®äœå°ããã決å®ã«ã€ãªãããŸãã
- Infinityãªã©ã®ç¹å¥ãªäœããè¿ãã«ã¯ãInfinityã䜿çšããä»ã®ãã¹ãŠã®é¢æ°/æŒç®ã®æŒç®èŠåã決å®ããå¿ èŠããããŸããããã«ãããç®è¡å šäœãè€éã«ãªããŸãããããšãã°ãåçŽãªããããã£a / b = câb * c = aã倱ãããŸããããã«ãããã䜿çšããããšãããšãç°¡åã«äºæ³å€ã®çµæã«ã€ãªãããŸãã
- äŸå€ãçºçãããããã«ïŒããã¯ãéåžžã®ããã°ã©ã ãããŒã®äžæã«ã€ãªããã ãã§ãªãããã£ãããããŠããªãäŸå€ãå«ããã°ã®æ ¹æ ãäœæããã ãã§ãªãããããäžå¯èœã«ãªããªãå Žåãé¢æ°ã«é¢ããè°è«ïŒç¹ã«æ£åŒïŒãå€§å¹ ã«è€éã«ããŸãã
- çµæãMaybeã«ã©ããããŠã0ã§é€ç®ããããšãããšNothingãè¿ããŸããåã®2ã€ãããåªããŠããŸãããã ããé¢æ°èªäœã¯ããã°ã©ãã«æ£ããããã°ã©ã ã®äœæãä¿ãããåŒã®ç²ŸåºŠãäœäžããããã«ããŽãªçè«ã§é床ã«é£œåãããããå¯èœæ§ããããŸãããã®é€ç®ã®å®è£ ã䜿çšããæ©èœã
äŸååãæã€èšèªãç¹ã«Idrisã«ã¯ãå¥ã®ãªãã·ã§ã³ã衚瀺ãããŸãã0ã«ããé€ç®ãçŠæ¢ããŸããèšãæãããšã0ã«ããé€ç®ã¯çŠæ¢ãããŸãã é¢æ°ã®ã¿ã€ãã¯ãã2ã€ã®æ°å€ãåãã2çªç®ã®æ°å€ã0ã§ãªããæ°å€ãè¿ãé¢æ°ããšèšè¿°ãããŸãã å¿ èŠã«å¿ããŠãæ»ãå€ãšé¢æ°ã®åŒæ°ãšã®é¢ä¿ã瀺ãããããã£ã§ãã®ä»æ§ãè£è¶³ã§ããŸãã ã...ãªã©...ãã§ãããå¥ã®å®çã«ä»»ããæ¹ãç°¡åã§ãããããã§ã¯é€ç®é¢æ°ã®ã¿ã€ãã®èª¬æã«æ»ããŸããéåžžã®2ã€ã®åŒæ°ã«ã3ã€ç®ã®åŒæ°ãè¿œå ããå¿ èŠããããŸãã
次ã«ãé€ç®ã䜿çšãã3ã€ã®ã±ãŒã¹ãæ€èšããŸãïŒã³ã³ãã€ã«æéã«ã€ããŠè©±ããŠããããšãæãåºããŠãã ããïŒã
- é€æ°ã¯æ¢ç¥ã§ããèªç¶æ°ã®ç䟡æ§ã¯æ±ºå®å¯èœã§ããããïŒã€ãŸããã³ã³ãã€ã©ã¯é€æ°ããŒããã©ããã確èªããŸãïŒããããã£ãŠãå¿ èŠã«å¿ããŠãéåžžã®2ã€ã®åŒæ°ãæã€é¢æ°ã«ãã®ãããªé€ç®é¢æ°ãã©ããããŠãåãåçŽãª3çªç®ã®åŒæ°ã
- é€æ°ã¯äžæã§ããããŒãã«çãããªãããšã確èªããããã®é€æ°ãããã£ãŠããŸããããšãã°ãè² ã§ãªãæ°ããã倧ããå Žåã§ãã 次ã«ã蚌æ ãæå®ã®å Žæã«èšè¿°ããããæã£ãŠãããã®ãåãïŒæ°ãéè² æ°ããã倧ããããšã蚌æããïŒãå¿ èŠãªãã®ãè¿ãé¢æ°ã䜿çšããïŒãã®æ°ããŒãã«çãããªãããšã蚌æããïŒå¿ èŠããããŸãã ãã®ãããªé¢æ°ã¯ãåã«é¢æ°ããŸãã¯è£é¡ãŸãã¯å®çãšåŒã¶ããšãã§ããŸããããã§ã«è¿°ã¹ãããã«ããã®æèã§ã¯ããã¯ãŸã£ããåãã§ãã
- ç§ãã¡èªèº«ã¯ãé€æ°ããŒãã«çãããªãããšã確信ããŠããŸããïŒäžå¹³çã蚌æããããã«ç¶æ³ãæ éã«æ€èšããåŸãåã®ã±ãŒã¹ã¯ãã®ã±ãŒã¹ã«å ¥ããããããŸããïŒïŒãã®å Žåã®ã¿ãå®éã«é€ç®ã®åã«ãã§ãã¯ãå°å ¥ããå¿ èŠããããŸã; é€æ°ããŒãã®å Žåã代æ¿ãœãªã¥ãŒã·ã§ã³ã䜿çšããããã§ãªãå Žåã¯ãåä¿¡ããæ å ±ã䜿çšããŠé€ç®ãå®è¡ããŸãã
ãã¡ããããã®ã¢ãããŒãã¯Idrisã§ã¯å¿ èŠãããŸããããããã°ã©ããŒãèšç®ãæ£ããå®è¡ã§ããããã«ããŸãã
æåŸã«ãã³ãŒãäŸã¯é€ç®é¢æ°ã®ãã¬ãŒã ã¯ãŒã¯ã§ãã
-- (total) -- "==" - , Bool -- "=" - , total div : (n, m: Nat) -> ((m == Z) = False) -> Nat -- 0 - ; -- , , div n Z f = FalseElim $ trueNotFalse f -- div n (S k) f = {-todo-}?div_rhs
ããã¯åãªãã¯ã€ã€ãŒãã¬ãŒã ã§ãããããã¡ã¿å€æ°
div_rhs
ãããã§äœ¿çšãããŸãã Agdaã«ç²ŸéããŠãã人ã¯æ¢ã«ãç©Žããç¥ã£ãŠããããã®åŒ±ãããŒãžã§ã³ã¯Idrisã®ã¡ã¿å€æ°ã§ãããæ®ãã«ã€ããŠã¯èª¬æããŸããIdrisã䜿çšãããšãã³ã³ããã¹ãïŒãã®äœçœ®ããèŠããå€æ°ïŒãšç®çïŒãã®äœçœ®ããæ§ç¯/è¿åŽãããïŒã蚌æ ãšããã°ã©ã ã®äž¡æ¹ã®èšè¿°ãéåžžã«å®¹æã«ããŸãã ãã®å Žåã次ã®ããã«ãªããŸãã
n : Nat k : Nat f : S k == 0 = False -------------------------------------- div_rhs : Nat
ããããåèªåçã«å ¥åããããšãå¯èœã§ãïŒ
Nat
ãè¿ãç®çã§ãïŒREPL / IDEïŒãrefineãã³ãã³ãã䜿çšããŠãããšãã°
plus
é¢æ°ã®ååãæž¡ãã
plus
é¢æ°ãå¿ èŠãªåã®å€ãè¿ãããšãã§ããå Žåãããã眮ãæããŸããã®ã¡ã¿å€æ°ã®ä»£ããã«ããã®åŒæ°ã«2ã€ã®æ°ããã¡ã¿ã眮ãæããããŸãã ããã»ã¹ã¯ãå¥ã®æ©èœã§äœ¿çšãããããã»ã¹ãšåãã§ã-ã¡ã¿å€æ°ã®å®å šèªå眮æãã€ãŸã 蚌æ ã®æ€çŽ¢ïŒå Žåã«ãã£ãŠã¯ãå¿ èŠãªèšŒæ ãèªåçã«èŠã€ããããšãã§ããŸãã
ã¿ã€ãïŒèªã¿ãããããã«å°ãç·šéïŒïŒ
λΠ> :t div div : Nat -> (m : Nat) -> (m == 0 = False) -> Nat
λΠ> :t div 1 2 div 1 2 : (2 == 0 = False) -> Nat
λΠ> :t div 1 2 refl div 1 2 refl : Nat
λΠ> :t div 1 0 refl (, )
é€ç®é¢æ°ã®å®è£ ããè±ç·ããŠããã®ã¢ãããŒããç§ãã¡ã«äžãããã®ãèŠãŠã¿ãŸãããã åè¿°ã®æ£ç¢ºãããå§ããŸããããé¢æ°ã¯æ¬æ¥ã®åäœãããŸãã é¢æ°ã¯ãéåžžãå®è£ ãããã®ãšèããŠèããããšãã§ããŸãïŒç®è¡ããã®å ŽåïŒãŒãã§é€ç®ããããšã¯ã§ããŸããããé€ç®ã®éçšã§äŸå€ã®ãããªæŠå¿µã¯å«ãŸãããçµæã¯æ°å€ã§ãïŒã é¢æ°ã«ã€ããŠã¯ã圢åŒçã«ãå«ããŠããããè¡šãæŠå¿µãšåãæ¹æ³ã§è©±ãããšãã§ããŸãã æšè«ãã³ãŒãã§æžãçããŸãã ããã䜿çšããé¢æ°ã§ã¯ãæšè«ãšçµè«ãèšç®ãšçµ¡ã¿åã£ãŠãã§ãã¯ã§ããããã«ãªããããã°ã©ããŒã®é ã®äžãããã¹ãã³ã¡ã³ãã«æ®ãããšã¯ãªããªããŸããã ãŸããããã°ã©ã ã¯ãèšç®ã®ã¬ã·ãã ãã§ãªããæ£ããæšè«ãšæ±ºå®ããæ§æãããŸãã
ãªã¹ã
ãªã¹ãïŒãŸãã¯é åïŒãæäœããããšããã»ãŒåãäžé£ã®ç©è°ãéžã決å®ãšãã®åŸã®ãšã©ãŒã«ã€ãªããäžè¬çãªã¿ã¹ã¯ã§ãã ç¹ã«ããªã¹ãã®nçªç®ã®èŠçŽ ãè¿ãé¢æ°ãèããŸãããã®å®è£ ã®åé¡ã¯ããªã¹ãã«ãªãäœçœ®ããèŠçŽ ãèŠæ±ã§ããããšã§ãã éåžžã®è§£æ±ºçã¯ããã¢ã¯ã»ã¹éåããŸãã¯ãã»ã°ã¡ã³ããŒã·ã§ã³ãã©ãŒã«ããã«è©²åœããäŸå€ãã¹ããŒããïŒå Žåã«ãã£ãŠã¯ããã§è©²åœããïŒå ŽåããããŸãã
äŸååãæã€èšèªã§ã¯ãããã«èãããã解決çãããã€ãçŸããŸãã æåã®æ¹æ³ã¯ããŒãã«ããé€ç®ã®åé¡ã解決ããã®ãšäŒŒãŠããŸãã é¢æ°ã®æåŸã®åŒæ°ã¯ãèŠæ±ãããäœçœ®ããªã¹ãã®é·ãããå°ããããšã®èšŒæã§ãã
ããã§ã¯ãããŸããŸãªæ°åããªã¹ãããif-then-elseããªã©ã確èªã§ããŸãã èšèªèªäœã§å®çŸ©ãããŠããŸãã ã©ã€ãã©ãªã«å®è£ ãããŠããèªç¶æ°ã¯ãCã§ã®ã³ã³ãã€ã«æã«GMPçªå·ã«çœ®ãæããããå ç®ãä¹ç®ãªã©ã®é¢æ°ã¯å¯Ÿå¿ããGMPé¢æ°ã«çœ®ãæããããŸããããã«ãããã³ã³ãã€ã«ãããããã°ã©ã ã§ã®è¿ éãªèšç®ãšãããã«ã€ããŠã®è©±ãåããå¯èœã«ãªããŸãã 次ã«ãã³ãŒããèŠãŠã¿ãŸãããã
data Nat = Z | S Nat data List a = Nil | (::) a (List a) length : List a -> Nat length [] = 0 length (x::xs) = 1 + length xs index : (n : Nat) -> (l : List a) -> (ok : lt n (length l) = True) -> a index Z (x::xs) p = x index (S n) (x::xs) p = index n xs ?indexTailProof index _ [] refl impossible indexTailProof = proof { intros; rewrite sym p; trivial; }
indexTailProof
ã¯Coqã¹ã¿ã€ã«ã®æŠè¡ã䜿çšãã蚌æã§ãããAgdaã¹ã¿ã€ã«ãã€ãŸã ãã銎æã¿ã®ããæ©èœïŒçå®ã¯ãæŠè¡ããŸããªãAgdaã«ãå°å ¥ããããšããããšã§ãïŒã
2çªç®ã®è§£æ±ºçã¯ããªã¹ãã ãã§ãªããåºå®é·ã®ãªã¹ããã€ãŸããäŸååãæã€èšèªã®ã³ã³ããã¹ãã§åŒã³åºããããã¯ã¿ãŒã䜿çšããããšã§ãã äžèšã§äŸãæããŸãããããã«ãããã5è¡ã®ãªã¹ãããšèšãããšãã§ããŸãã ãããã æçµå-ã€ãŸããç°ãªãå€ã®æ°ãæéã§ããåïŒèªç¶æ°ã®åãåã§ããããäžéããããšèããããšãã§ããŸãã ãã®ã¿ã€ãã¯ãèªç¶æ°ããããnæªæºã®æ°ããšèšãæ¹ãç°¡åã§ãããããç¹ã«äŸ¿å©ã§ãã ãã¯ãã«ã®nçªç®ã®èŠçŽ ãååŸããããã®é¢æ°ã®åã¯ããnæªæºã®æ°ãšnåã®èŠçŽ ã®ãªã¹ããåããaåã®èŠçŽ ãè¿ãé¢æ°ããšããŠèªã¿åãããŸãã
ãã®å Žåãã¿ã¹ã¯ã¯èšŒæãæäŸããããšã§ã¯ãªããå¿ èŠãªã¿ã€ãïŒnæªæºïŒãæ§ç¯ããããšã§ãã ã¡ãªã¿ã«ãããã§ã®èšŒæã®è«çã¯å€å žçïŒçŽèŠ³çïŒãšã¯ç°ãªãã蚌æã®æ§ç¯ã«ãããŸããã€ãŸããã¹ããŒãã¡ã³ã/åã®èšŒæã¯ãã®åã®ä»»æã®å€ã§ããããã以åã®ã¢ãããŒããšã®é¡äŒŒæ§ã远跡ã§ããŸãããåæã«ãããã°ã©ã å šäœãæžããšãããã¯å€ãããŸãã
ã³ãŒãïŒ
data Fin : (n : Nat) -> Type where fZ : Fin (S k) fS : Fin k -> Fin (S k) data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : (x : a) -> (xs : Vect na) -> Vect (S n) a index : Fin n -> Vect na -> a index fZ (x::xs) = x index (fS k) (x::xs) = index k xs -- - , -- "" index fZ [] impossible
ãããã£ãŠãæ確ãªèšŒæ ããããã«å ã«é²ã¿ãŸãããæ£ããããã°ã©ã ãæ§ç¯ããŠããŸãã
ããŠããã¯ãã«ã«ãã©ãçããã®ã§ãããã«ããããçµåããæ©èœããããŸããå€ãã®å ŽåãäŸååã瀺ãããã®äŸãšããŠäžããããŠããŸãã
(++) : Vect ma -> Vect na -> Vect (m + n) a (++) [] ys = ys (++) (x::xs) ys = x :: xs ++ ys
æ¬æã¯éåžžã®ãªã¹ããšåãã§ãããã¿ã€ãã¯ããèå³æ·±ããã®ã§ã
m + n
泚æããŠãã ããã
ãã®ä»ã®äŸ
äžèšã¯ãã€ããªã¹ãä¿®æ£ããã®ã«åœ¹ç«ã€åã ã®å°ããªé¢æ°ã®äŸã§ãããããã«ããã€ãã®ãã倧ããªãã®ããããŸãïŒ
- ãããã³ã«ïŒDSLã䜿çšããŠãããã³ã«ãèšè¿°ããå®è£ ã§ãããããã³ã«ã©ã€ãã©ãªããããŸãã ãããã³ã«èšè¿°ãšå®è£ ã®äžäžèŽã¯ãšã©ãŒã«ãªããŸãã
- ç©çåŠãšã²ãŒã ïŒèšç®ãæ£ããã ãã§ãªããã¡ã€ã³ããã°ã©ã ãæžããåŸã«å®çã蚌æããããšãæçšã§ãã
- ãã¡ã³ã¯ã¿ãé©çšãã¡ã³ã¯ã¿ãããã³ã¢ããã®æ³åã¯ãæéã¯ã©ã¹èªäœã®ã³ãŒãã«å«ããããšãã§ããŸã ã
- æå·å ïŒéèŠãªããšã®æãããªäŸã
- ããã¹ã/ãã€ããªåœ¢åŒã®è§£æãšã³ã³ãã€ã«ïŒæ§æãããè¡ããœãŒã¹ããŒã¿ã«è§£æããã解æãããããŒã¿ããœãŒã¹è¡ã«ã³ã³ãã€ã«ãããããšãæ£åŒã«èšŒæã§ããŸãã ãããç§ãã€ããªã¹ã®æåã®ãããžã§ã¯ããšããŠéžãã ãã®ã§ãã
- ã¢ã¯ã»ã¹æš©ã·ã¹ãã ãããŒã¿ããŒã¹ãããã€ã¹ãã©ã€ããŒ-Idrisã§ã®å®è£ ã¯ãŸã èŠãŠããŸããããä¿¡é Œã§ãããã®ãèŠãããšæã£ãŠããŸãã
DOMãšããåãããããã®Webãã¬ãŒã ã¯ãŒã¯ãšã©ã€ãã©ãªã®äž¡æ¹ããã®äžã«èšè¿°ãããŠããïŒå·çæç¹ã§ã¯ãã³ã³ãã€ã©ã¯CãLLVMãJavaãããã³JavaScriptã§ã®ã³ã³ãã€ã«ããµããŒãããŠããŸãïŒãããããçš®é¡ã®ããŒãµãŒïŒ one ã two ïŒã§ãããã·ã¹ãã ããã°ã©ãã³ã°ã察象ãšããŠããŸãã HaskellããIdrisã«å¯Ÿå¿ããããã°ã©ã ã¯éåžžã«ç°¡åã§ãã
ã€ããªã¹ã¯ãŸã çç£ã«äœ¿çšãããŠããŸãã-å°ãªããšãåºã䜿ãããŠããŸãïŒãããã æ°å圱é¿ç 究æã§ç©æ¥µçã«äœ¿çšãããŠãããšèããŸããããããã¯éåžžçç£ã§æ£ç¢ºã«ç解ãããŠãããšã¯éããŸããïŒã äž»ãªæè¡çé害ã¯ãéããŒã«ã€ã³ãã§ãããããã¯ãããŒã«ã€ã³ãã«ãã£ãŠæ±ºå®ãããã¹ãã§ãã
ãããã«
ãã®èšèªã¯æ°ããããããæªå å·¥ãã§ãããä»ã®èšèªã§èç©ãããçŸä»£ã®çè«ãšå®è·µã䜿çšããŠçŸä»£çã§ãã
ã€ããªã¹ïŒããã³ãã®åŸã«ç»å ŽããèšèªïŒã®å°æ¥ã®äœ¿çšã«ã€ããŠå°ã倢ãèŠãããšãã§ããããã«ãªããšãããã°ã©ã ã®ä¿¡é Œæ§ã®äžè¬çãªåäžã«å ããŠãæ£åŒãªä»æ§ã«äŒŽãæè¡çãªã¿ã¹ã¯ããŸãã¯ããããããªãããšããæ³åã§ããŸãã ãã«ãŒãããŒã±ããã®ãããªãµãŒãã¹ã®æé·ã ç©çãæ°åŠãããžãã³ã®ãããªä»ã®çè«ãšèšèªã®ã©ã€ãã©ãªã 蚌æãããå®çã®æ£åŒãªä»æ§ã®ãªã¹ããšããŠã®èšäºãšæ¬ã ç¹ã«èªåçã«ãã§ãã¯ãããã¬ããªã«ãšè³ªåãšåçã®ãã¢ããæ§ç¯ãããéä¿¡ã
é¢é£ãªã³ã¯ãšæ¬
- ããã¥ã¡ã³ããšãªã³ã¯ã®ããå ¬åŒãµã€ã ã
- github wiki ;
- idris-modeã䜿çšããã¹ã¯ãªãŒã³ãã£ã¹ã ïŒã¡ãªã¿ã«idris-vimããããŸã ïŒã
- Software Foundations-äŸååãæã€èšèªã®åªããå ¥éæžã§ãããCoqã䜿çšããŠããŸãã
- åçè«ãšé¢æ°åããã°ã©ãã³ã° -ãã®ãããªèšèªã®æ ¹åºã«ããçè«ã®èª¬æã
- TaPLãHaskellã®æžç±ãããã³Agdaã®ããã¥ã¡ã³ããå šäœåã瀺ããŠããŸãã
PS
ã³ã¡ã³ããšã¢ã€ãã¢ã«ã€ããŠããã®ã¬ãã¥ãŒããã¹ãããã人ã ã«æè¬ããŸãã