| 数式での翻訳 | 
|---|
\(\{I,V\}\)を記号とする文字列の集合 \[ \textrm{KaiMei} = \{\textrm{I},\textrm{II},\textrm{III},\textrm{IV},\textrm{V},\textrm{VI},\textrm{VII}\} \] に属する文字列を階名と呼びます。完全に公理的集合論で定義をしたい場合は、幹音の記事において導入した規則で英語のアルファベットを自然数にコードすることで、\(\mathbb{N}\)を記号の集合とする文字列の集合に翻訳して下さい。 全単射 \[ \begin{align} \textrm{KaiMei} &\to \mathbb{Z}/7 \mathbb{Z} \\
 \textrm{I} & \mapsto 0 \\
 \textrm{II} & \mapsto 1 \\
 \textrm{III} & \mapsto 2 \\
 \textrm{IV} & \mapsto 3 \\
 \textrm{V} & \mapsto 4 \\
 \textrm{VI} & \mapsto 5 \\
 \textrm{VII} & \mapsto 6 \end{align} \] により\(\textrm{KaiMei}\)を\(\mathbb{Z}/7 \mathbb{Z}\)と同一視します。\(\textrm{I}\)に対応する\(\mathbb{Z}/7 \mathbb{Z}\)の元は\(1\)ではなく\(0\)であることに注意しましょう。
階名単体ではさほど用途がないのですが、例えば次の音階の記事で導入する音階という概念と組み合わせて使われます。具体的には、音階と階名の組をピッチクラスへ翻訳する単射な写像を定義していきます。そうすることで、音階を固定するごとに\(7\)種類のピッチクラスが階名により番号付けられるわけです。ただしこの番号付けと\(\mathbb{Z}/7 \mathbb{Z}\)に備わっている環構造は特筆すべき整合性を持たないため、\(\textrm{KaiMei}\)に誘導される環構造にはあまり意味がありません。それでも階名\(n\)の次の階名を表すのに\(n+1\)と書けることは便利であるため、\(\{0,1,2,3,4,5,6\}\)ではなく\(\mathbb{Z}/7 \mathbb{Z}\)との同一視を行います。例えば\(\textrm{III} + 2 = \textrm{V}\)や\(\textrm{VI} + 3 = \textrm{II}\)といった等式が成り立ちます。
| C++での宣言 | 
|---|
階名のクラスおよび関係する関数たちを以下のように宣言します。
class KaiMei :
  public Mod<7>
{
  string m_s;
public:
  KaiMei( const int& n ) noexcept;
  inline const string& Display() const noexcept;
  static inline const KaiMei& I() noexcept;
  static inline const KaiMei& II() noexcept;
  static inline const KaiMei& III() noexcept;
  static inline const KaiMei& IV() noexcept;
  static inline const KaiMei& V() noexcept;
  static inline const KaiMei& VI() noexcept;
  static inline const KaiMei& VII() noexcept;
private:
  static string SymbolTable( const int& n ) noexcept;
};
const KaiMei& operator+( const KaiMei& n1 , const int& n2 ) noexcept;
| C++での定義 | 
|---|
実際の実装例についてはこちらをご覧下さい。実装においては以下の仕様を要請します。
- inline KaiMei::KaiMei( const int& n ) noexceptはメンバ初期化子リスト- Mod<7>( n ),- m_s( SymbolTable( n ) )で定める。
- inline string KaiMei::Display() const noexceptは- return m_sと定める。
- static inline const KaiMei& KaiMei::I() noexcept~- static inline const KaiMei& KaiMei::VII() noexceptはそれぞれ\(i+1\)のアラビア数字表記が関数名とメタに等しいような唯一の\(i \in \{0,1,2,3,4,5,6\}\)を用いて- const KaiMei nを- KaiMei( i )と定め、- return nと定める。
- static string KaiMei::SymbolTable( const int& n ) noexceptは- n < 7の時に- const string sを- "I",- "II",- "III",- "IV",- "V",- "VI",- "VII"の- n+1番目と定め、- return sと定める。
- const KaiMei& operator+( const KaiMei& n1 , const int& n2 ) noexceptは- const Mod<7> nを- Mod<7>( n1.Represent() + n2 )で定め、- KaiMei::I()~- KaiMei::VII()の- n.Represent()+1番目の戻り値を返す。