diff --git a/src/main.tex b/src/main.tex index 13aa6ba..d01f364 100755 --- a/src/main.tex +++ b/src/main.tex @@ -6,6 +6,10 @@ \usepackage[dvips]{graphicx} \usepackage{latexsym} +\usepackage{amsmath,amssymb,amsfonts,amsthm} +\usepackage{listings,listings-rust} + + \begin{document} % Title, Author %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -61,11 +65,16 @@ W-calculusは、変数の過去の値にアクセスする機能(すなわち 筆者が開発している音楽のためのプログラミング言語mimium(MInimal-Musical-medIUM)\cite{Matsuura2021}では、ラムダ計算に遅延とフィードバックを基本構文として組み込むことで、汎用プログラミング言語と同様の構文を維持しながら、信号処理を簡潔に表現することができる。ただ、mimiumのこれまでの問題として、意味論が厳密に定義できていないために、遅延やフィードバックを含む内部状態を伴う関数と、再帰的関数や高階関数の組み合わせを含むコードをコンパイルできないという点があった。 -本稿では、W-calculusの2つの制限(非線形システムと高階関数)を緩和する形で設計された、mimiumの中間表現となる計算モデル$\lambda_{mmm}$を提案する。以降の節では、まず第2節で$\lambda_{mmm}$のシンタックスと型付け規則、ナイーブな操作的意味論を簡単に紹介する。この操作的意味論は現実的に直接リアルタイム実行することが難しいため、実際のmimiumの実行環境では、$\lambda_{mmm}$を実際に実行するための仮想機械(VM)とその命令セットを持つ。第3章ではこのVMおよび命令セットの設計について概説する。第4節では、現状の$\lambda_{mmm}$を下敷きにしたmimiumの設計の今後の課題および展望を3つの視点で議論する。1つ目は、計算がグローバル環境の評価時に発生するのか、実際の信号処理中に発生するのかをユーザーが区別しなければならないという問題である。2つ目は、if式による部分的な内部状態更新を許すかどうかが信号処理の表現できる範囲およびユーザー体験に大きな影響を与えるという点である。3つ目は、$\lambda_{mmm}$の中間表現を取り入れることで外部関数の呼び出しが容易になるという点である。 +本稿では、W-calculusの2つの制限(非線形システムと高階関数)を緩和する形で設計された、mimiumの中間表現となる計算モデル$\lambda_{mmm}$を提案する\footnote{本稿の内容は、2024年11月に行われたInternational Faust Conference 2024での筆者の発表\cite{matsuura2024}を、対象読者として日本語話者かつ言語設計コミュニティを想定し大幅に改稿したものである。}。以降の節では、まず第2節で$\lambda_{mmm}$のシンタックスと型付け規則、ナイーブな操作的意味論を簡単に紹介する。この操作的意味論は現実的に直接リアルタイム実行することが難しいため、実際のmimiumの実行環境では、$\lambda_{mmm}$を実際に実行するための仮想機械(VM)とその命令セットを持つ。第3章ではこのVMおよび命令セットの設計について概説する。第4節では、現状の$\lambda_{mmm}$を下敷きにしたmimiumの設計の今後の課題および展望を3つの視点で議論する。1つ目は、計算がグローバル環境の評価時に発生するのか、実際の信号処理中に発生するのかをユーザーが区別しなければならないという問題である。2つ目は、if式による部分的な内部状態更新を許すかどうかが信号処理の表現できる範囲およびユーザー体験に大きな影響を与えるという点である。3つ目は、$\lambda_{mmm}$の中間表現を取り入れることで外部関数の呼び出しが容易になるという点である。 \section{音楽のためのプログラミング言語mimiumの仕様} +\input{syntax.tex} + +\input{typing.tex} + +\input{semantics.tex} \section{論文1ページ目の情報} diff --git a/src/ref_bibtex.bib b/src/ref_bibtex.bib index 22713d3..5d2745e 100644 --- a/src/ref_bibtex.bib +++ b/src/ref_bibtex.bib @@ -41,7 +41,7 @@ file = {/Users/tomoya/Zotero/storage/L7F62UTL/Languages_for_Computer_Music.pdf;/Users/tomoya/Zotero/storage/QVM64Q68/Dannenberg - 2018 - Languages for Computer Music.pdf} } -@inproceedings{Dannenberg2018, +@inproceedings{Dannenberg2018ugg, title = {{{UGG}}: {{A Unit Generator Generator}}}, booktitle = {Proceedings of the 2018 {{International Computer Music Conference}}}, author = {Dannenberg, Roger B}, @@ -151,17 +151,8 @@ file = {/Users/tomoya/Zotero/storage/PG6GGQCV/Mathews - 1963 - The Digital Computer as a Musical Instrument.pdf} } -@inproceedings{Matsuura2021, - title = {Mimium: {{A Self-Extensible Programming Language}} for {{Sound}} and {{Music}}}, - booktitle = {{{FARM}} 2021 - {{Proceedings}} of the {{ACM SIGPLAN International Workshop}} on {{Functional Art}}, {{Music}}, {{Modeling}}, and {{Design}}}, - author = {Matsuura, Tomoya and Jo, Kazuhiro}, - year = {2021}, - doi = {10.1145/3471872.3472969}, - file = {/Users/tomoya/Zotero/storage/ERG4LFIZ/Matsuura and Jo - 2021 - mimium A Self-Extensible Programming Language for.pdf} -} - @inproceedings{matsuura2021, - title = {Mimium: A Self-Extensible Programming Language for Sound and Music}, + title = {Mimium: {{A Self-Extensible Programming Language}} for {{Sound}} and {{Music}}}, shorttitle = {Mimium}, booktitle = {Proceedings of the 9th {{ACM SIGPLAN International Workshop}} on {{Functional Art}}, {{Music}}, {{Modelling}}, and {{Design}}}, author = {Matsuura, Tomoya and Jo, Kazuhiro}, @@ -175,7 +166,7 @@ urldate = {2024-07-09}, abstract = {We propose a programming language for music named mimium, which combines temporal-discrete control and signal processing in a single language. mimium has an intuitive imperative syntax and can use stateful functions as Unit Generator in the same way as ordinary function definitions and applications. Furthermore, the runtime performance is made equivalent to that of lower-level languages by compiling the code through the LLVM compiler infrastructure. By using the strategy of adding a minimum number of features for sound to the design and implementation of a general-purpose functional language, mimium is expected to lower the learning cost for users, simplify the implementation of compilers, and increase the self-extensibility of the language. In this paper, we present the basic language specification, semantics for simple task scheduling, the semantics for stateful functions, and the compilation process. mimium has certain specifications that have not been achieved in existing languages. Future works suggested include extending the compiler functionality to combine task scheduling with the functional paradigm and introducing multi-stage computation for parametric replication of stateful functions.}, isbn = {978-1-4503-8613-5}, - file = {/Users/tomoya/Zotero/storage/TDBLJQTL/Matsuura and Jo - 2021 - mimium a self-extensible programming language for.pdf} + file = {/Users/tomoya/Zotero/storage/ERG4LFIZ/Matsuura and Jo - 2021 - mimium A Self-Extensible Programming Language for.pdf;/Users/tomoya/Zotero/storage/TDBLJQTL/Matsuura and Jo - 2021 - mimium a self-extensible programming language for.pdf} } @misc{matsuura2024, diff --git a/src/semantics.tex b/src/semantics.tex new file mode 100644 index 0000000..b20ff06 --- /dev/null +++ b/src/semantics.tex @@ -0,0 +1,50 @@ +\begin{figure*}[ht] + \centering + \begin{tabular}{ccc} + \begin{minipage}[b]{0.31\hsize} + \centering + \begin{equation*} + \frac{E^n \vdash e_2 \Downarrow v_d \ n>v_d \ E^{n-v_d} \vdash e_1 \Downarrow v}{E^n \vdash\ delay\ n\ e_1\ e_2 \Downarrow v} + \end{equation*}\textrm{E-DELAY} + \end{minipage} & + \begin{minipage}[b]{0.31\hsize} + \centering + \begin{equation*} + \frac{}{E^n \vdash\ \lambda x.e \Downarrow cls(\lambda x.e , E^n) } + \end{equation*}\textrm{E-LAM} + \end{minipage}& + \begin{minipage}[b]{0.31\hsize} + \centering + \begin{equation*} + \frac{ E^{n-1} \vdash e \Downarrow v_f\ E^n, x \mapsto v_f \vdash e \Downarrow v }{E^n \vdash\ feed\ x.e \Downarrow v} + \end{equation*}\textrm{E-FEED} + \end{minipage} + \\ + \begin{minipage}[b]{0.31\hsize} + \centering + \begin{equation*} + \frac{E^n \vdash e_c \Downarrow n \quad n > 0\ E^n \vdash e_t\ \Downarrow v\ }{E^n \vdash\ if (e_c)\ e_t\ else\ e_e \Downarrow v } + \end{equation*}\textrm{E-IFTRUE} + \end{minipage} + & + \begin{minipage}[b]{0.31\hsize} + \centering + \begin{equation*} + \frac{E^n \vdash e_c \Downarrow n \quad n \leqq0\ E^n \vdash e_e\ \Downarrow v\ }{E^n \vdash\ if (e_c)\ e_t\ else\ e_e \Downarrow v } + \end{equation*}\textrm{E-IFFALSE} + \end{minipage} + & + \\ + \multicolumn{3}{c}{ + \begin{minipage}[b]{15cm} + \centering + \begin{equation*} + \frac{E^n \vdash e_1 \Downarrow cls(\lambda x_c.e_c, E^n_c)\ E^n \vdash e_2 \Downarrow v_2\ E^n_c,\ x_c \mapsto v_2 \vdash e_c \Downarrow v }{E^n \vdash\ e_1\ e_2 \Downarrow v } + \end{equation*}\textrm{E-APP} + \end{minipage} + } + \\ + + \end{tabular} + \caption{\label{fig:semantics}{\it$\lambda_{mmm}$のナイーブな評価におけるビッグステップ操作的意味論の抜粋。}} + \end{figure*} \ No newline at end of file diff --git a/src/syntax.tex b/src/syntax.tex new file mode 100644 index 0000000..71f2aba --- /dev/null +++ b/src/syntax.tex @@ -0,0 +1,57 @@ +\begin{figure}[ht] + + \begin{tabular}{cc} + \begin{minipage}[b]{0.4\hsize} + \centering + + \begin{equation*} + \begin{aligned} + &\tau_p &::= &\;R &[real]& \\ + & &\; | &\;N &[nat] & \\ + &\tau &::= &\;\tau_p & & \\ + & &\; | &\;\tau \to \tau &[fun]& + % |&\quad \langle \tau \rangle + \end{aligned} + \end{equation*} + \textrm{Types} + \end{minipage}& + + \begin{minipage}[b]{0.4\hsize} + \centering + \begin{equation*} + \begin{aligned} + &v_p &::=&\; r \; r \in \mathbb{R}&\\ + & &\;|&\; n \; n \in \mathbb{N}&\\ + &v &::=&\; v_p &\\ + & &\;|&\; cls(\lambda x.e, E) & + %%|& \quad (e_1,e_2) \quad & [product]\\ + %%|& \quad \pi_n e \quad n\in \mathbb{N},\; n>0 \quad & [project]\\ + %%|& \quad \langle e \rangle \quad & [code] \\ + %%|& \quad \textasciitilde e \quad & [escape] + \end{aligned} + \end{equation*} + \textrm{Values} + \end{minipage}\\ + \multicolumn{2}{l}{ + \begin{minipage}[t]{0.4\hsize} + \begin{equation*} + \begin{aligned} +&e&::=& \; x \;\; (x \in {v_p}) & [value] &\\ +& & |& \; \lambda x.e & [lambda] &\\ +& & |& \; e_1 \; e_2 & [app] &\\ +& & |& \; if\; (e_c)\; e_t\; else\; e_e & [if] &\\ +& & |& \; delay\; n \; e_1 \; e_2 \;\; (n \in \mathbb{N})& [delay] &\\ +& & |& \; feed \; x.e & [feed] &\\ +& & |& ... & & + %%|& \quad (e_1,e_2) \quad & [product]\\ + %%|& \quad \pi_n e \quad n\in \mathbb{N},\; n>0 \quad & [project]\\ + %%|& \quad \langle e \rangle \quad & [code] \\ + %%|& \quad \textasciitilde e \quad & [escape] + \end{aligned} + \end{equation*} + \end{minipage} + } +\end{tabular} +\centering \textrm{Terms} %置き方おかしいけどこれで上手くレイアウトされてるのでこのまま +\caption{\label{fig:syntax_v}{\it$\lambda_{mmm}$の値、型、項の定義の抜粋。基本演算などは省略した。}} +\end{figure} \ No newline at end of file diff --git a/src/typing.tex b/src/typing.tex new file mode 100644 index 0000000..c0fe663 --- /dev/null +++ b/src/typing.tex @@ -0,0 +1,34 @@ +\begin{figure}[ht] + \begin{tabular}{cc} + + \begin{minipage}[t]{0.3\hsize} + \centering + \begin{equation*} + \frac{\Gamma, x:\tau_a \vdash e:\tau_b}{\Gamma \vdash \lambda x.e:\tau_a \to \tau_b } + \end{equation*}\textrm{T-LAMBDA} + \end{minipage} & + + \begin{minipage}[t]{0.62\hsize} + \centering + \begin{equation*} + \frac{ \Gamma \vdash n{:}N \; \Gamma \vdash e1{:}\tau\quad \Gamma \vdash e_2{:}R }{\Gamma \vdash delay\, n\, e_1\, e_2 : \tau} + \end{equation*}\textrm{T-DELAY} + \end{minipage}\\ + + \begin{minipage}[t]{0.3\hsize} + \centering + \begin{equation*} + \frac{\Gamma, x : \tau_p \vdash e: \tau_p }{\Gamma \vdash feed\ x.e:\tau_p} + \end{equation*}\textrm{T-FEED} + \end{minipage}& + + \begin{minipage}[t]{0.62\hsize} + \centering + \begin{equation*} + \frac{ \Gamma \vdash e_c : R\ \Gamma \vdash e_t:\tau\ \Gamma \vdash e_e:\tau }{\Gamma \vdash if\ (e_c)\ e_t\ e_e\ : \tau} + \end{equation*}\textrm{T-IF} + \end{minipage}\\ + + \end{tabular} + \caption{\label{fig:typing}{\it$\lambda_{mmm}$の型付け規則の抜粋。}} + \end{figure} \ No newline at end of file