@@ -66,6 +66,7 @@ data Tactic = Attack
66 | Forall Name Raw
66 | Forall Name Raw
67 | LetBind Name Raw Raw
67 | LetBind Name Raw Raw
68 | Rewrite Raw
68 | Rewrite Raw
69 | PatVar Name
70 | PatVar Name
70 | PatBind Name
71 | PatBind Name
71 | Focus Name
72 | Focus Name
@@ -539,6 +540,13 @@ rewrite tm ctxt env (Bind x (Hole t) xp@(P _ x' _)) | x == x' =
539 rname = MN 0 "replaced"
540 rname = MN 0 "replaced"
540rewrite _ _ _ _ = fail "Can't rewrite here"
541rewrite _ _ _ _ = fail "Can't rewrite here"
543+equiv :: Raw -> RunTactic
544+equiv tm ctxt env (Bind x (Hole t) sc) =
545+ do (tmv, tmt) <- lift $ check ctxt env tm
546+ lift $ converts ctxt env tmv t
547+ return $ Bind x (Hole tmv) sc
548+equiv tm ctxt env _ = fail "Can't equiv here"
542patbind :: Name -> RunTactic
550patbind :: Name -> RunTactic
543patbind n ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' =
551patbind n ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' =
544 do let t' = case t of
552 do let t' = case t of
@@ -724,6 +732,7 @@ process t h = tactic (Just h) (mktac t)
724 mktac (Forall n t) = forall n t
732 mktac (Forall n t) = forall n t
725 mktac (LetBind n t v) = letbind n t v
733 mktac (LetBind n t v) = letbind n t v
726 mktac (Rewrite t) = rewrite t
734 mktac (Rewrite t) = rewrite t
735+ mktac (Equiv t) = equiv t
727 mktac (PatVar n) = patvar n
736 mktac (PatVar n) = patvar n
728 mktac (PatBind n) = patbind n
737 mktac (PatBind n) = patbind n
729 mktac (CheckIn r) = check_in r
738 mktac (CheckIn r) = check_in r