From Stdlib Require Import Strings.String.
From Stdlib Require Import String Ascii.
From Stdlib Require Arith.
From stdpp Require Import base.
From stdpp Require Import fin_maps.
From stdpp Require Import gmap.
From stdpp Require Import base gmultiset.
From Stdlib Require Classical.
From Stdlib Require Import ZArith.
From stdpp.bitvector Require Import definitions tactics.
From Stdlib Require Import Sorting.Sorted.
From Stdlib Require Import Reals.Rbasic_fun.
From Stdlib Require Import Reals.Abstract.ConstructiveAbs.
From Stdlib Require Import Reals.Rdefinitions.
From stdpp Require Import list_relations.
From stdpp Require Import list_numbers.
From stdpp Require Import functions.
From Stdlib Require Import ClassicalEpsilon.
From stdpp Require Import base decidable.
From Stdlib Require Import ZArith.Zeuclid.
From Stdlib Require Import ZArith.Znumtheory.
From stdpp Require Import propset.
From Stdlib Require Import Reals.
Require Import Why3.Base.
Require Import Why3.why3.Ref.Ref.
Require Import Why3.map.MapEq.
Require Import Why3.map.MapExchange.
Require Import Why3.map.MapPermut.
Require Import Why3.array.IntArraySorted.
Open Scope Z_scope.
Definition qs_partition (t1 : list Z) (t2 : list Z) (m : Z) (n : Z) (i : Z) (j : Z) (x : Z) := permut_sub' t1 t2 (Z.to_nat m) (Z.to_nat (n + 1%Z)) ∧ (∀(k : Z), m ≤ k ∧ k ≤ j -> nth (Z.to_nat k) t2 inhabitant ≤ x) ∧ (∀(k : Z), j < k ∧ k < i -> nth (Z.to_nat k) t2 inhabitant = x) ∧ (∀(k : Z), i ≤ k ∧ k ≤ n -> x ≤ nth (Z.to_nat k) t2 inhabitant).
Theorem qs'vc (a : list Z) : if decide (0%Z < Z.of_nat (length a)) then let o1 : Z := Z.of_nat (length a) - 1%Z in (0%Z ≤ 0%Z ∧ 0%Z ≤ o1 ∧ o1 < Z.of_nat (length a)) ∧ (∀(a1 : list Z), length a1 = length a -> permut_sub' a a1 0%nat (Z.to_nat (o1 + 1%Z)) ∧ sorted_sub1 a1 0%Z (o1 + 1%Z) -> a ≡ₚ a1 ∧ sorted a1) else a ≡ₚ a ∧ sorted a.
Admitted.
