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 balance_vcg.balance.Roberval.
Open Scope Z_scope.
Theorem solve12'vc (counter : Roberval.counter) (j : Z) (balls : list Z) (w : Z) (b : bool) (fact0 : v counter = 3%Z) (fact1 : 0%Z ≤ j) (fact2 : j < 12%Z) (fact3 : 12%Z = Z.of_nat (length balls)) (fact4 : ∀(i : Z), 0%Z ≤ i ∧ i < 12%Z -> ¬ i = j -> nth (Z.to_nat i) balls inhabitant = w) (fact5 : if decide (b = true) then nth (Z.to_nat j) balls inhabitant < w else w < nth (Z.to_nat j) balls inhabitant) : 0%Z ≤ 7%Z ∧ 7%Z < Z.of_nat (length balls) ∧ 0%Z ≤ 6%Z ∧ 6%Z < Z.of_nat (length balls) ∧ 0%Z ≤ 5%Z ∧ 5%Z < Z.of_nat (length balls) ∧ 0%Z ≤ 4%Z ∧ 4%Z < Z.of_nat (length balls) ∧ (let o1 : Z := nth 4%nat balls inhabitant + nth 5%nat balls inhabitant + nth 6%nat balls inhabitant + nth 7%nat balls inhabitant in (0%Z ≤ 3%Z ∧ 3%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 2%Z ∧ 2%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 1%Z ∧ 1%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 0%Z ∧ 0%Z < Z.of_nat (length balls)) ∧ (let o2 : Z := nth 0%nat balls inhabitant + nth 1%nat balls inhabitant + nth 2%nat balls inhabitant + nth 3%nat balls inhabitant in 0%Z < v counter ∧ (∀(counter1 : Roberval.counter) (o3 : outcome), (match o3 with | Left => o1 < o2 | Equal => o2 = o1 | Right => o2 < o1 end) ∧ v counter1 = v counter - 1%Z -> (match o3 with | Equal => (0%Z ≤ 10%Z ∧ 10%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 9%Z ∧ 9%Z < Z.of_nat (length balls)) ∧ (let o4 : Z := nth 9%nat balls inhabitant + nth 10%nat balls inhabitant in (0%Z ≤ 8%Z ∧ 8%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 0%Z ∧ 0%Z < Z.of_nat (length balls)) ∧ (let o5 : Z := nth 0%nat balls inhabitant + nth 8%nat balls inhabitant in 0%Z < v counter1 ∧ (∀(counter2 : Roberval.counter) (o6 : outcome), (match o6 with | Left => o4 < o5 | Equal => o5 = o4 | Right => o5 < o4 end) ∧ v counter2 = v counter1 - 1%Z -> (match o6 with | Equal => (0%Z ≤ 11%Z ∧ 11%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 11%nat balls inhabitant in (0%Z ≤ 0%Z ∧ 0%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 0%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Right => result = 11%Z ∧ result1 = false | _ => result = 11%Z ∧ result1 = true end) -> result = j ∧ result1 = b)))) | Right => (0%Z ≤ 10%Z ∧ 10%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 10%nat balls inhabitant in (0%Z ≤ 9%Z ∧ 9%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 9%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 8%Z ∧ result1 = true | Right => result = 10%Z ∧ result1 = false | Left => result = 9%Z ∧ result1 = false end) -> result = j ∧ result1 = b)))) | Left => (0%Z ≤ 10%Z ∧ 10%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 10%nat balls inhabitant in (0%Z ≤ 9%Z ∧ 9%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 9%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 8%Z ∧ result1 = false | Right => result = 9%Z ∧ result1 = true | Left => result = 10%Z ∧ result1 = true end) -> result = j ∧ result1 = b)))) end)))) | Right => (0%Z ≤ 8%Z ∧ 8%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 5%Z ∧ 5%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 2%Z ∧ 2%Z < Z.of_nat (length balls)) ∧ (let o4 : Z := nth 2%nat balls inhabitant + nth 5%nat balls inhabitant + nth 8%nat balls inhabitant in (0%Z ≤ 4%Z ∧ 4%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 1%Z ∧ 1%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 0%Z ∧ 0%Z < Z.of_nat (length balls)) ∧ (let o5 : Z := nth 0%nat balls inhabitant + nth 1%nat balls inhabitant + nth 4%nat balls inhabitant in 0%Z < v counter1 ∧ (∀(counter2 : Roberval.counter) (o6 : outcome), (match o6 with | Left => o4 < o5 | Equal => o5 = o4 | Right => o5 < o4 end) ∧ v counter2 = v counter1 - 1%Z -> (match o6 with | Equal => (0%Z ≤ 7%Z ∧ 7%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 7%nat balls inhabitant in (0%Z ≤ 6%Z ∧ 6%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 6%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 3%Z ∧ result1 = true | Right => result = 7%Z ∧ result1 = false | Left => result = 6%Z ∧ result1 = false end) -> result = j ∧ result1 = b)))) | Right => (0%Z ≤ 1%Z ∧ 1%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 1%nat balls inhabitant in (0%Z ≤ 0%Z ∧ 0%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 0%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 5%Z ∧ result1 = false | Right => result = 0%Z ∧ result1 = true | Left => result = 1%Z ∧ result1 = true end) -> result = j ∧ result1 = b)))) | Left => (0%Z ≤ 8%Z ∧ 8%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 8%nat balls inhabitant in (0%Z ≤ 4%Z ∧ 4%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 4%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 2%Z ∧ result1 = true | _ => result = 4%Z ∧ result1 = false end) -> result = j ∧ result1 = b)))) end)))) | Left => (0%Z ≤ 8%Z ∧ 8%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 5%Z ∧ 5%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 2%Z ∧ 2%Z < Z.of_nat (length balls)) ∧ (let o4 : Z := nth 2%nat balls inhabitant + nth 5%nat balls inhabitant + nth 8%nat balls inhabitant in (0%Z ≤ 4%Z ∧ 4%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 1%Z ∧ 1%Z < Z.of_nat (length balls)) ∧ (0%Z ≤ 0%Z ∧ 0%Z < Z.of_nat (length balls)) ∧ (let o5 : Z := nth 0%nat balls inhabitant + nth 1%nat balls inhabitant + nth 4%nat balls inhabitant in 0%Z < v counter1 ∧ (∀(counter2 : Roberval.counter) (o6 : outcome), (match o6 with | Left => o4 < o5 | Equal => o5 = o4 | Right => o5 < o4 end) ∧ v counter2 = v counter1 - 1%Z -> (match o6 with | Equal => (0%Z ≤ 7%Z ∧ 7%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 7%nat balls inhabitant in (0%Z ≤ 6%Z ∧ 6%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 6%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 3%Z ∧ result1 = false | Right => result = 6%Z ∧ result1 = true | Left => result = 7%Z ∧ result1 = true end) -> result = j ∧ result1 = b)))) | Right => (0%Z ≤ 5%Z ∧ 5%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 5%nat balls inhabitant in (0%Z ≤ 2%Z ∧ 2%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 2%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 4%Z ∧ result1 = true | Right => result = 5%Z ∧ result1 = false | Left => result = 2%Z ∧ result1 = false end) -> result = j ∧ result1 = b)))) | Left => (0%Z ≤ 1%Z ∧ 1%Z < Z.of_nat (length balls)) ∧ (let o7 : Z := nth 1%nat balls inhabitant in (0%Z ≤ 0%Z ∧ 0%Z < Z.of_nat (length balls)) ∧ (let o8 : Z := nth 0%nat balls inhabitant in 0%Z < v counter2 ∧ (∀(counter3 : Roberval.counter) (o9 : outcome), (match o9 with | Left => o7 < o8 | Equal => o8 = o7 | Right => o8 < o7 end) ∧ v counter3 = v counter2 - 1%Z -> (∀(result : Z) (result1 : bool), (match o9 with | Equal => result = 5%Z ∧ result1 = true | Right => result = 1%Z ∧ result1 = false | Left => result = 0%Z ∧ result1 = false end) -> result = j ∧ result1 = b)))) end)))) end)))).
Admitted.
