~llee454/llee454-incident-geometry/master

« back to all changes in this revision

Viewing changes to incidence.v

  • Committer: Larry Darryl Lee
  • Date: 2018-06-22 11:23:17 UTC
  • Revision ID: llee454@gmail.com-20180622112317-bc3lwoduiye5vva4
[Unstable] Branching to define point_set_add.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
(*
2
 
  6:15 6:20
 
2
  6:21 7:03 code
 
3
  7:18 7:20 review
3
4
  zojirushi $20 
4
5
 
5
6
  This module defines an abstract theory of
1056
1057
 
1057
1058
(*
1058
1059
*)
 
1060
Definition point_set_difference
 
1061
  :  point_set -> point_set -> point_set
 
1062
  := fun ps qs
 
1063
       => list_rec
 
1064
            (fun 
 
1065
 
 
1066
(*
 
1067
  TODO Fforgot to factor in the fact that point sets are distinct.
 
1068
*)
1059
1069
Definition point_set_difference_strong
1060
1070
  :  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}
 
1071
  := fun ps qs
 
1072
       => let t ps rs := forall p : point, point_set_in p ps /\ ~ point_set_in p qs -> point_set_in p rs in
 
1073
          let u ps := {rs | t ps rs} in
 
1074
          list_rec u
 
1075
            (exist
 
1076
              (t nil)
 
1077
              nil
 
1078
              (fun p (H : In p nil /\ ~ point_set_in p qs)
 
1079
                => False_ind
 
1080
                     (t nil nil)
 
1081
                     (and_ind
 
1082
                       (fun (H0 : In p nil) _ => H0)
 
1083
                       H)))
 
1084
            (fun p rs (F : u rs)
 
1085
              => sumbool_rec (* over in p qs *)
 
1086
                   (fun _ => u (p :: rs))
 
1087
                   (fun H : point_set_in p qs
 
1088
                     => let (ss, H0) := F in
 
1089
                        (* H0 : {ss : point_set | forall p : point, point_set_in p rs /\ ~ point_set_in p qs -> point_set_in p ss} *)
 
1090
                        exist
 
1091
                          (t (p :: rs))
 
1092
                          ss
 
1093
                          (fun q (H1 : point_set_in q (p :: rs) /\ ~ (point_set_in q qs))
 
1094
                            => or_ind
 
1095
                                 (fun H2 : p = q
 
1096
                                   => False_ind
 
1097
                                        (point_set_in q ss)
 
1098
                                        (proj2 H1
 
1099
                                          (H || point_set_in a qs @a by H2)))
 
1100
                                 (fun H2 : In p rs
 
1101
                                   => H0 (conj H2 (proj2 H1)))
 
1102
                                 (proj1 H1)))
 
1103
                   (fun H : ~ point_set_in p qs
 
1104
                     => let (ss, H0) := F in
 
1105
                        let ts := p :: ss in
 
1106
                        exist
 
1107
                          (t (p :: rs))
 
1108
                          ts
 
1109
                          (fun q (H1 : point_set_in q (p :: rs) /\ ~ (point_set_in q qs))
 
1110
                            => or_ind
 
1111
                                 (fun H2 : p = q
 
1112
                                   => or_inrol (In q ss) H2)
 
1113
                                 (fun H2 : In p rs
 
1114
                                   => or_intror
 
1115
                                        (p = q)
 
1116
                                        (H0 (conj H2 (proj2 H1))))
 
1117
                                 (proj1 H1)))
 
1118
            (point_set_list ps)
1061
1119
 
1062
1120
(*
1063
1121