# Declarations

decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 267 2 274 41
body:
    trk_green_bands_si : THEOREM
      FORALL (fpr:FlightPlanRelevant_nz(to)):
      LET trkb = trk_bands_si(so,vo,to,fpr)(N-2) IN
       FORALL (i:subrange(0,trkb`length-2) | trkb`seq(i) /= trkb`seq(i+1)) : 
         NOT red_trk_band_fp?(so,vo,to,fpr,trkb)(i) IFF
         (FORALL (x | trkb`seq(i) < x AND x < trkb`seq(i+1)):
           LET trk = trk2v3(vo)(x) IN
           NOT conflict_3D?(so,to,trk,fpr))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 278 2 281 73
body:
    gs_bands_si_combines : LEMMA
      FORALL (i:subrange(0,N-2), x:real):
        member(x,gs_bands_si(so,vo,to,fp)(i)) IFF
          EXISTS (j:subrange(0,i)): member(x,gs_bands_si_i(so,vo,to,fp)(j))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 283 2 293 82
body:
    gs_bands_si_component : LEMMA
      FORALL (i:subrange(0,N-2), x:real):
        member(x,gs_bands_si(so,vo,to,fp)(i)) IFF
          EXISTS (j:subrange(0,i)): 
            LET
              LB = max(fp(j)`time,B+to)-to,
              UB = min(fp(1+j)`time,T+to)-to
            IN
            fp(j+1)`time > B+to AND fp(j)`time < T+ to AND 
            member(x,gs_bands_3D[D,H,LB,UB,gsmin,gsmax,vsmin,vsmax]
                     (so-(fp(j)`position - (fp(j)`time-to)*velocity(fp)(j)), vo, velocity(fp)(j)))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 296 2 305 74
body:
    gs_bands_si_equivalence: LEMMA
      FORALL (fpr:FlightPlanRelevant_nz(to)):
         LET
           gsb = gs_bands_si(so,vo,to,fpr)(N-2),
           gs = gs2v3(vo) 
         IN
         FORALL (x,y): (gsmin<=x AND x<=y AND y<=gsmax AND
           (FORALL (i:subrange(0,gsb`length-1)): gsb`seq(i) < x OR y < gsb`seq(i)))
           IMPLIES
           (conflict_3D?(so,to,gs(x),fpr) IFF conflict_3D?(so,to,gs(y),fpr))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 307 3 314 36
body:
     gs_red_bands_si : THEOREM
      FORALL (fpr:FlightPlanRelevant_nz(to)):
      LET gsb = gs_bands_si(so,vo,to,fpr)(N-2) IN
       FORALL (i:subrange(0,gsb`length-2) | gsb`seq(i) /= gsb`seq(i+1)) : 
         red_gs_band_fp?(so,vo,to,fpr,gsb)(i) IFF
         (FORALL (x | gsb`seq(i) < x AND x < gsb`seq(i+1)):
           LET gs = gs2v3(vo)(x) IN
           conflict_3D?(so,to,gs,fpr))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 316 2 323 40
body:
    gs_green_bands_si : THEOREM
      FORALL (fpr:FlightPlanRelevant_nz(to)):
      LET gsb = gs_bands_si(so,vo,to,fpr)(N-2) IN
       FORALL (i:subrange(0,gsb`length-2) | gsb`seq(i) /= gsb`seq(i+1)) : 
         NOT red_gs_band_fp?(so,vo,to,fpr,gsb)(i) IFF
         (FORALL (x | gsb`seq(i) < x AND x < gsb`seq(i+1)):
           LET gs = gs2v3(vo)(x) IN
           NOT conflict_3D?(so,to,gs,fpr))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 328 2 331 73
body:
    vs_bands_si_combines : LEMMA
      FORALL (i:subrange(0,N-2), x:real):
        member(x,vs_bands_si(so,vo,to,fp)(i)) IFF
          EXISTS (j:subrange(0,i)): member(x,vs_bands_si_i(so,vo,to,fp)(j))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 333 2 343 82
body:
    vs_bands_si_component : LEMMA
      FORALL (i:subrange(0,N-2), x:real):
        member(x,vs_bands_si(so,vo,to,fp)(i)) IFF
          EXISTS (j:subrange(0,i)): 
            LET
              LB = max(fp(j)`time,B+to)-to,
              UB = min(fp(1+j)`time,T+to)-to
            IN
            fp(j+1)`time > B+to AND fp(j)`time < T+ to AND 
            member(x,vs_bands_3D[D,H,LB,UB,gsmin,gsmax,vsmin,vsmax]
                     (so-(fp(j)`position - (fp(j)`time-to)*velocity(fp)(j)), vo, velocity(fp)(j)))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 346 2 355 74
body:
    vs_bands_si_equivalence: LEMMA
      FORALL (fpr:FlightPlanRelevant_nz(to)):
         LET
           vsb = vs_bands_si(so,vo,to,fpr)(N-2),
           vs = vs2v3(vo) 
         IN
         FORALL (x,y): (vsmin<=x AND x<=y AND y<=vsmax AND
           (FORALL (i:subrange(0,vsb`length-1)): vsb`seq(i) < x OR y < vsb`seq(i)))
           IMPLIES
           (conflict_3D?(so,to,vs(x),fpr) IFF conflict_3D?(so,to,vs(y),fpr))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 357 3 364 36
body:
     vs_red_bands_si : THEOREM
      FORALL (fpr:FlightPlanRelevant_nz(to)):
      LET vsb = vs_bands_si(so,vo,to,fpr)(N-2) IN
       FORALL (i:subrange(0,vsb`length-2) | vsb`seq(i) /= vsb`seq(i+1)) : 
         red_vs_band_fp?(so,vo,to,fpr,vsb)(i) IFF
         (FORALL (x | vsb`seq(i) < x AND x < vsb`seq(i+1)):
           LET vs = vs2v3(vo)(x) IN
           conflict_3D?(so,to,vs,fpr))


decl_type: formula
theory: bands_si
library: ACCoRD
signature: nil
location: 366 2 373 40
body:
    vs_green_bands_si : THEOREM
      FORALL (fpr:FlightPlanRelevant_nz(to)):
      LET vsb = vs_bands_si(so,vo,to,fpr)(N-2) IN
       FORALL (i:subrange(0,vsb`length-2) | vsb`seq(i) /= vsb`seq(i+1)) : 
         NOT red_vs_band_fp?(so,vo,to,fpr,vsb)(i) IFF
         (FORALL (x | vsb`seq(i) < x AND x < vsb`seq(i+1)):
           LET vs = vs2v3(vo)(x) IN
           NOT conflict_3D?(so,to,vs,fpr))


decl_type: type
theory: bands_si
library: ACCoRD
signature: nil
location: 23 3 23 119
body:
     FlightPlanRelevant_nz(to): TYPE+ = {flp: FlightPlanRelevant(to) | FORALL(i:below[N-1]): nz_vect2?(velocity(flp)(i))}


decl_type: function
theory: bands_si
library: ACCoRD
location: 32 2 54 9
signature:
  [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
          [below[N - 1] ->
             {fs: (trk_fseq?[gsmin, gsmax]) | increasing?(fs)}]]

body:
    trk_bands_si_i(so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz) (i : below[N-1]) 
    : {fs : (trk_fseq?[gsmin,gsmax]) | increasing?(fs)} =
      LET
        fi_st = fp(i)`time,               % assume 0 <= fi_st <= to
        fi_et = fp(i+1)`time,             % assume fist < fi_et
        vi = velocity(fp)(i),             % intruder velocity for segment i
        Bo = B+to,                        % absolute range bottom
        To = T+to                         % absolute range bottom
      IN
      IF fi_et <= Bo OR fi_st >= To THEN
        emptyseq
      ELSE
          LET
            st = max(fi_st,Bo),           % start of range time
            et = min(fi_et,To),           % end of range time
            si = fp(i)`position,          % intruder position for segment i
            si_o = si-(fi_st-to)*vi,      % projected intruder position back to to
            s = so-si_o,                  % relative position at start time
            rel_st = st-to,               % relative start time
            rel_et = et-to                % relative end time
          IN
          trk_bands_3D[D,H,rel_st,rel_et,gsmin,gsmax,vsmin,vsmax](s, vo, vi)
      ENDIF


decl_type: function
theory: bands_si
library: ACCoRD
location: 69 2 76 11
signature:
  [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
          [below[N - 1] ->
             {fs: (trk_fseq?[gsmin, gsmax]) | increasing?(fs)}]]

body:
    trk_bands_si(so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz) (i : below[N-1]) 
    : RECURSIVE {fs : (trk_fseq?[gsmin,gsmax]) | increasing?(fs)} =
      IF i=0 THEN
        trk_bands_si_i(so,vo,to,fp)(i)
      ELSE
        sort (trk_bands_si_i(so,vo,to,fp)(i) o trk_bands_si(so,vo,to,fp)(i-1))
      ENDIF
    MEASURE i


decl_type: function
theory: bands_si
library: ACCoRD
location: 81 2 103 9
signature:
  [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
          [below[N - 1] ->
             {fs: (gs_fseq?[gsmin, gsmax]) | increasing?(fs)}]]

body:
    gs_bands_si_i(so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz) (i : below[N-1]) 
    : {fs : (gs_fseq?[gsmin,gsmax]) | increasing?(fs)} =
      LET
        fi_st = fp(i)`time,               % assume 0 <= fi_st <= to
        fi_et = fp(i+1)`time,             % assume fist < fi_et
        vi = velocity(fp)(i),             % intruder velocity for segment i
        Bo = B+to,                        % absolute range bottom
        To = T+to                         % absolute range bottom
      IN
      IF fi_et <= Bo OR fi_st >= To THEN
        emptyseq
      ELSE
          LET
            st = max(fi_st,Bo),           % start of range time
            et = min(fi_et,To),           % end of range time
            si = fp(i)`position,          % intruder position for segment i
            si_o = si-(fi_st-to)*vi,      % projected intruder position back to to
            s = so-si_o,                  % relative position at start time
            rel_st = st-to,               % relative start time
            rel_et = et-to                % relative end time
          IN
          gs_bands_3D[D,H,rel_st,rel_et,gsmin,gsmax,vsmin,vsmax](s, vo, vi)
      ENDIF


decl_type: function
theory: bands_si
library: ACCoRD
location: 106 2 113 11
signature:
  [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
          [below[N - 1] ->
             {fs: (gs_fseq?[gsmin, gsmax]) | increasing?(fs)}]]

body:
    gs_bands_si(so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz) (i : below[N-1]) 
    : RECURSIVE {fs : (gs_fseq?[gsmin,gsmax]) | increasing?(fs)} =
      IF i=0 THEN
        gs_bands_si_i(so,vo,to,fp)(i)
      ELSE
        sort (gs_bands_si_i(so,vo,to,fp)(i) o gs_bands_si(so,vo,to,fp)(i-1))
      ENDIF
    MEASURE i


decl_type: function
theory: bands_si
library: ACCoRD
location: 118 2 140 9
signature:
  [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
          [below[N - 1] ->
             {fs: (vs_fseq?[vsmin, vsmax]) | increasing?(fs)}]]

body:
    vs_bands_si_i(so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz) (i : below[N-1]) 
    : {fs : (vs_fseq?[vsmin,vsmax]) | increasing?(fs)} =
      LET
        fi_st = fp(i)`time,               % assume 0 <= fi_st <= to
        fi_et = fp(i+1)`time,             % assume fist < fi_et
        vi = velocity(fp)(i),             % intruder velocity for segment i
        Bo = B+to,                        % absolute range bottom
        To = T+to                         % absolute range bottom
      IN
      IF fi_et <= Bo OR fi_st >= To THEN
        emptyseq
      ELSE
          LET
            st = max(fi_st,Bo),           % start of range time
            et = min(fi_et,To),           % end of range time
            si = fp(i)`position,          % intruder position for segment i
            si_o = si-(fi_st-to)*vi,      % projected intruder position back to to
            s = so-si_o,                  % relative position at start time
            rel_st = st-to,               % relative start time
            rel_et = et-to                % relative end time
          IN
          vs_bands_3D[D,H,rel_st,rel_et,gsmin,gsmax,vsmin,vsmax](s, vo, vi)
      ENDIF


decl_type: function
theory: bands_si
library: ACCoRD
location: 143 2 150 11
signature:
  [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
          [below[N - 1] ->
             {fs: (vs_fseq?[vsmin, vsmax]) | increasing?(fs)}]]

body:
    vs_bands_si(so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz) (i : below[N-1]) 
    : RECURSIVE {fs : (vs_fseq?[vsmin,vsmax]) | increasing?(fs)} =
      IF i=0 THEN
        vs_bands_si_i(so,vo,to,fp)(i)
      ELSE
        sort (vs_bands_si_i(so,vo,to,fp)(i) o vs_bands_si(so,vo,to,fp)(i-1))
      ENDIF
    MEASURE i


decl_type: function
theory: bands_si
library: ACCoRD
location: 157 2 162 30
signature:
  [d:
          [Vect3, Nzv2_vect3, real, FlightPlan_nz[N],
           {fs: (trk_fseq?[gsmin, gsmax]) | increasing?(fs)}] ->
          [subrange(0, d`5`length - 2) -> bool]]

body:
    red_trk_band_fp?(so,vo,to,fp,trkb)(i:subrange(0,trkb`length-2)) : bool =
      LET
        mp = (trkb`seq(i)+trkb`seq(i+1))/2,
        trk = trk2v3(vo)(mp) 
      IN
      conflict_3D?(so,to,trk,fp)


decl_type: function
theory: bands_si
library: ACCoRD
location: 164 2 169 29
signature:
  [d:
          [Vect3, Nzv2_vect3, real, FlightPlan_nz[N],
           {fs: (gs_fseq?[gsmin, gsmax]) | increasing?(fs)}] ->
          [subrange(0, d`5`length - 2) -> bool]]

body:
    red_gs_band_fp?(so,vo,to,fp,gsb)(i:subrange(0,gsb`length-2)) : bool =
      LET
        mp = (gsb`seq(i)+gsb`seq(i+1))/2,
        gs = gs2v3(vo)(mp) 
      IN
      conflict_3D?(so,to,gs,fp)


decl_type: function
theory: bands_si
library: ACCoRD
location: 171 2 176 29
signature:
  [d:
          [Vect3, Nzv2_vect3, real, FlightPlan_nz[N],
           {fs: (vs_fseq?[vsmin, vsmax]) | increasing?(fs)}] ->
          [subrange(0, d`5`length - 2) -> bool]]

body:
    red_vs_band_fp?(so,vo,to,fp,vsb)(i:subrange(0,vsb`length-2)) : bool =
      LET
        mp = (vsb`seq(i)+vsb`seq(i+1))/2,
        vs = vs2v3(vo)(mp) 
      IN
      conflict_3D?(so,to,vs,fp)


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 382 0 384 999
body:
  % Subtype TCC generated (at line 23, column 84) for  N - 1
      % expected type  nat
  FlightPlanRelevant_nz_TCC1: OBLIGATION FORALL (to: real): N - 1 >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 386 0 389 999
body:
  % Subtype TCC generated (at line 15, column 71) for  i - 1
      % expected type  below[N]
  FlightPlanRelevant_nz_TCC2: OBLIGATION
    FORALL (i: below[N]): i - 1 >= 0 IMPLIES i - 1 < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 391 0 393 999
body:
  % Subtype TCC generated (at line 15, column 45) for  0
      % expected type  below[N]
  FlightPlanRelevant_nz_TCC3: OBLIGATION 0 < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 395 0 399 999
body:
  % Subtype TCC generated (at line 18, column 87) for  N - 1
      % expected type  below[N]
  FlightPlanRelevant_nz_TCC4: OBLIGATION
    FORALL (to: real, flp: FlightPlan[N]):
      flp(0)`time < to + T IMPLIES N - 1 >= 0 AND N - 1 < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 401 0 412 999
body:
  % Existence TCC generated (at line 23, column 3) for
      % FlightPlanRelevant_nz(to): TYPE+ =
      %       {flp: FlightPlanRelevant(to) |
      %                FORALL (i: below[N - 1]):
      %                  vect2(velocity(flp)(i)) /= zero}
  FlightPlanRelevant_nz_TCC5: OBLIGATION
    FORALL (to: real):
      EXISTS (x:
                {flp: FlightPlanRelevant[D, H, B, T, N](to) |
                         FORALL (i: below[N - 1]):
                           vect2(velocity[N](flp)(i)) /= zero}):
        TRUE;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 414 0 417 999
body:
  % Subtype TCC generated (at line 35, column 17) for  i
      % expected type  below[N]
  trk_bands_si_i_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3, i: below[N - 1]): i < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 419 0 424 999
body:
  % Subtype TCC generated (at line 36, column 17) for  i + 1
      % expected type  below[N]
  trk_bands_si_i_TCC2: OBLIGATION
    FORALL (vo: Nzv2_vect3, fp: FlightPlan_nz[N], i: below[N - 1],
            fi_st: real):
      fi_st = fp(i)`time IMPLIES i + 1 < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 426 0 445 999
body:
  % Subtype TCC generated (at line 53, column 24) for  empty_seq
      % expected type  {fs: (trk_fseq?[gsmin, gsmax]) | increasing?(fs)}
  trk_bands_si_i_TCC3: OBLIGATION
    FORALL (vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N], i: below[N - 1],
            fi_st: real):
      fi_st = fp(i)`time IMPLIES
       (FORALL (fi_et: real):
          fi_et = fp(i + 1)`time IMPLIES
           (FORALL (vi: Vect3):
              vi = velocity(fp)(i) IMPLIES
               (FORALL (Bo: real):
                  Bo = B + to IMPLIES
                   (FORALL (To: real):
                      (fi_et <= Bo OR fi_st >= To) AND To = T + to IMPLIES
                       (FORALL (i: nat):
                          i >= empty_seq[real]`length IMPLIES
                           empty_seq[real]`seq(i) = default[real])
                        AND
                        trk_fseq?[gsmin, gsmax](empty_seq[real]) AND
                         increasing?[real, <=](empty_seq[real])))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 447 0 483 999
body:
  % Subtype TCC generated (at line 53, column 71) for  vi
      % expected type  Nzv2_vect3
  trk_bands_si_i_TCC4: OBLIGATION
    FORALL (so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N],
            i: below[N - 1], fi_st: real):
      fi_st = fp(i)`time IMPLIES
       (FORALL (fi_et: real):
          fi_et = fp(i + 1)`time IMPLIES
           (FORALL (vi: Vect3):
              vi = velocity(fp)(i) IMPLIES
               (FORALL (Bo: real):
                  Bo = B + to IMPLIES
                   (FORALL (To: real):
                      NOT fi_et <= Bo AND NOT fi_st >= To AND To = T + to
                       IMPLIES
                       (FORALL (st: {p: real | p >= fi_st AND p >= Bo}):
                          st = max(fi_st, Bo) IMPLIES
                           (FORALL (et: {p: real | p <= fi_et AND p <= To}):
                              et = min(fi_et, To) IMPLIES
                               (FORALL (si: Vect3):
                                  si = fp(i)`position IMPLIES
                                   (FORALL (si_o: Vector):
                                      si_o = si - (fi_st - to) * vi
                                      IMPLIES
                                      (FORALL
                                       (s: Vector):
                                       s = so - si_o
                                       IMPLIES
                                       (FORALL
                                        (rel_st: real):
                                        rel_st = st - to
                                        IMPLIES
                                        (FORALL
                                         (rel_et: real):
                                         rel_et = et - to
                                         IMPLIES
                                         vect2(vi) /= zero)))))))))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 485 0 521 999
body:
  % Subtype TCC generated (at line 53, column 25) for  rel_st
      % expected type  nnreal
  trk_bands_si_i_TCC5: OBLIGATION
    FORALL (so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N],
            i: below[N - 1], fi_st: real):
      fi_st = fp(i)`time IMPLIES
       (FORALL (fi_et: real):
          fi_et = fp(i + 1)`time IMPLIES
           (FORALL (vi: Vect3):
              vi = velocity(fp)(i) IMPLIES
               (FORALL (Bo: real):
                  Bo = B + to IMPLIES
                   (FORALL (To: real):
                      NOT fi_et <= Bo AND NOT fi_st >= To AND To = T + to
                       IMPLIES
                       (FORALL (st: {p: real | p >= fi_st AND p >= Bo}):
                          st = max(fi_st, Bo) IMPLIES
                           (FORALL (et: {p: real | p <= fi_et AND p <= To}):
                              et = min(fi_et, To) IMPLIES
                               (FORALL (si: Vect3):
                                  si = fp(i)`position IMPLIES
                                   (FORALL (si_o: Vector):
                                      si_o = si - (fi_st - to) * vi
                                      IMPLIES
                                      (FORALL
                                       (s: Vector):
                                       s = so - si_o
                                       IMPLIES
                                       (FORALL
                                        (rel_st: real):
                                        rel_st = st - to
                                        IMPLIES
                                        (FORALL
                                         (rel_et: real):
                                         rel_et = et - to
                                         IMPLIES
                                         rel_st >= 0)))))))))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 523 0 563 999
body:
  % Subtype TCC generated (at line 53, column 32) for  rel_et
      % expected type  {x: posreal | x > rel_st}
  trk_bands_si_i_TCC6: OBLIGATION
    FORALL (so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N],
            i: below[N - 1], fi_st: real):
      fi_st = fp(i)`time IMPLIES
       (FORALL (fi_et: real):
          fi_et = fp(i + 1)`time IMPLIES
           (FORALL (vi: Vect3):
              vi = velocity(fp)(i) IMPLIES
               (FORALL (Bo: real):
                  Bo = B + to IMPLIES
                   (FORALL (To: real):
                      NOT fi_et <= Bo AND NOT fi_st >= To AND To = T + to
                       IMPLIES
                       (FORALL (st: {p: real | p >= fi_st AND p >= Bo}):
                          st = max(fi_st, Bo) IMPLIES
                           (FORALL (et: {p: real | p <= fi_et AND p <= To}):
                              et = min(fi_et, To) IMPLIES
                               (FORALL (si: Vect3):
                                  si = fp(i)`position IMPLIES
                                   (FORALL (si_o: Vector):
                                      si_o = si - (fi_st - to) * vi
                                      IMPLIES
                                      (FORALL
                                       (s: Vector):
                                       s = so - si_o
                                       IMPLIES
                                       (FORALL
                                        (rel_st: real):
                                        rel_st = st - to
                                        IMPLIES
                                        (FORALL
                                         (rel_et: real):
                                         rel_et = et - to
                                         IMPLIES
                                         rel_et >= 0
                                         AND
                                         rel_et > 0
                                         AND
                                         rel_et > rel_st)))))))))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 565 0 567 999
body:
  % Subtype TCC generated (at line 59, column 7) for  i + 1
      % expected type  below[N]
  expand_trk_bands_si_i_TCC1: OBLIGATION FORALL (i: below[N - 1]): i + 1 < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 569 0 573 999
body:
  % Subtype TCC generated (at line 59, column 31) for  i
      % expected type  below[N]
  expand_trk_bands_si_i_TCC2: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: below[N - 1]):
      fp(i + 1)`time > B + to IMPLIES i < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 575 0 581 999
body:
  % Subtype TCC generated (at line 63, column 24) for  1 + i
      % expected type  below[N]
  expand_trk_bands_si_i_TCC3: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: below[N - 1]):
      fp(i + 1)`time > B + to AND fp(i)`time < T + to IMPLIES
       (FORALL (LB: real):
          LB = max(fp(i)`time, B + to) - to IMPLIES 1 + i < N);


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 583 0 592 999
body:
  % Subtype TCC generated (at line 65, column 115) for  velocity(fp)(i)
      % expected type  Nzv2_vect3
  expand_trk_bands_si_i_TCC4: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: below[N - 1]):
      fp(i + 1)`time > B + to AND fp(i)`time < T + to IMPLIES
       (FORALL (LB: real):
          LB = max(fp(i)`time, B + to) - to IMPLIES
           (FORALL (UB: real):
              UB = min(fp(1 + i)`time, T + to) - to IMPLIES
               vect2(velocity[N](fp)(i)) /= zero));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 594 0 602 999
body:
  % Subtype TCC generated (at line 65, column 27) for  LB
      % expected type  nnreal
  expand_trk_bands_si_i_TCC5: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: below[N - 1]):
      fp(i + 1)`time > B + to AND fp(i)`time < T + to IMPLIES
       (FORALL (LB: real):
          LB = max(fp(i)`time, B + to) - to IMPLIES
           (FORALL (UB: real):
              UB = min(fp(1 + i)`time, T + to) - to IMPLIES LB >= 0));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 604 0 613 999
body:
  % Subtype TCC generated (at line 65, column 30) for  UB
      % expected type  {x: posreal | x > LB}
  expand_trk_bands_si_i_TCC6: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: below[N - 1]):
      fp(i + 1)`time > B + to AND fp(i)`time < T + to IMPLIES
       (FORALL (LB: real):
          LB = max(fp(i)`time, B + to) - to IMPLIES
           (FORALL (UB: real):
              UB = min(fp(1 + i)`time, T + to) - to IMPLIES
               UB >= 0 AND UB > 0 AND UB > LB));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 615 0 617 999
body:
  % Subtype TCC generated (at line 69, column 82) for  N - 1
      % expected type  nat
  trk_bands_si_TCC1: OBLIGATION FORALL (vo: Nzv2_vect3): N - 1 >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 619 0 623 999
body:
  % Subtype TCC generated (at line 74, column 71) for  i - 1
      % expected type  below[N - 1]
  trk_bands_si_TCC2: OBLIGATION
    FORALL (vo: Nzv2_vect3, i: below[N - 1]):
      NOT i = 0 IMPLIES i - 1 >= 0 AND i - 1 < N - 1;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 625 0 628 999
body:
  % Termination TCC generated (at line 74, column 45) for
      % trk_bands_si(so, vo, to, fp)(i - 1)
  trk_bands_si_TCC3: OBLIGATION
    FORALL (vo: Nzv2_vect3, i: below[N - 1]): NOT i = 0 IMPLIES i - 1 < i;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 630 0 652 999
body:
  % Subtype TCC generated (at line 74, column 6) for
      % sort(trk_bands_si_i(so, vo, to, fp)(i) o
      %       trk_bands_si(so, vo, to, fp)(i - 1))
      % expected type  {fs: (trk_fseq?[gsmin, gsmax]) | increasing?(fs)}
  trk_bands_si_TCC4: OBLIGATION
    FORALL (so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N],
            i: below[N - 1],
            v:
              [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
                 [{z1: below[N - 1] | z1 < i} ->
                    {fs: (trk_fseq?[gsmin, gsmax]) | increasing?(fs)}]]):
      NOT i = 0 IMPLIES
       trk_fseq?[gsmin, gsmax]
           (sort[real, <=]
                (o[real]
                     (trk_bands_si_i(so, vo, to, fp)(i),
                      v(so, vo, to, fp)(i - 1))))
        AND
        increasing?[real, <=]
            (sort[real, <=]
                 (o[real]
                      (trk_bands_si_i(so, vo, to, fp)(i),
                       v(so, vo, to, fp)(i - 1))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 654 0 673 999
body:
  % Subtype TCC generated (at line 53, column 24) for  empty_seq
      % expected type  {fs: (gs_fseq?[gsmin, gsmax]) | increasing?(fs)}
  gs_bands_si_i_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N], i: below[N - 1],
            fi_st: real):
      fi_st = fp(i)`time IMPLIES
       (FORALL (fi_et: real):
          fi_et = fp(i + 1)`time IMPLIES
           (FORALL (vi: Vect3):
              vi = velocity(fp)(i) IMPLIES
               (FORALL (Bo: real):
                  Bo = B + to IMPLIES
                   (FORALL (To: real):
                      (fi_et <= Bo OR fi_st >= To) AND To = T + to IMPLIES
                       (FORALL (i: nat):
                          i >= empty_seq[real]`length IMPLIES
                           empty_seq[real]`seq(i) = default[real])
                        AND
                        gs_fseq?[gsmin, gsmax](empty_seq[real]) AND
                         increasing?[real, <=](empty_seq[real])))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 675 0 697 999
body:
  % Subtype TCC generated (at line 111, column 6) for
      % sort(gs_bands_si_i(so, vo, to, fp)(i) o
      %       gs_bands_si(so, vo, to, fp)(i - 1))
      % expected type  {fs: (gs_fseq?[gsmin, gsmax]) | increasing?(fs)}
  gs_bands_si_TCC1: OBLIGATION
    FORALL (so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N],
            i: below[N - 1],
            v:
              [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
                 [{z1: below[N - 1] | z1 < i} ->
                    {fs: (gs_fseq?[gsmin, gsmax]) | increasing?(fs)}]]):
      NOT i = 0 IMPLIES
       gs_fseq?[gsmin, gsmax]
           (sort[real, <=]
                (o[real]
                     (gs_bands_si_i(so, vo, to, fp)(i),
                      v(so, vo, to, fp)(i - 1))))
        AND
        increasing?[real, <=]
            (sort[real, <=]
                 (o[real]
                      (gs_bands_si_i(so, vo, to, fp)(i),
                       v(so, vo, to, fp)(i - 1))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 699 0 718 999
body:
  % Subtype TCC generated (at line 53, column 24) for  empty_seq
      % expected type  {fs: (vs_fseq?[vsmin, vsmax]) | increasing?(fs)}
  vs_bands_si_i_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N], i: below[N - 1],
            fi_st: real):
      fi_st = fp(i)`time IMPLIES
       (FORALL (fi_et: real):
          fi_et = fp(i + 1)`time IMPLIES
           (FORALL (vi: Vect3):
              vi = velocity(fp)(i) IMPLIES
               (FORALL (Bo: real):
                  Bo = B + to IMPLIES
                   (FORALL (To: real):
                      (fi_et <= Bo OR fi_st >= To) AND To = T + to IMPLIES
                       (FORALL (i: nat):
                          i >= empty_seq[real]`length IMPLIES
                           empty_seq[real]`seq(i) = default[real])
                        AND
                        vs_fseq?[vsmin, vsmax](empty_seq[real]) AND
                         increasing?[real, <=](empty_seq[real])))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 720 0 742 999
body:
  % Subtype TCC generated (at line 148, column 6) for
      % sort(vs_bands_si_i(so, vo, to, fp)(i) o
      %       vs_bands_si(so, vo, to, fp)(i - 1))
      % expected type  {fs: (vs_fseq?[vsmin, vsmax]) | increasing?(fs)}
  vs_bands_si_TCC1: OBLIGATION
    FORALL (so: Vect3, vo: Nzv2_vect3, to: real, fp: FlightPlan_nz[N],
            i: below[N - 1],
            v:
              [[Vect3, Nzv2_vect3, real, FlightPlan_nz[N]] ->
                 [{z1: below[N - 1] | z1 < i} ->
                    {fs: (vs_fseq?[vsmin, vsmax]) | increasing?(fs)}]]):
      NOT i = 0 IMPLIES
       vs_fseq?[vsmin, vsmax]
           (sort[real, <=]
                (o[real]
                     (vs_bands_si_i(so, vo, to, fp)(i),
                      v(so, vo, to, fp)(i - 1))))
        AND
        increasing?[real, <=]
            (sort[real, <=]
                 (o[real]
                      (vs_bands_si_i(so, vo, to, fp)(i),
                       v(so, vo, to, fp)(i - 1))));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 744 0 751 999
body:
  % Subtype TCC generated (at line 159, column 21) for  i
      % expected type  nat
  red_trk_band_fp?_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3,
            trkb:
              {fs: (trk_fseq?[gsmin, gsmax]) | increasing?[real, <=](fs)},
            i: subrange(0, trkb`length - 2)):
      i >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 753 0 760 999
body:
  % Subtype TCC generated (at line 159, column 33) for  i + 1
      % expected type  nat
  red_trk_band_fp?_TCC2: OBLIGATION
    FORALL (vo: Nzv2_vect3,
            trkb:
              {fs: (trk_fseq?[gsmin, gsmax]) | increasing?[real, <=](fs)},
            i: subrange(0, trkb`length - 2)):
      i + 1 >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 762 0 768 999
body:
  % Subtype TCC generated (at line 166, column 20) for  i
      % expected type  nat
  red_gs_band_fp?_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3,
            gsb: {fs: (gs_fseq?[gsmin, gsmax]) | increasing?[real, <=](fs)},
            i: subrange(0, gsb`length - 2)):
      i >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 770 0 776 999
body:
  % Subtype TCC generated (at line 166, column 31) for  i + 1
      % expected type  nat
  red_gs_band_fp?_TCC2: OBLIGATION
    FORALL (vo: Nzv2_vect3,
            gsb: {fs: (gs_fseq?[gsmin, gsmax]) | increasing?[real, <=](fs)},
            i: subrange(0, gsb`length - 2)):
      i + 1 >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 778 0 784 999
body:
  % Subtype TCC generated (at line 173, column 20) for  i
      % expected type  nat
  red_vs_band_fp?_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3,
            vsb: {fs: (vs_fseq?[vsmin, vsmax]) | increasing?[real, <=](fs)},
            i: subrange(0, vsb`length - 2)):
      i >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 786 0 792 999
body:
  % Subtype TCC generated (at line 173, column 31) for  i + 1
      % expected type  nat
  red_vs_band_fp?_TCC2: OBLIGATION
    FORALL (vo: Nzv2_vect3,
            vsb: {fs: (vs_fseq?[vsmin, vsmax]) | increasing?[real, <=](fs)},
            i: subrange(0, vsb`length - 2)):
      i + 1 >= 0;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 794 0 797 999
body:
  % Subtype TCC generated (at line 186, column 27) for  j
      % expected type  below[N - 1]
  segdefs_TCC1: OBLIGATION
    FORALL (j: subrange(0, N - 2)): j >= 0 AND j < N - 1;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 799 0 801 999
body:
  % Subtype TCC generated (at line 186, column 33) for  j
      % expected type  below[N]
  segdefs_TCC2: OBLIGATION FORALL (j: subrange(0, N - 2)): j >= 0 AND j < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 803 0 809 999
body:
  % Subtype TCC generated (at line 187, column 50) for  1 + j
      % expected type  below[N]
  segdefs_TCC3: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, j: subrange(0, N - 2)):
      seg_lh_bottom(fp, to)(j) + fp(j)`time - to =
       max(fp(j)`time, B + to) - to
       IMPLIES 1 + j >= 0 AND 1 + j < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 811 0 814 999
body:
  % Subtype TCC generated (at line 199, column 71) for  j
      % expected type  below[N - 1]
  trk_bands_si_combines_TCC1: OBLIGATION
    FORALL (i: subrange(0, N - 2), j: subrange(0, i)): j >= 0 AND j < N - 1;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 816 0 821 999
body:
  % Subtype TCC generated (at line 53, column 24) for  empty_seq
      % expected type  fseq[real]
  empty_no_members_TCC1: OBLIGATION
    FORALL (i: nat):
      i >= empty_seq[real]`length IMPLIES
       empty_seq[real]`seq(i) = default[real];


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 823 0 826 999
body:
  % Subtype TCC generated (at line 213, column 24) for  j
      % expected type  below[N]
  trk_bands_si_component_TCC1: OBLIGATION
    FORALL (i: subrange(0, N - 2), j: subrange(0, i)): j >= 0 AND j < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 828 0 833 999
body:
  % Subtype TCC generated (at line 214, column 24) for  1 + j
      % expected type  below[N]
  trk_bands_si_component_TCC2: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: subrange(0, N - 2),
            j: subrange(0, i), LB: real):
      LB = max(fp(j)`time, B + to) - to IMPLIES 1 + j >= 0 AND 1 + j < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 835 0 843 999
body:
  % Subtype TCC generated (at line 216, column 13) for  j + 1
      % expected type  below[N]
  trk_bands_si_component_TCC3: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: subrange(0, N - 2),
            j: subrange(0, i), LB: real):
      LB = max(fp(j)`time, B + to) - to IMPLIES
       (FORALL (UB: real):
          UB = min(fp(1 + j)`time, T + to) - to IMPLIES
           j + 1 >= 0 AND j + 1 < N);


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 845 0 854 999
body:
  % Subtype TCC generated (at line 218, column 65) for  velocity(fp)(j)
      % expected type  Nzv2_vect3
  trk_bands_si_component_TCC4: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: subrange(0, N - 2),
            j: subrange(0, i), LB: real):
      LB = max(fp(j)`time, B + to) - to IMPLIES
       (FORALL (UB: real):
          fp(j)`time < T + to AND
           fp(j + 1)`time > B + to AND UB = min(fp(1 + j)`time, T + to) - to
           IMPLIES vect2(velocity[N](fp)(j)) /= zero);


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 856 0 865 999
body:
  % Subtype TCC generated (at line 217, column 36) for  LB
      % expected type  nnreal
  trk_bands_si_component_TCC5: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: subrange(0, N - 2),
            j: subrange(0, i), LB: real):
      LB = max(fp(j)`time, B + to) - to IMPLIES
       (FORALL (UB: real):
          fp(j)`time < T + to AND
           fp(j + 1)`time > B + to AND UB = min(fp(1 + j)`time, T + to) - to
           IMPLIES LB >= 0);


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 867 0 876 999
body:
  % Subtype TCC generated (at line 217, column 39) for  UB
      % expected type  {x: posreal | x > LB}
  trk_bands_si_component_TCC6: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: subrange(0, N - 2),
            j: subrange(0, i), LB: real):
      LB = max(fp(j)`time, B + to) - to IMPLIES
       (FORALL (UB: real):
          fp(j)`time < T + to AND
           fp(j + 1)`time > B + to AND UB = min(fp(1 + j)`time, T + to) - to
           IMPLIES UB >= 0 AND UB > 0 AND UB > LB);


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 878 0 882 999
body:
  % Subtype TCC generated (at line 228, column 85) for  i + 1
      % expected type  below[N]
  trk_bands_si_i_relevant_TCC1: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: subrange(0, N - 2)):
      fp(i)`time < to + T IMPLIES i + 1 >= 0 AND i + 1 < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 884 0 888 999
body:
  % Subtype TCC generated (at line 238, column 83) for  i + 1
      % expected type  below[N]
  trk_bands_si_relevant_TCC1: OBLIGATION
    FORALL (fp: FlightPlan_nz[N], to: real, i: subrange(0, N - 2)):
      fp(0)`time < to + T IMPLIES i + 1 >= 0 AND i + 1 < N;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 890 0 892 999
body:
  % Subtype TCC generated (at line 250, column 43) for  N - 2
      % expected type  below[N - 1]
  trk_bands_si_equivalence_TCC1: OBLIGATION N - 2 >= 0 AND N - 2 < N - 1;


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 894 0 909 999
body:
  % Subtype TCC generated (at line 254, column 57) for  i
      % expected type  nat
  trk_bands_si_equivalence_TCC2: OBLIGATION
    FORALL (so: Vect3, to: real, vo: Nzv2_vect3,
            fpr: FlightPlanRelevant_nz(to),
            trkb:
              {fs: (trk_fseq?[gsmin, gsmax]) | increasing?[real, <=](fs)}):
      trkb = trk_bands_si(so, vo, to, fpr)(N - 2) IMPLIES
       (FORALL (trk:
                  [real ->
                     (LAMBDA (vo2):
                        trk_only?(vect2(vo))(vect2(vo2)) AND vo`z = vo2`z)]):
          trk = trk2v3(vo) IMPLIES
           (FORALL (x: real, y: real):
              y <= 2 * pi AND x <= y AND 0 <= x IMPLIES
               (FORALL (i: subrange(0, trkb`length - 1)): i >= 0)));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 911 0 922 999
body:
  % Subtype TCC generated (at line 303, column 55) for  i
      % expected type  nat
  gs_bands_si_equivalence_TCC1: OBLIGATION
    FORALL (so: Vect3, to: real, vo: Nzv2_vect3,
            fpr: FlightPlanRelevant_nz(to),
            gsb: {fs: (gs_fseq?[gsmin, gsmax]) | increasing?[real, <=](fs)}):
      gsb = gs_bands_si(so, vo, to, fpr)(N - 2) IMPLIES
       (FORALL (gs: [real -> Vect3]):
          gs = gs2v3(vo) IMPLIES
           (FORALL (x: real, y: real):
              y <= gsmax AND x <= y AND gsmin <= x IMPLIES
               (FORALL (i: subrange(0, gsb`length - 1)): i >= 0)));


decl_type: tcc
theory: bands_si
library: ACCoRD
signature: nil
location: 924 0 935 999
body:
  % Subtype TCC generated (at line 353, column 55) for  i
      % expected type  nat
  vs_bands_si_equivalence_TCC1: OBLIGATION
    FORALL (so: Vect3, to: real, vo: Nzv2_vect3,
            fpr: FlightPlanRelevant_nz(to),
            vsb: {fs: (vs_fseq?[vsmin, vsmax]) | increasing?[real, <=](fs)}):
      vsb = vs_bands_si(so, vo, to, fpr)(N - 2) IMPLIES
       (FORALL (vs: [real -> (vs_only?(vo))]):
          vs = vs2v3(vo) IMPLIES
           (FORALL (x: real, y: real):
              y <= vsmax AND x <= y AND vsmin <= x IMPLIES
               (FORALL (i: subrange(0, vsb`length - 1)): i >= 0)));


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 40 2 43 83
body:
    seg_allowable: LEMMA
      FORALL (fp:FlightPlan[N], fp2:FlightPlanRelevant2(fp), t1: FlightTimesLimited2(fp,fp2), j:below[N]):
        j = segment(fp)(t1) IMPLIES 
        j < N-1 AND min(fp(1 + j)`time - fp(j)`time, fp(0)`time - fp(j)`time + T) > 0


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 45 2 51 92
body:
    time_in_range: LEMMA
      FORALL (fp:FlightPlan[N], fp2:FlightPlanRelevant2(fp), t1: FlightTimesLimited2(fp,fp2)):
        LET 
          j = segment(fp)(t1)
        IN
        FORALL(t2: FlightTimesRelevant[D, H, 0, min(fp(1 + j)`time - fp(j)`time, fp(0)`time - fp(j)`time + T), M](fp(j)`time, fp2)):
          t2 <= fp(j+1)`time AND t2 <= fp(0)`time + T AND fp(0)`time <= t2 AND t1 = fp(j)`time


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 53 2 57 26
body:
    limited_bounds: LEMMA
      FORALL (fp:FlightPlan[N], fp2:FlightPlanRelevant2(fp), jt: FlightTimesLimited2(fp,fp2), j:below[N]):
        segment(fp)(jt) = j IMPLIES
          fp2(0)`time < jt + min(fp(j+1)`time-fp(j)`time, fp(0)`time - fp(j)`time + T) AND
          jt < fp2(M-1)`time


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 59 2 62 88
body:
    upper_seg_bounds: LEMMA
      FORALL (fp:FlightPlan[N], fp2:FlightPlanRelevant2(fp), jt: FlightTimesLimited2(fp,fp2), j:below[N]):
        segment(fp)(jt) = j IMPLIES
        min(fp(1 + j)`time - fp(j)`time, fp(0)`time - fp(j)`time + T) + jt <= fp(j+1)`time


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 66 2 77 43
body:
    cd3d_ii_rew: LEMMA
      FORALL (fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)):
      conflict_3D_ii?(fp,fp2) IFF
      EXISTS (tt:FlightTimesLimited2(fp,fp2)): 
        LET
          j = segment(fp)(tt),
          relT = T - (fp(j)`time - fp(0)`time),           % remaining overall lookahead time
          t = min(fp(j+1)`time - fp(j)`time, relT),       % relative end time of ownship segment
          so = fp(j)`position,
          vo = velocity[N](fp)(j)
        IN
        conflict_3D?[D,H,0,t,M](so,tt,vo,fp2)


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 176 0 196 999
body:
  cd3d_ii_ind?_weak_induction: AXIOM
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            P: [below[N - 1] -> bool]):
      (FORALL (j: below[N - 1]):
         IF T - (fp(j)`time - fp(0)`time) > 0 AND
             (fp2(0)`time <
               min(fp(j + 1)`time,
                   fp(j)`time + (T - (fp(j)`time - fp(0)`time)))
               AND fp2(M - 1)`time > fp(j)`time)
           THEN cd3d_si?
                    [D, H, 0,
                     min(fp(1 + j)`time - fp(j)`time,
                         fp(0)`time - fp(j)`time + T),
                     M]
                    (fp(j)`position, velocity[N](fp)(j), fp(j)`time, fp2)
         ELSE FALSE
         ENDIF
          OR (j > 0 AND P(j - 1))
          IMPLIES P(j))
       IMPLIES
       (FORALL (j: below[N - 1]): cd3d_ii_ind?(fp, fp2)(j) IMPLIES P(j));


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 198 0 218 999
body:
  cd3d_ii_ind?_induction: AXIOM
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            P: [below[N - 1] -> bool]):
      (FORALL (j: below[N - 1]):
         IF T - (fp(j)`time - fp(0)`time) > 0 AND
             (fp2(0)`time <
               min(fp(j + 1)`time,
                   fp(j)`time + (T - (fp(j)`time - fp(0)`time)))
               AND fp2(M - 1)`time > fp(j)`time)
           THEN cd3d_si?
                    [D, H, 0,
                     min(fp(1 + j)`time - fp(j)`time,
                         fp(0)`time - fp(j)`time + T),
                     M]
                    (fp(j)`position, velocity[N](fp)(j), fp(j)`time, fp2)
         ELSE FALSE
         ENDIF
          OR (j > 0 AND cd3d_ii_ind?(fp, fp2)(j - 1) AND P(j - 1))
          IMPLIES P(j))
       IMPLIES
       (FORALL (j: below[N - 1]): cd3d_ii_ind?(fp, fp2)(j) IMPLIES P(j));


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 98 2 102 38
body:
    some_cd3d_ii: LEMMA
      FORALL (fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp), i: below[N-1]):
      cd3d_ii_ind?(fp, fp2)(i) IFF 
      EXISTS (j: below[N-1]) :
      j <= i AND cd3d_ii_ind?(fp,fp2)(j)


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 109 2 125 18
body:
    cd3d_ii_ind_correct: LEMMA 
      FORALL (fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)):
             (FORALL (i: below[N-1]): cd3d_ii_ind?(fp,fp2)(i) IMPLIES
             EXISTS (j: below[N-1]): 
             LET
               relT = T - (fp(j)`time - fp(0)`time),      % remaining overall lookahead time
               t = min(fp(j+1)`time - fp(j)`time, relT),  % relative end time of ownship segment
               so = fp(j)`position,
               to = fp(j)`time,
               vo = velocity[N](fp)(j)
             IN
             (j<=i AND 
             IF relT > 0 AND fp2(0)`time < min(fp(j+1)`time, fp(j)`time+relT) AND fp2(M-1)`time > fp(j)`time THEN
               conflict_3D?[D,H,0,t,M](so,to,vo,fp2)
             ELSE
               FALSE
             ENDIF))


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 129 2 147 32
body:
    cd3d_ii_ind_complete: LEMMA
      FORALL (fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)):
             (FORALL (i: below[N-1]):
               EXISTS (j: below[N-1]): 
               LET
                 relT = T - (fp(j)`time - fp(0)`time),    % remaining overall lookahead time
                 t = min(fp(j+1)`time - fp(j)`time, relT),        % relative end time of ownship segment
                 so = fp(j)`position,
                 to = fp(j)`time,
                 vo = velocity[N](fp)(j)
               IN
               (j<=i AND 
                 IF relT > 0 AND fp2(0)`time < min(fp(j+1)`time, fp(j)`time+relT) AND fp2(M-1)`time > fp(j)`time THEN
                   conflict_3D?[D,H,0,t,M](so,to,vo,fp2)
                 ELSE
                   FALSE
                 ENDIF)
               IMPLIES  
                 cd3d_ii_ind?(fp,fp2)(i))


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 150 2 157 38
body:
    cd3d_si_complete_parameters: LEMMA
      FORALL (so,vo:Vect3,to:real,t1: posreal, fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)):
             LET
               t2=t1
             IN
             fp2(0)`time < t2 + to AND to < fp2(M - 1)`time AND
             conflict_3D?[D,H,0,t1,M](so,to,vo,fp2) IMPLIES
             cd3d_si?[D,H,0,t2,M](so,vo,to,fp2)


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 160 2 163 27
body:
    cd3d_ii_correct: THEOREM
      FORALL (fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)):
             cd3d_ii?(fp,fp2) IMPLIES
             conflict_3D_ii?(fp,fp2)


decl_type: formula
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 166 2 169 20
body:
    cd3d_ii_complete: THEOREM
      FORALL (fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)):
             conflict_3D_ii?(fp,fp2) IMPLIES
             cd3d_ii?(fp,fp2)


decl_type: type
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 16 2 17 129
body:
    FlightPlanRelevant2(fp): 
          TYPE+ = {flp: FlightPlan[M] | flp(0)`time < fp(N-1)`time AND fp(0)`time < flp(M-1)`time AND flp(0)`time < fp(0)`time + T}


decl_type: type
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 21 2 23 68
body:
    FlightTimesRelevant2(fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)): 
          TYPE = {aa: real | fp(0)`time <= aa AND aa < fp(N-1)`time AND aa < fp(0)`time + T AND
                             fp2(0)`time <= aa AND aa < fp2(M-1)`time}


decl_type: type
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 26 2 29 132
body:
    FlightTimesLimited2(fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)):
          TYPE = {aa: FlightTimes[N](fp) | 
                  EXISTS(j:below[N-1]): aa = fp(j)`time AND fp(j+1)`time > fp2(0)`time AND aa < fp(0)`time + T AND aa < fp(N-1)`time 
                                                                                                               AND aa < fp2(M-1)`time}


decl_type: function
theory: cd3d_ii
library: ACCoRD
signature: [[fp: FlightPlan[N], FlightPlanRelevant2(fp)] -> bool]
location: 33 2 36 76
body:
    conflict_3D_ii?(fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp)): bool =
      EXISTS (tt: FlightTimesRelevant2(fp,fp2)):
        horizontal_los?[D](location_at[N](fp)(tt) - location_at[M](fp2)(tt)) AND
        vertical_los?[H](location_at[N](fp)(tt)`z - location_at[M](fp2)(tt)`z)


decl_type: function
theory: cd3d_ii
library: ACCoRD
signature:
  [[fp: FlightPlan[N], FlightPlanRelevant2(fp)] ->
  [below[N - 1] -> bool]]

location: 81 2 95 39
body:
    cd3d_ii_ind?(fp:FlightPlan[N],fp2:FlightPlanRelevant2(fp))(j: below[N-1]): INDUCTIVE bool =
      LET
        relT = T - (fp(j)`time - fp(0)`time),     % remaining overall lookahead time
        t = min(fp(j+1)`time - fp(j)`time, relT), % relative end time of ownship segment
        so = fp(j)`position,
        to = fp(j)`time,
        vo = velocity[N](fp)(j)
      IN
      IF relT > 0 AND (fp2(0)`time < min(fp(j+1)`time, fp(j)`time+relT) AND fp2(M-1)`time > fp(j)`time) THEN 
        cd3d_si?[D,H,0,t,M](so,vo,to,fp2)
      ELSE 
        FALSE 
      ENDIF 
      OR 
      (j>0 AND cd3d_ii_ind?(fp,fp2)(j-1))


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 220 0 222 999
body:
  % Subtype TCC generated (at line 17, column 42) for  0
      % expected type  below[M]
  FlightPlanRelevant2_TCC1: OBLIGATION 0 < M;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 224 0 226 999
body:
  % Subtype TCC generated (at line 17, column 55) for  N - 1
      % expected type  below[N]
  FlightPlanRelevant2_TCC2: OBLIGATION N - 1 >= 0 AND N - 1 < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 228 0 232 999
body:
  % Subtype TCC generated (at line 17, column 72) for  0
      % expected type  below[N]
  FlightPlanRelevant2_TCC3: OBLIGATION
    FORALL (fp: FlightPlan[N], flp: FlightPlan[M]):
      flp(0)`time < fp(N - 1)`time IMPLIES 0 < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 234 0 238 999
body:
  % Subtype TCC generated (at line 17, column 86) for  M - 1
      % expected type  below[M]
  FlightPlanRelevant2_TCC4: OBLIGATION
    FORALL (fp: FlightPlan[N], flp: FlightPlan[M]):
      flp(0)`time < fp(N - 1)`time IMPLIES M - 1 >= 0 AND M - 1 < M;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 240 0 243 999
body:
  % Subtype TCC generated (at line 15, column 71) for  i - 1
      % expected type  below[M]
  FlightPlanRelevant2_TCC5: OBLIGATION
    FORALL (i: below[M]): i - 1 >= 0 IMPLIES i - 1 < M;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 245 0 258 999
body:
  % Existence TCC generated (at line 16, column 2) for
      % FlightPlanRelevant2(fp): TYPE+ =
      %       {flp: FlightPlan[M] |
      %                flp(0)`time < fp(N - 1)`time AND
      %                 fp(0)`time < flp(M - 1)`time AND
      %                  flp(0)`time < fp(0)`time + T}
  FlightPlanRelevant2_TCC6: OBLIGATION
    FORALL (fp: FlightPlan[N]):
      EXISTS (x:
                {flp: FlightPlan[M] |
                         flp(0)`time < fp(N - 1)`time AND
                          fp(0)`time < flp(M - 1)`time AND
                           flp(0)`time < fp(0)`time + T}):
        TRUE;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 260 0 262 999
body:
  % Subtype TCC generated (at line 22, column 30) for  0
      % expected type  below[N]
  FlightTimesRelevant2_TCC1: OBLIGATION 0 < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 264 0 270 999
body:
  % Subtype TCC generated (at line 23, column 58) for  M - 1
      % expected type  below[M]
  FlightTimesRelevant2_TCC2: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp), aa: real):
      fp2(0)`time <= aa AND
       aa < fp(0)`time + T AND aa < fp(N - 1)`time AND fp(0)`time <= aa
       IMPLIES M - 1 >= 0 AND M - 1 < M;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 272 0 274 999
body:
  % Subtype TCC generated (at line 28, column 31) for  N - 1
      % expected type  nat
  FlightTimesLimited2_TCC1: OBLIGATION N - 1 >= 0;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 276 0 278 999
body:
  % Subtype TCC generated (at line 28, column 46) for  j
      % expected type  below[N]
  FlightTimesLimited2_TCC2: OBLIGATION FORALL (j: below[N - 1]): j < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 280 0 284 999
body:
  % Subtype TCC generated (at line 28, column 61) for  j + 1
      % expected type  below[N]
  FlightTimesLimited2_TCC3: OBLIGATION
    FORALL (fp: FlightPlan[N], aa: FlightTimes[N](fp), j: below[N - 1]):
      aa = fp(j)`time IMPLIES j + 1 < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 286 0 294 999
body:
  % Subtype TCC generated (at line 29, column 122) for  M - 1
      % expected type  below[M]
  FlightTimesLimited2_TCC4: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            aa: FlightTimes[N](fp), j: below[N - 1]):
      aa < fp(N - 1)`time AND
       aa < fp(0)`time + T AND
        fp(j + 1)`time > fp2(0)`time AND aa = fp(j)`time
       IMPLIES M - 1 >= 0 AND M - 1 < M;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 296 0 301 999
body:
  % Subtype TCC generated (at line 35, column 44) for  tt
      % expected type  FlightTimes[N](fp)
  conflict_3D_ii?_TCC1: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            tt: FlightTimesRelevant2(fp, fp2)):
      start_time[N](fp) <= tt AND tt <= end_time[N](fp);


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 303 0 308 999
body:
  % Subtype TCC generated (at line 35, column 70) for  tt
      % expected type  FlightTimes[M](fp2)
  conflict_3D_ii?_TCC2: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            tt: FlightTimesRelevant2(fp, fp2)):
      start_time[M](fp2) <= tt AND tt <= end_time[M](fp2);


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 310 0 315 999
body:
  % Subtype TCC generated (at line 43, column 25) for  1 + j
      % expected type  below[N]
  seg_allowable_TCC1: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            t1: FlightTimesLimited2(fp, fp2), j: below[N]):
      j < N - 1 AND j = segment(fp)(t1) IMPLIES 1 + j < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 317 0 322 999
body:
  % Subtype TCC generated (at line 50, column 53) for  1 + j
      % expected type  below[N]
  time_in_range_TCC1: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            t1: FlightTimesLimited2(fp, fp2), j: below[N]):
      j = segment(fp)(t1) IMPLIES 1 + j < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 324 0 332 999
body:
  % Subtype TCC generated (at line 50, column 46) for
      % min(fp(1 + j)`time - fp(j)`time, fp(0)`time - fp(j)`time + T)
      % expected type  {AB: posreal | TRUE}
  time_in_range_TCC2: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            t1: FlightTimesLimited2(fp, fp2), j: below[N]):
      j = segment(fp)(t1) IMPLIES
       min(fp(1 + j)`time - fp(j)`time, fp(0)`time - fp(j)`time + T) >= 0 AND
        min(fp(1 + j)`time - fp(j)`time, fp(0)`time - fp(j)`time + T) > 0;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 334 0 346 999
body:
  % Subtype TCC generated (at line 51, column 17) for  j + 1
      % expected type  below[N]
  time_in_range_TCC3: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            t1: FlightTimesLimited2(fp, fp2), j: below[N]):
      j = segment(fp)(t1) IMPLIES
       (FORALL (t2:
                  FlightTimesRelevant
                      [D, H, 0,
                       min(fp(1 + j)`time - fp(j)`time,
                           fp(0)`time - fp(j)`time + T),
                       M](fp(j)`time, fp2)):
          j + 1 < N);


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 348 0 353 999
body:
  % Subtype TCC generated (at line 56, column 34) for  j + 1
      % expected type  below[N]
  limited_bounds_TCC1: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            jt: FlightTimesLimited2(fp, fp2), j: below[N]):
      segment(fp)(jt) = j IMPLIES j + 1 < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 355 0 363 999
body:
  % Subtype TCC generated (at line 57, column 17) for  M - 1
      % expected type  below[M]
  limited_bounds_TCC2: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            jt: FlightTimesLimited2(fp, fp2), j: below[N]):
      fp2(0)`time <
       jt + min(fp(j + 1)`time - fp(j)`time, fp(0)`time - fp(j)`time + T)
       AND segment(fp)(jt) = j
       IMPLIES M - 1 >= 0 AND M - 1 < M;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 365 0 370 999
body:
  % Subtype TCC generated (at line 62, column 13) for  1 + j
      % expected type  below[N]
  upper_seg_bounds_TCC1: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            jt: FlightTimesLimited2(fp, fp2), j: below[N]):
      segment(fp)(jt) = j IMPLIES 1 + j < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 372 0 379 999
body:
  % Subtype TCC generated (at line 73, column 12) for  j + 1
      % expected type  below[N]
  cd3d_ii_rew_TCC1: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            tt: FlightTimesLimited2(fp, fp2), j: below[N]):
      j = segment(fp)(tt) IMPLIES
       (FORALL (relT: real):
          relT = T - (fp(j)`time - fp(0)`time) IMPLIES j + 1 < N);


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 381 0 394 999
body:
  % Subtype TCC generated (at line 75, column 28) for  j
      % expected type  below[N - 1]
  cd3d_ii_rew_TCC2: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            tt: FlightTimesLimited2(fp, fp2), j: below[N]):
      j = segment(fp)(tt) IMPLIES
       (FORALL (relT: real):
          relT = T - (fp(j)`time - fp(0)`time) IMPLIES
           (FORALL (t:
                      {p: real |
                               p <= fp(1 + j)`time - fp(j)`time AND
                                p <= relT}):
              t = min(fp(j + 1)`time - fp(j)`time, relT) IMPLIES
               (FORALL (so: Vect3): so = fp(j)`position IMPLIES j < N - 1)));


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 396 0 412 999
body:
  % Subtype TCC generated (at line 77, column 25) for  t
      % expected type  {AB: posreal | TRUE}
  cd3d_ii_rew_TCC3: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp),
            tt: FlightTimesLimited2(fp, fp2), j: below[N]):
      j = segment(fp)(tt) IMPLIES
       (FORALL (relT: real):
          relT = T - (fp(j)`time - fp(0)`time) IMPLIES
           (FORALL (t:
                      {p: real |
                               p <= fp(1 + j)`time - fp(j)`time AND
                                p <= relT}):
              t = min(fp(j + 1)`time - fp(j)`time, relT) IMPLIES
               (FORALL (so: Vect3):
                  so = fp(j)`position IMPLIES
                   (FORALL (vo: Vect3):
                      vo = velocity[N](fp)(j) IMPLIES t >= 0 AND t > 0))));


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 414 0 418 999
body:
  % Subtype TCC generated (at line 84, column 17) for  j + 1
      % expected type  below[N]
  cd3d_ii_ind?_TCC1: OBLIGATION
    FORALL (fp: FlightPlan[N], j: below[N - 1], relT: real):
      relT = T - (fp(j)`time - fp(0)`time) IMPLIES j + 1 < N;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 420 0 437 999
body:
  % Subtype TCC generated (at line 89, column 78) for  M - 1
      % expected type  below[M]
  cd3d_ii_ind?_TCC2: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp), j: below[N - 1],
            relT: real):
      relT = T - (fp(j)`time - fp(0)`time) IMPLIES
       (FORALL (t:
                  {p: real |
                           p <= fp(1 + j)`time - fp(j)`time AND p <= relT}):
          t = min(fp(j + 1)`time - fp(j)`time, relT) IMPLIES
           (FORALL (so: Vect3):
              so = fp(j)`position IMPLIES
               (FORALL (to: real):
                  to = fp(j)`time IMPLIES
                   (FORALL (vo: Vect3):
                      fp2(0)`time < min(fp(j + 1)`time, fp(j)`time + relT)
                       AND relT > 0 AND vo = velocity[N](fp)(j)
                       IMPLIES M - 1 >= 0 AND M - 1 < M))));


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 439 0 460 999
body:
  % Subtype TCC generated (at line 90, column 35) for  fp2
      % expected type  FlightPlanRelevant[D, H, 0, t, M](to)
  cd3d_ii_ind?_TCC3: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp), j: below[N - 1],
            relT: real):
      relT = T - (fp(j)`time - fp(0)`time) IMPLIES
       (FORALL (t:
                  {p: real |
                           p <= fp(1 + j)`time - fp(j)`time AND p <= relT}):
          t = min(fp(j + 1)`time - fp(j)`time, relT) IMPLIES
           (FORALL (so: Vect3):
              so = fp(j)`position IMPLIES
               (FORALL (to: real):
                  to = fp(j)`time IMPLIES
                   (FORALL (vo: Vect3):
                      relT > 0 AND
                       fp2(0)`time < min(fp(j + 1)`time, fp(j)`time + relT)
                        AND
                        fp2(M - 1)`time > fp(j)`time AND
                         vo = velocity[N](fp)(j)
                       IMPLIES
                       fp2(0)`time < t + to AND to < fp2(M - 1)`time))));


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 462 0 482 999
body:
  % Subtype TCC generated (at line 90, column 21) for  t
      % expected type  {AB: posreal | TRUE}
  cd3d_ii_ind?_TCC4: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp), j: below[N - 1],
            relT: real):
      relT = T - (fp(j)`time - fp(0)`time) IMPLIES
       (FORALL (t:
                  {p: real |
                           p <= fp(1 + j)`time - fp(j)`time AND p <= relT}):
          t = min(fp(j + 1)`time - fp(j)`time, relT) IMPLIES
           (FORALL (so: Vect3):
              so = fp(j)`position IMPLIES
               (FORALL (to: real):
                  to = fp(j)`time IMPLIES
                   (FORALL (vo: Vect3):
                      relT > 0 AND
                       fp2(0)`time < min(fp(j + 1)`time, fp(j)`time + relT)
                        AND
                        fp2(M - 1)`time > fp(j)`time AND
                         vo = velocity[N](fp)(j)
                       IMPLIES t >= 0 AND t > 0))));


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 484 0 506 999
body:
  % Subtype TCC generated (at line 95, column 34) for  j - 1
      % expected type  below[N - 1]
  cd3d_ii_ind?_TCC5: OBLIGATION
    FORALL (fp: FlightPlan[N], fp2: FlightPlanRelevant2(fp), j: below[N - 1],
            relT: real):
      relT = T - (fp(j)`time - fp(0)`time) IMPLIES
       (FORALL (t:
                  {p: real |
                           p <= fp(1 + j)`time - fp(j)`time AND p <= relT}):
          t = min(fp(j + 1)`time - fp(j)`time, relT) IMPLIES
           (FORALL (so: Vect3):
              so = fp(j)`position IMPLIES
               (FORALL (to: real):
                  to = fp(j)`time IMPLIES
                   (FORALL (vo: Vect3):
                      j > 0 AND
                       NOT ((relT > 0 AND
                              (fp2(0)`time <
                                min(fp(j + 1)`time, fp(j)`time + relT)
                                AND fp2(M - 1)`time > fp(j)`time))
                             AND cd3d_si?[D, H, 0, t, M](so, vo, to, fp2))
                        AND vo = velocity[N](fp)(j)
                       IMPLIES j - 1 >= 0 AND j - 1 < N - 1))));


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 508 0 510 999
body:
  % Subtype TCC generated (at line 105, column 87) for  N - 2
      % expected type  below[N - 1]
  cd3d_ii?_TCC1: OBLIGATION N - 2 >= 0 AND N - 2 < N - 1;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 512 0 517 999
body:
  % Subtype TCC generated (at line 155, column 46) for  M - 1
      % expected type  below[M]
  cd3d_si_complete_parameters_TCC1: OBLIGATION
    FORALL (to: real, t1: posreal, fp: FlightPlan[N],
            fp2: FlightPlanRelevant2(fp), t2: posreal):
      fp2(0)`time < t2 + to AND t2 = t1 IMPLIES M - 1 >= 0 AND M - 1 < M;


decl_type: tcc
theory: cd3d_ii
library: ACCoRD
signature: nil
location: 519 0 527 999
body:
  % Subtype TCC generated (at line 157, column 34) for  fp2
      % expected type  FlightPlanRelevant[D, H, 0, t2, M](to)
  cd3d_si_complete_parameters_TCC2: OBLIGATION
    FORALL (so, vo: Vect3, to: real, t1: posreal, fp: FlightPlan[N],
            fp2: FlightPlanRelevant2(fp), t2: posreal):
      fp2(0)`time < t2 + to AND
       to < fp2(M - 1)`time AND
        conflict_3D?[D, H, 0, t1, M](so, to, vo, fp2) AND t2 = t1
       IMPLIES fp2(0)`time < t2 + to AND to < fp2(M - 1)`time;


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 36 2 42 47
body:
    repulsive_simple: LEMMA
      repulsive?(s,v)(nv) IMPLIES
      (s*v<0 AND tca(s,v)>0 AND
      (FORALL (t:nnreal): norm(s+t*nv)>=norm(s+tca(s,v)*v)))
      OR
      (s*v>=0 AND
      (FORALL (t:nnreal): norm(s+t*nv)>=norm(s))) 


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 44 2 47 23
body:
    repulsive_transitive: LEMMA
      repulsive?(s,v)(nv) AND
      repulsive?(s,nv)(nw) IMPLIES
      repulsive?(s,v)(nw)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 49 2 50 80
body:
    not_repulsive_sum_closed: LEMMA
      sum_closed_2D?(LAMBDA (s,v): LAMBDA (nv): s*v<0 AND NOT repulsive?(s,v)(nv))


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 64 2 66 38
body:
    repulsive_criteria_scal_s: LEMMA
      repulsive_criteria(s,v,eps)(nv) IFF
      repulsive_criteria(cc*s,v,eps)(nv)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 68 2 73 44
body:
    repulsive_criteria_scal_nv: LEMMA
      (s*v<0 AND (repulsive_criteria(s,v,eps)(cc*nv) IFF
      repulsive_criteria(s,v,eps)(nv)))
      OR
      (s*v>=0 AND (repulsive_criteria(s,v,eps)(cc*nv) IFF
      repulsive_criteria(s,(1/cc)*v,eps)(nv)))


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 75 2 80 34
body:
    wedge_containment: LEMMA
      FORALL (e,f,g,h:Nz_vect2):
      (e*h>=0 AND f*h>0 AND g*h>0) AND
      (NOT (det(e,g)>=0 AND det(f,g)>0)) AND
      (NOT (det(e,g)<=0 AND det(f,g)<0)) AND
      e*v>=0 AND f*v>0 IMPLIES g*v>0


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 82 2 85 35
body:
    repulsive_criteria_transitive: LEMMA
      repulsive_criteria(s,v,eps)(nv) AND
      repulsive_criteria(s,nv,eps)(nw) IMPLIES
      repulsive_criteria(s,v,eps)(nw)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 87 2 91 50
body:
    repulsive_criteria_transitive_odd1: LEMMA
      s*v<0 AND (s+pt*nv)*nv<0 AND
      repulsive_criteria(s,v,eps)(nv) AND
      repulsive_criteria(s+pt*nv,nv,eps)(nw) IMPLIES
      repulsive_criteria(s,v,eps)((s+pt*nv+px*nw)-s)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 93 2 105 68
body:
    rep_crit_odd2_ax: LEMMA
      FORALL(sx,sy,vx,vy,nvx,nvy,nwx,nwy:real,pt,px:posreal,eps:Sign) :
        px>0 AND pt>0
        AND nvx*sx+nvy*sy+nvx*nvx*pt+nvy*nvy*pt>=0
        AND sx*vx+sy*vy<0 AND sx*vy*eps-sy*vx*eps<=0
        AND nvy*sx*eps-nvx*sy*eps<0
        AND nvx*vy*eps-nvy*vx*eps<0
        AND nvy*sx*eps-nvx*sy*eps<=0
        AND -1*(nwx*sy*eps)-nvy*nwx*eps*pt+nwy*sx*eps+nvx*nwy*eps*pt<0
        AND nwx*sx+nwy*sy+nvx*nwx*pt+nvy*nwy*pt>nvx*sx+nvy*sy+nvx*nvx*pt+nvy*nvy*pt
        AND nwx*vy*eps-nwy*vx*eps<0
        IMPLIES
        -1*(nvx*sy*eps*pt)-nwx*sy*eps*px+nvy*sx*eps*pt+nwy*sx*eps*px<0


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 107 2 112 50
body:
    repulsive_criteria_transitive_odd2: LEMMA
      s*v<0 AND (s+pt*nv)*nv>=0  AND
      repulsive_criteria(s,v,eps)(nv) AND
      repulsive_criteria(s+pt*nv,nv,eps)(nw) AND eps*det(nw,v) < 0
      IMPLIES
      repulsive_criteria(s,v,eps)((s+pt*nv+px*nw)-s)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 114 2 118 50
body:
    repulsive_criteria_transitive_odd3: LEMMA
      s*v>=0 AND pt>=1 AND
      repulsive_criteria(s,v,eps)(nv) AND
      repulsive_criteria(s+pt*nv,nv,eps)(nw) IMPLIES
      repulsive_criteria(s,v,eps)((s+pt*nv+px*nw)-s)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 120 2 123 38
body:
    repulsive_criteria_sum_closed: LEMMA
      repulsive_criteria(s,v,eps)(nv) AND
      repulsive_criteria(s,v,eps)(nw) IMPLIES
      repulsive_criteria(s,v,eps)(nv+nw)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 125 2 129 37
body:
    repulsive_criteria_indep_of_length: LEMMA
      s*v < 0 IMPLIES
      FORALL (c:posreal):
      repulsive_criteria(s,v,eps)(nv) IFF
      repulsive_criteria(s,v,eps)(c*nv)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 131 2 134 23
body:
    repulsive_criteria_repulsive: LEMMA
      repulsive_criteria(s,v,eps)(nv)
      IMPLIES
      repulsive?(s,v)(nv)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 136 2 141 35
body:
    repulsive_criteria_repulsive2: LEMMA
      repulsive?(s,v)(nv)
      AND eps * det(s, v) <= 0 AND eps * det(s, nv) < 0 AND nv /= zero
      AND (s*v>=0 IMPLIES eps*det(nv,v)<=0)
      IMPLIES
      repulsive_criteria(s,v,eps)(nv)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 143 2 145 38
body:
    repulsive_criteria_symmetric: LEMMA
      repulsive_criteria(s,v,eps)(nv) IFF
      repulsive_criteria(-s,-v,eps)(-nv)


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 147 2 151 32
body:
    repulsive_criteria_coordinately_repulsive: LEMMA
      repulsive_criteria(s,vo-vi,eps)(nvo-vi) AND
      repulsive_criteria(-s,vi-vo,eps)(nvi-vo)
      IMPLIES
      repulsive?(s,vo-vi)(nvo-nvi) 


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 153 2 157 32
body:
    foo: LEMMA
      repulsive_criteria(s,vo-vi,eps)(nvo-vi) AND
      repulsive_criteria(-s,vi-vo,eps)(nvi-vo)
      IMPLIES
      repulsive?(s,vo-vi)(nvo-nvi) 


decl_type: formula
theory: repulsive
library: ACCoRD
signature: nil
location: 159 2 167 61
body:
    repulsive_increases_dist: LEMMA
      repulsive?(s,v)(nv) IMPLIES
      (s*v<0 AND horizontal_tca(s,v)>0 AND v/=zero AND
        FORALL (nnt:nnreal): norm(s+nnt*nv)>norm(s+horizontal_tca(s,v)*v))
      OR
      (s*v>=0 AND v/=zero AND horizontal_tca(s,v)<=0 AND
        FORALL (pt:posreal): norm(s+pt*nv)>norm(s))
      OR
      (v=zero AND FORALL (nnt:nnreal): norm(s+nnt*nv)>=norm(s))


decl_type: function
theory: repulsive
library: ACCoRD
signature: [[Vect2, Vect2] -> [Vect2 -> bool]]
location: 27 2 34 75
body:
    repulsive?(s,v)(nv) : bool =
     LET tau1 = tca(s,v),
         tau2 = tca(s,nv) IN
       (s*v < 0 AND
       (tau2 <= 0 OR
       norm(s+tau1*v) < norm(s+tau2*nv)))
       OR
       (s*v>=0 AND (v = zero IMPLIES s*nv>=0) AND (v/=zero IMPLIES s*nv>s*v))


decl_type: function
theory: repulsive
library: ACCoRD
signature: [[Vect2, Vect2, Sign] -> [Vect2 -> bool]]
location: 52 2 62 29
body:
    repulsive_criteria(s,v,eps)(nv): bool =
      s  /= zero AND
      nv /= zero AND
      eps*det(s,v) <= 0 AND
      eps*det(s,nv) < 0 AND
      ((s*v < 0 AND
      eps*det(nv,v) < 0)
      OR
      (s*v>=0 AND (v = zero IMPLIES s*nv>=0) 
              AND (v/= zero IMPLIES s*nv> s*v)
              AND eps*det(nv,v) <= 0))


decl_type: tcc
theory: repulsive
library: ACCoRD
signature: nil
location: 174 0 176 999
body:
  % Subtype TCC generated (at line 24, column 26) for  v
      % expected type  Nz_vect2
  tca_TCC1: OBLIGATION FORALL (v: Vect2): NOT v = zero IMPLIES v /= zero;


decl_type: tcc
theory: repulsive
library: ACCoRD
signature: nil
location: 178 0 182 999
body:
  % Subtype TCC generated (at line 161, column 32) for  v
      % expected type  Nz_vect2
  repulsive_increases_dist_TCC1: OBLIGATION
    FORALL (nv, s, v: Vect2):
      repulsive?(s, v)(nv) AND s * v < 0 IMPLIES v /= zero;


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 35 2 49 54
body:
    angle_from_to_test: LEMMA
      angle_from_to(2*pi,pi) = -pi AND
      angle_from_to(pi,2*pi) = -pi AND
      angle_from_to(pi/6,11*pi/6) = -pi/3 AND
      angle_from_to(pi/2,5*pi/3) = -5*pi/6 AND
      angle_from_to(pi/4,7*pi/6) = 11*pi/12 AND
      angle_from_to(7*pi/6,pi/4) = -11*pi/12 AND
      angle_from_to(0,2*pi) = 0 AND
      angle_from_to(2*pi,0) = 0 AND
      angle_from_to(3*pi/4,23*pi/12) = -5*pi/6 AND
      angle_from_to(23*pi/12,3*pi/4) = 5*pi/6 AND
      angle_from_to(17*pi/12,pi/6) = 3*pi/4 AND
      angle_from_to(pi/6,17*pi/12) = -3*pi/4 AND
      angle_from_to(34*pi + pi/4,-24*pi+7*pi/6) = 11*pi/12 AND
      angle_from_to(34*pi+17*pi/12,-18*pi+pi/6) = 3*pi/4


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 54 2 59 91
body:
    chirel_star_equiv: LEMMA 
      abs(track(v) - (track(-s) - eps*asin(D/norm(s)))) < pi AND 
      f >= 0 AND 
      f<=1 
      IMPLIES
      chirel_star(s,v,f,eps) = to2pi(track(v)+f*(track(-s) - eps*asin(D/norm(s)) - track(v)))


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 61 2 72 37
body:
    chirel_star_test: LEMMA
       D = 5 AND s = (-10/sqrt(3),0) AND
       vo = (2,0) AND
       vi = (1,0) IMPLIES
       track(vo) = pi/2 AND track(vi) = pi/2
       AND horizontal_conflict?(s,vo-vi) AND
       track(vo-vi) = pi/2 AND
       track(-s) = pi/2 AND
       norm(s) = 10/sqrt(3) AND
       chirel_star(s,vo-vi,1/2,-1) = 2*pi/3 AND
       chirel_star(s,vo-vi,1,-1) = 5*pi/6 AND
       chirel_star(s,vo-vi,0,-1) = pi/2


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 78 2 79 26
body:
    chirel_star_f_entry_scaf: LEMMA abs(phi)<=pi AND cos(r)<0 AND cos(r-phi)<0 AND f>=0 AND f<=1
      IMPLIES cos(r-f*phi)<0


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 103 2 105 79
body:
    sin_track_minus: LEMMA
      vo-vi /= zero IMPLIES
      norm(vo)*sin(track(vo-vi)-track(vo)) = norm(vi)*sin(track(vo-vi)-track(vi))


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 107 2 112 112
body:
    chi_hc_sin_equivalence_2: LEMMA
      LET ch = chi_hc(f,eps,irt)(s,vo,vi),
          nvo = trkgs2vect(ch`1,norm(vo))
      IN
      ch`2 IMPLIES
      norm(vi)*sin(chirel_star(s,vo-vi,f,eps) - track(vi)) = norm(vo)*sin(chirel_star(s,vo-vi,f,eps) - track(nvo))


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 114 2 115 114
body:
    chi_hc_track_eq: LEMMA
      FORALL (v,w:Nz_vect2): v`y/=0 AND w`y/=0 AND v`x/v`y = w`x/w`y AND s*v<0 AND s*w<0 IMPLIES track(v) = track(w)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 117 2 119 94
body:
    chi_hc_1_chirel: LEMMA
      chi_hc(1,eps,irt)(s,vo,vi)`2 IMPLIES
      track(trkgs2vect(chi_hc(1,eps,irt)(s,vo,vi)`1,norm(vo)) - vi) = chirel_star(s,vo-vi,1,eps)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 121 2 124 94
body:
    chi_hc_f_chirel: LEMMA
      s*(vo-vi)<0 AND
      chi_hc(f,eps,irt)(s,vo,vi)`2 AND f < 1 IMPLIES
      track(trkgs2vect(chi_hc(f,eps,irt)(s,vo,vi)`1,norm(vo)) - vi) = chirel_star(s,vo-vi,f,eps)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 126 2 131 45
body:
    chi_hc_0_id: LEMMA 
        chi_hc(0,eps,-1)(s,vo,vi)`2 AND
        -pi/2 < track(vo-vi)-track(vo) AND
        track(vo-vi)-track(vo) < pi/2
      IMPLIES 
        chi_hc(0,eps,-1)(s,vo,vi)`1 = track(vo)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 133 2 142 34
body:
    chi_hc_0_id_rel: LEMMA
        chi_hc(0,eps,irt)(s,vo,vi)`2 AND
        -pi/2 < track(vo-vi)-track(vo) AND
        track(vo-vi)-track(vo) < pi/2 AND
        s*(vo-vi) < 0
      IMPLIES 
      LET
        nvo = trkgs2vect(chi_hc(0,eps,irt)(s,vo,vi)`1,norm(vo))
      IN
        track(nvo-vi) = track(vo-vi)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 150 2 155 32
body:
    kb_0_id : LEMMA
        chi_hc(0,eps,-1)(s,vo,vi)`2 AND
        -pi/2 < track(vo-vi)-track(vo) AND
        track(vo-vi)-track(vo) < pi/2 
      IMPLIES 
        kb(eps,-1,0)(s,vo,vi) = vo


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 157 2 162 55
body:
    kb_tangent_line : LEMMA
          chi_hc(1,eps,irt)(s,vo,vi)`2 AND
          -pi/2 < track(vo-vi)-track(vo) AND
          track(vo-vi)-track(vo) < pi/2 
      IMPLIES
          line_solution?(s,kb(eps,irt,1)(s,vo,vi)-vi,eps)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 164 2 173 40
body:
    kb_is_independent : THEOREM
      horizontal_conflict?(s,vo-vi) AND
      abs(track(vo-vi)-track(vo)) < 0 AND
      abs(track(vi-vo)-track(vi)) < 0 AND
      nvo = kb(eps,irt,1)(s,vo,vi) AND
      nvo /= zero AND
      nvi = kb(eps,0,irt)(-s,vi,vo) AND
      nvi /= zero
      IMPLIES
        NOT horizontal_conflict?(s,nvo-vi)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 178 2 188 37
body:
    kb_is_not_coordinated_1 : THEOREM
       D = 5 AND s = (-10/sqrt(3),0) AND
       vo = (2,0) AND
       vi = (1,0) AND
        nvo = kb(-1,-1,1/2)(s,vo,vi) AND
        nvi = kb(-1,-1,1/2)(-s,vi,vo)
        IMPLIES
        nvo /= zero AND
        nvi /= zero AND 
        horizontal_conflict?(s,vo-vi) AND
        horizontal_conflict?(s,nvo-nvi)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 190 2 200 37
body:
    kb_is_not_coordinated_2 : THEOREM
       D = 5 AND s = (-10/sqrt(3),0) AND
       vo = (500,0) AND
       vi = (250,0) AND
        nvo = kb(-1,-1,1/2)(s,vo,vi) AND
        nvi = kb(-1,-1,1/2)(-s,vi,vo)
        IMPLIES
        nvo /= zero AND
        nvi /= zero AND 
        horizontal_conflict?(s,vo-vi) AND
        horizontal_conflict?(s,nvo-nvi)


decl_type: formula
theory: kb
library: ACCoRD
signature: nil
location: 204 2 214 37
body:
    kb_is_not_coordinated_3 : THEOREM
       D = 5 AND s = (-10/sqrt(3),0) AND
       vo = (500,0) AND
       vi = (250,0) AND
        nvo = kb(-1,-1,1/2)(s,vo,vi) AND
        nvi = kb(-1,-1,1/2)(-s,vi,vo)
        IMPLIES
        nvo /= zero AND
        nvi /= zero AND 
        horizontal_conflict?(s,vo-vi) AND
        horizontal_conflict?(s,nvo-nvi)


decl_type: function
theory: kb
library: ACCoRD
signature: [[Ss_vect2[D], Nz_vect2, nnreal, Sign] -> nnreal_lt_2pi]
location: 51 2 52 79
body:
    chirel_star(s,v,f,eps) : nnreal_lt_2pi = 
      to2pi(track(v) + f*angle_from_to(track(v),track(-s) - eps*asin(D/norm(s))))


decl_type: function
theory: kb
library: ACCoRD
location: 85 2 101 11
signature:
  [[nnreal, Sign, Sign] ->
          [[Ss_vect2[D], Nz_vect2, Nz_vect2] ->
             [nnreal_lt_2pi, bool]]]

body:
    chi_hc(f,eps,irt)(s,vo,vi) : [nnreal_lt_2pi,bool] =
      LET v = vo - vi IN
        IF zero_vect2?(v) THEN (0,false) 
        ELSE 
          LET chirelstar = chirel_star(s,v,f,eps),
              expr       = (norm(vi)/norm(vo))*sin(chirelstar-track(vi)),
              asinex     = IF abs(expr) > 1 THEN FALSE ELSE asin(expr) ENDIF,
              exsign     = sign(asinex),  
              expidiff   = exsign*(pi/2)-asinex,
              arcsindir  = exsign*(pi/2)+irt*expidiff,
              theta      = to2pi(chirelstar - arcsindir),
              nvovect    = trkgs2vect(theta,norm(vo))
          IN
            IF (abs(expr) > 1 OR s*(nvovect-vi)>=0) THEN (0,false)
            ELSE (theta,true)
            ENDIF
        ENDIF


decl_type: function
theory: kb
library: ACCoRD
signature:
  [[Sign, Sign, nnreal] ->
  [[Ss_vect2[D], Nz_vect2, Nz_vect2] -> Vect2]]

location: 144 2 148 11
body:
    kb(eps,irt,f)(s,vo,vi) : Vect2 =  
      LET (trk,b) = chi_hc(f,eps,irt)(s,vo,vi) IN
        IF b THEN trkgs2vect(trk,norm(vo)) 
        ELSE zero
        ENDIF


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 221 0 225 999
body:
  % Subtype TCC generated (at line 25, column 4) for  to2pi((y - x) + pi) - pi
      % expected type  {aa: real | aa >= -pi AND aa < pi}
  angle_from_to_TCC1: OBLIGATION
    FORALL (x: real, y: real):
      to2pi((y - x) + pi) - pi >= -pi AND to2pi((y - x) + pi) - pi < pi;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 227 0 231 999
body:
  % Subtype TCC generated (at line 52, column 67) for  D / norm(s)
      % expected type  real_abs_le1
  chirel_star_TCC1: OBLIGATION
    FORALL (s: Ss_vect2[D], v: Nz_vect2):
      -1 <= D / norm(s) AND D / norm(s) <= 1;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 233 0 236 999
body:
  % Subtype TCC generated (at line 55, column 41) for  D / norm(s)
      % expected type  real_abs_le1
  chirel_star_equiv_TCC1: OBLIGATION
    FORALL (s: Ss_vect2[D]): -1 <= D / norm(s) AND D / norm(s) <= 1;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 238 0 246 999
body:
  % Subtype TCC generated (at line 67, column 11) for  vo - vi
      % expected type  Nz_vect2
  chirel_star_test_TCC1: OBLIGATION
    FORALL (s: Ss_vect2[D], vi, vo: Nz_vect2):
           vi = (# x := 1, y := 0 #) AND vo = (# x := 2, y := 0 #)
       AND s = (# x := -10 / sqrt(3), y := 0 #) AND D = 5
       AND track(vo) = pi / 2 AND track(vi) = pi / 2
       AND horizontal_conflict?(s, vo - vi)
       IMPLIES vo - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 248 0 252 999
body:
  % Subtype TCC generated (at line 87, column 30) for  0
      % expected type  nnreal_lt_2pi
  chi_hc_TCC1: OBLIGATION
    FORALL (s: Ss_vect2[D], vo: Nz_vect2, vi: Nz_vect2, v: Vector):
      v = zero AND v = vo - vi IMPLIES 0 < 2 * pi;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 254 0 258 999
body:
  % Subtype TCC generated (at line 89, column 39) for  v
      % expected type  Nz_vect2
  chi_hc_TCC2: OBLIGATION
    FORALL (s: Ss_vect2[D], vo: Nz_vect2, vi: Nz_vect2, v: Vector):
      NOT v = zero AND v = vo - vi IMPLIES v /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 260 0 271 999
body:
  % Subtype TCC generated (at line 91, column 56) for  expr
      % expected type  real_abs_le1
  chi_hc_TCC3: OBLIGATION
    FORALL (f: nnreal, eps: Sign, s: Ss_vect2[D], vo: Nz_vect2, vi: Nz_vect2,
            v: Vector):
      NOT v = zero AND v = vo - vi IMPLIES
       (FORALL (chirelstar: nnreal_lt_2pi):
          chirelstar = chirel_star(s, v, f, eps) IMPLIES
           (FORALL (expr: real):
              NOT abs(expr) > 1 AND
               expr = (norm(vi) / norm(vo)) * sin(chirelstar - track(vi))
               IMPLIES -1 <= expr AND expr <= 1));


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 273 0 305 999
body:
  % Subtype TCC generated (at line 98, column 56) for  0
      % expected type  nnreal_lt_2pi
  chi_hc_TCC4: OBLIGATION
    FORALL (f: nnreal, eps: Sign, irt: Sign, s: Ss_vect2[D], vo: Nz_vect2,
            vi: Nz_vect2, v: Vector):
      NOT v = zero AND v = vo - vi IMPLIES
       (FORALL (chirelstar: nnreal_lt_2pi):
          chirelstar = chirel_star(s, v, f, eps) IMPLIES
           (FORALL (expr: real):
              expr = (norm(vi) / norm(vo)) * sin(chirelstar - track(vi))
               IMPLIES
               (FORALL (asinex: real):
                  asinex =
                   IF abs(expr) > 1 THEN b2n(FALSE) ELSE asin(expr) ENDIF
                   IMPLIES
                   (FORALL (exsign: Sign):
                      exsign = sign(asinex) IMPLIES
                       (FORALL (expidiff: real):
                          expidiff = exsign * (pi / 2) - asinex IMPLIES
                           (FORALL (arcsindir: real):
                              arcsindir = exsign * (pi / 2) + irt * expidiff
                               IMPLIES
                               (FORALL (theta: nnreal_lt_2pi):
                                  theta = to2pi(chirelstar - arcsindir)
                                   IMPLIES
                                   (FORALL (nvovect: Nz_vect2):
                                      (abs(expr) > 1
                                       OR
                                       s * (nvovect - vi) >= 0)
                                      AND
                                      nvovect = trkgs2vect(theta, norm(vo))
                                      IMPLIES
                                      0 < 2 * pi))))))));


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 307 0 314 999
body:
  % Subtype TCC generated (at line 112, column 31) for  vo - vi
      % expected type  Nz_vect2
  chi_hc_sin_equivalence_2_TCC1: OBLIGATION
    FORALL (eps: Sign, f: nnreal, irt: Sign, s: Ss_vect2[D],
            vi, vo: Nz_vect2, ch: [nnreal_lt_2pi, bool]):
      ch = chi_hc(f, eps, irt)(s, vo, vi) IMPLIES
       (FORALL (nvo: Nz_vect2):
          ch`2 AND nvo = trkgs2vect(ch`1, norm(vo)) IMPLIES vo - vi /= zero);


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 316 0 322 999
body:
  % Subtype TCC generated (at line 119, column 10) for
      % trkgs2vect(chi_hc(1, eps, irt)(s, vo, vi)`1, norm(vo)) - vi
      % expected type  Nz_vect2
  chi_hc_1_chirel_TCC1: OBLIGATION
    FORALL (eps, irt: Sign, s: Ss_vect2[D], vi, vo: Nz_vect2):
      chi_hc(1, eps, irt)(s, vo, vi)`2 IMPLIES
       trkgs2vect(chi_hc(1, eps, irt)(s, vo, vi)`1, norm(vo)) - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 324 0 328 999
body:
  % Subtype TCC generated (at line 119, column 82) for  vo - vi
      % expected type  Nz_vect2
  chi_hc_1_chirel_TCC2: OBLIGATION
    FORALL (eps, irt: Sign, s: Ss_vect2[D], vi, vo: Nz_vect2):
      chi_hc(1, eps, irt)(s, vo, vi)`2 IMPLIES vo - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 330 0 338 999
body:
  % Subtype TCC generated (at line 124, column 10) for
      % trkgs2vect(chi_hc(f, eps, irt)(s, vo, vi)`1, norm(vo)) - vi
      % expected type  Nz_vect2
  chi_hc_f_chirel_TCC1: OBLIGATION
    FORALL (eps: Sign, f: nnreal, irt: Sign, s: Ss_vect2[D],
            vi, vo: Nz_vect2):
      f < 1 AND chi_hc(f, eps, irt)(s, vo, vi)`2 AND s * (vo - vi) < 0
       IMPLIES
       trkgs2vect(chi_hc(f, eps, irt)(s, vo, vi)`1, norm(vo)) - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 340 0 346 999
body:
  % Subtype TCC generated (at line 124, column 82) for  vo - vi
      % expected type  Nz_vect2
  chi_hc_f_chirel_TCC2: OBLIGATION
    FORALL (eps: Sign, f: nnreal, irt: Sign, s: Ss_vect2[D],
            vi, vo: Nz_vect2):
      f < 1 AND chi_hc(f, eps, irt)(s, vo, vi)`2 AND s * (vo - vi) < 0
       IMPLIES vo - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 348 0 352 999
body:
  % Subtype TCC generated (at line 128, column 20) for  vo - vi
      % expected type  Nz_vect2
  chi_hc_0_id_TCC1: OBLIGATION
    FORALL (eps: Sign, s: Ss_vect2[D], vi, vo: Nz_vect2):
      chi_hc(0, eps, -1)(s, vo, vi)`2 IMPLIES vo - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 354 0 358 999
body:
  % Subtype TCC generated (at line 135, column 20) for  vo - vi
      % expected type  Nz_vect2
  chi_hc_0_id_rel_TCC1: OBLIGATION
    FORALL (eps, irt: Sign, s: Ss_vect2[D], vi, vo: Nz_vect2):
      chi_hc(0, eps, irt)(s, vo, vi)`2 IMPLIES vo - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 360 0 371 999
body:
  % Subtype TCC generated (at line 142, column 12) for  nvo - vi
      % expected type  Nz_vect2
  chi_hc_0_id_rel_TCC2: OBLIGATION
    FORALL (eps, irt: Sign, s: Ss_vect2[D], vi, vo: Nz_vect2):
      s * (vo - vi) < 0 AND
       track(vo - vi) - track(vo) < pi / 2 AND
        -pi / 2 < track(vo - vi) - track(vo) AND
         chi_hc(0, eps, irt)(s, vo, vi)`2
       IMPLIES
       (FORALL (nvo: Nz_vect2):
          nvo = trkgs2vect(chi_hc(0, eps, irt)(s, vo, vi)`1, norm(vo))
           IMPLIES nvo - vi /= zero);


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 373 0 377 999
body:
  % Subtype TCC generated (at line 166, column 14) for  vo - vi
      % expected type  Nz_vect2
  kb_is_independent_TCC1: OBLIGATION
    FORALL (s: Ss_vect2[D], vi, vo: Nz_vect2):
      horizontal_conflict?(s, vo - vi) IMPLIES vo - vi /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 379 0 385 999
body:
  % Subtype TCC generated (at line 167, column 14) for  vi - vo
      % expected type  Nz_vect2
  kb_is_independent_TCC2: OBLIGATION
    FORALL (s: Ss_vect2[D], vi, vo: Nz_vect2):
      horizontal_conflict?(s, vo - vi) AND
       abs(track(vo - vi) - track(vo)) < 0
       IMPLIES vi - vo /= zero;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 387 0 395 999
body:
  % Subtype TCC generated (at line 170, column 17) for  0
      % expected type  Sign
  kb_is_independent_TCC3: OBLIGATION
    FORALL (eps, irt: Sign, nvo: Vect2, s: Ss_vect2[D], vi, vo: Nz_vect2):
           horizontal_conflict?(s, vo - vi)
       AND abs(track(vo - vi) - track(vo)) < 0
       AND abs(track(vi - vo) - track(vi)) < 0
       AND nvo = kb(eps, irt, 1)(s, vo, vi) AND nvo /= zero
       IMPLIES (0 = 1 OR 0 = -1) AND 0 /= 0;


decl_type: tcc
theory: kb
library: ACCoRD
signature: nil
location: 397 0 405 999
body:
  % Subtype TCC generated (at line 170, column 19) for  irt
      % expected type  nnreal
  kb_is_independent_TCC4: OBLIGATION
    FORALL (eps, irt: Sign, nvo: Vect2, s: Ss_vect2[D], vi, vo: Nz_vect2):
           horizontal_conflict?(s, vo - vi)
       AND abs(track(vo - vi) - track(vo)) < 0
       AND abs(track(vi - vo) - track(vi)) < 0
       AND nvo = kb(eps, irt, 1)(s, vo, vi) AND nvo /= zero
       IMPLIES irt >= 0;


decl_type: function
theory: losr_iterative
library: ACCoRD
signature:
  [d: [Vect2, posreal, Sign] ->
  {nvo2: Vect2 | trk_only?(d`1)(nvo2)}]

location: 18 2 19 48
body:
    incr_trk_vect(nvo,step,dir): {nvo2: Vect2 | trk_only?(nvo)(nvo2)} =
      cos(dir*step)*nvo + sin(dir*step)*perpR(nvo)


decl_type: function
theory: losr_iterative
library: ACCoRD
signature: [[Nz_vect2, Nz_vect2, Nz_vect2, posreal, Sign] -> Sign3]
location: 21 2 26 16
body:
    losr_trk_iter_dir(s,vo,vi,step,eps): Sign3 =
      IF repulsive_criteria(s,vo-vi,eps)(incr_trk_vect(vo,step,1)-vi)
        THEN 1
      ELSIF repulsive_criteria(s,vo-vi,eps)(incr_trk_vect(vo,step,-1)-vi)
        THEN -1
      ELSE 0 ENDIF


decl_type: function
theory: losr_iterative
library: ACCoRD
location: 28 2 42 39
signature:
  [d:
          [s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, nnreal, posreal,
           posreal, posnat, Sign, eps: Sign,
           {nvo |
                    trk_only?(vo)(nvo) AND
                     repulsive_criteria(s, vo - vi, eps)(nvo - vi)}] ->
          {nvo2 |
                   nvo2 /= zero =>
                    trk_only?(d`2)(nvo2) AND
                     repulsive_criteria(d`1, d`2 - d`3, d`9)
                                       (nvo2 - d`3)}]

body:
    losr_trk_iter_i(s,vo,vi,minrelgs,maxtrk,step,i,dir,eps,
                   (nvo | trk_only?(vo)(nvo) AND
                          repulsive_criteria(s,vo-vi,eps)(nvo-vi))): 
      RECURSIVE {nvo2 | nz_vect2?(nvo2) => 
                   trk_only?(vo)(nvo2) AND
                   repulsive_criteria(s,vo-vi,eps)(nvo2-vi)} =
        LET nvop = incr_trk_vect(nvo,step,dir) IN 
        IF i*step >= maxtrk OR NOT repulsive_criteria(s,nvo-vi,eps)(nvop-vi) THEN
          nvo
        ELSIF divergent?(s,nvop-vi) AND norm(nvop-vi) >= minrelgs THEN
          nvop
        ELSE 
          losr_trk_iter_i(s,vo,vi,minrelgs,maxtrk,step,i+1,dir,eps,nvop)
        ENDIF
    MEASURE max(0,floor(maxtrk/step)-i+1)


decl_type: function
theory: losr_iterative
library: ACCoRD
location: 44 2 58 9
signature:
  [d: [Nz_vect2, Nz_vect2, Nz_vect2, nnreal, posreal, posreal] ->
          {nvo |
                   nvo /= zero =>
                    trk_only?(d`2)(nvo) AND
                     repulsive_criteria(d`1,
                                        d`2 - d`3,
                                        -sign(det(d`1, d`2 - d`3)))
                                       (nvo - d`3)}]

body:
    losr_trk_iter(s,vo,vi,minrelgs,maxtrk,step):  
      {nvo | nz_vect2?(nvo) => 
         trk_only?(vo)(nvo) AND
         repulsive_criteria(s,vo-vi,-sign(det(s,vo-vi)))(nvo-vi)} = 
      LET eps = -sign(det(s,vo-vi)),
          dir3 = losr_trk_iter_dir(s,vo,vi,step,eps) IN
      IF dir3 = 0 THEN
        zero
      ELSE LET nvo = incr_trk_vect(vo,step,dir3) IN 
        IF repulsive_criteria(s,vo-vi,eps)(nvo-vi) THEN
          losr_trk_iter_i(s,vo,vi,minrelgs,maxtrk,step,1,dir3,eps,nvo)
        ELSE 
          zero
        ENDIF
      ENDIF


decl_type: function
theory: losr_iterative
library: ACCoRD
location: 61 2 62 29
signature:
  [d: [Nz_vect2, posreal, Sign] ->
          {nvo: Vect2 |
                   norm(d`1) + d`3 * d`2 > 0 IMPLIES
                    gs_only?(d`1)(nvo)}]

body:
    incr_gs_vect(vo,step,dir): {nvo: Vect2 | norm(vo)+dir*step > 0 IMPLIES gs_only?(vo)(nvo)} =
      (norm(vo)+dir*step)*^(vo)


decl_type: function
theory: losr_iterative
library: ACCoRD
signature:
  [[Nz_vect2, Nz_vect2, Nz_vect2, posreal, posreal, posreal,
  Sign] ->
  Sign3]

location: 64 2 69 16
body:
    losr_gs_iter_dir(s,vo,vi,mings,maxgs,step,eps): Sign3 =
      IF norm(vo) + step <= maxgs AND repulsive_criteria(s,vo-vi,eps)(incr_gs_vect(vo,step,1)-vi)
        THEN 1
      ELSIF norm(vo) - step >= mings AND repulsive_criteria(s,vo-vi,eps)(incr_gs_vect(vo,step,-1)-vi)
        THEN -1
      ELSE 0 ENDIF


decl_type: function
theory: losr_iterative
library: ACCoRD
location: 71 2 86 99
signature:
  [d:
          [s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, nnreal, posreal,
           posreal, step: posreal, i: posnat, dir: Sign, eps: Sign,
           {nvo |
                    nvo = (norm(vo) + dir * i * step) * ^(vo) AND
                     norm(vo) + dir * i * step > 0 AND
                      repulsive_criteria(s, vo - vi, eps)(nvo - vi)}] ->
          {nvo2 |
                   nvo2 /= zero =>
                    gs_only?(d`2)(nvo2) AND
                     repulsive_criteria(d`1, d`2 - d`3, d`10)
                                       (nvo2 - d`3)}]

body:
    losr_gs_iter_i(s,vo,vi,minrelgs,mings,maxgs,step,i,dir,eps,
                  (nvo | nvo = (norm(vo)+dir*i*step)*^(vo) AND norm(vo)+dir*i*step > 0 AND 
                          repulsive_criteria(s,vo-vi,eps)(nvo-vi))): 
      RECURSIVE {nvo2 | nz_vect2?(nvo2) => 
                   gs_only?(vo)(nvo2) AND
                   repulsive_criteria(s,vo-vi,eps)(nvo2-vi)} =
        LET nvop = incr_gs_vect(nvo,step,dir),
            nnorm = norm(nvo)+dir*step IN 
        IF nnorm > maxgs OR nnorm < mings OR NOT repulsive_criteria(s,nvo-vi,eps)(nvop-vi) THEN
          nvo
        ELSIF divergent?(s,nvop-vi) AND norm(nvop-vi) >= minrelgs THEN
          nvop
        ELSE 
          losr_gs_iter_i(s,vo,vi,minrelgs,mings,maxgs,step,i+1,dir,eps,nvop)
        ENDIF
    MEASURE max(0,floor(IF dir >= 0 THEN (maxgs-norm(vo))/step ELSE (norm(vo)-mings)/step ENDIF)-i+1)


decl_type: function
theory: losr_iterative
library: ACCoRD
location: 88 2 102 9
signature:
  [d:
          [Nz_vect2, Nz_vect2, Nz_vect2, nnreal, posreal, posreal,
           posreal] ->
          {nvo |
                   nvo /= zero =>
                    gs_only?(d`2)(nvo) AND
                     repulsive_criteria(d`1,
                                        d`2 - d`3,
                                        -sign(det(d`1, d`2 - d`3)))
                                       (nvo - d`3)}]

body:
    losr_gs_iter(s,vo,vi,minrelgs,mings,maxgs,step):  
      {nvo | nz_vect2?(nvo) => 
         gs_only?(vo)(nvo) AND
         repulsive_criteria(s,vo-vi,-sign(det(s,vo-vi)))(nvo-vi)} = 
      LET eps = -sign(det(s,vo-vi)),
          dir3 = losr_gs_iter_dir(s,vo,vi,mings,maxgs,step,eps) IN
      IF dir3 = 0 THEN
        zero
      ELSE LET nvo = incr_gs_vect(vo,step,dir3) IN
        IF repulsive_criteria(s,vo-vi,eps)(nvo-vi) THEN
          losr_gs_iter_i(s,vo,vi,minrelgs,mings,maxgs,step,1,dir3,eps,nvo)
        ELSE 
          zero
        ENDIF
      ENDIF


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 109 0 114 999
body:
  % Subtype TCC generated (at line 19, column 4) for
      % cos(dir * step) * nvo + sin(dir * step) * perpR(nvo)
      % expected type  {nvo2: Vect2 | trk_only?(nvo)(nvo2)}
  incr_trk_vect_TCC1: OBLIGATION
    FORALL (nvo: Vect2, step: posreal, dir: Sign):
      trk_only?(nvo)(cos(dir * step) * nvo + sin(dir * step) * perpR(nvo));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 116 0 125 999
body:
  % Subtype TCC generated (at line 42, column 10) for
      % max(0, floor(maxtrk / step) - i + 1)
      % expected type  naturalnumber
  losr_trk_iter_i_TCC1: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, maxtrk: posreal,
            step: posreal, i: posnat, eps: Sign,
            (nvo: Vect2
                 | trk_only?(vo)(nvo) AND
                    repulsive_criteria(s, vo - vi, eps)(nvo - vi))):
      max(0, floor(maxtrk / step) - i + 1) >= 0;


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 127 0 145 999
body:
  % Subtype TCC generated (at line 36, column 8) for  nvo
      % expected type  {nvo2 |
                     %          nvo2 /= zero =>
                     %           trk_only?(vo)(nvo2) AND
                     %            repulsive_criteria(s, vo - vi, eps)
                     %                              (nvo2 - vi)}
  losr_trk_iter_i_TCC2: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, maxtrk: posreal,
            step: posreal, i: posnat, dir: Sign, eps: Sign,
            (nvo: Vect2
                 | trk_only?(vo)(nvo) AND
                    repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop: {nvo2: Vect2 | trk_only?(nvo)(nvo2)}):
      (i * step >= maxtrk OR
        NOT repulsive_criteria(s, nvo - vi, eps)(nvop - vi))
       AND nvop = incr_trk_vect(nvo, step, dir)
       IMPLIES
       nvo /= zero =>
        trk_only?(vo)(nvo) AND repulsive_criteria(s, vo - vi, eps)(nvo - vi);


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 147 0 167 999
body:
  % Subtype TCC generated (at line 38, column 8) for  nvop
      % expected type  {nvo2 |
                     %          nvo2 /= zero =>
                     %           trk_only?(vo)(nvo2) AND
                     %            repulsive_criteria(s, vo - vi, eps)
                     %                              (nvo2 - vi)}
  losr_trk_iter_i_TCC3: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            maxtrk: posreal, step: posreal, i: posnat, dir: Sign, eps: Sign,
            (nvo: Vect2
                 | trk_only?(vo)(nvo) AND
                    repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop: {nvo2: Vect2 | trk_only?(nvo)(nvo2)}):
           divergent?(s, zero, nvop - vi, zero)
       AND norm(nvop - vi) >= minrelgs AND NOT i * step >= maxtrk
       AND repulsive_criteria(s, nvo - vi, eps)(nvop - vi)
       AND nvop = incr_trk_vect(nvo, step, dir)
       IMPLIES
       nvop /= zero =>
        trk_only?(vo)(nvop) AND
         repulsive_criteria(s, vo - vi, eps)(nvop - vi);


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 169 0 188 999
body:
  % Subtype TCC generated (at line 40, column 65) for  nvop
      % expected type  {nvo |
                     %          trk_only?(vo)(nvo) AND
                     %           repulsive_criteria(s, vo - vi, eps)
                     %                             (nvo - vi)}
  losr_trk_iter_i_TCC4: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            maxtrk: posreal, step: posreal, i: posnat, dir: Sign, eps: Sign,
            (nvo: Vect2
                 | trk_only?(vo)(nvo) AND
                    repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop: {nvo2: Vect2 | trk_only?(nvo)(nvo2)}):
      NOT (divergent?(s, zero, nvop - vi, zero) AND
            norm(nvop - vi) >= minrelgs)
       AND
       NOT i * step >= maxtrk AND
        repulsive_criteria(s, nvo - vi, eps)(nvop - vi) AND
         nvop = incr_trk_vect(nvo, step, dir)
       IMPLIES
       trk_only?(vo)(nvop) AND repulsive_criteria(s, vo - vi, eps)(nvop - vi);


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 190 0 208 999
body:
  % Termination TCC generated (at line 40, column 8) for
      % losr_trk_iter_i(s, vo, vi, minrelgs, maxtrk, step, i + 1, dir, eps,
      %                 nvop)
  losr_trk_iter_i_TCC5: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            maxtrk: posreal, step: posreal, i: posnat, dir: Sign, eps: Sign,
            (nvo: Vect2
                 | trk_only?(vo)(nvo) AND
                    repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop: {nvo2: Vect2 | trk_only?(nvo)(nvo2)}):
      NOT (divergent?(s, zero, nvop - vi, zero) AND
            norm(nvop - vi) >= minrelgs)
       AND
       NOT i * step >= maxtrk AND
        repulsive_criteria(s, nvo - vi, eps)(nvop - vi) AND
         nvop = incr_trk_vect(nvo, step, dir)
       IMPLIES
       max(0, floor(maxtrk / step) - (i + 1) + 1) <
        max(0, floor(maxtrk / step) - i + 1);


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 210 0 227 999
body:
  % Subtype TCC generated (at line 51, column 6) for  zero
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           trk_only?(vo)(nvo) AND
                     %            repulsive_criteria(s,
                     %                               vo - vi,
                     %                               -sign(det(s, vo - vi)))
                     %                              (nvo - vi)}
  losr_trk_iter_TCC1: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, step: posreal,
            eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          dir3 = 0 AND dir3 = losr_trk_iter_dir(s, vo, vi, step, eps) IMPLIES
           zero /= zero =>
            trk_only?(vo)(zero) AND
             repulsive_criteria(s, vo - vi, -sign(det(s, vo - vi)))
                               (zero - vi));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 229 0 237 999
body:
  % Subtype TCC generated (at line 52, column 41) for  dir3
      % expected type  Sign
  losr_trk_iter_TCC2: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, step: posreal,
            eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND dir3 = losr_trk_iter_dir(s, vo, vi, step, eps)
           IMPLIES dir3 /= 0 AND (dir3 = 1 OR dir3 = -1));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 239 0 256 999
body:
  % Subtype TCC generated (at line 54, column 64) for  nvo
      % expected type  {nvo |
                     %          trk_only?(vo)(nvo) AND
                     %           repulsive_criteria(s, vo - vi, eps)
                     %                             (nvo - vi)}
  losr_trk_iter_TCC3: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, step: posreal,
            eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND dir3 = losr_trk_iter_dir(s, vo, vi, step, eps)
           IMPLIES
           (FORALL (nvo: {nvo2: Vect2 | trk_only?(vo)(nvo2)}):
              repulsive_criteria(s, vo - vi, eps)(nvo - vi) AND
               nvo = incr_trk_vect(vo, step, dir3)
               IMPLIES
               trk_only?(vo)(nvo) AND
                repulsive_criteria(s, vo - vi, eps)(nvo - vi)));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 258 0 305 999
body:
  % Subtype TCC generated (at line 54, column 8) for
      % losr_trk_iter_i(s, vo, vi, minrelgs, maxtrk, step, 1, dir3, eps, nvo)
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           trk_only?(vo)(nvo) AND
                     %            repulsive_criteria(s,
                     %                               vo - vi,
                     %                               -sign(det(s, vo - vi)))
                     %                              (nvo - vi)}
  losr_trk_iter_TCC4: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            maxtrk: posreal, step: posreal, eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND dir3 = losr_trk_iter_dir(s, vo, vi, step, eps)
           IMPLIES
           (FORALL (nvo: {nvo2: Vect2 | trk_only?(vo)(nvo2)}):
              repulsive_criteria(s, vo - vi, eps)(nvo - vi) AND
               nvo = incr_trk_vect(vo, step, dir3)
               IMPLIES
               losr_trk_iter_i(s, vo, vi, minrelgs, maxtrk, step, 1, dir3,
                               eps, nvo)
                /= zero
                =>
                trk_only?(vo)
                         (losr_trk_iter_i(s,
                                          vo,
                                          vi,
                                          minrelgs,
                                          maxtrk,
                                          step,
                                          1,
                                          dir3,
                                          eps,
                                          nvo))
                 AND
                 repulsive_criteria(s, vo - vi, -sign(det(s, vo - vi)))
                                   (losr_trk_iter_i(s,
                                                    vo,
                                                    vi,
                                                    minrelgs,
                                                    maxtrk,
                                                    step,
                                                    1,
                                                    dir3,
                                                    eps,
                                                    nvo)
                                     - vi)));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 307 0 329 999
body:
  % Subtype TCC generated (at line 56, column 8) for  zero
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           trk_only?(vo)(nvo) AND
                     %            repulsive_criteria(s,
                     %                               vo - vi,
                     %                               -sign(det(s, vo - vi)))
                     %                              (nvo - vi)}
  losr_trk_iter_TCC5: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, step: posreal,
            eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND dir3 = losr_trk_iter_dir(s, vo, vi, step, eps)
           IMPLIES
           (FORALL (nvo: {nvo2: Vect2 | trk_only?(vo)(nvo2)}):
              NOT repulsive_criteria(s, vo - vi, eps)(nvo - vi) AND
               nvo = incr_trk_vect(vo, step, dir3)
               IMPLIES
               zero /= zero =>
                trk_only?(vo)(zero) AND
                 repulsive_criteria(s, vo - vi, -sign(det(s, vo - vi)))
                                   (zero - vi)));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 331 0 339 999
body:
  % Subtype TCC generated (at line 62, column 4) for
      % (norm(vo) + dir * step) * ^(vo)
      % expected type  {nvo: Vect2 |
                     %          norm(vo) + dir * step > 0 IMPLIES
                     %           gs_only?(vo)(nvo)}
  incr_gs_vect_TCC1: OBLIGATION
    FORALL (vo: Nz_vect2, step: posreal, dir: Sign):
      norm(vo) + dir * step > 0 IMPLIES
       gs_only?(vo)((norm(vo) + dir * step) * ^(vo));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 341 0 362 999
body:
  % Subtype TCC generated (at line 86, column 10) for
      % max(0,
      %     floor(IF dir >= 0 THEN (maxgs - norm(vo)) / step
      %           ELSE (norm(vo) - mings) / step
      %           ENDIF)
      %      - i
      %      + 1)
      % expected type  naturalnumber
  losr_gs_iter_i_TCC1: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, mings: posreal,
            maxgs: posreal, step: posreal, i: posnat, dir: Sign, eps: Sign,
            (nvo: Vect2
                 | nvo = (norm(vo) + dir * i * step) * ^(vo) AND
                    norm(vo) + dir * i * step > 0 AND
                     repulsive_criteria(s, vo - vi, eps)(nvo - vi))):
      max(0,
          floor(IF dir >= 0 THEN (maxgs - norm(vo)) / step
                ELSE (norm(vo) - mings) / step
                ENDIF)
           - i
           + 1)
       >= 0;


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 364 0 390 999
body:
  % Subtype TCC generated (at line 80, column 8) for  nvo
      % expected type  {nvo2 |
                     %          nvo2 /= zero =>
                     %           gs_only?(vo)(nvo2) AND
                     %            repulsive_criteria(s, vo - vi, eps)
                     %                              (nvo2 - vi)}
  losr_gs_iter_i_TCC2: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, mings: posreal,
            maxgs: posreal, step: posreal, i: posnat, dir: Sign, eps: Sign,
            (nvo: Vect2
                 | nvo = (norm(vo) + dir * i * step) * ^(vo) AND
                    norm(vo) + dir * i * step > 0 AND
                     repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop:
              {nvo_1: Vect2 |
                       norm(nvo) + dir * step > 0 IMPLIES
                        gs_only?(nvo)(nvo_1)}):
      nvop = incr_gs_vect(nvo, step, dir) IMPLIES
       (FORALL (nnorm: real):
          (nnorm > maxgs OR
            nnorm < mings OR
             NOT repulsive_criteria(s, nvo - vi, eps)(nvop - vi))
           AND nnorm = norm(nvo) + dir * step
           IMPLIES
           nvo /= zero =>
            gs_only?(vo)(nvo) AND
             repulsive_criteria(s, vo - vi, eps)(nvo - vi));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 392 0 420 999
body:
  % Subtype TCC generated (at line 82, column 8) for  nvop
      % expected type  {nvo2 |
                     %          nvo2 /= zero =>
                     %           gs_only?(vo)(nvo2) AND
                     %            repulsive_criteria(s, vo - vi, eps)
                     %                              (nvo2 - vi)}
  losr_gs_iter_i_TCC3: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            mings: posreal, maxgs: posreal, step: posreal, i: posnat,
            dir: Sign, eps: Sign,
            (nvo: Vect2
                 | nvo = (norm(vo) + dir * i * step) * ^(vo) AND
                    norm(vo) + dir * i * step > 0 AND
                     repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop:
              {nvo_1: Vect2 |
                       norm(nvo) + dir * step > 0 IMPLIES
                        gs_only?(nvo)(nvo_1)}):
      nvop = incr_gs_vect(nvo, step, dir) IMPLIES
       (FORALL (nnorm: real):
               divergent?(s, zero, nvop - vi, zero)
           AND norm(nvop - vi) >= minrelgs AND NOT nnorm > maxgs
           AND NOT nnorm < mings
           AND repulsive_criteria(s, nvo - vi, eps)(nvop - vi)
           AND nnorm = norm(nvo) + dir * step
           IMPLIES
           nvop /= zero =>
            gs_only?(vo)(nvop) AND
             repulsive_criteria(s, vo - vi, eps)(nvop - vi));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 422 0 454 999
body:
  % Subtype TCC generated (at line 84, column 69) for  nvop
      % expected type  {nvo |
                     %          nvo =
                     %           (norm(vo) + step * dir + dir * i * step) *
                     %            ^(vo)
                     %           AND
                     %           norm(vo) + step * dir + dir * i * step > 0
                     %            AND
                     %            repulsive_criteria(s, vo - vi, eps)
                     %                              (nvo - vi)}
  losr_gs_iter_i_TCC4: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            mings: posreal, maxgs: posreal, step: posreal, i: posnat,
            dir: Sign, eps: Sign,
            (nvo: Vect2
                 | nvo = (norm(vo) + dir * i * step) * ^(vo) AND
                    norm(vo) + dir * i * step > 0 AND
                     repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop:
              {nvo_1: Vect2 |
                       norm(nvo) + dir * step > 0 IMPLIES
                        gs_only?(nvo)(nvo_1)}):
      nvop = incr_gs_vect(nvo, step, dir) IMPLIES
       (FORALL (nnorm: real):
               NOT (divergent?(s, zero, nvop - vi, zero) AND
                     norm(nvop - vi) >= minrelgs)
           AND NOT nnorm > maxgs AND NOT nnorm < mings
           AND repulsive_criteria(s, nvo - vi, eps)(nvop - vi)
           AND nnorm = norm(nvo) + dir * step
           IMPLIES
           nvop = (norm(vo) + step * dir + dir * i * step) * ^(vo) AND
            norm(vo) + step * dir + dir * i * step > 0 AND
             repulsive_criteria(s, vo - vi, eps)(nvop - vi));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 456 0 491 999
body:
  % Termination TCC generated (at line 84, column 8) for
      % losr_gs_iter_i(s, vo, vi, minrelgs, mings, maxgs, step, i + 1, dir,
      %                eps, nvop)
  losr_gs_iter_i_TCC5: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            mings: posreal, maxgs: posreal, step: posreal, i: posnat,
            dir: Sign, eps: Sign,
            (nvo: Vect2
                 | nvo = (norm(vo) + dir * i * step) * ^(vo) AND
                    norm(vo) + dir * i * step > 0 AND
                     repulsive_criteria(s, vo - vi, eps)(nvo - vi)),
            nvop:
              {nvo_1: Vect2 |
                       norm(nvo) + dir * step > 0 IMPLIES
                        gs_only?(nvo)(nvo_1)}):
      nvop = incr_gs_vect(nvo, step, dir) IMPLIES
       (FORALL (nnorm: real):
               NOT (divergent?(s, zero, nvop - vi, zero) AND
                     norm(nvop - vi) >= minrelgs)
           AND NOT nnorm > maxgs AND NOT nnorm < mings
           AND repulsive_criteria(s, nvo - vi, eps)(nvop - vi)
           AND nnorm = norm(nvo) + dir * step
           IMPLIES
           max(0,
               floor(IF dir >= 0 THEN (maxgs - norm(vo)) / step
                     ELSE (norm(vo) - mings) / step
                     ENDIF)
                - (i + 1)
                + 1)
            <
            max(0,
                floor(IF dir >= 0 THEN (maxgs - norm(vo)) / step
                      ELSE (norm(vo) - mings) / step
                      ENDIF)
                 - i
                 + 1));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 493 0 502 999
body:
  % Subtype TCC generated (at line 77, column 30) for  nvo
      % expected type  Nz_vect2
  losr_gs_iter_i_TCC6: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, step: posreal,
            i: posnat, dir: Sign, eps: Sign,
            (nvo: Vect2
                 | nvo = (norm(vo) + dir * i * step) * ^(vo) AND
                    norm(vo) + dir * i * step > 0 AND
                     repulsive_criteria(s, vo - vi, eps)(nvo - vi))):
      nvo /= zero;


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 504 0 523 999
body:
  % Subtype TCC generated (at line 95, column 6) for  zero
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           gs_only?(vo)(nvo) AND
                     %            repulsive_criteria(s,
                     %                               vo - vi,
                     %                               -sign(det(s, vo - vi)))
                     %                              (nvo - vi)}
  losr_gs_iter_TCC1: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, mings: posreal,
            maxgs: posreal, step: posreal, eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          dir3 = 0 AND
           dir3 = losr_gs_iter_dir(s, vo, vi, mings, maxgs, step, eps)
           IMPLIES
           zero /= zero =>
            gs_only?(vo)(zero) AND
             repulsive_criteria(s, vo - vi, -sign(det(s, vo - vi)))
                               (zero - vi));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 525 0 534 999
body:
  % Subtype TCC generated (at line 96, column 40) for  dir3
      % expected type  Sign
  losr_gs_iter_TCC2: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, mings: posreal,
            maxgs: posreal, step: posreal, eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND
           dir3 = losr_gs_iter_dir(s, vo, vi, mings, maxgs, step, eps)
           IMPLIES dir3 /= 0 AND (dir3 = 1 OR dir3 = -1));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 536 0 559 999
body:
  % Subtype TCC generated (at line 98, column 68) for  nvo
      % expected type  {nvo |
                     %          nvo = (norm(vo) + step * dir3) * ^(vo) AND
                     %           norm(vo) + step * dir3 > 0 AND
                     %            repulsive_criteria(s, vo - vi, eps)
                     %                              (nvo - vi)}
  losr_gs_iter_TCC3: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, mings: posreal,
            maxgs: posreal, step: posreal, eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND
           dir3 = losr_gs_iter_dir(s, vo, vi, mings, maxgs, step, eps)
           IMPLIES
           (FORALL (nvo:
                      {nvo: Vect2 |
                               norm(vo) + dir3 * step > 0 IMPLIES
                                gs_only?(vo)(nvo)}):
              repulsive_criteria(s, vo - vi, eps)(nvo - vi) AND
               nvo = incr_gs_vect(vo, step, dir3)
               IMPLIES
               nvo = (norm(vo) + step * dir3) * ^(vo) AND
                norm(vo) + step * dir3 > 0 AND
                 repulsive_criteria(s, vo - vi, eps)(nvo - vi)));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 561 0 615 999
body:
  % Subtype TCC generated (at line 98, column 8) for
      % losr_gs_iter_i(s, vo, vi, minrelgs, mings, maxgs, step, 1, dir3, eps,
      %                nvo)
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           gs_only?(vo)(nvo) AND
                     %            repulsive_criteria(s,
                     %                               vo - vi,
                     %                               -sign(det(s, vo - vi)))
                     %                              (nvo - vi)}
  losr_gs_iter_TCC4: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, minrelgs: nnreal,
            mings: posreal, maxgs: posreal, step: posreal, eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND
           dir3 = losr_gs_iter_dir(s, vo, vi, mings, maxgs, step, eps)
           IMPLIES
           (FORALL (nvo:
                      {nvo: Vect2 |
                               norm(vo) + dir3 * step > 0 IMPLIES
                                gs_only?(vo)(nvo)}):
              repulsive_criteria(s, vo - vi, eps)(nvo - vi) AND
               nvo = incr_gs_vect(vo, step, dir3)
               IMPLIES
               losr_gs_iter_i(s, vo, vi, minrelgs, mings, maxgs, step, 1,
                              dir3, eps, nvo)
                /= zero
                =>
                gs_only?(vo)
                        (losr_gs_iter_i(s,
                                        vo,
                                        vi,
                                        minrelgs,
                                        mings,
                                        maxgs,
                                        step,
                                        1,
                                        dir3,
                                        eps,
                                        nvo))
                 AND
                 repulsive_criteria(s, vo - vi, -sign(det(s, vo - vi)))
                                   (losr_gs_iter_i(s,
                                                   vo,
                                                   vi,
                                                   minrelgs,
                                                   mings,
                                                   maxgs,
                                                   step,
                                                   1,
                                                   dir3,
                                                   eps,
                                                   nvo)
                                     - vi)));


decl_type: tcc
theory: losr_iterative
library: ACCoRD
signature: nil
location: 617 0 643 999
body:
  % Subtype TCC generated (at line 100, column 8) for  zero
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           gs_only?(vo)(nvo) AND
                     %            repulsive_criteria(s,
                     %                               vo - vi,
                     %                               -sign(det(s, vo - vi)))
                     %                              (nvo - vi)}
  losr_gs_iter_TCC5: OBLIGATION
    FORALL (s: Nz_vect2, vo: Nz_vect2, vi: Nz_vect2, mings: posreal,
            maxgs: posreal, step: posreal, eps: Sign):
      eps = -sign(det(s, vo - vi)) IMPLIES
       (FORALL (dir3: Sign3):
          NOT dir3 = 0 AND
           dir3 = losr_gs_iter_dir(s, vo, vi, mings, maxgs, step, eps)
           IMPLIES
           (FORALL (nvo:
                      {nvo: Vect2 |
                               norm(vo) + dir3 * step > 0 IMPLIES
                                gs_only?(vo)(nvo)}):
              NOT repulsive_criteria(s, vo - vi, eps)(nvo - vi) AND
               nvo = incr_gs_vect(vo, step, dir3)
               IMPLIES
               zero /= zero =>
                gs_only?(vo)(zero) AND
                 repulsive_criteria(s, vo - vi, -sign(det(s, vo - vi)))
                                   (zero - vi)));


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 31 2 37 49
body:
    man_pos_seq_test: LEMMA
      man_pos_seq(so,timestep,velseqo)(1) = so AND
      man_pos_seq(so,timestep,velseqo)(2) = so+timestep*velseqo(1) AND
      man_pos_seq(so,timestep,velseqo)(3) = so+timestep*velseqo(1)
                          + timestep*velseqo(2) AND
      man_pos_seq(so,timestep,velseqo)(4) = so+timestep*velseqo(1)
                          + timestep*velseqo(2) +timestep*velseqo(3)


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 45 2 47 41
body:
    manuever_position_at_def: LEMMA m+1<=Nsteps IMPLIES
      maneuver_position_at(so,timestep,velseqo,Nsteps)(m*timestep) =
      man_pos_seq(so,timestep,velseqo)(m+1)


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 60 2 63 52
body:
    repulsive_criteria_iterative_repulsive: LEMMA
      repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps)
      IMPLIES
      repulsive_iterative?(s,v,timestep,velseq,Nsteps)


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 65 2 70 95
body:
    repulsive_criteria_iterative_reduces_seq: LEMMA s*v<0 AND
      repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps)
      IMPLIES
      FORALL (m:subrange(1,Nsteps)):
        repulsive_criteria(s,v,eps)(velseq(m))
        AND (m<Nsteps IMPLIES repulsive_criteria(s,v,eps)(man_pos_seq(s,timestep,velseq)(m+1)-s))


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 72 2 75 84
body:
    repulsive_criteria_iterative_reduces: LEMMA s*v<0 AND
      repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps)
      IMPLIES
      repulsive_criteria(s,v,eps)(maneuver_position_at(s,timestep,velseq,Nsteps)(t)-s)


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 77 2 82 110
body:
    repulsive_criteria_iterative_reduces_seq_divergent_special: LEMMA
      timestep = 1 AND s = (1,0) AND s * v >= 0 AND repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps)
      IMPLIES
      FORALL (m:subrange(1,Nsteps)):
        repulsive_criteria(s,v,eps)(velseq(m))
        AND (m<Nsteps IMPLIES repulsive_criteria(s,(m*timestep)*v,eps)((man_pos_seq(s,timestep,velseq)(m+1)-s)))


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 84 2 89 110
body:
    repulsive_criteria_iterative_reduces_seq_divergent: LEMMA s/=zero AND s*v>=0 AND
      repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps)
      IMPLIES
      FORALL (m:subrange(1,Nsteps)):
        repulsive_criteria(s,v,eps)(velseq(m))
        AND (m<Nsteps IMPLIES repulsive_criteria(s,(m*timestep)*v,eps)((man_pos_seq(s,timestep,velseq)(m+1)-s)))


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 91 2 97 17
body:
    repulsive_criteria_iterative_reduces_seq_div: LEMMA s*v>=0 AND
      repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps)
      IMPLIES
      FORALL (m:subrange(1,Nsteps)): s*velseq(m)>=0 AND
       (m<Nsteps IMPLIES 
        LET vv=man_pos_seq(s,timestep,velseq)(m+1)-s 
              IN  s*vv>=0)


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 99 2 102 68
body:
    repulsive_criteria_iterative_reduces_div: LEMMA s*v>=0 AND
      repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps)
      IMPLIES
      s*(maneuver_position_at(s,timestep,velseq,Nsteps)(t)-s)>=t*(s*v)


decl_type: formula
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 112 2 118 82
body:
    repulsive_criteria_iterative_coordinated: LEMMA
      repulsive_criteria_iterative(s,vo-vi,timestep,
                relative_velseq_vel(velseqo,vi),Nsteps,eps) AND
      repulsive_criteria_iterative(-s,vi-vo,timestep,
                relative_velseq_vel(velseqi,vo),Nsteps,eps)
      IMPLIES
      repulsive_iterative?(s,vo-vi,timestep,relative_velseq(velseqo,velseqi),Nsteps)


decl_type: function
theory: repulsive_iterative
library: ACCoRD
signature: [[Vect2, posreal, VelSeq] -> [posnat -> Vect2]]
location: 24 2 29 19
body:
    man_pos_seq(so,timestep,velseqo)(i): RECURSIVE Vect2 =
      IF    i = 1 THEN so
      ELSE LET soprev = man_pos_seq(so,timestep,velseqo)(i-1),
               voprev = velseqo(i-1)
           IN soprev + timestep*voprev
      ENDIF MEASURE i


decl_type: function
theory: repulsive_iterative
library: ACCoRD
signature: [[Vect2, posreal, VelSeq, posnat] -> [nnreal -> Vect2]]
location: 39 2 43 49
body:
    maneuver_position_at(so,timestep,velseqo,Nsteps)(t:nnreal): Vect2 =
      LET numsteps = min(floor(t/timestep)+1,Nsteps),
          lastso    = man_pos_seq(so,timestep,velseqo)(numsteps),
          lastvo    = velseqo(numsteps)
      IN  lastso + (t-timestep*(numsteps-1))*lastvo


decl_type: function
theory: repulsive_iterative
library: ACCoRD
signature: [[Vect2, Vect2, posreal, VelSeq, posnat] -> bool]
location: 49 2 54 83
body:
    repulsive_iterative?(s,v,timestep,velseq,Nsteps): bool =
      (s*v<0 AND
      (FORALL (t): norm(maneuver_position_at(s,timestep,velseq,Nsteps)(t))>=norm(s+tca(s,v)*v)))
      OR
      (s*v>=0 AND
      (FORALL (t): norm(maneuver_position_at(s,timestep,velseq,Nsteps)(t))>=norm(s)))


decl_type: function
theory: repulsive_iterative
library: ACCoRD
signature: [[Vect2, Vect2, posreal, VelSeq, posnat, Sign] -> bool]
location: 56 2 58 119
body:
    repulsive_criteria_iterative(s,v,timestep,velseq,Nsteps,eps): bool =
      repulsive_criteria(s,v,eps)(velseq(1)) AND
      FORALL (m:subrange(1,Nsteps-1)): repulsive_criteria(man_pos_seq(s,timestep,velseq)(m+1),velseq(m),eps)(velseq(m+1))


decl_type: tcc
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 125 0 135 999
body:
  % Subtype TCC generated (at line 27, column 27) for  i - 1
      % expected type  posnat
  man_pos_seq_TCC1: OBLIGATION
    FORALL (so: Vect2, timestep: posreal, velseqo: VelSeq, i: posnat,
            v:
              [[Vect2, posreal, VelSeq] ->
                 [{z1: posnat | z1 < i} -> Vect2]]):
      NOT i = 1 IMPLIES
       (FORALL (soprev: Vect2):
          soprev = v(so, timestep, velseqo)(i - 1) IMPLIES
           i - 1 >= 0 AND i - 1 > 0);


decl_type: tcc
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 137 0 140 999
body:
  % Subtype TCC generated (at line 26, column 55) for  i - 1
      % expected type  posnat
  man_pos_seq_TCC2: OBLIGATION
    FORALL (i: posnat): NOT i = 1 IMPLIES i - 1 >= 0 AND i - 1 > 0;


decl_type: tcc
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 142 0 145 999
body:
  % Termination TCC generated (at line 26, column 22) for
      % man_pos_seq(so, timestep, velseqo)(i - 1)
  man_pos_seq_TCC3: OBLIGATION
    FORALL (i: posnat): NOT i = 1 IMPLIES i - 1 < i;


decl_type: tcc
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 147 0 152 999
body:
  % Subtype TCC generated (at line 58, column 114) for  m + 1
      % expected type  posnat
  repulsive_criteria_iterative_TCC1: OBLIGATION
    FORALL (s: Vect2, v: Vect2, velseq: VelSeq, Nsteps: posnat, eps: Sign):
      repulsive_criteria(s, v, eps)(velseq(1)) IMPLIES
       (FORALL (m: subrange(1, Nsteps - 1)): m + 1 >= 0 AND m + 1 > 0);


decl_type: tcc
theory: repulsive_iterative
library: ACCoRD
signature: nil
location: 154 0 159 999
body:
  % Subtype TCC generated (at line 58, column 99) for  m
      % expected type  posnat
  repulsive_criteria_iterative_TCC2: OBLIGATION
    FORALL (s: Vect2, v: Vect2, velseq: VelSeq, Nsteps: posnat, eps: Sign):
      repulsive_criteria(s, v, eps)(velseq(1)) IMPLIES
       (FORALL (m: subrange(1, Nsteps - 1)): m >= 0 AND m > 0);


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 22 2 25 22
body:
    horizontal_criterion_rewrite: THEOREM
      horizontal_criterion?(sp,eps)(v) IFF
      (eps*det(v,tangent_line(sp,eps)) <= 0 AND
       eps*det(sp,v)<=0)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 32 2 36 42
body:
    horizontal_criterion_special_coordination: LEMMA
      horizontal_criterion?(-sp,eps)(nvi-vo) AND
      horizontal_criterion?(sp,eps)(nvo-vo)
      IMPLIES
        NOT horizontal_conflict?(sp,nvo-nvi)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 38 2 41 36
body:
    horizontal_criterion_dot_equality: LEMMA
      line_solution?(sp,nvo-vi,eps) AND 
      line_solution?(sp,v,eps) IMPLIES
        det(vi-nvi,v) = det(nvo-nvi,v)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 43 2 46 45
body:
    horizontal_criterion_line_invariance: LEMMA
      line_solution?(sp,nvo-vi,eps) IMPLIES
       (horizontal_criterion?(sp,eps)(vi-nvi) IMPLIES
        horizontal_criterion?(sp,eps)(nvo-nvi))


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 48 2 52 42
body:
    horizontal_criterion_line_coordination: LEMMA
      line_solution?(-sp,nvi-vo,eps) AND
      horizontal_criterion?(sp,eps)(nvo-vo)
      IMPLIES
        NOT horizontal_conflict?(sp,nvo-nvi)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 95 2 97 37
body:
    horizontal_criterion_ext_subset: LEMMA
      horizontal_criterion_ext?(sp,v,eps)(nv) IMPLIES
      horizontal_criterion?(sp,eps)(nv)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 99 2 102 39
body:
    horizontal_criterion_ext_restrict: LEMMA
      horizontal_conflict?(sp,v) IMPLIES
      (horizontal_criterion_ext?(sp,v,eps)(nv) IFF
       horizontal_criterion?(sp,eps)(nv))


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 104 2 107 39
body:
    horizontal_criterion_ext_restrict_conflict: LEMMA
      horizontal_conflict?(sp,v) IMPLIES
      (horizontal_criterion_ext?(sp,v,eps)(nv) IFF
       horizontal_criterion?(sp,eps)(nv))


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 109 2 111 35
body:
    horizontal_criterion_ext_independence: LEMMA
      horizontal_criterion_ext?(sp,v,eps)(nv) IMPLIES
      NOT horizontal_conflict?(sp,nv)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 119 2 123 40
body:
    horizontal_criterion_ext_coordinated: LEMMA
      horizontal_criterion_ext?(sp,vo-vi,eps)(nvo-vi) AND
      horizontal_criterion_ext?(-sp,vi-vo,eps)(nvi-vo)
      IMPLIES
      NOT horizontal_conflict?(sp,nvo-nvi)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 127 2 131 48
body:
    horizontal_criterion_ext_sum_closed: LEMMA
      horizontal_criterion_ext?(sp,v,eps)(nv1) AND
      horizontal_criterion_ext?(sp,v,eps)(nv2)
      IMPLIES
      horizontal_criterion_ext?(sp,v,eps)(nv1+nv2)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 133 2 137 45
body:
    horizontal_criterion_ext_scal: LEMMA
      FORALL (c:real): c>=1 AND
      horizontal_criterion_ext?(sp,v,eps)(nv)
      IMPLIES
      horizontal_criterion_ext?(sp,v,eps)(c*nv)


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 139 2 146 57
body:
    horizontal_criterion_ext_seg_convex: LEMMA
      FORALL (eps: Sign, sp: Sp_vect2[D], v, nv1, nv2: Vect2):
        horizontal_criterion_ext?(sp, v, eps)(nv1) AND
        horizontal_criterion_ext?(sp, v, eps)(nv2)
        IMPLIES
        (FORALL (t: real):
          0 <= t AND t <= 1 IMPLIES
          horizontal_criterion_ext?(sp,v,eps)((1-t)*nv1 + t *nv2))


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 151 2 156 67
body:
    horizontal_criterion_ext_seg_independence: LEMMA
      FORALL (sp1,sp2:Vect2,t1,t2:real): t1<t2 AND
      horizontal_criterion_ext?(sp,v,eps)(sp1-sp) AND
      horizontal_criterion_ext?(sp,v,eps)(sp2-sp) IMPLIES
      FORALL (t:real): t1 <= t AND t <= t2
        IMPLIES NOT horizontal_los?(sp1 + ((t-t1)/(t2-t1))*(sp2-sp1))


decl_type: formula
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 161 2 173 81
body:
    horizontal_criterion_ext_seg_coordination: LEMMA
      FORALL (so,si,vo,vi,nso1,nso2,nsi1,nsi2:Vect2,t1,t2:real): 
      t1<t2 AND sqv(so-si) >= sq(D) AND
      horizontal_criterion_ext?(so-si,vo-vi,eps)(nso1-so) AND
      horizontal_criterion_ext?(so-si,vo-vi,eps)(nso2-so) AND
      horizontal_criterion_ext?(si-so,vi-vo,eps)(nsi1-si) AND
      horizontal_criterion_ext?(si-so,vi-vo,eps)(nsi2-si) IMPLIES
      FORALL (t:real):
        LET time01 = (t-t1)/(t2-t1),
            ownshippos = nso1 + time01*(nso2-nso1),
            intruderpos = nsi1 + time01*(nsi2-nsi1)
        IN
            t1 <= t AND t <= t2 IMPLIES NOT horizontal_los?(ownshippos-intruderpos)


decl_type: function
theory: horizontal_criterion_line
library: ACCoRD
signature: [[Sp_vect2[D], Vect2, Sign] -> [Vect2 -> bool]]
location: 83 2 93 9
body:
    horizontal_criterion_ext?(sp,v,eps)(nv): bool =
      IF horizontal_criterion?(sp,eps)(v)
        THEN horizontal_criterion?(sp,eps)(nv-(1/2)*v)
      ELSIF 
           horizontal_criterion?(sp,eps)(-v) OR
           (NOT horizontal_criterion?(sp,-eps)(v))
         THEN horizontal_criterion?(sp,eps)(nv)
      ELSE 
        horizontal_criterion?(sp,eps)(nv) AND
        horizontal_criterion?(sp,eps)(nv-(1/2)*v) 
      ENDIF


decl_type: tcc
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 183 0 190 999
body:
  % Subtype TCC generated (at line 156, column 49) for  (t2 - t1)
      % expected type  nznum
  horizontal_criterion_ext_seg_independence_TCC1: OBLIGATION
    FORALL (eps: Sign, sp: Sp_vect2[D], v, sp1, sp2: Vect2, t1, t2: real):
      t1 < t2 AND
       horizontal_criterion_ext?(sp, v, eps)(sp1 - sp) AND
        horizontal_criterion_ext?(sp, v, eps)(sp2 - sp)
       IMPLIES (FORALL (t: real): t1 <= t AND t <= t2 IMPLIES (t2 - t1) /= 0);


decl_type: tcc
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 192 0 199 999
body:
  % Subtype TCC generated (at line 166, column 30) for  si - so
      % expected type  Sp_vect2[D]
  horizontal_criterion_ext_seg_coordination_TCC1: OBLIGATION
    FORALL (eps: Sign, so, si, vo, vi, nso1, nso2: Vect2, t1, t2: real):
      horizontal_criterion_ext?(so - si, vo - vi, eps)(nso2 - so) AND
       horizontal_criterion_ext?(so - si, vo - vi, eps)(nso1 - so) AND
        sqv(so - si) >= sq(D) AND t1 < t2
       IMPLIES sqv(si - so) >= sq(D);


decl_type: tcc
theory: horizontal_criterion_line
library: ACCoRD
signature: nil
location: 201 0 211 999
body:
  % Subtype TCC generated (at line 169, column 27) for  (t2 - t1)
      % expected type  nznum
  horizontal_criterion_ext_seg_coordination_TCC2: OBLIGATION
    FORALL (eps: Sign, so, si, vo, vi, nso1, nso2, nsi1, nsi2: Vect2,
            t1, t2: real):
           t1 < t2 AND sqv(so - si) >= sq(D)
       AND horizontal_criterion_ext?(so - si, vo - vi, eps)(nso1 - so)
       AND horizontal_criterion_ext?(so - si, vo - vi, eps)(nso2 - so)
       AND horizontal_criterion_ext?(si - so, vi - vo, eps)(nsi1 - si)
       AND horizontal_criterion_ext?(si - so, vi - vo, eps)(nsi2 - si)
       IMPLIES (t2 - t1) /= 0;


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 78 4 79 71
body:
      coordinated_symmetric: LEMMA symmetric?(C) IMPLIES
                             (coordinated?(Crit1,Crit2,C) IFF coordinated?(Crit2,Crit1,C))


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 86 4 91 33
body:
      sum_indep_coordinated: LEMMA
          crit_symmetric?(Crit) AND
          sum_independent?(Crit,C) AND
          sum_closed?(C)
          IMPLIES
          coordinated?(Crit,Crit,C)


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 93 4 100 25
body:
      coordinated_sum_indep: LEMMA
          crit_symmetric?(Crit) AND
          crit_independent_of_length?(Crit) AND
          coordinated?(Crit,Crit,C) AND
          open?(C) AND
          independent_of_length?(C)
          IMPLIES
          sum_independent?(Crit,C)


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 106 4 111 46
body:
      sum_indep_coordinated_antisym: LEMMA
          crit_antisymmetric?(Scrit) AND
          sum_independent?(Scrit(eps),C) AND
          sum_closed?(C)
          IMPLIES
          coordinated?(Scrit(eps),Scrit(-eps),C)


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 113 4 120 31
body:
      coordinated_antisym_sum_indep: LEMMA
          crit_antisymmetric?(Scrit) AND
          crit_independent_of_length?(Scrit(eps)) AND
          coordinated?(Scrit(eps),Scrit(-eps),C) AND
          open?(C) AND
          independent_of_length?(C)
          IMPLIES
          sum_independent?(Scrit(eps),C)


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 129 2 133 41
body:
    deriv_subset: LEMMA
      Crit(s,v)(-l*v) AND
      crit_sum_closed?(Crit)
       IMPLIES
      subset?(Crit(s,v),deriv(Crit,l)(s,v))


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 135 2 139 54
body:
    deriv_coordinated: LEMMA
                                l1+l2 = 1 IMPLIES
                                crit_symmetric?(Crit) AND
                                sum_independent?(Crit,C) IMPLIES
                                coordinated?(deriv(Crit,l1),deriv(Crit,l2),C)


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 141 2 144 43
body:
    deriv_coordinated_1: LEMMA
                                crit_symmetric?(Crit) AND
                                sum_independent?(Crit,C) IMPLIES
                                coordinated?(deriv(Crit,1),Crit,C)


decl_type: formula
theory: predicate_coordination
library: ACCoRD
signature: nil
location: 148 2 155 55
body:
    Comb_coordinated: LEMMA
      sum_independent?(Crit1,C) AND
      crit_symmetric?(Crit1) AND
      coordinated?(Crit2,Crit3,C) AND
      sum_closed?(C) AND
      symmetric?(C)
      IMPLIES
      coordinated?(Comb(Crit1,Crit2),Comb(Crit1,Crit3),C)


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [Vector_Predicate -> bool]
location: 33 4 35 48
body:
      sum_closed?(C): bool =
          FORALL (s,v,nv,nw:Vect3):
          C(s,v)(nv) AND C(s,v)(nw) IMPLIES C(s,v)(nv+nw)


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [Criter -> bool]
location: 42 4 44 57
body:
      crit_sum_closed?(Crit): bool =
          FORALL (s,v,nv,nw:Vect3):
          Crit(s,v)(nv) AND Crit(s,v)(nw) IMPLIES Crit(s,v)(nv+nw)


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [[Criter, Vector_Predicate] -> bool]
location: 47 4 51 26
body:
      sum_independent?(Crit,C): bool = 
          FORALL (v,s,nv,nw: Vect3):
          (Crit(s,v)(nv) AND Crit(s,v)(nw) AND C(s,v)(v)
          IMPLIES
          NOT C(s,v)(nv+nw))


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [Vector_Predicate -> bool]
location: 53 4 59 15
body:
      open?(C): bool = 
          FORALL (s,v,nv: Vect3): C(s,v)(nv) IMPLIES
          (EXISTS (epsilon:posreal):
          FORALL (nw: Vect3):
          norm(nw)<epsilon
          IMPLIES
          C(s,v)(nv+nw))


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [Criter -> bool]
location: 62 4 64 37
body:
      crit_independent_of_length?(Crit): bool =
          FORALL (v,s,nv: Vect3,pr: posreal):
          (Crit(s,v)(nv) IFF Crit(s,pr*v)(nv))


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [Vector_Predicate -> bool]
location: 66 4 68 34
body:
      independent_of_length?(C): bool = 
          FORALL (s,v,nv:Vect3,pr,pz:posreal):
          (C(s,v)(nv) IFF C(s,pz*v)(pr*nv))


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [[Criter, Criter, Vector_Predicate] -> bool]
location: 70 4 76 32
body:
      coordinated?(Crit1,Crit2,C): bool =
          FORALL (vo,vi,nvo,nvi,s: Vect3):
          (C(s,vo-vi)(vo-vi) AND
          Crit1(s,vo-vi)(nvo-vi) AND
          Crit2(-s,vi-vo)(nvi-vo)
          IMPLIES
          NOT C(s,vo-vi)(nvo-nvi))


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [Criter -> bool]
location: 82 4 84 44
body:
      crit_symmetric?(Crit): bool =
          FORALL (v,s,nv: Vect3):
          (Crit(s,v)(nv) IFF Crit(-s,-v)(-nv))


decl_type: function
theory: predicate_coordination
library: ACCoRD
signature: [SignedCrit -> bool]
location: 102 4 104 57
body:
      crit_antisymmetric?(Scrit): bool =
          FORALL (v,s,nv: Vect3, eps:Sign):
          (Scrit(eps)(s,v)(nv) IFF Scrit(-eps)(-s,-v)(-nv))


decl_type: formula
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 34 2 37 46
body:
    closed_region_3D_t_def: LEMMA
      vect2(v)*vect2(p) /= 0 IMPLIES
      LET t = (sq(D)-vect2(s)*vect2(p))/(vect2(v)*vect2(p)) IN
        (vect2(s) + t*vect2(v))*vect2(p) = sq(D)


decl_type: formula
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 39 2 43 96
body:
    closed_region_3D_t_direction: LEMMA
      vect2(v)*vect2(p) /= 0 IMPLIES
      LET t = (sq(D)-vect2(s)*vect2(p))/(vect2(v)*vect2(p)) IN
      t /= tztime IMPLIES
      sign(vect2(v)*vect2(p))*sign(t-tztime) = sign(sq(D) - (vect2(s) + tztime*vect2(v))*vect2(p))


decl_type: formula
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 45 2 49 38
body:
    closed_region_3D_sum_closed: LEMMA
      closed_region_3D(s,p,eps,dir)(v) AND
      closed_region_3D(s,p,eps,dir)(w)
      IMPLIES
      closed_region_3D(s,p,eps,dir)(v+w)


decl_type: formula
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 72 2 74 23
body:
    vertical_criterion_independence: LEMMA
      vertical_criterion?(eps)(s,v)(nv) IMPLIES
      NOT conflict?(s,nv)


decl_type: formula
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 76 2 81 28
body:
    vertical_criterion_coordination: LEMMA
      conflict?(s,vo-vi) AND
      vertical_criterion?(eps)(s,vo-vi)(nvo-vi) AND
      vertical_criterion?(-eps)(-s,vi-vo)(nvi-vo)
      IMPLIES
      NOT conflict?(s,nvo-nvi)


decl_type: formula
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 83 2 93 45
body:
    horizontal_meets_vertical_criterion : LEMMA
      LET v = vo-vi,
          dir: Sign = IF abs(s`z) >= H THEN eps * sign(s`z) ELSE -1 ENDIF
      IN
        Delta(s,v) > 0 AND vo`z /= vi`z AND 
        Theta_D(s,v,dir) > 0 AND Theta_H(s`z,v`z,-dir) > 0 AND
        eps = sign(s`z + Theta_H(s`z,v`z,-dir)*v`z) AND
        (vect2(s)+Theta_H(s`z,v`z,-dir)*vect2(nvo-vi))*(vect2(s)+Theta_D(s,v,dir)*vect2(v)) = sq(D) AND
        horizontal_only?(vo)(nvo)
        IMPLIES
          vertical_criterion?(eps)(s,v)(nvo-vi)


decl_type: formula
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 108 2 113 112
body:
    vertical_criterion_rewrite: LEMMA
      vertical_criterion?(eps)(s,v)(nv)
      IFF
      (vect2(v) = zero AND eps*nv`z >= 0 AND eps*s`z >= H
      OR
      Delta(s,v) > 0 AND Theta_D(s,v,safe_dir(s,v,eps)) > 0  AND intersects_half_plane?(s,nv,safe_p(s,v,eps),eps))


decl_type: function
theory: vertical_criterion
library: ACCoRD
signature: [[Vect3, Vect3, Sign, Sign] -> [Vect3 -> bool]]
location: 25 2 32 31
body:
    closed_region_3D(s,p,eps,dir)(v): bool = 
      vect2(v)*vect2(p) /= 0 AND sign(vect2(v)*vect2(p)) = dir AND
      LET t = (sq(D)-vect2(s)*vect2(p))/(vect2(v)*vect2(p)) IN
      t >= 0 AND
      eps*(s`z + t*v`z) >= H AND
      (abs(s`z) >= H AND dir = eps*sign(s`z)
       OR
       abs(s`z) < H AND dir = -1)


decl_type: function
theory: vertical_criterion
library: ACCoRD
signature: SignedCrit
location: 55 2 64 42
body:
    vertical_criterion?: SignedCrit = 
      LAMBDA (eps:Sign): (LAMBDA (s,v:Vect3): (LAMBDA (nv:Vect3):
      (vect2(v) = zero AND eps*nv`z >= 0 AND eps*s`z >= H
      OR
       Delta(s,v) > 0 AND
        LET dir : Sign = IF abs(s`z) >= H THEN eps*sign(s`z) ELSE Entry ENDIF,
            p          = (s + Theta_D(s,v,dir)*v) WITH [z := eps*H] IN
        Theta_D(s,v,dir) > 0
        AND
        closed_region_3D(s,p,eps,dir)(nv))))


decl_type: function
theory: vertical_criterion
library: ACCoRD
signature: [[Vect3, Vect3, Vect3, Sign] -> bool]
location: 98 2 102 32
body:
    intersects_half_plane?(s,v,p,eps) : bool =
      vect2(v)*vect2(p) /= 0 AND 
      LET t = (sq(D)-vect2(s)*vect2(p))/(vect2(v)*vect2(p)) IN
      t >= 0 AND
      eps*(s`z + t*v`z) >= eps*p`z


decl_type: function
theory: vertical_criterion
library: ACCoRD
signature:
  [[s: Vect3, {v | Delta(vect2(s), vect2(v)) > 0}, Sign] ->
  Vect3]

location: 106 2 106 107
body:
    safe_p(s:Vect3,v | Delta(s,v) > 0,eps) : Vect3 = (s + Theta_D(s,v,safe_dir(s,v,eps))*v) WITH [z := eps*H]


decl_type: tcc
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 121 0 130 999
body:
  % Subtype TCC generated (at line 61, column 38) for  vect2(v)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  vertical_criterion?_TCC1: OBLIGATION
    FORALL (eps: Sign, s, v, nv: Vect3):
      Delta(vect2(s), vect2(v)) > 0 AND
       NOT (vect2(v) = zero AND eps * nv`z >= 0 AND eps * s`z >= H)
       IMPLIES
       (FORALL (dir: Sign):
          dir = IF abs(s`z) >= H THEN eps * sign(s`z) ELSE -1 ENDIF IMPLIES
           vect2(v) /= zero AND Delta[D](vect2(s), vect2(v)) >= 0);


decl_type: tcc
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 132 0 141 999
body:
  % Subtype TCC generated (at line 88, column 16) for  vect2(v)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  horizontal_meets_vertical_criterion_TCC1: OBLIGATION
    FORALL (eps: Sign, s, vi, vo, v: Vect3):
      v = vo - vi IMPLIES
       (FORALL (dir: Sign):
          vo`z /= vi`z AND
           Delta(vect2(s), vect2(v)) > 0 AND
            dir = IF abs(s`z) >= H THEN eps * sign(s`z) ELSE -1 ENDIF
           IMPLIES vect2(v) /= zero AND Delta[D](vect2(s), vect2(v)) >= 0);


decl_type: tcc
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 143 0 153 999
body:
  % Subtype TCC generated (at line 88, column 43) for  v`z
      % expected type  nzreal
  horizontal_meets_vertical_criterion_TCC2: OBLIGATION
    FORALL (eps: Sign, s, vi, vo, v: Vect3):
      v = vo - vi IMPLIES
       (FORALL (dir: Sign):
          Theta_D(vect2(s), vect2(v), dir) > 0 AND
           vo`z /= vi`z AND
            Delta(vect2(s), vect2(v)) > 0 AND
             dir = IF abs(s`z) >= H THEN eps * sign(s`z) ELSE -1 ENDIF
           IMPLIES v`z /= 0);


decl_type: tcc
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 155 0 159 999
body:
  % Subtype TCC generated (at line 106, column 66) for  vect2(v)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  safe_p_TCC1: OBLIGATION
    FORALL (s: Vect3, v: Vect3 | Delta[D](vect2(s), vect2(v)) > 0):
      vect2(v) /= zero AND Delta[D](vect2(s), vect2(v)) >= 0;


decl_type: tcc
theory: vertical_criterion
library: ACCoRD
signature: nil
location: 161 0 167 999
body:
  % Subtype TCC generated (at line 113, column 33) for  vect2(v)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  vertical_criterion_rewrite_TCC1: OBLIGATION
    FORALL (eps: Sign, nv, s, v: Vect3):
      NOT (vect2(v) = zero AND eps * nv`z >= 0 AND eps * s`z >= H) AND
       Delta(vect2(s), vect2(v)) > 0
       IMPLIES vect2(v) /= zero AND Delta[D](vect2(s), vect2(v)) >= 0;


decl_type: formula
theory: criteria_3D
library: ACCoRD
signature: nil
location: 24 2 28 26
body:
    criterion_3D_independence : THEOREM
      conflict?(sp,v) AND
      criterion_3D?(sp,v,epsh,epsv)(nv) 
      IMPLIES
        NOT conflict?(sp,nv)


decl_type: formula
theory: criteria_3D
library: ACCoRD
signature: nil
location: 30 2 34 30
body:
    criterion_3D_coordination : THEOREM
      conflict?(sp,vo-vi) AND
      criterion_3D?(sp,vo-vi,epsh,epsv)(nvo-vi) AND
      criterion_3D?(-sp,vi-vo,epsh,-epsv)(nvi-vo) IMPLIES
      NOT  conflict?(sp,nvo-nvi)


decl_type: function
theory: criteria_3D
library: ACCoRD
signature: [[Sp_vect3[D, H], Vect3, Sign, Sign] -> [Vect3 -> bool]]
location: 18 2 22 44
body:
    criterion_3D?(sp,v,epsh,epsv)(nv) : bool = 
      (horizontal_sep?(sp) AND horizontal_criterion?(sp,epsh)(nv)) OR
      (vertical_criterion?(epsv)(sp,v)(nv) AND
       (horizontal_los?(sp) OR
        horizontal_criterion?(sp,epsh)(nv-v)))


decl_type: tcc
theory: criteria_3D
library: ACCoRD
signature: nil
location: 41 0 49 999
body:
  % Subtype TCC generated (at line 22, column 28) for  vect2(sp)
      % expected type  Sp_vect2[D]
  criterion_3D?_TCC1: OBLIGATION
    FORALL (sp: Sp_vect3[D, H], v: Vect3, epsh: Sign, epsv: Sign, nv: Vect3):
      NOT sqv(vect2(sp)) < sq(D) AND
       vertical_criterion?(epsv)(sp, v)(nv) AND
        NOT (sqv(vect2(sp)) >= sq(D) AND
              horizontal_criterion?(vect2(sp), epsh)(vect2(nv)))
       IMPLIES sqv(vect2(sp)) >= sq(D);


decl_type: formula
theory: opt_trk_gs
library: ACCoRD
signature: nil
location: 57 2 62 51
body:
    opt_trk_gs_vertical_on_D: LEMMA
      LET v = vo-vi IN
      opt_trk_gs_vertical?(s,vo,vi,t,dir)(nvo) IMPLIES
        Delta(s,v) > 0 AND
        Theta_D(s,v,dir) > 0 AND
        (s+t*(nvo-vi))*(s+Theta_D(s,v,dir)*v) = sq(D) 


decl_type: function
theory: opt_trk_gs
library: ACCoRD
signature:
  [d: [Nz_vect2, Vect2, Vect2] ->
  {k: real, nvo: (optimal?(d`2, d`1)) | k * d`1 = nvo - d`3}]

location: 34 2 37 18
body:
    opt_trk_gs_line(nzv,vo,vi): {k:real,nvo:(optimal?(vo,nzv)) | 
                                 k*nzv = nvo-vi} = 
      LET  k  = k_opt(nzv,vo-vi) IN
        (k,k*nzv+vi)


decl_type: function
theory: opt_trk_gs
library: ACCoRD
location: 40 2 42 50
signature:
  [d: [Nz_vect2, Vect2, Vect2, real] ->
          {nvo: (optimal?(d`2, Vdir(d`1, d`2 - d`3))) |
                   d`1 * (nvo - d`3) = d`4}]

body:
    opt_trk_gs_dot(u,vo,vi,j) : {nvo:(optimal?(vo,Vdir(u,vo-vi))) |
                                     u*(nvo-vi) = j} =
      opt_trk_gs_line(Vdir(u,vo-vi),vo,vi+W0(u,j))`2 


decl_type: function
theory: opt_trk_gs
library: ACCoRD
signature: [[Vect2, Vect2, Vect2, posreal, Sign] -> Vect2]
location: 44 2 51 9
body:
    opt_trk_gs_vertical(s,vo,vi,t,dir) : Vect2 =
      LET v = vo-vi IN
      IF Delta(s,v) > 0 AND Theta_D(s,v,dir) > 0 THEN
        LET p = s + Theta_D(s,v,dir)*v IN
          opt_trk_gs_dot(t*p,vo,vi,sq(D)-s*p) 
      ELSE
        zero
      ENDIF


decl_type: function
theory: opt_trk_gs
library: ACCoRD
signature: [[Vect2, Vect2, Vect2, posreal, Sign] -> [Vect2 -> bool]]
location: 53 2 55 45
body:
    opt_trk_gs_vertical?(s,vo,vi,t,dir)(nvo) : bool = 
      nz_vect2?(nvo) AND
      nvo =  opt_trk_gs_vertical(s,vo,vi,t,dir)


decl_type: tcc
theory: opt_trk_gs
library: ACCoRD
signature: nil
location: 69 0 73 999
body:
  % Subtype TCC generated (at line 37, column 9) for  k * nzv + vi
      % expected type  (optimal?(vo, nzv))
  opt_trk_gs_line_TCC1: OBLIGATION
    FORALL (nzv: Nz_vect2, vo: Vect2, vi: Vect2, k: real):
      k = k_opt(nzv, vo - vi) IMPLIES optimal?(vo, nzv)(k * nzv + vi);


decl_type: tcc
theory: opt_trk_gs
library: ACCoRD
signature: nil
location: 75 0 80 999
body:
  % Subtype TCC generated (at line 37, column 6) for  (k, k * nzv + vi)
      % expected type  {k: real, nvo: (optimal?(vo, nzv)) |
                     %          k * nzv = nvo - vi}
  opt_trk_gs_line_TCC2: OBLIGATION
    FORALL (nzv: Nz_vect2, vo: Vect2, vi: Vect2, k: real):
      k = k_opt(nzv, vo - vi) IMPLIES k * nzv = k * nzv + vi - vi;


decl_type: tcc
theory: opt_trk_gs
library: ACCoRD
signature: nil
location: 82 0 88 999
body:
  % Subtype TCC generated (at line 42, column 4) for
      % opt_trk_gs_line(Vdir(u, vo - vi), vo, vi + W0(u, j))`2
      % expected type  {nvo: (optimal?(vo, Vdir(u, vo - vi))) |
                     %          u * (nvo - vi) = j}
  opt_trk_gs_dot_TCC1: OBLIGATION
    FORALL (u: Nz_vect2, vo: Vect2, vi: Vect2, j: real):
      u * (opt_trk_gs_line(Vdir(u, vo - vi), vo, vi + W0(u, j))`2 - vi) = j;


decl_type: tcc
theory: opt_trk_gs
library: ACCoRD
signature: nil
location: 90 0 95 999
body:
  % Subtype TCC generated (at line 46, column 36) for  v
      % expected type  {nzv | Delta(s, nzv) >= 0}
  opt_trk_gs_vertical_TCC1: OBLIGATION
    FORALL (s: Vect2, vo: Vect2, vi: Vect2, v: Vect2):
      Delta(s, v) > 0 AND v = vo - vi IMPLIES
       v /= zero AND Delta[D](s, v) >= 0;


decl_type: tcc
theory: opt_trk_gs
library: ACCoRD
signature: nil
location: 97 0 103 999
body:
  % Subtype TCC generated (at line 48, column 23) for  t * p
      % expected type  Nz_vect2
  opt_trk_gs_vertical_TCC2: OBLIGATION
    FORALL (s: Vect2, vo: Vect2, vi: Vect2, t: posreal, dir: Sign, v: Vect2):
      Delta(s, v) > 0 AND Theta_D(s, v, dir) > 0 AND v = vo - vi IMPLIES
       (FORALL (p: Vector):
          p = s + Theta_D(s, v, dir) * v IMPLIES t * p /= zero);


decl_type: formula
theory: opt_vertical
library: ACCoRD
signature: nil
location: 44 2 46 42
body:
    opt_vertical_meets_horizontal_criterion : THEOREM
      opt_vertical?(sp,vo,vi,epsh,epsv)(nvo) IMPLIES
      horizontal_criterion?(sp,epsh)(nvo-vo)


decl_type: formula
theory: opt_vertical
library: ACCoRD
signature: nil
location: 48 2 50 46
body:
    opt_vertical_meets_vertical_criterion : THEOREM
      opt_vertical?(s,vo,vi,epsh,epsv)(nvo) IMPLIES
      vertical_criterion?(epsv)(s,vo-vi)(nvo-vi)


decl_type: function
theory: opt_vertical
library: ACCoRD
location: 17 2 34 9
signature:
  [d: [Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
          {nvo | vect2(nvo) /= zero => d`2`z = nvo`z}]

body:
    opt_vertical(s,vo,vi,epsh,epsv): {nvo | nz_vect2?(nvo) => 
                                            horizontal_only?(vo)(nvo)} =
      IF vo`z = vi`z THEN zero
      ELSE
        LET v        = vo-vi,
            dir:Sign = IF abs(s`z) >= H THEN epsv*sign(s`z) ELSE Entry ENDIF,
            t        = Theta_H(s`z,v`z,-dir) IN
        IF t > 0 AND epsv = sign(s`z + t*v`z) THEN
          LET nvo2 = opt_trk_gs_vertical(s,vo,vi,t,dir) IN
            IF horizontal_los?(s) OR horizontal_criterion?(s,epsh)(nvo2-vo) THEN
              nvo2 WITH [z |-> vo`z] 
            ELSE
              zero
            ENDIF
        ELSE
           zero
        ENDIF
      ENDIF


decl_type: function
theory: opt_vertical
library: ACCoRD
signature:
  [[Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
  [Vect3 -> bool]]

location: 36 2 38 41
body:
    opt_vertical?(s,vo,vi,epsh,epsv)(nvo) : bool =
      nz_vect2?(nvo) AND
      nvo = opt_vertical(s,vo,vi,epsh,epsv)


decl_type: tcc
theory: opt_vertical
library: ACCoRD
signature: nil
location: 57 0 61 999
body:
  % Subtype TCC generated (at line 19, column 24) for  zero
      % expected type  {nvo | vect2(nvo) /= zero => vo`z = nvo`z}
  opt_vertical_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3, vi: Nzv2_vect3):
      vo`z = vi`z IMPLIES vect2(zero) /= zero => vo`z = zero`z;


decl_type: tcc
theory: opt_vertical
library: ACCoRD
signature: nil
location: 63 0 72 999
body:
  % Subtype TCC generated (at line 23, column 33) for  v`z
      % expected type  nzreal
  opt_vertical_TCC2: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES v`z /= 0));


decl_type: tcc
theory: opt_vertical
library: ACCoRD
signature: nil
location: 74 0 87 999
body:
  % Subtype TCC generated (at line 25, column 47) for  t
      % expected type  posreal
  opt_vertical_TCC3: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES t >= 0)));


decl_type: tcc
theory: opt_vertical
library: ACCoRD
signature: nil
location: 89 0 111 999
body:
  % Subtype TCC generated (at line 26, column 57) for  vect2(s)
      % expected type  Sp_vect2[D]
  opt_vertical_TCC4: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2: Vect2):
                      NOT sqv(vect2(s)) < sq(D) AND
                       nvo2 =
                        opt_trk_gs_vertical(vect2(s),
                                            vect2(vo),
                                            vect2(vi),
                                            t,
                                            dir)
                       IMPLIES sqv(vect2(s)) >= sq(D)))));


decl_type: tcc
theory: opt_vertical
library: ACCoRD
signature: nil
location: 113 0 115 999
body:
  % Subtype TCC generated (at line 27, column 12) for  nvo2 WITH [z |-> vo`z]
      % expected type  {nvo | vect2(nvo) /= zero => vo`z = nvo`z}
  opt_vertical_TCC5: OBLIGATION FORALL (vo: Nzv2_vect3, vi: Nzv2_vect3): TRUE;


decl_type: tcc
theory: opt_vertical
library: ACCoRD
signature: nil
location: 117 0 143 999
body:
  % Subtype TCC generated (at line 29, column 12) for  zero
      % expected type  {nvo | vect2(nvo) /= zero => vo`z = nvo`z}
  opt_vertical_TCC6: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsh: Sign,
            epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2: Vect2):
                      NOT sqv(vect2(s)) < sq(D) AND
                       NOT horizontal_criterion?(vect2(s), epsh)
                                                (nvo2 - vect2(vo))
                        AND
                        nvo2 =
                         opt_trk_gs_vertical(vect2(s),
                                             vect2(vo),
                                             vect2(vi),
                                             t,
                                             dir)
                       IMPLIES vect2(zero) /= zero => vo`z = zero`z))));


decl_type: tcc
theory: opt_vertical
library: ACCoRD
signature: nil
location: 145 0 158 999
body:
  % Subtype TCC generated (at line 32, column 9) for  zero
      % expected type  {nvo | vect2(nvo) /= zero => vo`z = nvo`z}
  opt_vertical_TCC7: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  NOT (t > 0 AND epsv = sign(s`z + t * v`z)) AND
                   t = Theta_H(s`z, v`z, -dir)
                   IMPLIES vect2(zero) /= zero => vo`z = zero`z)));


decl_type: formula
theory: circle_solutions
library: ACCoRD
signature: nil
location: 26 2 30 66
body:
    circle_solution_horizontal: LEMMA
      vertical_conflict?(s`z,v`z) AND
      circle_solution?(s,v,t,dir) 
      IMPLIES
        v`z /= 0 AND circle_solution?(s,v,Theta_H(s`z,v`z,-dir),dir)


decl_type: formula
theory: circle_solutions
library: ACCoRD
signature: nil
location: 32 2 36 71
body:
    circle_solution_vertical: LEMMA
      horizontal_conflict?(s,v) AND
      circle_solution?(s,v,t,dir) 
      IMPLIES
        NOT zero_vect2?(v) AND circle_solution?(s,v,Theta_D(s,v,dir),dir)


decl_type: formula
theory: circle_solutions
library: ACCoRD
signature: nil
location: 38 2 40 35
body:
    circle_solution_meets_criterion : LEMMA
      circle_solution?(s,v,t,dir) IMPLIES
      circle_criterion_at?(s,v,t,dir)


decl_type: formula
theory: circle_solutions
library: ACCoRD
signature: nil
location: 42 2 44 27
body:
    circle_solution_independence : THEOREM
      circle_solution?(s,v,t,dir) IMPLIES
      NOT conflict_ever?(s,v)


decl_type: function
theory: circle_solutions
library: ACCoRD
signature: [[Vect3, Vect3, real, Sign] -> bool]
location: 21 2 24 38
body:
    circle_solution?(s,v,t,dir): bool =
      t > 0 AND
      circle_solution_2D?(s,v,t,dir) AND
      vertical_solution?(s`z,v`z,t,-dir)


decl_type: tcc
theory: circle_solutions
library: ACCoRD
signature: nil
location: 55 0 61 999
body:
  % Subtype TCC generated (at line 36, column 60) for  vect2(v)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  circle_solution_vertical_TCC1: OBLIGATION
    FORALL (dir: Sign, s: Vect3, t: real, v: Vect3):
      circle_solution?(s, v, t, dir) AND
       horizontal_conflict?(vect2(s), vect2(v)) AND NOT vect2(v) = zero
       IMPLIES vect2(v) /= zero AND Delta[D](vect2(s), vect2(v)) >= 0;


decl_type: formula
theory: trk_circle
library: ACCoRD
signature: nil
location: 97 2 99 67
body:
    trk_circle_solution_2D : LEMMA
      trk_circle?(s,vo,vi,dir)(nvo) IMPLIES
        circle_solution_2D?(s,nvo-vi,Theta_H(s`z,vo`z-vi`z,-dir),dir)


decl_type: formula
theory: trk_circle
library: ACCoRD
signature: nil
location: 101 2 103 64
body:
    trk_circle_solution : LEMMA
      trk_circle?(s,vo,vi,dir)(nvo) IMPLIES
        circle_solution?(s,nvo-vi,Theta_H(s`z,vo`z-vi`z,-dir),dir)


decl_type: formula
theory: trk_circle
library: ACCoRD
signature: nil
location: 105 2 107 34
body:
    trk_circle_independence: THEOREM
      trk_circle?(s,vo,vi,dir)(nvo) IMPLIES
        NOT conflict_ever?(s,nvo-vi)


decl_type: formula
theory: trk_circle
library: ACCoRD
signature: nil
location: 109 2 115 35
body:
    trk_circle_complete: THEOREM
      vo`z /= vi`z AND 
      trk_only_3D?(vo)(nvo) AND
      circle_solution?(s,nvo-vi,Theta_H(s`z,vo`z-vi`z,-dir),dir) AND
      NOT trk_special_case?(s,vo,vi,Theta_H(s`z,vo`z-vi`z,-dir))
      IMPLIES
        trk_circle?(s,vo,vi,dir)(nvo)


decl_type: formula
theory: trk_circle
library: ACCoRD
signature: nil
location: 117 2 120 41
body:
    trk_vertical_eps : LEMMA
      LET nvo = trk_vertical(s,vo,vi,epsh,epsv) IN
      nz_vect2?(nvo) IMPLIES
      trk_vertical?(s,vo,vi,epsh,epsv)(nvo)


decl_type: formula
theory: trk_circle
library: ACCoRD
signature: nil
location: 122 2 124 42
body:
    trk_vertical_meets_horizontal_criterion : THEOREM
      trk_vertical?(sp,vo,vi,epsh,epsv)(nvo) IMPLIES
      horizontal_criterion?(sp,epsh)(nvo-vo)


decl_type: formula
theory: trk_circle
library: ACCoRD
signature: nil
location: 126 2 128 46
body:
    trk_vertical_meets_vertical_criterion : THEOREM
      trk_vertical?(s,vo,vi,epsh,epsv)(nvo) IMPLIES
      vertical_criterion?(epsv)(s,vo-vi)(nvo-vi)


decl_type: function
theory: trk_circle
library: ACCoRD
location: 36 2 47 9
signature:
  [d: [Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
          {nvo |
                   vect2(nvo) /= zero =>
                    trk_only?(vect2(d`2))(vect2(nvo)) AND
                     d`2`z = nvo`z}]

body:
    trk_circle(s,vo,vi,dir,irt): {nvo | nz_vect2?(nvo) => 
                                        trk_only_3D?(vo)(nvo)} =
      IF vo`z = vi`z THEN zero
      ELSE
        LET t = Theta_H(s`z,vo`z-vi`z,-dir) IN
        IF t > 0 THEN
          LET nvo2 = trk_only_circle(s,vo,vi,t,dir,irt) IN
            nvo2 WITH [ z |-> vo`z ] 
        ELSE
           zero
        ENDIF
      ENDIF


decl_type: function
theory: trk_circle
library: ACCoRD
signature: [[Vect3, Nzv2_vect3, Nzv2_vect3, Sign] -> [Vect3 -> bool]]
location: 49 2 51 51
body:
    trk_circle?(s,vo,vi,dir)(nvo) : bool =
      nz_vect2?(nvo) AND
      EXISTS (irt): nvo = trk_circle(s,vo,vi,dir,irt)


decl_type: function
theory: trk_circle
library: ACCoRD
location: 56 2 73 9
signature:
  [d: [Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign, Sign] ->
          {nvo |
                   vect2(nvo) /= zero =>
                    trk_only?(vect2(d`2))(vect2(nvo)) AND
                     d`2`z = nvo`z}]

body:
    trk_vertical_irt(s,vo,vi,epsh,epsv,irt): {nvo | nz_vect2?(nvo) => 
                                                    trk_only_3D?(vo)(nvo)} =
      IF vo`z = vi`z THEN zero
      ELSE
        LET v        = vo-vi,
            dir:Sign = IF abs(s`z) >= H THEN epsv*sign(s`z) ELSE Entry ENDIF,
            t        = Theta_H(s`z,v`z,-dir) IN
        IF t > 0 AND epsv = sign(s`z + t*v`z) THEN
          LET nvo2 = trk_only_vertical(s,vo,vi,t,dir,irt) IN
            IF horizontal_los?(s) OR horizontal_criterion?(s,epsh)(nvo2-vo) THEN
              nvo2 WITH [z |-> vo`z] 
            ELSE
              zero
            ENDIF
        ELSE
           zero
        ENDIF
      ENDIF


decl_type: function
theory: trk_circle
library: ACCoRD
location: 75 2 83 9
signature:
  [d: [Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
          {nvo |
                   vect2(nvo) /= zero =>
                    trk_only?(vect2(d`2))(vect2(nvo)) AND
                     d`2`z = nvo`z}]

body:
    trk_vertical(s,vo,vi,epsh,epsv): {nvo | nz_vect2?(nvo) => 
                                            trk_only_3D?(vo)(nvo)} =
      LET vo1 = trk_vertical_irt(s,vo,vi,epsh,epsv,1),
          vo2 = trk_vertical_irt(s,vo,vi,epsh,epsv,-1) IN
      IF vo2 = zero THEN vo1
      ELSIF vo1 = zero OR
            le?(vo)(vo2,vo1) THEN vo2
      ELSE vo1
      ENDIF


decl_type: function
theory: trk_circle
library: ACCoRD
signature:
  [[Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
  [Vect3 -> bool]]

location: 85 2 87 63
body:
    trk_vertical?(s,vo,vi,epsh,epsv)(nvo) : bool =
      nz_vect2?(nvo) AND
      EXISTS (irt): nvo = trk_vertical_irt(s,vo,vi,epsh,epsv,irt)


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 135 0 144 999
body:
  % Subtype TCC generated (at line 38, column 24) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           trk_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  trk_circle_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3, vi: Nzv2_vect3):
      vo`z = vi`z IMPLIES
       vect2(zero) /= zero =>
        trk_only?(vect2(vo))(vect2(zero)) AND vo`z = zero`z;


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 146 0 150 999
body:
  % Subtype TCC generated (at line 40, column 26) for  vo`z - vi`z
      % expected type  nzreal
  trk_circle_TCC2: OBLIGATION
    FORALL (vo: Nzv2_vect3, vi: Nzv2_vect3):
      NOT vo`z = vi`z IMPLIES vo`z - vi`z /= 0;


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 152 0 158 999
body:
  % Subtype TCC generated (at line 42, column 43) for  t
      % expected type  posreal
  trk_circle_TCC3: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, dir: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (t: real):
          t > 0 AND t = Theta_H(s`z, vo`z - vi`z, -dir) IMPLIES t >= 0);


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 160 0 175 999
body:
  % Subtype TCC generated (at line 43, column 10) for  nvo2 WITH [z |-> vo`z]
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           trk_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  trk_circle_TCC4: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, dir: Sign, irt: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (t: real):
          t > 0 AND t = Theta_H(s`z, vo`z - vi`z, -dir) IMPLIES
           (FORALL (nvo2: {nvo | nvo /= zero => trk_only?(vect2(vo))(nvo)}):
              nvo2 =
               trk_only_circle(vect2(s), vect2(vo), vect2(vi), t, dir, irt)
               IMPLIES
               vect2((nvo2 WITH [z |-> vo`z])) /= zero =>
                trk_only?(vect2(vo))(vect2((nvo2 WITH [z |-> vo`z])))));


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 177 0 188 999
body:
  % Subtype TCC generated (at line 45, column 9) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           trk_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  trk_circle_TCC5: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, dir: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (t: real):
          NOT t > 0 AND t = Theta_H(s`z, vo`z - vi`z, -dir) IMPLIES
           vect2(zero) /= zero =>
            trk_only?(vect2(vo))(vect2(zero)) AND vo`z = zero`z);


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 190 0 199 999
body:
  % Subtype TCC generated (at line 62, column 33) for  v`z
      % expected type  nzreal
  trk_vertical_irt_TCC1: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES v`z /= 0));


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 201 0 214 999
body:
  % Subtype TCC generated (at line 64, column 45) for  t
      % expected type  posreal
  trk_vertical_irt_TCC2: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES t >= 0)));


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 216 0 243 999
body:
  % Subtype TCC generated (at line 65, column 57) for  vect2(s)
      % expected type  Sp_vect2[D]
  trk_vertical_irt_TCC3: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign, irt: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2:
                              {nvo |
                                       nvo /= zero
                                       =>
                                       trk_only?(vect2(vo))(nvo)}):
                      NOT sqv(vect2(s)) < sq(D) AND
                       nvo2 =
                        trk_only_vertical(vect2(s),
                                          vect2(vo),
                                          vect2(vi),
                                          t,
                                          dir,
                                          irt)
                       IMPLIES sqv(vect2(s)) >= sq(D)))));


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 245 0 282 999
body:
  % Subtype TCC generated (at line 66, column 12) for  nvo2 WITH [z |-> vo`z]
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           trk_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  trk_vertical_irt_TCC4: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsh: Sign, epsv: Sign,
            irt: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2:
                              {nvo |
                                       nvo /= zero
                                       =>
                                       trk_only?(vect2(vo))(nvo)}):
                      (sqv(vect2(s)) < sq(D) OR
                        horizontal_criterion?(vect2(s), epsh)
                                             (nvo2 - vect2(vo)))
                       AND
                       nvo2 =
                        trk_only_vertical(vect2(s),
                                          vect2(vo),
                                          vect2(vi),
                                          t,
                                          dir,
                                          irt)
                       IMPLIES
                       vect2((nvo2 WITH [z |-> vo`z])) /= zero =>
                        trk_only?(vect2(vo))
                                 (vect2((nvo2 WITH [z |-> vo`z])))))));


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 284 0 321 999
body:
  % Subtype TCC generated (at line 68, column 12) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           trk_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  trk_vertical_irt_TCC5: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsh: Sign, epsv: Sign,
            irt: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2:
                              {nvo |
                                       nvo /= zero
                                       =>
                                       trk_only?(vect2(vo))(nvo)}):
                      NOT sqv(vect2(s)) < sq(D) AND
                       NOT horizontal_criterion?(vect2(s), epsh)
                                                (nvo2 - vect2(vo))
                        AND
                        nvo2 =
                         trk_only_vertical(vect2(s),
                                           vect2(vo),
                                           vect2(vi),
                                           t,
                                           dir,
                                           irt)
                       IMPLIES
                       vect2(zero) /= zero =>
                        trk_only?(vect2(vo))(vect2(zero)) AND
                         vo`z = zero`z))));


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 323 0 341 999
body:
  % Subtype TCC generated (at line 71, column 9) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           trk_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  trk_vertical_irt_TCC6: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  NOT (t > 0 AND epsv = sign(s`z + t * v`z)) AND
                   t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   vect2(zero) /= zero =>
                    trk_only?(vect2(vo))(vect2(zero)) AND vo`z = zero`z)));


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 343 0 347 999
body:
  % Subtype TCC generated (at line 99, column 47) for  vo`z - vi`z
      % expected type  nzreal
  trk_circle_solution_2D_TCC1: OBLIGATION
    FORALL (dir: Sign, nvo, s: Vect3, vi, vo: Nzv2_vect3):
      trk_circle?(s, vo, vi, dir)(nvo) IMPLIES vo`z - vi`z /= 0;


decl_type: tcc
theory: trk_circle
library: ACCoRD
signature: nil
location: 349 0 360 999
body:
  % Subtype TCC generated (at line 113, column 34) for
      % Theta_H(s`z, vo`z - vi`z, -dir)
      % expected type  posreal
  trk_circle_complete_TCC1: OBLIGATION
    FORALL (dir: Sign, nvo, s: Vect3, vi, vo: Nzv2_vect3):
      vo`z /= vi`z AND
       vo`z = nvo`z AND
        trk_only?(vect2(vo))(vect2(nvo)) AND
         circle_solution?(s, nvo - vi, Theta_H(s`z, vo`z - vi`z, -dir), dir)
       IMPLIES
       Theta_H[H](s`z, vo`z - vi`z, -dir) >= 0 AND
        Theta_H[H](s`z, vo`z - vi`z, -dir) > 0;


decl_type: formula
theory: gs_circle
library: ACCoRD
signature: nil
location: 85 2 87 67
body:
    gs_circle_solution_2D : LEMMA
      gs_circle?(s,vo,vi,dir)(nvo) IMPLIES
        circle_solution_2D?(s,nvo-vi,Theta_H(s`z,vo`z-vi`z,-dir),dir)


decl_type: formula
theory: gs_circle
library: ACCoRD
signature: nil
location: 89 2 91 64
body:
    gs_circle_solution : LEMMA
      gs_circle?(s,vo,vi,dir)(nvo) IMPLIES
        circle_solution?(s,nvo-vi,Theta_H(s`z,vo`z-vi`z,-dir),dir)


decl_type: formula
theory: gs_circle
library: ACCoRD
signature: nil
location: 93 2 95 34
body:
    gs_circle_independence: THEOREM
      gs_circle?(s,vo,vi,dir)(nvo) IMPLIES
        NOT conflict_ever?(s,nvo-vi)


decl_type: formula
theory: gs_circle
library: ACCoRD
signature: nil
location: 97 2 102 34
body:
    gs_circle_complete: THEOREM
      vo`z /= vi`z AND
      gs_only_3D?(vo)(nvo) AND
      circle_solution?(s,nvo-vi,Theta_H(s`z,vo`z-vi`z,-dir),dir)
      IMPLIES
        gs_circle?(s,vo,vi,dir)(nvo)


decl_type: formula
theory: gs_circle
library: ACCoRD
signature: nil
location: 104 2 106 42
body:
    gs_vertical_meets_horizontal_criterion : THEOREM
      gs_vertical?(sp,vo,vi,epsh,epsv)(nvo) IMPLIES
      horizontal_criterion?(sp,epsh)(nvo-vo)


decl_type: formula
theory: gs_circle
library: ACCoRD
signature: nil
location: 108 2 110 46
body:
    gs_vertical_meets_vertical_criterion : THEOREM
      gs_vertical?(s,vo,vi,epsh,epsv)(nvo) IMPLIES
      vertical_criterion?(epsv)(s,vo-vi)(nvo-vi)


decl_type: function
theory: gs_circle
library: ACCoRD
location: 36 2 46 9
signature:
  [d: [Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
          {nvo |
                   vect2(nvo) /= zero =>
                    gs_only?(vect2(d`2))(vect2(nvo)) AND
                     d`2`z = nvo`z}]

body:
    gs_circle(s,vo,vi,dir,irt): {nvo | nz_vect2?(nvo) => gs_only_3D?(vo)(nvo)} =
      IF vo`z = vi`z THEN zero
      ELSE
        LET t = Theta_H(s`z,vo`z-vi`z,-dir) IN
        IF t > 0 THEN
          LET nvo2 = gs_only_circle(s,vo,vi,t,dir,irt) IN
            nvo2 WITH [z |-> vo`z] 
        ELSE
           zero
        ENDIF
      ENDIF


decl_type: function
theory: gs_circle
library: ACCoRD
signature: [[Vect3, Nzv2_vect3, Nzv2_vect3, Sign] -> [Vect3 -> bool]]
location: 48 2 50 50
body:
    gs_circle?(s,vo,vi,dir)(nvo) : bool =
      nz_vect2?(nvo) AND
      EXISTS (irt): nvo = gs_circle(s,vo,vi,dir,irt)


decl_type: function
theory: gs_circle
library: ACCoRD
location: 55 2 71 9
signature:
  [d: [Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
          {nvo |
                   vect2(nvo) /= zero =>
                    gs_only?(vect2(d`2))(vect2(nvo)) AND
                     d`2`z = nvo`z}]

body:
    gs_vertical(s,vo,vi,epsh,epsv): {nvo | nz_vect2?(nvo) => 
                                           gs_only_3D?(vo)(nvo)} =
      IF vo`z = vi`z THEN zero
      ELSE LET v = vo-vi,
               dir:Sign = IF abs(s`z) >= H THEN epsv*sign(s`z) ELSE Entry ENDIF,
               t = Theta_H(s`z,v`z,-dir) IN
        IF t > 0 AND epsv = sign(s`z + t*v`z) THEN
          LET nvo2 = gs_only_vertical(s,vo,vi,t,dir) IN
            IF horizontal_los?(s) OR horizontal_criterion?(s,epsh)(nvo2-vo) THEN
              nvo2 WITH [z |-> vo`z] 
            ELSE
              zero
            ENDIF
        ELSE
           zero
        ENDIF
      ENDIF


decl_type: function
theory: gs_circle
library: ACCoRD
signature:
  [[Vect3, Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
  [Vect3 -> bool]]

location: 73 2 75 40
body:
    gs_vertical?(s,vo,vi,epsh,epsv)(nvo) : bool =
      nz_vect2?(nvo) AND
      nvo = gs_vertical(s,vo,vi,epsh,epsv)


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 117 0 126 999
body:
  % Subtype TCC generated (at line 37, column 24) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           gs_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  gs_circle_TCC1: OBLIGATION
    FORALL (vo: Nzv2_vect3, vi: Nzv2_vect3):
      vo`z = vi`z IMPLIES
       vect2(zero) /= zero =>
        gs_only?(vect2(vo))(vect2(zero)) AND vo`z = zero`z;


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 128 0 132 999
body:
  % Subtype TCC generated (at line 39, column 26) for  vo`z - vi`z
      % expected type  nzreal
  gs_circle_TCC2: OBLIGATION
    FORALL (vo: Nzv2_vect3, vi: Nzv2_vect3):
      NOT vo`z = vi`z IMPLIES vo`z - vi`z /= 0;


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 134 0 140 999
body:
  % Subtype TCC generated (at line 41, column 42) for  t
      % expected type  posreal
  gs_circle_TCC3: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, dir: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (t: real):
          t > 0 AND t = Theta_H(s`z, vo`z - vi`z, -dir) IMPLIES t >= 0);


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 142 0 157 999
body:
  % Subtype TCC generated (at line 42, column 10) for  nvo2 WITH [z |-> vo`z]
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           gs_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  gs_circle_TCC4: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, dir: Sign, irt: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (t: real):
          t > 0 AND t = Theta_H(s`z, vo`z - vi`z, -dir) IMPLIES
           (FORALL (nvo2: {nvo | nvo /= zero => gs_only?(vect2(vo))(nvo)}):
              nvo2 =
               gs_only_circle(vect2(s), vect2(vo), vect2(vi), t, dir, irt)
               IMPLIES
               vect2((nvo2 WITH [z |-> vo`z])) /= zero =>
                gs_only?(vect2(vo))(vect2((nvo2 WITH [z |-> vo`z])))));


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 159 0 170 999
body:
  % Subtype TCC generated (at line 44, column 9) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           gs_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  gs_circle_TCC5: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, dir: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (t: real):
          NOT t > 0 AND t = Theta_H(s`z, vo`z - vi`z, -dir) IMPLIES
           vect2(zero) /= zero =>
            gs_only?(vect2(vo))(vect2(zero)) AND vo`z = zero`z);


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 172 0 181 999
body:
  % Subtype TCC generated (at line 60, column 29) for  v`z
      % expected type  nzreal
  gs_vertical_TCC1: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES v`z /= 0));


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 183 0 196 999
body:
  % Subtype TCC generated (at line 62, column 44) for  t
      % expected type  posreal
  gs_vertical_TCC2: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES t >= 0)));


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 198 0 224 999
body:
  % Subtype TCC generated (at line 63, column 57) for  vect2(s)
      % expected type  Sp_vect2[D]
  gs_vertical_TCC3: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2:
                              {nvo |
                                       nvo /= zero
                                       =>
                                       gs_only?(vect2(vo))(nvo)}):
                      NOT sqv(vect2(s)) < sq(D) AND
                       nvo2 =
                        gs_only_vertical(vect2(s),
                                         vect2(vo),
                                         vect2(vi),
                                         t,
                                         dir)
                       IMPLIES sqv(vect2(s)) >= sq(D)))));


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 226 0 262 999
body:
  % Subtype TCC generated (at line 64, column 12) for  nvo2 WITH [z |-> vo`z]
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           gs_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  gs_vertical_TCC4: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsh: Sign,
            epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2:
                              {nvo |
                                       nvo /= zero
                                       =>
                                       gs_only?(vect2(vo))(nvo)}):
                      (sqv(vect2(s)) < sq(D) OR
                        horizontal_criterion?(vect2(s), epsh)
                                             (nvo2 - vect2(vo)))
                       AND
                       nvo2 =
                        gs_only_vertical(vect2(s),
                                         vect2(vo),
                                         vect2(vi),
                                         t,
                                         dir)
                       IMPLIES
                       vect2((nvo2 WITH [z |-> vo`z])) /= zero =>
                        gs_only?(vect2(vo))
                                (vect2((nvo2 WITH [z |-> vo`z])))))));


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 264 0 300 999
body:
  % Subtype TCC generated (at line 66, column 12) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           gs_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  gs_vertical_TCC5: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsh: Sign,
            epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  t > 0 AND
                   epsv = sign(s`z + t * v`z) AND t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   (FORALL (nvo2:
                              {nvo |
                                       nvo /= zero
                                       =>
                                       gs_only?(vect2(vo))(nvo)}):
                      NOT sqv(vect2(s)) < sq(D) AND
                       NOT horizontal_criterion?(vect2(s), epsh)
                                                (nvo2 - vect2(vo))
                        AND
                        nvo2 =
                         gs_only_vertical(vect2(s),
                                          vect2(vo),
                                          vect2(vi),
                                          t,
                                          dir)
                       IMPLIES
                       vect2(zero) /= zero =>
                        gs_only?(vect2(vo))(vect2(zero)) AND
                         vo`z = zero`z))));


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 302 0 320 999
body:
  % Subtype TCC generated (at line 69, column 9) for  zero
      % expected type  {nvo |
                     %          vect2(nvo) /= zero =>
                     %           gs_only?(vect2(vo))(vect2(nvo)) AND
                     %            vo`z = nvo`z}
  gs_vertical_TCC6: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, epsv: Sign):
      NOT vo`z = vi`z IMPLIES
       (FORALL (v: Vector):
          v = vo - vi IMPLIES
           (FORALL (dir: Sign):
              dir = IF abs(s`z) >= H THEN epsv * sign(s`z) ELSE -1 ENDIF
               IMPLIES
               (FORALL (t: real):
                  NOT (t > 0 AND epsv = sign(s`z + t * v`z)) AND
                   t = Theta_H(s`z, v`z, -dir)
                   IMPLIES
                   vect2(zero) /= zero =>
                    gs_only?(vect2(vo))(vect2(zero)) AND vo`z = zero`z)));


decl_type: tcc
theory: gs_circle
library: ACCoRD
signature: nil
location: 322 0 326 999
body:
  % Subtype TCC generated (at line 87, column 47) for  vo`z - vi`z
      % expected type  nzreal
  gs_circle_solution_2D_TCC1: OBLIGATION
    FORALL (dir: Sign, nvo, s: Vect3, vi, vo: Nzv2_vect3):
      gs_circle?(s, vo, vi, dir)(nvo) IMPLIES vo`z - vi`z /= 0;


decl_type: formula
theory: vs_only
library: ACCoRD
signature: nil
location: 48 2 54 39
body:
    circle_vs_only_ge : LEMMA
      LET signsz = sign(s`z+nnt*vz) IN
      circle_criterion_at?(s,v WITH [z := vz],nnt,eps) AND
      (eps = Exit IMPLIES signsz*v`z <= 0) AND
      signsz*v`z >= signsz*vz
      IMPLIES
        circle_criterion_at?(s,v,nnt,eps)


decl_type: formula
theory: vs_only
library: ACCoRD
signature: nil
location: 56 2 61 63
body:
    vs_entry_meets_circle_criterion : LEMMA
       horizontal_conflict?(ss,vgs) AND
       eps*ss`z < H AND
       eps*vgs`z >= eps*vs_at(ss`z,Theta_D(ss,vgs,Entry),eps)
       IMPLIES
         circle_criterion_at?(ss,vgs,Theta_D(ss,vgs,Entry),Entry)


decl_type: formula
theory: vs_only
library: ACCoRD
signature: nil
location: 63 2 68 58
body:
    vs_exit_meets_circle_criterion : LEMMA
      eps*s`z >= H AND
      horizontal_conflict?(s,vgs) AND
      vgs`z = vs_at(s`z,Theta_D(s,vgs,Exit),eps)
      IMPLIES
        circle_criterion_at?(s,vgs,Theta_D(s,vgs,Exit),Exit)


decl_type: function
theory: vs_only
library: ACCoRD
signature: [[Vect3, Vect2, real, Sign] -> [bool, real]]
location: 35 2 42 9
body:
    vs_only(s,v2,t,eps) : [bool,real] =
      IF eps*s`z < H AND strict_horizontal_sep?(s) AND Delta(s,v2) > 0 THEN  
        (true,vs_at(s`z,Theta_D(s,v2,Entry),eps))
      ELSIF eps*s`z >= H AND t > 0 THEN
        (true,vs_at(s`z,t,eps))
      ELSE
        (false,0)
      ENDIF


decl_type: tcc
theory: vs_only
library: ACCoRD
signature: nil
location: 75 0 80 999
body:
  % Subtype TCC generated (at line 37, column 32) for  v2
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  vs_only_TCC1: OBLIGATION
    FORALL (s: Vect3, v2: Vect2, eps: Sign):
      eps * s`z < H AND sqv(vect2(s)) > sq(D) AND Delta(vect2(s), v2) > 0
       IMPLIES v2 /= zero AND Delta[D](vect2(s), v2) >= 0;


decl_type: tcc
theory: vs_only
library: ACCoRD
signature: nil
location: 82 0 88 999
body:
  % Subtype TCC generated (at line 37, column 22) for
      % Theta_D(vect2(s), v2, -1)
      % expected type  nzreal
  vs_only_TCC2: OBLIGATION
    FORALL (s: Vect3, v2: Vect2, eps: Sign):
      eps * s`z < H AND sqv(vect2(s)) > sq(D) AND Delta(vect2(s), v2) > 0
       IMPLIES Theta_D[D](vect2(s), v2, -1) /= 0;


decl_type: tcc
theory: vs_only
library: ACCoRD
signature: nil
location: 90 0 98 999
body:
  % Subtype TCC generated (at line 39, column 22) for  t
      % expected type  nzreal
  vs_only_TCC3: OBLIGATION
    FORALL (s: Vect3, v2: Vect2, t: real, eps: Sign):
      eps * s`z >= H AND
       t > 0 AND
        NOT (eps * s`z < H AND
              sqv(vect2(s)) > sq(D) AND Delta(vect2(s), v2) > 0)
       IMPLIES t /= 0;


decl_type: tcc
theory: vs_only
library: ACCoRD
signature: nil
location: 100 0 105 999
body:
  % Subtype TCC generated (at line 59, column 44) for  vect2(vgs)
      % expected type  {nzv | Delta(vect2(ss), nzv) >= 0}
  vs_entry_meets_circle_criterion_TCC1: OBLIGATION
    FORALL (eps: Sign, ss: Ss2_vect3[D, H], vgs: Nzv2_vect3):
      horizontal_conflict?(vect2(ss), vect2(vgs)) AND eps * ss`z < H IMPLIES
       Delta[D](vect2(ss), vect2(vgs)) >= 0;


decl_type: tcc
theory: vs_only
library: ACCoRD
signature: nil
location: 107 0 113 999
body:
  % Subtype TCC generated (at line 59, column 33) for
      % Theta_D(vect2(ss), vect2(vgs), -1)
      % expected type  nzreal
  vs_entry_meets_circle_criterion_TCC2: OBLIGATION
    FORALL (eps: Sign, ss: Ss2_vect3[D, H], vgs: Nzv2_vect3):
      horizontal_conflict?(vect2(ss), vect2(vgs)) AND eps * ss`z < H IMPLIES
       Theta_D[D](vect2(ss), vect2(vgs), -1) /= 0;


decl_type: tcc
theory: vs_only
library: ACCoRD
signature: nil
location: 115 0 120 999
body:
  % Subtype TCC generated (at line 66, column 32) for  vect2(vgs)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  vs_exit_meets_circle_criterion_TCC1: OBLIGATION
    FORALL (eps: Sign, s: Vect3, vgs: Nzv2_vect3):
      eps * s`z >= H AND horizontal_conflict?(vect2(s), vect2(vgs)) IMPLIES
       Delta[D](vect2(s), vect2(vgs)) >= 0;


decl_type: tcc
theory: vs_only
library: ACCoRD
signature: nil
location: 122 0 128 999
body:
  % Subtype TCC generated (at line 66, column 22) for
      % Theta_D(vect2(s), vect2(vgs), 1)
      % expected type  nzreal
  vs_exit_meets_circle_criterion_TCC2: OBLIGATION
    FORALL (eps: Sign, s: Vect3, vgs: Nzv2_vect3):
      eps * s`z >= H AND horizontal_conflict?(vect2(s), vect2(vgs)) IMPLIES
       Theta_D[D](vect2(s), vect2(vgs), 1) /= 0;


decl_type: formula
theory: vs_circle
library: ACCoRD
signature: nil
location: 53 2 56 46
body:
    vs_circle_meets_vertical_criterion: LEMMA
      horizontal_conflict?(sp,vo-vi) AND
      vs_circle?(sp,vo,vi,eps)(nvo) IMPLIES
      vertical_criterion?(eps)(sp,vo-vi)(nvo-vi)


decl_type: formula
theory: vs_circle
library: ACCoRD
signature: nil
location: 58 2 62 42
body:
    vs_only_vs_criterion_ge_vz: LEMMA
      vertical_criterion?(eps)(s,v)(nvo1-vi) AND  
      vs_only?(nvo1)(nvo2) AND
      eps*nvo2`z >= eps*nvo1`z IMPLIES
      vertical_criterion?(eps)(s,v)(nvo2-vi)


decl_type: formula
theory: vs_circle
library: ACCoRD
signature: nil
location: 68 2 72 30
body:
    vs_circle_independence : THEOREM
      horizontal_conflict?(sp,vo-vi) AND
      vs_circle?(sp,vo,vi,eps)(nvo) 
      IMPLIES
        NOT conflict?(sp,nvo-vi)


decl_type: formula
theory: vs_circle
library: ACCoRD
signature: nil
location: 78 2 83 31
body:
    vs_circle_coordination : THEOREM
      conflict?(sp,vo-vi) AND
      vs_circle?(sp,vo,vi,eps)(nvo) AND
      vs_circle?(-sp,vi,vo,-eps)(nvi)
      IMPLIES
        NOT conflict?(sp,nvo-nvi)


decl_type: function
theory: vs_circle
library: ACCoRD
location: 31 2 40 9
signature:
  [d: [Vect3, Nzv2_vect3, Nzv2_vect3, Sign] ->
          {nvo | vect2(nvo) /= zero IMPLIES vs_only?(d`2)(nvo)}]

body:
    vs_circle(s,vo,vi,eps) : {nvo | nz_vect2?(nvo) IMPLIES vs_only?(vo)(nvo)} =
      LET v = vo-vi IN
      IF zero_vect2?(v) AND eps=sign(s`z) THEN vo WITH [z:=vi`z]
      ELSIF Delta(s,v) > 0 THEN
         LET (res,vz) = vs_only(s,v,Theta_D(s,v,Exit),eps) IN
         IF res THEN vo WITH [z := vi`z+vz]
         ELSE zero
         ENDIF
      ELSE zero
      ENDIF


decl_type: tcc
theory: vs_circle
library: ACCoRD
signature: nil
location: 90 0 96 999
body:
  % Subtype TCC generated (at line 33, column 45) for  vo WITH [z := vi`z]
      % expected type  {nvo | vect2(nvo) /= zero IMPLIES vs_only?(vo)(nvo)}
  vs_circle_TCC1: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, eps: Sign, v: Vect3):
      vect2(v) = zero AND eps = sign(s`z) AND v = vo - vi IMPLIES
       vect2((vo WITH [z := vi`z])) /= zero IMPLIES
        vs_only?(vo)((vo WITH [z := vi`z]));


decl_type: tcc
theory: vs_circle
library: ACCoRD
signature: nil
location: 98 0 104 999
body:
  % Subtype TCC generated (at line 35, column 44) for  vect2(v)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  vs_circle_TCC2: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, eps: Sign, v: Vect3):
      Delta(vect2(s), vect2(v)) > 0 AND
       NOT (vect2(v) = zero AND eps = sign(s`z)) AND v = vo - vi
       IMPLIES vect2(v) /= zero AND Delta[D](vect2(s), vect2(v)) >= 0;


decl_type: tcc
theory: vs_circle
library: ACCoRD
signature: nil
location: 106 0 121 999
body:
  % Subtype TCC generated (at line 36, column 19) for
      % vo WITH [z := vi`z + vz]
      % expected type  {nvo | vect2(nvo) /= zero IMPLIES vs_only?(vo)(nvo)}
  vs_circle_TCC3: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, eps: Sign, v: Vect3):
      Delta(vect2(s), vect2(v)) > 0 AND
       NOT (vect2(v) = zero AND eps = sign(s`z)) AND v = vo - vi
       IMPLIES
       (FORALL (res: bool, vz: real):
          res AND
           vz = vs_only(s, vect2(v), Theta_D(vect2(s), vect2(v), 1), eps)`2
            AND
            res = vs_only(s, vect2(v), Theta_D(vect2(s), vect2(v), 1), eps)`1
           IMPLIES
           vect2((vo WITH [z := vi`z + vz])) /= zero IMPLIES
            vs_only?(vo)((vo WITH [z := vi`z + vz])));


decl_type: tcc
theory: vs_circle
library: ACCoRD
signature: nil
location: 123 0 135 999
body:
  % Subtype TCC generated (at line 37, column 12) for  zero
      % expected type  {nvo | vect2(nvo) /= zero IMPLIES vs_only?(vo)(nvo)}
  vs_circle_TCC4: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, eps: Sign, v: Vect3):
      Delta(vect2(s), vect2(v)) > 0 AND
       NOT (vect2(v) = zero AND eps = sign(s`z)) AND v = vo - vi
       IMPLIES
       (FORALL (res: bool, vz: real):
          NOT res AND
           vz = vs_only(s, vect2(v), Theta_D(vect2(s), vect2(v), 1), eps)`2
            AND
            res = vs_only(s, vect2(v), Theta_D(vect2(s), vect2(v), 1), eps)`1
           IMPLIES vect2(zero) /= zero IMPLIES vs_only?(vo)(zero));


decl_type: tcc
theory: vs_circle
library: ACCoRD
signature: nil
location: 137 0 143 999
body:
  % Subtype TCC generated (at line 39, column 9) for  zero
      % expected type  {nvo | vect2(nvo) /= zero IMPLIES vs_only?(vo)(nvo)}
  vs_circle_TCC5: OBLIGATION
    FORALL (s: Vect3, vo: Nzv2_vect3, vi: Nzv2_vect3, eps: Sign, v: Vect3):
      NOT Delta(vect2(s), vect2(v)) > 0 AND
       NOT (vect2(v) = zero AND eps = sign(s`z)) AND v = vo - vi
       IMPLIES vect2(zero) /= zero IMPLIES vs_only?(vo)(zero);


decl_type: formula
theory: vertical_cr
library: ACCoRD
signature: nil
location: 29 2 31 31
body:
    hor_circle_horizontal_only : LEMMA
      hor_circle?(sp,vo,vi,epsh,epsv)(nvo) IMPLIES
        horizontal_only?(vo)(nvo)


decl_type: formula
theory: vertical_cr
library: ACCoRD
signature: nil
location: 37 2 41 49
body:
    vertical_cr_meets_vertical_criterion: THEOREM
      horizontal_conflict?(sp,vo-vi) AND
      vertical_cr?(sp,vo,vi,epsh,epsv)(nvo)
      IMPLIES 
        vertical_criterion?(epsv)(sp,vo-vi)(nvo-vi)


decl_type: formula
theory: vertical_cr
library: ACCoRD
signature: nil
location: 43 2 47 44
body:
    hor_circle_meets_horizontal_criterion: THEOREM
      horizontal_sep?(sp) AND
      hor_circle?(sp,vo,vi,epsh,epsv)(nvo)
      IMPLIES 
        horizontal_criterion?(sp,epsh)(nvo-vo)


decl_type: function
theory: vertical_cr
library: ACCoRD
signature:
  [[Sp_vect3[D, H], Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
  [Vect3 -> bool]]

location: 24 2 27 42
body:
    hor_circle?(sp,vo,vi,epsh,epsv)(nvo) : bool =
      gs_vertical?(sp,vo,vi,epsh,epsv)(nvo) OR
      trk_vertical?(sp,vo,vi,epsh,epsv)(nvo) OR
      opt_vertical?(sp,vo,vi,epsh,epsv)(nvo)


decl_type: function
theory: vertical_cr
library: ACCoRD
signature:
  [[Sp_vect3[D, H], Nzv2_vect3, Nzv2_vect3, Sign, Sign] ->
  [Vect3 -> bool]]

location: 33 2 35 40
body:
    vertical_cr?(sp,vo,vi,epsh,epsv)(nvo) : bool = 
      vs_circle?(sp,vo,vi,epsv)(nvo) OR
      hor_circle?(sp,vo,vi,epsh,epsv)(nvo)


decl_type: formula
theory: opt_line
library: ACCoRD
signature: nil
location: 44 2 47 34
body:
    opt_line_eps_tangent_line: LEMMA 
      opt_line_eps?(sp,vo,vi,eps)(nvo) 
      IMPLIES
        tangent_line?(sp,nvo-vi,eps)  


decl_type: formula
theory: opt_line
library: ACCoRD
signature: nil
location: 49 2 52 35
body:
    opt_line_is_line_solution: LEMMA 
      opt_line_eps?(sp,vo,vi,eps)(nvo) 
      IMPLIES
        line_solution?(sp,nvo-vi,eps)              


decl_type: function
theory: opt_line
library: ACCoRD
location: 26 2 33 9
signature:
  [d: [Sp_vect2[D], Vect2, Vect2, Sign] ->
          {nvo: Vect2 |
                   nvo /= zero =>
                    optimal?(d`2, tangent_line(d`1, d`4))(nvo)}]

body:
    opt_line_eps(sp,vo,vi,eps): {nvo:Vect2 | nz_vect2?(nvo) => 
                                             optimal?(vo,tangent_line(sp,eps))(nvo)} =
      LET (k,nvo) = opt_trk_gs_line(tangent_line(sp,eps),vo,vi) IN
      IF k >= 0 THEN
        nvo
      ELSE
        zero 
      ENDIF


decl_type: function
theory: opt_line
library: ACCoRD
signature: [[Sp_vect2[D], Vect2, Vect2, Sign] -> [Vect2 -> bool]]
location: 36 2 38 36
body:
    opt_line_eps?(sp,vo,vi,eps)(nvo) : bool =
      nz_vect2?(nvo) AND
      nvo = opt_line_eps(sp,vo,vi,eps)


decl_type: tcc
theory: opt_line
library: ACCoRD
signature: nil
location: 59 0 69 999
body:
  % Subtype TCC generated (at line 30, column 6) for  nvo
      % expected type  {nvo: Vect2 |
                     %          nvo /= zero =>
                     %           optimal?(vo, tangent_line(sp, eps))(nvo)}
  opt_line_eps_TCC1: OBLIGATION
    FORALL (sp: Sp_vect2[D], vo: Vect2, vi: Vect2, eps: Sign, k: real,
            nvo: (optimal?(vo, tangent_line[D](sp, eps)))):
      k >= 0 AND
       nvo = opt_trk_gs_line(tangent_line(sp, eps), vo, vi)`2 AND
        k = opt_trk_gs_line(tangent_line(sp, eps), vo, vi)`1
       IMPLIES nvo /= zero => optimal?(vo, tangent_line[D](sp, eps))(nvo);


decl_type: tcc
theory: opt_line
library: ACCoRD
signature: nil
location: 71 0 81 999
body:
  % Subtype TCC generated (at line 32, column 6) for  zero
      % expected type  {nvo: Vect2 |
                     %          nvo /= zero =>
                     %           optimal?(vo, tangent_line(sp, eps))(nvo)}
  opt_line_eps_TCC2: OBLIGATION
    FORALL (sp: Sp_vect2[D], vo: Vect2, vi: Vect2, eps: Sign, k: real,
            nvo: (optimal?(vo, tangent_line[D](sp, eps)))):
      NOT k >= 0 AND
       nvo = opt_trk_gs_line(tangent_line(sp, eps), vo, vi)`2 AND
        k = opt_trk_gs_line(tangent_line(sp, eps), vo, vi)`1
       IMPLIES zero /= zero => optimal?(vo, tangent_line[D](sp, eps))(zero);


decl_type: formula
theory: horizontal_cr
library: ACCoRD
signature: nil
location: 33 2 36 35
body:
    horizontal_cr_is_line_solution: THEOREM
      horizontal_cr?(sp,vo,vi,eps)(nvo)
      IMPLIES 
        line_solution?(sp,nvo-vi,eps)


decl_type: function
theory: horizontal_cr
library: ACCoRD
signature: [[Sp_vect2[D], Vect2, Vect2, Sign] -> [Vect2 -> bool]]
location: 24 2 27 36
body:
    horizontal_cr?(sp,vo,vi,eps)(nvo) : bool =
      gs_line_eps?(sp,vo,vi,eps)(nvo) OR
      trk_line_eps?(sp,vo,vi,eps)(nvo) OR
      opt_line_eps?(sp,vo,vi,eps)(nvo) 


decl_type: formula
theory: cr3d
library: ACCoRD
signature: nil
location: 25 2 28 63
body:
    cr_satifies_criterion_3D : THEOREM
      conflict?(sp,vo-vi) AND
      cr?(sp,vo,vi,hst,vst)(nvo) IMPLIES
      criterion_3D?(sp,vo-vi,hst(sp,vo-vi),vst(sp,vo-vi))(nvo-vi)


decl_type: formula
theory: cr3d
library: ACCoRD
signature: nil
location: 33 2 36 107
body:
    cr3d_satifies_criterion_3D : THEOREM
      conflict?(sp,vo-vi) AND
      cr3d?(sp,vo,vi)(nvo) IMPLIES
      criterion_3D?(sp,vo-vi,horizontalCoordination(sp,vo-vi),verticalCoordinationConflict(sp,vo-vi))(nvo-vi)


decl_type: formula
theory: cr3d
library: ACCoRD
signature: nil
location: 42 2 46 30
body:
    cr_independence: THEOREM
      conflict?(sp,vo-vi) AND
      cr?(sp,vo,vi,hst,vst)(nvo)
      IMPLIES 
        NOT conflict?(sp,nvo-vi)


decl_type: formula
theory: cr3d
library: ACCoRD
signature: nil
location: 48 2 52 30
body:
    cr3d_independence: THEOREM
      conflict?(sp,vo-vi) AND
      cr3d?(sp,vo,vi)(nvo)
      IMPLIES 
        NOT conflict?(sp,nvo-vi)


decl_type: formula
theory: cr3d
library: ACCoRD
signature: nil
location: 58 2 63 31
body:
    cr_coordination: THEOREM
      conflict?(sp,vo-vi) AND
      cr?(sp,vo,vi,hst,vst)(nvo) AND
      cr?(-sp,vi,vo,hst,vst)(nvi)
      IMPLIES 
        NOT conflict?(sp,nvo-nvi)


decl_type: formula
theory: cr3d
library: ACCoRD
signature: nil
location: 65 2 70 31
body:
    cr3d_coordination: THEOREM
      conflict?(sp,vo-vi) AND
      cr3d?(sp,vo,vi)(nvo) AND
      cr3d?(-sp,vi,vo)(nvi)
      IMPLIES 
        NOT conflict?(sp,nvo-nvi)


decl_type: function
theory: cr3d
library: ACCoRD
location: 21 2 23 59
signature:
  [[Sp_vect3[D, H], Nzv2_vect3, Nzv2_vect3, Horizontal_Strategy,
         Vertical_Strategy[D, H]] ->
          [Vect3 -> bool]]

body:
    cr?(sp,vo,vi,hst,vst)(nvo) : bool =
      horizontal_sep?(sp) AND horizontal_cr?(sp,vo,vi,hst(sp,vo-vi))(nvo) OR
      vertical_cr?(sp,vo,vi,hst(sp,vo-vi),vst(sp,vo-vi))(nvo)


decl_type: function
theory: cr3d
library: ACCoRD
signature: [[Sp_vect3[D, H], Nzv2_vect3, Nzv2_vect3] -> [Vect3 -> bool]]
location: 30 2 31 74
body:
    cr3d?(sp,vo,vi)(nvo) : bool =
      cr?(sp,vo,vi,horizontalCoordination,verticalCoordinationConflict)(nvo)


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 25 0 26 109
body:
  cyl_norm_sq_diff_cont: LEMMA
                         continuous?(LAMBDA (t:real): (sqv(vect2(s) + t*vect2(v))/sq(D) - sq(s`z+t*v`z)/sq(H)),fullset[real])


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 28 0 29 128
body:
  cyl_norm_sq_IVT1: LEMMA cyl_norm_sq(s+t1*v) = sqv(vect2(s)+t1*vect2(v))/sq(D) AND cyl_norm_sq(s+t2*v) /= sqv(vect2(s)+t2*vect2(v))/sq(D)
                    IMPLIES (EXISTS (t:real): ((t1<=t AND t<=t2) OR (t2<=t AND t<=t1)) AND sqv(vect2(s)+t*vect2(v))/sq(D) = sq(s`z+t*v`z)/sq(H))


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 31 0 32 128
body:
  cyl_norm_sq_IVT2: LEMMA cyl_norm_sq(s+t1*v) = sq(s`z+t1*v`z)/sq(H) AND cyl_norm_sq(s+t2*v) /= sq(s`z+t2*v`z)/sq(H)
                    IMPLIES (EXISTS (t:real): ((t1<=t AND t<=t2) OR (t2<=t AND t<=t1)) AND sqv(vect2(s)+t*vect2(v))/sq(D) = sq(s`z+t*v`z)/sq(H))


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 40 0 40 174
body:
  cyl_norm_min_exists: LEMMA B1<=B2 IMPLIES (EXISTS (t:real): B1<=t AND t<=B2 AND (FORALL (r:real): B1<=r AND r<=B2 IMPLIES cyl_norm_sq_fun(s,v)(r) >= cyl_norm_sq_fun(s,v)(t)))


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 42 0 42 126
body:
  cyl_norm_min_exists_inf: LEMMA EXISTS (tz: nnreal): FORALL (nnt:nnreal): cyl_norm_sq_fun(s,v)(nnt) >= cyl_norm_sq_fun(s,v)(tz)


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 84 0 85 64
body:
  cyl_intersect_time_lt: LEMMA
                         cyl_intersect_time(s,v,-1) <= cyl_intersect_time(s,v,1)


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 87 0 91 55
body:
  cyl_intersect_time_id : LEMMA
                        (EXISTS (t1:real): sqv(vect2(s+t1*v))/sq(D) /= sq((s+t1*v)`z)/sq(H))
                        AND
                        sqv(vect2(s + t*v))/sq(D) = sq((s+t*v)`z)/sq(H) IMPLIES
                        (EXISTS (eps): t = cyl_intersect_time(s,v,eps))


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 108 0 110 57
body:
  tca_3D_id : LEMMA nnt = 0 OR (vect2(v) /= zero AND nnt = -(vect2(s)*vect2(v))/sqv(vect2(v))) OR (v`z /= 0 AND nnt = -(s`z*v`z)/sq(v`z))
            OR sqv(vect2(s+nnt*v))/sq(D) = sq((s+nnt*v)`z)/sq(H) IMPLIES
            cyl_norm_sq(s + nnt*v) >= cyl_norm_sq(s+tca_3D(s,v)*v)


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 112 0 113 67
body:
  tca_3D_vect2_zero: LEMMA vect2(v)=zero AND cyl_norm_sq_fun(s,v)(nnt) = sqv(vect2(s+nnt*v))/sq(D) IMPLIES
                     cyl_norm_sq_fun(s,v)(nnt) >= cyl_norm_sq_fun(s,v)(tca_3D(s,v))


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 115 0 116 67
body:
  tca_3D_vz_zero: LEMMA v`z=0 AND cyl_norm_sq_fun(s,v)(nnt) = sq((s+nnt*v)`z)/sq(H) IMPLIES
                     cyl_norm_sq_fun(s,v)(nnt) >= cyl_norm_sq_fun(s,v)(tca_3D(s,v))


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 127 0 128 54
body:
  tca_3D_left_decreasing: LEMMA nnt<=pt AND pt<=tca_3D(s,v) IMPLIES
                          cyl_norm_sq_fun(s,v)(nnt)>=cyl_norm_sq_fun(s,v)(pt)


decl_type: formula
theory: tca_3D
library: ACCoRD
signature: nil
location: 130 0 131 54
body:
  tca_3D_right_increasing: LEMMA tca_3D(s,v)<=nnt AND nnt<=pt IMPLIES
                          cyl_norm_sq_fun(s,v)(nnt)<=cyl_norm_sq_fun(s,v)(pt)


decl_type: function
theory: tca_3D
library: ACCoRD
location: 53 0 55 25
signature:
  [d: [Min_Info, Min_Info] ->
          {MI: Min_Info |
                   (MI = d`1 OR MI = d`2) AND
                    MI`min_dist <= d`1`min_dist AND
                     MI`min_dist <= d`2`min_dist}]

body:
  minimum_info(MI1,MI2): {MI : Min_Info | (MI = MI1 OR MI = MI2) AND MI`min_dist <= MI1`min_dist AND MI`min_dist <= MI2`min_dist}
                         = IF MI1`min_dist <= MI2`min_dist THEN MI1
                           ELSE MI2 ENDIF


decl_type: function
theory: tca_3D
library: ACCoRD
location: 57 0 62 9
signature:
  [d: [Vect3, Vect3] ->
          {MI: Min_Info |
                   MI`min_dist <= info(d`1, d`2, 0)`min_dist AND
                    (vect2(d`2) /= zero AND
                      horizontal_tca(vect2(d`1), vect2(d`2)) >= 0
                      IMPLIES
                      MI`min_dist <=
                       info(d`1, d`2,
                            horizontal_tca(vect2(d`1),
                                           vect2(d`2)))`min_dist)}]

body:
  horizontal_min_info(s,v) : {MI : Min_Info | MI`min_dist <= info(s,v,0)`min_dist AND 
                                            (vect2(v) /= zero AND horizontal_tca(s,v)>=0 IMPLIES MI`min_dist<=info(s,v,horizontal_tca(s,v))`min_dist)}=
                           IF vect2(v) = zero OR (vect2(v) /= zero AND horizontal_tca(s,v) <= 0) THEN
                              info(s,v,0)
                           ELSE minimum_info(info(s,v,horizontal_tca(s,v)),info(s,v,0))
                           ENDIF


decl_type: function
theory: tca_3D
library: ACCoRD
location: 64 0 71 9
signature:
  [d: [Vect3, Vect3] ->
          {MI: Min_Info |
                   MI`min_dist <= info(d`1, d`2, 0)`min_dist AND
                    (vect2(d`2) /= zero AND
                      horizontal_tca(vect2(d`1), vect2(d`2)) >= 0
                      IMPLIES
                      MI`min_dist <=
                       info(d`1, d`2,
                            horizontal_tca(vect2(d`1),
                                           vect2(d`2)))`min_dist)
                     AND
                     (d`2`z /= 0 AND -d`1`z / d`2`z >= 0 IMPLIES
                       MI`min_dist <=
                        info(d`1, d`2, -d`1`z / d`2`z)`min_dist)}]

body:
  horiz_vert_min_info(s,v) : {MI : Min_Info | MI`min_dist <= info(s,v,0)`min_dist AND 
                                            (vect2(v) /= zero AND horizontal_tca(s,v)>=0 IMPLIES MI`min_dist<=info(s,v,horizontal_tca(s,v))`min_dist)
                                            AND (v`z/=0 AND -s`z/v`z>=0 IMPLIES MI`min_dist <= info(s,v,-s`z/v`z)`min_dist)} =
                           IF v`z = 0 OR (v`z /= 0 AND -s`z/v`z <= 0) THEN
                              horizontal_min_info(s,v)
                           ELSE
                                  minimum_info(horizontal_min_info(s,v),info(s,v,-s`z/v`z))
                           ENDIF


decl_type: function
theory: tca_3D
library: ACCoRD
signature: [[Vect3, Vect3, Sign] -> real]
location: 73 0 82 40
body:
  cyl_intersect_time(s,v,eps) : real = 
                          LET
                                  a = sqv(vect2(v))/sq(D) - sq(v`z)/sq(H),
                                  b = vect2(s)*vect2(v)/sq(D) - s`z*v`z/sq(H),
                                  c = sqv(vect2(s))/sq(D) - sq(s`z)/sq(H)
                          IN
                                  IF a = 0 AND b = 0 THEN 0
                                  ELSIF a = 0 THEN -c/(2*b)
                                  ELSIF discr2b(a,b,c) < 0 THEN 0
                                  ELSE root2b(a,b,c,sign(a)*eps) ENDIF % This uses sign(a)*eps instead of just eps, so that the LT lemma will prove


decl_type: function
theory: tca_3D
library: ACCoRD
location: 93 0 104 12
signature:
  [d: [Vect3, Vect3] ->
          {MI: Min_Info |
                   FORALL (eps: Sign):
                     cyl_intersect_time(d`1, d`2, eps) > 0 IMPLIES
                      MI`min_dist <=
                       info(d`1, d`2,
                            cyl_intersect_time(d`1,
                                               d`2,
                                               eps))`min_dist}]

body:
  cyl_intersect_min_info(s,v) : {MI : Min_Info | FORALL (eps:Sign): cyl_intersect_time(s,v,eps)>0 IMPLIES
                              MI`min_dist<=info(s,v,cyl_intersect_time(s,v,eps))`min_dist} =
                            LET
                              mt1 = cyl_intersect_time(s,v,-1),
                              mt2 = cyl_intersect_time(s,v,1)
                            IN
                              IF mt2 <= 0 THEN horizontal_min_info(s,v)
                              ELSIF mt1 <=0 THEN (# min_time := mt2, min_dist := cyl_norm_sq(s+mt2*v) #)
                              ELSE
                              minimum_info((# min_time := mt1, min_dist := cyl_norm_sq(s+mt1*v) #),
                                              (# min_time := mt2, min_dist := cyl_norm_sq(s+mt2*v) #))
                              ENDIF


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 145 0 149 999
body:
  % Assuming TCC generated (at line 13, column 5) for
      % analysis@metric_space_real_fun[real, real_dist]
      % generated from assumption metric_space_real_fun.fullset_metric_space
  IMP_metric_space_real_fun_TCC1: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 151 0 159 999
body:
  % Subtype TCC generated (at line 54, column 48) for  MI1
      % expected type  {MI: Min_Info |
                     %          (MI = MI1 OR MI = MI2) AND
                     %           MI`min_dist <= MI1`min_dist AND
                     %            MI`min_dist <= MI2`min_dist}
  minimum_info_TCC1: OBLIGATION
    FORALL (MI1: Min_Info, MI2: Min_Info):
      MI1`min_dist <= MI2`min_dist IMPLIES
       MI1`min_dist <= MI1`min_dist AND MI1`min_dist <= MI2`min_dist;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 161 0 169 999
body:
  % Subtype TCC generated (at line 55, column 16) for  MI2
      % expected type  {MI: Min_Info |
                     %          (MI = MI1 OR MI = MI2) AND
                     %           MI`min_dist <= MI1`min_dist AND
                     %            MI`min_dist <= MI2`min_dist}
  minimum_info_TCC2: OBLIGATION
    FORALL (MI1: Min_Info, MI2: Min_Info):
      NOT MI1`min_dist <= MI2`min_dist IMPLIES
       MI2`min_dist <= MI1`min_dist AND MI2`min_dist <= MI2`min_dist;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 171 0 190 999
body:
  % Subtype TCC generated (at line 60, column 7) for  info(s, v, 0)
      % expected type  {MI: Min_Info |
                     %          MI`min_dist <= info(s, v, 0)`min_dist AND
                     %           (vect2(v) /= zero AND
                     %             horizontal_tca(vect2(s), vect2(v)) >= 0
                     %             IMPLIES
                     %             MI`min_dist <=
                     %              info(s,
                     %                   v,
                     %                   horizontal_tca
                     %                   (vect2(s), vect2(v)))`min_dist)}
  horizontal_min_info_TCC1: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      vect2(v) = zero OR
       (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) <= 0)
       IMPLIES
       info(s, v, 0)`min_dist <= info(s, v, 0)`min_dist AND
        (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) >= 0 IMPLIES
          info(s, v, 0)`min_dist <=
           info(s, v, horizontal_tca(vect2(s), vect2(v)))`min_dist);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 192 0 198 999
body:
  % Subtype TCC generated (at line 61, column 48) for  vect2(v)
      % expected type  Nz_vect2
  horizontal_min_info_TCC2: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      NOT vect2(v) = zero AND
       NOT (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) <= 0)
       IMPLIES vect2(v) /= zero;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 200 0 207 999
body:
  % Subtype TCC generated (at line 61, column 31) for
      % horizontal_tca(vect2(s), vect2(v))
      % expected type  nnreal
  horizontal_min_info_TCC3: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      NOT vect2(v) = zero AND
       NOT (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) <= 0)
       IMPLIES horizontal_tca(vect2(s), vect2(v)) >= 0;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 209 0 234 999
body:
  % Subtype TCC generated (at line 61, column 9) for
      % minimum_info(info(s, v, horizontal_tca(vect2(s), vect2(v))),
      %              info(s, v, 0))
      % expected type  {MI: Min_Info |
                     %          MI`min_dist <= info(s, v, 0)`min_dist AND
                     %           (vect2(v) /= zero AND
                     %             horizontal_tca(vect2(s), vect2(v)) >= 0
                     %             IMPLIES
                     %             MI`min_dist <=
                     %              info(s,
                     %                   v,
                     %                   horizontal_tca
                     %                   (vect2(s), vect2(v)))`min_dist)}
  horizontal_min_info_TCC4: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      NOT vect2(v) = zero AND
       NOT (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) <= 0)
       IMPLIES
       minimum_info(info(s, v, horizontal_tca(vect2(s), vect2(v))),
                    info(s, v, 0))`min_dist
        <= info(s, v, 0)`min_dist
        AND
        (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) >= 0 IMPLIES
          minimum_info(info(s, v, horizontal_tca(vect2(s), vect2(v))),
                       info(s, v, 0))`min_dist
           <= info(s, v, horizontal_tca(vect2(s), vect2(v)))`min_dist);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 236 0 262 999
body:
  % Subtype TCC generated (at line 68, column 7) for
      % horizontal_min_info(s, v)
      % expected type  {MI: Min_Info |
                     %          MI`min_dist <= info(s, v, 0)`min_dist AND
                     %           (vect2(v) /= zero AND
                     %             horizontal_tca(vect2(s), vect2(v)) >= 0
                     %             IMPLIES
                     %             MI`min_dist <=
                     %              info(s,
                     %                   v,
                     %                   horizontal_tca
                     %                   (vect2(s), vect2(v)))`min_dist)
                     %            AND
                     %            (v`z /= 0 AND -s`z / v`z >= 0 IMPLIES
                     %              MI`min_dist <=
                     %               info(s, v, -s`z / v`z)`min_dist)}
  horiz_vert_min_info_TCC1: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      v`z = 0 OR (v`z /= 0 AND -s`z / v`z <= 0) IMPLIES
       horizontal_min_info(s, v)`min_dist <= info(s, v, 0)`min_dist AND
        (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) >= 0 IMPLIES
          horizontal_min_info(s, v)`min_dist <=
           info(s, v, horizontal_tca(vect2(s), vect2(v)))`min_dist)
         AND
         (v`z /= 0 AND -s`z / v`z >= 0 IMPLIES
           horizontal_min_info(s, v)`min_dist <=
            info(s, v, -s`z / v`z)`min_dist);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 264 0 268 999
body:
  % Subtype TCC generated (at line 70, column 56) for  v`z
      % expected type  nznum
  horiz_vert_min_info_TCC2: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      NOT v`z = 0 AND NOT (v`z /= 0 AND -s`z / v`z <= 0) IMPLIES v`z /= 0;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 270 0 275 999
body:
  % Subtype TCC generated (at line 70, column 51) for  -s`z / v`z
      % expected type  nnreal
  horiz_vert_min_info_TCC3: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      NOT v`z = 0 AND NOT (v`z /= 0 AND -s`z / v`z <= 0) IMPLIES
       -s`z / v`z >= 0;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 277 0 308 999
body:
  % Subtype TCC generated (at line 70, column 4) for
      % minimum_info(horizontal_min_info(s, v), info(s, v, -s`z / v`z))
      % expected type  {MI: Min_Info |
                     %          MI`min_dist <= info(s, v, 0)`min_dist AND
                     %           (vect2(v) /= zero AND
                     %             horizontal_tca(vect2(s), vect2(v)) >= 0
                     %             IMPLIES
                     %             MI`min_dist <=
                     %              info(s,
                     %                   v,
                     %                   horizontal_tca
                     %                   (vect2(s), vect2(v)))`min_dist)
                     %            AND
                     %            (v`z /= 0 AND -s`z / v`z >= 0 IMPLIES
                     %              MI`min_dist <=
                     %               info(s, v, -s`z / v`z)`min_dist)}
  horiz_vert_min_info_TCC4: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      NOT v`z = 0 AND NOT (v`z /= 0 AND -s`z / v`z <= 0) IMPLIES
       minimum_info(horizontal_min_info(s, v),
                    info(s, v, -s`z / v`z))`min_dist
        <= info(s, v, 0)`min_dist
        AND
        (vect2(v) /= zero AND horizontal_tca(vect2(s), vect2(v)) >= 0 IMPLIES
          minimum_info(horizontal_min_info(s, v),
                       info(s, v, -s`z / v`z))`min_dist
           <= info(s, v, horizontal_tca(vect2(s), vect2(v)))`min_dist)
         AND
         (v`z /= 0 AND -s`z / v`z >= 0 IMPLIES
           minimum_info(horizontal_min_info(s, v),
                        info(s, v, -s`z / v`z))`min_dist
            <= info(s, v, -s`z / v`z)`min_dist);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 310 0 321 999
body:
  % Subtype TCC generated (at line 80, column 25) for  (2 * b)
      % expected type  nznum
  cyl_intersect_time_TCC1: OBLIGATION
    FORALL (s: Vect3, v: Vect3, a: real):
      a = sqv(vect2(v)) / sq(D) - sq(v`z) / sq(H) IMPLIES
       (FORALL (b: real):
          b = vect2(s) * vect2(v) / sq(D) - s`z * v`z / sq(H) IMPLIES
           (FORALL (c: real):
              a = 0 AND
               NOT (a = 0 AND b = 0) AND
                c = sqv(vect2(s)) / sq(D) - sq(s`z) / sq(H)
               IMPLIES (2 * b) /= 0));


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 323 0 334 999
body:
  % Subtype TCC generated (at line 81, column 18) for  a
      % expected type  nzreal
  cyl_intersect_time_TCC2: OBLIGATION
    FORALL (s: Vect3, v: Vect3, a: real):
      a = sqv(vect2(v)) / sq(D) - sq(v`z) / sq(H) IMPLIES
       (FORALL (b: real):
          b = vect2(s) * vect2(v) / sq(D) - s`z * v`z / sq(H) IMPLIES
           (FORALL (c: real):
              NOT a = 0 AND
               NOT (a = 0 AND b = 0) AND
                c = sqv(vect2(s)) / sq(D) - sq(s`z) / sq(H)
               IMPLIES a /= 0));


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 336 0 348 999
body:
  % Subtype TCC generated (at line 82, column 20) for  c
      % expected type  {c: real | discr2b(a, b, c) >= 0}
  cyl_intersect_time_TCC3: OBLIGATION
    FORALL (s: Vect3, v: Vect3, a: real):
      a = sqv(vect2(v)) / sq(D) - sq(v`z) / sq(H) IMPLIES
       (FORALL (b: real):
          b = vect2(s) * vect2(v) / sq(D) - s`z * v`z / sq(H) IMPLIES
           (FORALL (c: real):
              NOT discr2b(a, b, c) < 0 AND
               NOT a = 0 AND
                NOT (a = 0 AND b = 0) AND
                 c = sqv(vect2(s)) / sq(D) - sq(s`z) / sq(H)
               IMPLIES discr2b(a, b, c) >= 0));


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 350 0 356 999
body:
  % Subtype TCC generated (at line 94, column 29) for
      % cyl_intersect_time(s, v, eps)
      % expected type  nnreal
  cyl_intersect_min_info_TCC1: OBLIGATION
    FORALL (s, v, eps: Sign):
      cyl_intersect_time(s, v, eps) > 0 IMPLIES
       cyl_intersect_time(s, v, eps) >= 0;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 358 0 376 999
body:
  % Subtype TCC generated (at line 99, column 24) for
      % horizontal_min_info(s, v)
      % expected type  {MI: Min_Info |
                     %          FORALL (eps: Sign):
                     %            cyl_intersect_time(s, v, eps) > 0 IMPLIES
                     %             MI`min_dist <=
                     %              info(s,
                     %                   v,
                     %                   cyl_intersect_time
                     %                   (s, v, eps))`min_dist}
  cyl_intersect_min_info_TCC2: OBLIGATION
    FORALL (s, v: Vect3, mt1: real):
      mt1 = cyl_intersect_time(s, v, -1) IMPLIES
       (FORALL (mt2: real):
          mt2 <= 0 AND mt2 = cyl_intersect_time(s, v, 1) IMPLIES
           (FORALL (eps: Sign):
              cyl_intersect_time(s, v, eps) > 0 IMPLIES
               horizontal_min_info(s, v)`min_dist <=
                info(s, v, cyl_intersect_time(s, v, eps))`min_dist));


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 378 0 385 999
body:
  % Subtype TCC generated (at line 100, column 41) for  mt2
      % expected type  nnreal
  cyl_intersect_min_info_TCC3: OBLIGATION
    FORALL (s, v: Vect3, mt1: real):
      mt1 = cyl_intersect_time(s, v, -1) IMPLIES
       (FORALL (mt2: real):
          mt1 <= 0 AND NOT mt2 <= 0 AND mt2 = cyl_intersect_time(s, v, 1)
           IMPLIES mt2 >= 0);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 387 0 406 999
body:
  % Subtype TCC generated (at line 100, column 26) for
      % (# min_time := mt2, min_dist := cyl_norm_sq(s + mt2 * v) #)
      % expected type  {MI: Min_Info |
                     %          FORALL (eps: Sign):
                     %            cyl_intersect_time(s, v, eps) > 0 IMPLIES
                     %             MI`min_dist <=
                     %              info(s,
                     %                   v,
                     %                   cyl_intersect_time
                     %                   (s, v, eps))`min_dist}
  cyl_intersect_min_info_TCC4: OBLIGATION
    FORALL (s, v: Vect3, mt1: real):
      mt1 = cyl_intersect_time(s, v, -1) IMPLIES
       (FORALL (mt2: real):
          mt1 <= 0 AND NOT mt2 <= 0 AND mt2 = cyl_intersect_time(s, v, 1)
           IMPLIES
           (FORALL (eps: Sign):
              cyl_intersect_time(s, v, eps) > 0 IMPLIES
               cyl_norm_sq(s + mt2 * v) <=
                info(s, v, cyl_intersect_time(s, v, eps))`min_dist));


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 408 0 415 999
body:
  % Subtype TCC generated (at line 102, column 35) for  mt1
      % expected type  nnreal
  cyl_intersect_min_info_TCC5: OBLIGATION
    FORALL (s, v: Vect3, mt1: real):
      mt1 = cyl_intersect_time(s, v, -1) IMPLIES
       (FORALL (mt2: real):
          NOT mt1 <= 0 AND NOT mt2 <= 0 AND mt2 = cyl_intersect_time(s, v, 1)
           IMPLIES mt1 >= 0);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 417 0 424 999
body:
  % Subtype TCC generated (at line 103, column 28) for  mt2
      % expected type  nnreal
  cyl_intersect_min_info_TCC6: OBLIGATION
    FORALL (s, v: Vect3, mt1: real):
      mt1 = cyl_intersect_time(s, v, -1) IMPLIES
       (FORALL (mt2: real):
          NOT mt1 <= 0 AND NOT mt2 <= 0 AND mt2 = cyl_intersect_time(s, v, 1)
           IMPLIES mt2 >= 0);


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 426 0 452 999
body:
  % Subtype TCC generated (at line 102, column 7) for
      % minimum_info((# min_time := mt1,
      %                 min_dist := cyl_norm_sq(s + mt1 * v) #),
      %              (# min_time := mt2,
      %                 min_dist := cyl_norm_sq(s + mt2 * v) #))
      % expected type  {MI: Min_Info |
                     %          FORALL (eps: Sign):
                     %            cyl_intersect_time(s, v, eps) > 0 IMPLIES
                     %             MI`min_dist <=
                     %              info(s,
                     %                   v,
                     %                   cyl_intersect_time
                     %                   (s, v, eps))`min_dist}
  cyl_intersect_min_info_TCC7: OBLIGATION
    FORALL (s, v: Vect3, mt1: real):
      mt1 = cyl_intersect_time(s, v, -1) IMPLIES
       (FORALL (mt2: real):
          NOT mt1 <= 0 AND NOT mt2 <= 0 AND mt2 = cyl_intersect_time(s, v, 1)
           IMPLIES
           (FORALL (eps: Sign):
              cyl_intersect_time(s, v, eps) > 0 IMPLIES
               minimum_info((# min_time := mt1,
                               min_dist := cyl_norm_sq(s + mt1 * v) #),
                            (# min_time := mt2,
                               min_dist
                                 := cyl_norm_sq(s + mt2 * v) #))`min_dist
                <= info(s, v, cyl_intersect_time(s, v, eps))`min_dist));


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 454 0 458 999
body:
  % Subtype TCC generated (at line 108, column 78) for  sqv(vect2(v))
      % expected type  nznum
  tca_3D_id_TCC1: OBLIGATION
    FORALL (nnt: nnreal, v: Vect3):
      NOT nnt = 0 AND vect2(v) /= zero IMPLIES sqv(vect2(v)) /= 0;


decl_type: tcc
theory: tca_3D
library: ACCoRD
signature: nil
location: 460 0 468 999
body:
  % Subtype TCC generated (at line 108, column 127) for  sq(v`z)
      % expected type  nznum
  tca_3D_id_TCC2: OBLIGATION
    FORALL (nnt: nnreal, s, v: Vect3):
      NOT nnt = 0 AND
       NOT (vect2(v) /= zero AND
             nnt = -(vect2(s) * vect2(v)) / sqv(vect2(v)))
        AND v`z /= 0
       IMPLIES sq(v`z) /= 0;


decl_type: function
theory: tca_3D_interval
library: ACCoRD
signature: [[Vect3, Vect3] -> Lookahead[B, T]]
location: 18 2 24 12
body:
    tca_3D_interval(s,v): Lookahead[B,T] = 
                          LET tca = tca_3D(s,v)
                          IN
                              IF B<=tca AND tca<=T THEN tca
                              ELSIF tca<B THEN B
                              ELSE T
                              ENDIF


decl_type: tcc
theory: tca_3D_interval
library: ACCoRD
signature: nil
location: 43 0 48 999
body:
  % Subtype TCC generated (at line 21, column 33) for  tca
      % expected type  Lookahead[B, T]
  tca_3D_interval_TCC1: OBLIGATION
    FORALL (s: Vect3, v: Vect3, tca: nnreal):
      B <= tca AND tca <= T AND tca = tca_3D(s, v) IMPLIES
       B <= tca AND tca <= T;


decl_type: tcc
theory: tca_3D_interval
library: ACCoRD
signature: nil
location: 50 0 55 999
body:
  % Subtype TCC generated (at line 22, column 24) for  B
      % expected type  Lookahead[B, T]
  tca_3D_interval_TCC2: OBLIGATION
    FORALL (s: Vect3, v: Vect3, tca: nnreal):
      tca < B AND NOT (B <= tca AND tca <= T) AND tca = tca_3D(s, v) IMPLIES
       B <= B AND B <= T;


decl_type: tcc
theory: tca_3D_interval
library: ACCoRD
signature: nil
location: 57 0 62 999
body:
  % Subtype TCC generated (at line 23, column 12) for  T
      % expected type  Lookahead[B, T]
  tca_3D_interval_TCC3: OBLIGATION
    FORALL (s: Vect3, v: Vect3, tca: nnreal):
      NOT tca < B AND NOT (B <= tca AND tca <= T) AND tca = tca_3D(s, v)
       IMPLIES B <= T AND T <= T;


decl_type: formula
theory: delay_3D
library: ACCoRD
signature: nil
location: 18 2 26 36
body:
    delay_conflict_free_rel: LEMMA
      nnt <= rt AND
      conflict?[D,H](s,v) AND
      (NOT conflict_3D?[D,H,0,rt](s,v)) AND
      (NOT conflict?[D,H](s + rt*v,nv))
      IMPLIES
      (NOT conflict_3D?[D,H,0,nnt](s,v))
      AND
      (NOT conflict?[D,H](s+nnt*v,nv))


decl_type: formula
theory: delay_3D
library: ACCoRD
signature: nil
location: 28 2 36 56
body:
    delay_conflict_free: LEMMA
      nnt <= rt AND
      conflict?[D,H](so-si,vo-vi) AND
      (NOT conflict_3D?[D,H,0,rt](so-si,vo-vi)) AND
      (NOT conflict?[D,H]((so+rt*vo)-(si+rt*vi),nvo-vi))
      IMPLIES
      (NOT conflict_3D?[D,H,0,nnt](so-si,vo-vi))
      AND
      (NOT conflict?[D,H]((so+nnt*vo)-(si+nnt*vi),nvo-vi))


decl_type: function
theory: cd_sphere
library: ACCoRD
signature: [[posreal, Vect3, Vect3] -> bool]
location: 23 2 26 9
body:
    cd_sphere(D,s,v): bool =
      IF   s*v < 0 THEN (sq(s*v)-sqv(v)*(sqv(s)-sq(D)) > 0)
      ELSE (sqv(s) < sq(D))
      ENDIF


decl_type: formula
theory: cd2d_inf
library: ACCoRD
signature: nil
location: 35 2 37 58
body:
    detection_2D_inf_correct : THEOREM
      LET (tin,tout) = detection_2D_inf(s,nzv) IN
       tin < t AND t < tout IMPLIES horizontal_los?(s+t*nzv)


decl_type: formula
theory: cd2d_inf
library: ACCoRD
signature: nil
location: 39 2 41 76
body:
    detection_2D_inf_complete : THEOREM
      LET (tin,tout) = detection_2D_inf(s,nzv) IN
        horizontal_los?(s+t*nzv) IMPLIES tin <= t AND t <= tout AND tin < tout


decl_type: formula
theory: cd2d_inf
library: ACCoRD
signature: nil
location: 43 2 45 46
body:
    conflict_detection_2D_inf : THEOREM
      LET (tin,tout) = detection_2D_inf(s,nzv) IN
      horizontal_conflict?(s,nzv) IFF tin < tout


decl_type: function
theory: cd2d_inf
library: ACCoRD
signature: [[Vect2, Nz_vect2] -> [nnreal, nnreal]]
location: 26 2 33 9
body:
    detection_2D_inf(s,nzv) : [nnreal,nnreal] =
      IF Delta(s,nzv) > 0 THEN
        LET tin  = Theta_D(s,nzv,Entry),
            tout = Theta_D(s,nzv,Exit) IN
          (max(tin,0),max(tout,0))
      ELSE
        (0,0)
      ENDIF


decl_type: tcc
theory: cd2d_inf
library: ACCoRD
signature: nil
location: 69 0 73 999
body:
  % Subtype TCC generated (at line 28, column 27) for  nzv
      % expected type  {nzv | Delta(s, nzv) >= 0}
  detection_2D_inf_TCC1: OBLIGATION
    FORALL (s: Vect2, nzv: Nz_vect2):
      Delta(s, nzv) > 0 IMPLIES Delta[D](s, nzv) >= 0;


decl_type: formula
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 24 2 27 83
body:
    conflict_3D_2D_inf_stable: LEMMA v`z/=0 AND max(-H-sign(v`z)*s`z,0) < H-sign(v`z)*s`z
      IMPLIES
      (conflict?(s,v) IFF 
      conflict_2D?[D*abs(v`z),max(-H-sign(v`z)*s`z,0),H-sign(v`z)*s`z](abs(v`z)*s,v))


decl_type: formula
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 31 2 32 92
body:
    conflict_on_open_interval: LEMMA conflict?(s,v) IFF
      EXISTS (topen: posreal): sqv(vect2(s)+topen*vect2(v))<sq(D) AND abs(s`z + topen*v`z) < H


decl_type: formula
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 58 2 60 55
body:
    detection_inf_correct : THEOREM
      LET (tin,tout) = detection_inf(s,nzv) IN
       tin < t AND t < tout IMPLIES conflict_at?(s,nzv,t)


decl_type: formula
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 62 2 64 73
body:
    detection_inf_complete : THEOREM
      LET (tin,tout) = detection_inf(s,nzv) IN
        conflict_at?(s,nzv,t) IMPLIES tin <= t AND t <= tout AND tin < tout


decl_type: formula
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 66 2 68 35
body:
    conflict_detection_inf : THEOREM
      LET (tin,tout) = detection_inf(s,nzv) IN
      conflict?(s,nzv) IFF tin < tout


decl_type: formula
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 83 2 90 9
body:
    cd3d_inf_rewrite: LEMMA cd3d_inf?(s,v) IFF 
      IF v`z = 0 AND abs(s`z)<H 
         THEN cd2d_inf?[D](s,v)
      ELSIF v`z /= 0 AND max(Theta_H(s`z,v`z,Entry),0) < Theta_H(s`z,v`z,Exit)
         THEN cd2d?[D,max(Theta_H(s`z,v`z,Entry),0),Theta_H(s`z,v`z,Exit)](s,v)
      ELSE
         FALSE
      ENDIF


decl_type: function
theory: cd3d_inf
library: ACCoRD
signature: [[Vect3, Nz_vect3] -> [nnreal, nnreal]]
location: 39 2 56 9
body:
    detection_inf(s,nzv) : [nnreal,nnreal] =
      IF zero_vect2?(nzv) AND horizontal_los?(s) THEN
          (max(Theta_H(s`z,nzv`z,Entry),0),max(Theta_H(s`z,nzv`z,Exit),0))
      ELSIF Delta(s,nzv) > 0 THEN
        LET td1 = Theta_D(s,nzv,Entry),
            td2 = Theta_D(s,nzv,Exit) IN
        IF nzv`z /= 0 THEN
          LET tin  = max(td1,Theta_H(s`z,nzv`z,Entry)),
              tout = min(td2,Theta_H(s`z,nzv`z,Exit)) IN      
          (max(tin,0),max(tout,0))
        ELSIF vertical_los?(s`z) THEN
          (max(td1,0),max(td2,0))
        ELSE
          (0,0)
        ENDIF
      ELSE
        (0,0)
      ENDIF


decl_type: function
theory: cd3d_inf
library: ACCoRD
signature: [[Vect3, Vect3] -> bool]
location: 74 2 81 9
body:
    cd3d_inf?(s,v) : bool =
      IF v`z = 0 AND abs(s`z)<H 
         THEN cd2d_inf?[D](s,v)
      ELSIF v`z /= 0 AND max(-H-sign(v`z)*s`z,0) < H-sign(v`z)*s`z
         THEN cd2d?[D*abs(v`z),max(-H-sign(v`z)*s`z,0),H-sign(v`z)*s`z](abs(v`z)*s,v)
      ELSE
         FALSE
      ENDIF


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 115 0 120 999
body:
  % Subtype TCC generated (at line 27, column 17) for  D * abs(v`z)
      % expected type  posreal
  conflict_3D_2D_inf_stable_TCC1: OBLIGATION
    FORALL (s, v: Vect3):
      max(-H - sign(v`z) * s`z, 0) < H - sign(v`z) * s`z AND v`z /= 0 IMPLIES
       D * abs(v`z) > 0;


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 122 0 128 999
body:
  % Subtype TCC generated (at line 27, column 28) for
      % max(-H - sign(v`z) * s`z, 0)
      % expected type  nnreal
  conflict_3D_2D_inf_stable_TCC2: OBLIGATION
    FORALL (s, v: Vect3):
      max(-H - sign(v`z) * s`z, 0) < H - sign(v`z) * s`z AND v`z /= 0 IMPLIES
       max(-H - sign(v`z) * s`z, 0) >= 0;


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 130 0 137 999
body:
  % Subtype TCC generated (at line 27, column 52) for  H - sign(v`z) * s`z
      % expected type  {AB: posreal | AB > max(-H - sign(v`z) * s`z, 0)}
  conflict_3D_2D_inf_stable_TCC3: OBLIGATION
    FORALL (s, v: Vect3):
      max(-H - sign(v`z) * s`z, 0) < H - sign(v`z) * s`z AND v`z /= 0 IMPLIES
       H - sign(v`z) * s`z >= 0 AND
        H - sign(v`z) * s`z > 0 AND
         H - sign(v`z) * s`z > max(-H - sign(v`z) * s`z, 0);


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 139 0 143 999
body:
  % Subtype TCC generated (at line 41, column 25) for  nzv`z
      % expected type  nzreal
  detection_inf_TCC1: OBLIGATION
    FORALL (s: Vect3, nzv: Nz_vect3):
      vect2(nzv) = zero AND sqv(vect2(s)) < sq(D) IMPLIES nzv`z /= 0;


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 145 0 151 999
body:
  % Subtype TCC generated (at line 41, column 9) for
      % max(Theta_H(s`z, nzv`z, -1), 0)
      % expected type  nnreal
  detection_inf_TCC2: OBLIGATION
    FORALL (s: Vect3, nzv: Nz_vect3):
      vect2(nzv) = zero AND sqv(vect2(s)) < sq(D) IMPLIES
       max(Theta_H[H](s`z, nzv`z, -1), 0) >= 0;


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 153 0 159 999
body:
  % Subtype TCC generated (at line 41, column 41) for
      % max(Theta_H(s`z, nzv`z, 1), 0)
      % expected type  nnreal
  detection_inf_TCC3: OBLIGATION
    FORALL (s: Vect3, nzv: Nz_vect3):
      vect2(nzv) = zero AND sqv(vect2(s)) < sq(D) IMPLIES
       max(Theta_H[H](s`z, nzv`z, 1), 0) >= 0;


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 161 0 167 999
body:
  % Subtype TCC generated (at line 43, column 26) for  vect2(nzv)
      % expected type  {nzv | Delta(vect2(s), nzv) >= 0}
  detection_inf_TCC4: OBLIGATION
    FORALL (s: Vect3, nzv: Nz_vect3):
      Delta(vect2(s), vect2(nzv)) > 0 AND
       NOT (vect2(nzv) = zero AND sqv(vect2(s)) < sq(D))
       IMPLIES vect2(nzv) /= zero AND Delta[D](vect2(s), vect2(nzv)) >= 0;


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 169 0 191 999
body:
  % Subtype TCC generated (at line 48, column 9) for  max(tin, 0)
      % expected type  nnreal
  detection_inf_TCC5: OBLIGATION
    FORALL (s: Vect3, nzv: Nz_vect3):
      Delta(vect2(s), vect2(nzv)) > 0 AND
       NOT (vect2(nzv) = zero AND sqv(vect2(s)) < sq(D))
       IMPLIES
       (FORALL (td1: real):
          td1 = Theta_D(vect2(s), vect2(nzv), -1) IMPLIES
           (FORALL (td2: real):
              nzv`z /= 0 AND td2 = Theta_D(vect2(s), vect2(nzv), 1) IMPLIES
               (FORALL (tin:
                          {p: real |
                                   p >= td1 AND
                                    p >= Theta_H[H](s`z, nzv`z, -1)}):
                  tin = max(td1, Theta_H(s`z, nzv`z, -1)) IMPLIES
                   (FORALL (tout:
                              {p: real |
                                       p <= td2
                                       AND
                                       p <= Theta_H[H](s`z, nzv`z, 1)}):
                      tout = min(td2, Theta_H(s`z, nzv`z, 1)) IMPLIES
                       max(tin, 0) >= 0))));


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 193 0 215 999
body:
  % Subtype TCC generated (at line 48, column 20) for  max(tout, 0)
      % expected type  nnreal
  detection_inf_TCC6: OBLIGATION
    FORALL (s: Vect3, nzv: Nz_vect3):
      Delta(vect2(s), vect2(nzv)) > 0 AND
       NOT (vect2(nzv) = zero AND sqv(vect2(s)) < sq(D))
       IMPLIES
       (FORALL (td1: real):
          td1 = Theta_D(vect2(s), vect2(nzv), -1) IMPLIES
           (FORALL (td2: real):
              nzv`z /= 0 AND td2 = Theta_D(vect2(s), vect2(nzv), 1) IMPLIES
               (FORALL (tin:
                          {p: real |
                                   p >= td1 AND
                                    p >= Theta_H[H](s`z, nzv`z, -1)}):
                  tin = max(td1, Theta_H(s`z, nzv`z, -1)) IMPLIES
                   (FORALL (tout:
                              {p: real |
                                       p <= td2
                                       AND
                                       p <= Theta_H[H](s`z, nzv`z, 1)}):
                      tout = min(td2, Theta_H(s`z, nzv`z, 1)) IMPLIES
                       max(tout, 0) >= 0))));


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 217 0 224 999
body:
  % Subtype TCC generated (at line 87, column 20) for
      % max(Theta_H(s`z, v`z, -1), 0)
      % expected type  nnreal
  cd3d_inf_rewrite_TCC1: OBLIGATION
    FORALL (s, v: Vect3):
      NOT (v`z = 0 AND abs(s`z) < H) AND
       max(Theta_H(s`z, v`z, -1), 0) < Theta_H(s`z, v`z, 1) AND v`z /= 0
       IMPLIES max(Theta_H[H](s`z, v`z, -1), 0) >= 0;


decl_type: tcc
theory: cd3d_inf
library: ACCoRD
signature: nil
location: 226 0 235 999
body:
  % Subtype TCC generated (at line 87, column 50) for  Theta_H(s`z, v`z, 1)
      % expected type  {AB: posreal | AB > max(Theta_H(s`z, v`z, -1), 0)}
  cd3d_inf_rewrite_TCC2: OBLIGATION
    FORALL (s, v: Vect3):
      NOT (v`z = 0 AND abs(s`z) < H) AND
       max(Theta_H(s`z, v`z, -1), 0) < Theta_H(s`z, v`z, 1) AND v`z /= 0
       IMPLIES
       Theta_H[H](s`z, v`z, 1) >= 0 AND
        Theta_H[H](s`z, v`z, 1) > 0 AND
         Theta_H[H](s`z, v`z, 1) > max(Theta_H[H](s`z, v`z, -1), 0);


decl_type: formula
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 13 2 15 70
body:
    horizontal_sq_dtca_diff : LEMMA
      (FORALL (a):nz_vect2?(V(a))) IMPLIES
      derivable?[real](LAMBDA (r: real): horizontal_sq_dtca(s, V(r)), r)


decl_type: formula
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 17 2 22 64
body:
    horizontal_sq_dtca_deriv : LEMMA
      (FORALL (a):nz_vect2?(V(a))) IMPLIES
      deriv(LAMBDA(r:real):horizontal_sq_dtca(s,V(r)),r) = 
      LET v = V(r),
          w = deriv_rv(V)(r) IN
      (2*sqv(v)*det(s,v)*det(s,w)-2*sq(det(s,v))*(v*w))/sq(sqv(v))


decl_type: formula
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 24 2 29 46
body:
    horizontal_sq_dtca_deriv_simpl : LEMMA
      (FORALL (a):nz_vect2?(V(a))) IMPLIES
      LET v = V(r),
          w = deriv_rv(V)(r) IN
      (2*sqv(v)*det(s,v)*det(s,w)-2*sq(det(s,v))*(v*w))/sq(sqv(v)) =
      2*det(s,v)*det(V(r),w)*(s*V(r))/sq(sqv(v))


decl_type: formula
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 31 2 38 26
body:
    horizontal_sq_dtca_deriv_sign : LEMMA 
      (FORALL (a):nz_vect2?(V(a))) AND
      line_solution?(ss,V(r)) IMPLIES
      (pm*deriv(LAMBDA(r:real):horizontal_sq_dtca(ss,V(r)),r) > 0 IFF
       LET v   = V(r),
           w   = deriv_rv(V)(r),
           eps = eps_line(ss,v) IN
       pm*(Q(ss,eps)*w) > 0) 


decl_type: tcc
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 45 0 48 999
body:
  % Assuming TCC generated (at line 4, column 12) for
      % vect_analysis@vect_deriv_2D[real]
      % generated from assumption vect_deriv_2D.deriv_domain
  IMP_vect_deriv_2D_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 50 0 53 999
body:
  % Assuming TCC generated (at line 4, column 12) for
      % vect_analysis@vect_deriv_2D[real]
      % generated from assumption vect_deriv_2D.not_one_element
  IMP_vect_deriv_2D_TCC2: OBLIGATION not_one_element?[real];


decl_type: tcc
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 55 0 59 999
body:
  % Subtype TCC generated (at line 15, column 61) for  V(r)
      % expected type  Nz_vect2
  horizontal_sq_dtca_diff_TCC1: OBLIGATION
    FORALL (V: (LAMBDA (V: [real -> Vect2]): derivable_rv?(V))):
      (FORALL (a): V(a) /= zero) IMPLIES (FORALL (r: real): V(r) /= zero);


decl_type: tcc
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 61 0 71 999
body:
  % Subtype TCC generated (at line 19, column 52) for  r
      % expected type  {x |
                     %          derivable?(LAMBDA
                     %                     (r: real):
                     %                     horizontal_sq_dtca(s, V(r)),
                     %                     x)}
  horizontal_sq_dtca_deriv_TCC1: OBLIGATION
    FORALL (V: (LAMBDA (V: [real -> Vect2]): derivable_rv?(V)), r1: real,
            s: Vect2):
      (FORALL (a): V(a) /= zero) IMPLIES
       derivable?[real](LAMBDA (r: real): horizontal_sq_dtca(s, V(r)), r1);


decl_type: tcc
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 73 0 80 999
body:
  % Subtype TCC generated (at line 22, column 54) for  sq(sqv(v))
      % expected type  nznum
  horizontal_sq_dtca_deriv_TCC2: OBLIGATION
    FORALL (V: (LAMBDA (V: [real -> Vect2]): derivable_rv?(V)), r: real):
      (FORALL (a): V(a) /= zero) IMPLIES
       (FORALL (v: Vect2):
          v = V(r) IMPLIES
           (FORALL (w: Vect2): w = deriv_rv(V)(r) IMPLIES sq(sqv(v)) /= 0));


decl_type: tcc
theory: horizontal_sq_dtca
library: ACCoRD
signature: nil
location: 82 0 94 999
body:
  % Subtype TCC generated (at line 34, column 57) for  r
      % expected type  {x |
                     %          derivable?(LAMBDA
                     %                     (r: real):
                     %                     horizontal_sq_dtca(ss, V(r)),
                     %                     x)}
  horizontal_sq_dtca_deriv_sign_TCC1: OBLIGATION
    FORALL (V: (LAMBDA (V: [real -> Vect2]): derivable_rv?(V)), r1: real,
            ss: Ss_vect2[D]):
      ((EXISTS (eps: Sign): line_solution?(ss, V(r1), eps)) AND
        (FORALL (a): V(a) /= zero))
       IMPLIES
       derivable?[real](LAMBDA (r: real): horizontal_sq_dtca(ss, V(r)), r1);


decl_type: function
theory: cd2d_ever
library: ACCoRD
signature: [[posreal, Vect2, Vect2] -> bool]
location: 20 2 23 9
body:
    cd2d_ever(D,s,v): bool =
      IF   s*v < 0 THEN (sq(s*v)-sqv(v)*(sqv(s)-sq(D)) > 0)
      ELSE (sqv(s) < sq(D))
      ENDIF


decl_type: formula
theory: cd3d_ever
library: ACCoRD
signature: nil
location: 21 2 24 83
body:
    conflict_2D_stable: LEMMA v`z/=0 AND max(-H-sign(v`z)*s`z,0) < H-sign(v`z)*s`z
      IMPLIES
      (conflict?(s,v) IFF 
      conflict_2D?[D*abs(v`z),max(-H-sign(v`z)*s`z,0),H-sign(v`z)*s`z](abs(v`z)*s,v))


decl_type: formula
theory: cd3d_ever
library: ACCoRD
signature: nil
location: 44 2 51 9
body:
    cd3d_ever_rewrite: LEMMA cd3d_ever?(s,v) IFF 
      IF v`z = 0 AND abs(s`z)<H 
         THEN cd2d_ever(D,s,v)
      ELSIF v`z /= 0 AND max(Theta_H(s`z,v`z,Entry),0) < Theta_H(s`z,v`z,Exit)
         THEN cd2d?[D,max(Theta_H(s`z,v`z,Entry),0),Theta_H(s`z,v`z,Exit)](s,v)
      ELSE
         FALSE
      ENDIF


decl_type: function
theory: cd3d_ever
library: ACCoRD
signature: [[Vect3, Vect3] -> bool]
location: 35 2 42 9
body:
    cd3d_ever?(s,v) : bool =
      IF v`z = 0 AND abs(s`z)<H 
         THEN cd2d_ever(D,s,v)
      ELSIF v`z /= 0 AND max(-H-sign(v`z)*s`z,0) < H-sign(v`z)*s`z
         THEN cd2d?[D*abs(v`z),max(-H-sign(v`z)*s`z,0),H-sign(v`z)*s`z](abs(v`z)*s,v)
      ELSE
         FALSE
      ENDIF


decl_type: tcc
theory: cd3d_ever
library: ACCoRD
signature: nil
location: 76 0 81 999
body:
  % Subtype TCC generated (at line 24, column 17) for  D * abs(v`z)
      % expected type  posreal
  conflict_2D_stable_TCC1: OBLIGATION
    FORALL (s, v: Vect3):
      max(-H - sign(v`z) * s`z, 0) < H - sign(v`z) * s`z AND v`z /= 0 IMPLIES
       D * abs(v`z) > 0;


decl_type: tcc
theory: cd3d_ever
library: ACCoRD
signature: nil
location: 83 0 89 999
body:
  % Subtype TCC generated (at line 24, column 28) for
      % max(-H - sign(v`z) * s`z, 0)
      % expected type  nnreal
  conflict_2D_stable_TCC2: OBLIGATION
    FORALL (s, v: Vect3):
      max(-H - sign(v`z) * s`z, 0) < H - sign(v`z) * s`z AND v`z /= 0 IMPLIES
       max(-H - sign(v`z) * s`z, 0) >= 0;


decl_type: tcc
theory: cd3d_ever
library: ACCoRD
signature: nil
location: 91 0 98 999
body:
  % Subtype TCC generated (at line 24, column 52) for  H - sign(v`z) * s`z
      % expected type  {AB: posreal | AB > max(-H - sign(v`z) * s`z, 0)}
  conflict_2D_stable_TCC3: OBLIGATION
    FORALL (s, v: Vect3):
      max(-H - sign(v`z) * s`z, 0) < H - sign(v`z) * s`z AND v`z /= 0 IMPLIES
       H - sign(v`z) * s`z >= 0 AND
        H - sign(v`z) * s`z > 0 AND
         H - sign(v`z) * s`z > max(-H - sign(v`z) * s`z, 0);


decl_type: tcc
theory: cd3d_ever
library: ACCoRD
signature: nil
location: 100 0 107 999
body:
  % Subtype TCC generated (at line 48, column 20) for
      % max(Theta_H(s`z, v`z, -1), 0)
      % expected type  nnreal
  cd3d_ever_rewrite_TCC1: OBLIGATION
    FORALL (s, v: Vect3):
      NOT (v`z = 0 AND abs(s`z) < H) AND
       max(Theta_H(s`z, v`z, -1), 0) < Theta_H(s`z, v`z, 1) AND v`z /= 0
       IMPLIES max(Theta_H[H](s`z, v`z, -1), 0) >= 0;


decl_type: tcc
theory: cd3d_ever
library: ACCoRD
signature: nil
location: 109 0 118 999
body:
  % Subtype TCC generated (at line 48, column 50) for  Theta_H(s`z, v`z, 1)
      % expected type  {AB: posreal | AB > max(Theta_H(s`z, v`z, -1), 0)}
  cd3d_ever_rewrite_TCC2: OBLIGATION
    FORALL (s, v: Vect3):
      NOT (v`z = 0 AND abs(s`z) < H) AND
       max(Theta_H(s`z, v`z, -1), 0) < Theta_H(s`z, v`z, 1) AND v`z /= 0
       IMPLIES
       Theta_H[H](s`z, v`z, 1) >= 0 AND
        Theta_H[H](s`z, v`z, 1) > 0 AND
         Theta_H[H](s`z, v`z, 1) > max(Theta_H[H](s`z, v`z, -1), 0);


decl_type: formula
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 61 2 62 65
body:
    time_vertical_exit_by_symm: LEMMA time_vertical_exit_by(-sz,-vz,-eps,MinRelVertSpeed) =
                                      time_vertical_exit_by(sz,vz,eps,MinRelVertSpeed)


decl_type: formula
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 70 2 71 55
body:
    min_rel_vert_speed_symm: LEMMA min_rel_vert_speed(-sz,-vz,-eps,MinRelVertSpeed) =
                                   min_rel_vert_speed(sz,vz,eps,MinRelVertSpeed)


decl_type: formula
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 73 2 77 72
body:
    vs_bound_crit_indep: LEMMA
      vs_bound_crit?(s,v,eps)(nv) AND
      vect2(s)*vect2(v) < 0 AND vect2(s)*vect2(nv) < 0 IMPLIES
      norm(vect2(s+horizontal_tca(s,nv)*nv)) > norm(vect2(s+horizontal_tca(s,v)*v)) OR
      eps*(s+horizontal_tca(s,nv)*nv)`z >= eps*(s+horizontal_tca(s,v)*v)`z


decl_type: formula
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 79 2 82 44
body:
    vs_bound_crit_coord: LEMMA
      vs_bound_crit?(so-si,vo-vi,eps)(nvo-vi) AND
      vs_bound_crit?(si-so,vi-vo,-eps)(nvi-vo) IMPLIES
      vs_bound_crit?(so-si,vo-vi,eps)(nvo-nvi)


decl_type: formula
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 93 2 96 88
body:
    vertical_los_criterion_coord: LEMMA
      vertical_los_criterion?(s,vo-vi,eps,MinRelVertSpeedo)(nvo-vi) AND
      vertical_los_criterion?(-s,vi-vo,-eps,MinRelVertSpeedi)(nvi-vo) IMPLIES
      vertical_los_criterion?(s,vo-vi,eps,max(MinRelVertSpeedo,MinRelVertSpeedi))(nvo-nvi)


decl_type: formula
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 98 2 101 33
body:
    vertical_sep_after_def: LEMMA
      abs(sz)<H AND vertical_sep_at?(sz,vz,tr)
      IMPLIES
      vertical_sep_after(sz,vz)(tr)


decl_type: formula
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 103 2 107 41
body:
    z_los_vertical_sep: LEMMA
      vertical_los_criterion?(s,v,eps,MinRelVertSpeed)(nv)
      IMPLIES
      LET teb = time_vertical_exit_by(s`z,v`z,eps,MinRelVertSpeed)
      IN  vertical_sep_after(s`z,nv`z)(teb)


decl_type: function
theory: vertical_los_criterion
library: ACCoRD
signature: [[real, real] -> [real -> bool]]
location: 33 2 35 29
body:
    vertical_sep_after(sz,vz)(tm): bool = 
      FORALL (t): t>=tm IMPLIES
      vertical_sep_at?(sz,vz,t)


decl_type: function
theory: vertical_los_criterion
library: ACCoRD
signature: [[Vect3, Vect3, Sign] -> [Vect3 -> bool]]
location: 37 2 41 9
body:
    vs_bound_crit?(s,v,eps)(nv): bool =
      IF eps*v`z>0
        THEN (eps*nv`z>=eps*v`z) AND eps*v`z*(vect2(nv)*vect2(s)) - eps*nv`z*(vect2(v)*vect2(s)) >= 0
      ELSE eps*nv`z>=0
      ENDIF


decl_type: function
theory: vertical_los_criterion
library: ACCoRD
signature: [[Vect3, Vect3, Sign] -> [Vect3 -> bool]]
location: 48 2 49 92
body:
    horizontal_new_repulsive_criterion?(s,v,eps)(nv): bool =
      (eps*nv`z>=eps*v`z) AND eps*v`z*(vect2(nv)*vect2(s)) - eps*nv`z*(vect2(v)*vect2(s)) >= 0


decl_type: function
theory: vertical_los_criterion
library: ACCoRD
signature:
  [d: [real, real, Sign, posreal] ->
  {x: real | d`4 > 0 AND abs(d`1) < H IMPLIES x > 0}]

location: 56 2 59 9
body:
    time_vertical_exit_by(sz,vz,eps,MinRelVertSpeed): {x:real | MinRelVertSpeed>0 AND abs(sz)<H IMPLIES x>0} =
      IF eps*vz <= 0 THEN Theta_H(sz,eps*MinRelVertSpeed,1)
      ELSE min(Theta_H(sz,eps*MinRelVertSpeed,1),Theta_H(sz,vz,1))
      ENDIF


decl_type: function
theory: vertical_los_criterion
library: ACCoRD
signature:
  [d: [real, real, Sign, posreal] ->
  {x: nnreal | abs(d`1) < H IMPLIES x > 0}]

location: 66 2 68 43
body:
    min_rel_vert_speed(sz,vz,eps,MinRelVertSpeed): {x:nnreal | abs(sz)<H IMPLIES x>0} =
      IF eps*vz <=0 THEN MinRelVertSpeed
      ELSE max(MinRelVertSpeed,abs(vz)) ENDIF


decl_type: function
theory: vertical_los_criterion
library: ACCoRD
signature: [[Vect3, Vect3, Sign, posreal] -> [Vect3 -> bool]]
location: 88 2 91 65
body:
    vertical_los_criterion?(s,v,eps,MinRelVertSpeed)(nv): bool =
        abs(s`z)<H AND
        vs_bound_crit?(s,v,eps)(nv) AND
        eps*nv`z >= min_rel_vert_speed(s`z,v`z,eps,MinRelVertSpeed)


decl_type: tcc
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 114 0 123 999
body:
  % Subtype TCC generated (at line 57, column 24) for
      % Theta_H(sz, eps * MinRelVertSpeed, 1)
      % expected type  {x: real |
                     %          MinRelVertSpeed > 0 AND abs(sz) < H IMPLIES
                     %           x > 0}
  time_vertical_exit_by_TCC1: OBLIGATION
    FORALL (sz: real, vz: real, eps: Sign, MinRelVertSpeed: posreal):
      eps * vz <= 0 IMPLIES
       MinRelVertSpeed > 0 AND abs(sz) < H IMPLIES
        Theta_H[H](sz, eps * MinRelVertSpeed, 1) > 0;


decl_type: tcc
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 125 0 128 999
body:
  % Subtype TCC generated (at line 58, column 58) for  vz
      % expected type  nzreal
  time_vertical_exit_by_TCC2: OBLIGATION
    FORALL (vz: real, eps: Sign): NOT eps * vz <= 0 IMPLIES vz /= 0;


decl_type: tcc
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 130 0 140 999
body:
  % Subtype TCC generated (at line 58, column 9) for
      % min(Theta_H(sz, eps * MinRelVertSpeed, 1), Theta_H(sz, vz, 1))
      % expected type  {x: real |
                     %          MinRelVertSpeed > 0 AND abs(sz) < H IMPLIES
                     %           x > 0}
  time_vertical_exit_by_TCC3: OBLIGATION
    FORALL (sz: real, vz: real, eps: Sign, MinRelVertSpeed: posreal):
      NOT eps * vz <= 0 IMPLIES
       MinRelVertSpeed > 0 AND abs(sz) < H IMPLIES
        min(Theta_H[H](sz, eps * MinRelVertSpeed, 1), Theta_H[H](sz, vz, 1))
         > 0;


decl_type: tcc
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 142 0 146 999
body:
  % Subtype TCC generated (at line 67, column 23) for  MinRelVertSpeed
      % expected type  {x: nnreal | abs(sz) < H IMPLIES x > 0}
  min_rel_vert_speed_TCC1: OBLIGATION
    FORALL (sz: real, vz: real, eps: Sign, MinRelVertSpeed: posreal):
      eps * vz <= 0 IMPLIES abs(sz) < H IMPLIES MinRelVertSpeed > 0;


decl_type: tcc
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 148 0 154 999
body:
  % Subtype TCC generated (at line 68, column 9) for
      % max(MinRelVertSpeed, abs(vz))
      % expected type  {x: nnreal | abs(sz) < H IMPLIES x > 0}
  min_rel_vert_speed_TCC2: OBLIGATION
    FORALL (sz: real, vz: real, eps: Sign, MinRelVertSpeed: posreal):
      NOT eps * vz <= 0 IMPLIES
       abs(sz) < H IMPLIES max(MinRelVertSpeed, abs(vz)) > 0;


decl_type: tcc
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 156 0 162 999
body:
  % Subtype TCC generated (at line 76, column 34) for  vect2(nv)
      % expected type  Nz_vect2
  vs_bound_crit_indep_TCC1: OBLIGATION
    FORALL (eps: Sign, nv, s, v: Vect3):
      vect2(s) * vect2(nv) < 0 AND
       vect2(s) * vect2(v) < 0 AND vs_bound_crit?(s, v, eps)(nv)
       IMPLIES vect2(nv) /= zero;


decl_type: tcc
theory: vertical_los_criterion
library: ACCoRD
signature: nil
location: 164 0 170 999
body:
  % Subtype TCC generated (at line 76, column 75) for  vect2(v)
      % expected type  Nz_vect2
  vs_bound_crit_indep_TCC2: OBLIGATION
    FORALL (eps: Sign, nv, s, v: Vect3):
      vect2(s) * vect2(nv) < 0 AND
       vect2(s) * vect2(v) < 0 AND vs_bound_crit?(s, v, eps)(nv)
       IMPLIES vect2(v) /= zero;


decl_type: formula
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 106 2 114 75
body:
    vertical_los_crit_CA_independent: LEMMA
      LET eps: Sign = dv_to_ec(vertical_decision_vect)(s, v)
      IN 
          s/=zero AND
          vertical_los_crit_CA?(s,v,MinRelVertSpeed)(nv) AND
          vect2(s)*vect2(v) < 0 AND vect2(s)*vect2(nv) < 0 AND
          norm(vect2(s+horizontal_tca(s,nv)*nv)) <= norm(vect2(s+horizontal_tca(s,v)*(v)))
          IMPLIES
          eps*(s+horizontal_tca((s),nv)*nv)`z >= eps*(s+horizontal_tca((s),v)*(v))`z


decl_type: formula
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 116 2 125 77
body:
    vertical_los_crit_CA_independent_strong: LEMMA
          s/=zero AND
          vertical_los_crit_CA?(s,v,MinRelVertSpeed)(nv) AND
          vect2(s)*vect2(v) < 0 AND vect2(s)*vect2(nv) < 0 AND
          norm(vect2(s+horizontal_tca(s,nv)*nv)) <= norm(vect2(s+horizontal_tca(s,v)*(v)))
          IMPLIES
          ((v`z=0 OR CA_cyl_conflict_ever?(s,v)) AND 
            sign(s`z)/=sign(v`z) AND abs((s+horizontal_tca((s),nv)*nv)`z) >= abs(s`z))
          OR
          abs((s+horizontal_tca((s),nv)*nv)`z) >= abs((s+horizontal_tca((s),v)*(v))`z)


decl_type: formula
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 127 2 131 72
body:
    vertical_los_crit_CA_independent_vspeed: LEMMA
      s/=zero AND
        vertical_los_crit_CA?(s,v,MinRelVertSpeed)(nv)
        IMPLIES
        break_vz_symm(vertical_decision_vect(s,v))*(nv`z)>=MinRelVertSpeed


decl_type: formula
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 133 2 138 106
body:
    vertical_los_crit_CA_coordinated_vspeed: LEMMA
        s/=zero AND
        vertical_los_crit_CA?(s,vo-vi,MinRelVertSpeedo)(nvo-vi) AND
        vertical_los_crit_CA?(-s,vi-vo,MinRelVertSpeedi)(nvi-vo)
        IMPLIES
        break_vz_symm(vertical_decision_vect(s,vo-vi))*(nvo`z-nvi`z)>=max(MinRelVertSpeedo,MinRelVertSpeedi)


decl_type: formula
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 140 2 145 84
body:
    vertical_los_crit_CA_coordinated: LEMMA
        s/=zero AND
        vertical_los_crit_CA?(s,vo-vi,MinRelVertSpeedo)(nvo-vi) AND
        vertical_los_crit_CA?(-s,vi-vo,MinRelVertSpeedi)(nvi-vo)
        IMPLIES
        vertical_los_crit_CA?(s,vo-vi,max(MinRelVertSpeedo,MinRelVertSpeedi))(nvo-nvi)


decl_type: formula
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 147 2 158 82
body:
    vertical_los_crit_CA_coordinated_strong: LEMMA
        LET v = vo-vi, nv = nvo-nvi IN
        s/=zero AND
        vertical_los_crit_CA?(s,vo-vi,MinRelVertSpeedo)(nvo-vi) AND
        vertical_los_crit_CA?(-s,vi-vo,MinRelVertSpeedi)(nvi-vo) AND
        vect2(s)*vect2(v) < 0
        IMPLIES
        vect2(s)*vect2(nv) >= 0 OR
        norm(vect2(s+horizontal_tca(s,nv)*nv)) > norm(vect2(s+horizontal_tca(s,v)*(v))) OR
        ((v`z=0 OR CA_cyl_conflict_ever?(s,v)) AND 
           sign(s`z)/=sign(v`z) AND abs((s+horizontal_tca((s),nv)*nv)`z) >= abs(s`z)) OR
        abs((s+horizontal_tca((s),nv)*nv)`z) >= abs((s+horizontal_tca((s),v)*(v))`z)


decl_type: type
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 65 2 66 66
body:
    Decision_Vector : TYPE+ = {f:[[Vect3,Vect3]->Vect3]| FORALL (s,v): 
      (s /= zero OR v/=zero) => (f(s,v)/=zero AND f(-s,-v)=-f(s,v))}


decl_type: judgement
theory: vertical_los_crit_CA
library: ACCoRD
signature: Decision_Vector
location: 96 2 97 51
body:
    vertical_decision_vect_antisymmetric: JUDGEMENT
      vertical_decision_vect HAS_TYPE Decision_Vector


decl_type: function
theory: vertical_los_crit_CA
library: ACCoRD
location: 85 2 94 9
signature:
  [d: [Vect3, Vect3] ->
          {vq: Vect3 |
                   (d`1 /= zero OR d`2 /= zero) IMPLIES vq /= zero}]

body:
    vertical_decision_vect(s,v): {vq: Vect3 | (s /= zero OR v/=zero) IMPLIES vq/=zero} =
      IF (s/=zero AND CA_cyl_conflict_ever?(s,v)) OR (s/=zero AND v`z=0) THEN
         (IF s`z /= 0 OR sqv(v)=0 THEN s ELSE v ENDIF)
      ELSIF vect2(v) = zero OR s = zero THEN
         v
      ELSIF vect2(s)*vect2(v) <= 0 THEN
         s + horizontal_tca(s,v)*v
      ELSE
         s
      ENDIF


decl_type: function
theory: vertical_los_crit_CA
library: ACCoRD
signature: [[Vect3, Vect3, posreal] -> [Vect3 -> bool]]
location: 101 2 102 90
body:
    vertical_los_crit_CA?(s,v,MinRelVertSpeed)(nv) : bool =
      vertical_los_criterion?(s,v,dv_to_ec(vertical_decision_vect)(s,v),MinRelVertSpeed)(nv)


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 165 0 177 999
body:
  % Existence TCC generated (at line 65, column 2) for
      % Decision_Vector: TYPE+ =
      %       {f: [[Vect3, Vect3] -> Vect3] |
      %                FORALL (s, v):
      %                  (s /= zero OR v /= zero) =>
      %                   (f(s, v) /= zero AND f(-s, -v) = -f(s, v))}
  Decision_Vector_TCC1: OBLIGATION
    EXISTS (x:
              {f: [[Vect3, Vect3] -> Vect3] |
                       FORALL (s, v):
                         (s /= zero OR v /= zero) =>
                          (f(s, v) /= zero AND f(-s, -v) = -f(s, v))}):
      TRUE;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 179 0 183 999
body:
  % Judgement subtype TCC generated (at line 74, column 4) for  dv_to_ec(dv)
      % expected type  Vertical_Strategy[D, H]
  dv_to_ec_antisymmetric: OBLIGATION
    FORALL (dv, s, v):
      (s /= zero OR v /= zero) => dv_to_ec(dv)(-s, -v) = -dv_to_ec(dv)(s, v);


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 185 0 193 999
body:
  % Subtype TCC generated (at line 87, column 37) for  s
      % expected type  {vq: Vect3 |
                     %          (s /= zero OR v /= zero) IMPLIES vq /= zero}
  vertical_decision_vect_TCC1: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      (s`z /= 0 OR sqv(v) = 0) AND
       ((s /= zero AND CA_cyl_conflict_ever?(s, v)) OR
         (s /= zero AND v`z = 0))
       IMPLIES (s /= zero OR v /= zero) IMPLIES s /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 195 0 204 999
body:
  % Subtype TCC generated (at line 87, column 44) for  v
      % expected type  {vq: Vect3 |
                     %          (s /= zero OR v /= zero) IMPLIES vq /= zero}
  vertical_decision_vect_TCC2: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      NOT s`z /= 0 AND
       NOT sqv(v) = 0 AND
        ((s /= zero AND CA_cyl_conflict_ever?(s, v)) OR
          (s /= zero AND v`z = 0))
       IMPLIES (s /= zero OR v /= zero) IMPLIES v /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 206 0 214 999
body:
  % Subtype TCC generated (at line 89, column 7) for  v
      % expected type  {vq: Vect3 |
                     %          (s /= zero OR v /= zero) IMPLIES vq /= zero}
  vertical_decision_vect_TCC3: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
      (vect2(v) = zero OR s = zero) AND
       NOT (s /= zero AND CA_cyl_conflict_ever?(s, v)) AND
        NOT (s /= zero AND v`z = 0)
       IMPLIES (s /= zero OR v /= zero) IMPLIES v /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 216 0 223 999
body:
  % Subtype TCC generated (at line 91, column 28) for  vect2(v)
      % expected type  Nz_vect2
  vertical_decision_vect_TCC4: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
           vect2(s) * vect2(v) <= 0 AND NOT vect2(v) = zero AND NOT s = zero
       AND NOT (s /= zero AND CA_cyl_conflict_ever?(s, v))
       AND NOT (s /= zero AND v`z = 0)
       IMPLIES vect2(v) /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 225 0 236 999
body:
  % Subtype TCC generated (at line 91, column 7) for
      % s + horizontal_tca(vect2(s), vect2(v)) * v
      % expected type  {vq: Vect3 |
                     %          (s /= zero OR v /= zero) IMPLIES vq /= zero}
  vertical_decision_vect_TCC5: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
           vect2(s) * vect2(v) <= 0 AND NOT vect2(v) = zero AND NOT s = zero
       AND NOT (s /= zero AND CA_cyl_conflict_ever?(s, v))
       AND NOT (s /= zero AND v`z = 0)
       IMPLIES
       (s /= zero OR v /= zero) IMPLIES
        s + horizontal_tca(vect2(s), vect2(v)) * v /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 238 0 246 999
body:
  % Subtype TCC generated (at line 93, column 7) for  s
      % expected type  {vq: Vect3 |
                     %          (s /= zero OR v /= zero) IMPLIES vq /= zero}
  vertical_decision_vect_TCC6: OBLIGATION
    FORALL (s: Vect3, v: Vect3):
           NOT vect2(s) * vect2(v) <= 0 AND NOT vect2(v) = zero
       AND NOT s = zero AND NOT (s /= zero AND CA_cyl_conflict_ever?(s, v))
       AND NOT (s /= zero AND v`z = 0)
       IMPLIES (s /= zero OR v /= zero) IMPLIES s /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 248 0 255 999
body:
  % Judgement subtype TCC generated (at line 97, column 4) for
      % vertical_decision_vect
      % expected type  Decision_Vector
  vertical_decision_vect_antisymmetric: OBLIGATION
    FORALL (s, v):
      (s /= zero OR v /= zero) =>
       (vertical_decision_vect(s, v) /= zero AND
         vertical_decision_vect(-s, -v) = -vertical_decision_vect(s, v));


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 257 0 264 999
body:
  % Subtype TCC generated (at line 112, column 31) for  vect2(nv)
      % expected type  Nz_vect2
  vertical_los_crit_CA_independent_TCC1: OBLIGATION
    FORALL (MinRelVertSpeed: posreal, nv, s, v: Vect3, eps: Sign):
           vect2(s) * vect2(nv) < 0 AND vect2(s) * vect2(v) < 0
       AND vertical_los_crit_CA?(s, v, MinRelVertSpeed)(nv) AND s /= zero
       AND eps = dv_to_ec(vertical_decision_vect)(s, v)
       IMPLIES vect2(nv) /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 266 0 273 999
body:
  % Subtype TCC generated (at line 112, column 73) for  vect2(v)
      % expected type  Nz_vect2
  vertical_los_crit_CA_independent_TCC2: OBLIGATION
    FORALL (MinRelVertSpeed: posreal, nv, s, v: Vect3, eps: Sign):
           vect2(s) * vect2(nv) < 0 AND vect2(s) * vect2(v) < 0
       AND vertical_los_crit_CA?(s, v, MinRelVertSpeed)(nv) AND s /= zero
       AND eps = dv_to_ec(vertical_decision_vect)(s, v)
       IMPLIES vect2(v) /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 275 0 282 999
body:
  % Subtype TCC generated (at line 120, column 31) for  vect2(nv)
      % expected type  Nz_vect2
  vertical_los_crit_CA_independent_strong_TCC1: OBLIGATION
    FORALL (MinRelVertSpeed: posreal, nv, s, v: Vect3):
      s /= zero AND
       vertical_los_crit_CA?(s, v, MinRelVertSpeed)(nv) AND
        vect2(s) * vect2(v) < 0 AND vect2(s) * vect2(nv) < 0
       IMPLIES vect2(nv) /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 284 0 291 999
body:
  % Subtype TCC generated (at line 120, column 73) for  vect2(v)
      % expected type  Nz_vect2
  vertical_los_crit_CA_independent_strong_TCC2: OBLIGATION
    FORALL (MinRelVertSpeed: posreal, nv, s, v: Vect3):
      s /= zero AND
       vertical_los_crit_CA?(s, v, MinRelVertSpeed)(nv) AND
        vect2(s) * vect2(v) < 0 AND vect2(s) * vect2(nv) < 0
       IMPLIES vect2(v) /= zero;


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 293 0 304 999
body:
  % Subtype TCC generated (at line 155, column 36) for  vect2(nv)
      % expected type  Nz_vect2
  vertical_los_crit_CA_coordinated_strong_TCC1: OBLIGATION
    FORALL (MinRelVertSpeedi, MinRelVertSpeedo: posreal,
            nvi, nvo, s, vi, vo, v: Vect3):
      v = vo - vi IMPLIES
       (FORALL (nv: Vect3):
               NOT vect2(s) * vect2(nv) >= 0 AND s /= zero
           AND vertical_los_crit_CA?(s, vo - vi, MinRelVertSpeedo)(nvo - vi)
           AND vertical_los_crit_CA?(-s, vi - vo, MinRelVertSpeedi)(nvi - vo)
           AND vect2(s) * vect2(v) < 0 AND nv = nvo - nvi
           IMPLIES vect2(nv) /= zero);


decl_type: tcc
theory: vertical_los_crit_CA
library: ACCoRD
signature: nil
location: 306 0 317 999
body:
  % Subtype TCC generated (at line 155, column 77) for  vect2(v)
      % expected type  Nz_vect2
  vertical_los_crit_CA_coordinated_strong_TCC2: OBLIGATION
    FORALL (MinRelVertSpeedi, MinRelVertSpeedo: posreal,
            nvi, nvo, s, vi, vo, v: Vect3):
      v = vo - vi IMPLIES
       (FORALL (nv: Vect3):
               NOT vect2(s) * vect2(nv) >= 0 AND s /= zero
           AND vertical_los_crit_CA?(s, vo - vi, MinRelVertSpeedo)(nvo - vi)
           AND vertical_los_crit_CA?(-s, vi - vo, MinRelVertSpeedi)(nvi - vo)
           AND vect2(s) * vect2(v) < 0 AND nv = nvo - nvi
           IMPLIES vect2(v) /= zero);


decl_type: formula
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 64 2 66 40
body:
    intersects_segment_sym: LEMMA
      intersects_segment?(p,w,v,a,b,e2,e1) IFF
      intersects_segment?(p,w,v,a,b,e1,e2)


decl_type: formula
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 68 2 70 41
body:
    on_segment_in_wedge_sym: LEMMA
      on_segment_in_wedge?(p,w,v,a,b,e2,e1) =
      on_segment_in_wedge?(p,w,v,a,b,e1,e2)


decl_type: formula
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 95 2 100 42
body:
    max_segment_point_in_slice_def: LEMMA
      Let s = max_segment_point_in_slice(p,w,v,a,b,e1,e2) IN
      (intersects_segment?(p,w,v,a,b,e1,e2)
      IMPLIES on_segment_in_wedge?(p,w,v,a,b,e1,e2)(s)) AND
      (FORALL (u): on_segment_in_wedge?(p,w,v,a,b,e1,e2)(u)
                   IMPLIES norm(u-p) <= norm(s-p))


decl_type: formula
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 102 2 106 42
body:
    max_segment_point_in_slice_complete: LEMMA 
      LET s = max_segment_point_in_slice(p,w,v,a,b,e1,e2) IN
      FORALL (u): on_segment_in_wedge?(p,w,v,a,b,e1,e2)(u)
                  IMPLIES
                  on_segment_in_wedge?(p,w,v,a,b,e1,e2)(s)


decl_type: function
theory: wedge_optimum_2D
library: ACCoRD
signature: [[Vect2, Vect2, Vect2, real, real, Nz_vect2, Nz_vect2] -> bool]
location: 36 2 39 22
body:
    intersects_segment?(p,w,v,a,b,e1,e2): bool =
      EXISTS (t:real): a<=t AND t<=b AND
                       (w+t*v-p)*e1>=0 AND
                       (w+t*v-p)*e2>=0


decl_type: function
theory: wedge_optimum_2D
library: ACCoRD
signature: [[Vect2, Vect2, Vect2, real, real, Nz_vect2, Nz_vect2] -> bool]
location: 41 2 49 22
body:
    intersects_segment_fun?(p,w,v,a,b,e1,e2): bool =
      LET
        tlow1  = IF v*e1>0 THEN ((p-w)*e1)/(v*e1) ELSIF v*e1 = 0 AND (w-p)*e1<0 THEN b+1 ELSE a ENDIF,
        thigh1 = IF v*e1<0 THEN ((p-w)*e1)/(v*e1) ELSIF v*e1 = 0 AND (w-p)*e1<0 THEN a-1 ELSE b ENDIF,
        tlow2  = IF v*e2>0 THEN ((p-w)*e2)/(v*e2) ELSIF v*e2 = 0 AND (w-p)*e2<0 THEN b+2 ELSE a ENDIF,
        thigh2 = IF v*e2<0 THEN ((p-w)*e2)/(v*e2) ELSIF v*e2 = 0 AND (w-p)*e2<0 THEN a-2 ELSE b ENDIF,
        tlow   = max(max(tlow1,tlow2),a),
        thigh  = min(min(thigh1,thigh2),b)
      IN (tlow <= thigh)


decl_type: function
theory: wedge_optimum_2D
library: ACCoRD
signature: [[Vect2, Vect2, real, real] -> [Vect2 -> bool]]
location: 54 2 56 23
body:
    on_segment?(w,v,a,b)(s): bool = 
      EXISTS (t:real): a<=t AND t<=b AND
                       s = w+t*v


decl_type: function
theory: wedge_optimum_2D
library: ACCoRD
signature:
  [[Vect2, Vect2, Vect2, real, real, Nz_vect2, Nz_vect2] ->
  [Vect2 -> bool]]

location: 58 2 62 18
body:
    on_segment_in_wedge?(p,w,v,a,b,e1,e2)(s): bool = 
      EXISTS (t:real): a<=t AND t<=b AND
                       s = w+t*v AND
                       (s-p)*e1>=0 AND
                       (s-p)*e2>=0


decl_type: function
theory: wedge_optimum_2D
library: ACCoRD
signature:
  [[Vect2, Vect2, Vect2, real, real, Nz_vect2, Nz_vect2] ->
  Vect2]

location: 75 2 89 17
body:
    max_segment_point_in_slice(p,w,v,a,b,e1,e2): Vect2 =
      LET
        tlow1  = IF v*e1>0 THEN ((p-w)*e1)/(v*e1) ELSIF v*e1 = 0 AND (w-p)*e1<0 THEN b+1 ELSE a ENDIF,
        thigh1 = IF v*e1<0 THEN ((p-w)*e1)/(v*e1) ELSIF v*e1 = 0 AND (w-p)*e1<0 THEN a-1 ELSE b ENDIF,
        tlow2  = IF v*e2>0 THEN ((p-w)*e2)/(v*e2) ELSIF v*e2 = 0 AND (w-p)*e2<0 THEN b+2 ELSE a ENDIF,
        thigh2 = IF v*e2<0 THEN ((p-w)*e2)/(v*e2) ELSIF v*e2 = 0 AND (w-p)*e2<0 THEN a-2 ELSE b ENDIF,
        tlow   = max(max(tlow1,tlow2),a),
        thigh  = min(min(thigh1,thigh2),b),
        aa     = sqv(v),
        bb     = 2*(v*(w-p)),
        cc     = sqv(w-p),
        qmint  = IF v = zero THEN 0 ELSE -bb/(2*aa) ENDIF,
        maxt   = IF aa*tlow^2 + bb*tlow <= aa*thigh^2+bb*thigh THEN thigh
                 ELSE tlow ENDIF
      IN w + maxt*v


decl_type: tcc
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 116 0 120 999
body:
  % Subtype TCC generated (at line 43, column 42) for  (v * e1)
      % expected type  nznum
  intersects_segment_fun?_TCC1: OBLIGATION
    FORALL (v: Vect2, e1: Nz_vect2, e2: Nz_vect2):
      v * e1 > 0 IMPLIES (v * e1) /= 0;


decl_type: tcc
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 122 0 133 999
body:
  % Subtype TCC generated (at line 44, column 42) for  (v * e1)
      % expected type  nznum
  intersects_segment_fun?_TCC2: OBLIGATION
    FORALL (p: Vect2, w: Vect2, v: Vect2, a: real, b: real, e1: Nz_vect2,
            e2: Nz_vect2, tlow1: real):
      v * e1 < 0 AND
       tlow1 =
        IF v * e1 > 0 THEN ((p - w) * e1) / (v * e1)
        ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN b + 1
        ELSE a
        ENDIF
       IMPLIES (v * e1) /= 0;


decl_type: tcc
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 135 0 153 999
body:
  % Subtype TCC generated (at line 45, column 42) for  (v * e2)
      % expected type  nznum
  intersects_segment_fun?_TCC3: OBLIGATION
    FORALL (p: Vect2, w: Vect2, v: Vect2, a: real, b: real, e1: Nz_vect2,
            e2: Nz_vect2, tlow1: real):
      tlow1 =
       IF v * e1 > 0 THEN ((p - w) * e1) / (v * e1)
       ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN b + 1
       ELSE a
       ENDIF
       IMPLIES
       (FORALL (thigh1: real):
          v * e2 > 0 AND
           thigh1 =
            IF v * e1 < 0 THEN ((p - w) * e1) / (v * e1)
            ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN a - 1
            ELSE b
            ENDIF
           IMPLIES (v * e2) /= 0);


decl_type: tcc
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 155 0 180 999
body:
  % Subtype TCC generated (at line 46, column 42) for  (v * e2)
      % expected type  nznum
  intersects_segment_fun?_TCC4: OBLIGATION
    FORALL (p: Vect2, w: Vect2, v: Vect2, a: real, b: real, e1: Nz_vect2,
            e2: Nz_vect2, tlow1: real):
      tlow1 =
       IF v * e1 > 0 THEN ((p - w) * e1) / (v * e1)
       ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN b + 1
       ELSE a
       ENDIF
       IMPLIES
       (FORALL (thigh1: real):
          thigh1 =
           IF v * e1 < 0 THEN ((p - w) * e1) / (v * e1)
           ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN a - 1
           ELSE b
           ENDIF
           IMPLIES
           (FORALL (tlow2: real):
              v * e2 < 0 AND
               tlow2 =
                IF v * e2 > 0 THEN ((p - w) * e2) / (v * e2)
                ELSIF v * e2 = 0 AND (w - p) * e2 < 0 THEN b + 2
                ELSE a
                ENDIF
               IMPLIES (v * e2) /= 0));


decl_type: tcc
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 182 0 233 999
body:
  % Subtype TCC generated (at line 86, column 44) for  (2 * aa)
      % expected type  nznum
  max_segment_point_in_slice_TCC1: OBLIGATION
    FORALL (p: Vect2, w: Vect2, v: Vect2, a: real, b: real, e1: Nz_vect2,
            e2: Nz_vect2, tlow1: real):
      tlow1 =
       IF v * e1 > 0 THEN ((p - w) * e1) / (v * e1)
       ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN b + 1
       ELSE a
       ENDIF
       IMPLIES
       (FORALL (thigh1: real):
          thigh1 =
           IF v * e1 < 0 THEN ((p - w) * e1) / (v * e1)
           ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN a - 1
           ELSE b
           ENDIF
           IMPLIES
           (FORALL (tlow2: real):
              tlow2 =
               IF v * e2 > 0 THEN ((p - w) * e2) / (v * e2)
               ELSIF v * e2 = 0 AND (w - p) * e2 < 0 THEN b + 2
               ELSE a
               ENDIF
               IMPLIES
               (FORALL (thigh2: real):
                  thigh2 =
                   IF v * e2 < 0 THEN ((p - w) * e2) / (v * e2)
                   ELSIF v * e2 = 0 AND (w - p) * e2 < 0 THEN a - 2
                   ELSE b
                   ENDIF
                   IMPLIES
                   (FORALL (tlow:
                              {p_1: real |
                                       p_1 >= max(tlow1, tlow2)
                                       AND
                                       p_1 >= a}):
                      tlow = max(max(tlow1, tlow2), a) IMPLIES
                       (FORALL (thigh:
                                  {p_1: real |
                                           p_1 <= min(thigh1, thigh2)
                                           AND
                                           p_1 <= b}):
                          thigh = min(min(thigh1, thigh2), b) IMPLIES
                           (FORALL (aa: nnreal):
                              aa = sqv(v) IMPLIES
                               (FORALL (bb: real):
                                  bb = 2 * (v * (w - p)) IMPLIES
                                   (FORALL (cc: nnreal):
                                      NOT v = zero AND cc = sqv(w - p)
                                      IMPLIES
                                      (2 * aa) /= 0))))))));


decl_type: tcc
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 235 0 295 999
body:
  % Subtype TCC generated (at line 87, column 26) for  2
      % expected type  {i: int | tlow /= 0 OR i >= 0}
  max_segment_point_in_slice_TCC2: OBLIGATION
    FORALL (p: Vect2, w: Vect2, v: Vect2, a: real, b: real, e1: Nz_vect2,
            e2: Nz_vect2, tlow1: real):
      tlow1 =
       IF v * e1 > 0 THEN ((p - w) * e1) / (v * e1)
       ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN b + 1
       ELSE a
       ENDIF
       IMPLIES
       (FORALL (thigh1: real):
          thigh1 =
           IF v * e1 < 0 THEN ((p - w) * e1) / (v * e1)
           ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN a - 1
           ELSE b
           ENDIF
           IMPLIES
           (FORALL (tlow2: real):
              tlow2 =
               IF v * e2 > 0 THEN ((p - w) * e2) / (v * e2)
               ELSIF v * e2 = 0 AND (w - p) * e2 < 0 THEN b + 2
               ELSE a
               ENDIF
               IMPLIES
               (FORALL (thigh2: real):
                  thigh2 =
                   IF v * e2 < 0 THEN ((p - w) * e2) / (v * e2)
                   ELSIF v * e2 = 0 AND (w - p) * e2 < 0 THEN a - 2
                   ELSE b
                   ENDIF
                   IMPLIES
                   (FORALL (tlow:
                              {p_1: real |
                                       p_1 >= max(tlow1, tlow2)
                                       AND
                                       p_1 >= a}):
                      tlow = max(max(tlow1, tlow2), a) IMPLIES
                       (FORALL (thigh:
                                  {p_1: real |
                                           p_1 <= min(thigh1, thigh2)
                                           AND
                                           p_1 <= b}):
                          thigh = min(min(thigh1, thigh2), b) IMPLIES
                           (FORALL (aa: nnreal):
                              aa = sqv(v) IMPLIES
                               (FORALL (bb: real):
                                  bb = 2 * (v * (w - p)) IMPLIES
                                   (FORALL (cc: nnreal):
                                      cc = sqv(w - p)
                                      IMPLIES
                                      (FORALL
                                       (qmint: real):
                                       qmint
                                       =
                                       IF v = zero
                                       THEN 0
                                       ELSE -bb / (2 * aa)
                                       ENDIF
                                       IMPLIES
                                       tlow /= 0 OR 2 >= 0)))))))));


decl_type: tcc
theory: wedge_optimum_2D
library: ACCoRD
signature: nil
location: 297 0 357 999
body:
  % Subtype TCC generated (at line 87, column 50) for  2
      % expected type  {i: int | thigh /= 0 OR i >= 0}
  max_segment_point_in_slice_TCC3: OBLIGATION
    FORALL (p: Vect2, w: Vect2, v: Vect2, a: real, b: real, e1: Nz_vect2,
            e2: Nz_vect2, tlow1: real):
      tlow1 =
       IF v * e1 > 0 THEN ((p - w) * e1) / (v * e1)
       ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN b + 1
       ELSE a
       ENDIF
       IMPLIES
       (FORALL (thigh1: real):
          thigh1 =
           IF v * e1 < 0 THEN ((p - w) * e1) / (v * e1)
           ELSIF v * e1 = 0 AND (w - p) * e1 < 0 THEN a - 1
           ELSE b
           ENDIF
           IMPLIES
           (FORALL (tlow2: real):
              tlow2 =
               IF v * e2 > 0 THEN ((p - w) * e2) / (v * e2)
               ELSIF v * e2 = 0 AND (w - p) * e2 < 0 THEN b + 2
               ELSE a
               ENDIF
               IMPLIES
               (FORALL (thigh2: real):
                  thigh2 =
                   IF v * e2 < 0 THEN ((p - w) * e2) / (v * e2)
                   ELSIF v * e2 = 0 AND (w - p) * e2 < 0 THEN a - 2
                   ELSE b
                   ENDIF
                   IMPLIES
                   (FORALL (tlow:
                              {p_1: real |
                                       p_1 >= max(tlow1, tlow2)
                                       AND
                                       p_1 >= a}):
                      tlow = max(max(tlow1, tlow2), a) IMPLIES
                       (FORALL (thigh:
                                  {p_1: real |
                                           p_1 <= min(thigh1, thigh2)
                                           AND
                                           p_1 <= b}):
                          thigh = min(min(thigh1, thigh2), b) IMPLIES
                           (FORALL (aa: nnreal):
                              aa = sqv(v) IMPLIES
                               (FORALL (bb: real):
                                  bb = 2 * (v * (w - p)) IMPLIES
                                   (FORALL (cc: nnreal):
                                      cc = sqv(w - p)
                                      IMPLIES
                                      (FORALL
                                       (qmint: real):
                                       qmint
                                       =
                                       IF v = zero
                                       THEN 0
                                       ELSE -bb / (2 * aa)
                                       ENDIF
                                       IMPLIES
                                       thigh /= 0 OR 2 >= 0)))))))));


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 47 2 48 49
body:
    intersects_circle_fun_scal: LEMMA intersects_circle_fun?(v,c,R) IFF
                                     intersects_circle_fun?(k*v,c,R)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 50 2 51 62
body:
    intersects_circle_fun_def: LEMMA intersects_circle_fun?(v,c,R) IFF
                                 (EXISTS (w): circle?(c,R)(w) AND segment?(v)(w))


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 53 2 54 56
body:
    intersects_circle_fun_inc: LEMMA v/=zero AND u/=zero AND intersects_circle_fun?(v,c,R) AND
      ^(v)*c<=^(u)*c IMPLIES intersects_circle_fun?(u,c,R)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 60 2 61 94
body:
    inter_circle_max_time_scal: LEMMA
      FORALL (pt:posreal): inter_circle_max_time(pt*v,c,R) = (1/pt)*inter_circle_max_time(v,c,R)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 63 2 69 65
body:
    inter_circle_max_time_def: LEMMA
      LET t = inter_circle_max_time(v,c,R) IN
          (intersects_circle_fun?(v,c,R) IMPLIES
          circle?(c,R)(t*v)) AND
          (FORALL (nnt:nnreal): circle?(c,R)(nnt*v) IMPLIES
                 norm(nnt*v) <= norm(t*v) AND
                 (nnt /= t AND v/=zero IMPLIES norm(nnt*v) < norm(t*v)))


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 75 2 76 87
body:
    inter_circle_max_norm_scal: LEMMA
      FORALL (pt:posreal): inter_circle_max_norm(pt*v,c,R) = inter_circle_max_norm(v,c,R)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 82 2 86 64
body:
    max_norm_increasing: LEMMA
      (v/=zero AND u/=zero AND ^(v)*c<=^(u)*c) OR
      ((v=zero OR u=zero) AND norm(v)<=norm(u))
      IMPLIES
      inter_circle_max_norm(v,c,R) <= inter_circle_max_norm(u,c,R)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 126 2 128 44
body:
    lem1: LEMMA FORALL (v1,v2:Vect2): norm(v1) = 1 AND norm(v2) = 1
      IMPLIES ((v1*v2>=0 IFF norm(v1-v2)<=sqrt(2)) AND
              (v1*v2> 0 IFF norm(v1-v2)<sqrt(2)))


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 130 2 133 54
body:
    lem2: LEMMA FORALL (v1,v2,v3:Vect2): norm(v1) = 1 AND norm(v2) = 1 AND
                                         norm(v3) = 1
      IMPLIES ((v1*v3 <= v2*v3) IFF norm(v1-v3)>=norm(v2-v3)) AND
              ((v1*v3 < v2*v3) IFF norm(v1-v3)>norm(v2-v3))


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 137 2 147 39
body:
    max_circle_point_in_slice_intersection: LEMMA
      FORALL (aa, bb, cc, dd, ap, bp, cp, dp, h, g: Nz_vect2):
               orthonormal?(aa, ap) AND orthonormal?(bb, bp)
           AND orthonormal?(cc, cp) AND orthonormal?(dd, dp) AND norm(h) = 1 and norm(g) = 1
           AND bp * aa >= 0 AND ap * bb >= 0 AND cp * dd >= 0 AND dp * cc >= 0
           AND (aa = bb IMPLIES ap/=bp)
           AND h * aa > 0 AND h * bb > 0
           AND h * cc > 0 AND h * dd > 0 AND g*cc>0 AND g*dd>0 AND (NOT (g*aa>=0 AND g*bb>=0))
           IMPLIES
           (ap * cc > 0 AND ap * dd > 0) OR
            (bp * cc > 0 AND bp * dd > 0)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 149 2 159 38
body:
    max_circle_point_in_slice_union: LEMMA
      FORALL (aa, bb, cc, dd, ap, bp, cp, dp, h, g: Nz_vect2):
               orthonormal?(aa, ap) AND orthonormal?(bb, bp)
           AND orthonormal?(cc, cp) AND orthonormal?(dd, dp) AND norm(h) = 1 and norm(g) = 1
           AND bp * aa >= 0 AND ap * bb >= 0 AND cp * dd >= 0 AND dp * cc >= 0
           AND (aa = bb IMPLIES ap/=bp)
           AND h * aa > 0 AND h * bb > 0 AND g*cc = g*dd
           AND (h * cc > 0 OR h * dd > 0) AND (g*cc>0 OR g*dd>0) AND (NOT (g*aa>=0 AND g*bb>=0))
           IMPLIES
           (ap * cc > 0 OR ap * dd > 0) OR
            (bp * cc > 0 OR bp * dd > 0)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 161 2 166 70
body:
    dot_gt_dot_equals_slice_intersection: LEMMA 
      FORALL (g,rp:Vect2): rp*g>=0 AND norm(g) = 1 AND norm(rp) = 1
          IMPLIES  (EXISTS (vv1, vv2: Nz_vect2): norm(vv1) = 1 AND norm(vv2) = 1 AND
             g*vv1 = g*vv2 AND
             (FORALL (ww: Nz_vect2): norm(ww) = 1 IMPLIES
                 (ww * g > rp * g IFF (ww * vv1 > 0 AND ww * vv2 > 0))))


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 168 2 173 69
body:
    dot_gt_dot_equals_slice_union: LEMMA 
      FORALL (g,rp:Vect2): rp*g<0 AND norm(g) = 1 AND norm(rp) = 1 AND rp/=-g
          IMPLIES  (EXISTS (vv1, vv2: Nz_vect2): norm(vv1) = 1 AND norm(vv2) = 1 AND
             g * vv1 = g * vv2 AND
             (FORALL (ww: Nz_vect2): norm(ww) = 1 IMPLIES
                 (ww * g > rp * g IFF (ww * vv1 > 0 OR ww * vv2 > 0))))


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 175 2 183 33
body:
    max_circle_point_in_slice_lem: LEMMA
       (FORALL (r, s, g, h, rp, sp: Vect2):
               norm(r) = 1 AND norm(s) = 1 AND norm(g) = 1 AND norm(h) = 1
           AND norm(rp) = 1 AND norm(sp) = 1
           AND (NOT (g * r >= 0 AND g * s >= 0)) AND sp * g <= rp * g
           AND h * r >= 0 AND h * s >= 0 AND orthonormal?(r, rp)
           AND orthonormal?(s, sp) AND rp * s >= 0 AND sp * r >= 0 AND (r=s IMPLIES rp/=sp)
           AND (NOT (sp * g <= 0 AND r = -s AND rp = sp AND h = -sp))
           IMPLIES h * g <= rp * g)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 185 2 192 33
body:
    max_circle_point_in_slice_lem_eq: LEMMA
       (FORALL (r, s, g, h, rp, sp: Vect2):
               norm(r) = 1 AND norm(s)  = 1 AND norm(g) = 1 AND norm(h) = 1
           AND norm(rp) = 1 AND norm(sp) = 1
           AND (NOT (g * r >= 0 AND g * s >= 0)) AND sp * g <= rp * g
           AND h * r >= 0 AND h * s >= 0 AND orthonormal?(r, rp)
           AND orthonormal?(s, sp) AND rp * s >= 0 AND sp * r >= 0 AND r=s and            rp = -sp
           IMPLIES h * g <= rp * g)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 194 2 206 97
body:
    max_circle_point_in_slide_sym_lem: LEMMA FORALL (vv:Vect2,e1perp,e2perp:Nz_vect2):
       vv = p + inter_circle_max_time(e1perp, c - p, R) * e1perp AND circle?(c, R)(w) AND 
       (w - p) * e1 >= 0 AND  (w - p) * e2 >= 0 AND  orthogonal?(e1, e1perp)
       AND  orthogonal?(e2, e2perp) AND  e1perp * e2 >= 0 AND  e2perp * e1 >= 0
       AND ((e2perp /= zero AND e1perp /= zero AND ^(e2perp) * (c - p) <= ^(e1perp) * (c - p) AND
            (c-p/=zero AND (NOT (^(c - p) * ^(e1) >= 0 AND ^(c - p) * ^(e2) >= 0)) AND
         ^(e1) = ^(e2) AND ^(e1perp) = -^(e2perp) OR (c-p/=zero AND NOT (^(c - p) * ^(e1) >= 0 AND ^(c - p) * ^(e2) >= 0)) AND
         (^(e1) = ^(e2) IMPLIES ^(e1perp) /= ^(e2perp)) AND
          (NOT (^(e2perp) * ^(c - p) <= 0 AND
                 ^(e1) = -^(e2) AND
                  ^(e1perp) = ^(e2perp) AND w-p /= zero AND ^(w - p) = -^(e2perp))))) 
       OR ((e2perp = zero OR e1perp = zero) AND norm(perpR(e2)) <= norm(perpR(e1))))
       IMPLIES  (((c - p) * e1 >= 0 AND (c - p) * e2 >= 0) OR norm(w - p) <= norm(vv - p) OR c = p)


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 208 2 215 43
body:
    max_circle_point_in_slice_def: LEMMA
      LET vv = max_circle_point_in_slice(p,c,R,e1,e2) IN
      (intersects_circle_fun?(vv-p,c-p,R)
      IMPLIES circle?(c,R)(vv) AND
      (vv-p)*e1 >= 0 AND
      (vv-p)*e2 >= 0) AND
      (FORALL (w): circle?(c,R)(w) AND (w-p)*e1 >= 0 AND (w-p)*e2 >= 0
                   IMPLIES norm(w-p) <= norm(vv-p))


decl_type: formula
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 217 2 221 36
body:
    max_circle_point_in_slice_complete: LEMMA 
      LET vv = max_circle_point_in_slice(p,c,R,e1,e2) IN
      FORALL (w): circle?(c,R)(w) AND (w-p)*e1 >= 0 AND (w-p)*e2 >= 0
                  IMPLIES
                  intersects_circle_fun?(vv-p,c-p,R)


decl_type: function
theory: circle_optimum_2D
library: ACCoRD
signature: [[Vect2, Vect2, posreal] -> bool]
location: 43 2 45 33
body:
    intersects_circle_fun?(v,c,R): bool = (v/=zero AND Delta[R](-c,v)>=0 AND (c*v >=0 OR sqv(-c)<=sq(R)))
                                          OR
                                          (v =zero AND sqv(c) = sq(R))


decl_type: function
theory: circle_optimum_2D
library: ACCoRD
signature: [[Vect2, Vect2, posreal] -> nnreal]
location: 56 2 58 16
body:
    inter_circle_max_time(v,c,R): nnreal =
      IF v/=zero AND intersects_circle_fun?(v,c,R) THEN Theta_D[R](-c,v,1)
      ELSE 0 ENDIF


decl_type: function
theory: circle_optimum_2D
library: ACCoRD
signature: [[Vect2, Vect2, posreal] -> nnreal]
location: 71 2 73 20
body:
    inter_circle_max_norm(v,c,R): nnreal = 
          IF intersects_circle_fun?(v,c,R) THEN inter_circle_max_time(v,c,R)*norm(v)
          ELSE 0 ENDIF


decl_type: function
theory: circle_optimum_2D
library: ACCoRD
signature: [[Vect2, Vect2, posreal, Nz_vect2, Nz_vect2] -> Vect2]
location: 94 2 114 9
body:
    max_circle_point_in_slice(p,c,R,e1,e2): Vect2 =
      IF    c = p AND perpR(e1)*e2>=0 
          THEN p + (R/norm(e1))*perpR(e1)
      ELSIF c = p
          THEN p - (R/norm(e1))*perpR(e1)
      ELSIF (c-p)*e1 >= 0 AND (c-p)*e2 >= 0
          THEN p + (1+R/norm(c-p))*(c-p)
      ELSE
          LET e1perp = IF perpR(e1)*e2 >= 0 THEN perpR(e1) ELSE -perpR(e1) ENDIF,
              e2perp = IF (-sign(e1*e2))*(perpR(e2)*e1) >= 0 THEN (-sign(e1*e2))*perpR(e2) ELSE sign(e1*e2)*perpR(e2) ENDIF,
              e1vect = p + inter_circle_max_time(e1perp,c-p,R)*e1perp,
              e2vect = p + inter_circle_max_time(e2perp,c-p,R)*e2perp
          IN
              IF (e2perp/=zero AND e1perp/=zero AND ^(e2perp)*(c-p)<=^(e1perp)*(c-p)) OR
                 ((e2perp=zero OR e1perp=zero) AND norm(e2vect-p)<=norm(e1vect-p))
              THEN 
                 e1vect
              ELSE
                 e2vect
              ENDIF
      ENDIF


decl_type: tcc
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 231 0 236 999
body:
  % Subtype TCC generated (at line 57, column 68) for  v
      % expected type  {nzv | Delta[R](-c, nzv) >= 0}
  inter_circle_max_time_TCC1: OBLIGATION
    FORALL (v: Vect2, c: Vect2, R: posreal):
      v /= zero AND intersects_circle_fun?(v, c, R) IMPLIES
       Delta[R](-c, v) >= 0;


decl_type: tcc
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 238 0 243 999
body:
  % Subtype TCC generated (at line 57, column 54) for  Theta_D[R](-c, v, 1)
      % expected type  nnreal
  inter_circle_max_time_TCC2: OBLIGATION
    FORALL (v: Vect2, c: Vect2, R: posreal):
      v /= zero AND intersects_circle_fun?(v, c, R) IMPLIES
       Theta_D[R](-c, v, 1) >= 0;


decl_type: tcc
theory: circle_optimum_2D
library: ACCoRD
signature: nil
location: 245 0 252 999
body:
  % Subtype TCC generated (at line 100, column 22) for  norm(c - p)
      % expected type  nznum
  max_circle_point_in_slice_TCC1: OBLIGATION
    FORALL (p: Vect2, c: Vect2, e1: Nz_vect2, e2: Nz_vect2):
      (c - p) * e1 >= 0 AND
       (c - p) * e2 >= 0 AND
        NOT c = p AND NOT (c = p AND perpR(e1) * e2 >= 0)
       IMPLIES norm(c - p) /= 0;


decl_type: formula
theory: old_horiz_los_criterion
library: ACCoRD
signature: nil
location: 35 2 37 50
body:
    horizontal_los_crit_symm: LEMMA
        horizontal_los_crit?(s,MinRelSpeed,eps)(v) IFF
        horizontal_los_crit?(-s,MinRelSpeed,eps)(-v)


decl_type: formula
theory: old_horiz_los_criterion
library: ACCoRD
signature: nil
location: 39 2 44 31
body:
    horizontal_los_crit_independent: LEMMA
        nvo-vi /= zero AND
        horizontal_los_crit?(s,MinRelSpeed,eps)(nvo-vi) IMPLIES
        divergent?(s,nvo-vi) AND
        eps*det(s,nvo-vi)<=0 AND
        norm(nvo-vi)>=MinRelSpeed


decl_type: formula
theory: old_horiz_los_criterion
library: ACCoRD
signature: nil
location: 46 2 50 27
body:
    horizontal_los_crit_coordinated: LEMMA
        horizontal_los_crit?(s,MinRelSpeedo,eps)(nvo-vi) AND
        horizontal_los_crit?(-s,MinRelSpeedi,eps)(nvi-vo) AND
        s*(vo-vi)<0 IMPLIES
        divergent?(s,nvo-nvi)


decl_type: function
theory: old_horiz_los_criterion
library: ACCoRD
signature: [[Vect2, nnreal, Sign] -> [Vect2 -> bool]]
location: 29 2 32 26
body:
    horizontal_los_crit?(s,MinRelSpeed,eps)(v): bool =
        s*v>=0 AND
        eps*det(s,v)<=0 AND
        norm(v)>=MinRelSpeed


decl_type: formula
theory: horizontal_los
library: ACCoRD
signature: nil
location: 48 2 66 13
body:
    gs_los_def: LEMMA LET nvo = gs_los(s,vo,vi,MinGS,MaxGS,MinRelSpeed,irt) IN
      (nvo/=zero IMPLIES
        gs_only?(vo)(nvo) AND 
        MinGS <= norm(nvo) AND 
        norm(nvo) <= MaxGS AND
        s*(nvo-vi)>=0 AND
        norm(nvo-vi)>=MinRelSpeed AND
        ((nvo-vi/=zero OR MinRelSpeed>0) IMPLIES divergent?(s,nvo-vi)) AND
        irt*det(s,nvo-vi)<=0) AND
          (FORALL (nvo2:Vect2):
            gs_only?(vo)(nvo2) AND 
            MinGS <= norm(nvo2) AND 
            norm(nvo2) <= MaxGS AND
            divergent?(s,nvo2-vi) AND
            irt*det(s,nvo2-vi)<=0 AND
            norm(nvo2-vi)>=MinRelSpeed IMPLIES
            norm(nvo2-vi)<=norm(nvo-vi)
            AND
            nvo/=zero)


decl_type: formula
theory: horizontal_los
library: ACCoRD
signature: nil
location: 82 2 96 13
body:
    trk_los_def: LEMMA LET nvo = trk_los(s,vo,vi,MinRelSpeed,irt) IN
      (nvo/=zero IMPLIES
        norm(nvo) = norm(vo) AND
        s*(nvo-vi)>=0 AND
        norm(nvo-vi)>=MinRelSpeed AND
        ((nvo-vi/=zero OR MinRelSpeed>0) IMPLIES divergent?(s,nvo-vi)) AND
        irt*det(s,nvo-vi)<=0) AND
          (FORALL (nvo2:Vect2):
            norm(nvo2) = norm(vo) AND
            divergent?(s,nvo2-vi) AND
            irt*det(s,nvo2-vi)<=0 AND
            norm(nvo2-vi)>=MinRelSpeed IMPLIES
            norm(nvo2-vi)<=norm(nvo-vi)
            AND
            nvo/=zero)


decl_type: formula
theory: horizontal_los
library: ACCoRD
signature: nil
location: 123 2 126 70
body:
    los_recovery_meets_criteria : LEMMA
      los_recovery?(s,vo,vi,MinRelSpeed,MinGS,MaxGS,MinRelSpeed)(nvo)
      IMPLIES
        horizontal_los_crit?(s,MinRelSpeed,-sign(det(s,nvo-vi)))(nvo-vi)


decl_type: formula
theory: horizontal_los
library: ACCoRD
signature: nil
location: 132 2 136 31
body:
    los_recovery_independence : THEOREM
      los_recovery?(s,vo,vi,MinRelSpeed,MinGS,MaxGS,MinRelSpeed)(nvo)
      IMPLIES
        divergent?(s,nvo-vi) AND
        norm(nvo-vi)>=MinRelSpeed


decl_type: formula
theory: horizontal_los
library: ACCoRD
signature: nil
location: 142 2 147 45
body:
    los_recovery_coordination : THEOREM
      los_recovery?(s,vo,vi,MinRelSpeedo,MinGSo,MaxGSo,MinRelSpeedo)(nvo) AND
      los_recovery?(-s,vi,vo,MinRelSpeedi,MinGSi,MaxGSi,MinRelSpeedi)(nvi)  AND
      horizontal_entry?(s,vo-vi)
      IMPLIES
        (divergent?(s,nvo-nvi) OR nvo-nvi=zero)


decl_type: function
theory: horizontal_los
library: ACCoRD
location: 38 2 46 11
signature:
  [d:
          [LoS_vect2[D], Nz_vect2, Nz_vect2, posreal, posreal, posreal,
           Sign] ->
          {nvo |
                   nvo /= zero =>
                    gs_only?(d`2)(nvo) AND
                     d`4 <= norm(nvo) AND norm(nvo) <= d`5}]

body:
    gs_los(s,vo,vi,MinGS,MaxGS,MinRelSpeed,irt): {nvo | nz_vect2?(nvo) => 
                                   gs_only?(vo)(nvo) AND MinGS <= norm(nvo) AND norm(nvo) <= MaxGS} =
      LET nv = max_segment_point_in_slice(zero,-vi,(1/norm(vo))*vo,MinGS,MaxGS,s,irt*perpR(s))
      IN
        IF intersects_segment_fun?(zero,-vi,(1/norm(vo))*vo,MinGS,MaxGS,s,irt*perpR(s)) AND norm(nv)>=MinRelSpeed THEN
          nv+vi
        ELSE
          zero
        ENDIF


decl_type: function
theory: horizontal_los
library: ACCoRD
signature:
  [[LoS_vect2[D], Nz_vect2, Nz_vect2, posreal, posreal, posreal] ->
  [Vect2 -> bool]]

location: 68 2 70 67
body:
    gs_los?(s,vo,vi,MinGS,MaxGS,MinRelSpeed)(nvo) : bool =
      nz_vect2?(nvo) AND
      EXISTS (irt): nvo = gs_los(s,vo,vi,MinGS,MaxGS,MinRelSpeed,irt)


decl_type: function
theory: horizontal_los
library: ACCoRD
location: 72 2 80 11
signature:
  [d: [LoS_vect2[D], Nz_vect2, Nz_vect2, posreal, Sign] ->
          {nvo | nvo /= zero => trk_only?(d`2)(nvo)}]

body:
    trk_los(s,vo,vi,MinRelSpeed,irt): {nvo | nz_vect2?(nvo) => 
                                   trk_only?(vo)(nvo)} =
      LET nv = max_circle_point_in_slice(zero,-vi,norm(vo),s,irt*perpR(s))
      IN
        IF intersects_circle_fun?(nv,-vi,norm(vo)) AND norm(nv)>=MinRelSpeed THEN
          nv+vi
        ELSE 
          zero
        ENDIF


decl_type: function
theory: horizontal_los
library: ACCoRD
signature:
  [[LoS_vect2[D], Nz_vect2, Nz_vect2, posreal] ->
  [Vect2 -> bool]]

location: 98 2 100 57
body:
    trk_los?(s,vo,vi,MinRelSpeed)(nvo) : bool =
      nz_vect2?(nvo) AND
      EXISTS (irt) : nvo = trk_los(s,vo,vi,MinRelSpeed,irt)


decl_type: function
theory: horizontal_los
library: ACCoRD
location: 115 2 117 38
signature:
  [[LoS_vect2[D], Nz_vect2, Nz_vect2, posreal, posreal, posreal,
         posreal] ->
          [Vect2 -> bool]]

body:
    los_recovery?(s,vo,vi,MinRelSpeed,MinGS,MaxGS,MinRelSpeed)(nvo) : bool =
      gs_los?(s,vo,vi,MinGS,MaxGS,MinRelSpeed)(nvo) OR
      trk_los?(s,vo,vi,MinRelSpeed)(nvo)


decl_type: tcc
theory: horizontal_los
library: ACCoRD
signature: nil
location: 156 0 160 999
body:
  % Subtype TCC generated (at line 36, column 20) for  norm(s) * D - sqv(s)
      % expected type  posreal
  sDs_TCC1: OBLIGATION
    FORALL (s: LoS_vect2[D]):
      norm(s) * D - sqv(s) >= 0 AND norm(s) * D - sqv(s) > 0;


decl_type: tcc
theory: horizontal_los
library: ACCoRD
signature: nil
location: 162 0 180 999
body:
  % Subtype TCC generated (at line 43, column 8) for  nv + vi
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           gs_only?(vo)(nvo) AND
                     %            MinGS <= norm(nvo) AND norm(nvo) <= MaxGS}
  gs_los_TCC1: OBLIGATION
    FORALL (s: LoS_vect2[D], vo: Nz_vect2, vi: Nz_vect2, MinGS: posreal,
            MaxGS: posreal, MinRelSpeed: posreal, irt: Sign, nv: Vect2):
      intersects_segment_fun?(zero, -vi, (1 / norm(vo)) * vo, MinGS, MaxGS,
                              s, irt * perpR(s))
       AND
       norm(nv) >= MinRelSpeed AND
        nv =
         max_segment_point_in_slice(zero, -vi, (1 / norm(vo)) * vo, MinGS,
                                    MaxGS, s, irt * perpR(s))
       IMPLIES
       nv + vi /= zero =>
        gs_only?(vo)(nv + vi) AND
         MinGS <= norm(nv + vi) AND norm(nv + vi) <= MaxGS;


decl_type: tcc
theory: horizontal_los
library: ACCoRD
signature: nil
location: 182 0 199 999
body:
  % Subtype TCC generated (at line 45, column 8) for  zero
      % expected type  {nvo |
                     %          nvo /= zero =>
                     %           gs_only?(vo)(nvo) AND
                     %            MinGS <= norm(nvo) AND norm(nvo) <= MaxGS}
  gs_los_TCC2: OBLIGATION
    FORALL (s: LoS_vect2[D], vo: Nz_vect2, vi: Nz_vect2, MinGS: posreal,
            MaxGS: posreal, MinRelSpeed: posreal, irt: Sign, nv: Vect2):
      NOT (intersects_segment_fun?(zero, -vi, (1 / norm(vo)) * vo, MinGS,
                                   MaxGS, s, irt * perpR(s))
            AND norm(nv) >= MinRelSpeed)
       AND
       nv =
        max_segment_point_in_slice(zero, -vi, (1 / norm(vo)) * vo, MinGS,
                                   MaxGS, s, irt * perpR(s))
       IMPLIES
       zero /= zero =>
        gs_only?(vo)(zero) AND MinGS <= norm(zero) AND norm(zero) <= MaxGS;


decl_type: tcc
theory: horizontal_los
library: ACCoRD
signature: nil
location: 201 0 210 999
body:
  % Subtype TCC generated (at line 77, column 8) for  nv + vi
      % expected type  {nvo | nvo /= zero => trk_only?(vo)(nvo)}
  trk_los_TCC1: OBLIGATION
    FORALL (s: LoS_vect2[D], vo: Nz_vect2, vi: Nz_vect2,
            MinRelSpeed: posreal, irt: Sign, nv: Vect2):
      intersects_circle_fun?(nv, -vi, norm(vo)) AND
       norm(nv) >= MinRelSpeed AND
        nv =
         max_circle_point_in_slice(zero, -vi, norm(vo), s, irt * perpR(s))
       IMPLIES nv + vi /= zero => trk_only?(vo)(nv + vi);


decl_type: tcc
theory: horizontal_los
library: ACCoRD
signature: nil
location: 212 0 221 999
body:
  % Subtype TCC generated (at line 79, column 8) for  zero
      % expected type  {nvo | nvo /= zero => trk_only?(vo)(nvo)}
  trk_los_TCC2: OBLIGATION
    FORALL (s: LoS_vect2[D], vo: Nz_vect2, vi: Nz_vect2,
            MinRelSpeed: posreal, irt: Sign, nv: Vect2):
      NOT (intersects_circle_fun?(nv, -vi, norm(vo)) AND
            norm(nv) >= MinRelSpeed)
       AND
       nv = max_circle_point_in_slice(zero, -vi, norm(vo), s, irt * perpR(s))
       IMPLIES zero /= zero => trk_only?(vo)(zero);


decl_type: tcc
theory: horizontal_los
library: ACCoRD
signature: nil
location: 223 0 230 999
body:
  % Subtype TCC generated (at line 144, column 18) for  -s
      % expected type  LoS_vect2[D]
  los_recovery_coordination_TCC1: OBLIGATION
    FORALL (MaxGSo, MinGSo, MinRelSpeedo: posreal, nvo: Vect2,
            s: LoS_vect2[D], vi, vo: Nz_vect2):
      los_recovery?(s, vo, vi, MinRelSpeedo, MinGSo, MaxGSo, MinRelSpeedo)
                   (nvo)
       IMPLIES sqv(-s) < sq(D);


decl_type: formula
theory: horizontal_los_criterion
library: ACCoRD
signature: nil
location: 18 2 21 31
body:
    horizontal_los_criterion_repulsive: LEMMA
      horizontal_los_criterion(s,vo,vi,nvo,eps)
      IMPLIES
      repulsive?(s,vo-vi)(nvo-vi)


decl_type: formula
theory: horizontal_los_criterion
library: ACCoRD
signature: nil
location: 23 2 27 32
body:
    horizontal_los_criterion_coordinately_repulsive: LEMMA
      horizontal_los_criterion(s,vo,vi,nvo,eps) AND
      horizontal_los_criterion(-s,vi,vo,nvi,eps)
      IMPLIES
      repulsive?(s,vo-vi)(nvo-nvi)


decl_type: function
theory: horizontal_los_criterion
library: ACCoRD
signature: [[Nz_vect2, Nz_vect2, Nz_vect2, Nz_vect2, Sign] -> bool]
location: 16 2 16 101
body:
    horizontal_los_criterion(s, vo, vi, nvo, eps): MACRO bool = repulsive_criteria(s,vo-vi,eps)(nvo-vi)


decl_type: formula
theory: examples
library: MetiTarski
signature: nil
location: 36 2 39 63
body:
    tr_35 : LEMMA
      abs(phi) <= 35 AND 
      v   ## [| 200, 250 |] IMPLIES
      abs(180*g*tan(phi*pi/180)/(pi*v*0.514)) ## [|0.000, 3.825|]


decl_type: formula
theory: examples
library: MetiTarski
signature: nil
location: 79 0 96 33
body:
  ajn : LEMMA
      FORALL(sx,sy,vx,vy,nvx,nvy,nwx,nwy,eps,pt,px:real) :
         px > 0 AND pt > 0 AND (eps = 1 OR eps = -1)
         AND nvx * sx + nvy * sy + nvx * nvx * pt + nvy * nvy * pt >= 0
         AND sx * vx + sy * vy < 0 AND sx * vy * eps - sy * vx * eps <= 0
         AND nvy * sx * eps - nvx * sy * eps < 0
         AND nvx * vy * eps - nvy * vx * eps < 0
         AND nvy * sx * eps - nvx * sy * eps <= 0
         AND -1 * (nwx * sy * eps) - nvy * nwx * eps * pt + nwy * sx * eps +
              nvx * nwy * eps * pt
              < 0
         AND nwx * sx + nwy * sy + nvx * nwx * pt + nvy * nwy * pt >
              nvx * sx + nvy * sy + nvx * nvx * pt + nvy * nvy * pt
         AND nwx * vy * eps - nwy * vx * eps < 0
         IMPLIES
         -1 * (nvx * sy * eps * pt) - nwx * sy * eps * px +
          nvy * sx * eps * pt
          + nwy * sx * eps * px < 0


decl_type: formula
theory: examples
library: MetiTarski
signature: nil
location: 141 2 145 19
body:
    quadratic : LEMMA
      FORALL(a,b,c,t:real) :
        a > 0 AND
        a*sq(t) + b*t + c < 0 IMPLIES
        sq(b) > 4*a*c


decl_type: formula
theory: examples
library: MetiTarski
signature: nil
location: 153 2 155 74
body:
    Tunnel_3_IL : LEMMA
      x ## [| 0, 2.39*10^(-9) |] IMPLIES
      -0.0059 - 0.000016*exp(-2.55*10^8*x) + 0.031*exp(-5.49*10^7*x) <= 0.03


decl_type: formula
theory: examples
library: MetiTarski
signature: nil
location: 158 2 162 22
body:
    Tunnel_3_IL_LU : LEMMA
      x ## [| 0, 8.17*10^(-8) |] IMPLIES
      -0.0006427443996*exp(-2.559889987*(10^8*x)) - 0.07600397043 + 
       0.1443470449*exp(-4.211001275*(10^6*x)) 
        ## [| 0, 0.08 |]


decl_type: formula
theory: examples
library: MetiTarski
signature: nil
location: 168 2 170 85
body:
    Ayad_Marche : LEMMA
      FORALL (r:real) : abs(r) <= 1 IMPLIES
        abs(0.9890365552 + 1.130258690*r + 0.5540440796*r*r - exp(r)) <= (1-2^-16)*2^-4


decl_type: function
theory: examples
library: MetiTarski
signature: [real -> real]
location: 66 2 67 51
body:
    r(x) : MACRO real = x - (11184811/33554432) * x^3 
                          - (13421773/67108864) * x^5


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 178 0 180 999
body:
  % Subtype TCC generated (at line 31, column 9) for  x
      % expected type  nnx: nonneg_real
  sqrtx3_TCC1: OBLIGATION FORALL (x: real): x ## [|1, 2|] IMPLIES x >= 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 182 0 186 999
body:
  % Subtype TCC generated (at line 39, column 18) for  phi * pi / 180
      % expected type  (Tan?)
  tr_35_TCC1: OBLIGATION
    FORALL (phi: real, v: posreal):
      v ## [|200, 250|] AND abs(phi) <= 35 IMPLIES Tan?(phi * pi / 180);


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 188 0 190 999
body:
  % Subtype TCC generated (at line 47, column 19) for  35 * pi / 180
      % expected type  (Tan?)
  tr_35_le_TCC1: OBLIGATION Tan?(35 * pi / 180);


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 192 0 194 999
body:
  % Subtype TCC generated (at line 58, column 38) for  1 - x
      % expected type  posreal
  G_TCC1: OBLIGATION FORALL (x: real | x < 1): 1 - x >= 0 AND 1 - x > 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 196 0 198 999
body:
  % Subtype TCC generated (at line 66, column 50) for  3
      % expected type  {i: int | x /= 0 OR i >= 0}
  r_TCC1: OBLIGATION FORALL (x: real): x /= 0 OR 3 >= 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 200 0 202 999
body:
  % Subtype TCC generated (at line 67, column 50) for  5
      % expected type  {i: int | x /= 0 OR i >= 0}
  r_TCC2: OBLIGATION FORALL (x: real): x /= 0 OR 5 >= 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 204 0 207 999
body:
  % Subtype TCC generated (at line 108, column 10) for  2
      % expected type  {i: int | x /= 0 OR i >= 0}
  ex1_ba_TCC1: OBLIGATION
    FORALL (x: real): x ## [|0, 1|] IMPLIES x /= 0 OR 2 >= 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 209 0 212 999
body:
  % Subtype TCC generated (at line 108, column 30) for  1 + x
      % expected type  posreal
  ex1_ba_TCC2: OBLIGATION
    FORALL (x: real): x ## [|0, 1|] IMPLIES 1 + x >= 0 AND 1 + x > 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 214 0 217 999
body:
  % Subtype TCC generated (at line 113, column 7) for  1 - x
      % expected type  posreal
  ex2_ba_TCC1: OBLIGATION
    FORALL (x: real): x ## [|0, 0.9|] IMPLIES 1 - x >= 0 AND 1 - x > 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 219 0 222 999
body:
  % Subtype TCC generated (at line 118, column 33) for  1 - x
      % expected type  posreal
  ex3_ba_TCC1: OBLIGATION
    FORALL (x: real): x ## [|0, 1 / 2|] IMPLIES 1 - x >= 0 AND 1 - x > 0;


decl_type: tcc
theory: examples
library: MetiTarski
signature: nil
location: 224 0 227 999
body:
  % Subtype TCC generated (at line 128, column 11) for  1 + x
      % expected type  posreal
  ex5_ba_TCC1: OBLIGATION
    FORALL (x: real): x ## [|-1 / 2, 0|] IMPLIES 1 + x >= 0 AND 1 + x > 0;


decl_type: tcc
theory: is_prime
library: PVSioChecker
signature: nil
location: 13 0 17 999
body:
  % Subtype TCC generated (at line 6, column 59) for  j
      % expected type  nonzero_integer
  is_prime?_TCC1: OBLIGATION
    FORALL (n: nat):
      NOT n = 2 AND n > 1 IMPLIES (FORALL (j: subrange(2, n - 1)): j /= 0);


decl_type: function
theory: pathname
library: PVSioChecker
signature: [string -> string]
location: 10 2 17 9
body:
    pathname_dir(name:string) : string =
      LET path = pathname_path(name) IN
      IF null?(path) THEN ""
      ELSIF car(path) = "/" THEN
        format("/~{~a/~}",{|cdr(path)|})
      ELSE
        format("~{~a/~}",{|path|})
      ENDIF


decl_type: tcc
theory: pathname
library: PVSioChecker
signature: nil
location: 24 0 29 999
body:
  % Subtype TCC generated (at line 13, column 14) for  path
      % expected type  (cons?[string])
  pathname_dir_TCC1: OBLIGATION
    FORALL (name: string, path: list[string]):
      NOT null?(path) AND path = pathname_path(name) IMPLIES
       cons?[string](path);


decl_type: function
theory: time_fun
library: PVSioChecker
signature: [real -> string]
location: 19 2 25 35
body:
    hms(t:real) : string =
      LET ts = floor(t),
          ms = t-ts,
          h = floor(ts/3600),
          m = floor(mod(ts,3600)/60),
          s = mod(mod(ts,3600),60)+ms IN
      format("~ah:~am:~,3fs",(h,m,s))


decl_type: constant
theory: time_fun
library: PVSioChecker
signature: [real, real]
location: 13 2 16 67
body:
    toc : [real,real] = 
      LET (ret,rut) = (real_time,run_time),
          (re0,ru0) = val[[nat,nat]](Stamp) IN
        ((ret-re0)/internal_time_units,(rut-ru0)/internal_time_units)


decl_type: tcc
theory: time_fun
library: PVSioChecker
signature: nil
location: 35 0 57 999
body:
  % Existence TCC generated (at line 25, column 4) for  format
  hms_TCC1: OBLIGATION
    FORALL (t: real, ts: {i | i <= t & t < 1 + i}):
      ts = floor(t) IMPLIES
       (FORALL (ms: real):
          ms = t - ts IMPLIES
           (FORALL (h: {i | i <= ts / 3600 & ts / 3600 < 1 + i}):
              h = floor(ts / 3600) IMPLIES
               (FORALL (m:
                          {i |
                                   i <= mod(ts, 3600) / 60 &
                                    mod(ts, 3600) / 60 < 1 + i}):
                  m = floor(mod(ts, 3600) / 60) IMPLIES
                   (FORALL (s: real):
                      s = mod(mod(ts, 3600), 60) + ms IMPLIES
                       (EXISTS (x:
                                  [{i | i <= ts / 3600 & ts / 3600 < 1 + i},
                                   {i |
                                            i <= mod(ts, 3600) / 60
                                            &
                                            mod(ts, 3600) / 60 < 1 + i},
                                   real]):
                          TRUE)))));


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [[IStream, nat] -> void]
location: 21 2 31 9
body:
    print_etc(fin:IStream,maxr:nat) : void =
      IF mod(val[nat](Records),val[posnat](Frequency)) = 0 THEN
        LET is   = IF maxr = 0 THEN safe_div(flength(fin),fgetpos(fin))
                   ELSE safe_div(maxr,val[nat](Records)) ENDIF,
            per  = floor(100*safe_div(1,is)),
            time = toc`1*(is-1) IN
          printf("[~d% - Line: ~d, Records: ~a] Estimated Time of Completion: ~a~%",
                (per,val(CurrentLine),val(Records),hms(time)))
      ELSE
        skip
      ENDIF 


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [[string, [[IStream, OStream] -> bool], nat] -> void]
location: 33 2 62 9
body:
    checker(file:string,check:[[IStream,OStream]->bool],maxr:nat) : void =
      IF file = "" OR fexists(file) THEN
        LET fin     = IF file = "" THEN stdin ELSE fopenin(file) ENDIF,
            nameout = IF maxr = 0 THEN format("~a~a.out",
                                             (pathname_dir(file),pathname_name(file))) 
                      ELSE format("~a~a-~a.out",
                                 (pathname_dir(file),pathname_name(file),maxr)) ENDIF,
            fout    = IF file = "" THEN stdout ELSE fopenout(create,nameout) ENDIF IN
          IF file /= "" THEN 
            printf("Reading: ~a. Writing: ~a~%",(file,nameout)) &
            fprintf(fout,"Date: ~a~%",date) &
            fprintf(fout,"Input file: ~a~%",file) 
          ELSE skip ENDIF &
          set[nat](Records,0) &
          set[nat](Fails,0) &
          set[nat](CurrentLine,0) &
          tic &
          while(NOT eof?(fin) AND maxr <= 0 OR val[nat](Records) < maxr,
                set[nat](Records,val[nat](Records)+1) &
                IF check(fin,fout) THEN skip ELSE set[nat](Fails,val[nat](Fails)+1) ENDIF &
                IF file /= "" THEN print_etc(fin,maxr) ELSE skip ENDIF) &
          LET msg = format("~a~%Lines: ~a. Records: ~a. Fails: ~a~%",
                          (str_toc,val[nat](CurrentLine),val[nat](Records),val[nat](Fails))) IN
          printf(msg) & 
          IF file /= "" THEN fprintf(fout,msg) ELSE skip ENDIF &
          fclose(fin) &
          fclose(fout) 
      ELSE
        printf("File ~a doesn't exist",file)
      ENDIF


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [string -> bool]
location: 64 2 66 40
body:
    empty_line(line:string) : bool =
      LET trln = trim(line) IN
        trln = "" OR strfind("%",trln) = 0


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [IStream -> string]
location: 68 2 73 21
body:
    readln_checker(fin:IStream):string =
      LET lvar = ref[string]("") IN
        prog(while (NOT eof?(fin) AND empty_line(val(lvar)),
               set[nat](CurrentLine,val[nat](CurrentLine)+1) &
               set[string](lvar,fread_line(fin))),
             val(lvar))


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [[OStream, string, real, real, nnreal] -> bool]
location: 81 2 88 9
body:
    check_real_prec(fout:OStream,msg:string,pvs,io:real,prec:nnreal) : bool =
      IF NOT almost_equal_prec?(pvs,io,prec) THEN
        fprintf(fout,"*** ERROR~a. Line: ~a. Record: ~a. PVS: ~,8f vs. Input: ~,8f~%",
               (msg,val(CurrentLine),val(Records),pvs,io)) &
        FALSE
      ELSE
        TRUE
      ENDIF


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [[OStream, string, real, real] -> bool]
location: 90 2 91 51
body:
    check_real(fout:OStream,msg:string,pvs,io:real) : bool =
      check_real_prec(fout,msg,io,pvs,val(Precision))


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [[OStream, string, bool, bool] -> bool]
location: 93 2 100 9
body:
    check_bool(fout:OStream,msg:string,pvs,io:bool) : bool =
      IF pvs /= io THEN
        fprintf(fout,"*** ERROR~a. Line: ~a. Record: ~a. PVS: ~a vs. Input: ~a~%",
               (msg,val(CurrentLine),val(Records),pvs,io)) &
        FALSE
      ELSE
        TRUE
      ENDIF


decl_type: function
theory: pvsio_checker
library: PVSioChecker
signature: [[OStream, string, int, int] -> bool]
location: 102 2 109 9
body:
    check_int(fout:OStream,msg:string,pvs,io:int) : bool =
      IF pvs /= io THEN
        fprintf(fout,"*** ERROR~a. Line: ~a. Record: ~a. PVS: ~a vs. Input: ~a~%",
               (msg,val(CurrentLine),val(Records),pvs,io)) &
        FALSE
      ELSE
        TRUE
      ENDIF


decl_type: tcc
theory: pvsio_checker
library: PVSioChecker
signature: nil
location: 118 0 120 999
body:
  % Subtype TCC generated (at line 19, column 27) for  n
      % expected type  nznum
  safe_div_TCC1: OBLIGATION FORALL (n: real): NOT n = 0 IMPLIES n /= 0;


decl_type: tcc
theory: pvsio_checker
library: PVSioChecker
signature: nil
location: 122 0 145 999
body:
  % Existence TCC generated (at line 7024, column 10) for  format
  print_etc_TCC1: OBLIGATION
    FORALL (fin: IStream, maxr: nat):
      mod(val[nat](Records), val[posnat](Frequency)) = 0 IMPLIES
       (FORALL (is: real):
          is =
           IF maxr = 0 THEN safe_div(flength(fin), fgetpos(fin))
           ELSE safe_div(maxr, val[nat](Records))
           ENDIF
           IMPLIES
           (FORALL (per:
                      {i |
                               i <= 100 * safe_div(1, is) &
                                100 * safe_div(1, is) < 1 + i}):
              per = floor(100 * safe_div(1, is)) IMPLIES
               (FORALL (time: real):
                  time = toc`1 * (is - 1) IMPLIES
                   (EXISTS (x:
                              [{i |
                                        i <= 100 * safe_div(1, is)
                                        &
                                        100 * safe_div(1, is) < 1 + i},
                               nat, nat, string]):
                      TRUE))));


decl_type: function
theory: prime_check
library: PVSioChecker
signature: [[IStream, OStream] -> bool]
location: 8 2 12 32
body:
    check?(fin:IStream,fout:OStream) : bool = 
      LET n  = str2pvs[nat](readln_checker(fin)),  % Read n from file
          io = str2pvs[bool](readln_checker(fin)), % Read output from file
          pvs = is_prime?(n) IN
        check_bool(fout,"",pvs,io) % Check PVS output against ouput in file       


decl_type: function
theory: prime_check
library: PVSioChecker
signature: [[string, nat] -> void]
location: 14 2 17 32
body:
    main(file:string,records:nat): void =
      %set[posnat](Frequency,n) &    % Set frequency (in number of records) to print estimated time of completion
      %set[posreal](Precision,r) &   % Set precision to almost_equal
      checker(file,check?,records)


decl_type: formula
theory: clear_denominators
library: Sturm
signature: nil
location: 20 0 21 39
body:
  posratpair_plus: LEMMA posratpair_convert(prp1)+posratpair_convert(prp2)=
                         posratpair_convert(prp1+prp2);


decl_type: formula
theory: clear_denominators
library: Sturm
signature: nil
location: 26 0 27 39
body:
  posratpair_div: LEMMA posratpair_convert(prp1)/posratpair_convert(prp2)=
                         posratpair_convert(prp1/prp2);


decl_type: formula
theory: clear_denominators
library: Sturm
signature: nil
location: 42 0 44 37
body:
  PosRatMeas_increasing: LEMMA
    (EXISTS (pn:(PosRatSet(x))): FORALL (pm:(PosRatSet(y))): pn<pm)
    IMPLIES PosRatMeas(x)<PosRatMeas(y)


decl_type: function
theory: clear_denominators
library: Sturm
signature: [[PosRatPair, PosRatPair] -> PosRatPair]
location: 17 0 18 34
body:
  +(prp1,prp2):PosRatPair = (# num:=prp1`num*prp2`den+prp2`num*prp1`den,
                               den:=prp1`den*prp2`den #);


decl_type: function
theory: clear_denominators
library: Sturm
signature: [[PosRatPair, PosRatPair] -> PosRatPair]
location: 23 0 24 34
body:
  /(prp1,prp2):PosRatPair = (# num:=prp1`num*prp2`den,
                               den:=prp1`den*prp2`num #);


decl_type: function
theory: clear_denominators
library: Sturm
signature: [posrat -> set[posnat]]
location: 29 0 30 37
body:
  PosRatSet(x): set[posnat]= {N:posnat | EXISTS (pn1,pn2:posnat):
                                     x=pn1/pn2 AND N=pn1+pn2}


decl_type: function
theory: clear_denominators
library: Sturm
signature: [posrat -> nat]
location: 38 0 40 42
body:
  PosRatMeas(x): nat =
    LET mp:posnat = glb(PosRatSet(x)) IN
      IF x<1 THEN 10^mp ELSE 10^mp - 1 ENDIF


decl_type: function
theory: clear_denominators
library: Sturm
signature: [x: posrat -> {prp | posratpair_convert(prp) = x}]
location: 49 0 53 29
body:
  compute_posratpair(x:posrat): RECURSIVE {prp | posratpair_convert(prp)=x} =
    IF floor(x)=x THEN (# num:=floor(x),den:=1 #)
    ELSIF x>1 THEN (# num:=floor(x),den:=1 #) + compute_posratpair(x-floor(x))
    ELSE (# num:=1,den:=1 #)/compute_posratpair(1/x)
    ENDIF MEASURE PosRatMeas(x)


decl_type: function
theory: clear_denominators
library: Sturm
location: 59 0 76 17
signature:
  [d: [[nat -> rat], nat] ->
          {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                   (EXISTS (cp: posrat):
                      FORALL (j: nat): ans`newpoly(j) = cp * d`1(j))
                    AND
                    (FORALL (j: upto(d`2)):
                       integer_pred(ans`newpoly(j)) AND
                        divides(ans`currgcd, ans`newpoly(j)))}]

body:
  rat_poly_to_int_rec(aq,n): RECURSIVE {ans:[# newpoly:[nat->rat],currgcd:posnat #] |
    (EXISTS (cp:posrat): FORALL (j:nat): ans`newpoly(j) = cp*aq(j)) AND
    (FORALL (j:upto(n)): rational_pred(ans`newpoly(j)) AND
                         integer_pred(ans`newpoly(j)) AND
                         divides(ans`currgcd,ans`newpoly(j)))} =
    IF n = 0 AND aq(0)=0 THEN (# newpoly:=aq,currgcd:=1 #)
    ELSIF n = 0 THEN 
      LET thisden = compute_posratpair(abs(aq(0)))`den IN
        (# newpoly:= (LAMBDA (i:nat): thisden*aq(i)),
           currgcd:= abs(thisden*aq(0)) #)
    ELSIF aq(n) = 0 THEN rat_poly_to_int_rec(aq,n-1)
    ELSE
      LET currpoly = rat_poly_to_int_rec(aq,n-1),
          thisden = compute_posratpair(abs(currpoly`newpoly(n)))`den
      IN  (# newpoly:=(LAMBDA (i:nat): thisden*(currpoly`newpoly(i))),
             currgcd:=compute_gcd(thisden*currpoly`newpoly(n),
                                            currpoly`currgcd) #)
    ENDIF MEASURE n


decl_type: function
theory: clear_denominators
library: Sturm
location: 78 0 83 62
signature:
  [d: [[nat -> rat], nat] ->
          {ai: [nat -> int] |
                   EXISTS (cp: posrat):
                     FORALL (j: upto(d`2)): ai(j) = cp * d`1(j)}]

body:
  rat_poly_to_int(aq,n): {ai:[nat->int] | EXISTS (cp:posrat):
                         FORALL (j:upto(n)): ai(j) = cp*aq(j) } =
    LET rptir = rat_poly_to_int_rec(aq,n),
        ppoly = rptir`newpoly,
        mgcd  = rptir`currgcd
    IN (LAMBDA (i:nat): IF i<=n THEN ppoly(i)/mgcd ELSE 0 ENDIF)


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 90 0 97 999
body:
  % Subtype TCC generated (at line 36, column 11) for
      % extend[real, posnat, bool, FALSE](PosRatSet(x))
      % expected type  SB: (bounded_below?)
  PosRatSet_glb_posnat_TCC1: OBLIGATION
    FORALL (x: posrat, pn: posnat):
      PosRatSet(x)(pn) IMPLIES
       nonempty?[real](extend[real, posnat, bool, FALSE](PosRatSet(x))) AND
        bounded_below?(extend[real, posnat, bool, FALSE](PosRatSet(x)));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 99 0 105 999
body:
  % Subtype TCC generated (at line 39, column 22) for
      % extend[real, posnat, bool, FALSE](PosRatSet(x))
      % expected type  SB: (bounded_below?)
  PosRatMeas_TCC1: OBLIGATION
    FORALL (x: posrat):
      nonempty?[real](extend[real, posnat, bool, FALSE](PosRatSet(x))) AND
       bounded_below?(extend[real, posnat, bool, FALSE](PosRatSet(x)));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 107 0 115 999
body:
  % Subtype TCC generated (at line 39, column 18) for
      % glb(extend[real, posnat, bool, FALSE](PosRatSet(x)))
      % expected type  posnat
  PosRatMeas_TCC2: OBLIGATION
    FORALL (x: posrat):
      rational_pred(glb(extend[real, posnat, bool, FALSE](PosRatSet(x)))) AND
       integer_pred(glb(extend[real, posnat, bool, FALSE](PosRatSet(x)))) AND
        glb(extend[real, posnat, bool, FALSE](PosRatSet(x))) >= 0 AND
         glb(extend[real, posnat, bool, FALSE](PosRatSet(x))) > 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 117 0 122 999
body:
  % Subtype TCC generated (at line 40, column 27) for  10 ^ mp - 1
      % expected type  nat
  PosRatMeas_TCC3: OBLIGATION
    FORALL (x: posrat, mp: posnat):
      NOT x < 1 AND mp = glb(extend[real, posnat, bool, FALSE](PosRatSet(x)))
       IMPLIES 10 ^ mp - 1 >= 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 124 0 127 999
body:
  % Subtype TCC generated (at line 47, column 16) for  x - pn
      % expected type  posrat
  PosRatMeas_glb_minus_posnat_TCC1: OBLIGATION
    FORALL (pn: posnat, x: posrat): x > pn IMPLIES x - pn >= 0 AND x - pn > 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 129 0 137 999
body:
  % Subtype TCC generated (at line 47, column 6) for
      % extend[real, posnat, bool, FALSE](PosRatSet(x - pn))
      % expected type  SB: (bounded_below?)
  PosRatMeas_glb_minus_posnat_TCC2: OBLIGATION
    FORALL (pn: posnat, x: posrat):
      x > pn IMPLIES
       nonempty?[real](extend[real, posnat, bool, FALSE](PosRatSet(x - pn)))
        AND
        bounded_below?(extend[real, posnat, bool, FALSE](PosRatSet(x - pn)));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 139 0 142 999
body:
  % Subtype TCC generated (at line 50, column 29) for  floor(x)
      % expected type  posnat
  compute_posratpair_TCC1: OBLIGATION
    FORALL (x: posrat): floor(x) = x IMPLIES floor(x) > 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 144 0 150 999
body:
  % Subtype TCC generated (at line 50, column 21) for
      % (# num := floor(x), den := 1 #)
      % expected type  {prp | posratpair_convert(prp) = x}
  compute_posratpair_TCC2: OBLIGATION
    FORALL (x: posrat):
      floor(x) = x IMPLIES
       posratpair_convert((# num := floor(x), den := 1 #)) = x;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 152 0 155 999
body:
  % Subtype TCC generated (at line 51, column 25) for  floor(x)
      % expected type  posnat
  compute_posratpair_TCC3: OBLIGATION
    FORALL (x: posrat): x > 1 AND NOT floor(x) = x IMPLIES floor(x) > 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 157 0 162 999
body:
  % Subtype TCC generated (at line 51, column 65) for  x - floor(x)
      % expected type  x: posrat
  compute_posratpair_TCC4: OBLIGATION
    FORALL (x: posrat):
      x > 1 AND NOT floor(x) = x IMPLIES
       x - floor(x) >= 0 AND x - floor(x) > 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 164 0 169 999
body:
  % Termination TCC generated (at line 51, column 46) for
      % compute_posratpair(x - floor(x))
  compute_posratpair_TCC5: OBLIGATION
    FORALL (x: posrat):
      x > 1 AND NOT floor(x) = x IMPLIES
       PosRatMeas(x - floor(x)) < PosRatMeas(x);


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 171 0 181 999
body:
  % Subtype TCC generated (at line 51, column 17) for
      % (# num := floor(x), den := 1 #) + compute_posratpair(x - floor(x))
      % expected type  {prp | posratpair_convert(prp) = x}
  compute_posratpair_TCC6: OBLIGATION
    FORALL (x: posrat,
            v:
              [x1: {z: posrat | PosRatMeas(z) < PosRatMeas(x)} ->
                 {prp | posratpair_convert(prp) = x1}]):
      x > 1 AND NOT floor(x) = x IMPLIES
       posratpair_convert((# num := floor(x), den := 1 #) + v(x - floor(x)))
        = x;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 183 0 188 999
body:
  % Termination TCC generated (at line 52, column 27) for
      % compute_posratpair(1 / x)
  compute_posratpair_TCC7: OBLIGATION
    FORALL (x: posrat):
      NOT x > 1 AND NOT floor(x) = x IMPLIES
       PosRatMeas(1 / x) < PosRatMeas(x);


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 190 0 199 999
body:
  % Subtype TCC generated (at line 52, column 7) for
      % (# num := 1, den := 1 #) / compute_posratpair(1 / x)
      % expected type  {prp | posratpair_convert(prp) = x}
  compute_posratpair_TCC8: OBLIGATION
    FORALL (x: posrat,
            v:
              [x1: {z: posrat | PosRatMeas(z) < PosRatMeas(x)} ->
                 {prp | posratpair_convert(prp) = x1}]):
      NOT x > 1 AND NOT floor(x) = x IMPLIES
       posratpair_convert((# num := 1, den := 1 #) / v(1 / x)) = x;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 201 0 215 999
body:
  % Subtype TCC generated (at line 64, column 28) for
      % (# newpoly := aq, currgcd := 1 #)
      % expected type  {ans: [# newpoly: [nat -> rat], currgcd: posnat #] |
                     %          (EXISTS (cp: posrat):
                     %             FORALL (j: nat):
                     %               ans`newpoly(j) = cp * aq(j))
                     %           AND
                     %           (FORALL (j: upto(n)):
                     %              integer_pred(ans`newpoly(j)) AND
                     %               divides(ans`currgcd, ans`newpoly(j)))}
  rat_poly_to_int_rec_TCC1: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      n = 0 AND aq(0) = 0 IMPLIES
       (EXISTS (cp: posrat): FORALL (j: nat): aq(j) = cp * aq(j)) AND
        (FORALL (j: upto(n)): integer_pred(aq(j)) AND divides(1, aq(j)));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 217 0 225 999
body:
  % Subtype TCC generated (at line 68, column 19) for  abs(thisden * aq(0))
      % expected type  posnat
  rat_poly_to_int_rec_TCC2: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       (FORALL (thisden: posnat):
          thisden = compute_posratpair(abs(aq(0)))`den IMPLIES
           abs(thisden * aq(0)) > 0 AND
            abs(thisden * aq(0)) >= 0 AND integer_pred(abs(thisden * aq(0))));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 227 0 248 999
body:
  % Subtype TCC generated (at line 67, column 6) for
      % (# newpoly := (LAMBDA (i: nat): thisden * aq(i)),
      %    currgcd := abs(thisden * aq(0)) #)
      % expected type  {ans: [# newpoly: [nat -> rat], currgcd: posnat #] |
                     %          (EXISTS (cp: posrat):
                     %             FORALL (j: nat):
                     %               ans`newpoly(j) = cp * aq(j))
                     %           AND
                     %           (FORALL (j: upto(n)):
                     %              integer_pred(ans`newpoly(j)) AND
                     %               divides(ans`currgcd, ans`newpoly(j)))}
  rat_poly_to_int_rec_TCC3: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       (FORALL (thisden: posnat):
          thisden = compute_posratpair(abs(aq(0)))`den IMPLIES
           (EXISTS (cp: posrat):
              FORALL (j: nat): thisden * aq(j) = cp * aq(j))
            AND
            (FORALL (j: upto(n)):
               integer_pred(thisden * aq(j)) AND
                divides(abs(thisden * aq(0)), thisden * aq(j))));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 250 0 254 999
body:
  % Subtype TCC generated (at line 66, column 37) for  abs(aq(0))
      % expected type  x: posrat
  rat_poly_to_int_rec_TCC4: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES abs(aq(0)) > 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 256 0 261 999
body:
  % Subtype TCC generated (at line 69, column 46) for  n - 1
      % expected type  nat
  rat_poly_to_int_rec_TCC5: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       n - 1 >= 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 263 0 267 999
body:
  % Termination TCC generated (at line 69, column 23) for
      % rat_poly_to_int_rec(aq, n - 1)
  rat_poly_to_int_rec_TCC6: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES n - 1 < n;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 269 0 296 999
body:
  % Subtype TCC generated (at line 69, column 23) for
      % rat_poly_to_int_rec(aq, n - 1)
      % expected type  {ans: [# newpoly: [nat -> rat], currgcd: posnat #] |
                     %          (EXISTS (cp: posrat):
                     %             FORALL (j: nat):
                     %               ans`newpoly(j) = cp * aq(j))
                     %           AND
                     %           (FORALL (j: upto(n)):
                     %              integer_pred(ans`newpoly(j)) AND
                     %               divides(ans`currgcd, ans`newpoly(j)))}
  rat_poly_to_int_rec_TCC7: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat,
            v:
              [d1: {z: [[nat -> rat], nat] | z`2 < n} ->
                 {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                          (EXISTS (cp: posrat):
                             FORALL (j: nat): ans`newpoly(j) = cp * d1`1(j))
                           AND
                           (FORALL (j: upto(d1`2)):
                              integer_pred(ans`newpoly(j)) AND
                               divides(ans`currgcd, ans`newpoly(j)))}]):
      aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       (EXISTS (cp: posrat):
          FORALL (j: nat): v(aq, n - 1)`newpoly(j) = cp * aq(j))
        AND
        (FORALL (j: upto(n)):
           integer_pred(v(aq, n - 1)`newpoly(j)) AND
            divides(v(aq, n - 1)`currgcd, v(aq, n - 1)`newpoly(j)));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 298 0 321 999
body:
  % Subtype TCC generated (at line 72, column 30) for
      % abs(currpoly`newpoly(n))
      % expected type  x: posrat
  rat_poly_to_int_rec_TCC8: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat,
            v:
              [d1: {z: [[nat -> rat], nat] | z`2 < n} ->
                 {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                          (EXISTS (cp: posrat):
                             FORALL (j: nat): ans`newpoly(j) = cp * d1`1(j))
                           AND
                           (FORALL (j: upto(d1`2)):
                              integer_pred(ans`newpoly(j)) AND
                               divides(ans`currgcd, ans`newpoly(j)))}]):
      NOT aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       (FORALL (currpoly:
                  {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                           (EXISTS (cp: posrat):
                              FORALL (j: nat): ans`newpoly(j) = cp * aq(j))
                            AND
                            (FORALL (j: upto(n - 1)):
                               integer_pred(ans`newpoly(j)) AND
                                divides(ans`currgcd, ans`newpoly(j)))}):
          currpoly = v(aq, n - 1) IMPLIES abs(currpoly`newpoly(n)) > 0);


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 323 0 349 999
body:
  % Subtype TCC generated (at line 74, column 29) for
      % thisden * currpoly`newpoly(n)
      % expected type  int
  rat_poly_to_int_rec_TCC9: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat,
            v:
              [d1: {z: [[nat -> rat], nat] | z`2 < n} ->
                 {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                          (EXISTS (cp: posrat):
                             FORALL (j: nat): ans`newpoly(j) = cp * d1`1(j))
                           AND
                           (FORALL (j: upto(d1`2)):
                              integer_pred(ans`newpoly(j)) AND
                               divides(ans`currgcd, ans`newpoly(j)))}]):
      NOT aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       (FORALL (currpoly:
                  {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                           (EXISTS (cp: posrat):
                              FORALL (j: nat): ans`newpoly(j) = cp * aq(j))
                            AND
                            (FORALL (j: upto(n - 1)):
                               integer_pred(ans`newpoly(j)) AND
                                divides(ans`currgcd, ans`newpoly(j)))}):
          currpoly = v(aq, n - 1) IMPLIES
           (FORALL (thisden: posnat):
              thisden = compute_posratpair(abs(currpoly`newpoly(n)))`den
               IMPLIES integer_pred(thisden * currpoly`newpoly(n))));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 351 0 378 999
body:
  % Subtype TCC generated (at line 75, column 35) for  currpoly`currgcd
      % expected type  {jj: int |
                     %          thisden * currpoly`newpoly(n) = 0 => jj /= 0}
  rat_poly_to_int_rec_TCC10: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat,
            v:
              [d1: {z: [[nat -> rat], nat] | z`2 < n} ->
                 {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                          (EXISTS (cp: posrat):
                             FORALL (j: nat): ans`newpoly(j) = cp * d1`1(j))
                           AND
                           (FORALL (j: upto(d1`2)):
                              integer_pred(ans`newpoly(j)) AND
                               divides(ans`currgcd, ans`newpoly(j)))}]):
      NOT aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       (FORALL (currpoly:
                  {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                           (EXISTS (cp: posrat):
                              FORALL (j: nat): ans`newpoly(j) = cp * aq(j))
                            AND
                            (FORALL (j: upto(n - 1)):
                               integer_pred(ans`newpoly(j)) AND
                                divides(ans`currgcd, ans`newpoly(j)))}):
          currpoly = v(aq, n - 1) IMPLIES
           (FORALL (thisden: posnat):
              thisden = compute_posratpair(abs(currpoly`newpoly(n)))`den
               IMPLIES
               thisden * currpoly`newpoly(n) = 0 => currpoly`currgcd /= 0));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 380 0 425 999
body:
  % Subtype TCC generated (at line 73, column 8) for
      % (# newpoly := (LAMBDA (i: nat): thisden * (currpoly`newpoly(i))),
      %    currgcd
      %      := compute_gcd(thisden * currpoly`newpoly(n),
      %                     currpoly`currgcd) #)
      % expected type  {ans: [# newpoly: [nat -> rat], currgcd: posnat #] |
                     %          (EXISTS (cp: posrat):
                     %             FORALL (j: nat):
                     %               ans`newpoly(j) = cp * aq(j))
                     %           AND
                     %           (FORALL (j: upto(n)):
                     %              integer_pred(ans`newpoly(j)) AND
                     %               divides(ans`currgcd, ans`newpoly(j)))}
  rat_poly_to_int_rec_TCC11: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat,
            v:
              [d1: {z: [[nat -> rat], nat] | z`2 < n} ->
                 {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                          (EXISTS (cp: posrat):
                             FORALL (j: nat): ans`newpoly(j) = cp * d1`1(j))
                           AND
                           (FORALL (j: upto(d1`2)):
                              integer_pred(ans`newpoly(j)) AND
                               divides(ans`currgcd, ans`newpoly(j)))}]):
      NOT aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       (FORALL (currpoly:
                  {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                           (EXISTS (cp: posrat):
                              FORALL (j: nat): ans`newpoly(j) = cp * aq(j))
                            AND
                            (FORALL (j: upto(n - 1)):
                               integer_pred(ans`newpoly(j)) AND
                                divides(ans`currgcd, ans`newpoly(j)))}):
          currpoly = v(aq, n - 1) IMPLIES
           (FORALL (thisden: posnat):
              thisden = compute_posratpair(abs(currpoly`newpoly(n)))`den
               IMPLIES
               (EXISTS (cp: posrat):
                  FORALL (j: nat):
                    thisden * (currpoly`newpoly(j)) = cp * aq(j))
                AND
                (FORALL (j: upto(n)):
                   integer_pred(thisden * (currpoly`newpoly(j))) AND
                    divides(compute_gcd(thisden * currpoly`newpoly(n),
                                        currpoly`currgcd),
                            thisden * (currpoly`newpoly(j))))));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 427 0 432 999
body:
  % Subtype TCC generated (at line 71, column 42) for  n - 1
      % expected type  nat
  rat_poly_to_int_rec_TCC12: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      NOT aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       n - 1 >= 0;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 434 0 439 999
body:
  % Termination TCC generated (at line 71, column 19) for
      % rat_poly_to_int_rec(aq, n - 1)
  rat_poly_to_int_rec_TCC13: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat):
      NOT aq(n) = 0 AND NOT n = 0 AND NOT (n = 0 AND aq(0) = 0) IMPLIES
       n - 1 < n;


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 441 0 459 999
body:
  % Subtype TCC generated (at line 83, column 35) for  ppoly(i) / mgcd
      % expected type  int
  rat_poly_to_int_TCC1: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat,
            rptir:
              {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                       (EXISTS (cp: posrat):
                          FORALL (j: nat): ans`newpoly(j) = cp * aq(j))
                        AND
                        (FORALL (j: upto(n)):
                           integer_pred(ans`newpoly(j)) AND
                            divides(ans`currgcd, ans`newpoly(j)))}):
      rptir = rat_poly_to_int_rec(aq, n) IMPLIES
       (FORALL (ppoly: [nat -> rat]):
          ppoly = rptir`newpoly IMPLIES
           (FORALL (mgcd: posnat):
              mgcd = rptir`currgcd IMPLIES
               (FORALL (i: nat):
                  i <= n IMPLIES integer_pred(ppoly(i) / mgcd))));


decl_type: tcc
theory: clear_denominators
library: Sturm
signature: nil
location: 461 0 484 999
body:
  % Subtype TCC generated (at line 83, column 6) for
      % (LAMBDA (i: nat): IF i <= n THEN ppoly(i) / mgcd ELSE 0 ENDIF)
      % expected type  {ai: [nat -> int] |
                     %          EXISTS (cp: posrat):
                     %            FORALL (j: upto(n)): ai(j) = cp * aq(j)}
  rat_poly_to_int_TCC2: OBLIGATION
    FORALL (aq: [nat -> rat], n: nat,
            rptir:
              {ans: [# currgcd: posnat, newpoly: [nat -> rat] #] |
                       (EXISTS (cp: posrat):
                          FORALL (j: nat): ans`newpoly(j) = cp * aq(j))
                        AND
                        (FORALL (j: upto(n)):
                           integer_pred(ans`newpoly(j)) AND
                            divides(ans`currgcd, ans`newpoly(j)))}):
      rptir = rat_poly_to_int_rec(aq, n) IMPLIES
       (FORALL (ppoly: [nat -> rat]):
          ppoly = rptir`newpoly IMPLIES
           (FORALL (mgcd: posnat):
              mgcd = rptir`currgcd IMPLIES
               (EXISTS (cp: posrat):
                  FORALL (j: upto(n)):
                    IF j <= n THEN ppoly(j) / mgcd ELSE 0 ENDIF =
                     cp * aq(j))));


decl_type: formula
theory: polynomial_division
library: Sturm
signature: nil
location: 29 2 35 36
body:
    poly_divide_def: LEMMA
      h(m)/=0 IMPLIES
      LET pd = poly_divide(g,n)(h,m)(i) IN
          FORALL (x:real):
          polynomial(g,n)(x) = 
            polynomial(pd`quot,pd`qdeg)(x)*polynomial(h,m)(x)
              + polynomial(pd`rem,pd`rdeg)(x)


decl_type: formula
theory: polynomial_division
library: Sturm
signature: nil
location: 37 2 41 22
body:
    poly_divide_struct: LEMMA h(m)/=0 IMPLIES
      LET pd = poly_divide(g,n)(h,m)(0) IN
          (m=0 AND pd`rdeg = 0 AND pd`rem = (LAMBDA (i:nat): 0))
          OR
          (m>0 AND pd`rdeg < m)


decl_type: formula
theory: polynomial_division
library: Sturm
signature: nil
location: 43 2 46 65
body:
    poly_divide_lengths: LEMMA h(m)/=0 IMPLIES
      LET pd = poly_divide(g,n)(h,m)(i) IN
      pd`qdeg = (IF i<=n-m THEN n-m ELSE 0 ENDIF) AND
      pd`rdeg = (IF i>n-m THEN n ELSIF m=0 THEN 0 ELSE m+i-1 ENDIF)


decl_type: type
theory: polynomial_division
library: Sturm
signature: nil
location: 9 2 10 40
body:
    DivType : TYPE = [# quot: [nat->real],qdeg:nat,
                        rem : [nat->real],rdeg :nat #]


decl_type: function
theory: polynomial_division
library: Sturm
signature:
  [[[nat -> real], nat] ->
  [[h: [nat -> real], {m | h(m) /= 0}] -> [nat -> DivType]]]

location: 14 2 27 26
body:
    poly_divide(g,n)(h,(m|h(m)/=0))(i): RECURSIVE DivType =
      IF m>n OR i>n-m THEN make_divtype(LAMBDA (j:nat): 0,0,g,n)
      ELSIF m = 0 THEN make_divtype((1/h(m))*g,n-m,LAMBDA (j:nat): 0,0)
      ELSE
        LET ldt = IF i=n-m THEN make_divtype(LAMBDA (j:nat): 0,n-m,g,n)
                    ELSE poly_divide(g,n)(h,m)(i+1) ENDIF,
            thisterm = ldt`rem(ldt`rdeg)/h(m)
        IN  make_divtype(ldt`quot WITH [(i):=thisterm],
                         n-m,LAMBDA (j:nat):
                               IF j>m+i THEN 0
                               ELSIF j<i THEN ldt`rem(j)
                               ELSE ldt`rem(j)-thisterm*h(j-i) ENDIF,m+i-1)
      ENDIF
      MEASURE max(n-m-i+1,0)


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 53 0 57 999
body:
  % Subtype TCC generated (at line 27, column 12) for  max(n - m - i + 1, 0)
      % expected type  naturalnumber
  poly_divide_TCC1: OBLIGATION
    FORALL (n: nat, h: [nat -> real], (m: nat | h(m) /= 0), i: nat):
      max(n - m - i + 1, 0) >= 0;


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 59 0 63 999
body:
  % Subtype TCC generated (at line 16, column 37) for  h(m)
      % expected type  nznum
  poly_divide_TCC2: OBLIGATION
    FORALL (n: nat, h: [nat -> real], (m: nat | h(m) /= 0), i: nat):
      m = 0 AND NOT m > n AND NOT i > n - m IMPLIES h(m) /= 0;


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 65 0 69 999
body:
  % Subtype TCC generated (at line 16, column 45) for  n - m
      % expected type  nat
  poly_divide_TCC3: OBLIGATION
    FORALL (n: nat, h: [nat -> real], (m: nat | h(m) /= 0), i: nat):
      m = 0 AND NOT m > n AND NOT i > n - m IMPLIES n - m >= 0;


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 71 0 89 999
body:
  % Subtype TCC generated (at line 20, column 36) for  h(m)
      % expected type  nznum
  poly_divide_TCC4: OBLIGATION
    FORALL (g: [nat -> real], n: nat, h: [nat -> real], (m: nat | h(m) /= 0),
            i: nat,
            v:
              [z: [[nat -> real], nat] ->
                 [z1: [h: [nat -> real], {m | h(m) /= 0}] ->
                    [{z2: nat |
                              max(1 - z2 - z1`2 + z`2, 0) <
                               max(1 + n - i - m, 0)} ->
                       DivType]]]):
      NOT m = 0 AND NOT m > n AND NOT i > n - m IMPLIES
       (FORALL (ldt: DivType):
          ldt =
           IF i = n - m THEN make_divtype(LAMBDA (j: nat): 0, n - m, g, n)
           ELSE v(g, n)(h, m)(i + 1)
           ENDIF
           IMPLIES h(m) /= 0);


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 91 0 111 999
body:
  % Subtype TCC generated (at line 22, column 16) for  n - m
      % expected type  nat
  poly_divide_TCC5: OBLIGATION
    FORALL (g: [nat -> real], n: nat, h: [nat -> real], (m: nat | h(m) /= 0),
            i: nat,
            v:
              [z: [[nat -> real], nat] ->
                 [z1: [h: [nat -> real], {m | h(m) /= 0}] ->
                    [{z2: nat |
                              max(1 - z2 - z1`2 + z`2, 0) <
                               max(1 + n - i - m, 0)} ->
                       DivType]]]):
      NOT m = 0 AND NOT m > n AND NOT i > n - m IMPLIES
       (FORALL (ldt: DivType):
          ldt =
           IF i = n - m THEN make_divtype(LAMBDA (j: nat): 0, n - m, g, n)
           ELSE v(g, n)(h, m)(i + 1)
           ENDIF
           IMPLIES
           (FORALL (thisterm: real):
              thisterm = ldt`rem(ldt`rdeg) / h(m) IMPLIES n - m >= 0));


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 113 0 135 999
body:
  % Subtype TCC generated (at line 25, column 35) for  j - i
      % expected type  nat
  poly_divide_TCC6: OBLIGATION
    FORALL (g: [nat -> real], n: nat, h: [nat -> real], (m: nat | h(m) /= 0),
            i: nat,
            v:
              [z: [[nat -> real], nat] ->
                 [z1: [h: [nat -> real], {m | h(m) /= 0}] ->
                    [{z2: nat |
                              max(1 - z2 - z1`2 + z`2, 0) <
                               max(1 + n - i - m, 0)} ->
                       DivType]]]):
      NOT m = 0 AND NOT m > n AND NOT i > n - m IMPLIES
       (FORALL (ldt: DivType):
          ldt =
           IF i = n - m THEN make_divtype(LAMBDA (j: nat): 0, n - m, g, n)
           ELSE v(g, n)(h, m)(i + 1)
           ENDIF
           IMPLIES
           (FORALL (thisterm: real):
              thisterm = ldt`rem(ldt`rdeg) / h(m) IMPLIES
               (FORALL (j1: nat):
                  NOT j1 < i AND NOT j1 > m + i IMPLIES j1 - i >= 0)));


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 137 0 157 999
body:
  % Subtype TCC generated (at line 25, column 46) for  m + i - 1
      % expected type  nat
  poly_divide_TCC7: OBLIGATION
    FORALL (g: [nat -> real], n: nat, h: [nat -> real], (m: nat | h(m) /= 0),
            i: nat,
            v:
              [z: [[nat -> real], nat] ->
                 [z1: [h: [nat -> real], {m | h(m) /= 0}] ->
                    [{z2: nat |
                              max(1 - z2 - z1`2 + z`2, 0) <
                               max(1 + n - i - m, 0)} ->
                       DivType]]]):
      NOT m = 0 AND NOT m > n AND NOT i > n - m IMPLIES
       (FORALL (ldt: DivType):
          ldt =
           IF i = n - m THEN make_divtype(LAMBDA (j: nat): 0, n - m, g, n)
           ELSE v(g, n)(h, m)(i + 1)
           ENDIF
           IMPLIES
           (FORALL (thisterm: real):
              thisterm = ldt`rem(ldt`rdeg) / h(m) IMPLIES m + i - 1 >= 0));


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 159 0 164 999
body:
  % Subtype TCC generated (at line 18, column 61) for  n - m
      % expected type  nat
  poly_divide_TCC8: OBLIGATION
    FORALL (n: nat, h: [nat -> real], (m: nat | h(m) /= 0), i: nat):
      i = n - m AND NOT m = 0 AND NOT m > n AND NOT i > n - m IMPLIES
       n - m >= 0;


decl_type: tcc
theory: polynomial_division
library: Sturm
signature: nil
location: 166 0 171 999
body:
  % Termination TCC generated (at line 19, column 20) for
      % poly_divide(g, n)(h, m)(i + 1)
  poly_divide_TCC9: OBLIGATION
    FORALL (n: nat, h: [nat -> real], (m: nat | h(m) /= 0), i: nat):
      NOT i = n - m AND NOT m = 0 AND NOT m > n AND NOT i > n - m IMPLIES
       max(n - m - (i + 1) + 1, 0) < max(n - m - i + 1, 0);


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 28 2 29 80
body:
    gcd_coeff_nonzero: LEMMA
      (EXISTS (i:below(length[int](l))): nth[int](l,i)/=0) IMPLIES gcd_coeff(l)/=0


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 31 2 32 85
body:
    gcd_coeff_zero: LEMMA
      (FORALL (i:nat): i<length[int](l) IMPLIES nth[int](l,i)=0) IMPLIES gcd_coeff(l)=0


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 47 2 53 59
body:
    primitize_list_def: LEMMA
      (EXISTS (i:below(length[int](l))): nth[int](l,i)/=0)
      IMPLIES
      length[int](l) = length[int](primitize_list(l)) AND
      LET thisgcd=gcd_coeff(l) IN
        thisgcd>0 AND FORALL (k:below(length[int](l))):
        nth[int](l,k) = thisgcd*nth[int](primitize_list(l),k)


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 55 2 58 74
body:
    primitize_zero_list: LEMMA
      (FORALL (i:nat): i<length[int](l) IMPLIES nth[int](l,i)=0)
      IMPLIES
      primitize_list(l) = array2list[int](length[int](l))(LAMBDA (i:nat): 0)


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 71 2 75 77
body:
    nonzero_version_rec_length_nonzero: LEMMA
      FORALL (ll:list[int]):
        length[int](nonzero_version_rec(ll)) > 0
        IFF
        (length[int](ll)>0 AND EXISTS (i:below(length[int](ll))): nth(ll,i)/=0)


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 77 2 80 66
body:
    nonzero_version_rec_def: LEMMA FORALL (ll:list[int]):
      LET L = nonzero_version_rec(ll) IN
        length[int](L) > 0 IMPLIES (car(L)/=0 AND FORALL (i:nat):
          i<length[int](ll)-length[int](L) IMPLIES nth[int](ll,i)=0)


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 85 2 97 76
body:
    nonzero_version_def: LEMMA FORALL (ll:list[int]):
      LET L = nonzero_version(ll) IN
         length[int](L)<=length[int](ll) AND
         (FORALL (i:nat): i<length[int](ll) 
           IMPLIES nth[int](ll,i) = 
             (IF i<length[int](L) THEN 
             nth[int](L,i) ELSE 0 ENDIF)) AND 
         ((EXISTS (i:below(length[int](ll))):nth(ll,i)/=0) 
           IMPLIES (length[int](L)>0 AND nth(L,length[int](L)-1)/=0)) AND
         (length[int](L) > 0 IFF (length[int](ll)>0 AND 
           EXISTS (i:below(length[int](ll))): nth(ll,i)/=0)) AND
         (length[int](L) > 0 IMPLIES (nth[int](L,length[int](L)-1)/=0 AND FORALL (i:nat):
           i>length[int](L)-1 AND i<length[int](ll) IMPLIES nth[int](ll,i)=0))


decl_type: formula
theory: gcd_coeff
library: Sturm
signature: nil
location: 99 2 101 28
body:
    nonzero_version_length_nz: LEMMA FORALL (ll:list[int]):
      length(ll)>0 AND nth(ll,length(ll)-1)/=0 IMPLIES
      nonzero_version(ll) = ll


decl_type: function
theory: gcd_coeff
library: Sturm
location: 18 2 26 33
signature:
  [ll: list[int] ->
          {m: nat |
                   FORALL (ii: nat):
                     ii < length[int](ll) IMPLIES
                      divides(m, nth[int](ll, ii))}]

body:
    gcd_coeff(ll:list[int]): RECURSIVE {m:nat| FORALL (ii:nat): 
                                      ii<length[int](ll) IMPLIES divides(m,nth[int](ll,ii))} =
      IF length[int](ll)=0 THEN 0
      ELSIF length[int](ll)=1 THEN abs(nth[int](ll,0))
      ELSE LET oldgcd = gcd_coeff(cdr[int](ll)) IN
        IF car[int](ll)=0 THEN oldgcd
        ELSIF oldgcd=1 THEN 1
        ELSE compute_gcd(car[int](ll),oldgcd) ENDIF
      ENDIF MEASURE length[int](ll)


decl_type: function
theory: gcd_coeff
library: Sturm
location: 34 2 40 24
signature:
  [d:
          [ll: list[int],
           {k: nzint |
                    FORALL (ii: nat):
                      ii < length[int](ll) IMPLIES
                       divides(k, nth[int](ll, ii))}] ->
          {nl: list[int] |
                   length[int](nl) = length[int](d`1) AND
                    (FORALL (i: below(length[int](d`1))):
                       nth[int](d`1, i) = d`2 * nth[int](nl, i))}]

body:
    descalarize_list(ll:list[int],(k:nzint|
        FORALL (ii:nat): ii<length[int](ll) IMPLIES 
          divides(k,nth[int](ll,ii)))): RECURSIVE {nl:list[int]|length[int](nl)=length[int](ll) AND
          FORALL (i:below(length[int](ll))): nth[int](ll,i)=k*nth[int](nl,i)} =
          IF null?(ll) THEN ll
          ELSE cons[int](car[int](ll)/k,descalarize_list(cdr[int](ll),k)) ENDIF
          MEASURE length[int](ll)


decl_type: function
theory: gcd_coeff
library: Sturm
signature: [list[int] -> list[int]]
location: 42 2 45 45
body:
    primitize_list(ll:list[int]): list[int] =
      LET thisgcd = gcd_coeff(ll) IN
        IF thisgcd = 0 OR thisgcd = 1 THEN ll
        ELSE descalarize_list(ll,thisgcd) ENDIF


decl_type: function
theory: gcd_coeff
library: Sturm
location: 63 2 69 72
signature:
  [ll: list[int] ->
          {nl: list[int] |
                   length[int](nl) <= length[int](ll) AND
                    (FORALL (i: nat):
                       i < length[int](ll) IMPLIES
                        nth[int](ll, i) =
                         (IF i < length[int](ll) - length[int](nl) THEN 0
                          ELSE nth[int]
                                   (nl,
                                    i + length[int](nl)
                                    -
                                    length[int](ll))
                          ENDIF))
                     AND
                     ((length[int](nl) > 0 OR
                        (EXISTS (i: below(length[int](ll))):
                           nth(ll, i) /= 0))
                       IMPLIES
                       (length[int](nl) > 0 AND car[int](nl) /= 0))}]

body:
    nonzero_version_rec(ll:list[int]): RECURSIVE 
      {nl:list[int] | length[int](nl)<=length[int](ll) AND
        (FORALL (i:nat): i<length[int](ll) 
          IMPLIES nth[int](ll,i) = (IF i<length[int](ll)-length[int](nl) THEN 0 ELSE nth[int](nl,i-length[int](ll)+length[int](nl)) ENDIF))
         AND ((length[int](nl)>0 OR EXISTS (i:below(length[int](ll))):nth(ll,i)/=0) IMPLIES (length[int](nl)>0 AND car[int](nl)/=0))} =
      IF length[int](ll)=0 OR car[int](ll) /= 0 THEN ll
      ELSE nonzero_version_rec(cdr[int](ll)) ENDIF measure length[int](ll)


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 108 0 117 999
body:
  % Subtype TCC generated (at line 20, column 30) for  0
      % expected type  {m: nat |
                     %          FORALL (ii: nat):
                     %            ii < length[int](ll) IMPLIES
                     %             divides(m, nth[int](ll, ii))}
  gcd_coeff_TCC1: OBLIGATION
    FORALL (ll: list[int]):
      length[int](ll) = 0 IMPLIES
       (FORALL (ii: nat):
          ii < length[int](ll) IMPLIES divides(0, nth[int](ll, ii)));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 119 0 124 999
body:
  % Subtype TCC generated (at line 21, column 49) for  0
      % expected type  below[length(ll)]
  gcd_coeff_TCC2: OBLIGATION
    FORALL (ll: list[int]):
      length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       0 < length[int](ll);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 126 0 136 999
body:
  % Subtype TCC generated (at line 21, column 33) for  abs(nth[int](ll, 0))
      % expected type  {m: nat |
                     %          FORALL (ii: nat):
                     %            ii < length[int](ll) IMPLIES
                     %             divides(m, nth[int](ll, ii))}
  gcd_coeff_TCC3: OBLIGATION
    FORALL (ll: list[int]):
      length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       (FORALL (ii: nat):
          ii < length[int](ll) IMPLIES
           divides(abs(nth[int](ll, 0)), nth[int](ll, ii)));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 138 0 154 999
body:
  % Subtype TCC generated (at line 23, column 18) for  ll
      % expected type  (cons?)
  gcd_coeff_TCC4: OBLIGATION
    FORALL (ll: list[int],
            v:
              [ll1: {z: list[int] | length[int](z) < length[int](ll)} ->
                 {m: nat |
                          FORALL (ii: nat):
                            ii < length[int](ll1) IMPLIES
                             divides(m, nth[int](ll1, ii))}]):
      NOT length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       (FORALL (oldgcd:
                  {m: nat |
                           FORALL (ii: nat):
                             ii < length[int](cdr[int](ll)) IMPLIES
                              divides(m, nth[int](cdr[int](ll), ii))}):
          oldgcd = v(cdr[int](ll)) IMPLIES cons?[int](ll));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 156 0 178 999
body:
  % Subtype TCC generated (at line 23, column 29) for  oldgcd
      % expected type  {m: nat |
                     %          FORALL (ii: nat):
                     %            ii < length[int](ll) IMPLIES
                     %             divides(m, nth[int](ll, ii))}
  gcd_coeff_TCC5: OBLIGATION
    FORALL (ll: list[int],
            v:
              [ll1: {z: list[int] | length[int](z) < length[int](ll)} ->
                 {m: nat |
                          FORALL (ii: nat):
                            ii < length[int](ll1) IMPLIES
                             divides(m, nth[int](ll1, ii))}]):
      NOT length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       (FORALL (oldgcd:
                  {m: nat |
                           FORALL (ii: nat):
                             ii < length[int](cdr[int](ll)) IMPLIES
                              divides(m, nth[int](cdr[int](ll), ii))}):
          car[int](ll) = 0 AND oldgcd = v(cdr[int](ll)) IMPLIES
           (FORALL (ii: nat):
              ii < length[int](ll) IMPLIES
               divides(oldgcd, nth[int](ll, ii))));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 180 0 202 999
body:
  % Subtype TCC generated (at line 24, column 26) for  1
      % expected type  {m: nat |
                     %          FORALL (ii: nat):
                     %            ii < length[int](ll) IMPLIES
                     %             divides(m, nth[int](ll, ii))}
  gcd_coeff_TCC6: OBLIGATION
    FORALL (ll: list[int],
            v:
              [ll1: {z: list[int] | length[int](z) < length[int](ll)} ->
                 {m: nat |
                          FORALL (ii: nat):
                            ii < length[int](ll1) IMPLIES
                             divides(m, nth[int](ll1, ii))}]):
      NOT length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       (FORALL (oldgcd:
                  {m: nat |
                           FORALL (ii: nat):
                             ii < length[int](cdr[int](ll)) IMPLIES
                              divides(m, nth[int](cdr[int](ll), ii))}):
          oldgcd = 1 AND NOT car[int](ll) = 0 AND oldgcd = v(cdr[int](ll))
           IMPLIES
           (FORALL (ii: nat):
              ii < length[int](ll) IMPLIES divides(1, nth[int](ll, ii))));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 204 0 222 999
body:
  % Subtype TCC generated (at line 25, column 36) for  oldgcd
      % expected type  {jj: int | car[int](ll) = 0 => jj /= 0}
  gcd_coeff_TCC7: OBLIGATION
    FORALL (ll: list[int],
            v:
              [ll1: {z: list[int] | length[int](z) < length[int](ll)} ->
                 {m: nat |
                          FORALL (ii: nat):
                            ii < length[int](ll1) IMPLIES
                             divides(m, nth[int](ll1, ii))}]):
      NOT length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       (FORALL (oldgcd:
                  {m: nat |
                           FORALL (ii: nat):
                             ii < length[int](cdr[int](ll)) IMPLIES
                              divides(m, nth[int](cdr[int](ll), ii))}):
          NOT oldgcd = 1 AND
           NOT car[int](ll) = 0 AND oldgcd = v(cdr[int](ll))
           IMPLIES car[int](ll) = 0 => oldgcd /= 0);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 224 0 249 999
body:
  % Subtype TCC generated (at line 25, column 11) for
      % compute_gcd(car[int](ll), oldgcd)
      % expected type  {m: nat |
                     %          FORALL (ii: nat):
                     %            ii < length[int](ll) IMPLIES
                     %             divides(m, nth[int](ll, ii))}
  gcd_coeff_TCC8: OBLIGATION
    FORALL (ll: list[int],
            v:
              [ll1: {z: list[int] | length[int](z) < length[int](ll)} ->
                 {m: nat |
                          FORALL (ii: nat):
                            ii < length[int](ll1) IMPLIES
                             divides(m, nth[int](ll1, ii))}]):
      NOT length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       (FORALL (oldgcd:
                  {m: nat |
                           FORALL (ii: nat):
                             ii < length[int](cdr[int](ll)) IMPLIES
                              divides(m, nth[int](cdr[int](ll), ii))}):
          NOT oldgcd = 1 AND
           NOT car[int](ll) = 0 AND oldgcd = v(cdr[int](ll))
           IMPLIES
           (FORALL (ii: nat):
              ii < length[int](ll) IMPLIES
               divides(compute_gcd(car[int](ll), oldgcd), nth[int](ll, ii))));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 251 0 256 999
body:
  % Subtype TCC generated (at line 22, column 41) for  ll
      % expected type  (cons?)
  gcd_coeff_TCC9: OBLIGATION
    FORALL (ll: list[int]):
      NOT length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       cons?[int](ll);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 258 0 263 999
body:
  % Termination TCC generated (at line 22, column 22) for
      % gcd_coeff(cdr[int](ll))
  gcd_coeff_TCC10: OBLIGATION
    FORALL (ll: list[int]):
      NOT length[int](ll) = 1 AND NOT length[int](ll) = 0 IMPLIES
       length[int](cdr[int](ll)) < length[int](ll);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 265 0 270 999
body:
  % Subtype TCC generated (at line 37, column 65) for  i
      % expected type  below[length(nl)]
  descalarize_list_TCC1: OBLIGATION
    FORALL (ll: list[int], nl: list[int]):
      length[int](nl) = length[int](ll) IMPLIES
       (FORALL (i: below(length[int](ll))): i < length[int](nl));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 272 0 285 999
body:
  % Subtype TCC generated (at line 38, column 19) for  ll
      % expected type  {nl: list[int] |
                     %          length[int](nl) = length[int](ll) AND
                     %           (FORALL (i: below(length[int](ll))):
                     %              nth[int](ll, i) = k * nth[int](nl, i))}
  descalarize_list_TCC2: OBLIGATION
    FORALL (ll: list[int],
            (k: nzint
                 | FORALL (ii: nat):
                     ii < length[int](ll) IMPLIES
                      divides(k, nth[int](ll, ii)))):
      null?(ll) IMPLIES
       (FORALL (i: below(length[int](ll))):
          nth[int](ll, i) = k * nth[int](ll, i));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 287 0 295 999
body:
  % Subtype TCC generated (at line 39, column 25) for  ll
      % expected type  (cons?)
  descalarize_list_TCC3: OBLIGATION
    FORALL (ll: list[int],
            (k: nzint
                 | FORALL (ii: nat):
                     ii < length[int](ll) IMPLIES
                      divides(k, nth[int](ll, ii)))):
      NOT null?(ll) IMPLIES cons?[int](ll);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 297 0 305 999
body:
  % Subtype TCC generated (at line 39, column 16) for  car[int](ll) / k
      % expected type  int
  descalarize_list_TCC4: OBLIGATION
    FORALL (ll: list[int],
            (k: nzint
                 | FORALL (ii: nat):
                     ii < length[int](ll) IMPLIES
                      divides(k, nth[int](ll, ii)))):
      NOT null?(ll) IMPLIES integer_pred(car[int](ll) / k);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 307 0 321 999
body:
  % Subtype TCC generated (at line 39, column 61) for  k
      % expected type  {k: nzint |
                     %          FORALL (ii: nat):
                     %            ii < length[int](cdr[int](ll)) IMPLIES
                     %             divides(k, nth[int](cdr[int](ll), ii))}
  descalarize_list_TCC5: OBLIGATION
    FORALL (ll: list[int],
            (k: nzint
                 | FORALL (ii: nat):
                     ii < length[int](ll) IMPLIES
                      divides(k, nth[int](ll, ii)))):
      NOT null?(ll) IMPLIES
       (FORALL (ii: nat):
          ii < length[int](cdr[int](ll)) IMPLIES
           divides(k, nth[int](cdr[int](ll), ii)));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 323 0 331 999
body:
  % Termination TCC generated (at line 39, column 31) for
      % descalarize_list(cdr[int](ll), k)
  descalarize_list_TCC6: OBLIGATION
    FORALL (ll: list[int],
            (k: nzint
                 | FORALL (ii: nat):
                     ii < length[int](ll) IMPLIES
                      divides(k, nth[int](ll, ii)))):
      NOT null?(ll) IMPLIES length[int](cdr[int](ll)) < length[int](ll);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 333 0 364 999
body:
  % Subtype TCC generated (at line 39, column 6) for
      % cons[int](car[int](ll) / k, descalarize_list(cdr[int](ll), k))
      % expected type  {nl: list[int] |
                     %          length[int](nl) = length[int](ll) AND
                     %           (FORALL (i: below(length[int](ll))):
                     %              nth[int](ll, i) = k * nth[int](nl, i))}
  descalarize_list_TCC7: OBLIGATION
    FORALL (ll: list[int],
            v:
              [d1:
                 {z:
                    [ll: list[int],
                     {k: nzint |
                              FORALL (ii: nat):
                                ii < length[int](ll) IMPLIES
                                 divides(k, nth[int](ll, ii))}] |
                          length[int](z`1) < length[int](ll)} ->
                 {nl: list[int] |
                          length[int](nl) = length[int](d1`1) AND
                           (FORALL (i: below(length[int](d1`1))):
                              nth[int](d1`1, i) = d1`2 * nth[int](nl, i))}],
            (k: nzint
                 | FORALL (ii: nat):
                     ii < length[int](ll) IMPLIES
                      divides(k, nth[int](ll, ii)))):
      NOT null?(ll) IMPLIES
       length[int](cons[int](car[int](ll) / k, v(cdr[int](ll), k))) =
        length[int](ll)
        AND
        (FORALL (i: below(length[int](ll))):
           nth[int](ll, i) =
            k * nth[int](cons[int](car[int](ll) / k, v(cdr[int](ll), k)), i));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 366 0 381 999
body:
  % Subtype TCC generated (at line 45, column 31) for  thisgcd
      % expected type  {k: nzint |
                     %          FORALL (ii: nat):
                     %            ii < length[int](ll) IMPLIES
                     %             divides(k, nth[int](ll, ii))}
  primitize_list_TCC1: OBLIGATION
    FORALL (ll: list[int],
            thisgcd:
              {m: nat |
                       FORALL (ii: nat):
                         ii < length[int](ll) IMPLIES
                          divides(m, nth[int](ll, ii))}):
      NOT thisgcd = 0 AND NOT thisgcd = 1 AND thisgcd = gcd_coeff(ll) IMPLIES
       thisgcd /= 0 AND
        (FORALL (ii: nat):
           ii < length[int](ll) IMPLIES divides(thisgcd, nth[int](ll, ii)));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 383 0 397 999
body:
  % Subtype TCC generated (at line 53, column 57) for  k
      % expected type  below[length(primitize_list(l))]
  primitize_list_def_TCC1: OBLIGATION
    FORALL (l: list[int]):
      (EXISTS (i: below(length[int](l))): nth[int](l, i) /= 0) AND
       length[int](l) = length[int](primitize_list(l))
       IMPLIES
       (FORALL (thisgcd:
                  {m: nat |
                           FORALL (ii: nat):
                             ii < length[int](l) IMPLIES
                              divides(m, nth[int](l, ii))}):
          thisgcd > 0 AND thisgcd = gcd_coeff(l) IMPLIES
           (FORALL (k: below(length[int](l))):
              k < length[int](primitize_list(l))));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 399 0 409 999
body:
  % Subtype TCC generated (at line 66, column 95) for
      % i - length[int](ll) + length[int](nl)
      % expected type  below[length(nl)]
  nonzero_version_rec_TCC1: OBLIGATION
    FORALL (ll: list[int], nl: list[int]):
      length[int](nl) <= length[int](ll) IMPLIES
       (FORALL (i: nat):
          NOT i < length[int](ll) - length[int](nl) AND i < length[int](ll)
           IMPLIES
           i - length[int](ll) + length[int](nl) >= 0 AND
            i - length[int](ll) + length[int](nl) < length[int](nl));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 411 0 426 999
body:
  % Subtype TCC generated (at line 67, column 122) for  nl
      % expected type  (cons?)
  nonzero_version_rec_TCC2: OBLIGATION
    FORALL (ll: list[int], nl: list[int]):
      length[int](nl) > 0 AND
       (length[int](nl) > 0 OR
         (EXISTS (i: below(length[int](ll))): nth(ll, i) /= 0))
        AND
        (FORALL (i: nat):
           i < length[int](ll) IMPLIES
            nth[int](ll, i) =
             (IF i < length[int](ll) - length[int](nl) THEN 0
              ELSE nth[int](nl, i - length[int](ll) + length[int](nl))
              ENDIF))
         AND length[int](nl) <= length[int](ll)
       IMPLIES cons?[int](nl);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 428 0 431 999
body:
  % Subtype TCC generated (at line 68, column 37) for  ll
      % expected type  (cons?)
  nonzero_version_rec_TCC3: OBLIGATION
    FORALL (ll: list[int]): NOT length[int](ll) = 0 IMPLIES cons?[int](ll);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 433 0 470 999
body:
  % Subtype TCC generated (at line 68, column 51) for  ll
      % expected type  {nl: list[int] |
                     %          length[int](nl) <= length[int](ll) AND
                     %           (FORALL (i: nat):
                     %              i < length[int](ll) IMPLIES
                     %               nth[int](ll, i) =
                     %                (IF i
                     %                    <
                     %                    length[int](ll) - length[int](nl)
                     %                 THEN 0
                     %                 ELSE nth[int]
                     %                      (nl,
                     %                       i + length[int](nl)
                     %                       -
                     %                       length[int](ll))
                     %                 ENDIF))
                     %            AND
                     %            ((length[int](nl) > 0 OR
                     %               (EXISTS
                     %                (i: below(length[int](ll))):
                     %                nth(ll, i) /= 0))
                     %              IMPLIES
                     %              (length[int](nl) > 0 AND
                     %                car[int](nl) /= 0))}
  nonzero_version_rec_TCC4: OBLIGATION
    FORALL (ll: list[int]):
      length[int](ll) = 0 OR car[int](ll) /= 0 IMPLIES
       length[int](ll) <= length[int](ll) AND
        (FORALL (i: nat):
           i < length[int](ll) IMPLIES
            nth[int](ll, i) =
             (IF i < length[int](ll) - length[int](ll) THEN 0
              ELSE nth[int](ll, i + length[int](ll) - length[int](ll))
              ENDIF))
         AND
         ((length[int](ll) > 0 OR
            (EXISTS (i: below(length[int](ll))): nth[int](ll, i) /= 0))
           IMPLIES (length[int](ll) > 0 AND car[int](ll) /= 0));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 472 0 477 999
body:
  % Termination TCC generated (at line 69, column 9) for
      % nonzero_version_rec(cdr[int](ll))
  nonzero_version_rec_TCC5: OBLIGATION
    FORALL (ll: list[int]):
      NOT length[int](ll) = 0 AND NOT car[int](ll) /= 0 IMPLIES
       length[int](cdr[int](ll)) < length[int](ll);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 479 0 543 999
body:
  % Subtype TCC generated (at line 69, column 9) for
      % nonzero_version_rec(cdr[int](ll))
      % expected type  {nl: list[int] |
                     %          length[int](nl) <= length[int](ll) AND
                     %           (FORALL (i: nat):
                     %              i < length[int](ll) IMPLIES
                     %               nth[int](ll, i) =
                     %                (IF i
                     %                    <
                     %                    length[int](ll) - length[int](nl)
                     %                 THEN 0
                     %                 ELSE nth[int]
                     %                      (nl,
                     %                       i + length[int](nl)
                     %                       -
                     %                       length[int](ll))
                     %                 ENDIF))
                     %            AND
                     %            ((length[int](nl) > 0 OR
                     %               (EXISTS
                     %                (i: below(length[int](ll))):
                     %                nth(ll, i) /= 0))
                     %              IMPLIES
                     %              (length[int](nl) > 0 AND
                     %                car[int](nl) /= 0))}
  nonzero_version_rec_TCC6: OBLIGATION
    FORALL (ll: list[int],
            v:
              [ll1: {z: list[int] | length[int](z) < length[int](ll)} ->
                 {nl: list[int] |
                          length[int](nl) <= length[int](ll1) AND
                           (FORALL (i: nat):
                              i < length[int](ll1) IMPLIES
                               nth[int](ll1, i) =
                                (IF i < length[int](ll1) - length[int](nl)
                                   THEN 0
                                 ELSE nth[int]
                                      (nl,
                                       i + length[int](nl)
                                       -
                                       length[int](ll1))
                                 ENDIF))
                            AND
                            ((length[int](nl) > 0 OR
                               (EXISTS (i: below(length[int](ll1))):
                                  nth(ll1, i) /= 0))
                              IMPLIES
                              (length[int](nl) > 0 AND
                                car[int](nl) /= 0))}]):
      NOT length[int](ll) = 0 AND NOT car[int](ll) /= 0 IMPLIES
       length[int](v(cdr[int](ll))) <= length[int](ll) AND
        (FORALL (i: nat):
           i < length[int](ll) IMPLIES
            nth[int](ll, i) =
             (IF i < length[int](ll) - length[int](v(cdr[int](ll))) THEN 0
              ELSE nth[int]
                       (v(cdr[int](ll)),
                        i + length[int](v(cdr[int](ll))) - length[int](ll))
              ENDIF))
         AND
         ((length[int](v(cdr[int](ll))) > 0 OR
            (EXISTS (i: below(length[int](ll))): nth[int](ll, i) /= 0))
           IMPLIES
           (length[int](v(cdr[int](ll))) > 0 AND
             car[int](v(cdr[int](ll))) /= 0));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 545 0 569 999
body:
  % Subtype TCC generated (at line 79, column 38) for  L
      % expected type  (cons?)
  nonzero_version_rec_def_TCC1: OBLIGATION
    FORALL (ll: list[int],
            L:
              {nl: list[int] |
                       length[int](nl) <= length[int](ll) AND
                        (FORALL (i: nat):
                           i < length[int](ll) IMPLIES
                            nth[int](ll, i) =
                             (IF i < length[int](ll) - length[int](nl) THEN 0
                              ELSE nth[int]
                                       (nl,
                                        i + length[int](nl)
                                        -
                                        length[int](ll))
                              ENDIF))
                         AND
                         ((length[int](nl) > 0 OR
                            (EXISTS (i: below(length[int](ll))):
                               nth[int](ll, i) /= 0))
                           IMPLIES
                           (length[int](nl) > 0 AND car[int](nl) /= 0))}):
      length[int](L) > 0 AND L = nonzero_version_rec(ll) IMPLIES
       cons?[real](L);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 571 0 597 999
body:
  % Subtype TCC generated (at line 80, column 61) for  i
      % expected type  below[length(ll)]
  nonzero_version_rec_def_TCC2: OBLIGATION
    FORALL (ll: list[int],
            L:
              {nl: list[int] |
                       length[int](nl) <= length[int](ll) AND
                        (FORALL (i: nat):
                           i < length[int](ll) IMPLIES
                            nth[int](ll, i) =
                             (IF i < length[int](ll) - length[int](nl) THEN 0
                              ELSE nth[int]
                                       (nl,
                                        i + length[int](nl)
                                        -
                                        length[int](ll))
                              ENDIF))
                         AND
                         ((length[int](nl) > 0 OR
                            (EXISTS (i: below(length[int](ll))):
                               nth[int](ll, i) /= 0))
                           IMPLIES
                           (length[int](nl) > 0 AND car[int](nl) /= 0))}):
      car(L) /= 0 AND length[int](L) > 0 AND L = nonzero_version_rec(ll)
       IMPLIES
       (FORALL (i: nat):
          i < length[int](ll) - length[int](L) IMPLIES i < length[int](ll));


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 599 0 611 999
body:
  % Subtype TCC generated (at line 93, column 45) for  length[int](L) - 1
      % expected type  below[length(L)]
  nonzero_version_def_TCC1: OBLIGATION
    FORALL (ll: list[int], L: list[int]):
           length[int](L) > 0
       AND (EXISTS (i: below(length[int](ll))): nth(ll, i) /= 0)
       AND FORALL (i: nat):
             i < length[int](ll) IMPLIES
              nth[int](ll, i) =
               (IF i < length[int](L) THEN nth[int](L, i) ELSE 0 ENDIF)
       AND length[int](L) <= length[int](ll) AND L = nonzero_version(ll)
       IMPLIES
       length[int](L) - 1 >= 0 AND length[int](L) - 1 < length[int](L);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 613 0 632 999
body:
  % Subtype TCC generated (at line 96, column 47) for  length[int](L) - 1
      % expected type  below[length(L)]
  nonzero_version_def_TCC2: OBLIGATION
    FORALL (ll: list[int], L: list[int]):
           length[int](L) > 0
       AND length[int](L) > 0 IMPLIES
            (length[int](ll) > 0 AND
              (EXISTS (i: below(length[int](ll))): nth(ll, i) /= 0))
       AND (length[int](ll) > 0 AND
             (EXISTS (i: below(length[int](ll))): nth(ll, i) /= 0))
            IMPLIES length[int](L) > 0
       AND ((EXISTS (i: below(length[int](ll))): nth(ll, i) /= 0) IMPLIES
             (length[int](L) > 0 AND nth(L, length[int](L) - 1) /= 0))
       AND FORALL (i: nat):
             i < length[int](ll) IMPLIES
              nth[int](ll, i) =
               (IF i < length[int](L) THEN nth[int](L, i) ELSE 0 ENDIF)
       AND length[int](L) <= length[int](ll) AND L = nonzero_version(ll)
       IMPLIES
       length[int](L) - 1 >= 0 AND length[int](L) - 1 < length[int](L);


decl_type: tcc
theory: gcd_coeff
library: Sturm
signature: nil
location: 634 0 639 999
body:
  % Subtype TCC generated (at line 100, column 28) for  length(ll) - 1
      % expected type  below[length(ll)]
  nonzero_version_length_nz_TCC1: OBLIGATION
    FORALL (ll: list[int]):
      length(ll) > 0 IMPLIES
       length[int](ll) - 1 >= 0 AND length[int](ll) - 1 < length[int](ll);


decl_type: formula
theory: polynomial_pseudo_divide
library: Sturm
signature: nil
location: 37 2 44 72
body:
    pseudo_div_lengths: LEMMA
      h(m)/=0 IMPLIES
      LET psd = pseudo_div(g,n)(h,m)(i),
          pd  = poly_divide(g,n)(h,m)(i),
          qlength = length(psd`quotl),
          rlength = length(psd`reml)
      IN  psd`qdegl = pd`qdeg AND psd`rdegl = pd`rdeg AND psd`rdegl = max(rlength-1,0) AND
          qlength = (IF i>n-m THEN 0 ELSIF m=0 THEN n-m+1 ELSE n-m-i+1 ENDIF)


