Modules
Modules¶
Core orchestration for geometric search.
Engine coordinates the deductive database (discrete inference rules) with the
algebraic system (symbolic equation solving) against a mutable State. The two
systems alternate until a goal is solved, a fixed point is reached, or a depth
limit is hit.
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Engine
¶
Coordinate deductive and algebraic reasoning over a State.
Typical usage::
state = State()
db = DeductiveDatabase(state)
alg = AlgebraicSystem(state)
engine = Engine(state, db, alg)
engine.search()
Source code in pyeuclid/engine/engine.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
__init__(state, deductive_database, algebraic_system)
¶
Create an engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
Shared state tracking relations, equations, and goal. |
required |
deductive_database
|
DeductiveDatabase
|
Applies inference rules. |
required |
algebraic_system
|
AlgebraicSystem
|
Solves symbolic constraints. |
required |
Source code in pyeuclid/engine/engine.py
24 25 26 27 28 29 30 31 32 33 34 | |
search(depth=9999)
¶
Run alternating algebraic + deductive steps until solved or closed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
depth
|
int
|
Maximum additional reasoning depth to explore before returning. |
9999
|
The method
1) solves current algebraic constraints, 2) alternates deductive and algebraic steps, incrementing depth, 3) stops early if the goal is satisfied or the deductive database reports closure.
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/engine/engine.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
step(conditions, conclusions=[])
¶
Apply a single interactive step constrained to given conditions.
The method temporarily restricts the state to a subset of relations,
verifies conditions, runs one search depth, then checks conclusions.
It restores the previous state afterward, allowing interactive/human-in-the-loop
experimentation without polluting the main search trace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
Iterable
|
Relations/equations that must hold. |
required |
conclusions
|
Iterable
|
Relations/equations expected to be derivable. |
[]
|
Raises:
| Type | Description |
|---|---|
AssertionError
|
If |
Exception
|
If any condition cannot be verified or any conclusion fails. |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/engine/engine.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Named geometric point used throughout the formalization.
Source code in pyeuclid/formalization/relation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__(name)
¶
Create a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier (underscores are not allowed). |
required |
Source code in pyeuclid/formalization/relation.py
16 17 18 19 20 21 22 23 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
Inference rules and registry for the deductive database.
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
InferenceRule
¶
Base class for all geometric inference rules.
Subclasses implement condition() and conclusion(), each returning
relations/equations. The register decorator wraps these to expand
definitions and filter zero expressions before the deductive database uses
them.
Source code in pyeuclid/engine/inference_rule.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
conclusion()
¶
Return relations/equations that are added when the rule fires.
Source code in pyeuclid/engine/inference_rule.py
60 61 | |
condition()
¶
Return premises (relations/equations) required to trigger the rule.
Source code in pyeuclid/engine/inference_rule.py
57 58 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Named geometric point used throughout the formalization.
Source code in pyeuclid/formalization/relation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__(name)
¶
Create a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier (underscores are not allowed). |
required |
Source code in pyeuclid/formalization/relation.py
16 17 18 19 20 21 22 23 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
register
¶
Decorator that registers an inference rule class into named rule sets.
Source code in pyeuclid/engine/inference_rule.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
Deductive database for geometric inference rules.
Matches registered inference rules against the current State, instantiates
them with concrete points, and applies resulting conclusions. Uses a Z3 encoding
to search admissible assignments while preserving canonical point orderings via
Lt constraints.
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Circle
¶
Numerical circle.
Source code in pyeuclid/formalization/numericals.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
sample_within(points, n=5)
¶
Sample a point within the boundary of points.
Source code in pyeuclid/formalization/numericals.py
457 458 459 460 461 462 463 464 465 466 467 468 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
ConstructionRule
¶
Base class for geometric construction rules.
Source code in pyeuclid/formalization/construction_rule.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__()
¶
Initialize an empty construction rule.
Source code in pyeuclid/formalization/construction_rule.py
12 13 14 | |
arguments()
¶
Return the input entities required for the construction.
Source code in pyeuclid/formalization/construction_rule.py
16 17 18 | |
conclusions()
¶
Return relations implied after applying the construction.
Source code in pyeuclid/formalization/construction_rule.py
28 29 30 | |
conditions()
¶
Return prerequisite relations for the construction to be valid.
Source code in pyeuclid/formalization/construction_rule.py
24 25 26 | |
constructed_points()
¶
Return the points constructed by this rule.
Source code in pyeuclid/formalization/construction_rule.py
20 21 22 | |
DeductiveDatabase
¶
Match and apply geometric inference rules against a state.
Source code in pyeuclid/engine/deductive_database.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
__init__(state, inner_theorems=inference_rule_sets['ex'], outer_theorems=inference_rule_sets['basic'])
¶
Initialize a deductive database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
Shared state being reasoned over. |
required |
inner_theorems
|
Iterable[type[InferenceRule]]
|
Higher-priority rules applied exhaustively first. |
inference_rule_sets['ex']
|
outer_theorems
|
Iterable[type[InferenceRule]]
|
Secondary rules applied after inner closure. |
inference_rule_sets['basic']
|
Source code in pyeuclid/engine/deductive_database.py
22 23 24 25 26 27 28 29 30 31 32 33 | |
apply(inferences)
¶
Apply instantiated rules by adding their conclusions to the state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inferences
|
Iterable[InferenceRule]
|
Instantiated rules to apply. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/engine/deductive_database.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
get_applicable_theorems(theorems)
¶
Instantiate and return all applicable rules from the given set.
Returns:
| Type | Description |
|---|---|
|
list[InferenceRule]: Concrete rule instances whose conditions are satisfiable in the current state. |
Source code in pyeuclid/engine/deductive_database.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
run()
¶
Execute one deductive phase over inner then outer theorems.
Updates closure when no further inferences are available.
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/engine/deductive_database.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
Diagram
¶
Source code in pyeuclid/formalization/diagram.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | |
__new__(constructions_list=None, save_path=None, cache_folder=os.path.join(ROOT_DIR, 'cache'), resample=False)
¶
Load from cache if available, otherwise construct a new diagram instance.
Source code in pyeuclid/formalization/diagram.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
add_constructions(constructions)
¶
Add a new batch of constructions, retrying if degeneracy occurs.
Source code in pyeuclid/formalization/diagram.py
86 87 88 89 90 91 92 93 94 95 96 97 | |
clear()
¶
Reset all stored points, segments, circles, and name mappings.
Source code in pyeuclid/formalization/diagram.py
65 66 67 68 69 70 71 72 | |
construct(constructions)
¶
Apply a single batch of construction rules to extend the diagram.
Source code in pyeuclid/formalization/diagram.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
construct_diagram()
¶
Construct the full diagram from all construction batches, with retries.
Source code in pyeuclid/formalization/diagram.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
draw_diagram(show=False)
¶
Draw the current diagram; optionally display the matplotlib figure.
Source code in pyeuclid/formalization/diagram.py
1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | |
numerical_check(relation)
¶
Numerically evaluate whether a relation/expression holds in the diagram.
Source code in pyeuclid/formalization/diagram.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
numerical_check_goal(goal)
¶
Check if the current diagram satisfies a goal relation/expression.
Source code in pyeuclid/formalization/diagram.py
147 148 149 150 151 152 153 154 155 156 | |
reduce(objs, existing_points)
¶
Reduce intersecting objects into sampled intersection points.
Filters half-planes, handles point-only cases, samples within half-planes, or intersects pairs of essential geometric objects.
Source code in pyeuclid/formalization/diagram.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
save_to_cache()
¶
Persist the diagram to cache if caching is enabled.
Source code in pyeuclid/formalization/diagram.py
78 79 80 81 82 83 84 | |
show()
¶
Render the diagram with matplotlib.
Source code in pyeuclid/formalization/diagram.py
74 75 76 | |
sketch_2l1c(*args)
¶
Intersections of perpendiculars from P to AC/BC with circle centered at P.
Source code in pyeuclid/formalization/diagram.py
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
sketch_3peq(*args)
¶
Three-point equidistance construction.
Source code in pyeuclid/formalization/diagram.py
662 663 664 665 666 667 668 669 670 671 672 673 | |
sketch_angle_bisector(*args)
¶
Ray that bisects angle ABC.
Source code in pyeuclid/formalization/diagram.py
191 192 193 194 195 196 197 198 | |
sketch_angle_mirror(*args)
¶
Mirror of ray BA across BC.
Source code in pyeuclid/formalization/diagram.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
sketch_centroid(*args)
¶
Mid-segment points and centroid of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
357 358 359 360 361 362 363 364 | |
sketch_circle(*args)
¶
Center of circle through three points.
Source code in pyeuclid/formalization/diagram.py
215 216 217 218 219 220 221 | |
sketch_circumcenter(*args)
¶
Circumcenter of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
223 224 225 226 227 228 229 | |
sketch_e5128(*args)
¶
Problem-specific construction e5128.
Source code in pyeuclid/formalization/diagram.py
650 651 652 653 654 655 656 657 658 659 660 | |
sketch_eq_quadrangle(*args)
¶
Randomly sample a quadrilateral with opposite sides equal.
Source code in pyeuclid/formalization/diagram.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
sketch_eq_trapezoid(*args)
¶
Randomly sample an isosceles trapezoid.
Source code in pyeuclid/formalization/diagram.py
246 247 248 249 250 251 252 253 254 255 256 257 | |
sketch_eq_triangle(*args)
¶
Circles defining an equilateral triangle on BC.
Source code in pyeuclid/formalization/diagram.py
259 260 261 262 | |
sketch_eqangle2(*args)
¶
Point X such that angle ABX equals angle XCB.
Source code in pyeuclid/formalization/diagram.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
sketch_eqdia_quadrangle(*args)
¶
Quadrilateral with equal diagonals.
Source code in pyeuclid/formalization/diagram.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
sketch_eqdistance(*args)
¶
Circle centered at A with radius BC.
Source code in pyeuclid/formalization/diagram.py
299 300 301 302 | |
sketch_eqdistance2(*args)
¶
Circle centered at A with radius alpha*BC.
Source code in pyeuclid/formalization/diagram.py
304 305 306 307 | |
sketch_eqdistance3(*args)
¶
Circle centered at A with fixed radius alpha.
Source code in pyeuclid/formalization/diagram.py
309 310 311 312 | |
sketch_excenter(*args)
¶
Excenter opposite B in triangle ABC.
Source code in pyeuclid/formalization/diagram.py
341 342 343 344 345 346 | |
sketch_excenter2(*args)
¶
Excenter plus touch points on extended sides.
Source code in pyeuclid/formalization/diagram.py
348 349 350 351 352 353 354 355 | |
sketch_foot(*args)
¶
Foot of perpendicular from A to line BC.
Source code in pyeuclid/formalization/diagram.py
314 315 316 317 318 319 | |
sketch_free(*args)
¶
Free point uniformly sampled in a box.
Source code in pyeuclid/formalization/diagram.py
321 322 323 | |
sketch_incenter(*args)
¶
Incenter of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
325 326 327 328 329 330 | |
sketch_incenter2(*args)
¶
Incenter plus touch points on each side.
Source code in pyeuclid/formalization/diagram.py
332 333 334 335 336 337 338 339 | |
sketch_intersection_cc(*args)
¶
Two circles centered at O and W through A.
Source code in pyeuclid/formalization/diagram.py
366 367 368 369 | |
sketch_intersection_lc(*args)
¶
Line and circle defined by A,O,B for intersection.
Source code in pyeuclid/formalization/diagram.py
371 372 373 374 | |
sketch_intersection_ll(*args)
¶
Intersection of lines AB and CD.
Source code in pyeuclid/formalization/diagram.py
376 377 378 379 380 381 | |
sketch_isquare(*args)
¶
Axis-aligned unit square, randomly re-ordered.
Source code in pyeuclid/formalization/diagram.py
584 585 586 587 588 589 590 591 | |
sketch_on_dia(*args)
¶
Circle with diameter AB.
Source code in pyeuclid/formalization/diagram.py
710 711 712 713 714 | |
sketch_r_trapezoid(*args)
¶
Right trapezoid with AB horizontal and AD vertical.
Source code in pyeuclid/formalization/diagram.py
518 519 520 521 522 523 524 525 | |
sketch_r_triangle(*args)
¶
Random right triangle with legs on axes.
Source code in pyeuclid/formalization/diagram.py
527 528 529 530 531 532 533 | |
sketch_rectangle(*args)
¶
Axis-aligned rectangle with random width/height.
Source code in pyeuclid/formalization/diagram.py
535 536 537 538 539 540 541 542 543 | |
sketch_reflect(*args)
¶
Reflect point A across line BC.
Source code in pyeuclid/formalization/diagram.py
545 546 547 548 549 | |
sketch_risos(*args)
¶
Right isosceles triangle.
Source code in pyeuclid/formalization/diagram.py
551 552 553 554 555 556 557 | |
sketch_s_angle(*args)
¶
Ray at point B making angle alpha with BA.
Source code in pyeuclid/formalization/diagram.py
559 560 561 562 563 564 | |
sketch_segment(*args)
¶
Random segment endpoints in [-1,1] box.
Source code in pyeuclid/formalization/diagram.py
566 567 568 569 570 | |
sketch_shift(*args)
¶
Translate C by vector BA.
Source code in pyeuclid/formalization/diagram.py
572 573 574 575 | |
sketch_square(*args)
¶
Square constructed on segment AB.
Source code in pyeuclid/formalization/diagram.py
577 578 579 580 581 582 | |
sketch_trapezoid(*args)
¶
Random trapezoid with AB // CD.
Source code in pyeuclid/formalization/diagram.py
593 594 595 596 597 598 599 600 601 602 603 | |
sketch_triangle(*args)
¶
Random triangle.
Source code in pyeuclid/formalization/diagram.py
605 606 607 608 609 610 611 612 | |
sketch_triangle12(*args)
¶
Triangle with side-length ratios near 1:2.
Source code in pyeuclid/formalization/diagram.py
614 615 616 617 618 619 620 | |
sketch_trisect(*args)
¶
Trisect angle ABC.
Source code in pyeuclid/formalization/diagram.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | |
sketch_trisegment(*args)
¶
Trisect segment AB.
Source code in pyeuclid/formalization/diagram.py
704 705 706 707 708 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
HalfPlane
¶
Numerical HalfPlane.
Source code in pyeuclid/formalization/numericals.py
471 472 473 474 475 476 477 478 479 | |
InferenceRule
¶
Base class for all geometric inference rules.
Subclasses implement condition() and conclusion(), each returning
relations/equations. The register decorator wraps these to expand
definitions and filter zero expressions before the deductive database uses
them.
Source code in pyeuclid/engine/inference_rule.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
conclusion()
¶
Return relations/equations that are added when the rule fires.
Source code in pyeuclid/engine/inference_rule.py
60 61 | |
condition()
¶
Return premises (relations/equations) required to trigger the rule.
Source code in pyeuclid/engine/inference_rule.py
57 58 | |
Line
¶
Numerical line.
Source code in pyeuclid/formalization/numericals.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
sample_within(points, n=5)
¶
Sample a point within the boundary of points.
Source code in pyeuclid/formalization/numericals.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
sample_within_halfplanes(points, halfplanes, n=5)
¶
Sample points on the line within the intersection of half-plane constraints and near existing points.
Source code in pyeuclid/formalization/numericals.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Named geometric point used throughout the formalization.
Source code in pyeuclid/formalization/relation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__(name)
¶
Create a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier (underscores are not allowed). |
required |
Source code in pyeuclid/formalization/relation.py
16 17 18 19 20 21 22 23 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Ray
¶
Bases: Line
Numerical ray.
Source code in pyeuclid/formalization/numericals.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
sample_within_halfplanes(points, halfplanes, n=5)
¶
Sample points on the half-line within the intersection of half-plane constraints and near existing points.
Source code in pyeuclid/formalization/numericals.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
State
¶
Mutable state holding points, relations, equations, and goal/solution status.
Source code in pyeuclid/formalization/state.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
add_equation(equation)
¶
Insert an equation, tracing its depth and registering involved symbols.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equation
|
Expr
|
Equation to add. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
add_point(p)
¶
Track a new point and initialize length union-find edges to existing points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
Point
|
Point to register. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
118 119 120 121 122 123 124 125 126 127 128 129 130 | |
add_relation(relation)
¶
Insert a relation, ensuring its points are tracked.
Source code in pyeuclid/formalization/state.py
109 110 111 112 113 114 115 116 | |
add_relations(relations)
¶
Add one or more relations/equations, expanding definitions as needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relations
|
Relation or sympy expression or iterable of them. Composite
relations with a |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
categorize_variable()
¶
Infer variable types (Angle/Length) from existing equations.
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
check_conditions(conditions)
¶
Verify that a set of relations/equations holds in the current state.
Expands relation definitions, checks presence in relations, and
simplifies equations via solved variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
Iterable | Relation | Expr
|
Conditions to verify. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if all conditions hold; False otherwise. |
Source code in pyeuclid/formalization/state.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
complete()
¶
Return solved status: True/expr if goal satisfied, else None.
Returns:
| Type | Description |
|---|---|
|
bool | sympy.Expr | None: True or numeric expression if solved; otherwise None. |
Source code in pyeuclid/formalization/state.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
load_problem(conditions=None, goal=None, diagram=None)
¶
Seed the state with initial conditions, goal, and optional diagram.
Adds relations/equations, infers variable categories, sets the goal, and records an optional diagram instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
Iterable | None
|
Relations/equations to seed the state. |
None
|
goal
|
Relation | Expr | None
|
Target to satisfy. |
None
|
diagram
|
Diagram | None
|
Optional diagram object. |
None
|
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
load_problem_from_text(text, diagram_path=None, resample=False)
¶
Parse a textual benchmark instance and populate state+diagram.
Builds a diagram, verifies numerical consistency with the goal, and populates points/relations deduced from construction rules and sampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Problem description string. |
required |
diagram_path
|
str | None
|
Optional path for saving diagram. |
None
|
resample
|
bool
|
Force resampling even if cache exists. |
False
|
Returns:
| Type | Description |
|---|---|
|
None |
Raises: Exception: If a consistent diagram cannot be generated in allotted attempts.
Source code in pyeuclid/formalization/state.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
set_logger(level)
¶
Configure the state logger; rank-aware for MPI runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
Logging level (e.g., logging.INFO). |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
simplify_equation(expr, depth=None)
¶
Substitute solved variables into an expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expr
|
Expr
|
Expression to simplify. |
required |
depth
|
int | None
|
Solution depth to use; defaults to latest. |
None
|
Returns:
| Type | Description |
|---|---|
|
sympy.Expr: Simplified expression. |
Source code in pyeuclid/formalization/state.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
construct_angle_bisector
¶
Bases: ConstructionRule
Construct the bisector point X of angle ABC.
Source code in pyeuclid/formalization/construction_rule.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
construct_angle_mirror
¶
Bases: ConstructionRule
Construct point X as the mirror of BA across BC.
Source code in pyeuclid/formalization/construction_rule.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
construct_circle
¶
Bases: ConstructionRule
Construct circle center X equidistant from A, B, C.
Source code in pyeuclid/formalization/construction_rule.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
construct_circumcenter
¶
Bases: ConstructionRule
Construct circumcenter X of triangle ABC.
Source code in pyeuclid/formalization/construction_rule.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
construct_eq_quadrangle
¶
Bases: ConstructionRule
Construct quadrilateral ABCD with equal diagonals.
Source code in pyeuclid/formalization/construction_rule.py
141 142 143 144 145 146 147 148 149 150 151 152 153 | |
construct_eq_trapezoid
¶
Bases: ConstructionRule
Construct isosceles trapezoid ABCD (AB ∥ CD).
Source code in pyeuclid/formalization/construction_rule.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
construct_eq_triangle
¶
Bases: ConstructionRule
Construct equilateral triangle with vertex X and base BC.
Source code in pyeuclid/formalization/construction_rule.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
construct_eqangle2
¶
Bases: ConstructionRule
Construct X so that angle ABX equals angle XCB.
Source code in pyeuclid/formalization/construction_rule.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
register
¶
Decorator that registers an inference rule class into named rule sets.
Source code in pyeuclid/engine/inference_rule.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
circle_circle_intersection(c1, c2)
¶
Returns a pair of Points as intersections of c1 and c2.
Source code in pyeuclid/formalization/numericals.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
get_constructions_list_from_text(text)
¶
Parse the constructions section of a text instance into rule objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Full benchmark line containing constructions and goal separated by ' ? '. |
required |
Returns:
| Type | Description |
|---|---|
|
list[list[ConstructionRule]]: Nested list of construction batches. |
Source code in pyeuclid/formalization/translation.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
get_goal_from_text(text)
¶
Parse the goal portion of a text instance into a Relation or expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Full benchmark line containing constructions and goal. |
required |
Returns:
| Type | Description |
|---|---|
|
Relation | sympy.Expr | tuple[Relation, Relation] | None: Parsed goal or None. |
Source code in pyeuclid/formalization/translation.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
line_circle_intersection(line, circle)
¶
Returns a pair of points as intersections of line and circle.
Source code in pyeuclid/formalization/numericals.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
parse_texts_from_file(file_name)
¶
Load every other line from a benchmark file as a problem description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str
|
Path to benchmark text file. |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: Problem description strings. |
Source code in pyeuclid/formalization/translation.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
random_rfss(*points)
¶
Random rotate-flip-scale-shift a point cloud.
Source code in pyeuclid/formalization/numericals.py
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
solve_quad(a, b, c)
¶
Solve a x^2 + bx + c = 0.
Source code in pyeuclid/formalization/numericals.py
513 514 515 516 517 518 519 520 521 | |
Algebraic solver for geometric equations.
Manages sympy-based elimination, simplification, and solution extraction for
angle/length variables tracked in the shared State. Computes equivalence
classes for ratios and angle sums to aid later inference.
AlgebraicSystem
¶
Symbolic equation processor for geometric variables.
Source code in pyeuclid/engine/algebraic_system.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
__init__(state)
¶
Create an algebraic system bound to a State.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
Shared state containing equations and solved variables. |
required |
Source code in pyeuclid/engine/algebraic_system.py
22 23 24 25 26 27 28 | |
elim(equations, var_types)
¶
Triangularize equations to solve single-variable expressions where possible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equations
|
list[Traced]
|
Equations to solve. |
required |
var_types
|
dict
|
Mapping of symbols to semantic type ("Angle"/"Length"/None). |
required |
Returns:
| Type | Description |
|---|---|
|
tuple[list[sympy.Symbol], dict]: Free variables list and solved expressions map. |
Source code in pyeuclid/engine/algebraic_system.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
process_equation(eqn, check=False)
¶
Simplify an equation by dropping small factors and factoring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eqn
|
Expr
|
Expression to simplify. |
required |
check
|
bool
|
If True, raise on degenerate factors instead of returning 0. |
False
|
Returns:
| Type | Description |
|---|---|
|
sympy.Expr: Simplified expression (possibly 0). |
Source code in pyeuclid/engine/algebraic_system.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
process_solutions(var, eqn, solutions, var_types)
¶
Filter and sanitize candidate solutions for a single variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var
|
Symbol
|
Variable being solved. |
required |
eqn
|
Expr
|
Original equation. |
required |
solutions
|
list
|
Candidate solutions from sympy. |
required |
var_types
|
dict
|
Mapping of symbols to semantic type ("Angle"/"Length"/None). |
required |
Returns:
| Type | Description |
|---|---|
|
sympy.Expr | None: A single viable solution or None if ambiguous/invalid. |
Source code in pyeuclid/engine/algebraic_system.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
run()
¶
Full algebraic pass: solve equations then compute ratio/angle equivalences.
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/engine/algebraic_system.py
356 357 358 359 360 361 362 363 | |
solve_equation()
¶
Solve current equations, updating the state's solution stack and unions.
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/engine/algebraic_system.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
InferenceRule
¶
Base class for all geometric inference rules.
Subclasses implement condition() and conclusion(), each returning
relations/equations. The register decorator wraps these to expand
definitions and filter zero expressions before the deductive database uses
them.
Source code in pyeuclid/engine/inference_rule.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
conclusion()
¶
Return relations/equations that are added when the rule fires.
Source code in pyeuclid/engine/inference_rule.py
60 61 | |
condition()
¶
Return premises (relations/equations) required to trigger the rule.
Source code in pyeuclid/engine/inference_rule.py
57 58 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Named geometric point used throughout the formalization.
Source code in pyeuclid/formalization/relation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__(name)
¶
Create a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier (underscores are not allowed). |
required |
Source code in pyeuclid/formalization/relation.py
16 17 18 19 20 21 22 23 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
register
¶
Decorator that registers an inference rule class into named rule sets.
Source code in pyeuclid/engine/inference_rule.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
State container for geometric problems and intermediate deductions.
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Circle
¶
Numerical circle.
Source code in pyeuclid/formalization/numericals.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
sample_within(points, n=5)
¶
Sample a point within the boundary of points.
Source code in pyeuclid/formalization/numericals.py
457 458 459 460 461 462 463 464 465 466 467 468 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
ConstructionRule
¶
Base class for geometric construction rules.
Source code in pyeuclid/formalization/construction_rule.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__()
¶
Initialize an empty construction rule.
Source code in pyeuclid/formalization/construction_rule.py
12 13 14 | |
arguments()
¶
Return the input entities required for the construction.
Source code in pyeuclid/formalization/construction_rule.py
16 17 18 | |
conclusions()
¶
Return relations implied after applying the construction.
Source code in pyeuclid/formalization/construction_rule.py
28 29 30 | |
conditions()
¶
Return prerequisite relations for the construction to be valid.
Source code in pyeuclid/formalization/construction_rule.py
24 25 26 | |
constructed_points()
¶
Return the points constructed by this rule.
Source code in pyeuclid/formalization/construction_rule.py
20 21 22 | |
Diagram
¶
Source code in pyeuclid/formalization/diagram.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | |
__new__(constructions_list=None, save_path=None, cache_folder=os.path.join(ROOT_DIR, 'cache'), resample=False)
¶
Load from cache if available, otherwise construct a new diagram instance.
Source code in pyeuclid/formalization/diagram.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
add_constructions(constructions)
¶
Add a new batch of constructions, retrying if degeneracy occurs.
Source code in pyeuclid/formalization/diagram.py
86 87 88 89 90 91 92 93 94 95 96 97 | |
clear()
¶
Reset all stored points, segments, circles, and name mappings.
Source code in pyeuclid/formalization/diagram.py
65 66 67 68 69 70 71 72 | |
construct(constructions)
¶
Apply a single batch of construction rules to extend the diagram.
Source code in pyeuclid/formalization/diagram.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
construct_diagram()
¶
Construct the full diagram from all construction batches, with retries.
Source code in pyeuclid/formalization/diagram.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
draw_diagram(show=False)
¶
Draw the current diagram; optionally display the matplotlib figure.
Source code in pyeuclid/formalization/diagram.py
1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | |
numerical_check(relation)
¶
Numerically evaluate whether a relation/expression holds in the diagram.
Source code in pyeuclid/formalization/diagram.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
numerical_check_goal(goal)
¶
Check if the current diagram satisfies a goal relation/expression.
Source code in pyeuclid/formalization/diagram.py
147 148 149 150 151 152 153 154 155 156 | |
reduce(objs, existing_points)
¶
Reduce intersecting objects into sampled intersection points.
Filters half-planes, handles point-only cases, samples within half-planes, or intersects pairs of essential geometric objects.
Source code in pyeuclid/formalization/diagram.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
save_to_cache()
¶
Persist the diagram to cache if caching is enabled.
Source code in pyeuclid/formalization/diagram.py
78 79 80 81 82 83 84 | |
show()
¶
Render the diagram with matplotlib.
Source code in pyeuclid/formalization/diagram.py
74 75 76 | |
sketch_2l1c(*args)
¶
Intersections of perpendiculars from P to AC/BC with circle centered at P.
Source code in pyeuclid/formalization/diagram.py
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
sketch_3peq(*args)
¶
Three-point equidistance construction.
Source code in pyeuclid/formalization/diagram.py
662 663 664 665 666 667 668 669 670 671 672 673 | |
sketch_angle_bisector(*args)
¶
Ray that bisects angle ABC.
Source code in pyeuclid/formalization/diagram.py
191 192 193 194 195 196 197 198 | |
sketch_angle_mirror(*args)
¶
Mirror of ray BA across BC.
Source code in pyeuclid/formalization/diagram.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
sketch_centroid(*args)
¶
Mid-segment points and centroid of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
357 358 359 360 361 362 363 364 | |
sketch_circle(*args)
¶
Center of circle through three points.
Source code in pyeuclid/formalization/diagram.py
215 216 217 218 219 220 221 | |
sketch_circumcenter(*args)
¶
Circumcenter of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
223 224 225 226 227 228 229 | |
sketch_e5128(*args)
¶
Problem-specific construction e5128.
Source code in pyeuclid/formalization/diagram.py
650 651 652 653 654 655 656 657 658 659 660 | |
sketch_eq_quadrangle(*args)
¶
Randomly sample a quadrilateral with opposite sides equal.
Source code in pyeuclid/formalization/diagram.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
sketch_eq_trapezoid(*args)
¶
Randomly sample an isosceles trapezoid.
Source code in pyeuclid/formalization/diagram.py
246 247 248 249 250 251 252 253 254 255 256 257 | |
sketch_eq_triangle(*args)
¶
Circles defining an equilateral triangle on BC.
Source code in pyeuclid/formalization/diagram.py
259 260 261 262 | |
sketch_eqangle2(*args)
¶
Point X such that angle ABX equals angle XCB.
Source code in pyeuclid/formalization/diagram.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
sketch_eqdia_quadrangle(*args)
¶
Quadrilateral with equal diagonals.
Source code in pyeuclid/formalization/diagram.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
sketch_eqdistance(*args)
¶
Circle centered at A with radius BC.
Source code in pyeuclid/formalization/diagram.py
299 300 301 302 | |
sketch_eqdistance2(*args)
¶
Circle centered at A with radius alpha*BC.
Source code in pyeuclid/formalization/diagram.py
304 305 306 307 | |
sketch_eqdistance3(*args)
¶
Circle centered at A with fixed radius alpha.
Source code in pyeuclid/formalization/diagram.py
309 310 311 312 | |
sketch_excenter(*args)
¶
Excenter opposite B in triangle ABC.
Source code in pyeuclid/formalization/diagram.py
341 342 343 344 345 346 | |
sketch_excenter2(*args)
¶
Excenter plus touch points on extended sides.
Source code in pyeuclid/formalization/diagram.py
348 349 350 351 352 353 354 355 | |
sketch_foot(*args)
¶
Foot of perpendicular from A to line BC.
Source code in pyeuclid/formalization/diagram.py
314 315 316 317 318 319 | |
sketch_free(*args)
¶
Free point uniformly sampled in a box.
Source code in pyeuclid/formalization/diagram.py
321 322 323 | |
sketch_incenter(*args)
¶
Incenter of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
325 326 327 328 329 330 | |
sketch_incenter2(*args)
¶
Incenter plus touch points on each side.
Source code in pyeuclid/formalization/diagram.py
332 333 334 335 336 337 338 339 | |
sketch_intersection_cc(*args)
¶
Two circles centered at O and W through A.
Source code in pyeuclid/formalization/diagram.py
366 367 368 369 | |
sketch_intersection_lc(*args)
¶
Line and circle defined by A,O,B for intersection.
Source code in pyeuclid/formalization/diagram.py
371 372 373 374 | |
sketch_intersection_ll(*args)
¶
Intersection of lines AB and CD.
Source code in pyeuclid/formalization/diagram.py
376 377 378 379 380 381 | |
sketch_isquare(*args)
¶
Axis-aligned unit square, randomly re-ordered.
Source code in pyeuclid/formalization/diagram.py
584 585 586 587 588 589 590 591 | |
sketch_on_dia(*args)
¶
Circle with diameter AB.
Source code in pyeuclid/formalization/diagram.py
710 711 712 713 714 | |
sketch_r_trapezoid(*args)
¶
Right trapezoid with AB horizontal and AD vertical.
Source code in pyeuclid/formalization/diagram.py
518 519 520 521 522 523 524 525 | |
sketch_r_triangle(*args)
¶
Random right triangle with legs on axes.
Source code in pyeuclid/formalization/diagram.py
527 528 529 530 531 532 533 | |
sketch_rectangle(*args)
¶
Axis-aligned rectangle with random width/height.
Source code in pyeuclid/formalization/diagram.py
535 536 537 538 539 540 541 542 543 | |
sketch_reflect(*args)
¶
Reflect point A across line BC.
Source code in pyeuclid/formalization/diagram.py
545 546 547 548 549 | |
sketch_risos(*args)
¶
Right isosceles triangle.
Source code in pyeuclid/formalization/diagram.py
551 552 553 554 555 556 557 | |
sketch_s_angle(*args)
¶
Ray at point B making angle alpha with BA.
Source code in pyeuclid/formalization/diagram.py
559 560 561 562 563 564 | |
sketch_segment(*args)
¶
Random segment endpoints in [-1,1] box.
Source code in pyeuclid/formalization/diagram.py
566 567 568 569 570 | |
sketch_shift(*args)
¶
Translate C by vector BA.
Source code in pyeuclid/formalization/diagram.py
572 573 574 575 | |
sketch_square(*args)
¶
Square constructed on segment AB.
Source code in pyeuclid/formalization/diagram.py
577 578 579 580 581 582 | |
sketch_trapezoid(*args)
¶
Random trapezoid with AB // CD.
Source code in pyeuclid/formalization/diagram.py
593 594 595 596 597 598 599 600 601 602 603 | |
sketch_triangle(*args)
¶
Random triangle.
Source code in pyeuclid/formalization/diagram.py
605 606 607 608 609 610 611 612 | |
sketch_triangle12(*args)
¶
Triangle with side-length ratios near 1:2.
Source code in pyeuclid/formalization/diagram.py
614 615 616 617 618 619 620 | |
sketch_trisect(*args)
¶
Trisect angle ABC.
Source code in pyeuclid/formalization/diagram.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | |
sketch_trisegment(*args)
¶
Trisect segment AB.
Source code in pyeuclid/formalization/diagram.py
704 705 706 707 708 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
HalfPlane
¶
Numerical HalfPlane.
Source code in pyeuclid/formalization/numericals.py
471 472 473 474 475 476 477 478 479 | |
Line
¶
Numerical line.
Source code in pyeuclid/formalization/numericals.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
sample_within(points, n=5)
¶
Sample a point within the boundary of points.
Source code in pyeuclid/formalization/numericals.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
sample_within_halfplanes(points, halfplanes, n=5)
¶
Sample points on the line within the intersection of half-plane constraints and near existing points.
Source code in pyeuclid/formalization/numericals.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Named geometric point used throughout the formalization.
Source code in pyeuclid/formalization/relation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__(name)
¶
Create a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier (underscores are not allowed). |
required |
Source code in pyeuclid/formalization/relation.py
16 17 18 19 20 21 22 23 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Ray
¶
Bases: Line
Numerical ray.
Source code in pyeuclid/formalization/numericals.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
sample_within_halfplanes(points, halfplanes, n=5)
¶
Sample points on the half-line within the intersection of half-plane constraints and near existing points.
Source code in pyeuclid/formalization/numericals.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
State
¶
Mutable state holding points, relations, equations, and goal/solution status.
Source code in pyeuclid/formalization/state.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
add_equation(equation)
¶
Insert an equation, tracing its depth and registering involved symbols.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equation
|
Expr
|
Equation to add. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
add_point(p)
¶
Track a new point and initialize length union-find edges to existing points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
Point
|
Point to register. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
118 119 120 121 122 123 124 125 126 127 128 129 130 | |
add_relation(relation)
¶
Insert a relation, ensuring its points are tracked.
Source code in pyeuclid/formalization/state.py
109 110 111 112 113 114 115 116 | |
add_relations(relations)
¶
Add one or more relations/equations, expanding definitions as needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relations
|
Relation or sympy expression or iterable of them. Composite
relations with a |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
categorize_variable()
¶
Infer variable types (Angle/Length) from existing equations.
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
check_conditions(conditions)
¶
Verify that a set of relations/equations holds in the current state.
Expands relation definitions, checks presence in relations, and
simplifies equations via solved variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
Iterable | Relation | Expr
|
Conditions to verify. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if all conditions hold; False otherwise. |
Source code in pyeuclid/formalization/state.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
complete()
¶
Return solved status: True/expr if goal satisfied, else None.
Returns:
| Type | Description |
|---|---|
|
bool | sympy.Expr | None: True or numeric expression if solved; otherwise None. |
Source code in pyeuclid/formalization/state.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
load_problem(conditions=None, goal=None, diagram=None)
¶
Seed the state with initial conditions, goal, and optional diagram.
Adds relations/equations, infers variable categories, sets the goal, and records an optional diagram instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
Iterable | None
|
Relations/equations to seed the state. |
None
|
goal
|
Relation | Expr | None
|
Target to satisfy. |
None
|
diagram
|
Diagram | None
|
Optional diagram object. |
None
|
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
load_problem_from_text(text, diagram_path=None, resample=False)
¶
Parse a textual benchmark instance and populate state+diagram.
Builds a diagram, verifies numerical consistency with the goal, and populates points/relations deduced from construction rules and sampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Problem description string. |
required |
diagram_path
|
str | None
|
Optional path for saving diagram. |
None
|
resample
|
bool
|
Force resampling even if cache exists. |
False
|
Returns:
| Type | Description |
|---|---|
|
None |
Raises: Exception: If a consistent diagram cannot be generated in allotted attempts.
Source code in pyeuclid/formalization/state.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
set_logger(level)
¶
Configure the state logger; rank-aware for MPI runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
Logging level (e.g., logging.INFO). |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in pyeuclid/formalization/state.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
simplify_equation(expr, depth=None)
¶
Substitute solved variables into an expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expr
|
Expr
|
Expression to simplify. |
required |
depth
|
int | None
|
Solution depth to use; defaults to latest. |
None
|
Returns:
| Type | Description |
|---|---|
|
sympy.Expr: Simplified expression. |
Source code in pyeuclid/formalization/state.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
construct_angle_bisector
¶
Bases: ConstructionRule
Construct the bisector point X of angle ABC.
Source code in pyeuclid/formalization/construction_rule.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
construct_angle_mirror
¶
Bases: ConstructionRule
Construct point X as the mirror of BA across BC.
Source code in pyeuclid/formalization/construction_rule.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
construct_circle
¶
Bases: ConstructionRule
Construct circle center X equidistant from A, B, C.
Source code in pyeuclid/formalization/construction_rule.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
construct_circumcenter
¶
Bases: ConstructionRule
Construct circumcenter X of triangle ABC.
Source code in pyeuclid/formalization/construction_rule.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
construct_eq_quadrangle
¶
Bases: ConstructionRule
Construct quadrilateral ABCD with equal diagonals.
Source code in pyeuclid/formalization/construction_rule.py
141 142 143 144 145 146 147 148 149 150 151 152 153 | |
construct_eq_trapezoid
¶
Bases: ConstructionRule
Construct isosceles trapezoid ABCD (AB ∥ CD).
Source code in pyeuclid/formalization/construction_rule.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
construct_eq_triangle
¶
Bases: ConstructionRule
Construct equilateral triangle with vertex X and base BC.
Source code in pyeuclid/formalization/construction_rule.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
construct_eqangle2
¶
Bases: ConstructionRule
Construct X so that angle ABX equals angle XCB.
Source code in pyeuclid/formalization/construction_rule.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
register
¶
Decorator that registers a construction rule into labeled sets.
Source code in pyeuclid/formalization/construction_rule.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
circle_circle_intersection(c1, c2)
¶
Returns a pair of Points as intersections of c1 and c2.
Source code in pyeuclid/formalization/numericals.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
get_constructions_list_from_text(text)
¶
Parse the constructions section of a text instance into rule objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Full benchmark line containing constructions and goal separated by ' ? '. |
required |
Returns:
| Type | Description |
|---|---|
|
list[list[ConstructionRule]]: Nested list of construction batches. |
Source code in pyeuclid/formalization/translation.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
get_goal_from_text(text)
¶
Parse the goal portion of a text instance into a Relation or expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Full benchmark line containing constructions and goal. |
required |
Returns:
| Type | Description |
|---|---|
|
Relation | sympy.Expr | tuple[Relation, Relation] | None: Parsed goal or None. |
Source code in pyeuclid/formalization/translation.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
line_circle_intersection(line, circle)
¶
Returns a pair of points as intersections of line and circle.
Source code in pyeuclid/formalization/numericals.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
parse_texts_from_file(file_name)
¶
Load every other line from a benchmark file as a problem description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str
|
Path to benchmark text file. |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: Problem description strings. |
Source code in pyeuclid/formalization/translation.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
random_rfss(*points)
¶
Random rotate-flip-scale-shift a point cloud.
Source code in pyeuclid/formalization/numericals.py
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
solve_quad(a, b, c)
¶
Solve a x^2 + bx + c = 0.
Source code in pyeuclid/formalization/numericals.py
513 514 515 516 517 518 519 520 521 | |
Geometric primitive types and relations used throughout PyEuclid.
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Named geometric point used throughout the formalization.
Source code in pyeuclid/formalization/relation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__(name)
¶
Create a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier (underscores are not allowed). |
required |
Source code in pyeuclid/formalization/relation.py
16 17 18 19 20 21 22 23 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
Parsing utilities for benchmark text descriptions into constructions/goals.
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
ConstructionRule
¶
Base class for geometric construction rules.
Source code in pyeuclid/formalization/construction_rule.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__()
¶
Initialize an empty construction rule.
Source code in pyeuclid/formalization/construction_rule.py
12 13 14 | |
arguments()
¶
Return the input entities required for the construction.
Source code in pyeuclid/formalization/construction_rule.py
16 17 18 | |
conclusions()
¶
Return relations implied after applying the construction.
Source code in pyeuclid/formalization/construction_rule.py
28 29 30 | |
conditions()
¶
Return prerequisite relations for the construction to be valid.
Source code in pyeuclid/formalization/construction_rule.py
24 25 26 | |
constructed_points()
¶
Return the points constructed by this rule.
Source code in pyeuclid/formalization/construction_rule.py
20 21 22 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Named geometric point used throughout the formalization.
Source code in pyeuclid/formalization/relation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__(name)
¶
Create a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier (underscores are not allowed). |
required |
Source code in pyeuclid/formalization/relation.py
16 17 18 19 20 21 22 23 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
construct_angle_bisector
¶
Bases: ConstructionRule
Construct the bisector point X of angle ABC.
Source code in pyeuclid/formalization/construction_rule.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
construct_angle_mirror
¶
Bases: ConstructionRule
Construct point X as the mirror of BA across BC.
Source code in pyeuclid/formalization/construction_rule.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
construct_circle
¶
Bases: ConstructionRule
Construct circle center X equidistant from A, B, C.
Source code in pyeuclid/formalization/construction_rule.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
construct_circumcenter
¶
Bases: ConstructionRule
Construct circumcenter X of triangle ABC.
Source code in pyeuclid/formalization/construction_rule.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
construct_eq_quadrangle
¶
Bases: ConstructionRule
Construct quadrilateral ABCD with equal diagonals.
Source code in pyeuclid/formalization/construction_rule.py
141 142 143 144 145 146 147 148 149 150 151 152 153 | |
construct_eq_trapezoid
¶
Bases: ConstructionRule
Construct isosceles trapezoid ABCD (AB ∥ CD).
Source code in pyeuclid/formalization/construction_rule.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
construct_eq_triangle
¶
Bases: ConstructionRule
Construct equilateral triangle with vertex X and base BC.
Source code in pyeuclid/formalization/construction_rule.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
construct_eqangle2
¶
Bases: ConstructionRule
Construct X so that angle ABX equals angle XCB.
Source code in pyeuclid/formalization/construction_rule.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
register
¶
Decorator that registers a construction rule into labeled sets.
Source code in pyeuclid/formalization/construction_rule.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
get_constructions_list_from_text(text)
¶
Parse the constructions section of a text instance into rule objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Full benchmark line containing constructions and goal separated by ' ? '. |
required |
Returns:
| Type | Description |
|---|---|
|
list[list[ConstructionRule]]: Nested list of construction batches. |
Source code in pyeuclid/formalization/translation.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
get_goal_from_text(text)
¶
Parse the goal portion of a text instance into a Relation or expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Full benchmark line containing constructions and goal. |
required |
Returns:
| Type | Description |
|---|---|
|
Relation | sympy.Expr | tuple[Relation, Relation] | None: Parsed goal or None. |
Source code in pyeuclid/formalization/translation.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
parse_texts_from_file(file_name)
¶
Load every other line from a benchmark file as a problem description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str
|
Path to benchmark text file. |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: Problem description strings. |
Source code in pyeuclid/formalization/translation.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
Numerical diagram construction and validation for geometric problems.
Between
¶
Bases: Relation
p1 lies between p2 and p3 (on the same line).
Source code in pyeuclid/formalization/relation.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
__init__(p1, p2, p3)
¶
p1 is between p2 and p3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Middle point. |
required |
p2
|
Point
|
Endpoint 1. |
required |
p3
|
Point
|
Endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
170 171 172 173 174 175 176 177 178 179 180 181 | |
permutations()
¶
Enumerate equivalent point orderings for the between relation.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point]]: Permitted permutations. |
Source code in pyeuclid/formalization/relation.py
183 184 185 186 187 188 189 | |
Circle
¶
Numerical circle.
Source code in pyeuclid/formalization/numericals.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
sample_within(points, n=5)
¶
Sample a point within the boundary of points.
Source code in pyeuclid/formalization/numericals.py
457 458 459 460 461 462 463 464 465 466 467 468 | |
Collinear
¶
Bases: Relation
Points p1,p2,p3 are collinear.
Source code in pyeuclid/formalization/relation.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
248 249 250 251 252 253 254 255 256 | |
permutations()
¶
Enumerate collinearity argument permutations.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the three points. |
Source code in pyeuclid/formalization/relation.py
258 259 260 261 262 263 264 | |
Concyclic
¶
Bases: Relation
All given points lie on the same circle.
Source code in pyeuclid/formalization/relation.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points to be tested for concyclicity. |
()
|
Source code in pyeuclid/formalization/relation.py
376 377 378 379 380 381 382 | |
permutations()
¶
Enumerate symmetric permutations of the point set.
Returns:
| Type | Description |
|---|---|
|
itertools.permutations: All orderings of the points. |
Source code in pyeuclid/formalization/relation.py
384 385 386 387 388 389 390 | |
Congruent
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are congruent.
Source code in pyeuclid/formalization/relation.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
319 320 321 322 323 324 325 326 327 328 | |
definition()
¶
Congruence expressed as equal side lengths and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
330 331 332 333 334 335 336 337 338 339 340 341 | |
ConstructionRule
¶
Base class for geometric construction rules.
Source code in pyeuclid/formalization/construction_rule.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
__init__()
¶
Initialize an empty construction rule.
Source code in pyeuclid/formalization/construction_rule.py
12 13 14 | |
arguments()
¶
Return the input entities required for the construction.
Source code in pyeuclid/formalization/construction_rule.py
16 17 18 | |
conclusions()
¶
Return relations implied after applying the construction.
Source code in pyeuclid/formalization/construction_rule.py
28 29 30 | |
conditions()
¶
Return prerequisite relations for the construction to be valid.
Source code in pyeuclid/formalization/construction_rule.py
24 25 26 | |
constructed_points()
¶
Return the points constructed by this rule.
Source code in pyeuclid/formalization/construction_rule.py
20 21 22 | |
Diagram
¶
Source code in pyeuclid/formalization/diagram.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | |
__new__(constructions_list=None, save_path=None, cache_folder=os.path.join(ROOT_DIR, 'cache'), resample=False)
¶
Load from cache if available, otherwise construct a new diagram instance.
Source code in pyeuclid/formalization/diagram.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
add_constructions(constructions)
¶
Add a new batch of constructions, retrying if degeneracy occurs.
Source code in pyeuclid/formalization/diagram.py
86 87 88 89 90 91 92 93 94 95 96 97 | |
clear()
¶
Reset all stored points, segments, circles, and name mappings.
Source code in pyeuclid/formalization/diagram.py
65 66 67 68 69 70 71 72 | |
construct(constructions)
¶
Apply a single batch of construction rules to extend the diagram.
Source code in pyeuclid/formalization/diagram.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
construct_diagram()
¶
Construct the full diagram from all construction batches, with retries.
Source code in pyeuclid/formalization/diagram.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
draw_diagram(show=False)
¶
Draw the current diagram; optionally display the matplotlib figure.
Source code in pyeuclid/formalization/diagram.py
1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | |
numerical_check(relation)
¶
Numerically evaluate whether a relation/expression holds in the diagram.
Source code in pyeuclid/formalization/diagram.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
numerical_check_goal(goal)
¶
Check if the current diagram satisfies a goal relation/expression.
Source code in pyeuclid/formalization/diagram.py
147 148 149 150 151 152 153 154 155 156 | |
reduce(objs, existing_points)
¶
Reduce intersecting objects into sampled intersection points.
Filters half-planes, handles point-only cases, samples within half-planes, or intersects pairs of essential geometric objects.
Source code in pyeuclid/formalization/diagram.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
save_to_cache()
¶
Persist the diagram to cache if caching is enabled.
Source code in pyeuclid/formalization/diagram.py
78 79 80 81 82 83 84 | |
show()
¶
Render the diagram with matplotlib.
Source code in pyeuclid/formalization/diagram.py
74 75 76 | |
sketch_2l1c(*args)
¶
Intersections of perpendiculars from P to AC/BC with circle centered at P.
Source code in pyeuclid/formalization/diagram.py
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
sketch_3peq(*args)
¶
Three-point equidistance construction.
Source code in pyeuclid/formalization/diagram.py
662 663 664 665 666 667 668 669 670 671 672 673 | |
sketch_angle_bisector(*args)
¶
Ray that bisects angle ABC.
Source code in pyeuclid/formalization/diagram.py
191 192 193 194 195 196 197 198 | |
sketch_angle_mirror(*args)
¶
Mirror of ray BA across BC.
Source code in pyeuclid/formalization/diagram.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
sketch_centroid(*args)
¶
Mid-segment points and centroid of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
357 358 359 360 361 362 363 364 | |
sketch_circle(*args)
¶
Center of circle through three points.
Source code in pyeuclid/formalization/diagram.py
215 216 217 218 219 220 221 | |
sketch_circumcenter(*args)
¶
Circumcenter of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
223 224 225 226 227 228 229 | |
sketch_e5128(*args)
¶
Problem-specific construction e5128.
Source code in pyeuclid/formalization/diagram.py
650 651 652 653 654 655 656 657 658 659 660 | |
sketch_eq_quadrangle(*args)
¶
Randomly sample a quadrilateral with opposite sides equal.
Source code in pyeuclid/formalization/diagram.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
sketch_eq_trapezoid(*args)
¶
Randomly sample an isosceles trapezoid.
Source code in pyeuclid/formalization/diagram.py
246 247 248 249 250 251 252 253 254 255 256 257 | |
sketch_eq_triangle(*args)
¶
Circles defining an equilateral triangle on BC.
Source code in pyeuclid/formalization/diagram.py
259 260 261 262 | |
sketch_eqangle2(*args)
¶
Point X such that angle ABX equals angle XCB.
Source code in pyeuclid/formalization/diagram.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
sketch_eqdia_quadrangle(*args)
¶
Quadrilateral with equal diagonals.
Source code in pyeuclid/formalization/diagram.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
sketch_eqdistance(*args)
¶
Circle centered at A with radius BC.
Source code in pyeuclid/formalization/diagram.py
299 300 301 302 | |
sketch_eqdistance2(*args)
¶
Circle centered at A with radius alpha*BC.
Source code in pyeuclid/formalization/diagram.py
304 305 306 307 | |
sketch_eqdistance3(*args)
¶
Circle centered at A with fixed radius alpha.
Source code in pyeuclid/formalization/diagram.py
309 310 311 312 | |
sketch_excenter(*args)
¶
Excenter opposite B in triangle ABC.
Source code in pyeuclid/formalization/diagram.py
341 342 343 344 345 346 | |
sketch_excenter2(*args)
¶
Excenter plus touch points on extended sides.
Source code in pyeuclid/formalization/diagram.py
348 349 350 351 352 353 354 355 | |
sketch_foot(*args)
¶
Foot of perpendicular from A to line BC.
Source code in pyeuclid/formalization/diagram.py
314 315 316 317 318 319 | |
sketch_free(*args)
¶
Free point uniformly sampled in a box.
Source code in pyeuclid/formalization/diagram.py
321 322 323 | |
sketch_incenter(*args)
¶
Incenter of triangle ABC.
Source code in pyeuclid/formalization/diagram.py
325 326 327 328 329 330 | |
sketch_incenter2(*args)
¶
Incenter plus touch points on each side.
Source code in pyeuclid/formalization/diagram.py
332 333 334 335 336 337 338 339 | |
sketch_intersection_cc(*args)
¶
Two circles centered at O and W through A.
Source code in pyeuclid/formalization/diagram.py
366 367 368 369 | |
sketch_intersection_lc(*args)
¶
Line and circle defined by A,O,B for intersection.
Source code in pyeuclid/formalization/diagram.py
371 372 373 374 | |
sketch_intersection_ll(*args)
¶
Intersection of lines AB and CD.
Source code in pyeuclid/formalization/diagram.py
376 377 378 379 380 381 | |
sketch_isquare(*args)
¶
Axis-aligned unit square, randomly re-ordered.
Source code in pyeuclid/formalization/diagram.py
584 585 586 587 588 589 590 591 | |
sketch_on_dia(*args)
¶
Circle with diameter AB.
Source code in pyeuclid/formalization/diagram.py
710 711 712 713 714 | |
sketch_r_trapezoid(*args)
¶
Right trapezoid with AB horizontal and AD vertical.
Source code in pyeuclid/formalization/diagram.py
518 519 520 521 522 523 524 525 | |
sketch_r_triangle(*args)
¶
Random right triangle with legs on axes.
Source code in pyeuclid/formalization/diagram.py
527 528 529 530 531 532 533 | |
sketch_rectangle(*args)
¶
Axis-aligned rectangle with random width/height.
Source code in pyeuclid/formalization/diagram.py
535 536 537 538 539 540 541 542 543 | |
sketch_reflect(*args)
¶
Reflect point A across line BC.
Source code in pyeuclid/formalization/diagram.py
545 546 547 548 549 | |
sketch_risos(*args)
¶
Right isosceles triangle.
Source code in pyeuclid/formalization/diagram.py
551 552 553 554 555 556 557 | |
sketch_s_angle(*args)
¶
Ray at point B making angle alpha with BA.
Source code in pyeuclid/formalization/diagram.py
559 560 561 562 563 564 | |
sketch_segment(*args)
¶
Random segment endpoints in [-1,1] box.
Source code in pyeuclid/formalization/diagram.py
566 567 568 569 570 | |
sketch_shift(*args)
¶
Translate C by vector BA.
Source code in pyeuclid/formalization/diagram.py
572 573 574 575 | |
sketch_square(*args)
¶
Square constructed on segment AB.
Source code in pyeuclid/formalization/diagram.py
577 578 579 580 581 582 | |
sketch_trapezoid(*args)
¶
Random trapezoid with AB // CD.
Source code in pyeuclid/formalization/diagram.py
593 594 595 596 597 598 599 600 601 602 603 | |
sketch_triangle(*args)
¶
Random triangle.
Source code in pyeuclid/formalization/diagram.py
605 606 607 608 609 610 611 612 | |
sketch_triangle12(*args)
¶
Triangle with side-length ratios near 1:2.
Source code in pyeuclid/formalization/diagram.py
614 615 616 617 618 619 620 | |
sketch_trisect(*args)
¶
Trisect angle ABC.
Source code in pyeuclid/formalization/diagram.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | |
sketch_trisegment(*args)
¶
Trisect segment AB.
Source code in pyeuclid/formalization/diagram.py
704 705 706 707 708 | |
Different
¶
Bases: Relation
All provided points must be pairwise distinct.
Source code in pyeuclid/formalization/relation.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(*ps)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*ps
|
Point
|
Points that must be distinct. |
()
|
Source code in pyeuclid/formalization/relation.py
150 151 152 153 154 155 156 | |
definition()
¶
Expand to pairwise inequality relations.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Negated equalities for every point pair. |
Source code in pyeuclid/formalization/relation.py
158 159 160 161 162 163 164 | |
Equal
¶
Bases: Relation
Point equality relation.
Source code in pyeuclid/formalization/relation.py
89 90 91 92 93 94 95 96 97 98 | |
permutations()
¶
Enumerate equivalent orderings of the two points.
Source code in pyeuclid/formalization/relation.py
96 97 98 | |
HalfPlane
¶
Numerical HalfPlane.
Source code in pyeuclid/formalization/numericals.py
471 472 473 474 475 476 477 478 479 | |
Line
¶
Numerical line.
Source code in pyeuclid/formalization/numericals.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
sample_within(points, n=5)
¶
Sample a point within the boundary of points.
Source code in pyeuclid/formalization/numericals.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
sample_within_halfplanes(points, halfplanes, n=5)
¶
Sample points on the line within the intersection of half-plane constraints and near existing points.
Source code in pyeuclid/formalization/numericals.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
Lt
¶
Bases: Relation
Source code in pyeuclid/formalization/relation.py
81 82 83 84 85 86 | |
__init__(v1, v2)
¶
Ordering helper used to canonicalize inference rule assignments.
Source code in pyeuclid/formalization/relation.py
82 83 84 85 86 | |
Midpoint
¶
Bases: Relation
p1 is the midpoint of segment p2p3.
Source code in pyeuclid/formalization/relation.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
__init__(p1, p2, p3)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
Candidate midpoint. |
required |
p2
|
Point
|
Segment endpoint. |
required |
p3
|
Point
|
Segment endpoint. |
required |
Source code in pyeuclid/formalization/relation.py
291 292 293 294 295 296 297 298 299 300 | |
definition()
¶
Midpoint expressed via equal lengths, collinearity, and betweenness.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
NotCollinear
¶
Bases: Relation
Points p1,p2,p3 are not collinear.
Source code in pyeuclid/formalization/relation.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(p1, p2, p3)
¶
Source code in pyeuclid/formalization/relation.py
270 271 272 273 274 275 276 277 278 | |
definition()
¶
Expand non-collinearity into primitive constraints.
Source code in pyeuclid/formalization/relation.py
280 281 282 283 284 285 | |
OppositeSide
¶
Bases: Relation
Points p1,p2 lie on opposite sides of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
220 221 222 223 224 225 226 227 228 229 230 | |
definition()
¶
Logical expansion expressing opposite-side constraints.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive relations defining opposite sides. |
Source code in pyeuclid/formalization/relation.py
232 233 234 235 236 237 238 239 240 241 242 | |
Parallel
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are parallel.
Source code in pyeuclid/formalization/relation.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
396 397 398 399 400 401 402 403 404 405 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
Pentagon
¶
Bases: Relation
Points form a cyclically ordered pentagon.
Source code in pyeuclid/formalization/relation.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
__init__(p1, p2, p3, p4, p5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4, p5
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
500 501 502 503 504 505 506 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
Perpendicular
¶
Bases: Relation
Segments (p1,p2) and (p3,p4) are perpendicular.
Source code in pyeuclid/formalization/relation.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2
|
Point
|
First segment endpoints. |
required |
p3, p4
|
Point
|
Second segment endpoints. |
required |
Source code in pyeuclid/formalization/relation.py
428 429 430 431 432 433 434 435 436 437 | |
permutations()
¶
Enumerate symmetric endpoint permutations preserving segment groups.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
Point
¶
Numerical point.
Source code in pyeuclid/formalization/numericals.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
Quadrilateral
¶
Bases: Relation
Points form a cyclically ordered quadrilateral.
Source code in pyeuclid/formalization/relation.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3, p4
|
Point
|
Vertices. |
required |
Source code in pyeuclid/formalization/relation.py
460 461 462 463 464 465 466 | |
definition()
¶
Opposite sides must lie on opposite sides of diagonals.
Returns:
| Type | Description |
|---|---|
|
list[Relation]: Primitive opposite-side relations. |
Source code in pyeuclid/formalization/relation.py
485 486 487 488 489 490 491 492 493 494 | |
permutations()
¶
Enumerate cyclic and reversed vertex orderings.
Returns:
| Type | Description |
|---|---|
|
list[tuple[Point, Point, Point, Point]]: Valid permutations. |
Source code in pyeuclid/formalization/relation.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
Ray
¶
Bases: Line
Numerical ray.
Source code in pyeuclid/formalization/numericals.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
sample_within_halfplanes(points, halfplanes, n=5)
¶
Sample points on the half-line within the intersection of half-plane constraints and near existing points.
Source code in pyeuclid/formalization/numericals.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
Relation
¶
Base class for logical relations over points.
Source code in pyeuclid/formalization/relation.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__str__()
¶
Readable representation, prefixed with Not() when negated.
Source code in pyeuclid/formalization/relation.py
60 61 62 63 64 65 66 67 68 69 | |
get_points()
¶
Return all point instances contained in the relation.
Source code in pyeuclid/formalization/relation.py
48 49 50 51 52 53 54 55 56 57 58 | |
negate()
¶
Toggle negation flag in-place.
Source code in pyeuclid/formalization/relation.py
44 45 46 | |
SameSide
¶
Bases: Relation
Points p1,p2 lie on the same side of the line (p3,p4).
Source code in pyeuclid/formalization/relation.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
__init__(p1, p2, p3, p4)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
Point
|
First query point. |
required |
p2
|
Point
|
Second query point. |
required |
p3
|
Point
|
Line endpoint 1. |
required |
p4
|
Point
|
Line endpoint 2. |
required |
Source code in pyeuclid/formalization/relation.py
195 196 197 198 199 200 201 202 203 204 205 | |
permutations()
¶
Enumerate symmetric orderings for same-side tests.
Source code in pyeuclid/formalization/relation.py
207 208 209 210 211 212 213 214 | |
Similar
¶
Bases: Relation
Triangles (p1,p2,p3) and (p4,p5,p6) are similar.
Source code in pyeuclid/formalization/relation.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(p1, p2, p3, p4, p5, p6)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1, p2, p3
|
Point
|
First triangle vertices. |
required |
p4, p5, p6
|
Point
|
Second triangle vertices. |
required |
Source code in pyeuclid/formalization/relation.py
347 348 349 350 351 352 353 354 355 356 | |
definition()
¶
Similarity expressed via length ratios and non-collinearity.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
358 359 360 361 362 363 364 365 366 367 368 369 370 | |
Similar4P
¶
Bases: Relation
Two quadrilaterals are similar.
Source code in pyeuclid/formalization/relation.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p4
|
Point
|
First quadrilateral. |
required |
p5..p8
|
Point
|
Second quadrilateral. |
required |
Source code in pyeuclid/formalization/relation.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
definition()
¶
Similarity expressed via side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | |
Similar5P
¶
Bases: Relation
Two pentagons are similar.
Source code in pyeuclid/formalization/relation.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
__init__(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1..p5
|
Point
|
First pentagon. |
required |
p6..p10
|
Point
|
Second pentagon. |
required |
Source code in pyeuclid/formalization/relation.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
definition()
¶
Similarity expressed via consecutive side ratios and angle equalities.
Returns:
| Type | Description |
|---|---|
|
list[Relation | sympy.Expr]: Derived relations/equations. |
Source code in pyeuclid/formalization/relation.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
construct_angle_bisector
¶
Bases: ConstructionRule
Construct the bisector point X of angle ABC.
Source code in pyeuclid/formalization/construction_rule.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
construct_angle_mirror
¶
Bases: ConstructionRule
Construct point X as the mirror of BA across BC.
Source code in pyeuclid/formalization/construction_rule.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
construct_circle
¶
Bases: ConstructionRule
Construct circle center X equidistant from A, B, C.
Source code in pyeuclid/formalization/construction_rule.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
construct_circumcenter
¶
Bases: ConstructionRule
Construct circumcenter X of triangle ABC.
Source code in pyeuclid/formalization/construction_rule.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
construct_eq_quadrangle
¶
Bases: ConstructionRule
Construct quadrilateral ABCD with equal diagonals.
Source code in pyeuclid/formalization/construction_rule.py
141 142 143 144 145 146 147 148 149 150 151 152 153 | |
construct_eq_trapezoid
¶
Bases: ConstructionRule
Construct isosceles trapezoid ABCD (AB ∥ CD).
Source code in pyeuclid/formalization/construction_rule.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
construct_eq_triangle
¶
Bases: ConstructionRule
Construct equilateral triangle with vertex X and base BC.
Source code in pyeuclid/formalization/construction_rule.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
construct_eqangle2
¶
Bases: ConstructionRule
Construct X so that angle ABX equals angle XCB.
Source code in pyeuclid/formalization/construction_rule.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
register
¶
Decorator that registers a construction rule into labeled sets.
Source code in pyeuclid/formalization/construction_rule.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
Angle(p1, p2, p3)
¶
Symbolic angle at p2.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Non-negative angle symbol. |
Source code in pyeuclid/formalization/relation.py
108 109 110 111 112 113 114 115 | |
Area(*ps)
¶
Symbolic polygonal area over an ordered point cycle.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive area symbol. |
Source code in pyeuclid/formalization/relation.py
128 129 130 131 132 133 134 135 | |
Length(p1, p2)
¶
Symbolic length between two points.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Positive length symbol. |
Source code in pyeuclid/formalization/relation.py
118 119 120 121 122 123 124 125 | |
Not(p)
¶
Return a negated shallow copy of a relation.
Source code in pyeuclid/formalization/relation.py
101 102 103 104 105 | |
Variable(name)
¶
Free symbolic variable placeholder.
Returns:
| Type | Description |
|---|---|
|
sympy.Symbol: Dimensionless variable symbol. |
Source code in pyeuclid/formalization/relation.py
138 139 140 141 142 143 144 | |
circle_circle_intersection(c1, c2)
¶
Returns a pair of Points as intersections of c1 and c2.
Source code in pyeuclid/formalization/numericals.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
line_circle_intersection(line, circle)
¶
Returns a pair of points as intersections of line and circle.
Source code in pyeuclid/formalization/numericals.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
random_rfss(*points)
¶
Random rotate-flip-scale-shift a point cloud.
Source code in pyeuclid/formalization/numericals.py
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
solve_quad(a, b, c)
¶
Solve a x^2 + bx + c = 0.
Source code in pyeuclid/formalization/numericals.py
513 514 515 516 517 518 519 520 521 | |