Qcert.Basic.Typing.TDData


Section TDData.


  Context {fdata:foreign_data}.
  Context {ftype:foreign_type}.
  Context {fdtyping:foreign_data_typing}.
  Context {m:brand_model}.

  Inductive ddata_type : ddata drtype Prop :=
  | dtlocal d τ : data_type d τ ddata_type (Dlocal d) (Tlocal τ)
  | dtdistr dl τ : Forall (fun ddata_type d τ) dl ddata_type (Ddistr dl) (Tdistr τ).

  Lemma ddata_dtype_normalized d dτ :
    ddata_type d dτ ddata_normalized brand_relation_brands d.

  Definition drtype_sub (dτ dτ:drtype) : Prop
    := match dτ, dτ with
       | Tlocal τ, Tlocal τ ⇒ τ τ
       | Tdistr τ, Tdistr τ ⇒ τ τ
       | _, _False
       end.

  Global Instance drtype_sub_pre : PreOrder drtype_sub.

  Global Instance drtype_sub_part : PartialOrder eq drtype_sub.

  Global Instance ddata_type_sub :
    Proper (eq ==> drtype_sub ==> impl) ddata_type.

  Lemma drtype_sub_dec (dτ dτ:drtype) :
    {drtype_sub dτ dτ} + {¬ drtype_sub dτ dτ}.

End TDData.