Module("strategy/general/unification",[Imports([ImportWildcard("collection/list"),Import("term/common"),Import("term/properties"),Import("strategy/general/substitution")]),Strategies([SDefNoArgs("equal",Call(SVar("for"),[Id,ListCongNoTail([]),LChoice(CallNoArgs(SVar("UfIdem")),CallNoArgs(SVar("UfDecompose")))]))]),Rules([RDefNoArgs("UfIdem",RuleNoCond(NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("x")]))],Var("ps"))),Var("ps"))),RDefNoArgs("UfDecompose",RuleNoCond(NoAnnoList(ListTail([NoAnnoList(Tuple([NoAnnoList(Explode(Var("f"),Var("xs"))),NoAnnoList(Explode(Var("f"),Var("ys")))]))],Var("ps"))),App(CallNoArgs(SVar("conc")),NoAnnoList(Tuple([App(Call(SVar("zip"),[Id]),NoAnnoList(Tuple([Var("xs"),Var("ys")]))),Var("ps")])))))]),Strategies([SDefNoArgs("diff",Call(SVar("for"),[LRule(RuleNoCond(Var("ps"),NoAnnoList(Tuple([NoAnnoList(List([])),Var("ps")])))),TupleCong(Id,[ListCongNoTail([])]),LChoice(TupleCong(Id,[LChoice(CallNoArgs(SVar("UfIdem")),CallNoArgs(SVar("UfDecompose")))]),CallNoArgs(SVar("UfShift")))]))]),Rules([RDefNoArgs("UfShift",RuleNoCond(NoAnnoList(Tuple([Var("ps1"),NoAnnoList(ListTail([Var("p")],Var("ps2")))])),NoAnnoList(Tuple([NoAnnoList(ListTail([Var("p")],Var("ps1"))),Var("ps2")]))))]),Strategies([SDef("pattern-match",[DefaultVarDec("isvar")],Call(SVar("for"),[LRule(RuleNoCond(Var("pairs"),NoAnnoList(Tuple([Var("pairs"),NoAnnoList(List([]))])))),LRule(RuleNoCond(NoAnnoList(Tuple([NoAnnoList(List([])),Var("sbs")])),Var("sbs"))),LChoice(TupleCong(CallNoArgs(SVar("UfIdem")),[Id]),Choice(Call(SVar("MatchVar"),[CallNoArgs(SVar("isvar"))]),TupleCong(CallNoArgs(SVar("UfDecompose")),[Id])))]))]),Rules([RDef("MatchVar",[DefaultVarDec("isvar")],Rule(NoAnnoList(Tuple([NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("y")]))],Var("ps"))),Var("sbs")])),NoAnnoList(Tuple([Var("ps"),NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("y")]))],Var("sbs")))])),Seq(BA(CallNoArgs(SVar("isvar")),Var("x")),BA(Not(Call(SVar("fetch"),[Scope(["z"],Seq(Match(NoAnnoList(Tuple([Var("x"),Var("z")]))),BA(Not(CallNoArgs(SVar("eq"))),NoAnnoList(Tuple([Var("y"),Var("z")])))))])),Var("sbs")))))]),Strategies([SDef("unify",[DefaultVarDec("isvar")],Call(SVar("for"),[LRule(RuleNoCond(Var("pairs"),NoAnnoList(Tuple([Var("pairs"),NoAnnoList(List([]))])))),LRule(RuleNoCond(NoAnnoList(Tuple([NoAnnoList(List([])),Var("sbs")])),Var("sbs"))),LChoice(TupleCong(CallNoArgs(SVar("UfIdem")),[Id]),Choice(Call(SVar("UfVar"),[CallNoArgs(SVar("isvar"))]),LChoice(Call(SVar("UfSwap"),[CallNoArgs(SVar("isvar"))]),TupleCong(CallNoArgs(SVar("UfDecompose")),[Id]))))]))]),Rules([RDef("UfVar",[DefaultVarDec("isvar")],Rule(NoAnnoList(Tuple([NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("y")]))],Var("ps"))),Var("sbs")])),NoAnnoList(Tuple([Var("ps'"),NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("y")]))],Var("sbs''")))])),Seq(BA(CallNoArgs(SVar("isvar")),Var("x")),Seq(BA(Not(CallNoArgs(SVar("is-subterm"))),NoAnnoList(Tuple([Var("x"),Var("y")]))),AM(BA(Call(SVar("substitute"),[CallNoArgs(SVar("isvar"))]),NoAnnoList(Tuple([NoAnnoList(List([NoAnnoList(Tuple([Var("x"),Var("y")]))])),NoAnnoList(Tuple([Var("sbs"),Var("ps")]))]))),NoAnnoList(Tuple([Var("sbs''"),Var("ps'")]))))))),RDef("UfSwap",[DefaultVarDec("isvar")],Rule(NoAnnoList(Tuple([NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("y")]))],Var("ps"))),Var("sbs")])),NoAnnoList(Tuple([NoAnnoList(ListTail([NoAnnoList(Tuple([Var("y"),Var("x")]))],Var("ps"))),Var("sbs")])),Seq(BA(Not(CallNoArgs(SVar("isvar"))),Var("x")),BA(CallNoArgs(SVar("isvar")),Var("y")))))]),Strategies([SDef("equal",[DefaultVarDec("fltr")],Call(SVar("for"),[Id,ListCongNoTail([]),LChoice(CallNoArgs(SVar("UfIdem")),Seq(Call(SVar("try"),[ListCong([TupleCong(CallNoArgs(SVar("fltr")),[CallNoArgs(SVar("fltr"))])],Id)]),CallNoArgs(SVar("UfDecompose"))))]))]),Strategies([SDef("equal",[DefaultVarDec("fltr1"),DefaultVarDec("fltr2")],Call(SVar("for"),[Id,ListCongNoTail([]),LChoice(CallNoArgs(SVar("UfIdem")),Seq(ListCong([Seq(TupleCong(Call(SVar("try"),[CallNoArgs(SVar("fltr1"))]),[Call(SVar("try"),[CallNoArgs(SVar("fltr1"))])]),Call(SVar("try"),[CallNoArgs(SVar("fltr2"))]))],Id),CallNoArgs(SVar("UfDecompose"))))]))])])
