Require Import ADuplicateSymb. Require Import AGraph. Require Import APolyInt_MA. Require Import ATrs. Require Import List. Require Import LogicUtil. Require Import MonotonePolynom. Require Import Polynom. Require Import SN. Require Import VecUtil. Open Scope nat_scope. (* termination problem *) Module M. Inductive symb : Type := | and : symb | not : symb | or : symb. End M. Lemma eq_symb_dec : forall f g : M.symb, {f=g}+{~f=g}. Proof. decide equality. Defined. Open Scope nat_scope. Definition ar (s : M.symb) : nat := match s with | M.and => 2 | M.not => 1 | M.or => 2 end. Definition s0 := ASignature.mkSignature ar eq_symb_dec. Definition s0_p := s0. Definition V0 := @ATerm.Var s0. Definition F0 := @ATerm.Fun s0. Definition R0 := @ATrs.mkRule s0. Module S0. Definition and x2 x1 := F0 M.and (Vcons x2 (Vcons x1 Vnil)). Definition not x1 := F0 M.not (Vcons x1 Vnil). Definition or x2 x1 := F0 M.or (Vcons x2 (Vcons x1 Vnil)). End S0. Definition E := @nil (@ATrs.rule s0). Definition R := R0 (S0.not (S0.not (V0 0))) (V0 0) :: R0 (S0.not (S0.or (V0 0) (V0 1))) (S0.and (S0.not (S0.not (S0.not (V0 0)))) (S0.not (S0.not (S0.not (V0 1))))) :: R0 (S0.not (S0.and (V0 0) (V0 1))) (S0.or (S0.not (S0.not (S0.not (V0 0)))) (S0.not (S0.not (S0.not (V0 1))))) :: @nil (@ATrs.rule s0). Definition rel := ATrs.red_mod E R. (* symbol marking *) Definition s1 := dup_sig s0. Definition s1_p := s0. Definition V1 := @ATerm.Var s1. Definition F1 := @ATerm.Fun s1. Definition R1 := @ATrs.mkRule s1. Module S1. Definition hand x2 x1 := F1 (hd_symb s1_p M.and) (Vcons x2 (Vcons x1 Vnil)). Definition and x2 x1 := F1 (int_symb s1_p M.and) (Vcons x2 (Vcons x1 Vnil)). Definition hnot x1 := F1 (hd_symb s1_p M.not) (Vcons x1 Vnil). Definition not x1 := F1 (int_symb s1_p M.not) (Vcons x1 Vnil). Definition hor x2 x1 := F1 (hd_symb s1_p M.or) (Vcons x2 (Vcons x1 Vnil)). Definition or x2 x1 := F1 (int_symb s1_p M.or) (Vcons x2 (Vcons x1 Vnil)). End S1. (* polynomial interpretation 1 *) Module PIS1 (*<: TPolyInt*). Definition sig := s1. Definition trsInt f := match f as f return poly (@ASignature.arity s1 f) with | (hd_symb M.not) => (1%Z, (Vcons 1 Vnil)) :: nil | (int_symb M.not) => (1%Z, (Vcons 1 Vnil)) :: nil | (hd_symb M.or) => nil | (int_symb M.or) => (1%Z, (Vcons 0 (Vcons 0 Vnil))) :: (1%Z, (Vcons 1 (Vcons 0 Vnil))) :: (1%Z, (Vcons 0 (Vcons 1 Vnil))) :: nil | (hd_symb M.and) => nil | (int_symb M.and) => (1%Z, (Vcons 0 (Vcons 0 Vnil))) :: (1%Z, (Vcons 1 (Vcons 0 Vnil))) :: (1%Z, (Vcons 0 (Vcons 1 Vnil))) :: nil end. Lemma trsInt_wm : forall f, pweak_monotone (trsInt f). Proof. pmonotone. Qed. End PIS1. Module PI1 := PolyInt PIS1. (* termination proof *) Lemma termination : WF rel. Proof. unfold rel. dp_trans. mark. PI1.prove_termination. termination_trivial. Qed.