You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: categorized_tag_list_component.rb
    path of file: ./repos/danbooru/app/components
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# A vertical tag list, with tags split
    
  def tag_tree(tag_list = tags, level = 0)
    tag_list.map do |tag|
      # If we're at the top level and this is a subtag (a tag that implies another tag), then ignore it (it will be included beneath another tag)
      if level == 0 && tag.name.in?(antecedent_names)
        nil

      # If this is a parent tag (a tag implied by other tags), then build the subtree of tags that imply it.
      elsif tag.name.in?(consequent_names)
        antecedents = implications.select { |ti| ti.consequent_name == tag.name }.map(&:antecedent_name)
        subtags = tags.select { |t| t.name.in?(antecedents) }

        [tag, tag_tree(subtags, level + 1)]

      # If this tag isn't implied by anything, then it doesn't have any subtags.
      else
        [tag, []]
      end
    end.compact
  end
end