% The TAPL E-Tuple rule uses a slightly different indexing form, 
% {li=vi ^{i IN 1..j-1}, lj=tj, lk=tk^{k IN j+1..n}
% which ott does not support, so that rule is slightly rephrased here.

% The rules include several :TmPair: hints to the parser.  These are needed
% only to disambiguate these pairs from tuples, in the (artificial) case in
% which we build a language containing both.

grammar
T {{ hol Typ }}, S, U :: Ty ::=                             {{ com types: }}
  | T1 * T2                               ::   :: Pair        {{ com product type }}

t :: Tm ::=                                        {{ com terms: }}
  | { t1 , t2 }                           ::   :: Pair        {{ com pair  }}
  | t . 1                                 ::   :: Proj1        {{ com first projection }}
  | t . 2                                 ::   :: Proj2        {{ com second projection }}

v :: Va ::=                                        {{ com values: }}
  | { v1 , v2 }                           ::   :: Pair        {{ com pair value }}


defns 
Jop :: '' ::= 

defn 
t --> t' :: :: red :: E_ {{ com Evaluation }} by

---------------- :: PairBeta1
:TmPair: {v1,v2}.1 --> v1

---------------- :: PairBeta2
:TmPair: {v1,v2}.2 --> v2

t1 --> t1'
-------------- :: Proj1
t1.1 --> t1'.1

t1 --> t1'
-------------- :: Proj2
t1.2 --> t1'.2

t1 --> t1'
-------------------- :: Pair1
:TmPair: {t1,t2} --> :TmPair: {t1',t2}

t2 --> t2'
-------------------- :: Pair2
:TmPair: {v1,t2} --> :TmPair: {v1,t2'}



defns
Jtype :: '' ::= 

defn
G |- t : T :: :: typing :: T_ {{ com Typing }} by

G|-t1:T1  
G|-t2:T2
----------------- :: Pair
G|- :TmPair: {t1,t2}:T1*T2

G|- t1:T1*T2
------------- :: Proj1
G|- t1.1 : T1

G|- t1:T1*T2
------------- :: Proj2
G|- t1.2 : T2
