Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Require terminaison.
- Require Relations.
- Require term.
- Require List.
- Require equational_theory.
- Require rpo_extension.
- Require equational_extension.
- Require closure_extension.
- Require term_extension.
- Require dp.
- Require Inclusion.
- Require or_ext_generated.
- Require ZArith.
- Require ring_extention.
- Require ring_extention2.
- Require Zwf.
- Require Inverse_Image.
- Require matrix.
- Require more_list_extention.
- Require graph_dp.
- Require subterm_dp.
- Import List.
- Import ZArith.
- Set Implicit Arguments.
- Module algebra.
- Module F
- <:term_spec.Signature.
- Inductive symb :
- Set :=
- (* id_u22 *)
- | id_u22 : symb
- (* id_ack_in *)
- | id_ack_in : symb
- (* id_0 *)
- | id_0 : symb
- (* id_ack_out *)
- | id_ack_out : symb
- (* id_s *)
- | id_s : symb
- (* id_u21 *)
- | id_u21 : symb
- (* id_u11 *)
- | id_u11 : symb
- .
- Definition symb_eq_bool (f1 f2:symb) : bool :=
- match f1,f2 with
- | id_u22,id_u22 => true
- | id_ack_in,id_ack_in => true
- | id_0,id_0 => true
- | id_ack_out,id_ack_out => true
- | id_s,id_s => true
- | id_u21,id_u21 => true
- | id_u11,id_u11 => true
- | _,_ => false
- end.
- (* Proof of decidability of equality over symb *)
- Definition symb_eq_bool_ok(f1 f2:symb) :
- match symb_eq_bool f1 f2 with
- | true => f1 = f2
- | false => f1 <> f2
- end.
- Proof.
- intros f1 f2.
- refine match f1 as u1,f2 as u2 return
- match symb_eq_bool u1 u2 return
- Prop with
- | true => u1 = u2
- | false => u1 <> u2
- end with
- | id_u22,id_u22 => refl_equal _
- | id_ack_in,id_ack_in => refl_equal _
- | id_0,id_0 => refl_equal _
- | id_ack_out,id_ack_out => refl_equal _
- | id_s,id_s => refl_equal _
- | id_u21,id_u21 => refl_equal _
- | id_u11,id_u11 => refl_equal _
- | _,_ => _
- end;intros abs;discriminate.
- Defined.
- Definition arity (f:symb) :=
- match f with
- | id_u22 => term_spec.Free 1
- | id_ack_in => term_spec.Free 2
- | id_0 => term_spec.Free 0
- | id_ack_out => term_spec.Free 1
- | id_s => term_spec.Free 1
- | id_u21 => term_spec.Free 2
- | id_u11 => term_spec.Free 1
- end.
- Definition symb_order (f1 f2:symb) : bool :=
- match f1,f2 with
- | id_u22,id_u22 => true
- | id_u22,id_ack_in => false
- | id_u22,id_0 => false
- | id_u22,id_ack_out => false
- | id_u22,id_s => false
- | id_u22,id_u21 => false
- | id_u22,id_u11 => false
- | id_ack_in,id_u22 => true
- | id_ack_in,id_ack_in => true
- | id_ack_in,id_0 => false
- | id_ack_in,id_ack_out => false
- | id_ack_in,id_s => false
- | id_ack_in,id_u21 => false
- | id_ack_in,id_u11 => false
- | id_0,id_u22 => true
- | id_0,id_ack_in => true
- | id_0,id_0 => true
- | id_0,id_ack_out => false
- | id_0,id_s => false
- | id_0,id_u21 => false
- | id_0,id_u11 => false
- | id_ack_out,id_u22 => true
- | id_ack_out,id_ack_in => true
- | id_ack_out,id_0 => true
- | id_ack_out,id_ack_out => true
- | id_ack_out,id_s => false
- | id_ack_out,id_u21 => false
- | id_ack_out,id_u11 => false
- | id_s,id_u22 => true
- | id_s,id_ack_in => true
- | id_s,id_0 => true
- | id_s,id_ack_out => true
- | id_s,id_s => true
- | id_s,id_u21 => false
- | id_s,id_u11 => false
- | id_u21,id_u22 => true
- | id_u21,id_ack_in => true
- | id_u21,id_0 => true
- | id_u21,id_ack_out => true
- | id_u21,id_s => true
- | id_u21,id_u21 => true
- | id_u21,id_u11 => false
- | id_u11,id_u22 => true
- | id_u11,id_ack_in => true
- | id_u11,id_0 => true
- | id_u11,id_ack_out => true
- | id_u11,id_s => true
- | id_u11,id_u21 => true
- | id_u11,id_u11 => true
- end.
- Module Symb.
- Definition A := symb.
- Definition eq_A := @eq A.
- Definition eq_proof : equivalence A eq_A.
- Proof.
- constructor.
- red ;reflexivity .
- red ;intros ;transitivity y ;assumption.
- red ;intros ;symmetry ;assumption.
- Defined.
- Add Relation A eq_A
- reflexivity proved by (@equiv_refl _ _ eq_proof)
- symmetry proved by (@equiv_sym _ _ eq_proof)
- transitivity proved by (@equiv_trans _ _ eq_proof) as EQA
- .
- Definition eq_bool := symb_eq_bool.
- Definition eq_bool_ok := symb_eq_bool_ok.
- End Symb.
- Export Symb.
- End F.
- Module Alg := term.Make'(F)(term_extension.IntVars).
- Module Alg_ext := term_extension.Make(Alg).
- Module EQT := equational_theory.Make(Alg).
- Module EQT_ext := equational_extension.Make(EQT).
- End algebra.
- Inductive R_xml_0_rules :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* ack_in(0,n) -> ack_out(s(n)) *)
- | R_xml_0_rule_0 :
- R_xml_0_rules (algebra.Alg.Term algebra.F.id_ack_out ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 1)::nil))::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_0
- nil)::(algebra.Alg.Var 1)::nil))
- (* ack_in(s(m),0) -> u11(ack_in(m,s(0))) *)
- | R_xml_0_rule_1 :
- R_xml_0_rules (algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Term algebra.F.id_s ((algebra.Alg.Term
- algebra.F.id_0 nil)::nil))::nil))::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_0
- nil)::nil))
- (* u11(ack_out(n)) -> ack_out(n) *)
- | R_xml_0_rule_2 :
- R_xml_0_rules (algebra.Alg.Term algebra.F.id_ack_out
- ((algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::nil))
- (* ack_in(s(m),s(n)) -> u21(ack_in(s(m),n),m) *)
- | R_xml_0_rule_3 :
- R_xml_0_rules (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 1)::nil))::nil))
- (* u21(ack_out(n),m) -> u22(ack_in(m,n)) *)
- | R_xml_0_rule_4 :
- R_xml_0_rules (algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil))
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- (* u22(ack_out(n)) -> ack_out(n) *)
- | R_xml_0_rule_5 :
- R_xml_0_rules (algebra.Alg.Term algebra.F.id_ack_out
- ((algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::nil))
- .
- Module WF_R_xml_0.
- Definition R_xml_0_rule_as_list_0 :=
- ((algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_0
- nil)::(algebra.Alg.Var 1)::nil)),
- (algebra.Alg.Term algebra.F.id_ack_out ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 1)::nil))::nil)))::nil.
- Definition R_xml_0_rule_as_list_1 :=
- ((algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_0
- nil)::nil)),
- (algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term algebra.F.id_0
- nil)::nil))::nil))::nil)))::R_xml_0_rule_as_list_0.
- Definition R_xml_0_rule_as_list_2 :=
- ((algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::nil)),
- (algebra.Alg.Term algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil)))::
- R_xml_0_rule_as_list_1.
- Definition R_xml_0_rule_as_list_3 :=
- ((algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 1)::nil))::nil)),
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil)))::R_xml_0_rule_as_list_2.
- Definition R_xml_0_rule_as_list_4 :=
- ((algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil)),
- (algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil)))::R_xml_0_rule_as_list_3.
- Definition R_xml_0_rule_as_list_5 :=
- ((algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::nil)),
- (algebra.Alg.Term algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil)))::
- R_xml_0_rule_as_list_4.
- Definition R_xml_0_rule_as_list := R_xml_0_rule_as_list_5.
- Lemma R_xml_0_rules_included :
- forall l r, R_xml_0_rules r l <-> In (l,r) R_xml_0_rule_as_list.
- Proof.
- intros l r.
- constructor.
- intros H.
- case H;clear H;
- (apply (more_list.mem_impl_in (@eq (algebra.Alg.term*algebra.Alg.term)));
- [tauto|idtac]);
- match goal with
- | |- _ _ _ ?t ?l =>
- let u := fresh "u" in
- (generalize (more_list.mem_bool_ok _ _
- algebra.Alg_ext.eq_term_term_bool_ok t l);
- set (u:=more_list.mem_bool algebra.Alg_ext.eq_term_term_bool t l) in *;
- vm_compute in u|-;unfold u in *;clear u;intros H;refine H)
- end
- .
- intros H.
- vm_compute in H|-.
- rewrite <- or_ext_generated.or7_equiv in H|-.
- case H;clear H;intros H.
- injection H;intros ;subst;constructor 6.
- injection H;intros ;subst;constructor 5.
- injection H;intros ;subst;constructor 4.
- injection H;intros ;subst;constructor 3.
- injection H;intros ;subst;constructor 2.
- injection H;intros ;subst;constructor 1.
- elim H.
- Qed.
- Lemma R_xml_0_non_var : forall x t, ~R_xml_0_rules t (algebra.EQT.T.Var x).
- Proof.
- intros x t H.
- inversion H.
- Qed.
- Lemma R_xml_0_reg :
- forall s t,
- (R_xml_0_rules s t) ->
- forall x, In x (algebra.Alg.var_list s) ->In x (algebra.Alg.var_list t).
- Proof.
- intros s t H.
- inversion H;intros x Hx;
- (apply (more_list.mem_impl_in (@eq algebra.Alg.variable));[tauto|idtac]);
- apply (more_list.in_impl_mem (@eq algebra.Alg.variable)) in Hx;
- vm_compute in Hx|-*;tauto.
- Qed.
- Inductive and_3 (x4 x5 x6:Prop) :
- Prop :=
- | conj_3 : x4->x5->x6->and_3 x4 x5 x6
- .
- Lemma are_constuctors_of_R_xml_0 :
- forall t t',
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) t' t) ->
- and_3 (t = (algebra.Alg.Term algebra.F.id_0 nil) ->
- t' = (algebra.Alg.Term algebra.F.id_0 nil))
- (forall x5,
- t = (algebra.Alg.Term algebra.F.id_ack_out (x5::nil)) ->
- exists x4,
- t' = (algebra.Alg.Term algebra.F.id_ack_out (x4::nil))/\
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- x4 x5))
- (forall x5,
- t = (algebra.Alg.Term algebra.F.id_s (x5::nil)) ->
- exists x4,
- t' = (algebra.Alg.Term algebra.F.id_s (x4::nil))/\
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- x4 x5)).
- Proof.
- intros t t' H.
- induction H as [|y IH z z_to_y] using
- closure_extension.refl_trans_clos_ind2.
- constructor 1.
- intros H;intuition;constructor 1.
- intros x5 H;exists x5;intuition;constructor 1.
- intros x5 H;exists x5;intuition;constructor 1.
- inversion z_to_y as [t1 t2 H H0 H1|f l1 l2 H0 H H2];clear z_to_y;subst.
- inversion H as [t1 t2 sigma H2 H1 H0];clear H IH;subst;inversion H2;
- clear ;constructor;try (intros until 0 );clear ;intros abs;
- discriminate abs.
- destruct IH as [H_id_0 H_id_ack_out H_id_s].
- constructor.
- clear H_id_ack_out H_id_s;intros H;injection H;clear H;intros ;subst;
- repeat (
- match goal with
- | H:weaved_relation.one_step_list (algebra.EQT.one_step _) _ _ |-
- _ => inversion H;clear H;subst
- end
- ).
- clear H_id_0 H_id_s;intros x5 H;injection H;clear H;intros ;subst;
- repeat (
- match goal with
- | H:weaved_relation.one_step_list (algebra.EQT.one_step _) _ _ |-
- _ => inversion H;clear H;subst
- end
- ).
- match goal with
- | H:algebra.EQT.one_step _ ?y x5 |- _ =>
- destruct (H_id_ack_out y (refl_equal _)) as [x4];intros ;intuition;
- exists x4;intuition;eapply closure_extension.refl_trans_clos_R;
- eassumption
- end
- .
- clear H_id_0 H_id_ack_out;intros x5 H;injection H;clear H;intros ;
- subst;
- repeat (
- match goal with
- | H:weaved_relation.one_step_list (algebra.EQT.one_step _) _ _ |-
- _ => inversion H;clear H;subst
- end
- ).
- match goal with
- | H:algebra.EQT.one_step _ ?y x5 |- _ =>
- destruct (H_id_s y (refl_equal _)) as [x4];intros ;intuition;exists x4;
- intuition;eapply closure_extension.refl_trans_clos_R;eassumption
- end
- .
- Qed.
- Lemma id_0_is_R_xml_0_constructor :
- forall t t',
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) t' t) ->
- t = (algebra.Alg.Term algebra.F.id_0 nil) ->
- t' = (algebra.Alg.Term algebra.F.id_0 nil).
- Proof.
- intros t t' H.
- destruct (are_constuctors_of_R_xml_0 H).
- assumption.
- Qed.
- Lemma id_ack_out_is_R_xml_0_constructor :
- forall t t',
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) t' t) ->
- forall x5,
- t = (algebra.Alg.Term algebra.F.id_ack_out (x5::nil)) ->
- exists x4,
- t' = (algebra.Alg.Term algebra.F.id_ack_out (x4::nil))/\
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- x4 x5).
- Proof.
- intros t t' H.
- destruct (are_constuctors_of_R_xml_0 H).
- assumption.
- Qed.
- Lemma id_s_is_R_xml_0_constructor :
- forall t t',
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) t' t) ->
- forall x5,
- t = (algebra.Alg.Term algebra.F.id_s (x5::nil)) ->
- exists x4,
- t' = (algebra.Alg.Term algebra.F.id_s (x4::nil))/\
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- x4 x5).
- Proof.
- intros t t' H.
- destruct (are_constuctors_of_R_xml_0 H).
- assumption.
- Qed.
- Ltac impossible_star_reduction_R_xml_0 :=
- match goal with
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- _ (algebra.Alg.Term algebra.F.id_0 nil) |- _ =>
- let Heq := fresh "Heq" in
- (set (Heq:=id_0_is_R_xml_0_constructor H (refl_equal _)) in *;
- (discriminate Heq)||
- (clearbody Heq;try (subst);try (clear Heq);clear H;
- impossible_star_reduction_R_xml_0 ))
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- _ (algebra.Alg.Term algebra.F.id_ack_out (?x4::nil)) |- _ =>
- let x4 := fresh "x" in
- (let Heq := fresh "Heq" in
- (let Hred1 := fresh "Hred" in
- (destruct (id_ack_out_is_R_xml_0_constructor H (refl_equal _)) as
- [x4 [Heq Hred1]];
- (discriminate Heq)||
- (injection Heq;intros ;subst;clear Heq;clear H;
- impossible_star_reduction_R_xml_0 ))))
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- _ (algebra.Alg.Term algebra.F.id_s (?x4::nil)) |- _ =>
- let x4 := fresh "x" in
- (let Heq := fresh "Heq" in
- (let Hred1 := fresh "Hred" in
- (destruct (id_s_is_R_xml_0_constructor H (refl_equal _)) as
- [x4 [Heq Hred1]];
- (discriminate Heq)||
- (injection Heq;intros ;subst;clear Heq;clear H;
- impossible_star_reduction_R_xml_0 ))))
- end
- .
- Ltac simplify_star_reduction_R_xml_0 :=
- match goal with
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- _ (algebra.Alg.Term algebra.F.id_0 nil) |- _ =>
- let Heq := fresh "Heq" in
- (set (Heq:=id_0_is_R_xml_0_constructor H (refl_equal _)) in *;
- (discriminate Heq)||
- (clearbody Heq;try (subst);try (clear Heq);clear H;
- try (simplify_star_reduction_R_xml_0 )))
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- _ (algebra.Alg.Term algebra.F.id_ack_out (?x4::nil)) |- _ =>
- let x4 := fresh "x" in
- (let Heq := fresh "Heq" in
- (let Hred1 := fresh "Hred" in
- (destruct (id_ack_out_is_R_xml_0_constructor H (refl_equal _)) as
- [x4 [Heq Hred1]];
- (discriminate Heq)||
- (injection Heq;intros ;subst;clear Heq;clear H;
- try (simplify_star_reduction_R_xml_0 )))))
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules)
- _ (algebra.Alg.Term algebra.F.id_s (?x4::nil)) |- _ =>
- let x4 := fresh "x" in
- (let Heq := fresh "Heq" in
- (let Hred1 := fresh "Hred" in
- (destruct (id_s_is_R_xml_0_constructor H (refl_equal _)) as
- [x4 [Heq Hred1]];
- (discriminate Heq)||
- (injection Heq;intros ;subst;clear Heq;clear H;
- try (simplify_star_reduction_R_xml_0 )))))
- end
- .
- Module InterpGen := interp.Interp(algebra.EQT).
- Module ddp := dp.MakeDP(algebra.EQT).
- Module subdp := subterm_dp.MakeSubDP(algebra.EQT).
- Module SymbType. Definition A := algebra.Alg.F.Symb.A. End SymbType.
- Module Symb_more_list := more_list_extention.Make(SymbType)(algebra.Alg.F.Symb).
- Module SymbSet := list_set.Make(algebra.F.Symb).
- Module Interp.
- Section S.
- Require Import interp.
- Hypothesis A : Type.
- Hypothesis Ale Alt Aeq : A -> A -> Prop.
- Hypothesis Aop : interp.ordering_pair Aeq Alt Ale.
- Hypothesis A0 : A.
- Notation Local "a <= b" := (Ale a b).
- Hypothesis P_id_u22 : A ->A.
- Hypothesis P_id_ack_in : A ->A ->A.
- Hypothesis P_id_0 : A.
- Hypothesis P_id_ack_out : A ->A.
- Hypothesis P_id_s : A ->A.
- Hypothesis P_id_u21 : A ->A ->A.
- Hypothesis P_id_u11 : A ->A.
- Hypothesis P_id_u22_monotonic :
- forall x4 x5, (A0 <= x5)/\ (x5 <= x4) ->P_id_u22 x5 <= P_id_u22 x4.
- Hypothesis P_id_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (A0 <= x7)/\ (x7 <= x6) ->
- (A0 <= x5)/\ (x5 <= x4) ->P_id_ack_in x5 x7 <= P_id_ack_in x4 x6.
- Hypothesis P_id_ack_out_monotonic :
- forall x4 x5,
- (A0 <= x5)/\ (x5 <= x4) ->P_id_ack_out x5 <= P_id_ack_out x4.
- Hypothesis P_id_s_monotonic :
- forall x4 x5, (A0 <= x5)/\ (x5 <= x4) ->P_id_s x5 <= P_id_s x4.
- Hypothesis P_id_u21_monotonic :
- forall x4 x6 x5 x7,
- (A0 <= x7)/\ (x7 <= x6) ->
- (A0 <= x5)/\ (x5 <= x4) ->P_id_u21 x5 x7 <= P_id_u21 x4 x6.
- Hypothesis P_id_u11_monotonic :
- forall x4 x5, (A0 <= x5)/\ (x5 <= x4) ->P_id_u11 x5 <= P_id_u11 x4.
- Hypothesis P_id_u22_bounded : forall x4, (A0 <= x4) ->A0 <= P_id_u22 x4.
- Hypothesis P_id_ack_in_bounded :
- forall x4 x5, (A0 <= x4) ->(A0 <= x5) ->A0 <= P_id_ack_in x5 x4.
- Hypothesis P_id_0_bounded : A0 <= P_id_0 .
- Hypothesis P_id_ack_out_bounded :
- forall x4, (A0 <= x4) ->A0 <= P_id_ack_out x4.
- Hypothesis P_id_s_bounded : forall x4, (A0 <= x4) ->A0 <= P_id_s x4.
- Hypothesis P_id_u21_bounded :
- forall x4 x5, (A0 <= x4) ->(A0 <= x5) ->A0 <= P_id_u21 x5 x4.
- Hypothesis P_id_u11_bounded : forall x4, (A0 <= x4) ->A0 <= P_id_u11 x4.
- Fixpoint measure t { struct t } :=
- match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- P_id_ack_in (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_0 nil) => P_id_0
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- P_id_ack_out (measure x4)
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) => P_id_s (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- P_id_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_u11 (measure x4)
- | _ => A0
- end.
- Lemma measure_equation :
- forall t,
- measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- P_id_ack_in (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_0 nil) => P_id_0
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- P_id_ack_out (measure x4)
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) =>
- P_id_s (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- P_id_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_u11 (measure x4)
- | _ => A0
- end.
- Proof.
- intros t;
- refine match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_0 nil) => _
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) => _
- | _ => _
- end;apply refl_equal.
- Qed.
- Definition Pols f : InterpGen.Pol_type A (InterpGen.get_arity f) :=
- match f with
- | algebra.F.id_u22 => P_id_u22
- | algebra.F.id_ack_in => P_id_ack_in
- | algebra.F.id_0 => P_id_0
- | algebra.F.id_ack_out => P_id_ack_out
- | algebra.F.id_s => P_id_s
- | algebra.F.id_u21 => P_id_u21
- | algebra.F.id_u11 => P_id_u11
- end.
- Lemma same_measure : forall t, measure t = InterpGen.measure A0 Pols t.
- Proof.
- fix 1 .
- intros [a| f l].
- simpl in |-*.
- unfold eq_rect_r, eq_rect, sym_eq in |-*.
- reflexivity .
- refine match f with
- | algebra.F.id_u22 =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- | algebra.F.id_ack_in =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::nil => _
- | _::_::_::_ => _
- end
- | algebra.F.id_0 => match l with
- | nil => _
- | _::_ => _
- end
- | algebra.F.id_ack_out =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- | algebra.F.id_s =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- | algebra.F.id_u21 =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::nil => _
- | _::_::_::_ => _
- end
- | algebra.F.id_u11 =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- end;simpl in |-*;unfold eq_rect_r, eq_rect, sym_eq in |-*;
- try (reflexivity );f_equal ;auto.
- Qed.
- Lemma measure_bounded : forall t, A0 <= measure t.
- Proof.
- intros t.
- rewrite same_measure in |-*.
- apply (InterpGen.measure_bounded Aop).
- intros f.
- case f.
- vm_compute in |-*;intros ;apply P_id_u22_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_in_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_0_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_out_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_s_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_u21_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_u11_bounded;assumption.
- Qed.
- Ltac generate_pos_hyp :=
- match goal with
- | H:context [measure ?x] |- _ =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- | |- context [measure ?x] =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- end
- .
- Hypothesis rules_monotonic :
- forall l r,
- (algebra.EQT.axiom R_xml_0_rules r l) ->measure r <= measure l.
- Lemma measure_star_monotonic :
- forall l r,
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) r l) ->
- measure r <= measure l.
- Proof.
- intros .
- do 2 (rewrite same_measure in |-*).
- apply InterpGen.measure_star_monotonic with (1:=Aop) (Pols:=Pols)
- (rules:=R_xml_0_rules).
- intros f.
- case f.
- vm_compute in |-*;intros ;apply P_id_u22_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_in_monotonic;assumption.
- vm_compute in |-*;apply (Aop.(le_refl)).
- vm_compute in |-*;intros ;apply P_id_ack_out_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_s_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_u21_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_u11_monotonic;assumption.
- intros f.
- case f.
- vm_compute in |-*;intros ;apply P_id_u22_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_in_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_0_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_out_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_s_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_u21_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_u11_bounded;assumption.
- intros .
- do 2 (rewrite <- same_measure in |-*).
- apply rules_monotonic;assumption.
- assumption.
- Qed.
- Hypothesis P_id_Marked_u11 : A ->A.
- Hypothesis P_id_Marked_u22 : A ->A.
- Hypothesis P_id_Marked_u21 : A ->A ->A.
- Hypothesis P_id_Marked_ack_in : A ->A ->A.
- Hypothesis P_id_Marked_u11_monotonic :
- forall x4 x5,
- (A0 <= x5)/\ (x5 <= x4) ->P_id_Marked_u11 x5 <= P_id_Marked_u11 x4.
- Hypothesis P_id_Marked_u22_monotonic :
- forall x4 x5,
- (A0 <= x5)/\ (x5 <= x4) ->P_id_Marked_u22 x5 <= P_id_Marked_u22 x4.
- Hypothesis P_id_Marked_u21_monotonic :
- forall x4 x6 x5 x7,
- (A0 <= x7)/\ (x7 <= x6) ->
- (A0 <= x5)/\ (x5 <= x4) ->
- P_id_Marked_u21 x5 x7 <= P_id_Marked_u21 x4 x6.
- Hypothesis P_id_Marked_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (A0 <= x7)/\ (x7 <= x6) ->
- (A0 <= x5)/\ (x5 <= x4) ->
- P_id_Marked_ack_in x5 x7 <= P_id_Marked_ack_in x4 x6.
- Definition marked_measure t :=
- match t with
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_Marked_u11 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_Marked_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- P_id_Marked_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- P_id_Marked_ack_in (measure x5) (measure x4)
- | _ => measure t
- end.
- Definition Marked_pols :
- forall f,
- (algebra.EQT.defined R_xml_0_rules f) ->
- InterpGen.Pol_type A (InterpGen.get_arity f).
- Proof.
- intros f H.
- apply ddp.defined_list_complete with (1:=R_xml_0_rules_included) in H .
- apply (Symb_more_list.change_in algebra.F.symb_order) in H .
- set (u := (Symb_more_list.qs algebra.F.symb_order
- (Symb_more_list.XSet.remove_red
- (ddp.defined_list R_xml_0_rule_as_list nil) ))) in * .
- vm_compute in u .
- unfold u in * .
- clear u .
- unfold more_list.mem_bool in H .
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros x4;apply (P_id_Marked_u11 x4).
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros x5 x4;apply (P_id_Marked_u21 x5 x4).
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros x5 x4;apply (P_id_Marked_ack_in x5 x4).
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros x4;apply (P_id_Marked_u22 x4).
- discriminate H.
- Defined.
- Lemma same_marked_measure :
- forall t,
- marked_measure t = InterpGen.marked_measure A0 Pols Marked_pols
- (ddp.defined_dec _ _ R_xml_0_rules_included)
- t.
- Proof.
- intros [a| f l].
- simpl in |-*.
- unfold eq_rect_r, eq_rect, sym_eq in |-*.
- reflexivity .
- refine match f with
- | algebra.F.id_u22 =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- | algebra.F.id_ack_in =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::nil => _
- | _::_::_::_ => _
- end
- | algebra.F.id_0 => match l with
- | nil => _
- | _::_ => _
- end
- | algebra.F.id_ack_out =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- | algebra.F.id_s =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- | algebra.F.id_u21 =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::nil => _
- | _::_::_::_ => _
- end
- | algebra.F.id_u11 =>
- match l with
- | nil => _
- | _::nil => _
- | _::_::_ => _
- end
- end.
- vm_compute in |-*;reflexivity .
- lazy - [measure InterpGen.measure Pols] in |-* ;f_equal ;
- apply same_measure.
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- lazy - [measure InterpGen.measure Pols] in |-* ;f_equal ;
- apply same_measure.
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- lazy - [measure InterpGen.measure Pols] in |-* ;f_equal ;
- apply same_measure.
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- lazy - [measure InterpGen.measure Pols] in |-* ;f_equal ;
- apply same_measure.
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- lazy - [measure InterpGen.measure Pols] in |-* ;f_equal ;
- apply same_measure.
- vm_compute in |-*;reflexivity .
- vm_compute in |-*;reflexivity .
- lazy - [measure InterpGen.measure Pols] in |-* ;f_equal ;
- apply same_measure.
- vm_compute in |-*;reflexivity .
- Qed.
- Lemma marked_measure_equation :
- forall t,
- marked_measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_Marked_u11 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_Marked_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::
- x4::nil)) =>
- P_id_Marked_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::
- x4::nil)) =>
- P_id_Marked_ack_in (measure x5) (measure x4)
- | _ => measure t
- end.
- Proof.
- reflexivity .
- Qed.
- Lemma marked_measure_star_monotonic :
- forall f l1 l2,
- (TransClosure.refl_trans_clos (weaved_relation.one_step_list (algebra.EQT.one_step
- R_xml_0_rules)
- )
- l1 l2) ->
- marked_measure (algebra.Alg.Term f l1) <= marked_measure (algebra.Alg.Term
- f l2).
- Proof.
- intros .
- do 2 (rewrite same_marked_measure in |-*).
- apply InterpGen.marked_measure_star_monotonic with
- (1:=Aop) (Pols:=Pols) (rules:=R_xml_0_rules).
- clear f.
- intros f.
- case f.
- vm_compute in |-*;intros ;apply P_id_u22_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_in_monotonic;assumption.
- vm_compute in |-*;apply (Aop.(le_refl)).
- vm_compute in |-*;intros ;apply P_id_ack_out_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_s_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_u21_monotonic;assumption.
- vm_compute in |-*;intros ;apply P_id_u11_monotonic;assumption.
- clear f.
- intros f.
- case f.
- vm_compute in |-*;intros ;apply P_id_u22_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_in_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_0_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_ack_out_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_s_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_u21_bounded;assumption.
- vm_compute in |-*;intros ;apply P_id_u11_bounded;assumption.
- intros .
- do 2 (rewrite <- same_measure in |-*).
- apply rules_monotonic;assumption.
- clear f.
- intros f.
- clear H.
- intros H.
- generalize H.
- apply ddp.defined_list_complete with (1:=R_xml_0_rules_included) in H .
- apply (Symb_more_list.change_in algebra.F.symb_order) in H .
- set (u := (Symb_more_list.qs algebra.F.symb_order
- (Symb_more_list.XSet.remove_red
- (ddp.defined_list R_xml_0_rule_as_list nil)))) in * .
- vm_compute in u .
- unfold u in * .
- clear u .
- unfold more_list.mem_bool in H .
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros ;apply P_id_Marked_u11_monotonic;assumption.
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros ;apply P_id_Marked_u21_monotonic;assumption.
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros ;apply P_id_Marked_ack_in_monotonic;assumption.
- match type of H with
- | orb ?a ?b = true =>
- assert (H':{a = true}+{b = true});[
- revert H;case a;[left;reflexivity|simpl;intros h;right;exact h]|
- clear H;destruct H' as [H|H]]
- end .
- match type of H with
- | _ _ ?t = true =>
- generalize (algebra.F.symb_eq_bool_ok f t);
- unfold algebra.Alg.eq_symb_bool in H;
- rewrite H;clear H;intros ;subst
- end .
- vm_compute in |-*;intros ;apply P_id_Marked_u22_monotonic;assumption.
- discriminate H.
- assumption.
- Qed.
- End S.
- End Interp.
- Module InterpZ.
- Section S.
- Open Scope Z_scope.
- Hypothesis min_value : Z.
- Import ring_extention.
- Notation Local "'Alt'" := (Zwf.Zwf min_value).
- Notation Local "'Ale'" := Zle.
- Notation Local "'Aeq'" := (@eq Z).
- Notation Local "a <= b" := (Ale a b).
- Notation Local "a < b" := (Alt a b).
- Hypothesis P_id_u22 : Z ->Z.
- Hypothesis P_id_ack_in : Z ->Z ->Z.
- Hypothesis P_id_0 : Z.
- Hypothesis P_id_ack_out : Z ->Z.
- Hypothesis P_id_s : Z ->Z.
- Hypothesis P_id_u21 : Z ->Z ->Z.
- Hypothesis P_id_u11 : Z ->Z.
- Hypothesis P_id_u22_monotonic :
- forall x4 x5,
- (min_value <= x5)/\ (x5 <= x4) ->P_id_u22 x5 <= P_id_u22 x4.
- Hypothesis P_id_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (min_value <= x7)/\ (x7 <= x6) ->
- (min_value <= x5)/\ (x5 <= x4) ->
- P_id_ack_in x5 x7 <= P_id_ack_in x4 x6.
- Hypothesis P_id_ack_out_monotonic :
- forall x4 x5,
- (min_value <= x5)/\ (x5 <= x4) ->P_id_ack_out x5 <= P_id_ack_out x4.
- Hypothesis P_id_s_monotonic :
- forall x4 x5, (min_value <= x5)/\ (x5 <= x4) ->P_id_s x5 <= P_id_s x4.
- Hypothesis P_id_u21_monotonic :
- forall x4 x6 x5 x7,
- (min_value <= x7)/\ (x7 <= x6) ->
- (min_value <= x5)/\ (x5 <= x4) ->P_id_u21 x5 x7 <= P_id_u21 x4 x6.
- Hypothesis P_id_u11_monotonic :
- forall x4 x5,
- (min_value <= x5)/\ (x5 <= x4) ->P_id_u11 x5 <= P_id_u11 x4.
- Hypothesis P_id_u22_bounded :
- forall x4, (min_value <= x4) ->min_value <= P_id_u22 x4.
- Hypothesis P_id_ack_in_bounded :
- forall x4 x5,
- (min_value <= x4) ->(min_value <= x5) ->min_value <= P_id_ack_in x5 x4.
- Hypothesis P_id_0_bounded : min_value <= P_id_0 .
- Hypothesis P_id_ack_out_bounded :
- forall x4, (min_value <= x4) ->min_value <= P_id_ack_out x4.
- Hypothesis P_id_s_bounded :
- forall x4, (min_value <= x4) ->min_value <= P_id_s x4.
- Hypothesis P_id_u21_bounded :
- forall x4 x5,
- (min_value <= x4) ->(min_value <= x5) ->min_value <= P_id_u21 x5 x4.
- Hypothesis P_id_u11_bounded :
- forall x4, (min_value <= x4) ->min_value <= P_id_u11 x4.
- Definition measure :=
- Interp.measure min_value P_id_u22 P_id_ack_in P_id_0 P_id_ack_out
- P_id_s P_id_u21 P_id_u11.
- Lemma measure_equation :
- forall t,
- measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- P_id_ack_in (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_0 nil) => P_id_0
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- P_id_ack_out (measure x4)
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) =>
- P_id_s (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- P_id_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_u11 (measure x4)
- | _ => min_value
- end.
- Proof.
- intros t;
- refine match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_0 nil) => _
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) => _
- | _ => _
- end;apply refl_equal.
- Qed.
- Lemma measure_bounded : forall t, min_value <= measure t.
- Proof.
- unfold measure in |-*.
- apply Interp.measure_bounded with Alt Aeq;
- (apply interp.o_Z)||
- (cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;auto with zarith).
- Qed.
- Ltac generate_pos_hyp :=
- match goal with
- | H:context [measure ?x] |- _ =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- | |- context [measure ?x] =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- end
- .
- Hypothesis rules_monotonic :
- forall l r,
- (algebra.EQT.axiom R_xml_0_rules r l) ->measure r <= measure l.
- Lemma measure_star_monotonic :
- forall l r,
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) r l) ->
- measure r <= measure l.
- Proof.
- unfold measure in *.
- apply Interp.measure_star_monotonic with Alt Aeq.
- (apply interp.o_Z)||
- (cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;auto with zarith).
- intros ;apply P_id_u22_monotonic;assumption.
- intros ;apply P_id_ack_in_monotonic;assumption.
- intros ;apply P_id_ack_out_monotonic;assumption.
- intros ;apply P_id_s_monotonic;assumption.
- intros ;apply P_id_u21_monotonic;assumption.
- intros ;apply P_id_u11_monotonic;assumption.
- intros ;apply P_id_u22_bounded;assumption.
- intros ;apply P_id_ack_in_bounded;assumption.
- intros ;apply P_id_0_bounded;assumption.
- intros ;apply P_id_ack_out_bounded;assumption.
- intros ;apply P_id_s_bounded;assumption.
- intros ;apply P_id_u21_bounded;assumption.
- intros ;apply P_id_u11_bounded;assumption.
- apply rules_monotonic.
- Qed.
- Hypothesis P_id_Marked_u11 : Z ->Z.
- Hypothesis P_id_Marked_u22 : Z ->Z.
- Hypothesis P_id_Marked_u21 : Z ->Z ->Z.
- Hypothesis P_id_Marked_ack_in : Z ->Z ->Z.
- Hypothesis P_id_Marked_u11_monotonic :
- forall x4 x5,
- (min_value <= x5)/\ (x5 <= x4) ->
- P_id_Marked_u11 x5 <= P_id_Marked_u11 x4.
- Hypothesis P_id_Marked_u22_monotonic :
- forall x4 x5,
- (min_value <= x5)/\ (x5 <= x4) ->
- P_id_Marked_u22 x5 <= P_id_Marked_u22 x4.
- Hypothesis P_id_Marked_u21_monotonic :
- forall x4 x6 x5 x7,
- (min_value <= x7)/\ (x7 <= x6) ->
- (min_value <= x5)/\ (x5 <= x4) ->
- P_id_Marked_u21 x5 x7 <= P_id_Marked_u21 x4 x6.
- Hypothesis P_id_Marked_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (min_value <= x7)/\ (x7 <= x6) ->
- (min_value <= x5)/\ (x5 <= x4) ->
- P_id_Marked_ack_in x5 x7 <= P_id_Marked_ack_in x4 x6.
- Definition marked_measure :=
- Interp.marked_measure min_value P_id_u22 P_id_ack_in P_id_0
- P_id_ack_out P_id_s P_id_u21 P_id_u11 P_id_Marked_u11 P_id_Marked_u22
- P_id_Marked_u21 P_id_Marked_ack_in.
- Lemma marked_measure_equation :
- forall t,
- marked_measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_Marked_u11 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_Marked_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::
- x4::nil)) =>
- P_id_Marked_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::
- x4::nil)) =>
- P_id_Marked_ack_in (measure x5) (measure x4)
- | _ => measure t
- end.
- Proof.
- reflexivity .
- Qed.
- Lemma marked_measure_star_monotonic :
- forall f l1 l2,
- (TransClosure.refl_trans_clos (weaved_relation.one_step_list (algebra.EQT.one_step
- R_xml_0_rules)
- )
- l1 l2) ->
- marked_measure (algebra.Alg.Term f l1) <= marked_measure (algebra.Alg.Term
- f l2).
- Proof.
- unfold marked_measure in *.
- apply Interp.marked_measure_star_monotonic with Alt Aeq.
- (apply interp.o_Z)||
- (cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;auto with zarith).
- intros ;apply P_id_u22_monotonic;assumption.
- intros ;apply P_id_ack_in_monotonic;assumption.
- intros ;apply P_id_ack_out_monotonic;assumption.
- intros ;apply P_id_s_monotonic;assumption.
- intros ;apply P_id_u21_monotonic;assumption.
- intros ;apply P_id_u11_monotonic;assumption.
- intros ;apply P_id_u22_bounded;assumption.
- intros ;apply P_id_ack_in_bounded;assumption.
- intros ;apply P_id_0_bounded;assumption.
- intros ;apply P_id_ack_out_bounded;assumption.
- intros ;apply P_id_s_bounded;assumption.
- intros ;apply P_id_u21_bounded;assumption.
- intros ;apply P_id_u11_bounded;assumption.
- apply rules_monotonic.
- intros ;apply P_id_Marked_u11_monotonic;assumption.
- intros ;apply P_id_Marked_u22_monotonic;assumption.
- intros ;apply P_id_Marked_u21_monotonic;assumption.
- intros ;apply P_id_Marked_ack_in_monotonic;assumption.
- Qed.
- End S.
- End InterpZ.
- Inductive DP_R_xml_0 :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <ack_in(s(m),0),u11(ack_in(m,s(0)))> *)
- | DP_R_xml_0_0 :
- DP_R_xml_0 (algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term algebra.F.id_0
- nil)::nil))::nil))::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_0
- nil)::nil))
- (* <ack_in(s(m),0),ack_in(m,s(0))> *)
- | DP_R_xml_0_1 :
- DP_R_xml_0 (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Term algebra.F.id_s ((algebra.Alg.Term
- algebra.F.id_0 nil)::nil))::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_0
- nil)::nil))
- (* <ack_in(s(m),s(n)),u21(ack_in(s(m),n),m)> *)
- | DP_R_xml_0_2 :
- DP_R_xml_0 (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 1)::nil))::nil))
- (* <ack_in(s(m),s(n)),ack_in(s(m),n)> *)
- | DP_R_xml_0_3 :
- DP_R_xml_0 (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 1)::nil))::nil))
- (* <u21(ack_out(n),m),u22(ack_in(m,n))> *)
- | DP_R_xml_0_4 :
- DP_R_xml_0 (algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil))
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- (* <u21(ack_out(n),m),ack_in(m,n)> *)
- | DP_R_xml_0_5 :
- DP_R_xml_0 (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- .
- Module sdp := subterm_dp.MakeSubDP(algebra.EQT).
- Ltac cdp_incl_dp_tac ind :=
- let H := fresh "H" in
- intros ?x ?y H;
- destruct H;
- match goal with
- |- sdp.Dp.dp _ ?t ?r =>
- match type of ind with
- | context f [_ ?l r -> _] =>
- match l with
- | context g [t] =>
- match eval vm_compute in
- (algebra.Alg.is_subterm_ok_true t l (refl_equal true)) with
- | exist _ ?pos ?Hpos =>
- constructor 1 with (p := pos) (t2 := l);
- [ constructor | exact Hpos | econstructor econstructor ]
- end
- end
- end
- end.
- Ltac destruct_nth_error_nth_subterm :=
- match goal with
- | H: context [List.nth_error _ ?i ] |- _ =>
- destruct i; simpl in *
- | H: context [algebra.Alg.subterm_at_pos _ ?p ] |- _ =>
- destruct p; simpl in *
- | H: Some _ = Some _ |- _ =>
- inversion H; clear H; subst; simpl in *
- | H: None = Some _ |- _ =>
- inversion H
- | H: Some _ <> None |- _ =>
- inversion H
- | H:algebra.EQT.defined _ ?f |- _ => (* cons pas defini *)
- solve [
- let f := fresh "f" in
- let l := fresh "l" in
- let h1 := fresh "h" in
- let h2 := fresh "h" in
- inversion H as [f l h1 h2] ; subst; inversion h2 ]
- end.
- Ltac destruct_until_absurd :=
- match goal with
- | |- context [List.nth_error _ ?i ] =>
- destruct i; simpl
- | |- context [algebra.Alg.subterm_at_pos _ ?p ] =>
- destruct p; simpl
- | |- Some _ <> Some _ =>
- let abs := fresh "abs" in
- solve [intro abs; inversion abs]
- | |- None <> Some _ =>
- let abs := fresh "abs" in
- solve [intro abs; inversion abs]
- | |- Some _ <> None =>
- let abs := fresh "abs" in
- solve [intro abs; inversion abs]
- end.
- Lemma are_connected_incl : forall (R DP1 DP2:relation algebra.Alg.term) x y,
- (forall x y,DP1 x y -> DP2 x y) ->
- sdp.Dp.are_connected DP1 R x y
- -> sdp.Dp.are_connected DP2 R x y.
- Proof.
- intros R DP1 DP2 x y H.
- destruct x; destruct y.
- unfold sdp.Dp.are_connected.
- intros [sigma [sigma' [hdp1 [hdp2 h]]]] .
- exists sigma; exists sigma';intros.
- split.
- apply H;assumption.
- split.
- apply H;assumption.
- assumption.
- Qed.
- Module WF_DP_R_xml_0.
- Inductive DP_R_xml_0_non_scc_1 :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <ack_in(s(m),0),u11(ack_in(m,s(0)))> *)
- | DP_R_xml_0_non_scc_1_0 :
- DP_R_xml_0_non_scc_1 (algebra.Alg.Term algebra.F.id_u11
- ((algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term algebra.F.id_0
- nil)::nil))::nil))::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_0 nil)::nil))
- .
- Lemma acc_DP_R_xml_0_non_scc_1 :
- forall x sigma,
- In x (List.map (algebra.Alg.apply_subst sigma)
- ((algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term algebra.F.id_0
- nil)::nil))::nil))::nil))::nil)) ->
- Acc (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0) x.
- Proof.
- intros x sigma H0.
- simpl in H0|-.
- constructor;intros y Hy;inversion Hy;clear Hy;subst;destruct H;
- inversion H2;clear H2;subst;revert H3 H1;destruct H5;intros H3 H1;
- match goal with
- | |- _ =>
- simpl in H0|-;injection H3;clear H3;intros ;subst;
- repeat (
- match type of H0 with
- | or _ _ => destruct H0 as [H0| H0]
- | False => elim H0
- end
- );
- (discriminate H0)||
- (injection H0;clear H0;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- end
- );
- (impossible_star_reduction_R_xml_0 )||
- (repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step _) (algebra.Alg.Term ?f1 ?l1) (algebra.Alg.Term ?f2 ?l2)
- |- _ =>
- match f1 with
- | f2 => fail 1
- | _ => destruct (algebra.EQT_ext.trans_at_top _ f1 l1 f2 l2 _ _ H (refl_equal _) (refl_equal _) ) as [l [u [h1 [h2 h3]]]];clear H;[
- intros;discriminate|]
- end
- | H:algebra.EQT.axiom _ _ _ |- _ => inversion H;clear H;subst
- | H:R_xml_0_rules _ _ |- _ => inversion H;clear H;subst
- | H:_ = _ |- _ =>
- discriminate H || (simpl in H;injection H;clear H;intros;subst) ||fail 0
- end
- );impossible_star_reduction_R_xml_0 ))
- end
- .
- Qed.
- Inductive DP_R_xml_0_non_scc_2 :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <u21(ack_out(n),m),u22(ack_in(m,n))> *)
- | DP_R_xml_0_non_scc_2_0 :
- DP_R_xml_0_non_scc_2 (algebra.Alg.Term algebra.F.id_u22
- ((algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil))
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- .
- Lemma acc_DP_R_xml_0_non_scc_2 :
- forall x sigma,
- In x (List.map (algebra.Alg.apply_subst sigma)
- ((algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil))::nil)) ->
- Acc (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0) x.
- Proof.
- intros x sigma H0.
- simpl in H0|-.
- constructor;intros y Hy;inversion Hy;clear Hy;subst;destruct H;
- inversion H2;clear H2;subst;revert H3 H1;destruct H5;intros H3 H1;
- match goal with
- | |- _ =>
- simpl in H0|-;injection H3;clear H3;intros ;subst;
- repeat (
- match type of H0 with
- | or _ _ => destruct H0 as [H0| H0]
- | False => elim H0
- end
- );
- (discriminate H0)||
- (injection H0;clear H0;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- end
- );
- (impossible_star_reduction_R_xml_0 )||
- (repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step _) (algebra.Alg.Term ?f1 ?l1) (algebra.Alg.Term ?f2 ?l2)
- |- _ =>
- match f1 with
- | f2 => fail 1
- | _ => destruct (algebra.EQT_ext.trans_at_top _ f1 l1 f2 l2 _ _ H (refl_equal _) (refl_equal _) ) as [l [u [h1 [h2 h3]]]];clear H;[
- intros;discriminate|]
- end
- | H:algebra.EQT.axiom _ _ _ |- _ => inversion H;clear H;subst
- | H:R_xml_0_rules _ _ |- _ => inversion H;clear H;subst
- | H:_ = _ |- _ =>
- discriminate H || (simpl in H;injection H;clear H;intros;subst) ||fail 0
- end
- );impossible_star_reduction_R_xml_0 ))
- end
- .
- Qed.
- Inductive DP_R_xml_0_scc_0 :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <ack_in(s(m),0),ack_in(m,s(0))> *)
- | DP_R_xml_0_scc_0_0 :
- DP_R_xml_0_scc_0 (algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term algebra.F.id_0
- nil)::nil))::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_0 nil)::nil))
- (* <ack_in(s(m),s(n)),u21(ack_in(s(m),n),m)> *)
- | DP_R_xml_0_scc_0_1 :
- DP_R_xml_0_scc_0 (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))::(algebra.Alg.Var 2)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 1)::nil))::nil))
- (* <ack_in(s(m),s(n)),ack_in(s(m),n)> *)
- | DP_R_xml_0_scc_0_2 :
- DP_R_xml_0_scc_0 (algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 1)::nil))::nil))
- (* <u21(ack_out(n),m),ack_in(m,n)> *)
- | DP_R_xml_0_scc_0_3 :
- DP_R_xml_0_scc_0 (algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Var 2)::(algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- .
- Module WF_DP_R_xml_0_scc_0.
- Inductive DP_R_xml_0_scc_0_large :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <ack_in(s(m),s(n)),u21(ack_in(s(m),n),m)> *)
- | DP_R_xml_0_scc_0_large_0 :
- DP_R_xml_0_scc_0_large (algebra.Alg.Term algebra.F.id_u21
- ((algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 1)::nil))::nil))
- (* <ack_in(s(m),s(n)),ack_in(s(m),n)> *)
- | DP_R_xml_0_scc_0_large_1 :
- DP_R_xml_0_scc_0_large (algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 1)::nil))::nil))
- .
- Inductive DP_R_xml_0_scc_0_strict :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <ack_in(s(m),0),ack_in(m,s(0))> *)
- | DP_R_xml_0_scc_0_strict_0 :
- DP_R_xml_0_scc_0_strict (algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term
- algebra.F.id_0 nil)::nil))::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_0 nil)::nil))
- (* <u21(ack_out(n),m),ack_in(m,n)> *)
- | DP_R_xml_0_scc_0_strict_1 :
- DP_R_xml_0_scc_0_strict (algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_out ((algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- .
- Module WF_DP_R_xml_0_scc_0_large.
- Inductive DP_R_xml_0_scc_0_large_non_scc_1 :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <ack_in(s(m),s(n)),u21(ack_in(s(m),n),m)> *)
- | DP_R_xml_0_scc_0_large_non_scc_1_0 :
- DP_R_xml_0_scc_0_large_non_scc_1 (algebra.Alg.Term algebra.F.id_u21
- ((algebra.Alg.Term
- algebra.F.id_ack_in
- ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 1)::nil))::nil))
- .
- Lemma acc_DP_R_xml_0_scc_0_large_non_scc_1 :
- forall x sigma,
- In x (List.map (algebra.Alg.apply_subst sigma)
- ((algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))::nil)) ->
- Acc (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0_large) x.
- Proof.
- intros x sigma H0.
- simpl in H0|-.
- constructor;intros y Hy;inversion Hy;clear Hy;subst;destruct H;
- inversion H2;clear H2;subst;revert H3 H1;destruct H5;intros H3 H1;
- match goal with
- | |- _ =>
- simpl in H0|-;injection H3;clear H3;intros ;subst;
- repeat (
- match type of H0 with
- | or _ _ => destruct H0 as [H0| H0]
- | False => elim H0
- end
- );
- (discriminate H0)||
- (injection H0;clear H0;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- end
- );
- (impossible_star_reduction_R_xml_0 )||
- (repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step _) (algebra.Alg.Term ?f1 ?l1) (algebra.Alg.Term ?f2 ?l2)
- |- _ =>
- match f1 with
- | f2 => fail 1
- | _ => destruct (algebra.EQT_ext.trans_at_top _ f1 l1 f2 l2 _ _ H (refl_equal _) (refl_equal _) ) as [l [u [h1 [h2 h3]]]];clear H;[
- intros;discriminate|]
- end
- | H:algebra.EQT.axiom _ _ _ |- _ =>
- inversion H;clear H;subst
- | H:R_xml_0_rules _ _ |- _ => inversion H;clear H;subst
- | H:_ = _ |- _ =>
- discriminate H || (simpl in H;injection H;clear H;intros;subst) ||fail 0
- end
- );impossible_star_reduction_R_xml_0 ))
- end
- .
- Qed.
- Inductive DP_R_xml_0_scc_0_large_scc_0 :
- algebra.Alg.term ->algebra.Alg.term ->Prop :=
- (* <ack_in(s(m),s(n)),ack_in(s(m),n)> *)
- | DP_R_xml_0_scc_0_large_scc_0_0 :
- DP_R_xml_0_scc_0_large_scc_0 (algebra.Alg.Term algebra.F.id_ack_in
- ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 1)::nil))::nil))
- .
- Module WF_DP_R_xml_0_scc_0_large_scc_0.
- Open Scope Z_scope.
- Import ring_extention.
- Notation Local "a <= b" := (Zle a b).
- Notation Local "a < b" := (Zlt a b).
- Definition P_id_u22 (x4:Z) := 0.
- Definition P_id_ack_in (x4:Z) (x5:Z) := 0.
- Definition P_id_0 := 0.
- Definition P_id_ack_out (x4:Z) := 0.
- Definition P_id_s (x4:Z) := 1 + 1* x4 + 0.
- Definition P_id_u21 (x4:Z) (x5:Z) := 0.
- Definition P_id_u11 (x4:Z) := 0.
- Lemma P_id_u22_monotonic :
- forall x4 x5, (0 <= x5)/\ (x5 <= x4) ->P_id_u22 x5 <= P_id_u22 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->P_id_ack_in x5 x7 <= P_id_ack_in x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_out_monotonic :
- forall x4 x5,
- (0 <= x5)/\ (x5 <= x4) ->P_id_ack_out x5 <= P_id_ack_out x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_s_monotonic :
- forall x4 x5, (0 <= x5)/\ (x5 <= x4) ->P_id_s x5 <= P_id_s x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u21_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->P_id_u21 x5 x7 <= P_id_u21 x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u11_monotonic :
- forall x4 x5, (0 <= x5)/\ (x5 <= x4) ->P_id_u11 x5 <= P_id_u11 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u22_bounded : forall x4, (0 <= x4) ->0 <= P_id_u22 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_in_bounded :
- forall x4 x5, (0 <= x4) ->(0 <= x5) ->0 <= P_id_ack_in x5 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_0_bounded : 0 <= P_id_0 .
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_out_bounded :
- forall x4, (0 <= x4) ->0 <= P_id_ack_out x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_s_bounded : forall x4, (0 <= x4) ->0 <= P_id_s x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u21_bounded :
- forall x4 x5, (0 <= x4) ->(0 <= x5) ->0 <= P_id_u21 x5 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u11_bounded : forall x4, (0 <= x4) ->0 <= P_id_u11 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Definition measure :=
- InterpZ.measure 0 P_id_u22 P_id_ack_in P_id_0 P_id_ack_out P_id_s
- P_id_u21 P_id_u11.
- Lemma measure_equation :
- forall t,
- measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- P_id_ack_in (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_0 nil) => P_id_0
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- P_id_ack_out (measure x4)
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) =>
- P_id_s (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- P_id_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_u11 (measure x4)
- | _ => 0
- end.
- Proof.
- intros t;
- refine match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_0 nil) => _
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) => _
- | _ => _
- end;apply refl_equal.
- Qed.
- Lemma measure_bounded : forall t, 0 <= measure t.
- Proof.
- unfold measure in |-*.
- apply InterpZ.measure_bounded;
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Ltac generate_pos_hyp :=
- match goal with
- | H:context [measure ?x] |- _ =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- | |- context [measure ?x] =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- end
- .
- Lemma rules_monotonic :
- forall l r,
- (algebra.EQT.axiom R_xml_0_rules r l) ->measure r <= measure l.
- Proof.
- intros l r H.
- fold measure in |-*.
- inversion H;clear H;subst;inversion H0;clear H0;subst;
- simpl algebra.EQT.T.apply_subst in |-*;
- repeat (
- match goal with
- | |- context [measure (algebra.Alg.Term ?f ?t)] =>
- rewrite (measure_equation (algebra.Alg.Term f t))
- end
- );repeat (generate_pos_hyp );
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma measure_star_monotonic :
- forall l r,
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) r l) ->
- measure r <= measure l.
- Proof.
- unfold measure in *.
- apply InterpZ.measure_star_monotonic.
- intros ;apply P_id_u22_monotonic;assumption.
- intros ;apply P_id_ack_in_monotonic;assumption.
- intros ;apply P_id_ack_out_monotonic;assumption.
- intros ;apply P_id_s_monotonic;assumption.
- intros ;apply P_id_u21_monotonic;assumption.
- intros ;apply P_id_u11_monotonic;assumption.
- intros ;apply P_id_u22_bounded;assumption.
- intros ;apply P_id_ack_in_bounded;assumption.
- intros ;apply P_id_0_bounded;assumption.
- intros ;apply P_id_ack_out_bounded;assumption.
- intros ;apply P_id_s_bounded;assumption.
- intros ;apply P_id_u21_bounded;assumption.
- intros ;apply P_id_u11_bounded;assumption.
- apply rules_monotonic.
- Qed.
- Definition P_id_Marked_u11 (x4:Z) := 1* x4 + 0.
- Definition P_id_Marked_u22 (x4:Z) := 1* x4 + 0.
- Definition P_id_Marked_u21 (x4:Z) (x5:Z) := 1* x5 + 1* x4 + 0.
- Definition P_id_Marked_ack_in (x4:Z) (x5:Z) := 1* x5 + 0.
- Lemma P_id_Marked_u11_monotonic :
- forall x4 x5,
- (0 <= x5)/\ (x5 <= x4) ->P_id_Marked_u11 x5 <= P_id_Marked_u11 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_Marked_u22_monotonic :
- forall x4 x5,
- (0 <= x5)/\ (x5 <= x4) ->P_id_Marked_u22 x5 <= P_id_Marked_u22 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_Marked_u21_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->
- P_id_Marked_u21 x5 x7 <= P_id_Marked_u21 x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_Marked_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->
- P_id_Marked_ack_in x5 x7 <= P_id_Marked_ack_in x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Definition marked_measure :=
- InterpZ.marked_measure 0 P_id_u22 P_id_ack_in P_id_0 P_id_ack_out
- P_id_s P_id_u21 P_id_u11 P_id_Marked_u11 P_id_Marked_u22
- P_id_Marked_u21 P_id_Marked_ack_in.
- Lemma marked_measure_equation :
- forall t,
- marked_measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_Marked_u11 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_Marked_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::
- x4::nil)) =>
- P_id_Marked_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::
- x4::nil)) =>
- P_id_Marked_ack_in (measure x5) (measure x4)
- | _ => measure t
- end.
- Proof.
- reflexivity .
- Qed.
- Lemma marked_measure_star_monotonic :
- forall f l1 l2,
- (TransClosure.refl_trans_clos (weaved_relation.one_step_list (algebra.EQT.one_step
- R_xml_0_rules)
- )
- l1 l2) ->
- marked_measure (algebra.Alg.Term f l1) <= marked_measure (algebra.Alg.Term
- f
- l2).
- Proof.
- unfold marked_measure in *.
- apply InterpZ.marked_measure_star_monotonic.
- intros ;apply P_id_u22_monotonic;assumption.
- intros ;apply P_id_ack_in_monotonic;assumption.
- intros ;apply P_id_ack_out_monotonic;assumption.
- intros ;apply P_id_s_monotonic;assumption.
- intros ;apply P_id_u21_monotonic;assumption.
- intros ;apply P_id_u11_monotonic;assumption.
- intros ;apply P_id_u22_bounded;assumption.
- intros ;apply P_id_ack_in_bounded;assumption.
- intros ;apply P_id_0_bounded;assumption.
- intros ;apply P_id_ack_out_bounded;assumption.
- intros ;apply P_id_s_bounded;assumption.
- intros ;apply P_id_u21_bounded;assumption.
- intros ;apply P_id_u11_bounded;assumption.
- apply rules_monotonic.
- intros ;apply P_id_Marked_u11_monotonic;assumption.
- intros ;apply P_id_Marked_u22_monotonic;assumption.
- intros ;apply P_id_Marked_u21_monotonic;assumption.
- intros ;apply P_id_Marked_ack_in_monotonic;assumption.
- Qed.
- Ltac rewrite_and_unfold :=
- do 2 (rewrite marked_measure_equation);
- repeat (
- match goal with
- | |- context [measure (algebra.Alg.Term ?f ?t)] =>
- rewrite (measure_equation (algebra.Alg.Term f t))
- | H:context [measure (algebra.Alg.Term ?f ?t)] |- _ =>
- rewrite (measure_equation (algebra.Alg.Term f t)) in H|-
- end
- ).
- Lemma wf :
- well_founded (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0_large_scc_0).
- Proof.
- intros x.
- apply well_founded_ind with
- (R:=fun x y => (Zwf.Zwf 0) (marked_measure x) (marked_measure y)).
- apply Inverse_Image.wf_inverse_image with (B:=Z).
- apply Zwf.Zwf_well_founded.
- clear x.
- intros x IHx.
- repeat (
- constructor;intros y H;
- repeat progress
- match goal with
- | H: _ = _ |- _ => (injection H;clear H;intros;subst)||discriminate H || fail 0
- | H : sdp.Rcdp _ _ _ _ |- _ => inversion H;clear H; subst
- | H : DP_R_xml_0_scc_0_large_scc_0 _ _ |- _ => inversion H;clear H; subst
- | H : algebra.EQT.axiom _ _ _ |- _ => inversion H;clear H; subst
- | H : sdp.Rcdp_min _ _ _ _ |- _ => destruct H as [H _]
- | H : TransClosure.refl_trans_clos (weaved_relation.one_step_list _) (_::_) _ |- _ =>
- apply algebra.EQT_ext.one_step_list_star_decompose_cons in H;
- let x := fresh "x" in
- let l := fresh "l" in
- let h1 := fresh "h" in
- let h2 := fresh "h" in
- destruct H as [ x [ l [ h1 [ h2 H ]]]]
- | H : TransClosure.refl_trans_clos (weaved_relation.one_step_list _) nil _ |- _ =>
- apply algebra.EQT_ext.one_step_list_star_decompose_nil in H;
- subst
- end ;
- simpl algebra.Alg.apply_subst in |-*;
- full_prove_ineq algebra.Alg.Term
- ltac:(algebra.Alg_ext.find_replacement )
- algebra.EQT_ext.one_step_list_refl_trans_clos marked_measure
- marked_measure_star_monotonic (Zwf.Zwf 0) (interp.o_Z 0)
- ltac:(fun _ => impossible_star_reduction_R_xml_0 )
- ltac:(fun _ => rewrite_and_unfold ) ltac:(fun _ => generate_pos_hyp )
- ltac:(fun _ => cbv beta iota zeta delta - [Zplus Zmult Zle Zlt] in * ;
- try (constructor))
- IHx algebra.Alg.apply_subst
- ).
- Qed.
- End WF_DP_R_xml_0_scc_0_large_scc_0.
- Definition wf_DP_R_xml_0_scc_0_large_scc_0 :=
- WF_DP_R_xml_0_scc_0_large_scc_0.wf.
- Lemma acc_DP_R_xml_0_scc_0_large_scc_0 :
- forall x sigma,
- In x (List.map (algebra.Alg.apply_subst sigma)
- ((algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))::nil)) ->
- Acc (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0_large) x.
- Proof.
- intros x.
- pattern x.
- apply well_founded_induction with (1:=wf_DP_R_xml_0_scc_0_large_scc_0) .
- clear .
- intros x IH sigma H0.
- simpl in H0|-.
- constructor;intros y Hy;inversion Hy;clear Hy;subst;destruct H;
- inversion H2;clear H2;subst;revert H3 H1;destruct H5;intros H3 H1;
- match goal with
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))) =>
- apply acc_DP_R_xml_0_scc_0_large_non_scc_1 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))) =>
- (apply IH with sigma;
- [(constructor;
- [(constructor 1 with l2;[assumption|rewrite <- H3]);
- constructor constructor|assumption])|
- apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])])
- | |- _ =>
- simpl in H0|-;injection H3;clear H3;intros ;subst;
- repeat (
- match type of H0 with
- | or _ _ => destruct H0 as [H0| H0]
- | False => elim H0
- end
- );
- (discriminate H0)||
- (injection H0;clear H0;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- end
- );
- (impossible_star_reduction_R_xml_0 )||
- (repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step _) (algebra.Alg.Term ?f1 ?l1) (algebra.Alg.Term ?f2 ?l2)
- |- _ =>
- match f1 with
- | f2 => fail 1
- | _ => destruct (algebra.EQT_ext.trans_at_top _ f1 l1 f2 l2 _ _ H (refl_equal _) (refl_equal _) ) as [l [u [h1 [h2 h3]]]];clear H;[
- intros;discriminate|]
- end
- | H:algebra.EQT.axiom _ _ _ |- _ =>
- inversion H;clear H;subst
- | H:R_xml_0_rules _ _ |- _ => inversion H;clear H;subst
- | H:_ = _ |- _ =>
- discriminate H || (simpl in H;injection H;clear H;intros;subst) ||fail 0
- end
- );impossible_star_reduction_R_xml_0 ))
- end
- .
- Qed.
- Lemma wf :
- well_founded (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0_large).
- Proof.
- constructor;intros y Hy;inversion Hy;clear Hy;subst;destruct H;
- inversion H1;clear H1;subst;revert H2 H0;case H4;intros H2 H0;
- match goal with
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))) =>
- apply acc_DP_R_xml_0_scc_0_large_non_scc_1 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))) =>
- apply acc_DP_R_xml_0_scc_0_large_scc_0 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- _ =>
- injection H;clear H;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- end
- );
- (impossible_star_reduction_R_xml_0 )||
- (repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step _) (algebra.Alg.Term ?f1 ?l1) (algebra.Alg.Term ?f2 ?l2)
- |- _ =>
- match f1 with
- | f2 => fail 1
- | _ => destruct (algebra.EQT_ext.trans_at_top _ f1 l1 f2 l2 _ _ H (refl_equal _) (refl_equal _) ) as [l [u [h1 [h2 h3]]]];clear H;[
- intros;discriminate|]
- end
- | H:algebra.EQT.axiom _ _ _ |- _ => inversion H;clear H;subst
- | H:R_xml_0_rules _ _ |- _ => inversion H;clear H;subst
- | H:_ = _ |- _ =>
- discriminate H || (simpl in H;injection H;clear H;intros;subst) ||fail 0
- end
- );impossible_star_reduction_R_xml_0 )
- end
- .
- Qed.
- End WF_DP_R_xml_0_scc_0_large.
- Open Scope Z_scope.
- Import ring_extention.
- Notation Local "a <= b" := (Zle a b).
- Notation Local "a < b" := (Zlt a b).
- Definition P_id_u22 (x4:Z) := 0.
- Definition P_id_ack_in (x4:Z) (x5:Z) := 0.
- Definition P_id_0 := 0.
- Definition P_id_ack_out (x4:Z) := 0.
- Definition P_id_s (x4:Z) := 1 + 1* x4 + 0.
- Definition P_id_u21 (x4:Z) (x5:Z) := 0.
- Definition P_id_u11 (x4:Z) := 0.
- Lemma P_id_u22_monotonic :
- forall x4 x5, (0 <= x5)/\ (x5 <= x4) ->P_id_u22 x5 <= P_id_u22 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->P_id_ack_in x5 x7 <= P_id_ack_in x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_out_monotonic :
- forall x4 x5, (0 <= x5)/\ (x5 <= x4) ->P_id_ack_out x5 <= P_id_ack_out x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_s_monotonic :
- forall x4 x5, (0 <= x5)/\ (x5 <= x4) ->P_id_s x5 <= P_id_s x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u21_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->P_id_u21 x5 x7 <= P_id_u21 x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u11_monotonic :
- forall x4 x5, (0 <= x5)/\ (x5 <= x4) ->P_id_u11 x5 <= P_id_u11 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u22_bounded : forall x4, (0 <= x4) ->0 <= P_id_u22 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_in_bounded :
- forall x4 x5, (0 <= x4) ->(0 <= x5) ->0 <= P_id_ack_in x5 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_0_bounded : 0 <= P_id_0 .
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_ack_out_bounded : forall x4, (0 <= x4) ->0 <= P_id_ack_out x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_s_bounded : forall x4, (0 <= x4) ->0 <= P_id_s x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u21_bounded :
- forall x4 x5, (0 <= x4) ->(0 <= x5) ->0 <= P_id_u21 x5 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_u11_bounded : forall x4, (0 <= x4) ->0 <= P_id_u11 x4.
- Proof.
- intros .
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Definition measure :=
- InterpZ.measure 0 P_id_u22 P_id_ack_in P_id_0 P_id_ack_out P_id_s
- P_id_u21 P_id_u11.
- Lemma measure_equation :
- forall t,
- measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- P_id_ack_in (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_0 nil) => P_id_0
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- P_id_ack_out (measure x4)
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) =>
- P_id_s (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- P_id_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_u11 (measure x4)
- | _ => 0
- end.
- Proof.
- intros t;
- refine match t with
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_0 nil) => _
- | (algebra.Alg.Term algebra.F.id_ack_out (x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_s (x4::nil)) => _
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- _
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) => _
- | _ => _
- end;apply refl_equal.
- Qed.
- Lemma measure_bounded : forall t, 0 <= measure t.
- Proof.
- unfold measure in |-*.
- apply InterpZ.measure_bounded;
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Ltac generate_pos_hyp :=
- match goal with
- | H:context [measure ?x] |- _ =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- | |- context [measure ?x] =>
- let v := fresh "v" in
- (let H := fresh "h" in
- (set (H:=measure_bounded x) in *;set (v:=measure x) in *;
- clearbody H;clearbody v))
- end
- .
- Lemma rules_monotonic :
- forall l r,
- (algebra.EQT.axiom R_xml_0_rules r l) ->measure r <= measure l.
- Proof.
- intros l r H.
- fold measure in |-*.
- inversion H;clear H;subst;inversion H0;clear H0;subst;
- simpl algebra.EQT.T.apply_subst in |-*;
- repeat (
- match goal with
- | |- context [measure (algebra.Alg.Term ?f ?t)] =>
- rewrite (measure_equation (algebra.Alg.Term f t))
- end
- );repeat (generate_pos_hyp );
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma measure_star_monotonic :
- forall l r,
- (TransClosure.refl_trans_clos (algebra.EQT.one_step R_xml_0_rules) r l) ->
- measure r <= measure l.
- Proof.
- unfold measure in *.
- apply InterpZ.measure_star_monotonic.
- intros ;apply P_id_u22_monotonic;assumption.
- intros ;apply P_id_ack_in_monotonic;assumption.
- intros ;apply P_id_ack_out_monotonic;assumption.
- intros ;apply P_id_s_monotonic;assumption.
- intros ;apply P_id_u21_monotonic;assumption.
- intros ;apply P_id_u11_monotonic;assumption.
- intros ;apply P_id_u22_bounded;assumption.
- intros ;apply P_id_ack_in_bounded;assumption.
- intros ;apply P_id_0_bounded;assumption.
- intros ;apply P_id_ack_out_bounded;assumption.
- intros ;apply P_id_s_bounded;assumption.
- intros ;apply P_id_u21_bounded;assumption.
- intros ;apply P_id_u11_bounded;assumption.
- apply rules_monotonic.
- Qed.
- Definition P_id_Marked_u11 (x4:Z) := 1* x4 + 0.
- Definition P_id_Marked_u22 (x4:Z) := 1* x4 + 0.
- Definition P_id_Marked_u21 (x4:Z) (x5:Z) := 1 + 1* x5 + 0.
- Definition P_id_Marked_ack_in (x4:Z) (x5:Z) := 1* x4 + 0.
- Lemma P_id_Marked_u11_monotonic :
- forall x4 x5,
- (0 <= x5)/\ (x5 <= x4) ->P_id_Marked_u11 x5 <= P_id_Marked_u11 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_Marked_u22_monotonic :
- forall x4 x5,
- (0 <= x5)/\ (x5 <= x4) ->P_id_Marked_u22 x5 <= P_id_Marked_u22 x4.
- Proof.
- intros x5 x4.
- intros [H_1 H_0].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_Marked_u21_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->P_id_Marked_u21 x5 x7 <= P_id_Marked_u21 x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma P_id_Marked_ack_in_monotonic :
- forall x4 x6 x5 x7,
- (0 <= x7)/\ (x7 <= x6) ->
- (0 <= x5)/\ (x5 <= x4) ->
- P_id_Marked_ack_in x5 x7 <= P_id_Marked_ack_in x4 x6.
- Proof.
- intros x7 x6 x5 x4.
- intros [H_1 H_0].
- intros [H_3 H_2].
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Definition marked_measure :=
- InterpZ.marked_measure 0 P_id_u22 P_id_ack_in P_id_0 P_id_ack_out
- P_id_s P_id_u21 P_id_u11 P_id_Marked_u11 P_id_Marked_u22
- P_id_Marked_u21 P_id_Marked_ack_in.
- Lemma marked_measure_equation :
- forall t,
- marked_measure t = match t with
- | (algebra.Alg.Term algebra.F.id_u11 (x4::nil)) =>
- P_id_Marked_u11 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u22 (x4::nil)) =>
- P_id_Marked_u22 (measure x4)
- | (algebra.Alg.Term algebra.F.id_u21 (x5::x4::nil)) =>
- P_id_Marked_u21 (measure x5) (measure x4)
- | (algebra.Alg.Term algebra.F.id_ack_in (x5::
- x4::nil)) =>
- P_id_Marked_ack_in (measure x5) (measure x4)
- | _ => measure t
- end.
- Proof.
- reflexivity .
- Qed.
- Lemma marked_measure_star_monotonic :
- forall f l1 l2,
- (TransClosure.refl_trans_clos (weaved_relation.one_step_list (algebra.EQT.one_step
- R_xml_0_rules)
- )
- l1 l2) ->
- marked_measure (algebra.Alg.Term f l1) <= marked_measure (algebra.Alg.Term
- f l2).
- Proof.
- unfold marked_measure in *.
- apply InterpZ.marked_measure_star_monotonic.
- intros ;apply P_id_u22_monotonic;assumption.
- intros ;apply P_id_ack_in_monotonic;assumption.
- intros ;apply P_id_ack_out_monotonic;assumption.
- intros ;apply P_id_s_monotonic;assumption.
- intros ;apply P_id_u21_monotonic;assumption.
- intros ;apply P_id_u11_monotonic;assumption.
- intros ;apply P_id_u22_bounded;assumption.
- intros ;apply P_id_ack_in_bounded;assumption.
- intros ;apply P_id_0_bounded;assumption.
- intros ;apply P_id_ack_out_bounded;assumption.
- intros ;apply P_id_s_bounded;assumption.
- intros ;apply P_id_u21_bounded;assumption.
- intros ;apply P_id_u11_bounded;assumption.
- apply rules_monotonic.
- intros ;apply P_id_Marked_u11_monotonic;assumption.
- intros ;apply P_id_Marked_u22_monotonic;assumption.
- intros ;apply P_id_Marked_u21_monotonic;assumption.
- intros ;apply P_id_Marked_ack_in_monotonic;assumption.
- Qed.
- Ltac rewrite_and_unfold :=
- do 2 (rewrite marked_measure_equation);
- repeat (
- match goal with
- | |- context [measure (algebra.Alg.Term ?f ?t)] =>
- rewrite (measure_equation (algebra.Alg.Term f t))
- | H:context [measure (algebra.Alg.Term ?f ?t)] |- _ =>
- rewrite (measure_equation (algebra.Alg.Term f t)) in H|-
- end
- ).
- Definition lt a b := (Zwf.Zwf 0) (marked_measure a) (marked_measure b).
- Definition le a b := marked_measure a <= marked_measure b.
- Lemma lt_le_compat : forall a b c, (lt a b) ->(le b c) ->lt a c.
- Proof.
- unfold lt, le in *.
- intros a b c.
- apply (interp.le_lt_compat_right (interp.o_Z 0)).
- Qed.
- Lemma wf_lt : well_founded lt.
- Proof.
- unfold lt in *.
- apply Inverse_Image.wf_inverse_image with (B:=Z).
- apply Zwf.Zwf_well_founded.
- Qed.
- Lemma DP_R_xml_0_scc_0_strict_in_lt :
- Relation_Definitions.inclusion _
- (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0_strict) lt.
- Proof.
- unfold Relation_Definitions.inclusion, lt in *.
- intros a b H;destruct H;clear H0;destruct H;inversion H0;clear H0;
- subst;destruct H3;injection H1;clear H1;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) (_::_) ?l1
- |- _ =>
- let x := fresh "x" in
- let l := fresh "l" in
- let heq := fresh "heq" in
- let h1 := fresh "h" in
- let h2:= fresh "h" in
- destruct (algebra.EQT_ext.one_step_list_star_decompose_cons _ _ _ _ H) as
- [x [ l [ heq [h1 h2]]]];
- clear H;subst l1
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) nil ?l1 |- _ =>
- let heq := fresh "heq" in
- set (heq := algebra.EQT_ext.one_step_list_star_decompose_nil _ _ H);
- clearbody heq; clear H;subst l1
- end) ;
- match goal with
- | |- (Zwf.Zwf 0) _ (marked_measure (algebra.Alg.Term ?f ?l)) =>
- let l'' := algebra.Alg_ext.find_replacement l in
- ((apply (interp.le_lt_compat_right (interp.o_Z 0)) with
- (marked_measure (algebra.Alg.Term f l''));[idtac|
- apply marked_measure_star_monotonic;
- repeat (apply algebra.EQT_ext.one_step_list_refl_trans_clos);
- (assumption)||(constructor 1)]))
- end
- ;clear ;simpl algebra.Alg.apply_subst in *;rewrite_and_unfold ;
- repeat (generate_pos_hyp );
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Lemma DP_R_xml_0_scc_0_large_in_le :
- Relation_Definitions.inclusion _
- (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0_large) le.
- Proof.
- unfold Relation_Definitions.inclusion, le, Zwf.Zwf in *.
- intros a b H;destruct H;clear H0;destruct H;inversion H0;clear H0;
- subst;destruct H3;injection H1;clear H1;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) (_::_) ?l1
- |- _ =>
- let x := fresh "x" in
- let l := fresh "l" in
- let heq := fresh "heq" in
- let h1 := fresh "h" in
- let h2:= fresh "h" in
- destruct (algebra.EQT_ext.one_step_list_star_decompose_cons _ _ _ _ H) as
- [x [ l [ heq [h1 h2]]]];
- clear H;subst l1
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) nil ?l1 |- _ =>
- let heq := fresh "heq" in
- set (heq := algebra.EQT_ext.one_step_list_star_decompose_nil _ _ H);
- clearbody heq; clear H;subst l1
- end) ;
- match goal with
- | |- _ <= marked_measure (algebra.Alg.Term ?f ?l) =>
- let l'' := algebra.Alg_ext.find_replacement l in
- ((apply (interp.le_trans (interp.o_Z 0)) with
- (marked_measure (algebra.Alg.Term f l''));[idtac|
- apply marked_measure_star_monotonic;
- repeat (apply algebra.EQT_ext.one_step_list_refl_trans_clos);
- (assumption)||(constructor 1)]))
- end
- ;clear ;simpl algebra.Alg.apply_subst in *;rewrite_and_unfold ;
- repeat (generate_pos_hyp );
- cbv beta iota zeta delta - [Zle Zlt Zplus Zmult] ;intuition;
- ring_simplify ;
- (auto with zarith)||(repeat (translate_vars );prove_ineq ).
- Qed.
- Definition wf_DP_R_xml_0_scc_0_large := WF_DP_R_xml_0_scc_0_large.wf.
- Lemma wf : well_founded (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0).
- Proof.
- intros x.
- apply (well_founded_ind wf_lt).
- clear x.
- intros x.
- pattern x.
- apply (@Acc_ind _ (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0_scc_0_large)).
- clear x.
- intros x _ IHx IHx'.
- constructor.
- intros y H.
- destruct H.
- destruct H.
- inversion H1;clear H1;subst.
- destruct H4;injection H2;intros .
- apply IHx';apply DP_R_xml_0_scc_0_strict_in_lt;
- (constructor;
- [(constructor 1 with l2;[refine H|
- subst;rewrite <- H2;constructor;constructor])|assumption]).
- (apply IHx;
- [(constructor;
- [(constructor 1 with l2;[refine H|
- subst;rewrite <- H2;constructor;constructor])|assumption])|
- intros y' Hlt;apply IHx';apply lt_le_compat with (1:=Hlt) ;
- apply DP_R_xml_0_scc_0_large_in_le;
- (constructor;
- [(constructor 1 with l2;[refine H|
- subst;rewrite <- H2;constructor;constructor])|assumption])]).
- (apply IHx;
- [(constructor;
- [(constructor 1 with l2;[refine H|
- subst;rewrite <- H2;constructor;constructor])|assumption])|
- intros y' Hlt;apply IHx';apply lt_le_compat with (1:=Hlt) ;
- apply DP_R_xml_0_scc_0_large_in_le;
- (constructor;
- [(constructor 1 with l2;[refine H|
- subst;rewrite <- H2;constructor;constructor])|assumption])]).
- apply IHx';apply DP_R_xml_0_scc_0_strict_in_lt;
- (constructor;
- [(constructor 1 with l2;[refine H|
- subst;rewrite <- H2;constructor;constructor])|assumption]).
- apply wf_DP_R_xml_0_scc_0_large.
- Qed.
- End WF_DP_R_xml_0_scc_0.
- Definition wf_DP_R_xml_0_scc_0 := WF_DP_R_xml_0_scc_0.wf.
- Lemma acc_DP_R_xml_0_scc_0 :
- forall x sigma,
- In x (List.map (algebra.Alg.apply_subst sigma)
- ((algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Term algebra.F.id_s ((algebra.Alg.Term
- algebra.F.id_0 nil)::nil))::nil))::
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil)) ->
- Acc (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0) x.
- Proof.
- intros x.
- pattern x.
- apply well_founded_induction with (1:=wf_DP_R_xml_0_scc_0) .
- clear .
- intros x IH sigma H0.
- simpl in H0|-.
- constructor;intros y Hy;inversion Hy;clear Hy;subst;destruct H;
- inversion H2;clear H2;subst;revert H3 H1;destruct H5;intros H3 H1;
- match goal with
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil))) =>
- apply acc_DP_R_xml_0_non_scc_2 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term algebra.F.id_0
- nil)::nil))::nil))::nil))) =>
- apply acc_DP_R_xml_0_non_scc_1 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Term algebra.F.id_s ((algebra.Alg.Term
- algebra.F.id_0 nil)::nil))::nil))) =>
- (apply IH with sigma;
- [(constructor;
- [(constructor 1 with l2;[assumption|rewrite <- H3]);
- constructor constructor|assumption])|
- apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))) =>
- (apply IH with sigma;
- [(constructor;
- [(constructor 1 with l2;[assumption|rewrite <- H3]);
- constructor constructor|assumption])|
- apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))) =>
- (apply IH with sigma;
- [(constructor;
- [(constructor 1 with l2;[assumption|rewrite <- H3]);
- constructor constructor|assumption])|
- apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))) =>
- (apply IH with sigma;
- [(constructor;
- [(constructor 1 with l2;[assumption|rewrite <- H3]);
- constructor constructor|assumption])|
- apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])])
- | |- _ =>
- simpl in H0|-;injection H3;clear H3;intros ;subst;
- repeat (
- match type of H0 with
- | or _ _ => destruct H0 as [H0| H0]
- | False => elim H0
- end
- );
- (discriminate H0)||
- (injection H0;clear H0;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- end
- );
- (impossible_star_reduction_R_xml_0 )||
- (repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step _) (algebra.Alg.Term ?f1 ?l1) (algebra.Alg.Term ?f2 ?l2)
- |- _ =>
- match f1 with
- | f2 => fail 1
- | _ => destruct (algebra.EQT_ext.trans_at_top _ f1 l1 f2 l2 _ _ H (refl_equal _) (refl_equal _) ) as [l [u [h1 [h2 h3]]]];clear H;[
- intros;discriminate|]
- end
- | H:algebra.EQT.axiom _ _ _ |- _ => inversion H;clear H;subst
- | H:R_xml_0_rules _ _ |- _ => inversion H;clear H;subst
- | H:_ = _ |- _ =>
- discriminate H || (simpl in H;injection H;clear H;intros;subst) ||fail 0
- end
- );impossible_star_reduction_R_xml_0 ))
- end
- .
- Qed.
- Lemma wf : well_founded (sdp.Rcdp_min R_xml_0_rules DP_R_xml_0).
- Proof.
- constructor;intros y Hy;inversion Hy;clear Hy;subst;destruct H;
- inversion H1;clear H1;subst;revert H2 H0;case H4;intros H2 H0;
- match goal with
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u22 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))::nil))) =>
- apply acc_DP_R_xml_0_non_scc_2 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u11 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Var 2)::(algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Term algebra.F.id_0
- nil)::nil))::nil))::nil))) =>
- apply acc_DP_R_xml_0_non_scc_1 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Term algebra.F.id_s ((algebra.Alg.Term
- algebra.F.id_0 nil)::nil))::nil))) =>
- apply acc_DP_R_xml_0_scc_0 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_u21 ((algebra.Alg.Term
- algebra.F.id_ack_in ((algebra.Alg.Term algebra.F.id_s
- ((algebra.Alg.Var 2)::nil))::(algebra.Alg.Var 1)::nil))::
- (algebra.Alg.Var 2)::nil))) =>
- apply acc_DP_R_xml_0_scc_0 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Term
- algebra.F.id_s ((algebra.Alg.Var 2)::nil))::
- (algebra.Alg.Var 1)::nil))) =>
- apply acc_DP_R_xml_0_scc_0 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- Acc _
- (algebra.Alg.apply_subst ?sigma
- (algebra.Alg.Term algebra.F.id_ack_in ((algebra.Alg.Var 2)::
- (algebra.Alg.Var 1)::nil))) =>
- apply acc_DP_R_xml_0_scc_0 with sigma;apply in_map;
- (rewrite (algebra.EQT_ext.inb_equiv _ algebra.Alg.eq_bool);
- [vm_compute in |-*;refine (refl_equal _)|
- apply algebra.Alg_ext.term_eq_bool_equiv])
- | |- _ =>
- injection H;clear H;intros ;subst;
- repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- end
- );
- (impossible_star_reduction_R_xml_0 )||
- (repeat (
- match goal with
- | H:TransClosure.refl_trans_clos (weaved_relation.one_step_list _) _ _
- |- _ =>
- destruct (algebra.EQT_ext.cons_star _ _ _ _ _ H) ;clear H
- | H:TransClosure.refl_trans_clos (algebra.EQT.one_step _) (algebra.Alg.Term ?f1 ?l1) (algebra.Alg.Term ?f2 ?l2)
- |- _ =>
- match f1 with
- | f2 => fail 1
- | _ => destruct (algebra.EQT_ext.trans_at_top _ f1 l1 f2 l2 _ _ H (refl_equal _) (refl_equal _) ) as [l [u [h1 [h2 h3]]]];clear H;[
- intros;discriminate|]
- end
- | H:algebra.EQT.axiom _ _ _ |- _ => inversion H;clear H;subst
- | H:R_xml_0_rules _ _ |- _ => inversion H;clear H;subst
- | H:_ = _ |- _ =>
- discriminate H || (simpl in H;injection H;clear H;intros;subst) ||fail 0
- end
- );impossible_star_reduction_R_xml_0 )
- end
- .
- Qed.
- End WF_DP_R_xml_0.
- Ltac destruct_until_cdp_or_notdefined :=
- match goal with
- | H: None = Some _ |- _ => inversion H
- | H:algebra.EQT.defined _ ?f |- _ =>
- solve [inversion H;
- match goal with
- H': R_xml_0_rules _ _ |- _ =>
- inversion H'
- end
- | solve
- [constructor; constructor |
- constructor 2; constructor ; constructor |
- constructor 2 ;constructor 2; constructor |
- constructor 2 ;constructor 2; constructor 2 ]
- ]
- | H: Some _ = Some _ |- _ =>
- inversion H; clear H;subst
- | H: (match (nth_error _ ?n) with
- Some _ => _
- | None => _ end) = Some _ |- _ =>
- destruct n;simpl in *
- | H: algebra.Alg.subterm_at_pos _ ?p = Some _ |- _ => destruct p;simpl in *
- end.
- Definition wf_H := WF_DP_R_xml_0.wf.
- Lemma wf : well_founded (algebra.EQT.one_step R_xml_0_rules).
- Proof.
- apply sdp.Dp.ddp_criterion.
- intros x t .
- apply R_xml_0_non_var.
- apply R_xml_0_reg.
- intros ;apply (ddp.constructor_defined_dec _ _ R_xml_0_rules_included).
- apply Inclusion.wf_incl with (2:=wf_H).
- intros x y.
- clear;intros H;destruct H;constructor;[|assumption].
- inversion H. econstructor; try eassumption;subst.
- inversion H2. constructor.
- clear -H5.
- apply sdp.Dp.ddp_list_is_complete with (is_def := algebra.EQT_ext.is_def (sdp.Dp.defined_list R_xml_0_rule_as_list nil)) (1:=R_xml_0_rules_included) in H5.
- vm_compute in H5;
- repeat (destruct H5 as [H5|H5]; [ injection H5;clear H5;intros;subst;constructor|]);
- elim H5.
- apply algebra.EQT_ext.is_def_equiv.
- split.
- apply sdp.Dp.defined_list_sound with (1:=R_xml_0_rules_included).
- apply sdp.Dp.defined_list_complete with (1:=R_xml_0_rules_included)
- .
- Qed.
- End WF_R_xml_0.
- (*
- *** Local Variables: ***
- *** coq-prog-name: "coqtop" ***
- *** coq-prog-args: ("-emacs-U" "-I" "$COCCINELLE/examples" "-I" "$COCCINELLE/term_algebra" "-I" "$COCCINELLE/term_orderings" "-I" "$COCCINELLE/basis" "-I" "$COCCINELLE/list_extensions" "-I" "$COCCINELLE/examples/cime_trace/") ***
- *** compile-command: "coqc -I $COCCINELLE/term_algebra -I $COCCINELLE/term_orderings -I $COCCINELLE/basis -I $COCCINELLE/list_extensions -I $COCCINELLE/examples/cime_trace/ -I $COCCINELLE/examples/ certificate.v" ***
- *** End: ***
- *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement