mirror of
https://github.com/achlipala/frap.git
synced 2024-11-27 23:06:20 +00:00
A big pass to stop Coq from complaining about missing locality annotations
This commit is contained in:
parent
b643755628
commit
f3211734b9
16 changed files with 80 additions and 80 deletions
|
@ -56,7 +56,7 @@ Record absint_sound (a : absint) : Prop := {
|
||||||
-> a.(Represents) n (a.(Join) x y)
|
-> a.(Represents) n (a.(Join) x y)
|
||||||
}.
|
}.
|
||||||
|
|
||||||
Hint Resolve TopSound ConstSound AddSound SubtractSound MultiplySound
|
Global Hint Resolve TopSound ConstSound AddSound SubtractSound MultiplySound
|
||||||
AddMonotone SubtractMonotone MultiplyMonotone
|
AddMonotone SubtractMonotone MultiplyMonotone
|
||||||
JoinSoundLeft JoinSoundRight : core.
|
JoinSoundLeft JoinSoundRight : core.
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ Proof.
|
||||||
cases (s $? x); equality.
|
cases (s $? x); equality.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve subsumed_refl : core.
|
Global Hint Resolve subsumed_refl : core.
|
||||||
|
|
||||||
Lemma subsumed_use : forall a (s s' : astate a) x n t0 t,
|
Lemma subsumed_use : forall a (s s' : astate a) x n t0 t,
|
||||||
s $? x = Some t0
|
s $? x = Some t0
|
||||||
|
@ -131,7 +131,7 @@ Proof.
|
||||||
equality.
|
equality.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve subsumed_use subsumed_use_empty : core.
|
Global Hint Resolve subsumed_use subsumed_use_empty : core.
|
||||||
|
|
||||||
Lemma subsumed_trans : forall a (s1 s2 s3 : astate a),
|
Lemma subsumed_trans : forall a (s1 s2 s3 : astate a),
|
||||||
subsumed s1 s2
|
subsumed s1 s2
|
||||||
|
@ -156,7 +156,7 @@ Proof.
|
||||||
invert H0; eauto.
|
invert H0; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve subsumed_merge_left : core.
|
Global Hint Resolve subsumed_merge_left : core.
|
||||||
|
|
||||||
Lemma subsumed_add : forall a, absint_sound a
|
Lemma subsumed_add : forall a, absint_sound a
|
||||||
-> forall (s1 s2 : astate a) x v1 v2,
|
-> forall (s1 s2 : astate a) x v1 v2,
|
||||||
|
@ -170,7 +170,7 @@ Proof.
|
||||||
specialize (H0 x0); eauto.
|
specialize (H0 x0); eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve subsumed_add : core.
|
Global Hint Resolve subsumed_add : core.
|
||||||
|
|
||||||
|
|
||||||
(** * Flow-sensitive analysis *)
|
(** * Flow-sensitive analysis *)
|
||||||
|
@ -190,7 +190,7 @@ Proof.
|
||||||
invert H1; eauto.
|
invert H1; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve compatible_add : core.
|
Global Hint Resolve compatible_add : core.
|
||||||
|
|
||||||
(* A similar result follows about soundness of expression interpretation. *)
|
(* A similar result follows about soundness of expression interpretation. *)
|
||||||
Theorem absint_interp_ok : forall a, absint_sound a
|
Theorem absint_interp_ok : forall a, absint_sound a
|
||||||
|
@ -208,7 +208,7 @@ Proof.
|
||||||
assumption.
|
assumption.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve absint_interp_ok : core.
|
Global Hint Resolve absint_interp_ok : core.
|
||||||
|
|
||||||
Definition astates (a : absint) := fmap cmd (astate a).
|
Definition astates (a : absint) := fmap cmd (astate a).
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ Inductive abs_step a : astate a * cmd -> astate a * cmd -> Prop :=
|
||||||
-> ss $? c' = Some s'
|
-> ss $? c' = Some s'
|
||||||
-> abs_step (s, c) (s', c').
|
-> abs_step (s, c) (s', c').
|
||||||
|
|
||||||
Hint Constructors abs_step : core.
|
Global Hint Constructors abs_step : core.
|
||||||
|
|
||||||
Definition absint_trsys a (c : cmd) := {|
|
Definition absint_trsys a (c : cmd) := {|
|
||||||
Initial := {($0, c)};
|
Initial := {($0, c)};
|
||||||
|
@ -293,7 +293,7 @@ Inductive Rabsint a : valuation * cmd -> astate a * cmd -> Prop :=
|
||||||
compatible s v
|
compatible s v
|
||||||
-> Rabsint (v, c) (s, c).
|
-> Rabsint (v, c) (s, c).
|
||||||
|
|
||||||
Hint Constructors abs_step Rabsint : core.
|
Global Hint Constructors abs_step Rabsint : core.
|
||||||
|
|
||||||
Theorem absint_simulates : forall a v c,
|
Theorem absint_simulates : forall a v c,
|
||||||
absint_sound a
|
absint_sound a
|
||||||
|
@ -351,7 +351,7 @@ Proof.
|
||||||
unfold subsumeds; simplify; eauto.
|
unfold subsumeds; simplify; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve subsumeds_refl : core.
|
Global Hint Resolve subsumeds_refl : core.
|
||||||
|
|
||||||
Lemma subsumeds_add : forall a (ss1 ss2 : astates a) c s1 s2,
|
Lemma subsumeds_add : forall a (ss1 ss2 : astates a) c s1 s2,
|
||||||
subsumeds ss1 ss2
|
subsumeds ss1 ss2
|
||||||
|
@ -363,7 +363,7 @@ Proof.
|
||||||
invert H1; eauto.
|
invert H1; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve subsumeds_add : core.
|
Global Hint Resolve subsumeds_add : core.
|
||||||
|
|
||||||
Lemma subsumeds_empty : forall a (ss : astates a),
|
Lemma subsumeds_empty : forall a (ss : astates a),
|
||||||
subsumeds $0 ss.
|
subsumeds $0 ss.
|
||||||
|
@ -459,7 +459,7 @@ Proof.
|
||||||
cases (s $? x); eauto.
|
cases (s $? x); eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve absint_interp_monotone : core.
|
Global Hint Resolve absint_interp_monotone : core.
|
||||||
|
|
||||||
Lemma absint_step_monotone : forall a, absint_sound a
|
Lemma absint_step_monotone : forall a, absint_sound a
|
||||||
-> forall (s : astate a) c wrap ss,
|
-> forall (s : astate a) c wrap ss,
|
||||||
|
|
|
@ -474,7 +474,7 @@ Ltac use H := (eapply use_lemma; [ eapply H | cancel; auto ])
|
||||||
Ltac heq := intros; apply himp_heq; split.
|
Ltac heq := intros; apply himp_heq; split.
|
||||||
|
|
||||||
(* Fancy theorem to help us rewrite within preconditions and postconditions *)
|
(* Fancy theorem to help us rewrite within preconditions and postconditions *)
|
||||||
Instance hoare_triple_morphism : forall linvs A,
|
Local Instance hoare_triple_morphism : forall linvs A,
|
||||||
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple linvs A).
|
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple linvs A).
|
||||||
Proof.
|
Proof.
|
||||||
Transparent himp.
|
Transparent himp.
|
||||||
|
|
|
@ -455,7 +455,7 @@ Ltac use H := (eapply use_lemma; [ eapply H | cancel ])
|
||||||
Ltac heq := intros; apply himp_heq; split.
|
Ltac heq := intros; apply himp_heq; split.
|
||||||
|
|
||||||
(* Fancy theorem to help us rewrite within preconditions and postconditions *)
|
(* Fancy theorem to help us rewrite within preconditions and postconditions *)
|
||||||
Instance hoare_triple_morphism : forall linvs A,
|
Local Instance hoare_triple_morphism : forall linvs A,
|
||||||
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple linvs A).
|
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple linvs A).
|
||||||
Proof.
|
Proof.
|
||||||
Transparent himp.
|
Transparent himp.
|
||||||
|
|
|
@ -769,7 +769,7 @@ Module MixedEmbedded(Import BW : BIT_WIDTH).
|
||||||
cases s; simp; eauto.
|
cases s; simp; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Instance hoare_triple_morphism : forall A,
|
Local Instance hoare_triple_morphism : forall A,
|
||||||
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple A).
|
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple A).
|
||||||
Proof.
|
Proof.
|
||||||
Transparent himp.
|
Transparent himp.
|
||||||
|
@ -874,8 +874,8 @@ Module MixedEmbedded(Import BW : BIT_WIDTH).
|
||||||
end; cancel.
|
end; cancel.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite <- rev_alt.
|
Local Hint Rewrite <- rev_alt.
|
||||||
Hint Rewrite rev_involutive.
|
Local Hint Rewrite rev_involutive.
|
||||||
|
|
||||||
Opaque linkedList.
|
Opaque linkedList.
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ Local Hint Extern 1 (@eq nat _ _) => linear_arithmetic : core.
|
||||||
|
|
||||||
Example h0 : heap := $0 $+ (0, 2) $+ (1, 1) $+ (2, 8) $+ (3, 6).
|
Example h0 : heap := $0 $+ (0, 2) $+ (1, 1) $+ (2, 8) $+ (3, 6).
|
||||||
|
|
||||||
Hint Rewrite max_l max_r using linear_arithmetic : core.
|
Local Hint Rewrite max_l max_r using linear_arithmetic : core.
|
||||||
|
|
||||||
Ltac simp := repeat (simplify; subst; propositional;
|
Ltac simp := repeat (simplify; subst; propositional;
|
||||||
try match goal with
|
try match goal with
|
||||||
|
@ -1214,7 +1214,7 @@ Module DeeperWithFail.
|
||||||
reflexivity.
|
reflexivity.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite firstn_nochange fold_left_firstn using linear_arithmetic : core.
|
Local Hint Rewrite firstn_nochange fold_left_firstn using linear_arithmetic : core.
|
||||||
|
|
||||||
(* Here's the soundness theorem for [heapfold], relying on a hypothesis of
|
(* Here's the soundness theorem for [heapfold], relying on a hypothesis of
|
||||||
* soundness for [combine]. *)
|
* soundness for [combine]. *)
|
||||||
|
|
|
@ -14,7 +14,7 @@ Local Hint Extern 1 (@eq nat _ _) => linear_arithmetic : core.
|
||||||
|
|
||||||
Example h0 : heap := $0 $+ (0, 2) $+ (1, 1) $+ (2, 8) $+ (3, 6).
|
Example h0 : heap := $0 $+ (0, 2) $+ (1, 1) $+ (2, 8) $+ (3, 6).
|
||||||
|
|
||||||
Hint Rewrite max_l max_r using linear_arithmetic : core.
|
Local Hint Rewrite max_l max_r using linear_arithmetic : core.
|
||||||
|
|
||||||
Ltac simp := repeat (simplify; subst; propositional;
|
Ltac simp := repeat (simplify; subst; propositional;
|
||||||
try match goal with
|
try match goal with
|
||||||
|
@ -1044,7 +1044,7 @@ Module DeeperWithFail.
|
||||||
reflexivity.
|
reflexivity.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite firstn_nochange fold_left_firstn using linear_arithmetic : core.
|
Local Hint Rewrite firstn_nochange fold_left_firstn using linear_arithmetic : core.
|
||||||
|
|
||||||
Theorem heapfold_ok : forall {A : Set} (init : A) combine
|
Theorem heapfold_ok : forall {A : Set} (init : A) combine
|
||||||
(ls : list nat) (f : A -> nat -> A),
|
(ls : list nat) (f : A -> nat -> A),
|
||||||
|
|
|
@ -1091,7 +1091,7 @@ Proof.
|
||||||
induct s; substring.
|
induct s; substring.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_all substring_none.
|
Local Hint Rewrite substring_all substring_none.
|
||||||
|
|
||||||
Lemma substring_split : forall s m,
|
Lemma substring_split : forall s m,
|
||||||
substring 0 m s ++ substring m (length s - m) s = s.
|
substring 0 m s ++ substring m (length s - m) s = s.
|
||||||
|
@ -1115,7 +1115,7 @@ Proof.
|
||||||
rewrite IHs1; auto.
|
rewrite IHs1; auto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite <- minus_n_O.
|
Local Hint Rewrite <- minus_n_O.
|
||||||
|
|
||||||
Lemma substring_app_snd : forall s2 s1 n,
|
Lemma substring_app_snd : forall s2 s1 n,
|
||||||
length s1 = n
|
length s1 = n
|
||||||
|
@ -1124,7 +1124,7 @@ Proof.
|
||||||
induct s1; simplify; subst; simplify; auto.
|
induct s1; simplify; subst; simplify; auto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_app_fst substring_app_snd using solve [trivial].
|
Local Hint Rewrite substring_app_fst substring_app_snd using solve [trivial].
|
||||||
|
|
||||||
(* BOREDOM'S END! *)
|
(* BOREDOM'S END! *)
|
||||||
|
|
||||||
|
@ -1227,7 +1227,7 @@ Proof.
|
||||||
induct s; substring.
|
induct s; substring.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite app_empty_end.
|
Local Hint Rewrite app_empty_end.
|
||||||
|
|
||||||
Lemma substring_self : forall s n,
|
Lemma substring_self : forall s n,
|
||||||
n <= 0
|
n <= 0
|
||||||
|
@ -1243,8 +1243,8 @@ Proof.
|
||||||
induct s; substring.
|
induct s; substring.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_self substring_empty using linear_arithmetic.
|
Local Hint Rewrite substring_self substring_empty using linear_arithmetic.
|
||||||
Hint Rewrite substring_split.
|
Local Hint Rewrite substring_split.
|
||||||
|
|
||||||
Lemma substring_split' : forall s n m,
|
Lemma substring_split' : forall s n m,
|
||||||
substring n m s ++ substring (n + m) (length s - (n + m)) s
|
substring n m s ++ substring (n + m) (length s - (n + m)) s
|
||||||
|
@ -1308,7 +1308,7 @@ Proof.
|
||||||
simplify; cases m; simplify; eauto using substring_suffix_emp'.
|
simplify; cases m; simplify; eauto using substring_suffix_emp'.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_stack substring_stack' substring_suffix using linear_arithmetic.
|
Local Hint Rewrite substring_stack substring_stack' substring_suffix using linear_arithmetic.
|
||||||
|
|
||||||
Lemma minus_minus : forall n m1 m2,
|
Lemma minus_minus : forall n m1 m2,
|
||||||
m1 + m2 <= n
|
m1 + m2 <= n
|
||||||
|
@ -1322,7 +1322,7 @@ Proof.
|
||||||
linear_arithmetic.
|
linear_arithmetic.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite minus_minus plus_n_Sm' using linear_arithmetic.
|
Local Hint Rewrite minus_minus plus_n_Sm' using linear_arithmetic.
|
||||||
|
|
||||||
(* BOREDOM VANQUISHED! *)
|
(* BOREDOM VANQUISHED! *)
|
||||||
|
|
||||||
|
|
|
@ -507,7 +507,7 @@ Proof.
|
||||||
induct s; substring.
|
induct s; substring.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_all substring_none.
|
Local Hint Rewrite substring_all substring_none.
|
||||||
|
|
||||||
Lemma substring_split : forall s m,
|
Lemma substring_split : forall s m,
|
||||||
substring 0 m s ++ substring m (length s - m) s = s.
|
substring 0 m s ++ substring m (length s - m) s = s.
|
||||||
|
@ -531,7 +531,7 @@ Proof.
|
||||||
rewrite IHs1; auto.
|
rewrite IHs1; auto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite <- minus_n_O.
|
Local Hint Rewrite <- minus_n_O.
|
||||||
|
|
||||||
Lemma substring_app_snd : forall s2 s1 n,
|
Lemma substring_app_snd : forall s2 s1 n,
|
||||||
length s1 = n
|
length s1 = n
|
||||||
|
@ -540,7 +540,7 @@ Proof.
|
||||||
induct s1; simplify; subst; simplify; auto.
|
induct s1; simplify; subst; simplify; auto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_app_fst substring_app_snd using solve [trivial].
|
Local Hint Rewrite substring_app_fst substring_app_snd using solve [trivial].
|
||||||
|
|
||||||
(* BOREDOM'S END! *)
|
(* BOREDOM'S END! *)
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ Proof.
|
||||||
induct s; substring.
|
induct s; substring.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite app_empty_end.
|
Local Hint Rewrite app_empty_end.
|
||||||
|
|
||||||
Lemma substring_self : forall s n,
|
Lemma substring_self : forall s n,
|
||||||
n <= 0
|
n <= 0
|
||||||
|
@ -625,8 +625,8 @@ Proof.
|
||||||
induct s; substring.
|
induct s; substring.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_self substring_empty using linear_arithmetic.
|
Local Hint Rewrite substring_self substring_empty using linear_arithmetic.
|
||||||
Hint Rewrite substring_split.
|
Local Hint Rewrite substring_split.
|
||||||
|
|
||||||
Lemma substring_split' : forall s n m,
|
Lemma substring_split' : forall s n m,
|
||||||
substring n m s ++ substring (n + m) (length s - (n + m)) s
|
substring n m s ++ substring (n + m) (length s - (n + m)) s
|
||||||
|
@ -690,7 +690,7 @@ Proof.
|
||||||
simplify; cases m; simplify; eauto using substring_suffix_emp'.
|
simplify; cases m; simplify; eauto using substring_suffix_emp'.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite substring_stack substring_stack' substring_suffix using linear_arithmetic.
|
Local Hint Rewrite substring_stack substring_stack' substring_suffix using linear_arithmetic.
|
||||||
|
|
||||||
Lemma minus_minus : forall n m1 m2,
|
Lemma minus_minus : forall n m1 m2,
|
||||||
m1 + m2 <= n
|
m1 + m2 <= n
|
||||||
|
@ -704,7 +704,7 @@ Proof.
|
||||||
linear_arithmetic.
|
linear_arithmetic.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite minus_minus plus_n_Sm' using linear_arithmetic.
|
Local Hint Rewrite minus_minus plus_n_Sm' using linear_arithmetic.
|
||||||
|
|
||||||
(* BOREDOM VANQUISHED! *)
|
(* BOREDOM VANQUISHED! *)
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ Proof.
|
||||||
trivial.
|
trivial.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite dnot_dnot.
|
Global Hint Rewrite dnot_dnot.
|
||||||
|
|
||||||
Lemma map_identity : forall A (f : A -> A) (ls : list A),
|
Lemma map_identity : forall A (f : A -> A) (ls : list A),
|
||||||
(forall x, x = f x)
|
(forall x, x = f x)
|
||||||
|
@ -363,7 +363,7 @@ Proof.
|
||||||
induct ls; simplify; equality.
|
induct ls; simplify; equality.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite map_identity map_map using assumption.
|
Global Hint Rewrite map_identity map_map using assumption.
|
||||||
|
|
||||||
Lemma map_same : forall A B (f1 f2 : A -> B) ls,
|
Lemma map_same : forall A B (f1 f2 : A -> B) ls,
|
||||||
(forall x, f1 x = f2 x)
|
(forall x, f1 x = f2 x)
|
||||||
|
@ -399,9 +399,9 @@ Proof.
|
||||||
apply filter_same; assumption.
|
apply filter_same; assumption.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve List_map_same List_filter_same : core.
|
Global Hint Resolve List_map_same List_filter_same : core.
|
||||||
|
|
||||||
Hint Extern 5 (_ = match _ with Bool _ => _ | _ => _ end) =>
|
Global Hint Extern 5 (_ = match _ with Bool _ => _ | _ => _ end) =>
|
||||||
match goal with
|
match goal with
|
||||||
| [ H : forall x : dyn, _ |- _ ] => rewrite <- H
|
| [ H : forall x : dyn, _ |- _ ] => rewrite <- H
|
||||||
end : core.
|
end : core.
|
||||||
|
@ -493,7 +493,7 @@ Proof.
|
||||||
induct d; simplify; linear_arithmetic.
|
induct d; simplify; linear_arithmetic.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Immediate dsize_positive : core.
|
Global Hint Immediate dsize_positive : core.
|
||||||
|
|
||||||
Lemma sum_map_monotone : forall A (f1 f2 : A -> nat) ds,
|
Lemma sum_map_monotone : forall A (f1 f2 : A -> nat) ds,
|
||||||
(forall x, f1 x <= f2 x)
|
(forall x, f1 x <= f2 x)
|
||||||
|
|
|
@ -316,7 +316,7 @@ Proof.
|
||||||
simplify; subst; auto.
|
simplify; subst; auto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite <- minus_n_O.
|
Local Hint Rewrite <- minus_n_O.
|
||||||
|
|
||||||
Lemma fact_rec : forall n,
|
Lemma fact_rec : forall n,
|
||||||
n > 0
|
n > 0
|
||||||
|
@ -325,7 +325,7 @@ Proof.
|
||||||
simplify; cases n; simplify; linear_arithmetic.
|
simplify; cases n; simplify; linear_arithmetic.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite fact_base fact_rec using linear_arithmetic.
|
Local Hint Rewrite fact_base fact_rec using linear_arithmetic.
|
||||||
|
|
||||||
(* Note the careful choice of loop invariant below. It may look familiar from
|
(* Note the careful choice of loop invariant below. It may look familiar from
|
||||||
* earlier chapters' proofs! *)
|
* earlier chapters' proofs! *)
|
||||||
|
|
16
Imp.v
16
Imp.v
|
@ -90,7 +90,7 @@ Inductive step : valuation * cmd -> valuation * cmd -> Prop :=
|
||||||
interp e v = 0
|
interp e v = 0
|
||||||
-> step (v, While e body) (v, Skip).
|
-> step (v, While e body) (v, Skip).
|
||||||
|
|
||||||
Hint Constructors trc step eval : core.
|
Global Hint Constructors trc step eval : core.
|
||||||
|
|
||||||
Lemma step_star_Seq : forall v c1 c2 v' c1',
|
Lemma step_star_Seq : forall v c1 c2 v' c1',
|
||||||
step^* (v, c1) (v', c1')
|
step^* (v, c1) (v', c1')
|
||||||
|
@ -100,7 +100,7 @@ Proof.
|
||||||
cases y; eauto.
|
cases y; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve step_star_Seq : core.
|
Global Hint Resolve step_star_Seq : core.
|
||||||
|
|
||||||
Theorem big_small : forall v c v', eval v c v'
|
Theorem big_small : forall v c v', eval v c v'
|
||||||
-> step^* (v, c) (v', Skip).
|
-> step^* (v, c) (v', Skip).
|
||||||
|
@ -118,7 +118,7 @@ Proof.
|
||||||
end; eauto.
|
end; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve small_big'' : core.
|
Global Hint Resolve small_big'' : core.
|
||||||
|
|
||||||
Lemma small_big' : forall v c v' c', step^* (v, c) (v', c')
|
Lemma small_big' : forall v c v' c', step^* (v, c) (v', c')
|
||||||
-> forall v'', eval v' c' v''
|
-> forall v'', eval v' c' v''
|
||||||
|
@ -128,7 +128,7 @@ Proof.
|
||||||
cases y; eauto.
|
cases y; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve small_big' : core.
|
Global Hint Resolve small_big' : core.
|
||||||
|
|
||||||
Theorem small_big : forall v c v', step^* (v, c) (v', Skip)
|
Theorem small_big : forall v c v', step^* (v, c) (v', Skip)
|
||||||
-> eval v c v'.
|
-> eval v c v'.
|
||||||
|
@ -176,7 +176,7 @@ Inductive cstep : valuation * cmd -> valuation * cmd -> Prop :=
|
||||||
-> plug C c' c2
|
-> plug C c' c2
|
||||||
-> cstep (v, c1) (v', c2).
|
-> cstep (v, c1) (v', c2).
|
||||||
|
|
||||||
Hint Constructors plug step0 cstep : core.
|
Global Hint Constructors plug step0 cstep : core.
|
||||||
|
|
||||||
Theorem step_cstep : forall v c v' c',
|
Theorem step_cstep : forall v c v' c',
|
||||||
step (v, c) (v', c')
|
step (v, c) (v', c')
|
||||||
|
@ -187,7 +187,7 @@ Proof.
|
||||||
end; eauto.
|
end; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve step_cstep : core.
|
Global Hint Resolve step_cstep : core.
|
||||||
|
|
||||||
Lemma step0_step : forall v c v' c',
|
Lemma step0_step : forall v c v' c',
|
||||||
step0 (v, c) (v', c')
|
step0 (v, c) (v', c')
|
||||||
|
@ -196,7 +196,7 @@ Proof.
|
||||||
invert 1; eauto.
|
invert 1; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve step0_step : core.
|
Global Hint Resolve step0_step : core.
|
||||||
|
|
||||||
Lemma cstep_step' : forall C c0 c,
|
Lemma cstep_step' : forall C c0 c,
|
||||||
plug C c0 c
|
plug C c0 c
|
||||||
|
@ -209,7 +209,7 @@ Proof.
|
||||||
end; eauto.
|
end; eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve cstep_step' : core.
|
Global Hint Resolve cstep_step' : core.
|
||||||
|
|
||||||
Theorem cstep_step : forall v c v' c',
|
Theorem cstep_step : forall v c v' c',
|
||||||
cstep (v, c) (v', c')
|
cstep (v, c) (v', c')
|
||||||
|
|
24
Map.v
24
Map.v
|
@ -133,17 +133,17 @@ Module Type S.
|
||||||
lookup (restrict P m) k = Some v
|
lookup (restrict P m) k = Some v
|
||||||
-> P k.
|
-> P k.
|
||||||
|
|
||||||
Hint Extern 1 => match goal with
|
Global Hint Extern 1 => match goal with
|
||||||
| [ H : lookup (empty _ _) _ = Some _ |- _ ] =>
|
| [ H : lookup (empty _ _) _ = Some _ |- _ ] =>
|
||||||
rewrite lookup_empty in H; discriminate
|
rewrite lookup_empty in H; discriminate
|
||||||
end : core.
|
end : core.
|
||||||
|
|
||||||
Hint Resolve includes_lookup includes_add empty_includes : core.
|
Global Hint Resolve includes_lookup includes_add empty_includes : core.
|
||||||
|
|
||||||
Hint Rewrite lookup_empty lookup_add_eq lookup_add_ne lookup_remove_eq lookup_remove_ne
|
Global Hint Rewrite lookup_empty lookup_add_eq lookup_add_ne lookup_remove_eq lookup_remove_ne
|
||||||
lookup_merge lookup_restrict_true lookup_restrict_false using congruence.
|
lookup_merge lookup_restrict_true lookup_restrict_false using congruence.
|
||||||
|
|
||||||
Hint Rewrite dom_empty dom_add.
|
Global Hint Rewrite dom_empty dom_add.
|
||||||
|
|
||||||
Ltac maps_equal :=
|
Ltac maps_equal :=
|
||||||
apply fmap_ext; intros;
|
apply fmap_ext; intros;
|
||||||
|
@ -152,17 +152,17 @@ Module Type S.
|
||||||
| [ |- context[lookup (add _ ?k _) ?k' ] ] => destruct (classic (k = k')); subst
|
| [ |- context[lookup (add _ ?k _) ?k' ] ] => destruct (classic (k = k')); subst
|
||||||
end).
|
end).
|
||||||
|
|
||||||
Hint Extern 3 (_ = _) => maps_equal : core.
|
Global Hint Extern 3 (_ = _) => maps_equal : core.
|
||||||
|
|
||||||
Axiom lookup_split : forall A B (m : fmap A B) k v k' v',
|
Axiom lookup_split : forall A B (m : fmap A B) k v k' v',
|
||||||
(m $+ (k, v)) $? k' = Some v'
|
(m $+ (k, v)) $? k' = Some v'
|
||||||
-> (k' <> k /\ m $? k' = Some v') \/ (k' = k /\ v' = v).
|
-> (k' <> k /\ m $? k' = Some v') \/ (k' = k /\ v' = v).
|
||||||
|
|
||||||
Hint Rewrite merge_empty1 merge_empty2 using solve [ eauto 1 ].
|
Global Hint Rewrite merge_empty1 merge_empty2 using solve [ eauto 1 ].
|
||||||
Hint Rewrite merge_empty1_alt merge_empty2_alt using congruence.
|
Global Hint Rewrite merge_empty1_alt merge_empty2_alt using congruence.
|
||||||
|
|
||||||
Hint Rewrite merge_add1 using solve [ eauto | unfold Sets.In; autorewrite with core in *; simpl in *; try (normalize_set; simpl); intuition congruence ].
|
Global Hint Rewrite merge_add1 using solve [ eauto | unfold Sets.In; autorewrite with core in *; simpl in *; try (normalize_set; simpl); intuition congruence ].
|
||||||
Hint Rewrite merge_add1_alt using solve [ congruence | unfold Sets.In; autorewrite with core in *; simpl in *; try (normalize_set; simpl); intuition congruence ].
|
Global Hint Rewrite merge_add1_alt using solve [ congruence | unfold Sets.In; autorewrite with core in *; simpl in *; try (normalize_set; simpl); intuition congruence ].
|
||||||
|
|
||||||
Axiom includes_intro : forall K V (m1 m2 : fmap K V),
|
Axiom includes_intro : forall K V (m1 m2 : fmap K V),
|
||||||
(forall k v, m1 $? k = Some v -> m2 $? k = Some v)
|
(forall k v, m1 $? k = Some v -> m2 $? k = Some v)
|
||||||
|
@ -267,9 +267,9 @@ Module Type S.
|
||||||
-> disjoint h3 h2.
|
-> disjoint h3 h2.
|
||||||
End splitting.
|
End splitting.
|
||||||
|
|
||||||
Hint Immediate disjoint_comm split_comm : core.
|
Global Hint Immediate disjoint_comm split_comm : core.
|
||||||
Hint Immediate split_empty_bwd disjoint_hemp disjoint_hemp' split_assoc1 split_assoc2 : core.
|
Global Hint Immediate split_empty_bwd disjoint_hemp disjoint_hemp' split_assoc1 split_assoc2 : core.
|
||||||
Hint Immediate disjoint_assoc1 disjoint_assoc2 split_join split_disjoint disjoint_assoc3 : core.
|
Global Hint Immediate disjoint_assoc1 disjoint_assoc2 split_join split_disjoint disjoint_assoc3 : core.
|
||||||
End S.
|
End S.
|
||||||
|
|
||||||
Module M : S.
|
Module M : S.
|
||||||
|
|
|
@ -82,7 +82,7 @@ Module Make(Import S : SEP).
|
||||||
transitivity proved by heq_trans
|
transitivity proved by heq_trans
|
||||||
as heq_rel.
|
as heq_rel.
|
||||||
|
|
||||||
Instance himp_heq_mor : Proper (heq ==> heq ==> iff) himp.
|
Global Instance himp_heq_mor : Proper (heq ==> heq ==> iff) himp.
|
||||||
Proof.
|
Proof.
|
||||||
hnf; intros; hnf; intros.
|
hnf; intros; hnf; intros.
|
||||||
apply himp_heq in H; apply himp_heq in H0.
|
apply himp_heq in H; apply himp_heq in H0.
|
||||||
|
@ -104,7 +104,7 @@ Module Make(Import S : SEP).
|
||||||
auto using star_cancel.
|
auto using star_cancel.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Instance exis_iff_morphism (A : Type) :
|
Global Instance exis_iff_morphism (A : Type) :
|
||||||
Proper (pointwise_relation A heq ==> heq) (@exis A).
|
Proper (pointwise_relation A heq ==> heq) (@exis A).
|
||||||
Proof.
|
Proof.
|
||||||
hnf; intros; apply himp_heq; intuition.
|
hnf; intros; apply himp_heq; intuition.
|
||||||
|
@ -120,7 +120,7 @@ Module Make(Import S : SEP).
|
||||||
apply himp_heq in H0; intuition eauto.
|
apply himp_heq in H0; intuition eauto.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Instance exis_imp_morphism (A : Type) :
|
Global Instance exis_imp_morphism (A : Type) :
|
||||||
Proper (pointwise_relation A himp ==> himp) (@exis A).
|
Proper (pointwise_relation A himp ==> himp) (@exis A).
|
||||||
Proof.
|
Proof.
|
||||||
hnf; intros.
|
hnf; intros.
|
||||||
|
|
|
@ -181,7 +181,7 @@ Module Import S <: SEP.
|
||||||
t.
|
t.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve split_empty_bwd' : core.
|
Local Hint Resolve split_empty_bwd' : core.
|
||||||
|
|
||||||
Theorem extra_lift : forall (P : Prop) p,
|
Theorem extra_lift : forall (P : Prop) p,
|
||||||
P
|
P
|
||||||
|
@ -1161,8 +1161,8 @@ Proof.
|
||||||
end; cancel.
|
end; cancel.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite <- rev_alt.
|
Local Hint Rewrite <- rev_alt.
|
||||||
Hint Rewrite rev_involutive.
|
Local Hint Rewrite rev_involutive.
|
||||||
|
|
||||||
(* Let's hide the definition of [linkedList], so that we *only* reason about it
|
(* Let's hide the definition of [linkedList], so that we *only* reason about it
|
||||||
* via the two lemmas we just proved. *)
|
* via the two lemmas we just proved. *)
|
||||||
|
@ -1302,8 +1302,8 @@ Qed.
|
||||||
Opaque linkedList linkedListSegment.
|
Opaque linkedList linkedListSegment.
|
||||||
|
|
||||||
(* A few algebraic properties of list operations: *)
|
(* A few algebraic properties of list operations: *)
|
||||||
Hint Rewrite <- app_assoc.
|
Local Hint Rewrite <- app_assoc.
|
||||||
Hint Rewrite app_length app_nil_r.
|
Local Hint Rewrite app_length app_nil_r.
|
||||||
|
|
||||||
(* We tie a few of them together into this lemma. *)
|
(* We tie a few of them together into this lemma. *)
|
||||||
Lemma move_along : forall A (ls : list A) x2 x1 x0 x,
|
Lemma move_along : forall A (ls : list A) x2 x1 x0 x,
|
||||||
|
|
|
@ -165,7 +165,7 @@ Module Import S <: SEP.
|
||||||
t.
|
t.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Resolve split_empty_bwd' : core.
|
Global Hint Resolve split_empty_bwd' : core.
|
||||||
|
|
||||||
Theorem extra_lift : forall (P : Prop) p,
|
Theorem extra_lift : forall (P : Prop) p,
|
||||||
P
|
P
|
||||||
|
@ -398,7 +398,7 @@ Qed.
|
||||||
|
|
||||||
|
|
||||||
(* Fancy theorem to help us rewrite within preconditions and postconditions *)
|
(* Fancy theorem to help us rewrite within preconditions and postconditions *)
|
||||||
Instance hoare_triple_morphism : forall A,
|
Local Instance hoare_triple_morphism : forall A,
|
||||||
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple A).
|
Proper (heq ==> eq ==> (eq ==> heq) ==> iff) (@hoare_triple A).
|
||||||
Proof.
|
Proof.
|
||||||
Transparent himp.
|
Transparent himp.
|
||||||
|
@ -542,8 +542,8 @@ Proof.
|
||||||
end; cancel.
|
end; cancel.
|
||||||
Qed.
|
Qed.
|
||||||
|
|
||||||
Hint Rewrite <- rev_alt.
|
Local Hint Rewrite <- rev_alt.
|
||||||
Hint Rewrite rev_involutive.
|
Local Hint Rewrite rev_involutive.
|
||||||
|
|
||||||
(* Let's hide the definition of [linkedList], so that we *only* reason about it
|
(* Let's hide the definition of [linkedList], so that we *only* reason about it
|
||||||
* via the two lemmas we just proved. *)
|
* via the two lemmas we just proved. *)
|
||||||
|
@ -590,8 +590,8 @@ Admitted.
|
||||||
(* ** Computing the length of a linked list *)
|
(* ** Computing the length of a linked list *)
|
||||||
|
|
||||||
(* A few algebraic properties of list operations: *)
|
(* A few algebraic properties of list operations: *)
|
||||||
Hint Rewrite <- app_assoc.
|
Local Hint Rewrite <- app_assoc.
|
||||||
Hint Rewrite app_length app_nil_r.
|
Local Hint Rewrite app_length app_nil_r.
|
||||||
|
|
||||||
(* We tie a few of them together into this lemma. *)
|
(* We tie a few of them together into this lemma. *)
|
||||||
Lemma move_along : forall A (ls : list A) x2 x1 x0 x,
|
Lemma move_along : forall A (ls : list A) x2 x1 x0 x,
|
||||||
|
|
|
@ -536,7 +536,7 @@ Notation "e1 ;; e2" := (if e1 then e2 else ??)
|
||||||
* [hasType] proof obligation, and [eauto] makes short work of them when we add
|
* [hasType] proof obligation, and [eauto] makes short work of them when we add
|
||||||
* [hasType]'s constructors as hints. *)
|
* [hasType]'s constructors as hints. *)
|
||||||
|
|
||||||
Local Hint Constructors hasType.
|
Local Hint Constructors hasType : core.
|
||||||
|
|
||||||
Definition typeCheck : forall e : exp, {{t | hasType e t}}.
|
Definition typeCheck : forall e : exp, {{t | hasType e t}}.
|
||||||
refine (fix F (e : exp) : {{t | hasType e t}} :=
|
refine (fix F (e : exp) : {{t | hasType e t}} :=
|
||||||
|
@ -589,7 +589,7 @@ Qed.
|
||||||
(* Now we can define the type-checker. Its type expresses that it only fails on
|
(* Now we can define the type-checker. Its type expresses that it only fails on
|
||||||
* untypable expressions. *)
|
* untypable expressions. *)
|
||||||
|
|
||||||
Local Hint Resolve hasType_det.
|
Local Hint Resolve hasType_det : core.
|
||||||
(* The lemma [hasType_det] will also be useful for proving proof obligations
|
(* The lemma [hasType_det] will also be useful for proving proof obligations
|
||||||
* with contradictory contexts. *)
|
* with contradictory contexts. *)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue