Commit 4387b7c1 authored by Pascal Fradet's avatar Pascal Fradet

Clean PF version

parent 968de8c7
This diff is collapsed.
Require Import Arith NPeano List Omega.
Require Import event_model types.
Require Import Arith NPeano List Omega.
Require Import event_model types.
(* ########################################################### *)
(** * Evaluations *)
(* ########################################################### *)
Definition sigma1 (t : instant) : nb_occurrences :=
match t with
| 0 => 0
| 1 => 0
| 2 => 1
| 3 => 2
| 4 => 1
| 5 => 1
| 9 => 3
| n => 4
end.
Check delta.
(*
Example test_delta : @delta sigma1 AE 1 3 = 1.
unfold delta.
simpl.
unfold instant_of.
assert (H : instant_after sigma1 AE 3 0 = 3).
-
unfold instant_after.
elim sigma1.
induction sigma1.
unfold instant_after_func.
simpl.
induction.
Eval compute in (@next sigma1 AE 1).
(* ########################################################### *)
Definition sigma (t : instant) : nb_occurrences :=
match t with
| 0 => 0
| 1 => 0
| 2 => 1
| 3 => 2
| 4 => 0
| 5 => 0
| 6 => 3
| n => 1
end.
(*
Example test_delta : @delta sigma1 AE 1 3 = 1.
unfold delta.
simpl.
unfold instant_of.
assert (H : instant_after sigma1 AE 3 0 = 3).
-
unfold instant_after.
elim sigma1.
induction sigma1.
unfold instant_after_func.
simpl.
induction.
Eval compute in (@next sigma1 AE 1).
*)
\ No newline at end of file
This diff is collapsed.
Require Import NPeano Arith Omega.
Require Import event_functions trace types util.
Require Import NPeano Arith Omega.
Require Import event_functions trace types util tactics.
(* #################################################### *)
(* ** Definitions related to the event load function ** *)
(* #################################################### *)
Definition max_eta_trace (f : duration -> nb_occurrences) : Prop :=
forall t dt, eta t dt <= f dt.
(** The event load maximum function *)
Definition eta_max (f : duration -> nb_occurrences) : Prop :=
max_eta_trace f /\ subadditive f.
(* #################################################### *)
Definition max_eta_trace (f : duration -> nb_occurrences) : Prop :=
forall t dt, eta t dt <= f dt.
(** The event load maximum function *)
Definition eta_max (f : duration -> nb_occurrences) : Prop :=
max_eta_trace f /\ subadditive f.
(* ######################################################## *)
(* ** Definitions related to the event distance function ** *)
(* ######################################################## *)
Definition pseudo_superadditive (f : nat -> nat) : Prop :=
forall (x y : nat), f (x + 1) + f (y + 1) <= f (x + (y + 1)).
Definition pseudo_superadditive (f : nat -> nat) : Prop :=
forall (x y : nat), f (x + 1) + f (y + 1) <= f (x + (y + 1)).
Definition min_delta_trace (f : nb_occurrences -> duration) : Prop :=
forall n k, f k <= delta n k.
(** The event distance minimum function *)
Definition delta_min (f : nb_occurrences -> duration) : Prop :=
min_delta_trace f /\ pseudo_superadditive f.
(* Relation between delta and eta_max *)
Property eta_max_by_delta :
forall n k (eta_plus : duration -> nb_occurrences),
max_eta_trace eta_plus
-> k <= eta_plus ((delta n k) + 1).
Proof.
intros.
unfold max_eta_trace in H.
transitivity (eta (instant_of n) (delta n k +1)).
apply delta_to_eta.
apply H.
Qed.
(* ######################################################## *)
Definition pseudo_superadditive (f : nat -> nat) : Prop :=
forall (x y : nat), f (x + 1) + f (y + 1) <= f (x + (y + 1)).
Definition min_delta_trace (f : nb_occurrences -> duration) : Prop :=
forall n k, 1 <= n -> f k <= delta n k.
(** The event distance minimum function *)
Definition delta_min (f : nb_occurrences -> duration) : Prop :=
min_delta_trace f /\ pseudo_superadditive f.
(* Relation between delta and eta_max *)
Property eta_max_by_delta :
forall n k (eta_plus : duration -> nb_occurrences),
1 <= n -> 1 <= k -> max_eta_trace eta_plus
-> k <= eta_plus ((delta n k) + 1).
Proof.
introv I1 I2 H.
transitivity (eta (instant_of n) (delta n k +1)).
eapply delta_to_eta; try easy.
apply H.
Qed.
\ No newline at end of file
(* ------------------------------------------------------- *)
(** #<hr> <center> <h1>#
Basic and simple tactics and notations
(mostly taken form Software Foundations' LibTactics.v
with a few complements)
#</h1>#
Basic tactics and notations
(mostly taken from Software Foundations' LibTactics.v
with a few complements)
#</h1>#
#</center> <hr># *)
(* Pascal Fradet - 2014_2015 *)
(* ------------------------------------------------------- *)
......@@ -614,7 +614,7 @@ Tactic Notation "inverts" hyp(H) "as" simple_intropattern(I1)
(* and the following small shortcuts *)
(* ####################################################### *)
Ltac easy := solve [simpl; intros; auto].
Ltac easy := solve [cbn; intros; auto].
(* Ltac easy := solve [simpl; intros; info_auto]. *)
Ltac dupl_base h1 h2 := generalize h1; intro h2.
......
This diff is collapsed.
Require Import List Coq.Logic.ConstructiveEpsilon Coq.Logic.Decidable Omega.
Require Import tactics.
Require Import List Coq.Logic.ConstructiveEpsilon Coq.Logic.Decidable Omega Psatz.
Require Import tactics.
(* ########################### *)
(* ** Arithmetic properties ** *)
(* ########################### *)
Property plus_le_reg_r :
forall n m p,
n + p <= m + p -> n <= m.
Proof.
intros.
apply plus_le_reg_l with (p := p). omega.
Qed.
Property plus_le_min:
forall a b c,
a <= b -> b - c = b - a + a - c .
Proof.
intros a b c H; omega.
Qed.
(* ########################### *)
Lemma neq_le_imp_lt : forall a b, a <> b -> a <= b -> a < b.
Proof. introv N I. omega. Qed.
Lemma le_sub_eq : forall a b, b <= a -> a <= b <-> a=b.
Proof. intros. omega. Qed.
Lemma le_sub_plus : forall a b c, b <= a -> a - b + c = a + c - b.
Proof. intros. omega. Qed.
Lemma le_sub_add : forall a b, a <= b -> a + (b - a) = b.
Proof. intros. omega. Qed.
Lemma sub_S_1: forall a : nat, S a - 1 = a.
Proof. intros. omega. Qed.
Lemma plus_sub_S_1 : forall a b, a + S b - 1 = a + b.
Proof. intros. omega. Qed.
Theorem le_minus_0: forall a b, a <= b <-> a - b = 0.
Proof. intros. omega. Qed.
Property plus_le_reg_r : forall a b c,
a + c <= b + c -> a <= b.
Proof. intros. apply plus_le_reg_l with (p := c). omega. Qed.
Property lt_imp_eq : forall a b, a <= b -> b <= a -> a=b.
Proof. intros. omega. Qed.
Property plus_le_min: forall a b c,
a <= b -> b - c = b - a + a - c .
Proof. intros a b c H; omega. Qed.
Lemma let_sub_lt : forall a b c, c <= a < b -> a - c < b - c.
Proof. induction c; introv [A B]; omega. Qed.
Lemma exists_int_if_lt : forall a b, a < b -> exists c, c > 0 /\ b = a + c.
Proof.
introv G. induction b.
- omega.
- apply lt_n_Sm_le in G.
apply le_lt_eq_dec in G.
destruct G as [G | G].
+ apply IHb in G. destruct G as [c [G1 G2]].
exists (S c). omega.
+ exists (S 0). omega.
Qed.
(* ############################################ *)
(* ** Non-decreasing functions ** *)
(* ############################################ *)
(* ** Non-decreasing functions ** *)
(* ############################################ *)
Definition non_decreasing (f: nat -> nat) : Prop :=
forall a b, a < b -> f a <= f b.
Property non_decreasing_lemma :
forall (f: nat -> nat) a b,
non_decreasing f
-> f a + 1 <= f b -> a + 1 <= b.
Proof.
intros.
Admitted.
Definition non_decreasing (f: nat -> nat) : Prop := forall a b, a < b -> f a <= f b.
Property non_decreasing_lemma : forall (f: nat -> nat) a b,
non_decreasing f -> f a + 1 <= f b
-> a + 1 <= b.
Proof.
introv ND G.
destruct (gt_eq_gt_dec a b) as [[I | I] | I]; try (subst; omega).
apply ND in I. omega.
Qed.
Definition strictly_increasing(f: nat -> nat) : Prop := forall a b, a < b -> f a < f b.
Lemma strict_incr_imp_non_decr : forall f, strictly_increasing f -> non_decreasing f.
Proof. introv SI I. apply SI in I. omega. Qed.
Definition non_increasing (f: nat -> nat) : Prop := forall a b, b < a -> f a <= f b.
(* ###################################### *)
(* ** Sub- and superadditive functions ** *)
(* ###################################### *)
Definition superadditive (f : nat -> nat) : Prop :=
forall (x y : nat), f x + f y <= f (x + y).
Definition subadditive (f : nat -> nat) : Prop :=
forall (x y : nat), f (x + y) <= f x + f y.
Property subadditive_implies_non_decreasing:
forall (f: nat -> nat),
subadditive f
-> non_decreasing f.
Proof.
Admitted.
(** General property on P:nat->Prop predicates:
(* ###################################### *)
Definition superadditive (f : nat -> nat) : Prop :=
forall (x y : nat), f x + f y <= f (x + y).
Definition subadditive (f : nat -> nat) : Prop :=
forall (x y : nat), f (x + y) <= f x + f y.
(* Property subadditive_imp_non_decreasing:
forall (f: nat -> nat), subadditive f -> non_decreasing f.
Proof.
False. Counterexample:
f 0 = 1, f x = 0 if x > 0
or
f 0 = 0, f 1 = 2, f x = 1 if x>1
*)
Property superadditive_imp_non_decreasing:
forall (f: nat -> nat), superadditive f -> non_decreasing f.
Proof.
introv SA I.
destruct (exists_int_if_lt a b I) as [c [I1 I2]].
assert (X: (f a) + (f c) <= f (a+c)) by apply SA.
rewrite <- I2 in X. omega.
Qed.
Property superadditive_imp_f0_eq_0 : forall (f: nat -> nat), superadditive f -> f 0 = 0.
Proof.
introv G.
assert (X:f 1 + f 0 <= f (1+0)) by apply G.
cbn in X. omega.
Qed.
(** General property on P:nat->Prop predicates:
if P is decidable and P holds for at least one nat
then there is a minimal integer for which P holds *)
Lemma P_upto_n : forall P n, (forall x, P x \/ ~ P x)
Lemma P_upto_n : forall P n, (forall x, P x \/ ~ P x)
-> (exists m, m < n /\ P m) \/ (forall m, m < n -> ~ P m).
Proof.
introv Pdec. induction n.
......@@ -76,9 +130,9 @@ introv Pdec. induction n.
destruct G; try easy.
apply IHn. omega.
Qed.
Lemma exists_min : forall n (P:nat->Prop), (forall x, P x \/ ~ P x) -> P n
Lemma exists_min : forall n (P:nat->Prop), (forall x, P x \/ ~ P x) -> P n
-> exists m, P m /\ forall p, p < m -> ~ P p.
Proof.
induction n using lt_wf_ind; intros.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment