Require Import Coq.Bool.Bool.
Require Import Coq.ZArith.ZArith.
Require Import Coq.Lists.List.
Require Import Charge.Logics.ILogic.
Require Import Charge.Logics.ILEmbed.
Require Import MapPositive.
Require Import ExtLib.Core.RelDec.
Require Import ExtLib.Data.Fun.
Require Import ExtLib.Data.Positive.
Require Import ExtLib.Tactics.
Require Import MirrorCore.SymI.
Require Import MirrorCore.TypesI.
Variable RType_typ : RType typ.
Variable RelDec_typ_eq : RelDec (@eq typ).
Variable RelDecCorrect_typ_eq : RelDec_Correct RelDec_typ_eq.
| ief_embed (from to : typ).
(* | fref (fi : positive) *)
Global Instance RelDec_iefunc : RelDec (@eq iefunc) :=
| ief_embed a t, ief_embed a' t' => a ?[eq] a' && t ?[eq] t'
Global Instance RelDec_Correct_iefunc : RelDec_Correct RelDec_iefunc.
destruct x; destruct y; simpl;
try solve [ try rewrite andb_true_iff ;
repeat rewrite rel_dec_correct; intuition congruence ].
Definition logic_ops := forall (t : typ),
option (ILogicOps (typD t)).
Definition embed_ops := forall (t u : typ),
option (EmbedOp (typD t) (typD u)).
Definition logic_opsOk (l : logic_ops) : Prop :=
forall g, match l g return Prop with
Definition embed_opsOk (ls : logic_ops) (es : embed_ops) : Prop :=
match ls t , ls t' , es t t' return Prop with
| Some a , Some b , Some T => @Embed _ a _ _ T
Variable Typ2_tyArr : Typ2 _ Fun.
Variable Typ0_tyProp : Typ0 _ Prop.
Let tyArr : typ -> typ -> typ := @typ2 _ _ _ _.
Let tyProp : typ := @typ0 _ _ _ _.
Definition typeof_func (f : iefunc) : option typ :=
| Some _ => Some (tyArr a b)
Definition typ2_cast_bin (a b c : typ)
: (typD a -> typD b -> typD c) -> typD (tyArr a (tyArr b c)) :=
match eq_sym (typ2_cast a (tyArr b c)) in _ = t
| eq_refl => match eq_sym (typ2_cast b c) in _ = t
Definition typ2_cast_quant (a b c : typ)
: ((typD a -> typD b) -> typD c) -> typD (tyArr (tyArr a b) c) :=
match eq_sym (typ2_cast (tyArr a b) c) in _ = t
| eq_refl => match eq_sym (typ2_cast a b) in _ = t
Definition funcD (f : iefunc) :
return match typeof_func f with
return match match x with
| Some _ => Some (tyArr t u)
match eq_sym (typ2_cast t u) in _ = t return t
| eq_refl => @embed _ _ _
Global Instance RSym_iefunc : RSym iefunc :=
{ typeof_sym := typeof_func
; sym_eqb := fun a b => Some (rel_dec a b)
Global Instance RSymOk_iefunc : RSymOk RSym_iefunc.
intros. unfold sym_eqb; simpl.
consider (a ?[ eq ] b); auto.