Rinse dry beans several times, place them in a Dutch oven or lidded pot, cover with a few inches of water, and bring to a boil for 3 minutes. Remove and discard any foam on top. Let sit for 1 hour.
Rinse the beans, and cover them again with 3 quarts (2.8 l) fresh water, stock, or a combination of water and stock. Bring the beans to a boil for about 3 minutes. Remove and discard any foam on top. Turn down the heat, add the optional bay leaf, and simmer partially covered for about 30 minutes while you chop the vegetables.
Chop the potatoes, carrots, celery, and onions so that they are all about 1/2 to 3/4 inches (1 to 2 cm) in size. You can use a food processor on the pulse setting if you’d like.
Heat a large cast-iron frying pan over medium heat and add the olive oil. Add the potatoes, carrots, celery, and onions and let cook for about 6 minutes, stirring occasionally.
Add the garlic to the vegetables along with the rosemary, thyme, and salt. Let cook for another 3 to 4 minutes, stirring occasionally.
Add the entire vegetable mixture to the soup pot and continue simmering for another 30 minutes or until the beans are soft.
Add the pasta, if using, towards the end of the simmer.
Taste and add salt if needed. Serve with a little olive oil drizzled and some freshly grated Parmigiano-Reggiano cheese or a dollop of pesto.