Qcert.Basic.Typing.TOpsEq



Section TOpsEq.




    Context {fdata:foreign_data}.
    Context {fuop:foreign_unary_op}.
    Context {fbop:foreign_binary_op}.
    Context {ftype:foreign_type}.
    Context {fdtyping:foreign_data_typing}.
    Context {m:brand_model}.
    Context {fuoptyping:foreign_unary_op_typing}.
    Context {fboptyping:foreign_binary_op_typing}.

  Definition typed_unaryOp τin τout := {u:unaryOp|unaryOp_type u τin τout}.

  Definition tunaryop_eqin τout} (uop1 uop2:typed_unaryOp τin τout) : Prop :=
     (x:data), data_type x τin (fun_of_unaryop brand_relation_brands (`uop1)) x = (fun_of_unaryop brand_relation_brands (`uop2)) x.

  Global Instance tunaryop_equivin τout} : Equivalence (@tunaryop_eq τin τout).

  Definition tunaryOp_rewrites_to τ} (u1 u2:unaryOp) :=
    unaryOp_type u1 τ τ
    unaryOp_type u2 τ τ
    ( (x:data), data_type x τ (fun_of_unaryop brand_relation_brands u1) x = (fun_of_unaryop brand_relation_brands u2) x).

  Definition typed_binOp τ τ τout := {b:binOp|binOp_type b τ τ τout}.

  Definition tbinop_eq τ τout} (bop1 bop2:typed_binOp τ τ τout) : Prop :=
     (x1 x2:data),
      data_type x1 τ data_type x2 τ
      (fun_of_binop brand_relation_brands (`bop1)) x1 x2 = (fun_of_binop brand_relation_brands (`bop2)) x1 x2.

  Global Instance tbinop_equiv τ τout} : Equivalence (@tbinop_eq τ τ τout).

  Definition tbinaryOp_rewrites_to τ τ} (b1 b2:binOp) :=
    binOp_type b1 τ τ τ
    binOp_type b2 τ τ τ
    ( (x1 x2:data), data_type x1 τ data_type x2 τ
                          (fun_of_binop brand_relation_brands b1) x1 x2 = (fun_of_binop brand_relation_brands b2) x1 x2).

End TOpsEq.