Coder Social home page Coder Social logo

hs-bcopl's Introduction

hs-bcopl

五十嵐淳著『プログラミング言語の基礎概念』

データレベルプログラム

自動導出システムを実装しようという試み

第1章

  • Language.BCoPL.DataLevel.Peano: ペアノ自然数
  • Language.BCoPL.DataLevel.Nat: 自然数の加算・乗算
  • Language.BCoPL.DataLevel.CompareNat: 自然数の比較
  • Language.BCoPL.DataLevel.Exp: 算術式
  • Language.BCoPL.DataLevel.EvalNatExp: 算術式の評価
  • Language.BCoPL.DataLevel.ReduceNatExp: 算術式の簡約

使用例(出力の改行は編集でいれたもの)

% cd src/Language/BCoPL/
% ghci -v0 -i../.. ReduceNatExp.hs
ghci> sessionMulti'
ReduceMulti> S(Z)*S(Z)+S(Z)*S(Z) -*-> S(S(Z))
S(Z) * S(Z) + S(Z) * S(Z) -*-> S(S(Z)) by MR-Multi {
  S(Z) * S(Z) + S(Z) * S(Z) -*-> S(Z) + S(Z) * S(Z) by MR-One {
    S(Z) * S(Z) + S(Z) * S(Z) ---> S(Z) + S(Z) * S(Z) by R-PlusL {
      S(Z) * S(Z) ---> S(Z) by R-Times {
        S(Z) times S(Z) is S(Z) by T-Succ {
          Z times S(Z) is Z by T-Zero {  } ;
          S(Z) plus Z is S(Z) by P-Succ {
            Z plus Z is Z by P-Zero {  }
          }
        }
      }
    }
  } ;
  S(Z) + S(Z) * S(Z) -*-> S(S(Z)) by MR-Multi {
    S(Z) + S(Z) * S(Z) -*-> S(Z) + S(Z) by MR-One {
      S(Z) + S(Z) * S(Z) ---> S(Z) + S(Z) by R-PlusR {
        S(Z) * S(Z) ---> S(Z) by R-Times {
          S(Z) times S(Z) is S(Z) by T-Succ {
            Z times S(Z) is Z by T-Zero {  } ;
            S(Z) plus Z is S(Z) by P-Succ {
              Z plus Z is Z by P-Zero {  }
            }
          }
        }
      }
    } ;
    S(Z) + S(Z) -*-> S(S(Z)) by MR-One {
      S(Z) + S(Z) ---> S(S(Z)) by R-Plus {
        S(Z) plus S(Z) is S(S(Z)) by P-Succ {
          Z plus S(Z) is S(Z) by P-Zero {  }
        }
      }
    }
  }
}

型レベルプログラム

『判断』を型で,その『導出』を値で書く試みです. REPLに型エラーなしにロードできれば,正しい導出であるということです.

現時点では『判断』を表す型をShowクラスのインスタンスできていません. 判断を表す式を評価したら導出木が出力されるといいのですが,それができない(残念な)システムです. 『判断』をShowクラスのインスタンスにする方法をご存知でしたら教えていただければ幸いです.

第1章

  • Language.BCoPL.TypeLevel.Peano -- ペアノ自然数
  • Language.BCoPL.TypeLevel.Nat -- 自然数の加算・乗算
  • Language.BCoPL.TypeLevel.CompareNat -- 自然数の比較
  • Language.BCoPL.TypeLevel.Exp -- 算術式
  • Language.BCoPL.TypeLevel.EvalNatExp -- 算術式の評価
  • Language.BCoPL.TypeLevel.ReduceNatExp -- 算術式の簡約

第2章

  • Language.BCoPL.TypeLevel.MetaTheory.Nat -- 自然数の加算・乗算に関するメタ定理
  • Language.BCoPL.TypeLevel.MetaTheory.CompareNat -- 自然数の比較に関するメタ定理
  • Language.BCoPL.TypeLevel.MetaTheory.EvalNatExp -- 算術式の評価に関するメタ定理
  • Language.BCoPL.TypeLevel.MetaTheory.ReduceNatExp -- 算術式の簡約に関するメタ定理

hs-bcopl's People

Contributors

nobsun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cutsea110

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.