fact: Definition abstract A B (x : A) (t : B) : M (moption _) := mif is_evar x then M.ret mNone else r <- (mfix1 loop (r : dynr) : M (moption (result x (elemr r))) := let r := reduce_dyns r in let '(Dynr r') := r in mif is_evar (r') then M.ret mNone else mmatch r as r' return M (moption (result x (elemr r'))) with | Dynr x =c> ret (mSome (R (fun x=>x) (meq_refl _))) | [? P Q] Dynr (P -> Q) =n> P' <- loop (Dynr P); Q' <- loop (Dynr Q); match P', Q' with | mSome P', mSome Q' => ret (mSome (non_dep_eq P' Q')) | mSome P', mNone => ret (mSome (non_dep_eq P' (R (fun _ => Q) meq_refl))) | mNone, mSome Q' => ret (mSome (non_dep_eq (R (fun _ => P) meq_refl) Q')) | mNone, mNone => ret mNone end | _ as r => let r' := dreduce (typer) (typer r) in mmatch r as r' return M (moption (result x (elemr r'))) with | [? A' (t1 : A' -> r') t2] Dynr (t1 t2) =n> r1 <- loop (Dynr t1); r2 <- loop (Dynr t2); match r1, r2 with | mSome r1, mSome r2 => ret (mSome (abs_app r1 r2)) | mSome r1, mNone => ret (mSome (abs_app r1 (R (fun _ => t2) meq_refl))) | mNone, mSome r2 => ret (mSome (abs_app (R (fun _ => t1) meq_refl) r2)) | mNone, mNone => ret mNone end | [? z] z =n> let def := R (fun _=>elemr z) (meq_refl) : (result x (elemr z)) in mtry let '@Dynr T e := z in C <- destcase e; cas <- construct_case loop C; match cas with | mSome cas => mmatch cas with | [? el: A -> (typer z)] Dyn el =c> eq <- coerce (meq_refl (elemr z)); ret (mSome (R (t:=elemr z) el eq)) | [? e] e => print "nope:";; print_term e;; ret (mNone) end | mNone => ret mNone end with NotAMatchExp => ret mNone end end end) (Dynr t); let reduced := reduce_all r in ret reduced.
imports: Mtac2(Base Logic Datatypes List) Strings.String