Library probsa.util.misc

(* --------------------------- Reals and SSReflect -------------------------- *)
Require Export Reals Psatz.
From mathcomp Require Export ssreflect ssrnat ssrbool seq eqtype fintype.

(* --------------------------------- Prosa ---------------------------------- *)
From prosa.util Require Import list.

(* --------------------------------- ProBsa --------------------------------- *)
From probsa.util Require Export boolp.
Local Open Scope nat_scope.

(* ---------------------------------- Main ---------------------------------- *)
Definition min_option (xs : seq nat) : option nat :=
  match xs with
  | [::]None
  | h::tlSome (foldl minn h tl)
  end.

Definition min_default (d : nat) (xs : seq nat) : nat := foldl minn d xs.

We prove that any monotone function f : nat bool falls into one of the following cases: (1) f n is false for any n, (2) there exists t0 such that t, t > t0 f t, (3) or f n is always true. We note that this lemma uses the classical excluded middle axiom P : Prop, P ¬ P.
Lemma swithing_point_of_monotone_function :
   (f : nat bool),
    ( t1 t2, t1 t2 f t1 f t2)
    ( t, ¬ f t) ( t0, t, t > t0 f t) ( t, f t).

Function that changes a type of a job s by mapping s : Job to s : Job \ {j}.
Definition to_fintype {Job : finType} (s j : Job) (NEQ: s != j) :
  Finite.sort (seq_sub_finType (T:=Job) (rem (T:=Job) j (enum Job))).