def METHOD_NAME(kernel, name, value, within=None):
    def process_set(s):
        var_dict = s.get_var_dict()
        try:
            dt, idx = var_dict[name]
        except KeyError:
            return s
        value_aff = isl.Aff.zero_on_domain(s.space) + value
        from loopy.isl_helpers import iname_rel_aff
        name_equal_value_aff = iname_rel_aff(s.space, name, "==", value_aff)
        s = (s
                .add_constraint(
                    isl.Constraint.equality_from_aff(name_equal_value_aff))
                .project_out(dt, idx, 1))
        return s
    new_domains = [process_set(dom) for dom in kernel.domains]
    from pymbolic.mapper.substitutor import make_subst_func
    subst_func = make_subst_func({name: value})
    from loopy.symbolic import SubstitutionMapper, PartialEvaluationMapper
    subst_map = SubstitutionMapper(subst_func)
    ev_map = PartialEvaluationMapper()
    def map_expr(expr):
        return ev_map(subst_map(expr))
    from loopy.kernel.array import ArrayBase
    new_args = []
    for arg in kernel.args:
        if arg.name == name:
            # remove from argument list
            continue
        if not isinstance(arg, ArrayBase):
            new_args.append(arg)
        else:
            new_args.append(arg.map_exprs(map_expr))
    new_temp_vars = {}
    for tv in kernel.temporary_variables.values():
        new_temp_vars[tv.name] = tv.map_exprs(map_expr)
    from loopy.match import parse_stack_match
    within = parse_stack_match(within)
    rule_mapping_context = SubstitutionRuleMappingContext(
            kernel.substitutions, kernel.get_var_name_generator())
    esubst_map = RuleAwareSubstitutionMapper(
            rule_mapping_context, subst_func, within=within)
    return (
            rule_mapping_context.finish_kernel(
                esubst_map.map_kernel(kernel, within=within,
                    # overwritten below, no need to map
                    map_tvs=False, map_args=False))
            .copy(
                domains=new_domains,
                args=new_args,
                temporary_variables=new_temp_vars,
                assumptions=process_set(kernel.assumptions),
                ))