val equal_counts (#a: eqtype) (xs ys: list a) : Type0
let equal_counts (#a:eqtype) (xs ys:list a) : Type0 =
  (forall (e:a).{:pattern (count e xs) \/ (count e ys)} count e xs == count e ys)
val equal_counts (#a: eqtype) (xs ys: list a) : Type0
let equal_counts (#a: eqtype) (xs ys: list a) : Type0 =
(forall (e: a). {:pattern (count e xs)\/(count e ys)} count e xs == count e ys)
FStar.Tactics.CanonCommSwaps.fst.checked
prims.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked
FStar.Tactics.CanonCommSwaps.fst
Prims.eqtype Prims.list Prims.l_Forall Prims.eq2 Prims.nat FStar.List.Tot.Base.count
(*
   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)
                  (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

let apply_swap (#a:Type) = apply_swap_aux #a 0

let rec apply_swaps (#a:Type) (xs:list a) (ss:list (swap (length xs))) :
    Pure (list a) (requires True)
                  (ensures (fun zs -> length zs == length xs)) (decreases ss) =
  match ss with
  | [] -> xs
  | s::ss' -> apply_swaps (apply_swap xs s) ss'
val equal_counts (#a: eqtype) (xs ys: list a) : Type0
xs: Prims.list a -> ys: Prims.list a -> Type0