Matroid.is_valid() returns True for invalid matroid

asked 2025-07-17 11:06:59 +0200

ak gravatar image

I am using the is_valid() method from the Matroid class to check if some specific groups of sets form valid matroids. I checked this specific case with the ground set being {0,1,...,7} and the method returns True. However, this is incorrect (For example, {3,5,6} does not extend to any 4 length set). Am I using the class incorrectly or is there a problem with the method? (I am using the online SageMathCell version of Sage)

ind = [{2, 4, 5, 7}, {2, 4, 5, 6}, {2, 3, 4, 7}, {2, 3, 4, 6}, {1, 4, 5, 7}, {1, 4, 5, 6}, {1, 3, 4, 7}, {1, 3, 4, 6}, {0, 2, 5, 7}, {0, 2, 5, 6}, {0, 2, 3, 7}, {0, 2, 3, 6}, {0, 1, 5, 7}, {0, 1, 5, 6}, {0, 1, 3, 7}, {0, 1, 3, 6}, {4, 5, 7}, {4, 5, 6}, {3, 5, 7}, {3, 5, 6}, {3, 4, 7}, {3, 4, 6}, {3, 4, 5}, {2, 5, 7}, {2, 5, 6}, {2, 4, 7}, {2, 4, 6}, {2, 4, 5}, {2, 3, 7}, {2, 3, 6}, {2, 3, 5}, {2, 3, 4}, {1, 5, 7}, {1, 5, 6}, {1, 4, 7}, {1, 4, 6}, {1, 4, 5}, {1, 3, 7}, {1, 3, 6}, {1, 3, 5}, {1, 3, 4}, {1, 2, 7}, {1, 2, 6}, {1, 2, 5}, {1, 2, 4}, {1, 2, 3}, {0, 5, 7}, {0, 5, 6}, {0, 3, 7}, {0, 3, 6}, {0, 3, 5}, {0, 2, 7}, {0, 2, 6}, {0, 2, 5}, {0, 2, 3}, {0, 1, 7}, {0, 1, 6}, {0, 1, 5}, {0, 1, 3}, {0, 1, 2}, {5, 7}, {5, 6}, {4, 7}, {4, 6}, {4, 5}, {3, 7}, {3, 6}, {3, 5}, {3, 4}, {2, 7}, {2, 6}, {2, 5}, {2, 4}, {2, 3}, {1, 7}, {1, 6}, {1, 5}, {1, 4}, {1, 3}, {1, 2}, {0, 7}, {0, 6}, {0, 5}, {0, 3}, {0, 2}, {0, 1}, {7}, {6}, {5}, {4}, {3}, {2}, {1}, {0}, set()]
M = Matroid(groundset = list(range(8)), independent_sets=ind)
M.is_valid()
edit retag flag offensive close merge delete