Tensor Network Rewriting Strategies for Satisfiability and Counting