val apply_swap_aux (#a: Type) (n: nat) (xs: list a) (s: swap (length xs + n))
    : Pure (list a) (requires True) (ensures (fun zs -> length zs == length xs)) (decreases xs)
let rec apply_swap_aux (#a:Type) (n:nat) (xs:list a) (s:swap (length xs + n)) :
    Pure (list a) (requires True)
                  (ensures (fun zs -> length zs == length xs)) (decreases xs) =
  match xs with
  | [] | [_] -> xs
  | x1 :: x2 :: xs' -> if n = (s <: nat)
                       then x2 :: x1 :: xs'
                       else x1 :: apply_swap_aux (n+1) (x2 :: xs') s
val apply_swap_aux (#a: Type) (n: nat) (xs: list a) (s: swap (length xs + n))
    : Pure (list a) (requires True) (ensures (fun zs -> length zs == length xs)) (decreases xs)
let rec apply_swap_aux (#a: Type) (n: nat) (xs: list a) (s: swap (length xs + n))
    : Pure (list a) (requires True) (ensures (fun zs -> length zs == length xs)) (decreases xs) =
match xs with
| [] | [_] -> xs
| x1 :: x2 :: xs' ->
  if n = (s <: nat) then x2 :: x1 :: xs' else x1 :: apply_swap_aux (n + 1) (x2 :: xs') s
FStar.Tactics.CanonCommSwaps.fst.checked
prims.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked
FStar.Tactics.CanonCommSwaps.fst
Prims.nat Prims.list FStar.Tactics.CanonCommSwaps.swap Prims.op_Addition FStar.List.Tot.Base.length Prims.op_Equality Prims.Cons Prims.bool FStar.Tactics.CanonCommSwaps.apply_swap_aux Prims.l_True Prims.eq2
(*
   Copyright 2008-2018 Microsoft Research

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*)
module FStar.Tactics.CanonCommSwaps

open FStar.List.Tot

let swap (n:nat) :Type = x:nat{x < n-1}

let rec apply_swap_aux (#a:Type) (n:nat) (xs:list a) (s:swap (length xs + n)) :
    Pure (list a) (requires True)
val apply_swap_aux (#a: Type) (n: nat) (xs: list a) (s: swap (length xs + n))
    : Pure (list a) (requires True) (ensures (fun zs -> length zs == length xs)) (decreases xs)

    n: Prims.nat ->
    xs: Prims.list a ->
    s: FStar.Tactics.CanonCommSwaps.swap (FStar.List.Tot.Base.length xs + n)
  -> Prims.Pure (Prims.list a)