prompt
stringlengths
134
5.79k
completion
stringlengths
5
2.16k
meta
stringlengths
120
394
Proof State: ``` 2 goals A : Set a : A l : list A H : forall (a : A) (l1 : list A), In (a, l1) (split_one l) -> Permutation (a :: l1) l a0 : A l1 : list A H0 : (a, l) = (a0, l1) ============================ Permutation (a0 :: l1) (a :: l) goal 2 is: Permutation (a0 :: l1) (a :: l) ``` Commit Diff: ``` diff --git a/Div.v b/Div.v index 7e7d694..e83d601 100644 --- a/Div.v +++ b/Div.v @@ -57,2 +57,2 @@ n) p) (c2 := mod n p); try apply mod_lt; auto with arith. -rewrite mult_plus_distr_r; rewrite <- plus_assoc; repeat -rewrite <- div_mod_correct; auto with arith. +rewrite mult_plus_distr_r, <- plus_assoc; repeat rewrite +<- div_mod_correct; auto with arith. @@ -67,4 +67,2 @@ intros n m p H; apply plus_reg_l with (div (p * m + n) p * p). -rewrite <- div_mod_correct; auto. -rewrite div_mult_comp; auto. -rewrite mult_plus_distr_r; rewrite (mult_comm p); rewrite <- plus_assoc. -eq_tac; apply div_mod_correct; auto. +rewrite <- div_mod_correct, div_mult_comp, mult_plus_distr_r, (mult_comm p), <- plus_assoc by assumption. +f_equal. now apply div_mod_correct. diff --git a/ListAux.v b/ListAux.v index 82a8d82..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -76 +76 @@ exists (nil (A:=A)); exists l; simpl; auto. -eq_tac; auto. +f_equal; auto. @@ -78 +78 @@ case H; auto; intros l1 [l2 Hl2]; exists (a1 :: l1); exists l2; simpl; auto. -eq_tac; auto. +f_equal; auto. @@ -146 +146 @@ intros a l H l2 l3 l4 a0; case l3; simpl. -intros H0; left; exists l; eq_tac; injection H0; auto. +intros H0; left; exists l; f_equal; injection H0; auto. @@ -150 +150 @@ intros [l5 H1]. -left; exists l5; eq_tac; injection H0; auto. +left; exists l5; f_equal; injection H0; auto. @@ -165,2 +165,2 @@ intros H0; right; right; injection H0; split; auto. -eq_tac; auto. -intros b0 l0 H0; left; exists l0; injection H0; intros; (repeat eq_tac); auto. +f_equal; auto. +intros b0 l0 H0; left; exists l0; injection H0; intros; (repeat f_equal); auto. @@ -169 +169 @@ injection H0; auto. -intros [l5 HH1]; left; exists l5; eq_tac; auto; injection H0; auto. +intros [l5 HH1]; left; exists l5; f_equal; auto; injection H0; auto. @@ -171 +171 @@ intros [H1|[H1 H2]]; auto. -right; right; split; auto; eq_tac; auto; injection H0; auto. +right; right; split; auto; f_equal; auto; injection H0; auto. @@ -190 +190 @@ exists (b :: l4); exists l5; exists b1; (repeat (simpl; split; auto)). -eq_tac; auto. +f_equal; auto. @@ -237 +237 @@ intros H4 H5; split; auto. -eq_tac; auto. +f_equal; auto. @@ -278 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app; rewrite length_map; rewrite H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index b9797d9..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -138,2 +138 @@ intros a b c; elim c; simpl; auto. -intros n H; rewrite jump_nil; rewrite -take_nil; rewrite H; auto with arith. +intros n H; rewrite jump_nil, take_nil, H; auto with arith. @@ -146,2 +145,2 @@ intros k Rec i j s H; -rewrite length_app; rewrite length_take1; auto with arith. -eq_tac; auto. +rewrite length_app, length_take1; auto with arith. +f_equal; auto. @@ -199 +198 @@ intros l; elim l; simpl; auto with datatypes. -intros; eq_tac; auto. +intros; f_equal; auto. @@ -206 +205 @@ intros H; contradict H; auto with arith. -intros n1 H; eq_tac; auto with arith. +intros n1 H; f_equal; auto with arith. @@ -219 +218 @@ intros a l1 Rec n; case n; auto; clear n. -simpl length; intros n H; simpl; eq_tac; auto with arith. +simpl length; intros n H; simpl; f_equal; auto with arith. diff --git a/OrderedList.v b/OrderedList.v index f2762b8..3136749 100644 --- a/OrderedList.v +++ b/OrderedList.v @@ -624 +624 @@ intros; discriminate. -intros; eq_tac; auto. +intros; f_equal; auto. diff --git a/Permutation.v b/Permutation.v index ecfa699..3f52951 100644 --- a/Permutation.v +++ b/Permutation.v @@ -33,2 +32,0 @@ Variable A : Set. -Definition permutation (l1 l2 : list A) := @Permutation A l1 l2. - @@ -37,66 +34,0 @@ Hint Constructors Permutation : core. -Definition permutation_trans := perm_trans. - - - - - -Theorem permutation_refl : forall l : list A, permutation l l. -Proof. -simple induction l. -apply perm_nil. -intros a l1 H. -apply perm_skip with (1 := H). -Qed. -Hint Resolve permutation_refl : core. - - - ``` Ongoing Proof History: ``` Proof. intros a l1 l2; generalize a l1; elim l2; clear a l1 l2; simpl in |- *; auto. intros a l1 H1; case H1. intros a l H a0 l1 [H0| H0]. ? injection H0; intros H1 H2; rewrite H2; rewrite H1; auto. ? generalize H H0; elim (split_one l); simpl in |- *; auto. ? intros H1 H2; case H2. ``` Next Tactic: ```
injection H0; intros H1 H2; rewrite H2, H1; auto. ```
{"final_commit":"82eb0678991955dfa8f12720d652ad5adb465c3e","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-b5543771d6bdeab13ec58ac6c8d281815d96ed62-82eb0678991955dfa8f12720d652ad5adb465c3e-8_15_2-8_15_2-35.git.json","initial_commit":"b5543771d6bdeab13ec58ac6c8d281815d96ed62","file":"Permutation.v"}
Ongoing Proof History: ``` Proof. intros n m p Hp H. apply gcd_unique; trivial. - apply H. apply divide_refl. ``` Proof State: ``` This subproof is complete, but there are some unfocused goals. Focus next goal with bullet -. 2 subgoals subgoal 1 is: (p | m) subgoal 2 is: forall q : t, (q | n) -> (q | m) -> (q | p) ``` Next Tactic: ```
- ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Numbers\/NatInt\/NZGcd.v"}
Proof State: ``` 1 subgoal E : Type -> Type R : Type S : Type classicT : forall P : Type, P + (P -> False) r : itrace E S -> itrace E R -> Prop CIH : forall (b : itrace E R) (t : itree E S) (f : S -> itree E R), b βŠ‘ ITree.bind t f -> r (peel b t) b b : itrace E R t : itree E S f : S -> itree E R A0 : Type e1 : E A0 ans : A0 k : unit -> itree (EvAns E) R k0 : A0 -> itree E R t0 : itree E S k' : A0 -> itree E S Hvis : eqit_ eq true true id (upaco2 (eqit_ eq true true id) bot2) (Vis e1 (fun x : A0 => ITree.bind (k' x) f)) (Vis e1 k0) Href : rutt_ (REvRef E) (RAnsRef E) eq (upaco2 (rutt_ (REvRef E) (RAnsRef E) eq) bot2) (Vis (evans A0 e1 ans) k) (Vis e1 (fun x : A0 => ITree.bind (k' x) f)) Ht0 : eqitF eq true true id (upaco2 (eqit_ eq true true id) bot2) (observe t0) (VisF e1 k') H6 : forall (a : unit) (b : A0), RAnsRef E unit A0 (evans A0 e1 ans) a e1 b -> upaco2 (rutt_ (REvRef E) (RAnsRef E) eq) bot2 (k a) (ITree.bind (k' b) f) k4 : A0 -> itree E R REL : forall v : A0, paco2 (eqit_ eq true true id) bot2 (k4 v) (k0 v) ============================ trace_prefixF (upaco2 trace_prefix_ r) (observe (peel_ (VisF (evans A0 e1 ans) k) (observe t0))) (VisF (evans A0 e1 ans) k) ``` Ongoing Proof History: ``` cbn in *. destruct (observe t0) eqn : Heqt0; try discriminate. + right. exists r0. pfold. red. cbn. rewrite Heqt0. - auto. + auto with itree. + injection x as Ht1. symmetry in Heqt0. apply simpobs in Heqt0. setoid_rewrite Heqt0. setoid_rewrite tau_eutt. eapply IHHvis; eauto. rewrite Ht1. auto. } destruct H as [ [B [k' [e1 Ht0] ] ] | [s Ht0] ]. + rewrite Heqt in Href. rewrite tau_eutt in Href. rewrite Ht0 in Href. rewrite bind_vis in Href. pinversion Href. subst; ddestruction; subst. rewrite Ht0 in Hvis. rewrite bind_vis in Hvis. pinversion Hvis. subst; ddestruction; subst. clear Heqt Heqb. punfold Ht0. red in Ht0. cbn in *. destruct e. * inv H1. ddestruction; subst. cbn. constructor. ? eapply trace_prefix_vis_evans; eauto. ? * ? eapply trace_prefix_vis_evempty; eauto. ``` Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index ff16faf..1f991e2 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -57,0 +58,2 @@ Definition state (s a : Type) := s -> prod s a. +Definition run_stateT {s m a} (x : stateT s m a) : s -> m (s * a)%type := x. + diff --git a/theories/Basics/HeterogeneousRelations.v b/theories/Basics/HeterogeneousRelations.v index 8894184..ad37cca 100644 --- a/theories/Basics/HeterogeneousRelations.v +++ b/theories/Basics/HeterogeneousRelations.v @@ -751 +751,21 @@ cbn in *. unfold diagonal_prop in *; tauto. -Qed. \ No newline at end of file +Qed. + + + + + +Definition option_rel {X : Type} (R : +relation X) : relation (option X) := +fun mx my => match mx,my with +| Some x, Some y => R +x y | None, None => True +| _, _ => False end. +Hint Unfold option_rel : core. + +Lemma option_rel_eq : forall {A : Type}, +eq_rel (@eq (option A)) (option_rel eq). +Proof. +intros ?; split; intros [] [] EQ; subst; try inv EQ; cbn; auto. +Qed. + +#[global] Hint Unfold option_rel : core. \ No newline at end of file diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 3f88726..eff8f67 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -69,0 +70,2 @@ Arguments itreeF _ _ : clear implicits. +Create HintDb itree. + diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index a1c2431..9949acf 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -113 +113 @@ intros ? ? ?. red. -induction 1; auto. +induction 1; auto with itree. diff --git a/theories/Dijkstra/ITreeDijkstra.v b/theories/Dijkstra/ITreeDijkstra.v ``` Next Tactic: ```
eapply <LOOKUP>trace_prefix_vis_evans : forall (E : Type -> Type) (R S : Type) (r : itrace E S -> itrace E R -> Prop) (A0 : Type) (ev : E A0) (ans : A0) (k : unit -> itree (EvAns E) R) (k' : A0 -> itree E S) (t0 : itree E S) (f : S -> itree E R), (forall (a : unit) (b : A0), RAnsRef E unit A0 (evans A0 ev ans) a ev b -> id (upaco2 (rutt_ (REvRef E) (RAnsRef E) eq) bot2) (k a) (ITree.bind (k' b) f)) -> t0 β‰ˆ Vis ev k' -> (forall (b : itrace E R) (t : itree E S) (f0 : S -> itree E R), b βŠ‘ ITree.bind t f0 -> r (peel b t) b) -> trace_prefixF (upaco2 trace_prefix_ r) (observe (peel_ (VisF (evans A0 ev ans) k) (observe t0))) (VisF (evans A0 ev ans) k)</LOOKUP>; eauto with itree. ```
{"final_commit":"8fcf6f5f81ec9289d56e777b3885e715b3328486","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-8447a4e3e92c94e5ec1f23f35b6ecd63fae0c880-8fcf6f5f81ec9289d56e777b3885e715b3328486-8_10_2-8_12_2-83.git.json","initial_commit":"8447a4e3e92c94e5ec1f23f35b6ecd63fae0c880","file":"theories\/ITrace\/ITraceBind.v"}
Ongoing Proof History: ``` Proof. induction p. - intro x. simpl. destruct (stop (f x)) eqn:des1. exists xH. split. reflexivity. split. ``` Proof State: ``` 3 subgoals X : Type f : X β†’ X stop : X β†’ bool p : positive IHp : βˆ€ x : X, βˆƒ q : positive, iterate_stop p x ≑ iterate q x ∧ (βˆ€ r : positive, (r < q)%positive β†’ stop (iterate r x) ≑ false) ∧ (p ≑ q ∨ (q < p)%positive ∧ stop (iterate q x) ≑ true) x : X des1 : stop (f x) ≑ true ============================ βˆ€ r : positive, (r < 1)%positive β†’ stop (iterate r x) ≑ false subgoal 2 is: (p~1)%positive ≑ 1%positive ∨ (1 < p~1)%positive ∧ stop (iterate 1 x) ≑ true subgoal 3 is: βˆƒ q : positive, (if stop (iterate_stop p (f x)) then iterate_stop p (f x) else iterate_stop p (iterate_stop p (f x))) ≑ iterate q x ∧ (βˆ€ r : positive, (r < q)%positive β†’ stop (iterate r x) ≑ false) ∧ ((p~1)%positive ≑ q ∨ (q < p~1)%positive ∧ stop (iterate q x) ≑ true) ``` Next Tactic: ```
intros. ```
{"package":"coq-corn","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/CoRN\/reals\/fast\/CRstreams.v"}
Proof State: ``` 1 subgoal A : Type t1, t2 : btree A l1, l2, l3 : list (btree A) H : ordered_cover l1 t1 H0 : forall l2 : list (btree A), length l1 = length l2 -> exists t2 : btree A, subst_pred l1 l2 t1 t2 H1 : ordered_cover l2 t2 H2 : forall l3 : list (btree A), length l2 = length l3 -> exists t3 : btree A, subst_pred l2 l3 t2 t3 l0 : list (btree A) H3 : length (l1 ++ l2) = length l0 t4 : btree A HH1 : subst_pred l1 (firstn (length l1) l0) t1 t4 ============================ exists t0 : btree A, subst_pred (l1 ++ l2) l0 (node t1 t2) t0 ``` Ongoing Proof History: ``` Proof using. intros t1 l1 l2 H; generalize l2; elim H; clear t1 l1 l2 H. intros t l l2; case l2. simpl in |- *; intros; discriminate. intros b l0; case l0; simpl in |- *; auto. intros H; exists b; auto. intros; discriminate. intros t1 t2 l1 l2 l3 H H0 H1 H2 l0 H3. - case (H0 (first_n l0 (length l1))); auto. + case (H0 (firstn (length l1) l0)); auto. - rewrite first_n_length; auto; (rewrite <- H3; rewrite length_app; auto with arith). + rewrite firstn_le_length_eq; auto; (rewrite <- H3; rewrite app_length; auto with arith). intros t4 HH1. ? case (H2 (skip_n l0 (length l1))); auto. ? rewrite skip_n_length; auto; (rewrite <- H3; rewrite length_app; rewrite minus_plus; auto with arith). ? intros t5 HH2. ``` Commit Diff: ``` diff --git a/theories/Aux.v b/theories/Aux.v index c7e8186..355e02d 100644 --- a/theories/Aux.v +++ b/theories/Aux.v @@ -132 +132,2 @@ End LeBool. -Section fold. +Section Fold. + @@ -137,7 +137,0 @@ Variable h : A -> A. -Variable eqA_dec : forall a b : A, {a = b} + {a <> b}. - -Theorem fold_left_app : forall a l1 l2, fold_left f (l1 ++ -l2) a = fold_left f l2 (fold_left f l1 a). -Proof using. -intros a l1; generalize a; elim l1; simpl in |- *; auto; clear a l1. -Qed. @@ -161,8 +154,0 @@ Qed. -Theorem fold_right_app : forall a l1 l2, -fold_right g a (l1 ++ l2) = -fold_right g (fold_right g a l2) l1. -Proof using. -intros a l1; generalize a; elim l1; simpl in |- *; auto; clear a l1. -intros a l H a0 l2; rewrite H; auto. -Qed. - @@ -178 +164 @@ Qed. -End fold. +End Fold. @@ -181,0 +168 @@ Section List. + @@ -227,31 +213,0 @@ Qed. - -Theorem length_app : forall l1 l2 : list A, length -(l1 ++ l2) = length l1 + length l2. -Proof using. -intros l1; elim l1; simpl in |- *; auto. -Qed. - -Theorem app_inv_head : forall l1 l2 l3 : list A, l1 -++ l2 = l1 ++ l3 -> l2 = l3. -Proof using. -intros l1; elim l1; simpl in |- *; auto. -intros a l H l2 l3 H0; apply H; injection H0; auto. -Qed. - -Theorem app_inv_tail : forall l1 l2 l3 : list A, l2 -++ l1 = l3 ++ l1 -> l2 = l3. -Proof using. -intros l1 l2; generalize l1; elim l2; clear l1 l2; simpl in |- *; auto. -intros l1 l3; case l3; auto. -intros b l H; absurd (length ((b :: l) ++ l1) <= length l1). -simpl in |- *; rewrite length_app; auto with arith. -rewrite <- H; auto with arith. -intros a l H l1 l3; case l3. -simpl in |- *; intros H1; absurd (length (a :: l ++ l1) <= length l1). -simpl in |- *; rewrite length_app; auto with arith. -rewrite H1; auto with arith. -simpl in |- *; intros b l0 H0; injection H0. -intros H1 H2; apply f_equal2 with (f := cons (A:=A)); auto. -apply H with (1 := H1); auto. -Qed. - @@ -341,4 +296,0 @@ Qed. -Theorem length_map : forall l, length (map f l) = length l. -Proof using. -intros l; elim l; simpl in |- *; auto. -Qed. @@ -346,8 +298 @@ Qed. -Theorem map_app : forall l1 l2, map f (l1 ++ l2) = map f l1 ++ map f l2. -Proof using. -intros l; elim l; simpl in |- *; auto. -intros a l0 H l2; apply f_equal2 with (f := cons (A:=B)); auto. -Qed. - - -Theorem in_flat_map : forall (l : list B) (f : +Theorem in_flat_map_in : forall (l : list B) (f : @@ -357,4 +302 @@ Proof using. -intros l g; elim l; simpl in |- *; auto. -intros a l0 H a0 b H0 [H1| H1]; apply in_or_app; auto. -left; rewrite H1; auto. -right; apply H with (b := b); auto. +intros; apply in_flat_map; exists b; split; auto. @@ -367,6 +309 @@ Proof using. -intros l g; elim l; simpl in |- *; auto. -intros a H; case H. -intros a l0 H a0 H0; case in_app_or with (1 := H0); simpl in |- *; auto. -intros H1; exists a; auto. -intros H1; case H with (1 := H1). -intros b (H2, H3); exists b; simpl in |- *; auto. +intros; apply in_flat_map; auto. @@ -416,14 +353,3 @@ Variable A : Type. -Fixpoint first_n (l : list -A) (n : nat) {struct -n} : list A := -match n with | O -=> [] | S n1 -=> match l with | -[] => [] | a -:: l1 => a :: ``` Next Tactic: ```
case (H2 (<LOOKUP>skipn : forall A : Type, nat -> list A -> list A</LOOKUP> (<LOOKUP>length : forall A : Type, list A -> nat</LOOKUP> l1) l0)); auto. ```
{"final_commit":"b6befe10be8f4acefcd6424a3eec659dbd39c0c4","project":"huffman","repair_file":"\/data\/coq-pearls\/repairs\/huffman\/repair-huffman-6e3f37b2113e34f74c6b5a6ff2c7346a9cdf9e4e-b6befe10be8f4acefcd6424a3eec659dbd39c0c4-8_11_2-8_11_2-18.git.json","initial_commit":"6e3f37b2113e34f74c6b5a6ff2c7346a9cdf9e4e","file":"theories\/SubstPred.v"}
Proof State: ``` 1 subgoal X, Y : MetricSpace XY := ProductMS X Y : MetricSpace f : X --> Complete Y plX : PrelengthSpace X plFEX : PrelengthSpace (FinEnum X) x : Complete X y : Complete Y s : Compact X H0 : inCompact x s H1 : msp_eq y (Cbind plX f x) ============================ inCompact (Couple (PairMS x (Cbind plX f x))) (CompactGraph_b plFEX s) ``` Ongoing Proof History: ``` Proof. intros plX plFEX x y s. split; intros H. split; rewrite <- (CoupleCorrect2 x y). apply (@CompactGraph_b_correct2 plFEX). exact H. symmetry. transitivity (Csnd (Couple (x,y))). refine (CompactGraph_b_correct3 _ _). apply H. apply CoupleCorrect3. destruct H as [H0 H1]. change (x, y) with (PairMS x y). rewrite -> H1. ``` Next Tactic: ```
apply <LOOKUP>CompactGraph_b_correct1 : forall [plX : PrelengthSpace X] (plFEX : PrelengthSpace (FinEnum X)) [x : Complete X] [s : Compact X], inCompact x s -> inCompact (Couple (x, Cbind plX f x)) (CompactGraph_b plFEX s)</LOOKUP>. ```
{"package":"coq-corn","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/CoRN\/metric2\/Graph.v"}
Commit Diff: ``` diff --git a/theories/Basics/CategoryFacts.v b/theories/Basics/CategoryFacts.v index 732b8d2..a684e54 100644 --- a/theories/Basics/CategoryFacts.v +++ b/theories/Basics/CategoryFacts.v @@ -121,0 +122,13 @@ Qed. +Context {t : obj}. +Context {Terminal_t : Terminal C t}. +Context {TerminalObject_t : TerminalObject C t}. + + +Lemma terminal_unique : forall a (f g +: C a t), f β©― g. +Proof. +intros. +rewrite (terminal_object f), (terminal_object g). +reflexivity. +Qed. + @@ -402,0 +416,281 @@ End CoproductFacts. + + + +Section ProductFacts. + +Context {obj : Type} {C : Hom obj}. + +Context {Eq2_C : Eq2 C}. +Context {E_Eq2_C : forall a b, @Equivalence (C a b) eq2}. + +Context {Id_C : Id_ C} {Cat_C : Cat C}. + +Context {Category_C : Category C}. + +Context {bif : binop obj}. +Context {Prod_C : Pair C bif} +{Fst_C : Fst C bif} +{Snd_C : Snd C bif}. +Context {Product_C : Product C bif}. + +Lemma pair_fst' {a b c d} (ca : C c a) (cb : C c b) (dc +: C d c) : dc >>> pair_ ca cb >>> fst_ β©― dc >>> ca. +Proof. +rewrite cat_assoc, pair_fst. reflexivity. +Qed. + +Lemma pair_snd' {a b c d} (ca : C c a) (cb : C c b) (dc +: C d c) : dc >>> pair_ ca cb >>> snd_ β©― dc >>> cb. +Proof. +rewrite cat_assoc, pair_snd. reflexivity. +Qed. + + +Lemma pair_cat {a b c d} (ab : C a b) (bc : C b c) (bd : +C b d) : (ab >>> pair_ bc bd β©― pair_ (ab >>> bc) (ab >>> bd)). +Proof. +apply pair_universal. +- rewrite pair_fst'; reflexivity. +- rewrite pair_snd'; reflexivity. +Qed. + + +Corollary pair_eta {a b} : id_ (bif a b) β©― pair_ fst_ snd_. +Proof. +apply pair_universal; rewrite cat_id_l; reflexivity. +Qed. + +Lemma pair_eta' {a b c} (f : C a (bif b +c)) : f β©― pair_ (f >>> fst_) (f >>> snd_). +Proof. +eapply pair_universal; reflexivity. +Qed. + + + +Lemma pair_split {a b c} (f g : C +a (bif b c)) : (f >>> fst_ +β©― g >>> fst_) -> (f >>> snd_ +β©― g >>> snd_) -> f β©― g. +Proof. +intros. rewrite (pair_eta' g). +apply pair_universal; assumption. +Qed. + +Existing Instance Bimap_Product. +Existing Instance Swap_Product. +Existing Instance AssocR_Product. +Existing Instance AssocL_Product. +Existing Instance UnitL_Product. +Existing Instance UnitL'_Product. +Existing Instance UnitR_Product. +Existing Instance UnitR'_Product. + +Ltac unfold_product +:= unfold +bimap, Bimap_Product, +assoc_r, AssocR_Product, +assoc_l, AssocL_Product, +unit_l, UnitL_Product, +unit_l', UnitL'_Product, +unit_r, UnitR_Product, +unit_r', UnitR'_Product, +swap, Swap_Product. + + +Ltac cat_auto_simpl_prod := match goal with +| [ |- eq2 ?lhs ?rhs +] => repeat (rewrite cat_id_l || +rewrite cat_id_r || rewrite pair_fst || +rewrite <- (cat_assoc (pair_ _ _) +fst_), pair_fst || rewrite pair_snd || +rewrite <- (cat_assoc (pair_ _ _) +snd_), pair_snd || rewrite !cat_assoc); reflexivity ``` Ongoing Proof History: ``` Proof. unfold map_default_eq, interp_map. repeat intro. revert x y H s1 s2 H0. einit. ecofix CH. intros. rewrite! unfold_interp_state. punfold H0. red in H0. revert s1 s2 H1. induction H0; intros; subst; simpl; pclearbot. - eret. - etau. - ebind. apply pbc_intro_h with (RU := prod_rel (@eq_map _ _ _ _ d) eq). { ? unfold over. ? destruct (case e). ? - ``` Proof State: ``` 1 subgoal K, V : Type map : Type M : Map K V map MOk : MapOk eq M Kdec : RelDec eq KdecOk : RelDec_Correct Kdec R : Type E : Type -> Type d : V RR : R -> R -> Prop gL' : itree E (map * R) -> itree E (map * R) -> Prop INCL : forall x0 x1 : itree E (map * R), bot2 x0 x1 -> gL' x0 x1 gH' : itree E (map * R) -> itree E (map * R) -> Prop INCH : forall x0 x1 : itree E (map * R), bot2 x0 x1 -> gH' x0 x1 CHL : forall x x0 : itree (mapE K d +' E) R, eutt RR x x0 -> forall x2 x3 : map, eq_map x2 x3 -> gL' (interp_state (case_ (handle_map (V:=V)) pure_state) x x2) (interp_state (case_ (handle_map (V:=V)) pure_state) x0 x3) CHH : forall x x0 : itree (mapE K d +' E) R, eutt RR x x0 -> forall x2 x3 : map, eq_map x2 x3 -> gH' (interp_state (case_ (handle_map (V:=V)) pure_state) x x2) (interp_state (case_ (handle_map (V:=V)) pure_state) x0 x3) x, y : itree (mapE K d +' E) R u : Type e : (mapE K d +' E) u k1, k2 : u -> itree (mapE K d +' E) R REL : forall v : u, paco2 (eqit_ RR true true id) bot2 (k1 v) (k2 v) s1, s2 : map H1 : eq_map s1 s2 ============================ eqit (prod_rel eq_map eq) true true (case_ (handle_map (V:=V)) pure_state u e s1) (case_ (handle_map (V:=V)) pure_state u e s2) ``` Next Tactic: ```
unfold case_. ```
{"final_commit":"81a1ac45e6eac7285942c92f0079e632d7200904","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-440b18da2c80560f3454b2cbc1736209a76d64ad-81a1ac45e6eac7285942c92f0079e632d7200904-8_10_2-8_10_2-3.git.json","initial_commit":"440b18da2c80560f3454b2cbc1736209a76d64ad","file":"theories\/Events\/MapDefaultFacts.v"}
Ongoing Proof History: ``` Proof. intro. ``` Proof State: ``` 1 subgoal I : interval pI : proper I F, G : PartFunct IR diffF : Diffble I pI F diffG : Diffble I pI G X : bnd_away_zero_in_P G I ============================ Diffble I pI (F {/} G) ``` Next Tactic: ```
apply <LOOKUP>Diffble_wd : forall (I : interval) (pI : proper I) (F H : PartFunct IR), Feq I F H -> Diffble I pI F -> Diffble I pI H</LOOKUP> with (F{*}{1/}G). ```
{"package":"coq-corn","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/CoRN\/ftc\/MoreFunctions.v"}
Ongoing Proof History: ``` Proof. intros C HnotEM. set (R := fun A b => A /\ true = b \/ ~ A /\ false = b). assert (H : exists f : Prop -> bool, (forall A:Prop, R A (f A))). apply unique_choice. intro A. destruct (classic A) as [Ha| Hnota]. exists true; split. left; split; [ assumption | reflexivity ]. intros y [[_ Hy]| [Hna _]]. assumption. contradiction. exists false; split. right; split; [ assumption | reflexivity ]. intros y [[Ha _]| [_ Hy]]. contradiction. assumption. ``` Proof State: ``` 1 subgoal C : Prop HnotEM : (forall P : Prop, {P} + {~ P}) -> C R := fun (A : Prop) (b : bool) => A /\ true = b \/ ~ A /\ false = b : Prop -> bool -> Prop H : exists f : Prop -> bool, forall A : Prop, R A (f A) ============================ C ``` Next Tactic: ```
destruct H as [f Hf]. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Logic\/ClassicalUniqueChoice.v"}
Ongoing Proof History: ``` Proof. repeat red. intros. subst. split. - revert_until y1. pcofix CIH. intros. pstep. - punfold H1. + punfold H0. - red in H1. + red in H0. red. ? hinduction H1 before CIH; intros; eauto. ? + ? apply EqRet. ``` Proof State: ``` 1 subgoal E : Type -> Type R1 : Type R2 : Type x, y : relationH R1 R2 H : eq_rel x y y0, y1 : bool r : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) CIH0 : forall (a0 : itree E R1) (a1 : itree E R2), bot2 a0 a1 -> r a0 a1 CIH : forall (x0 : itree E R1) (x1 : itree E R2), eqit x y0 y1 x0 x1 -> r x0 x1 y2 : itree E R1 y3 : itree E R2 H0 : eqitF x y0 y1 id (upaco2 (eqit_ x y0 y1 id) bot2) (observe y2) (observe y3) ============================ eqitF y y0 y1 id (upaco2 (eqit_ y y0 y1 id) r) (observe y2) (observe y3) ``` Commit Diff: ``` diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index b8604b4..1d0cd49 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -253,2 +253,2 @@ t2)) (at level 61, t1 at next level, right associativity) : itree_scope. -Notation "` x : t <- t1 ;; t2" := (ITree.bind t1 (fun x : t => t2)) -(at level 61, t at next level, t1 at next level, x ident, right associativity) : itree_scope. +Notation "` x : t <- t1 ;; t2" := (ITree.bind t1 (fun x : t => t2)) (at +level 61, t at next level, t1 at next level, x ident, right associativity, only parsing) : itree_scope. diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index b911a90..32f56a6 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6,2 +6 @@ Require Import -Program Classes.Morphisms -Setoids.Setoid +Classes.Morphisms Setoids.Setoid @@ -24 +23,2 @@ Eq.Eq -Eq.UpToTaus. +Eq.UpToTaus +Eq.Paco2. @@ -68 +68 @@ Proof. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert A B C f g a0. -ginit. gcofix CIH. intros. +revert f g a0. +ginit. pcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -277 +277 @@ revert a. -gcofix CIH'. intros. +pcofix CIH'. intros. @@ -337,2 +337 @@ etau. -specialize (CIH xa). -cbn in CIH. +specialize (CIHL xa). cbn in CIHL. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 21ac7e0..9f80143 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29 +29,2 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition. +Core.ITreeDefinition +Eq.Paco2. @@ -165,0 +167,54 @@ Hint Unfold id: core. +Lemma eqitF_VisF_inv_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} +t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 +b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 +/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 += TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). +Proof. +refine (fun H => match H +in eqitF _ _ _ _ +_ _ t2 return match t2 +return Prop with | VisF e2 +k2 => _ | _ +=> True end with | +EqVis _ _ _ _ +_ _ _ _ _ +=> _ | _ => +_ end); try exact I. +- left; eauto. +- destruct i0; eauto. +Qed. + +Lemma eqitF_VisF_inv {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 +(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 +-> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists +p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. +Proof. +refine (fun H => match H in +eqitF _ _ _ _ _ t1 +t2 return match t1, t2 return Prop +with | VisF e1 k1, VisF e2 +k2 => _ | _, _ => +True end with | EqVis _ +_ _ _ _ _ _ +_ _ => _ | _ +=> _ end); try exact I. +- exists eq_refl; cbn; eauto. +- destruct i; exact I. +Qed. + +Lemma eqitF_VisF_inv_strong {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 +vclo sim} X (e : E X) (k1 : X -> _) (k2 +: X -> _) : eqitF RR b1 b2 vclo sim (VisF e +k1) (VisF e k2) -> forall x, vclo sim (k1 x) (k2 x). +Proof. +intros H. dependent destruction H. assumption. +Qed. + +Lemma eqitF_VisF {E R1 R2} {RR : R1 -> R2 -> Prop} {b1 b2 vclo sim} {X1 +X2} (p : X1 = X2) (e1 : E X1) (k1 : X1 -> _) (e2 : +E X2) (k2 : X2 -> _) : eqeq E p e1 e2 -> pweqeq (vclo sim) ``` Next Tactic: ```
hinduction H0 before CIH; intros; eauto. ```
{"final_commit":"f3853150994e962978fa4cf0ed18dcb8c42e3262","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-fbba5fd82470aa824ec0eab20c275063ca38fb75-f3853150994e962978fa4cf0ed18dcb8c42e3262-8_10_2-8_11_2-0.git.json","initial_commit":"fbba5fd82470aa824ec0eab20c275063ca38fb75","file":"theories\/Eq\/Eq.v"}
Proof State: ``` 1 subgoal x, y : t H : y <= x ============================ match x ?= y with | Lt => y | _ => x end == x ``` Ongoing Proof History: ``` Proof. intros. unfold max, gmax. ``` Next Tactic: ```
case <LOOKUP>compare_spec : forall x y : t, CompareSpec (x == y) (x < y) (y < x) (x ?= y)</LOOKUP>; auto with relations. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Structures\/GenericMinMax.v"}
Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index ff16faf..1f991e2 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -57,0 +58,2 @@ Definition state (s a : Type) := s -> prod s a. +Definition run_stateT {s m a} (x : stateT s m a) : s -> m (s * a)%type := x. + diff --git a/theories/Basics/HeterogeneousRelations.v b/theories/Basics/HeterogeneousRelations.v index 8894184..ad37cca 100644 --- a/theories/Basics/HeterogeneousRelations.v +++ b/theories/Basics/HeterogeneousRelations.v @@ -751 +751,21 @@ cbn in *. unfold diagonal_prop in *; tauto. -Qed. \ No newline at end of file +Qed. + + + + + +Definition option_rel {X : Type} (R : +relation X) : relation (option X) := +fun mx my => match mx,my with +| Some x, Some y => R +x y | None, None => True +| _, _ => False end. +Hint Unfold option_rel : core. + +Lemma option_rel_eq : forall {A : Type}, +eq_rel (@eq (option A)) (option_rel eq). +Proof. +intros ?; split; intros [] [] EQ; subst; try inv EQ; cbn; auto. +Qed. + +#[global] Hint Unfold option_rel : core. \ No newline at end of file diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 3f88726..eff8f67 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -69,0 +70,2 @@ Arguments itreeF _ _ : clear implicits. +Create HintDb itree. + diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index a1c2431..9949acf 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -113 +113 @@ intros ? ? ?. red. -induction 1; auto. +induction 1; auto with itree. diff --git a/theories/Dijkstra/ITreeDijkstra.v b/theories/Dijkstra/ITreeDijkstra.v index 9529757..b25a16e 100644 --- a/theories/Dijkstra/ITreeDijkstra.v +++ b/theories/Dijkstra/ITreeDijkstra.v @@ -189 +189 @@ is_inf_cons (h : A) (t : stream A) : F t -> is_infF F (ConsF h t). -Hint Constructors is_infF : core. +Hint Constructors is_infF : itree. @@ -198 +198 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -217 +217 @@ s2 : stream A) : F s1 s2 -> bisimF F (ConsF h s1) (ConsF h s2). -Hint Constructors bisimF : core. +Hint Constructors bisimF : itree. @@ -226 +226 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -234 +234 @@ constructor; red. -- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto. +- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto with itree. @@ -237 +237 @@ pfold. red. -pinversion H0; subst; auto. +pinversion H0; subst; auto with itree. @@ -239 +239 @@ pinversion H0; subst; auto. -pinversion H0; pinversion H1; auto. +pinversion H0; pinversion H1; auto with itree. @@ -250 +250 @@ pfold. red. unfold app. pinversion H12. -- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto. +- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto with itree. @@ -282 +282 @@ stream' A -> Prop := | forall_nil : forall_streamF P F NilF | forall_cons (h : A -Hint Constructors forall_streamF : core. +Hint Constructors forall_streamF : itree. @@ -289 +289 @@ Proof. -red. intros. red. red in IN. destruct IN; auto. +red. intros. red. red in IN. destruct IN; auto with itree. @@ -301 +301 @@ F (observe_stream t) -> inf_manyF P F (ConsF h t) | cons_found (h : A) (t -Hint Constructors inf_manyF : core. +Hint Constructors inf_manyF : itree. @@ -308 +308 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -320,2 +320,2 @@ punfold Him. red in Him. pfold. red. -induction Him; auto. pclearbot. -auto. +induction Him; auto with itree. pclearbot. +auto with itree. @@ -355 +355 @@ sim ot1 (observe t2) -> eqitEF RR sim ot1 (TauF t2). -Hint Constructors eqitEF : core. +Hint Constructors eqitEF : itree. @@ -367 +367 @@ repeat red. intros. rename x0 into t1. rename x1 into t2. -induction IN; eauto. +induction IN; eauto with itree. @@ -378 +378 @@ r) | eventlessTau (t : itree E R) : F t -> eventlessF F (TauF t). -Hint Constructors eventlessF : core. +Hint Constructors eventlessF : itree. @@ -383 +383 @@ Prop) : itree E R -> Prop := fun t => eventlessF F (observe t). -Hint Unfold eventless_ : core. +Hint Unfold eventless_ : itree. @@ -390 +390 @@ Proof. -red. intros. red in IN. red. inversion IN; auto. +red. intros. red in IN. red. inversion IN; auto with itree. ``` Proof State: ``` 1 subgoal E : Type -> Type R : Type eq_ : itree E R -> itree E R -> Prop ============================ Equivalence eq_ -> Equivalence (going eq_) ``` Ongoing Proof History: ``` Proof. ? intros []; constructor; cbv; eauto. ? - ? intros ? ? []; auto. ``` Next Tactic: ```
intros []; constructor; cbv; eauto with itree. ```
{"final_commit":"8fcf6f5f81ec9289d56e777b3885e715b3328486","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-8447a4e3e92c94e5ec1f23f35b6ecd63fae0c880-8fcf6f5f81ec9289d56e777b3885e715b3328486-8_10_2-8_12_2-5.git.json","initial_commit":"8447a4e3e92c94e5ec1f23f35b6ecd63fae0c880","file":"theories\/Eq\/Shallow.v"}
Ongoing Proof History: ``` apply Rle_pow. unfold C; apply RmaxLess1. replace (4 * N)%nat with (2 * (2 * N))%nat; [ idtac | ring ]. apply (fun m n p:nat => mult_le_compat_l p n m). replace (2 * N)%nat with (S (N + pred N)). apply le_n_S. apply plus_le_compat_l; assumption. rewrite pred_of_minus. lia. apply Rle_trans with (sum_f_R0 (fun k:nat => sum_f_R0 (fun l:nat => C ^ (4 * N) * Rsqr (/ INR (fact (S (N + k))))) (pred (N - k))) (pred N)). apply sum_Rle; intros. apply sum_Rle; intros. rewrite <- (Rmult_comm (C ^ (4 * N))). apply Rmult_le_compat_l. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. unfold C; apply RmaxLess1. replace (/ INR (fact (2 * S (n0 + n)) * fact (2 * (N - n0)))) with (Binomial.C (2 * S (N + n)) (2 * S (n0 + n)) / INR (fact (2 * S (N + n)))). apply Rle_trans with (Binomial.C (2 * S (N + n)) (S (N + n)) / INR (fact (2 * S (N + n)))). unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ INR (fact (2 * S (N + n))))). apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply C_maj. lia. right. unfold Rdiv; rewrite Rmult_comm. unfold Binomial.C. unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. replace (2 * S (N + n) - S (N + n))%nat with (S (N + n)). rewrite Rinv_mult_distr. unfold Rsqr; reflexivity. apply INR_fact_neq_0. apply INR_fact_neq_0. lia. apply INR_fact_neq_0. unfold Rdiv; rewrite Rmult_comm. unfold Binomial.C. unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. replace (2 * S (N + n) - 2 * S (n0 + n))%nat with (2 * (N - n0))%nat. rewrite mult_INR. reflexivity. lia. apply INR_fact_neq_0. apply Rle_trans with (sum_f_R0 (fun k:nat => INR N / INR (fact (S N)) * C ^ (4 * N)) (pred N)). apply sum_Rle; intros. rewrite <- (scal_sum (fun _:nat => C ^ (4 * N)) (pred (N - n)) (Rsqr (/ INR (fact (S (N + n)))))). rewrite sum_cte. rewrite <- Rmult_assoc. do 2 rewrite <- (Rmult_comm (C ^ (4 * N))). rewrite Rmult_assoc. apply Rmult_le_compat_l. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. unfold C; apply RmaxLess1. apply Rle_trans with (Rsqr (/ INR (fact (S (N + n)))) * INR N). apply Rmult_le_compat_l. apply Rle_0_sqr. apply le_INR. lia. rewrite Rmult_comm; unfold Rdiv; apply Rmult_le_compat_l. apply pos_INR. apply Rle_trans with (/ INR (fact (S (N + n)))). pattern (/ INR (fact (S (N + n)))) at 2; rewrite <- Rmult_1_r. unfold Rsqr. apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply Rmult_le_reg_l with (INR (fact (S (N + n)))). apply INR_fact_lt_0. rewrite <- Rinv_r_sym. rewrite Rmult_1_r. apply (le_INR 1). apply lt_le_S. apply INR_lt; apply INR_fact_lt_0. apply INR_fact_neq_0. apply Rmult_le_reg_l with (INR (fact (S (N + n)))). apply INR_fact_lt_0. rewrite <- Rinv_r_sym. apply Rmult_le_reg_l with (INR (fact (S N))). apply INR_fact_lt_0. rewrite Rmult_1_r. rewrite (Rmult_comm (INR (fact (S N)))). rewrite Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_r. apply le_INR. apply fact_le. apply le_n_S. apply le_plus_l. apply INR_fact_neq_0. apply INR_fact_neq_0. rewrite sum_cte. apply Rle_trans with (C ^ (4 * N) / INR (fact (pred N))). rewrite <- (Rmult_comm (C ^ (4 * N))). unfold Rdiv; rewrite Rmult_assoc; apply Rmult_le_compat_l. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. unfold C; apply RmaxLess1. cut (S (pred N) = N). intro; rewrite H0. pattern N at 2; rewrite <- H0. do 2 rewrite fact_simpl. rewrite H0. repeat rewrite mult_INR. repeat rewrite Rinv_mult_distr. rewrite (Rmult_comm (/ INR (S N))). repeat rewrite <- Rmult_assoc. rewrite <- Rinv_r_sym. rewrite Rmult_1_l. pattern (/ INR (fact (pred N))) at 2; rewrite <- Rmult_1_r. rewrite Rmult_assoc. apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply Rmult_le_reg_l with (INR (S N)). apply lt_INR_0; apply lt_O_Sn. rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_r; rewrite Rmult_1_l. apply le_INR; apply le_n_Sn. apply not_O_INR; discriminate. apply not_O_INR. red; intro; rewrite H1 in H; elim (lt_irrefl _ H). apply not_O_INR. red; intro; rewrite H1 in H; elim (lt_irrefl _ H). ``` Proof State: ``` 5 subgoals x, y : R N : nat H : (0 < N)%nat C := Rmax 1 (Rmax (Rabs x) (Rabs y)) : R H0 : S (Init.Nat.pred N) = N ============================ INR (fact (Init.Nat.pred N)) <> 0 subgoal 2 is: INR (S N) <> 0 subgoal 3 is: INR N * INR (fact (Init.Nat.pred N)) <> 0 subgoal 4 is: S (Init.Nat.pred N) = N subgoal 5 is: C ^ (4 * N) / INR (fact (Init.Nat.pred N)) <= Majxy x y (Init.Nat.pred N) ``` Next Tactic: ```
apply <LOOKUP>INR_fact_neq_0 : forall n : nat, INR (fact n) <> 0</LOOKUP>. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Reals\/Cos_plus.v"}
Commit Diff: ``` diff --git a/Reachability.v b/Reachability.v index 5c47635..f125ad9 100644 --- a/Reachability.v +++ b/Reachability.v @@ -18,5 +18,20 @@ Import Eval.Evaluator. - -Inductive reachability : Store -> Loc -> Loc ->Prop := |rch_heap : forall l Οƒ, l < (dom Οƒ) -> (reachability Οƒ -l l) |rch_trans : forall l0 l1 l2 C Ο‰ Οƒ, (reachability Οƒ l0 l1) -> (getObj Οƒ l1 = Some -(C, Ο‰)) -> (exists f, (getVal Ο‰ f = Some l2)) -> (l2 < dom Οƒ) -> (reachability Οƒ l0 l2). -Notation "Οƒ ⊨ l1 ⇝ l2" := (reachability Οƒ l1 l2) (at level 80, l1 at level 80, l2 at level 80). +Reserved Notation "Οƒ ⊨ l1 ⇝ l2" (at level 80, l1 at level 80, l2 at level 80). +Inductive reachability : Store -> Loc +-> Loc ->Prop := | rch_heap: +forall l Οƒ, l < (dom +Οƒ) -> Οƒ ⊨ l ⇝ +l | rch_step: forall l0 l1 +C f Ο‰ Οƒ, l1 < +(dom Οƒ) -> getObj Οƒ l0 += Some (C, Ο‰) -> getVal +Ο‰ f = Some l1 -> +Οƒ ⊨ l0 ⇝ l1 +| rch_trans: forall l0 l1 +l2 Οƒ, Οƒ ⊨ l0 +⇝ l1 -> Οƒ ⊨ +l1 ⇝ l2 -> Οƒ +⊨ l0 ⇝ l2 where +"Οƒ ⊨ l1 ⇝ l2" +:= (reachability Οƒ l1 l2). +Hint Resolve rch_heap rch_step rch_trans: rch. +Hint Rewrite update_dom: rch. @@ -41,3 +56 @@ Proof. -intros Οƒ l1 l2 l3 H1 H2. -induction H2 => //. -apply (rch_trans l1 l2 l3 C Ο‰ Οƒ (IHreachability H1) H H0 H3). +eauto using rch_trans. @@ -44,0 +58 @@ Qed. + @@ -60 +74 @@ intros. -induction H; steps. +induction H; repeat steps || eapply_anywhere getObj_dom. @@ -64,11 +78,11 @@ Qed. -Lemma reachability_rev: forall Οƒ l l', Οƒ ⊨ l -⇝ l' -> (l = l' /\ l < -dom Οƒ) \/ (exists C Ο‰ f l0, getObj -Οƒ l = Some(C, Ο‰) /\ getVal Ο‰ f -= Some l0 /\ Οƒ ⊨ l0 ⇝ l'). -Proof. -intros. -induction H; steps. -+ right. repeat eexists; eauto using rch_heap. -+ right. repeat eexists; eauto using rch_heap, rch_trans. -Qed. + + + + + + + + + + + @@ -85,3 +98,0 @@ induction H2; eauto. -steps. -pose proof (H1 l1 l2 C Ο‰ f). -eapply H0; eauto. @@ -99,25 +110,4 @@ intros Οƒ x C Ο‰ l Hx Hobj. -apply reachability_rev_ind; intros. -+ left; rewrite_anywhere update_dom; eauto using rch_heap. -+ steps; eauto using reachability_trans. -+ destruct (PeanoNat.Nat.eq_dec l0 x) as [Heq | Hneq]; steps. -++ move: (H1) => H1cp. -rewrite_anywhere getObj_update1 => //. -invert_constructor_equalities; subst. -unfold getVal in *. -assert (f < length Ο‰ \/ f = length Ο‰) as [Hf | Hf]. { -apply Lt.le_lt_or_eq, Lt.lt_n_Sm_le. -pose proof (nth_error_Some (Ο‰ ++ [l]) f) as Hf. -rewrite app_length PeanoNat.Nat.add_1_r in Hf. -apply Hf. steps. -} -+++ rewrite_anywhere nth_error_app1; steps. -rewrite_anywhere update_dom. -left. eapply rch_trans; eauto using rch_heap. -+++ rewrite nth_error_app2 in H2; steps. -rewrite PeanoNat.Nat.sub_diag in H2. simpl in H2. -steps. rewrite_anywhere update_dom. -right; eauto -using rch_heap. -++ rewrite_anywhere getObj_update2; steps. -rewrite_anywhere update_dom. -left. eapply rch_trans; eauto using rch_heap, getObj_dom. +apply reachability_rev_ind; steps; eauto with rch; +rewrite_anywhere update_dom; eauto with rch. +eapply_anywhere getObj_update3; steps; eauto with rch. +eapply_anywhere getVal_add; steps; eauto with rch. @@ -127,2 +116,0 @@ Qed. - - @@ -138,10 +126,3 @@ Proof. ``` Proof State: ``` 1 subgoal Οƒ : list (ClN * list Value) C : ClN L : LocSet l1 : Loc l : nat H : S l <= dom Οƒ C0 : ClN Ο‰ : Env H1 : S l1 <= S (dom Οƒ) H2 : getObj (Οƒ ++ [(C, [])]) l1 = Some (C0, Ο‰) f : nat H0 : getVal Ο‰ f = Some l H4 : S l <= S (dom Οƒ) ============================ Οƒ ⊨ l1 ⇝ l ``` Ongoing Proof History: ``` Proof. intros. inversion H0 as [l1 [Hl1 Hrch]]. exists l1; split => //. apply reachable_path_reachability in Hrch as [Hrch | [p Hrch]]. + - steps; eauto using rch_heap. + steps; eauto with rch. + clear Hl1 H0. generalize dependent l. generalize dependent l1. induction p; intros. ++ steps; unfold reachable_one_step in *; steps. - unfold dom in H1. + repeat rewrite_anywhere dom_app. ? repeat rewrite_anywhere app_length ; steps. ? pose proof (getObj_last_empty _ _ _ _ _ _ _ H2 H0) as [Hobj Hl1]. ? eapply rch_trans; eauto using rch_trans, rch_heap. ``` Next Tactic: ```
eapply <LOOKUP>getObj_last_empty : forall (Οƒ : list (ClN * list Value)) (C C' : ClN) (Ο‰ : Env) (l f : nat) (v : Value), getObj (Οƒ ++ [(C, [])]) l = Some (C', Ο‰) -> getVal Ο‰ f = Some v -> getObj Οƒ l = Some (C', Ο‰) /\ l < dom Οƒ</LOOKUP> in H2; eauto; steps. ```
{"final_commit":"2dfd0b6c87b32ebd6bd1dd83e76e654e73dd3696","project":"celsius","repair_file":"\/data\/coq-pearls\/repairs\/celsius\/repair-celsius-a726b4d083864e7cb26d15bceeb49fbc418b2811-2dfd0b6c87b32ebd6bd1dd83e76e654e73dd3696-8_13_2-8_13_2-16.git.json","initial_commit":"a726b4d083864e7cb26d15bceeb49fbc418b2811","file":"Reachability.v"}
Ongoing Proof History: ``` Proof. intros. unfold decode_val in H. revert H; case_eq (getN 4 i b); intros. inv H. unfold getN in H. destruct l; inv H. destruct (proj_bytes (ZMap.get i b :: ZMap.get (i + 1) b :: ZMap.get (i + 1 + 1) b :: ZMap.get (i + 1 + 1 + 1) b :: nil)) eqn:PB. * simpl proj_bytes in PB. destruct (ZMap.get i b); inv PB. destruct (ZMap.get (i+1) b); inv H2. destruct (ZMap.get (i+1+1) b); inv H3. destruct (ZMap.get (i+1+1+1) b); inv H2. unfold decode_int in H1. assert (Int.repr (int_of_bytes (rev_if_be (i0 :: i1 :: i2 :: i3 :: nil))) = Int.repr 0) by (forget (Int.repr (int_of_bytes (rev_if_be (i0 :: i1 :: i2 :: i3 :: nil)))) as foo; inv H1; auto). clear H1. assert (forall b0 b1 b2 b3, Int.repr (int_of_bytes (b0::b1::b2::b3::nil)) = Int.repr 0 -> (Byte.unsigned b0=0/\Byte.unsigned b1=0/\Byte.unsigned b2=0/\Byte.unsigned b3=0)). clear. intros. simpl in H. pose proof (Byte.unsigned_range b0). pose proof (Byte.unsigned_range b1). pose proof (Byte.unsigned_range b2). pose proof (Byte.unsigned_range b3). replace (Byte.modulus) with 256 in * by reflexivity. pose proof (Int.unsigned_repr (Byte.unsigned b0 + (Byte.unsigned b1 + (Byte.unsigned b2 + (Byte.unsigned b3 + 0) * 256) * 256) * 256)). spec H4. clear H. rewrite max_unsigned_eq; lia. ``` Proof State: ``` 2 subgoals b0, b1, b2, b3 : byte H : Int.repr (Byte.unsigned b0 + (Byte.unsigned b1 + (Byte.unsigned b2 + (Byte.unsigned b3 + 0) * 256) * 256) * 256) = Int.repr 0 H0 : 0 <= Byte.unsigned b0 < 256 H1 : 0 <= Byte.unsigned b1 < 256 H2 : 0 <= Byte.unsigned b2 < 256 H3 : 0 <= Byte.unsigned b3 < 256 H4 : Int.unsigned (Int.repr (Byte.unsigned b0 + (Byte.unsigned b1 + (Byte.unsigned b2 + (Byte.unsigned b3 + 0) * 256) * 256) * 256)) = Byte.unsigned b0 + (Byte.unsigned b1 + (Byte.unsigned b2 + (Byte.unsigned b3 + 0) * 256) * 256) * 256 ============================ Byte.unsigned b0 = 0 /\ Byte.unsigned b1 = 0 /\ Byte.unsigned b2 = 0 /\ Byte.unsigned b3 = 0 subgoal 2 is: nth (Z.to_nat (j - i)) (Byte i0 :: Byte i1 :: Byte i2 :: Byte i3 :: nil) Undef = Byte Byte.zero ``` Next Tactic: ```
rewrite H in H4. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/veric\/initialize.v"}
Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index ff16faf..1f991e2 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -57,0 +58,2 @@ Definition state (s a : Type) := s -> prod s a. +Definition run_stateT {s m a} (x : stateT s m a) : s -> m (s * a)%type := x. + diff --git a/theories/Basics/HeterogeneousRelations.v b/theories/Basics/HeterogeneousRelations.v index 8894184..ad37cca 100644 --- a/theories/Basics/HeterogeneousRelations.v +++ b/theories/Basics/HeterogeneousRelations.v @@ -751 +751,21 @@ cbn in *. unfold diagonal_prop in *; tauto. -Qed. \ No newline at end of file +Qed. + + + + + +Definition option_rel {X : Type} (R : +relation X) : relation (option X) := +fun mx my => match mx,my with +| Some x, Some y => R +x y | None, None => True +| _, _ => False end. +Hint Unfold option_rel : core. + +Lemma option_rel_eq : forall {A : Type}, +eq_rel (@eq (option A)) (option_rel eq). +Proof. +intros ?; split; intros [] [] EQ; subst; try inv EQ; cbn; auto. +Qed. + +#[global] Hint Unfold option_rel : core. \ No newline at end of file diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 3f88726..eff8f67 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -69,0 +70,2 @@ Arguments itreeF _ _ : clear implicits. +Create HintDb itree. + diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index a1c2431..9949acf 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -113 +113 @@ intros ? ? ?. red. -induction 1; auto. +induction 1; auto with itree. diff --git a/theories/Dijkstra/ITreeDijkstra.v b/theories/Dijkstra/ITreeDijkstra.v index 9529757..b25a16e 100644 --- a/theories/Dijkstra/ITreeDijkstra.v +++ b/theories/Dijkstra/ITreeDijkstra.v @@ -189 +189 @@ is_inf_cons (h : A) (t : stream A) : F t -> is_infF F (ConsF h t). -Hint Constructors is_infF : core. +Hint Constructors is_infF : itree. @@ -198 +198 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -217 +217 @@ s2 : stream A) : F s1 s2 -> bisimF F (ConsF h s1) (ConsF h s2). -Hint Constructors bisimF : core. +Hint Constructors bisimF : itree. @@ -226 +226 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -234 +234 @@ constructor; red. -- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto. +- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto with itree. @@ -237 +237 @@ pfold. red. -pinversion H0; subst; auto. +pinversion H0; subst; auto with itree. @@ -239 +239 @@ pinversion H0; subst; auto. -pinversion H0; pinversion H1; auto. +pinversion H0; pinversion H1; auto with itree. @@ -250 +250 @@ pfold. red. unfold app. pinversion H12. -- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto. +- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto with itree. @@ -282 +282 @@ stream' A -> Prop := | forall_nil : forall_streamF P F NilF | forall_cons (h : A -Hint Constructors forall_streamF : core. +Hint Constructors forall_streamF : itree. @@ -289 +289 @@ Proof. -red. intros. red. red in IN. destruct IN; auto. +red. intros. red. red in IN. destruct IN; auto with itree. @@ -301 +301 @@ F (observe_stream t) -> inf_manyF P F (ConsF h t) | cons_found (h : A) (t -Hint Constructors inf_manyF : core. +Hint Constructors inf_manyF : itree. @@ -308 +308 @@ Proof. -red. intros. red in IN. red. induction IN; auto. ``` Proof State: ``` 1 subgoal E : Type -> Type A : Type B : Type R : A -> B -> Prop a : A u : itree E A FIN : a ∈ u IHFIN : forall u0 : itree E B, eutt R u u0 -> exists b : B, b ∈ u0 /\ R a b u2 : itree E B i : itree' E A Heqi : i = TauF u ou2 : itree' E B Heqou2 : ou2 = observe u2 EQ : eqitF R true true id (upaco2 (eqit_ R true true id) bot2) i ou2 ============================ exists b : B, b ∈ u2 /\ R a b ``` Ongoing Proof History: ``` Proof. intros * EQ FIN; revert u EQ. induction FIN; intros u2 EQ. - punfold EQ. red in EQ; rewrite H in EQ; clear H t. remember (RetF a); genobs u2 ou. hinduction EQ before R; intros; try now discriminate. + + - inv Heqi; eauto. + inv Heqi; eauto with itree. + + - edestruct IHEQ as (b & IN & HR); eauto. + edestruct IHEQ as (b & IN & HR); eauto with itree. - punfold EQ; red in EQ; rewrite H in EQ; clear H t. remember (TauF u); genobs u2 ou2. ? hinduction EQ before R; intros; try discriminate; pclearbot; inv Heqi; eauto. ? edestruct IHFIN as (? & ? & ?); eauto. ? edestruct IHEQ as (? & ? & ?); eauto. ``` Next Tactic: ```
hinduction EQ before <LOOKUP>R : A -> B -> Prop</LOOKUP>; intros; try discriminate; pclearbot; inv Heqi. ```
{"final_commit":"8fcf6f5f81ec9289d56e777b3885e715b3328486","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-1158ff1cbb628aeaa69973bf098058744d458c36-8fcf6f5f81ec9289d56e777b3885e715b3328486-8_10_2-8_12_2-92.git.json","initial_commit":"1158ff1cbb628aeaa69973bf098058744d458c36","file":"theories\/Props\/Leaf.v"}
Ongoing Proof History: ``` Proof. intros until m0. intros NR H8 ? ?. destruct (eq_dec loc (nextblock m0, 0)). * subst loc. unfold initial_core. unfold inflate_initial_mem. rewrite !resource_at_make_rmap. unfold inflate_initial_mem'. rewrite !resource_at_make_rmap. rewrite nextblock_access_empty by (apply Pos2Nat.inj_ge; lia). split; intros _; [ |apply NO_identity]. unfold Genv.alloc_global in H. destruct (alloc m0 0 1) eqn:?. assert (H9: 0 <= 0 < 1) by (clear; lia). assert (H6 := alloc_result _ _ _ _ _ Heqp); subst b. assert (H1 := perm_drop_1 _ _ _ _ _ _ H 0 Cur H9). destruct (perm_mem_access _ _ _ _ H1) as [p [H4 H5]]. assert (H2 := perm_drop_2 _ _ _ _ _ _ H 0 Cur p H9). rewrite H5. unfold perm in *. unfold access_at in H5. simpl in H5. destruct ((mem_access m) !! (nextblock m0) 0 Cur); inv H5. spec H2; [constructor | ]. destruct p; try solve [inv H2]. unfold initial_core'. simpl. rewrite Genv.find_invert_symbol with (id:=i) by auto. destruct (list_in_map_inv _ _ _ H0) as [[i' fd] [H10 H11]]; simpl in H10, H11. subst i'. rewrite find_id_i with (fs:=fd); auto. destruct fd. apply PURE_identity. apply in_app. right; auto. * clear NR. unfold initial_core. unfold inflate_initial_mem. rewrite !resource_at_make_rmap. unfold inflate_initial_mem'. rewrite !resource_at_make_rmap. pose proof (Pos.ltb_spec (fst loc) (nextblock m0)). destruct ((fst loc <? nextblock m0)%positive); inv H1. destruct (alloc_global_old _ _ _ _ H loc H2) as [? ?]. rewrite H3. rewrite H1; split; intro; auto. destruct loc as [b ofs]. simpl fst in *; simpl snd in *. rewrite (nextblock_access_empty m0) by (apply Pos.le_ge; auto). split; intros _; [ |apply NO_identity]. replace (access_at m (b,ofs) Cur) with (@None permission). apply NO_identity. symmetry. unfold Genv.alloc_global in H. destruct (alloc m0 0 1) eqn:?. assert (H6 := alloc_result _ _ _ _ _ Heqp); subst b0. clear - n0 H2 Heqp H. assert (b <> nextblock m0 \/ ofs <> 0). { ``` Proof State: ``` 1 subgoal m : Memory.mem b : block ofs : Z m0, m1 : mem' H : drop_perm m1 (nextblock m0) 0 1 Nonempty = Some m Heqp : alloc m0 0 1 = (m1, nextblock m0) n0 : (b, ofs) <> (nextblock m0, 0) H2 : (nextblock m0 <= b)%positive ============================ b <> nextblock m0 \/ ofs <> 0 ``` Next Tactic: ```
destruct (<LOOKUP>eq_block : forall x y : positive, {x = y} + {x <> y}</LOOKUP> b (<LOOKUP>nextblock : mem' -> block</LOOKUP> m0)). ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/veric\/initialize.v"}
Proof State: ``` 1 subgoal p : positive x : nat H : p = Pos.of_succ_nat x ============================ (- Pos.to_nat p)%Z = Z.neg p ``` Ongoing Proof History: ``` Proof. intro p. elim (p_is_some_anti_convert p). intros x H. ``` Next Tactic: ```
rewrite H. ```
{"package":"coq-corn","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/CoRN\/logic\/CornBasics.v"}
Ongoing Proof History: ``` Proof. intros. punfold H. unfold eqit_ in H. cbn in *. remember (ITree.bind ma kab) as tl. assert (tl β‰… (ITree.bind ma kab)) by (subst; reflexivity). clear Heqtl. genobs tl tl'. remember (VisF e kxc) as tr. revert ma kab tl Heqtl' H0 kxc Heqtr. induction H. - intros. inv Heqtr. - intros. inv Heqtr. - intros. rewrite unfold_bind in H0. destruct (observe ma) eqn: Hobma; cbn in *; rewrite itree_eta in H0; rewrite <- Heqtl' in H0. + right. exists r. split. rewrite itree_eta. rewrite Hobma. reflexivity. rewrite <- H0. apply eqit_Vis. intros. destruct (REL u0); auto. inv H. + symmetry in H0. apply eqitree_inv_tau_vis in H0. contradiction. + setoid_rewrite itree_eta at 1. rewrite Hobma. clear Hobma Heqtl'. - red in H0. + inv Heqtr; auto_inj_pair2; subst. - apply eqit_inv_vis_weak in H0. + apply eq_itree_inv_vis in H0. ? destruct H0 as [<- [<- H0]]; cbn in H0. ? inv_Vis. ? left. ``` Proof State: ``` 1 subgoal A : Type B : Type C : Type E : Type -> Type X : Type RR : B -> C -> Prop b1, b2 : bool e : E X k1 : X -> itree E B kxc : X -> itree E C REL : forall v : X, id (upaco2 (fun (sim : itree E B -> itree E C -> Prop) (t1 : itree E B) (t2 : itree E C) => eqitF RR b1 b2 id sim (observe t1) (observe t2)) bot2) (k1 v) (kxc v) ma : itree E A kab : A -> itree E B tl : itree E B X0 : Type e1 : E X0 k : X0 -> itree E A H0 : exists k' : X0 -> itree E B, observe (Vis e k1) = VisF e1 k' /\ (forall u : X0, k' u β‰… x <- k u;; kab x) ============================ (exists kxa : X -> itree E A, eqit eq b1 b2 (Vis e1 k) (Vis e kxa) /\ (forall x : X, eqit RR b1 b2 (x <- kxa x;; kab x) (kxc x))) \/ (exists a : A, eqit eq b1 b2 ma (Ret a) /\ eqit RR b1 b2 (kab a) (Vis e kxc)) ``` Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index 32f56a6..b911a90 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6 +6,2 @@ Require Import -Classes.Morphisms Setoids.Setoid +Program Classes.Morphisms +Setoids.Setoid @@ -23,2 +24 @@ Eq.Eq -Eq.UpToTaus -Eq.Paco2. +Eq.UpToTaus. @@ -68 +68 @@ Proof. -ginit. pcofix CIH. intros. +ginit. gcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert f g a0. -ginit. pcofix CIH. intros. +revert A B C f g a0. +ginit. gcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. pcofix CIH. intros. +ginit. gcofix CIH. intros. @@ -277 +277 @@ revert a. -pcofix CIH'. intros. +gcofix CIH'. intros. @@ -337 +337,2 @@ etau. -specialize (CIHL xa). cbn in CIHL. +specialize (CIH xa). +cbn in CIH. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 42a3038..1c90dcb 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29,2 +29 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition -Eq.Paco2. +Core.ITreeDefinition. @@ -167,54 +165,0 @@ Hint Unfold id: core. -Lemma eqitF_VisF_inv_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} -t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 -b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 -/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 -= TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). -Proof. -refine (fun H => match H -in eqitF _ _ _ _ -_ _ t2 return match t2 -return Prop with | VisF e2 -k2 => _ | _ -=> True end with | -EqVis _ _ _ _ -_ _ _ _ _ -=> _ | _ => -_ end); try exact I. -- left; eauto. -- destruct i0; eauto. -Qed. - -Lemma eqitF_VisF_inv {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 -(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 --> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists -p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. -Proof. -refine (fun H => match H in -eqitF _ _ _ _ _ t1 -t2 return match t1, t2 return Prop -with | VisF e1 k1, VisF e2 -k2 => _ | _, _ => -True end with | EqVis _ -_ _ _ _ _ _ -_ _ => _ | _ -=> _ end); try exact I. -- exists eq_refl; cbn; eauto. -- destruct i; exact I. -Qed. - -Lemma eqitF_VisF_inv_strong {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 -vclo sim} X (e : E X) (k1 : X -> _) (k2 ``` Next Tactic: ```
destruct H0 as (? & ? & ?). ```
{"final_commit":"f4bacabbc5b1556a723e3cb4efb1cd614c156d8f","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-f3853150994e962978fa4cf0ed18dcb8c42e3262-f4bacabbc5b1556a723e3cb4efb1cd614c156d8f-8_11_2-8_10_2-13.git.json","initial_commit":"f3853150994e962978fa4cf0ed18dcb8c42e3262","file":"theories\/Eq\/Eq.v"}
Ongoing Proof History: ``` Proof. split; try (split; try apply _). intros ?? E1 ?? E2. now rewrite !le_correct, E1, E2. ``` Proof State: ``` 5 subgoals L : Type Ae : Equiv L Ameet : Meet L H : MeetSemiLattice L H0 : Le L le_correct : βˆ€ x y : L, x ≀ y ↔ x βŠ“ y = x ============================ PreOrder le subgoal 2 is: AntiSymmetric le subgoal 3 is: βˆ€ x y : L, x βŠ“ y ≀ x subgoal 4 is: βˆ€ x y : L, x βŠ“ y ≀ y subgoal 5 is: βˆ€ x y z : L, z ≀ x β†’ z ≀ y β†’ z ≀ x βŠ“ y ``` Next Tactic: ```
split. ```
{"package":"coq-math-classes","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/MathClasses\/orders\/lattices.v"}
Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index b911a90..32f56a6 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6,2 +6 @@ Require Import -Program Classes.Morphisms -Setoids.Setoid +Classes.Morphisms Setoids.Setoid @@ -24 +23,2 @@ Eq.Eq -Eq.UpToTaus. +Eq.UpToTaus +Eq.Paco2. @@ -68 +68 @@ Proof. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert A B C f g a0. -ginit. gcofix CIH. intros. +revert f g a0. +ginit. pcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -277 +277 @@ revert a. -gcofix CIH'. intros. +pcofix CIH'. intros. @@ -337,2 +337 @@ etau. -specialize (CIH xa). -cbn in CIH. +specialize (CIHL xa). cbn in CIHL. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 21ac7e0..4f26bd0 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29 +29,2 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition. +Core.ITreeDefinition +Eq.Paco2. @@ -165,0 +167,54 @@ Hint Unfold id: core. +Lemma eqitF_VisF_inv_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} +t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 +b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 +/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 += TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). +Proof. +refine (fun H => match H +in eqitF _ _ _ _ +_ _ t2 return match t2 +return Prop with | VisF e2 +k2 => _ | _ +=> True end with | +EqVis _ _ _ _ +_ _ _ _ _ +=> _ | _ => +_ end); try exact I. +- left; eauto. +- destruct i0; eauto. +Qed. + +Lemma eqitF_VisF_inv {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 +(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 +-> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists +p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. +Proof. +refine (fun H => match H in ``` Ongoing Proof History: ``` Proof. econstructor. pmonauto. intros. - dependent destruction PR. + destruct PR. punfold EQVl. punfold EQVr. unfold_eqit. hinduction REL before r; intros; clear t1' t2'. - remember (RetF r1) as x. hinduction EQVl before r; intros; subst; try inv Heqx; eauto. remember (RetF r3) as y. hinduction EQVr before r; intros; subst; try inv Heqy; eauto. - remember (TauF m1) as x. hinduction EQVl before r; intros; subst; try inv Heqx; try inv CHECK; eauto. remember (TauF m3) as y. hinduction EQVr before r; intros; subst; try inv Heqy; try inv CHECK; eauto. pclearbot. econstructor. gclo. - econstructor; cycle -1; eauto with paco. + econstructor; eauto with paco. - remember (VisF e k1) as x. - hinduction EQVl before r; intros; subst; try dependent destruction Heqx; try inv CHECK; eauto. + hinduction EQVl before r; intros; try discriminate Heqx; eauto; inv_Vis. ? remember (VisF e0 k3) as y. ? hinduction EQVr before r; intros; subst; try dependent destruction Heqy; try inv CHECK; eauto. ? econstructor. ``` Proof State: ``` 1 subgoal E : Type -> Type R1 : Type R2 : Type RR : R1 -> R2 -> Prop b1, b2 : bool vclo : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) -> rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) MON : monotone2 vclo CMP : forall (x0 : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2)) (x1 : itree E R1) (x2 : itree E R2), (eqitC b1 b2 ∘ vclo) x0 x1 x2 -> (vclo ∘ eqitC b1 b2) x0 x1 x2 r : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) t1 : itree E R1 RR1 : R1 -> R1 -> Prop u : Type e : E u k1, k2 : u -> itree E R1 REL : forall v : u, id (upaco2 (eqit_ RR1 b1 false id) bot2) (k1 v) (k2 v) k3 : u -> itree E R2 REL0 : forall v : u, vclo r (k2 v) (k3 v) t2 : itree E R2 RR2 : R2 -> R2 -> Prop EQVr : eqitF RR2 b2 false id (upaco2 (eqit_ RR2 b2 false id) bot2) (observe t2) (VisF e k3) LERR1 : forall (x x' : R1) (y : R2), RR1 x x' -> RR x' y -> RR x y LERR2 : forall (x : R1) (y y' : R2), RR2 y y' -> RR x y' -> RR x y ============================ eqitF RR b1 b2 vclo (gupaco2 (eqit_ RR b1 b2 vclo) (eqitC b1 b2) r) (VisF e k1) (observe t2) ``` Next Tactic: ```
remember (<LOOKUP>VisF : forall (E : Type -> Type) (R itree X : Type), E X -> (X -> itree) -> itreeF E R itree</LOOKUP> e k3) as y. ```
{"final_commit":"f3853150994e962978fa4cf0ed18dcb8c42e3262","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-1fcd2d39e27da8068431211b7952365e163782cc-f3853150994e962978fa4cf0ed18dcb8c42e3262-8_10_2-8_11_2-57.git.json","initial_commit":"1fcd2d39e27da8068431211b7952365e163782cc","file":"theories\/Eq\/Eq.v"}
Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 986e88b..769776a 100644 --- a/ListAux.v +++ b/ListAux.v @@ -131,6 +130,0 @@ Qed. -Theorem length_app: forall (l1 l2 : list A), length -(l1 ++ l2) = length l1 + length l2. -Proof. -apply app_length. -Qed. - @@ -278 +272 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app, length_map, H; auto. +intros a l H; rewrite app_length, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index e1936ca..7a13f04 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite length_app, length_take1; auto with arith. +rewrite app_length, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index 5083f1b..9b556eb 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm; auto. +apply div_lt; rewrite mult_comm... @@ -677,6 +677,2 @@ apply div_lt; rewrite mult_comm; auto. -repeat (rewrite (fun x => -mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp; auto. -rewrite (mod_small (div y w) h); auto. -rewrite (div_is_0 (div y w) h); auto. -rewrite plus_0_r. +repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... @@ -703,3 +699,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl; -auto with arith; clear n H1 H2 U1. -+ intros h1; case h1; simpl; auto. +intros U3 n; generalize h; elim n; simpl... +clear n H1 H2 U1. ++ intros h1; case h1; simpl... @@ -713,3 +709,2 @@ apply sym_equal; apply take_nth... -** apply le_trans with (1 := H1)... -apply le_trans with (2 := U3). -apply lt_le_weak; apply mod_lt... +** pose proof (mod_lt y w). +lia. @@ -726 +721 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H1. +case (le_or_lt (length l) w); intros H3. @@ -728,2 +723 @@ case (le_or_lt (length l) w); intros H1. -** rewrite length_take_small... -rewrite jump_too_far. +** rewrite length_take_small, jump_too_far... @@ -732,2 +726,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H1)... -*** apply le_trans with (1 := H1)... +apply le_trans with (1 := H3)... +*** apply le_trans with (1 := H3)... @@ -738,2 +732 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth; rewrite jump_add. -rewrite <- jump_nth... +rewrite jump_nth, jump_add, <- jump_nth... @@ -750 +743 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump; auto. +rewrite length_take_and_jump... @@ -767,2 +760 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. -rewrite le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... @@ -854,2 +846,2 @@ l2 l3 -> lit_test l1 l3 = lit_test l1 l2. -Proof. -intros l1 l2 l3; case l1; case l2; case l3; simpl; auto. +Proof with auto. +intros l1 l2 l3; case l1; case l2; case l3; simpl... @@ -859 +851 @@ case_eq (pos_test p2 p3); intros H1. -rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. +rewrite (pos_test_trans p1 p2 p3); rewrite H... @@ -861,2 +853,2 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1); auto. -rewrite H; auto. ``` Proof State: ``` 2 goals h, w : nat s : list nat H : length s = size * size H1 : empty s z1, x1, y1 : nat Hl : In (L (Pos x1 y1) z1) (gen_row x1 z1) n1 : nat V1 : In x1 indexes V2 : In z1 ref_list Hy : y1 < size ============================ valid_lit (L (Pos x1 y1) z1) s goal 2 is: In (n, c) (fold_right (fun (iz : nat * nat) (l0 : clauses) => clause_insert (gen_column (fst iz) (snd iz)) l0) (fold_right (fun (iz : nat * nat) (l0 : clauses) => clause_insert (gen_rect (fst iz) (snd iz)) l0) all_cell cross1) cross1) -> valid_lit l s ``` Ongoing Proof History: ``` - Proof. + Proof with auto with arith. unfold init_c; intros s H H1 n c Hn l Hl. case (fold_clause_insert1 _ (fun iz => gen_row (fst iz) (snd iz))) with (1 := Hn); clear Hn. intros ((x,z), (n1, (HH1, HH2))); simpl in HH2. injection HH2; intros; subst; clear HH2. case (cross1_correct (x, z)); intros tmp _; case (tmp HH1); clear tmp HH1. intros x1 (z1, (V1, (V2, V3))); injection V3; intros; subst; clear V3. case (gen_row_correct l x1 z1). intros tmp _; case (tmp Hl); clear tmp. intros y1 (Hl1, Hy); subst. ? repeat (split; auto); case (in_indexes x1); auto. ? intros Hn; case (fold_clause_insert1 _ (fun iz => gen_column (fst iz) (snd iz))) with (1 := Hn); clear Hn. ? intros ((y,z), (n1, (HH1, HH2))); simpl in HH2. ``` Next Tactic: ```
repeat (split; auto); case (<LOOKUP>in_indexes : forall i : nat, In i indexes <-> i < size</LOOKUP> x1)... ```
{"final_commit":"5337edcaf31b9f036a0a6651b2f733d3068b8f8f","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-427448011e3341d35aa5b9e00f675f6582fcd477-5337edcaf31b9f036a0a6651b2f733d3068b8f8f-8_15_2-8_15_2-36.git.json","initial_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","file":"Sudoku.v"}
Ongoing Proof History: ``` Proof. cut (forall (x1 x2 : Q2), msp_eq x1 x2 -> forall x3 x4 : Q2, msp_eq x3 x4 -> forall y, InFinEnumC y (CentersOfPixels bm x1 x3) -> InFinEnumC y (CentersOfPixels bm x2 x4)). { intro L. split. discriminate. split. intros q H1 abs. contradiction (abs q). split. exact (L x y H x0 y0 H0 q H1). reflexivity. intros q H1 abs. contradiction (abs q). split. symmetry in H, H0. exact (L y x H y0 x0 H0 q H1). reflexivity. } intros [x1l x1r] x2 Hx [y1l y1r] y2 Hy z Hz. destruct (@InStrengthen _ _ Hz) as [[ax ay] [Ha0 Ha1]]. destruct (InterpRaster_correct2 _ _ _ _ _ _ _ bmWf Ha0) as [[bx by'] [Hb0 [Hb1 Hb2]]]. rewrite Hb1 in Ha1. rewrite Hb2 in Ha1. unfold snd, fst in Ha1. destruct x2 as [x2l x2r]. destruct y2 as [y2l y2r]. assert (L0:msp_eq z ((x2l + (y2l - x2l) * (2 * Z.of_nat by' + 1 # 1) / (2 * Zpos n # 1)), (x2r + (y2r - x2r) * (2 * Z.of_nat bx + 1 # 1) / (2 * Zpos m # 1)))). transitivity ((x1l + (y1l - x1l) * (2 * Z.of_nat by' + 1 # 1) / (2 * Zpos n # 1)), (x1r + (y1r - x1r) * (2 * Z.of_nat bx + 1 # 1) / (2 * Zpos m # 1))). auto. clear - Hx Hy. destruct Hx as [Hx1 Hx2]. destruct Hy as [Hy1 Hy2]. split; unfold fst,snd in *. apply Qball_0 in Hx1. apply Qball_0 in Hy1. rewrite -> Hx1, Hy1. reflexivity. apply Qball_0 in Hx2. apply Qball_0 in Hy2. rewrite -> Hx2, Hy2. reflexivity. ``` Proof State: ``` 1 subgoal n, m : positive bm : raster n m bmWf : raster_well_formed bm x1l, x1r, x2l, x2r : Q_as_MetricSpace Hx : msp_eq (x1l, x1r) (x2l, x2r) y1l, y1r, y2l, y2r : Q_as_MetricSpace Hy : msp_eq (y1l, y1r) (y2l, y2r) z : Q2 Hz : InFinEnumC z (CentersOfPixels bm (x1l, x1r) (y1l, y1r)) ax, ay : Q_as_MetricSpace Ha0 : In (ax, ay) (CentersOfPixels bm (x1l, x1r) (y1l, y1r)) bx, by' : nat Ha1 : msp_eq z (x1l + (y1l - x1l) * (2 * Z.of_nat by' + 1 # 1) / (2 * Z.pos n # 1), x1r + (y1r - x1r) * (2 * Z.of_nat bx + 1 # 1) / (2 * Z.pos m # 1)) Hb0 : Is_true (RasterIndex bm (fst (bx, by')) (snd (bx, by'))) Hb1 : ax = x1l + (y1l - x1l) * (2 * Z.of_nat (snd (bx, by')) + 1 # 1) / (2 * Z.pos n # 1) Hb2 : ay = x1r + (y1r - x1r) * (2 * Z.of_nat (fst (bx, by')) + 1 # 1) / (2 * Z.pos m # 1) L0 : msp_eq z (x2l + (y2l - x2l) * (2 * Z.of_nat by' + 1 # 1) / (2 * Z.pos n # 1), x2r + (y2r - x2r) * (2 * Z.of_nat bx + 1 # 1) / (2 * Z.pos m # 1)) ============================ InFinEnumC z (CentersOfPixels bm (x2l, x2r) (y2l, y2r)) ``` Next Tactic: ```
unfold InFinEnumC. ```
{"package":"coq-corn","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/CoRN\/reals\/fast\/RasterQ.v"}
Ongoing Proof History: ``` Proof. repeat red. intros until T. ginit. gcofix CIH. intros. rewrite !unfold_interp. punfold H1. red in H1. induction H1; intros; subst; pclearbot; simpl. - gstep. constructor. eauto. - gstep. constructor. eauto with paco. - guclo eqit_clo_bind; econstructor; [apply H|]. intros; subst. gstep; constructor; eauto with paco. - - rewrite tau_eutt, unfold_interp. + rewrite tau_euttge, unfold_interp. auto. - ? rewrite tau_eutt, unfold_interp. ? auto. ? Qed. ``` Proof State: ``` 1 subgoal F : Type -> Type T : Type E : Type -> Type x, y : Handler E F H : eq2 x y r : itree F T -> itree F T -> Prop CIH : forall a1 a2 : itree E T, a1 β‰ˆ a2 -> r (interp x a1) (interp y a2) a1, a2 : itree E T ot1 : itree' E T t2 : itree E T CHECK : true H1 : eqitF eq true true id (upaco2 (eqit_ eq true true id) bot2) ot1 (observe t2) IHeqitF : gpaco2 (eqit_ eq true true id) (eqitC eq true true) bot2 r (_interp x ot1) (_interp y (observe t2)) ============================ gpaco2 (eqit_ eq true true id) (eqitC eq true true) bot2 r (_interp x ot1) (Tau (interp y t2)) ``` Commit Diff: ``` diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 57c2013..9b33167 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -242 +242 @@ Notation "t1 >>= k2" := (ITree.bind t1 k2) -(at level 50, left associativity) : itree_scope. +(at level 58, left associativity) : itree_scope. diff --git a/theories/Core/KTree.v b/theories/Core/KTree.v index 7740c5f..49acfb6 100644 --- a/theories/Core/KTree.v +++ b/theories/Core/KTree.v @@ -69,4 +69 @@ Local Notation ktree := (ktree E). -End Operations. - -Notation iter := (@iter _ (ktree _) sum _ _ _). -Notation loop := (@loop _ (ktree _) sum _ _ _ _ _ _ _ _ _). \ No newline at end of file +End Operations. \ No newline at end of file diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index 37d0ea8..1c27491 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -47 +47 @@ intros [a | b] _ []. -- rewrite bind_ret_l, tau_eutt. +- rewrite bind_ret_l, tau_euttge. @@ -129,4 +129,4 @@ Qed. -Definition eutt_iter_gen {F A B R S} : @Proper -((A -> itree F (A + B)) -> A --> itree F B) ((R ==> eutt (sum_rel -R S)) ==> R ==> (eutt S)) KTree.iter. +Definition eutt_iter_gen {F A B R S} : @Proper ((A +-> itree F (A + B)) -> A -> itree +F B) ((R ==> eutt (sum_rel R S)) ==> +R ==> (eutt S)) (iter (C := ktree F)). @@ -185,18 +185,18 @@ Qed. -Lemma iter_dinatural_ktree {E A B C} -(f : ktree E A (C -+ B)) (g : ktree E -C (A + B)) (a0 : -A) : iter (fun a => -cb <- f a ;; match -cb with | inl c => -Tau (g c) | inr b -=> Ret (inr b) end) a0 -β‰… cb <- f a0 ;; -match cb with | inl c0 -=> Tau (iter (fun c => -ab <- g c ;; match -ab with | inl a -=> Tau (f a) | -inr b => Ret (inr -b) end) c0) | inr -b => Ret b end. +Lemma iter_dinatural_ktree {E A B C} (f +: ktree E A (C + B)) +(g : ktree E C (A + +B)) (a0 : A) : iter +(C := ktree E) (fun a +=> cb <- f a ;; +match cb with | inl c +=> Tau (g c) | inr +b => Ret (inr b) end) +a0 β‰… cb <- f a0 +;; match cb with | inl +c0 => Tau (iter (C := +ktree E) (fun c => ab +<- g c ;; match ab +with | inl a => Tau +(f a) | inr b => +Ret (inr b) end) c0) | +inr b => Ret b end. @@ -230,6 +230,6 @@ cbn. -transitivity (iter (fun t => -x <- f t;; match -x with | inl a1 -=> Tau (g a1) | -inr b0 => Ret -(inr b0) end) a0). +transitivity (iter (C := ktree E) +(fun t => x <- f +t;; match x with | +inl a1 => Tau (g +a1) | inr b0 => +Ret (inr b0) end) a0). @@ -256,9 +256,9 @@ Qed. -Lemma iter_codiagonal_ktree {E A B} (f : -ktree E A (A + (A + -B))) (a0 : A) : iter (iter -f) a0 β‰… iter (fun a => -r <- f a ;; match r -with | inl a' => Ret (inl -a') | inr (inl a') => Ret -(inl a') | inr (inr b) -=> Ret (inr b) end) a0. +Lemma iter_codiagonal_ktree {E A B} (f : ktree +E A (A + (A + B))) (a0 +: A) : iter (iter f) a0 +β‰… iter (C := ktree _) (fun +a => r <- f a ;; +match r with | inl a' => +Ret (inl a') | inr (inl a') ``` Next Tactic: ```
rewrite <LOOKUP>tau_euttge : forall (E : Type -> Type) (R : Type) (t : itree E R), Tau t ≳ t</LOOKUP>, <LOOKUP>unfold_interp : forall (E F : Type -> Type) (R : Type) (f : forall T : Type, E T -> itree F T) (t : itree E R), interp f t β‰… _interp f (observe t)</LOOKUP>. ```
{"final_commit":"4e1301e834381725b933593fcf1f3b973986b630","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-66f56a8a4d02a262dbe75a676a4064f18ea7c3a0-4e1301e834381725b933593fcf1f3b973986b630-8_10_2-8_10_2-6.git.json","initial_commit":"66f56a8a4d02a262dbe75a676a4064f18ea7c3a0","file":"theories\/Interp\/InterpFacts.v"}
Proof State: ``` This subproof is complete, but there are some unfocused goals. Focus next goal with bullet -. 3 subgoals subgoal 1 is: x ^Z Z.pos_sub n m = x ^ Pos.to_nat n * / x ^ Pos.to_nat m subgoal 2 is: x ^Z Z.pos_sub m n = / x ^ Pos.to_nat n * x ^ Pos.to_nat m subgoal 3 is: / x ^ Pos.to_nat (n + m) = / x ^ Pos.to_nat n * / x ^ Pos.to_nat m ``` Ongoing Proof History: ``` Proof. intros x [|n|n] [|m|m]; simpl; intros; auto with real. - rewrite Pos2Nat.inj_add; auto with real. ``` Next Tactic: ```
- ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Reals\/Rfunctions.v"}
Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index 32f56a6..b911a90 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6 +6,2 @@ Require Import -Classes.Morphisms Setoids.Setoid +Program Classes.Morphisms +Setoids.Setoid @@ -23,2 +24 @@ Eq.Eq -Eq.UpToTaus -Eq.Paco2. +Eq.UpToTaus. @@ -68 +68 @@ Proof. -ginit. pcofix CIH. intros. +ginit. gcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert f g a0. -ginit. pcofix CIH. intros. +revert A B C f g a0. +ginit. gcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. pcofix CIH. intros. +ginit. gcofix CIH. intros. @@ -277 +277 @@ revert a. -pcofix CIH'. intros. +gcofix CIH'. intros. @@ -337 +337,2 @@ etau. -specialize (CIHL xa). cbn in CIHL. +specialize (CIH xa). +cbn in CIH. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 42a3038..21ac7e0 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29,2 +29 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition -Eq.Paco2. +Core.ITreeDefinition. @@ -167,54 +165,0 @@ Hint Unfold id: core. -Lemma eqitF_VisF_inv_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} -t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 -b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 -/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 -= TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). -Proof. -refine (fun H => match H -in eqitF _ _ _ _ -_ _ t2 return match t2 -return Prop with | VisF e2 -k2 => _ | _ -=> True end with | -EqVis _ _ _ _ -_ _ _ _ _ -=> _ | _ => -_ end); try exact I. -- left; eauto. -- destruct i0; eauto. -Qed. - -Lemma eqitF_VisF_inv {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 -(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 --> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists -p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. -Proof. -refine (fun H => match H in -eqitF _ _ _ _ _ t1 -t2 return match t1, t2 return Prop -with | VisF e1 k1, VisF e2 -k2 => _ | _, _ => -True end with | EqVis _ -_ _ _ _ _ _ -_ _ => _ | _ -=> _ end); try exact I. -- exists eq_refl; cbn; eauto. -- destruct i; exact I. -Qed. - -Lemma eqitF_VisF_inv_strong {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 -vclo sim} X (e : E X) (k1 : X -> _) (k2 -: X -> _) : eqitF RR b1 b2 vclo sim (VisF e -k1) (VisF e k2) -> forall x, vclo sim (k1 x) (k2 x). -Proof. -intros H. dependent destruction H. assumption. -Qed. - -Lemma eqitF_VisF {E R1 R2} {RR : R1 -> R2 -> Prop} {b1 b2 vclo sim} {X1 -X2} (p : X1 = X2) (e1 : E X1) (k1 : X1 -> _) (e2 : -E X2) (k2 : X2 -> _) : eqeq E p e1 e2 -> pweqeq (vclo sim) -p k1 k2 -> eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2). -Proof. -destruct p; intros <-; cbn; constructor; auto. -Qed. - @@ -270,2 +215,2 @@ split. -pstep. punfold H0. red in H0. red. -hinduction H0 before CIH; intros; eauto. +pstep. punfold H1. red in H1. red. +hinduction H1 before CIH; intros; eauto. @@ -278,2 +223,2 @@ red in REL. pclearbot. pinversion REL. -pstep. punfold H0. red in H0. red. -hinduction H0 before CIH; intros; eauto. +pstep. punfold H1. red in H1. red. +hinduction H1 before CIH; intros; eauto. @@ -381 +326 @@ econstructor. pmonauto. -intros. destruct PR. ``` Proof State: ``` 1 subgoal E : Type -> Type R2 : Type R1 : Type RR : R1 -> R2 -> Prop rH, rL, gL, gH, x : itree E R1 -> itree E R2 -> Prop H : forall (x0 : itree E R1) (x1 : itree E R2), x x0 x1 -> euttG rH rL (gL \2/ x) (gH \2/ x) x0 x1 r : itree E R1 -> itree E R2 -> Prop CIH0 : forall (x0 : itree E R1) (x1 : itree E R2), gL x0 x1 \/ transU RR rH x0 x1 \/ rL x0 x1 -> r x0 x1 CIH : forall (x2 : itree E R1) (x3 : itree E R2), x x2 x3 -> r x2 x3 x2 : itree E R1 x3 : itree E R2 PR : x x2 x3 ============================ gpaco2 (eqit_ RR true true (euttVC RR gH)) (transD RR) (transU RR rH \2/ rL) r x2 x3 ``` Ongoing Proof History: ``` Proof. intros. apply euttG_gen. econstructor. revert x0 x1 PR. - pcofix CIH. + gcofix CIH. + intros. ? intros t1 t2 PR. ? apply H in PR. ? destruct PR as [IN]. ``` Next Tactic: ```
apply H in PR. ```
{"final_commit":"f4bacabbc5b1556a723e3cb4efb1cd614c156d8f","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-f3853150994e962978fa4cf0ed18dcb8c42e3262-f4bacabbc5b1556a723e3cb4efb1cd614c156d8f-8_11_2-8_10_2-18.git.json","initial_commit":"f3853150994e962978fa4cf0ed18dcb8c42e3262","file":"theories\/Eq\/UpToTaus.v"}
Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index 32f56a6..b911a90 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6 +6,2 @@ Require Import -Classes.Morphisms Setoids.Setoid +Program Classes.Morphisms +Setoids.Setoid @@ -23,2 +24 @@ Eq.Eq -Eq.UpToTaus -Eq.Paco2. +Eq.UpToTaus. @@ -68 +68 @@ Proof. -ginit. pcofix CIH. intros. +ginit. gcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert f g a0. -ginit. pcofix CIH. intros. +revert A B C f g a0. +ginit. gcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. pcofix CIH. intros. +ginit. gcofix CIH. intros. @@ -277 +277 @@ revert a. -pcofix CIH'. intros. +gcofix CIH'. intros. @@ -337 +337,2 @@ etau. -specialize (CIHL xa). cbn in CIHL. +specialize (CIH xa). +cbn in CIH. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 42a3038..21ac7e0 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29,2 +29 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition -Eq.Paco2. +Core.ITreeDefinition. @@ -167,54 +165,0 @@ Hint Unfold id: core. -Lemma eqitF_VisF_inv_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} -t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 -b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 -/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 -= TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). -Proof. -refine (fun H => match H -in eqitF _ _ _ _ -_ _ t2 return match t2 -return Prop with | VisF e2 -k2 => _ | _ -=> True end with | -EqVis _ _ _ _ -_ _ _ _ _ -=> _ | _ => -_ end); try exact I. -- left; eauto. -- destruct i0; eauto. -Qed. - -Lemma eqitF_VisF_inv {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 -(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 --> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists -p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. -Proof. -refine (fun H => match H in -eqitF _ _ _ _ _ t1 -t2 return match t1, t2 return Prop -with | VisF e1 k1, VisF e2 -k2 => _ | _, _ => -True end with | EqVis _ -_ _ _ _ _ _ -_ _ => _ | _ -=> _ end); try exact I. -- exists eq_refl; cbn; eauto. -- destruct i; exact I. -Qed. - -Lemma eqitF_VisF_inv_strong {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 -vclo sim} X (e : E X) (k1 : X -> _) (k2 -: X -> _) : eqitF RR b1 b2 vclo sim (VisF e -k1) (VisF e k2) -> forall x, vclo sim (k1 x) (k2 x). -Proof. -intros H. dependent destruction H. assumption. -Qed. - -Lemma eqitF_VisF {E R1 R2} {RR : R1 -> R2 -> Prop} {b1 b2 vclo sim} {X1 -X2} (p : X1 = X2) (e1 : E X1) (k1 : X1 -> _) (e2 : -E X2) (k2 : X2 -> _) : eqeq E p e1 e2 -> pweqeq (vclo sim) -p k1 k2 -> eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2). -Proof. -destruct p; intros <-; cbn; constructor; auto. -Qed. - @@ -270,2 +215,2 @@ split. -pstep. punfold H0. red in H0. red. -hinduction H0 before CIH; intros; eauto. +pstep. punfold H1. red in H1. red. +hinduction H1 before CIH; intros; eauto. @@ -278,2 +223,2 @@ red in REL. pclearbot. pinversion REL. -pstep. punfold H0. red in H0. red. -hinduction H0 before CIH; intros; eauto. +pstep. punfold H1. red in H1. red. ``` Ongoing Proof History: ``` Proof. intros. apply euttG_gen. econstructor. revert x0 x1 PR. - pcofix CIH. + gcofix CIH. - intros t1 t2 PR. + intros. apply H in PR. ? destruct PR as [IN]. ? revert t1 t2 IN. ? pcofix CIH. ``` Proof State: ``` 1 subgoal E : Type -> Type R2 : Type R1 : Type RR : R1 -> R2 -> Prop rH, rL, gL, gH, x : itree E R1 -> itree E R2 -> Prop H : forall (x0 : itree E R1) (x1 : itree E R2), x x0 x1 -> euttG rH rL (gL \2/ x) (gH \2/ x) x0 x1 r : itree E R1 -> itree E R2 -> Prop CIH0 : forall (x0 : itree E R1) (x1 : itree E R2), gL x0 x1 \/ transU RR rH x0 x1 \/ rL x0 x1 -> r x0 x1 CIH : forall (x2 : itree E R1) (x3 : itree E R2), x x2 x3 -> r x2 x3 x2 : itree E R1 x3 : itree E R2 PR : euttG rH rL (gL \2/ x) (gH \2/ x) x2 x3 ============================ gpaco2 (eqit_ RR true true (euttVC RR gH)) (transD RR) (transU RR rH \2/ rL) r x2 x3 ``` Next Tactic: ```
destruct PR. ```
{"final_commit":"f4bacabbc5b1556a723e3cb4efb1cd614c156d8f","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-f3853150994e962978fa4cf0ed18dcb8c42e3262-f4bacabbc5b1556a723e3cb4efb1cd614c156d8f-8_11_2-8_10_2-18.git.json","initial_commit":"f3853150994e962978fa4cf0ed18dcb8c42e3262","file":"theories\/Eq\/UpToTaus.v"}
Ongoing Proof History: ``` intros l1; elim l1; simpl; auto. intros l2 H H0; exists l2; simpl; auto. intros a l H l2 H0 H1; auto. case (in_permutation_ex _ a l2); auto with datatypes. intros l3 Hl3. case (H l3); auto. apply ulist_inv with ( 1 := H0 ); auto. intros b Hb. assert (H2: In b (a :: l3)). - apply permutation_in with ( 1 := permutation_sym _ _ _ Hl3 ); auto with datatypes. + apply Permutation_in with ( 1 := Permutation_sym Hl3 ); auto with datatypes. simpl in H2 |-; case H2; intros H3; simpl; auto. inversion_clear H0 as [|c lc Hk1]; auto. case Hk1; subst a; auto. intros l4 H4; exists l4. ? apply permutation_trans with (a :: l3); auto. ? apply permutation_sym; auto. ? Qed. ``` Proof State: ``` 1 goal A : Set eqA_dec : forall a b : A, {a = b} + {a <> b} l1 : list A a : A l : list A H : forall l2 : list A, ulist l -> incl l l2 -> exists l3 : list A, Permutation l2 (l ++ l3) l2 : list A H0 : ulist (a :: l) H1 : incl (a :: l) l2 l3 : list A Hl3 : Permutation (a :: l3) l2 l4 : list A H4 : Permutation l3 (l ++ l4) ============================ Permutation l2 (a :: l ++ l4) ``` Commit Diff: ``` diff --git a/Permutation.v b/Permutation.v index ecfa699..af80c37 100644 --- a/Permutation.v +++ b/Permutation.v @@ -33,2 +32,0 @@ Variable A : Set. -Definition permutation (l1 l2 : list A) := @Permutation A l1 l2. - @@ -37,66 +34,0 @@ Hint Constructors Permutation : core. -Definition permutation_trans := perm_trans. - - - - - -Theorem permutation_refl : forall l : list A, permutation l l. -Proof. -simple induction l. -apply perm_nil. -intros a l1 H. -apply perm_skip with (1 := H). -Qed. -Hint Resolve permutation_refl : core. - - - - - -Theorem permutation_sym : forall l m : list -A, permutation l m -> permutation m l. -Proof. -apply Permutation_sym. -Qed. - - - - - -Theorem permutation_length : forall l m : list A, -permutation l m -> length l = length m. -Proof. -apply Permutation_length. -Qed. - - - - - -Theorem perm_nil_inv : forall l : list A, permutation l nil -> l = nil. -Proof. -intros l H. -apply Permutation_nil. -apply Permutation_sym; assumption. -Qed. - - - - -Theorem permutation_one_inv : forall (a : A) (l : list A), -permutation (a :: nil) l -> l = a :: nil. -Proof. -apply Permutation_length_1_inv. -Qed. - - - - - -Theorem permutation_in : forall (a : A) (l m : list A), -permutation l m -> In a l -> In a m. -Proof. -intros a l m H H0. -eapply Permutation_in; eassumption. -Qed. - @@ -107,26 +39,3 @@ Qed. -Theorem permutation_app_comp : forall l1 l2 l3 l4, -permutation l1 l2 -> permutation l3 l4 -> -permutation (l1 ++ l3) (l2 ++ l4). -Proof. -intros l1 l2 l3 l4 H H0. -apply Permutation_app; auto. -Qed. -Hint Resolve permutation_app_comp : core. - - - - - -Theorem permutation_app_swap : forall l1 l2, permutation -(l1 ++ l2) (l2 ++ l1). -Proof. -apply Permutation_app_comm. -Qed. - - - - - -Theorem perm_transposition : forall a b l1 l2 l3, permutation -(l1 ++ a :: l2 ++ b :: l3) -(l1 ++ b :: l2 ++ a :: l3). +Theorem perm_transposition : forall a b (l1 l2 l3 : list +A), Permutation (l1 ++ a :: l2 ++ b :: +l3) (l1 ++ b :: l2 ++ a :: l3). @@ -135,2 +44,2 @@ intros a b l1 l2 l3. -apply permutation_app_comp; auto. -change (permutation ((a :: nil) ++ l2 ++ (b +apply Permutation_app; auto. +change (Permutation ((a :: nil) ++ l2 ++ (b @@ -140 +49 @@ repeat rewrite <- app_ass. -apply permutation_app_comp; auto. +apply Permutation_app; auto. @@ -142 +51 @@ apply perm_trans with ((b :: nil) ++ (a :: nil) ++ l2); auto. -apply permutation_app_swap; auto. +apply Permutation_app_comm; auto. @@ -144,2 +53,2 @@ repeat rewrite app_ass. -apply permutation_app_comp; auto. -apply permutation_app_swap; auto. +apply Permutation_app; auto. +apply Permutation_app_comm; auto. @@ -153 +62 @@ Theorem in_permutation_ex : forall a l, In a l -> -exists l1 : list A, permutation (a :: l1) l. +exists l1 : list A, Permutation (a :: l1) l. @@ -167,13 +75,0 @@ Qed. -Theorem permutation_inv : forall (a : A) (l1 -l2 : list A), permutation (a :: l1) -(a :: l2) -> permutation l1 l2. -Proof. -intros a l1 l2 H. -eapply Permutation_cons_inv. -eassumption. -Qed. - - - - - @@ -195 +91 @@ l2 : list A), In (a, l1) (split_one -l2) -> permutation (a :: l1) l2. +l2) -> Permutation (a :: l1) l2. @@ -256 +152 @@ Lemma all_permutations_aux_permutation : forall (n : nat) (l1 l2 -l1 (all_permutations_aux l2 n) -> permutation l1 l2. +l1 (all_permutations_aux l2 n) -> Permutation l1 l2. @@ -276,2 +172,2 @@ change (length l2 = length (a1 :: l3)) in |- *. -apply permutation_length; auto. ``` Next Tactic: ```
apply <LOOKUP>perm_trans : forall [A : Type] [l l' l'' : list A], Permutation l l' -> Permutation l' l'' -> Permutation l l''</LOOKUP> with (a :: l3); auto. ```
{"final_commit":"5a29a619b6acc23531ef31506b909056de730bf6","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-b5543771d6bdeab13ec58ac6c8d281815d96ed62-5a29a619b6acc23531ef31506b909056de730bf6-8_15_2-8_15_2-7.git.json","initial_commit":"b5543771d6bdeab13ec58ac6c8d281815d96ed62","file":"UList.v"}
Commit Diff: ``` diff --git a/theories/Aux.v b/theories/Aux.v index d240627..c7e8186 100644 --- a/theories/Aux.v +++ b/theories/Aux.v @@ -27 +26,0 @@ - @@ -30,0 +30 @@ Require Export List. +Export ListNotations. @@ -85,11 +84,0 @@ Hint Resolve le_minus: arith. -Section EqBool. - -Definition eq_bool_dec : forall a b : bool, {a = b} + {a <> b}. -Proof. -intros a b; case a; case b; simpl in |- *; auto. -right; red in |- *; intros; discriminate. -Defined. - -End EqBool. - - @@ -231 +220 @@ intros a1 l H [H1| H1]; auto. -exists (nil (A:=A)); exists l; simpl in |- *; auto. +exists []; exists l; simpl in |- *; auto. @@ -270,4 +259,4 @@ Theorem app_inv_app : forall l1 l2 l3 l4 a, -l1 ++ l2 = l3 ++ a :: l4 --> (exists l5 : list A, l1 = l3 -++ a :: l5) \/ (exists l5 : -_, l2 = l5 ++ a :: l4). +l1 ++ l2 = l3 ++ a :: +l4 -> (exists l5 : list A, l1 += l3 ++ a :: l5) \/ (exists +l5, l2 = l5 ++ a :: l4). @@ -288,2 +277,2 @@ Theorem app_inv_app2 : forall l1 l2 l3 l4 a b, l1 -(exists l5 : list A, l1 = l3 ++ a :: -b :: l5) \/ (exists l5 : _, l2 = l5 +(exists l5 : list A, l1 = l3 ++ a +:: b :: l5) \/ (exists l5, l2 = l5 @@ -291 +280 @@ b :: l5) \/ (exists l5 : _, l2 = l5 -++ a :: nil /\ l2 = b :: l4. +++ a :: [] /\ l2 = b :: l4. @@ -310,7 +299,7 @@ Qed. -Theorem same_length_ex : forall (a : A) l1 -l2 l3, length (l1 ++ a :: l2) -= length l3 -> exists l4 : -_, (exists l5 : _, (exists b -: B, length l1 = length l4 -/\ length l2 = length l5 /\ -l3 = l4 ++ b :: l5)). +Theorem same_length_ex : forall (a : A) +l1 l2 l3, length (l1 ++ a +:: l2) = length l3 -> exists +l4, (exists l5, (exists b : B, +length l1 = length l4 /\ length +l2 = length l5 /\ l3 += l4 ++ b :: l5)). @@ -320 +309 @@ intros l2 l3; case l3; simpl in |- *; try (intros; discriminate). -intros b l H; exists (nil (A:=B)); exists l; exists b; repeat (split; auto). +intros b l H; exists []; exists l; exists b; repeat (split; auto). @@ -341,3 +330,3 @@ Qed. -Theorem in_map_fst_inv : forall a (l : list (B -* C)), In a (map (fst (B:=_)) l) -> -exists c : _, In (a, c) l. +Theorem in_map_fst_inv : forall a (l : list +(B * C)), In a (map (fst (B:=_)) +l) -> exists c, In (a, c) l. ``` Ongoing Proof History: ``` apply trans_equal with (1 := E1); rewrite HH; auto. intros (HH1, HH2). - cut (ln0 = nil /\ ln4 = nil /\ a = S n); [ intros (HH3, (HH4, HH5)) | generalize HH1; rewrite H7; case ln0; simpl in |- *; [ case ln4; try (intros; discriminate); (intros HH6; injection HH6; auto) | intros n0 l; case l; simpl in |- *; intros; discriminate ] ]. + cut (ln0 = [] /\ ln4 = [] /\ a = S n); [ intros (HH3, (HH4, HH5)) | generalize HH1; rewrite H7; case ln0; simpl in |- *; [ case ln4; try (intros; discriminate); (intros HH6; injection HH6; auto) | intros n0 l; case l; simpl in |- *; intros; discriminate ] ]. generalize E1 H1; case ln2; simpl in |- *; auto; clear E1 H1. intros E1 H1; case height_pred_not_nil2 with (1 := H1); auto. generalize (height_pred_length _ _ _ _ H1); case l2; simpl in |- *; auto; intros; discriminate. intros n0 ln5 E1 H1; case height_pred_larger_strict with (n1 := n0) (1 := H1); simpl in |- *; auto with datatypes. intros HH6; Contradict HH6; apply le_not_lt; rewrite <- HH5; apply H5; rewrite E1; auto with datatypes. ? intros (H8, H9); left; exists (nil (A:=nat)); injection H8. ? intros HH7 HH8; rewrite HH5; rewrite <- HH8; rewrite <- HH7; rewrite E1; rewrite HH4; auto. ? intros (ln4, H7); auto. ``` Proof State: ``` 2 subgoals A : Type f : A -> nat eqA_dec : forall a b : A, {a = b} + {a <> b} n : nat ln1, ln2 : list nat t1, t2 : btree A l1, l2 : list (btree A) H : height_pred (S n) ln1 l1 t1 ln0, ln3 : list nat a : nat H3 : ln1 ++ ln2 = ln0 ++ a :: ln3 H4 : forall n1 : nat, In n1 ln0 -> n1 < a H5 : forall n1 : nat, In n1 ln3 -> n1 <= a ln4 : list nat H7 : ln1 = ln0 ++ a :: ln4 HH1 : ln1 = [S n] HH2 : l1 = [t1] HH3 : ln0 = [] HH4 : ln4 = [] HH5 : a = S n n0 : nat ln5 : list nat E1 : ln3 = ln4 ++ n0 :: ln5 H1 : height_pred (S n) (n0 :: ln5) l2 t2 ============================ n0 :: ln5 = [S n] /\ l2 = [t2] -> (exists ln6 : list nat, ln3 = a :: ln6) \/ ln1 ++ n0 :: ln5 = [n] /\ l1 ++ l2 = [node t1 t2] subgoal 2 is: (exists l5 : list nat, ln2 = l5 ++ a :: ln3) -> (exists ln4 : list nat, ln3 = a :: ln4) \/ ln1 ++ ln2 = [n] /\ l1 ++ l2 = [node t1 t2] ``` Next Tactic: ```
intros (H8, H9); left; exists []; injection H8. ```
{"final_commit":"6e3f37b2113e34f74c6b5a6ff2c7346a9cdf9e4e","project":"huffman","repair_file":"\/data\/coq-pearls\/repairs\/huffman\/repair-huffman-773c1feea03edc5e845ecafc7c9752fa403e7faf-6e3f37b2113e34f74c6b5a6ff2c7346a9cdf9e4e-8_11_2-8_11_2-27.git.json","initial_commit":"773c1feea03edc5e845ecafc7c9752fa403e7faf","file":"theories\/HeightPred.v"}
Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index b911a90..32f56a6 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6,2 +6 @@ Require Import -Program Classes.Morphisms -Setoids.Setoid +Classes.Morphisms Setoids.Setoid @@ -24 +23,2 @@ Eq.Eq -Eq.UpToTaus. +Eq.UpToTaus +Eq.Paco2. @@ -68 +68 @@ Proof. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert A B C f g a0. -ginit. gcofix CIH. intros. +revert f g a0. +ginit. pcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -277 +277 @@ revert a. -gcofix CIH'. intros. +pcofix CIH'. intros. @@ -337,2 +337 @@ etau. -specialize (CIH xa). -cbn in CIH. +specialize (CIHL xa). cbn in CIHL. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 21ac7e0..7f12983 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29 +29,2 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition. +Core.ITreeDefinition +Eq.Paco2. @@ -165,0 +167,54 @@ Hint Unfold id: core. +Lemma eqitF_inv_VisF_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} +t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 +b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 +/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 += TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). +Proof. +refine (fun H => match H +in eqitF _ _ _ _ +_ _ t2 return match t2 +return Prop with | VisF e2 +k2 => _ | _ +=> True end with | +EqVis _ _ _ _ +_ _ _ _ _ +=> _ | _ => +_ end); try exact I. +- left; eauto. +- destruct i0; eauto. +Qed. + +Lemma eqitF_inv_VisF_weak {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 +(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 +-> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists +p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. +Proof. +refine (fun H => match H in +eqitF _ _ _ _ _ t1 +t2 return match t1, t2 return Prop +with | VisF e1 k1, VisF e2 ``` Proof State: ``` 1 subgoal E : Type -> Type X : Type R1 : Type R2 : Type RR : R1 -> R2 -> Prop b1, b2 : bool t1 : itree E R1 CHECK : b1 b : R2 ma : itree E X IHeqitF : t1 β‰… ma;; t1 -> forall b0 : R2, RetF b = RetF b0 -> exists a : X, eqit eq b1 b2 ma (Ret a) /\ eqit RR b1 b2 ((fun _ : X => t1) a) (Ret b) H : eqitF RR b1 b2 id (upaco2 (fun (sim : itree E R1 -> itree E R2 -> Prop) (t1 : itree E R1) (t2 : itree E R2) => eqitF RR b1 b2 id sim (observe t1) (observe t2)) bot2) (observe t1) (RetF b) kb : X -> itree E R1 r : X Hobma : observe ma = RetF r H0 : Tau t1 β‰… kb r a : X H1 : eqit eq b1 b2 (Ret r) (Ret a) H2 : eqit RR b1 b2 t1 (Ret b) ============================ eqit RR b1 b2 (kb a) (Ret b) ``` Ongoing Proof History: ``` revert ma kb tl Heqtl' H0 b Heqtr. induction H. - intros; subst. inv Heqtr. destruct (observe tl) eqn: Hobtl; inv Heqtl'. rewrite unfold_bind in H0. destruct (observe ma) eqn: Hobma. * exists r0. split. rewrite <- Hobma. tau_steps. reflexivity. cbn in *. rewrite <- H0. rewrite itree_eta, Hobtl. apply eqit_Ret; auto. * cbn in H0. rewrite itree_eta in H0. rewrite Hobtl in H0. - apply eqitree_inv_ret_tau in H0. + apply eqit_inv in H0. contradiction. * cbn in H0. rewrite itree_eta, Hobtl in H0. - apply eqitree_inv_ret_vis in H0. + apply eqit_inv in H0. contradiction. - intros. inversion Heqtr. - intros. inversion Heqtr. - intros. subst. apply simpobs in Heqtl'. rewrite Heqtl' in H0; clear tl Heqtl'. rewrite unfold_bind in H0. destruct (observe ma) eqn: Hobma. + cbn in *. specialize (IHeqitF ma (fun _ => t1) t1 eq_refl). edestruct IHeqitF as (a & ? & ?);[| reflexivity |]. * setoid_rewrite itree_eta at 4. rewrite Hobma, bind_ret_l. reflexivity. * exists a; split; auto. rewrite itree_eta, Hobma in H1. ? apply eqit_inv_ret in H1; subst. ? rewrite <- H0. ? destruct b1; [| inv CHECK]. ``` Next Tactic: ```
apply <LOOKUP>eqit_inv_Ret : forall (E : Type -> Type) (R1 R2 : Type) (RR : R1 -> R2 -> Prop) (b1 b2 : bool) (r1 : R1) (r2 : R2), eqit RR b1 b2 (Ret r1) (Ret r2) -> RR r1 r2</LOOKUP> in H1; subst. ```
{"final_commit":"7f00358aeb230f7970571fddaa8b256375910c62","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-672193e2507cf3326b834f5fa47b7518af829b4b-7f00358aeb230f7970571fddaa8b256375910c62-8_10_2-8_10_2-15.git.json","initial_commit":"672193e2507cf3326b834f5fa47b7518af829b4b","file":"theories\/Eq\/Eq.v"}
Proof State: ``` 2 goals h, w : nat Eq1 : ulist ref_list Eq2 : length ref_list = size s : list nat H : length s = size * size H1 : sat init_c s HH0 : forall i : nat, i < size -> incl ref_list (row i s) HH1 : forall i : nat, i < size -> incl ref_list (column i s) HH2 : forall i : nat, i < size -> incl ref_list (rect i s) HH3 : forall p : pos, valid_pos p -> In (get p s) ref_list ============================ length s = size * size /\ (forall i : nat, i < size -> Permutation (row i s) ref_list) /\ (forall i : nat, i < size -> Permutation (column i s) ref_list) /\ (forall i : nat, i < size -> Permutation (rect i s) ref_list) goal 2 is: sat init_c s ``` Ongoing Proof History: ``` - Proof with auto. + Proof. generalize (ref_list_ulist); intros Eq1. generalize (ref_list_length); intros Eq2. intros s H; case (init_c_sat s); auto; intros HH0 HH1; split; intros H1. case HH0; clear HH0 HH1; auto; intros HH0 (HH1, (HH2, HH3)); unfold sudoku. ? split... ? repeat split; intros i U; apply Permutation_sym; apply ulist_eq_permutation... ? rewrite length_row... ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 769776a..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -130,0 +131,6 @@ Qed. +Theorem length_app: forall (l1 l2 : list A), length +(l1 ++ l2) = length l1 + length l2. +Proof. +apply app_length. +Qed. + @@ -272 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite app_length, length_map, H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index 7a13f04..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite app_length, length_take1; auto with arith. +rewrite length_app, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index f9e372e..3a01485 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm... +apply div_lt; rewrite mult_comm; auto. @@ -677,2 +677,6 @@ apply div_lt; rewrite mult_comm... -repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... +repeat (rewrite (fun x => +mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp; auto. +rewrite (mod_small (div y w) h); auto. +rewrite (div_is_0 (div y w) h); auto. +rewrite plus_0_r. @@ -699,3 +703,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl... -clear n H1 H2 U1. -+ intros h1; case h1; simpl... +intros U3 n; generalize h; elim n; simpl; +auto with arith; clear n H1 H2 U1. ++ intros h1; case h1; simpl; auto. @@ -709,2 +713,3 @@ apply sym_equal; apply take_nth... -** pose proof (mod_lt y w). -lia. +** apply le_trans with (1 := H1)... +apply le_trans with (2 := U3). +apply lt_le_weak; apply mod_lt... @@ -721 +726 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H3. +case (le_or_lt (length l) w); intros H1. @@ -723 +728,2 @@ case (le_or_lt (length l) w); intros H3. -** rewrite length_take_small, jump_too_far... +** rewrite length_take_small... +rewrite jump_too_far. @@ -726,2 +732,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H3)... -*** apply le_trans with (1 := H3)... +apply le_trans with (1 := H1)... +*** apply le_trans with (1 := H1)... @@ -732 +738,2 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth, jump_add, <- jump_nth... +rewrite jump_nth; rewrite jump_add. +rewrite <- jump_nth... @@ -743 +750 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump... +rewrite length_take_and_jump; auto. @@ -760 +767,2 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. +rewrite le_plus_minus_r... @@ -846,2 +854,2 @@ l2 l3 -> lit_test l1 l3 = lit_test l1 l2. -Proof with auto. -intros l1 l2 l3; case l1; case l2; case l3; simpl... +Proof. +intros l1 l2 l3; case l1; case l2; case l3; simpl; auto. @@ -851 +859 @@ case_eq (pos_test p2 p3); intros H1. -rewrite (pos_test_trans p1 p2 p3); rewrite H... +rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. @@ -853,2 +861,2 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1)... -rewrite H... +apply pos_test_exact with (1 := H1); auto. +rewrite H; auto. @@ -856,4 +864,4 @@ intros; discriminate. -replace p1 with p2... -case_eq (pos_test p2 p3); intros H1... -intros; apply test_trans... -apply sym_equal; apply pos_test_exact with (1 := H)... +replace p1 with p2; auto. +case_eq (pos_test p2 p3); intros H1; auto. +intros; apply test_trans; auto. +apply sym_equal; apply pos_test_exact with (1 := H); auto. @@ -863,3 +871,3 @@ assert (p2 = p3); subst. ``` Next Tactic: ```
split; auto. ```
{"final_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-dc8d4294a32dbb6e0a642dc553b64495f27e6d60-427448011e3341d35aa5b9e00f675f6582fcd477-8_15_2-8_15_2-72.git.json","initial_commit":"dc8d4294a32dbb6e0a642dc553b64495f27e6d60","file":"Sudoku.v"}
Commit Diff: ``` diff --git a/src/DblibTactics.v b/src/DblibTactics.v index 2a08b3e..2aa54e9 100644 --- a/src/DblibTactics.v +++ b/src/DblibTactics.v @@ -2,3 +2 @@ Set Implicit Arguments. -Require Import Compare_dec. -Require Import Peano_dec. -Require Import Lia. +Require Export Omega. @@ -12,7 +10,8 @@ Hint Extern 1 => f_equal : f_equal. -Hint Extern 1 (_ = _ :> nat) => reflexivity : lia. -Hint Extern 3 (_ = _ :> nat) => lia : lia. -Hint Extern 3 (_ <> _ :> nat) => lia : lia. -Hint Extern 3 (_ < _) => lia : lia. -Hint Extern 3 (_ > _) => lia : lia. -Hint Extern 3 (_ <= _) => lia : lia. -Hint Extern 3 (_ >= _) => lia : lia. +Hint Extern 1 (_ = _ :> nat) => reflexivity : omega. + +Hint Extern 1 (_ = _ :> nat) => omega : omega. +Hint Extern 1 (_ <> _ :> nat) => omega : omega. +Hint Extern 1 (_ < _) => omega : omega. +Hint Extern 1 (_ > _) => omega : omega. +Hint Extern 1 (_ <= _) => omega : omega. +Hint Extern 1 (_ >= _) => omega : omega. @@ -43 +42 @@ Ltac dblib_by_cases := repeat dblib_inspect_cases; try solve -[ intros; exfalso; lia ]; intros. \ No newline at end of file +[ intros; exfalso; omega ]; intros. \ No newline at end of file diff --git a/src/DeBruijn.v b/src/DeBruijn.v index 45bfa51..7a58a05 100644 --- a/src/DeBruijn.v +++ b/src/DeBruijn.v @@ -3,2 +2,0 @@ Generalizable All Variables. -Require Import Arith. -Require Import Lia. @@ -286,3 +284,3 @@ intros. -replace k with (ws + (k - ws)) by lia. -erewrite <- lift_lift by lia. -replace (ws + (k - ws) - ws) with (k - ws) by lia. +replace k with (ws + (k - ws)) by omega. +erewrite <- lift_lift by omega. +replace (ws + (k - ws) - ws) with (k - ws) by omega. @@ -456,2 +454,2 @@ eapply traverse_relative with (p := 0). -intros m ?. replace (m + 0) with m by lia. eauto. -lia. +intros m ?. replace (m + 0) with m by omega. eauto. +omega. @@ -483,4 +481,3 @@ Qed. -Ltac just_do_it := unfold -subst, Subst_idx, subst_idx, lift, -Lift_idx, var, Var_idx; intros; -dblib_by_cases; eauto with lia. +Ltac just_do_it := unfold subst, Subst_idx, subst_idx, +lift, Lift_idx, var, Var_idx; intros; solve [ +dblib_by_cases; eauto with f_equal omega ]. @@ -512,2 +509,2 @@ Ltac lift_idx := first [ rewrite @lift_idx_recent by -solve [ lia | eauto with lift_idx_hints -] | rewrite @lift_idx_old by lia ]. +solve [ omega | eauto with lift_idx_hints +] | rewrite @lift_idx_old by omega ]. @@ -518,2 +515,2 @@ Ltac lift_idx_in h := first [ rewrite @lift_idx_recent in -h by solve [ lia | eauto with lift_idx_hints -] | rewrite @lift_idx_old in h by lia ]. +h by solve [ omega | eauto with lift_idx_hints +] | rewrite @lift_idx_old in h by omega ]. @@ -522,2 +519,2 @@ Ltac lift_idx_all := first [ rewrite @lift_idx_recent in * -by solve [ lia | eauto with lift_idx_hints ] -| rewrite @lift_idx_old in * by lia ]. +by solve [ omega | eauto with lift_idx_hints ] +| rewrite @lift_idx_old in * by omega ]. @@ -587,2 +584,2 @@ Ltac subst_idx := first -lia | rewrite -@subst_idx_miss_1 by lia +omega | rewrite +@subst_idx_miss_1 by omega @@ -590 +587 @@ lia | rewrite -by lia ]. +by omega ]. @@ -594,2 +591,2 @@ Ltac subst_idx_in h := first -by lia | rewrite @subst_idx_miss_1 -in h by lia +by omega | rewrite @subst_idx_miss_1 +in h by omega @@ -597 +594 @@ in h by lia -h by lia ]. +h by omega ]. @@ -601,2 +598,2 @@ rewrite @subst_idx_identity in * by -lia | rewrite @subst_idx_miss_1 -in * by lia +omega | rewrite @subst_idx_miss_1 +in * by omega @@ -604 +601 @@ in * by lia -* by lia ]. +* by omega ]. @@ -667 +664 @@ intros. subst. simpl. -eapply traverse_relative; [ | instantiate (1 := k1); lia ]. +eapply traverse_relative; [ | instantiate (1 := k1); omega ]. @@ -820,2 +817,2 @@ intros. f_equal. -rewrite lift_lift by lia. -f_equal. lia. +rewrite lift_lift by omega. +f_equal. omega. ``` Proof State: ``` 1 subgoal A : Type s : nat IHs : forall (k : nat) (a b : option A) (e : env A), k <= s -> raw_insert k a (raw_insert s b e) = raw_insert (1 + s) b (raw_insert k a e) k : nat a, b : option A e : env A H : S k <= S s ============================ raw_insert (S k) a (raw_insert (S s) b e) = raw_insert (1 + S s) b (raw_insert (S k) a e) ``` Ongoing Proof History: ``` Proof. intros ? k s. generalize s k; clear s k. induction s; intros. - - destruct k; [ | elimtype False; lia ]. + destruct k; [ | elimtype False; omega ]. reflexivity. - { destruct k. - reflexivity. - ? destruct e; replace (1 + S s) with (S (1 + s)) by lia; simpl; f_equal; intuition. ? } ? Qed. ``` Next Tactic: ```
destruct e; replace (1 + <LOOKUP>S : nat -> nat</LOOKUP> s) with (<LOOKUP>S : nat -> nat</LOOKUP> (1 + s)) by omega; simpl; f_equal; eauto with omega. ```
{"final_commit":"3de04cadb63c28bfcffb194cf9e64e75a0c1f697","project":"dblib","repair_file":"\/data\/coq-pearls\/repairs\/dblib\/repair-dblib-d4ece98bb63f75c2a53e9d125338454e6e1393b2-3de04cadb63c28bfcffb194cf9e64e75a0c1f697-8_12_2-8_12_2-24.git.json","initial_commit":"d4ece98bb63f75c2a53e9d125338454e6e1393b2","file":"src\/Environments.v"}
Ongoing Proof History: ``` Proof. intros. repeat rewrite two_power_nat_two_p in *. unfold Z.divide. exists (two_p (Z.of_nat m - Z.of_nat n)). assert ((Z.of_nat m) = (Z.of_nat m - Z.of_nat n) + Z.of_nat n) by lia. rewrite H0 at 1. assert (Z.of_nat m >= 0) by lia. ``` Proof State: ``` 1 subgoal n, m : nat H : two_p (Z.of_nat n) <= two_p (Z.of_nat m) H0 : Z.of_nat m = Z.of_nat m - Z.of_nat n + Z.of_nat n H1 : Z.of_nat m >= 0 ============================ two_p (Z.of_nat m - Z.of_nat n + Z.of_nat n) = two_p (Z.of_nat m - Z.of_nat n) * two_p (Z.of_nat n) ``` Next Tactic: ```
assert (<LOOKUP>Z.of_nat : nat -> Z</LOOKUP> n >= 0) by lia. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/veric\/coqlib4.v"}
Ongoing Proof History: ``` Proof. intros. transitivity (PROPx P (LOCALx Q (EX x:A, SEPx (replace_nth n R (S x))))). * f_equal. f_equal. unfold SEPx. simpl. extensionality rho. revert R H; induction n; destruct R; intros. unfold replace_nth, fold_right. simpl. unfold nth in H. rewrite H; clear H. apply pred_ext. apply exp_left; intro x. apply exp_right with x. apply exp_right with x. auto. apply exp_left; intro x. auto. unfold replace_nth, nth in *. subst m. unfold fold_right_sepcon. fold (fold_right_sepcon R). normalize. unfold nth in H. unfold replace_nth. ``` Proof State: ``` 2 subgoals n : nat P : list Prop Q : list localdef A : Type S : A -> mpred rho : environ IHn : forall R : list mpred, nth n R emp = EX y, S y -> fold_right_sepcon R = EX x : A, fold_right_sepcon (replace_nth n R (S x)) H : emp = EX y, S y ============================ fold_right_sepcon nil = EX _ : A, fold_right_sepcon nil subgoal 2 is: fold_right_sepcon (m :: R) = EX x : A, fold_right_sepcon (replace_nth (Datatypes.S n) (m :: R) (S x)) ``` Next Tactic: ```
simpl. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/floyd\/client_lemmas.v"}
Proof State: ``` 1 subgoal s, s', s'' : t x, y, z : elt ============================ choose empty = None ``` Ongoing Proof History: ``` Proof. ``` Next Tactic: ```
generalize (@choose_1 <LOOKUP>empty : t</LOOKUP>). ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/FSets\/FSetEqProperties.v"}
Ongoing Proof History: ``` + unfold size; rewrite (mult_comm h); apply mult_lt_plus; auto. - apply div_lt; rewrite mult_comm... + apply div_lt; rewrite mult_comm; auto. apply ref_list_ulist. repeat rewrite (fun x => mult_comm x h). - unfold out in H4; rewrite H4... + unfold out in H4; rewrite H4; auto. - repeat rewrite (mult_comm h)... + repeat rewrite (mult_comm h); auto. - unfold size; repeat rewrite (mult_comm h); apply mult_lt_plus... + unfold size; repeat rewrite (mult_comm h); apply mult_lt_plus; auto. - unfold size; rewrite (mult_comm w); apply mult_lt_plus... + unfold size; rewrite (mult_comm w); apply mult_lt_plus; auto. - apply div_lt; rewrite mult_comm... + apply div_lt; rewrite mult_comm; auto. repeat rewrite div_mult_comp; auto with arith. rewrite (div_is_0 x1); auto with arith. rewrite (div_is_0 y1); auto with arith. case H; clear H; intros V1 V2; rewrite V1 in H3; rewrite V2 in H3. match goal with H:(In ?X _) |- _ => apply (rm_not_in _ lit_test) with (a := X) (l1 := X::nil) (l2 := gen_rect (div x h * h + div y w) z); auto with datatypes end. exact lit_test_trans. intros; apply lit_test_anti_sym. exact lit_test_exact. apply olist_one. apply gen_rect_ordered. repeat rewrite (fun x => mult_comm x h). repeat ((rewrite mod_mult_comp || rewrite div_mult_comp); auto). - rewrite (div_is_0 (div y w) h)... + rewrite (div_is_0 (div y w) h); auto. - rewrite (mod_small (div y w) h)... + rewrite (mod_small (div y w) h); auto. ? apply div_lt; rewrite (mult_comm w)... ? apply div_lt; rewrite (mult_comm w)... ? case (gen_cell_correct l x y); auto; intros tmp; case tmp; auto; clear tmp. ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 769776a..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -130,0 +131,6 @@ Qed. +Theorem length_app: forall (l1 l2 : list A), length +(l1 ++ l2) = length l1 + length l2. +Proof. +apply app_length. +Qed. + @@ -272 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite app_length, length_map, H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index 7a13f04..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite app_length, length_take1; auto with arith. +rewrite length_app, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index f9e372e..838c038 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm... +apply div_lt; rewrite mult_comm; auto. @@ -677,2 +677,6 @@ apply div_lt; rewrite mult_comm... -repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... +repeat (rewrite (fun x => +mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp; auto. +rewrite (mod_small (div y w) h); auto. +rewrite (div_is_0 (div y w) h); auto. +rewrite plus_0_r. @@ -699,3 +703,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl... -clear n H1 H2 U1. -+ intros h1; case h1; simpl... +intros U3 n; generalize h; elim n; simpl; +auto with arith; clear n H1 H2 U1. ++ intros h1; case h1; simpl; auto. @@ -709,2 +713,3 @@ apply sym_equal; apply take_nth... -** pose proof (mod_lt y w). -lia. +** apply le_trans with (1 := H1)... +apply le_trans with (2 := U3). +apply lt_le_weak; apply mod_lt... @@ -721 +726 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H3. +case (le_or_lt (length l) w); intros H1. @@ -723 +728,2 @@ case (le_or_lt (length l) w); intros H3. -** rewrite length_take_small, jump_too_far... +** rewrite length_take_small... +rewrite jump_too_far. @@ -726,2 +732,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H3)... -*** apply le_trans with (1 := H3)... +apply le_trans with (1 := H1)... +*** apply le_trans with (1 := H1)... @@ -732 +738,2 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth, jump_add, <- jump_nth... +rewrite jump_nth; rewrite jump_add. +rewrite <- jump_nth... @@ -743 +750 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump... +rewrite length_take_and_jump; auto. @@ -760 +767,2 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. +rewrite le_plus_minus_r... ``` Proof State: ``` 3 goals h, w : nat Eq1 : ulist ref_list x, y, z : nat s : list nat H1 : sudoku s U1 : x < size U2 : y < size H2 : get (Pos x y) s = z x1, y1 : nat U3 : 0 < h U4 : 0 < w U5 : forall a b c : nat, a < b * c -> div a b < c U6 : forall n m : nat, 0 < m -> mod n m < m H6 : x1 < h H7 : y1 < w ============================ div y w < h goal 2 is: div y w < h goal 3 is: False ``` Next Tactic: ```
apply <LOOKUP>div_lt : forall a b c : nat, a < b * c -> div a b < c</LOOKUP>; rewrite (mult_comm w); auto. ```
{"final_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-dc8d4294a32dbb6e0a642dc553b64495f27e6d60-427448011e3341d35aa5b9e00f675f6582fcd477-8_15_2-8_15_2-16.git.json","initial_commit":"dc8d4294a32dbb6e0a642dc553b64495f27e6d60","file":"Sudoku.v"}
Proof State: ``` 1 subgoal E : Type -> Type R : Type r1, r2 : R ============================ Ret r1 β‰ˆ Ret r2 -> r1 = r2 ``` Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index b911a90..32f56a6 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6,2 +6 @@ Require Import -Program Classes.Morphisms -Setoids.Setoid +Classes.Morphisms Setoids.Setoid @@ -24 +23,2 @@ Eq.Eq -Eq.UpToTaus. +Eq.UpToTaus +Eq.Paco2. @@ -68 +68 @@ Proof. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert A B C f g a0. -ginit. gcofix CIH. intros. +revert f g a0. +ginit. pcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -277 +277 @@ revert a. -gcofix CIH'. intros. +pcofix CIH'. intros. @@ -337,2 +337 @@ etau. -specialize (CIH xa). -cbn in CIH. +specialize (CIHL xa). cbn in CIHL. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 21ac7e0..b6665d0 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29 +29,2 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition. +Core.ITreeDefinition +Eq.Paco2. @@ -165,0 +167,54 @@ Hint Unfold id: core. +Lemma eqitF_inv_VisF_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} +t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 +b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 +/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 += TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). +Proof. +refine (fun H => match H +in eqitF _ _ _ _ +_ _ t2 return match t2 +return Prop with | VisF e2 +k2 => _ | _ +=> True end with | +EqVis _ _ _ _ +_ _ _ _ _ +=> _ | _ => +_ end); try exact I. +- left; eauto. +- destruct i0; eauto. +Qed. + +Lemma eqitF_inv_VisF_weak {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 +(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 +-> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists +p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. +Proof. +refine (fun H => match H in +eqitF _ _ _ _ _ t1 +t2 return match t1, t2 return Prop +with | VisF e1 k1, VisF e2 +k2 => _ | _, _ => +True end with | EqVis _ +_ _ _ _ _ _ +_ _ => _ | _ +=> _ end); try exact I. +- exists eq_refl; cbn; eauto. +- destruct i; exact I. +Qed. + +Lemma eqitF_inv_VisF {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 +vclo sim} X (e : E X) (k1 : X -> _) (k2 +: X -> _) : eqitF RR b1 b2 vclo sim (VisF e +k1) (VisF e k2) -> forall x, vclo sim (k1 x) (k2 x). +Proof. +intros H. dependent destruction H. assumption. +Qed. + +Lemma eqitF_VisF_gen {E R1 R2} {RR : R1 -> R2 -> Prop} {b1 b2 vclo sim} {X1 +X2} (p : X1 = X2) (e1 : E X1) (k1 : X1 -> _) (e2 : +E X2) (k2 : X2 -> _) : eqeq E p e1 e2 -> pweqeq (vclo sim) +p k1 k2 -> eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2). +Proof. +destruct p; intros <-; cbn; constructor; auto. +Qed. + @@ -215,2 +270,2 @@ split. -pstep. punfold H1. red in H1. red. -hinduction H1 before CIH; intros; eauto. +pstep. punfold H0. red in H0. red. +hinduction H0 before CIH; intros; eauto. @@ -223,2 +278,2 @@ red in REL. pclearbot. pinversion REL. -pstep. punfold H1. red in H1. red. -hinduction H1 before CIH; intros; eauto. +pstep. punfold H0. red in H0. red. +hinduction H0 before CIH; intros; eauto. @@ -326 +381 @@ econstructor. pmonauto. -intros. dependent destruction PR. +intros. destruct PR. @@ -338 +393 @@ pclearbot. econstructor. gclo. -econstructor; cycle -1; eauto with paco. +econstructor; eauto with paco. @@ -340,3 +395,3 @@ econstructor; cycle -1; eauto with paco. -hinduction EQVl before r; intros; subst; try dependent destruction Heqx; try inv CHECK; eauto. -remember (VisF e0 k3) as y. -hinduction EQVr before r; intros; subst; try dependent destruction Heqy; try inv CHECK; eauto. +hinduction EQVl before r; intros; try discriminate Heqx; eauto; inv_Vis. +remember (VisF e k3) as y. +hinduction EQVr before r; intros; try discriminate Heqy; eauto; inv_Vis. @@ -425 +480 @@ Proof. -gcofix CIH. gstep; intros. +pcofix CIH. gstep; intros. @@ -443 +498 @@ Proof. -ginit. gcofix CIH. intros. ``` Ongoing Proof History: ``` Proof. ? apply ITree.Eq.Eq.eqit_inv_ret. ? Qed. ``` Next Tactic: ```
apply ITree.Eq.Eq.eqit_inv_Ret. ```
{"final_commit":"7f00358aeb230f7970571fddaa8b256375910c62","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-672193e2507cf3326b834f5fa47b7518af829b4b-7f00358aeb230f7970571fddaa8b256375910c62-8_10_2-8_10_2-58.git.json","initial_commit":"672193e2507cf3326b834f5fa47b7518af829b4b","file":"theories\/Simple.v"}
Ongoing Proof History: ``` Proof. ``` Proof State: ``` 1 subgoal R : ringType a : R ============================ 'X - a%:P = [:: - a; 1] ``` Next Tactic: ```
by rewrite -['X]<LOOKUP>mul1r : forall [R : ringType], left_id 1 *%R</LOOKUP> -<LOOKUP>polyCN : {morph polyC : c / - c >-> - c}</LOOKUP> -<LOOKUP>cons_poly_def : forall p a, cons_poly a p = p * 'X + a%:P</LOOKUP> <LOOKUP>polyseq_cons : forall c p, cons_poly c p = (if ~~ nilp p then c :: p else c%:P)</LOOKUP> <LOOKUP>polyseq1 : (1 : {poly R}) = [:: 1]</LOOKUP>. ```
{"package":"coq-mathcomp-algebra","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/mathcomp\/algebra\/poly.v"}
Proof State: ``` 3 focused subgoals (shelved: 4) f : R -> R r, r1 : R r2 : Rlist H0 : forall (l2 lf1 lf2 : Rlist) (a b : R), a <= b -> adapted_couple f a b (r1 :: r2) lf1 -> adapted_couple_opt f a b l2 lf2 -> Int_SF lf1 (r1 :: r2) = Int_SF lf2 l2 l2 : Rlist r3 : R lf1 : Rlist r4 : R lf2 : Rlist a, b : R H1 : a <= b H2 : adapted_couple f a b (r :: r1 :: r2) (r3 :: lf1) s1, s2 : R s3 : Rlist H : adapted_couple f a b (s1 :: s2 :: s3) (r4 :: lf2) H3 : (forall i : nat, (i < Init.Nat.pred (Rlength (r4 :: lf2)))%nat -> pos_Rl (r4 :: lf2) i <> pos_Rl (r4 :: lf2) (S i) \/ f (pos_Rl l2 (S i)) <> pos_Rl (r4 :: lf2) i) /\ (forall i : nat, (i < Init.Nat.pred (Rlength l2))%nat -> pos_Rl l2 i <> pos_Rl l2 (S i)) H4 : a <> b Hyp_min : Rmin a b = a Hyp_max : Rmax a b = b H5 : l2 = s1 :: s2 :: s3 H6 : r = s1 H7 : r <> r1 ============================ adapted_couple f a b (?s1 :: s2 :: ?s3) (?r4 :: ?lf2) subgoal 2 is: (forall i : nat, (i < Init.Nat.pred (Rlength (?r4 :: ?lf2)))%nat -> pos_Rl (?r4 :: ?lf2) i <> pos_Rl (?r4 :: ?lf2) (S i) \/ f (pos_Rl (?s1 :: s2 :: ?s3) (S i)) <> pos_Rl (?r4 :: ?lf2) i) /\ (forall i : nat, (i < Init.Nat.pred (Rlength (?s1 :: s2 :: ?s3)))%nat -> pos_Rl (?s1 :: s2 :: ?s3) i <> pos_Rl (?s1 :: s2 :: ?s3) (S i)) subgoal 3 is: Int_SF (r3 :: lf1) (r :: r1 :: r2) = Int_SF (r4 :: lf2) (s1 :: s2 :: s3) ``` Ongoing Proof History: ``` Proof. induction l1 as [ | r r0 H0]. intros l2 lf1 lf2 a b Hyp H H0; unfold adapted_couple in H; decompose [and] H; clear H H0 H2 H3 H1 H6; simpl in H4; discriminate. induction r0 as [|r1 r2 H]. intros; case (Req_dec a b); intro. unfold adapted_couple_opt in H2; elim H2; intros; rewrite (StepFun_P8 H4 H3); rewrite (StepFun_P8 H1 H3); reflexivity. assert (H4 := StepFun_P9 H1 H3); simpl in H4; elim (le_Sn_O _ (le_S_n _ _ H4)). intros; clear H; unfold adapted_couple_opt in H3; elim H3; clear H3; intros; case (Req_dec a b); intro. rewrite (StepFun_P8 H2 H4); rewrite (StepFun_P8 H H4); reflexivity. assert (Hyp_min : Rmin a b = a). unfold Rmin; decide (Rle_dec a b) with H1; reflexivity. assert (Hyp_max : Rmax a b = b). unfold Rmax; decide (Rle_dec a b) with H1; reflexivity. elim (RList_P20 _ (StepFun_P9 H H4)); intros s1 [s2 [s3 H5]]; rewrite H5 in H; rewrite H5; induction lf1 as [| r3 lf1 Hreclf1]. unfold adapted_couple in H2; decompose [and] H2; clear H H2 H4 H5 H3 H6 H8 H7 H11; simpl in H9; discriminate. clear Hreclf1; induction lf2 as [| r4 lf2 Hreclf2]. unfold adapted_couple in H; decompose [and] H; clear H H2 H4 H5 H3 H6 H8 H7 H11; simpl in H9; discriminate. clear Hreclf2; assert (H6 : r = s1). unfold adapted_couple in H, H2; decompose [and] H; decompose [and] H2; clear H H2; simpl in H13; simpl in H8; rewrite H13; rewrite H8; reflexivity. assert (H7 : r3 = r4 \/ r = r1). case (Req_dec r r1); intro. right; assumption. left; cut (r1 <= s2). intro; unfold adapted_couple in H2, H; decompose [and] H; decompose [and] H2; clear H H2; set (x := (r + r1) / 2); assert (H18 := H14 0%nat); assert (H20 := H19 0%nat); unfold constant_D_eq, open_interval in H18, H20; simpl in H18; simpl in H20; rewrite <- (H18 (lt_O_Sn _) x). rewrite <- (H20 (lt_O_Sn _) x). reflexivity. assert (H21 := H13 0%nat (lt_O_Sn _)); simpl in H21; elim H21; intro; [ idtac | elim H7; assumption ]; unfold x; split. apply Rmult_lt_reg_l with 2; [ prove_sup0 | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply H | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite <- (Rplus_comm r1); rewrite double; apply Rplus_lt_compat_l; apply H | discrR ] ]. rewrite <- H6; assert (H21 := H13 0%nat (lt_O_Sn _)); simpl in H21; elim H21; intro; [ idtac | elim H7; assumption ]; unfold x; split. apply Rmult_lt_reg_l with 2; [ prove_sup0 | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply H | discrR ] ]. apply Rlt_le_trans with r1; [ apply Rmult_lt_reg_l with 2; [ prove_sup0 | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite <- (Rplus_comm r1); rewrite double; apply Rplus_lt_compat_l; apply H | discrR ] ] | assumption ]. eapply StepFun_P13. apply H4. apply H2. unfold adapted_couple_opt; split. ``` Next Tactic: ```
apply H. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Reals\/RiemannInt_SF.v"}
Proof State: ``` 1 subgoal E : Type -> Type S : Type R : Type A : Type e0 : E A ans : A ks : unit -> itrace E S k2 : unit -> itree (EvAns E) S REL : forall v : unit, paco2 (eqit_ eq true true id) bot2 (ks v) (k2 v) m2 : itree (EvAns E) S r : itrace E R -> itrace E S -> Prop k : unit -> itree (EvAns E) R H : paco2 trace_prefix_ bot2 (k tt) (ks tt) m1 : itree (EvAns E) S x : VisF (evans A e0 ans) k2 = observe m2 x0 : VisF (evans A e0 ans) ks = observe m1 CIH : forall (b : itrace E R) (b1 b2 : itrace E S), b1 β‰ˆ b2 -> trace_prefix b b1 -> r b b2 ============================ r (k tt) (k2 tt) ``` Ongoing Proof History: ``` Proof. intros E S R m1 m2 REL r X e k H1 CIH. punfold REL. red in REL. dependent induction H1. - eapply IHtrace_prefixF; auto. rewrite <- x in REL. assert (Tau bs β‰ˆ m2). { pfold. auto. } rewrite tau_eutt in H. punfold H. - rewrite <- x in REL. dependent induction REL. + rewrite <- x. constructor. + rewrite <- x. constructor. eapply IHREL; eauto. - pclearbot. rewrite <- x in REL. dependent induction REL. + rewrite <- x. constructor. right. pclearbot. ? eapply CIH; eauto. ? + ? rewrite <- x. ``` Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index ff16faf..1f991e2 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -57,0 +58,2 @@ Definition state (s a : Type) := s -> prod s a. +Definition run_stateT {s m a} (x : stateT s m a) : s -> m (s * a)%type := x. + diff --git a/theories/Basics/HeterogeneousRelations.v b/theories/Basics/HeterogeneousRelations.v index 8894184..ad37cca 100644 --- a/theories/Basics/HeterogeneousRelations.v +++ b/theories/Basics/HeterogeneousRelations.v @@ -751 +751,21 @@ cbn in *. unfold diagonal_prop in *; tauto. -Qed. \ No newline at end of file +Qed. + + + + + +Definition option_rel {X : Type} (R : +relation X) : relation (option X) := +fun mx my => match mx,my with +| Some x, Some y => R +x y | None, None => True +| _, _ => False end. +Hint Unfold option_rel : core. + +Lemma option_rel_eq : forall {A : Type}, +eq_rel (@eq (option A)) (option_rel eq). +Proof. +intros ?; split; intros [] [] EQ; subst; try inv EQ; cbn; auto. +Qed. + +#[global] Hint Unfold option_rel : core. \ No newline at end of file diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 3f88726..eff8f67 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -69,0 +70,2 @@ Arguments itreeF _ _ : clear implicits. +Create HintDb itree. + diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index a1c2431..9949acf 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -113 +113 @@ intros ? ? ?. red. -induction 1; auto. +induction 1; auto with itree. diff --git a/theories/Dijkstra/ITreeDijkstra.v b/theories/Dijkstra/ITreeDijkstra.v index 9529757..b25a16e 100644 --- a/theories/Dijkstra/ITreeDijkstra.v +++ b/theories/Dijkstra/ITreeDijkstra.v @@ -189 +189 @@ is_inf_cons (h : A) (t : stream A) : F t -> is_infF F (ConsF h t). -Hint Constructors is_infF : core. +Hint Constructors is_infF : itree. @@ -198 +198 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -217 +217 @@ s2 : stream A) : F s1 s2 -> bisimF F (ConsF h s1) (ConsF h s2). -Hint Constructors bisimF : core. +Hint Constructors bisimF : itree. @@ -226 +226 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -234 +234 @@ constructor; red. -- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto. +- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto with itree. @@ -237 +237 @@ pfold. red. -pinversion H0; subst; auto. +pinversion H0; subst; auto with itree. @@ -239 +239 @@ pinversion H0; subst; auto. -pinversion H0; pinversion H1; auto. +pinversion H0; pinversion H1; auto with itree. @@ -250 +250 @@ pfold. red. unfold app. pinversion H12. -- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto. +- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto with itree. @@ -282 +282 @@ stream' A -> Prop := | forall_nil : forall_streamF P F NilF | forall_cons (h : A -Hint Constructors forall_streamF : core. +Hint Constructors forall_streamF : itree. @@ -289 +289 @@ Proof. -red. intros. red. red in IN. destruct IN; auto. +red. intros. red. red in IN. destruct IN; auto with itree. @@ -301 +301 @@ F (observe_stream t) -> inf_manyF P F (ConsF h t) | cons_found (h : A) (t -Hint Constructors inf_manyF : core. +Hint Constructors inf_manyF : itree. ``` Next Tactic: ```
eapply CIH; eauto with itree. ```
{"final_commit":"8fcf6f5f81ec9289d56e777b3885e715b3328486","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-1158ff1cbb628aeaa69973bf098058744d458c36-8fcf6f5f81ec9289d56e777b3885e715b3328486-8_10_2-8_12_2-76.git.json","initial_commit":"1158ff1cbb628aeaa69973bf098058744d458c36","file":"theories\/ITrace\/ITracePrefix.v"}
Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index ff16faf..1f991e2 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -57,0 +58,2 @@ Definition state (s a : Type) := s -> prod s a. +Definition run_stateT {s m a} (x : stateT s m a) : s -> m (s * a)%type := x. + diff --git a/theories/Basics/HeterogeneousRelations.v b/theories/Basics/HeterogeneousRelations.v index 8894184..ad37cca 100644 --- a/theories/Basics/HeterogeneousRelations.v +++ b/theories/Basics/HeterogeneousRelations.v @@ -751 +751,21 @@ cbn in *. unfold diagonal_prop in *; tauto. -Qed. \ No newline at end of file +Qed. + + + + + +Definition option_rel {X : Type} (R : +relation X) : relation (option X) := +fun mx my => match mx,my with +| Some x, Some y => R +x y | None, None => True +| _, _ => False end. +Hint Unfold option_rel : core. + +Lemma option_rel_eq : forall {A : Type}, +eq_rel (@eq (option A)) (option_rel eq). +Proof. +intros ?; split; intros [] [] EQ; subst; try inv EQ; cbn; auto. +Qed. + +#[global] Hint Unfold option_rel : core. \ No newline at end of file diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 3f88726..eff8f67 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -69,0 +70,2 @@ Arguments itreeF _ _ : clear implicits. +Create HintDb itree. + diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index a1c2431..9949acf 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -113 +113 @@ intros ? ? ?. red. -induction 1; auto. +induction 1; auto with itree. diff --git a/theories/Dijkstra/ITreeDijkstra.v b/theories/Dijkstra/ITreeDijkstra.v index 9529757..b25a16e 100644 --- a/theories/Dijkstra/ITreeDijkstra.v +++ b/theories/Dijkstra/ITreeDijkstra.v @@ -189 +189 @@ is_inf_cons (h : A) (t : stream A) : F t -> is_infF F (ConsF h t). -Hint Constructors is_infF : core. +Hint Constructors is_infF : itree. @@ -198 +198 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -217 +217 @@ s2 : stream A) : F s1 s2 -> bisimF F (ConsF h s1) (ConsF h s2). -Hint Constructors bisimF : core. +Hint Constructors bisimF : itree. @@ -226 +226 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -234 +234 @@ constructor; red. -- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto. +- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto with itree. ``` Proof State: ``` 1 subgoal E : Type -> Type S : Type R : Type A : Type e0 : E A ans : A kr : unit -> itrace E R k2 : unit -> itree (EvAns E) R REL0 : forall v : unit, paco2 (eqit_ eq true true id) bot2 (kr v) (k2 v) m2 : itree (EvAns E) R r : itrace E R -> itrace E S -> Prop b1, b2 : itrace E R b : itrace E S k : unit -> itree (EvAns E) S H : paco2 trace_prefix_ bot2 (kr tt) (k tt) m1 : itree (EvAns E) R REL : paco2 (eqit_ eq true true id) bot2 m1 m2 CIH : forall (b1 b2 : itrace E R) (b : itrace E S), b1 β‰ˆ b2 -> trace_prefix b1 b -> r b2 b x0 : m1 β‰… Vis (evans A e0 ans) kr x : VisF (evans A e0 ans) k2 = observe m2 ============================ r (k2 tt) (k tt) ``` Ongoing Proof History: ``` apply simpobs in x. assert (m1 β‰ˆ m2); auto. rewrite x in H. rewrite tau_eutt in H. auto. + constructor. right. eapply CIH; eauto. eapply trace_prefix_tau_inv; eauto. + constructor. clear Heqb. inv Hbp. dependent induction H0. * apply simpobs in x0. assert (m1 β‰ˆ m2); auto. rewrite x0 in H. punfold H. red in H. cbn in *. dependent induction H. ++ rewrite <- x. apply trace_prefix_ret. ++ rewrite <- x. constructor. eapply IHeqitF; eauto. assert (m1 β‰ˆ m2); auto. apply simpobs in x. rewrite x in H0. rewrite tau_eutt in H0. auto. * eapply IHtrace_prefixF; auto. assert (m1 β‰ˆ m2); auto. apply simpobs in x. rewrite x in H. rewrite tau_eutt in H. auto. * assert (m1 β‰ˆ m2); auto. apply simpobs in x. rewrite x in H0. punfold H0. red in H0. cbn in *. dependent induction H0. ++ rewrite <- x. constructor. ++ rewrite <- x. constructor. eapply IHeqitF; eauto. assert (m1 β‰ˆ m2); auto. apply simpobs in x. rewrite x in H1. rewrite tau_eutt in H1. auto. * pclearbot. apply simpobs in x. assert (m1 β‰ˆ m2); auto. rewrite x in H0. punfold H0. red in H0. cbn in *. dependent induction H0. ++ rewrite <- x. constructor. right. pclearbot. ? eapply CIH; eauto. ? ++ ? rewrite <- x. ``` Next Tactic: ```
eapply CIH; eauto with itree. ```
{"final_commit":"8fcf6f5f81ec9289d56e777b3885e715b3328486","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-1158ff1cbb628aeaa69973bf098058744d458c36-8fcf6f5f81ec9289d56e777b3885e715b3328486-8_10_2-8_12_2-75.git.json","initial_commit":"1158ff1cbb628aeaa69973bf098058744d458c36","file":"theories\/ITrace\/ITracePrefix.v"}
Proof State: ``` 1 subgoal m, n : nat p : t m IHn : t (n + m) ============================ t (S n + m) ``` Ongoing Proof History: ``` Proof. induction n as [|n IHn]. - exact p. - ``` Next Tactic: ```
exact ((fix LS k (<LOOKUP>p : t m</LOOKUP>: <LOOKUP>t : nat -> Set</LOOKUP> k) := match <LOOKUP>p : t m</LOOKUP> with |@F1 k' => @F1 (<LOOKUP>S : nat -> nat</LOOKUP> k') |FS p' => <LOOKUP>FS : forall {n : nat}, t n -> t (S n)</LOOKUP> (LS _ p') end) _ IHn). ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Vectors\/Fin.v"}
Proof State: ``` 1 subgoal S : ident -> Prop i : ident H : ~ S i ============================ closed_wrt_vars S (fun rho : environ => env_set (globals_only rho) ret_temp (eval_id i rho)) ``` Ongoing Proof History: ``` Proof. intros. unfold get_result1. simpl. ``` Next Tactic: ```
hnf; intros. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/floyd\/closed_lemmas.v"}
Ongoing Proof History: ``` Proof. induction n; destruct a; simpl in *; intros; auto. - exfalso; omega. + exfalso; lia. f_equal. eapply IHn; eauto. ? omega. ? Qed. ``` Commit Diff: ``` diff --git a/examples/ConsiderDemo.v b/examples/ConsiderDemo.v index 2151e52..9490a21 100644 --- a/examples/ConsiderDemo.v +++ b/examples/ConsiderDemo.v @@ -7,0 +8 @@ Require Import Coq.ZArith.ZArith. +Require Import Coq.micromega.Lia. @@ -18 +19 @@ consider (ltb x y && ltb y z). -consider (ltb x z); auto. intros. exfalso. omega. +consider (ltb x z); auto. intros. exfalso. lia. @@ -27 +28 @@ intros. consider (ltb x y); consider (ltb y z); consider (ltb x z); intros; auto -exfalso; omega. +exfalso; lia. diff --git a/theories/Data/ListFirstnSkipn.v b/theories/Data/ListFirstnSkipn.v index cf126d1..dda9dff 100644 --- a/theories/Data/ListFirstnSkipn.v +++ b/theories/Data/ListFirstnSkipn.v @@ -2,0 +3 @@ Require Import Coq.ZArith.ZArith. +Require Import Coq.micromega.Lia. @@ -18,2 +19,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -f_equal. eapply IHn; eauto. omega. +exfalso; lia. +f_equal. eapply IHn; eauto. lia. @@ -27,2 +28,2 @@ induction n; destruct a; simpl; intros; auto. -exfalso; omega. -simpl. f_equal. eapply IHn; omega. +exfalso; lia. +simpl. f_equal. eapply IHn; lia. @@ -43,2 +44,2 @@ destruct n; intros. -omega. -simpl. replace (n - 0) with n; [ | omega ]. reflexivity. +lia. +simpl. replace (n - 0) with n; [ | lia ]. reflexivity. @@ -47 +48 @@ Qed. -Hint Rewrite firstn_app_L firstn_app_R firstn_all firstn_0 firstn_cons using omega : list_rw. +Hint Rewrite firstn_app_L firstn_app_R firstn_all firstn_0 firstn_cons using lia : list_rw. @@ -54,2 +55,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -eapply IHn. omega. +exfalso; lia. +eapply IHn. lia. @@ -63,2 +64,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -eapply IHn. omega. +exfalso; lia. +eapply IHn. lia. @@ -79,2 +80,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -apply IHn; omega. +exfalso; lia. +apply IHn; lia. @@ -88,2 +89,2 @@ destruct n; intros. -omega. -simpl. replace (n - 0) with n; [ | omega ]. reflexivity. +lia. +simpl. replace (n - 0) with n; [ | lia ]. reflexivity. @@ -92 +93 @@ Qed. -Hint Rewrite skipn_app_L skipn_app_R skipn_0 skipn_all skipn_cons using omega : list_rw. \ No newline at end of file +Hint Rewrite skipn_app_L skipn_app_R skipn_0 skipn_all skipn_cons using lia : list_rw. \ No newline at end of file diff --git a/theories/Data/ListNth.v b/theories/Data/ListNth.v index d6a09d0..c2394fd 100644 --- a/theories/Data/ListNth.v +++ b/theories/Data/ListNth.v @@ -1,0 +2 @@ Require Import Coq.Lists.List. +Require Import Coq.Arith.Lt Coq.Arith.Plus. diff --git a/theories/Data/Map/FMapAList.v b/theories/Data/Map/FMapAList.v index 9d25baf..6d62e97 100644 --- a/theories/Data/Map/FMapAList.v +++ b/theories/Data/Map/FMapAList.v @@ -8,0 +9,9 @@ Require Import ExtLib.Structures.Functor. +From Coq Require +Import Basics. +From ExtLib +Require Import +Extras OptionMonad. +Import +FunNotation +FunctorNotation. +Open Scope program_scope. @@ -37,0 +47,14 @@ alist_find k ms end. +Definition alist_find' (k: K) : alist -> option V +:= fmap snd ∘ find (rel_dec k ∘ fst). + +Lemma alist_find_alt (m: alist) : forall k: K, +alist_find k m = alist_find' k m. +Proof. +induction m; intuition. +unfold alist_find', compose. +simpl. +destruct (k ?[ R ] a0) eqn:Heq; intuition. +rewrite IHm. +reflexivity. +Qed. + @@ -51,0 +75,13 @@ in fold_alist acc m end. + +Definition fold_alist' : T -> alist -> T +:= flip $ fold_left (flip $ uncurry f). + +Lemma fold_alist_alt (map: alist) : forall acc: T, +fold_alist acc map = fold_alist' acc map. +Proof. +induction map; intuition. +simpl. +rewrite IHmap. +reflexivity. +Qed. + diff --git a/theories/Data/Monads/ListMonad.v b/theories/Data/Monads/ListMonad.v index fd6906f..7023710 100644 --- a/theories/Data/Monads/ListMonad.v +++ b/theories/Data/Monads/ListMonad.v @@ -7,8 +7,4 @@ Set Strict Implicit. -Global Instance Monad_list : Monad list := -{ ret := fun _ v -=> v :: nil ; bind -:= fun _ _ => fix -recur c1 c2 := match c1 -with | nil => nil | -a :: b => c2 a -++ recur b c2 end }. ``` Proof State: ``` 1 goal T : Type n : nat IHn : forall a b : list T, n <= length a -> firstn n (a ++ b) = firstn n a t : T a, b : list T H : S n <= S (length a) ============================ n <= length a ``` Next Tactic: ```
lia. ```
{"final_commit":"8f0f0228332007a1b73abb01fb9bf828023007fa","project":"coq-ext-lib","repair_file":"\/data\/coq-pearls\/repairs\/coq-ext-lib\/repair-coq-ext-lib-7532d92d1d6a9d7c9c45e111766f65421f6e09ba-8f0f0228332007a1b73abb01fb9bf828023007fa-8_12_2-8_14_1-2.git.json","initial_commit":"7532d92d1d6a9d7c9c45e111766f65421f6e09ba","file":"theories\/Data\/ListFirstnSkipn.v"}
Ongoing Proof History: ``` Proof. induction e; simpl; intros. - - replace n with k by lia. + replace n with k by omega. assumption. - ? eauto using agree_insert with lia. ? Qed. ``` Commit Diff: ``` diff --git a/src/DblibTactics.v b/src/DblibTactics.v index 2a08b3e..2aa54e9 100644 --- a/src/DblibTactics.v +++ b/src/DblibTactics.v @@ -2,3 +2 @@ Set Implicit Arguments. -Require Import Compare_dec. -Require Import Peano_dec. -Require Import Lia. +Require Export Omega. @@ -12,7 +10,8 @@ Hint Extern 1 => f_equal : f_equal. -Hint Extern 1 (_ = _ :> nat) => reflexivity : lia. -Hint Extern 3 (_ = _ :> nat) => lia : lia. -Hint Extern 3 (_ <> _ :> nat) => lia : lia. -Hint Extern 3 (_ < _) => lia : lia. -Hint Extern 3 (_ > _) => lia : lia. -Hint Extern 3 (_ <= _) => lia : lia. -Hint Extern 3 (_ >= _) => lia : lia. +Hint Extern 1 (_ = _ :> nat) => reflexivity : omega. + +Hint Extern 1 (_ = _ :> nat) => omega : omega. +Hint Extern 1 (_ <> _ :> nat) => omega : omega. +Hint Extern 1 (_ < _) => omega : omega. +Hint Extern 1 (_ > _) => omega : omega. +Hint Extern 1 (_ <= _) => omega : omega. +Hint Extern 1 (_ >= _) => omega : omega. @@ -43 +42 @@ Ltac dblib_by_cases := repeat dblib_inspect_cases; try solve -[ intros; exfalso; lia ]; intros. \ No newline at end of file +[ intros; exfalso; omega ]; intros. \ No newline at end of file diff --git a/src/DeBruijn.v b/src/DeBruijn.v index 45bfa51..7a58a05 100644 --- a/src/DeBruijn.v +++ b/src/DeBruijn.v @@ -3,2 +2,0 @@ Generalizable All Variables. -Require Import Arith. -Require Import Lia. @@ -286,3 +284,3 @@ intros. -replace k with (ws + (k - ws)) by lia. -erewrite <- lift_lift by lia. -replace (ws + (k - ws) - ws) with (k - ws) by lia. +replace k with (ws + (k - ws)) by omega. +erewrite <- lift_lift by omega. +replace (ws + (k - ws) - ws) with (k - ws) by omega. @@ -456,2 +454,2 @@ eapply traverse_relative with (p := 0). -intros m ?. replace (m + 0) with m by lia. eauto. -lia. +intros m ?. replace (m + 0) with m by omega. eauto. +omega. @@ -483,4 +481,3 @@ Qed. -Ltac just_do_it := unfold -subst, Subst_idx, subst_idx, lift, -Lift_idx, var, Var_idx; intros; -dblib_by_cases; eauto with lia. +Ltac just_do_it := unfold subst, Subst_idx, subst_idx, +lift, Lift_idx, var, Var_idx; intros; solve [ +dblib_by_cases; eauto with f_equal omega ]. @@ -512,2 +509,2 @@ Ltac lift_idx := first [ rewrite @lift_idx_recent by -solve [ lia | eauto with lift_idx_hints -] | rewrite @lift_idx_old by lia ]. +solve [ omega | eauto with lift_idx_hints +] | rewrite @lift_idx_old by omega ]. @@ -518,2 +515,2 @@ Ltac lift_idx_in h := first [ rewrite @lift_idx_recent in -h by solve [ lia | eauto with lift_idx_hints -] | rewrite @lift_idx_old in h by lia ]. +h by solve [ omega | eauto with lift_idx_hints +] | rewrite @lift_idx_old in h by omega ]. @@ -522,2 +519,2 @@ Ltac lift_idx_all := first [ rewrite @lift_idx_recent in * -by solve [ lia | eauto with lift_idx_hints ] -| rewrite @lift_idx_old in * by lia ]. +by solve [ omega | eauto with lift_idx_hints ] +| rewrite @lift_idx_old in * by omega ]. @@ -587,2 +584,2 @@ Ltac subst_idx := first -lia | rewrite -@subst_idx_miss_1 by lia +omega | rewrite +@subst_idx_miss_1 by omega @@ -590 +587 @@ lia | rewrite -by lia ]. +by omega ]. @@ -594,2 +591,2 @@ Ltac subst_idx_in h := first -by lia | rewrite @subst_idx_miss_1 -in h by lia +by omega | rewrite @subst_idx_miss_1 +in h by omega @@ -597 +594 @@ in h by lia -h by lia ]. +h by omega ]. @@ -601,2 +598,2 @@ rewrite @subst_idx_identity in * by -lia | rewrite @subst_idx_miss_1 -in * by lia +omega | rewrite @subst_idx_miss_1 +in * by omega @@ -604 +601 @@ in * by lia -* by lia ]. +* by omega ]. @@ -667 +664 @@ intros. subst. simpl. -eapply traverse_relative; [ | instantiate (1 := k1); lia ]. +eapply traverse_relative; [ | instantiate (1 := k1); omega ]. @@ -820,2 +817,2 @@ intros. f_equal. -rewrite lift_lift by lia. -f_equal. lia. +rewrite lift_lift by omega. +f_equal. omega. @@ -835 +832 @@ intros. f_equal. -rewrite lift_lift_fuse by lia. reflexivity. +rewrite lift_lift_fuse by omega. reflexivity. ``` Proof State: ``` 1 subgoal A : Type a : A e : list A IHe : forall (e1 e2 : env A) (k n : nat), agree e1 e2 k -> k + length e = n -> agree (concat e1 e) (concat e2 e) n e1, e2 : env A k, n : nat H : agree e1 e2 k H0 : k + S (length e) = n ============================ agree (concat (insert 0 a e1) e) (concat (insert 0 a e2) e) n ``` Next Tactic: ```
eauto using <LOOKUP>agree_insert : forall [A : Type] [e1 e2 : env A] [k : nat], agree e1 e2 k -> forall (x : nat) (o : option A), x <= k -> agree (raw_insert x o e1) (raw_insert x o e2) (1 + k)</LOOKUP> with omega. ```
{"final_commit":"3de04cadb63c28bfcffb194cf9e64e75a0c1f697","project":"dblib","repair_file":"\/data\/coq-pearls\/repairs\/dblib\/repair-dblib-d4ece98bb63f75c2a53e9d125338454e6e1393b2-3de04cadb63c28bfcffb194cf9e64e75a0c1f697-8_12_2-8_12_2-36.git.json","initial_commit":"d4ece98bb63f75c2a53e9d125338454e6e1393b2","file":"src\/Environments.v"}
Proof State: ``` 4 subgoals x, h, eps, l1, alp_f2, alp_f2t2 : R eps_f2 : posreal f2 : R -> R H : 0 < eps H0 : f2 x <> 0 H1 : f2 (x + h) <> 0 H2 : forall a : R, Rabs a < alp_f2t2 -> Rabs (f2 (x + a) - f2 x) < Rabs (eps * (f2 x)Β² / (8 * l1)) H3 : forall a : R, Rabs a < Rmin eps_f2 alp_f2 -> / Rabs (f2 (x + a)) < 2 / Rabs (f2 x) H4 : h <> 0 H5 : Rabs h < alp_f2t2 H6 : Rabs h < Rmin eps_f2 alp_f2 H7 : l1 <> 0 H8 : / Rabs (f2 (x + h)) < 2 / Rabs (f2 x) H9 : Rabs (f2 (x + h) - f2 x) < Rabs (eps * (f2 x)Β² / (8 * l1)) ============================ 2 * (Rabs l1 * (/ Rabs (f2 x) * / Rabs (f2 x))) * (eps * (Rabs (f2 x) * Rabs (f2 x)) * (/ 8 * / Rabs l1)) = eps * / 4 subgoal 2 is: 2 = Rabs 2 subgoal 3 is: 8 = Rabs 8 subgoal 4 is: eps = Rabs eps ``` Ongoing Proof History: ``` Proof. intros. assert (H8 := H3 h H6). assert (H9 := H2 h H5). apply Rle_lt_trans with (Rabs (l1 / (f2 x * f2 (x + h))) * Rabs (eps * Rsqr (f2 x) / (8 * l1))). rewrite Rabs_mult; apply Rmult_le_compat_l. apply Rabs_pos. rewrite <- (Rabs_Ropp (f2 x - f2 (x + h))); rewrite Ropp_minus_distr. left; apply H9. apply Rlt_le_trans with (Rabs (2 * (l1 / (f2 x * f2 x))) * Rabs (eps * Rsqr (f2 x) / (8 * l1))). apply Rmult_lt_compat_r. apply Rabs_pos_lt. unfold Rdiv; unfold Rsqr; repeat apply prod_neq_R0; try assumption || discrR. red; intro H10; rewrite H10 in H; elim (Rlt_irrefl _ H). apply Rinv_neq_0_compat; apply prod_neq_R0; try assumption || discrR. unfold Rdiv. repeat rewrite Rinv_mult_distr; try assumption. repeat rewrite Rabs_mult. replace (Rabs 2) with 2. rewrite (Rmult_comm 2). replace (Rabs l1 * (Rabs (/ f2 x) * Rabs (/ f2 x)) * 2) with (Rabs l1 * (Rabs (/ f2 x) * (Rabs (/ f2 x) * 2))); [ idtac | ring ]. repeat apply Rmult_lt_compat_l. apply Rabs_pos_lt; assumption. apply Rabs_pos_lt; apply Rinv_neq_0_compat; assumption. repeat rewrite Rabs_Rinv; try assumption. rewrite <- (Rmult_comm 2). unfold Rdiv in H8; exact H8. symmetry ; apply Rabs_right; left; prove_sup0. right. unfold Rsqr, Rdiv. do 1 rewrite Rinv_mult_distr; try assumption || discrR. do 1 rewrite Rinv_mult_distr; try assumption || discrR. repeat rewrite Rabs_mult. repeat rewrite Rabs_Rinv; try assumption || discrR. replace (Rabs eps) with eps. replace (Rabs 8) with 8. replace (Rabs 2) with 2. ``` Next Tactic: ```
replace 8 with (4 * 2); [ idtac | ring ]. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Reals\/Ranalysis2.v"}
Proof State: ``` 1 subgoal n : nat r : AV.address -> resource m1, m2 : ghost s2 : {g : ghost.Ghost & {a : ghost.G | ghost.valid a}} p2 : preds g0 : list (option ({g : ghost.Ghost & {a : ghost.G | ghost.valid a}} * preds)) IHghost_join : forall g1 : ghost, ghost_fmap (approx n) (approx n) g0 = ghost_fmap (approx n) (approx n) g1 -> ghost_fmap (approx n) (approx n) m1 = m1 H0 : ghost_join m1 m2 (ghost_fmap (approx n) (approx n) g0) s : {g : ghost.Ghost & {a : ghost.G | ghost.valid a}} p : preds s0 : {g : ghost.Ghost & {a : ghost.G | ghost.valid a}} p0 : preds H : join s s0 s2 H2 : join p p0 (preds_fmap (approx n) (approx n) p2) ============================ Some (s, preds_fmap (approx n) (approx n) p) = Some (s, p) ``` Ongoing Proof History: ``` Proof. intros. rewrite rmap_level_eq. unfold ghost_of in *. revert H; case_eq (unsquash phi); intros n ? ?. generalize H; rewrite <- (squash_unsquash phi). rewrite H. rewrite unsquash_squash. simpl; intros. injection H0. clear H0. intro. clear phi H. rewrite <- H0 in H1. clear H0. unfold rmap_fmap in *. destruct r. simpl in H1; destruct H1. remember (ghost_fmap (approx n) (approx n) g0) as g'. revert dependent g0; induction H; auto; intros; subst. - rewrite ghost_fmap_fmap, approx_oo_approx; auto. - destruct g0; inv Heqg'. simpl; f_equal; eauto. inv H; auto; simpl. + destruct o as [[]|]; auto; simpl. rewrite preds_fmap_fmap, approx_oo_approx; auto. + destruct a0, a3, a4; inv H4; simpl in *. destruct o as [[]|]; inv H1. ``` Next Tactic: ```
inv H2. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/veric\/rmaps_lemmas.v"}
Proof State: ``` 2 focused subgoals (shelved: 1) n : nat H_strong2 : forall k : nat, k < S n -> forall (e : Expr) (Οƒ Οƒ' : Store) (ρ : Env) (ψ l : Value), (⟦ e ⟧ (Οƒ, ρ, ψ )( k)) = Success l Οƒ' -> wf Οƒ -> (codom ρ βˆͺ {ψ}) βͺ½ Οƒ -> ((Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ', {l})) /\ (Οƒ ⇝ Οƒ' β‹– codom ρ βˆͺ {ψ}) e0 : Expr f : Var Οƒ, Οƒ' : Store ρ : Env ψ, l, v : Value matched : (⟦ e0 ⟧ (Οƒ, ρ, ψ )( n)) = Success v Οƒ' c : ClN e : Env matched0 : getObj Οƒ' v = Some (c, e) matched2 : getVal e f = Some l H_wf : wf Οƒ H_codom : (codom ρ βˆͺ {ψ}) βͺ½ Οƒ H_strong : forall (e : Expr) (Οƒ Οƒ' : Store) (ρ : Env) (ψ l : Value), (⟦ e ⟧ (Οƒ, ρ, ψ )( n)) = Success l Οƒ' -> wf Οƒ -> (codom ρ βˆͺ {ψ}) βͺ½ Οƒ -> ((Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ', {l})) /\ (Οƒ ⇝ Οƒ' β‹– codom ρ βˆͺ {ψ}) H : dom Οƒ <= dom Οƒ' A2 : (Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ', {v}) A3 : Οƒ ⇝ Οƒ' β‹– codom ρ βˆͺ {ψ} ============================ Οƒ' ⊨ v ⇝ ?l1 subgoal 2 is: Οƒ' ⊨ ?l1 ⇝ l ``` Commit Diff: ``` diff --git a/Reachability.v b/Reachability.v index 5c47635..1b96ea3 100644 --- a/Reachability.v +++ b/Reachability.v @@ -18,5 +18,20 @@ Import Eval.Evaluator. - -Inductive reachability : Store -> Loc -> Loc ->Prop := |rch_heap : forall l Οƒ, l < (dom Οƒ) -> (reachability Οƒ -l l) |rch_trans : forall l0 l1 l2 C Ο‰ Οƒ, (reachability Οƒ l0 l1) -> (getObj Οƒ l1 = Some -(C, Ο‰)) -> (exists f, (getVal Ο‰ f = Some l2)) -> (l2 < dom Οƒ) -> (reachability Οƒ l0 l2). -Notation "Οƒ ⊨ l1 ⇝ l2" := (reachability Οƒ l1 l2) (at level 80, l1 at level 80, l2 at level 80). +Reserved Notation "Οƒ ⊨ l1 ⇝ l2" (at level 80, l1 at level 80, l2 at level 80). +Inductive reachability : Store -> Loc +-> Loc ->Prop := | rch_heap: +forall l Οƒ, l < (dom +Οƒ) -> Οƒ ⊨ l ⇝ +l | rch_step: forall l0 l1 +C f Ο‰ Οƒ, l1 < +(dom Οƒ) -> getObj Οƒ l0 += Some (C, Ο‰) -> getVal +Ο‰ f = Some l1 -> +Οƒ ⊨ l0 ⇝ l1 +| rch_trans: forall l0 l1 +l2 Οƒ, Οƒ ⊨ l0 +⇝ l1 -> Οƒ ⊨ +l1 ⇝ l2 -> Οƒ +⊨ l0 ⇝ l2 where +"Οƒ ⊨ l1 ⇝ l2" +:= (reachability Οƒ l1 l2). +Hint Resolve rch_heap rch_step rch_trans: rch. +Hint Rewrite update_dom: rch. @@ -41,3 +56 @@ Proof. -intros Οƒ l1 l2 l3 H1 H2. -induction H2 => //. -apply (rch_trans l1 l2 l3 C Ο‰ Οƒ (IHreachability H1) H H0 H3). +eauto using rch_trans. @@ -44,0 +58 @@ Qed. + @@ -60 +74 @@ intros. -induction H; steps. +induction H; repeat steps || eapply_anywhere getObj_dom. @@ -64,11 +78,11 @@ Qed. -Lemma reachability_rev: forall Οƒ l l', Οƒ ⊨ l -⇝ l' -> (l = l' /\ l < -dom Οƒ) \/ (exists C Ο‰ f l0, getObj -Οƒ l = Some(C, Ο‰) /\ getVal Ο‰ f -= Some l0 /\ Οƒ ⊨ l0 ⇝ l'). -Proof. -intros. -induction H; steps. -+ right. repeat eexists; eauto using rch_heap. -+ right. repeat eexists; eauto using rch_heap, rch_trans. -Qed. + + + + + + + + + + + @@ -85,3 +98,0 @@ induction H2; eauto. -steps. -pose proof (H1 l1 l2 C Ο‰ f). -eapply H0; eauto. ``` Ongoing Proof History: ``` Proof. apply strong_induction. unfold ScopabilityProp. intros n H_strong2 e Οƒ Οƒ' ρ ψ l H_success H_wf H_codom. destruct n => //. move: (H_strong2 n (le_n (S n)) ) => H_strong. destruct e as [x | this | e0 f | e0 m el | C el | e0 f e1 e2]; simpl in H_success; repeat destruct_match; try discriminate; try invert_constructor_equalities; subst. + split. unfold scoping; steps. exists l; steps. apply Union_introl. unfold codom, In. eauto using nth_error_In. apply_anywhere reachability_singleton => //. unfold scoping_preservation; steps. + split. unfold scoping; steps. unfold reachability_set in *; steps. inSingleton. exists l. steps; eauto using Union_intror. unfold scoping_preservation; steps. + unfold scoping; intros; simpl. pose proof (PartialMonotonicity.partialMonotonicity_theorem_dom _ _ _ _ _ _ _ matched). move : (H_strong _ _ _ _ _ _ matched H_wf H_codom) => [A2 A3]. assert ((Οƒ', {v}) β‹– (Οƒ', {l})) as B1. { apply scoping_reachability. eapply rch_trans; eauto. ? apply rch_heap; eauto using getObj_dom. ? eapply wellformedness_conserved in matched0; eauto. ? } ``` Next Tactic: ```
eauto using <LOOKUP>getObj_dom : forall (Οƒ : Store) (o : Obj) (l : nat), getObj Οƒ l = Some o -> l < dom Οƒ</LOOKUP> with rch. ```
{"final_commit":"2dfd0b6c87b32ebd6bd1dd83e76e654e73dd3696","project":"celsius","repair_file":"\/data\/coq-pearls\/repairs\/celsius\/repair-celsius-a726b4d083864e7cb26d15bceeb49fbc418b2811-2dfd0b6c87b32ebd6bd1dd83e76e654e73dd3696-8_13_2-8_13_2-17.git.json","initial_commit":"a726b4d083864e7cb26d15bceeb49fbc418b2811","file":"Scopability.v"}
Commit Diff: ``` diff --git a/Div.v b/Div.v index 7e7d694..e83d601 100644 --- a/Div.v +++ b/Div.v @@ -57,2 +57,2 @@ n) p) (c2 := mod n p); try apply mod_lt; auto with arith. -rewrite mult_plus_distr_r; rewrite <- plus_assoc; repeat -rewrite <- div_mod_correct; auto with arith. +rewrite mult_plus_distr_r, <- plus_assoc; repeat rewrite +<- div_mod_correct; auto with arith. @@ -67,4 +67,2 @@ intros n m p H; apply plus_reg_l with (div (p * m + n) p * p). -rewrite <- div_mod_correct; auto. -rewrite div_mult_comp; auto. -rewrite mult_plus_distr_r; rewrite (mult_comm p); rewrite <- plus_assoc. -eq_tac; apply div_mod_correct; auto. +rewrite <- div_mod_correct, div_mult_comp, mult_plus_distr_r, (mult_comm p), <- plus_assoc by assumption. +f_equal. now apply div_mod_correct. diff --git a/ListAux.v b/ListAux.v index 82a8d82..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -76 +76 @@ exists (nil (A:=A)); exists l; simpl; auto. -eq_tac; auto. +f_equal; auto. @@ -78 +78 @@ case H; auto; intros l1 [l2 Hl2]; exists (a1 :: l1); exists l2; simpl; auto. -eq_tac; auto. +f_equal; auto. @@ -146 +146 @@ intros a l H l2 l3 l4 a0; case l3; simpl. -intros H0; left; exists l; eq_tac; injection H0; auto. +intros H0; left; exists l; f_equal; injection H0; auto. @@ -150 +150 @@ intros [l5 H1]. -left; exists l5; eq_tac; injection H0; auto. +left; exists l5; f_equal; injection H0; auto. @@ -165,2 +165,2 @@ intros H0; right; right; injection H0; split; auto. -eq_tac; auto. -intros b0 l0 H0; left; exists l0; injection H0; intros; (repeat eq_tac); auto. +f_equal; auto. +intros b0 l0 H0; left; exists l0; injection H0; intros; (repeat f_equal); auto. @@ -169 +169 @@ injection H0; auto. -intros [l5 HH1]; left; exists l5; eq_tac; auto; injection H0; auto. +intros [l5 HH1]; left; exists l5; f_equal; auto; injection H0; auto. @@ -171 +171 @@ intros [H1|[H1 H2]]; auto. -right; right; split; auto; eq_tac; auto; injection H0; auto. +right; right; split; auto; f_equal; auto; injection H0; auto. @@ -190 +190 @@ exists (b :: l4); exists l5; exists b1; (repeat (simpl; split; auto)). -eq_tac; auto. +f_equal; auto. @@ -237 +237 @@ intros H4 H5; split; auto. -eq_tac; auto. +f_equal; auto. @@ -278 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app; rewrite length_map; rewrite H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index b9797d9..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -138,2 +138 @@ intros a b c; elim c; simpl; auto. -intros n H; rewrite jump_nil; rewrite -take_nil; rewrite H; auto with arith. +intros n H; rewrite jump_nil, take_nil, H; auto with arith. @@ -146,2 +145,2 @@ intros k Rec i j s H; -rewrite length_app; rewrite length_take1; auto with arith. -eq_tac; auto. +rewrite length_app, length_take1; auto with arith. +f_equal; auto. @@ -199 +198 @@ intros l; elim l; simpl; auto with datatypes. -intros; eq_tac; auto. +intros; f_equal; auto. @@ -206 +205 @@ intros H; contradict H; auto with arith. -intros n1 H; eq_tac; auto with arith. +intros n1 H; f_equal; auto with arith. @@ -219 +218 @@ intros a l1 Rec n; case n; auto; clear n. -simpl length; intros n H; simpl; eq_tac; auto with arith. +simpl length; intros n H; simpl; f_equal; auto with arith. diff --git a/OrderedList.v b/OrderedList.v index f2762b8..3136749 100644 --- a/OrderedList.v +++ b/OrderedList.v @@ -624 +624 @@ intros; discriminate. -intros; eq_tac; auto. +intros; f_equal; auto. diff --git a/Permutation.v b/Permutation.v index ecfa699..ccd8195 100644 --- a/Permutation.v +++ b/Permutation.v @@ -33,2 +32,0 @@ Variable A : Set. -Definition permutation (l1 l2 : list A) := @Permutation A l1 l2. - ``` Ongoing Proof History: ``` Proof. intros n; elim n; simpl in |- *; auto. intros l1 l2; case l2. ? intros H H0; rewrite perm_nil_inv with (1 := H0); auto with datatypes. ? simpl in |- *; intros; discriminate. ? intros n0 H l1; case l1. ``` Proof State: ``` 3 goals A : Set n : nat l1, l2 : list A ============================ 0 = length nil -> Permutation l1 nil -> nil = l1 \/ False goal 2 is: forall (a : A) (l : list A), 0 = length (a :: l) -> Permutation l1 (a :: l) -> nil = l1 \/ False goal 3 is: forall n0 : nat, (forall l1 l2 : list A, n0 = length l2 -> Permutation l1 l2 -> In l1 (all_permutations_aux l2 n0)) -> forall l1 l2 : list A, S n0 = length l2 -> Permutation l1 l2 -> In l1 (flat_map (fun p : A * list A => map (cons (fst p)) (all_permutations_aux (snd p) n0)) (split_one l2)) ``` Next Tactic: ```
intros H H0; rewrite (<LOOKUP>Permutation_nil : forall [A : Type] [l : list A], Permutation nil l -> l = nil</LOOKUP> (<LOOKUP>Permutation_sym : forall [A : Type] [l l' : list A], Permutation l l' -> Permutation l' l</LOOKUP> H0)); auto with datatypes. ```
{"final_commit":"82eb0678991955dfa8f12720d652ad5adb465c3e","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-b5543771d6bdeab13ec58ac6c8d281815d96ed62-82eb0678991955dfa8f12720d652ad5adb465c3e-8_15_2-8_15_2-37.git.json","initial_commit":"b5543771d6bdeab13ec58ac6c8d281815d96ed62","file":"Permutation.v"}
Ongoing Proof History: ``` + Proof. ? Proof with auto. ? generalize (ref_list_ulist); intros Eq1. ? generalize (ref_list_length); intros Eq2. ``` Proof State: ``` 1 goal h, w : nat ============================ forall s : list nat, length s = size * size -> sat init_c s <-> sudoku s ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 769776a..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -130,0 +131,6 @@ Qed. +Theorem length_app: forall (l1 l2 : list A), length +(l1 ++ l2) = length l1 + length l2. +Proof. +apply app_length. +Qed. + @@ -272 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite app_length, length_map, H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index 7a13f04..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite app_length, length_take1; auto with arith. +rewrite length_app, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index f9e372e..3a01485 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm... +apply div_lt; rewrite mult_comm; auto. @@ -677,2 +677,6 @@ apply div_lt; rewrite mult_comm... -repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... +repeat (rewrite (fun x => +mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp; auto. +rewrite (mod_small (div y w) h); auto. +rewrite (div_is_0 (div y w) h); auto. +rewrite plus_0_r. @@ -699,3 +703,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl... -clear n H1 H2 U1. -+ intros h1; case h1; simpl... +intros U3 n; generalize h; elim n; simpl; +auto with arith; clear n H1 H2 U1. ++ intros h1; case h1; simpl; auto. @@ -709,2 +713,3 @@ apply sym_equal; apply take_nth... -** pose proof (mod_lt y w). -lia. +** apply le_trans with (1 := H1)... +apply le_trans with (2 := U3). +apply lt_le_weak; apply mod_lt... @@ -721 +726 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H3. +case (le_or_lt (length l) w); intros H1. @@ -723 +728,2 @@ case (le_or_lt (length l) w); intros H3. -** rewrite length_take_small, jump_too_far... +** rewrite length_take_small... +rewrite jump_too_far. @@ -726,2 +732,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H3)... -*** apply le_trans with (1 := H3)... +apply le_trans with (1 := H1)... +*** apply le_trans with (1 := H1)... @@ -732 +738,2 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth, jump_add, <- jump_nth... +rewrite jump_nth; rewrite jump_add. +rewrite <- jump_nth... @@ -743 +750 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump... +rewrite length_take_and_jump; auto. @@ -760 +767,2 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. +rewrite le_plus_minus_r... @@ -846,2 +854,2 @@ l2 l3 -> lit_test l1 l3 = lit_test l1 l2. -Proof with auto. -intros l1 l2 l3; case l1; case l2; case l3; simpl... +Proof. +intros l1 l2 l3; case l1; case l2; case l3; simpl; auto. @@ -851 +859 @@ case_eq (pos_test p2 p3); intros H1. -rewrite (pos_test_trans p1 p2 p3); rewrite H... +rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. @@ -853,2 +861,2 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1)... -rewrite H... +apply pos_test_exact with (1 := H1); auto. +rewrite H; auto. @@ -856,4 +864,4 @@ intros; discriminate. -replace p1 with p2... -case_eq (pos_test p2 p3); intros H1... -intros; apply test_trans... -apply sym_equal; apply pos_test_exact with (1 := H)... +replace p1 with p2; auto. +case_eq (pos_test p2 p3); intros H1; auto. +intros; apply test_trans; auto. +apply sym_equal; apply pos_test_exact with (1 := H); auto. @@ -863,3 +871,3 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1)... -rewrite H... -rewrite (pos_test_trans p1 p2 p3); rewrite H... +apply pos_test_exact with (1 := H1); auto. +rewrite H; auto. +rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. @@ -1445,2 +1453,2 @@ ordered cs -> ordered (clauses_update l c cs). -Proof with auto with datatypes. -intros l c cs; elim cs; simpl... +Proof. +intros l c cs; elim cs; simpl; auto. @@ -1448,7 +1456,7 @@ intros (n1, c1) cs1 Rec H H1; case (lit_is_in l c1). -apply Rec... -intros n2 c2 H2; apply (H1 n2 c2)... -apply clause_insert_ordered... -apply lit_rm_ordered... -apply (H1 n1 c1)... -apply Rec... -intros n2 c2 H2; apply (H1 n2 c2)... +apply Rec; auto. ``` Next Tactic: ```
generalize (<LOOKUP>ref_list_ulist : ulist ref_list</LOOKUP>); intros Eq1. ```
{"final_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-dc8d4294a32dbb6e0a642dc553b64495f27e6d60-427448011e3341d35aa5b9e00f675f6582fcd477-8_15_2-8_15_2-23.git.json","initial_commit":"dc8d4294a32dbb6e0a642dc553b64495f27e6d60","file":"Sudoku.v"}
Ongoing Proof History: ``` Proof using A_coll B_coll A_conn B_conn L_AB. exists iso. split. - exact: Bijective can_iso_inv can_iso. - move => x a. apply/B_coll => w. rewrite -[_ (iso x) a]/(delta (iso x) [::a]). by rewrite -delta_cat -!delta_iso_inv !can_iso_inv. - move => x. by rewrite -[iso x]/(delta _ [::]) delta_iso. - ``` Proof State: ``` 1 subgoal char : finType A, B : dfa L_AB : dfa_lang A =i dfa_lang B A_coll : collapsed A B_coll : collapsed B A_conn : connected A B_conn : connected B ============================ iso (dfa_s A) = dfa_s B ``` Next Tactic: ```
apply/B_coll => w. ```
{"package":"coq-reglang","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/RegLang\/minimization.v"}
Proof State: ``` 1 subgoal cs : compspecs Qtemp : PTree.t val Qvar : PTree.t (type * val) GV : option globals a : expr Delta : tycontext P : list Prop Q : list localdef R, R' : list mpred fs : funspec argsig : list type retty' : type cc : calling_convention ts : list Type A : rmaps.TypeTree Pre : forall ts : list Type, functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec ts (ArgsTT A)) mpred Post : forall ts : list Type, functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec ts (AssertTT A)) mpred NEPre : args_super_non_expansive Pre NEPost : super_non_expansive Post witness : functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec ts A) mpred Frame : list mpred bl : list expr Ppre : list Prop Rpre : list mpred GV' : option globals gv : list globals args, vl : list val SETUP : call_setup2 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty' cc ts A Pre Post NEPre NEPost bl vl witness Frame Ppre Rpre GV' gv args retty : type Espec : OracleKind ret : ident ret' : positive Post2 : environ -> mpred Qnew : list localdef B : Type Ppost : B -> list Prop F : B -> val Rpost : B -> list mpred RETinit : (temp_types Delta) ! ret' = Some retty' OKretty : check_retty retty OKretty' : check_retty retty' NEUTRAL : is_neutral_cast retty' retty = true NEret : ret <> ret' POST1 : Post ts witness = (EX vret : B, PROPx (Ppost vret) (RETURN (F vret) (SEPx (Rpost vret)))%assert3)%argsassert DELETE : remove_localdef_temp ret Q = Qnew DELETE' : remove_localdef_temp ret' Q = Q H0 : Post2 = (EX vret : B, PROPx (P ++ Ppost vret) (LOCALx (temp ret (F vret) :: Qnew) (SEPx (Rpost vret ++ Frame))))%argsassert PPRE : fold_right_and True Ppre vret : B rho : environ H : tc_environ Delta rho H1 : fold_right and True (P ++ Ppost vret) H2 : (` and) ((` (eq (F vret))) (eval_id ret')) (` (F vret <> Vundef)) rho H3 : fold_right (fun (x x0 : environ -> Prop) (x1 : environ) => x x1 /\ x0 x1) (fun _ : environ => True) (map locald_denote Q) rho ============================ fold_right_sepcon (Rpost vret ++ Frame) |-- denote_tc_assert (tc_andp (tc_bool (is_neutral_cast (implicit_deref retty) retty) (invalid_cast retty retty)) (isCastResultType (implicit_deref retty) retty (Ecast (Etempvar ret' retty') retty))) rho ``` Ongoing Proof History: ``` Proof. intros. eapply semax_seq'. eapply semax_call_id1_wow; try eassumption; auto. unfold typeof_temp; rewrite RETinit; reflexivity. apply extract_exists_pre; intro vret. eapply semax_pre_post'; [ | | apply semax_set_forward]. + eapply derives_trans; [ | apply now_later ]. instantiate (1:= (PROPx (P ++ Ppost vret) (LOCALx (temp ret' (F vret) :: Qnew) (SEPx (Rpost vret ++ Frame))))). apply andp_right; [apply andp_right |]. - unfold tc_expr. simpl typecheck_expr. rewrite RETinit. simpl @fst. replace ((is_neutral_cast retty' retty' || same_base_type retty' retty')%bool) with true by (clear- OKretty'; destruct retty' as [ | [ | | |] [| ]| [|] | [ | ] | | | | | ]; try contradiction; unfold is_neutral_cast; rewrite ?eqb_type_refl; reflexivity). rewrite denote_tc_assert_andp. apply andp_right; [| intros rho; apply neutral_isCastResultType; auto]. apply PQR_denote_tc_initialized; auto. - unfold tc_temp_id, typecheck_temp_id. unfold typeof_temp in TYret. destruct ((temp_types Delta) ! ret); inversion TYret; clear TYret; try subst t. go_lowerx. ``` Next Tactic: ```
repeat rewrite <LOOKUP>denote_tc_assert_andp : forall {CS : compspecs} (a b : tc_assert), denote_tc_assert (tc_andp a b) = denote_tc_assert a && denote_tc_assert b</LOOKUP>; simpl. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/floyd\/call_lemmas.v"}
Ongoing Proof History: ``` Proof. unfold map_default_eq, interp_map. repeat intro. revert x y H s1 s2 H0. einit. ecofix CH. intros. rewrite! unfold_interp_state. punfold H0. red in H0. revert s1 s2 H1. induction H0; intros; subst; simpl; pclearbot. - eret. - etau. - ebind. apply pbc_intro_h with (RU := prod_rel (@eq_map _ _ _ _ d) eq). { - unfold case_. + unfold over. - unfold Case_sum1, case_sum1. + destruct (case e). - destruct e. + - apply handle_map_eq. assumption. + - - unfold pure_state. + unfold trigger, Trigger_State, trigger, Trigger_ITree, ITree.trigger. pstep. + cbn. + red. + cbn. econstructor. intros. constructor. pfold. ? econstructor. ? constructor; auto. ? } ``` Commit Diff: ``` diff --git a/theories/Core/Subevent.v b/theories/Core/Subevent.v index 42a9534..e0c634e 100644 --- a/theories/Core/Subevent.v +++ b/theories/Core/Subevent.v @@ -4,0 +5,3 @@ +From Coq Require +Import Setoid Morphisms. + @@ -8 +11,6 @@ Require Import -Basics.Basics Basics.CategoryOps +Basics.Basics +Basics.CategoryOps +Basics.CategoryTheory +Basics.CategoryFacts +Basics.Function +Basics.FunctionFacts @@ -11 +19,72 @@ Indexed.Sum -Indexed.Function. +Indexed.Function +Indexed.FunctionFacts. + + +From ExtLib Require +Import Monad. + +Import MonadNotation. +Import CatNotations. +Open Scope cat_scope. + + + +Set Implicit Arguments. + + +Inductive option1 (A : Type +-> Type) X :Type +:= | None1 | +Some1 (_: A X). +Arguments None1 {_ _}. +Arguments Some1 {_} [_]. + +Section Subevent. + + +Class Subevent {A B C : +Type -> Type} : Type := +{ split_E : B ~> A ++' C ; merge_E : (A ++' C) ~> B }. + +Class Subevent_wf {A B C} +(sub: @Subevent A B C): +Prop := { sub_iso :> +Iso _ split_E merge_E }. + +Arguments Subevent : clear implicits. +Arguments split_E {_ _ _ _} [_]. +Arguments merge_E {_ _ _ _} [_]. +Definition inj1 {A B C} `{Subevent A B C} : A ~> B := inl_ >>> merge_E. +Definition inj2 {A B C} `{Subevent A B C} : C ~> B := inr_ >>> merge_E. +Definition case {A B C} `{Subevent A B C} : B ~> (A +' C) := split_E. + +End Subevent. + +Arguments Subevent : clear implicits. +Arguments case {_ _ _ _} [_]. +Arguments inj1 {_ _ _ _} [_]. +Arguments inj2 {_ _ _ _} [_]. + +Notation "A +? C -< B" := (Subevent A +B C) (at level 89, left associativity) : type_scope. + +Lemma case_inj1: forall {A B C: Type -> Type} `{Sub: A +? C -< B} +{SubWF: Subevent_wf Sub} {T} (e: A T), case (inj1 e) = inl_ _ e. +Proof. +intros. +pose proof (iso_epi IFun T (inl_ _ e)). +auto. +Qed. + +Lemma case_inj2: forall {A B C: Type -> Type} `{Sub: A +? C -< B} +{SubWF: Subevent_wf Sub} {T} (e: C T), case (inj2 e) = inr_ _ e. +Proof. +intros. +pose proof (iso_epi IFun T (inr_ _ e)). +auto. +Qed. + +Section Trigger. + @@ -16,0 +96 @@ Indexed.Function. +Class Trigger (E: Type -> Type) (M: Type -> Type) := trigger: E ~> M. @@ -17,0 +98,2 @@ Indexed.Function. +End Trigger. +Arguments trigger {E M Trigger} [T]. @@ -19,0 +102 @@ Indexed.Function. +Notation vis e k := (Vis (inj1 e) k). @@ -25,0 +109,35 @@ Indexed.Function. +Definition over {A B C M : Type -> Type} +{S:A +? C -< B} {T:Trigger C M} (f : +A ~> M) : B ~> M := fun t +b => match case b with | inl1 a => +f _ a | inr1 c => trigger c end. + ``` Proof State: ``` 1 subgoal K, V : Type map : Type M : Map K V map MOk : MapOk eq M Kdec : RelDec eq KdecOk : RelDec_Correct Kdec R : Type E : Type -> Type F : Type -> Type d : V SE : mapE K d +? F -< E RR : R -> R -> Prop gL' : itree F (map * R) -> itree F (map * R) -> Prop INCL : forall x0 x1 : itree F (map * R), bot2 x0 x1 -> gL' x0 x1 gH' : itree F (map * R) -> itree F (map * R) -> Prop INCH : forall x0 x1 : itree F (map * R), bot2 x0 x1 -> gH' x0 x1 CHL : forall x x0 : itree E R, eutt RR x x0 -> forall x2 x3 : map, eq_map x2 x3 -> gL' (interp_state (over (handle_map (V:=V))) x x2) (interp_state (over (handle_map (V:=V))) x0 x3) CHH : forall x x0 : itree E R, eutt RR x x0 -> forall x2 x3 : map, eq_map x2 x3 -> gH' (interp_state (over (handle_map (V:=V))) x x2) (interp_state (over (handle_map (V:=V))) x0 x3) x, y : itree E R u : Type e : E u k1, k2 : u -> itree E R REL : forall v : u, paco2 (eqit_ RR true true id) bot2 (k1 v) (k2 v) s1, s2 : map H1 : eq_map s1 s2 f : F u v : u ============================ eqit_ (prod_rel eq_map eq) true true id (upaco2 (eqit_ (prod_rel eq_map eq) true true id) bot2) (ITree.subst (fun t : u => Ret (s1, t)) (Ret v)) (ITree.subst (fun t : u => Ret (s2, t)) (Ret v)) ``` Next Tactic: ```
red; cbn. ```
{"final_commit":"440b18da2c80560f3454b2cbc1736209a76d64ad","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-fe0513e4d0c57354d47c6ed811e0d6a0ce65670d-440b18da2c80560f3454b2cbc1736209a76d64ad-8_10_2-8_10_2-1.git.json","initial_commit":"fe0513e4d0c57354d47c6ed811e0d6a0ce65670d","file":"theories\/Events\/MapDefaultFacts.v"}
Proof State: ``` 6 subgoals h : R H : Rabs h <= 1 H0 : 0 <= 1 + h Hlt : h < 0 ============================ sqrt (1 + h)Β² - 1 < 0 subgoal 2 is: sqrt (1 + h) - 1 < 0 subgoal 3 is: Rabs (sqrt (1 + h) - 1) <= Rabs (sqrt (1 + h)Β² - 1) subgoal 4 is: Rabs (sqrt (1 + h) - 1) <= Rabs (sqrt (1 + h)Β² - 1) subgoal 5 is: Rabs (sqrt (1 + h)Β² - 1) <= Rabs h subgoal 6 is: 0 <= 1 + h ``` Ongoing Proof History: ``` Proof. intros; cut (0 <= 1 + h). intro; apply Rle_trans with (Rabs (sqrt (Rsqr (1 + h)) - 1)). destruct (total_order_T h 0) as [[Hlt|Heq]|Hgt]. repeat rewrite Rabs_left. unfold Rminus; do 2 rewrite <- (Rplus_comm (-1)). change (-1) with (-(1)). do 2 rewrite Ropp_plus_distr; rewrite Ropp_involutive; apply Rplus_le_compat_l. apply Ropp_le_contravar; apply sqrt_le_1. apply Rle_0_sqr. apply H0. pattern (1 + h) at 2; rewrite <- Rmult_1_r; unfold Rsqr; apply Rmult_le_compat_l. apply H0. pattern 1 at 2; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; assumption. ``` Next Tactic: ```
apply <LOOKUP>Rplus_lt_reg_l : forall r r1 r2 : R, r + r1 < r + r2 -> r1 < r2</LOOKUP> with 1; rewrite <LOOKUP>Rplus_0_r : forall r : R, r + 0 = r</LOOKUP>; rewrite <LOOKUP>Rplus_comm : forall r1 r2 : R, r1 + r2 = r2 + r1</LOOKUP>; unfold Rminus; rewrite <LOOKUP>Rplus_assoc : forall r1 r2 r3 : R, r1 + r2 + r3 = r1 + (r2 + r3)</LOOKUP>; rewrite <LOOKUP>Rplus_opp_l : forall r : R, - r + r = 0</LOOKUP>; rewrite <LOOKUP>Rplus_0_r : forall r : R, r + 0 = r</LOOKUP>. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Reals\/Sqrt_reg.v"}
Ongoing Proof History: ``` Proof. intros. apply semax_seq_inv in H. destruct H as [Q [? ?]]. eapply (AuxDefs.semax_loop _ P Q). ``` Proof State: ``` 2 subgoals CS : compspecs Espec : OracleKind Delta : tycontext P : environ -> mpred body, incr : statement R : ret_assert Q : environ -> mpred H : semax Delta P body (overridePost Q (loop_nocontinue_ret_assert P R)) H0 : semax Delta Q incr (loop_nocontinue_ret_assert P R) ============================ AuxDefs.semax Delta P body (loop1_ret_assert Q R) subgoal 2 is: AuxDefs.semax Delta Q incr (loop2_ret_assert P R) ``` Next Tactic: ```
+ ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/floyd\/SeparationLogicAsLogic.v"}
Commit Diff: ``` diff --git a/theories/Aux.v b/theories/Aux.v index d240627..c7e8186 100644 --- a/theories/Aux.v +++ b/theories/Aux.v @@ -27 +26,0 @@ - @@ -30,0 +30 @@ Require Export List. +Export ListNotations. @@ -85,11 +84,0 @@ Hint Resolve le_minus: arith. -Section EqBool. - -Definition eq_bool_dec : forall a b : bool, {a = b} + {a <> b}. -Proof. -intros a b; case a; case b; simpl in |- *; auto. -right; red in |- *; intros; discriminate. -Defined. - -End EqBool. - - @@ -231 +220 @@ intros a1 l H [H1| H1]; auto. -exists (nil (A:=A)); exists l; simpl in |- *; auto. +exists []; exists l; simpl in |- *; auto. @@ -270,4 +259,4 @@ Theorem app_inv_app : forall l1 l2 l3 l4 a, -l1 ++ l2 = l3 ++ a :: l4 --> (exists l5 : list A, l1 = l3 -++ a :: l5) \/ (exists l5 : -_, l2 = l5 ++ a :: l4). +l1 ++ l2 = l3 ++ a :: +l4 -> (exists l5 : list A, l1 += l3 ++ a :: l5) \/ (exists +l5, l2 = l5 ++ a :: l4). @@ -288,2 +277,2 @@ Theorem app_inv_app2 : forall l1 l2 l3 l4 a b, l1 -(exists l5 : list A, l1 = l3 ++ a :: -b :: l5) \/ (exists l5 : _, l2 = l5 +(exists l5 : list A, l1 = l3 ++ a +:: b :: l5) \/ (exists l5, l2 = l5 @@ -291 +280 @@ b :: l5) \/ (exists l5 : _, l2 = l5 -++ a :: nil /\ l2 = b :: l4. +++ a :: [] /\ l2 = b :: l4. @@ -310,7 +299,7 @@ Qed. -Theorem same_length_ex : forall (a : A) l1 -l2 l3, length (l1 ++ a :: l2) -= length l3 -> exists l4 : -_, (exists l5 : _, (exists b -: B, length l1 = length l4 -/\ length l2 = length l5 /\ -l3 = l4 ++ b :: l5)). +Theorem same_length_ex : forall (a : A) +l1 l2 l3, length (l1 ++ a +:: l2) = length l3 -> exists +l4, (exists l5, (exists b : B, +length l1 = length l4 /\ length +l2 = length l5 /\ l3 += l4 ++ b :: l5)). @@ -320 +309 @@ intros l2 l3; case l3; simpl in |- *; try (intros; discriminate). -intros b l H; exists (nil (A:=B)); exists l; exists b; repeat (split; auto). +intros b l H; exists []; exists l; exists b; repeat (split; auto). @@ -341,3 +330,3 @@ Qed. -Theorem in_map_fst_inv : forall a (l : list (B -* C)), In a (map (fst (B:=_)) l) -> -exists c : _, In (a, c) l. +Theorem in_map_fst_inv : forall a (l : list +(B * C)), In a (map (fst (B:=_)) +l) -> exists c, In (a, c) l. @@ -375,2 +364,2 @@ Theorem in_flat_map_ex : forall (l : list B) (f : B --> list C) a, In a (flat_map f l) -> exists -b : _, In b l /\ In a (f b). +-> list C) a, In a (flat_map f l) -> +exists b, In b l /\ In a (f b). @@ -397 +386 @@ list C := fun l2 -nil => nil | a +[] => [] | a @@ -399 +388 @@ nil => nil | a -with | nil => nil +with | [] => [] @@ -431 +420 @@ match n with | O -=> nil | S n1 +=> [] | S n1 @@ -433 +422 @@ match n with | O -nil => nil | a +[] => [] | a @@ -482 +471 @@ match n with | O -nil => nil | a +[] => [] | a @@ -512 +501 @@ Qed. -Theorem skip_n_id : forall l : list A, skip_n l (length l) = nil. +Theorem skip_n_id : forall l : list A, skip_n l (length l) = []. @@ -533 +522 @@ Theorem exist_first_max : forall l : list -nat, l <> nil -> exists a +nat, l <> [] -> exists a @@ -544,2 +533,2 @@ intros a l0; case l0. -intros H H0; exists a; exists (nil (A:=nat)); exists (nil -(A:=nat)); repeat (split; simpl in |- *; auto with datatypes). +intros H H0; exists a; exists []; exists []; +repeat (split; simpl in |- *; auto with datatypes). @@ -552,2 +541,2 @@ case (le_or_lt a1 a); intros HH4; auto. -exists a; exists (nil (A:=nat)); exists (n -:: l1); repeat (split; auto with datatypes). +exists a; exists []; exists (n :: +l1); repeat (split; auto with datatypes). ``` Proof State: ``` 2 subgoals A : Type l1 : list A a : A l : list A H : forall l2 : list A, permutation (l ++ l2) (l2 ++ l) l2 : list A ============================ permutation (l ++ [a] ++ l2) (l ++ l2 ++ [a]) subgoal 2 is: (l2 ++ [a]) ++ l = l2 ++ a :: l ``` Ongoing Proof History: ``` Proof using. intros l1; elim l1; auto. intros; rewrite <- app_nil_end; auto. intros a l H l2. - replace (l2 ++ a :: l) with ((l2 ++ a :: nil) ++ l). + replace (l2 ++ a :: l) with ((l2 ++ a :: []) ++ l). - apply permutation_trans with (l ++ l2 ++ a :: nil); auto. + apply permutation_trans with (l ++ l2 ++ a :: []); auto. - apply permutation_trans with (((a :: nil) ++ l2) ++ l); auto. + apply permutation_trans with (((a :: []) ++ l2) ++ l); auto. simpl in |- *; auto. - apply permutation_trans with (l ++ (a :: nil) ++ l2); auto. + apply permutation_trans with (l ++ (a :: []) ++ l2); auto. apply permutation_sym; auto. ? replace (l2 ++ a :: l) with ((l2 ++ a :: nil) ++ l). ? apply permutation_app_comp; auto. ? elim l2; simpl in |- *; auto. ``` Next Tactic: ```
replace (l2 ++ a :: l) with ((l2 ++ a :: []) ++ l). ```
{"final_commit":"6e3f37b2113e34f74c6b5a6ff2c7346a9cdf9e4e","project":"huffman","repair_file":"\/data\/coq-pearls\/repairs\/huffman\/repair-huffman-773c1feea03edc5e845ecafc7c9752fa403e7faf-6e3f37b2113e34f74c6b5a6ff2c7346a9cdf9e4e-8_11_2-8_11_2-4.git.json","initial_commit":"773c1feea03edc5e845ecafc7c9752fa403e7faf","file":"theories\/Permutation.v"}
Ongoing Proof History: ``` Proof. revert is is'. induction i as [ | i]. - intros is is'. rewrite natminuseqn. rewrite natminuseqn. apply is. - intros is is'. induction (natlthorgeh n (S i)) as [H | H]. + assert (e : n - S i = 0). { apply minuseq0. exact (natlthtoleh _ _ H). } rewrite e. apply (natlthandplusrinv _ _ (S i)). rewrite natplusl0. rewrite minusplusnmm. apply is'. apply natlthtoleh. apply is'. + apply (natlthandplusrinv _ _ (S i)). rewrite (minusplusnmm m (S i)). ``` Proof State: ``` 2 subgoals n, m, i : nat IHi : n < m β†’ i < m β†’ n - i < m - i is : n < m is' : S i < m H : n β‰₯ S i ============================ n - S i + S i < m subgoal 2 is: m β‰₯ S i ``` Next Tactic: ```
* ```
{"package":"coq-unimath","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/UniMath\/Foundations\/NaturalNumbers.v"}
Ongoing Proof History: ``` Proof. split=> [[B eqrUV injB homB] | [f injf homf defV]]. have: \rank (U *m val_submod (in_submod U 1%:M *m B)) = \rank U. do 2!rewrite mulmxA mxrankMfree ?row_base_free //. by rewrite -(eqmxMr _ (val_submod1 U)) -in_submodE val_submodK mxrank1. case/complete_unitmx => f injf defUf; exists f => //. apply/hom_mxP=> x Gx; rewrite -defUf -2!mulmxA -(val_submodJ modV) //. ``` Proof State: ``` 3 subgoals F : fieldType gT : finGroupType G : {group gT} n : nat rG : mx_representation F G n U, V : 'M_n modU : mxmodule (G:=G) rG U modV : mxmodule (G:=G) rG V B : 'M_(\rank U, \rank V) eqrUV : \rank U = \rank V injB : row_free (F:=F) B homB : forall x : gT, x \in G -> submod_repr (G:=G) (rG:=rG) (U:=U) modU x *m B = B *m submod_repr (G:=G) (rG:=rG) (U:=V) modV x f : 'M_n injf : f \in unitmx defUf : U *m val_submod (in_submod U 1%:M *m B) = U *m f x : gT Gx : x \in G ============================ U *m (rG x *m f) = U *m val_submod (in_submod U 1%:M *m B *m submod_mx (G:=G) (rG:=rG) (U:=V) modV x) subgoal 2 is: (U *m f :=: V)%MS subgoal 3 is: mx_rsim (submod_repr (G:=G) (rG:=rG) (U:=U) modU) (submod_repr (G:=G) (rG:=rG) (U:=V) modV) ``` Next Tactic: ```
rewrite -(<LOOKUP>mulmxA : forall [R : ringType] [m n p q : nat] (A : 'M_(m, n)) (B : 'M_(n, p)) (C : 'M_(p, q)), A *m (B *m C) = A *m B *m C</LOOKUP> _ B) -homB // <LOOKUP>val_submodE : forall [n : nat] [U : 'M_n] [m : nat] (W : 'M_(m, \rank U)), val_submod W = W *m val_submod 1%:M</LOOKUP> 3!(<LOOKUP>mulmxA : forall [R : ringType] [m n p q : nat] (A : 'M_(m, n)) (B : 'M_(n, p)) (C : 'M_(p, q)), A *m (B *m C) = A *m B *m C</LOOKUP> U) (<LOOKUP>mulmxA : forall [R : ringType] [m n p q : nat] (A : 'M_(m, n)) (B : 'M_(n, p)) (C : 'M_(p, q)), A *m (B *m C) = A *m B *m C</LOOKUP> _ _ B). ```
{"package":"coq-mathcomp-character","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/mathcomp\/character\/mxrepresentation.v"}
Commit Diff: ``` diff --git a/Div.v b/Div.v index 7e7d694..e83d601 100644 --- a/Div.v +++ b/Div.v @@ -57,2 +57,2 @@ n) p) (c2 := mod n p); try apply mod_lt; auto with arith. -rewrite mult_plus_distr_r; rewrite <- plus_assoc; repeat -rewrite <- div_mod_correct; auto with arith. +rewrite mult_plus_distr_r, <- plus_assoc; repeat rewrite +<- div_mod_correct; auto with arith. @@ -67,4 +67,2 @@ intros n m p H; apply plus_reg_l with (div (p * m + n) p * p). -rewrite <- div_mod_correct; auto. -rewrite div_mult_comp; auto. -rewrite mult_plus_distr_r; rewrite (mult_comm p); rewrite <- plus_assoc. -eq_tac; apply div_mod_correct; auto. +rewrite <- div_mod_correct, div_mult_comp, mult_plus_distr_r, (mult_comm p), <- plus_assoc by assumption. +f_equal. now apply div_mod_correct. diff --git a/ListAux.v b/ListAux.v index 82a8d82..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -76 +76 @@ exists (nil (A:=A)); exists l; simpl; auto. -eq_tac; auto. +f_equal; auto. @@ -78 +78 @@ case H; auto; intros l1 [l2 Hl2]; exists (a1 :: l1); exists l2; simpl; auto. -eq_tac; auto. +f_equal; auto. @@ -146 +146 @@ intros a l H l2 l3 l4 a0; case l3; simpl. -intros H0; left; exists l; eq_tac; injection H0; auto. +intros H0; left; exists l; f_equal; injection H0; auto. @@ -150 +150 @@ intros [l5 H1]. -left; exists l5; eq_tac; injection H0; auto. +left; exists l5; f_equal; injection H0; auto. @@ -165,2 +165,2 @@ intros H0; right; right; injection H0; split; auto. -eq_tac; auto. -intros b0 l0 H0; left; exists l0; injection H0; intros; (repeat eq_tac); auto. +f_equal; auto. +intros b0 l0 H0; left; exists l0; injection H0; intros; (repeat f_equal); auto. @@ -169 +169 @@ injection H0; auto. -intros [l5 HH1]; left; exists l5; eq_tac; auto; injection H0; auto. +intros [l5 HH1]; left; exists l5; f_equal; auto; injection H0; auto. @@ -171 +171 @@ intros [H1|[H1 H2]]; auto. -right; right; split; auto; eq_tac; auto; injection H0; auto. +right; right; split; auto; f_equal; auto; injection H0; auto. @@ -190 +190 @@ exists (b :: l4); exists l5; exists b1; (repeat (simpl; split; auto)). -eq_tac; auto. +f_equal; auto. @@ -237 +237 @@ intros H4 H5; split; auto. -eq_tac; auto. +f_equal; auto. @@ -278 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app; rewrite length_map; rewrite H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index b9797d9..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -138,2 +138 @@ intros a b c; elim c; simpl; auto. -intros n H; rewrite jump_nil; rewrite -take_nil; rewrite H; auto with arith. +intros n H; rewrite jump_nil, take_nil, H; auto with arith. @@ -146,2 +145,2 @@ intros k Rec i j s H; -rewrite length_app; rewrite length_take1; auto with arith. -eq_tac; auto. +rewrite length_app, length_take1; auto with arith. +f_equal; auto. @@ -199 +198 @@ intros l; elim l; simpl; auto with datatypes. -intros; eq_tac; auto. +intros; f_equal; auto. @@ -206 +205 @@ intros H; contradict H; auto with arith. -intros n1 H; eq_tac; auto with arith. +intros n1 H; f_equal; auto with arith. @@ -219 +218 @@ intros a l1 Rec n; case n; auto; clear n. -simpl length; intros n H; simpl; eq_tac; auto with arith. +simpl length; intros n H; simpl; f_equal; auto with arith. diff --git a/OrderedList.v b/OrderedList.v ``` Ongoing Proof History: ``` Proof. intros n; elim n; simpl in |- *; auto. intros l1 l2; case l2. - intros H H0; rewrite perm_nil_inv with (1 := H0); auto with datatypes. + intros H H0; rewrite (Permutation_nil (Permutation_sym H0)); auto with datatypes. simpl in |- *; intros; discriminate. intros n0 H l1; case l1. - intros l2 H0 H1; rewrite perm_nil_inv with (1 := permutation_sym _ _ H1) in H0; discriminate. + intros l2 H0 H1; rewrite (Permutation_nil H1) in H0; discriminate. clear l1; intros a1 l1 l2 H1 H2. case (split_one_in_ex a1 l2); auto. - apply permutation_in with (1 := H2); auto with datatypes. + apply Permutation_in with (1 := H2); auto with datatypes. intros x H0. apply in_flat_map with (b := (a1, x)); auto. apply in_map; simpl in |- *. apply H; auto. apply eq_add_S. apply trans_equal with (1 := H1). change (length l2 = length (a1 :: x)) in |- *. ? apply permutation_length; auto. ? apply permutation_sym; apply split_one_permutation; auto. ? apply permutation_inv with (a := a1). ``` Proof State: ``` 2 goals A : Set n, n0 : nat H : forall l1 l2 : list A, n0 = length l2 -> Permutation l1 l2 -> In l1 (all_permutations_aux l2 n0) a1 : A l1, l2 : list A H1 : S n0 = length l2 H2 : Permutation (a1 :: l1) l2 x : list A H0 : In (a1, x) (split_one l2) ============================ length l2 = length (a1 :: x) goal 2 is: Permutation l1 x ``` Next Tactic: ```
apply <LOOKUP>Permutation_length : forall [A : Type] [l l' : list A], Permutation l l' -> length l = length l'</LOOKUP>; auto. ```
{"final_commit":"82eb0678991955dfa8f12720d652ad5adb465c3e","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-b5543771d6bdeab13ec58ac6c8d281815d96ed62-82eb0678991955dfa8f12720d652ad5adb465c3e-8_15_2-8_15_2-37.git.json","initial_commit":"b5543771d6bdeab13ec58ac6c8d281815d96ed62","file":"Permutation.v"}
Ongoing Proof History: ``` Proof. ginit. ? gcofix CIH. ? intros x y H. ? rewrite itree_eta, (itree_eta (translate h y)), !unfold_translate, <-!itree_eta. ``` Proof State: ``` 1 subgoal E : Type -> Type F : Type -> Type R : Type h : forall T : Type, E T -> F T ============================ forall x y : itree E R, x β‰… y -> gpaco2 (eqit_ eq false false id) (eqitC eq false false) bot2 bot2 (translate h x) (translate h y) ``` Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index b911a90..32f56a6 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6,2 +6 @@ Require Import -Program Classes.Morphisms -Setoids.Setoid +Classes.Morphisms Setoids.Setoid @@ -24 +23,2 @@ Eq.Eq -Eq.UpToTaus. +Eq.UpToTaus +Eq.Paco2. @@ -68 +68 @@ Proof. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert A B C f g a0. -ginit. gcofix CIH. intros. +revert f g a0. +ginit. pcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -277 +277 @@ revert a. -gcofix CIH'. intros. +pcofix CIH'. intros. @@ -337,2 +337 @@ etau. -specialize (CIH xa). -cbn in CIH. +specialize (CIHL xa). cbn in CIHL. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 21ac7e0..b6665d0 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29 +29,2 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition. +Core.ITreeDefinition +Eq.Paco2. @@ -165,0 +167,54 @@ Hint Unfold id: core. +Lemma eqitF_inv_VisF_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} +t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 +b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 +/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 += TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). +Proof. +refine (fun H => match H +in eqitF _ _ _ _ +_ _ t2 return match t2 +return Prop with | VisF e2 +k2 => _ | _ +=> True end with | +EqVis _ _ _ _ +_ _ _ _ _ +=> _ | _ => +_ end); try exact I. +- left; eauto. +- destruct i0; eauto. +Qed. + +Lemma eqitF_inv_VisF_weak {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 +(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 +-> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists +p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. +Proof. +refine (fun H => match H in +eqitF _ _ _ _ _ t1 +t2 return match t1, t2 return Prop +with | VisF e1 k1, VisF e2 +k2 => _ | _, _ => +True end with | EqVis _ +_ _ _ _ _ _ +_ _ => _ | _ +=> _ end); try exact I. +- exists eq_refl; cbn; eauto. +- destruct i; exact I. +Qed. + +Lemma eqitF_inv_VisF {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 +vclo sim} X (e : E X) (k1 : X -> _) (k2 +: X -> _) : eqitF RR b1 b2 vclo sim (VisF e +k1) (VisF e k2) -> forall x, vclo sim (k1 x) (k2 x). +Proof. +intros H. dependent destruction H. assumption. +Qed. + +Lemma eqitF_VisF_gen {E R1 R2} {RR : R1 -> R2 -> Prop} {b1 b2 vclo sim} {X1 +X2} (p : X1 = X2) (e1 : E X1) (k1 : X1 -> _) (e2 : +E X2) (k2 : X2 -> _) : eqeq E p e1 e2 -> pweqeq (vclo sim) +p k1 k2 -> eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2). +Proof. +destruct p; intros <-; cbn; constructor; auto. +Qed. + @@ -215,2 +270,2 @@ split. -pstep. punfold H1. red in H1. red. -hinduction H1 before CIH; intros; eauto. +pstep. punfold H0. red in H0. red. +hinduction H0 before CIH; intros; eauto. @@ -223,2 +278,2 @@ red in REL. pclearbot. pinversion REL. -pstep. punfold H1. red in H1. red. -hinduction H1 before CIH; intros; eauto. +pstep. punfold H0. red in H0. red. +hinduction H0 before CIH; intros; eauto. @@ -326 +381 @@ econstructor. pmonauto. -intros. dependent destruction PR. +intros. destruct PR. @@ -338 +393 @@ pclearbot. econstructor. gclo. -econstructor; cycle -1; eauto with paco. +econstructor; eauto with paco. @@ -340,3 +395,3 @@ econstructor; cycle -1; eauto with paco. -hinduction EQVl before r; intros; subst; try dependent destruction Heqx; try inv CHECK; eauto. -remember (VisF e0 k3) as y. -hinduction EQVr before r; intros; subst; try dependent destruction Heqy; try inv CHECK; eauto. +hinduction EQVl before r; intros; try discriminate Heqx; eauto; inv_Vis. +remember (VisF e k3) as y. +hinduction EQVr before r; intros; try discriminate Heqy; eauto; inv_Vis. ``` Next Tactic: ```
pcofix CIH. ```
{"final_commit":"7f00358aeb230f7970571fddaa8b256375910c62","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-672193e2507cf3326b834f5fa47b7518af829b4b-7f00358aeb230f7970571fddaa8b256375910c62-8_10_2-8_10_2-93.git.json","initial_commit":"672193e2507cf3326b834f5fa47b7518af829b4b","file":"theories\/Interp\/TranslateFacts.v"}
Ongoing Proof History: ``` Proof. repeat split. - intros X Y f g Ξ± ; cbn. rewrite !vassocr. rewrite vcomp_lunitor. rewrite !vassocl. rewrite rinvunitor_natural. rewrite rwhisker_hcomp. apply idpath. - intros X ; cbn. rewrite id2_left. rewrite !vassocr. rewrite vcomp_lunitor. rewrite !vassocl. rewrite lunitor_runitor_identity. rewrite rinvunitor_natural. rewrite lunitor_V_id_is_left_unit_V_id. rewrite rwhisker_hcomp. apply idpath. - intros X Y Z f g ; cbn. rewrite id2_left. rewrite <- lwhisker_vcomp, <- rwhisker_vcomp. ``` Proof State: ``` 1 subgoal B₁, Bβ‚‚ : bicat F : psfunctor B₁ Bβ‚‚ X, Y, Z : B₁ f : B₁ ⟦ X, Y ⟧ g : B₁ ⟦ Y, Z ⟧ ============================ (id₁ (F X) β—ƒ (pr222 (pr1 F)) X Y Z f g) β€’ (lunitor (# F (f Β· g)) β€’ rinvunitor (# F (f Β· g))) = ((((lassociator (id₁ (F X)) (# F f) (# F g) β€’ ((lunitor (# F f) β–Ή # F g) β€’ (rinvunitor (# F f) β–Ή # F g))) β€’ rassociator (# F f) (id₁ (F Y)) (# F g)) β€’ ((# F f β—ƒ lunitor (# F g)) β€’ (# F f β—ƒ rinvunitor (# F g)))) β€’ lassociator (# F f) (# F g) (id₁ (F Z))) β€’ ((pr222 (pr1 F)) X Y Z f g β–Ή id₁ (F Z)) ``` Next Tactic: ```
rewrite !<LOOKUP>vassocr : ∏ (C : prebicat) (a b : C) (f g h k : C ⟦ a, b ⟧) (x : f ==> g) (y : g ==> h) (z : h ==> k), x β€’ (y β€’ z) = (x β€’ y) β€’ z</LOOKUP>. ```
{"package":"coq-unimath","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/UniMath\/Bicategories\/Transformations\/Examples\/Unitality.v"}
Ongoing Proof History: ``` intros l1 l2 H1 Hi; case ulist_incl_permutation with ( 2 := Hi ); auto. intros l3 Hl3; rewrite Permutation_length with ( 1 := Hl3 ); auto. ? rewrite app_length; simpl; auto with arith. ? Qed. ``` Proof State: ``` 1 goal A : Set eqA_dec : forall a b : A, {a = b} + {a <> b} l1, l2 : list A H1 : ulist l1 Hi : incl l1 l2 l3 : list A Hl3 : Permutation l2 (l1 ++ l3) ============================ length l1 <= length (l1 ++ l3) ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 769776a..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -130,0 +131,6 @@ Qed. +Theorem length_app: forall (l1 l2 : list A), length +(l1 ++ l2) = length l1 + length l2. +Proof. +apply app_length. +Qed. + @@ -272 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite app_length, length_map, H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index 7a13f04..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite app_length, length_take1; auto with arith. +rewrite length_app, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index f9e372e..5083f1b 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm... +apply div_lt; rewrite mult_comm; auto. @@ -677,2 +677,6 @@ apply div_lt; rewrite mult_comm... -repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... +repeat (rewrite (fun x => +mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp; auto. +rewrite (mod_small (div y w) h); auto. +rewrite (div_is_0 (div y w) h); auto. +rewrite plus_0_r. @@ -699,3 +703,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl... -clear n H1 H2 U1. -+ intros h1; case h1; simpl... +intros U3 n; generalize h; elim n; simpl; +auto with arith; clear n H1 H2 U1. ++ intros h1; case h1; simpl; auto. @@ -709,2 +713,3 @@ apply sym_equal; apply take_nth... -** pose proof (mod_lt y w). -lia. +** apply le_trans with (1 := H1)... +apply le_trans with (2 := U3). +apply lt_le_weak; apply mod_lt... @@ -721 +726 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H3. +case (le_or_lt (length l) w); intros H1. @@ -723 +728,2 @@ case (le_or_lt (length l) w); intros H3. -** rewrite length_take_small, jump_too_far... +** rewrite length_take_small... +rewrite jump_too_far. @@ -726,2 +732,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H3)... -*** apply le_trans with (1 := H3)... +apply le_trans with (1 := H1)... +*** apply le_trans with (1 := H1)... @@ -732 +738,2 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth, jump_add, <- jump_nth... +rewrite jump_nth; rewrite jump_add. +rewrite <- jump_nth... @@ -743 +750 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump... +rewrite length_take_and_jump; auto. @@ -760 +767,2 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. +rewrite le_plus_minus_r... @@ -846,2 +854,2 @@ l2 l3 -> lit_test l1 l3 = lit_test l1 l2. -Proof with auto. -intros l1 l2 l3; case l1; case l2; case l3; simpl... +Proof. +intros l1 l2 l3; case l1; case l2; case l3; simpl; auto. @@ -851 +859 @@ case_eq (pos_test p2 p3); intros H1. -rewrite (pos_test_trans p1 p2 p3); rewrite H... +rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. @@ -853,2 +861,2 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1)... -rewrite H... +apply pos_test_exact with (1 := H1); auto. +rewrite H; auto. @@ -856,4 +864,4 @@ intros; discriminate. -replace p1 with p2... -case_eq (pos_test p2 p3); intros H1... -intros; apply test_trans... -apply sym_equal; apply pos_test_exact with (1 := H)... +replace p1 with p2; auto. +case_eq (pos_test p2 p3); intros H1; auto. +intros; apply test_trans; auto. +apply sym_equal; apply pos_test_exact with (1 := H); auto. @@ -863,3 +871,3 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1)... -rewrite H... -rewrite (pos_test_trans p1 p2 p3); rewrite H... +apply pos_test_exact with (1 := H1); auto. +rewrite H; auto. +rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. @@ -1445,2 +1453,2 @@ ordered cs -> ordered (clauses_update l c cs). -Proof with auto with datatypes. -intros l c cs; elim cs; simpl... +Proof. +intros l c cs; elim cs; simpl; auto. ``` Next Tactic: ```
rewrite <LOOKUP>length_app : forall (A : Set) (l1 l2 : list A), length (l1 ++ l2) = length l1 + length l2</LOOKUP>; simpl; auto with arith. ```
{"final_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-dc8d4294a32dbb6e0a642dc553b64495f27e6d60-427448011e3341d35aa5b9e00f675f6582fcd477-8_15_2-8_15_2-2.git.json","initial_commit":"dc8d4294a32dbb6e0a642dc553b64495f27e6d60","file":"UList.v"}
Ongoing Proof History: ``` case (cross1_correct (y, z)); intros tmp _; case (tmp HH1); clear tmp HH1. intros y1 (z1, (V1, (V2, V3))); injection V3; intros; subst; clear V3. case (gen_column_correct l y1 z1). intros tmp _; case (tmp Hl); clear tmp. intros x1 (Hl1, Hy); subst. - repeat (split; auto); case (in_indexes y1); auto. + repeat (split; auto); case (in_indexes y1)... intros Hn; case (fold_clause_insert1 _ (fun iz => gen_rect (fst iz) (snd iz))) with (1 := Hn); clear Hn. intros ((i,z), (n1, (HH1, HH2))); simpl in HH2. injection HH2; intros; subst; clear HH2. case (cross1_correct (i, z)); intros tmp _; case (tmp HH1); clear tmp HH1. intros i1 (z1, (V1, (V2, V3))); injection V3; intros; subst; clear V3. case (gen_rect_correct l i1 z1). - case (in_indexes i1); auto. + case (in_indexes i1)... intros tmp _; case (tmp Hl); clear tmp. intros x1 (y1, (Hl1, (Hl2, Hl3))); subst. repeat (split; auto). unfold size. - repeat rewrite (mult_comm h); apply mult_lt_plus; auto. + repeat rewrite (mult_comm h); apply mult_lt_plus... - apply div_lt; auto. + apply div_lt... - case (in_indexes i1); auto. + case (in_indexes i1)... unfold size. - repeat rewrite (mult_comm w); apply mult_lt_plus; auto. + repeat rewrite (mult_comm w); apply mult_lt_plus... - apply mod_lt; auto. + apply mod_lt... ? apply le_lt_trans with (2 := Hl2); auto with arith. ? unfold all_cell; intros Hn; case fold_clause_insert1 with (1 := Hn); clear Hn. ? intros ((x, y), (n1, (HH1, HH2))); simpl in HH2. ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 986e88b..769776a 100644 --- a/ListAux.v +++ b/ListAux.v @@ -131,6 +130,0 @@ Qed. -Theorem length_app: forall (l1 l2 : list A), length -(l1 ++ l2) = length l1 + length l2. -Proof. -apply app_length. -Qed. - @@ -278 +272 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app, length_map, H; auto. +intros a l H; rewrite app_length, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index e1936ca..7a13f04 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite length_app, length_take1; auto with arith. +rewrite app_length, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index 5083f1b..9b556eb 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm; auto. +apply div_lt; rewrite mult_comm... @@ -677,6 +677,2 @@ apply div_lt; rewrite mult_comm; auto. -repeat (rewrite (fun x => -mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp; auto. -rewrite (mod_small (div y w) h); auto. -rewrite (div_is_0 (div y w) h); auto. -rewrite plus_0_r. +repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... @@ -703,3 +699,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl; -auto with arith; clear n H1 H2 U1. -+ intros h1; case h1; simpl; auto. +intros U3 n; generalize h; elim n; simpl... +clear n H1 H2 U1. ++ intros h1; case h1; simpl... @@ -713,3 +709,2 @@ apply sym_equal; apply take_nth... -** apply le_trans with (1 := H1)... -apply le_trans with (2 := U3). -apply lt_le_weak; apply mod_lt... +** pose proof (mod_lt y w). +lia. @@ -726 +721 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H1. +case (le_or_lt (length l) w); intros H3. @@ -728,2 +723 @@ case (le_or_lt (length l) w); intros H1. -** rewrite length_take_small... -rewrite jump_too_far. +** rewrite length_take_small, jump_too_far... @@ -732,2 +726,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H1)... -*** apply le_trans with (1 := H1)... +apply le_trans with (1 := H3)... +*** apply le_trans with (1 := H3)... @@ -738,2 +732 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth; rewrite jump_add. -rewrite <- jump_nth... +rewrite jump_nth, jump_add, <- jump_nth... @@ -750 +743 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump; auto. +rewrite length_take_and_jump... @@ -767,2 +760 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. -rewrite le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... ``` Proof State: ``` 2 goals h, w : nat s : list nat H : length s = size * size H1 : empty s z1, i1, x1, y1 : nat Hl : In (L (Pos (h * div i1 h + x1) (w * mod i1 h + y1)) z1) (gen_rect i1 z1) n1 : nat V1 : In i1 indexes V2 : In z1 ref_list Hl2 : x1 < h Hl3 : y1 < w ============================ 0 < h goal 2 is: In (n, c) all_cell -> valid_lit l s ``` Next Tactic: ```
apply le_lt_trans with (2 := Hl2)... ```
{"final_commit":"5337edcaf31b9f036a0a6651b2f733d3068b8f8f","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-427448011e3341d35aa5b9e00f675f6582fcd477-5337edcaf31b9f036a0a6651b2f733d3068b8f8f-8_15_2-8_15_2-36.git.json","initial_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","file":"Sudoku.v"}
Ongoing Proof History: ``` Proof. ``` Proof State: ``` 1 subgoal K : fieldType vT : vectType K vs2mxP : forall U V, reflect (U = V) (vs2mx U == vs2mx V)%MS memvK : forall v U, (v \in U) = (v2r v <= vs2mx U)%MS mem_r2v : forall (rv : 'rV_(Vector.dim vT)) U, (r2v rv \in U) = (rv <= vs2mx U)%MS vs2mx0 : vs2mx 0 = 0 vs2mxD : forall U V, vs2mx (U + V) = (vs2mx U + vs2mx V)%MS vs2mx_sum := big_morph vs2mx vs2mxD vs2mx0 : forall (I : Type) (r : seq I) (P : pred I) (F : I -> {vspace vT}), vs2mx (\sum_(i <- r | P i) F i) = (\sum_(i <- r | P i) vs2mx (F i))%MS vs2mxI : forall U V, vs2mx (U :&: V) = (vs2mx U :&: vs2mx V)%MS vs2mxF : vs2mx fullv = 1%:M row_b2mx : forall (n : nat) (X : n.-tuple vT) (i : 'I_n), row i (b2mx X) = v2r X`_i span_b2mx : forall (n : nat) (X : n.-tuple vT), <<X>>%VS = mx2vs (b2mx X) mul_b2mx : forall (n : nat) (X : n.-tuple vT) (rk : 'rV_n), \sum_i rk 0 i *: X`_i = r2v (rk *m b2mx X) lin_b2mx : forall (n : nat) (X : n.-tuple vT) (k : 'I_n -> K), \sum_(i < n) k i *: X`_i = r2v (\row_i k i *m b2mx X) free_b2mx : forall (n : nat) (X : n.-tuple vT), free X = row_free (F:=K) (b2mx X) U, V : {vspace vT} ============================ (U :\: V + U :&: V)%VS = U ``` Next Tactic: ```
apply/vs2mxP; rewrite vs2mxD -<LOOKUP>genmx_adds : forall [F : fieldType] [m1 m2 n : nat] (A : 'M_(m1, n)) (B : 'M_(m2, n)), <<(A + B)%MS>>%MS = (<<A>> + <<B>>)%MS</LOOKUP> !<LOOKUP>genmxE : forall [F : fieldType] [m n : nat] (A : 'M_(m, n)), (<<A>> :=: A)%MS</LOOKUP>. ```
{"package":"coq-mathcomp-algebra","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/mathcomp\/algebra\/vector.v"}
Proof State: ``` 1 subgoal cs : compspecs t' : type n : Z a : attr sh : Share.t v : list (reptype t') p : val H : n >= 0 H0 : field_compatible (Tarray t' n a) nil p H1 : Zlength v = Z.max 0 n H2 : Forall (value_fits t') v ============================ Zlength v = n ``` Ongoing Proof History: ``` Proof. intros. eapply derives_trans; [apply data_array_at_local_facts |]. apply prop_derives. intros [? [? ?]]; split3; auto. ``` Next Tactic: ```
rewrite <LOOKUP>Z.max_r : forall n m : Z, n <= m -> Z.max n m = m</LOOKUP> in H1 by lia. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/floyd\/field_at.v"}
Ongoing Proof History: ``` Proof. intros n; elim n; simpl in |- *; auto. intros l1 l2; case l2. - intros H H0; rewrite perm_nil_inv with (1 := H0); auto with datatypes. + intros H H0; rewrite (Permutation_nil (Permutation_sym H0)); auto with datatypes. simpl in |- *; intros; discriminate. intros n0 H l1; case l1. - intros l2 H0 H1; rewrite perm_nil_inv with (1 := permutation_sym _ _ H1) in H0; discriminate. + intros l2 H0 H1; rewrite (Permutation_nil H1) in H0; discriminate. clear l1; intros a1 l1 l2 H1 H2. case (split_one_in_ex a1 l2); auto. ? apply permutation_in with (1 := H2); auto with datatypes. ? intros x H0. ? apply in_flat_map with (b := (a1, x)); auto. ``` Proof State: ``` 2 goals A : Set n, n0 : nat H : forall l1 l2 : list A, n0 = length l2 -> Permutation l1 l2 -> In l1 (all_permutations_aux l2 n0) a1 : A l1, l2 : list A H1 : S n0 = length l2 H2 : Permutation (a1 :: l1) l2 ============================ In a1 l2 goal 2 is: forall x : list A, In (a1, x) (split_one l2) -> In (a1 :: l1) (flat_map (fun p : A * list A => map (cons (fst p)) (all_permutations_aux (snd p) n0)) (split_one l2)) ``` Commit Diff: ``` diff --git a/Permutation.v b/Permutation.v index ecfa699..e499555 100644 --- a/Permutation.v +++ b/Permutation.v @@ -33,2 +32,0 @@ Variable A : Set. -Definition permutation (l1 l2 : list A) := @Permutation A l1 l2. - @@ -37,66 +34,0 @@ Hint Constructors Permutation : core. -Definition permutation_trans := perm_trans. - - - - - -Theorem permutation_refl : forall l : list A, permutation l l. -Proof. -simple induction l. -apply perm_nil. -intros a l1 H. -apply perm_skip with (1 := H). -Qed. -Hint Resolve permutation_refl : core. - - - - - -Theorem permutation_sym : forall l m : list -A, permutation l m -> permutation m l. -Proof. -apply Permutation_sym. -Qed. - - - - - -Theorem permutation_length : forall l m : list A, -permutation l m -> length l = length m. -Proof. -apply Permutation_length. -Qed. - - - - - -Theorem perm_nil_inv : forall l : list A, permutation l nil -> l = nil. -Proof. -intros l H. -apply Permutation_nil. -apply Permutation_sym; assumption. -Qed. - - - - -Theorem permutation_one_inv : forall (a : A) (l : list A), -permutation (a :: nil) l -> l = a :: nil. -Proof. -apply Permutation_length_1_inv. -Qed. - - - - - -Theorem permutation_in : forall (a : A) (l m : list A), -permutation l m -> In a l -> In a m. -Proof. -intros a l m H H0. -eapply Permutation_in; eassumption. -Qed. - @@ -107,26 +39,3 @@ Qed. -Theorem permutation_app_comp : forall l1 l2 l3 l4, -permutation l1 l2 -> permutation l3 l4 -> -permutation (l1 ++ l3) (l2 ++ l4). -Proof. -intros l1 l2 l3 l4 H H0. -apply Permutation_app; auto. -Qed. -Hint Resolve permutation_app_comp : core. - - - - - -Theorem permutation_app_swap : forall l1 l2, permutation -(l1 ++ l2) (l2 ++ l1). -Proof. -apply Permutation_app_comm. -Qed. - - - - - -Theorem perm_transposition : forall a b l1 l2 l3, permutation -(l1 ++ a :: l2 ++ b :: l3) -(l1 ++ b :: l2 ++ a :: l3). +Theorem perm_transposition : forall a b (l1 l2 l3 : list +A), Permutation (l1 ++ a :: l2 ++ b :: +l3) (l1 ++ b :: l2 ++ a :: l3). @@ -135,2 +44,2 @@ intros a b l1 l2 l3. -apply permutation_app_comp; auto. -change (permutation ((a :: nil) ++ l2 ++ (b +apply Permutation_app; auto. +change (Permutation ((a :: nil) ++ l2 ++ (b @@ -140 +49 @@ repeat rewrite <- app_ass. -apply permutation_app_comp; auto. +apply Permutation_app; auto. @@ -142 +51 @@ apply perm_trans with ((b :: nil) ++ (a :: nil) ++ l2); auto. -apply permutation_app_swap; auto. +apply Permutation_app_comm; auto. @@ -144,2 +53,2 @@ repeat rewrite app_ass. -apply permutation_app_comp; auto. -apply permutation_app_swap; auto. +apply Permutation_app; auto. +apply Permutation_app_comm; auto. @@ -153 +62 @@ Theorem in_permutation_ex : forall a l, In a l -> -exists l1 : list A, permutation (a :: l1) l. +exists l1 : list A, Permutation (a :: l1) l. @@ -167,13 +75,0 @@ Qed. -Theorem permutation_inv : forall (a : A) (l1 -l2 : list A), permutation (a :: l1) -(a :: l2) -> permutation l1 l2. -Proof. -intros a l1 l2 H. -eapply Permutation_cons_inv. -eassumption. -Qed. - - - - - @@ -195 +91 @@ l2 : list A), In (a, l1) (split_one -l2) -> permutation (a :: l1) l2. +l2) -> Permutation (a :: l1) l2. @@ -256 +152 @@ Lemma all_permutations_aux_permutation : forall (n : nat) (l1 l2 -l1 (all_permutations_aux l2 n) -> permutation l1 l2. +l1 (all_permutations_aux l2 n) -> Permutation l1 l2. @@ -276,2 +172,2 @@ change (length l2 = length (a1 :: l3)) in |- *. ``` Next Tactic: ```
apply <LOOKUP>Permutation_in : forall [A : Type] [l l' : list A] (x : A), Permutation l l' -> In x l -> In x l'</LOOKUP> with (1 := H2); auto with datatypes. ```
{"final_commit":"5a29a619b6acc23531ef31506b909056de730bf6","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-b5543771d6bdeab13ec58ac6c8d281815d96ed62-5a29a619b6acc23531ef31506b909056de730bf6-8_15_2-8_15_2-17.git.json","initial_commit":"b5543771d6bdeab13ec58ac6c8d281815d96ed62","file":"Permutation.v"}
Commit Diff: ``` diff --git a/Eval.v b/Eval.v index bc7147c..0f3077e 100644 --- a/Eval.v +++ b/Eval.v @@ -42,0 +43,13 @@ v]fields)] Οƒ | None => Οƒ end. + +Inductive Result : Type +:= | Timeout | +Error | Success +: Value -> +Store -> Result. +Inductive Result_l : Type +:= | Timeout_l | +Error_l | Success_l : +(list Value) -> +Store -> Result_l. + + @@ -74 +87 @@ el _⟧(Οƒ1, ρ, v)(n)) with | -Success_list args_val Οƒ2 => let ρ1 +Success_l args_val Οƒ2 => let ρ1 @@ -82 +95 @@ end) | new C args => -v)(n)) with | Success_list args_val Οƒ1 +v)(n)) with | Success_l args_val Οƒ1 @@ -89,37 +102,39 @@ Some Οƒ3 => (Success I Οƒ3) -| None => Error end ) -| _ => Error end) | -asgn e1 x e2 e' => -( match (⟦e1⟧(Οƒ, ρ, v)(n)) with -| Success v1 Οƒ1 => match -(⟦e2⟧(Οƒ1, ρ, v)(n)) with | Success -v2 Οƒ2 => ( let Οƒ3 -:= (assign v1 x v2 Οƒ2) -in ⟦e'⟧(Οƒ3, ρ, v)(n)) | -_ => Error end | -_ => Error end ) -end end where "'⟦' e -'⟧' '(' Οƒ ',' ρ -',' v ')(' k ')'" -:= (eval e Οƒ ρ -v k) with eval_list (e_l: -list Expr) (Οƒ: Store) (ρ: -Env) (v: Value) (k: nat) -: Result := match k -with | 0 => Timeout -| S n => fold_left -(eval_list_aux ρ v n) e_l -(Success_list [] Οƒ) end where -"'⟦_' e '_⟧' '(' Οƒ -',' ρ ',' v ')(' -k ')'" := (eval_list e -Οƒ ρ v k) with -eval_list_aux (ρ: Env) (v: Value) -(k: nat) (acc: Result) (e: -Expr) := match k with -| 0 => Timeout | -S n => match acc -with | Success_list vs Οƒ1 -=> match (⟦e⟧(Οƒ1, ρ, v)(n)) -with | Success v Οƒ2 -=> Success_list (v::vs) Οƒ2 | -z => z end | +| None => Error end +) | _ => Error +end) | asgn e1 x +e2 e' => ( match ``` Ongoing Proof History: ``` { induction el0; intros; simpl in H4. + invert_constructor_equalities; subst; split => //. + destruct n; [rewrite_anywhere foldLeft_constant => // |]. simpl in H4. + destruct_eval. ? destruct (⟦ a ⟧ (Οƒ1, ρ, ψ )( n)) eqn:A; try solve [rewrite_anywhere foldLeft_constant => //; try eval_not_success_list]. ? unshelve epose proof (H n _ _ _ _ _ _ _ A _ _); try lia ; eauto with wf; destruct_and. ? assert (dom Οƒ <= dom s) by eauto using PeanoNat.Nat.le_trans with pM. ``` Proof State: ``` 1 subgoal n : nat H : forall k : nat, k < S (S (S n)) -> forall (e : Expr) (Οƒ Οƒ' : Store) (ρ : Env) (ψ l : Value), (⟦ e ⟧ (Οƒ, ρ, ψ )( k)) = Success l Οƒ' -> wf Οƒ -> (codom ρ βˆͺ {ψ}) βͺ½ Οƒ -> ((Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ', {l})) /\ (Οƒ ⇝ Οƒ' β‹– codom ρ βˆͺ {ψ}) e0 : Expr el : list Expr Οƒ : list Obj ρ : Env ψ, l0 : Value Οƒ0 : Store ρ' : list Value Οƒ_n : Store H0 : fold_left (eval_list_aux ρ ψ (S n)) el (Success_l [] Οƒ0) = Success_l ρ' Οƒ_n H1 : wf Οƒ H2 : (codom ρ βˆͺ {ψ}) βͺ½ Οƒ H3 : (⟦ e0 ⟧ (Οƒ, ρ, ψ )( S (S n))) = Success l0 Οƒ0 H_scope : (Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ0, {l0}) H_preserv : Οƒ ⇝ Οƒ0 β‹– codom ρ βˆͺ {ψ} a : Expr el0 : list Expr IHel0 : forall (ρ' : list Value) (Οƒ1 Οƒ2 : Store) (acc : list Value), fold_left (eval_list_aux ρ ψ (S n)) el0 (Success_l acc Οƒ1) = Success_l ρ' Οƒ2 -> wf Οƒ1 -> dom Οƒ <= dom Οƒ1 -> Οƒ ⇝ Οƒ1 β‹– codom ρ βˆͺ {ψ} -> (codom acc βˆͺ {l0}) βͺ½ Οƒ1 -> (Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ1, codom acc βˆͺ {l0}) -> ((Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ2, codom ρ' βˆͺ {l0})) /\ (Οƒ ⇝ Οƒ2 β‹– codom ρ βˆͺ {ψ}) ρ'0 : list Value Οƒ1, Οƒ2 : Store acc : list Value v : Value s : Store H10 : (⟦ a ⟧ (Οƒ1, ρ, ψ )( n)) = Success v s H4 : fold_left (fun (acc : Result_l) (e : Expr) => match acc with | Success_l vs Οƒ1 => match ⟦ e ⟧ (Οƒ1, ρ, ψ )( n) with | Timeout => Timeout_l | Error => Error_l | Success v Οƒ2 => Success_l (v :: vs) Οƒ2 end | _ => acc end) el0 (Success_l (v :: acc) s) = Success_l ρ'0 Οƒ2 H5 : wf Οƒ1 H6 : dom Οƒ <= dom Οƒ1 H7 : Οƒ ⇝ Οƒ1 β‹– codom ρ βˆͺ {ψ} H8 : (codom acc βˆͺ {l0}) βͺ½ Οƒ1 H9 : (Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ1, codom acc βˆͺ {l0}) ============================ ((Οƒ, codom ρ βˆͺ {ψ}) β‹– (Οƒ2, codom ρ'0 βˆͺ {l0})) /\ (Οƒ ⇝ Οƒ2 β‹– codom ρ βˆͺ {ψ}) ``` Next Tactic: ```
unshelve epose proof (H n _ _ _ _ _ _ _ H10 _ _); try lia ; eauto with wf; destruct_and. ```
{"final_commit":"81a8b9e957eb20b980dd0b63d6bd418225e4e1f8","project":"celsius","repair_file":"\/data\/coq-pearls\/repairs\/celsius\/repair-celsius-ac60f930c564d720bea462f088eb6b63d28c97cc-81a8b9e957eb20b980dd0b63d6bd418225e4e1f8-8_13_2-8_13_2-6.git.json","initial_commit":"ac60f930c564d720bea462f088eb6b63d28c97cc","file":"Scopability.v"}
Proof State: ``` 1 subgoal P : Ghost a1, a2 : option G m1, m2 : list (option G) a3 : option G m3 : list (option G) H : join a1 a2 a3 H0 : list_join m1 m2 m3 IHlist_join : forall n : nat, join (nth_error m1 n) (nth_error m2 n) (nth_error m3 n) n : nat ============================ join (nth_error (a1 :: m1) n) (nth_error (a2 :: m2) n) (nth_error (a3 :: m3) n) ``` Ongoing Proof History: ``` Proof. intros; revert n. induction H; intro. - rewrite nth_error_nil; constructor. - rewrite nth_error_nil; constructor. - ``` Next Tactic: ```
destruct n; simpl; auto. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/veric\/invariants.v"}
Ongoing Proof History: ``` Proof. intros s s'; revert s. induction s' as [ | x' s' IH]; intros [ | x s] Hs Hs'; simpl; auto. split; try red; intros; auto. split; intros H. discriminate. assert (In x nil) by (apply H; auto). inv. split; try red; intros; auto. inv. inv. elim_compare x x' as C. rewrite IH; auto. split; intros S y; specialize (S y). rewrite !InA_cons, C. intuition. rewrite !InA_cons, C in S. intuition; try sort_inf_in; order. split; intros S. discriminate. assert (In x (x'::s')) by (apply S; auto). inv; try sort_inf_in; order. rewrite IH; auto. ``` Proof State: ``` 1 subgoal x' : elt s' : list elt IH : forall s : t, Ok s -> Ok s' -> subset s s' = true <-> Subset s s' x : elt s : list elt H : Sorted X.lt s' H0 : Inf x' s' H1 : Sorted X.lt s H2 : Inf x s C : X.lt x' x ============================ Subset (x :: s) s' <-> Subset (x :: s) (x' :: s') ``` Next Tactic: ```
split; intros S y; specialize (<LOOKUP>S : nat -> nat</LOOKUP> y). ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/MSets\/MSetList.v"}
Proof State: ``` 1 subgoal B₁, Bβ‚‚, B₃ : bicat F₁, Fβ‚‚ : psfunctor B₁ Bβ‚‚ G : psfunctor Bβ‚‚ B₃ Ξ· : pstrans F₁ Fβ‚‚ D₁ : disp_bicat B₁ Dβ‚‚ : disp_bicat Bβ‚‚ D₃ : disp_bicat B₃ FF₁ : disp_psfunctor D₁ Dβ‚‚ F₁ FFβ‚‚ : disp_psfunctor D₁ Dβ‚‚ Fβ‚‚ GG : disp_psfunctor Dβ‚‚ D₃ G Ξ·Ξ· : disp_pstrans FF₁ FFβ‚‚ Ξ· PP := total_psfunctor Dβ‚‚ D₃ G GG β—… total_pstrans FF₁ FFβ‚‚ Ξ· Ξ·Ξ· : pstrans (comp_psfunctor (total_psfunctor Dβ‚‚ D₃ G GG) (total_psfunctor D₁ Dβ‚‚ F₁ FF₁)) (comp_psfunctor (total_psfunctor Dβ‚‚ D₃ G GG) (total_psfunctor D₁ Dβ‚‚ Fβ‚‚ FFβ‚‚)) PP2 := pstrans_to_is_pstrans PP : is_pstrans (pstrans_to_pstrans_data PP) X : pstrans_to_pstrans_data PP = total_pstrans_data (disp_pseudo_comp F₁ G D₁ Dβ‚‚ D₃ FF₁ GG) (disp_pseudo_comp Fβ‚‚ G D₁ Dβ‚‚ D₃ FFβ‚‚ GG) (G β—… Ξ·) disp_left_whisker_data ============================ is_pstrans (total_pstrans_data (disp_pseudo_comp F₁ G D₁ Dβ‚‚ D₃ FF₁ GG) (disp_pseudo_comp Fβ‚‚ G D₁ Dβ‚‚ D₃ FFβ‚‚ GG) (G β—… Ξ·) disp_left_whisker_data) ``` Ongoing Proof History: ``` Proof. apply is_disp_pstrans_from_total. pose (PP := (total_psfunctor _ _ _ GG) β—… total_pstrans _ _ _ Ξ·Ξ·). pose (PP2 := pstrans_to_is_pstrans PP). assert (pstrans_to_pstrans_data PP = total_pstrans_data _ _ _ disp_left_whisker_data). - use total2_paths_f. + apply idpath. + apply funextsec. intro x. apply funextsec. intro y. apply funextsec. intro f. use subtypePath. { intro. apply isaprop_is_invertible_2cell. } apply idpath. - ``` Next Tactic: ```
exact (<LOOKUP>transportf : ∏ (X : UU) (P : X β†’ UU) (x x' : X), x = x' β†’ P x β†’ P x'</LOOKUP> <LOOKUP>is_pstrans : ∏ (C D : bicat) (F G : psfunctor C D), pstrans_data F G β†’ UU</LOOKUP> X PP2). ```
{"package":"coq-unimath","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/UniMath\/Bicategories\/DisplayedBicats\/DispTransformation.v"}
Proof State: ``` 3 subgoals l, r : tree IHl : forall x y : elt, min_elt l = Some x -> mem y l = true -> ~ E.lt y x e : elt IHr : forall x y : elt, Some e = Some x -> mem y r = true -> ~ E.lt y x z : positive H' : mem z~0 (Node l false r) = true Hp : Empty l ============================ ~ E.lt z~0 e~1 subgoal 2 is: ~ E.lt 1 e~1 subgoal 3 is: ~ E.lt y x ``` Ongoing Proof History: ``` Proof. unfold In. induction s as [|l IHl o r IHr]; intros x y H H'. discriminate. simpl in H. case_eq (min_elt l). intros p Hp. rewrite Hp in H. injection H as [= <-]. destruct y as [z|z|]; simpl; intro; trivial. apply (IHl p z); trivial. intro Hp; rewrite Hp in H. apply min_elt_3 in Hp. destruct o. injection H as [= <-]. intros Hl. destruct y as [z|z|]; simpl; trivial. elim (Hp _ H'). destruct (min_elt r). injection H as [= <-]. destruct y as [z|z|]. apply (IHr e z); trivial. ``` Next Tactic: ```
elim (Hp _ H'). ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/FSets\/FSetPositive.v"}
Ongoing Proof History: ``` Proof. econstructor. pmonauto. intros. - dependent destruction PR. + destruct PR. punfold EQVl. punfold EQVr. unfold_eqit. hinduction REL before r; intros; clear t1' t2'. - remember (RetF r1) as x. hinduction EQVl before r; intros; subst; try inv Heqx; eauto. remember (RetF r3) as y. hinduction EQVr before r; intros; subst; try inv Heqy; eauto. - remember (TauF m1) as x. hinduction EQVl before r; intros; subst; try inv Heqx; try inv CHECK; eauto. remember (TauF m3) as y. hinduction EQVr before r; intros; subst; try inv Heqy; try inv CHECK; eauto. pclearbot. econstructor. gclo. - econstructor; cycle -1; eauto with paco. + econstructor; eauto with paco. - remember (VisF e k1) as x. - hinduction EQVl before r; intros; subst; try dependent destruction Heqx; try inv CHECK; eauto. + hinduction EQVl before r; intros; try discriminate Heqx; eauto; inv_Vis. - remember (VisF e0 k3) as y. + remember (VisF e k3) as y. ? hinduction EQVr before r; intros; subst; try dependent destruction Heqy; try inv CHECK; eauto. ? econstructor. ? intros. ``` Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index b911a90..32f56a6 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6,2 +6 @@ Require Import -Program Classes.Morphisms -Setoids.Setoid +Classes.Morphisms Setoids.Setoid @@ -24 +23,2 @@ Eq.Eq -Eq.UpToTaus. +Eq.UpToTaus +Eq.Paco2. @@ -68 +68 @@ Proof. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert A B C f g a0. -ginit. gcofix CIH. intros. +revert f g a0. +ginit. pcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -277 +277 @@ revert a. -gcofix CIH'. intros. +pcofix CIH'. intros. @@ -337,2 +337 @@ etau. -specialize (CIH xa). -cbn in CIH. +specialize (CIHL xa). cbn in CIHL. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 21ac7e0..9024a7a 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29 +29,2 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition. +Core.ITreeDefinition +Eq.Paco2. @@ -165,0 +167,54 @@ Hint Unfold id: core. +Lemma eqitF_inv_VisF_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} +t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 +b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 +/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 += TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). +Proof. +refine (fun H => match H +in eqitF _ _ _ _ +_ _ t2 return match t2 +return Prop with | VisF e2 +k2 => _ | _ +=> True end with | +EqVis _ _ _ _ +_ _ _ _ _ +=> _ | _ => +_ end); try exact I. +- left; eauto. +- destruct i0; eauto. +Qed. + +Lemma eqitF_inv_VisF_weak {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 +(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 +-> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists +p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. +Proof. ``` Proof State: ``` 1 subgoal E : Type -> Type R1 : Type R2 : Type RR : R1 -> R2 -> Prop b1, b2 : bool vclo : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) -> rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) MON : monotone2 vclo CMP : forall (x0 : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2)) (x1 : itree E R1) (x2 : itree E R2), (eqitC b1 b2 ∘ vclo) x0 x1 x2 -> (vclo ∘ eqitC b1 b2) x0 x1 x2 r : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) t1 : itree E R1 RR1 : R1 -> R1 -> Prop u : Type e : E u k1, k2 : u -> itree E R1 REL : forall v : u, id (upaco2 (eqit_ RR1 b1 false id) bot2) (k1 v) (k2 v) k3 : u -> itree E R2 REL0 : forall v : u, vclo r (k2 v) (k3 v) t2 : itree E R2 RR2 : R2 -> R2 -> Prop y : itree' E R2 Heqy : y = VisF e k3 EQVr : eqitF RR2 b2 false id (upaco2 (eqit_ RR2 b2 false id) bot2) (observe t2) y LERR1 : forall (x x' : R1) (y : R2), RR1 x x' -> RR x' y -> RR x y LERR2 : forall (x : R1) (y y' : R2), RR2 y y' -> RR x y' -> RR x y ============================ eqitF RR b1 b2 vclo (gupaco2 (eqit_ RR b1 b2 vclo) (eqitC b1 b2) r) (VisF e k1) (observe t2) ``` Next Tactic: ```
hinduction EQVr before r; intros; try discriminate Heqy; eauto; inv_Vis. ```
{"final_commit":"7f00358aeb230f7970571fddaa8b256375910c62","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-672193e2507cf3326b834f5fa47b7518af829b4b-7f00358aeb230f7970571fddaa8b256375910c62-8_10_2-8_10_2-1.git.json","initial_commit":"672193e2507cf3326b834f5fa47b7518af829b4b","file":"theories\/Eq\/Eq.v"}
Commit Diff: ``` diff --git a/theories/Basics/CategoryKleisliFacts.v b/theories/Basics/CategoryKleisliFacts.v index e0b955f..d6eecd6 100644 --- a/theories/Basics/CategoryKleisliFacts.v +++ b/theories/Basics/CategoryKleisliFacts.v @@ -59,0 +60,8 @@ Qed. + + + + + + + + diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 57c2013..9b33167 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -242 +242 @@ Notation "t1 >>= k2" := (ITree.bind t1 k2) -(at level 50, left associativity) : itree_scope. +(at level 58, left associativity) : itree_scope. diff --git a/theories/Core/KTree.v b/theories/Core/KTree.v ``` Proof State: ``` 1 subgoal c : Type -> Type T : Type a, b : Type -> Type f : forall T : Type, a T -> itree (a +' b) T g : forall T : Type, b T -> itree c T a0 : a T gL : itree c T -> itree c T -> Prop CIH : forall t : itree (a +' b) T, gL (interp g (Recursion.interp_mrec (fun (T : Type) (e : a T) => Tau (f T e)) t)) (Recursion.interp_mrec (fun (R : Type) (e : a R) => interp (fun (T : Type) (ab : (a +' b) T) => match ab with | inl1 a0 => interp (fun (T0 : Type) (e0 : a T0) => ITree.trigger (inl1 e0)) (ITree.trigger a0) | inr1 b => interp (fun (T0 : Type) (e0 : c T0) => ITree.trigger (inr1 e0)) (g T b) end) (Tau (f R e))) (interp (fun (T : Type) (ab : (a +' b) T) => match ab with | inl1 a0 => interp (fun (T0 : Type) (e : a T0) => ITree.trigger (inl1 e)) (ITree.trigger a0) | inr1 b => interp (fun (T0 : Type) (e : c T0) => ITree.trigger (inr1 e)) (g T b) end) t)) gH : itree c T -> itree c T -> Prop CIH0 : forall t : itree (a +' b) T, gH (interp g (Recursion.interp_mrec (fun (T : Type) (e : a T) => Tau (f T e)) t)) (Recursion.interp_mrec (fun (R : Type) (e : a R) => interp (fun (T : Type) (ab : (a +' b) T) => match ab with | inl1 a0 => interp (fun (T0 : Type) (e0 : a T0) => ITree.trigger (inl1 e0)) (ITree.trigger a0) | inr1 b => interp (fun (T0 : Type) (e0 : c T0) => ITree.trigger (inr1 e0)) (g T b) end) (Tau (f R e))) (interp (fun (T : Type) (ab : (a +' b) T) => match ab with | inl1 a0 => interp (fun (T0 : Type) (e : a T0) => ITree.trigger (inl1 e)) (ITree.trigger a0) | inr1 b => interp (fun (T0 : Type) (e : c T0) => ITree.trigger (inr1 e)) (g T b) end) t)) t : itree (a +' b) T X : Type a1 : a X k : X -> itree (a +' b) T ============================ euttG eq bot2 gL gL gH (interp g (Recursion.interp_mrec (fun (T0 : Type) (e : a T0) => Tau (f T0 e)) (x <- f X a1;; k x))) (Recursion.interp_mrec (fun (R : Type) (e : a R) => interp (fun (T0 : Type) (ab : (a +' b) T0) => match ab with | inl1 a2 => interp (fun (T1 : Type) (e0 : a T1) => ITree.trigger (inl1 e0)) (ITree.trigger a2) | inr1 b0 => interp (fun (T1 : Type) (e0 : c T1) => ITree.trigger (inr1 e0)) (g T0 b0) end) (Tau (f R e))) (x <- interp (fun (T0 : Type) (ab : (a +' b) T0) => match ab with | inl1 a2 => interp (fun (T1 : Type) (e : a T1) => ITree.trigger (inl1 e)) (ITree.trigger a2) | inr1 b0 => interp (fun (T1 : Type) (e : c T1) => ITree.trigger (inr1 e)) (g T0 b0) end) (f X a1);; Tau (interp (fun (T0 : Type) (ab : (a +' b) T0) => match ab with | inl1 a2 => interp (fun (T1 : Type) (e : a T1) => ITree.trigger (inl1 e)) (ITree.trigger a2) | inr1 b0 => interp (fun (T1 : Type) (e : c T1) => ITree.trigger (inr1 e)) (g T0 b0) end) (k x)))) ``` Ongoing Proof History: ``` unfold Recursion.mrec. rewrite !interp_tau. rewrite (unfold_interp_mrec _ _ (Tau _)); cbn. rewrite !bind_tau. etau. - rewrite tau_eutt, <- interp_bind, <- 2 interp_mrec_bind. + rewrite tau_euttge, <- interp_bind, <- 2 interp_mrec_bind. ? setoid_rewrite (tau_eutt (interp _ _)). ? rewrite <- interp_bind. ? auto with paco. ``` Next Tactic: ```
setoid_rewrite (<LOOKUP>tau_euttge : forall (E : Type -> Type) (R : Type) (t : itree E R), Tau t ≳ t</LOOKUP> (<LOOKUP>interp : forall E M : Type -> Type, Functor.Functor M -> Monad.Monad M -> MonadIter M -> (forall T : Type, E T -> M T) -> forall T : Type, itree E T -> M T</LOOKUP> _ _)). ```
{"final_commit":"6b6e1763da94788e6204f549039421936cad4437","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-75a5a716bb6a18a6fdca492391f694fb344ea589-6b6e1763da94788e6204f549039421936cad4437-8_10_2-8_10_2-17.git.json","initial_commit":"75a5a716bb6a18a6fdca492391f694fb344ea589","file":"theories\/Interp\/HandlerFacts.v"}
Proof State: ``` 3 goals h, w : nat s : list nat H : length s = size * size H1 : empty s l : lit z1, i1 : nat Hl : In l (gen_rect i1 z1) n1 : nat V1 : In i1 indexes V2 : In z1 ref_list ============================ i1 < size goal 2 is: (In l (gen_rect i1 z1) -> exists i2 j1 : nat, l = L (Pos (h * div i1 h + i2) (w * mod i1 h + j1)) z1 /\ i2 < h /\ j1 < w) -> ((exists i2 j1 : nat, l = L (Pos (h * div i1 h + i2) (w * mod i1 h + j1)) z1 /\ i2 < h /\ j1 < w) -> In l (gen_rect i1 z1)) -> valid_lit l s goal 3 is: In (n, c) all_cell -> valid_lit l s ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 986e88b..769776a 100644 --- a/ListAux.v +++ b/ListAux.v @@ -131,6 +130,0 @@ Qed. -Theorem length_app: forall (l1 l2 : list A), length -(l1 ++ l2) = length l1 + length l2. -Proof. -apply app_length. -Qed. - @@ -278 +272 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app, length_map, H; auto. +intros a l H; rewrite app_length, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index e1936ca..7a13f04 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite length_app, length_take1; auto with arith. +rewrite app_length, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index 5083f1b..9b556eb 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm; auto. +apply div_lt; rewrite mult_comm... @@ -677,6 +677,2 @@ apply div_lt; rewrite mult_comm; auto. -repeat (rewrite (fun x => -mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp; auto. -rewrite (mod_small (div y w) h); auto. -rewrite (div_is_0 (div y w) h); auto. -rewrite plus_0_r. +repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... @@ -703,3 +699,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl; -auto with arith; clear n H1 H2 U1. -+ intros h1; case h1; simpl; auto. +intros U3 n; generalize h; elim n; simpl... +clear n H1 H2 U1. ++ intros h1; case h1; simpl... @@ -713,3 +709,2 @@ apply sym_equal; apply take_nth... -** apply le_trans with (1 := H1)... -apply le_trans with (2 := U3). -apply lt_le_weak; apply mod_lt... +** pose proof (mod_lt y w). +lia. @@ -726 +721 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H1. +case (le_or_lt (length l) w); intros H3. @@ -728,2 +723 @@ case (le_or_lt (length l) w); intros H1. -** rewrite length_take_small... -rewrite jump_too_far. +** rewrite length_take_small, jump_too_far... @@ -732,2 +726,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H1)... -*** apply le_trans with (1 := H1)... +apply le_trans with (1 := H3)... +*** apply le_trans with (1 := H3)... @@ -738,2 +732 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth; rewrite jump_add. -rewrite <- jump_nth... +rewrite jump_nth, jump_add, <- jump_nth... @@ -750 +743 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump; auto. +rewrite length_take_and_jump... @@ -767,2 +760 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. -rewrite le_plus_minus_r... ``` Ongoing Proof History: ``` intros x1 (z1, (V1, (V2, V3))); injection V3; intros; subst; clear V3. case (gen_row_correct l x1 z1). intros tmp _; case (tmp Hl); clear tmp. intros y1 (Hl1, Hy); subst. - repeat (split; auto); case (in_indexes x1); auto. + repeat (split; auto); case (in_indexes x1)... intros Hn; case (fold_clause_insert1 _ (fun iz => gen_column (fst iz) (snd iz))) with (1 := Hn); clear Hn. intros ((y,z), (n1, (HH1, HH2))); simpl in HH2. injection HH2; intros; subst; clear HH2. case (cross1_correct (y, z)); intros tmp _; case (tmp HH1); clear tmp HH1. intros y1 (z1, (V1, (V2, V3))); injection V3; intros; subst; clear V3. case (gen_column_correct l y1 z1). intros tmp _; case (tmp Hl); clear tmp. intros x1 (Hl1, Hy); subst. - repeat (split; auto); case (in_indexes y1); auto. + repeat (split; auto); case (in_indexes y1)... intros Hn; case (fold_clause_insert1 _ (fun iz => gen_rect (fst iz) (snd iz))) with (1 := Hn); clear Hn. intros ((i,z), (n1, (HH1, HH2))); simpl in HH2. injection HH2; intros; subst; clear HH2. case (cross1_correct (i, z)); intros tmp _; case (tmp HH1); clear tmp HH1. intros i1 (z1, (V1, (V2, V3))); injection V3; intros; subst; clear V3. case (gen_rect_correct l i1 z1). ? case (in_indexes i1); auto. ? intros tmp _; case (tmp Hl); clear tmp. ? intros x1 (y1, (Hl1, (Hl2, Hl3))); subst. ``` Next Tactic: ```
case (<LOOKUP>in_indexes : forall i : nat, In i indexes <-> i < size</LOOKUP> i1)... ```
{"final_commit":"5337edcaf31b9f036a0a6651b2f733d3068b8f8f","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-427448011e3341d35aa5b9e00f675f6582fcd477-5337edcaf31b9f036a0a6651b2f733d3068b8f8f-8_15_2-8_15_2-8.git.json","initial_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","file":"Sudoku.v"}
Ongoing Proof History: ``` Proof. intros. apply pred_ext. + ``` Proof State: ``` 1 subgoal A : Type ND : NatDed A P : Prop Q : A H : P ============================ !! P --> Q |-- Q ``` Next Tactic: ```
eapply <LOOKUP>derives_trans : forall {A : Type} {NatDed : NatDed A} (P Q R : A), P |-- Q -> Q |-- R -> P |-- R</LOOKUP>; [| apply <LOOKUP>modus_ponens : forall {A : Type} {ND : NatDed A} (P Q : A), P && (P --> Q) |-- Q</LOOKUP>]. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/msl\/log_normalize.v"}
Ongoing Proof History: ``` + apply ulist_perm with ref_list; auto. - apply Permutation_sym... + apply Permutation_sym; auto. - repeat rewrite <- get_column; try rewrite H2... + repeat rewrite <- get_column; try rewrite H2; auto. case (gen_rect_correct l (div x h * h + div y w) z). - apply rect_aux1... + apply rect_aux1; auto. intros tmp _; case tmp; auto; clear tmp. - apply (rm_incl _ lit_test) with (l1 := L (Pos x y) z::nil)... + apply (rm_incl _ lit_test) with (l1 := L (Pos x y) z::nil); auto. intros x1 (y1, (H5, (H6, H7))); subst l. simpl in H4. match type of H4 with get (Pos ?X ?Y) _ = _ => generalize H3 H4; clear H3 H4; replace (Pos X Y) with (Pos (h * div x h + x1) (w * div y w + y1)); [intros H3 H4 | idtac] end. match type of H4 with get (Pos ?X ?Y) _ = _ => assert (X = x /\ Y = y) end. - apply rect_aux2... + apply rect_aux2; auto. - unfold size; rewrite (mult_comm w); apply mult_lt_plus... + unfold size; rewrite (mult_comm w); apply mult_lt_plus; auto. - apply div_lt; rewrite mult_comm... + apply div_lt; rewrite mult_comm; auto. - rewrite get_rect in H4... + rewrite get_rect in H4; auto. ? rewrite get_rect in H2... ? generalize H4; clear H4. ? repeat rewrite (fun x => mult_comm x h). ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 769776a..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -130,0 +131,6 @@ Qed. +Theorem length_app: forall (l1 l2 : list A), length +(l1 ++ l2) = length l1 + length l2. +Proof. +apply app_length. +Qed. + @@ -272 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite app_length, length_map, H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index 7a13f04..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite app_length, length_take1; auto with arith. +rewrite length_app, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index f9e372e..838c038 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm... +apply div_lt; rewrite mult_comm; auto. @@ -677,2 +677,6 @@ apply div_lt; rewrite mult_comm... -repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... +repeat (rewrite (fun x => +mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp; auto. +rewrite (mod_small (div y w) h); auto. +rewrite (div_is_0 (div y w) h); auto. +rewrite plus_0_r. @@ -699,3 +703,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl... -clear n H1 H2 U1. -+ intros h1; case h1; simpl... +intros U3 n; generalize h; elim n; simpl; +auto with arith; clear n H1 H2 U1. ++ intros h1; case h1; simpl; auto. @@ -709,2 +713,3 @@ apply sym_equal; apply take_nth... -** pose proof (mod_lt y w). -lia. +** apply le_trans with (1 := H1)... +apply le_trans with (2 := U3). +apply lt_le_weak; apply mod_lt... @@ -721 +726 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H3. +case (le_or_lt (length l) w); intros H1. @@ -723 +728,2 @@ case (le_or_lt (length l) w); intros H3. -** rewrite length_take_small, jump_too_far... +** rewrite length_take_small... +rewrite jump_too_far. @@ -726,2 +732,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H3)... ``` Proof State: ``` 7 goals h, w : nat Eq1 : ulist ref_list x, y, z : nat s : list nat H1 : sudoku s U1 : x < size U2 : y < size H2 : get (Pos x y) s = z x1, y1 : nat U3 : 0 < h U4 : 0 < w U5 : forall a b c : nat, a < b * c -> div a b < c U6 : forall n m : nat, 0 < m -> mod n m < m H6 : x1 < h H7 : y1 < w H3 : In (L (Pos (h * div x h + x1) (w * div y w + y1)) z) (rm_cont lit lit_test (fun l2 : list lit => l2) (L (Pos x y) z) (gen_rect (div x h * h + div y w) z)) H4 : nth (mod (h * div x h + x1) h * w + mod (w * div y w + y1) w) (rect (div (h * div x h + x1) h * h + div (w * div y w + y1) w) s) out = z ============================ mod (h * div x h + x1) h * w + mod (w * div y w + y1) w = mod x h * w + mod y w goal 2 is: h * div x h + x1 < size goal 3 is: w * div y w + y1 < size goal 4 is: div (h * div x h + x1) h * h + div (w * div y w + y1) w = div x h * h + div y w goal 5 is: False goal 6 is: Pos (h * div x h + x1) (w * div y w + y1) = Pos (h * div (div x h * h + div y w) h + x1) (w * mod (div x h * h + div y w) h + y1) goal 7 is: False ``` Next Tactic: ```
rewrite <LOOKUP>get_rect : forall (x y : nat) (s : list nat), x < size -> y < size -> get (Pos x y) s = nth (mod x h * w + mod y w) (rect (div x h * h + div y w) s) out</LOOKUP> in H2; auto. ```
{"final_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-dc8d4294a32dbb6e0a642dc553b64495f27e6d60-427448011e3341d35aa5b9e00f675f6582fcd477-8_15_2-8_15_2-16.git.json","initial_commit":"dc8d4294a32dbb6e0a642dc553b64495f27e6d60","file":"Sudoku.v"}
Ongoing Proof History: ``` Proof. induction m. simpl; auto. destruct o; simpl; intros. apply (SortA_app (eqA:=eq_key_elt)). 1-2: auto with typeclass_instances. constructor; auto. ``` Proof State: ``` 3 subgoals A : Type m, m', m'' : t A x, y, z : key e, e' : A t0_1 : tree A a : A t0_2 : tree A IHt0_1 : forall p : key, Sorted lt_key (xelements t0_1 p) IHt0_2 : forall p : key, Sorted lt_key (xelements t0_2 p) p : key ============================ HdRel lt_key (p, a) (xelements t0_2 (append p 3)) subgoal 2 is: forall x0 y0 : key * A, InA eq_key_elt x0 (xelements t0_1 (append p 2)) -> InA eq_key_elt y0 ((p, a) :: xelements t0_2 (append p 3)) -> lt_key x0 y0 subgoal 3 is: Sorted lt_key (xelements t0_1 (append p 2) ++ xelements t0_2 (append p 3)) ``` Next Tactic: ```
apply <LOOKUP>In_InfA : forall [A : Type] [ltA : A -> A -> Prop] [l : list A] [x : A], (forall y : A, In y l -> ltA x y) -> HdRel ltA x l</LOOKUP>; intros. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/FSets\/FMapPositive.v"}
Ongoing Proof History: ``` Proof. destruct n; intros. - omega. + lia. simpl. ? replace (n - 0) with n; [ | omega ]. ? reflexivity. ? Qed. ``` Proof State: ``` 1 goal T : Type n : nat a : T b : list T H : 0 < S n ============================ a :: firstn n b = a :: firstn (n - 0) b ``` Commit Diff: ``` diff --git a/examples/ConsiderDemo.v b/examples/ConsiderDemo.v index 2151e52..9490a21 100644 --- a/examples/ConsiderDemo.v +++ b/examples/ConsiderDemo.v @@ -7,0 +8 @@ Require Import Coq.ZArith.ZArith. +Require Import Coq.micromega.Lia. @@ -18 +19 @@ consider (ltb x y && ltb y z). -consider (ltb x z); auto. intros. exfalso. omega. +consider (ltb x z); auto. intros. exfalso. lia. @@ -27 +28 @@ intros. consider (ltb x y); consider (ltb y z); consider (ltb x z); intros; auto -exfalso; omega. +exfalso; lia. diff --git a/theories/Data/ListFirstnSkipn.v b/theories/Data/ListFirstnSkipn.v index cf126d1..54bfc69 100644 --- a/theories/Data/ListFirstnSkipn.v +++ b/theories/Data/ListFirstnSkipn.v @@ -2,0 +3 @@ Require Import Coq.ZArith.ZArith. +Require Import Coq.micromega.Lia. @@ -9,2 +10,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -f_equal. eapply IHn; eauto. omega. +exfalso; lia. +f_equal. eapply IHn; eauto. lia. @@ -18,2 +19,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -f_equal. eapply IHn; eauto. omega. +exfalso; lia. +f_equal. eapply IHn; eauto. lia. @@ -27,2 +28,2 @@ induction n; destruct a; simpl; intros; auto. -exfalso; omega. -simpl. f_equal. eapply IHn; omega. +exfalso; lia. +simpl. f_equal. eapply IHn; lia. @@ -47 +48 @@ Qed. -Hint Rewrite firstn_app_L firstn_app_R firstn_all firstn_0 firstn_cons using omega : list_rw. +Hint Rewrite firstn_app_L firstn_app_R firstn_all firstn_0 firstn_cons using lia : list_rw. @@ -54,2 +55,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -eapply IHn. omega. +exfalso; lia. +eapply IHn. lia. @@ -63,2 +64,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -eapply IHn. omega. +exfalso; lia. +eapply IHn. lia. @@ -79,2 +80,2 @@ induction n; destruct a; simpl in *; intros; auto. -exfalso; omega. -apply IHn; omega. +exfalso; lia. +apply IHn; lia. @@ -88,2 +89,2 @@ destruct n; intros. -omega. -simpl. replace (n - 0) with n; [ | omega ]. reflexivity. +lia. +simpl. replace (n - 0) with n; [ | lia ]. reflexivity. @@ -92 +93 @@ Qed. -Hint Rewrite skipn_app_L skipn_app_R skipn_0 skipn_all skipn_cons using omega : list_rw. \ No newline at end of file +Hint Rewrite skipn_app_L skipn_app_R skipn_0 skipn_all skipn_cons using lia : list_rw. \ No newline at end of file diff --git a/theories/Data/ListNth.v b/theories/Data/ListNth.v index d6a09d0..c2394fd 100644 --- a/theories/Data/ListNth.v +++ b/theories/Data/ListNth.v @@ -1,0 +2 @@ Require Import Coq.Lists.List. +Require Import Coq.Arith.Lt Coq.Arith.Plus. diff --git a/theories/Data/Map/FMapAList.v b/theories/Data/Map/FMapAList.v index 9d25baf..6d62e97 100644 --- a/theories/Data/Map/FMapAList.v +++ b/theories/Data/Map/FMapAList.v @@ -8,0 +9,9 @@ Require Import ExtLib.Structures.Functor. +From Coq Require +Import Basics. +From ExtLib +Require Import +Extras OptionMonad. +Import +FunNotation +FunctorNotation. +Open Scope program_scope. @@ -37,0 +47,14 @@ alist_find k ms end. +Definition alist_find' (k: K) : alist -> option V +:= fmap snd ∘ find (rel_dec k ∘ fst). + +Lemma alist_find_alt (m: alist) : forall k: K, +alist_find k m = alist_find' k m. +Proof. +induction m; intuition. +unfold alist_find', compose. +simpl. +destruct (k ?[ R ] a0) eqn:Heq; intuition. +rewrite IHm. +reflexivity. +Qed. + @@ -51,0 +75,13 @@ in fold_alist acc m end. + +Definition fold_alist' : T -> alist -> T +:= flip $ fold_left (flip $ uncurry f). + +Lemma fold_alist_alt (map: alist) : forall acc: T, +fold_alist acc map = fold_alist' acc map. +Proof. +induction map; intuition. +simpl. +rewrite IHmap. +reflexivity. +Qed. + diff --git a/theories/Data/Monads/ListMonad.v b/theories/Data/Monads/ListMonad.v index fd6906f..7023710 100644 --- a/theories/Data/Monads/ListMonad.v +++ b/theories/Data/Monads/ListMonad.v @@ -7,8 +7,4 @@ Set Strict Implicit. -Global Instance Monad_list : Monad list := -{ ret := fun _ v -=> v :: nil ; bind -:= fun _ _ => fix -recur c1 c2 := match c1 -with | nil => nil | -a :: b => c2 a -++ recur b c2 end }. +Global Instance Monad_list : Monad list := { ``` Next Tactic: ```
replace (n - 0) with n; [ | lia ]. ```
{"final_commit":"8f0f0228332007a1b73abb01fb9bf828023007fa","project":"coq-ext-lib","repair_file":"\/data\/coq-pearls\/repairs\/coq-ext-lib\/repair-coq-ext-lib-7532d92d1d6a9d7c9c45e111766f65421f6e09ba-8f0f0228332007a1b73abb01fb9bf828023007fa-8_12_2-8_14_1-5.git.json","initial_commit":"7532d92d1d6a9d7c9c45e111766f65421f6e09ba","file":"theories\/Data\/ListFirstnSkipn.v"}
Ongoing Proof History: ``` Proof. intros D H r Dr q Hq. generalize (le_eqorltNonnegativeRationals _ _ Hq) ; clear Hq. apply sumofmaps ; intros H0. - rewrite H0. exact Dr. - rewrite ltNonnegativeRationals_correct in H0. generalize (pr2 (pr2 H) _ _ H0). apply hinhuniv, sumofmaps ; intros Dq. ``` Proof State: ``` 2 subgoals D : hq β†’ hProp H : isOneSided D r : NonnegativeRationals Dr : D (pr1 r) q : NonnegativeRationals H0 : pr1 q < pr1 r Dq : D (pr1 q) ============================ D (pr1 q) subgoal 2 is: D (pr1 q) ``` Next Tactic: ```
+ ```
{"package":"coq-unimath","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/UniMath\/RealNumbers\/DedekindCuts.v"}
Ongoing Proof History: ``` - remember (RetF r2) as ot. hinduction INR before CIH; intros; inv Heqot; eauto with paco. - assert (DEC: (exists m3, ot3 = TauF m3) \/ (forall m3, ot3 <> TauF m3)). { destruct ot3; eauto; right; red; intros; inv H. } destruct DEC as [EQ | EQ]. + destruct EQ as [m3 ?]; subst. econstructor. right. pclearbot. eapply CIH; eauto with paco. - eapply eqit_inv_tauLR. + eapply eqit_inv_Tau. eauto. + inv INR; try (exfalso; eapply EQ; eauto; fail). econstructor; eauto. pclearbot. punfold REL. red in REL. hinduction REL0 before CIH; intros; try (exfalso; eapply EQ; eauto; fail). * remember (RetF r1) as ot. hinduction REL0 before CIH; intros; inv Heqot; eauto with paco. * remember (VisF e k1) as ot. - hinduction REL0 before CIH; intros; dependent destruction Heqot; eauto with paco. + hinduction REL0 before CIH; intros; try discriminate; eauto; inv_Vis. econstructor. intros. right. destruct (REL v), (REL0 v); try contradiction. eauto. * eapply IHREL0; eauto. pstep_reverse. destruct b1; inv CHECK0. ? apply eqit_inv_tauR. ? eauto. ? - ``` Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index 6298c6d..d772a5d 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -20 +20,3 @@ Data.Monads.EitherMonad. -Import MonadNotation. +Import +FunctorNotation +MonadNotation. @@ -55,0 +58,3 @@ Definition state (s a : Type) := s -> prod s a. +Definition liftState {s a f} `{Functor f} (fa : f a) : +Monads.stateT s f a := fun s => pair s <$> fa. + @@ -157 +162,32 @@ r -> iter_Prop step i r. -Polymorphic Instance MonadIter_Prop : MonadIter Ensembles.Ensemble := @iter_Prop. \ No newline at end of file +Polymorphic Instance MonadIter_Prop : MonadIter Ensembles.Ensemble := @iter_Prop. + + +Definition equiv_pred {A : Type} (R S: A -> Prop): +Prop := forall a, R a <-> S a. + +Definition sum_pred {A B : Type} (PA : A -> Prop) (PB : B -> Prop) : A + B -> +Prop := fun x => match x with | inl a => PA a | inr b => PB b end. + +Definition prod_pred {A B : Type} (PA : A -> Prop) (PB : B -> Prop) +: A * B -> Prop := fun '(a,b) => PA a /\ PB b. + +Definition TT {A : Type} : A -> Prop := fun _ => True. +Global Hint Unfold TT sum_pred prod_pred: core. + +Global Instance equiv_pred_refl {A} : Reflexive (@equiv_pred A). +Proof. +split; auto. +Qed. +Global Instance equiv_pred_symm {A} : Symmetric (@equiv_pred A). + +Proof. +red; intros * EQ; split; intros; eapply EQ; auto. +Qed. +Global Instance equiv_pred_trans {A} : Transitive (@equiv_pred A). +Proof. +red; intros * EQ1 EQ2; split; intros; (apply EQ1,EQ2 || apply EQ2,EQ1); auto. +Qed. +Global Instance equiv_pred_equiv {A} : Equivalence (@equiv_pred A). +Proof. +split; typeclasses eauto. +Qed. \ No newline at end of file diff --git a/theories/Basics/CategoryFacts.v b/theories/Basics/CategoryFacts.v index 63cfb1d..a684e54 100644 --- a/theories/Basics/CategoryFacts.v +++ b/theories/Basics/CategoryFacts.v @@ -121,0 +122,13 @@ Qed. +Context {t : obj}. +Context {Terminal_t : Terminal C t}. +Context {TerminalObject_t : TerminalObject C t}. + + +Lemma terminal_unique : forall a (f g +: C a t), f β©― g. +Proof. +intros. +rewrite (terminal_object f), (terminal_object g). +reflexivity. +Qed. + @@ -124 +137 @@ End CategoryFacts. -Hint Resolve @initial_unique : cat. ``` Proof State: ``` 1 subgoal E : Type -> Type R1 : Type R2 : Type R3 : Type RR1 : R1 -> R2 -> Prop RR2 : R2 -> R3 -> Prop b2 : bool r : rel2 (itree E R1) (fun _ : itree E R1 => itree E R3) CIH0 : forall (a0 : itree E R1) (a1 : itree E R3), bot2 a0 a1 -> r a0 a1 CIH : forall (x : itree E R1) (x0 : itree E R2) (x1 : itree E R3), eqit RR1 true b2 x x0 -> eqit RR2 true b2 x0 x1 -> r x x1 m2, t1 : itree E R2 ot2 : itree' E R3 CHECK : true REL0 : eqitF RR2 true b2 id (upaco2 (eqit_ RR2 true b2 id) bot2) (observe t1) ot2 IHREL0 : forall m1 : itree E R1, eqitF RR1 true b2 id (upaco2 (eqit_ RR1 true b2 id) bot2) (observe m1) (observe t1) -> (forall m3 : itree E R3, ot2 <> TauF m3) -> true -> eqitF (rcompose RR1 RR2) true b2 id (upaco2 (eqit_ (rcompose RR1 RR2) true b2 id) r) (observe m1) ot2 m1 : itree E R1 REL : eqitF RR1 true b2 id (upaco2 (eqit_ RR1 true b2 id) bot2) (observe m1) (TauF t1) EQ : forall m3 : itree E R3, ot2 <> TauF m3 ============================ paco2 (eqit_ RR1 true b2 id) bot2 m1 t1 ``` Next Tactic: ```
apply <LOOKUP>eqit_inv_Tau_r : forall (E : Type -> Type) (R1 R2 : Type) (RR : R1 -> R2 -> Prop) (b2 : bool) (t1 : itree E R1) (t2 : itree E R2), eqit RR true b2 t1 (Tau t2) -> eqit RR true b2 t1 t2</LOOKUP>. ```
{"final_commit":"f0a99a2e4751c033f4db1d29683e26aa0bab9d79","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-6f69653dfbd363117616c670169aaf80e9ff19a6-f0a99a2e4751c033f4db1d29683e26aa0bab9d79-8_13_2-8_10_2-19.git.json","initial_commit":"6f69653dfbd363117616c670169aaf80e9ff19a6","file":"theories\/Eq\/Eq.v"}
Proof State: ``` 2 subgoals Bn : nat -> R l : R H : Un_cv Bn l An := fun _ : nat => 1 : nat -> R H0 : forall n : nat, 0 < An n H1 : forall n : nat, 0 < sum_f_R0 An n M : R H2 : 0 < M m := up M : Z H3 : IZR (up M) > M H4 : IZR (up M) - M <= 1 H5 : (0 <= m)%Z ============================ exists N : nat, forall n : nat, (N <= n)%nat -> M < sum_f_R0 An n subgoal 2 is: Un_cv (fun n : nat => sum_f_R0 Bn (Init.Nat.pred n) / INR n) l ``` Ongoing Proof History: ``` Proof with trivial. intros Bn l H; set (An := fun _:nat => 1)... assert (H0 : forall n:nat, 0 < An n)... intro; unfold An; apply Rlt_0_1... assert (H1 : forall n:nat, 0 < sum_f_R0 An n)... intro; apply tech1... assert (H2 : cv_infty (fun n:nat => sum_f_R0 An n))... unfold cv_infty; intro; destruct (Rle_dec M 0) as [Hle|Hnle]... exists 0%nat; intros; apply Rle_lt_trans with 0... assert (H2 : 0 < M)... auto with real... clear Hnle; set (m := up M); elim (archimed M); intros; assert (H5 : (0 <= m)%Z)... apply le_IZR; unfold m; simpl; left; apply Rlt_trans with M... ``` Next Tactic: ```
elim (<LOOKUP>IZN : forall n : Z, (0 <= n)%Z -> exists m : nat, n = Z.of_nat m</LOOKUP> _ H5); intros; exists x; intros; unfold An; rewrite <LOOKUP>sum_cte : forall (x : R) (N : nat), sum_f_R0 (fun _ : nat => x) N = x * INR (S N)</LOOKUP>; rewrite <LOOKUP>Rmult_1_l : forall r : R, 1 * r = r</LOOKUP>; apply <LOOKUP>Rlt_trans : forall r1 r2 r3 : R, r1 < r2 -> r2 < r3 -> r1 < r3</LOOKUP> with (<LOOKUP>IZR : Z -> R</LOOKUP> (<LOOKUP>up : R -> Z</LOOKUP> M))... ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/Reals\/SeqSeries.v"}
Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index ff16faf..1f991e2 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -57,0 +58,2 @@ Definition state (s a : Type) := s -> prod s a. +Definition run_stateT {s m a} (x : stateT s m a) : s -> m (s * a)%type := x. + diff --git a/theories/Basics/HeterogeneousRelations.v b/theories/Basics/HeterogeneousRelations.v index 8894184..ad37cca 100644 --- a/theories/Basics/HeterogeneousRelations.v +++ b/theories/Basics/HeterogeneousRelations.v @@ -751 +751,21 @@ cbn in *. unfold diagonal_prop in *; tauto. -Qed. \ No newline at end of file +Qed. + + + + + +Definition option_rel {X : Type} (R : +relation X) : relation (option X) := +fun mx my => match mx,my with +| Some x, Some y => R +x y | None, None => True +| _, _ => False end. +Hint Unfold option_rel : core. + +Lemma option_rel_eq : forall {A : Type}, +eq_rel (@eq (option A)) (option_rel eq). +Proof. +intros ?; split; intros [] [] EQ; subst; try inv EQ; cbn; auto. +Qed. + +#[global] Hint Unfold option_rel : core. \ No newline at end of file diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 3f88726..eff8f67 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -69,0 +70,2 @@ Arguments itreeF _ _ : clear implicits. +Create HintDb itree. + diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index a1c2431..9949acf 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -113 +113 @@ intros ? ? ?. red. -induction 1; auto. +induction 1; auto with itree. diff --git a/theories/Dijkstra/ITreeDijkstra.v b/theories/Dijkstra/ITreeDijkstra.v index 9529757..dd17260 100644 --- a/theories/Dijkstra/ITreeDijkstra.v +++ b/theories/Dijkstra/ITreeDijkstra.v @@ -189 +189 @@ is_inf_cons (h : A) (t : stream A) : F t -> is_infF F (ConsF h t). -Hint Constructors is_infF : core. +Hint Constructors is_infF : itree. @@ -198 +198 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -217 +217 @@ s2 : stream A) : F s1 s2 -> bisimF F (ConsF h s1) (ConsF h s2). -Hint Constructors bisimF : core. +Hint Constructors bisimF : itree. @@ -226 +226 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -250 +250 @@ pfold. red. unfold app. pinversion H12. -- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto. +- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto with itree. @@ -282 +282 @@ stream' A -> Prop := | forall_nil : forall_streamF P F NilF | forall_cons (h : A -Hint Constructors forall_streamF : core. +Hint Constructors forall_streamF : itree. @@ -289 +289 @@ Proof. -red. intros. red. red in IN. destruct IN; auto. +red. intros. red. red in IN. destruct IN; auto with itree. @@ -301 +301 @@ F (observe_stream t) -> inf_manyF P F (ConsF h t) | cons_found (h : A) (t -Hint Constructors inf_manyF : core. +Hint Constructors inf_manyF : itree. @@ -308 +308 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -320,2 +320,2 @@ punfold Him. red in Him. pfold. red. -induction Him; auto. pclearbot. -auto. +induction Him; auto with itree. pclearbot. +auto with itree. @@ -355 +355 @@ sim ot1 (observe t2) -> eqitEF RR sim ot1 (TauF t2). -Hint Constructors eqitEF : core. +Hint Constructors eqitEF : itree. @@ -367 +367 @@ repeat red. intros. rename x0 into t1. rename x1 into t2. -induction IN; eauto. +induction IN; eauto with itree. @@ -378 +378 @@ r) | eventlessTau (t : itree E R) : F t -> eventlessF F (TauF t). -Hint Constructors eventlessF : core. +Hint Constructors eventlessF : itree. @@ -383 +383 @@ Prop) : itree E R -> Prop := fun t => eventlessF F (observe t). -Hint Unfold eventless_ : core. +Hint Unfold eventless_ : itree. @@ -390 +390 @@ Proof. -red. intros. red in IN. red. inversion IN; auto. +red. intros. red in IN. red. inversion IN; auto with itree. @@ -401,2 +401,2 @@ unfold_eqit. assert (Hev' : eventless t1); auto. punfold Hev. -dependent induction Heutt; subst; auto. -- rewrite <- x. auto. +dependent induction Heutt; subst; auto with itree. ``` Proof State: ``` 1 subgoal A : Type E : Type -> Type r : stream A -> stream A -> Prop CIH : forall x y : stream A, bisim x y -> r y x x, y : stream A H0 : bisim x y ============================ bisimF (upaco2 bisim_ r) (observe_stream y) (observe_stream x) ``` Ongoing Proof History: ``` Proof. constructor; red. - pcofix CIH. intros. pfold. red. - destruct (observe_stream x); auto. + destruct (observe_stream x); auto with itree. - pcofix CIH. intros. pfold. red. ? pinversion H0; subst; auto. ? - ? pcofix CIH. ``` Next Tactic: ```
pinversion H0; subst; auto with itree. ```
{"final_commit":"8fcf6f5f81ec9289d56e777b3885e715b3328486","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-1158ff1cbb628aeaa69973bf098058744d458c36-8fcf6f5f81ec9289d56e777b3885e715b3328486-8_10_2-8_12_2-97.git.json","initial_commit":"1158ff1cbb628aeaa69973bf098058744d458c36","file":"theories\/Dijkstra\/ITreeDijkstra.v"}
Proof State: ``` 2 subgoals A : Type B : Type JB : Join B PB : Perm_alg B SB : Sep_alg B CB : Disj_alg B Bdec : forall x : B, {identity x} + {~ identity x} X : Cross_alg B X0 : Cross_alg (A -> option (lifted JB)) a : A -> option (lifted JB) Ha : finMap a b : A -> option (lifted JB) Hb : finMap b c : A -> option (lifted JB) Hc : finMap c d : A -> option (lifted JB) Hd : finMap d z : A -> option (lifted JB) Hz : finMap z H : join (exist (finMap (B:=lifted JB)) a Ha) (exist (finMap (B:=lifted JB)) b Hb) (exist (finMap (B:=lifted JB)) z Hz) H0 : join (exist (finMap (B:=lifted JB)) c Hc) (exist (finMap (B:=lifted JB)) d Hd) (exist (finMap (B:=lifted JB)) z Hz) s, p, q, r : A -> option (lifted JB) H1 : join s p a H3 : join q r b H2 : join s q c H5 : join p r d ============================ finMap s subgoal 2 is: {x : fpm A (lifted JB) * fpm A (lifted JB) * fpm A (lifted JB) * fpm A (lifted JB) & let (p0, bd) := x in let (p1, bc) := p0 in let (ac, ad) := p1 in join ac ad (exist (finMap (B:=lifted JB)) a Ha) /\ join bc bd (exist (finMap (B:=lifted JB)) b Hb) /\ join ac bc (exist (finMap (B:=lifted JB)) c Hc) /\ join ad bd (exist (finMap (B:=lifted JB)) d Hd)} ``` Ongoing Proof History: ``` Proof. intros. assert (Cross_alg (A -> option (lifted JB))). apply cross_split_fun. apply Cross_smash; auto. hnf. intros [a Ha] [b Hb] [c Hc] [d Hd] [z Hz]. simpl; intros. destruct (X0 a b c d z); auto. destruct x as [[[s p] q] r]. decompose [and] y; clear y. assert (Hs : finMap s). ``` Next Tactic: ```
destruct Ha. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/msl\/cross_split.v"}
Ongoing Proof History: ``` Proof. constructor. repeat intro. reflexivity. intros ? ? E ? ?. symmetry. ``` Proof State: ``` 2 subgoals sign : Signature x, y : Object sign x0, y0 : x ⟢ y E : x0 = y0 b : sorts sign a : x b ============================ (` x0) b a = (` y0) b a subgoal 2 is: Transitive equiv ``` Next Tactic: ```
apply E. ```
{"package":"coq-math-classes","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/MathClasses\/categories\/algebras.v"}
Proof State: ``` 1 subgoal R : commring p : prime_ideal R x : ringmultabmonoid R ============================ hProp ``` Ongoing Proof History: ``` Proof. use make_submonoid. - intro x. ``` Next Tactic: ```
exact (Β¬ p x). ```
{"package":"coq-unimath","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/UniMath\/Algebra\/RigsAndRings\/Ideals.v"}
Ongoing Proof History: ``` lia. } rewrite jump_add. match goal with |- context [jump ?X s] => generalize (jump X s) end. intros l; rewrite <- jump_nth; generalize l; clear l. generalize (mod_lt x h U1). generalize (mod x h). cut (w <= size). - generalize size; intros m. - intros U3 n; generalize h; elim n; simpl... + intros U3 n; generalize h; elim n; simpl; auto with arith; clear n H1 H2 U1. - clear n H1 H2 U1. + - intros h1; case h1; simpl... + intros h1; case h1; simpl; auto. * intros HH; contradict HH... * intros n1 _ l. case (le_or_lt (length l) (mod y w)); intros H1. ++ rewrite jump_too_far. ** rewrite take_and_jump_nil. rewrite <- app_nil_end. apply sym_equal; apply take_nth... ** - pose proof (mod_lt y w). + apply le_trans with (1 := H1)... - lia. + apply le_trans with (2 := U3). + apply lt_le_weak; apply mod_lt... ++ rewrite nth_app_l. ** apply sym_equal; apply take_nth... left; apply mod_lt... ** case (le_or_lt (length l) w); intros H2. *** rewrite length_take_small... *** rewrite length_take... apply mod_lt... + intros n1 Rec h1; case h1; simpl. * intros HH; contradict HH... * intros h2 HH l. - case (le_or_lt (length l) w); intros H3. + case (le_or_lt (length l) w); intros H1. ++ rewrite nth_app_r. ** ? rewrite length_take_small, jump_too_far... ? *** ? rewrite take_and_jump_nil. ``` Proof State: ``` 1 goal h, w, x, y : nat s : list nat U2 : 0 < w F1 : div y w < h m : nat U3 : w <= m n1 : nat Rec : forall h : nat, n1 < h -> forall l : list nat, nth (n1 * m + mod y w) l out = nth (n1 * w + mod y w) (take_and_jump w m h l) out h1, h2 : nat HH : S n1 < S h2 l : list nat H1 : length l <= w ============================ nth (m + n1 * m + mod y w) l out = nth (w + n1 * w + mod y w - length (take w l)) (take_and_jump w m h2 (jump m l)) out ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 769776a..986e88b 100644 --- a/ListAux.v +++ b/ListAux.v @@ -130,0 +131,6 @@ Qed. +Theorem length_app: forall (l1 l2 : list A), length +(l1 ++ l2) = length l1 + length l2. +Proof. +apply app_length. +Qed. + @@ -272 +278 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite app_length, length_map, H; auto. +intros a l H; rewrite length_app, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index 7a13f04..e1936ca 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite app_length, length_take1; auto with arith. +rewrite length_app, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index f9e372e..8e8aed4 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -709 +709,2 @@ apply sym_equal; apply take_nth... -** pose proof (mod_lt y w). +** +pose proof (mod_lt y w). @@ -743 +744 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump... +rewrite length_take_and_jump; auto. @@ -760 +761,2 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. +rewrite le_plus_minus_r... @@ -846,2 +848,2 @@ l2 l3 -> lit_test l1 l3 = lit_test l1 l2. -Proof with auto. -intros l1 l2 l3; case l1; case l2; case l3; simpl... +Proof. +intros l1 l2 l3; case l1; case l2; case l3; simpl; auto. @@ -851 +853 @@ case_eq (pos_test p2 p3); intros H1. -rewrite (pos_test_trans p1 p2 p3); rewrite H... +rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. @@ -853,2 +855,2 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1)... -rewrite H... +apply pos_test_exact with (1 := H1); auto. +rewrite H; auto. @@ -856,4 +858,4 @@ intros; discriminate. -replace p1 with p2... -case_eq (pos_test p2 p3); intros H1... -intros; apply test_trans... -apply sym_equal; apply pos_test_exact with (1 := H)... +replace p1 with p2; auto. +case_eq (pos_test p2 p3); intros H1; auto. +intros; apply test_trans; auto. +apply sym_equal; apply pos_test_exact with (1 := H); auto. @@ -863,3 +865,3 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1)... -rewrite H... -rewrite (pos_test_trans p1 p2 p3); rewrite H... +apply pos_test_exact with (1 := H1); auto. +rewrite H; auto. +rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. @@ -1445,2 +1447,2 @@ ordered cs -> ordered (clauses_update l c cs). -Proof with auto with datatypes. -intros l c cs; elim cs; simpl... +Proof. +intros l c cs; elim cs; simpl; auto. ``` Next Tactic: ```
rewrite <LOOKUP>length_take_small : forall (A : Set) (i : nat) (l : list A), length l <= i -> length (take i l) = length l</LOOKUP>... ```
{"final_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-dc8d4294a32dbb6e0a642dc553b64495f27e6d60-427448011e3341d35aa5b9e00f675f6582fcd477-8_15_2-8_15_2-29.git.json","initial_commit":"dc8d4294a32dbb6e0a642dc553b64495f27e6d60","file":"Sudoku.v"}
Ongoing Proof History: ``` Proof. intros x'; destruct (decide (x' = x)) as [->|]. - by rewrite discrete_fun_lookup_op !discrete_fun_lookup_singleton. - ``` Proof State: ``` 1 subgoal A : Type EqDecision0 : EqDecision A B : A β†’ ucmra x : A y1, y2 : B x x' : A n : x' β‰  x ============================ (discrete_fun_singleton x y1 β‹… discrete_fun_singleton x y2) x' ≑ discrete_fun_singleton x (y1 β‹… y2) x' ``` Next Tactic: ```
by rewrite <LOOKUP>discrete_fun_lookup_op : βˆ€ (A : Type) (B : A β†’ ucmra) (f g : discrete_fun (Ξ» x : A, B x)) (x : A), (f β‹… g) x = f x β‹… g x</LOOKUP> !<LOOKUP>discrete_fun_lookup_singleton_ne : βˆ€ x x' (y : B x), x β‰  x' β†’ discrete_fun_singleton x y x' = Ξ΅</LOOKUP> // <LOOKUP>left_id : βˆ€ (A : Type) (R : relation A) (i : A) (f : A β†’ A β†’ A), LeftId R i f β†’ βˆ€ x : A, R (f i x) x</LOOKUP>. ```
{"package":"coq-iris","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/iris\/algebra\/functions.v"}
Ongoing Proof History: ``` Proof. intros. induction Q. + simpl; auto. + simpl. split. - apply H; simpl; auto. ``` Proof State: ``` This subproof is complete, but there are some unfocused goals. Focus next goal with bullet -. 1 subgoal subgoal 1 is: fold_right (` and) (` True) Q rho ``` Next Tactic: ```
- ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/floyd\/local2ptree_denote.v"}
Ongoing Proof History: ``` Proof using. intros. ``` Proof State: ``` 1 subgoal A : Type m, m', m'' : t A x, y, z : key e, e' : A p : positive p0 : key q : positive m0 : t A v : A H : List.In (p0, v) (xelements m0 (append p q~1)) ============================ E.bits_lt p p0 ``` Next Tactic: ```
generalize (<LOOKUP>xelements_complete : forall (i j : key) (m : t A) (v : A), List.In (i, v) (xelements m j) -> xfind i j m = Some v</LOOKUP> _ _ _ _ H); clear H; intros. ```
{"package":"coq","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/theories\/FSets\/FMapPositive.v"}
Ongoing Proof History: ``` Proof. apply Build_Component with OKp; trivial. + apply Condition1. + apply LNR_VGI. + apply LNR_E. + apply LNR_Exports. + apply Condition2. + apply G_dom. + apply G_E. + apply G_justified. + apply G_Exports. ``` Proof State: ``` This subproof is complete, but there are some unfocused goals. Focus next goal with bullet +. 1 subgoal subgoal 1 is: forall gv : globals, globals_ok gv -> InitGPred (Vardefs p) gv |-- GP1 gv * GP2 gv ``` Next Tactic: ```
+ ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/floyd\/Component.v"}
Proof State: ``` 2 goals h, w : nat Eq1 : ulist ref_list x, y, z : nat s : list nat H1 : sudoku s U1 : x < size U2 : y < size H2 : get (Pos x y) s = z x1, y1 : nat U3 : 0 < h U4 : 0 < w U5 : forall a b c : nat, a < b * c -> div a b < c U6 : forall n m : nat, 0 < m -> mod n m < m H6 : x1 < h H7 : y1 < w ============================ div y w < h goal 2 is: False ``` Ongoing Proof History: ``` repeat rewrite (fun x => mult_comm x h). - unfold out in H4; rewrite H4; auto. + unfold out in H4; rewrite H4... - repeat rewrite (mult_comm h); auto. + repeat rewrite (mult_comm h)... - unfold size; repeat rewrite (mult_comm h); apply mult_lt_plus; auto. + unfold size; repeat rewrite (mult_comm h); apply mult_lt_plus... - unfold size; rewrite (mult_comm w); apply mult_lt_plus; auto. + unfold size; rewrite (mult_comm w); apply mult_lt_plus... - apply div_lt; rewrite mult_comm; auto. + apply div_lt; rewrite mult_comm... repeat rewrite div_mult_comp; auto with arith. rewrite (div_is_0 x1); auto with arith. rewrite (div_is_0 y1); auto with arith. case H; clear H; intros V1 V2; rewrite V1 in H3; rewrite V2 in H3. match goal with H:(In ?X _) |- _ => apply (rm_not_in _ lit_test) with (a := X) (l1 := X::nil) (l2 := gen_rect (div x h * h + div y w) z); auto with datatypes end. exact lit_test_trans. intros; apply lit_test_anti_sym. exact lit_test_exact. apply olist_one. apply gen_rect_ordered. repeat rewrite (fun x => mult_comm x h). repeat ((rewrite mod_mult_comp || rewrite div_mult_comp); auto). - rewrite (div_is_0 (div y w) h); auto. + rewrite (div_is_0 (div y w) h)... - rewrite (mod_small (div y w) h); auto. + rewrite (mod_small (div y w) h)... - apply div_lt; rewrite (mult_comm w); auto. + apply div_lt; rewrite (mult_comm w)... ? apply div_lt; rewrite (mult_comm w); auto. ? case (gen_cell_correct l x y); auto; intros tmp; case tmp; auto; clear tmp. ? apply (rm_incl _ lit_test) with (l1 := L (Pos x y) z::nil) (l2 := gen_cell (Pos x y)); auto. ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 986e88b..769776a 100644 --- a/ListAux.v +++ b/ListAux.v @@ -131,6 +130,0 @@ Qed. -Theorem length_app: forall (l1 l2 : list A), length -(l1 ++ l2) = length l1 + length l2. -Proof. -apply app_length. -Qed. - @@ -278 +272 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app, length_map, H; auto. +intros a l H; rewrite app_length, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index e1936ca..7a13f04 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite length_app, length_take1; auto with arith. +rewrite app_length, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index 5083f1b..abf9251 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm; auto. +apply div_lt; rewrite mult_comm... @@ -677,6 +677,2 @@ apply div_lt; rewrite mult_comm; auto. -repeat (rewrite (fun x => -mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp; auto. -rewrite (mod_small (div y w) h); auto. -rewrite (div_is_0 (div y w) h); auto. -rewrite plus_0_r. +repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... @@ -703,3 +699,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl; -auto with arith; clear n H1 H2 U1. -+ intros h1; case h1; simpl; auto. +intros U3 n; generalize h; elim n; simpl... +clear n H1 H2 U1. ++ intros h1; case h1; simpl... @@ -713,3 +709,2 @@ apply sym_equal; apply take_nth... -** apply le_trans with (1 := H1)... -apply le_trans with (2 := U3). -apply lt_le_weak; apply mod_lt... +** pose proof (mod_lt y w). +lia. @@ -726 +721 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H1. +case (le_or_lt (length l) w); intros H3. @@ -728,2 +723 @@ case (le_or_lt (length l) w); intros H1. -** rewrite length_take_small... -rewrite jump_too_far. +** rewrite length_take_small, jump_too_far... @@ -732,2 +726,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H1)... -*** apply le_trans with (1 := H1)... +apply le_trans with (1 := H3)... +*** apply le_trans with (1 := H3)... @@ -738,2 +732 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth; rewrite jump_add. -rewrite <- jump_nth... +rewrite jump_nth, jump_add, <- jump_nth... @@ -750 +743 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump; auto. +rewrite length_take_and_jump... @@ -767,2 +760 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. -rewrite le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... ``` Next Tactic: ```
apply <LOOKUP>div_lt : forall a b c : nat, a < b * c -> div a b < c</LOOKUP>; rewrite (mult_comm w)... ```
{"final_commit":"5337edcaf31b9f036a0a6651b2f733d3068b8f8f","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-427448011e3341d35aa5b9e00f675f6582fcd477-5337edcaf31b9f036a0a6651b2f733d3068b8f8f-8_15_2-8_15_2-41.git.json","initial_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","file":"Sudoku.v"}
Ongoing Proof History: ``` + gstep. red. simpobs. econstructor. gbase. destruct REL. * eapply CIH. econstructor; [|eauto using paco2_mon with paco|]. -- eapply eqit_trans; [apply REL0|]. rewrite tau_eutt. reflexivity. -- auto_ctrans. * eapply CIH0. apply CLOL. econstructor; [|eauto|]. -- eapply eqit_trans; [apply REL0|]. rewrite tau_eutt. reflexivity. -- auto_ctrans. + punfold REL0. red in REL0. simpl in *. remember (VisF e k1) as ot. genobs m1 ot2. hinduction REL0 before CIH; intros; subst; try dependent destruction Heqot; cycle 1. * gclo; econstructor; auto_ctrans_eq; try reflexivity. ? rewrite (simpobs Heqot1), tau_eutt. ? reflexivity. ? * ``` Commit Diff: ``` diff --git a/theories/Basics/CategoryKleisliFacts.v b/theories/Basics/CategoryKleisliFacts.v index e0b955f..d6eecd6 100644 --- a/theories/Basics/CategoryKleisliFacts.v +++ b/theories/Basics/CategoryKleisliFacts.v @@ -59,0 +60,8 @@ Qed. + + + + + + + + diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 57c2013..9b33167 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -242 +242 @@ Notation "t1 >>= k2" := (ITree.bind t1 k2) -(at level 50, left associativity) : itree_scope. +(at level 58, left associativity) : itree_scope. diff --git a/theories/Core/KTree.v b/theories/Core/KTree.v index 7740c5f..49acfb6 100644 --- a/theories/Core/KTree.v +++ b/theories/Core/KTree.v @@ -69,4 +69 @@ Local Notation ktree := (ktree E). -End Operations. - -Notation iter := (@iter _ (ktree _) sum _ _ _). -Notation loop := (@loop _ (ktree _) sum _ _ _ _ _ _ _ _ _). \ No newline at end of file +End Operations. \ No newline at end of file diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index 37d0ea8..1c27491 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -47 +47 @@ intros [a | b] _ []. -- rewrite bind_ret_l, tau_eutt. +- rewrite bind_ret_l, tau_euttge. @@ -129,4 +129,4 @@ Qed. ``` Proof State: ``` 1 subgoal E : Type -> Type R2 : Type R1 : Type RR : R1 -> R2 -> Prop vclo : rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) -> rel2 (itree E R1) (fun _ : itree E R1 => itree E R2) r : itree E R1 -> itree E R2 -> Prop MON : monotone2 vclo COMP : wcompatible2 (eqit_ RR true true vclo) (transD RR) CLOV : forall r : itree E R1 -> itree E R2 -> Prop, (forall (x0 : itree E R1) (x1 : itree E R2), transL r x0 x1 -> r x0 x1) -> forall (x0 : itree E R1) (x1 : itree E R2), transL (vclo r) x0 x1 -> vclo r x0 x1 CLOL : forall (x0 : itree E R1) (x1 : itree E R2), transL r x0 x1 -> r x0 x1 CLOD : forall (x0 : itree E R1) (x1 : itree E R2), transD RR r x0 x1 -> r x0 x1 r0 : itree E R1 -> itree E R2 -> Prop CIH0 : forall (x0 : itree E R1) (x1 : itree E R2), r x0 x1 -> r0 x0 x1 CIH : forall (x2 : itree E R1) (x3 : itree E R2), transL (gupaco2 (eqit_ RR true true vclo) (transD RR) r) x2 x3 -> r0 x2 x3 RR1 : R1 -> R1 -> Prop t1 : itree E R1 CHECK : true u : Type e : E u k1 : u -> itree E R1 IHREL0 : forall (u0 : Type) (e0 : E u0) (k2 : u0 -> itree E R1) (k3 : u0 -> itree E R2), (forall v : u0, vclo (upaco2 (eqit_ RR true true vclo) r) (k2 v) (k3 v)) -> forall m1 t' : itree E R1, VisF e k1 = VisF e0 k2 -> VisF e k1 = observe t' -> observe t1 = observe m1 -> forall (t1 : itree E R1) (t2 : itree E R2), TauF m1 = observe t1 -> (forall (x x' : R1) (y : R2), RR1 x x' -> RR x' y -> RR x y) -> VisF e0 k3 = observe t2 -> gpaco2 (eqit_ RR true true vclo) (transD RR) r r0 t1 t2 REL0 : eqitF RR1 true true id (upaco2 (eqit_ RR1 true true id) bot2) (observe t1) (VisF e k1) k2 : u -> itree E R2 REL : forall v : u, vclo (upaco2 (eqit_ RR true true vclo) r) (k1 v) (k2 v) m1, t' : itree E R1 Heqot' : VisF e k1 = observe t' Heqot0 : TauF t1 = observe m1 t0 : itree E R1 t2 : itree E R2 Heqot1 : TauF m1 = observe t0 LERR : forall (x x' : R1) (y : R2), RR1 x x' -> RR x' y -> RR x y Heqot2 : VisF e k2 = observe t2 ============================ eqit eq true false t0 m1 ``` Next Tactic: ```
rewrite (<LOOKUP>simpobs : forall (E : Type -> Type) (R : Type) (ot : itree' E R) (t : itree E R), ot = observe t -> t β‰… {| _observe := ot |}</LOOKUP> Heqot1), <LOOKUP>tau_euttge : forall (E : Type -> Type) (R : Type) (t : itree E R), Tau t ≳ t</LOOKUP>. ```
{"final_commit":"6b6e1763da94788e6204f549039421936cad4437","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-75a5a716bb6a18a6fdca492391f694fb344ea589-6b6e1763da94788e6204f549039421936cad4437-8_10_2-8_10_2-1.git.json","initial_commit":"75a5a716bb6a18a6fdca492391f694fb344ea589","file":"theories\/Eq\/UpToTaus.v"}
Ongoing Proof History: ``` + intros U3 n; generalize h; elim n; simpl... + clear n H1 H2 U1. + - intros h1; case h1; simpl; auto. + intros h1; case h1; simpl... * intros HH; contradict HH... * intros n1 _ l. case (le_or_lt (length l) (mod y w)); intros H1. ++ rewrite jump_too_far. ** rewrite take_and_jump_nil. rewrite <- app_nil_end. apply sym_equal; apply take_nth... ** - apply le_trans with (1 := H1)... + pose proof (mod_lt y w). - apply le_trans with (2 := U3). + lia. - apply lt_le_weak; apply mod_lt... ++ rewrite nth_app_l. ** apply sym_equal; apply take_nth... left; apply mod_lt... ** case (le_or_lt (length l) w); intros H2. *** rewrite length_take_small... *** rewrite length_take... apply mod_lt... + intros n1 Rec h1; case h1; simpl. * intros HH; contradict HH... * intros h2 HH l. - case (le_or_lt (length l) w); intros H1. + case (le_or_lt (length l) w); intros H3. ++ rewrite nth_app_r. ** - rewrite length_take_small... + rewrite length_take_small, jump_too_far... - rewrite jump_too_far. *** rewrite take_and_jump_nil. repeat rewrite nth_default... - apply le_trans with (1 := H1)... + apply le_trans with (1 := H3)... *** - apply le_trans with (1 := H1)... + apply le_trans with (1 := H3)... ** rewrite length_take_small... ++ rewrite nth_app_r. ** rewrite length_take... repeat rewrite <- plus_assoc; rewrite minus_plus... - rewrite jump_nth; rewrite jump_add. + rewrite jump_nth, jump_add, <- jump_nth... ? rewrite <- jump_nth... ? ** ? rewrite length_take... ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 986e88b..769776a 100644 --- a/ListAux.v +++ b/ListAux.v @@ -131,6 +130,0 @@ Qed. -Theorem length_app: forall (l1 l2 : list A), length -(l1 ++ l2) = length l1 + length l2. -Proof. -apply app_length. -Qed. - @@ -278 +272 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app, length_map, H; auto. +intros a l H; rewrite app_length, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index e1936ca..7a13f04 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite length_app, length_take1; auto with arith. +rewrite app_length, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index 5083f1b..e294c2a 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -713,2 +713 @@ apply sym_equal; apply take_nth... -** apply le_trans with (1 := H1)... -apply le_trans with (2 := U3). +** apply le_trans with (1 := H1)... apply le_trans with (2 := U3). @@ -750 +749 @@ generalize (w_pos _ H); intros U2. -rewrite length_take_and_jump; auto. +rewrite length_take_and_jump... @@ -767,2 +766 @@ rewrite (plus_assoc w). -pattern w at 1; rewrite <- mult_1_r; rewrite <- mult_plus_distr_l. -rewrite le_plus_minus_r... +pattern w at 1; rewrite <- mult_1_r, <- mult_plus_distr_l, le_plus_minus_r... @@ -854,2 +852,2 @@ l2 l3 -> lit_test l1 l3 = lit_test l1 l2. -Proof. -intros l1 l2 l3; case l1; case l2; case l3; simpl; auto. +Proof with auto. +intros l1 l2 l3; case l1; case l2; case l3; simpl... @@ -859 +857 @@ case_eq (pos_test p2 p3); intros H1. -rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. +rewrite (pos_test_trans p1 p2 p3); rewrite H... @@ -861,2 +859,2 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1); auto. -rewrite H; auto. +apply pos_test_exact with (1 := H1)... +rewrite H... @@ -864,4 +862,4 @@ intros; discriminate. -replace p1 with p2; auto. -case_eq (pos_test p2 p3); intros H1; auto. -intros; apply test_trans; auto. -apply sym_equal; apply pos_test_exact with (1 := H); auto. +replace p1 with p2... +case_eq (pos_test p2 p3); intros H1... +intros; apply test_trans... +apply sym_equal; apply pos_test_exact with (1 := H)... @@ -871,3 +869,3 @@ assert (p2 = p3); subst. -apply pos_test_exact with (1 := H1); auto. -rewrite H; auto. -rewrite (pos_test_trans p1 p2 p3); rewrite H; auto. +apply pos_test_exact with (1 := H1)... +rewrite H... +rewrite (pos_test_trans p1 p2 p3); rewrite H... @@ -1453,2 +1451,2 @@ ordered cs -> ordered (clauses_update l c cs). -Proof. -intros l c cs; elim cs; simpl; auto. +Proof with auto with datatypes. +intros l c cs; elim cs; simpl... @@ -1456,7 +1454,7 @@ intros (n1, c1) cs1 Rec H H1; case (lit_is_in l c1). -apply Rec; auto. -intros n2 c2 H2; apply (H1 n2 c2); auto with datatypes. -apply clause_insert_ordered; auto. -apply lit_rm_ordered; auto. -apply (H1 n1 c1); auto with datatypes. -apply Rec; auto. -intros n2 c2 H2; apply (H1 n2 c2); auto with datatypes. +apply Rec... ``` Proof State: ``` This subproof is complete, but there are some unfocused goals. Focus next goal with bullet **. 2 goals goal 1 is: length (take w l) <= w + n1 * w + mod y w goal 2 is: w <= size ``` Next Tactic: ```
** ```
{"final_commit":"5337edcaf31b9f036a0a6651b2f733d3068b8f8f","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-427448011e3341d35aa5b9e00f675f6582fcd477-5337edcaf31b9f036a0a6651b2f733d3068b8f8f-8_15_2-8_15_2-31.git.json","initial_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","file":"Sudoku.v"}
Proof State: ``` 1 subgoal m : hz is : hzneq 0 m a, b : fpscommring hz n : nat IHn : hzquotientmod m is (precarry (a + b) n) = hzquotientmod m is (precarry a n) + hzquotientmod m is (precarry b n) + hzquotientmod m is (precarry (carry a + carry b) n) pa := precarry a (S n) : hz pb := precarry b (S n) : hz ab := precarry (carry a + carry b) : nat β†’ hz ============================ (hzremaindermod m is pa + hzremaindermod m is (pb + hzquotientmod m is (ab n)))%hz = (hzremaindermod m is pa + hzremaindermod m is (carry b (S n) + hzquotientmod m is (ab n))%ring)%hz ``` Ongoing Proof History: ``` Proof. intros. induction n. - simpl. change ( hzquotientmod m is ( a 0%nat + b 0%nat ) = hzquotientmod m is (a 0%nat) + hzquotientmod m is (b 0%nat) + hzquotientmod m is ( hzremaindermod m is ( a 0%nat ) + hzremaindermod m is ( b 0%nat ) ) ). rewrite hzquotientmodandplus. apply idpath. - change ( hzquotientmod m is ( a ( S n ) + b ( S n ) + hzquotientmod m is ( precarry (a + b) n ) ) = hzquotientmod m is (precarry a (S n)) + hzquotientmod m is (precarry b (S n)) + hzquotientmod m is (carry a ( S n ) + carry b ( S n ) + hzquotientmod m is ( precarry (carry a + carry b) n)) ). rewrite IHn. rewrite ( ringassoc1 hz ( a ( S n ) ) ( b ( S n ) ) _ ). rewrite <- ( ringassoc1 hz ( b ( S n ) ) ). rewrite ( ringcomm1 hz ( b ( S n ) ) _ ). rewrite <- 3! ( ringassoc1 hz ( a ( S n ) ) _ _ ). change ( a ( S n ) + hzquotientmod m is ( precarry a n ) ) with ( precarry a ( S n ) ). set ( pa := precarry a ( S n ) ). rewrite ( ringassoc1 hz pa _ ( b ( S n ) ) ). rewrite ( ringcomm1 hz _ ( b ( S n ) ) ). change ( b ( S n ) + hzquotientmod m is ( precarry b n ) ) with ( precarry b ( S n ) ). set ( pb := precarry b ( S n ) ). set ( ab := precarry ( carry a + carry b ) ). rewrite ( ringassoc1 hz ( carry a ( S n ) ) ( carry b ( S n ) ) ( hzquotientmod m is ( ab n ) ) ). rewrite ( hzquotientmodandplus m is ( carry a ( S n ) ) _ ). unfold carry at 1. rewrite <- hzqrandremainderq. rewrite hzplusl0. rewrite ( hzquotientmodandplus m is ( carry b ( S n ) ) _ ). unfold carry at 1. rewrite <- hzqrandremainderq. rewrite hzplusl0. rewrite ( ringassoc1 hz pa pb _ ). rewrite ( hzquotientmodandplus m is pa _ ). change (pb + hzquotientmod m is (ab n)) with (pb + hzquotientmod m is (ab n))%hz. rewrite ( hzquotientmodandplus m is pb ( hzquotientmod m is ( ab n ) ) ). rewrite <- 2! ( ringassoc1 hz ( hzquotientmod m is pa ) _ _ ). rewrite <- 2! ( ringassoc1 hz ( hzquotientmod m is pa + hzquotientmod m is pb ) _ ). rewrite 2! ( ringassoc1 hz ( hzquotientmod m is pa + hzquotientmod m is pb + hzquotientmod m is (hzquotientmod m is (ab n)) ) _ _ ). apply ( maponpaths ( fun x : hz => hzquotientmod m is pa + hzquotientmod m is pb + hzquotientmod m is (hzquotientmod m is (ab n)) + x ) ). unfold carry at 1 2. rewrite 2! hzremaindermoditerated. change ( precarry b ( S n ) ) with pb. change ( precarry a ( S n ) ) with pa. apply ( maponpaths ( fun x : hz => ( hzquotientmod m is (hzremaindermod m is pb + hzremaindermod m is (hzquotientmod m is (ab n)))%hz ) + x ) ). apply maponpaths. ``` Next Tactic: ```
apply ( <LOOKUP>maponpaths : ∏ (T1 T2 : UU) (f : T1 β†’ T2) (t1 t2 : T1), t1 = t2 β†’ f t1 = f t2</LOOKUP> ( fun x : <LOOKUP>hz : commring</LOOKUP> => <LOOKUP>hzremaindermod : ∏ p : hz, hzneq 0 p β†’ hz β†’ hz</LOOKUP> m is pa + x ) ). ```
{"package":"coq-unimath","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/UniMath\/PAdics\/padics.v"}
Ongoing Proof History: ``` Proof. repeat red. pcofix CIH. intros t1 t2 Heutt Hev. pfold. punfold Heutt. red. unfold_eqit. assert (Hev' : eventless t1); auto. punfold Hev. - dependent induction Heutt; subst; auto. + dependent induction Heutt; subst; auto with itree. - rewrite <- x. - auto. + auto with itree. - rewrite <- x. constructor. right. eapply CIH; eauto. specialize (itree_eta t1) as Ht1. rewrite <- x0 in Ht1. rewrite Ht1. rewrite tau_eutt. pclearbot. auto. - red in Hev. inversion Hev; subst. + rewrite <- H0 in x0. discriminate. + rewrite <- H in x0. discriminate. - red in Hev. rewrite <- x in Hev. inversion Hev; subst. pclearbot. eapply IHHeutt; try apply H0; eauto. red. punfold H0. - rewrite <- x. constructor. right. ? eapply CIH; eauto. ? Qed. ``` Proof State: ``` 1 subgoal E1 : Type -> Type R : Type E : Type -> Type r : itree E1 R -> Prop t1, t0 : itree E1 R CHECK : is_true true Heutt : eqitF eq true true id (upaco2 (eqit_ eq true true id) bot2) (observe t1) (observe t0) IHHeutt : (forall x y : itree E1 R, x β‰ˆ y -> eventless x -> r y) -> forall t2 t3 : itree E1 R, R = R -> eq ~= eq -> true = true -> true = true -> id ~= id -> upaco2 (eqit_ eq true true id) bot2 ~= upaco2 (eqit_ eq true true id) bot2 -> observe t1 = observe t2 -> observe t0 ~= observe t3 -> eventless_ (upaco1 eventless_ bot1) t2 -> eventless t2 -> eventlessF (upaco1 eventless_ r) (observe t3) CIH : forall x y : itree E1 R, x β‰ˆ y -> eventless x -> r y t2 : itree E1 R x : TauF t0 = observe t2 Hev : eventless_ (upaco1 eventless_ bot1) t1 Hev' : eventless t1 ============================ r t0 ``` Commit Diff: ``` diff --git a/theories/Basics/Basics.v b/theories/Basics/Basics.v index ff16faf..1f991e2 100644 --- a/theories/Basics/Basics.v +++ b/theories/Basics/Basics.v @@ -57,0 +58,2 @@ Definition state (s a : Type) := s -> prod s a. +Definition run_stateT {s m a} (x : stateT s m a) : s -> m (s * a)%type := x. + diff --git a/theories/Basics/HeterogeneousRelations.v b/theories/Basics/HeterogeneousRelations.v index 8894184..ad37cca 100644 --- a/theories/Basics/HeterogeneousRelations.v +++ b/theories/Basics/HeterogeneousRelations.v @@ -751 +751,21 @@ cbn in *. unfold diagonal_prop in *; tauto. -Qed. \ No newline at end of file +Qed. + + + + + +Definition option_rel {X : Type} (R : +relation X) : relation (option X) := +fun mx my => match mx,my with +| Some x, Some y => R +x y | None, None => True +| _, _ => False end. +Hint Unfold option_rel : core. + +Lemma option_rel_eq : forall {A : Type}, +eq_rel (@eq (option A)) (option_rel eq). +Proof. +intros ?; split; intros [] [] EQ; subst; try inv EQ; cbn; auto. +Qed. + +#[global] Hint Unfold option_rel : core. \ No newline at end of file diff --git a/theories/Core/ITreeDefinition.v b/theories/Core/ITreeDefinition.v index 3f88726..eff8f67 100644 --- a/theories/Core/ITreeDefinition.v +++ b/theories/Core/ITreeDefinition.v @@ -69,0 +70,2 @@ Arguments itreeF _ _ : clear implicits. +Create HintDb itree. + diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index a1c2431..9949acf 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -113 +113 @@ intros ? ? ?. red. -induction 1; auto. +induction 1; auto with itree. diff --git a/theories/Dijkstra/ITreeDijkstra.v b/theories/Dijkstra/ITreeDijkstra.v index 9529757..875d3b0 100644 --- a/theories/Dijkstra/ITreeDijkstra.v +++ b/theories/Dijkstra/ITreeDijkstra.v @@ -189 +189 @@ is_inf_cons (h : A) (t : stream A) : F t -> is_infF F (ConsF h t). -Hint Constructors is_infF : core. +Hint Constructors is_infF : itree. @@ -198 +198 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -217 +217 @@ s2 : stream A) : F s1 s2 -> bisimF F (ConsF h s1) (ConsF h s2). -Hint Constructors bisimF : core. +Hint Constructors bisimF : itree. @@ -226 +226 @@ Proof. -red. intros. red in IN. red. induction IN; auto. +red. intros. red in IN. red. induction IN; auto with itree. @@ -234 +234 @@ constructor; red. -- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto. +- pcofix CIH. intros. pfold. red. destruct (observe_stream x); auto with itree. @@ -237 +237 @@ pfold. red. -pinversion H0; subst; auto. +pinversion H0; subst; auto with itree. @@ -239 +239 @@ pinversion H0; subst; auto. -pinversion H0; pinversion H1; auto. +pinversion H0; pinversion H1; auto with itree. @@ -250 +250 @@ pfold. red. unfold app. pinversion H12. -- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto. +- simpl. destruct s3. destruct s4. pinversion H34; simpl in *; subst; auto with itree. ``` Next Tactic: ```
eapply CIH; eauto with itree. ```
{"final_commit":"8fcf6f5f81ec9289d56e777b3885e715b3328486","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-1158ff1cbb628aeaa69973bf098058744d458c36-8fcf6f5f81ec9289d56e777b3885e715b3328486-8_10_2-8_12_2-104.git.json","initial_commit":"1158ff1cbb628aeaa69973bf098058744d458c36","file":"theories\/Dijkstra\/ITreeDijkstra.v"}
Ongoing Proof History: ``` Proof. ``` Proof State: ``` 1 subgoal ============================ forall a b : Share.t, Share.glb a b = Share.bot -> Share.glb (Share.comp a) b = b ``` Next Tactic: ```
intros. ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/veric\/shares.v"}
Proof State: ``` 1 subgoal Ξ£ : gFunctors heapGS0 : heapGS Ξ£ l : loc dq : dfrac v : val vs : list val ============================ l β†¦βˆ—{dq} (v :: vs) ⊣⊒ l ↦{dq} v βˆ— (l +β‚— 1) β†¦βˆ—{dq} vs ``` Ongoing Proof History: ``` Proof. ``` Next Tactic: ```
rewrite /<LOOKUP>array : βˆ€ Ξ£ : gFunctors, heapGS Ξ£ β†’ loc β†’ dfrac β†’ list val β†’ iProp Ξ£</LOOKUP> <LOOKUP>big_sepL_cons : βˆ€ (PROP : bi) (A : Type) (Ξ¦ : nat β†’ A β†’ PROP) (x : A) (l : list A), ([βˆ— list] k↦y ∈ (x :: l), Ξ¦ k y) ⊣⊒ Ξ¦ 0 x βˆ— ([βˆ— list] k↦y ∈ l, Ξ¦ (S k) y)</LOOKUP> <LOOKUP>loc_add_0 : βˆ€ l, l +β‚— 0 = l</LOOKUP>. ```
{"package":"coq-iris-heap-lang","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/iris\/heap_lang\/derived_laws.v"}
Proof State: ``` 4 goals h, w : nat Eq1 : ulist ref_list x, y, z : nat s : list nat U1 : x < size U2 : y < size H2 : get (Pos x y) s = z l : lit H4 : lit_sat l s U3 : 0 < h U4 : 0 < w U5 : forall a b c : nat, a < b * c -> div a b < c U6 : forall n m : nat, 0 < m -> mod n m < m H3 : In l (rm_cont lit lit_test (fun l2 : list lit => l2) (L (Pos x y) z) (gen_column y z)) V1 : length s = size * size V2 : forall i : nat, i < size -> Permutation (column i s) ref_list ============================ In l (gen_column y z) goal 2 is: forall x0 : nat, l = L (Pos x0 y) z /\ x0 < size -> False goal 3 is: False goal 4 is: False ``` Commit Diff: ``` diff --git a/ListAux.v b/ListAux.v index 986e88b..769776a 100644 --- a/ListAux.v +++ b/ListAux.v @@ -131,6 +130,0 @@ Qed. -Theorem length_app: forall (l1 l2 : list A), length -(l1 ++ l2) = length l1 + length l2. -Proof. -apply app_length. -Qed. - @@ -278 +272 @@ intros A l1 l2; elim l1; simpl; auto. -intros a l H; rewrite length_app, length_map, H; auto. +intros a l H; rewrite app_length, length_map, H; auto. diff --git a/ListOp.v b/ListOp.v index e1936ca..7a13f04 100644 --- a/ListOp.v +++ b/ListOp.v @@ -145 +145 @@ intros k Rec i j s H; -rewrite length_app, length_take1; auto with arith. +rewrite app_length, length_take1; auto with arith. diff --git a/Sudoku.v b/Sudoku.v index 5083f1b..abf9251 100644 --- a/Sudoku.v +++ b/Sudoku.v @@ -675 +675 @@ assert (F1: div y w < h). -apply div_lt; rewrite mult_comm; auto. +apply div_lt; rewrite mult_comm... @@ -677,6 +677,2 @@ apply div_lt; rewrite mult_comm; auto. -repeat (rewrite (fun x => -mult_comm x h)); rewrite mod_mult_comp... -rewrite div_mult_comp; auto. -rewrite (mod_small (div y w) h); auto. -rewrite (div_is_0 (div y w) h); auto. -rewrite plus_0_r. +repeat (rewrite (fun x => mult_comm x h)); rewrite mod_mult_comp... +rewrite div_mult_comp, (mod_small (div y w) h), (div_is_0 (div y w) h), plus_0_r... @@ -703,3 +699,3 @@ cut (w <= size). -intros U3 n; generalize h; elim n; simpl; -auto with arith; clear n H1 H2 U1. -+ intros h1; case h1; simpl; auto. +intros U3 n; generalize h; elim n; simpl... +clear n H1 H2 U1. ++ intros h1; case h1; simpl... @@ -713,3 +709,2 @@ apply sym_equal; apply take_nth... -** apply le_trans with (1 := H1)... -apply le_trans with (2 := U3). -apply lt_le_weak; apply mod_lt... +** pose proof (mod_lt y w). +lia. @@ -726 +721 @@ apply mod_lt... -case (le_or_lt (length l) w); intros H1. +case (le_or_lt (length l) w); intros H3. @@ -728,2 +723 @@ case (le_or_lt (length l) w); intros H1. -** rewrite length_take_small... -rewrite jump_too_far. +** rewrite length_take_small, jump_too_far... @@ -732,2 +726,2 @@ repeat rewrite nth_default... -apply le_trans with (1 := H1)... -*** apply le_trans with (1 := H1)... +apply le_trans with (1 := H3)... +*** apply le_trans with (1 := H3)... @@ -738,2 +732 @@ repeat rewrite <- plus_assoc; rewrite minus_plus... -rewrite jump_nth; rewrite jump_add. -rewrite <- jump_nth... +rewrite jump_nth, jump_add, <- jump_nth... @@ -750 +743 @@ generalize (w_pos _ H); intros U2. ``` Ongoing Proof History: ``` case (gen_row_correct l x z); intros tmp _; case tmp; auto; clear tmp. - apply (rm_incl _ lit_test) with (l1 := L (Pos x y) z::nil) (l2 := gen_row x z); auto. + apply (rm_incl _ lit_test) with (l1 := L (Pos x y) z::nil) (l2 := gen_row x z)... intros y1 (H5, H6); subst l. simpl in H4; absurd (y = y1). intros H7; apply (rm_not_in _ lit_test) with (a := L (Pos x y) z) (l1 := L (Pos x y) z::nil) (l2 := gen_row x z); subst; auto with datatypes. exact lit_test_trans. intros; apply lit_test_anti_sym. exact lit_test_exact. apply olist_one. apply gen_row_ordered. - apply nth_ulist with (a := 0) (l := row x s); auto. + apply nth_ulist with (a := 0) (l := row x s)... - rewrite length_row; auto. + rewrite length_row... - rewrite length_row; auto. + rewrite length_row... - apply ulist_perm with ref_list; auto. + apply ulist_perm with ref_list... - apply Permutation_sym; auto. + apply Permutation_sym... - repeat rewrite <- get_row; try rewrite H2; auto. + repeat rewrite <- get_row; try rewrite H2... case H1; clear H1; intros V1 (_, (V2, _)). case (gen_column_correct l y z); intros tmp _; case tmp; auto; clear tmp. ? apply (rm_incl _ lit_test) with (l1 := L (Pos x y) z::nil) (l2 := gen_column y z); auto. ? intros x1 (H5, H6); subst l. ? simpl in H4; absurd (x = x1). ``` Next Tactic: ```
apply (<LOOKUP>rm_incl : forall (A : Set) (weight : A -> A -> cmp) (l1 l2 : list A), incl (rm A weight l1 l2) l2</LOOKUP> _ <LOOKUP>lit_test : lit -> lit -> cmp</LOOKUP>) with (l1 := <LOOKUP>L : pos -> nat -> lit</LOOKUP> (<LOOKUP>Pos : nat -> nat -> pos</LOOKUP> x y) z::<LOOKUP>nil : forall {A : Type}, list A</LOOKUP>) (l2 := <LOOKUP>gen_column : nat -> nat -> clause</LOOKUP> y z)... ```
{"final_commit":"5337edcaf31b9f036a0a6651b2f733d3068b8f8f","project":"sudoku","repair_file":"\/data\/coq-pearls\/repairs\/sudoku\/repair-sudoku-427448011e3341d35aa5b9e00f675f6582fcd477-5337edcaf31b9f036a0a6651b2f733d3068b8f8f-8_15_2-8_15_2-41.git.json","initial_commit":"427448011e3341d35aa5b9e00f675f6582fcd477","file":"Sudoku.v"}
Ongoing Proof History: ``` Proof. intros. punfold H. unfold eqit_ in H. cbn in *. remember (ITree.bind ma kab) as tl. assert (tl β‰… (ITree.bind ma kab)) by (subst; reflexivity). clear Heqtl. genobs tl tl'. remember (VisF e kxc) as tr. revert ma kab tl Heqtl' H0 kxc Heqtr. induction H. - intros. inv Heqtr. - intros. inv Heqtr. - intros. rewrite unfold_bind in H0. destruct (observe ma) eqn: Hobma; cbn in *; rewrite itree_eta in H0; rewrite <- Heqtl' in H0. + right. exists r. split. rewrite itree_eta. rewrite Hobma. reflexivity. rewrite <- H0. apply eqit_Vis. intros. destruct (REL u0); auto. inv H. + symmetry in H0. apply eqitree_inv_tau_vis in H0. contradiction. + setoid_rewrite itree_eta at 1. rewrite Hobma. clear Hobma Heqtl'. - inv Heqtr; auto_inj_pair2; subst. + red in H0. - apply eq_itree_inv_vis in H0. + apply eqit_inv_vis_weak in H0. - destruct H0 as (? & ? & ?). + destruct H0 as [<- [<- H0]]; cbn in H0. + inv_Vis. + left. + exists k. ? inv H; auto_inj_pair2; subst. ? left. ? exists k. ``` Commit Diff: ``` diff --git a/theories/Core/KTreeFacts.v b/theories/Core/KTreeFacts.v index b911a90..32f56a6 100644 --- a/theories/Core/KTreeFacts.v +++ b/theories/Core/KTreeFacts.v @@ -6,2 +6 @@ Require Import -Program Classes.Morphisms -Setoids.Setoid +Classes.Morphisms Setoids.Setoid @@ -24 +23,2 @@ Eq.Eq -Eq.UpToTaus. +Eq.UpToTaus +Eq.Paco2. @@ -68 +68 @@ Proof. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -205,2 +205,2 @@ Proof. -revert A B C f g a0. -ginit. gcofix CIH. intros. +revert f g a0. +ginit. pcofix CIH. intros. @@ -268 +268 @@ revert a0. -ginit. gcofix CIH. intros. +ginit. pcofix CIH. intros. @@ -277 +277 @@ revert a. -gcofix CIH'. intros. +pcofix CIH'. intros. @@ -337,2 +337 @@ etau. -specialize (CIH xa). -cbn in CIH. +specialize (CIHL xa). cbn in CIHL. diff --git a/theories/Eq/Eq.v b/theories/Eq/Eq.v index 21ac7e0..46d9145 100644 --- a/theories/Eq/Eq.v +++ b/theories/Eq/Eq.v @@ -29 +29,2 @@ Basics.Basics Basics.HeterogeneousRelations -Core.ITreeDefinition. +Core.ITreeDefinition +Eq.Paco2. @@ -165,0 +167,54 @@ Hint Unfold id: core. +Lemma eqitF_VisF_inv_r {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} +t1 X2 (e2 : E X2) (k2 : X2 -> _) : eqitF RR b1 +b2 vclo sim t1 (VisF e2 k2) -> (exists k1, t1 = VisF e2 k1 +/\ forall v, vclo sim (k1 v) (k2 v)) \/ (b1 /\ exists t1', t1 += TauF t1' /\ eqitF RR b1 b2 vclo sim (observe t1') (VisF e2 k2)). +Proof. +refine (fun H => match H +in eqitF _ _ _ _ +_ _ t2 return match t2 +return Prop with | VisF e2 +k2 => _ | _ +=> True end with | +EqVis _ _ _ _ +_ _ _ _ _ +=> _ | _ => +_ end); try exact I. +- left; eauto. +- destruct i0; eauto. +Qed. + +Lemma eqitF_VisF_inv {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 vclo sim} X1 +(e1 : E X1) (k1 : X1 -> _) X2 (e2 : E X2) (k2 : X2 +-> _) : eqitF RR b1 b2 vclo sim (VisF e1 k1) (VisF e2 k2) -> exists +p : X1 = X2, eqeq E p e1 e2 /\ pweqeq (vclo sim) p k1 k2. +Proof. +refine (fun H => match H in +eqitF _ _ _ _ _ t1 +t2 return match t1, t2 return Prop +with | VisF e1 k1, VisF e2 +k2 => _ | _, _ => +True end with | EqVis _ +_ _ _ _ _ _ +_ _ => _ | _ +=> _ end); try exact I. +- exists eq_refl; cbn; eauto. +- destruct i; exact I. +Qed. + +Lemma eqitF_VisF_inv_strong {E R1 R2} (RR : R1 -> R2 -> Prop) {b1 b2 +vclo sim} X (e : E X) (k1 : X -> _) (k2 +: X -> _) : eqitF RR b1 b2 vclo sim (VisF e +k1) (VisF e k2) -> forall x, vclo sim (k1 x) (k2 x). +Proof. +intros H. dependent destruction H. assumption. +Qed. + ``` Proof State: ``` 1 subgoal A : Type B : Type C : Type E : Type -> Type RR : B -> C -> Prop b1, b2 : bool u : Type e0 : E u k1 : u -> itree E B k2 : u -> itree E C REL : forall v : u, id (upaco2 (fun (sim : itree E B -> itree E C -> Prop) (t1 : itree E B) (t2 : itree E C) => eqitF RR b1 b2 id sim (observe t1) (observe t2)) bot2) (k1 v) (k2 v) ma : itree E A kab : A -> itree E B tl : itree E B k : u -> itree E A H0 : forall x : u, eqit eq false false (k1 x) (x <- k x;; kab x) ============================ eqit eq b1 b2 (Vis e0 k) (Vis e0 k) /\ (forall x : u, eqit RR b1 b2 (x <- k x;; kab x) (k2 x)) ``` Next Tactic: ```
split; [reflexivity |]. ```
{"final_commit":"f3853150994e962978fa4cf0ed18dcb8c42e3262","project":"InteractionTrees","repair_file":"\/data\/coq-pearls\/repairs\/InteractionTrees\/repair-InteractionTrees-1fcd2d39e27da8068431211b7952365e163782cc-f3853150994e962978fa4cf0ed18dcb8c42e3262-8_10_2-8_11_2-13.git.json","initial_commit":"1fcd2d39e27da8068431211b7952365e163782cc","file":"theories\/Eq\/Eq.v"}
Proof State: ``` This subproof is complete, but there are some unfocused goals. Focus next goal with bullet --. 5 subgoals subgoal 1 is: address_mapsto_zeros sh n (b, Z.succ ofs) |-- (ALL y, jam (adr_range_dec (b, Z.succ ofs) (Z.of_nat n)) (fun loc : address => yesat NoneP (VAL match Z.to_nat (snd loc - ofs) with | 0%nat => Byte Byte.zero | S m => nth m (repeat (Byte Byte.zero) n) Undef end) sh loc) noat y) && noghost subgoal 2 is: exists resp : resource -> address -> nat -> Prop, is_resource_pred (fun loc : address => yesat NoneP (VAL (nth (Z.to_nat (snd loc - ofs)) (repeat (Byte Byte.zero) (S n)) Undef)) sh loc) resp subgoal 3 is: exists resp : resource -> address -> nat -> Prop, is_resource_pred (fun loc : address => yesat NoneP (VAL (nth (Z.to_nat (snd loc - ofs)) (repeat (Byte Byte.zero) (S n)) Undef)) sh loc) resp subgoal 4 is: exists resp : resource -> address -> nat -> Prop, is_resource_pred (fun loc : address => yesat NoneP (VAL (nth (Z.to_nat (snd loc - ofs)) (repeat (Byte Byte.zero) (S n)) Undef)) sh loc) resp subgoal 5 is: forall (l : address) (m : rmap) (sh0 : rshare) (k : AV.kind), adr_range (b, ofs) (Z.succ (Z.of_nat n)) l -> yesat NoneP (VAL (nth (Z.to_nat (snd l - ofs)) (repeat (Byte Byte.zero) (S n)) Undef)) sh l m -> res_option (m @ l) = Some (sh0, k) -> isVAL k \/ isFUN k ``` Ongoing Proof History: ``` Proof. intros until t. intros H2 H. unfold mapsto_zeros, mapsto. simpl. rewrite andb_false_r by auto. rewrite (prop_true_andp (is_pointer_or_null _)) by auto. apply prop_andp_left; intros [? ?]. rewrite prop_true_andp by auto. rewrite if_true by auto. apply orp_right1. unfold address_mapsto. apply exp_right with (encode_val (if Archi.ptr64 then Mint64 else Mint32) nullval). rewrite prop_true_andp by (split3; simpl; [rewrite encode_nullval; reflexivity | exact decode_encode_nullval | auto]). forget (Ptrofs.unsigned z) as ofs; clear z. replace (encode_val (if Archi.ptr64 then Mint64 else Mint32) nullval) with (repeat (Byte Byte.zero) (size_chunk_nat Mptr)) by (unfold size_chunk_nat, size_chunk, Mptr, encode_val, nullval; simpl; destruct Archi.ptr64; simpl; change (Int64.unsigned Int64.zero) with 0; change (Int.unsigned Int.zero) with 0; unfold encode_int, inj_bytes; simpl; compute; destruct Archi.big_endian; simpl; reflexivity). rewrite size_chunk_conv, Nat2Z.id. clear - H2. simpl snd. revert ofs; induction (size_chunk_nat Mptr); intros. * unfold address_mapsto_zeros. apply andp_right. apply allp_right; intro y. rewrite jam_false. intros ? ?. do 3 red. do 3 red in H. apply resource_at_identity; auto. simpl; destruct y; intros [? ?]; lia. intros ? ?. do 3 red in H|-*. apply ghost_of_identity; auto. * rewrite inj_S. simpl snd in *. rewrite allp_jam_split2 with (q := (fun loc : address => yesat NoneP (VAL (nth (Z.to_nat (snd loc - ofs)) (repeat (Byte Byte.zero) (S n)) Undef)) sh loc)) (r := (fun loc : address => yesat NoneP (VAL (nth (Z.to_nat (snd loc - ofs)) (repeat (Byte Byte.zero) (S n)) Undef)) sh loc)) (Q_DEC := adr_range_dec (b,ofs) 1) (R_DEC := adr_range_dec ( b, Z.succ ofs) (Z.of_nat n)); auto. 5:{ split; intros. destruct a; split; intros. destruct H; subst b0. destruct (zeq z ofs); [left|right]; split; auto; lia. destruct H; destruct H; subst b0; split; auto; lia. destruct a; destruct H,H0; subst; lia. } simpl. apply sepcon_derives. -- clear IHn. unfold address_mapsto. apply exp_left; intro bl. rewrite andp_assoc. apply prop_andp_left. intros [? ?]. apply andp_derives; auto. apply allp_derives; intro y. simpl. destruct H0. destruct bl; inv H. destruct bl; inv H4. destruct (adr_range_dec (b, ofs) 1 y). ++ rewrite !jam_true by auto. destruct y; destruct a; subst b0. assert (z=ofs) by lia. subst z. simpl snd. rewrite Z.sub_diag. simpl. replace m with (Byte Byte.zero); auto. clear - H0. destruct m; try discriminate. rewrite decode_byte_val in H0. apply Vint_inj in H0. f_equal. rewrite zero_ext_inrange in H0. unfold Int.zero in H0. apply repr_inj_unsigned in H0. apply (f_equal Byte.repr) in H0. rewrite Byte.repr_unsigned in H0. auto. pose proof (Byte.unsigned_range i). change Byte.modulus with 256 in H. split; try lia. apply Z.le_trans with 256; try lia. compute; congruence. split. lia. compute; congruence. rewrite Int.unsigned_repr. pose proof (Byte.unsigned_range i). change Byte.modulus with 256 in H. simpl. lia. pose proof (Byte.unsigned_range i). assert (Byte.modulus < Int.max_unsigned) by reflexivity. lia. ++ rewrite !jam_false by auto. auto. ``` Next Tactic: ```
-- ```
{"package":"coq-vst","file":"\/home\/tpr\/.opam\/PackageTable~8.13~2022.01.csv.formatted\/lib\/coq\/user-contrib\/VST\/veric\/mapsto_memory_block.v"}