From 7ce6bf4f7740de4c69877ec9179520bcaa0d014c Mon Sep 17 00:00:00 2001 From: Chantal Keller Date: Fri, 18 Feb 2022 17:10:13 +0100 Subject: Removed deprecated features --- src/cnf/Cnf.v | 64 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/cnf') diff --git a/src/cnf/Cnf.v b/src/cnf/Cnf.v index db6e689..bc4ab5d 100644 --- a/src/cnf/Cnf.v +++ b/src/cnf/Cnf.v @@ -23,7 +23,7 @@ Unset Strict Implicit. Definition or_of_imp args := let last := PArray.length args - 1 in - amapi (fun i l => if i == last then l else Lit.neg l) args. + amapi (fun i l => if i =? last then l else Lit.neg l) args. (* Register or_of_imp as PrimInline. *) Lemma length_or_of_imp : forall args, @@ -31,21 +31,21 @@ Lemma length_or_of_imp : forall args, Proof. intro; unfold or_of_imp; apply length_amapi. Qed. Lemma get_or_of_imp : forall args i, - i < (PArray.length args) - 1 -> (or_of_imp args).[i] = Lit.neg (args.[i]). + i (or_of_imp args).[i] = Lit.neg (args.[i]). Proof. - unfold or_of_imp; intros args i H; case_eq (0 < PArray.length args). + unfold or_of_imp; intros args i H; case_eq (0 +Lemma get_or_of_imp2 : forall args i, 0 i = (PArray.length args) - 1 -> (or_of_imp args).[i] = args.[i]. Proof. unfold or_of_imp; intros args i Heq Hi; rewrite get_amapi; subst i. @@ -55,7 +55,7 @@ Qed. Lemma afold_right_impb p a : (forall x, p (Lit.neg x) = negb (p x)) -> - (PArray.length a == 0) = false -> + (PArray.length a =? 0) = false -> (afold_right bool true implb (amap p a)) = List.existsb p (to_list (or_of_imp a)). Proof. @@ -97,7 +97,7 @@ Proof. case_eq (List.existsb p (to_list (or_of_imp a))); auto. rewrite existsb_exists. intros [x [H4 H5]]. apply In_to_list in H4. destruct H4 as [i [H4 ->]]. - case_eq (i < PArray.length a - 1); intro Heq. + case_eq (i if Lit.is_pos l then C._true - else if PArray.length args == 0 then C._true + else if PArray.length args =? 0 then C._true else let args := or_of_imp args in l :: to_list args @@ -193,7 +193,7 @@ Section CHECKER. if Lit.is_pos l then to_list args else C._true | Fimp args => - if PArray.length args == 0 then C._true else + if PArray.length args =? 0 then C._true else if Lit.is_pos l then let args := or_of_imp args in to_list args @@ -271,15 +271,15 @@ Section CHECKER. let x := Lit.blit l in match get_hash x with | For args => - if i < PArray.length args then Lit.lit x::Lit.neg (args.[i])::nil + if i - if i < PArray.length args then Lit.nlit x::(args.[i])::nil + if i let len := PArray.length args in - if i < len then - if i == len - 1 then Lit.lit x::Lit.neg (args.[i])::nil + if i C._true @@ -297,15 +297,15 @@ Section CHECKER. let x := Lit.blit l in match get_hash x with | For args => - if (i < PArray.length args) && negb (Lit.is_pos l) then Lit.neg (args.[i])::nil + if (i - if (i < PArray.length args) && (Lit.is_pos l) then (args.[i])::nil + if (i let len := PArray.length args in - if (i < len) && negb (Lit.is_pos l) then - if i == len - 1 then Lit.neg (args.[i])::nil + if (i C._true @@ -362,7 +362,7 @@ Section CHECKER. tauto_check). - rewrite afold_left_and, C.Cinterp_neg;apply orb_negb_r. - rewrite afold_left_or, orb_comm;apply orb_negb_r. - - case_eq (PArray.length a == 0); auto using C.interp_true. + - case_eq (PArray.length a =? 0); auto using C.interp_true. intro Hl; simpl. unfold Lit.interp at 1;rewrite Heq;unfold Var.interp; rewrite rho_interp, H;simpl. rewrite (afold_right_impb (Lit.interp_neg _) Hl), orb_comm;try apply orb_negb_r. @@ -381,7 +381,7 @@ Section CHECKER. Proof. unfold check_BuildProj,C.valid;intros l i. case_eq (t_form.[Lit.blit l]);intros;auto using C.interp_true; - case_eq (i < PArray.length a);intros Hlt;auto using C.interp_true;simpl. + case_eq (i ([|PArray.length a|] - 1)%Z) by (intro H1; apply Heq', to_Z_inj; rewrite (to_Z_sub_1 _ _ Hlt); auto); rewrite ltb_spec in Hlt; lia); rewrite <- (get_or_of_imp H1); apply to_list_In; rewrite length_or_of_imp; auto. + assert (H1: i ([|PArray.length a|] - 1)%Z) by (intro H1; apply Heq', to_Z_inj; rewrite (to_Z_sub_1 _ _ Hlt); auto); rewrite ltb_spec in Hlt; lia); rewrite <- (get_or_of_imp H1); apply to_list_In; rewrite length_or_of_imp; auto. Qed. End CHECKER. -- cgit