MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / test_angle_table_inbisector_exbisector

Method test_angle_table_inbisector_exbisector

ar_test.py:88–123  ·  view source on GitHub ↗

Test that AR can figure out bisector & ex-bisector are perpendicular.

(self)

Source from the content-addressed store, hash-verified

86 self.assertIn(('b', 'd', ['fact1', 'fact2']), result)
87
88 def test_angle_table_inbisector_exbisector(self):
89 """Test that AR can figure out bisector & ex-bisector are perpendicular."""
90 # Load the scenario that we have cd is bisector of acb and
91 # ce is the ex-bisector of acb.
92 p = pr.Problem.from_txt(
93 'a b c = triangle a b c; d = incenter d a b c; e = excenter e a b c ?'
94 ' perp d c c e'
95 )
96 g, _ = gh.Graph.build_problem(p, ARTest.defs)
97
98 # Create an external angle table:
99 tb = ar.AngleTable('pi')
100
101 # Add bisector & ex-bisector facts into the table:
102 ca, cd, cb, ce = g.names2nodes(['d(ac)', 'd(cd)', 'd(bc)', 'd(ce)'])
103 tb.add_eqangle(ca, cd, cd, cb, 'fact1')
104 tb.add_eqangle(ce, ca, cb, ce, 'fact2')
105
106 # Add a distractor fact to make sure traceback does not include this fact
107 ab = g.names2nodes(['d(ab)'])[0]
108 tb.add_eqangle(ab, cb, cb, ca, 'fact3')
109
110 # Check for all new equalities
111 result = list(tb.get_all_eqs_and_why())
112
113 # halfpi is represented as a tuple (1, 2)
114 halfpi = (1, 2)
115
116 # check that cd-ce == halfpi and this is because fact1 & fact2, not fact3
117 self.assertCountEqual(
118 result,
119 [
120 (cd, ce, halfpi, ['fact1', 'fact2']),
121 (ce, cd, halfpi, ['fact1', 'fact2']),
122 ],
123 )
124
125 def test_angle_table_equilateral_triangle(self):
126 """Test that AR can figure out triangles with 3 equal angles => each is pi/3."""

Callers

nothing calls this directly

Calls 5

add_eqangleMethod · 0.95
get_all_eqs_and_whyMethod · 0.95
build_problemMethod · 0.80
names2nodesMethod · 0.80
from_txtMethod · 0.45

Tested by

no test coverage detected