Module("collection/list/bag",[Imports([Import("collection/list/common")]),Rules([RDefNoArgs("bag-insert",RuleNoCond(NoAnnoList(Tuple([NoAnnoList(Tuple([Var("x"),Var("j")])),Var("l")])),App(LChoice(Call(SVar("fetch"),[LRule(Rule(NoAnnoList(Tuple([Var("y"),Var("i")])),NoAnnoList(Tuple([Var("y"),App(CallNoArgs(SVar("add")),NoAnnoList(Tuple([Var("i"),Var("j")])))])),BA(CallNoArgs(SVar("eq")),NoAnnoList(Tuple([Var("y"),Var("x")])))))]),Build(NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("j")]))],Var("l"))))),Var("l")))),RDefNoArgs("bag-union",RuleNoCond(NoAnnoList(Tuple([Var("l1"),Var("l2")])),App(Call(SVar("foldr"),[Build(Var("l2")),CallNoArgs(SVar("bag-insert"))]),Var("l1")))),RDef("bag-insert",[DefaultVarDec("equ")],RuleNoCond(NoAnnoList(Tuple([NoAnnoList(Tuple([Var("x"),Var("j")])),Var("l")])),App(LChoice(Call(SVar("fetch"),[LRule(RuleNoCond(NoAnnoList(Tuple([Var("y"),Var("i")])),NoAnnoList(Tuple([App(CallNoArgs(SVar("equ")),NoAnnoList(Tuple([Var("x"),Var("y")]))),App(CallNoArgs(SVar("add")),NoAnnoList(Tuple([Var("i"),Var("j")])))]))))]),Build(NoAnnoList(ListTail([NoAnnoList(Tuple([Var("x"),Var("j")]))],Var("l"))))),Var("l")))),RDef("bag-union",[DefaultVarDec("equ")],RuleNoCond(NoAnnoList(Tuple([Var("l1"),Var("l2")])),App(Call(SVar("foldr"),[Build(Var("l2")),Call(SVar("bag-insert"),[CallNoArgs(SVar("equ"))])]),Var("l1"))))])])
