Module cNRAEnvtoNRA


Section cNRAEnvtoNRA.
  Require Import String.
  Require Import List.
  Require Import BasicRuntime.
  Require Import NRARuntime.
  Require Import cNRAEnvRuntime.

  Context {fr:foreign_runtime}.

  Section Top.
    Context (h:brand_relation_t).

    Definition nraenv_core_to_nra_top (q:nraenv_core) : nra :=
      AApp (nra_of_nraenv_core q) (nra_context (AConst (drec nil)) (AConst dunit)).

    Theorem nraenv_core_to_nra_top_correct :
      forall q:nraenv_core, forall global_env:bindings,
          nraenv_core_eval_top h q global_env =
          nra_eval_top h (nraenv_core_to_nra_top q) global_env.
Proof.
      intros.
      unfold nraenv_core_eval_top.
      unfold nra_eval_top.
      unfold nraenv_core_to_nra_top.
      rewrite unfold_env_nra_sort.
      simpl.
      unfold nra_context_data.
      rewrite drec_sort_idempotent.
      reflexivity.
    Qed.
  End Top.
    
End cNRAEnvtoNRA.