def remove_vars_match(mat, fmla): """ Remove the variables bindings from a match. This is used to prevent variable capture when applying the match to premises. Make sure free variables are not captured by fmla """ res = dict((s, v) for s, v in mat.iteritems() if il.is_ui_sort(s)) sympairs = [(s, v) for s, v in mat.iteritems() if il.is_constant(s)] symfmlas = il.rename_vars_no_clash([v for s, v in sympairs], [fmla]) res.update((s, w) for (s, v), w in zip(sympairs, symfmlas)) return res
def remove_vars_match(mat,fmla): """ Remove the variables bindings from a match. This is used to prevent variable capture when applying the match to premises. Make sure free variables are not captured by fmla """ res = dict((s,v) for s,v in mat.iteritems() if il.is_ui_sort(s)) sympairs = [(s,v) for s,v in mat.iteritems() if il.is_constant(s)] symfmlas = il.rename_vars_no_clash([v for s,v in sympairs],[fmla]) res.update((s,w) for (s,v),w in zip(sympairs,symfmlas)) # show_match(res) return res