CakeML/cakeml

Derive PMATCH thms for relevant parts of compiler definition

開放

#136 建立於 2016年8月7日

 (8 則留言) (0 個反應) (1 位負責人)Standard ML (98 個分叉)auto 404
help wantedlow rewardmedium effort

倉庫指標

星標
 (1,169 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Certain case expressions are huge within HOL. For such case expressions, the translator produces huge CakeML output, which in turn is highly likely to cause problems for the compiler bootstrapping.

One way to make the translator produce better output is to introduce PMATCH-reformulations of the exploding case expressions and use the reformulations in the translator. This can make the CakeML output much smaller and hence easier for the bootstrapping process to digest.

The task for this issue is to look through the compiler definitions for suspicious looking case expressions, e.g. deeply nested matches and wildcards:

foo x =
  case x of 
  | SOME [x; SOME (NONE, [t1; t2; t3])] => SOME (x,t2)
  | _ => NONE

For each such:

  • a PMATCH reformulation needs to be proved and stored with a predictable name, e.g. foo_pmatch
  • the translator's look up mechanism in the bootstrap should be changed so that it first looks for theorems ending in _pmatch before it looks for the usual _def theorems

貢獻者指南