917
920
(eq_refl (p :: qs))).
920
TODO Give me a list of the points guaranteed to exist by collinearity_axiom.
922
TODO A function that returns two other points when given a point that are proved to be different and distinct
926
Proves that at least one line passes through
929
Definition point_line_ex
930
: forall p : point, exists l : line, on l p = true
935
fun (s : point) (H : distinct q r s /\ noncollinear q r s)
936
=> let qs := q :: r :: s :: nil in
938
(fun _ => exists l : line, on l p = true)
939
(fun H : points_differentb p qs = true
942
:= points_differentb_head p q (r :: s :: nil) H in
944
(fun l (H1 : unique (fun l => on l p = true /\ on l q = true) l)
946
(fun l => on l p = true)
949
(points_line_axiom p q H0))
950
(fun H : points_differentb p qs = false
956
923
Accepts a line and a list of points and returns
957
924
true iff all the ppints lie on the line.
959
926
Definition points_on
960
927
: line -> list point -> bool
961
:= fun l ps => forallb (fun p => on l p) ps.
928
:= fun l => forallb (on l).
964
931
Accepts a list of points and asserts that they
989
:= { ps : list point | points_distinct ps }.
993
Definition point_set_list
994
: point_set -> list point
999
Definition point_set_distinct
1000
: forall ps : point_set, points_distinct (point_set_list ps)
1005
Definition point_set_in
1006
: point -> point_set -> Prop
1008
=> In p (point_set_list ps).
1012
Definition point_set_in_dec
1013
: forall (p : point) (ps : point_set), {point_set_in p ps} + {~ point_set_in p ps}
1017
Definition point_set_subset
1018
: point_set -> point_set -> Prop
1020
=> forall p : point, point_set_in p ps -> point_set_in p qs.
1024
Definition point_set_disjoint
1025
: point_set -> point_set -> Prop
1027
=> forall p : point, point_set_in p ps -> ~ point_set_in p qs.
1031
Definition point_set_disjoint_sym
1032
: forall ps qs : point_set, point_set_disjoint ps qs -> point_set_disjoint qs ps
1036
Definition point_set_eq
1037
: point_set -> point_set -> Prop
1039
=> point_set_subset ps qs /\ point_set_subset qs ps.
1043
Definition point_set_nil
1046
(fun ps => points_distinct ps)
1048
points_distinct_nil.
1052
Definition point_set_difference_strong
1053
: forall ps qs : point_set, {rs : point_set | forall p : point, point_set_in p ps /\ ~ point_set_in p qs -> point_set_in p rs}
1059
Definition point_set_singleton
1060
: forall p : point -> {ps : point_set | unique (fun q : point => point_set_is q ps) p}
1064
Definition point_set_add
1065
: forall (p : point) (ps : point_set), {qs : list point | point_set_eq (point_set_difference qs ps) (point_
1071
Definition point_set_remove
1072
: forall (p : point) (ps : point_set), point_set_in p ps -> {qs : point_set | point_set_subset qs ps /\ ~ point_set_in p qs}
1076
Definition point_set_replace_collinear
1080
TODO Give me a list of the points guaranteed to exist by collinearity_axiom.
1082
TODO A function that returns two other points when given a point that are proved to be different and distinct
1085
| points_distinct ps /\
1089
: forall p : point, exists q : point, exists r : point, distinct p q r /\ noncollinear p q r
1091
my goal was to call the collinearity axiom to get three distinct noncollinear points q r s
1092
then form these in a list ps := q :: r :: s :: nil
1093
prove the elements were distinct using points_distinct_cons
1094
use cases over points_In_dec
1096
call points_distinct_remove to get qs where qs is distinct and doesnt contain
1097
in this case we can prove that p :: qs is noncollinear but we'd need to deepen our theory (points_collinear + thms).
1099
we can take the first two points and use points_different_head and points_different_tail iterative to prove they are all different
1102
: forall (p : point) (ps : list point) (H : points_distinct ps), points_noncollinear ps -> forall H0 : In p ps, let (qs, H1) := points_distinct_remove ps H p H0 in points_distinct (p :: qs) /\ points_noncollinear (p :: ps)
1108
Definition points_others_noncollinear
1109
: forall p : point, exists q : point, exists r : point, distinct p q r /\ noncollinear p q r
1111
=> ex_ind (fun q : point =>
1112
ex_ind (fun r : point =>
1114
(fun (s : point) (H : distinct q r s /\ noncollinear q r s)
1115
=> let ps := (q :: r :: s :: nil) in
1116
sumbool_ind (* over In p ps *)
1117
(fun _ => exists x : point, exists y : point, distinct p x y /\ noncollinear p x y)
1120
:= points_distinct_remove ps
1121
(* TODO: points_distinct ps *)
1123
let rs := p :: qs in
1125
:= points_list_destr qs
1127
|| a > 0 @a by (eq_add_S (proj1 (proj2 (proj2 H1))) : length qs = 2)) in
1129
:= points_list_destr ss
1134
Check (eq_add_S (length (1 :: 2 :: 3 :: nil)) 3 (eq_refl (length (0 :: 1 :: 2 :: 3 :: nil))) : length (1 :: 2 :: 3 :: nil) = 3).
1138
Proves that at least one line passes through
1141
Definition point_line_ex
1142
: forall p : point, exists l : line, on l p = true
1147
fun (s : point) (H : distinct q r s /\ noncollinear q r s)
1148
=> let qs := q :: r :: s :: nil in
1150
(fun _ => exists l : line, on l p = true)
1151
(fun H : points_differentb p qs = true
1154
:= points_differentb_head p q (r :: s :: nil) H in
1156
(fun l (H1 : unique (fun l => on l p = true /\ on l q = true) l)
1158
(fun l => on l p = true)
1161
(points_line_axiom p q H0))
1162
(fun H : points_differentb p qs = false
1018
1165
Definition points_collinearb_thm
1019
1166
: forall (ps : list point) (H : points_distinct ps), points_collinearb ps H = true <-> points_collinear ps