我一直在尝试在Hilbert平面的几何中实现入射公理。并想出了以下公理:
interface (Eq point) => Plane line point where
-- Abstract notion for saying three points lie on the same line.
colinear : point -> point -> point -> Bool
coplanar : point -> point -> point -> Bool
contains : line -> point -> Bool
-- Intersection between two lines
intersects_at : line -> line -> point -> Bool
intersection_def : (contains l a = True) -> (contains m a = True) -> (intersects_at l m a = True)
-- For any two distinct points there is a line that contains them.
line_contains_two_points : (a,b : point) -> (a /= b) = True -> (l : line ** (contains l a = True, contains l b = True ))
-- If two points are contained by l and m then l = m
two_pts_define_line : contains l a = True -> contains l b = True -> contains m a = True -> contains m b = True -> l = m
-- There exists 3 non-colinear points.
three_non_colinear_pts : (a : point ** b : point ** c : point ** (colinear a b c = False, (a /= b) = True, (b /= c) = True, (a /= c) = True))
-- Any lines contains at least two points.
contain_two_pts : (l : line) -> (a : point ** b : point ** (contains l a = True, contains l b = True))
我想表明一条线最多与另一条线相交一次。所以我想出了以下声明:
intersect_at_most_one_point : (l, m : line) -> (a : point) -> (intersects_at l m a = True) -> (intersects_at l m b = True) -> a = b
其中包括:
给定两行,如果它们在两个点
a
和b
相交,那么它必须是a = b
。
然而我收到错误:
When checking type of Main.intersect_at_most_one_point:
When checking argument x to type constructor =:
Can't find implementation for Plane line point
所以我怀疑这意味着它需要某种data
值,我可以证明它满足入射几何的想法。我在数学上解释这个,因为我需要一个系统模型。问题是有很多几何形状和#34;满足这些完全不同的公理。
是否有可能推导出有关接口的定理而无需使用任何明确的data
?
答案 0 :(得分:2)
您需要将Plane
约束添加到intersect_at_most_one_point
的类型签名:
intersect_at_most_one_point : Plane line point =>
(l, m : line) -> (a : point) ->
(intersects_at l m a = True) -> (intersects_at l m b = True) ->
a = b