
theorem lemmacardeven:
  for n being Nat st n is odd holds card (n /\ EvenNAT) = (n div 2) + 1
  proof
    0 is even; then
    ze: 0 in EvenNAT by NUMERAL2:def 1;
    let n be Nat;
    assume n: n is odd;
    defpred P[Nat] means $1 is odd implies card ($1 /\ EvenNAT) = ($1 div 2)+1;
    i: for n being Nat st for k being Nat st k<n holds P[k] holds P[n]
    proof
      let n be Nat;
      assume k: for k being Nat st k<n holds P[k];
      assume nod: n is odd;
      then reconsider no=n as odd Nat;
      per cases;
      suppose nd: n >= 2;
        then n >= 1 by XXREAL_0:2;
        then reconsider nj=no-1 as even Nat by NAT_1:21;
        n - 1 < n-0 by XREAL_1:15;
        then njz: nj < n;
        nj >= 2-1 by nd,XREAL_1:9;
        then reconsider nd=nj-1 as odd Nat by NAT_1:21;
        n - 2 < n-0 by XREAL_1:15;
        then ndz: nd < n;
        then tc: card (nd /\ EvenNAT) = (nd div 2)+1 by k;
        n-2 < n-1 by XREAL_1:15;
        then njd: nd < nj;

        reconsider X=nd/\EvenNAT as finite set;
        reconsider Y=n/\EvenNAT as finite set;
        reconsider Z={nd,nj}/\EvenNAT as finite set;
        sen: Segm nd c= Segm n by ndz,NAT_1:39;

        n=nd\/{nj,nd}
        proof
          thus n c= nd\/{nj,nd}
          proof
            let o be object;
            assume o in n;
            then os: o in Segm n;
            then reconsider on=o as Nat;
            per cases;
            suppose on < nd;
              then card Segm on in card Segm nd by NAT_1:41;
              then on in nd;
              hence o in nd\/{nj,nd} by XBOOLE_0:def 3;
            end;
            suppose on: on >= nd;
              card Segm on in card Segm n by os;
              then on < nj+1 by NAT_1:41;
              then on <= nd+1 by NAT_1:13;
              then on = nd or on=nj by on,NAT_1:9;
              then on in {nd,nj} by TARSKI:def 2;
              hence o in nd\/{nj,nd} by XBOOLE_0:def 3;
            end;
          end;
          thus nd\/{nj,nd} c= n
          proof
            let o be object;
            assume o in nd\/{nj,nd};
            then o in nd or o in {nj,nd} by XBOOLE_0:def 3;
            then per cases by TARSKI:def 2;
            suppose o in nd;
              hence o in n by sen;
            end;
            suppose on: o=nj;
              card Segm nj in card Segm n by NAT_1:41,njz;
              hence o in n by on;
            end;
            suppose on: o=nd;
              card Segm nd in card Segm n by NAT_1:41,ndz;
              hence o in n by on;
            end;
          end;
        end;
        then xyz: Y = X \/ Z by XBOOLE_1:23;

        X /\ Z  = {}
        proof
          thus X /\ Z c= {}
          proof
            let o be object;
            assume o in X /\ Z;
            then ox: o in X & o in Z by XBOOLE_0:def 4;
            then o in {nd,nj} by XBOOLE_0:def 4;
            then per cases by TARSKI:def 2;
            suppose o=nd;
              then nd in nd by ox,XBOOLE_0:def 4;
              hence thesis;
            end;
            suppose o=nj;
              then card Segm nj in card Segm nd by ox,XBOOLE_0:def 4;
              hence thesis by njd,NAT_1:41;
            end;
          end;
          thus {} c= X /\ Z by XBOOLE_1:2;
        end;
        then xmz: X misses Z by XBOOLE_0:def 7;
        Z = {nj}
        proof
          thus Z c= {nj}
          proof
            let o be object;
            assume o in Z;
            then o in {nd,nj} & o in EvenNAT by XBOOLE_0:def 4;
            then oj: (o=nd or o=nj) & o in EvenNAT by TARSKI:def 2;
            then consider oj being Nat such that
            ojoj: oj=o & oj is even by NUMERAL2:def 1;
            o=nj by oj,ojoj;
            hence o in {nj} by TARSKI:def 1;
          end;
          thus {nj} c= Z
          proof
            let o be object;
            assume o in {nj};
            then o=nj by TARSKI:def 1;
            then o in {nd,nj} & o in EvenNAT by TARSKI:def 2,NUMERAL2:def 1;
            hence o in Z by XBOOLE_0:def 4;
          end;
        end;
        then card Z = 1 by CARD_2:42;
        hence card (n /\ EvenNAT) = (nd div 2)+1 + 1 by tc,xyz,xmz,CARD_2:40
        .= (nd-1)/2 +1 + 1 by NAT_6:5
        .= ((no-1)/2)+1
        .= (n div 2)+1 by NAT_6:5;
      end;
      suppose n < 2;
        then j: n=1 by nod,NAT_1:23;
        then n={0} by CARD_1:49;
        then n /\ EvenNAT = {0} by ze,ZFMISC_1:46;
        hence card (n /\ EvenNAT) = ((no-1)/2)+1 by j,CARD_1:30
        .= (n div 2)+1 by NAT_6:5;
      end;
    end;
    for n being Nat holds P[n] from NAT_1:sch 4(i);
    hence card (n /\ EvenNAT) = (n div 2)+1 by n;
  end;
