# Declarations

decl_type: tcc
theory: critical_pairs
library: TRS
signature: nil
location: 201 0 215 999
body:
  % Subtype TCC generated (at line 98, column 55) for
      %  #(finseq_appl[position[variable, symbol, arity]](seqv)(i))
      % expected type  SPP[variable, symbol, arity](ext(sg1)(t))
  CP_lemma_aux2_TCC2: OBLIGATION
    FORALL (R, t, x, sg1, sg2, Posv: positions[variable, symbol, arity]):
      Posv = Pos_var(t, x) IMPLIES
       (FORALL (seqv: finite_sequence[position[variable, symbol, arity]]):
          comp_cont?(R) AND RSigma(R, sg1, sg2, x) AND seqv = set2seq(Posv)
           IMPLIES
           (FORALL (i: below[length(seqv)]):
              SPP?[variable, symbol, arity]
                  (ext[variable, symbol, arity](sg1)(t))
                  ( #[position[variable, symbol, arity]]
                       (finseq_appl[position[variable, symbol, arity]]
                            (seqv)(i)))));


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 70 1 80 82
body:
   ntCP_lemma_aux1: LEMMA
     FORALL E, (p: position), (e1 | member(e1, E)), (e2 | member(e2, E)):
      ( ( positionsOF(lhs(e1))(p) &
         NOT vars?(subtermOF(lhs(e1), p))                                     &
         ext(sg1)(subtermOF(lhs(e1), p)) = ext(sg2)(lhs(e2)) )                &
         NOT (e1 = e2 AND p = empty_seq) )
            =>
             EXISTS t1, t2, delta:
               ntCP?(E)(t1, t2)                                               &
               ext(delta)(t1) = ext(sg1)(rhs(e1))                             &
               ext(delta)(t2) = replaceTerm(ext(sg1)(lhs(e1)), ext(sg2)(rhs(e2)), p)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 99 1 100 89
body:
   Orth_lemma_aux0 : LEMMA
    Card(Pos_var(t, x)) = 1  => EXISTS (p1) : (positionsOF(t)(p1) AND subtermOF(t,p1) = x )


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 102 1 104 62
body:
   equality_replaceTerm : LEMMA 
    positionsOF(s)(p) =>
    (t1 = t2 iff replaceTerm(s, t1, p) =  replaceTerm(s, t2, p))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 107 1 111 52
body:
   Var_occurs_only_once_also_in_subterms : LEMMA
    vars?(x) & positionsOF(s)(p) & p`length /= 0 &
    x = subtermOF(s, p) &
    card(Pos_var(s,x)) = 1   => 
        card(Pos_var(subtermOF(s, #(first(p))),x)) = 1    


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 114 1 117 58
body:
   SigmaP_equivalence : LEMMA 
    (NOT member(x, Vars(s)) &
    positionsOF(ext(sigma)(x))(p2))
        =>   ext(SigmaP(sigma, t, x, p2))(s) = ext(sigma)(s)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 120 1 126 48
body:
   SigmaP_vs_replaceTerm_linearR : LEMMA
    vars?(x) & positionsOF(s)(p1) &
    positionsOF(ext(sigma)(x))(p2) &
    x = subtermOF(s, p1) &
    Card(Pos_var(s,x)) = 1   => 
        ext(SigmaP(sigma, t, x, p2))(s) =
           replaceTerm( ext(sigma)(s), t, p1 o p2)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 128 1 145 69
body:
   Orth_lemma_aux: LEMMA
       LET e1o = (# lhs := ext(rho1)(lhs(e1p)), rhs := ext(rho1)(rhs(e1p)) #) IN
         LET e2o = (# lhs := ext(rho2)(lhs(e2p)), rhs := ext(rho2)(rhs(e2p)) #) IN
         member(e1p,E) & 
         member(e2p,E) &
         positionsOF(t)(p1) &
         positionsOF(t)(p3) &
         NOT Ambiguous?(E) &
         p3 = p1 o p2 &
         Linear?(E) &
           subtermOF(t, p1) = ext(sg1)(lhs(e1o)) & 
           t1 = replaceTerm(t, ext(sg1)(rhs(e1o)), p1) &
           subtermOF(t, p3) = ext(sg2)(lhs(e2o)) &
           t2 = replaceTerm(t, ext(sg2)(rhs(e2o)), p3) &
           disjoint?(Vars(lhs(e1o)),Vars(t))&
           disjoint?(Vars(lhs(e2o)),Vars(t))
     =>
       EXISTS s:  (RC(reduction?(E))(t1, s) & RC(reduction?(E))(t2, s))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 147 1 150 47
body:
   Linear_and_Non_ambiguous_implies_triangle: LEMMA
    FORALL (E) :  
      (Linear?(E) AND NOT Ambiguous?(E) ) IMPLIES
       local_joinability_triangle?(reduction?(E))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 152 1 154 29
body:
   Triangle_implies_conflent: LEMMA
          local_joinability_triangle?(R)
          IMPLIES confluent?(R)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 156 1 159 31
body:
   Linear_and_Non_ambiguous_implies_confluent: LEMMA
    FORALL (E) :  
      ((Linear?(E) AND NOT Ambiguous?(E) ) IMPLIES
       confluent?(reduction?(E)))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 258 1 261 49
body:
   sub_pos_element: LEMMA
      PP?(fsp) & member_seq(p1 o p2, fsp) & p2`length /= 0
      IMPLIES sub_pos(fsp, p1)`length /= 0 & 
              member_seq(p1 o p2, sub_pos(fsp, p1))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 263 1 264 79
body:
   parallel_pos_are_dif: LEMMA
      PP?(fsp) IMPLIES FORALL(i,j: below[fsp`length]): i /= j => fsp(i) /= fsp(j)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 266 1 268 48
body:
   same_pos_in_Pos_Equal: LEMMA
      PP?(fsp1) & PP?(fsp2) & member_seq(p, fsp1) & member_seq(p, fsp2)
      IMPLIES member_seq(p, Pos_Equal(fsp1, fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 270 1 272 46
body:
   Pos_Over_is_sub_seq: LEMMA
      PP?(fsp1) & PP?(fsp2)
       IMPLIES subseq(Pos_Over(fsp1,fsp2), fsp1)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 274 1 276 45
body:
   Pos_Equal_is_sub_seq: LEMMA
      PP?(fsp1) & PP?(fsp2)
      IMPLIES subseq(Pos_Equal(fsp1,fsp2),fsp1)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 281 1 283 46
body:
   Pos_Under_is_sub_seq: LEMMA
      PP?(fsp1) & PP?(fsp2)
      IMPLIES subseq(Pos_Under(fsp1,fsp2), fsp1)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 289 1 291 33
body:
   Pos_Over_is_SPP: LEMMA 
      SPP?(s)(fsp1) & SPP?(s)(fsp2) IMPLIES
      SPP?(s)(Pos_Over(fsp1, fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 293 1 296 48
body:
   pos_up_in_Pos_Over: LEMMA
      PP?(fsp1) & PP?(fsp2) &
      p2`length /= 0 & member_seq(p1, fsp1) & member_seq(p1 o p2, fsp2)
      IMPLIES member_seq(p1, Pos_Over(fsp1, fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 298 1 300 47
body:
   parallel_pos_in_Pos_Over:  LEMMA    
      PP?(fsp1) & PP?(fsp2) & member_seq(p, fsp1) & PP?(add_first(p, fsp2))
      IMPLIES member_seq(p, Pos_Over(fsp1, fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 302 1 305 35
body:
   sub_pos_in_Pos_Under_aux: LEMMA
      PP?(fsp) & member_seq(p2, fsp) &
      p1 /= p2 & p1 <= p2 IMPLIES
      member_seq(p2, sub_pos(fsp,p1))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 307 1 310 43
body:
   sub_pos_in_Pos_Under: LEMMA
      PP?(fsp1) & PP?(fsp2) & member_seq(p1, fsp1) &
      member_seq(p2, fsp2) & p1 /= p2 & p2 <= p1 IMPLIES
        member_seq(p1, Pos_Under(fsp1, fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 322 1 325 47
body:
   Pos_Under_character: LEMMA
      PP?(fsp1) & PP?(fsp2) & member_seq(p, Pos_Under(fsp1,fsp2))
       IMPLIES  EXISTS(j:below[fsp2`length]):
             member_seq(p, sub_pos(fsp1,fsp2(j)))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 327 1 329 97
body:
   union_positions: LEMMA 
      PP?(fsp1) & PP?(fsp2) IMPLIES
      seq2set(fsp1) = seq2set(Pos_Over(fsp1, fsp2) o Pos_Equal(fsp1, fsp2) o Pos_Under(fsp1, fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 332 1 334 75
body:
   sigma_rhs_rest: LEMMA
       fse`length = fss`length 
          IMPLIES rest(sigma_rhs(fss, fse)) = sigma_rhs(rest(fss), rest(fse))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 337 1 340 90
body:
   sigma_rhs_o: LEMMA
     fse1`length = fss1`length AND fse2`length = fss2`length
       IMPLIES
         sigma_rhs(fss1 o fss2, fse1 o fse2) = sigma_rhs(fss1, fse1) o sigma_rhs(fss2, fse2)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 343 1 344 75
body:
   subtermsOF_rest: LEMMA
       SP?(t)(fsp) IMPLIES rest(subtermsOF(t,fsp)) = subtermsOF(t, rest(fsp))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 348 1 350 56
body:
   parallel_reduction_inclusion: LEMMA 
    subset?(reduction?(E), parallel_reduction?(E)) 
     & subset?(parallel_reduction?(E), RTC(reduction?(E)))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 360 1 362 55
body:
   replace_par_pos_preservs_pos: LEMMA
    SPP?(t)(add_first(p,fsp)) AND fst`length = fsp`length
          => positionsOF(replace_par_pos(t, fsp, fst))(p)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 366 2 368 96
body:
    replace_par_pos_preservs_PP: LEMMA
     SPP?(t)(fsp) AND fst`length = fsp`length
           => (FORALL (i : below[fsp`length]) : positionsOF(replace_par_pos(t, fsp, fst))(fsp(i)))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 372 1 374 95
body:
   replace_par_pos_preservs_PP_o_PP: LEMMA
    SPP?(t)(fsp o fsq ) AND fst`length = fsp`length
          => (FORALL (i : below[fsq`length]) : positionsOF(replace_par_pos(t, fsp, fst))(fsq(i)))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 378 1 381 81
body:
   replace_par_pos_equivalence: LEMMA
    SPP?(s)(fsp) AND fsp`length /= 0 AND fst`length = fsp`length
      => replace_par_pos(replaceTerm(s, fst(0), fsp(0)), rest(fsp), rest(fst)) = 
              replaceTerm(replace_par_pos(s, rest(fsp), rest(fst)), fst(0), fsp(0))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 385 1 388 38
body:
   replace_par_pos_equivalence1: LEMMA
    SPP?(s)(fsp) AND fsp`length /= 0 AND fst`length = fsp`length AND n < fsp`length
      => replace_par_pos(replaceTerm(s, fst(n), fsp(n)), delete(fsp,n), delete[term](fst,n)) = 
              replace_par_pos(s,fsp,fst)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 392 1 394 71
body:
   replace_par_pos_preservs_subterm: LEMMA
    SPP?(t)(add_first(p,fsp)) AND fst`length = fsp`length
          => subtermOF(replace_par_pos(t, fsp, fst), p) = subtermOF(t, p)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 398 2 400 100
body:
    replace_par_pos_subterm: LEMMA
      SPP?(t)(fsp) AND fst`length = fsp`length
           => (FORALL (i : below[fsp`length]) : subtermOF(replace_par_pos(t, fsp, fst),fsp(i))=fst(i))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 404 1 408 82
body:
   replace_par_pos_comp: LEMMA
    SPP?(t)(fsp1 o fsp2) AND fst1`length = fsp1`length
                         AND fst2`length = fsp2`length
           => replace_par_pos(t, fsp1 o fsp2, fst1 o fst2) =
                          replace_par_pos(replace_par_pos(t, fsp1, fst1),fsp2, fst2)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 412 1 416 90
body:
   replace_par_pos_comp_commute: LEMMA
      SPP?(t)(fsp1 o fsp2) AND fst1`length = fsp1`length AND fst2`length = fsp2`length
        IMPLIES 
          replace_par_pos(t, fsp1 o fsp2, fst1 o fst2) = 
                                                replace_par_pos(t, fsp2 o fsp1, fst2 o fst1)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 441 1 443 28
body:
   parallel_pos_same_prefix: LEMMA
      parallel(p1,p2) & p1= p o q1 & p2= p o q2
       IMPLIES parallel(q1,q2)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 445 1 448 31
body:
   complement_pos_character: LEMMA
      PP?(fsp) & member_seq(p1, complement_pos(p,fsp))
       IMPLIES EXISTS (i:below[fsp`length]):
               fsp`seq(i)= p o p1


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 453 1 455 56
body:
   complement_pos_preservs_sub_pos_length1: LEMMA
     PP?(fsp) IMPLIES
    complement_pos(p, fsp)`length = sub_pos(fsp, p)`length


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 482 1 484 43
body:
   comp_pos_character: LEMMA
       FORALL(i:below[fsp`length]):
       comp_pos(p,fsp)`seq(i)= p o fsp`seq(i)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 491 1 494 112
body:
   replace_replace_par_pos: LEMMA
      positionsOF(t)(q) AND SPP?(s)(fsp) AND fst`length = fsp`length
         IMPLIES
         replaceTerm(t, replace_par_pos(s,fsp,fst), q) = replace_par_pos(replaceTerm(t,s,q), comp_pos(q,fsp), fst)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 498 1 501 36
body:
   complement_pos_preservs_sub_pos_length: LEMMA
     PP?(fsp) IMPLIES 
      complement_pos(p1,complement_pos(p, fsp))`length
         = sub_pos(fsp, p o p1)`length


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 506 1 512 68
body:
   Pos_Over_character: LEMMA
       PP?(fsp1) & PP?(fsp2)
         => FORALL (i:below[Pos_Over(fsp1,fsp2)`length]):
                   PP?(add_first(Pos_Over(fsp1,fsp2)`seq(i),fsp2))
               OR  EXISTS (j:below[fsp2`length]):
                           Pos_Over(fsp1,fsp2)`seq(i) <= fsp2`seq(j)
                           & Pos_Over(fsp1,fsp2)`seq(i) /= fsp2`seq(j)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 514 1 518 62
body:
   Pos_Equal_character: LEMMA
       PP?(fsp1) & PP?(fsp2) 
         => FORALL (i:below[Pos_Equal(fsp1,fsp2)`length]):
               EXISTS (j:below[fsp2`length]):
                       Pos_Equal(fsp1,fsp2)`seq(i) = fsp2`seq(j)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 524 1 526 81
body:
   Pos_Over_and_Pos_Equal_is_PP: LEMMA
       PP?(fsp1) & PP?(fsp2)
         => PP?(Pos_Over(fsp1, fsp2) o Pos_Over(fsp2, fsp1) o Pos_Equal(fsp1,fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 532 2 534 79
body:
    comp_pos_in_SP_preservs_SP_in_replace: LEMMA
      SPP?(t)(fsp) & SP?(s)(fsp1) & fsp`length > 0 IMPLIES
       SP?(replaceTerm(t, s, fsp`seq(0)))(comp_pos(fsp`seq(0), fsp1) o rest(fsp))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 536 2 538 48
body:
    comp_pos_in_PP_preservs_PP: LEMMA
      PP?(fsp) & PP?(fsp1) & fsp`length > 0 IMPLIES
       PP?(comp_pos(fsp`seq(0), fsp1) o rest(fsp))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 540 2 542 80
body:
    comp_pos_in_SPP_preservs_SPP_in_replace: LEMMA
      SPP?(t)(fsp) & SPP?(s)(fsp1) & fsp`length > 0 IMPLIES
       SPP?(replaceTerm(t, s, fsp`seq(0)))(comp_pos(fsp`seq(0), fsp1) o rest(fsp))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 544 2 549 74
body:
    comp_pos_in_SPP_preservs_SPP_in_replace_par_pos: LEMMA
      SPP?(t)(fsp) & fsp`length=fst`length & fsp`length /= 0 &
      SPP?(fst`seq(0))(fsp1) &
      SPP?(replace_par_pos(t, fsp, fst))(fsp2) &
      PP?(add_first(fsp`seq(0),fsp2)) IMPLIES
       SPP?(replace_par_pos(t, fsp, fst))(comp_pos(fsp`seq(0), fsp1) o fsp2)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 553 2 557 24
body:
    non_ambiguous_implies_same_term: LEMMA
         NOT Ambiguous?(E) & positionsOF(s)(p) &
         reduction_fix?(E)(s,t1,p) &
         reduction_fix?(E)(s,t2,p)
           IMPLIES t1 = t2


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 559 2 564 89
body:
    parallel_reduction_context_aux2: LEMMA   
      SPP?(t)(fsp) AND fst1`length = fsp`length AND fst2`length = fsp`length AND
      (FORALL (i : below[fsp`length]): parallel_reduction?(E)(fst1(i),fst2(i)))
          IMPLIES EXISTS (fsq:SPP(replace_par_pos(t, fsp, fst1))):
             parallel_reduction_fix?(E)(replace_par_pos(t, fsp, fst1),replace_par_pos(t, fsp, fst2), fsq)
              AND (FORALL(p:positions?(t)): PP?(add_first(p,fsp)) => PP?(add_first(p,fsq)))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 566 2 570 94
body:
    parallel_reduction_context: LEMMA
      SPP?(t)(fsp) AND fst1`length = fsp`length AND fst2`length = fsp`length AND
      (FORALL (i : below[fsp`length]): parallel_reduction?(E)(fst1(i),fst2(i)))
          IMPLIES 
             parallel_reduction?(E)(replace_par_pos(t, fsp, fst1),replace_par_pos(t, fsp, fst2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 572 2 575 44
body:
    replace_par_pos_of_app_is_app: LEMMA
      app?(t) & SPP?(t)(fsp) & fst`length = fsp`length IMPLIES
       fsp = #(empty_seq) OR
            app?(replace_par_pos(t, fsp, fst))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 577 2 580 43
body:
    replace_par_pos_preservs_f: LEMMA
      app?(t) & SPP?(t)(fsp) & fst`length = fsp`length IMPLIES
       fsp = #(empty_seq) OR
         f(t) = f(replace_par_pos(t,fsp,fst))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 582 2 585 60
body:
    parallel_reduction_closed_subs: LEMMA
      (FORALL (x: Vars?(t)): parallel_reduction?(E)(ext(sigma)(x), ext(theta)(x)))
        IMPLIES
          parallel_reduction?(E)(ext(sigma)(t), ext(theta)(t))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 597 2 602 47
body:
    parallel_reduction_result: LEMMA
       Orthogonal?(E) & E(e) & SPP?(ext(sigma)(lhs(e)))(fsp) &
       parallel_reduction_fix?(E)(ext(sigma)(lhs(e)), t, fsp)
         IMPLIES
            fsp = #(empty_seq) OR
            EXISTS(theta): t = ext(theta)(lhs(e))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 604 2 610 80
body:
    replace_par_pos_subterm2: LEMMA
        SPP?(s)(fsp) & member_seq(p1, fsp) &
        p <= p1 & p /= p1 &
        fsp`length = fst`length IMPLIES
          EXISTS fst1 : (complement_pos(p, fsp)`length = fst1`length &
            subtermOF(replace_par_pos(s, fsp, fst), p) =
                   replace_par_pos(subtermOF(s, p), complement_pos(p, fsp), fst1))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 627 2 634 61
body:
    parallel_reduction_variables: LEMMA
     NOT Ambiguous?(E) & E(e) &
      SPP?(ext(sigma)(lhs(e)))(fsp) &
      parallel_reduction_fix?(E)(ext(sigma)(lhs(e)), ext(theta)(lhs(e)),fsp) &
      NOT fsp = #(empty_seq)    
        IMPLIES
          FORALL (x:Vars?(lhs(e))):
           parallel_reduction?(E)(ext(sigma)(x), ext(theta)(x))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 637 2 641 51
body:
    Parallel_Moves_Lemma: LEMMA
        Orthogonal?(E) & member(e,E) &
        parallel_reduction?(E)(ext(sigma)(lhs(e)), t)
        IMPLIES EXISTS s: parallel_reduction?(E)(ext(sigma)(rhs(e)),s) &
                          parallel_reduction?(E)(t,s)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 647 2 651 59
body:
    replace_par_pos_dominance: LEMMA
      SPP?(t)(fsp) & SPP?(t)(fsp1) & parallel_reduction_fix?(E)(t,s,fsp1) &
      (FORALL(i:below[fsp1`length]):
                 EXISTS(j:below[fsp`length]):fsp`seq(j) <= fsp1`seq(i))
         IMPLIES s = replace_par_pos(t,fsp,subtermsOF(s,fsp))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 653 2 657 98
body:
    Pos_Over_and_Pos_Equal_dominance: LEMMA
      SPP?(t)(fsp1) & SPP?(t)(fsp2) IMPLIES
      (FORALL(i:below[fsp1`length]):
          EXISTS(j:below[(Pos_Over(fsp1,fsp2) o Pos_Over(fsp2,fsp1) o Pos_Equal(fsp1,fsp2))`length]):
           (Pos_Over(fsp1,fsp2) o Pos_Over(fsp2,fsp1) o Pos_Equal(fsp1,fsp2))`seq(j) <= fsp1`seq(i))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 659 2 664 101
body:
    divergence_in_Pos_Over_aux: LEMMA
       SPP?(t)(fsp2) &
       parallel_reduction_fix?(E)(t, t2, fsp2) &
       positionsOF(t)(p) &
       member_seq(p, Pos_Over( #(p), fsp2))
              => parallel_reduction_fix?(E)(subtermOF(t, p), subtermOF(t2, p), complement_pos(p, fsp2))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 666 2 674 78
body:
    divergence_in_Pos_Over: LEMMA
       SPP?(t)(fsp1) & SPP?(t)(fsp2) &
       parallel_reduction_fix?(E)(t, t1, fsp1) &
       parallel_reduction_fix?(E)(t, t2, fsp2) &
       member_seq(p, Pos_Over(fsp1, fsp2))
              => (EXISTS((e | member(e, E)), sigma):
                       subtermOF(t, p) = ext(sigma)(lhs(e)) &
                       subtermOF(t1, p) = ext(sigma)(rhs(e)) &
                       parallel_reduction?(E)(subtermOF(t, p),subtermOF(t2,p)) )


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 676 2 685 54
body:
    subterm_joinability: LEMMA
      Orthogonal?(E) &
      SPP?(t)(fsp1) & SPP?(t)(fsp2) &
           parallel_reduction_fix?(E)(t,t1,fsp1) &
           parallel_reduction_fix?(E)(t,t2,fsp2) &
           fsp = Pos_Over(fsp1,fsp2) o Pos_Over(fsp2,fsp1) o Pos_Equal(fsp1,fsp2)
       IMPLIES FORALL(i:below[fsp`length]): 
           EXISTS s :
         parallel_reduction?(E)(subtermOF(t1,fsp(i)), s) &
         parallel_reduction?(E)(subtermOF(t2,fsp(i)), s)


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 687 2 696 59
body:
    subterms_joinability: LEMMA
      Orthogonal?(E) &
      SPP?(t)(fsp1) & SPP?(t)(fsp2) &
           parallel_reduction_fix?(E)(t,t1,fsp1) &
           parallel_reduction_fix?(E)(t,t2,fsp2) &
           fsp = Pos_Over(fsp1,fsp2) o Pos_Over(fsp2,fsp1) o Pos_Equal(fsp1,fsp2)
       IMPLIES EXISTS fst : fsp`length = fst`length AND
       FORALL(i:below[fsp`length]): 
         parallel_reduction?(E)(subtermOF(t1,fsp(i)), fst(i)) &
         parallel_reduction?(E)(subtermOF(t2,fsp(i)), fst(i))


decl_type: formula
theory: orthogonality
library: TRS
signature: nil
location: 709 1 712 19
body:
   Orthogonal_implies_confluent: LEMMA 
    FORALL (E : Orthogonal) :  
      LET RRE = reduction?(E) IN
      confluent?(RRE)


decl_type: function
theory: orthogonality
library: TRS
location: 57 2 68 76
signature:
  [set[rewrite_rule] ->
          [[term[variable, symbol, arity],
            term[variable, symbol, arity]] ->
             bool]]

body:
    ntCP?(E)(t1, t2): bool =
      EXISTS (sigma,rho,
             (e1 | member(e1, E)),
             (e2p | member(e2p, E)),
             (p: positions?(lhs(e1)))):
           NOT (e1 = e2p AND p = empty_seq) AND
           LET e2 = (# lhs := ext(rho)(lhs(e2p)), rhs := ext(rho)(rhs(e2p)) #) IN
                 disjoint?(Vars(lhs(e1)),Vars(lhs(e2)))                        &
                 NOT vars?(subtermOF(lhs(e1), p))                              &
                 mgu(sigma)(subtermOF(lhs(e1), p), lhs(e2))                    &
                 t1 = ext(sigma)(rhs(e1))                                      &
                 t2 = replaceTerm(ext(sigma)(lhs(e1)), ext(sigma)(rhs(e2)), p)


decl_type: function
theory: orthogonality
library: TRS
location: 93 1 94 55
signature:
[cell repeats an earlier one in this file: 109 characters]

body:
   local_joinability_triangle?(R) : bool = FORALL(t, t1, t2) : R(t, t1) & R(t, t2) =>
                 EXISTS s : (RC(R)(t1, s) & RC(R)(t2, s))


decl_type: function
theory: orthogonality
library: TRS
location: 170 1 178 22
signature:
  [[s: term[variable, symbol, arity],
         fsp: SPP[variable, symbol, arity](s),
         {fst | fst`length = fsp`length}] ->
          term[variable, symbol, arity]]

body:
   replace_par_pos(s, (fsp : SPP(s)), fst | fst`length = fsp`length): RECURSIVE 
      term =
        IF length(fsp) = 0
         THEN 
          s
         ELSE
          replace_par_pos(replaceTerm(s, fst(0), fsp(0)), rest(fsp), rest(fst))
        ENDIF
     MEASURE length(fsp)


decl_type: function
theory: orthogonality
library: TRS
location: 180 1 183 51
signature:
  [set[rewrite_rule] ->
          [[s: term[variable, symbol, arity],
            term[variable, symbol, arity],
            positions?[variable, symbol, arity](s)] ->
             bool]]

body:
   reduction_fix?(E)(s,t,(p:positions?(s))): bool =
        EXISTS (e|member(e,E), sigma):
          subtermOF(s,p)=ext(sigma)(lhs(e))
            AND t=replaceTerm(s,ext(sigma)(rhs(e)),p)


decl_type: function
theory: orthogonality
library: TRS
signature:
  [[fss: finseq[Sub], {fse | fse`length = fss`length}] ->
  finseq[term]]

location: 185 1 190 10
body:
   sigma_rhs(fss, (fse | fse`length = fss`length)): finseq[term] = 
       IF fss`length = 0 THEN empty_seq[term]
       ELSE
            (# length := fss`length,
                  seq := (LAMBDA (i: below[fss`length]): ext(fss(i))(rhs(fse(i)))) #)
       ENDIF


decl_type: function
theory: orthogonality
library: TRS
signature:
  [[fss: finseq[Sub], {fse | fse`length = fss`length}] ->
  finseq[term]]

location: 192 1 197 10
body:
   sigma_lhs(fss, (fse | fse`length = fss`length)): finseq[term] = 
       IF fss`length = 0 THEN empty_seq[term]
       ELSE
            (# length := fss`length,
                  seq := (LAMBDA (i: below[fss`length]): ext(fss(i))(lhs(fse(i)))) #)
       ENDIF


decl_type: function
theory: orthogonality
library: TRS
signature:
  [[t: term[variable, symbol, arity],
  SP[variable, symbol, arity](t)] ->
  finseq[term]]

location: 199 2 201 93
body:
    subtermsOF(t,(fsp:SP(t))): 
              finseq[term] = (# length := fsp`length,
                                seq := (LAMBDA (i: below[fsp`length]): subtermOF(t,fsp(i))) #);


decl_type: function
theory: orthogonality
library: TRS
location: 203 1 207 63
signature:
  [set[rewrite_rule] ->
          [[s: term[variable, symbol, arity],
            term[variable, symbol, arity],
            SPP[variable, symbol, arity](s)] ->
             bool]]

body:
   parallel_reduction_fix?(E)(s,t, (fsp: SPP(s))): bool =  
      EXISTS ((fse | member(fse, E)), fss) :
             fsp`length = fse`length AND fsp`length = fss`length
             AND subtermsOF(s,fsp) = sigma_lhs(fss, fse)
             AND t = replace_par_pos(s, fsp, sigma_rhs(fss, fse))


decl_type: function
theory: orthogonality
library: TRS
location: 214 1 220 23
signature:
  [[PP[variable, symbol, arity],
         position[variable, symbol, arity]] ->
          finseq[position]]

body:
   sub_pos((fsp : PP), p): RECURSIVE finseq[position] =
       IF  length(fsp) = 0 THEN empty_seq[position]
          ELSIF p <= fsp`seq(0) AND p /= fsp`seq(0)
                  THEN add_first(fsp`seq(0), sub_pos(rest(fsp), p))
                  ELSE sub_pos(rest(fsp), p)
       ENDIF
      MEASURE length(fsp)


decl_type: function
theory: orthogonality
library: TRS
signature:
  [[PP[variable, symbol, arity], PP[variable, symbol, arity]] ->
  finseq[position]]

location: 223 1 232 24
body:
   Pos_Over((fsp1 : PP), (fsp2 : PP)): RECURSIVE finseq[position] =
     (IF length(fsp1) = 0
         THEN empty_seq[position]
         ELSE (IF ( length(sub_pos(fsp2, fsp1`seq(0))) > 0  
                   OR PP?(add_first(fsp1`seq(0), fsp2)))
                  THEN add_first(fsp1`seq(0), Pos_Over(rest(fsp1), fsp2))
                  ELSE Pos_Over(rest(fsp1), fsp2)
               ENDIF)
       ENDIF)
      MEASURE length(fsp1)


decl_type: function
theory: orthogonality
library: TRS
signature:
  [[PP[variable, symbol, arity], PP[variable, symbol, arity]] ->
  finseq[position]]

location: 236 1 241 23
body:
   Pos_Under((fsp1 : PP), (fsp2 : PP)): RECURSIVE finseq[position] =
       IF length(fsp2)=0
          THEN empty_seq[position]
          ELSE sub_pos(fsp1, fsp2`seq(0)) o Pos_Under(fsp1,rest(fsp2))
       ENDIF
     MEASURE length(fsp2)


decl_type: function
theory: orthogonality
library: TRS
signature:
  [[PP[variable, symbol, arity], PP[variable, symbol, arity]] ->
  finseq[position]]

location: 245 1 251 22
body:
   Pos_Equal((fsp1 : PP), (fsp2 : PP)): RECURSIVE finseq[position] =
       IF length(fsp1) = 0 THEN empty_seq[position]
       ELSIF member_seq(fsp1`seq(0),fsp2)
       THEN add_first(fsp1`seq(0), Pos_Equal(rest(fsp1), fsp2))
       ELSE Pos_Equal(rest(fsp1), fsp2)
       ENDIF
    MEASURE length(fsp1)


decl_type: function
theory: orthogonality
library: TRS
location: 421 1 425 14
signature:
  [[position[variable, symbol, arity],
         position[variable, symbol, arity]] ->
          set[position[variable, symbol, arity]]]

body:
   complement_pos_set(p1,p): set[position] = 
           IF p1 <= p & p1 /= p 
             THEN {p2 | p=p1 o p2}
             ELSE emptyset
           ENDIF


decl_type: function
theory: orthogonality
library: TRS
location: 429 1 437 27
signature:
  [[position[variable, symbol, arity],
         PP[variable, symbol, arity]] ->
          finseq[position]]

body:
   complement_pos(p,(fsp:PP)):
         RECURSIVE finseq[position] = 
             IF length(fsp)=0 THEN empty_seq
             ELSIF nonempty?(complement_pos_set(p,fsp`seq(0)))
                THEN add_first(choose(complement_pos_set(p,fsp`seq(0))),
                               complement_pos(p,rest(fsp)))
                ELSE complement_pos(p,rest(fsp))
             ENDIF
         MEASURE(length(fsp))


decl_type: function
theory: orthogonality
library: TRS
signature:
  [[position[variable, symbol, arity], finseq[position]] ->
  finseq[position]]

location: 462 1 463 100
body:
   comp_pos(p,fsp): finseq[position] = (# length := fsp`length,
                                                seq := (LAMBDA (i: below[fsp`length]): p o fsp(i)) #);


decl_type: function
theory: orthogonality
library: TRS
location: 590 2 592 86
signature:
  [[PP[variable, symbol, arity],
         position[variable, symbol, arity]] ->
          finseq[position]]

body:
    compo_sufix(fsp:PP, p): 
        finseq[position] = (# length := fsp`length,
                                 seq := (LAMBDA(i:below[fsp`length]): fsp`seq(i) o p) #)


decl_type: function
theory: orthogonality
library: TRS
location: 614 2 616 44
signature:
  [[rewrite_rule[variable, symbol, arity],
         Sub[variable, symbol, arity], s: term[variable, symbol, arity],
         t: term[variable, symbol, arity],
         {p | positionsOF(s)(p) & positionsOF(t)(p)}] ->
          bool]

body:
    C(e, sigma, s, t, (p|positionsOF(s)(p) & positionsOF(t)(p))): bool = 
          subtermOF(s, p) = ext(sigma)(lhs(e)) AND
          subtermOF(t, p) = ext(sigma)(rhs(e))


decl_type: function
theory: orthogonality
library: TRS
location: 618 2 620 56
signature:
  [d:
          [s: term[variable, symbol, arity],
           t: term[variable, symbol, arity],
           {fsp | SPP?(s)(fsp) & SPP?(t)(fsp)}, set[rewrite_rule]] ->
          [[below[d`3`length], rewrite_rule[variable, symbol, arity]] ->
             bool]]

body:
    D(s, t, (fsp|SPP?(s)(fsp) & SPP?(t)(fsp)), E)(i:below[fsp`length], e): bool =
             member(e, E) &
              EXISTS sigma : C(e, sigma, s, t, fsp`seq(i))


decl_type: function
theory: orthogonality
library: TRS
location: 622 2 623 67
signature:
  [d:
          [s: term[variable, symbol, arity],
           t: term[variable, symbol, arity],
           {fsp | SPP?(s)(fsp) & SPP?(t)(fsp)}, set[rewrite_rule]] ->
          [[below[d`3`length], Sub[variable, symbol, arity]] -> bool]]

body:
    G(s, t, (fsp|SPP?(s)(fsp) & SPP?(t)(fsp)),E)(i:below[fsp`length], sigma): bool =
              EXISTS (e|member(e, E)) : C(e, sigma, s, t, fsp`seq(i))


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 720 0 725 999
body:
  % Assuming TCC generated (at line 99, column 14) for
      % critical_pairs[variable, symbol, arity]
      % generated from assumption critical_pairs.var_countable
  IMP_critical_pairs_TCC1: OBLIGATION
    is_countably_infinite[term[variable, symbol, arity]]
        (V[variable, symbol, arity]);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 727 0 757 999
body:
  % Subtype TCC generated (at line 140, column 74) for  p
      % expected type  positions?
                     %     [variable, symbol, arity](ext(sigma)(lhs(e1)))
  ntCP?_TCC1: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            t1: term[variable, symbol, arity],
            sigma: Sub[variable, symbol, arity],
            rho: Ren[variable, symbol, arity],
            (e1: rewrite_rule[variable, symbol, arity]
                 | member[rewrite_rule[variable, symbol, arity]](e1, E)),
            (e2p: rewrite_rule[variable, symbol, arity]
                 | member[rewrite_rule[variable, symbol, arity]](e2p, E)),
            (p:
               positions?
                   [variable, symbol, arity](lhs[variable, symbol, arity]
                                             (e1)))):
      NOT (e1 = e2p AND p = empty_seq) IMPLIES
       (FORALL (e2:
                  [# lhs: term[variable, symbol, arity],
                     rhs: term[variable, symbol, arity] #]):
               t1 = ext(sigma)(rhs(e1))
           AND mgu(sigma)(subtermOF(lhs(e1), p), lhs(e2))
           AND NOT vars?(subtermOF(lhs(e1), p))
           AND disjoint?(Vars(lhs(e1)), Vars(lhs(e2)))
           AND e2 =
                (# lhs := ext(rho)(lhs(e2p)), rhs := ext(rho)(rhs(e2p)) #)
           IMPLIES
           positionsOF[variable, symbol, arity]
               (ext[variable, symbol, arity]
                    (sigma)(lhs[variable, symbol, arity](e1)))
               (p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 759 0 778 999
body:
  % Subtype TCC generated (at line 152, column 80) for  p
      % expected type  positions?[variable, symbol, arity](ext(sg1)(lhs(e1)))
  ntCP_lemma_aux1_TCC1: OBLIGATION
    FORALL (sg1, sg2: Sub[variable, symbol, arity], E,
            p: position[variable, symbol, arity],
            e1: rewrite_rule[variable, symbol, arity]
                | member[rewrite_rule[variable, symbol, arity]](e1, E),
            e2: rewrite_rule[variable, symbol, arity]
                | member[rewrite_rule[variable, symbol, arity]](e2, E)):
      positionsOF(lhs(e1))(p) AND
       NOT vars?(subtermOF(lhs(e1), p)) AND
        ext(sg1)(subtermOF(lhs(e1), p)) = ext(sg2)(lhs(e2)) AND
         NOT (e1 = e2 AND p = empty_seq)
       IMPLIES
       (FORALL (t1, t2, delta):
          ext(delta)(t1) = ext(sg1)(rhs(e1)) AND ntCP?(E)(t1, t2) IMPLIES
           positionsOF[variable, symbol, arity]
               (ext[variable, symbol, arity]
                    (sg1)(lhs[variable, symbol, arity](e1)))
               (p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 780 0 786 999
body:
  % Subtype TCC generated (at line 156, column 68) for  Pos_var(t, x)
      % expected type  finite_set[position[variable, symbol, arity]]
  linear?_TCC1: OBLIGATION
    FORALL (t: term[variable, symbol, arity],
            x: (V) | member[(V)](x, Vars[variable, symbol, arity](t))):
      is_finite[position[variable, symbol, arity]]
          (Pos_var[variable, symbol, arity](t, x));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 788 0 793 999
body:
  % Subtype TCC generated (at line 172, column 7) for  Pos_var(t, x)
      % expected type  finite_set[position[variable, symbol, arity]]
  Orth_lemma_aux0_TCC1: OBLIGATION
    FORALL (t: term[variable, symbol, arity], x: (V)):
      is_finite[position[variable, symbol, arity]]
          (Pos_var[variable, symbol, arity](t, x));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 795 0 803 999
body:
  % Subtype TCC generated (at line 183, column 32) for   #(first(p))
      % expected type  positions?[variable, symbol, arity](s)
  Var_occurs_only_once_also_in_subterms_TCC1: OBLIGATION
    FORALL (p: position[variable, symbol, arity],
            s: term[variable, symbol, arity], x: (V)):
           card(Pos_var(s, x)) = 1 AND x = subtermOF(s, p) AND p`length /= 0
       AND positionsOF(s)(p) AND vars?(x)
       IMPLIES
       positionsOF[variable, symbol, arity](s)( #[posnat](first[posnat](p)));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 805 0 818 999
body:
  % Subtype TCC generated (at line 183, column 11) for
      % Pos_var(subtermOF(s,  #(first(p))), x)
      % expected type  S: finite_set[position[variable, symbol, arity]]
  Var_occurs_only_once_also_in_subterms_TCC2: OBLIGATION
    FORALL (p: position[variable, symbol, arity],
            s: term[variable, symbol, arity], x: (V)):
           card(Pos_var(s, x)) = 1 AND x = subtermOF(s, p) AND p`length /= 0
       AND positionsOF(s)(p) AND vars?(x)
       IMPLIES
       is_finite[position[variable, symbol, arity]]
           (Pos_var[variable, symbol, arity]
                (subtermOF[variable, symbol, arity]
                     (s,  #[posnat](first[posnat](p))),
                 x));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 820 0 827 999
body:
  % Subtype TCC generated (at line 189, column 35) for  p2
      % expected type  positions?[variable, symbol, arity](sigma(x))
  SigmaP_equivalence_TCC1: OBLIGATION
    FORALL (p2: position[variable, symbol, arity],
            s: term[variable, symbol, arity],
            sigma: Sub[variable, symbol, arity], x: (V)):
      positionsOF(ext(sigma)(x))(p2) AND NOT member(x, Vars(s)) IMPLIES
       positionsOF[variable, symbol, arity](sigma(x))(p2);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 829 0 839 999
body:
  % Subtype TCC generated (at line 189, column 15) for
      % SigmaP(sigma, t, x, p2)
      % expected type  Sub[variable, symbol, arity]
  SigmaP_equivalence_TCC2: OBLIGATION
    FORALL (p2: position[variable, symbol, arity],
            s: term[variable, symbol, arity],
            sigma: Sub[variable, symbol, arity],
            t: term[variable, symbol, arity], x: (V)):
      positionsOF(ext(sigma)(x))(p2) AND NOT member(x, Vars(s)) IMPLIES
       Sub?[variable, symbol, arity]
           (SigmaP[variable, symbol, arity](sigma, t, x, p2));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 841 0 849 999
body:
  % Subtype TCC generated (at line 197, column 30) for  p2
      % expected type  positions?[variable, symbol, arity](sigma(x))
  SigmaP_vs_replaceTerm_linearR_TCC1: OBLIGATION
    FORALL (p1, p2: position[variable, symbol, arity],
            s: term[variable, symbol, arity],
            sigma: Sub[variable, symbol, arity], x: (V)):
           Card(Pos_var(s, x)) = 1 AND x = subtermOF(s, p1)
       AND positionsOF(ext(sigma)(x))(p2) AND positionsOF(s)(p1) AND vars?(x)
       IMPLIES positionsOF[variable, symbol, arity](sigma(x))(p2);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 851 0 863 999
body:
  % Subtype TCC generated (at line 197, column 10) for
      % SigmaP(sigma, t, x, p2)
      % expected type  Sub[variable, symbol, arity]
  SigmaP_vs_replaceTerm_linearR_TCC2: OBLIGATION
    FORALL (p1, p2: position[variable, symbol, arity],
            s: term[variable, symbol, arity],
            sigma: Sub[variable, symbol, arity],
            t: term[variable, symbol, arity], x: (V)):
           Card(Pos_var(s, x)) = 1 AND x = subtermOF(s, p1)
       AND positionsOF(ext(sigma)(x))(p2) AND positionsOF(s)(p1) AND vars?(x)
       IMPLIES
       Sub?[variable, symbol, arity]
           (SigmaP[variable, symbol, arity](sigma, t, x, p2));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 865 0 875 999
body:
  % Subtype TCC generated (at line 198, column 40) for  p1 o p2
      % expected type  positions?[variable, symbol, arity](ext(sigma)(s))
  SigmaP_vs_replaceTerm_linearR_TCC3: OBLIGATION
    FORALL (p1, p2: position[variable, symbol, arity],
            s: term[variable, symbol, arity],
            sigma: Sub[variable, symbol, arity], x: (V)):
           Card(Pos_var(s, x)) = 1 AND x = subtermOF(s, p1)
       AND positionsOF(ext(sigma)(x))(p2) AND positionsOF(s)(p1) AND vars?(x)
       IMPLIES
       positionsOF[variable, symbol, arity]
           (ext[variable, symbol, arity](sigma)(s))(o[posnat](p1, p2));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 877 0 883 999
body:
  % Subtype TCC generated (at line 248, column 43) for  0
      % expected type  below[length(fst)]
  replace_par_pos_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            fst: finseq[term] | fst`length = fsp`length):
      NOT length(fsp) = 0 IMPLIES 0 < length(fst);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 885 0 891 999
body:
  % Subtype TCC generated (at line 248, column 51) for  0
      % expected type  below[length(fsp)]
  replace_par_pos_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            fst: finseq[term] | fst`length = fsp`length):
      NOT length(fsp) = 0 IMPLIES 0 < length(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 893 0 902 999
body:
  % Subtype TCC generated (at line 248, column 47) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(0)
      % expected type  positions?[variable, symbol, arity](s)
  replace_par_pos_TCC3: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            fst: finseq[term] | fst`length = fsp`length):
      NOT length(fsp) = 0 IMPLIES
       positionsOF[variable, symbol, arity]
           (s)(finseq_appl[position[variable, symbol, arity]](fsp)(0));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 904 0 929 999
body:
  % Subtype TCC generated (at line 248, column 56) for  rest(fsp)
      % expected type  SPP
                     %     [variable, symbol, arity](replaceTerm
                     %                               (s,
                     %                                finseq_appl
                     %                                [term
                     %                                 [variable,
                     %                                  symbol,
                     %                                  arity]]
                     %                                (fst)(0),
                     %                                finseq_appl
                     %                                [position
                     %                                 [variable,
                     %                                  symbol,
                     %                                  arity]]
                     %                                (fsp)(0)))
  replace_par_pos_TCC4: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            fst: finseq[term] | fst`length = fsp`length):
      NOT length(fsp) = 0 IMPLIES
       SPP?[variable, symbol, arity]
           (replaceTerm[variable, symbol, arity]
                (s, finseq_appl[term[variable, symbol, arity]](fst)(0),
                 finseq_appl[position[variable, symbol, arity]](fsp)(0)))
           (rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 931 0 939 999
body:
  % Subtype TCC generated (at line 248, column 67) for  rest(fst)
      % expected type  {fst_1 | fst_1`length = rest(fsp)`length}
  replace_par_pos_TCC5: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            fst: finseq[term] | fst`length = fsp`length):
      NOT length(fsp) = 0 IMPLIES
       rest[term[variable, symbol, arity]](fst)`length =
        rest[position[variable, symbol, arity]](fsp)`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 941 0 954 999
body:
  % Termination TCC generated (at line 248, column 8) for
      % replace_par_pos(replaceTerm(s,
      %                             finseq_appl[term[variable, symbol, arity]]
      %                                 (fst)(0),
      %                             finseq_appl
      %                                 [position[variable, symbol, arity]]
      %                                 (fsp)(0)),
      %                 rest(fsp), rest(fst))
  replace_par_pos_TCC6: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            fst: finseq[term] | fst`length = fsp`length):
      NOT length(fsp) = 0 IMPLIES
       length(rest[position[variable, symbol, arity]](fsp)) < length(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 956 0 962 999
body:
  % Subtype TCC generated (at line 261, column 75) for  i
      % expected type  below[length(fse)]
  sigma_rhs_TCC1: OBLIGATION
    FORALL (fss: finseq[Sub[variable, symbol, arity]],
            (fse: finseq[rewrite_rule] | fse`length = fss`length)):
      NOT fss`length = 0 IMPLIES
       (FORALL (i: below[fss`length]): i < length(fse));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 964 0 971 999
body:
  % Subtype TCC generated (at line 273, column 81) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(i)
      % expected type  positions?[variable, symbol, arity](t)
  subtermsOF_TCC1: OBLIGATION
    FORALL (t: term[variable, symbol, arity],
            (fsp: SP[variable, symbol, arity](t)), i: below[fsp`length]):
      positionsOF[variable, symbol, arity]
          (t)(finseq_appl[position[variable, symbol, arity]](fsp)(i));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 973 0 982 999
body:
  % Subtype TCC generated (at line 278, column 28) for  fsp
      % expected type  SP[variable, symbol, arity](s)
  parallel_reduction_fix?_TCC1: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            (fse: finseq[rewrite_rule] | member[rewrite_rule](fse, E)),
            fss: finseq[Sub[variable, symbol, arity]]):
      fsp`length = fss`length AND fsp`length = fse`length IMPLIES
       SP?[variable, symbol, arity](s)(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 984 0 993 999
body:
  % Subtype TCC generated (at line 278, column 50) for  fse
      % expected type  {fse | fse`length = fss`length}
  parallel_reduction_fix?_TCC2: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            (fse: finseq[rewrite_rule] | member[rewrite_rule](fse, E)),
            fss: finseq[Sub[variable, symbol, arity]]):
      fsp`length = fss`length AND fsp`length = fse`length IMPLIES
       fse`length = fss`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 995 0 1005 999
body:
  % Subtype TCC generated (at line 279, column 43) for  sigma_rhs(fss, fse)
      % expected type  {fst | fst`length = fsp`length}
  parallel_reduction_fix?_TCC3: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            s: term[variable, symbol, arity],
            (fsp: SPP[variable, symbol, arity](s)),
            (fse: finseq[rewrite_rule] | member[rewrite_rule](fse, E)),
            fss: finseq[Sub[variable, symbol, arity]]):
      subtermsOF(s, fsp) = sigma_lhs(fss, fse) AND
       fsp`length = fss`length AND fsp`length = fse`length
       IMPLIES sigma_rhs(fss, fse)`length = fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1007 0 1011 999
body:
  % Subtype TCC generated (at line 288, column 27) for  0
      % expected type  below[fsp`length]
  sub_pos_TCC1: OBLIGATION
    FORALL ((fsp: PP[variable, symbol, arity])):
      NOT length(fsp) = 0 IMPLIES 0 < fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1013 0 1020 999
body:
  % Subtype TCC generated (at line 289, column 51) for  rest(fsp)
      % expected type  PP[variable, symbol, arity]
  sub_pos_TCC2: OBLIGATION
    FORALL ((fsp: PP[variable, symbol, arity]),
            p: position[variable, symbol, arity]):
      p <= fsp`seq(0) AND p /= fsp`seq(0) AND NOT length(fsp) = 0 IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1022 0 1028 999
body:
  % Termination TCC generated (at line 289, column 43) for
      % sub_pos(rest(fsp), p)
  sub_pos_TCC3: OBLIGATION
    FORALL ((fsp: PP[variable, symbol, arity]),
            p: position[variable, symbol, arity]):
      p <= fsp`seq(0) AND p /= fsp`seq(0) AND NOT length(fsp) = 0 IMPLIES
       length(rest[position[variable, symbol, arity]](fsp)) < length(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1030 0 1038 999
body:
  % Subtype TCC generated (at line 290, column 29) for  rest(fsp)
      % expected type  PP[variable, symbol, arity]
  sub_pos_TCC4: OBLIGATION
    FORALL ((fsp: PP[variable, symbol, arity]),
            p: position[variable, symbol, arity]):
      NOT (p <= fsp`seq(0) AND p /= fsp`seq(0)) AND NOT length(fsp) = 0
       IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1040 0 1047 999
body:
  % Termination TCC generated (at line 290, column 21) for
      % sub_pos(rest(fsp), p)
  sub_pos_TCC5: OBLIGATION
    FORALL ((fsp: PP[variable, symbol, arity]),
            p: position[variable, symbol, arity]):
      NOT (p <= fsp`seq(0) AND p /= fsp`seq(0)) AND NOT length(fsp) = 0
       IMPLIES
       length(rest[position[variable, symbol, arity]](fsp)) < length(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1049 0 1059 999
body:
  % Subtype TCC generated (at line 300, column 53) for  rest(fsp1)
      % expected type  PP[variable, symbol, arity]
  Pos_Over_TCC1: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      (length(sub_pos(fsp2, fsp1`seq(0))) > 0 OR
        PP?(add_first(fsp1`seq(0), fsp2)))
       AND NOT length(fsp1) = 0
       IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp1));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1061 0 1070 999
body:
  % Termination TCC generated (at line 300, column 44) for
      % Pos_Over(rest(fsp1), fsp2)
  Pos_Over_TCC2: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      (length(sub_pos(fsp2, fsp1`seq(0))) > 0 OR
        PP?(add_first(fsp1`seq(0), fsp2)))
       AND NOT length(fsp1) = 0
       IMPLIES
       length(rest[position[variable, symbol, arity]](fsp1)) < length(fsp1);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1072 0 1081 999
body:
  % Subtype TCC generated (at line 301, column 30) for  rest(fsp1)
      % expected type  PP[variable, symbol, arity]
  Pos_Over_TCC3: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      NOT length(sub_pos(fsp2, fsp1`seq(0))) > 0 AND
       NOT PP?(add_first(fsp1`seq(0), fsp2)) AND NOT length(fsp1) = 0
       IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp1));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1083 0 1091 999
body:
  % Termination TCC generated (at line 301, column 21) for
      % Pos_Over(rest(fsp1), fsp2)
  Pos_Over_TCC4: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      NOT length(sub_pos(fsp2, fsp1`seq(0))) > 0 AND
       NOT PP?(add_first(fsp1`seq(0), fsp2)) AND NOT length(fsp1) = 0
       IMPLIES
       length(rest[position[variable, symbol, arity]](fsp1)) < length(fsp1);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1093 0 1098 999
body:
  % Subtype TCC generated (at line 311, column 36) for  0
      % expected type  below[fsp2`length]
  Pos_Under_TCC1: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      NOT length(fsp2) = 0 IMPLIES 0 < fsp2`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1100 0 1107 999
body:
  % Subtype TCC generated (at line 311, column 57) for  rest(fsp2)
      % expected type  PP[variable, symbol, arity]
  Pos_Under_TCC2: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      NOT length(fsp2) = 0 IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp2));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1109 0 1115 999
body:
  % Termination TCC generated (at line 311, column 42) for
      % Pos_Under(fsp1, rest(fsp2))
  Pos_Under_TCC3: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      NOT length(fsp2) = 0 IMPLIES
       length(rest[position[variable, symbol, arity]](fsp2)) < length(fsp2);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1117 0 1124 999
body:
  % Subtype TCC generated (at line 320, column 43) for  rest(fsp1)
      % expected type  PP[variable, symbol, arity]
  Pos_Equal_TCC1: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      member_seq(fsp1`seq(0), fsp2) AND NOT length(fsp1) = 0 IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp1));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1126 0 1132 999
body:
  % Termination TCC generated (at line 320, column 33) for
      % Pos_Equal(rest(fsp1), fsp2)
  Pos_Equal_TCC2: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      member_seq(fsp1`seq(0), fsp2) AND NOT length(fsp1) = 0 IMPLIES
       length(rest[position[variable, symbol, arity]](fsp1)) < length(fsp1);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1134 0 1141 999
body:
  % Subtype TCC generated (at line 321, column 20) for  rest(fsp1)
      % expected type  PP[variable, symbol, arity]
  Pos_Equal_TCC3: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      NOT member_seq(fsp1`seq(0), fsp2) AND NOT length(fsp1) = 0 IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp1));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1143 0 1149 999
body:
  % Termination TCC generated (at line 321, column 10) for
      % Pos_Equal(rest(fsp1), fsp2)
  Pos_Equal_TCC4: OBLIGATION
    FORALL ((fsp1: PP[variable, symbol, arity]),
            (fsp2: PP[variable, symbol, arity])):
      NOT member_seq(fsp1`seq(0), fsp2) AND NOT length(fsp1) = 0 IMPLIES
       length(rest[position[variable, symbol, arity]](fsp1)) < length(fsp1);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1151 0 1156 999
body:
  % Subtype TCC generated (at line 363, column 21) for  fsp1
      % expected type  PP[variable, symbol, arity]
  Pos_Over_is_SPP_TCC1: OBLIGATION
    FORALL (fsp1, fsp2: finseq[position], s: term[variable, symbol, arity]):
      SPP?(s)(fsp2) AND SPP?(s)(fsp1) IMPLIES
       PP?[variable, symbol, arity](fsp1);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1158 0 1163 999
body:
  % Subtype TCC generated (at line 363, column 27) for  fsp2
      % expected type  PP[variable, symbol, arity]
  Pos_Over_is_SPP_TCC2: OBLIGATION
    FORALL (fsp1, fsp2: finseq[position], s: term[variable, symbol, arity]):
      SPP?(s)(fsp2) AND SPP?(s)(fsp1) IMPLIES
       PP?[variable, symbol, arity](fsp2);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1165 0 1169 999
body:
  % Subtype TCC generated (at line 392, column 41) for  fsp
      % expected type  PP[variable, symbol, arity]
  sub_pos_is_SPP_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], s: term[variable, symbol, arity]):
      SPP?(s)(fsp) IMPLIES PP?[variable, symbol, arity](fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1171 0 1176 999
body:
  % Subtype TCC generated (at line 406, column 65) for  rest(fse)
      % expected type  {fse | fse`length = rest(fss)`length}
  sigma_rhs_rest_TCC1: OBLIGATION
    FORALL (fse: finseq[rewrite_rule], fss: finseq[Sub]):
      fse`length = fss`length IMPLIES
       rest[rewrite_rule](fse)`length = rest[Sub](fss)`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1178 0 1183 999
body:
  % Subtype TCC generated (at line 412, column 30) for  fse1 o fse2
      % expected type  {fse | fse`length = (fss1 o fss2)`length}
  sigma_rhs_o_TCC1: OBLIGATION
    FORALL (fse1, fse2: finseq[rewrite_rule], fss1, fss2: finseq[Sub]):
      fse2`length = fss2`length AND fse1`length = fss1`length IMPLIES
       (o[rewrite_rule](fse1, fse2))`length = (o[Sub](fss1, fss2))`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1185 0 1191 999
body:
  % Subtype TCC generated (at line 416, column 65) for  rest(fsp)
      % expected type  SP[variable, symbol, arity](t)
  subtermsOF_rest_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], t: term[variable, symbol, arity]):
      SP?(t)(fsp) IMPLIES
       SP?[variable, symbol, arity]
           (t)(rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1193 0 1200 999
body:
  % Subtype TCC generated (at line 434, column 42) for  fsp
      % expected type  SPP[variable, symbol, arity](t)
  replace_par_pos_preservs_pos_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p: position[variable, symbol, arity],
            t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(t)(add_first(p, fsp)) IMPLIES
       SPP?[variable, symbol, arity](t)(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1202 0 1208 999
body:
  % Subtype TCC generated (at line 446, column 76) for  fsp
      % expected type  SPP[variable, symbol, arity](t)
  replace_par_pos_preservs_PP_o_PP_TCC1: OBLIGATION
    FORALL (fsp, fsq: finseq[position], fst: finseq[term],
            t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(t)(fsp o fsq) IMPLIES
       (FORALL (i: below[fsq`length]): SPP?[variable, symbol, arity](t)(fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1210 0 1216 999
body:
  % Subtype TCC generated (at line 452, column 42) for  0
      % expected type  below[length(fst)]
  replace_par_pos_equivalence_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            s: term[variable, symbol, arity]):
      fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp) IMPLIES
       0 < length(fst);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1218 0 1224 999
body:
  % Subtype TCC generated (at line 452, column 50) for  0
      % expected type  below[length(fsp)]
  replace_par_pos_equivalence_TCC2: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            s: term[variable, symbol, arity]):
      fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp) IMPLIES
       0 < length(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1226 0 1234 999
body:
  % Subtype TCC generated (at line 452, column 46) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(0)
      % expected type  positions?[variable, symbol, arity](s)
  replace_par_pos_equivalence_TCC3: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            s: term[variable, symbol, arity]):
      fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp) IMPLIES
       positionsOF[variable, symbol, arity]
           (s)(finseq_appl[position[variable, symbol, arity]](fsp)(0));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1236 0 1260 999
body:
  % Subtype TCC generated (at line 452, column 55) for  rest(fsp)
      % expected type  SPP
                     %     [variable, symbol, arity](replaceTerm
                     %                               (s,
                     %                                finseq_appl
                     %                                [term
                     %                                 [variable,
                     %                                  symbol,
                     %                                  arity]]
                     %                                (fst)(0),
                     %                                finseq_appl
                     %                                [position
                     %                                 [variable,
                     %                                  symbol,
                     %                                  arity]]
                     %                                (fsp)(0)))
  replace_par_pos_equivalence_TCC4: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            s: term[variable, symbol, arity]):
      fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp) IMPLIES
       SPP?[variable, symbol, arity]
           (replaceTerm[variable, symbol, arity]
                (s, finseq_appl[term[variable, symbol, arity]](fst)(0),
                 finseq_appl[position[variable, symbol, arity]](fsp)(0)))
           (rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1262 0 1269 999
body:
  % Subtype TCC generated (at line 452, column 66) for  rest(fst)
      % expected type  {fst_1 | fst_1`length = rest(fsp)`length}
  replace_par_pos_equivalence_TCC5: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            s: term[variable, symbol, arity]):
      fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp) IMPLIES
       rest[term[variable, symbol, arity]](fst)`length =
        rest[position[variable, symbol, arity]](fsp)`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1271 0 1278 999
body:
  % Subtype TCC generated (at line 453, column 43) for  rest(fsp)
      % expected type  SPP[variable, symbol, arity](s)
  replace_par_pos_equivalence_TCC6: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            s: term[variable, symbol, arity]):
      fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp) IMPLIES
       SPP?[variable, symbol, arity]
           (s)(rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1280 0 1294 999
body:
  % Subtype TCC generated (at line 453, column 74) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(0)
      % expected type  positions?
                     %     [variable, symbol, arity](replace_par_pos
                     %                               (s,
                     %                                rest(fsp),
                     %                                rest(fst)))
  replace_par_pos_equivalence_TCC7: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            s: term[variable, symbol, arity]):
      fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp) IMPLIES
       positionsOF[variable, symbol, arity]
           (replace_par_pos(s, rest[position[variable, symbol, arity]](fsp),
                            rest[term[variable, symbol, arity]](fst)))
           (finseq_appl[position[variable, symbol, arity]](fsp)(0));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1296 0 1303 999
body:
  % Subtype TCC generated (at line 459, column 42) for  n
      % expected type  below[length(fst)]
  replace_par_pos_equivalence1_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term], n: nat,
            s: term[variable, symbol, arity]):
      n < fsp`length AND
       fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp)
       IMPLIES n < length(fst);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1305 0 1315 999
body:
  % Subtype TCC generated (at line 459, column 46) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(n)
      % expected type  positions?[variable, symbol, arity](s)
  replace_par_pos_equivalence1_TCC2: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term], n: nat,
            s: term[variable, symbol, arity]):
      n < fsp`length AND
       fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp)
       IMPLIES
       positionsOF[variable, symbol, arity]
           (s)(finseq_appl[position[variable, symbol, arity]](fsp)(n));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1317 0 1343 999
body:
  % Subtype TCC generated (at line 459, column 55) for  delete(fsp, n)
      % expected type  SPP
                     %     [variable, symbol, arity](replaceTerm
                     %                               (s,
                     %                                finseq_appl
                     %                                [term
                     %                                 [variable,
                     %                                  symbol,
                     %                                  arity]]
                     %                                (fst)(n),
                     %                                finseq_appl
                     %                                [position
                     %                                 [variable,
                     %                                  symbol,
                     %                                  arity]]
                     %                                (fsp)(n)))
  replace_par_pos_equivalence1_TCC3: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term], n: nat,
            s: term[variable, symbol, arity]):
      n < fsp`length AND
       fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp)
       IMPLIES
       SPP?[variable, symbol, arity]
           (replaceTerm[variable, symbol, arity]
                (s, finseq_appl[term[variable, symbol, arity]](fst)(n),
                 finseq_appl[position[variable, symbol, arity]](fsp)(n)))
           (delete[position[variable, symbol, arity]](fsp, n));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1345 0 1354 999
body:
  % Subtype TCC generated (at line 459, column 70) for  delete[term](fst, n)
      % expected type  {fst_1 | fst_1`length = delete(fsp, n)`length}
  replace_par_pos_equivalence1_TCC4: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term], n: nat,
            s: term[variable, symbol, arity]):
      n < fsp`length AND
       fst`length = fsp`length AND fsp`length /= 0 AND SPP?(s)(fsp)
       IMPLIES
       delete[term[variable, symbol, arity]](fst, n)`length =
        delete[position[variable, symbol, arity]](fsp, n)`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1356 0 1365 999
body:
  % Subtype TCC generated (at line 466, column 51) for  p
      % expected type  positions?
                     %     [variable, symbol, arity](replace_par_pos
                     %                               (t, fsp, fst))
  replace_par_pos_preservs_subterm_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p: position[variable, symbol, arity],
            t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(t)(add_first(p, fsp)) IMPLIES
       positionsOF[variable, symbol, arity](replace_par_pos(t, fsp, fst))(p);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1367 0 1374 999
body:
  % Subtype TCC generated (at line 466, column 69) for  p
      % expected type  positions?[variable, symbol, arity](t)
  replace_par_pos_preservs_subterm_TCC2: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p: position[variable, symbol, arity],
            t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(t)(add_first(p, fsp)) IMPLIES
       positionsOF[variable, symbol, arity](t)(p);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1376 0 1388 999
body:
  % Subtype TCC generated (at line 472, column 85) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(i)
      % expected type  positions?
                     %     [variable, symbol, arity](replace_par_pos
                     %                               (t, fsp, fst))
  replace_par_pos_subterm_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(t)(fsp) IMPLIES
       (FORALL (i: below[fsp`length]):
          positionsOF[variable, symbol, arity]
              (replace_par_pos(t, fsp, fst))
              (finseq_appl[position[variable, symbol, arity]](fsp)(i)));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1390 0 1396 999
body:
  % Subtype TCC generated (at line 472, column 97) for  i
      % expected type  below[length(fst)]
  replace_par_pos_subterm_TCC2: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(t)(fsp) IMPLIES
       (FORALL (i: below[fsp`length]): i < length(fst));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1398 0 1407 999
body:
  % Subtype TCC generated (at line 479, column 44) for  fst1 o fst2
      % expected type  {fst | fst`length = (fsp1 o fsp2)`length}
  replace_par_pos_comp_TCC1: OBLIGATION
    FORALL (fsp1, fsp2: finseq[position], fst1, fst2: finseq[term],
            t: term[variable, symbol, arity]):
      fst2`length = fsp2`length AND
       fst1`length = fsp1`length AND SPP?(t)(fsp1 o fsp2)
       IMPLIES
       (o[term[variable, symbol, arity]](fst1, fst2))`length =
        (o[position[variable, symbol, arity]](fsp1, fsp2))`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1409 0 1416 999
body:
  % Subtype TCC generated (at line 480, column 59) for  fsp1
      % expected type  SPP[variable, symbol, arity](t)
  replace_par_pos_comp_TCC2: OBLIGATION
    FORALL (fsp1, fsp2: finseq[position], fst1, fst2: finseq[term],
            t: term[variable, symbol, arity]):
      fst2`length = fsp2`length AND
       fst1`length = fsp1`length AND SPP?(t)(fsp1 o fsp2)
       IMPLIES SPP?[variable, symbol, arity](t)(fsp1);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1418 0 1428 999
body:
  % Subtype TCC generated (at line 480, column 71) for  fsp2
      % expected type  SPP
                     %     [variable, symbol, arity](replace_par_pos
                     %                               (t, fsp1, fst1))
  replace_par_pos_comp_TCC3: OBLIGATION
    FORALL (fsp1, fsp2: finseq[position], fst1, fst2: finseq[term],
            t: term[variable, symbol, arity]):
      fst2`length = fsp2`length AND
       fst1`length = fsp1`length AND SPP?(t)(fsp1 o fsp2)
       IMPLIES
       SPP?[variable, symbol, arity](replace_par_pos(t, fsp1, fst1))(fsp2);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1430 0 1439 999
body:
  % Subtype TCC generated (at line 488, column 65) for  fsp2 o fsp1
      % expected type  SPP[variable, symbol, arity](t)
  replace_par_pos_comp_commute_TCC1: OBLIGATION
    FORALL (fsp1, fsp2: finseq[position], fst1, fst2: finseq[term],
            t: term[variable, symbol, arity]):
      fst2`length = fsp2`length AND
       fst1`length = fsp1`length AND SPP?(t)(fsp1 o fsp2)
       IMPLIES
       SPP?[variable, symbol, arity]
           (t)(o[position[variable, symbol, arity]](fsp2, fsp1));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1441 0 1450 999
body:
  % Subtype TCC generated (at line 488, column 78) for  fst2 o fst1
      % expected type  {fst | fst`length = (fsp2 o fsp1)`length}
  replace_par_pos_comp_commute_TCC2: OBLIGATION
    FORALL (fsp1, fsp2: finseq[position], fst1, fst2: finseq[term],
            t: term[variable, symbol, arity]):
      fst2`length = fsp2`length AND
       fst1`length = fsp1`length AND SPP?(t)(fsp1 o fsp2)
       IMPLIES
       (o[term[variable, symbol, arity]](fst2, fst1))`length =
        (o[position[variable, symbol, arity]](fsp2, fsp1))`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1452 0 1460 999
body:
  % Subtype TCC generated (at line 506, column 46) for  rest(fsp)
      % expected type  PP[variable, symbol, arity]
  complement_pos_TCC1: OBLIGATION
    FORALL (p: position[variable, symbol, arity],
            (fsp: PP[variable, symbol, arity])):
      nonempty?(complement_pos_set(p, fsp`seq(0))) AND NOT length(fsp) = 0
       IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1462 0 1469 999
body:
  % Termination TCC generated (at line 506, column 29) for
      % complement_pos(p, rest(fsp))
  complement_pos_TCC2: OBLIGATION
    FORALL (p: position[variable, symbol, arity],
            (fsp: PP[variable, symbol, arity])):
      nonempty?(complement_pos_set(p, fsp`seq(0))) AND NOT length(fsp) = 0
       IMPLIES
       (length(rest[position[variable, symbol, arity]](fsp))) < (length(fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1471 0 1480 999
body:
  % Subtype TCC generated (at line 507, column 36) for  rest(fsp)
      % expected type  PP[variable, symbol, arity]
  complement_pos_TCC3: OBLIGATION
    FORALL (p: position[variable, symbol, arity],
            (fsp: PP[variable, symbol, arity])):
      NOT nonempty?(complement_pos_set(p, fsp`seq(0))) AND
       NOT length(fsp) = 0
       IMPLIES
       PP?[variable, symbol, arity]
           (rest[position[variable, symbol, arity]](fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1482 0 1490 999
body:
  % Termination TCC generated (at line 507, column 19) for
      % complement_pos(p, rest(fsp))
  complement_pos_TCC4: OBLIGATION
    FORALL (p: position[variable, symbol, arity],
            (fsp: PP[variable, symbol, arity])):
      NOT nonempty?(complement_pos_set(p, fsp`seq(0))) AND
       NOT length(fsp) = 0
       IMPLIES
       (length(rest[position[variable, symbol, arity]](fsp))) < (length(fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1492 0 1496 999
body:
  % Subtype TCC generated (at line 530, column 47) for  fsp
      % expected type  PP[variable, symbol, arity]
  complement_pos_empty_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], p: position[variable, symbol, arity]):
      PP?(add_first(p, fsp)) IMPLIES PP?[variable, symbol, arity](fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1498 0 1503 999
body:
  % Subtype TCC generated (at line 556, column 25) for  i
      % expected type  below[comp_pos(p, fsp)`length]
  comp_pos_character_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], p: position[variable, symbol, arity],
            i: below[fsp`length]):
      i < comp_pos(p, fsp)`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1505 0 1513 999
body:
  % Subtype TCC generated (at line 566, column 91) for  comp_pos(q, fsp)
      % expected type  SPP[variable, symbol, arity](replaceTerm(t, s, q))
  replace_replace_par_pos_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            q: position[variable, symbol, arity],
            s, t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(s)(fsp) AND positionsOF(t)(q) IMPLIES
       SPP?[variable, symbol, arity]
           (replaceTerm[variable, symbol, arity](t, s, q))(comp_pos(q, fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1515 0 1522 999
body:
  % Subtype TCC generated (at line 566, column 108) for  fst
      % expected type  {fst | fst`length = comp_pos(q, fsp)`length}
  replace_replace_par_pos_TCC2: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            q: position[variable, symbol, arity],
            s, t: term[variable, symbol, arity]):
      fst`length = fsp`length AND SPP?(s)(fsp) AND positionsOF(t)(q) IMPLIES
       fst`length = comp_pos(q, fsp)`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1524 0 1528 999
body:
  % Subtype TCC generated (at line 572, column 22) for  complement_pos(p, fsp)
      % expected type  PP[variable, symbol, arity]
  complement_pos_preservs_sub_pos_length_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], p: position[variable, symbol, arity]):
      PP?(fsp) IMPLIES PP?[variable, symbol, arity](complement_pos(p, fsp));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1530 0 1535 999
body:
  % Subtype TCC generated (at line 606, column 57) for  0
      % expected type  below[fsp`length]
  comp_pos_in_SP_preservs_SP_in_replace_TCC1: OBLIGATION
    FORALL (fsp, fsp1: finseq[position],
            s, t: term[variable, symbol, arity]):
      fsp`length > 0 AND SP?(s)(fsp1) AND SPP?(t)(fsp) IMPLIES 0 < fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1537 0 1543 999
body:
  % Subtype TCC generated (at line 606, column 27) for  fsp`seq(0)
      % expected type  positions?[variable, symbol, arity](t)
  comp_pos_in_SP_preservs_SP_in_replace_TCC2: OBLIGATION
    FORALL (fsp, fsp1: finseq[position],
            s, t: term[variable, symbol, arity]):
      fsp`length > 0 AND SP?(s)(fsp1) AND SPP?(t)(fsp) IMPLIES
       positionsOF[variable, symbol, arity](t)(fsp`seq(0));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1545 0 1549 999
body:
  % Subtype TCC generated (at line 610, column 26) for  0
      % expected type  below[fsp`length]
  comp_pos_in_PP_preservs_PP_TCC1: OBLIGATION
    FORALL (fsp, fsp1: finseq[position]):
      fsp`length > 0 AND PP?(fsp1) AND PP?(fsp) IMPLIES 0 < fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1551 0 1557 999
body:
  % Subtype TCC generated (at line 614, column 58) for  0
      % expected type  below[fsp`length]
  comp_pos_in_SPP_preservs_SPP_in_replace_TCC1: OBLIGATION
    FORALL (fsp, fsp1: finseq[position],
            s, t: term[variable, symbol, arity]):
      fsp`length > 0 AND SPP?(s)(fsp1) AND SPP?(t)(fsp) IMPLIES
       0 < fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1559 0 1565 999
body:
  % Subtype TCC generated (at line 614, column 28) for  fsp`seq(0)
      % expected type  positions?[variable, symbol, arity](t)
  comp_pos_in_SPP_preservs_SPP_in_replace_TCC2: OBLIGATION
    FORALL (fsp, fsp1: finseq[position],
            s, t: term[variable, symbol, arity]):
      fsp`length > 0 AND SPP?(s)(fsp1) AND SPP?(t)(fsp) IMPLIES
       positionsOF[variable, symbol, arity](t)(fsp`seq(0));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1567 0 1573 999
body:
  % Subtype TCC generated (at line 618, column 17) for  0
      % expected type  below[fst`length]
  comp_pos_in_SPP_preservs_SPP_in_replace_par_pos_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            t: term[variable, symbol, arity]):
      SPP?(t)(fsp) AND fsp`length = fst`length AND fsp`length /= 0 IMPLIES
       0 < fst`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1575 0 1582 999
body:
  % Subtype TCC generated (at line 619, column 33) for  fst
      % expected type  {fst | fst`length = fsp`length}
  comp_pos_in_SPP_preservs_SPP_in_replace_par_pos_TCC2: OBLIGATION
    FORALL (fsp, fsp1: finseq[position], fst: finseq[term],
            t: term[variable, symbol, arity]):
      SPP?(t)(fsp) AND
       fsp`length = fst`length AND fsp`length /= 0 AND SPP?(fst`seq(0))(fsp1)
       IMPLIES fst`length = fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1584 0 1592 999
body:
  % Subtype TCC generated (at line 620, column 26) for  0
      % expected type  below[fsp`length]
  comp_pos_in_SPP_preservs_SPP_in_replace_par_pos_TCC3: OBLIGATION
    FORALL (fsp, fsp1, fsp2: finseq[position], fst: finseq[term],
            t: term[variable, symbol, arity]):
           SPP?(t)(fsp) AND fsp`length = fst`length AND fsp`length /= 0
       AND SPP?(fst`seq(0))(fsp1)
       AND SPP?(replace_par_pos(t, fsp, fst))(fsp2)
       IMPLIES 0 < fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1594 0 1600 999
body:
  % Subtype TCC generated (at line 633, column 73) for  i
      % expected type  below[length(fst2)]
  parallel_reduction_context_aux2_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst1, fst2: finseq[term],
            t: term[variable, symbol, arity]):
      SPP?(t)(fsp) AND fst1`length = fsp`length AND fst2`length = fsp`length
       IMPLIES (FORALL (i: below[fsp`length]): i < length(fst2));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1602 0 1610 999
body:
  % Subtype TCC generated (at line 652, column 16) for
      % replace_par_pos(t, fsp, fst)
      % expected type  (app?)
  replace_par_pos_preservs_f_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            t: term[variable, symbol, arity]):
      fst`length = fsp`length AND
       SPP?(t)(fsp) AND app?(t) AND NOT fsp =  #(empty_seq)
       IMPLIES app?[variable, symbol, arity](replace_par_pos(t, fsp, fst));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1612 0 1623 999
body:
  % Subtype TCC generated (at line 681, column 44) for  fst
      % expected type  {fst | fst`length = fsp`length}
  replace_par_pos_subterm2_TCC1: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p, p1: position[variable, symbol, arity],
            s: term[variable, symbol, arity]):
           fsp`length = fst`length AND p /= p1 AND p <= p1
       AND member_seq(p1, fsp) AND SPP?(s)(fsp)
       IMPLIES
       (FORALL (fst1):
          complement_pos(p, fsp)`length = fst1`length IMPLIES
           fst`length = fsp`length);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1625 0 1639 999
body:
  % Subtype TCC generated (at line 681, column 50) for  p
      % expected type  positions?
                     %     [variable, symbol, arity](replace_par_pos
                     %                               (s, fsp, fst))
  replace_par_pos_subterm2_TCC2: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p, p1: position[variable, symbol, arity],
            s: term[variable, symbol, arity]):
           fsp`length = fst`length AND p /= p1 AND p <= p1
       AND member_seq(p1, fsp) AND SPP?(s)(fsp)
       IMPLIES
       (FORALL (fst1):
          complement_pos(p, fsp)`length = fst1`length IMPLIES
           positionsOF[variable, symbol, arity]
               (replace_par_pos(s, fsp, fst))(p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1641 0 1652 999
body:
  % Subtype TCC generated (at line 682, column 46) for  p
      % expected type  positions?[variable, symbol, arity](s)
  replace_par_pos_subterm2_TCC3: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p, p1: position[variable, symbol, arity],
            s: term[variable, symbol, arity]):
           fsp`length = fst`length AND p /= p1 AND p <= p1
       AND member_seq(p1, fsp) AND SPP?(s)(fsp)
       IMPLIES
       (FORALL (fst1):
          complement_pos(p, fsp)`length = fst1`length IMPLIES
           positionsOF[variable, symbol, arity](s)(p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1654 0 1667 999
body:
  % Subtype TCC generated (at line 682, column 50) for  complement_pos(p, fsp)
      % expected type  SPP[variable, symbol, arity](subtermOF(s, p))
  replace_par_pos_subterm2_TCC4: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p, p1: position[variable, symbol, arity],
            s: term[variable, symbol, arity]):
           fsp`length = fst`length AND p /= p1 AND p <= p1
       AND member_seq(p1, fsp) AND SPP?(s)(fsp)
       IMPLIES
       (FORALL (fst1):
          complement_pos(p, fsp)`length = fst1`length IMPLIES
           SPP?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](s, p))
               (complement_pos(p, fsp)));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1669 0 1680 999
body:
  % Subtype TCC generated (at line 682, column 74) for  fst1
      % expected type  {fst | fst`length = complement_pos(p, fsp)`length}
  replace_par_pos_subterm2_TCC5: OBLIGATION
    FORALL (fsp: finseq[position], fst: finseq[term],
            p, p1: position[variable, symbol, arity],
            s: term[variable, symbol, arity]):
           fsp`length = fst`length AND p /= p1 AND p <= p1
       AND member_seq(p1, fsp) AND SPP?(s)(fsp)
       IMPLIES
       (FORALL (fst1):
          complement_pos(p, fsp)`length = fst1`length IMPLIES
           fst1`length = complement_pos(p, fsp)`length);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1682 0 1695 999
body:
  % Subtype TCC generated (at line 692, column 45) for  fsp`seq(i)
      % expected type  {p | positionsOF(s)(p) & positionsOF(t)(p)}
  D_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            (fsp: finseq[position]
                 | SPP?[variable, symbol, arity](s)(fsp) &
                    SPP?[variable, symbol, arity](t)(fsp)),
            E: set[rewrite_rule[variable, symbol, arity]],
            i: below[fsp`length], e: rewrite_rule[variable, symbol, arity]):
      member(e, E) IMPLIES
       (FORALL (sigma):
          positionsOF[variable, symbol, arity](s)(fsp`seq(i)) &
           positionsOF[variable, symbol, arity](t)(fsp`seq(i)));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1697 0 1710 999
body:
  % Subtype TCC generated (at line 695, column 56) for  fsp`seq(i)
      % expected type  {p | positionsOF(s)(p) & positionsOF(t)(p)}
  G_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            (fsp: finseq[position]
                 | SPP?[variable, symbol, arity](s)(fsp) &
                    SPP?[variable, symbol, arity](t)(fsp)),
            E: set[rewrite_rule[variable, symbol, arity]],
            i: below[fsp`length], sigma: Sub[variable, symbol, arity],
            e: rewrite_rule[variable, symbol, arity]
                | member[rewrite_rule[variable, symbol, arity]](e, E)):
      positionsOF[variable, symbol, arity](s)(fsp`seq(i)) &
       positionsOF[variable, symbol, arity](t)(fsp`seq(i));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1712 0 1723 999
body:
  % Subtype TCC generated (at line 723, column 54) for  fsp
      % expected type  SP[variable, symbol, arity](s)
  replace_par_pos_dominance_TCC1: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp, fsp1: finseq[position],
            s, t: term[variable, symbol, arity]):
      (FORALL (i: below[fsp1`length]):
         EXISTS (j: below[fsp`length]): fsp`seq(j) <= fsp1`seq(i))
       AND
       parallel_reduction_fix?(E)(t, s, fsp1) AND
        SPP?(t)(fsp1) AND SPP?(t)(fsp)
       IMPLIES SP?[variable, symbol, arity](s)(fsp);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1725 0 1736 999
body:
  % Subtype TCC generated (at line 723, column 41) for  subtermsOF(s, fsp)
      % expected type  {fst | fst`length = fsp`length}
  replace_par_pos_dominance_TCC2: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp, fsp1: finseq[position],
            s, t: term[variable, symbol, arity]):
      (FORALL (i: below[fsp1`length]):
         EXISTS (j: below[fsp`length]): fsp`seq(j) <= fsp1`seq(i))
       AND
       parallel_reduction_fix?(E)(t, s, fsp1) AND
        SPP?(t)(fsp1) AND SPP?(t)(fsp)
       IMPLIES subtermsOF(s, fsp)`length = fsp`length;


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1738 0 1747 999
body:
  % Subtype TCC generated (at line 735, column 29) for   #(p)
      % expected type  PP[variable, symbol, arity]
  divergence_in_Pos_Over_aux_TCC1: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp2: finseq[position], p: position[variable, symbol, arity],
            t, t2: term[variable, symbol, arity]):
      SPP?(t)(fsp2) AND
       parallel_reduction_fix?(E)(t, t2, fsp2) AND positionsOF(t)(p)
       IMPLIES
       PP?[variable, symbol, arity]( #[position[variable, symbol, arity]](p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1749 0 1758 999
body:
  % Subtype TCC generated (at line 736, column 73) for  p
      % expected type  positions?[variable, symbol, arity](t2)
  divergence_in_Pos_Over_aux_TCC2: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp2: finseq[position], p: position[variable, symbol, arity],
            t, t2: term[variable, symbol, arity]):
      member_seq(p, Pos_Over( #(p), fsp2)) AND
       positionsOF(t)(p) AND
        parallel_reduction_fix?(E)(t, t2, fsp2) AND SPP?(t)(fsp2)
       IMPLIES positionsOF[variable, symbol, arity](t2)(p);


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1760 0 1773 999
body:
  % Subtype TCC generated (at line 736, column 77) for
      % complement_pos(p, fsp2)
      % expected type  SPP[variable, symbol, arity](subtermOF(t, p))
  divergence_in_Pos_Over_aux_TCC3: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp2: finseq[position], p: position[variable, symbol, arity],
            t, t2: term[variable, symbol, arity]):
      member_seq(p, Pos_Over( #(p), fsp2)) AND
       positionsOF(t)(p) AND
        parallel_reduction_fix?(E)(t, t2, fsp2) AND SPP?(t)(fsp2)
       IMPLIES
       SPP?[variable, symbol, arity]
           (subtermOF[variable, symbol, arity](t, p))
           (complement_pos(p, fsp2));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1775 0 1790 999
body:
  % Subtype TCC generated (at line 744, column 34) for  p
      % expected type  positions?[variable, symbol, arity](t)
  divergence_in_Pos_Over_TCC1: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp1, fsp2: finseq[position],
            p: position[variable, symbol, arity],
            t, t1, t2: term[variable, symbol, arity]):
           member_seq(p, Pos_Over(fsp1, fsp2))
       AND parallel_reduction_fix?(E)(t, t2, fsp2)
       AND parallel_reduction_fix?(E)(t, t1, fsp1) AND SPP?(t)(fsp2)
       AND SPP?(t)(fsp1)
       IMPLIES
       (FORALL ((e: rewrite_rule[variable, symbol, arity]
                     | member[rewrite_rule[variable, symbol, arity]](e, E)),
                sigma: Sub[variable, symbol, arity]):
          positionsOF[variable, symbol, arity](t)(p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1792 0 1808 999
body:
  % Subtype TCC generated (at line 745, column 35) for  p
      % expected type  positions?[variable, symbol, arity](t1)
  divergence_in_Pos_Over_TCC2: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp1, fsp2: finseq[position],
            p: position[variable, symbol, arity],
            t, t1, t2: term[variable, symbol, arity]):
           member_seq(p, Pos_Over(fsp1, fsp2))
       AND parallel_reduction_fix?(E)(t, t2, fsp2)
       AND parallel_reduction_fix?(E)(t, t1, fsp1) AND SPP?(t)(fsp2)
       AND SPP?(t)(fsp1)
       IMPLIES
       (FORALL ((e: rewrite_rule[variable, symbol, arity]
                     | member[rewrite_rule[variable, symbol, arity]](e, E)),
                sigma: Sub[variable, symbol, arity]):
          subtermOF(t, p) = ext(sigma)(lhs(e)) IMPLIES
           positionsOF[variable, symbol, arity](t1)(p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1810 0 1827 999
body:
  % Subtype TCC generated (at line 746, column 73) for  p
      % expected type  positions?[variable, symbol, arity](t2)
  divergence_in_Pos_Over_TCC3: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp1, fsp2: finseq[position],
            p: position[variable, symbol, arity],
            t, t1, t2: term[variable, symbol, arity]):
           member_seq(p, Pos_Over(fsp1, fsp2))
       AND parallel_reduction_fix?(E)(t, t2, fsp2)
       AND parallel_reduction_fix?(E)(t, t1, fsp1) AND SPP?(t)(fsp2)
       AND SPP?(t)(fsp1)
       IMPLIES
       (FORALL ((e: rewrite_rule[variable, symbol, arity]
                     | member[rewrite_rule[variable, symbol, arity]](e, E)),
                sigma: Sub[variable, symbol, arity]):
          subtermOF(t1, p) = ext(sigma)(rhs(e)) AND
           subtermOF(t, p) = ext(sigma)(lhs(e))
           IMPLIES positionsOF[variable, symbol, arity](t2)(p));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1829 0 1845 999
body:
  % Subtype TCC generated (at line 756, column 43) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(i)
      % expected type  positions?[variable, symbol, arity](t1)
  subterm_joinability_TCC1: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp, fsp1, fsp2: finseq[position],
            t, t1, t2: term[variable, symbol, arity]):
           fsp =
            Pos_Over(fsp1, fsp2) o Pos_Over(fsp2, fsp1) o
             Pos_Equal(fsp1, fsp2)
       AND parallel_reduction_fix?(E)(t, t2, fsp2)
       AND parallel_reduction_fix?(E)(t, t1, fsp1) AND SPP?(t)(fsp2)
       AND SPP?(t)(fsp1) AND Orthogonal?(E)
       IMPLIES
       (FORALL (i: below[fsp`length]):
          positionsOF[variable, symbol, arity]
              (t1)(finseq_appl[position[variable, symbol, arity]](fsp)(i)));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1847 0 1870 999
body:
  % Subtype TCC generated (at line 757, column 43) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(i)
      % expected type  positions?[variable, symbol, arity](t2)
  subterm_joinability_TCC2: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp, fsp1, fsp2: finseq[position],
            t, t1, t2: term[variable, symbol, arity]):
           fsp =
            Pos_Over(fsp1, fsp2) o Pos_Over(fsp2, fsp1) o
             Pos_Equal(fsp1, fsp2)
       AND parallel_reduction_fix?(E)(t, t2, fsp2)
       AND parallel_reduction_fix?(E)(t, t1, fsp1) AND SPP?(t)(fsp2)
       AND SPP?(t)(fsp1) AND Orthogonal?(E)
       IMPLIES
       (FORALL (i: below[fsp`length], s):
          parallel_reduction?(E)
                             (subtermOF(t1,
                                        finseq_appl
                                        [position[variable, symbol, arity]]
                                        (fsp)(i)),
                              s)
           IMPLIES
           positionsOF[variable, symbol, arity]
               (t2)(finseq_appl[position[variable, symbol, arity]](fsp)(i)));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1872 0 1887 999
body:
  % Subtype TCC generated (at line 767, column 56) for  i
      % expected type  below[length(fst)]
  subterms_joinability_TCC1: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp, fsp1, fsp2: finseq[position],
            t, t1, t2: term[variable, symbol, arity]):
           fsp =
            Pos_Over(fsp1, fsp2) o Pos_Over(fsp2, fsp1) o
             Pos_Equal(fsp1, fsp2)
       AND parallel_reduction_fix?(E)(t, t2, fsp2)
       AND parallel_reduction_fix?(E)(t, t1, fsp1) AND SPP?(t)(fsp2)
       AND SPP?(t)(fsp1) AND Orthogonal?(E)
       IMPLIES
       (FORALL (fst):
          fsp`length = fst`length IMPLIES
           (FORALL (i: below[fsp`length]): i < length(fst)));


decl_type: tcc
theory: orthogonality
library: TRS
signature: nil
location: 1889 0 1917 999
body:
  % Subtype TCC generated (at line 768, column 43) for
      % finseq_appl[position[variable, symbol, arity]](fsp)(i)
      % expected type  positions?[variable, symbol, arity](t2)
  subterms_joinability_TCC2: OBLIGATION
    FORALL (E: set[rewrite_rule[variable, symbol, arity]],
            fsp, fsp1, fsp2: finseq[position],
            t, t1, t2: term[variable, symbol, arity]):
           fsp =
            Pos_Over(fsp1, fsp2) o Pos_Over(fsp2, fsp1) o
             Pos_Equal(fsp1, fsp2)
       AND parallel_reduction_fix?(E)(t, t2, fsp2)
       AND parallel_reduction_fix?(E)(t, t1, fsp1) AND SPP?(t)(fsp2)
       AND SPP?(t)(fsp1) AND Orthogonal?(E)
       IMPLIES
       (FORALL (fst):
          fsp`length = fst`length IMPLIES
           (FORALL (i: below[fsp`length]):
              parallel_reduction?(E)
                                 (subtermOF(t1,
                                            finseq_appl
                                            [position
                                             [variable, symbol, arity]]
                                            (fsp)(i)),
                                  finseq_appl[term[variable, symbol, arity]]
                                      (fst)(i))
               IMPLIES
               positionsOF[variable, symbol, arity]
                   (t2)
                   (finseq_appl[position[variable, symbol, arity]](fsp)(i))));


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 77 0 79 53
body:
  comutative_first_diff : LEMMA
     FORALL (s : term, t : term | s /= t, p : position) :
       p = first_diff(s, t) IMPLIES p = first_diff(t,s)


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 81 0 83 51
body:
  position_s_first_diff : LEMMA 
     FORALL (s : term, t : term | s /= t, p : position) :
       p = first_diff(s, t) IMPLIES positionsOF(s)(p)


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 85 0 87 51
body:
  position_t_first_diff : LEMMA
     FORALL (s : term, t : term | s /= t, p : position) :
       p = first_diff(s, t) IMPLIES positionsOF(t)(p)


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 89 0 91 68
body:
  first_diff_has_diff_argument : LEMMA
     FORALL (s : term, t : term | s /= t, p : position):
       p = first_diff(s, t) IMPLIES subtermOF(s, p) /= subtermOF(t, p)


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 93 0 96 50
body:
  first_diff_unifiable_vars : LEMMA
     FORALL (s : term, t : term | s /= t, p : position):
       p = first_diff(s, t) AND unifiable(s,t) IMPLIES
          vars?(subtermOF(s, p)) OR vars?(subtermOF(t, p))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 98 0 105 62
body:
  fd_equal_symbol : LEMMA
      FORALL (s : term,
              t : term | s /= t) :
        LET fd = first_diff(s, t) IN
           ( FORALL (p : position | positionsOF(s)(p) AND
                                    positionsOF(t)(p)):
                    child(fd, p) =>
                      f(subtermOF(s, p)) =  f(subtermOF(t, p)) )


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 127 0 134 16
body:
  dom_link_of_frst_diff_is : LEMMA
      FORALL (s : term, t : term | s /= t):
        LET sig = link_of_frst_diff(s, t) IN
          NOT sig = fail AND p = first_diff(s, t) IMPLIES
             IF vars?(subtermOF(s, p))
               THEN Dom(sig) = singleton(subtermOF(s, p))
               ELSE Dom(sig) = singleton(subtermOF(t, p))
             ENDIF


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 136 0 141 37
body:
  dom_ran_link_disjoint : LEMMA
      FORALL (s : term, t : term | s /= t): 
         LET sig = link_of_frst_diff(s ,t) IN 
             NOT sig = fail IMPLIES
             FORALL ( x | member(x,Dom(sig)), r | member(r,Ran(sig) )) :
                 NOT member(x, Vars(r))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 143 0 148 46
body:
  link_remove_x : LEMMA
      FORALL (s : term, t : term | s /= t):
         LET sig = link_of_frst_diff(s, t) IN
           (NOT sig = fail AND  Dom(sig)(x)) IMPLIES  
              (NOT member(x, Vars(ext(sig)(s)))) AND
              (NOT member(x, Vars(ext(sig)(t))))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 150 0 154 63
body:
  link_of_frst_diff_s_is_subset_union : LEMMA
      FORALL (s : term, t : term |  s /= t):
          LET sig = link_of_frst_diff(s, t) IN
             NOT sig = fail IMPLIES 
             subset?(Vars(ext(sig)(s)), union( Vars(s), Vars(t)))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 156 0 160 60
body:
  comutative_link_fd : LEMMA
      FORALL (s : term, t : term |  s /= t):
          LET p = first_diff(s, t) IN
           NOT vars?(subtermOF(s,p)) IMPLIES
             link_of_frst_diff(s, t) = link_of_frst_diff(t, s)


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 162 0 166 64
body:
  link_of_frst_diff_t_is_subset_union : LEMMA
      FORALL (s : term, t : term |  s /= t):
          LET sig = link_of_frst_diff(s, t) IN
              NOT sig = fail IMPLIES 
              subset?(Vars(ext(sig)(t)), union( Vars(s), Vars(t)))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 168 0 173 62
body:
  union_vars_ext_link : LEMMA
      FORALL (s : term, t : term | s /= t) :
          LET sig = link_of_frst_diff(s, t) IN
             NOT sig = fail IMPLIES
               union(Vars(ext(sig)(s)), Vars(ext(sig)(t)))
                = difference(union( Vars(s), Vars(t)), Dom(sig))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 175 0 180 45
body:
  termination_lemma : LEMMA
    FORALL (s : term, t : term | s /= t):
           LET sig = link_of_frst_diff(s, t) IN
             NOT sig = fail IMPLIES
               Card(union( Vars(ext(sig)(s)), Vars(ext(sig)(t))))
               < Card(union( Vars(s), Vars(t)))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 182 0 186 26
body:
  unifiable_implies_not_fail : LEMMA
    FORALL (s : term, t : term | s /= t):
           LET sig = link_of_frst_diff(s, t) IN
              unifiable(s, t) IMPLIES
              NOT sig = fail


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 188 0 192 51
body:
  preserving_generality : LEMMA
      FORALL (s : term, t : term | s /= t):
          member(rho, U(s, t)) IMPLIES
             LET sig = link_of_frst_diff(s, t) IN
                EXISTS theta : rho = comp(theta, sig)


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 194 0 198 46
body:
  unifiable_preserves_unifiability : LEMMA
    FORALL (s : term, t : term | s /= t):
           LET sig = link_of_frst_diff(s, t) IN
              unifiable(s, t) IMPLIES
              unifiable(ext(sig)(s),ext(sig)(t))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 218 1 220 71
body:
   var_ext_term_exists_var_term : LEMMA
     member(x, Vars(ext(sigma)(r)))
       IMPLIES EXISTS y: member(y, Vars(r)) AND member(x, Vars(sigma(y)))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 222 1 225 56
body:
   rob_uni_alg_dom_subset_union_vars : LEMMA
      unifiable(s, t) IMPLIES 
         LET sigma = robinson_unification_algorithm(s, t) IN
            subset?( Dom(sigma), union(Vars(s), Vars(t)) )


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 227 1 233 71
body:
   rob_uni_alg_vran_subset_union : LEMMA
      FORALL (s : term, t : term | s /= t):
      LET sig1 = link_of_frst_diff(s, t) IN
        LET sig2 = robinson_unification_algorithm(ext(sig1)(s), ext(sig1)(t)) IN
          unifiable(s, t) IMPLIES
            subset?(VRan(comp(sig2, sig1)), 
                    union(VRan(sig2), difference(VRan(sig1), Dom(sig2))))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 235 1 239 71
body:
   rob_uni_alg_dom_ran_disjoint : LEMMA
      unifiable(s,t) IMPLIES
            LET sigma = robinson_unification_algorithm(s, t) IN
             subset?( VRan(sigma) , 
                       difference( union(Vars(s), Vars(t)), Dom(sigma) ))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 241 1 242 67
body:
   robinson_unification_algorithm_fails_iff_non_unifiable : LEMMA
    NOT unifiable(s,t) IFF robinson_unification_algorithm(s,t) = fail


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 246 1 247 76
body:
   robinson_unification_algorithm_gives_unifier : LEMMA
      unifiable(s,t) IFF member(robinson_unification_algorithm(s, t), U(s, t))


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 249 1 250 76
body:
   robinson_unification_algorithm_gives_mg_subs : LEMMA
      member(rho, U(s, t)) IMPLIES robinson_unification_algorithm(s, t) <= rho


decl_type: formula
theory: robinsonunification
library: TRS
signature: nil
location: 254 1 257 8
body:
   completeness_robinson_unification_algorithm : THEOREM
     IF unifiable(s,t) THEN  mgu(robinson_unification_algorithm(s,t))(s,t)
                       ELSE  robinson_unification_algorithm(s,t) = fail 
     ENDIF


decl_type: function
theory: robinsonunification
library: TRS
signature:
  [[s: term, {t: term | s /= t}] ->
  position[variable, symbol, arity]]

location: 52 1 72 16
body:
   first_diff(s : term, (t : term | s /= t ) ):
     RECURSIVE position =
      (CASES s OF
         vars(s) : empty_seq,
         app(f, st) :
         IF length(st) = 0 THEN empty_seq
         ELSE 
          (CASES t OF
             vars(t) : empty_seq,
             app(fp, stp) : 
             IF f = fp THEN
               LET k : below[length(stp)] = 
                  min({kk : below[length(stp)] |
                            subtermOF(s,#(kk+1)) /= subtermOF(t,#(kk+1))}) IN
                  add_first(k+1,
                         first_diff(subtermOF(s,#(k+1)),subtermOF(t,#(k+1))))
             ELSE empty_seq ENDIF
           ENDCASES)
         ENDIF
       ENDCASES)
   MEASURE s BY << 


decl_type: function
theory: robinsonunification
library: TRS
signature: [[s: term, {t: term | s /= t}] -> Sub[variable, symbol, arity]]
location: 110 1 123 13
body:
   link_of_frst_diff(s : term , (t : term | s /= t )) : Sub =
    LET k : position = first_diff(s,t) IN
       LET sp = subtermOF(s,k) , tp = subtermOF(t,k) IN 
          IF vars?(sp) 
          THEN IF NOT member(sp, Vars(tp))
               THEN (LAMBDA (x : (V)) : IF x = sp THEN tp ELSE x ENDIF)
               ELSE fail ENDIF 
          ELSE 
             IF vars?(tp) 
             THEN IF NOT member(tp, Vars(sp))
                  THEN (LAMBDA (x : (V)) : IF x = tp THEN sp ELSE x ENDIF)
                  ELSE fail ENDIF           
             ELSE fail ENDIF 
          ENDIF


decl_type: function
theory: robinsonunification
library: TRS
location: 204 1 213 38
signature:
  [[term[variable, symbol, arity], term[variable, symbol, arity]] ->
          Sub[variable, symbol, arity]]

body:
   robinson_unification_algorithm(s, t : term) : RECURSIVE Sub =
      IF s = t THEN identity  
      ELSE LET sig = link_of_frst_diff(s,t) IN
         IF sig = fail THEN fail
         ELSE 
         LET sigma = robinson_unification_algorithm(ext(sig)(s) , ext(sig)(t)) IN
                IF sigma = fail THEN fail ELSE comp(sigma, sig) ENDIF
         ENDIF
      ENDIF
   MEASURE Card(union(Vars(s), Vars(t)))


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 265 0 270 999
body:
  % Assuming TCC generated (at line 30, column 13) for
      % unification[variable, symbol, arity]
      % generated from assumption unification.var_countable
  IMP_unification_TCC1: OBLIGATION
    is_countably_infinite[term[variable, symbol, arity]]
        (V[variable, symbol, arity]);


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 272 0 273 999
body:
  % Existence TCC generated (at line 39, column 17) for  xx: (V)
  xx_TCC1: OBLIGATION EXISTS (x: (V[variable, symbol, arity])): TRUE;


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 275 0 277 999
body:
  % Existence TCC generated (at line 40, column 17) for
      % ff: {f: symbol | arity(f) = 1}
  ff_TCC1: OBLIGATION EXISTS (x: {f: symbol | arity(f) = 1}): TRUE;


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 279 0 284 999
body:
  % Subtype TCC generated (at line 41, column 50) for   #(xx)
      % expected type  {args:
                     %    finite_sequence[term[variable, symbol, arity]] |
                     %          args`length = arity(ff)}
  fail_TCC1: OBLIGATION
     #[term[variable, symbol, arity]](xx)`length = arity(ff);


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 286 0 294 999
body:
  % Subtype TCC generated (at line 41, column 27) for
      % id WITH [xx := app(ff,  #(xx))]
      % expected type  Sub[variable, symbol, arity]
  fail_TCC2: OBLIGATION
    Sub?[variable, symbol, arity]
        ((id[(V)]
            WITH [xx
                    := app[variable, symbol, arity]
                           (ff,  #[term[variable, symbol, arity]](xx))]));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 296 0 315 999
body:
  % Subtype TCC generated (at line 67, column 46) for   #(k + 1)
      % expected type  positions?[variable, symbol, arity](s)
  first_diff_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t), f: symbol,
            st:
              {args: finite_sequence[term[variable, symbol, arity]] |
                       args`length = arity(f)}):
      NOT length(st) = 0 AND s = app(f, st) IMPLIES
       (FORALL (fp: symbol,
                stp:
                  {args: finite_sequence[term[variable, symbol, arity]] |
                           args`length = arity(fp)}):
          f = fp AND t = app(fp, stp) IMPLIES
           (FORALL (k: below[length(stp)]):
              k =
               min({kk: below[length(stp)] |
                      subtermOF(s,  #(kk + 1)) /= subtermOF(t,  #(kk + 1))})
               IMPLIES
               positionsOF[variable, symbol, arity](s)( #[posnat](k + 1))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 317 0 336 999
body:
  % Subtype TCC generated (at line 67, column 66) for   #(k + 1)
      % expected type  positions?[variable, symbol, arity](t)
  first_diff_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t), f: symbol,
            st:
              {args: finite_sequence[term[variable, symbol, arity]] |
                       args`length = arity(f)}):
      NOT length(st) = 0 AND s = app(f, st) IMPLIES
       (FORALL (fp: symbol,
                stp:
                  {args: finite_sequence[term[variable, symbol, arity]] |
                           args`length = arity(fp)}):
          f = fp AND t = app(fp, stp) IMPLIES
           (FORALL (k: below[length(stp)]):
              k =
               min({kk: below[length(stp)] |
                      subtermOF(s,  #(kk + 1)) /= subtermOF(t,  #(kk + 1))})
               IMPLIES
               positionsOF[variable, symbol, arity](t)( #[posnat](k + 1))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 338 0 359 999
body:
  % Subtype TCC generated (at line 67, column 54) for  subtermOF(t,  #(k + 1))
      % expected type  {t: term | NOT subtermOF(s,  #(1 + k)) = t}
  first_diff_TCC3: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t), f: symbol,
            st:
              {args: finite_sequence[term[variable, symbol, arity]] |
                       args`length = arity(f)}):
      NOT length(st) = 0 AND s = app(f, st) IMPLIES
       (FORALL (fp: symbol,
                stp:
                  {args: finite_sequence[term[variable, symbol, arity]] |
                           args`length = arity(fp)}):
          f = fp AND t = app(fp, stp) IMPLIES
           (FORALL (k: below[length(stp)]):
              k =
               min({kk: below[length(stp)] |
                      subtermOF(s,  #(kk + 1)) /= subtermOF(t,  #(kk + 1))})
               IMPLIES
               NOT subtermOF[variable, symbol, arity](s,  #[posnat](1 + k)) =
                    subtermOF[variable, symbol, arity]
                        (t,  #[posnat](k + 1))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 361 0 382 999
body:
  % Termination TCC generated (at line 67, column 23) for
      % first_diff(subtermOF(s,  #(k + 1)), subtermOF(t,  #(k + 1)))
  first_diff_TCC4: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t), f: symbol,
            st:
              {args: finite_sequence[term[variable, symbol, arity]] |
                       args`length = arity(f)}):
      NOT length(st) = 0 AND s = app(f, st) IMPLIES
       (FORALL (fp: symbol,
                stp:
                  {args: finite_sequence[term[variable, symbol, arity]] |
                           args`length = arity(fp)}):
          f = fp AND t = app(fp, stp) IMPLIES
           (FORALL (k: below[length(stp)]):
              k =
               min({kk: below[length(stp)] |
                      subtermOF(s,  #(kk + 1)) /= subtermOF(t,  #(kk + 1))})
               IMPLIES
               <<[variable, symbol, arity]
                   (subtermOF[variable, symbol, arity](s,  #[posnat](k + 1)),
                    s)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 384 0 403 999
body:
  % Subtype TCC generated (at line 65, column 38) for   #(kk + 1)
      % expected type  positions?[variable, symbol, arity](s)
  first_diff_TCC5: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t), f: symbol,
            st:
              {args: finite_sequence[term[variable, symbol, arity]] |
                       args`length = arity(f)}):
      NOT length(st) = 0 AND s = app(f, st) IMPLIES
       (FORALL (fp: symbol,
                stp:
                  {args: finite_sequence[term[variable, symbol, arity]] |
                           args`length = arity(fp)}):
          f = fp AND t = app(fp, stp) IMPLIES
           (FORALL (kk: below[length(stp)], k: below[length(stp)]):
              k =
               min({kk: below[length(stp)] |
                      subtermOF(s,  #(kk + 1)) /= subtermOF(t,  #(kk + 1))})
               IMPLIES
               positionsOF[variable, symbol, arity](s)( #[posnat](kk + 1))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 405 0 424 999
body:
  % Subtype TCC generated (at line 65, column 62) for   #(kk + 1)
      % expected type  positions?[variable, symbol, arity](t)
  first_diff_TCC6: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t), f: symbol,
            st:
              {args: finite_sequence[term[variable, symbol, arity]] |
                       args`length = arity(f)}):
      NOT length(st) = 0 AND s = app(f, st) IMPLIES
       (FORALL (fp: symbol,
                stp:
                  {args: finite_sequence[term[variable, symbol, arity]] |
                           args`length = arity(fp)}):
          f = fp AND t = app(fp, stp) IMPLIES
           (FORALL (kk: below[length(stp)], k: below[length(stp)]):
              k =
               min({kk: below[length(stp)] |
                      subtermOF(s,  #(kk + 1)) /= subtermOF(t,  #(kk + 1))})
               IMPLIES
               positionsOF[variable, symbol, arity](t)( #[posnat](kk + 1))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 426 0 447 999
body:
  % Subtype TCC generated (at line 64, column 20) for
      % {kk: below[length(stp)] |
      %    subtermOF(s,  #(kk + 1)) /= subtermOF(t,  #(kk + 1))}
      % expected type  S: (nonempty?[below[length(stp)]])
  first_diff_TCC7: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t), f: symbol,
            st:
              {args: finite_sequence[term[variable, symbol, arity]] |
                       args`length = arity(f)}):
      NOT length(st) = 0 AND s = app(f, st) IMPLIES
       (FORALL (fp: symbol,
                stp:
                  {args: finite_sequence[term[variable, symbol, arity]] |
                           args`length = arity(fp)}):
          f = fp AND t = app(fp, stp) IMPLIES
           nonempty?[below[length(stp)]]
               ({kk: below[length(stp)] |
                   subtermOF[variable, symbol, arity](s,  #[posnat](kk + 1))
                    /=
                    subtermOF[variable, symbol, arity]
                        (t,  #[posnat](kk + 1))}));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 449 0 455 999
body:
  % Subtype TCC generated (at line 79, column 51) for  s
      % expected type  {t_1: term | t /= t_1}
  comutative_first_diff_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            p: position[variable, symbol, arity]):
      p = first_diff(s, t) IMPLIES t /= s;


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 457 0 463 999
body:
  % Subtype TCC generated (at line 91, column 47) for  p
      % expected type  positions?[variable, symbol, arity](s)
  first_diff_has_diff_argument_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            p: position[variable, symbol, arity]):
      p = first_diff(s, t) IMPLIES positionsOF[variable, symbol, arity](s)(p);


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 465 0 471 999
body:
  % Subtype TCC generated (at line 91, column 66) for  p
      % expected type  positions?[variable, symbol, arity](t)
  first_diff_has_diff_argument_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            p: position[variable, symbol, arity]):
      p = first_diff(s, t) IMPLIES positionsOF[variable, symbol, arity](t)(p);


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 473 0 485 999
body:
  % Subtype TCC generated (at line 105, column 22) for  subtermOF(s, p)
      % expected type  (app?[variable, symbol, arity])
  fd_equal_symbol_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            fd: position[variable, symbol, arity]):
      fd = first_diff(s, t) IMPLIES
       (FORALL (p: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(p) AND
                       positionsOF[variable, symbol, arity](t)(p)):
          child(fd, p) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](s, p)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 487 0 499 999
body:
  % Subtype TCC generated (at line 105, column 44) for  subtermOF(t, p)
      % expected type  (app?[variable, symbol, arity])
  fd_equal_symbol_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            fd: position[variable, symbol, arity]):
      fd = first_diff(s, t) IMPLIES
       (FORALL (p: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(p) AND
                       positionsOF[variable, symbol, arity](t)(p)):
          child(fd, p) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](t, p)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 501 0 512 999
body:
  % Subtype TCC generated (at line 114, column 27) for  sp
      % expected type  (V)
  link_of_frst_diff_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t),
            k: position[variable, symbol, arity]):
      k = first_diff(s, t) IMPLIES
       (FORALL (sp: term[variable, symbol, arity]):
          sp = subtermOF(s, k) IMPLIES
           (FORALL (tp: term[variable, symbol, arity]):
              vars?(sp) AND tp = subtermOF(t, k) IMPLIES
               V[variable, symbol, arity](sp)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 514 0 529 999
body:
  % Subtype TCC generated (at line 115, column 19) for
      % (LAMBDA (x: (V)): IF x = sp THEN tp ELSE x ENDIF)
      % expected type  Sub[variable, symbol, arity]
  link_of_frst_diff_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t),
            k: position[variable, symbol, arity]):
      k = first_diff(s, t) IMPLIES
       (FORALL (sp: term[variable, symbol, arity]):
          sp = subtermOF(s, k) IMPLIES
           (FORALL (tp: term[variable, symbol, arity]):
              NOT member(sp, Vars(tp)) AND vars?(sp) AND tp = subtermOF(t, k)
               IMPLIES
               Sub?[variable, symbol, arity]
                   (LAMBDA (x: (V[variable, symbol, arity])):
                      IF x = sp THEN tp ELSE x ENDIF)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 531 0 542 999
body:
  % Subtype TCC generated (at line 119, column 30) for  tp
      % expected type  (V)
  link_of_frst_diff_TCC3: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t),
            k: position[variable, symbol, arity]):
      k = first_diff(s, t) IMPLIES
       (FORALL (sp: term[variable, symbol, arity]):
          sp = subtermOF(s, k) IMPLIES
           (FORALL (tp: term[variable, symbol, arity]):
              vars?(tp) AND NOT vars?(sp) AND tp = subtermOF(t, k) IMPLIES
               V[variable, symbol, arity](tp)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 544 0 560 999
body:
  % Subtype TCC generated (at line 120, column 22) for
      % (LAMBDA (x: (V)): IF x = tp THEN sp ELSE x ENDIF)
      % expected type  Sub[variable, symbol, arity]
  link_of_frst_diff_TCC4: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            (t: term[variable, symbol, arity] | s /= t),
            k: position[variable, symbol, arity]):
      k = first_diff(s, t) IMPLIES
       (FORALL (sp: term[variable, symbol, arity]):
          sp = subtermOF(s, k) IMPLIES
           (FORALL (tp: term[variable, symbol, arity]):
              NOT member(tp, Vars(sp)) AND
               vars?(tp) AND NOT vars?(sp) AND tp = subtermOF(t, k)
               IMPLIES
               Sub?[variable, symbol, arity]
                   (LAMBDA (x: (V[variable, symbol, arity])):
                      IF x = tp THEN sp ELSE x ENDIF)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 562 0 575 999
body:
  % Subtype TCC generated (at line 179, column 18) for
      % union(Vars(ext(sig)(s)), Vars(ext(sig)(t)))
      % expected type  finite_set[(V)]
  termination_lemma_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            sig: Sub[variable, symbol, arity]):
      NOT sig = fail AND sig = link_of_frst_diff(s, t) IMPLIES
       is_finite[(V)]
           (union[(V)]
                (Vars[variable, symbol, arity]
                     (ext[variable, symbol, arity](sig)(s)),
                 Vars[variable, symbol, arity]
                     (ext[variable, symbol, arity](sig)(t))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 577 0 588 999
body:
  % Subtype TCC generated (at line 180, column 20) for
      % union(Vars(s), Vars(t))
      % expected type  finite_set[(V)]
  termination_lemma_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            sig: Sub[variable, symbol, arity]):
      NOT sig = fail AND sig = link_of_frst_diff(s, t) IMPLIES
       is_finite[(V)]
           (union[(V)]
                (Vars[variable, symbol, arity](s),
                 Vars[variable, symbol, arity](t)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 590 0 598 999
body:
  % Subtype TCC generated (at line 213, column 14) for
      % union(Vars(s), Vars(t))
      % expected type  finite_set[(V)]
  robinson_unification_algorithm_TCC1: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity]):
      is_finite[(V)]
          (union[(V)]
               (Vars[variable, symbol, arity](s),
                Vars[variable, symbol, arity](t)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 600 0 610 999
body:
  % Subtype TCC generated (at line 213, column 14) for
      % union(Vars(z`1), Vars(z`2))
      % expected type  finite_set[(V)]
  robinson_unification_algorithm_TCC2: OBLIGATION
    FORALL (z:
              [term[variable, symbol, arity],
               term[variable, symbol, arity]]):
      is_finite[(V)]
          (union[(V)]
               (Vars[variable, symbol, arity](z`1),
                Vars[variable, symbol, arity](z`2)));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 612 0 616 999
body:
  % Subtype TCC generated (at line 205, column 18) for  identity
      % expected type  Sub[variable, symbol, arity]
  robinson_unification_algorithm_TCC3: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity]):
      s = t IMPLIES Sub?[variable, symbol, arity](identity[(V)]);


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 618 0 635 999
body:
  % Termination TCC generated (at line 209, column 19) for
      % robinson_unification_algorithm(ext(sig)(s), ext(sig)(t))
  robinson_unification_algorithm_TCC4: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity]):
      NOT s = t IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND sig = link_of_frst_diff(s, t) IMPLIES
           Card[(V)]
               (union[(V)]
                    (Vars[variable, symbol, arity]
                         (ext[variable, symbol, arity](sig)(s)),
                     Vars[variable, symbol, arity]
                         (ext[variable, symbol, arity](sig)(t))))
            <
            Card[(V)]
                (union[(V)]
                     (Vars[variable, symbol, arity](s),
                      Vars[variable, symbol, arity](t))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 637 0 655 999
body:
  % Subtype TCC generated (at line 210, column 45) for  comp(sigma, sig)
      % expected type  Sub[variable, symbol, arity]
  robinson_unification_algorithm_TCC5: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            v:
              [{z:
                  [term[variable, symbol, arity],
                   term[variable, symbol, arity]] |
                        Card(union(Vars(z`1), Vars(z`2))) <
                         Card(union(Vars(s), Vars(t)))} ->
                 Sub[variable, symbol, arity]]):
      NOT s = t IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND sig = link_of_frst_diff(s, t) IMPLIES
           (FORALL (sigma: Sub[variable, symbol, arity]):
              NOT sigma = fail AND sigma = v(ext(sig)(s), ext(sig)(t))
               IMPLIES
               Sub?[variable, symbol, arity]
                   (comp[variable, symbol, arity](sigma, sig))));


decl_type: tcc
theory: robinsonunification
library: TRS
signature: nil
location: 657 0 660 999
body:
  % Subtype TCC generated (at line 206, column 39) for  t
      % expected type  {t: term | s /= t}
  robinson_unification_algorithm_TCC6: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity]): NOT s = t IMPLIES s /= t;


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 101 1 103 44
body:
   right_pos_subset : LEMMA
   FORALL (s : term, p : position | positionsOF(s)(p)):
      subset?(right_pos(s, p), positionsOF(s))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 105 1 108 53
body:
   next_position_commute : LEMMA
    FORALL (s, t : term, p : position |
      positionsOF(s)(p) AND positionsOF(t)(p)):
        next_position(s, t, p) = next_position(t, s, p)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 110 1 113 44
body:
   next_position_is_position : LEMMA
    FORALL (s, t : term, p : position |
      positionsOF(s)(p) AND positionsOF(t)(p)):
        positionsOF(s)(next_position(s, t, p))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 115 1 120 46
body:
   next_pos_length_and_last : LEMMA
    FORALL (s, t : term, p : position |
      positionsOF(s)(p) AND positionsOF(t)(p) AND p /= empty_seq):
        length(next_position(s, t, p)) < length(p) OR
        (length(next_position(s, t, p)) = length(p) AND
         last(p) < last(next_position(s, t, p)))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 122 1 126 33
body:
   next_pos_is_a_diff_pos : LEMMA
    FORALL (s, t : term, p : position |
      positionsOF(s)(p) AND positionsOF(t)(p)):
        (NOT p = empty_seq) IMPLIES
        next_position(s, t, p) /= p


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 128 1 131 63
body:
   member_right_pos : LEMMA
     FORALL (s : term, p : position | positionsOF(s)(p), 
             q : position | positionsOF(s)(q)):
       (member(q, right_pos(s, p)) AND p /= q) IFF left_pos(p, q)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 133 1 136 53
body:
   next_pos_member_right_pos : LEMMA
    FORALL (s, t : term, p : position |
      positionsOF(s)(p) AND positionsOF(t)(p) AND p /= empty_seq):
        member(next_position(s, t, p), right_pos(s, p))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 138 1 141 53
body:
   equal_right_pos : LEMMA
     FORALL (s : term, p : position | positionsOF(s)(p), 
             q : position | positionsOF(s)(q)):
        right_pos(s, p) = right_pos(s, q) IMPLIES p = q


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 144 1 148 62
body:
   subset_right_pos : LEMMA
    FORALL (s : term, p : position | positionsOF(s)(p), 
            q : position | positionsOF(s)(q)):
      member(q, right_pos(s, p)) AND q /= p
        IMPLIES strict_subset?(right_pos(s, q), right_pos(s, p))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 150 1 154 29
body:
   next_pos_to_the_right : LEMMA
      FORALL(s:term, t:term, p: position |
             positionsOF(s)(p) AND positionsOF(t)(p) AND p /= empty_seq ):
        Card(right_pos(s, next_position(s, t, p)))
        < Card(right_pos(s, p))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 156 1 162 46
body:
   ext_link_remove_x : LEMMA
      FORALL(s : term, t : term, p : position | positionsOF(s)(p) AND 
             positionsOF(t)(p) AND subtermOF(s,p) /= subtermOF(t,p)):
          LET sig = link_of_frst_diff(subtermOF(s,p), subtermOF(t,p)) IN
           (NOT sig = fail AND  Dom(sig)(x)) IMPLIES  
              (NOT member(x, Vars(ext(sig)(s)))) AND
              (NOT member(x, Vars(ext(sig)(t))))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 164 1 169 63
body:
   vars_ext_link_s_subset : LEMMA
      FORALL(s : term, t : term, p : position | positionsOF(s)(p) AND 
             positionsOF(t)(p) AND subtermOF(s,p) /= subtermOF(t,p)):
          LET sig = link_of_frst_diff(subtermOF(s,p), subtermOF(t,p)) IN
             NOT sig = fail IMPLIES 
             subset?(Vars(ext(sig)(s)), union( Vars(s), Vars(t)))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 171 1 176 63
body:
   vars_ext_link_t_subset : LEMMA
      FORALL(s : term, t : term, p : position | positionsOF(s)(p) AND 
             positionsOF(t)(p) AND subtermOF(s,p) /= subtermOF(t,p)):
          LET sig = link_of_frst_diff(subtermOF(s,p), subtermOF(t,p)) IN
             NOT sig = fail IMPLIES 
             subset?(Vars(ext(sig)(t)), union( Vars(s), Vars(t)))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 178 1 185 62
body:
   union_vars_ext_link_subterm : LEMMA
    FORALL (s : term, t : term, p : position | 
      positionsOF(s)(p) AND  positionsOF(t)(p) 
      AND subtermOF(s,p) /= subtermOF(t,p)):
        LET sig = link_of_frst_diff(subtermOF(s,p), subtermOF(t,p)) IN
             NOT sig = fail IMPLIES
               union(Vars(ext(sig)(s)), Vars(ext(sig)(t)))
                = difference(union( Vars(s), Vars(t)), Dom(sig))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 187 1 194 45
body:
   termination_lemma_subterm : LEMMA
    FORALL (s : term, t : term, p : position | 
      positionsOF(s)(p) AND  positionsOF(t)(p) 
      AND subtermOF(s,p) /= subtermOF(t,p)):
        LET sig = link_of_frst_diff(subtermOF(s,p), subtermOF(t,p)) IN
             NOT sig = fail IMPLIES
               Card(union( Vars(ext(sig)(s)), Vars(ext(sig)(t))))
               < Card(union( Vars(s), Vars(t)))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 199 1 205 42
body:
   subtermOF_next_position : LEMMA
     FORALL (s : term, 
             t : term | s /= t, 
             p : position | positionsOF(s)(p) AND  
                            positionsOF(t)(p)) :
        LET q = next_position(s, t, p) IN
          subtermOF(s, q) /= subtermOF(t, q)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 207 1 214 31
body:
   np_o_fd_is_position : LEMMA
     FORALL (s : term,
             t : term | s /= t,
             p : position | positionsOF(s)(p) AND
                            positionsOF(t)(p)) :
       LET q = next_position(s, t, p) IN
        LET q1 = first_diff(subtermOF(s,q), subtermOF(t,q)) IN
           positionsOF(t)(q o q1)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 217 1 225 29
body:
   child_np_child_p : LEMMA
     FORALL (s : term, 
             t : term, 
             p : position | positionsOF(s)(p) AND  
                            positionsOF(t)(p)) :
       (FORALL (q: position | positionsOF(s)(q) AND
                              positionsOF(t)(q)):
          child(next_position(s, t, p), q)
           IMPLIES child(p, q))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 227 1 241 49
body:
   next_pos_empty_equal_subterm : LEMMA
     FORALL (s : term, 
             t : term, 
             p : position | positionsOF(s)(p) AND  
                            positionsOF(t)(p) AND 
                            p /= empty_seq ) :
        ( next_position(s, t, p) = empty_seq AND
          FORALL (p1 : position | positionsOF(s)(p1) AND
                                  positionsOF(t)(p1) ):
           child(p, p1) => f(subtermOF(s, p1)) = f(subtermOF(t, p1)) )
        IMPLIES
        ( FORALL (q : position | positionsOF(s)(q) AND  
                                 positionsOF(t)(q)):
            left_without_children(p, q) => 
                subtermOF(s, q) = subtermOF(t, q) )


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 243 1 266 50
body:
   next_pos_equal_subterm : LEMMA
     FORALL (s : term, 
             t : term, 
             p : position | positionsOF(s)(p) AND  
                            positionsOF(t)(p) AND
                            p /= empty_seq ) :
        ( (FORALL (p1 : position | positionsOF(s)(p1) AND
                                   positionsOF(t)(p1) ):
             child(p, p1) => 
                 f(subtermOF(s, p1)) = f(subtermOF(t, p1)))
         AND 
          (FORALL (q: position | positionsOF(s)(q) AND
                                 positionsOF(t)(q)):
             left_without_children(q, p) =>
                 subtermOF(s, q) = subtermOF(t, q))
         AND
           subtermOF(s, p) = subtermOF(t, p)       
         AND
           next_position(s, t, p) /= empty_seq  )
        IMPLIES
        (  FORALL (q : position | positionsOF(s)(q) AND  
                                  positionsOF(t)(q)):
             left_without_children(q, next_position(s, t, p)) => 
                 subtermOF(s, q) = subtermOF(t, q) )


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 268 1 275 52
body:
   fd_equal_subterm : LEMMA
    FORALL (s : term, 
            t : term | s /= t,
            p : position | positionsOF(s)(p) AND
                           positionsOF(t)(p) ):
        LET fd = first_diff(s, t) IN
            left_without_children(p, fd) 
               IMPLIES subtermOF(s,p) = subtermOF(t,p)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 277 1 291 88
body:
   child_p_o_fd : LEMMA
    FORALL (s : term, 
            t : term, 
            p : position | positionsOF(s)(p) AND
                           positionsOF(t)(p) AND
                           subtermOF(s,p) /= subtermOF(t,p)):
        LET fd = first_diff(subtermOF(s,p), subtermOF(t,p)) IN
             (FORALL (q : position | positionsOF(s)(q) AND
                                     positionsOF(t)(q) ):
                      child(p, q) => 
                      f(subtermOF(s, q)) = f(subtermOF(t, q)))
            IMPLIES (FORALL (q : position | positionsOF(ext(sig)(s))(q) AND
                                            positionsOF(ext(sig)(t))(q) ):
                              child(p o fd, q) => 
                              f(subtermOF(ext(sig)(s), q)) = f(subtermOF(ext(sig)(t), q)))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 294 1 296 67
body:
   separation_lwc_pos : LEMMA
      left_without_children(q, p o p1) AND NOT left_without_children(q, p)
      IMPLIES EXISTS q1: q = p o q1 AND left_without_children(q1, p1)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 298 1 305 29
body:
   lwc_o_fd_empty_seq : LEMMA
    FORALL (s : term, 
            t : term | s /= t):
        LET fd = first_diff(s, t) IN
         ( left_without_children(p, fd) AND positionsOF(s)(p)
           AND p = p1 o p2 AND positionsOF(t)(p1)
           AND vars?(subtermOF(t, p1)) )
         IMPLIES p2 = empty_seq


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 307 1 321 82
body:
   lwc_p_o_fd : LEMMA
    FORALL (s : term, 
            t : term, 
            p : position | positionsOF(s)(p) AND
                           positionsOF(t)(p) AND
                           subtermOF(s,p) /= subtermOF(t,p)):
        LET fd = first_diff(subtermOF(s,p), subtermOF(t,p)) IN
             (FORALL (q : position | positionsOF(s)(q) AND
                                     positionsOF(t)(q) ):
                      left_without_children(q, p) => 
                      subtermOF(s, q) = subtermOF(t, q))
            IMPLIES (FORALL (q : position | positionsOF(ext(sig)(s))(q) AND
                                            positionsOF(ext(sig)(t))(q) ):
                              left_without_children(q, p o fd) => 
                              subtermOF(ext(sig)(s), q) = subtermOF(ext(sig)(t), q))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 323 1 345 37
body:
   np_p_o_fd_empty_unifiable_term : LEMMA
    FORALL (s : term, 
            t : term, 
            p : position | positionsOF(s)(p) AND
                           positionsOF(t)(p) AND
                           subtermOF(s,p) /= subtermOF(t,p)):
        LET fd = first_diff(subtermOF(s,p), subtermOF(t,p)) IN
          LET sig = link_of_frst_diff(subtermOF(s,p), subtermOF(t,p)) IN
            (  NOT sig = fail
             AND
               next_position(ext(sig)(s), ext(sig)(t), p o fd) = empty_seq
             AND
               (FORALL (q: position | positionsOF(s)(q) AND 
                                      positionsOF(t)(q)):
                   left_without_children(q, p) =>
                        subtermOF(s, q) = subtermOF(t, q))
             AND
               (FORALL (p1: position | positionsOF(s)(p1) AND
                                       positionsOF(t)(p1)):
                   child(p, p1) => 
                        f(subtermOF(s, p1)) = f(subtermOF(t, p1)))  )
            IMPLIES
              ext(sig)(s) = ext(sig)(t)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 347 1 373 73
body:
   np_p_o_fd_equal_subterm : LEMMA
    FORALL (s : term, 
            t : term, 
            p : position | positionsOF(s)(p) AND
                           positionsOF(t)(p) AND 
                           subtermOF(s,p) /= subtermOF(t,p)):
        LET fd = first_diff(subtermOF(s,p), subtermOF(t,p)) IN
          LET sig = link_of_frst_diff(subtermOF(s,p), subtermOF(t,p)) IN
            (  NOT sig = fail
             AND
               next_position(ext(sig)(s), ext(sig)(t), p o fd) /= empty_seq
             AND
               (FORALL (q: position | positionsOF(s)(q) AND 
                                      positionsOF(t)(q)):
                   left_without_children(q, p) =>
                        subtermOF(s, q) = subtermOF(t, q))
             AND
               (FORALL (p1: position | positionsOF(s)(p1) AND
                                       positionsOF(t)(p1)):
                   child(p, p1) => 
                        f(subtermOF(s, p1)) = f(subtermOF(t, p1)))  )
            IMPLIES
               (FORALL (q: position | positionsOF(ext(sig)(s))(q) AND
                                      positionsOF(ext(sig)(t))(q)):
                   left_without_children(q, 
                           next_position(ext(sig)(s), ext(sig)(t), p o fd)) =>
                     subtermOF(ext(sig)(s), q) = subtermOF(ext(sig)(t), q))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 410 0 417 26
body:
  unifiable_implies_not_fail1 : LEMMA
     FORALL (s : term, t : term,
              p: position | positionsOF(s)(p) AND 
                            positionsOF(t)(p) AND 
                            subtermOF(s, p) /= subtermOF(t, p)):
        LET sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p)) IN
              unifiable(s, t) IMPLIES
              NOT sig = fail


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 419 0 426 51
body:
  preserving_generality1 : LEMMA
     FORALL (s : term, t : term,
              p: position | positionsOF(s)(p) AND 
                            positionsOF(t)(p) AND 
                            subtermOF(s, p) /= subtermOF(t, p)):
         member(rho, U(s, t)) IMPLIES
             LET sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p)) IN
                EXISTS theta : rho = comp(theta, sig)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 429 1 435 71
body:
   unifiable_preserves_unifiability1 : LEMMA
      FORALL (s : term, t : term,
              p: position | positionsOF(s)(p) AND 
                            positionsOF(t)(p) AND 
                            subtermOF(s, p) /= subtermOF(t, p)):
        LET sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p)) IN
            unifiable(s, t) IMPLIES unifiable(ext(sig)(s), (ext(sig)(t)))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 438 1 443 56
body:
   dom_ruaEF_subset_union_vars_aux : LEMMA
      FORALL (s : term, t : term,
              p: position | positionsOF(s)(p) AND positionsOF(t)(p)) :
      unifiable(s, t) IMPLIES 
         LET sigma = robinson_unification_algorithm_aux(s, t, p) IN
            subset?( Dom(sigma), union(Vars(s), Vars(t)) )


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 446 1 449 56
body:
   dom_ruaEF_subset_union_vars : LEMMA
      unifiable(s, t) IMPLIES 
         LET sigma = robinson_unification_algorithm_EF(s, t) IN
            subset?( Dom(sigma), union(Vars(s), Vars(t)) )


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 452 1 463 71
body:
   vran_ruaEF_subset_union_aux : LEMMA
      FORALL (s : term, t : term,
              p: position | positionsOF(s)(p) AND 
                            positionsOF(t)(p) AND 
                            subtermOF(s, p) /= subtermOF(t, p)) :
    LET pi = first_diff(subtermOF(s, p), subtermOF(t, p)) IN
     LET sig1 = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p)) IN
      LET np = next_position(ext(sig1)(s), ext(sig1)(t), p o pi) IN
       LET sig2 = robinson_unification_algorithm_aux(ext(sig1)(s), ext(sig1)(t), np) IN
          unifiable(s, t) IMPLIES
            subset?(VRan(comp(sig2, sig1)), 
                    union(VRan(sig2), difference(VRan(sig1), Dom(sig2))))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 466 1 472 71
body:
   dom_ran_ruaEF_disjoint : LEMMA
     FORALL (s : term, t : term,
              p: position | positionsOF(s)(p) AND positionsOF(t)(p)) :
      unifiable(s, t) IMPLIES 
         LET sigma = robinson_unification_algorithm_aux(s, t, p) IN
             subset?( VRan(sigma) , 
                       difference( union(Vars(s), Vars(t)), Dom(sigma) ))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 475 1 489 59
body:
   ruaEF_fails_iff_non_unifiable_aux : LEMMA
     FORALL (s : term,
             t : term,
             p : position | positionsOF(s)(p) AND 
                            positionsOF(t)(p) ):
        ( FORALL (q : position | positionsOF(s)(q) AND
                                 positionsOF(t)(q) ): 
           left_without_children(q, p) => subtermOF(s,q) = subtermOF(t, q) ) 
       AND
        ( FORALL (p1 : position | positionsOF(s)(p1) AND
                                  positionsOF(t)(p1) ):
             child(p, p1) => f(subtermOF(s, p1)) = f(subtermOF(t, p1)) )
       IMPLIES     
        ( NOT unifiable(s,t) IFF 
          robinson_unification_algorithm_aux(s, t, p) = fail)


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 492 1 506 72
body:
   ruaEF_gives_unifier_aux : LEMMA
     FORALL (s : term,
             t : term,
             p : position | positionsOF(s)(p) AND 
                            positionsOF(t)(p) ):
        ( FORALL (q : position | positionsOF(s)(q) AND
                                 positionsOF(t)(q) ): 
           left_without_children(q, p) => subtermOF(s,q) = subtermOF(t, q) ) 
       AND
        ( FORALL (p1 : position | positionsOF(s)(p1) AND
                                  positionsOF(t)(p1) ):
             child(p, p1) => f(subtermOF(s, p1)) = f(subtermOF(t, p1)) )
       IMPLIES     
        ( unifiable(s,t) IFF
            member(robinson_unification_algorithm_aux(s, t, p), U(s, t)) )


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 509 1 523 62
body:
   ruaEF_gives_mg_subs_aux : LEMMA
     FORALL (s : term,
             t : term,
             p : position | positionsOF(s)(p) AND 
                            positionsOF(t)(p) ):
        ( FORALL (q : position | positionsOF(s)(q) AND
                                 positionsOF(t)(q) ): 
           left_without_children(q, p) => subtermOF(s,q) = subtermOF(t, q) ) 
       AND
        ( FORALL (p1 : position | positionsOF(s)(p1) AND
                                  positionsOF(t)(p1) ):
             child(p, p1) => f(subtermOF(s, p1)) = f(subtermOF(t, p1)) )
       IMPLIES     
        ( member(rho, U(s, t)) IMPLIES
            robinson_unification_algorithm_aux(s, t, p) <= rho )


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 526 1 527 72
body:
   ruaEF_fails_iff_non_unifiable : LEMMA
      NOT unifiable(s,t) IFF robinson_unification_algorithm_EF(s,t) = fail


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 531 1 532 79
body:
   ruaEF_gives_unifier : LEMMA
      unifiable(s,t) IFF member(robinson_unification_algorithm_EF(s, t), U(s, t))


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 534 1 535 79
body:
   ruaEF_gives_mg_subs : LEMMA
      member(rho, U(s, t)) IMPLIES robinson_unification_algorithm_EF(s, t) <= rho


decl_type: formula
theory: robinsonunificationEF
library: TRS
signature: nil
location: 539 1 542 8
body:
   completeness_ruaEF : LEMMA
     IF unifiable(s,t) THEN  mgu(robinson_unification_algorithm_EF(s,t))(s,t)
                       ELSE  robinson_unification_algorithm_EF(s,t) = fail 
     ENDIF


decl_type: function
theory: robinsonunificationEF
library: TRS
location: 51 1 66 18
signature:
  [[term[variable, symbol, arity],
         position[variable, symbol, arity]] ->
          positions[variable, symbol, arity]]

body:
   right_pos(s:term, p : position) : RECURSIVE  positions =
    IF NOT positionsOF(s)(p) THEN emptyset
     ELSE
     IF p = empty_seq THEN only_empty_seq
     ELSE 
      LET p1 = delete(p,length(p) - 1) IN 
       LET i: nat = last(p) IN
         LET n: nat = arity(f(subtermOF(s,p1))) IN
           union( union(singleton(p), right_pos(s, p1)), 
                  IUnion(LAMBDA (j : below(n - i)) :
                         {q | EXISTS q1 : positionsOF(subtermOF(s,
                                           add_last(p1, i + j + 1)))(q1)
                                 AND  q = p1 o #( i + j + 1) o q1 }))
     ENDIF
    ENDIF
   MEASURE length(p)


decl_type: function
theory: robinsonunificationEF
library: TRS
location: 72 1 96 15
signature:
  [[s: term, t: term,
         {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}] ->
          position[variable, symbol, arity]]

body:
   next_position(s, t : term, 
                 p : position | positionsOF(s)(p) AND positionsOF(t)(p)): 
     RECURSIVE position = 
     IF p = empty_seq THEN empty_seq 
     ELSE
       LET pi0 = delete(p,length(p) - 1) IN
        IF f(subtermOF(s,pi0)) /= f(subtermOF(t,pi0)) THEN pi0 
        ELSE     
          LET pi = add_last(delete(p, length(p) - 1), last(p) + 1) IN
          IF positionsOF(s)(pi) THEN 
              IF subtermOF(s, pi) /= subtermOF(t, pi) THEN pi 
              ELSE next_position(s,t, pi) ENDIF
          ELSE IF pi0 /= empty_seq THEN
                      next_position(s, t, pi0)
               ELSE empty_seq 
              ENDIF 
          ENDIF
        ENDIF  
     ENDIF  
    MEASURE IF p = empty_seq 
            THEN lex2(0,0)
            ELSE lex2(length(p), 
                      arity(f(subtermOF(s, 
                                     delete(p,length(p) - 1)))) - last(p))
            ENDIF


decl_type: function
theory: robinsonunificationEF
library: TRS
location: 378 1 401 37
signature:
  [[s: term, t: term,
         {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}] ->
          Sub[variable, symbol, arity]]

body:
   robinson_unification_algorithm_aux(s, t : term, p : position | 
      positionsOF(s)(p) AND  positionsOF(t)(p)) : RECURSIVE Sub = 
   IF subtermOF(s,p) = subtermOF(t,p) THEN 
     LET pi = next_position(s, t, p) IN
        IF pi = empty_seq THEN identity
        ELSE robinson_unification_algorithm_aux(s,t,pi)
        ENDIF
   ELSE
       LET sig = link_of_frst_diff(subtermOF(s,p),subtermOF(t,p)) 
       IN
          IF sig = fail THEN fail
          ELSE 
            LET pi = next_position(ext(sig)(s), ext(sig)(t), 
                           p o first_diff(subtermOF(s,p),subtermOF(t,p)))
            IN
              IF pi = empty_seq THEN  sig
              ELSE LET sigma = robinson_unification_algorithm_aux(
                                          ext(sig)(s), ext(sig)(t), pi) IN
                     IF sigma = fail THEN fail ELSE comp(sigma, sig) ENDIF
              ENDIF  
          ENDIF
   ENDIF 
    MEASURE  lex2(Card(union(Vars(s), Vars(t))),
                  Card(right_pos(s,p)))


decl_type: function
theory: robinsonunificationEF
library: TRS
location: 404 1 405 55
signature:
  [[term[variable, symbol, arity], term[variable, symbol, arity]] ->
          Sub[variable, symbol, arity]]

body:
   robinson_unification_algorithm_EF(s, t : term) : Sub =
     robinson_unification_algorithm_aux(s, t , empty_seq)


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 550 0 555 999
body:
  % Assuming TCC generated (at line 32, column 13) for
      % robinsonunification[variable, symbol, arity]
      % generated from assumption robinsonunification.var_countable
  IMP_robinsonunification_TCC1: OBLIGATION
    is_countably_infinite[term[variable, symbol, arity]]
        (V[variable, symbol, arity]);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 557 0 561 999
body:
  % Assuming TCC generated (at line 32, column 13) for
      % robinsonunification[variable, symbol, arity]
      % generated from assumption robinsonunification.var_nonempty
  IMP_robinsonunification_TCC2: OBLIGATION
    nonempty?[term[variable, symbol, arity]](V[variable, symbol, arity]);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 563 0 567 999
body:
  % Assuming TCC generated (at line 32, column 13) for
      % robinsonunification[variable, symbol, arity]
      % generated from assumption robinsonunification.symbol_nonempty
  IMP_robinsonunification_TCC3: OBLIGATION
    nonempty?[symbol]({f: symbol | arity(f) = 1});


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 569 0 576 999
body:
  % Subtype TCC generated (at line 57, column 23) for  p
      % expected type  not_empty_seq[posnat]
  right_pos_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            p: position[variable, symbol, arity]):
      NOT p = empty_seq AND positionsOF(s)(p) IMPLIES
       (FORALL (p1: position[variable, symbol, arity]):
          p1 = delete(p, length(p) - 1) IMPLIES length(p) /= 0);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 578 0 588 999
body:
  % Subtype TCC generated (at line 58, column 40) for  p1
      % expected type  positions?[variable, symbol, arity](s)
  right_pos_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            p: position[variable, symbol, arity]):
      NOT p = empty_seq AND positionsOF(s)(p) IMPLIES
       (FORALL (p1: position[variable, symbol, arity]):
          p1 = delete(p, length(p) - 1) IMPLIES
           (FORALL (i: nat):
              i = last(p) IMPLIES
               positionsOF[variable, symbol, arity](s)(p1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 590 0 601 999
body:
  % Subtype TCC generated (at line 58, column 28) for  subtermOF(s, p1)
      % expected type  (app?)
  right_pos_TCC3: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            p: position[variable, symbol, arity]):
      NOT p = empty_seq AND positionsOF(s)(p) IMPLIES
       (FORALL (p1: position[variable, symbol, arity]):
          p1 = delete(p, length(p) - 1) IMPLIES
           (FORALL (i: nat):
              i = last(p) IMPLIES
               app?[variable, symbol, arity]
                   (subtermOF[variable, symbol, arity](s, p1))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 603 0 614 999
body:
  % Termination TCC generated (at line 59, column 36) for  right_pos(s, p1)
  right_pos_TCC4: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            p: position[variable, symbol, arity]):
      NOT p = empty_seq AND positionsOF(s)(p) IMPLIES
       (FORALL (p1: position[variable, symbol, arity]):
          p1 = delete(p, length(p) - 1) IMPLIES
           (FORALL (i: nat):
              i = last(p) IMPLIES
               (FORALL (n: nat):
                  n = arity(f(subtermOF(s, p1))) IMPLIES
                   length(p1) < length(p))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 616 0 630 999
body:
  % Subtype TCC generated (at line 62, column 41) for  add_last(p1, i + j + 1)
      % expected type  positions?[variable, symbol, arity](s)
  right_pos_TCC5: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            p: position[variable, symbol, arity]):
      NOT p = empty_seq AND positionsOF(s)(p) IMPLIES
       (FORALL (p1: position[variable, symbol, arity]):
          p1 = delete(p, length(p) - 1) IMPLIES
           (FORALL (i: nat):
              i = last(p) IMPLIES
               (FORALL (n: nat):
                  n = arity(f(subtermOF(s, p1))) IMPLIES
                   (FORALL (j: below(n - i)):
                      positionsOF[variable, symbol, arity]
                          (s)(add_last[posnat](p1, i + j + 1))))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 632 0 638 999
body:
  % Subtype TCC generated (at line 56, column 22) for  length(p) - 1
      % expected type  below[length(p)]
  right_pos_TCC6: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            p: position[variable, symbol, arity]):
      NOT p = empty_seq AND positionsOF(s)(p) IMPLIES
       length(p) - 1 >= 0 AND length(p) - 1 < length(p);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 640 0 648 999
body:
  % Subtype TCC generated (at line 95, column 44) for  length(p) - 1
      % expected type  below[length(p)]
  next_position_TCC1: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       length(p) - 1 >= 0 AND length(p) - 1 < length(p);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 650 0 660 999
body:
  % Subtype TCC generated (at line 95, column 35) for
      % delete(p, length(p) - 1)
      % expected type  positions?[variable, symbol, arity](s)
  next_position_TCC2: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       positionsOF[variable, symbol, arity]
           (s)(delete[posnat](p, length(p) - 1));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 662 0 673 999
body:
  % Subtype TCC generated (at line 94, column 28) for
      % subtermOF(s, delete(p, length(p) - 1))
      % expected type  (app?)
  next_position_TCC3: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       app?[variable, symbol, arity]
           (subtermOF[variable, symbol, arity]
                (s, delete[posnat](p, length(p) - 1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 675 0 682 999
body:
  % Subtype TCC generated (at line 95, column 69) for  p
      % expected type  not_empty_seq[posnat]
  next_position_TCC4: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES length(p) /= 0;


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 684 0 697 999
body:
  % Subtype TCC generated (at line 94, column 20) for
      % arity(f(subtermOF(s, delete(p, length(p) - 1)))) - last(p)
      % expected type  nat
  next_position_TCC5: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       arity(f[variable, symbol, arity]
                 (subtermOF[variable, symbol, arity]
                      (s, delete[posnat](p, length(p) - 1))))
        - last[posnat](p)
        >= 0;


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 699 0 706 999
body:
  % Subtype TCC generated (at line 95, column 44) for  length(z`3) - 1
      % expected type  below[length(z`3)]
  next_position_TCC6: OBLIGATION
    FORALL (z:
              [s: term, t: term,
               {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}]):
      NOT z`3 = empty_seq IMPLIES
       length(z`3) - 1 >= 0 AND length(z`3) - 1 < length(z`3);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 708 0 717 999
body:
  % Subtype TCC generated (at line 95, column 35) for
      % delete(z`3, length(z`3) - 1)
      % expected type  positions?[variable, symbol, arity](z`1)
  next_position_TCC7: OBLIGATION
    FORALL (z:
              [s: term, t: term,
               {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}]):
      NOT z`3 = empty_seq IMPLIES
       positionsOF[variable, symbol, arity]
           (z`1)(delete[posnat](z`3, length(z`3) - 1));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 719 0 729 999
body:
  % Subtype TCC generated (at line 94, column 28) for
      % subtermOF(z`1, delete(z`3, length(z`3) - 1))
      % expected type  (app?)
  next_position_TCC8: OBLIGATION
    FORALL (z:
              [s: term, t: term,
               {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}]):
      NOT z`3 = empty_seq IMPLIES
       app?[variable, symbol, arity]
           (subtermOF[variable, symbol, arity]
                (z`1, delete[posnat](z`3, length(z`3) - 1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 731 0 737 999
body:
  % Subtype TCC generated for  z`3
      % expected type  not_empty_seq[posnat]
  next_position_TCC9: OBLIGATION
    FORALL (z:
              [s: term, t: term,
               {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}]):
      NOT z`3 = empty_seq IMPLIES length(z`3) /= 0;


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 739 0 751 999
body:
  % Subtype TCC generated (at line 94, column 20) for
      % arity(f(subtermOF(z`1, delete(z`3, length(z`3) - 1)))) - last(z`3)
      % expected type  nat
  next_position_TCC10: OBLIGATION
    FORALL (z:
              [s: term, t: term,
               {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}]):
      NOT z`3 = empty_seq IMPLIES
       arity(f[variable, symbol, arity]
                 (subtermOF[variable, symbol, arity]
                      (z`1, delete[posnat](z`3, length(z`3) - 1))))
        - last[posnat](z`3)
        >= 0;


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 753 0 763 999
body:
  % Subtype TCC generated (at line 78, column 23) for  pi0
      % expected type  positions?[variable, symbol, arity](s)
  next_position_TCC11: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          pi0 = delete(p, length(p) - 1) IMPLIES
           positionsOF[variable, symbol, arity](s)(pi0));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 765 0 776 999
body:
  % Subtype TCC generated (at line 78, column 11) for  subtermOF(s, pi0)
      % expected type  (app?)
  next_position_TCC12: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          pi0 = delete(p, length(p) - 1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](s, pi0)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 778 0 788 999
body:
  % Subtype TCC generated (at line 78, column 46) for  pi0
      % expected type  positions?[variable, symbol, arity](t)
  next_position_TCC13: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          pi0 = delete(p, length(p) - 1) IMPLIES
           positionsOF[variable, symbol, arity](t)(pi0));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 790 0 801 999
body:
  % Subtype TCC generated (at line 78, column 34) for  subtermOF(t, pi0)
      % expected type  (app?)
  next_position_TCC14: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          pi0 = delete(p, length(p) - 1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](t, pi0)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 803 0 818 999
body:
  % Subtype TCC generated (at line 82, column 48) for  pi
      % expected type  positions?[variable, symbol, arity](t)
  next_position_TCC15: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          NOT f(subtermOF(s, pi0)) /= f(subtermOF(t, pi0)) AND
           pi0 = delete(p, length(p) - 1)
           IMPLIES
           (FORALL (pi: finseq[posnat]):
              positionsOF(s)(pi) AND
               pi = add_last(delete(p, length(p) - 1), last(p) + 1)
               IMPLIES positionsOF[variable, symbol, arity](t)(pi)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 820 0 838 999
body:
  % Subtype TCC generated (at line 83, column 36) for  pi
      % expected type  {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}
  next_position_TCC16: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          NOT f(subtermOF(s, pi0)) /= f(subtermOF(t, pi0)) AND
           pi0 = delete(p, length(p) - 1)
           IMPLIES
           (FORALL (pi: finseq[posnat]):
              NOT subtermOF(s, pi) /= subtermOF(t, pi) AND
               positionsOF(s)(pi) AND
                pi = add_last(delete(p, length(p) - 1), last(p) + 1)
               IMPLIES
               positionsOF[variable, symbol, arity](s)(pi) AND
                positionsOF[variable, symbol, arity](t)(pi)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 840 0 874 999
body:
  % Termination TCC generated (at line 83, column 17) for
      % next_position(s, t, pi)
  next_position_TCC17: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          NOT f(subtermOF(s, pi0)) /= f(subtermOF(t, pi0)) AND
           pi0 = delete(p, length(p) - 1)
           IMPLIES
           (FORALL (pi: finseq[posnat]):
              NOT subtermOF(s, pi) /= subtermOF(t, pi) AND
               positionsOF(s)(pi) AND
                pi = add_last(delete(p, length(p) - 1), last(p) + 1)
               IMPLIES
               IF pi = empty_seq[posnat] THEN lex2(0, 0)
               ELSE lex2(length(pi),
                         arity(f[variable, symbol, arity]
                                   (subtermOF[variable, symbol, arity]
                                        (s,
                                         delete[posnat]
                                         (pi, length(pi) - 1))))
                          - last[posnat](pi))
               ENDIF
                <
                IF p = empty_seq[posnat] THEN lex2(0, 0)
                ELSE lex2(length(p),
                          arity(f[variable, symbol, arity]
                                    (subtermOF[variable, symbol, arity]
                                         (s,
                                          delete[posnat](p, length(p) - 1))))
                           - last[posnat](p))
                ENDIF));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 876 0 894 999
body:
  % Subtype TCC generated (at line 85, column 40) for  pi0
      % expected type  {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}
  next_position_TCC18: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          NOT f(subtermOF(s, pi0)) /= f(subtermOF(t, pi0)) AND
           pi0 = delete(p, length(p) - 1)
           IMPLIES
           (FORALL (pi: finseq[posnat]):
              pi0 /= empty_seq AND
               NOT positionsOF(s)(pi) AND
                pi = add_last(delete(p, length(p) - 1), last(p) + 1)
               IMPLIES
               positionsOF[variable, symbol, arity](s)(pi0) AND
                positionsOF[variable, symbol, arity](t)(pi0)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 896 0 930 999
body:
  % Termination TCC generated (at line 85, column 20) for
      % next_position(s, t, pi0)
  next_position_TCC19: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT p = empty_seq IMPLIES
       (FORALL (pi0: finseq[posnat]):
          NOT f(subtermOF(s, pi0)) /= f(subtermOF(t, pi0)) AND
           pi0 = delete(p, length(p) - 1)
           IMPLIES
           (FORALL (pi: finseq[posnat]):
              pi0 /= empty_seq AND
               NOT positionsOF(s)(pi) AND
                pi = add_last(delete(p, length(p) - 1), last(p) + 1)
               IMPLIES
               IF pi0 = empty_seq[posnat] THEN lex2(0, 0)
               ELSE lex2(length(pi0),
                         arity(f[variable, symbol, arity]
                                   (subtermOF[variable, symbol, arity]
                                        (s,
                                         delete[posnat]
                                         (pi0, length(pi0) - 1))))
                          - last[posnat](pi0))
               ENDIF
                <
                IF p = empty_seq[posnat] THEN lex2(0, 0)
                ELSE lex2(length(p),
                          arity(f[variable, symbol, arity]
                                    (subtermOF[variable, symbol, arity]
                                         (s,
                                          delete[posnat](p, length(p) - 1))))
                           - last[posnat](p))
                ENDIF));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 932 0 942 999
body:
  % Subtype TCC generated (at line 120, column 12) for  p
      % expected type  not_empty_seq[posnat]
  next_pos_length_and_last_TCC1: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat]):
      length(next_position(s, t, p)) = length(p) AND
       NOT length(next_position(s, t, p)) < length(p)
       IMPLIES length(p) /= 0;


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 944 0 954 999
body:
  % Subtype TCC generated (at line 120, column 22) for  next_position(s, t, p)
      % expected type  not_empty_seq[posnat]
  next_pos_length_and_last_TCC2: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat]):
      length(next_position(s, t, p)) = length(p) AND
       NOT length(next_position(s, t, p)) < length(p)
       IMPLIES length(next_position(s, t, p)) /= 0;


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 956 0 967 999
body:
  % Subtype TCC generated (at line 153, column 11) for
      % right_pos(s, next_position(s, t, p))
      % expected type  finite_set[position[variable, symbol, arity]]
  next_pos_to_the_right_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat]):
      is_finite[position[variable, symbol, arity]]
          (right_pos(s, next_position(s, t, p)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 969 0 978 999
body:
  % Subtype TCC generated (at line 154, column 13) for  right_pos(s, p)
      % expected type  finite_set[position[variable, symbol, arity]]
  next_pos_to_the_right_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat]):
      is_finite[position[variable, symbol, arity]](right_pos(s, p));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 980 0 992 999
body:
  % Subtype TCC generated (at line 159, column 52) for  subtermOF(t, p)
      % expected type  {t_1: term[variable, symbol, arity] |
                     %          subtermOF(s, p) /= t_1}
  ext_link_remove_x_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p)):
      subtermOF[variable, symbol, arity](s, p) /=
       subtermOF[variable, symbol, arity](t, p);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 994 0 1014 999
body:
  % Subtype TCC generated (at line 193, column 18) for
      % union(Vars(ext(sig)(s)), Vars(ext(sig)(t)))
      % expected type  finite_set[(V)]
  termination_lemma_subterm_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            sig: Sub[variable, symbol, arity]):
      NOT sig = fail AND
       sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
       IMPLIES
       is_finite[(V)]
           (union[(V)]
                (Vars[variable, symbol, arity]
                     (ext[variable, symbol, arity](sig)(s)),
                 Vars[variable, symbol, arity]
                     (ext[variable, symbol, arity](sig)(t))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1016 0 1034 999
body:
  % Subtype TCC generated (at line 194, column 20) for
      % union(Vars(s), Vars(t))
      % expected type  finite_set[(V)]
  termination_lemma_subterm_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            sig: Sub[variable, symbol, arity]):
      NOT sig = fail AND
       sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
       IMPLIES
       is_finite[(V)]
           (union[(V)]
                (Vars[variable, symbol, arity](s),
                 Vars[variable, symbol, arity](t)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1036 0 1046 999
body:
  % Subtype TCC generated (at line 205, column 21) for  q
      % expected type  positions?[variable, symbol, arity](s)
  subtermOF_next_position_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p),
            q: position[variable, symbol, arity]):
      q = next_position(s, t, p) IMPLIES
       positionsOF[variable, symbol, arity](s)(q);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1048 0 1058 999
body:
  % Subtype TCC generated (at line 205, column 40) for  q
      % expected type  positions?[variable, symbol, arity](t)
  subtermOF_next_position_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p),
            q: position[variable, symbol, arity]):
      q = next_position(s, t, p) IMPLIES
       positionsOF[variable, symbol, arity](t)(q);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1060 0 1072 999
body:
  % Subtype TCC generated (at line 213, column 42) for  subtermOF(t, q)
      % expected type  {t: term[variable, symbol, arity] |
                     %          subtermOF(s, q) /= t}
  np_o_fd_is_position_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity] | s /= t,
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p),
            q: position[variable, symbol, arity]):
      q = next_position(s, t, p) IMPLIES
       subtermOF[variable, symbol, arity](s, q) /=
        subtermOF[variable, symbol, arity](t, q);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1074 0 1089 999
body:
  % Subtype TCC generated (at line 236, column 27) for  subtermOF(s, p1)
      % expected type  (app?)
  next_pos_empty_equal_subterm_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat]):
      next_position(s, t, p) = empty_seq IMPLIES
       (FORALL (p1: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(p1) AND
                       positionsOF[variable, symbol, arity](t)(p1)):
          child(p, p1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](s, p1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1091 0 1106 999
body:
  % Subtype TCC generated (at line 236, column 49) for  subtermOF(t, p1)
      % expected type  (app?)
  next_pos_empty_equal_subterm_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat]):
      next_position(s, t, p) = empty_seq IMPLIES
       (FORALL (p1: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(p1) AND
                       positionsOF[variable, symbol, arity](t)(p1)):
          child(p, p1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](t, p1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1108 0 1122 999
body:
  % Subtype TCC generated (at line 252, column 17) for  subtermOF(s, p1)
      % expected type  (app?)
  next_pos_equal_subterm_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat],
            p1: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p1) AND
                   positionsOF[variable, symbol, arity](t)(p1)):
      child(p, p1) IMPLIES
       app?[variable, symbol, arity]
           (subtermOF[variable, symbol, arity](s, p1));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1124 0 1138 999
body:
  % Subtype TCC generated (at line 252, column 39) for  subtermOF(t, p1)
      % expected type  (app?)
  next_pos_equal_subterm_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    p /= empty_seq[posnat],
            p1: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p1) AND
                   positionsOF[variable, symbol, arity](t)(p1)):
      child(p, p1) IMPLIES
       app?[variable, symbol, arity]
           (subtermOF[variable, symbol, arity](t, p1));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1140 0 1157 999
body:
  % Subtype TCC generated (at line 287, column 22) for  subtermOF(s, q)
      % expected type  (app?)
  child_p_o_fd_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            fd: position[variable, symbol, arity]):
      fd = first_diff(subtermOF(s, p), subtermOF(t, p)) IMPLIES
       (FORALL (q: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(q) AND
                       positionsOF[variable, symbol, arity](t)(q)):
          child(p, q) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](s, q)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1159 0 1176 999
body:
  % Subtype TCC generated (at line 287, column 43) for  subtermOF(t, q)
      % expected type  (app?)
  child_p_o_fd_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            fd: position[variable, symbol, arity]):
      fd = first_diff(subtermOF(s, p), subtermOF(t, p)) IMPLIES
       (FORALL (q: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(q) AND
                       positionsOF[variable, symbol, arity](t)(q)):
          child(p, q) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](t, q)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1178 0 1205 999
body:
  % Subtype TCC generated (at line 291, column 30) for
      % subtermOF(ext(sig)(s), q)
      % expected type  (app?)
  child_p_o_fd_TCC3: OBLIGATION
    FORALL (sig: Sub[variable, symbol, arity],
            s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            fd: position[variable, symbol, arity]):
      (FORALL (q: position[variable, symbol, arity]
                   | positionsOF(s)(q) AND positionsOF(t)(q)):
         child(p, q) => f(subtermOF(s, q)) = f(subtermOF(t, q)))
       AND fd = first_diff(subtermOF(s, p), subtermOF(t, p))
       IMPLIES
       (FORALL (q1: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity]
                          (ext[variable, symbol, arity](sig)(s))(q)
                       AND
                       positionsOF[variable, symbol, arity]
                           (ext[variable, symbol, arity](sig)(t))(q)):
          child(p o fd, q1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity]
                    (ext[variable, symbol, arity](sig)(s), q1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1207 0 1234 999
body:
  % Subtype TCC generated (at line 291, column 61) for
      % subtermOF(ext(sig)(t), q)
      % expected type  (app?)
  child_p_o_fd_TCC4: OBLIGATION
    FORALL (sig: Sub[variable, symbol, arity],
            s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            fd: position[variable, symbol, arity]):
      (FORALL (q: position[variable, symbol, arity]
                   | positionsOF(s)(q) AND positionsOF(t)(q)):
         child(p, q) => f(subtermOF(s, q)) = f(subtermOF(t, q)))
       AND fd = first_diff(subtermOF(s, p), subtermOF(t, p))
       IMPLIES
       (FORALL (q1: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity]
                          (ext[variable, symbol, arity](sig)(s))(q)
                       AND
                       positionsOF[variable, symbol, arity]
                           (ext[variable, symbol, arity](sig)(t))(q)):
          child(p o fd, q1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity]
                    (ext[variable, symbol, arity](sig)(t), q1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1236 0 1258 999
body:
  % Subtype TCC generated (at line 333, column 53) for  p o fd
      % expected type  {p: position |
                     %          positionsOF(ext(sig)(s))(p) AND
                     %           positionsOF(ext(sig)(t))(p)}
  np_p_o_fd_empty_unifiable_term_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            fd: position[variable, symbol, arity]):
      fd = first_diff(subtermOF(s, p), subtermOF(t, p)) IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND
           sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
           IMPLIES
           positionsOF[variable, symbol, arity]
               (ext[variable, symbol, arity](sig)(s))(o[posnat](p, fd))
            AND
            positionsOF[variable, symbol, arity]
                (ext[variable, symbol, arity](sig)(t))(o[posnat](p, fd)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1260 0 1271 999
body:
  % Subtype TCC generated (at line 400, column 21) for
      % union(Vars(s), Vars(t))
      % expected type  finite_set[(V)]
  robinson_unification_algorithm_aux_TCC1: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      is_finite[(V)]
          (union[(V)]
               (Vars[variable, symbol, arity](s),
                Vars[variable, symbol, arity](t)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1273 0 1280 999
body:
  % Subtype TCC generated (at line 401, column 21) for  right_pos(s, p)
      % expected type  finite_set[position[variable, symbol, arity]]
  robinson_unification_algorithm_aux_TCC2: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      is_finite[position[variable, symbol, arity]](right_pos(s, p));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1282 0 1292 999
body:
  % Subtype TCC generated (at line 400, column 21) for
      % union(Vars(z`1), Vars(z`2))
      % expected type  finite_set[(V)]
  robinson_unification_algorithm_aux_TCC3: OBLIGATION
    FORALL (z:
              [s: term, t: term,
               {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}]):
      is_finite[(V)]
          (union[(V)]
               (Vars[variable, symbol, arity](z`1),
                Vars[variable, symbol, arity](z`2)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1294 0 1300 999
body:
  % Subtype TCC generated (at line 401, column 21) for  right_pos(z`1, z`3)
      % expected type  finite_set[position[variable, symbol, arity]]
  robinson_unification_algorithm_aux_TCC4: OBLIGATION
    FORALL (z:
              [s: term, t: term,
               {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}]):
      is_finite[position[variable, symbol, arity]](right_pos(z`1, z`3));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1302 0 1310 999
body:
  % Subtype TCC generated (at line 400, column 21) for
      % union(Vars(s), Vars(t))
      % expected type  finite_set[(V)]
  robinson_unification_algorithm_aux_TCC5: OBLIGATION
    FORALL (s, t: term):
      is_finite[(V)]
          (union[(V)]
               (Vars[variable, symbol, arity](s),
                Vars[variable, symbol, arity](t)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1312 0 1322 999
body:
  % Subtype TCC generated (at line 382, column 29) for  identity
      % expected type  Sub[variable, symbol, arity]
  robinson_unification_algorithm_aux_TCC6: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (pi: position[variable, symbol, arity]):
          pi = empty_seq AND pi = next_position(s, t, p) IMPLIES
           Sub?[variable, symbol, arity](identity[(V)]));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1324 0 1335 999
body:
  % Subtype TCC generated (at line 383, column 50) for  pi
      % expected type  {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}
  robinson_unification_algorithm_aux_TCC7: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (pi: position[variable, symbol, arity]):
          NOT pi = empty_seq AND pi = next_position(s, t, p) IMPLIES
           positionsOF[variable, symbol, arity](s)(pi) AND
            positionsOF[variable, symbol, arity](t)(pi));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1337 0 1357 999
body:
  % Termination TCC generated (at line 383, column 11) for
      % robinson_unification_algorithm_aux(s, t, pi)
  robinson_unification_algorithm_aux_TCC8: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (pi: position[variable, symbol, arity]):
          NOT pi = empty_seq AND pi = next_position(s, t, p) IMPLIES
           lex2(Card[(V)]
                    (union[(V)]
                         (Vars[variable, symbol, arity](s),
                          Vars[variable, symbol, arity](t))),
                Card[position[variable, symbol, arity]](right_pos(s, pi)))
            <
            lex2(Card[(V)]
                     (union[(V)]
                          (Vars[variable, symbol, arity](s),
                           Vars[variable, symbol, arity](t))),
                 Card[position[variable, symbol, arity]](right_pos(s, p))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1359 0 1373 999
body:
  % Subtype TCC generated (at line 391, column 55) for  subtermOF(t, p)
      % expected type  {t_1: term[variable, symbol, arity] |
                     %          subtermOF(s, p) /= t_1}
  robinson_unification_algorithm_aux_TCC9: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND
           sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
           IMPLIES
           subtermOF[variable, symbol, arity](s, p) /=
            subtermOF[variable, symbol, arity](t, p));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1375 0 1404 999
body:
  % Subtype TCC generated (at line 391, column 25) for
      % p o first_diff(subtermOF(s, p), subtermOF(t, p))
      % expected type  {p: position |
                     %          positionsOF(ext(sig)(s))(p) AND
                     %           positionsOF(ext(sig)(t))(p)}
  robinson_unification_algorithm_aux_TCC10: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND
           sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
           IMPLIES
           positionsOF[variable, symbol, arity]
               (ext[variable, symbol, arity](sig)(s))
               (o[posnat]
                    (p,
                     first_diff[variable, symbol, arity]
                         (subtermOF[variable, symbol, arity](s, p),
                          subtermOF[variable, symbol, arity](t, p))))
            AND
            positionsOF[variable, symbol, arity]
                (ext[variable, symbol, arity](sig)(t))
                (o[posnat]
                     (p,
                      first_diff[variable, symbol, arity]
                          (subtermOF[variable, symbol, arity](s, p),
                           subtermOF[variable, symbol, arity](t, p)))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1406 0 1431 999
body:
  % Subtype TCC generated (at line 395, column 66) for  pi
      % expected type  {p: position |
                     %          positionsOF(ext(sig)(s))(p) AND
                     %           positionsOF(ext(sig)(t))(p)}
  robinson_unification_algorithm_aux_TCC11: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND
           sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
           IMPLIES
           (FORALL (pi: position[variable, symbol, arity]):
              NOT pi = empty_seq AND
               pi =
                next_position(ext(sig)(s), ext(sig)(t),
                              p o
                               first_diff(subtermOF(s, p), subtermOF(t, p)))
               IMPLIES
               positionsOF[variable, symbol, arity]
                   (ext[variable, symbol, arity](sig)(s))(pi)
                AND
                positionsOF[variable, symbol, arity]
                    (ext[variable, symbol, arity](sig)(t))(pi)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1433 0 1467 999
body:
  % Termination TCC generated (at line 394, column 29) for
      % robinson_unification_algorithm_aux(ext(sig)(s), ext(sig)(t), pi)
  robinson_unification_algorithm_aux_TCC12: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND
           sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
           IMPLIES
           (FORALL (pi: position[variable, symbol, arity]):
              NOT pi = empty_seq AND
               pi =
                next_position(ext(sig)(s), ext(sig)(t),
                              p o
                               first_diff(subtermOF(s, p), subtermOF(t, p)))
               IMPLIES
               lex2(Card[(V)]
                        (union[(V)]
                             (Vars[variable, symbol, arity]
                                  (ext[variable, symbol, arity](sig)(s)),
                              Vars[variable, symbol, arity]
                                  (ext[variable, symbol, arity](sig)(t)))),
                    Card[position[variable, symbol, arity]]
                        (right_pos(ext[variable, symbol, arity](sig)(s),
                                   pi)))
                <
                lex2(Card[(V)]
                         (union[(V)]
                              (Vars[variable, symbol, arity](s),
                               Vars[variable, symbol, arity](t))),
                     Card[position[variable, symbol, arity]]
                         (right_pos(s, p)))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1469 0 1503 999
body:
  % Subtype TCC generated (at line 396, column 50) for  comp(sigma, sig)
      % expected type  Sub[variable, symbol, arity]
  robinson_unification_algorithm_aux_TCC13: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p),
            v:
              [{z:
                  [s: term, t: term,
                   {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}] |
                        lex2(Card(union(Vars(z`1), Vars(z`2))),
                             Card(right_pos(z`1, z`3)))
                         <
                         lex2(Card(union(Vars(s), Vars(t))),
                              Card(right_pos(s, p)))} ->
                 Sub[variable, symbol, arity]]):
      NOT subtermOF(s, p) = subtermOF(t, p) IMPLIES
       (FORALL (sig: Sub[variable, symbol, arity]):
          NOT sig = fail AND
           sig = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p))
           IMPLIES
           (FORALL (pi: position[variable, symbol, arity]):
              NOT pi = empty_seq AND
               pi =
                next_position(ext(sig)(s), ext(sig)(t),
                              p o
                               first_diff(subtermOF(s, p), subtermOF(t, p)))
               IMPLIES
               (FORALL (sigma: Sub[variable, symbol, arity]):
                  NOT sigma = fail AND
                   sigma = v(ext(sig)(s), ext(sig)(t), pi)
                   IMPLIES
                   Sub?[variable, symbol, arity]
                       (comp[variable, symbol, arity](sigma, sig)))));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1505 0 1515 999
body:
  % Subtype TCC generated (at line 386, column 48) for  subtermOF(t, p)
      % expected type  {t_1: term[variable, symbol, arity] |
                     %          subtermOF(s, p) /= t_1}
  robinson_unification_algorithm_aux_TCC14: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      NOT subtermOF(s, p) = subtermOF(t, p) IMPLIES
       subtermOF[variable, symbol, arity](s, p) /=
        subtermOF[variable, symbol, arity](t, p);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1517 0 1522 999
body:
  % Subtype TCC generated (at line 405, column 45) for  empty_seq
      % expected type  {p: position | positionsOF(s)(p) AND positionsOF(t)(p)}
  robinson_unification_algorithm_EF_TCC1: OBLIGATION
    FORALL (s, t: term[variable, symbol, arity]):
      positionsOF[variable, symbol, arity](s)(empty_seq[posnat]) AND
       positionsOF[variable, symbol, arity](t)(empty_seq[posnat]);


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1524 0 1544 999
body:
  % Subtype TCC generated (at line 459, column 55) for  p o pi
      % expected type  {p: position |
                     %          positionsOF(ext(sig1)(s))(p) AND
                     %           positionsOF(ext(sig1)(t))(p)}
  vran_ruaEF_subset_union_aux_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            pi: position[variable, symbol, arity]):
      pi = first_diff(subtermOF(s, p), subtermOF(t, p)) IMPLIES
       (FORALL (sig1: Sub[variable, symbol, arity]):
          sig1 = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p)) IMPLIES
           positionsOF[variable, symbol, arity]
               (ext[variable, symbol, arity](sig1)(s))(o[posnat](p, pi))
            AND
            positionsOF[variable, symbol, arity]
                (ext[variable, symbol, arity](sig1)(t))(o[posnat](p, pi)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1546 0 1568 999
body:
  % Subtype TCC generated (at line 460, column 79) for  np
      % expected type  {p: position |
                     %          positionsOF(ext(sig1)(s))(p) AND
                     %           positionsOF(ext(sig1)(t))(p)}
  vran_ruaEF_subset_union_aux_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p) AND
                    subtermOF[variable, symbol, arity](s, p) /=
                     subtermOF[variable, symbol, arity](t, p),
            pi: position[variable, symbol, arity]):
      pi = first_diff(subtermOF(s, p), subtermOF(t, p)) IMPLIES
       (FORALL (sig1: Sub[variable, symbol, arity]):
          sig1 = link_of_frst_diff(subtermOF(s, p), subtermOF(t, p)) IMPLIES
           (FORALL (np: position[variable, symbol, arity]):
              np = next_position(ext(sig1)(s), ext(sig1)(t), p o pi) IMPLIES
               positionsOF[variable, symbol, arity]
                   (ext[variable, symbol, arity](sig1)(s))(np)
                AND
                positionsOF[variable, symbol, arity]
                    (ext[variable, symbol, arity](sig1)(t))(np)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1570 0 1587 999
body:
  % Subtype TCC generated (at line 486, column 29) for  subtermOF(s, p1)
      % expected type  (app?)
  ruaEF_fails_iff_non_unifiable_aux_TCC1: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      (FORALL (q: position[variable, symbol, arity]
                   | positionsOF(s)(q) AND positionsOF(t)(q)):
         left_without_children(q, p) => subtermOF(s, q) = subtermOF(t, q))
       IMPLIES
       (FORALL (p1: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(p1) AND
                       positionsOF[variable, symbol, arity](t)(p1)):
          child(p, p1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](s, p1)));


decl_type: tcc
theory: robinsonunificationEF
library: TRS
signature: nil
location: 1589 0 1606 999
body:
  % Subtype TCC generated (at line 486, column 51) for  subtermOF(t, p1)
      % expected type  (app?)
  ruaEF_fails_iff_non_unifiable_aux_TCC2: OBLIGATION
    FORALL (s: term[variable, symbol, arity],
            t: term[variable, symbol, arity],
            p: position[variable, symbol, arity]
                | positionsOF[variable, symbol, arity](s)(p) AND
                   positionsOF[variable, symbol, arity](t)(p)):
      (FORALL (q: position[variable, symbol, arity]
                   | positionsOF(s)(q) AND positionsOF(t)(q)):
         left_without_children(q, p) => subtermOF(s, q) = subtermOF(t, q))
       IMPLIES
       (FORALL (p1: position[variable, symbol, arity]
                    | positionsOF[variable, symbol, arity](s)(p1) AND
                       positionsOF[variable, symbol, arity](t)(p1)):
          child(p, p1) IMPLIES
           app?[variable, symbol, arity]
               (subtermOF[variable, symbol, arity](t, p1)));


decl_type: tcc
theory: trs
library: TRS
signature: nil
location: 39 0 44 999
body:
  % Assuming TCC generated (at line 31, column 12) for
      % critical_pairs[variable, symbol, arity]
      % generated from assumption critical_pairs.var_countable
  IMP_critical_pairs_TCC1: OBLIGATION
    is_countably_infinite[term[variable, symbol, arity]]
        (V[variable, symbol, arity]);


decl_type: formula
theory: term_adt
library: TRS
signature: nil
location: 32 2 37 36
body:
    term_ord_defaxiom: AXIOM
      (FORALL (v: variable): term_ord(vars(v)) = 0) AND
       (FORALL (f: symbol,
                args:
                  {args: finite_sequence[term] | args`length = arity(f)}):
          term_ord(app(f, args)) = 1);


decl_type: formula
theory: term_adt
library: TRS
signature: nil
location: 42 2 44 66
body:
    term_vars_extensionality: AXIOM
      FORALL (vars?_var: (vars?), vars?_var2: (vars?)):
        v(vars?_var) = v(vars?_var2) IMPLIES vars?_var = vars?_var2;


decl_type: formula
theory: term_adt
library: TRS
signature: nil
location: 49 2 52 36
body:
    term_app_extensionality: AXIOM
      FORALL (app?_var: (app?), app?_var2: (app?)):
        f(app?_var) = f(app?_var2) AND args(app?_var) = args(app?_var2)
         IMPLIES app?_var = app?_var2;


decl_type: formula
theory: term_adt
library: TRS
signature: nil
location: 60 2 65 44
body:
    term_f_app: AXIOM
      FORALL (app1_var: symbol,
              app2_var:
                {args: finite_sequence[term] |
                         args`length = arity(app1_var)}):
        f(app(app1_var, app2_var)) = app1_var;


decl_type: formula
theory: term_adt
library: TRS
signature: nil
location: 67 2 72 47
body:
    term_args_app: AXIOM
      FORALL (app1_var: symbol,
              app2_var:
                {args: finite_sequence[term] |
                         args`length = arity(app1_var)}):
        args(app(app1_var, app2_var)) = app2_var;


decl_type: formula
theory: term_adt
library: TRS
signature: nil
location: 77 2 86 54
body:
    term_induction: AXIOM
      FORALL (p: [term -> boolean]):
        ((FORALL (vars1_var: variable): p(vars(vars1_var))) AND
          (FORALL (app1_var: symbol,
                   app2_var:
                     {args: finite_sequence[term] |
                              args`length = arity(app1_var)}):
             (FORALL (x: below[app2_var`length]): p(app2_var`seq(x))) IMPLIES
              p(app(app1_var, app2_var))))
         IMPLIES (FORALL (term_var: term): p(term_var));


decl_type: function
theory: term_adt
library: TRS
signature:
  [[f: symbol,
  {args: finite_sequence[term] | args`length = arity(f)}] ->
  (app?)]

location: 25 2 28 18
body:
    app:
          [[f: symbol,
            {args: finite_sequence[term] | args`length = arity(f)}] ->
             (app?)]


decl_type: function
theory: term_adt
library: TRS
signature: [term -> upto(1)]
location: 39 2 40 72
body:
    ord(x: term): [term -> upto(1)] =
        CASES x OF vars(vars1_var): 0, app(app1_var, app2_var): 1 ENDCASES


decl_type: function
theory: term_adt
library: TRS
signature: [PRED[variable] -> [term -> boolean]]
location: 88 2 91 17
body:
    every(p: PRED[variable])(a: term):  boolean =
        CASES a
          OF vars(vars1_var): p(vars1_var), app(app1_var, app2_var): TRUE
          ENDCASES;


decl_type: function
theory: term_adt
library: TRS
signature: [[PRED[variable], term] -> boolean]
location: 93 2 96 17
body:
    every(p: PRED[variable], a: term):  boolean =
        CASES a
          OF vars(vars1_var): p(vars1_var), app(app1_var, app2_var): TRUE
          ENDCASES;


decl_type: function
theory: term_adt
library: TRS
signature: [PRED[variable] -> [term -> boolean]]
location: 98 2 101 17
body:
    some(p: PRED[variable])(a: term):  boolean =
        CASES a
          OF vars(vars1_var): p(vars1_var), app(app1_var, app2_var): FALSE
          ENDCASES;


decl_type: function
theory: term_adt
library: TRS
signature: [[PRED[variable], term] -> boolean]
location: 103 2 106 17
body:
    some(p: PRED[variable], a: term):  boolean =
        CASES a
          OF vars(vars1_var): p(vars1_var), app(app1_var, app2_var): FALSE
          ENDCASES;


decl_type: function
theory: term_adt
library: TRS
signature: [[term, term] -> boolean]
location: 108 2 115 18
body:
    subterm(x: term, y: term):  boolean =
        x = y OR
         CASES y
           OF vars(vars1_var): FALSE,
              app(app1_var, app2_var):
                EXISTS (z: below[app2_var`length]):
                  subterm(x, seq(app2_var)(z))
           ENDCASES;


decl_type: function
theory: term_adt
library: TRS
location: 128 2 150 21
signature:
  [[[variable -> nat],
         [[app1_var: symbol,
           {args: finite_sequence[nat] |
                    args`length = arity(app1_var)}] ->
            nat]] ->
          [term -> nat]]

body:
    reduce_nat(vars?_fun: [variable -> nat],
               app?_fun:
                 [[app1_var: symbol,
                   {args: finite_sequence[nat] |
                            args`length = arity(app1_var)}] ->
                    nat]):
          [term -> nat] =
        LAMBDA (term_adtvar: term):
          LET red: [term -> nat] = reduce_nat(vars?_fun, app?_fun) IN
            CASES term_adtvar
              OF vars(vars1_var): vars?_fun(vars1_var),
                 app(app1_var, app2_var):
                   app?_fun(app1_var,
                            (# length := length(app2_var),
                               seq
                                 := (LAMBDA (a:
                                             [below[app2_var`length] ->
                                              term]):
                                       LAMBDA
                                       (x: below[app2_var`length]):
                                       red(a(x)))
                                        (seq(app2_var)) #))
              ENDCASES;


decl_type: function
theory: term_adt
library: TRS
location: 152 2 176 21
signature:
  [[[[variable, term] -> nat],
         [[app1_var: symbol,
           {args: finite_sequence[nat] | args`length = arity(app1_var)},
           term] ->
            nat]] ->
          [term -> nat]]

body:
    REDUCE_nat(vars?_fun: [[variable, term] -> nat],
               app?_fun:
                 [[app1_var: symbol,
                   {args: finite_sequence[nat] |
                            args`length = arity(app1_var)},
                   term] ->
                    nat]):
          [term -> nat] =
        LAMBDA (term_adtvar: term):
          LET red: [term -> nat] = REDUCE_nat(vars?_fun, app?_fun) IN
            CASES term_adtvar
              OF vars(vars1_var): vars?_fun(vars1_var, term_adtvar),
                 app(app1_var, app2_var):
                   app?_fun(app1_var,
                            (# length := length(app2_var),
                               seq
                                 := (LAMBDA (a:
                                             [below[app2_var`length] ->
                                              term]):
                                       LAMBDA
                                       (x: below[app2_var`length]):
                                       red(a(x)))
                                        (seq(app2_var)) #),
                            term_adtvar)
              ENDCASES;


decl_type: function
theory: term_adt
library: TRS
location: 178 2 200 21
signature:
  [[[variable -> ordinal],
         [[app1_var: symbol,
           {args: finite_sequence[ordinal] |
                    args`length = arity(app1_var)}] ->
            ordinal]] ->
          [term -> ordinal]]

body:
    reduce_ordinal(vars?_fun: [variable -> ordinal],
                   app?_fun:
                     [[app1_var: symbol,
                       {args: finite_sequence[ordinal] |
                                args`length = arity(app1_var)}] ->
                        ordinal]):
          [term -> ordinal] =
        LAMBDA (term_adtvar: term):
          LET red: [term -> ordinal] = reduce_ordinal(vars?_fun, app?_fun) IN
            CASES term_adtvar
              OF vars(vars1_var): vars?_fun(vars1_var),
                 app(app1_var, app2_var):
                   app?_fun(app1_var,
                            (# length := length(app2_var),
                               seq
                                 := (LAMBDA (a:
                                             [below[app2_var`length] ->
                                              term]):
                                       LAMBDA
                                       (x: below[app2_var`length]):
                                       red(a(x)))
                                        (seq(app2_var)) #))
              ENDCASES;


decl_type: function
theory: term_adt
library: TRS
location: 202 2 226 21
signature:
  [[[[variable, term] -> ordinal],
         [[app1_var: symbol,
           {args: finite_sequence[ordinal] |
                    args`length = arity(app1_var)},
           term] ->
            ordinal]] ->
          [term -> ordinal]]

body:
    REDUCE_ordinal(vars?_fun: [[variable, term] -> ordinal],
                   app?_fun:
                     [[app1_var: symbol,
                       {args: finite_sequence[ordinal] |
                                args`length = arity(app1_var)},
                       term] ->
                        ordinal]):
          [term -> ordinal] =
        LAMBDA (term_adtvar: term):
          LET red: [term -> ordinal] = REDUCE_ordinal(vars?_fun, app?_fun) IN
            CASES term_adtvar
              OF vars(vars1_var): vars?_fun(vars1_var, term_adtvar),
                 app(app1_var, app2_var):
                   app?_fun(app1_var,
                            (# length := length(app2_var),
                               seq
                                 := (LAMBDA (a:
                                             [below[app2_var`length] ->
                                              term]):
                                       LAMBDA
                                       (x: below[app2_var`length]):
                                       red(a(x)))
                                        (seq(app2_var)) #),
                            term_adtvar)
              ENDCASES;


decl_type: constant
theory: term_adt
library: TRS
signature: (strict_well_founded?[term])
location: 117 2 124 19
body:
    <<:  (strict_well_founded?[term]) =
        LAMBDA (x, y: term):
          CASES y
            OF vars(vars1_var): FALSE,
               app(app1_var, app2_var):
                 EXISTS (z: below[app2_var`length]):
                   subterm(x, seq(app2_var)(z))
            ENDCASES;


decl_type: function
theory: term_adt_map
library: TRS
location: 14 2 24 17
signature:
  [[variable -> variable1] ->
          [term[variable, symbol, arity] ->
             term[variable1, symbol, arity]]]

body:
    map(f1: [variable -> variable1])(a: term[variable, symbol, arity]):
          term[variable1, symbol, arity] =
        CASES a
          OF vars(vars1_var): vars(f1(vars1_var)),
             app(app1_var, app2_var):
               app(app1_var,
                   (# length := length(app2_var),
                      seq
                        := LAMBDA (x: below[app2_var`length]):
                             map(f1)(seq(app2_var)(x)) #))
          ENDCASES;


decl_type: function
theory: term_adt_map
library: TRS
location: 26 2 36 17
signature:
  [[[variable -> variable1], term[variable, symbol, arity]] ->
          term[variable1, symbol, arity]]

body:
    map(f1: [variable -> variable1], a: term[variable, symbol, arity]):
          term[variable1, symbol, arity] =
        CASES a
          OF vars(vars1_var): vars(f1(vars1_var)),
             app(app1_var, app2_var):
               app(app1_var,
                   (# length := length(app2_var),
                      seq
                        := LAMBDA (x: below[app2_var`length]):
                             map(f1)(seq(app2_var)(x)) #))
          ENDCASES;


decl_type: function
theory: term_adt_map
library: TRS
location: 38 2 49 57
signature:
  [[[variable, variable1] -> boolean] ->
          [[term[variable, symbol, arity],
            term[variable1, symbol, arity]] ->
             boolean]]

body:
    every(R: [[variable, variable1] -> boolean])
         (x: term[variable, symbol, arity],
          y: term[variable1, symbol, arity]):
          boolean =
        vars?(x) AND vars?(y) AND R(v(x), v(y)) OR
              app?(x) AND app?(y) AND f(x) = f(y)
          AND args(x)`length = args(y)`length
          AND (FORALL (z:
                         {x1: nat |
                                  x1 < args(x)`length AND
                                   x1 < args(y)`length}):
                 every(R)(args(x)`seq(z), args(y)`seq(z)));


decl_type: function
theory: term_adt_reduce
library: TRS
location: 12 2 36 21
signature:
  [[[variable -> range],
         [[symbol,
           {args: finite_sequence[range] | args`length = arity(f)}] ->
            range]] ->
          [term[variable, symbol, arity] -> range]]

body:
    reduce(vars?_fun: [variable -> range],
           app?_fun:
             [[symbol,
               {args: finite_sequence[range] | args`length = arity(f)}] ->
                range]):
          [term[variable, symbol, arity] -> range] =
        LAMBDA (term_adtvar: term[variable, symbol, arity]):
          LET red: [term[variable, symbol, arity] -> range] =
                reduce(vars?_fun, app?_fun)
            IN
            CASES term_adtvar
              OF vars(vars1_var): vars?_fun(vars1_var),
                 app(app1_var, app2_var):
                   app?_fun(app1_var,
                            (# length := length(app2_var),
                               seq
                                 := (LAMBDA (a:
                                             [below[app2_var`length] ->
                                              term
                                              [variable, symbol, arity]]):
                                       LAMBDA
                                       (x: below[app2_var`length]):
                                       red(a(x)))
                                        (seq(app2_var)) #))
              ENDCASES;


decl_type: function
theory: term_adt_reduce
library: TRS
location: 38 2 64 21
signature:
  [[[[variable, term[variable, symbol, arity]] -> range],
         [[symbol,
           {args: finite_sequence[range] | args`length = arity(f)},
           term[variable, symbol, arity]] ->
            range]] ->
          [term[variable, symbol, arity] -> range]]

body:
    REDUCE(vars?_fun: [[variable, term[variable, symbol, arity]] -> range],
           app?_fun:
             [[symbol,
               {args: finite_sequence[range] | args`length = arity(f)},
               term[variable, symbol, arity]] ->
                range]):
          [term[variable, symbol, arity] -> range] =
        LAMBDA (term_adtvar: term[variable, symbol, arity]):
          LET red: [term[variable, symbol, arity] -> range] =
                REDUCE(vars?_fun, app?_fun)
            IN
            CASES term_adtvar
              OF vars(vars1_var): vars?_fun(vars1_var, term_adtvar),
                 app(app1_var, app2_var):
                   app?_fun(app1_var,
                            (# length := length(app2_var),
                               seq
                                 := (LAMBDA (a:
                                             [below[app2_var`length] ->
                                              term
                                              [variable, symbol, arity]]):
                                       LAMBDA
                                       (x: below[app2_var`length]):
                                       red(a(x)))
                                        (seq(app2_var)) #),
                            term_adtvar)
              ENDCASES;


decl_type: tcc
theory: coalition_fun
library: TU_Games
signature: nil
location: 97 0 99 999
body:
  % Subtype TCC generated (at line 50, column 53) for  zero_fun
      % expected type  coalition_fun
  coalition_fun_TCC1: OBLIGATION coalition_fun?(zero_fun);


decl_type: tcc
theory: coalition_fun
library: TU_Games
signature: nil
location: 101 0 103 999
body:
  % Judgement subtype TCC generated (at line 52, column 32) for  x
      % expected type  finite_set[(N)]
  subsets_are_finite: OBLIGATION FORALL (x: setof[(N)]): is_finite[(N)](x);


decl_type: formula
theory: tu_game
library: TU_Games
signature: nil
location: 159 2 160 55
body:
    interch_impl_desir: LEMMA FORALL (g:tu_game, i,j:(g`1)):
      interchangeable?(g)(i,j) => more_desirable?(g)(i,j)


decl_type: formula
theory: tu_game
library: TU_Games
signature: nil
location: 164 2 165 56
body:
    interch_is_sym: LEMMA FORALL (g:tu_game, i,j:(g`1)):
      interchangeable?(g)(i,j) => interchangeable?(g)(j,i)


decl_type: formula
theory: tu_game
library: TU_Games
signature: nil
location: 173 2 175 42
body:
    affine_bij: LEMMA FORALL (N:players_set,
      a: posreal, b,x: [(N) -> real]):
      affine(N,a,b)(affineinv(N,a,b)(x)) = x


decl_type: function
theory: tu_game
library: TU_Games
signature:
  [d: [g: tu_game, NN: players_set, tau_type(g`1, NN)] ->
  coalition_fun[U, d`2]]

location: 69 2 70 28
body:
    tau_v(g:tu_game,NN:players_set,tau:tau_type(g`1,NN)): coalition_fun[U,NN] =
      g`2 o inverse_image(tau)


decl_type: function
theory: tu_game
library: TU_Games
location: 71 2 73 39
signature:
  [d: [g: tu_game, NN: players_set, tau_type(g`1, NN)] ->
          [[(d`1`1) -> real] -> [(d`2) -> real]]]

body:
    tau_x(g:tu_game,NN:players_set,tau:tau_type(g`1,NN))(
      x:[(g`1)->real]): [(NN)->real] =
      LAMBDA (i:(NN)): x(inverse(tau)(i))


decl_type: function
theory: tu_game
library: TU_Games
signature: [solution_concept -> bool]
location: 76 2 78 53
body:
    AN(s): bool = FORALL (g:tu_game, NN:players_set,
                          tau:tau_type(g`1,NN)):
    s(NN,tau_v(g,NN,tau)) = image(tau_x(g,NN,tau),s(g))


decl_type: function
theory: tu_game
library: TU_Games
signature: [g: tu_game -> [[(g`1), (g`1)] -> bool]]
location: 81 2 83 33
body:
    interchangeable?(g)(i,j:(g`1)): bool =
      FORALL (S:setof[(g`1)]): (NOT member(i,S)) AND (NOT member(j,S)) =>
      g`2(add(i,S)) = g`2(add(j,S))


decl_type: function
theory: tu_game
library: TU_Games
signature: [solution_concept -> bool]
location: 87 2 88 43
body:
    ETP(s): bool = FORALL (g:tu_game, x:(s(g)), i,j:(g`1)):
      interchangeable?(g)(i,j) => x(i) = x(j)


decl_type: function
theory: tu_game
library: TU_Games
signature: [g: tu_game -> [[(g`1), (g`1)] -> bool]]
location: 91 2 93 34
body:
    more_desirable?(g)(i,j:(g`1)): bool =
      FORALL (S:setof[(g`1)]): (NOT member(i,S)) AND (NOT member(j,S)) =>
      g`2(add(i,S)) >= g`2(add(j,S))


decl_type: function
theory: tu_game
library: TU_Games
signature: [solution_concept -> bool]
location: 97 2 98 43
body:
    DES(s): bool = FORALL (g:tu_game, x:(s(g)), i,j:(g`1)):
      more_desirable?(g)(i,j) => x(i) >= x(j)


decl_type: function
theory: tu_game
library: TU_Games
signature: [g: tu_game -> [(g`1) -> bool]]
location: 101 2 103 46
body:
    nullplayer?(g)(i:(g`1)): bool =
      FORALL (S:setof[(g`1)]): (NOT member(i,S)) =>
      g`2(add(i,S)) = g`2(S) + g`2(singleton(i))


decl_type: function
theory: tu_game
library: TU_Games
signature: [solution_concept -> bool]
location: 105 2 107 47
body:
    NPP(s): bool = FORALL (g:tu_game, x:(s(g)), i:(g`1)):
    % FORALL (i:nullplayer(g)): x(i) = g`2(singleton(i))
    nullplayer?(g)(i) => x(i) = g`2(singleton(i))


decl_type: function
theory: tu_game
library: TU_Games
signature:
  [d: [N: players_set, real, [(N) -> real]] ->
  [[(d`1) -> real] -> [(d`1) -> real]]]

location: 116 2 118 40
body:
    affine(N: players_set, a:real, b: [(N) -> real])
      (x: [(N) -> real]): [(N) -> real] =
      LAMBDA (i:(N)): lin(N,a,x)(i) + b(i)


decl_type: function
theory: tu_game
library: TU_Games
signature:
  [d: [N: players_set, nzreal, [(N) -> real]] ->
  [[(d`1) -> real] -> [(d`1) -> real]]]

location: 121 2 123 37
body:
    affineinv(N: players_set, a:nzreal, b: [(N) -> real])
      (y: [(N) -> real]): [(N) -> real] =
      LAMBDA (i:(N)): dif(N,y,b)(i) / a


decl_type: function
theory: tu_game
library: TU_Games
location: 126 2 128 48
signature:
  [d: [N: players_set, real, [(N) -> real]] ->
          [coalition_fun[U, d`1] -> coalition_fun[U, d`1]]]

body:
    affinestar(N: players_set, a:real, b: [(N) -> real])
      (v: coalition_fun[U,N]): coalition_fun[U,N] =
      LAMBDA (S:powset(N)): a*v(S) + bstar(N,b)(S)


decl_type: function
theory: tu_game
library: TU_Games
signature: [solution_concept -> bool]
location: 133 2 135 60
body:
    COV(s): bool = FORALL (N:players_set, a: posreal, b: [(N) -> real],
                           v:coalition_fun[U,N]):
      s(N,affinestar(N,a,b)(v)) = image(affine(N,a,b), s(N,v))


decl_type: function
theory: tu_game
library: TU_Games
signature: [solution_concept -> bool]
location: 149 2 153 78
body:
    REAS(s): bool = FORALL (N:players_set, v:coalition_fun[U,N],
                            x:(s(N,v)), i:(N)):
      (EXISTS (S1:powset(N)): (NOT member(i,S1)) AND x(i) >= v(add(i,S1))-v(S1))
      AND
      (EXISTS (S2:powset(N)): (NOT member(i,S2)) AND x(i) <= v(add(i,S2))-v(S2))


decl_type: tcc
theory: tu_game
library: TU_Games
signature: nil
location: 207 0 209 999
body:
  % Subtype TCC generated (at line 47, column 59) for  core
      % expected type  solution_concept
  solution_concept_TCC1: OBLIGATION solution_concept?(core);


decl_type: tcc
theory: tu_game
library: TU_Games
signature: nil
location: 211 0 217 999
body:
  % Subtype TCC generated (at line 70, column 4) for  g`2 o inverse_image(tau)
      % expected type  coalition_fun[U, NN]
  tau_v_TCC1: OBLIGATION
    FORALL (g: tu_game, NN: players_set[U], tau: tau_type(g`1, NN)):
      coalition_fun?[U, NN]
          (o[set[(NN)], powset[U, g`1], real]
               (g`2, inverse_image[(g`1), (NN)](tau)));


decl_type: tcc
theory: tu_game
library: TU_Games
signature: nil
location: 219 0 222 999
body:
  % Existence TCC generated (at line 73, column 23) for  inverse
  tau_x_TCC1: OBLIGATION
    FORALL (g: tu_game, NN: players_set[U], tau: tau_type(g`1, NN), i: (NN)):
      EXISTS (x1: (g`1)): TRUE;


decl_type: tcc
theory: tu_game
library: TU_Games
signature: nil
location: 224 0 229 999
body:
  % Subtype TCC generated (at line 125, column 4) for
      % LAMBDA (S: powset(N)): tot(S, b)
      % expected type  coalition_fun[U, N]
  bstar_TCC1: OBLIGATION
    FORALL (N: players_set[U], b: [(N) -> real]):
      coalition_fun?[U, N](LAMBDA (S: powset(N)): tot[U, N](S, b));


decl_type: tcc
theory: tu_game
library: TU_Games
signature: nil
location: 231 0 237 999
body:
  % Subtype TCC generated (at line 128, column 4) for
      % LAMBDA (S: powset(N)): a * v(S) + bstar(N, b)(S)
      % expected type  coalition_fun[U, N]
  affinestar_TCC1: OBLIGATION
    FORALL (N: players_set[U], a: real, b: [(N) -> real],
            v: coalition_fun[U, N]):
      coalition_fun?[U, N](LAMBDA (S: powset(N)): a * v(S) + bstar(N, b)(S));


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 38 2 43 54
body:
    constructed_sturm_seq_repeated_root: LEMMA 
      constructed_sturm_sequence?(p,n,g,k,m) IMPLIES
      FORALL (i:nat): i+1<=m AND
      polynomial(p(i),n(i))(x)=0 AND polynomial(p(i+1),n(i+1))(x)=0
      IMPLIES
      (FORALL (j:upto(m)): polynomial(p(j),n(j))(x) = 0)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 60 2 65 77
body:
    constructed_sturm_seq_root_degrees: LEMMA
      constructed_sturm_sequence?(p,n,g,k,m) IMPLIES
      ((polynomial(g,k)(y)=0 AND 
        default_root_degree?(p,n,g,k,m,y)(root_degree(p(0),n(0))(y))) OR
      (polynomial(g,k)(y)/=0 AND
        default_root_degree?(p,n,g,k,m,y)(max(root_degree(p(0),n(0))(y)-1,0))))


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 71 2 73 69
body:
    default_root_deg_def: LEMMA
      constructed_sturm_sequence?(p,n,g,k,m) IMPLIES
      default_root_degree?(p,n,g,k,m,y)(default_root_deg(p,n,g,k,m)(y))


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 75 2 77 85
body:
    constructed_sturm_seq_root_degree_lower_bound: LEMMA
      constructed_sturm_sequence?(p,n,g,k,m) IMPLIES
      FORALL (i): i<m IMPLIES root_degree(p(i),n(i))(y)>=default_root_deg(p,n,g,k,m)(y)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 81 2 87 32
body:
    sturm_tarski_basic_1: LEMMA FORALL (z:real):
      constructed_sturm_sequence?(p,n,g,k,m) AND
      (FORALL (j:below(m)): only_root_between?(p(j),n(j),x,y)(z)) AND
      polynomial(p(0),n(0))(z)=0 AND polynomial(g,k)(z)/=0 IMPLIES
      number_sign_changes(LAMBDA (i): polynomial(p(i),n(i))(x),1)`num -
      number_sign_changes(LAMBDA (i): polynomial(p(i),n(i))(y),1)`num =
      sign_ext(polynomial(g,k)(z))


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 89 2 95 34
body:
    sturm_tarski_basic_2: LEMMA FORALL (z:real):
      LET nsc = (LAMBDA (xyz:real,k:nat):
                     number_sign_changes(LAMBDA (i): 
                     polynomial(p(i),n(i))(xyz),k)`num)
        IN root_degree(p(1),n(1))(z) = root_degree(p(0),n(0))(z) AND constructed_sturm_sequence?(p,n,g,k,m) AND
      (FORALL (j:below(m)): only_root_between?(p(j),n(j),x,y)(z))
           IMPLIES nsc(x,1)=nsc(y,1)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 97 2 106 42
body:
    sturm_tarski_basic_3: LEMMA FORALL (z:real):
      m>2 AND
      constructed_sturm_sequence?(p,n,g,k,m) AND
      (FORALL (j:below(m)): only_root_between?(p(j),n(j),x,y)(z)) AND
      (polynomial(g,k)(z)=0 OR polynomial(p(0),n(0))(z)/=0) IMPLIES
        LET nsc = (LAMBDA (xyz:real,k:nat):
                     number_sign_changes(LAMBDA (i): 
                     polynomial(p(i),n(i))(xyz),k)`num)
        IN (root_degree(p(2),n(2))(z) = root_degree(p(0),n(0))(z)
                                             IMPLIES nsc(x,2)=nsc(y,2))


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 108 2 115 52
body:
    sturm_tarski_basic: LEMMA FORALL (z:real):
      constructed_sturm_sequence?(p,n,g,k,m) AND
      (FORALL (j:below(m)): only_root_between?(p(j),n(j),x,y)(z))
      IMPLIES
      number_sign_changes(LAMBDA (i): polynomial(p(i),n(i))(x),m-1)`num -
      number_sign_changes(LAMBDA (i): polynomial(p(i),n(i))(y),m-1)`num =
      (IF polynomial(p(0),n(0))(z)/=0 OR polynomial(g,k)(z)=0 THEN 0
      ELSIF polynomial(g,k)(z)>0 THEN 1 ELSE -1 ENDIF)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 117 2 123 38
body:
    constructed_sturm_roots_between_enum: LEMMA % THIS NEEDS TO BE FOR ALL P(i) NOT JUST P(0)
      x<y AND constructed_sturm_sequence?(p,n,g,k,m) IMPLIES
        EXISTS ((K:nat|K>=2),enum:[below(K)->real]):
          (FORALL (i,j:below(K)): i<j IMPLIES enum(i)<enum(j)) AND
          enum(0)=x AND enum(K-1)=y AND
          (FORALL (b:real,j:nat): j<=m-1 AND x<b AND b<=y AND polynomial(p(j),n(j))(b)=0 IMPLIES
            EXISTS (i:below(K)): b = enum(i))


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 130 2 132 62
body:
    Sol_union_top: LEMMA FORALL (z:real): x<=y AND y<=z AND a(m)/=0 IMPLIES
      union(Sol(a,m,g,k,rel,x,y,bbelow,babove),Sol(a,m,g,k,rel,y,z,bbelow2,babove2)) =
      Sol(a,m,g,k,rel,x,z,bbelow AND bbelow2,babove AND babove2)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 139 2 142 39
body:
    NSol_union_top: LEMMA FORALL (z:real): x<=y AND y<=z AND a(m)/=0 AND
      polynomial(a,m)(y)/=0 IMPLIES
      NSol(a,m,g,k,rel,x,y,bbelow,True)+NSol(a,m,g,k,rel,y,z,True,babove) =
      NSol(a,m,g,k,rel,x,z,bbelow,babove)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 144 2 151 89
body:
    sturm_tarski: LEMMA
      x<y AND
      constructed_sturm_sequence?(p,n,g,k,m) AND
      (FORALL (j:nat): j<m IMPLIES (polynomial(p(j),n(j))(x)/=0 AND polynomial(p(j),n(j))(y)/=0))
      IMPLIES
        LET nsc = LAMBDA (xyz:real): number_sign_changes(LAMBDA (i): polynomial(p(i),n(i))(xyz),m-1),
            Nroots = nsc(x)`num-nsc(y)`num
        IN Nroots = NSol(p(0),n(0),g,k,>,x,y,true,true)-NSol(p(0),n(0),g,k,<,x,y,true,true)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 164 2 169 61
body:
    sturm_tarski_unbounded: LEMMA
      constructed_sturm_sequence?(p,n,g,k,m) IMPLIES
        LET nschigh = number_sign_changes(LAMBDA (i): p(i)(n(i)),m-1),
            nsclow  = number_sign_changes(LAMBDA (i): (IF even?(n(i)) THEN 1 ELSE -1 ENDIF)*p(i)(n(i)),m-1),
            Nroots  = nsclow`num-nschigh`num
        IN Nroots = NSol(p(0),n(0),g,k,>)-NSol(p(0),n(0),g,k,<)


decl_type: formula
theory: sturmtarski
library: Tarski
signature: nil
location: 171 2 173 37
body:
    NSol_sq_gt: LEMMA a(m)/=0 IMPLIES
      NSol(a,m,polynomial_prod(g,k,g,k),2*k,>) =
      NSol(a,m,g,k,>) + NSol(a,m,g,k,<)


decl_type: function
theory: sturmtarski
library: Tarski
signature:
  [[[nat -> [nat -> real]], [nat -> nat], [nat -> real], nat,
  posnat] ->
  bool]

location: 25 2 35 24
body:
    constructed_sturm_sequence?(p,n,g,k,m): bool =
      (FORALL (i:below(m)): p(i)(n(i))/=0) AND
      (FORALL (i,j:subrange(1,m-1)): i<j IMPLIES n(i)>n(j)) AND
      n(0)>0 AND
      p(1) = polynomial_prod(g,k,poly_deriv(p(0)),n(0)-1) AND n(1) = k+n(0)-1 AND
      n(m) = 0 AND p(m)(0) = 0 AND
      (FORALL (j:nat): j>1 AND j<=m IMPLIES LET pd = poly_divide(p(j-2),n(j-2))(p(j-1),n(j-1))(0) IN
                                             EXISTS (c:posreal): 
                                             polynomial(p(j),n(j)) = 
                                             polynomial(-c*pd`rem,pd`rdeg))
      AND m>=2 AND g(k)/=0


decl_type: function
theory: sturmtarski
library: Tarski
location: 45 2 57 36
signature:
  [[[nat -> [nat -> real]], [nat -> nat], [nat -> real], nat,
         posnat, real] ->
          [nat -> bool]]

body:
    default_root_degree?(p,n,g,k,m,y)(d): bool =
      ((d=0 AND root_degree(p(0),n(0))(y)=0 AND polynomial(p(0),n(0))(y)/=0 AND
             polynomial(g,k)(y)/=0) OR
       (root_degree(p(0),n(0))(y)=d+1 AND root_degree(p(1),n(1))(y)=d AND
             polynomial(g,k)(y)/=0) OR
       (root_degree(p(0),n(0))(y)=d AND root_degree(p(1),n(1))(y)=d AND
        root_degree(g,k)(y)=1 AND polynomial(g,k)(y)=0) OR
       (root_degree(p(0),n(0))(y)=d AND root_degree(p(1),n(1))(y)>d AND
        root_degree(g,k)(y)>0 AND polynomial(g,k)(y)=0)) AND
      (FORALL (i:nat): i<m AND root_degree(p(i),n(i))(y)/=d IMPLIES
        ((i>0 IMPLIES root_degree(p(i-1),n(i-1))(y)=d) AND
         (i<m-1 IMPLIES root_degree(p(i+1),n(i+1))(y)=d))) AND
       root_degree(p(m-1),n(m-1))(y)=d


decl_type: function
theory: sturmtarski
library: Tarski
location: 67 2 69 49
signature:
  [[[nat -> [nat -> real]], [nat -> nat], [nat -> real], nat,
         posnat] ->
          [real -> nat]]

body:
    default_root_deg(p,n,g,k,m)(y): nat =
      IF polynomial(g,k)(y)=0 THEN root_degree(p(0),n(0))(y)
      ELSE max(root_degree(p(0),n(0))(y)-1,0) ENDIF


decl_type: function
theory: sturmtarski
library: Tarski
location: 125 2 128 71
signature:
  [[a: [nat -> real], {m: nat | a(m) /= 0}, [nat -> real], nat,
         [[real, real] -> bool], real, real, bool, bool] ->
          finite_set[real]]

body:
    Sol(a:[nat->real],(m:nat|a(m)/=0),g:[nat->real],k:nat,
        rel:[[real,real]->bool],x,y:real,bbelow,babove:bool):
      finite_set[real] = {r:real | polynomial(a,m)(r)=0 AND rel(polynomial(g,k)(r),0) AND
                                   (bbelow IMPLIES x<=r) AND (babove IMPLIES r<=y)}


decl_type: function
theory: sturmtarski
library: Tarski
location: 134 2 137 66
signature:
  [d1:
          [a: [nat -> real], {m: nat | a(m) /= 0}, [nat -> real], nat,
           [[real, real] -> bool], real, real, bool, bool] ->
          {d: nat |
                   EXISTS (enumsol:
                             [below(d) ->
                                (Sol(d1`1,
                                     d1`2,
                                     d1`3,
                                     d1`4,
                                     d1`5,
                                     d1`6,
                                     d1`7,
                                     d1`8,
                                     d1`9))]):
                     bijective?(enumsol)}]

body:
    NSol(a:[nat->real],(m:nat|a(m)/=0),g:[nat->real],k:nat,
        rel:[[real,real]->bool],x,y:real,bbelow,babove:bool): {d:nat |
          EXISTS (enumsol:[below(d)->(Sol(a,m,g,k,rel,x,y,bbelow,babove))]):
            bijective?(enumsol)} = card(Sol(a,m,g,k,rel,x,y,bbelow,babove))


decl_type: function
theory: sturmtarski
library: Tarski
location: 155 2 157 84
signature:
  [[a: [nat -> real], {m: nat | a(m) /= 0}, [nat -> real], nat,
         [[real, real] -> bool]] ->
          finite_set[real]]

body:
    Sol(a:[nat->real],(m:nat|a(m)/=0),g:[nat->real],k:nat,
        rel:[[real,real]->bool]):
      finite_set[real] = {r:real | polynomial(a,m)(r)=0 AND rel(polynomial(g,k)(r),0)}


decl_type: function
theory: sturmtarski
library: Tarski
location: 159 2 162 48
signature:
  [d1:
          [a: [nat -> real], {m: nat | a(m) /= 0}, [nat -> real], nat,
           [[real, real] -> bool]] ->
          {d: nat |
                   EXISTS (enumsol:
                             [below(d) ->
                                (Sol(d1`1, d1`2, d1`3, d1`4, d1`5))]):
                     bijective?(enumsol)}]

body:
    NSol(a:[nat->real],(m:nat|a(m)/=0),g:[nat->real],k:nat,
        rel:[[real,real]->bool]): {d:nat |
          EXISTS (enumsol:[below(d)->(Sol(a,m,g,k,rel))]):
            bijective?(enumsol)} = card(Sol(a,m,g,k,rel))


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 192 0 197 999
body:
  % Subtype TCC generated (at line 27, column 49) for  i
      % expected type  nat
  constructed_sturm_sequence?_TCC1: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], m: posnat):
      (FORALL (i: below(m)): p(i)(n(i)) /= 0) IMPLIES
       (FORALL (i1, j: subrange(1, m - 1)): i1 < j IMPLIES i1 >= 0);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 199 0 204 999
body:
  % Subtype TCC generated (at line 27, column 54) for  j
      % expected type  nat
  constructed_sturm_sequence?_TCC2: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], m: posnat):
      (FORALL (i: below(m)): p(i)(n(i)) /= 0) IMPLIES
       (FORALL (i1, j: subrange(1, m - 1)): i1 < j IMPLIES j >= 0);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 206 0 213 999
body:
  % Subtype TCC generated (at line 29, column 48) for  n(0) - 1
      % expected type  nat
  constructed_sturm_sequence?_TCC3: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], m: posnat):
      (n(0) > 0 AND
        (FORALL (i, j: subrange(1, m - 1)): i < j IMPLIES n(i) > n(j)) AND
         (FORALL (i: below(m)): p(i)(n(i)) /= 0))
       IMPLIES n(0) - 1 >= 0;


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 215 0 225 999
body:
  % Subtype TCC generated (at line 31, column 80) for  j - 1
      % expected type  nat
  constructed_sturm_sequence?_TCC4: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], g: [nat -> real],
            k: nat, m: posnat):
      (     p(m)(0) = 0 AND n(m) = 0 AND n(1) = k + n(0) - 1
        AND p(1) = polynomial_prod(g, k, poly_deriv(p(0)), n(0) - 1)
        AND n(0) > 0
        AND FORALL (i, j: subrange(1, m - 1)): i < j IMPLIES n(i) > n(j)
        AND FORALL (i: below(m)): p(i)(n(i)) /= 0)
       IMPLIES (FORALL (j1: nat): j1 > 1 AND j1 <= m IMPLIES j1 - 1 >= 0);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 227 0 239 999
body:
  % Subtype TCC generated (at line 31, column 85) for  n(j - 1)
      % expected type  {m | p(j - 1)(m) /= 0}
  constructed_sturm_sequence?_TCC5: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], g: [nat -> real],
            k: nat, m: posnat):
      (     p(m)(0) = 0 AND n(m) = 0 AND n(1) = k + n(0) - 1
        AND p(1) = polynomial_prod(g, k, poly_deriv(p(0)), n(0) - 1)
        AND n(0) > 0
        AND FORALL (i, j: subrange(1, m - 1)): i < j IMPLIES n(i) > n(j)
        AND FORALL (i: below(m)): p(i)(n(i)) /= 0)
       IMPLIES
       (FORALL (j1: nat):
          j1 > 1 AND j1 <= m IMPLIES p(j1 - 1)(n(j1 - 1)) /= 0);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 241 0 251 999
body:
  % Subtype TCC generated (at line 31, column 65) for  j - 2
      % expected type  nat
  constructed_sturm_sequence?_TCC6: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], g: [nat -> real],
            k: nat, m: posnat):
      (     p(m)(0) = 0 AND n(m) = 0 AND n(1) = k + n(0) - 1
        AND p(1) = polynomial_prod(g, k, poly_deriv(p(0)), n(0) - 1)
        AND n(0) > 0
        AND FORALL (i, j: subrange(1, m - 1)): i < j IMPLIES n(i) > n(j)
        AND FORALL (i: below(m)): p(i)(n(i)) /= 0)
       IMPLIES (FORALL (j1: nat): j1 > 1 AND j1 <= m IMPLIES j1 - 2 >= 0);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 253 0 275 999
body:
  % Subtype TCC generated (at line 55, column 34) for  i - 1
      % expected type  nat
  default_root_degree?_TCC1: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], g: [nat -> real],
            k: nat, m: posnat, y: real, d: nat):
      ((d = 0 AND
         root_degree(p(0), n(0))(y) = 0 AND
          polynomial(p(0), n(0))(y) /= 0 AND polynomial(g, k)(y) /= 0)
        OR
        (root_degree(p(0), n(0))(y) = d + 1 AND
          root_degree(p(1), n(1))(y) = d AND polynomial(g, k)(y) /= 0)
         OR
         (root_degree(p(0), n(0))(y) = d AND
           root_degree(p(1), n(1))(y) = d AND
            root_degree(g, k)(y) = 1 AND polynomial(g, k)(y) = 0)
          OR
          (root_degree(p(0), n(0))(y) = d AND
            root_degree(p(1), n(1))(y) > d AND
             root_degree(g, k)(y) > 0 AND polynomial(g, k)(y) = 0))
       IMPLIES
       (FORALL (i: nat):
          i > 0 AND i < m AND root_degree(p(i), n(i))(y) /= d IMPLIES
           i - 1 >= 0);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 277 0 301 999
body:
  % Subtype TCC generated (at line 57, column 19) for  m - 1
      % expected type  nat
  default_root_degree?_TCC2: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], g: [nat -> real],
            k: nat, m: posnat, y: real, d: nat):
      (FORALL (i: nat):
         i < m AND root_degree(p(i), n(i))(y) /= d IMPLIES
          ((i > 0 IMPLIES root_degree(p(i - 1), n(i - 1))(y) = d) AND
            (i < m - 1 IMPLIES root_degree(p(i + 1), n(i + 1))(y) = d)))
       AND
       ((d = 0 AND
          root_degree(p(0), n(0))(y) = 0 AND
           polynomial(p(0), n(0))(y) /= 0 AND polynomial(g, k)(y) /= 0)
         OR
         (root_degree(p(0), n(0))(y) = d + 1 AND
           root_degree(p(1), n(1))(y) = d AND polynomial(g, k)(y) /= 0)
          OR
          (root_degree(p(0), n(0))(y) = d AND
            root_degree(p(1), n(1))(y) = d AND
             root_degree(g, k)(y) = 1 AND polynomial(g, k)(y) = 0)
           OR
           (root_degree(p(0), n(0))(y) = d AND
             root_degree(p(1), n(1))(y) > d AND
              root_degree(g, k)(y) > 0 AND polynomial(g, k)(y) = 0))
       IMPLIES m - 1 >= 0;


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 303 0 314 999
body:
  % Subtype TCC generated (at line 65, column 40) for
      % max(root_degree(p(0), n(0))(y) - 1, 0)
      % expected type  nat
  constructed_sturm_seq_root_degrees_TCC1: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]], y: real):
      constructed_sturm_sequence?(p, n, g, k, m) AND
       NOT (polynomial(g, k)(y) = 0 AND
             default_root_degree?(p, n, g, k, m, y)
                                 (root_degree(p(0), n(0))(y)))
        AND polynomial(g, k)(y) /= 0
       IMPLIES max(root_degree(p(0), n(0))(y) - 1, 0) >= 0;


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 316 0 323 999
body:
  % Subtype TCC generated (at line 69, column 9) for
      % max(root_degree(p(0), n(0))(y) - 1, 0)
      % expected type  nat
  default_root_deg_TCC1: OBLIGATION
    FORALL (p: [nat -> [nat -> real]], n: [nat -> nat], g: [nat -> real],
            k: nat, y: real):
      NOT polynomial(g, k)(y) = 0 IMPLIES
       max(root_degree(p(0), n(0))(y) - 1, 0) >= 0;


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 325 0 332 999
body:
  % Subtype TCC generated (at line 112, column 61) for  m - 1
      % expected type  nat
  sturm_tarski_basic_TCC1: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]], x, y, z: real):
      (constructed_sturm_sequence?(p, n, g, k, m) AND
        (FORALL (j: below(m)): only_root_between?(p(j), n(j), x, y)(z)))
       IMPLIES m - 1 >= 0;


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 334 0 342 999
body:
  % Subtype TCC generated (at line 121, column 8) for  0
      % expected type  below(K)
  constructed_sturm_roots_between_enum_TCC1: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]], x, y: real):
      constructed_sturm_sequence?(p, n, g, k, m) AND x < y IMPLIES
       (FORALL ((K: nat | K >= 2), enum: [below(K) -> real]):
          (FORALL (i, j: below(K)): i < j IMPLIES enum(i) < enum(j)) IMPLIES
           0 < K);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 344 0 353 999
body:
  % Subtype TCC generated (at line 121, column 22) for  K - 1
      % expected type  below(K)
  constructed_sturm_roots_between_enum_TCC2: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]], x, y: real):
      constructed_sturm_sequence?(p, n, g, k, m) AND x < y IMPLIES
       (FORALL ((K: nat | K >= 2), enum: [below(K) -> real]):
          enum(0) = x AND
           (FORALL (i, j: below(K)): i < j IMPLIES enum(i) < enum(j))
           IMPLIES K - 1 >= 0 AND K - 1 < K);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 355 0 368 999
body:
  % Subtype TCC generated (at line 127, column 23) for
      % {r: real |
      %    polynomial(a, m)(r) = 0 AND
      %     rel(polynomial(g, k)(r), 0) AND
      %      (bbelow IMPLIES x <= r) AND (babove IMPLIES r <= y)}
      % expected type  finite_set[real]
  Sol_TCC1: OBLIGATION
    FORALL (a: [nat -> real], (m: nat | a(m) /= 0), g: [nat -> real], k: nat,
            rel: [[real, real] -> bool], x, y: real, bbelow, babove: bool):
      is_finite[real]
          ({r: real |
              polynomial(a, m)(r) = 0 AND
               rel(polynomial(g, k)(r), 0) AND
                (bbelow IMPLIES x <= r) AND (babove IMPLIES r <= y)});


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 370 0 396 999
body:
  % Subtype TCC generated (at line 137, column 26) for
      % card(Sol(a, m, g, k, rel, x, y, bbelow, babove))
      % expected type  {d: nat |
                     %          EXISTS (enumsol:
                     %                  [below(d) ->
                     %                   (Sol
                     %                    (a,
                     %                     m,
                     %                     g,
                     %                     k,
                     %                     rel,
                     %                     x,
                     %                     y,
                     %                     bbelow,
                     %                     babove))]):
                     %            bijective?(enumsol)}
  NSol_TCC1: OBLIGATION
    FORALL (a: [nat -> real], (m: nat | a(m) /= 0), g: [nat -> real], k: nat,
            rel: [[real, real] -> bool], x, y: real, bbelow, babove: bool):
      EXISTS (enumsol:
                [below(card[real]
                           (Sol(a, m, g, k, rel, x, y, bbelow, babove))) ->
                   (Sol(a, m, g, k, rel, x, y, bbelow, babove))]):
        bijective?
            [below(card(Sol(a, m, g, k, rel, x, y, bbelow, babove))),
             (Sol(a, m, g, k, rel, x, y, bbelow, babove))]
            (enumsol);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 398 0 408 999
body:
  % Subtype TCC generated (at line 149, column 94) for  m - 1
      % expected type  nat
  sturm_tarski_TCC1: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]], x, y: real):
      (FORALL (j: nat):
         j < m IMPLIES
          (polynomial(p(j), n(j))(x) /= 0 AND
            polynomial(p(j), n(j))(y) /= 0))
       AND constructed_sturm_sequence?(p, n, g, k, m) AND x < y
       IMPLIES m - 1 >= 0;


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 410 0 428 999
body:
  % Subtype TCC generated (at line 151, column 28) for  n(0)
      % expected type  {m: nat | p(0)(m) /= 0}
  sturm_tarski_TCC2: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]], x, y: real):
      (FORALL (j: nat):
         j < m IMPLIES
          (polynomial(p(j), n(j))(x) /= 0 AND
            polynomial(p(j), n(j))(y) /= 0))
       AND constructed_sturm_sequence?(p, n, g, k, m) AND x < y
       IMPLIES
       (FORALL (nsc: [real -> NSC]):
          (nsc =
            (LAMBDA (xyz: real):
               number_sign_changes(LAMBDA (i): polynomial(p(i), n(i))(xyz),
                                   m - 1)))
           IMPLIES
           (FORALL (Nroots: int):
              Nroots = nsc(x)`num - nsc(y)`num IMPLIES p(0)(n(0)) /= 0));


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 430 0 438 999
body:
  % Subtype TCC generated (at line 157, column 23) for
      % {r: real | polynomial(a, m)(r) = 0 AND rel(polynomial(g, k)(r), 0)}
      % expected type  finite_set[real]
  Sol_TCC2: OBLIGATION
    FORALL (a: [nat -> real], (m: nat | a(m) /= 0), g: [nat -> real], k: nat,
            rel: [[real, real] -> bool]):
      is_finite[real]
          ({r: real |
              polynomial(a, m)(r) = 0 AND rel(polynomial(g, k)(r), 0)});


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 440 0 454 999
body:
  % Subtype TCC generated (at line 162, column 26) for
      % card(Sol(a, m, g, k, rel))
      % expected type  {d: nat |
                     %          EXISTS (enumsol:
                     %                  [below(d) ->
                     %                   (Sol(a, m, g, k, rel))]):
                     %            bijective?(enumsol)}
  NSol_TCC2: OBLIGATION
    FORALL (a: [nat -> real], (m: nat | a(m) /= 0), g: [nat -> real], k: nat,
            rel: [[real, real] -> bool]):
      EXISTS (enumsol:
                [below(card[real](Sol(a, m, g, k, rel))) ->
                   (Sol(a, m, g, k, rel))]):
        bijective?[below(card(Sol(a, m, g, k, rel))), (Sol(a, m, g, k, rel))]
            (enumsol);


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 456 0 461 999
body:
  % Subtype TCC generated (at line 166, column 63) for  m - 1
      % expected type  nat
  sturm_tarski_unbounded_TCC1: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]]):
      constructed_sturm_sequence?(p, n, g, k, m) IMPLIES m - 1 >= 0;


decl_type: tcc
theory: sturmtarski
library: Tarski
signature: nil
location: 463 0 481 999
body:
  % Subtype TCC generated (at line 169, column 28) for  n(0)
      % expected type  {m: nat | p(0)(m) /= 0}
  sturm_tarski_unbounded_TCC2: OBLIGATION
    FORALL (g: [nat -> real], k: nat, m: posnat, n: [nat -> nat],
            p: [nat -> [nat -> real]]):
      constructed_sturm_sequence?(p, n, g, k, m) IMPLIES
       (FORALL (nschigh: NSC):
          nschigh = number_sign_changes(LAMBDA (i): p(i)(n(i)), m - 1)
           IMPLIES
           (FORALL (nsclow: NSC):
              nsclow =
               number_sign_changes(LAMBDA (i):
                                     (IF even?(n(i)) THEN 1 ELSE -1 ENDIF) *
                                      p(i)(n(i)),
                                   m - 1)
               IMPLIES
               (FORALL (Nroots: int):
                  Nroots = nsclow`num - nschigh`num IMPLIES
                   p(0)(n(0)) /= 0)));


decl_type: formula
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 33 2 42 68
body:
    computed_sturm_spec: LEMMA a(n)/=0 AND g(k)/=0 AND
      (FORALL (i:nat): i>n IMPLIES a(i)=0) IMPLIES
      LET sl = remainder_seq(a,n,der_prod(a,n,g,k),n-1+k),
          P: [nat->[nat->int]] = (LAMBDA (j:nat): IF j<length(sl) 
                                    THEN list2array[int](0)(nth(sl,length(sl)-1-j))
                                   ELSE (LAMBDA (i:nat): 0) ENDIF),
          N: [nat->nat] = (LAMBDA (j:nat): IF j<length(sl) 
                             THEN max(length(nth(sl,length(sl)-1-j))-1,0) ELSE 0 ENDIF),
          M: nat = length(sl)-1
      IN  constructed_sturm_sequence?(P,N,g,k,M) AND P(0)=a AND N(0)=n


decl_type: formula
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 80 2 83 29
body:
    TQ_eq_g: LEMMA a(n)/=0 AND g1(k)/=0 AND g2(k)/=0 AND
      (FORALL (i:upto(k)): g1(i)=g2(i))
      IMPLIES
      TQ(a,n,g1,k)=TQ(a,n,g2,k)


decl_type: function
theory: compute_sturm_tarski
library: Tarski
location: 44 2 46 84
signature:
  [[a: [nat -> int], {n | a(n) /= 0}, g: [nat -> int],
         {k | g(k) /= 0}] ->
          [list[list[int]] -> bool]]

body:
    Eq_computed_remainder?(a,(n|a(n)/=0),g,(k|g(k)/=0))(sl:list[list[int]]): bool =
      sl = remainder_seq((LAMBDA (i:nat): IF i<=n THEN a(i) ELSE 0 ENDIF),
             n,der_prod((LAMBDA (i:nat): IF i<=n THEN a(i) ELSE 0 ENDIF),n,g,k),n-1+k)


decl_type: function
theory: compute_sturm_tarski
library: Tarski
location: 54 2 68 13
signature:
  [[a: [nat -> int], n: {n | a(n) /= 0}, g: [nat -> int],
         k: {k | g(k) /= 0}, (Eq_computed_remainder?(a, n, g, k))] ->
          int]

body:
    compute_TQ_param(a,(n|a(n)/=0),g,(k|g(k)/=0),
                     sl:(Eq_computed_remainder?(a,n,g,k))): 
      int =
      LET P: [nat->[nat->int]] = (LAMBDA (j:nat): IF j<length(sl) 
                                    THEN list2array[int](0)(nth(sl,length(sl)-1-j))
                                   ELSE (LAMBDA (i:nat): 0) ENDIF),
          N: [nat->nat] = (LAMBDA (j:nat): IF j<length(sl) 
                             THEN max(length(nth(sl,length(sl)-1-j))-1,0) ELSE 0 ENDIF),
          M: nat     = length(sl)-1,
          nschighlow = LAMBDA (b:bool): IF b THEN 
            number_sign_changes(LAMBDA (i:nat): P(i)(N(i)),M-1)
            ELSE number_sign_changes(LAMBDA (i:nat): 
              (IF even?(N(i)) THEN 1 ELSE -1 ENDIF)*P(i)(N(i)),M-1) ENDIF,
          Nroots     = nschighlow(FALSE)`num-nschighlow(TRUE)`num
      IN Nroots


decl_type: function
theory: compute_sturm_tarski
library: Tarski
signature:
  [[a: [nat -> int], {n | a(n) /= 0}, g: [nat -> int],
  {k | g(k) /= 0}] ->
  int]

location: 70 2 74 38
body:
    TQ(a,(n|a(n)/=0),g,(k|g(k)/=0)): int =
      LET newa = (LAMBDA (i:nat): IF i<=n THEN a(i) ELSE 0 ENDIF),
          sl = remainder_seq(newa,n,
            der_prod(newa,n,g,k),n-1+k)
      IN compute_TQ_param(newa,n,g,k,sl)


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 90 0 92 999
body:
  % Subtype TCC generated (at line 19, column 38) for  n - 1
      % expected type  nat
  der_prod_TCC1: OBLIGATION FORALL (n: posnat): n - 1 >= 0;


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 94 0 100 999
body:
  % Subtype TCC generated (at line 19, column 4) for
      % polynomial_prod(g, k, poly_deriv(a), n - 1)(i)
      % expected type  int
  der_prod_TCC2: OBLIGATION
    FORALL (a: [nat -> int], n: posnat, g: [nat -> int], k: nat, i: nat):
      rational_pred(polynomial_prod(g, k, poly_deriv(a), n - 1)(i)) AND
       integer_pred(polynomial_prod(g, k, poly_deriv(a), n - 1)(i));


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 102 0 107 999
body:
  % Subtype TCC generated (at line 35, column 49) for  n - 1 + k
      % expected type  {m | der_prod(a, n, g, k)(m) /= 0}
  computed_sturm_spec_TCC1: OBLIGATION
    FORALL (a, g: [nat -> int], k: nat, n: posnat):
      (FORALL (i: nat): i > n IMPLIES a(i) = 0) AND g(k) /= 0 AND a(n) /= 0
       IMPLIES n - 1 + k >= 0 AND der_prod(a, n, g, k)(n - 1 + k) /= 0;


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 109 0 127 999
body:
  % Subtype TCC generated (at line 37, column 47) for  length(sl) - 1 - j
      % expected type  below[length[list[int]](sl)]
  computed_sturm_spec_TCC2: OBLIGATION
    FORALL (a, g: [nat -> int], k: nat, n: posnat):
      (FORALL (i: nat): i > n IMPLIES a(i) = 0) AND g(k) /= 0 AND a(n) /= 0
       IMPLIES
       (FORALL (sl:
                  {crem:
                     (is_neg_remainder_list?(a,
                                             n,
                                             der_prod(a, n, g, k),
                                             n - 1 + k)) |
                           length[list[int]](crem) > 1 AND
                            length[int](nth[list[int]](crem, 0)) = 0}):
          sl = remainder_seq(a, n, der_prod(a, n, g, k), n - 1 + k) IMPLIES
           (FORALL (j: nat):
              j < length(sl) IMPLIES
               length[list[int]](sl) - 1 - j >= 0 AND
                length[list[int]](sl) - 1 - j < length[list[int]](sl)));


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 129 0 160 999
body:
  % Subtype TCC generated (at line 40, column 25) for
      % max(length(nth(sl, length(sl) - 1 - j)) - 1, 0)
      % expected type  nat
  computed_sturm_spec_TCC3: OBLIGATION
    FORALL (a, g: [nat -> int], k: nat, n: posnat):
      (FORALL (i: nat): i > n IMPLIES a(i) = 0) AND g(k) /= 0 AND a(n) /= 0
       IMPLIES
       (FORALL (sl:
                  {crem:
                     (is_neg_remainder_list?(a,
                                             n,
                                             der_prod(a, n, g, k),
                                             n - 1 + k)) |
                           length[list[int]](crem) > 1 AND
                            length[int](nth[list[int]](crem, 0)) = 0}):
          sl = remainder_seq(a, n, der_prod(a, n, g, k), n - 1 + k) IMPLIES
           (FORALL (P: [nat -> [nat -> int]]):
              (P =
                (LAMBDA (j: nat):
                   IF j < length(sl)
                     THEN list2array[int](0)(nth(sl, length(sl) - 1 - j))
                   ELSE (LAMBDA (i: nat): 0)
                   ENDIF))
               IMPLIES
               (FORALL (j1: nat):
                  j1 < length(sl) IMPLIES
                   max(length[int]
                           (nth[list[int]]
                                (sl, length[list[int]](sl) - 1 - j1))
                        - 1,
                       0)
                    >= 0)));


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 162 0 192 999
body:
  % Subtype TCC generated (at line 41, column 10) for  length(sl) - 1
      % expected type  nat
  computed_sturm_spec_TCC4: OBLIGATION
    FORALL (a, g: [nat -> int], k: nat, n: posnat):
      (FORALL (i: nat): i > n IMPLIES a(i) = 0) AND g(k) /= 0 AND a(n) /= 0
       IMPLIES
       (FORALL (sl:
                  {crem:
                     (is_neg_remainder_list?(a,
                                             n,
                                             der_prod(a, n, g, k),
                                             n - 1 + k)) |
                           length[list[int]](crem) > 1 AND
                            length[int](nth[list[int]](crem, 0)) = 0}):
          sl = remainder_seq(a, n, der_prod(a, n, g, k), n - 1 + k) IMPLIES
           (FORALL (P: [nat -> [nat -> int]]):
              (P =
                (LAMBDA (j: nat):
                   IF j < length(sl)
                     THEN list2array[int](0)(nth(sl, length(sl) - 1 - j))
                   ELSE (LAMBDA (i: nat): 0)
                   ENDIF))
               IMPLIES
               (FORALL (N: [nat -> nat]):
                  (N =
                    (LAMBDA (j: nat):
                       IF j < length(sl)
                         THEN max(length(nth(sl, length(sl) - 1 - j)) - 1, 0)
                       ELSE 0
                       ENDIF))
                   IMPLIES length[list[int]](sl) - 1 >= 0)));


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 194 0 225 999
body:
  % Subtype TCC generated (at line 42, column 44) for  M
      % expected type  posnat
  computed_sturm_spec_TCC5: OBLIGATION
    FORALL (a, g: [nat -> int], k: nat, n: posnat):
      (FORALL (i: nat): i > n IMPLIES a(i) = 0) AND g(k) /= 0 AND a(n) /= 0
       IMPLIES
       (FORALL (sl:
                  {crem:
                     (is_neg_remainder_list?(a,
                                             n,
                                             der_prod(a, n, g, k),
                                             n - 1 + k)) |
                           length[list[int]](crem) > 1 AND
                            length[int](nth[list[int]](crem, 0)) = 0}):
          sl = remainder_seq(a, n, der_prod(a, n, g, k), n - 1 + k) IMPLIES
           (FORALL (P: [nat -> [nat -> int]]):
              (P =
                (LAMBDA (j: nat):
                   IF j < length(sl)
                     THEN list2array[int](0)(nth(sl, length(sl) - 1 - j))
                   ELSE (LAMBDA (i: nat): 0)
                   ENDIF))
               IMPLIES
               (FORALL (N: [nat -> nat]):
                  (N =
                    (LAMBDA (j: nat):
                       IF j < length(sl)
                         THEN max(length(nth(sl, length(sl) - 1 - j)) - 1, 0)
                       ELSE 0
                       ENDIF))
                   IMPLIES
                   (FORALL (M: nat): M = length(sl) - 1 IMPLIES M > 0))));


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 227 0 232 999
body:
  % Subtype TCC generated (at line 46, column 11) for  n
      % expected type  {n_1 | IF n_1 <= n THEN a(n_1) ELSE 0 ENDIF /= 0}
  Eq_computed_remainder?_TCC1: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
      IF n <= n THEN a(n) ELSE 0 ENDIF /= 0;


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 234 0 250 999
body:
  % Subtype TCC generated (at line 46, column 78) for  n - 1 + k
      % expected type  {m |
                     %          der_prod((LAMBDA
                     %                    (i: nat):
                     %                    IF i <= n THEN a(i) ELSE 0 ENDIF),
                     %                   n,
                     %                   g,
                     %                   k)
                     %                  (m)
                     %           /= 0}
  Eq_computed_remainder?_TCC2: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
      n - 1 + k >= 0 AND
       der_prod(LAMBDA (i: nat): IF i <= n THEN a(i) ELSE 0 ENDIF, n, g, k)
               (n - 1 + k)
        /= 0;


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 252 0 260 999
body:
  % Subtype TCC generated (at line 58, column 58) for  length(sl) - 1 - j
      % expected type  below[length[list[int]](sl)]
  compute_TQ_param_TCC1: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), sl: (Eq_computed_remainder?(a, n, g, k)),
            j: nat):
      j < length(sl) IMPLIES
       length[list[int]](sl) - 1 - j >= 0 AND
        length[list[int]](sl) - 1 - j < length[list[int]](sl);


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 262 0 282 999
body:
  % Subtype TCC generated (at line 61, column 25) for
      % max(length(nth(sl, length(sl) - 1 - j)) - 1, 0)
      % expected type  nat
  compute_TQ_param_TCC2: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), sl: (Eq_computed_remainder?(a, n, g, k)),
            P: [nat -> [nat -> int]]):
      (P =
        (LAMBDA (j: nat):
           IF j < length(sl)
             THEN list2array[int](0)(nth(sl, length(sl) - 1 - j))
           ELSE (LAMBDA (i: nat): 0)
           ENDIF))
       IMPLIES
       (FORALL (j1: nat):
          j1 < length(sl) IMPLIES
           max(length[int]
                   (nth[list[int]](sl, length[list[int]](sl) - 1 - j1))
                - 1,
               0)
            >= 0);


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 284 0 304 999
body:
  % Subtype TCC generated (at line 62, column 14) for  length(sl) - 1
      % expected type  nat
  compute_TQ_param_TCC3: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), sl: (Eq_computed_remainder?(a, n, g, k)),
            P: [nat -> [nat -> int]]):
      (P =
        (LAMBDA (j: nat):
           IF j < length(sl)
             THEN list2array[int](0)(nth(sl, length(sl) - 1 - j))
           ELSE (LAMBDA (i: nat): 0)
           ENDIF))
       IMPLIES
       (FORALL (N: [nat -> nat]):
          (N =
            (LAMBDA (j: nat):
               IF j < length(sl)
                 THEN max(length(nth(sl, length(sl) - 1 - j)) - 1, 0)
               ELSE 0
               ENDIF))
           IMPLIES length[list[int]](sl) - 1 >= 0);


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 306 0 329 999
body:
  % Subtype TCC generated (at line 64, column 50) for  M - 1
      % expected type  nat
  compute_TQ_param_TCC4: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), sl: (Eq_computed_remainder?(a, n, g, k)),
            P: [nat -> [nat -> int]]):
      (P =
        (LAMBDA (j: nat):
           IF j < length(sl)
             THEN list2array[int](0)(nth(sl, length(sl) - 1 - j))
           ELSE (LAMBDA (i: nat): 0)
           ENDIF))
       IMPLIES
       (FORALL (N: [nat -> nat]):
          (N =
            (LAMBDA (j: nat):
               IF j < length(sl)
                 THEN max(length(nth(sl, length(sl) - 1 - j)) - 1, 0)
               ELSE 0
               ENDIF))
           IMPLIES
           (FORALL (M: nat):
              M = length(sl) - 1 IMPLIES
               (FORALL (b: bool): b IMPLIES M - 1 >= 0)));


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 331 0 354 999
body:
  % Subtype TCC generated (at line 66, column 54) for  M - 1
      % expected type  nat
  compute_TQ_param_TCC5: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), sl: (Eq_computed_remainder?(a, n, g, k)),
            P: [nat -> [nat -> int]]):
      (P =
        (LAMBDA (j: nat):
           IF j < length(sl)
             THEN list2array[int](0)(nth(sl, length(sl) - 1 - j))
           ELSE (LAMBDA (i: nat): 0)
           ENDIF))
       IMPLIES
       (FORALL (N: [nat -> nat]):
          (N =
            (LAMBDA (j: nat):
               IF j < length(sl)
                 THEN max(length(nth(sl, length(sl) - 1 - j)) - 1, 0)
               ELSE 0
               ENDIF))
           IMPLIES
           (FORALL (M: nat):
              M = length(sl) - 1 IMPLIES
               (FORALL (b: bool): NOT b IMPLIES M - 1 >= 0)));


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 356 0 362 999
body:
  % Subtype TCC generated (at line 72, column 29) for  n
      % expected type  {n | newa(n) /= 0}
  TQ_TCC1: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), newa: [nat -> int]):
      (newa = (LAMBDA (i: nat): IF i <= n THEN a(i) ELSE 0 ENDIF)) IMPLIES
       newa(n) /= 0;


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 364 0 370 999
body:
  % Subtype TCC generated (at line 73, column 24) for  n - 1 + k
      % expected type  {m | der_prod(newa, n, g, k)(m) /= 0}
  TQ_TCC2: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), newa: [nat -> int]):
      (newa = (LAMBDA (i: nat): IF i <= n THEN a(i) ELSE 0 ENDIF)) IMPLIES
       n - 1 + k >= 0 AND der_prod(newa, n, g, k)(n - 1 + k) /= 0;


decl_type: tcc
theory: compute_sturm_tarski
library: Tarski
signature: nil
location: 372 0 387 999
body:
  % Subtype TCC generated (at line 74, column 35) for  sl
      % expected type  (Eq_computed_remainder?(newa, n, g, k))
  TQ_TCC3: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0), newa: [nat -> int]):
      (newa = (LAMBDA (i: nat): IF i <= n THEN a(i) ELSE 0 ENDIF)) IMPLIES
       (FORALL (sl:
                  {crem:
                     (is_neg_remainder_list?(newa,
                                             n,
                                             der_prod(newa, n, g, k),
                                             n - 1 + k)) |
                           length[list[int]](crem) > 1 AND
                            length[int](nth[list[int]](crem, 0)) = 0}):
          sl = remainder_seq(newa, n, der_prod(newa, n, g, k), n - 1 + k)
           IMPLIES Eq_computed_remainder?(newa, n, g, k)(sl));


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 28 2 29 92
body:
    polynomial_prod_int: LEMMA
      rational_pred(polynomial_prod(a,d,g,k)(i)) AND integer_pred(polynomial_prod(a,d,g,k)(i)) 


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 71 2 72 90
body:
    TQ_fam_def: LEMMA a(n)/=0 AND (FORALL (i:upto(k)):GF(i)(KF(i))/=0)
      IMPLIES TQ_fam(k,a,n,GF,KF,GP) = TQ(a,n,prod_polynomials(GF,KF,GP,k),sigma(0,k,KF*GP))


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 98 2 99 55
body:
    sign_prod_eq: LEMMA (FORALL (i:nat): i<=k IMPLIES RelF1(i)=RelF2(i))
      IMPLIES sign_prod(k,GP,RelF1)=sign_prod(k,GP,RelF2)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 103 2 105 101
body:
    sign_ext_prod_polynomials: LEMMA
      LET RelFF = (LAMBDA (i:nat): sign_ext(polynomial(GF(i),KF(i))(x)))
      IN sign_ext(polynomial(prod_polynomials(GF,KF,GP,k),sigma(0,k,KF*GP))(x)) = sign_prod(k,GP,RelFF)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 140 2 141 82
body:
    sig_seq_base_3_onto: LEMMA FORALL (RelF,k): EXISTS (i:below(3^(k+1))):
      sig_seq(base_3_seq(k,i)) = (LAMBDA (i:nat): IF i<=k THEN RelF(i) ELSE 0 ENDIF)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 143 2 144 78
body:
    sig_seq_base_3_onto_2: LEMMA FORALL (RelF,k): EXISTS (i:below(3^(k+1))):
      sig_seq(base_n(3,i)) = (LAMBDA (i:nat): IF i<=k THEN RelF(i) ELSE 0 ENDIF)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 146 2 147 82
body:
    sig_seq_base_6_onto: LEMMA FORALL (RelF,k): EXISTS (i:below(6^(k+1))): (FORALL (j:nat): base_6_seq(k,i)(j)<=2) AND
      sig_seq(base_6_seq(k,i)) = (LAMBDA (i:nat): IF i<=k THEN RelF(i) ELSE 0 ENDIF)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 149 2 150 78
body:
    sig_seq_base_6_onto_2: LEMMA FORALL (RelF,k): EXISTS (i:below(6^(k+1))): (FORALL (j:nat): base_n(6,i)(j)<=2) AND
      sig_seq(base_n(6,i)) = (LAMBDA (i:nat): IF i<=k THEN RelF(i) ELSE 0 ENDIF)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 154 2 155 36
body:
    base_3_seq_unique: LEMMA FORALL (i,j): i<3^(k+1) AND j<3^(k+1) AND i/=j IMPLIES
      base_3_seq(k,i)/=base_3_seq(k,j)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 157 2 158 28
body:
    base_n_3_seq_unique: LEMMA FORALL (i,j): i<3^(k+1) AND j<3^(k+1) AND i/=j IMPLIES
      base_n(3,i)/=base_n(3,j)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 165 2 167 42
body:
    union_upto_finite: LEMMA (FORALL (setseq:[nat->set[real]]):
      (FORALL (i:upto(k)): is_finite[real](setseq(i))) IMPLIES
      is_finite[real](union_upto(k,setseq)))


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 169 2 174 83
body:
    real_set_disj_union_cards: LEMMA FORALL (setseq:[nat->set[real]]):
      (FORALL (i:nat): is_finite[real](setseq(i))) AND 
      is_finite[real](union_upto(k,setseq)) AND
      (FORALL (i,j:nat): i/=j IMPLIES disjoint?[real](setseq(i),setseq(j)))
      IMPLIES
      card[real](union_upto(k,setseq)) = sigma(0,k,LAMBDA (i): card[real](setseq(i)))


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 176 2 182 45
body:
    mult_tarski_query_simple: LEMMA
      a(n)/=0 AND (FORALL (i:upto(k)):GF(i)(KF(i))/=0)
      IMPLIES
      TQ_fam(k,a,n,GF,KF,GP) =
      sigma(0,3^(k+1)-1,LAMBDA (i:nat):
        sign_prod(k,GP,sig_seq(base_n(3,i)))*
        NSol(k,a,n,GF,KF,sig_seq(base_n(3,i))))


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 211 1 217 7
body:
   splits_to_base3: LEMMA FORALL (n:posnat, k:nat, i:below(n)): 
       split_base6(n, k)(i) =   
           IF base_n(6,k)(i)<3 THEN (base_n(6,k)(i), 99)
           ELSIF base_n(6,k)(i) = 3  THEN (1,2)
           ELSIF base_n(6,k)(i) = 4  THEN (0,1)
           ELSE (0,2)
           ENDIF


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 227 2 232 57
body:
    mult_tarski_query_simple_6_0_to_3: LEMMA
      a(n)/=0 AND (FORALL (i:upto(k)):GF(i)(KF(i))/=0)
      IMPLIES
      TQ_fam(k,a,n,GF,KF,GP) =
      sigma(0,6^(k+1)-1,LAMBDA (i:nat):
        sign_prod_coeff6(k,GP,i)*NSol_seq6(k,a,n,GF,KF)(i))


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 244 2 247 39
body:
    sign_coeff6_zero_entry_eq: LEMMA
      base_n(6,i)(j) = base_n(6,d)(j) IMPLIES
      sign_coeff6_zero_entry(k,TQRow,i,j) =
      sign_coeff6_zero_entry(k,TQRow,d,j)


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 256 2 266 36
body:
    sigma_disjoinction_6: LEMMA
      FORALL (v:[nat->[nat,nat,nat,nat,nat,nat]]):
        (FORALL (j): j<=6^(k+1)-1 IMPLIES EXISTS (i): i<=6^k-1 AND in6?(v(i),j)) AND
        (FORALL (i): i<=6^k-1 IMPLIES
          (v(i)`1 < v(i)`2 AND v(i)`2 < v(i)`3 AND v(i)`3 < v(i)`4 
            AND v(i)`4 < v(i)`5 AND v(i)`5 < v(i)`6 AND v(i)`6<=6^(k+1)-1)) AND
        (FORALL (i,d,j): i<=6^k-1 AND d<=6^k-1 AND j<=6^(k+1)-1 AND in6?(v(i),j) AND in6?(v(d),j)
                IMPLIES i = d) AND
        (FORALL (i): i<=6^k-1 IMPLIES
          (g(v(i)`1)+g(v(i)`2)+g(v(i)`3)+g(v(i)`4)+g(v(i)`5)+g(v(i)`6)) = 0)
        IMPLIES sigma(0,6^(k+1)-1,g)=0


decl_type: formula
theory: poly_families
library: Tarski
signature: nil
location: 268 2 273 70
body:
    mult_tarski_query_simple_6_above_2: LEMMA
      a(n)/=0 AND (FORALL (i:upto(k)):GF(i)(KF(i))/=0) AND
      (EXISTS (i:upto(k)): TQRow(i)>2)
      IMPLIES
      sigma(0,6^(k+1)-1,LAMBDA (i:nat):
        sign_coeff6_zero(k,TQRow,i)*NSol_all(k,a,n,GF,KF,base_n(6,i)))=0


decl_type: function
theory: poly_families
library: Tarski
location: 31 2 46 15
signature:
  [d:
          [[nat -> [nat -> int]], [nat -> nat], [nat -> subrange(0, 2)],
           nat] ->
          {a |
                   (FORALL (x):
                      polynomial(a, sigma(0, d`4, d`2 * d`3))(x) =
                       product(0, d`4,
                               LAMBDA (j):
                                 polynomial(d`1(j), d`2(j))(x) ^ d`3(j)))
                    AND
                    ((FORALL (i):
                        i <= d`4 AND d`3(i) /= 0 IMPLIES
                         d`1(i)(d`2(i)) /= 0)
                      IMPLIES a(sigma(0, d`4, d`2 * d`3)) /= 0)
                     AND
                     (FORALL (i):
                        i > sigma(0, d`4, d`2 * d`3) IMPLIES
                         a(i) = 0)}]

body:
    prod_polynomials(GF,KF,GP,k): RECURSIVE {a | 
      (FORALL (x): polynomial(a,sigma(0,k,KF*GP))(x) =
        product(0,k,LAMBDA (j): polynomial(GF(j),KF(j))(x)^GP(j))) AND
      ((FORALL (i): i<=k AND GP(i)/=0 IMPLIES GF(i)(KF(i))/=0) IMPLIES a(sigma(0,k,KF*GP))/=0) AND
      (FORALL (i): i>sigma(0,k,KF*GP) IMPLIES a(i)=0)}
      = LET  tpoly = (IF GP(k)=0 THEN poly1 ELSIF GP(k)=1 THEN 
                         (LAMBDA (i:nat): IF i<=KF(k) THEN GF(k)(i) ELSE 0 ENDIF)
                         ELSE polynomial_prod(GF(k),KF(k),GF(k),KF(k)) ENDIF),
             tdeg = IF GP(k)=0 THEN 0 ELSIF GP(k)=1 THEN KF(k) ELSE 2*KF(k) ENDIF,
             bpoly = (IF k = 0 THEN poly1 ELSE prod_polynomials(GF,KF,GP,k-1) ENDIF),
             bdeg = IF k = 0 THEN 0 ELSE sigma(0,k-1,KF*GP) ENDIF,
             anspoly = (IF k = 0 THEN tpoly 
                        ELSIF GP(k)=0 THEN prod_polynomials(GF,KF,GP,k-1)
                        ELSE polynomial_prod(bpoly,bdeg,tpoly,tdeg) ENDIF)
        IN anspoly
        MEASURE k


decl_type: function
theory: poly_families
library: Tarski
location: 48 2 63 15
signature:
  [d:
          [[nat -> [nat -> int]], [nat -> nat], [nat -> subrange(0, 2)],
           nat] ->
          {ll |
                   length(ll) - 1 = sigma(0, d`4, d`2 * d`3) AND
                    prod_polynomials(d`1, d`2, d`3, d`4) =
                     (LAMBDA (i):
                        IF i < length(ll) THEN nth(ll, i)
                        ELSE 0
                        ENDIF)}]

body:
    prod_polynomials_list(GF,KF,GP,k): RECURSIVE {ll | 
      length(ll)-1=sigma(0,k,KF*GP) AND prod_polynomials(GF,KF,GP,k) = 
        (LAMBDA (i): IF i<length(ll) THEN nth(ll,i) ELSE 0 ENDIF)}
      = LET  tpolyinit = (IF GP(k)=0 THEN poly1 ELSIF GP(k)=1 THEN GF(k)
                         ELSE polynomial_prod(GF(k),KF(k),GF(k),KF(k)) ENDIF),
             tdeg = IF GP(k)=0 THEN 0 ELSIF GP(k)=1 THEN KF(k) ELSE 2*KF(k) ENDIF,
             tpoly = array2list[int](tdeg+1)(tpolyinit),
             bpolyinit = (IF k = 0 THEN poly1 ELSE prod_polynomials(GF,KF,GP,k-1) ENDIF),
             bdeg = IF k = 0 THEN 0 ELSE sigma(0,k-1,KF*GP) ENDIF,
             bpoly = array2list[int](bdeg+1)(bpolyinit),
             anspoly = (IF k = 0 THEN tpoly 
                        ELSIF GP(k)=0 THEN prod_polynomials_list(GF,KF,GP,k-1)
                        ELSE array2list[int](tdeg+bdeg+1)(
                          polynomial_prod(bpolyinit,bdeg,tpolyinit,tdeg)) ENDIF)
        IN anspoly
        MEASURE k


decl_type: function
theory: poly_families
library: Tarski
location: 65 2 69 19
signature:
  [[k: nat, a: [nat -> int], {n | a(n) /= 0},
         GF: [nat -> [nat -> int]],
         {KF | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0},
         [nat -> subrange(0, 2)]] ->
          int]

body:
    TQ_fam(k,a,(n|a(n)/=0),GF,(KF|FORALL (i:upto(k)):GF(i)(KF(i))/=0),GP): int =
      LET ll = prod_polynomials_list(GF,KF,GP,k),
          d  = length[int](ll)-1,
          g  = (LAMBDA (i): IF i<=d THEN nth(ll,i) ELSE 0 ENDIF)
      IN  TQ(a,n,g,d)


decl_type: function
theory: poly_families
library: Tarski
location: 74 2 78 74
signature:
  [[nat, a: [nat -> int], {n | a(n) /= 0}, [nat -> [nat -> int]],
         [nat -> nat], [nat -> subrange(-1, 1)]] ->
          finite_set[real]]

body:
    Sol(k,a,(n|a(n)/=0),GF,KF,RelF):
      finite_set[real] = {r:real | polynomial(a,n)(r)=0 AND (FORALL (i): i<=k IMPLIES
                                   (IF RelF(i)=-1 THEN polynomial(GF(i),KF(i))(r)<0
                                    ELSIF RelF(i)=1 THEN polynomial(GF(i),KF(i))(r)>0
                                    ELSIF RelF(i)=0 THEN polynomial(GF(i),KF(i))(r)=0 ELSE TRUE ENDIF))}


decl_type: function
theory: poly_families
library: Tarski
location: 80 2 87 76
signature:
  [[nat, a: [nat -> int], {n | a(n) /= 0}, [nat -> [nat -> int]],
         [nat -> nat], [nat -> subrange(0, 5)]] ->
          finite_set[real]]

body:
    Sol_all(k,a,(n|a(n)/=0),GF,KF,RelF6):
      finite_set[real] = {r:real | polynomial(a,n)(r)=0 AND (FORALL (i): i<=k IMPLIES
                                   (IF RelF6(i)=0 THEN polynomial(GF(i),KF(i))(r)=0
                                    ELSIF RelF6(i)=1 THEN polynomial(GF(i),KF(i))(r)>0
                                    ELSIF RelF6(i)=2 THEN polynomial(GF(i),KF(i))(r)<0 
                                    ELSIF RelF6(i)=3 THEN polynomial(GF(i),KF(i))(r)/=0 
                                    ELSIF RelF6(i)=4 THEN polynomial(GF(i),KF(i))(r)>=0 
                                    ELSIF RelF6(i)=5 THEN polynomial(GF(i),KF(i))(r)<=0 ELSE TRUE ENDIF))}


decl_type: function
theory: poly_families
library: Tarski
location: 89 2 90 31
body:
  NSol(k,a,(n|a(n)/=0),GF,KF,RelF): nat =
  card(Sol(k,a,n,GF,KF,RelF))

signature:
  [[nat, a: [nat -> int], {n | a(n) /= 0}, [nat -> [nat -> int]],
         [nat -> nat], [nat -> subrange(-1, 1)]] ->
          nat]


decl_type: function
theory: poly_families
library: Tarski
location: 92 2 93 36
body:
  NSol_all(k,a,(n|a(n)/=0),GF,KF,RelF6): nat =
  card(Sol_all(k,a,n,GF,KF,RelF6))

signature:
  [[nat, a: [nat -> int], {n | a(n) /= 0}, [nat -> [nat -> int]],
         [nat -> nat], [nat -> subrange(0, 5)]] ->
          nat]


decl_type: function
theory: poly_families
library: Tarski
signature: [subrange(0, 2) -> subrange(-1, 1)]
location: 120 2 123 11
body:
    sig(ii:subrange(0,2)): subrange(-1,1) = IF ii=0 THEN 0 
        ELSIF ii=1 THEN 1
        ELSE -1
        ENDIF


decl_type: function
theory: poly_families
library: Tarski
location: 160 2 163 13
signature:
  [d: [nat, [nat -> set[real]]] ->
          {Aset: set[real] |
                   FORALL (x):
                     Aset(x) IFF (EXISTS (i: upto(d`1)): d`2(i)(x))}]

body:
    union_upto(k:nat,setseq:[nat->set[real]]): RECURSIVE {Aset:set[real]|
      FORALL (x): Aset(x) IFF EXISTS (i:upto(k)): setseq(i)(x)} =
      (IF k = 0 THEN setseq(0) ELSE union[real](union_upto(k-1,setseq),setseq(k)) ENDIF)
      MEASURE k


decl_type: function
theory: poly_families
library: Tarski
signature: [[[nat -> [nat, nat]], nat] -> [nat -> [nat, nat]]]
location: 187 1 192 12
body:
   split_index_fun_entry( F:[nat->[nat, nat]], i:nat): [nat->[nat, nat]] = 
         IF F(i)`1<3 THEN F
         ELSIF F(i)`1 = 3 THEN F WITH [i:=(1,2)] 
         ELSIF F(i)`1 = 4 THEN F WITH [i:=(0,1)]
         ELSE                  F WITH [i:=(0,2)]
         ENDIF


decl_type: function
theory: poly_families
library: Tarski
location: 194 1 200 15
signature:
  [d: [[nat -> [nat, nat]], nat] ->
          {G: [nat -> [nat, nat]] |
                   (FORALL (i: upto(d`2)):
                      G(i) = split_index_fun_entry(d`1, i)(i))
                    AND (FORALL (i: above(d`2)): G(i) = d`1(i))}]

body:
   split_index_fun(F:[nat->[nat, nat]], n:nat): RECURSIVE {G:[nat->[nat, nat]]|
     (FORALL (i:upto(n)): G(i) = split_index_fun_entry(F,i)(i)) AND
     (FORALL (i:above(n)): G(i) = F(i))} = 
        IF n = 0 THEN split_index_fun_entry(F, n) 
        ELSE split_index_fun(split_index_fun_entry(F,n), n-1)
        ENDIF
        MEASURE n


decl_type: function
theory: poly_families
library: Tarski
signature: [[nat, [nat -> subrange(0, 2)], nat] -> subrange(-1, 1)]
location: 219 2 221 51
body:
    sign_prod_coeff6(k,GP,i): subrange(-1,1) =
      IF i>=6^(k+1) OR (EXISTS (p:upto(k)): base_n(6,i)(p)>=3) THEN 0
      ELSE sign_prod(k,GP,sig_seq(base_n(6,i))) ENDIF


decl_type: function
theory: poly_families
library: Tarski
location: 223 2 225 53
signature:
  [[nat, a: [nat -> int], {n | a(n) /= 0}, [nat -> [nat -> int]],
         [nat -> nat]] ->
          [nat -> nat]]

body:
    NSol_seq6(k,a,(n|a(n)/=0),GF,KF)(i): nat =
      IF i>=6^(k+1) OR (EXISTS (p:upto(k)): base_n(6,i)(p)>=3) THEN 0
      ELSE NSol(k,a,n,GF,KF,sig_seq(base_n(6,i))) ENDIF


decl_type: function
theory: poly_families
library: Tarski
signature: [[nat, [nat -> subrange(0, 5)], nat, nat] -> subrange(-1, 1)]
location: 234 2 242 18
body:
    sign_coeff6_zero_entry(k,TQRow,i,j): subrange(-1,1) =
      LET bij = base_n(6,i)(j) IN
        IF TQRow(j)=0 THEN (IF bij>=3 THEN 0 ELSE 1 ENDIF)
        ELSIF TQRow(j)=1 THEN (IF bij=1 THEN 1 ELSIF bij=2 THEN -1 ELSE 0 ENDIF)
        ELSIF TQRow(j)=2 THEN (IF 1<=bij AND bij<=2 THEN 1 ELSE 0 ENDIF)
        ELSIF TQRow(j)=3 THEN (IF 1<=bij AND bij<=2 THEN -1 ELSIF bij=3 THEN 1 ELSE 0 ENDIF)
        ELSIF TQRow(j)=4 THEN (IF bij<=1 THEN -1 ELSIF bij=4 THEN 1 ELSE 0 ENDIF)
        ELSIF TQRow(j)=5 THEN (IF bij=0 OR bij=2 THEN -1 ELSIF bij=5 THEN 1 ELSE 0 ENDIF)
        ELSE 0 ENDIF


decl_type: function
theory: poly_families
library: Tarski
signature: [[nat, [nat -> subrange(0, 5)], nat] -> subrange(-1, 1)]
location: 249 2 251 79
body:
    sign_coeff6_zero(k,TQRow,i): subrange(-1,1) =
      IF i>=6^(k+1) THEN 0
      ELSE product[nat](0,k,LAMBDA (j):sign_coeff6_zero_entry(k,TQRow,i,j)) ENDIF


decl_type: function
theory: poly_families
library: Tarski
signature: [[[nat, nat, nat, nat, nat, nat], nat] -> bool]
location: 253 2 254 62
body:
    in6?(vk:[nat,nat,nat,nat,nat,nat],j): bool =
      (j=vk`1 OR j=vk`2 OR j=vk`3 OR j=vk`4 OR j=vk`5 OR j=vk`6)


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 282 0 285 999
body:
  % Subtype TCC generated (at line 32, column 38) for  k
      % expected type  T_high[nat]
  prod_polynomials_TCC1: OBLIGATION
    FORALL (k): k >= 0 OR (EXISTS (j: nat): k <= j);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 287 0 293 999
body:
  % Subtype TCC generated (at line 32, column 30) for  sigma(0, k, KF * GP)
      % expected type  nat
  prod_polynomials_TCC2: OBLIGATION
    FORALL (GP, KF, k):
      rational_pred(sigma[nat](0, k, *[nat](KF, GP))) AND
       integer_pred(sigma[nat](0, k, *[nat](KF, GP))) AND
        sigma[nat](0, k, *[nat](KF, GP)) >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 295 0 299 999
body:
  % Subtype TCC generated (at line 33, column 57) for  GP(j)
      % expected type  {i: int | polynomial(GF(j), KF(j))(x) /= 0 OR i >= 0}
  prod_polynomials_TCC3: OBLIGATION
    FORALL (GF, GP, KF, x: real, j: nat):
      polynomial(GF(j), KF(j))(x) /= 0 OR GP(j) >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 301 0 304 999
body:
  % Assuming TCC generated (at line 11, column 28) for  reals@product[nat]
      % generated from assumption product.connected_domain
  prod_polynomials_TCC4: OBLIGATION
    (FORALL (x, y: nat), (z: integer): x <= z AND z <= y IMPLIES z >= 0);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 306 0 325 999
body:
  % Subtype TCC generated (at line 40, column 64) for  k - 1
      % expected type  nat
  prod_polynomials_TCC5: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpoly: [nat -> real]):
      tpoly =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1
          THEN LAMBDA (i: nat): IF i <= KF(k) THEN GF(k)(i) ELSE 0 ENDIF
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          NOT k = 0 AND
           tdeg =
            IF GP(k) = 0 THEN 0
            ELSIF GP(k) = 1 THEN KF(k)
            ELSE 2 * KF(k)
            ENDIF
           IMPLIES k - 1 >= 0);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 327 0 346 999
body:
  % Termination TCC generated (at line 40, column 38) for
      % prod_polynomials(GF, KF, GP, k - 1)
  prod_polynomials_TCC6: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpoly: [nat -> real]):
      tpoly =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1
          THEN LAMBDA (i: nat): IF i <= KF(k) THEN GF(k)(i) ELSE 0 ENDIF
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          NOT k = 0 AND
           tdeg =
            IF GP(k) = 0 THEN 0
            ELSIF GP(k) = 1 THEN KF(k)
            ELSE 2 * KF(k)
            ENDIF
           IMPLIES k - 1 < k);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 348 0 403 999
body:
  % Subtype TCC generated (at line 44, column 35) for  bdeg
      % expected type  nat
  prod_polynomials_TCC7: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat,
            v:
              [d1:
                 {z:
                    [[nat -> [nat -> int]], [nat -> nat],
                     [nat -> subrange(0, 2)], nat] |
                          z`4 < k} ->
                 {a |
                          (FORALL (x):
                             polynomial(a, sigma(0, d1`4, d1`2 * d1`3))(x) =
                              product(0,
                                      d1`4,
                                      LAMBDA
                                      (j):
                                      polynomial(d1`1(j), d1`2(j))(x)
                                      ^
                                      d1`3(j)))
                           AND
                           ((FORALL (i):
                               i <= d1`4 AND d1`3(i) /= 0 IMPLIES
                                d1`1(i)(d1`2(i)) /= 0)
                             IMPLIES a(sigma(0, d1`4, d1`2 * d1`3)) /= 0)
                            AND
                            (FORALL (i):
                               i > sigma(0, d1`4, d1`2 * d1`3) IMPLIES
                                a(i) = 0)}],
            tpoly: [nat -> real]):
      tpoly =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1
          THEN LAMBDA (i: nat): IF i <= KF(k) THEN GF(k)(i) ELSE 0 ENDIF
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (bpoly: [nat -> int]):
              bpoly = (IF k = 0 THEN poly1 ELSE v(GF, KF, GP, k - 1) ENDIF)
               IMPLIES
               (FORALL (bdeg: real):
                  NOT GP(k) = 0 AND
                   NOT k = 0 AND
                    bdeg =
                     IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                   IMPLIES
                   rational_pred(bdeg) AND
                    integer_pred(bdeg) AND bdeg >= 0)));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 405 0 502 999
body:
  % Subtype TCC generated (at line 45, column 9) for  anspoly
      % expected type  {a |
                     %          (FORALL (x):
                     %             polynomial(a, sigma(0, k, KF * GP))(x) =
                     %              product(0,
                     %                      k,
                     %                      LAMBDA
                     %                      (j):
                     %                      polynomial(GF(j), KF(j))(x)
                     %                      ^
                     %                      GP(j)))
                     %           AND
                     %           ((FORALL (i):
                     %               i <= k AND GP(i) /= 0 IMPLIES
                     %                GF(i)(KF(i)) /= 0)
                     %             IMPLIES a(sigma(0, k, KF * GP)) /= 0)
                     %            AND
                     %            (FORALL (i):
                     %               i > sigma(0, k, KF * GP) IMPLIES
                     %                a(i) = 0)}
  prod_polynomials_TCC8: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat,
            v:
              [d1:
                 {z:
                    [[nat -> [nat -> int]], [nat -> nat],
                     [nat -> subrange(0, 2)], nat] |
                          z`4 < k} ->
                 {a |
                          (FORALL (x):
                             polynomial(a, sigma(0, d1`4, d1`2 * d1`3))(x) =
                              product(0,
                                      d1`4,
                                      LAMBDA
                                      (j):
                                      polynomial(d1`1(j), d1`2(j))(x)
                                      ^
                                      d1`3(j)))
                           AND
                           ((FORALL (i):
                               i <= d1`4 AND d1`3(i) /= 0 IMPLIES
                                d1`1(i)(d1`2(i)) /= 0)
                             IMPLIES a(sigma(0, d1`4, d1`2 * d1`3)) /= 0)
                            AND
                            (FORALL (i):
                               i > sigma(0, d1`4, d1`2 * d1`3) IMPLIES
                                a(i) = 0)}],
            tpoly: [nat -> real]):
      tpoly =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1
          THEN LAMBDA (i: nat): IF i <= KF(k) THEN GF(k)(i) ELSE 0 ENDIF
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (bpoly: [nat -> int]):
              bpoly = (IF k = 0 THEN poly1 ELSE v(GF, KF, GP, k - 1) ENDIF)
               IMPLIES
               (FORALL (bdeg: real):
                  bdeg = IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                   IMPLIES
                   (FORALL (anspoly: [nat -> real]):
                      anspoly =
                       (IF k = 0 THEN tpoly
                        ELSIF GP(k) = 0 THEN v(GF, KF, GP, k - 1)
                        ELSE polynomial_prod(bpoly, bdeg, tpoly, tdeg)
                        ENDIF)
                       IMPLIES
                       (FORALL (x1: nat):
                          rational_pred(anspoly(x1)) AND
                           integer_pred(anspoly(x1)))
                        AND
                        (FORALL (x):
                           polynomial(anspoly,
                                      sigma[nat](0, k, *[nat](KF, GP)))
                                     (x)
                            =
                            product[nat]
                                (0, k,
                                 LAMBDA (j):
                                   polynomial(GF(j), KF(j))(x) ^ GP(j)))
                         AND
                         ((FORALL (i):
                             i <= k AND GP(i) /= 0 IMPLIES GF(i)(KF(i)) /= 0)
                           IMPLIES
                           anspoly(sigma[nat](0, k, *[nat](KF, GP))) /= 0)
                          AND
                          (FORALL (i):
                             i > sigma[nat](0, k, *[nat](KF, GP)) IMPLIES
                              anspoly(i) = 0)))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 504 0 523 999
body:
  % Subtype TCC generated (at line 54, column 36) for  tpolyinit
      % expected type  a: [nat -> int]
  prod_polynomials_list_TCC1: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (x1: nat):
              rational_pred(tpolyinit(x1)) AND integer_pred(tpolyinit(x1))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 525 0 548 999
body:
  % Subtype TCC generated (at line 55, column 68) for  k - 1
      % expected type  nat
  prod_polynomials_list_TCC2: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (tpoly:
                      {l: listn[int](1 + tdeg) |
                               FORALL (i: below(1 + tdeg)):
                                 tpolyinit(i) = nth[int](l, i)}):
              NOT k = 0 AND tpoly = array2list[int](tdeg + 1)(tpolyinit)
               IMPLIES k - 1 >= 0));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 550 0 584 999
body:
  % Subtype TCC generated (at line 57, column 28) for  bdeg + 1
      % expected type  n: nat
  prod_polynomials_list_TCC3: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (tpoly:
                      {l: listn[int](1 + tdeg) |
                               FORALL (i: below(1 + tdeg)):
                                 tpolyinit(i) = nth[int](l, i)}):
              tpoly = array2list[int](tdeg + 1)(tpolyinit) IMPLIES
               (FORALL (bpolyinit: [nat -> int]):
                  bpolyinit =
                   (IF k = 0 THEN poly1
                    ELSE prod_polynomials(GF, KF, GP, k - 1)
                    ENDIF)
                   IMPLIES
                   (FORALL (bdeg: real):
                      bdeg =
                       IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                       IMPLIES
                       rational_pred(bdeg + 1) AND
                        integer_pred(bdeg + 1) AND bdeg + 1 >= 0))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 586 0 627 999
body:
  % Termination TCC generated (at line 59, column 30) for
      % prod_polynomials_list(GF, KF, GP, k - 1)
  prod_polynomials_list_TCC4: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (tpoly:
                      {l: listn[int](1 + tdeg) |
                               FORALL (i: below(1 + tdeg)):
                                 tpolyinit(i) = nth[int](l, i)}):
              tpoly = array2list[int](tdeg + 1)(tpolyinit) IMPLIES
               (FORALL (bpolyinit: [nat -> int]):
                  bpolyinit =
                   (IF k = 0 THEN poly1
                    ELSE prod_polynomials(GF, KF, GP, k - 1)
                    ENDIF)
                   IMPLIES
                   (FORALL (bdeg: real):
                      bdeg =
                       IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                       IMPLIES
                       (FORALL (bpoly:
                                  {l: listn[int](1 + bdeg) |
                                           FORALL
                                           (i: below(1 + bdeg)):
                                           bpolyinit(i) = nth[int](l, i)}):
                          GP(k) = 0 AND
                           NOT k = 0 AND
                            bpoly = array2list[int](bdeg + 1)(bpolyinit)
                           IMPLIES k - 1 < k)))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 629 0 672 999
body:
  % Subtype TCC generated (at line 61, column 36) for  bdeg
      % expected type  nat
  prod_polynomials_list_TCC5: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (tpoly:
                      {l: listn[int](1 + tdeg) |
                               FORALL (i: below(1 + tdeg)):
                                 tpolyinit(i) = nth[int](l, i)}):
              tpoly = array2list[int](tdeg + 1)(tpolyinit) IMPLIES
               (FORALL (bpolyinit: [nat -> int]):
                  bpolyinit =
                   (IF k = 0 THEN poly1
                    ELSE prod_polynomials(GF, KF, GP, k - 1)
                    ENDIF)
                   IMPLIES
                   (FORALL (bdeg: real):
                      bdeg =
                       IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                       IMPLIES
                       (FORALL (bpoly:
                                  {l: listn[int](1 + bdeg) |
                                           FORALL
                                           (i: below(1 + bdeg)):
                                           bpolyinit(i) = nth[int](l, i)}):
                          NOT GP(k) = 0 AND
                           NOT k = 0 AND
                            bpoly = array2list[int](bdeg + 1)(bpolyinit)
                           IMPLIES
                           rational_pred(bdeg) AND
                            integer_pred(bdeg) AND bdeg >= 0)))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 674 0 724 999
body:
  % Subtype TCC generated (at line 61, column 10) for
      % polynomial_prod(bpolyinit, bdeg, tpolyinit, tdeg)
      % expected type  a: [nat -> int]
  prod_polynomials_list_TCC6: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (tpoly:
                      {l: listn[int](1 + tdeg) |
                               FORALL (i: below(1 + tdeg)):
                                 tpolyinit(i) = nth[int](l, i)}):
              tpoly = array2list[int](tdeg + 1)(tpolyinit) IMPLIES
               (FORALL (bpolyinit: [nat -> int]):
                  bpolyinit =
                   (IF k = 0 THEN poly1
                    ELSE prod_polynomials(GF, KF, GP, k - 1)
                    ENDIF)
                   IMPLIES
                   (FORALL (bdeg: real):
                      bdeg =
                       IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                       IMPLIES
                       (FORALL (bpoly:
                                  {l: listn[int](1 + bdeg) |
                                           FORALL
                                           (i: below(1 + bdeg)):
                                           bpolyinit(i) = nth[int](l, i)}):
                          NOT GP(k) = 0 AND
                           NOT k = 0 AND
                            bpoly = array2list[int](bdeg + 1)(bpolyinit)
                           IMPLIES
                           (FORALL (x1: nat):
                              rational_pred(polynomial_prod
                                            (bpolyinit, bdeg, tpolyinit, tdeg)
                                            (x1))
                               AND
                               integer_pred(polynomial_prod
                                            (bpolyinit, bdeg, tpolyinit, tdeg)
                                            (x1))))))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 726 0 770 999
body:
  % Subtype TCC generated (at line 60, column 29) for  tdeg + bdeg + 1
      % expected type  n: nat
  prod_polynomials_list_TCC7: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat, tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (tpoly:
                      {l: listn[int](1 + tdeg) |
                               FORALL (i: below(1 + tdeg)):
                                 tpolyinit(i) = nth[int](l, i)}):
              tpoly = array2list[int](tdeg + 1)(tpolyinit) IMPLIES
               (FORALL (bpolyinit: [nat -> int]):
                  bpolyinit =
                   (IF k = 0 THEN poly1
                    ELSE prod_polynomials(GF, KF, GP, k - 1)
                    ENDIF)
                   IMPLIES
                   (FORALL (bdeg: real):
                      bdeg =
                       IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                       IMPLIES
                       (FORALL (bpoly:
                                  {l: listn[int](1 + bdeg) |
                                           FORALL
                                           (i: below(1 + bdeg)):
                                           bpolyinit(i) = nth[int](l, i)}):
                          NOT GP(k) = 0 AND
                           NOT k = 0 AND
                            bpoly = array2list[int](bdeg + 1)(bpolyinit)
                           IMPLIES
                           rational_pred(tdeg + bdeg + 1) AND
                            integer_pred(tdeg + bdeg + 1) AND
                             tdeg + bdeg + 1 >= 0)))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 772 0 850 999
body:
  % Subtype TCC generated (at line 62, column 9) for  anspoly
      % expected type  {ll |
                     %          length(ll) - 1 = sigma(0, k, KF * GP) AND
                     %           prod_polynomials(GF, KF, GP, k) =
                     %            (LAMBDA (i):
                     %               IF i < length(ll) THEN nth(ll, i)
                     %               ELSE 0
                     %               ENDIF)}
  prod_polynomials_list_TCC8: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            GP: [nat -> subrange(0, 2)], k: nat,
            v:
              [d1:
                 {z:
                    [[nat -> [nat -> int]], [nat -> nat],
                     [nat -> subrange(0, 2)], nat] |
                          z`4 < k} ->
                 {ll |
                          length(ll) - 1 = sigma(0, d1`4, d1`2 * d1`3) AND
                           prod_polynomials(d1`1, d1`2, d1`3, d1`4) =
                            (LAMBDA (i):
                               IF i < length(ll) THEN nth(ll, i)
                               ELSE 0
                               ENDIF)}],
            tpolyinit: [nat -> real]):
      tpolyinit =
       (IF GP(k) = 0 THEN poly1
        ELSIF GP(k) = 1 THEN GF(k)
        ELSE polynomial_prod(GF(k), KF(k), GF(k), KF(k))
        ENDIF)
       IMPLIES
       (FORALL (tdeg: naturalnumber):
          tdeg =
           IF GP(k) = 0 THEN 0
           ELSIF GP(k) = 1 THEN KF(k)
           ELSE 2 * KF(k)
           ENDIF
           IMPLIES
           (FORALL (tpoly:
                      {l: listn[int](1 + tdeg) |
                               FORALL (i: below(1 + tdeg)):
                                 tpolyinit(i) = nth[int](l, i)}):
              tpoly = array2list[int](tdeg + 1)(tpolyinit) IMPLIES
               (FORALL (bpolyinit: [nat -> int]):
                  bpolyinit =
                   (IF k = 0 THEN poly1
                    ELSE prod_polynomials(GF, KF, GP, k - 1)
                    ENDIF)
                   IMPLIES
                   (FORALL (bdeg: real):
                      bdeg =
                       IF k = 0 THEN 0 ELSE sigma(0, k - 1, KF * GP) ENDIF
                       IMPLIES
                       (FORALL (bpoly:
                                  {l: listn[int](1 + bdeg) |
                                           FORALL
                                           (i: below(1 + bdeg)):
                                           bpolyinit(i) = nth[int](l, i)}):
                          bpoly = array2list[int](bdeg + 1)(bpolyinit)
                           IMPLIES
                           (FORALL (anspoly: list[int]):
                              anspoly =
                               (IF k = 0 THEN tpoly
                                ELSIF GP(k) = 0 THEN v(GF, KF, GP, k - 1)
                                ELSE array2list[int]
                                         (tdeg + bdeg + 1)
                                         (polynomial_prod
                                          (bpolyinit, bdeg, tpolyinit, tdeg))
                                ENDIF)
                               IMPLIES
                               length[int](anspoly) - 1 =
                                sigma[nat](0, k, *[nat](KF, GP))
                                AND
                                prod_polynomials(GF, KF, GP, k) =
                                 (LAMBDA (i):
                                    IF i < length[int](anspoly)
                                      THEN nth[int](anspoly, i)
                                    ELSE 0
                                    ENDIF)))))));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 852 0 871 999
body:
  % Subtype TCC generated (at line 68, column 39) for  i
      % expected type  below[length(ll)]
  TQ_fam_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            GP: [nat -> subrange(0, 2)],
            ll:
              {ll |
                       length[int](ll) - 1 = sigma[nat](0, k, *[nat](KF, GP))
                        AND
                        prod_polynomials(GF, KF, GP, k) =
                         (LAMBDA (i):
                            IF i < length[int](ll) THEN nth[int](ll, i)
                            ELSE 0
                            ENDIF)}):
      ll = prod_polynomials_list(GF, KF, GP, k) IMPLIES
       (FORALL (d: int):
          d = length[int](ll) - 1 IMPLIES
           (FORALL (i: nat): i <= d IMPLIES i < length[int](ll)));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 873 0 894 999
body:
  % Subtype TCC generated (at line 69, column 17) for  d
      % expected type  {k | g(k) /= 0}
  TQ_fam_TCC2: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            GP: [nat -> subrange(0, 2)],
            ll:
              {ll |
                       length[int](ll) - 1 = sigma[nat](0, k, *[nat](KF, GP))
                        AND
                        prod_polynomials(GF, KF, GP, k) =
                         (LAMBDA (i):
                            IF i < length[int](ll) THEN nth[int](ll, i)
                            ELSE 0
                            ENDIF)}):
      ll = prod_polynomials_list(GF, KF, GP, k) IMPLIES
       (FORALL (d: int):
          d = length[int](ll) - 1 IMPLIES
           (FORALL (g: [nat -> int]):
              (g = (LAMBDA (i): IF i <= d THEN nth(ll, i) ELSE 0 ENDIF))
               IMPLIES d >= 0 AND g(d) /= 0));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 896 0 906 999
body:
  % Subtype TCC generated (at line 72, column 73) for  sigma(0, k, KF * GP)
      % expected type  {k_1 | prod_polynomials(GF, KF, GP, k)(k_1) /= 0}
  TQ_fam_def_TCC1: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], GP: [nat -> subrange(0, 2)],
            KF: [nat -> nat], a: [nat -> int], k: nat, n: posnat):
      (FORALL (i: upto(k)): GF(i)(KF(i)) /= 0) AND a(n) /= 0 IMPLIES
       rational_pred(sigma[nat](0, k, *[nat](KF, GP))) AND
        integer_pred(sigma[nat](0, k, *[nat](KF, GP))) AND
         sigma[nat](0, k, *[nat](KF, GP)) >= 0 AND
          prod_polynomials(GF, KF, GP, k)(sigma[nat](0, k, *[nat](KF, GP)))
           /= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 908 0 932 999
body:
  % Subtype TCC generated (at line 75, column 23) for
      % {r: real |
      %    polynomial(a, n)(r) = 0 AND
      %     (FORALL (i):
      %        i <= k IMPLIES
      %         (IF RelF(i) = -1 THEN polynomial(GF(i), KF(i))(r) < 0
      %          ELSIF RelF(i) = 1 THEN polynomial(GF(i), KF(i))(r) > 0
      %          ELSIF RelF(i) = 0 THEN polynomial(GF(i), KF(i))(r) = 0
      %          ELSE TRUE
      %          ENDIF))}
      % expected type  finite_set[real]
  Sol_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]], KF: [nat -> nat],
            RelF: [nat -> subrange(-1, 1)]):
      is_finite[real]
          ({r: real |
              polynomial(a, n)(r) = 0 AND
               (FORALL (i):
                  i <= k IMPLIES
                   (IF RelF(i) = -1 THEN polynomial(GF(i), KF(i))(r) < 0
                    ELSIF RelF(i) = 1 THEN polynomial(GF(i), KF(i))(r) > 0
                    ELSIF RelF(i) = 0 THEN polynomial(GF(i), KF(i))(r) = 0
                    ELSE TRUE
                    ENDIF))});


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 934 0 964 999
body:
  % Subtype TCC generated (at line 81, column 23) for
      % {r: real |
      %    polynomial(a, n)(r) = 0 AND
      %     (FORALL (i):
      %        i <= k IMPLIES
      %         (IF RelF6(i) = 0 THEN polynomial(GF(i), KF(i))(r) = 0
      %          ELSIF RelF6(i) = 1 THEN polynomial(GF(i), KF(i))(r) > 0
      %          ELSIF RelF6(i) = 2 THEN polynomial(GF(i), KF(i))(r) < 0
      %          ELSIF RelF6(i) = 3 THEN polynomial(GF(i), KF(i))(r) /= 0
      %          ELSIF RelF6(i) = 4 THEN polynomial(GF(i), KF(i))(r) >= 0
      %          ELSIF RelF6(i) = 5 THEN polynomial(GF(i), KF(i))(r) <= 0
      %          ELSE TRUE
      %          ENDIF))}
      % expected type  finite_set[real]
  Sol_all_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]], KF: [nat -> nat],
            RelF6: [nat -> subrange(0, 5)]):
      is_finite[real]
          ({r: real |
              polynomial(a, n)(r) = 0 AND
               (FORALL (i):
                  i <= k IMPLIES
                   (IF RelF6(i) = 0 THEN polynomial(GF(i), KF(i))(r) = 0
                    ELSIF RelF6(i) = 1 THEN polynomial(GF(i), KF(i))(r) > 0
                    ELSIF RelF6(i) = 2 THEN polynomial(GF(i), KF(i))(r) < 0
                    ELSIF RelF6(i) = 3 THEN polynomial(GF(i), KF(i))(r) /= 0
                    ELSIF RelF6(i) = 4 THEN polynomial(GF(i), KF(i))(r) >= 0
                    ELSIF RelF6(i) = 5 THEN polynomial(GF(i), KF(i))(r) <= 0
                    ELSE TRUE
                    ENDIF))});


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 966 0 971 999
body:
  % Subtype TCC generated (at line 96, column 45) for  GP(i)
      % expected type  {i_1: int | RelF(i) /= 0 OR i_1 >= 0}
  sign_prod_TCC1: OBLIGATION
    FORALL (GP: [nat -> subrange(0, 2)], RelF: [nat -> subrange(-1, 1)],
            i: nat):
      RelF(i) /= 0 OR GP(i) >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 973 0 982 999
body:
  % Subtype TCC generated (at line 96, column 4) for
      % product[nat](0, k, LAMBDA (i: nat): RelF(i) ^ GP(i))
      % expected type  subrange(-1, 1)
  sign_prod_TCC2: OBLIGATION
    FORALL (k: nat, GP: [nat -> subrange(0, 2)],
            RelF: [nat -> subrange(-1, 1)]):
      rational_pred(product[nat](0, k, LAMBDA (i: nat): RelF(i) ^ GP(i))) AND
       integer_pred(product[nat](0, k, LAMBDA (i: nat): RelF(i) ^ GP(i))) AND
        -1 <= product[nat](0, k, LAMBDA (i: nat): RelF(i) ^ GP(i)) AND
         product[nat](0, k, LAMBDA (i: nat): RelF(i) ^ GP(i)) <= 1;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 984 0 986 999
body:
  % Subtype TCC generated (at line 101, column 33) for  k
      % expected type  {i: int | x /= 0 OR i >= 0}
  sign_ext_pow_TCC1: OBLIGATION FORALL (k: nat, x: real): x /= 0 OR k >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 988 0 991 999
body:
  % Subtype TCC generated (at line 101, column 48) for  k
      % expected type  {i: int | sign_ext(x) /= 0 OR i >= 0}
  sign_ext_pow_TCC2: OBLIGATION
    FORALL (k: nat, x: real): sign_ext(x) /= 0 OR k >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 993 0 1007 999
body:
  % Subtype TCC generated (at line 105, column 95) for  RelFF
      % expected type  [nat -> subrange(-1, 1)]
  sign_ext_prod_polynomials_TCC1: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat], x: real,
            RelFF:
              [i: nat ->
                 {sig: real |
                          (sig = -1 OR sig = 1 OR sig = 0) AND
                           sig * polynomial(GF(i), KF(i))(x) =
                            abs(polynomial(GF(i), KF(i))(x))}]):
      (RelFF = (LAMBDA (i: nat): sign_ext(polynomial(GF(i), KF(i))(x))))
       IMPLIES
       (FORALL (x1: nat):
          rational_pred(RelFF(x1)) AND
           integer_pred(RelFF(x1)) AND -1 <= RelFF(x1) AND RelFF(x1) <= 1);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1009 0 1012 999
body:
  % Subtype TCC generated (at line 125, column 44) for  mod(ii, 3)
      % expected type  subrange(0, 2)
  unsig_TCC1: OBLIGATION
    FORALL (ii: subrange(-1, 1)): 0 <= mod(ii, 3) AND mod(ii, 3) <= 2;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1014 0 1017 999
body:
  % Subtype TCC generated (at line 136, column 68) for  k - p
      % expected type  nat
  base_3_seq_TCC1: OBLIGATION
    FORALL (k: nat, p: nat): p <= k IMPLIES k - p >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1019 0 1023 999
body:
  % Subtype TCC generated (at line 136, column 56) for  base_n(3, i)(k - p)
      % expected type  subrange(0, 2)
  base_3_seq_TCC2: OBLIGATION
    FORALL (k: nat, i: nat, p: nat):
      p <= k IMPLIES 0 <= base_n(3, i)(k - p) AND base_n(3, i)(k - p) <= 2;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1025 0 1029 999
body:
  % Subtype TCC generated (at line 138, column 56) for  base_n(6, i)(k - p)
      % expected type  subrange(0, 5)
  base_6_seq_TCC1: OBLIGATION
    FORALL (k: nat, i: nat, p: nat):
      p <= k IMPLIES 0 <= base_n(6, i)(k - p) AND base_n(6, i)(k - p) <= 5;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1031 0 1035 999
body:
  % Subtype TCC generated (at line 144, column 12) for  base_n(3, i)
      % expected type  [nat -> subrange(0, 2)]
  sig_seq_base_3_onto_2_TCC1: OBLIGATION
    FORALL (RelF: [nat -> subrange(-1, 1)], k: nat, i: below(3 ^ (k + 1))):
      FORALL (x1: nat): 0 <= base_n(3, i)(x1) AND base_n(3, i)(x1) <= 2;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1037 0 1043 999
body:
  % Subtype TCC generated (at line 147, column 12) for  base_6_seq(k, i)
      % expected type  [nat -> subrange(0, 2)]
  sig_seq_base_6_onto_TCC1: OBLIGATION
    FORALL (RelF: [nat -> subrange(-1, 1)], k: nat, i: below(6 ^ (k + 1))):
      (FORALL (j: nat): base_6_seq(k, i)(j) <= 2) IMPLIES
       (FORALL (x1: nat):
          0 <= base_6_seq(k, i)(x1) AND base_6_seq(k, i)(x1) <= 2);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1045 0 1050 999
body:
  % Subtype TCC generated (at line 150, column 12) for  base_n(6, i)
      % expected type  [nat -> subrange(0, 2)]
  sig_seq_base_6_onto_2_TCC1: OBLIGATION
    FORALL (RelF: [nat -> subrange(-1, 1)], k: nat, i: below(6 ^ (k + 1))):
      (FORALL (j: nat): base_n(6, i)(j) <= 2) IMPLIES
       (FORALL (x1: nat): 0 <= base_n(6, i)(x1) AND base_n(6, i)(x1) <= 2);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1052 0 1060 999
body:
  % Subtype TCC generated (at line 162, column 19) for  setseq(0)
      % expected type  {Aset: set[real] |
                     %          FORALL (x):
                     %            Aset(x) IFF
                     %             (EXISTS (i: upto(k)): setseq(i)(x))}
  union_upto_TCC1: OBLIGATION
    FORALL (k: nat, setseq: [nat -> set[real]]):
      k = 0 IMPLIES
       (FORALL (x): setseq(0)(x) IFF (EXISTS (i: upto(k)): setseq(i)(x)));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1062 0 1064 999
body:
  % Subtype TCC generated (at line 162, column 57) for  k - 1
      % expected type  nat
  union_upto_TCC2: OBLIGATION FORALL (k: nat): NOT k = 0 IMPLIES k - 1 >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1066 0 1068 999
body:
  % Termination TCC generated (at line 162, column 46) for
      % union_upto(k - 1, setseq)
  union_upto_TCC3: OBLIGATION FORALL (k: nat): NOT k = 0 IMPLIES k - 1 < k;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1070 0 1087 999
body:
  % Subtype TCC generated (at line 162, column 34) for
      % union[real](union_upto(k - 1, setseq), setseq(k))
      % expected type  {Aset: set[real] |
                     %          FORALL (x):
                     %            Aset(x) IFF
                     %             (EXISTS (i: upto(k)): setseq(i)(x))}
  union_upto_TCC4: OBLIGATION
    FORALL (k: nat, setseq: [nat -> set[real]]):
      NOT k = 0 IMPLIES
       (FORALL (x,
                v:
                  [d1: {z: [nat, [nat -> set[real]]] | z`1 < k} ->
                     {Aset: set[real] |
                              FORALL (x):
                                Aset(x) IFF
                                 (EXISTS (i: upto(d1`1)): d1`2(i)(x))}]):
          union[real](v(k - 1, setseq), setseq(k))(x) IFF
           (EXISTS (i: upto(k)): setseq(i)(x)));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1089 0 1097 999
body:
  % Subtype TCC generated (at line 174, column 72) for  setseq(i)
      % expected type  S: finite_set[real]
  real_set_disj_union_cards_TCC1: OBLIGATION
    FORALL (k: nat, setseq: [nat -> set[real]]):
      (FORALL (i: nat): is_finite[real](setseq(i))) AND
       is_finite[real](union_upto(k, setseq)) AND
        (FORALL (i, j: nat):
           i /= j IMPLIES disjoint?[real](setseq(i), setseq(j)))
       IMPLIES (FORALL (i1: nat): is_finite[real](setseq(i1)));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1099 0 1105 999
body:
  % Subtype TCC generated (at line 180, column 12) for  3 ^ (k + 1) - 1
      % expected type  T_high[nat]
  mult_tarski_query_simple_TCC1: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat], a: [nat -> int],
            k: nat, n: posnat):
      (FORALL (i: upto(k)): GF(i)(KF(i)) /= 0) AND a(n) /= 0 IMPLIES
       3 ^ (k + 1) - 1 >= 0 OR (EXISTS (j: nat): 3 ^ (k + 1) - 1 <= j);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1107 0 1115 999
body:
  % Subtype TCC generated (at line 181, column 29) for  base_n(3, i)
      % expected type  [nat -> subrange(0, 2)]
  mult_tarski_query_simple_TCC2: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat], a: [nat -> int],
            k: nat, n: posnat):
      (FORALL (i: upto(k)): GF(i)(KF(i)) /= 0) AND a(n) /= 0 IMPLIES
       (FORALL (i1: nat):
          FORALL (x1: nat):
            0 <= base_n(3, i1)(x1) AND base_n(3, i1)(x1) <= 2);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1117 0 1128 999
body:
  % Subtype TCC generated (at line 197, column 20) for
      % split_index_fun_entry(F, n)
      % expected type  {G: [nat -> [nat, nat]] |
                     %          (FORALL (i: upto(n)):
                     %             G(i) = split_index_fun_entry(F, i)(i))
                     %           AND (FORALL (i: above(n)): G(i) = F(i))}
  split_index_fun_TCC1: OBLIGATION
    FORALL (F: [nat -> [nat, nat]], n: nat):
      n = 0 IMPLIES
       (FORALL (i: upto(n)):
          split_index_fun_entry(F, n)(i) = split_index_fun_entry(F, i)(i))
        AND (FORALL (i: above(n)): split_index_fun_entry(F, n)(i) = F(i));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1130 0 1150 999
body:
  % Subtype TCC generated (at line 198, column 11) for
      % split_index_fun(split_index_fun_entry(F, n), n - 1)
      % expected type  {G: [nat -> [nat, nat]] |
                     %          (FORALL (i: upto(n)):
                     %             G(i) = split_index_fun_entry(F, i)(i))
                     %           AND (FORALL (i: above(n)): G(i) = F(i))}
  split_index_fun_TCC2: OBLIGATION
    FORALL (F: [nat -> [nat, nat]], n: nat,
            v:
              [d1: {z: [[nat -> [nat, nat]], nat] | z`2 < n} ->
                 {G: [nat -> [nat, nat]] |
                          (FORALL (i: upto(d1`2)):
                             G(i) = split_index_fun_entry(d1`1, i)(i))
                           AND (FORALL (i: above(d1`2)): G(i) = d1`1(i))}]):
      NOT n = 0 IMPLIES
       (FORALL (i: upto(n)):
          v(split_index_fun_entry(F, n), n - 1)(i) =
           split_index_fun_entry(F, i)(i))
        AND
        (FORALL (i: above(n)):
           v(split_index_fun_entry(F, n), n - 1)(i) = F(i));


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1152 0 1154 999
body:
  % Subtype TCC generated (at line 208, column 38) for  n - 1
      % expected type  nat
  split_base6_TCC1: OBLIGATION FORALL (n: posnat): n - 1 >= 0;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1156 0 1163 999
body:
  % Subtype TCC generated (at line 221, column 32) for  base_n(6, i)
      % expected type  [nat -> subrange(0, 2)]
  sign_prod_coeff6_TCC1: OBLIGATION
    FORALL (k: nat, GP: [nat -> subrange(0, 2)], i: nat):
      NOT i >= 6 ^ (k + 1) AND
       NOT (EXISTS (p: upto(k)): base_n(6, i)(p) >= 3)
       IMPLIES
       (FORALL (x1: nat): 0 <= base_n(6, i)(x1) AND base_n(6, i)(x1) <= 2);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1165 0 1172 999
body:
  % Subtype TCC generated (at line 225, column 34) for  base_n(6, i)
      % expected type  [nat -> subrange(0, 2)]
  NSol_seq6_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0), i: nat):
      NOT i >= 6 ^ (k + 1) AND
       NOT (EXISTS (p: upto(k)): base_n(6, i)(p) >= 3)
       IMPLIES
       (FORALL (x1: nat): 0 <= base_n(6, i)(x1) AND base_n(6, i)(x1) <= 2);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1174 0 1180 999
body:
  % Subtype TCC generated (at line 231, column 12) for  6 ^ (k + 1) - 1
      % expected type  T_high[nat]
  mult_tarski_query_simple_6_0_to_3_TCC1: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat], a: [nat -> int],
            k: nat, n: posnat):
      (FORALL (i: upto(k)): GF(i)(KF(i)) /= 0) AND a(n) /= 0 IMPLIES
       6 ^ (k + 1) - 1 >= 0 OR (EXISTS (j: nat): 6 ^ (k + 1) - 1 <= j);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1182 0 1204 999
body:
  % Subtype TCC generated (at line 251, column 9) for
      % product[nat](0, k, LAMBDA (j): sign_coeff6_zero_entry(k, TQRow, i, j))
      % expected type  subrange(-1, 1)
  sign_coeff6_zero_TCC1: OBLIGATION
    FORALL (k: nat, TQRow: [nat -> subrange(0, 5)], i: nat):
      NOT i >= 6 ^ (k + 1) IMPLIES
       rational_pred(product[nat]
                         (0, k,
                          LAMBDA (j):
                            sign_coeff6_zero_entry(k, TQRow, i, j)))
        AND
        integer_pred(product[nat]
                         (0, k,
                          LAMBDA (j):
                            sign_coeff6_zero_entry(k, TQRow, i, j)))
         AND
         -1 <=
          product[nat]
              (0, k, LAMBDA (j): sign_coeff6_zero_entry(k, TQRow, i, j))
          AND
          product[nat]
              (0, k, LAMBDA (j): sign_coeff6_zero_entry(k, TQRow, i, j))
           <= 1;


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1206 0 1232 999
body:
  % Subtype TCC generated (at line 266, column 22) for  6 ^ (k + 1) - 1
      % expected type  T_high[nat]
  sigma_disjoinction_6_TCC1: OBLIGATION
    FORALL (g: [nat -> int], k: nat,
            v: [nat -> [nat, nat, nat, nat, nat, nat]]):
      ((FORALL (j):
          j <= 6 ^ (k + 1) - 1 IMPLIES
           (EXISTS (i): i <= 6 ^ k - 1 AND in6?(v(i), j)))
        AND
        (FORALL (i):
           i <= 6 ^ k - 1 IMPLIES
            (     v(i)`1 < v(i)`2 AND v(i)`2 < v(i)`3 AND v(i)`3 < v(i)`4
              AND v(i)`4 < v(i)`5 AND v(i)`5 < v(i)`6
              AND v(i)`6 <= 6 ^ (k + 1) - 1))
         AND
         (FORALL (i, d, j):
                 i <= 6 ^ k - 1 AND d <= 6 ^ k - 1 AND j <= 6 ^ (k + 1) - 1
             AND in6?(v(i), j) AND in6?(v(d), j)
             IMPLIES i = d)
          AND
          (FORALL (i):
             i <= 6 ^ k - 1 IMPLIES
              (g(v(i)`1) + g(v(i)`2) + g(v(i)`3) + g(v(i)`4) + g(v(i)`5) +
                g(v(i)`6))
               = 0))
       IMPLIES
       6 ^ (k + 1) - 1 >= 0 OR (EXISTS (j: nat): 6 ^ (k + 1) - 1 <= j);


decl_type: tcc
theory: poly_families
library: Tarski
signature: nil
location: 1234 0 1245 999
body:
  % Subtype TCC generated (at line 273, column 55) for  base_n(6, i)
      % expected type  [nat -> subrange(0, 5)]
  mult_tarski_query_simple_6_above_2_TCC1: OBLIGATION
    FORALL (GF: [nat -> [nat -> int]], KF: [nat -> nat],
            TQRow: [nat -> subrange(0, 5)], a: [nat -> int], k: nat,
            n: posnat):
      (EXISTS (i: upto(k)): TQRow(i) > 2) AND
       (FORALL (i: upto(k)): GF(i)(KF(i)) /= 0) AND a(n) /= 0
       IMPLIES
       (FORALL (i1: nat):
          FORALL (x1: nat):
            0 <= base_n(6, i1)(x1) AND base_n(6, i1)(x1) <= 5);


decl_type: formula
theory: tarski_query
library: Tarski
signature: nil
location: 19 2 21 20
body:
    NSol_squared_gt: LEMMA a(n)/=0 IMPLIES
      NSol(a,n,polynomial_prod(g,k,g,k),2*k,>) =
      NSol(a,n,g,k,/=)


decl_type: formula
theory: tarski_query
library: Tarski
signature: nil
location: 41 2 42 46
body:
    tarski_query_system_basic_3: LEMMA a(n)/=0 AND g(k)/=0 IMPLIES
      A3*TQ_vect3(a,n,g,k) = NSol_vect3(a,n,g,k)


decl_type: formula
theory: tarski_query
library: Tarski
signature: nil
location: 56 2 57 46
body:
    tarski_query_system_basic_6: LEMMA a(n)/=0 AND g(k)/=0 IMPLIES
      A6*TQ_vect3(a,n,g,k) = NSol_vect6(a,n,g,k)


decl_type: function
theory: tarski_query
library: Tarski
location: 35 2 36 93
signature:
  [[a: [nat -> int], {n | a(n) /= 0}, g: [nat -> int],
         {k | g(k) /= 0}] ->
          {v: PosFullMatrix | rows(v) = 3 AND columns(v) = 1}]

body:
    TQ_vect3(a,(n|a(n)/=0),g,(k|g(k)/=0)): {v: PosFullMatrix | rows(v)=3 AND columns(v)=1} =
      (: (: TQ(a,n,poly1,0) :),(: TQ(a,n,g,k) :), (: TQ(a,n,polynomial_prod(g,k,g,k),2*k) :) :)


decl_type: function
theory: tarski_query
library: Tarski
location: 38 2 39 76
signature:
  [[a: [nat -> int], {n | a(n) /= 0}, g: [nat -> int],
         {k | g(k) /= 0}] ->
          {v: PosFullMatrix | rows(v) = 3 AND columns(v) = 1}]

body:
    NSol_vect3(a,(n|a(n)/=0),g,(k|g(k)/=0)): {v: PosFullMatrix | rows(v)=3 AND columns(v)=1} =
      (: (: NSol(a,n,g,k,=) :),(: NSol(a,n,g,k,>) :), (: NSol(a,n,g,k,<) :) :)


decl_type: function
theory: tarski_query
library: Tarski
location: 52 2 54 79
signature:
  [[a: [nat -> int], {n | a(n) /= 0}, g: [nat -> int],
         {k | g(k) /= 0}] ->
          {v: PosFullMatrix | rows(v) = 6 AND columns(v) = 1}]

body:
    NSol_vect6(a,(n|a(n)/=0),g,(k|g(k)/=0)): {v: PosFullMatrix | rows(v)=6 AND columns(v)=1} =
      (: (: NSol(a,n,g,k,=) :),(: NSol(a,n,g,k,>) :), (: NSol(a,n,g,k,<) :),
         (: NSol(a,n,g,k,/=) :),(: NSol(a,n,g,k,>=) :), (: NSol(a,n,g,k,<=) :) :)


decl_type: constant
theory: tarski_query
library: Tarski
signature: {M: PosFullMatrix | rows(M) = 3 AND columns(M) = 3}
location: 29 2 30 63
body:
    A3: {M: PosFullMatrix | rows(M)=3 AND columns(M)=3} =
      (: (: 1, 0, -1 :), (: 0, 1/2, 1/2 :), (: 0, -1/2, 1/2 :) :)


decl_type: constant
theory: tarski_query
library: Tarski
location: 32 2 33 48
signature:
  {M: PosFullMatrix |
                rows(M) = 3 AND
                 columns(M) = 3 AND det(M) /= 0 AND inverse(M) = A3}

body:
    A3_inv: {M: PosFullMatrix | rows(M)=3 AND columns(M)=3 AND det(M)/=0 AND inverse(M)=A3} =
      (: (: 1,1,1 :), (: 0,1,-1 :), (: 0,1,1 :) :)


decl_type: constant
theory: tarski_query
library: Tarski
signature: {M: PosFullMatrix | rows(M) = 6 AND columns(M) = 3}
location: 44 2 50 27
body:
    A6: {M: PosFullMatrix | rows(M)=6 AND columns(M)=3} =
      (: (: 1, 0, -1 :), 
         (: 0, 1/2, 1/2 :),       
         (: 0, -1/2, 1/2 :),
         (: 0,0,1 :), 
         (: 1,1/2,-1/2 :), 
         (: 1,-1/2,-1/2 :) :)


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 64 0 69 999
body:
  % Subtype TCC generated (at line 30, column 7) for  (: 1, 0, -1 :)
      % expected type  list[real]
  A3_TCC1: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 0, -1 :));


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 71 0 79 999
body:
  % Subtype TCC generated (at line 30, column 23) for
      % (: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :) :)
      % expected type  list[list[real]]
  A3_TCC2: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :) :));


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 81 0 116 999
body:
  % Subtype TCC generated (at line 30, column 4) for
      % (: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :) :)
      % expected type  {M: PosFullMatrix | rows(M) = 3 AND columns(M) = 3}
  A3_TCC3: OBLIGATION
         null?[list[real]]
             ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :) :))
          OR
          (FORALL (i,
                   j:
                     below(length[list[real]]
                               ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                                   (: 0, -1 / 2, 1 / 2 :) :)))):
             length[real]
                 (nth[list[real]]
                      ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                          (: 0, -1 / 2, 1 / 2 :) :),
                       i))
              =
              length[real]
                  (nth[list[real]]
                       ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                           (: 0, -1 / 2, 1 / 2 :) :),
                        j)))
     AND rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :) :))
          > 0
     AND columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                    (: 0, -1 / 2, 1 / 2 :) :))
          > 0
     AND rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :) :))
          = 3
     AND columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                    (: 0, -1 / 2, 1 / 2 :) :))
          = 3;


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 118 0 123 999
body:
  % Subtype TCC generated (at line 32, column 83) for  M
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  A3_inv_TCC1: OBLIGATION
    FORALL (M: PosFullMatrix):
      det(M) /= 0 AND columns(M) = 3 AND rows(M) = 3 IMPLIES
       rows(M) = columns(M) AND (det(M) /= 0 OR invertible?(M));


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 125 0 130 999
body:
  % Subtype TCC generated (at line 33, column 7) for  (: 1, 1, 1 :)
      % expected type  list[real]
  A3_inv_TCC2: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 1, 1 :));


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 132 0 140 999
body:
  % Subtype TCC generated (at line 33, column 20) for
      % (: (: 0, 1, -1 :), (: 0, 1, 1 :) :)
      % expected type  list[list[real]]
  A3_inv_TCC3: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1, -1 :), (: 0, 1, 1 :) :));


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 142 0 171 999
body:
  % Subtype TCC generated (at line 33, column 4) for
      % (: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)
      % expected type  {M: PosFullMatrix |
                     %          rows(M) = 3 AND
                     %           columns(M) = 3 AND
                     %            det(M) /= 0 AND inverse(M) = A3}
  A3_inv_TCC4: OBLIGATION
         null?[list[real]]
             ((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :))
          OR
          (FORALL (i,
                   j:
                     below(length[list[real]]
                               ((: (: 1, 1, 1 :), (: 0, 1, -1 :),
                                   (: 0, 1, 1 :) :)))):
             length[real]
                 (nth[list[real]]
                      ((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :),
                       i))
              =
              length[real]
                  (nth[list[real]]
                       ((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :),
                        j)))
     AND rows((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) > 0
     AND columns((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) > 0
     AND rows((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) = 3
     AND columns((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) = 3
     AND det((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) /= 0
     AND inverse((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) = A3;


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 173 0 178 999
body:
  % Subtype TCC generated (at line 36, column 23) for  0
      % expected type  {k | poly1(k) /= 0}
  TQ_vect3_TCC1: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
      poly1(0) /= 0;


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 180 0 188 999
body:
  % Subtype TCC generated (at line 36, column 58) for
      % polynomial_prod(g, k, g, k)
      % expected type  [nat -> int]
  TQ_vect3_TCC2: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
      FORALL (x1: nat):
        rational_pred(polynomial_prod(g, k, g, k)(x1)) AND
         integer_pred(polynomial_prod(g, k, g, k)(x1));


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 190 0 195 999
body:
  % Subtype TCC generated (at line 36, column 83) for  2 * k
      % expected type  {k_1 | polynomial_prod(g, k, g, k)(k_1) /= 0}
  TQ_vect3_TCC3: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
      polynomial_prod(g, k, g, k)(2 * k) /= 0;


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 197 0 242 999
body:
  % Subtype TCC generated (at line 36, column 4) for
      % (: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
      %    (: TQ(a, n, polynomial_prod(g, k, g, k), 2 * k) :) :)
      % expected type  {v: PosFullMatrix | rows(v) = 3 AND columns(v) = 1}
  TQ_vect3_TCC4: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
           null?[list[real]]
               ((: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
                   (: TQ(a, n, polynomial_prod(g, k, g, k), 2 * k) :) :))
            OR
            (FORALL (i,
                     j:
                       below(length[list[real]]
                                 ((: (: TQ(a, n, poly1, 0) :),
                                     (: TQ(a, n, g, k) :),
                                     (: TQ
                                        (a,
                                         n,
                                         polynomial_prod(g, k, g, k),
                                         2 * k) :) :)))):
               length[real]
                   (nth[list[real]]
                        ((: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
                            (: TQ(a, n, polynomial_prod(g, k, g, k),
                                  2 * k) :) :),
                         i))
                =
                length[real]
                    (nth[list[real]]
                         ((: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
                             (: TQ(a, n, polynomial_prod(g, k, g, k),
                                   2 * k) :) :),
                          j)))
       AND rows((: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
                   (: TQ(a, n, polynomial_prod(g, k, g, k), 2 * k) :) :))
            > 0
       AND columns((: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
                      (: TQ(a, n, polynomial_prod(g, k, g, k), 2 * k) :) :))
            > 0
       AND rows((: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
                   (: TQ(a, n, polynomial_prod(g, k, g, k), 2 * k) :) :))
            = 3
       AND columns((: (: TQ(a, n, poly1, 0) :), (: TQ(a, n, g, k) :),
                      (: TQ(a, n, polynomial_prod(g, k, g, k), 2 * k) :) :))
            = 1;


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 244 0 319 999
body:
  % Subtype TCC generated (at line 39, column 4) for
      % (: (: NSol(a, n, g, k,
      %            restrict[[number, number], [real, real], boolean](=)) :),
      %    (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :) :)
      % expected type  {v: PosFullMatrix | rows(v) = 3 AND columns(v) = 1}
  NSol_vect3_TCC1: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
           null?[list[real]]
               ((: (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (=)) :),
                   (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :) :))
            OR
            (FORALL (i,
                     j:
                       below(length[list[real]]
                                 ((: (: NSol
                                        (a,
                                         n,
                                         g,
                                         k,
                                         restrict
                                         [[number, number],
                                          [real, real],
                                          boolean]
                                         (=)) :),
                                     (: NSol(a, n, g, k, >) :),
                                     (: NSol(a, n, g, k, <) :) :)))):
               length[real]
                   (nth[list[real]]
                        ((: (: NSol(a, n, g, k,
                                    restrict
                                        [[number, number],
                                         [real, real],
                                         boolean]
                                        (=)) :),
                            (: NSol(a, n, g, k, >) :),
                            (: NSol(a, n, g, k, <) :) :),
                         i))
                =
                length[real]
                    (nth[list[real]]
                         ((: (: NSol(a, n, g, k,
                                     restrict
                                         [[number, number],
                                          [real, real],
                                          boolean]
                                         (=)) :),
                             (: NSol(a, n, g, k, >) :),
                             (: NSol(a, n, g, k, <) :) :),
                          j)))
       AND rows((: (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (=)) :),
                   (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :) :))
            > 0
       AND columns((: (: NSol(a, n, g, k,
                              restrict
                                  [[number, number], [real, real], boolean]
                                  (=)) :),
                      (: NSol(a, n, g, k, >) :),
                      (: NSol(a, n, g, k, <) :) :))
            > 0
       AND rows((: (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (=)) :),
                   (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :) :))
            = 3
       AND columns((: (: NSol(a, n, g, k,
                              restrict
                                  [[number, number], [real, real], boolean]
                                  (=)) :),
                      (: NSol(a, n, g, k, >) :),
                      (: NSol(a, n, g, k, <) :) :))
            = 1;


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 321 0 331 999
body:
  % Subtype TCC generated (at line 46, column 7) for
      % (: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
      %    (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :)
      % expected type  list[list[real]]
  A6_TCC1: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
            (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :));


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 333 0 379 999
body:
  % Subtype TCC generated (at line 45, column 4) for
      % (: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :),
      %    (: 0, 0, 1 :), (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :)
      % expected type  {M: PosFullMatrix | rows(M) = 6 AND columns(M) = 3}
  A6_TCC2: OBLIGATION
         null?[list[real]]
             ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                 (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          OR
          (FORALL (i,
                   j:
                     below(length[list[real]]
                               ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                                   (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                                   (: 1, 1 / 2, -1 / 2 :),
                                   (: 1, -1 / 2, -1 / 2 :) :)))):
             length[real]
                 (nth[list[real]]
                      ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                          (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                          (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :),
                       i))
              =
              length[real]
                  (nth[list[real]]
                       ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                           (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                           (: 1, 1 / 2, -1 / 2 :),
                           (: 1, -1 / 2, -1 / 2 :) :),
                        j)))
     AND rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                 (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          > 0
     AND columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                    (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                    (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          > 0
     AND rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                 (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          = 6
     AND columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                    (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                    (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          = 3;


decl_type: tcc
theory: tarski_query
library: Tarski
signature: nil
location: 381 0 509 999
body:
  % Subtype TCC generated (at line 53, column 4) for
      % (: (: NSol(a, n, g, k,
      %            restrict[[number, number], [real, real], boolean](=)) :),
      %    (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :),
      %    (: NSol(a, n, g, k,
      %            restrict[[number, number], [real, real], boolean](/=)) :),
      %    (: NSol(a, n, g, k, >=) :), (: NSol(a, n, g, k, <=) :) :)
      % expected type  {v: PosFullMatrix | rows(v) = 6 AND columns(v) = 1}
  NSol_vect6_TCC1: OBLIGATION
    FORALL (a: [nat -> int], (n: posnat | a(n) /= 0), g: [nat -> int],
            (k: nat | g(k) /= 0)):
           null?[list[real]]
               ((: (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (=)) :),
                   (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :),
                   (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (/=)) :),
                   (: NSol(a, n, g, k, >=) :), (: NSol(a, n, g, k, <=) :) :))
            OR
            (FORALL (i,
                     j:
                       below(length[list[real]]
                                 ((: (: NSol
                                        (a,
                                         n,
                                         g,
                                         k,
                                         restrict
                                         [[number, number],
                                          [real, real],
                                          boolean]
                                         (=)) :),
                                     (: NSol(a, n, g, k, >) :),
                                     (: NSol(a, n, g, k, <) :),
                                     (: NSol
                                        (a,
                                         n,
                                         g,
                                         k,
                                         restrict
                                         [[number, number],
                                          [real, real],
                                          boolean]
                                         (/=)) :),
                                     (: NSol(a, n, g, k, >=) :),
                                     (: NSol(a, n, g, k, <=) :) :)))):
               length[real]
                   (nth[list[real]]
                        ((: (: NSol(a, n, g, k,
                                    restrict
                                        [[number, number],
                                         [real, real],
                                         boolean]
                                        (=)) :),
                            (: NSol(a, n, g, k, >) :),
                            (: NSol(a, n, g, k, <) :),
                            (: NSol(a, n, g, k,
                                    restrict
                                        [[number, number],
                                         [real, real],
                                         boolean]
                                        (/=)) :),
                            (: NSol(a, n, g, k, >=) :),
                            (: NSol(a, n, g, k, <=) :) :),
                         i))
                =
                length[real]
                    (nth[list[real]]
                         ((: (: NSol(a, n, g, k,
                                     restrict
                                         [[number, number],
                                          [real, real],
                                          boolean]
                                         (=)) :),
                             (: NSol(a, n, g, k, >) :),
                             (: NSol(a, n, g, k, <) :),
                             (: NSol(a, n, g, k,
                                     restrict
                                         [[number, number],
                                          [real, real],
                                          boolean]
                                         (/=)) :),
                             (: NSol(a, n, g, k, >=) :),
                             (: NSol(a, n, g, k, <=) :) :),
                          j)))
       AND rows((: (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (=)) :),
                   (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :),
                   (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (/=)) :),
                   (: NSol(a, n, g, k, >=) :), (: NSol(a, n, g, k, <=) :) :))
            > 0
       AND columns((: (: NSol(a, n, g, k,
                              restrict
                                  [[number, number], [real, real], boolean]
                                  (=)) :),
                      (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :),
                      (: NSol(a, n, g, k,
                              restrict
                                  [[number, number], [real, real], boolean]
                                  (/=)) :),
                      (: NSol(a, n, g, k, >=) :),
                      (: NSol(a, n, g, k, <=) :) :))
            > 0
       AND rows((: (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (=)) :),
                   (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :),
                   (: NSol(a, n, g, k,
                           restrict[[number, number], [real, real], boolean]
                               (/=)) :),
                   (: NSol(a, n, g, k, >=) :), (: NSol(a, n, g, k, <=) :) :))
            = 6
       AND columns((: (: NSol(a, n, g, k,
                              restrict
                                  [[number, number], [real, real], boolean]
                                  (=)) :),
                      (: NSol(a, n, g, k, >) :), (: NSol(a, n, g, k, <) :),
                      (: NSol(a, n, g, k,
                              restrict
                                  [[number, number], [real, real], boolean]
                                  (/=)) :),
                      (: NSol(a, n, g, k, >=) :),
                      (: NSol(a, n, g, k, <=) :) :))
            = 1;


decl_type: formula
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 55 2 59 28
body:
    multi_sturm_tarski_6by6: LEMMA a(n)/=0 AND 
      (FORALL (i:upto(k)):GF(i)(KF(i))/=0)
      IMPLIES
      TQ_vect6k(k,a,n,GF, KF) = tensor_power_alt(A66_inv,k+1)*
      NSol_vect6k(k,a,n,GF,KF)


decl_type: formula
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 61 2 65 27
body:
    multi_sturm_tarski_NSol: LEMMA a(n)/=0 AND 
      (FORALL (i:upto(k)):GF(i)(KF(i))/=0)
      IMPLIES
      NSol_vect6k(k,a,n,GF,KF) = tensor_power_alt(A66,k+1)*
      TQ_vect6k(k,a,n,GF, KF)


decl_type: formula
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 75 2 79 27
body:
    multi_sturm_tarski_NSol63: LEMMA a(n)/=0 AND 
      (FORALL (i:upto(k)):GF(i)(KF(i))/=0)
      IMPLIES
      NSol_vect6k(k,a,n,GF,KF) = tensor_power_alt(A63,k+1)*
      TQ_vect3k(k,a,n,GF, KF)


decl_type: function
theory: tarski_query_matrix
library: Tarski
location: 24 2 27 33
signature:
  [d:
          [k: nat, a: [nat -> int], {n | a(n) /= 0},
           GF: [nat -> [nat -> int]],
           {KF | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0}] ->
          {v: PosFullMatrix |
                   rows(v) = 3 ^ (1 + d`1) AND columns(v) = 1}]

body:
    TQ_vect3k(k,a,(n|a(n)/=0),GF,(KF|FORALL (i:upto(k)):GF(i)(KF(i))/=0)): {v: PosFullMatrix | rows(v)=3^(k+1) AND columns(v)=1} =
      LET GPFun = (LAMBDA (i,j): base_n(3,i)),
          eij = (LAMBDA (i,j): IF i>=3^(k+1) OR j>=1 THEN 0 ELSE TQ_fam(k,a,n,GF,KF,GPFun(i,j)) ENDIF)
      IN form_matrix(eij,3^(k+1),1)


decl_type: function
theory: tarski_query_matrix
library: Tarski
location: 29 2 32 33
signature:
  [d:
          [k: nat, a: [nat -> int], {n | a(n) /= 0},
           GF: [nat -> [nat -> int]],
           {KF | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0}] ->
          {v: PosFullMatrix |
                   rows(v) = 6 ^ (1 + d`1) AND columns(v) = 1}]

body:
    TQ_vect6k(k,a,(n|a(n)/=0),GF,(KF|FORALL (i:upto(k)):GF(i)(KF(i))/=0)): {v: PosFullMatrix | rows(v)=6^(k+1) AND columns(v)=1} =
      LET GPFun = (LAMBDA (i,j): base_n(6,i)),
          eij = (LAMBDA (i,j): IF i>=6^(k+1) OR j>=1 OR (EXISTS (p:upto(k)): GPFun(i,j)(p)>2) THEN 0 ELSE TQ_fam(k,a,n,GF,KF,GPFun(i,j)) ENDIF)
      IN form_matrix(eij,6^(k+1),1)


decl_type: function
theory: tarski_query_matrix
library: Tarski
location: 34 2 36 33
signature:
  [d:
          [k: nat, a: [nat -> int], {n | a(n) /= 0},
           GF: [nat -> [nat -> int]],
           {KF | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0}] ->
          {v: PosFullMatrix |
                   rows(v) = 3 ^ (1 + d`1) AND columns(v) = 1}]

body:
    NSol_vect3k(k,a,(n|a(n)/=0),GF,(KF|FORALL (i:upto(k)):GF(i)(KF(i))/=0)): {v: PosFullMatrix | rows(v)=3^(k+1) AND columns(v)=1} =
      LET eij = (LAMBDA (i,j): IF i>=3^(k+1) OR j>=1 THEN 0 ELSE NSol(k,a,n,GF,KF,sig_seq(base_n(3,i))) ENDIF)
      IN form_matrix(eij,3^(k+1),1)


decl_type: function
theory: tarski_query_matrix
library: Tarski
location: 38 2 40 33
signature:
  [d:
          [k: nat, a: [nat -> int], {n | a(n) /= 0},
           GF: [nat -> [nat -> int]],
           {KF | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0}] ->
          {v: PosFullMatrix |
                   rows(v) = 6 ^ (1 + d`1) AND columns(v) = 1}]

body:
    NSol_vect6k(k,a,(n|a(n)/=0),GF,(KF|FORALL (i:upto(k)):GF(i)(KF(i))/=0)): {v: PosFullMatrix | rows(v)=6^(k+1) AND columns(v)=1} =
      LET eij = (LAMBDA (i,j): IF i>=6^(k+1) OR j>=1 THEN 0 ELSE NSol_all(k,a,n,GF,KF,base_n(6,i)) ENDIF)
      IN form_matrix(eij,6^(k+1),1)


decl_type: constant
theory: tarski_query_matrix
library: Tarski
signature: {M: PosFullMatrix | rows(M) = 6 AND columns(M) = 6}
location: 42 2 48 36
body:
    A66_inv: {M: PosFullMatrix | rows(M)=6 AND columns(M)=6} =
      (: (: 1,   1,   1, 0, 0, 0 :), 
                       (: 0,   1,  -1, 0, 0, 0 :), 
                       (: 0,   1,   1, 0, 0, 0 :), 
                       (: 0,  -1,  -1, 1, 0, 0 :), 
                       (:-1,  -1,   0, 0, 1, 0 :), 
                       (:-1,   0,  -1, 0, 0, 1 :) :)


decl_type: constant
theory: tarski_query_matrix
library: Tarski
location: 50 2 53 63
signature:
  {M: PosFullMatrix |
                rows(M) = 6 AND
                 columns(M) = 6 AND M = inverse(A66_inv)}

body:
    A66: {M: PosFullMatrix | rows(M)=6 AND columns(M)=6 AND M = inverse(A66_inv)} = 
     (: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1/2, 1/2, 0, 0, 0 :),
     (: 0, -1/2, 1/2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
     (: 1, 1/2, -1/2, 0, 1, 0 :), (: 1, -1/2, -1/2, 0, 0, 1 :) :)


decl_type: constant
theory: tarski_query_matrix
library: Tarski
signature: {M: PosFullMatrix | rows(M) = 6 AND columns(M) = 3}
location: 67 2 70 45
body:
    A63: {M: PosFullMatrix | rows(M)=6 AND columns(M)=3} = 
     (: (: 1, 0, -1  :), (: 0, 1/2, 1/2  :),
     (: 0, -1/2, 1/2  :), (: 0, 0, 1 :),
     (: 1, 1/2, -1/2 :), (: 1, -1/2, -1/2 :) :)


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 90 0 101 999
body:
  % Subtype TCC generated (at line 26, column 79) for  GPFun(i, j)
      % expected type  [nat -> subrange(0, 2)]
  TQ_vect3k_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            GPFun: [[nat, nat] -> [nat -> nat]]):
      GPFun = (LAMBDA (i, j): base_n(3, i)) IMPLIES
       (FORALL (i1: nat, j1: nat):
          NOT i1 >= 3 ^ (k + 1) AND NOT j1 >= 1 IMPLIES
           (FORALL (x1: nat):
              0 <= GPFun(i1, j1)(x1) AND GPFun(i1, j1)(x1) <= 2));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 103 0 124 999
body:
  % Subtype TCC generated (at line 27, column 7) for
      % form_matrix(eij, 3 ^ (k + 1), 1)
      % expected type  {v: PosFullMatrix |
                     %          rows(v) = 3 ^ (1 + k) AND columns(v) = 1}
  TQ_vect3k_TCC2: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            GPFun: [[nat, nat] -> [nat -> nat]]):
      GPFun = (LAMBDA (i, j): base_n(3, i)) IMPLIES
       (FORALL (eij: [[nat, nat] -> int]):
          (eij =
            (LAMBDA (i, j):
               IF i >= 3 ^ (k + 1) OR j >= 1 THEN 0
               ELSE TQ_fam(k, a, n, GF, KF, GPFun(i, j))
               ENDIF))
           IMPLIES
           (rows(form_matrix(eij, 3 ^ (k + 1), 1)) = 3 ^ (1 + k) AND
             columns(form_matrix(eij, 3 ^ (k + 1), 1)) = 1)
            AND
            rows(form_matrix(eij, 3 ^ (k + 1), 1)) > 0 AND
             columns(form_matrix(eij, 3 ^ (k + 1), 1)) > 0);


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 126 0 139 999
body:
  % Subtype TCC generated (at line 31, column 120) for  GPFun(i, j)
      % expected type  [nat -> subrange(0, 2)]
  TQ_vect6k_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            GPFun: [[nat, nat] -> [nat -> nat]]):
      GPFun = (LAMBDA (i, j): base_n(6, i)) IMPLIES
       (FORALL (i1: nat, j1: nat):
          NOT i1 >= 6 ^ (k + 1) AND
           NOT j1 >= 1 AND NOT (EXISTS (p: upto(k)): GPFun(i1, j1)(p) > 2)
           IMPLIES
           (FORALL (x1: nat):
              0 <= GPFun(i1, j1)(x1) AND GPFun(i1, j1)(x1) <= 2));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 141 0 164 999
body:
  % Subtype TCC generated (at line 32, column 7) for
      % form_matrix(eij, 6 ^ (k + 1), 1)
      % expected type  {v: PosFullMatrix |
                     %          rows(v) = 6 ^ (1 + k) AND columns(v) = 1}
  TQ_vect6k_TCC2: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            GPFun: [[nat, nat] -> [nat -> nat]]):
      GPFun = (LAMBDA (i, j): base_n(6, i)) IMPLIES
       (FORALL (eij: [[nat, nat] -> int]):
          (eij =
            (LAMBDA (i, j):
               IF i >= 6 ^ (k + 1) OR
                   j >= 1 OR (EXISTS (p: upto(k)): GPFun(i, j)(p) > 2)
                 THEN 0
               ELSE TQ_fam(k, a, n, GF, KF, GPFun(i, j))
               ENDIF))
           IMPLIES
           (rows(form_matrix(eij, 6 ^ (k + 1), 1)) = 6 ^ (1 + k) AND
             columns(form_matrix(eij, 6 ^ (k + 1), 1)) = 1)
            AND
            rows(form_matrix(eij, 6 ^ (k + 1), 1)) > 0 AND
             columns(form_matrix(eij, 6 ^ (k + 1), 1)) > 0);


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 166 0 174 999
body:
  % Subtype TCC generated (at line 35, column 88) for  base_n(3, i)
      % expected type  [nat -> subrange(0, 2)]
  NSol_vect3k_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            i: nat, j: nat):
      NOT i >= 3 ^ (k + 1) AND NOT j >= 1 IMPLIES
       (FORALL (x1: nat): 0 <= base_n(3, i)(x1) AND base_n(3, i)(x1) <= 2);


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 176 0 195 999
body:
  % Subtype TCC generated (at line 36, column 7) for
      % form_matrix(eij, 3 ^ (k + 1), 1)
      % expected type  {v: PosFullMatrix |
                     %          rows(v) = 3 ^ (1 + k) AND columns(v) = 1}
  NSol_vect3k_TCC2: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            eij: [[nat, nat] -> naturalnumber]):
      (eij =
        (LAMBDA (i, j):
           IF i >= 3 ^ (k + 1) OR j >= 1 THEN 0
           ELSE NSol(k, a, n, GF, KF, sig_seq(base_n(3, i)))
           ENDIF))
       IMPLIES
       (rows(form_matrix(eij, 3 ^ (k + 1), 1)) = 3 ^ (1 + k) AND
         columns(form_matrix(eij, 3 ^ (k + 1), 1)) = 1)
        AND
        rows(form_matrix(eij, 3 ^ (k + 1), 1)) > 0 AND
         columns(form_matrix(eij, 3 ^ (k + 1), 1)) > 0;


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 197 0 205 999
body:
  % Subtype TCC generated (at line 39, column 84) for  base_n(6, i)
      % expected type  [nat -> subrange(0, 5)]
  NSol_vect6k_TCC1: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            i: nat, j: nat):
      NOT i >= 6 ^ (k + 1) AND NOT j >= 1 IMPLIES
       (FORALL (x1: nat): 0 <= base_n(6, i)(x1) AND base_n(6, i)(x1) <= 5);


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 207 0 226 999
body:
  % Subtype TCC generated (at line 40, column 7) for
      % form_matrix(eij, 6 ^ (k + 1), 1)
      % expected type  {v: PosFullMatrix |
                     %          rows(v) = 6 ^ (1 + k) AND columns(v) = 1}
  NSol_vect6k_TCC2: OBLIGATION
    FORALL (k: nat, a: [nat -> int], (n: posnat | a(n) /= 0),
            GF: [nat -> [nat -> int]],
            (KF: [nat -> nat] | FORALL (i: upto(k)): GF(i)(KF(i)) /= 0),
            eij: [[nat, nat] -> naturalnumber]):
      (eij =
        (LAMBDA (i, j):
           IF i >= 6 ^ (k + 1) OR j >= 1 THEN 0
           ELSE NSol_all(k, a, n, GF, KF, base_n(6, i))
           ENDIF))
       IMPLIES
       (rows(form_matrix(eij, 6 ^ (k + 1), 1)) = 6 ^ (1 + k) AND
         columns(form_matrix(eij, 6 ^ (k + 1), 1)) = 1)
        AND
        rows(form_matrix(eij, 6 ^ (k + 1), 1)) > 0 AND
         columns(form_matrix(eij, 6 ^ (k + 1), 1)) > 0;


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 228 0 233 999
body:
  % Subtype TCC generated (at line 43, column 7) for  (: 1, 1, 1, 0, 0, 0 :)
      % expected type  list[real]
  A66_inv_TCC1: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 1, 1, 0, 0, 0 :));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 235 0 247 999
body:
  % Subtype TCC generated (at line 44, column 20) for
      % (: (: 0, 1, -1, 0, 0, 0 :), (: 0, 1, 1, 0, 0, 0 :),
      %    (: 0, -1, -1, 1, 0, 0 :), (: -1, -1, 0, 0, 1, 0 :),
      %    (: -1, 0, -1, 0, 0, 1 :) :)
      % expected type  list[list[real]]
  A66_inv_TCC2: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1, -1, 0, 0, 0 :), (: 0, 1, 1, 0, 0, 0 :),
            (: 0, -1, -1, 1, 0, 0 :), (: -1, -1, 0, 0, 1, 0 :),
            (: -1, 0, -1, 0, 0, 1 :) :));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 249 0 299 999
body:
  % Subtype TCC generated (at line 43, column 4) for
      % (: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
      %    (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
      %    (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :)
      % expected type  {M: PosFullMatrix | rows(M) = 6 AND columns(M) = 6}
  A66_inv_TCC3: OBLIGATION
         null?[list[real]]
             ((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                 (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                 (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
          OR
          (FORALL (i,
                   j:
                     below(length[list[real]]
                               ((: (: 1, 1, 1, 0, 0, 0 :),
                                   (: 0, 1, -1, 0, 0, 0 :),
                                   (: 0, 1, 1, 0, 0, 0 :),
                                   (: 0, -1, -1, 1, 0, 0 :),
                                   (: -1, -1, 0, 0, 1, 0 :),
                                   (: -1, 0, -1, 0, 0, 1 :) :)))):
             length[real]
                 (nth[list[real]]
                      ((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                          (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                          (: -1, -1, 0, 0, 1, 0 :),
                          (: -1, 0, -1, 0, 0, 1 :) :),
                       i))
              =
              length[real]
                  (nth[list[real]]
                       ((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                           (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                           (: -1, -1, 0, 0, 1, 0 :),
                           (: -1, 0, -1, 0, 0, 1 :) :),
                        j)))
     AND rows((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                 (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                 (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
          > 0
     AND columns((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                    (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                    (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
          > 0
     AND rows((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                 (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                 (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
          = 6
     AND columns((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                    (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                    (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
          = 6;


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 301 0 307 999
body:
  % Subtype TCC generated (at line 50, column 70) for  A66_inv
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  A66_TCC1: OBLIGATION
    FORALL (M: PosFullMatrix):
      columns(M) = 6 AND rows(M) = 6 IMPLIES
       rows(A66_inv) = columns(A66_inv) AND
        (det(A66_inv) /= 0 OR invertible?(A66_inv));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 309 0 314 999
body:
  % Subtype TCC generated (at line 51, column 6) for  (: 1, 0, -1, 0, 0, 0 :)
      % expected type  list[real]
  A66_TCC2: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 0, -1, 0, 0, 0 :));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 316 0 328 999
body:
  % Subtype TCC generated (at line 51, column 31) for
      % (: (: 0, 1 / 2, 1 / 2, 0, 0, 0 :), (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
      %    (: 0, 0, 1, 1, 0, 0 :), (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
      %    (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :)
      % expected type  list[list[real]]
  A66_TCC3: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1 / 2, 1 / 2, 0, 0, 0 :), (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
            (: 0, 0, 1, 1, 0, 0 :), (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
            (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 330 0 397 999
body:
  % Subtype TCC generated (at line 51, column 3) for
      % (: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
      %    (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
      %    (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
      %    (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :)
      % expected type  {M: PosFullMatrix |
                     %          rows(M) = 6 AND
                     %           columns(M) = 6 AND M = inverse(A66_inv)}
  A66_TCC4: OBLIGATION
         null?[list[real]]
             ((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                 (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
                 (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                 (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
          OR
          (FORALL (i,
                   j:
                     below(length[list[real]]
                               ((: (: 1, 0, -1, 0, 0, 0 :),
                                   (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                                   (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
                                   (: 0, 0, 1, 1, 0, 0 :),
                                   (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                                   (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :)))):
             length[real]
                 (nth[list[real]]
                      ((: (: 1, 0, -1, 0, 0, 0 :),
                          (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                          (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
                          (: 0, 0, 1, 1, 0, 0 :),
                          (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                          (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :),
                       i))
              =
              length[real]
                  (nth[list[real]]
                       ((: (: 1, 0, -1, 0, 0, 0 :),
                           (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                           (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
                           (: 0, 0, 1, 1, 0, 0 :),
                           (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                           (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :),
                        j)))
     AND rows((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                 (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
                 (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                 (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
          > 0
     AND columns((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                    (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
                    (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                    (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
          > 0
     AND rows((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                 (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
                 (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                 (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
          = 6
     AND columns((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                    (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
                    (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                    (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
          = 6
     AND (: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
            (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
            (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
            (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :)
          = inverse(A66_inv);


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 399 0 404 999
body:
  % Subtype TCC generated (at line 68, column 6) for  (: 1, 0, -1 :)
      % expected type  list[real]
  A63_TCC1: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 0, -1 :));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 406 0 416 999
body:
  % Subtype TCC generated (at line 68, column 23) for
      % (: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
      %    (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :)
      % expected type  list[list[real]]
  A63_TCC2: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
            (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :));


decl_type: tcc
theory: tarski_query_matrix
library: Tarski
signature: nil
location: 418 0 464 999
body:
  % Subtype TCC generated (at line 68, column 3) for
      % (: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :),
      %    (: 0, 0, 1 :), (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :)
      % expected type  {M: PosFullMatrix | rows(M) = 6 AND columns(M) = 3}
  A63_TCC3: OBLIGATION
         null?[list[real]]
             ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                 (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          OR
          (FORALL (i,
                   j:
                     below(length[list[real]]
                               ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                                   (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                                   (: 1, 1 / 2, -1 / 2 :),
                                   (: 1, -1 / 2, -1 / 2 :) :)))):
             length[real]
                 (nth[list[real]]
                      ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                          (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                          (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :),
                       i))
              =
              length[real]
                  (nth[list[real]]
                       ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                           (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                           (: 1, 1 / 2, -1 / 2 :),
                           (: 1, -1 / 2, -1 / 2 :) :),
                        j)))
     AND rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                 (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          > 0
     AND columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                    (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                    (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          > 0
     AND rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                 (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                 (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          = 6
     AND columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                    (: 0, -1 / 2, 1 / 2 :), (: 0, 0, 1 :),
                    (: 1, 1 / 2, -1 / 2 :), (: 1, -1 / 2, -1 / 2 :) :))
          = 3;


decl_type: formula
theory: poly_systems
library: Tarski
signature: nil
location: 20 2 26 38
body:
    system_roots_enum: LEMMA 
      (FORALL (i):i<=k IMPLIES p(i)(n(i))/=0) IMPLIES
        EXISTS (K:nat,enum:[below(K)->real]):
          (FORALL (i,j:below(K)): i<j IMPLIES enum(i)<enum(j)) AND
          (FORALL (i:below(K)): EXISTS (j): j<=k AND polynomial(p(j),n(j))(enum(i))=0) AND
          (FORALL (b,j): j<=k AND polynomial(p(j),n(j))(b)=0 IMPLIES
            EXISTS (i:below(K)): b = enum(i))


decl_type: formula
theory: poly_systems
library: Tarski
signature: nil
location: 28 2 35 43
body:
    strict_poly_system_solvable: LEMMA (FORALL (i):i<=k IMPLIES p(i)(n(i))/=0) IMPLIES
      ((EXISTS (x): FORALL (i): i<=k IMPLIES polynomial(p(i),n(i))(x)>0)
      IFF
      ((FORALL (i): i<=k IMPLIES p(i)(n(i))>0) OR
       (FORALL (i): i<=k IMPLIES (IF odd?(n(i)) THEN -1 ELSE 1 ENDIF)*p(i)(n(i))>0) OR
       (EXISTS (x): (LET Q = prod_polynomials(p,n,(LAMBDA (i:nat): 1),k),Qdeg = sigma(0,k,n) IN
           Qdeg>0 AND polynomial(poly_deriv(Q),Qdeg-1)(x)=0) AND FORALL (i): i<=k 
                                          IMPLIES polynomial(p(i),n(i))(x)>0)))


decl_type: formula
theory: poly_systems
library: Tarski
signature: nil
location: 47 2 50 53
body:
    A63_tensor_power_mat_row_def: LEMMA 
      LET ii = base_n_to_nat(6,RelF6,k) IN
        A63_tensor_power_mat_row(1+k)(RelF6) =
        vect2matrix(row(tensor_power_alt(A63,1+k))(ii))


decl_type: function
theory: poly_systems
library: Tarski
location: 41 2 45 19
signature:
  [m: posnat ->
          [[nat -> subrange(0, 5)] ->
             {M: PosFullMatrix | rows(M) = 1 AND columns(M) = 3 ^ m}]]

body:
    A63_tensor_power_mat_row(m)(RelF6): RECURSIVE {M:PosFullMatrix|rows(M)=1 AND columns(M)=3^m} =
      IF m = 1 THEN vect2matrix(row(A63)(RelF6(0)))
      ELSE tensor_prod(A63_tensor_power_mat_row(m-1)((LAMBDA (d): RelF6(d+1))),
              vect2matrix(row(A63)(RelF6(0))))
      ENDIF MEASURE m


decl_type: function
theory: poly_systems
library: Tarski
location: 52 2 55 92
signature:
  [d:
          [k: nat, a: [nat -> int], {m | a(m) /= 0},
           p: [nat -> [nat -> int]],
           {n | FORALL (i: upto(k)): p(i)(n(i)) /= 0},
           [nat -> subrange(0, 5)]] ->
          {r: real |
                   r = NSol_all(d`1, d`2, d`3, d`4, d`5, d`6) AND
                    rational_pred(r) AND integer_pred(r)}]

body:
    sturm_tarski_solver_slow_basic(k,a,(m|a(m)/=0),p,
                  (n|FORALL (i:upto(k)):p(i)(n(i))/=0),RelF6):
      {r:real | r = NSol_all(k,a,m,p,n,RelF6) AND rational_pred(r) AND integer_pred(r)} =
          super_dot(row(A63_tensor_power_mat_row(k+1)(RelF6))(0),col(TQ_vect3k(k,a,m,p,n))(0))


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 66 0 104 999
body:
  % Subtype TCC generated (at line 33, column 86) for  k
      % expected type  T_high[nat]
  strict_poly_system_solvable_TCC1: OBLIGATION
    FORALL (k: nat, n: [nat -> nat], p: [nat -> [nat -> int]]):
      (FORALL (i): i <= k IMPLIES p(i)(n(i)) /= 0) AND
       NOT (FORALL (i): i <= k IMPLIES p(i)(n(i)) > 0) AND
        NOT (FORALL (i):
               i <= k IMPLIES
                (IF odd?(n(i)) THEN -1 ELSE 1 ENDIF) * p(i)(n(i)) > 0)
       IMPLIES
       (FORALL (Q:
                  {a |
                           (FORALL (x):
                              polynomial(a,
                                         sigma[nat]
                                         (0,
                                          k,
                                          *[nat](n, (LAMBDA (i: nat): 1))))
                                        (x)
                               =
                               product[nat]
                                   (0, k,
                                    LAMBDA (j):
                                      polynomial(p(j), n(j))(x) ^ 1))
                            AND
                            ((FORALL (i_1: nat):
                                i_1 <= k IMPLIES p(i_1)(n(i_1)) /= 0)
                              IMPLIES
                              a(sigma[nat]
                                    (0, k, *[nat](n, (LAMBDA (i: nat): 1))))
                               /= 0)
                             AND
                             (FORALL (i_1: nat):
                                i_1 >
                                 sigma[nat]
                                     (0, k, *[nat](n, (LAMBDA (i: nat): 1)))
                                 IMPLIES a(i_1) = 0)}):
          Q = prod_polynomials(p, n, (LAMBDA (i: nat): 1), k) IMPLIES
           k >= 0 OR (EXISTS (j: nat): k <= j));


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 106 0 145 999
body:
  % Subtype TCC generated (at line 34, column 45) for  Qdeg - 1
      % expected type  nat
  strict_poly_system_solvable_TCC2: OBLIGATION
    FORALL (k: nat, n: [nat -> nat], p: [nat -> [nat -> int]]):
      (FORALL (i): i <= k IMPLIES p(i)(n(i)) /= 0) AND
       NOT (FORALL (i): i <= k IMPLIES p(i)(n(i)) > 0) AND
        NOT (FORALL (i):
               i <= k IMPLIES
                (IF odd?(n(i)) THEN -1 ELSE 1 ENDIF) * p(i)(n(i)) > 0)
       IMPLIES
       (FORALL (Q:
                  {a |
                           (FORALL (x):
                              polynomial(a,
                                         sigma[nat]
                                         (0,
                                          k,
                                          *[nat](n, (LAMBDA (i: nat): 1))))
                                        (x)
                               =
                               product[nat]
                                   (0, k,
                                    LAMBDA (j):
                                      polynomial(p(j), n(j))(x) ^ 1))
                            AND
                            ((FORALL (i_1: nat):
                                i_1 <= k IMPLIES p(i_1)(n(i_1)) /= 0)
                              IMPLIES
                              a(sigma[nat]
                                    (0, k, *[nat](n, (LAMBDA (i: nat): 1))))
                               /= 0)
                             AND
                             (FORALL (i_1: nat):
                                i_1 >
                                 sigma[nat]
                                     (0, k, *[nat](n, (LAMBDA (i: nat): 1)))
                                 IMPLIES a(i_1) = 0)}):
          Q = prod_polynomials(p, n, (LAMBDA (i: nat): 1), k) IMPLIES
           (FORALL (Qdeg: nat):
              Qdeg > 0 AND Qdeg = sigma(0, k, n) IMPLIES Qdeg - 1 >= 0));


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 147 0 151 999
body:
  % Subtype TCC generated (at line 42, column 30) for  row(A63)(RelF6(0))
      % expected type  v: {v | length(v) > 0}
  A63_tensor_power_mat_row_TCC1: OBLIGATION
    FORALL (m: posnat, RelF6: [nat -> subrange(0, 5)]):
      m = 1 IMPLIES length[real](row(A63)(RelF6(0))) > 0;


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 153 0 160 999
body:
  % Subtype TCC generated (at line 42, column 18) for
      % vect2matrix(row(A63)(RelF6(0)))
      % expected type  {M: PosFullMatrix | rows(M) = 1 AND columns(M) = 3 ^ m}
  A63_tensor_power_mat_row_TCC2: OBLIGATION
    FORALL (m: posnat, RelF6: [nat -> subrange(0, 5)]):
      m = 1 IMPLIES
       rows(vect2matrix(row(A63)(RelF6(0)))) = 1 AND
        columns(vect2matrix(row(A63)(RelF6(0)))) = 3 ^ m;


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 162 0 166 999
body:
  % Subtype TCC generated (at line 43, column 46) for  m - 1
      % expected type  m: posnat
  A63_tensor_power_mat_row_TCC3: OBLIGATION
    FORALL (m: posnat, RelF6: [nat -> subrange(0, 5)]):
      NOT m = 1 IMPLIES m - 1 >= 0 AND m - 1 > 0;


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 168 0 172 999
body:
  % Termination TCC generated (at line 43, column 21) for
      % A63_tensor_power_mat_row(m - 1)
  A63_tensor_power_mat_row_TCC4: OBLIGATION
    FORALL (m: posnat, RelF6: [nat -> subrange(0, 5)]):
      NOT m = 1 IMPLIES m - 1 < m;


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 174 0 178 999
body:
  % Subtype TCC generated (at line 44, column 24) for  row(A63)(RelF6(0))
      % expected type  v: {v | length(v) > 0}
  A63_tensor_power_mat_row_TCC5: OBLIGATION
    FORALL (m: posnat, RelF6: [nat -> subrange(0, 5)]):
      NOT m = 1 IMPLIES length[real](row(A63)(RelF6(0))) > 0;


decl_type: tcc
theory: poly_systems
library: Tarski
signature: nil
location: 180 0 200 999
body:
  % Subtype TCC generated (at line 43, column 9) for
      % tensor_prod(A63_tensor_power_mat_row(m - 1)
      %                                     ((LAMBDA (d): RelF6(d + 1))),
      %             vect2matrix(row(A63)(RelF6(0))))
      % expected type  {M: PosFullMatrix | rows(M) = 1 AND columns(M) = 3 ^ m}
  A63_tensor_power_mat_row_TCC6: OBLIGATION
    FORALL (m: posnat,
            v:
              [m1: {z: posnat | z < m} ->
                 [[nat -> subrange(0, 5)] ->
                    {M: PosFullMatrix |
                             rows(M) = 1 AND columns(M) = 3 ^ m1}]],
            RelF6: [nat -> subrange(0, 5)]):
      NOT m = 1 IMPLIES
       rows(tensor_prod(v(m - 1)(LAMBDA (d): RelF6(d + 1)),
                        vect2matrix(row(A63)(RelF6(0)))))
        = 1
        AND
        columns(tensor_prod(v(m - 1)(LAMBDA (d): RelF6(d + 1)),
                            vect2matrix(row(A63)(RelF6(0)))))
         = 3 ^ m;


