{"record":{"id":"ce6a9db806e0f1c8","repo":"datawhalechina/hello-agents","slug":"ee-check-not-passed-when-add-init-fact-predicate","errorCode":null,"errorMessage":"EE check not passed when add init fact {(predicate, instance)}.","messagePattern":"EE check not passed when add init fact (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Co-creation-projects/BitSecret-GPSAgent/src/gps/symbolic_solver.py","lineNumber":385,"sourceCode":"            for a_point in a_points:\n                for b_point in b_points:\n                    angle = (a_point, v, b_point)\n                    extend_constructions['Angle'].add(angle)\n                    multiple_sym = symbols(''.join(angle) + f'.ma')\n                    self.sym_to_sym[multiple_sym] = sym\n                    self.sym_to_syms[sym].add(multiple_sym)\n\n        # 4.9 add extended constructions\n        operation_id = self._add_operation(('Preset', 'extend_construction', None))\n        for predicate in extend_constructions:\n            for instance in extend_constructions[predicate]:\n                self._add_fact(predicate, instance, premise_ids, operation_id)\n\n        # 5.Add facts\n        operation_id = self._add_operation(('Preset', 'init_fact', None))\n        for predicate, instance in self.parsed_cdl['relation_cdl']:\n            if not self._pass_geometric_constraints(predicate, instance):\n                raise Exception(f'EE check not passed when add init fact {(predicate, instance)}.')\n            if (predicate, instance) in self.fact_id:\n                continue\n            fact_id, _ = self._add_fact(predicate, instance, (), operation_id)\n            if fact_id is None:\n                raise Exception(f'Error when add init fact {(predicate, instance)}.')\n\n        # 6.Set goal\n        init_goal_operation_id = self._add_operation(('Preset', 'init_goal', None))\n        goal_ids = self._add_goals([self.parsed_cdl['goal_cdl']], None, init_goal_operation_id)\n        if goal_ids is None:\n            raise Exception(f\"Error when set init goal {self.parsed_cdl['goal_cdl']}.\")\n        self._check_goals(goal_ids)\n\n    def _add_fact(self, predicate, instance, premise_ids, operation_id):\n        if predicate == 'Eq':\n            instance = self._adjust_expr(instance)\n            if instance is None or len(instance.free_symbols) == 0:\n                return None, set()","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/datawhalechina/hello-agents/blob/606a07d341a47be773fab7f4b71177f53f96b2c3/Co-creation-projects/BitSecret-GPSAgent/src/gps/symbolic_solver.py#L367-L403","documentation":"An exception raised during the initialization phase of the symbolic geometry solver (src/gps/symbolic_solver.py) when adding an initial fact from the problem's relation_cdl fails the extended-entity (EE) check. _pass_geometric_constraints verifies that a fact's predicate/instance tuple is consistent with the geometric entities already constructed (points, lines, circles defined in the CDL); failure means the problem's relation statement references entities that do not exist or are structurally invalid.","triggerScenarios":"Calling the solver on a CDL problem string whose relation section (relation_cdl) contains a predicate mentioning an entity not declared in the construction section — e.g. 'ParallelBetweenLine(A,B,C,D)' where line CD was never constructed — or an instance whose syntax the constraint checker cannot reconcile with prior constructions. Also triggered by malformed CDL where the relation references point labels outside the diagram.","commonSituations":"Hand-written or LLM-generated CDL problems with inconsistent entity references; editing an example problem and renaming a point only in some statements; version drift in the CDL grammar changing how constructions must be declared; importing problems authored for a different solver dialect.","solutions":["Inspect the printed (predicate, instance) pair and check every entity it mentions appears in the problem's construction/entity declarations","Fix the CDL: add the missing construction or correct the entity label typo, then re-run","Validate the CDL with the library's parser (parse_cdl / the CDL linting utilities if present) before invoking the solver","If generating problems with an LLM, add a post-generation validation step that cross-checks entity references against declared entities"],"exampleFix":"# before (problem CDL, relation references undeclared line)\n# constructions omit D, but relation says:\n# PerpendicularBetweenLine(AB, CD)\n\n# after\n# add construction: D = midpoint(...); line CD declared,\n# then PerpendicularBetweenLine(AB, CD) passes the EE check","handlingStrategy":"validation","validationCode":"# before solving, cross-check relation entities against constructed ones\nconstructed = set(entities_defined_in(construction_cdl))\nfor predicate, instance in parse_relations(relation_cdl):\n    used = entities_referenced(instance)\n    missing = used - constructed\n    if missing:\n        raise ValueError(f'relation {predicate}{instance} references undeclared entities: {missing}')","typeGuard":null,"tryCatchPattern":"try:\n    solver.solve(problem_cdl)\nexcept Exception as e:\n    if 'EE check not passed' in str(e):\n        report_invalid_problem(cdl=problem_cdl, reason=str(e))  # authoring error, not a solver bug\n    else:\n        raise","preventionTips":["Validate CDL entity references before invoking the solver","When LLMs generate problems, run an entity-consistency lint pass","Keep constructions and relations in sync when renaming points/lines"],"tags":["geometry","solver","validation","cdl","domain-error"],"backgroundTag":null,"analyzedSha":"606a07d341a47be773fab7f4b71177f53f96b2c3","analyzedAt":"2026-08-14T22:57:27.446Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}