dependent-typetheorem-provingformal-methodsmmt

How do I access constants and notations from structures in MMT?


Given the following theories, which formalize meaningless stuff for the purpose of a small MWE,

theory Meta : http://cds.omdoc.org/urtheories?LF =
  ℕ: type ❙
  prop: type ❙
  or: prop ⟶ prop ⟶ prop ❘ # 1 ∨ 2 ❙
❚

theory S : ?Meta =
  c: ℕ ⟶ ℕ ⟶ prop ❘ # 1 + 2 ❙
  d: ℕ ⟶ ℕ ⟶ ℕ ⟶ prop ❘ # 1 |- 2 ∶ 3 ❙
❚

how do I access the contents from S when having declared two S-structures as below?

theory T : ?Meta =
  structure s1 : ?S = ❚
  structure s2 : ?S = ❚

  n: ℕ ❙

  // How do I access constants c, d and their notations from s1, s2?
❚

Solution

  • Constants are available via <structure name>/<constant name>

    theory T : ?Meta =
      structure s1 : ?S = ❚
      structure s2 : ?S = ❚
    
      n: ℕ ❙
    
      c_usage1 = s1/c n n ❙
      c_usage2 = s2/c n n ❙
      c_usage_combined = (s1/c n n) ∨ (s2/c n n) ❙
    
      d_usage1 = s1/d n n ❙
      d_usage2 = s2/d n n ❙
      d_usage_combined = (s1/d n n) ∨ (s2/d n n ) ❙
    ❚
    

    Notations get <structure name>/ prepended to their first presentation marker

    For instance, the notation defined as # 1 + 2 has only the single presentation marker +, thus is accessed via ... <structure name>/+ .... On the other hand, a notation defined as # 1 |- 2 ∶ 3 has two presentation markers: |- and . It is accessed via ... <structure name>/|- ... ∶ ...:

    theory T : ?Meta =
      structure s1 : ?S = ❚
      structure s2 : ?S = ❚
    
      n: ℕ ❙
    
      c_usage1 = n s1/+ n ❙
      c_usage2 = n s2/+ n ❙
      c_usage_combined = (n s1/+ n) ∨ (n s2/+ n) ❙
    
      d_usage1 = n s1/|- n ∶ n ❙
      d_usage2 = n s2/|- n ∶ n ❙
      d_usage_combined = (n s1/|- n ∶ n) ∨ (n s2/|- n ∶ n) ❙
    ❚