jjdishere / eg Goto Github PK
View Code? Open in Web Editor NEWFormalizing Euclidean Geometry in Lean
Formalizing Euclidean Geometry in Lean
A concept very useful in Position, and is easy to use in LCPosition.
It is a quotient of Ray and Line is a quotient of it.
Some file imports are not necessary, e.g.
B imports A ,and C imports both B and A.
Some file imports from Mathlib. I believe we should try to restrain import form Mathlib only in the file Vector.lean.
So there is a mission to clear all imports in the beginning of all files. After most files in Axiom and Constructions are done.
Should split Dir Proj to another file
Alternatively, we can define inx of x y : Line P
in Option P
. .none
when the are parallel.
still missing a normed space instance, for proving theroems in Vectors.lean
Now Lean cannot infer P
in l \parallel l'
when they have coe but not explicitly declared to coercion to LinearObj.
Task: Make this notation work.
we don't need a class called RTriangle, but we need some basic properties of it.
Too many files in the folder Axiom now, we should rearrange them into smaller folders. How?
still no documentation for most of the file. A documentation provides a working plan and guidance for the file.
the key theorem to many other theorems is that SAS implies congruent
but we have two ways proving SAS and other congruent theorems (both NOT easy)
one way to define congruent:
second way to define congruent: (the same technique Euclid used, but Euclid didn't claim congruent properly)
Now which route is better? And do we need both two routes to define congruent for general objects?
Please read the comments in both file before start to merge files. Similar theorems have been marked and sections has been planned in advance.
We try to redefine line as
Equivalent class of Rays.
As title says.
Sine value of OAngles could be negative if the triangle is clockwise (anti oriented), so the theorem should distinguish those two cases.
we should always 1 - 2 teams doing examples. When Construction is finished, half or more teams should do examples.
During formalization of exercises, we discover many theorems is formalized as
h : A LiesOn (seg_nd).1
however, hypothese are given as
A LiesOn SEG A B
It is inconvenient to use the theorem unless we prove a trivial claim
let seg_nd := \< SEG A B , sorry \>
have A LiesOn seg_nd.1 := by sorry
We should do this in a way that we can directly use LiesOn SEG_nd A B h in hypothesis.
Also do this for TRI_nd?
Use OANG (or ANG) for construction of an oriented angle and use symbol \angle (∠) to represent the value of an angle
We are defining different concept of IsCongr for Triangle and Triangle_nd
use macro
As title says. in position.lean?
A point LiesOn a line splits the line into two rays. This is some how a version of the Archimedean property of the line.
-- Arch property : \any r : \R, \exist s : \R such that s > r.
-- Another note : The Arch prop section now in Line.lean and the real Arch property have different meanings.
As long as tri.2 \ne tri.1, tri.3 \ne tri.1
, SAS do holds even when the triangle is degenerate.
Add these theorems into congruence.lean
The cosine theorem is the only theorem using bilinearity currently. With cosine theorem, we instantly get SAS, cos = ratio in a RTriangle, ... (even Pythagoras).
We decided to construct cosine theorem in the following order:
In constructions, a theorems can be stated in 2 different form. e.g.
theorem (tri : Triangle P) (h : tri.edge\1 = tri.edge\2) ...
theorem (A B C : P) (h : SEG A B = SEG A C)...
Should we include both version of theorems in most cases?
Example
PNT : point
LIN : line
SEG : segment
SGN : segment nondegenerate
ANG : angle (itself, the oriented angle, value is not a construction)
TRI : triangle
ARC : arc
SQR : square
QDR : quadrilateral
INX : intersection (this is an intersection)
AB//CD implies AB // DC, BA//CD BA//DC...
change Congr to
match tr1.is_nd
| true => sorry
| false => sorry
and when is_nd
we define a class with 6 fields (instead of using \and
).
Does this make using Congr easier?
Do we really need this? One seldom says Int and On together.
File Angle.lean
Define ang.external_angle
(whose start ray is ang.end_ray
, end ray is ang.start.reverse
)
.external_angle.external_angle
is not the same angle 对顶角
Write all numeric properties.
File Parallel.lean
内错角 同位角 同旁内角
File 垂直.lean
余角
File RightTriangle.lean
HL判别法
三角函数
Should add these permutation theorems into corresponding file. (using tactics like @[ext]
)
write theorems in Parallelogram not in A B C D : P
, but in prg : Parallelogram P
Thanks to alissa-tung , we get our first tactic. 👍
A major change of IsCongr in on the plan.
IsCongr
in to a structure with 6 fields.tri_nd
, don't do everything using tri_nd.1
congr_sa
should accept 3 conditions, we allow them to be .symm
and up to permutation.We are going to need lots of tactics. e. g.
tauto
tactic),simp
, and we need add attribute @[simp]
to new theorems),@[ext]
),linarith []
)When can we write our first tactic? The process form 0 to 1 is harder than from 1 to many.
the tactic colinear
, the naive version tactic judging whether 3 points are on the same line, can use a very simple algorithm behaving like "merging bubbles".
the tactic linear_order
discuss the "order" relation on a line. More precisely, it is the linear combination relation. A LiesOn SEG B C
means there exist 0 \le t \le 1
, xA = t xB + (1-t) xC
. Can linearize it? by adding new variables? (We can assume every point has coordinate \ge 0 by choosing a sufficient extreme point), so the above example will be translate into
0 \le t
t \le 1
xA = txB + xC - txC
0 \le txB
txB le xB
0 \le txC
txC \le xC
also writing goal (or its negation) into something like xA < xB \le xD
(more then one possible case)
Then use linarith
to solve it
Or can we define a order and use order?
Just as the title claimed.
High priority after naming convention is decided.
key point is that SEG_nd is used more commonly in geometric constructions
-- and that 1) makes the programs shorter (citation needed) (TRY IT!)
After a discussion with cyb, a major change emergence.
There are cases of point ne problem that our current planned pt_ne
tactic cannot solve.
Using convexity:
Let ABC be a triangle (nd), D liesint AB, E liesint AC, F liesint BC, O liesint EF. Then O ne G.
Note that this does not hold if one of D or E of F only lieson LIN instead of SEG.
Using position:
Let A B C D be four points lie on a line, X does not lies on this line, the if angle XCD > XBD > XAD > 0, then A B C D lies in order.
A file in Construction, discuss properties of perp center. (perp line and perp foot is constructed in perpendicular.lean already)
test
In some sense, the goal of position/convex is to show that every pt inside the incircle of a triangle falls in the triangle, and every pt inside the triangle is inside the circumcircle.
There is another road to do this (incircle):
Auto-generation of theorems of permutation
the name of the auto-generated theorems should be + 123 132 213 231 312 321
After we develop tactic pt_ne
,we shall do a enhanced, convenience version of SEG_nd, LIN, ANG
, who fills the condition of nondegenerate automatically SEG_nd' A B := SEG_nd A B (by pt_ne)
. If failed, the infoview should tell user pt_ne
cannot infer B \ne A
, try SEG_nd
and fill in B \ne A
by hand.
Instead of
notation "Vec" => \mathbb{R} * \mathbb{R}
we may use
class Vec where
fst : \mathbb{R}
snd : \mathbb{R}
This will enable us to use instances without messing up with product structure on \mathbb{R} \times \mathbb{R}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.