www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

adt-opsem.scrbl.old (3124B)


      1 #lang scribble/manual
      2 
      3 @require["util.rkt"
      4          "adt-utils.rkt"
      5          (for-label (only-meta-in 0 typed/racket))]
      6 @(use-mathjax)
      7 
      8 @title[#:style (with-html5 manual-doc-style)
      9        #:version (version-text)]{Operational Semantics}
     10 
     11 @$${
     12  @$inferrule[
     13  @${\phantom{x}}
     14  @${@ctor[@κ v] ↪ @ctor[@κ v]}
     15  @${@textsc{E-Ctor-Build}}
     16  ]
     17 }
     18 
     19 @$${
     20  @$inferrule[
     21  @${\phantom{x}}
     22  @${(@ctor-pred[@κ] v) ↪ δ(@ctor-pred[@κ], v)}
     23  @${@textsc{E-Ctor-Pred}}
     24  ]
     25 }
     26 
     27 We extend the @${δ} relation to accept in its first position not only constant
     28 functions (members of @${c}), but also members of families of operators
     29 indexed by a constructor label or a field label, like @${@ctor-pred[@κ]},
     30 @${@ctor-val[@κ]} and @record-pred[@repeated{@|ɐ|ᵢ}]
     31 
     32 @$${
     33  @aligned{
     34   δ(@ctor-pred[@κ], v) &= \#t &@textif v =  @ctor[@κ @${v'}] \\
     35   δ(@ctor-pred[@κ], v) &= \#f & \text{ otherwise} \\
     36  }
     37 }
     38 
     39 @todo{Is it really necessary to use a δ-rule for E-Ctor-GetVal ?}
     40 
     41 @$${
     42  @$inferrule[
     43  @${\phantom{x}}
     44  @${(@ctor-val[@κ] v) ↪ δ(@ctor-val[@κ], v)}
     45  @${@textsc{E-Ctor-GetVal}}
     46  ]
     47 }
     48 
     49 @$${
     50  @aligned{
     51   δ(@ctor-val[@κ], @ctor[@κ @${v'}]) & = @${v'}
     52  }
     53 }
     54 
     55 @$${
     56  @$inferrule[
     57  @${\phantom{x}}
     58  @${@record[@repeated{@|ɐ|ᵢ = vᵢ}] ↪ @record[@repeated{@|ɐ|ᵢ = vᵢ}]}
     59  @${@textsc{E-Record-Build}}
     60  ]
     61 }
     62 
     63 @$${
     64  @$inferrule[
     65  @${\phantom{x}}
     66  @${(@record-pred[@repeated{@|ɐ|ᵢ}] v) ↪ δ(@record-pred[@repeated{@|ɐ|ᵢ}], v)}
     67  @${@textsc{E-Record-Pred}}
     68  ]
     69 }
     70 
     71 @$${
     72  @aligned{
     73   δ(@record-pred[@repeated{@|ɐ|ᵢ}], v) &= \#t
     74   if v = @record[@repeated{@|ɐ|ⱼ = vⱼ}] ∧ @repeatset{@|ɐ|ⱼ} = @repeatset{@|ɐ|ᵢ}
     75   \\
     76   δ(@record-pred[@repeated{@|ɐ|ᵢ}], v) &= \#f otherwise
     77   }
     78 }
     79 
     80 @$${
     81  @$inferrule[
     82  @${@|ɐ|' ∈ @repeatset{@|ɐ|ᵢ} \\ @|ɐ|' = @|ɐ|ⱼ}
     83  @${@record[@repeated{@|ɐ|ᵢ = vᵢ}].@|ɐ|' ↪ vⱼ}
     84  @${@textsc{E-Record-GetField}}
     85  ]
     86 }
     87 
     88 
     89 @todo{This ∖ does not make sense because we remove the label @|ɐ|' from a set of
     90  label+value tuples. We must define a separate mathematical operator for removal
     91  of a label+value tuple from a set based on the label.}
     92 @$${
     93  @$inferrule[
     94  @${@|ɐ|ⱼ ∈ @repeatset{@|ɐ|ᵢ}}
     95  @${@opwith[@record[@repeated{@|ɐ|ᵢ = vᵢ}] @${@|ɐ|ⱼ} @${v'}]
     96    ↪ @record[@${@repeatset{@|ɐ|ᵢ = vᵢ} ∖ \{@|ɐ|ⱼ = vⱼ\}}
     97              @${\quad @|ɐ|ⱼ = v'}] \\
     98   (@|ɐ|ⱼ = vⱼ) ∈ @repeatset{@|ɐ|ᵢ = vᵢ}}
     99  @${@textsc{E-Record-With}_1}
    100  ]
    101 }
    102 
    103 @todo{what to do with the = sign? The a = v sign is syntactical, but could
    104  easily be understood as a meta comparison, instead of indicating the
    105  association between the field and the value.}
    106 
    107 @$${
    108  @$inferrule[
    109  @${@|ɐ|' ∉ @repeatset{@|ɐ|ᵢ}}
    110  @${@opwith[@record[@repeated{@|ɐ|ᵢ = vᵢ}] @${@|ɐ|'} @${v'}]
    111    ↪ @record[@repeatset{@|ɐ|ᵢ = vᵢ} @${\quad @${@|ɐ|'} = v'}]}
    112  @${@textsc{E-Record-With}_2}
    113  ]
    114 }
    115 
    116 @$${
    117  @$inferrule[
    118  @${@|ɐ|ⱼ ∈ @repeatset{@|ɐ|ᵢ}}
    119  @${@opwithout[@record[@repeated{@|ɐ|ᵢ = vᵢ}] @${@|ɐ|ⱼ}]
    120    ↪ @record[@${@repeatset{@|ɐ|ᵢ = vᵢ} ∖ \{@|ɐ|ⱼ = vⱼ\}}] \\
    121   (@|ɐ|ⱼ = vⱼ) ∈ @repeatset{@|ɐ|ᵢ = vᵢ}}
    122  @${@textsc{E-Record-Without}}
    123  ]
    124 }