Lvc.Equiv.Equiv

Require Import List.
Require Export Util Var Val Exp Env Map CSet AutoIndTac IL AllInRel.
Require Export EventsActivated StateType paco.

Set Implicit Arguments.

Class ProgramEquivalence S `{StateType S} `{StateType } := {
  progeq : (SProp) → SProp
}.


Class ProofRelation (A:Type) := {
    
    ParamRel : Alist varlist varProp;
    
    ArgRel : onv valonv valAlist vallist valProp;
    
    BlockRel : AF.blockF.blockProp;
    
    RelsOK : E a Z VL VL´, ParamRel a Z ArgRel E a VL VL´length Z = length VL length = length VL´
}.

Inductive simB (SIM:ProgramEquivalence F.state F.state) (r:F.stateF.stateProp) {A} (AR:ProofRelation A) : F.labenvF.labenvAF.blockF.blockProp :=
| simBI a L V Z s
  : ParamRel a Z
    → BlockRel a (F.blockI V Z s) (F.blockI )
    → ( E Y Yv Y´v,
         omap (exp_eval E) Y = Some Yv
         → omap (exp_eval ) = Some Y´v
         → ArgRel V a Yv Y´v
         → progeq r (L, E, stmtApp (LabI 0) Y)
                        (, , stmtApp (LabI 0) ))
    → simB SIM r AR L a (F.blockI V Z s) (F.blockI ).

Definition simL´ (SIM:ProgramEquivalence F.state F.state) r
           {A} AR (AL:list A) L := AIR5 (simB SIM r AR) L AL L .

Definition fexteq´ (SIM:ProgramEquivalence F.state F.state)
           {A} AR (a:A) (AL:list A) E Z s :=
  ParamRel a Z
  
   VL VL´ L (r:rel2 F.state (fun _ : F.stateF.state)),
    ArgRel E a VL VL´
    → simL´ SIM r AR AL L
    → progeq r (L, E[Z <-- List.map Some VL], s)
            (, [ <-- List.map Some VL´], ).