fact
stringlengths
6
103k
type
stringclasses
14 values
library
stringclasses
13 values
imports
listlengths
1
10
filename
stringclasses
157 values
symbolic_name
stringlengths
1
54
docstring
stringclasses
185 values
use_SCC_all_hypsM i Hi Hj := let rec aux x := match x with | 0 => lia | S ?y => destruct i; [use_SCC_hyp M Hi | aux y] end in match type of Hj with | le _ ?Y => aux Y end.
Ltac
DP
[ "From Stdlib Require Import Permutation Multiset Setoid PermutSetoid", "From CoLoR Require Import SCCTopoOrdering AGraph ATrs RelUtil RelSub BoundNat" ]
DP/ASCCUnion.v
use_SCC_all_hyps
null
SCC_namen1 n2 := match goal with | |- WF (chain ?R) => set (n1 := dp R); set (n2 := int_red R #) | |- WF (hd_red_mod ?E ?R) => set (n1 := R); set (n2 := red E #) | |- WF (?X @ hd_red ?R) => set (n1 := R); set (n2 := X) | |- WF (hd_red_Mod ?E ?R) => set (n1 := R); set (n2 := E) end.
Ltac
DP
[ "From Stdlib Require Import Permutation Multiset Setoid PermutSetoid", "From CoLoR Require Import SCCTopoOrdering AGraph ATrs RelUtil RelSub BoundNat" ]
DP/ASCCUnion.v
SCC_name
null
filterp := hd_red_mod; apply WF_hd_red_mod_filter with (pi:=p).
Ltac
Filter
[ "From CoLoR Require Import ATrs VecFilter VecUtil LogicUtil RelUtil SN NatUtil", "From Stdlib Require Import List" ]
Filter/AFilterBool.v
filter
tactics
non_dup:= match goal with | |- non_dup (build_pi _ _) => rewrite <- bnon_dup_ok; check_eq | |- non_dup ?pi => unfold pi; non_dup end || fail 10 "duplicating arguments filter".
Ltac
Filter
[ "From CoLoR Require Import LogicUtil ATrs ListUtil NatUtil VecUtil SN BoolUtil" ]
Filter/AFilterPerm.v
non_dup
tactics
permut:= match goal with | |- permut (build_pi _ _) => rewrite <- bpermut_ok; check_eq | |- permut ?pi => unfold pi; permut end || fail 10 "non-permutative arguments filter". (*COQ: does not work... the recursive call on filter fails...
Ltac
Filter
[ "From CoLoR Require Import LogicUtil ATrs ListUtil NatUtil VecUtil SN BoolUtil" ]
Filter/AFilterPerm.v
permut
null
filterp := match goal with | |- WF (hd_red_Mod _ _) => hd_red_mod; filter p | |- WF (hd_red_mod _ _) => apply WF_hd_red_mod_filter with (pi:=p); [non_dup | idtac] end.*)
Ltac
Filter
[ "From CoLoR Require Import LogicUtil ATrs ListUtil NatUtil VecUtil SN BoolUtil" ]
Filter/AFilterPerm.v
filter
null
filterp := hd_red_mod; apply WF_hd_red_mod_filter with (pi:=p); [non_dup | idtac].
Ltac
Filter
[ "From CoLoR Require Import LogicUtil ATrs ListUtil NatUtil VecUtil SN BoolUtil" ]
Filter/AFilterPerm.v
filter
null
prove_cc_succtac := apply filter_strong_cont_closed; [non_dup | permut | tac].
Ltac
Filter
[ "From CoLoR Require Import LogicUtil ATrs ListUtil NatUtil VecUtil SN BoolUtil" ]
Filter/AFilterPerm.v
prove_cc_succ
null
valid:= forall f k, raw_pi f = Some k -> k < arity f.
Definition
Filter
[ "From CoLoR Require Import ATrs VecUtil LogicUtil ListUtil SN ARelation RelUtil" ]
Filter/AProj.v
valid
null
bvalid_symbf := match raw_pi f with | Some k => bgt_nat (arity f) k | None => true end.
Definition
Filter
[ "From CoLoR Require Import ATrs VecUtil LogicUtil ListUtil SN ARelation RelUtil" ]
Filter/AProj.v
bvalid_symb
null
bvalid:= forallb bvalid_symb Fs.
Definition
Filter
[ "From CoLoR Require Import ATrs VecUtil LogicUtil ListUtil SN ARelation RelUtil" ]
Filter/AProj.v
bvalid
null
bvalid_ok: bvalid = true <-> valid. Proof. unfold bvalid, valid. apply forallb_ok_fintype. 2: hyp. intro f. unfold bvalid_symb. destruct (raw_pi f). rewrite bgt_nat_ok. intuition. inversion H1. subst. auto. intuition. discr. Qed.
Lemma
Filter
[ "From CoLoR Require Import ATrs VecUtil LogicUtil ListUtil SN ARelation RelUtil" ]
Filter/AProj.v
bvalid_ok
null
projp := hd_red_mod; apply WF_hd_red_mod_proj with (pi:=p).
Ltac
Filter
[ "From CoLoR Require Import ATrs VecUtil LogicUtil ListUtil SN ARelation RelUtil" ]
Filter/AProj.v
proj
tactics
validFs_ok := match goal with | |- valid ?p => rewrite <- (@bvalid_ok _ p _ Fs_ok); (check_eq || fail 10 "invalid projection") end.
Ltac
Filter
[ "From CoLoR Require Import ATrs VecUtil LogicUtil ListUtil SN ARelation RelUtil" ]
Filter/AProj.v
valid
null
matrixInt:= @matrixInt A matrix.
Definition
MatrixInt
[ "From Stdlib Require Import ZArith Lia", "From CoLoR Require Import LogicUtil Matrix AMonAlg AArcticBasedInt VecUtil" ]
MatrixInt/AArcticBZInt.v
matrixInt
null
mkMatrixInt:= @mkMatrixInt A matrix.
Definition
MatrixInt
[ "From Stdlib Require Import ZArith Lia", "From CoLoR Require Import LogicUtil Matrix AMonAlg AArcticBasedInt VecUtil" ]
MatrixInt/AArcticBZInt.v
mkMatrixInt
null
absolute_finiteFs_ok := apply (fin_absolute_finite _ _ Fs_ok); (check_eq || fail 10 "invalid below-zero arctic interpretation").
Ltac
MatrixInt
[ "From Stdlib Require Import ZArith Lia", "From CoLoR Require Import LogicUtil Matrix AMonAlg AArcticBasedInt VecUtil" ]
MatrixInt/AArcticBZInt.v
absolute_finite
null
matrixInt:= @matrixInt A matrix.
Definition
MatrixInt
[ "From CoLoR Require Import AArcticBasedInt Matrix OrdSemiRing VecUtil AMonAlg SN" ]
MatrixInt/AArcticInt.v
matrixInt
null
mkMatrixInt:= @mkMatrixInt A matrix.
Definition
MatrixInt
[ "From CoLoR Require Import AArcticBasedInt Matrix OrdSemiRing VecUtil AMonAlg SN" ]
MatrixInt/AArcticInt.v
mkMatrixInt
null
somewhere_finiteFs_ok := apply (fin_somewhere_finite _ _ Fs_ok); (check_eq || fail 10 "invalid arctic interpretation").
Ltac
MatrixInt
[ "From CoLoR Require Import AArcticBasedInt Matrix OrdSemiRing VecUtil AMonAlg SN" ]
MatrixInt/AArcticInt.v
somewhere_finite
null
matrixInt:= @matrixInt A matrix.
Definition
MatrixInt
[ "From Stdlib Require Import Setoid", "From CoLoR Require Import LogicUtil Matrix OrdSemiRing VecUtil AMonAlg" ]
MatrixInt/ABigMatrixInt.v
matrixInt
null
mkMatrixInt:= @mkMatrixInt A matrix.
Definition
MatrixInt
[ "From Stdlib Require Import Setoid", "From CoLoR Require Import LogicUtil Matrix OrdSemiRing VecUtil AMonAlg" ]
MatrixInt/ABigMatrixInt.v
mkMatrixInt
null
matrixInt:= @matrixInt A matrix.
Definition
MatrixInt
[ "From Stdlib Require Import Setoid", "From CoLoR Require Import LogicUtil Matrix OrdSemiRing VecUtil AMonAlg SN" ]
MatrixInt/AMatrixInt.v
matrixInt
null
mkMatrixInt:= @mkMatrixInt A matrix.
Definition
MatrixInt
[ "From Stdlib Require Import Setoid", "From CoLoR Require Import LogicUtil Matrix OrdSemiRing VecUtil AMonAlg SN" ]
MatrixInt/AMatrixInt.v
mkMatrixInt
null
matrixInt:= @matrixInt A matrix.
Definition
MatrixInt
[ "From CoLoR Require Import ATropicalBasedInt Matrix OrdSemiRing VecUtil AMonAlg", "From Stdlib Require Import Structures.Equalities" ]
MatrixInt/ATropicalInt.v
matrixInt
null
mkMatrixInt:= @mkMatrixInt A matrix.
Definition
MatrixInt
[ "From CoLoR Require Import ATropicalBasedInt Matrix OrdSemiRing VecUtil AMonAlg", "From Stdlib Require Import Structures.Equalities" ]
MatrixInt/ATropicalInt.v
mkMatrixInt
null
somewhere_tfiniteFs_ok := apply (fin_somewhere_tfinite _ _ Fs_ok); (check_eq || fail 10 "invalid tropical interpretation").
Ltac
MatrixInt
[ "From CoLoR Require Import ATropicalBasedInt Matrix OrdSemiRing VecUtil AMonAlg", "From Stdlib Require Import Structures.Equalities" ]
MatrixInt/ATropicalInt.v
somewhere_tfinite
null
check_loopt' ds' p' := apply is_loop_correct with (t:=t') (ds:=ds') (p:=p'); (check_eq || fail 10 "not a loop").
Ltac
NonTermin
[ "From Stdlib Require Import Euclid Wf_nat", "From CoLoR Require Import LogicUtil ATrs ListUtil RelUtil AMatching ListDec" ]
NonTermin/ALoop.v
check_loop
tactics
loopt' ds' p' := match goal with | |- EIS (red_mod ?E _) => remove_relative_rules E; check_loop t' ds' p' | |- EIS (red _) => check_loop t' ds' p' end.
Ltac
NonTermin
[ "From Stdlib Require Import Euclid Wf_nat", "From CoLoR Require Import LogicUtil ATrs ListUtil RelUtil AMatching ListDec" ]
NonTermin/ALoop.v
loop
null
loopt' mds' ds' p' := apply is_mod_loop_correct with (t:=t') (mds:=mds') (ds:=ds') (p:=p'); (check_eq || fail 10 "not a loop").
Ltac
NonTermin
[ "From Stdlib Require Import Euclid Wf_nat", "From CoLoR Require Import ATrs LogicUtil ALoop ListUtil RelUtil NatUtil" ]
NonTermin/AModLoop.v
loop
tactics
var_condSig := (apply var_cond_mod || apply var_cond); rewrite <- (ko (@brules_preserve_vars_ok Sig)); (check_eq || fail 10 "variable condition satisfied").
Ltac
NonTermin
[ "From CoLoR Require Import LogicUtil ATrs AVariables BoolUtil EqUtil ListUtil RelUtil" ]
NonTermin/AVarCond.v
var_cond
null
check_loopt' ds' p' := apply is_loop_correct with (t:=t') (ds:=ds') (p:=p'); (check_eq || fail 10 "not a loop").
Ltac
NonTermin
[ "From Stdlib Require Import Euclid Wf_nat", "From CoLoR Require Import LogicUtil Srs ListUtil EqUtil RelUtil ListDec NatUtil" ]
NonTermin/SLoop.v
check_loop
tactics
loopt' ds' p' := match goal with | |- EIS (red_mod ?E _) => remove_relative_rules E; check_loop t' ds' p' | |- EIS (red _) => check_loop t' ds' p' end.
Ltac
NonTermin
[ "From Stdlib Require Import Euclid Wf_nat", "From CoLoR Require Import LogicUtil Srs ListUtil EqUtil RelUtil ListDec NatUtil" ]
NonTermin/SLoop.v
loop
null
loopt' mds' ds' p' := apply is_mod_loop_correct with (t:=t') (mds:=mds') (ds:=ds') (p:=p'); (check_eq || fail 10 "not a loop").
Ltac
NonTermin
[ "From Stdlib Require Import Euclid Wf_nat", "From CoLoR Require Import Srs LogicUtil SLoop ListUtil NatUtil RelUtil" ]
NonTermin/SModLoop.v
loop
tactics
PolyWeakMonotoneFs_ok := match goal with | |- PolyWeakMonotone ?PI => apply (fin_PolyWeakMonotone PI Fs_ok); (check_eq || fail 10 "could not prove monotony") end.
Ltac
PolyInt
[ "From CoLoR Require Import ATerm ABterm ListUtil VecUtil" ]
PolyInt/APolyInt.v
PolyWeakMonotone
tactics
Definitioncheck_mono (n : nat) (m : monomial) : option (Z * monom n) := match m with | (coef, vars) => match eq_nat_dec n (List.length vars) with | left _ => Some (coef, vec_of_list vars) | right _ => None end end.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
check_poly(n : nat) (p : polynomial) : option (poly n) := map_opt (@check_mono n) p.
Definition
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
check_poly
null
polyIntn := { p : poly n | pweak_monotone p }. Notation symPI := (symInt Sig polyInt).
Definition
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
polyInt
null
Definitionsymbol_poly_int (f : Sig) (p : polynomial) : option symPI := match check_poly (arity f) p with | None => None | Some fi => match pweak_monotone_check fi with | None => None | Some _ => Some (buildSymInt Sig polyInt f fi) end end.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
defaultPolyn : poly n := pconst n 1 ++ list_of_vec (Vbuild (fun i (ip : i < n) => (1%Z, mxi ip))).
Definition
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
defaultPoly
null
defaultPoly_mxi_1n i (H : i < n) : List.In (1%Z, mxi H) (defaultPoly n). Proof. intros. right. simpl. apply list_of_vec_in. rewrite <- (Vbuild_nth (fun i (ip : i < n) => (1%Z, mxi ip)) H). apply Vnth_in. Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
defaultPoly_mxi_1
null
defaultPoly_wmn : pweak_monotone (defaultPoly n). Proof with simpl; auto with zarith. intros. split... apply lforall_intro. intros. ded (in_list_of_vec H). ded (Vbuild_in (fun i ip => (1%Z, mxi ip)) x H0). decomp H1. subst... Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
defaultPoly_wm
null
defaultPoly_smn : pstrong_monotone (defaultPoly n). Proof. split. apply defaultPoly_wm. intros. assert (HH : List.In (1%Z, mxi H) (defaultPoly n)). apply defaultPoly_mxi_1. set (w := coefPos_geC (defaultPoly n) (mxi H) 1 (defaultPoly_wm n) HH). auto with zarith. Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
defaultPoly_sm
null
DefinitiondefaultInt n : polyInt n := defaultPoly n. Next Obligation. Proof. set (w := defaultPoly_wm). simpl in w. apply w. Qed.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
Definitioninterpret n (fi : polyInt n) : naryFunction1 D n := @peval_D n fi _. Next Obligation. Proof. destruct fi. hyp. Qed.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
Definitionpoly_wm (fi : symPI) := True.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
weak and strong monotonicity checking
Definitionpoly_sm (fi : symPI) := pstrong_monotone (projT2 fi).
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
sm_imp_wm(fi : symPI) : poly_sm fi -> poly_wm fi. Proof. fo. Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
sm_imp_wm
null
Definitioncheck_wm (fi : symPI) : option (poly_wm fi) := Some _. Next Obligation. Proof. fo. Qed.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
wm_ok: forall fi, poly_wm fi -> Vmonotone1 (interpret (projT2 fi)) Dge. Proof. intros. apply Vmonotone_transp. apply coef_pos_monotone_peval_Dle. Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
wm_ok
null
Definitioncheck_sm (fi : symPI) : option (poly_sm fi) := pstrong_monotone_check (projT2 fi).
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
sm_ok: forall fi, poly_sm fi -> Vmonotone1 (interpret (projT2 fi)) Dgt. Proof. intros. apply Vmonotone_transp. apply pmonotone_imp_monotone_peval_Dlt. hyp. Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
sm_ok
null
buildSymInt:= buildSymInt Sig polyInt.
Let
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
buildSymInt
null
defaultIntForSymbol:= defaultIntForSymbol Sig polyInt defaultInt.
Let
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
defaultIntForSymbol
null
default_sm: forall f, poly_sm (buildSymInt (defaultIntForSymbol f)). Proof. intros. apply defaultPoly_sm. Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
default_sm
null
wm_spec:= Build_monSpec interpret poly_wm check_wm wm_ok.
Definition
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
wm_spec
null
sm_spec:= Build_monSpec interpret poly_sm check_sm sm_ok.
Definition
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
sm_spec
null
I:= makeI Sig D0 polyInt interpret i.
Definition
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
I
null
succ:= IR I Dgt.
Let
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
succ
null
succeq:= IR I Dge.
Let
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
succeq
null
Definitioncheck_succ (r : rule Sig) : option (succ (lhs r) (rhs r)) := match coef_pos_check (rulePoly_gt i r) with | None => None | Some _ => Some _ end. Next Obligation. Proof with try discr; auto. destruct_call coef_pos_check... apply pi_compat_rule... Qed.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
Definitioncheck_succeq (r : rule Sig) : option (succeq (lhs r) (rhs r)) := match coef_pos_check (rulePoly_ge i r) with | None => None | Some _ => Some _ end. Next Obligation. Proof with try discr; auto. destruct_call coef_pos_check... apply pi_compat_rule_weak... Qed.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
succ_WF:= WF_Dgt.
Definition
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
succ_WF
null
succ_succeq_compat: absorbs_left Dgt Dge. Proof. intros p q pq. destruct pq as [r [pr rq]]. unfold Dgt, Dlt, transp. apply Z.lt_le_trans with (val r); auto. Qed.
Lemma
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
succ_succeq_compat
null
DefinitionpolySolver := monotoneAlgebraSolver succ_WF succ_succeq_compat defaultInt check_succ check_succeq wm_spec sm_spec sm_imp_wm default_sm int symbol_poly_int.
Program
PolyInt
[ "From Stdlib Require Import Program", "From CoLoR Require Import ListUtil LogicUtil ZUtil VecUtil Problem" ]
PolyInt/PolyChecker.v
Definition
null
rawTrsInt:= trsInt Sig rawSymInt. Variable arSymInt : nat -> Set. Variable defaultInt : forall n, arSymInt n.
Definition
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
rawTrsInt
null
funInt(f : Sig) := arSymInt (arity f).
Definition
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
funInt
null
symInt:= { f : Sig & funInt f }.
Definition
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
symInt
null
defaultIntForSymbolf := @defaultInt (@arity Sig f).
Definition
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
defaultIntForSymbol
null
buildSymIntf (fi : funInt f) : symInt := existT fi. Variable checkInt : Sig -> rawSymInt -> option symInt.
Definition
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
buildSymInt
null
processInt(ri : rawTrsInt) : option (list symInt) := match ri with | nil => Some nil | cons i is => match checkInt (fst i) (snd i) with | None => None | Some fi => match processInt is with | None => None | Some fis => Some (fi :: fis) end end end.
Fixpoint
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
processInt
null
buildInt(i : list symInt) : forall f, funInt f := fun f => lookup_dep (el := f) (@eq_symb_dec Sig) defaultIntForSymbol i. Variable P : symInt -> Prop. Variable check_P : forall (i : symInt), option (P i). Variable default_P : forall f, P (buildSymInt (defaultIntForSymbol f)).
Definition
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
buildInt
null
FixpointcheckProp (i : list symInt) : option (forall f, P (buildSymInt (buildInt i f))) := match lforall_opt P check_P i with | None => None | Some _ => Some _ end. Next Obligation. apply (lookup_dep_prop (P := fun _ fi => P (buildSymInt fi))); intros. destruct_call lforall_opt; try discr. ded (lforall_in l H). decomp H0. destruct x. hyp. apply default_P. Qed.
Program
ProofChecker
[ "From Stdlib Require Import Program", "From CoLoR Require Import LogicUtil OptUtil ATrs NaryFunction" ]
ProofChecker/IntBasedChecker.v
Fixpoint
null
trsIntsymInt := list (Sig * symInt). (** [monomial] is a monomial in representation of a polynomial. A monomial [C * x_0^i_0 * ... * x_n^i_n] is represented as: [(C, i_0::...::i_n)]. *)
Definition
ProofChecker
[ "From Stdlib Require Import ZArith List", "From CoLoR Require Import ASignature" ]
ProofChecker/Proof.v
trsInt
null
monomial:= (Z * list nat)%type. (** [polynomial] is a list of monomials so [m_0 + ... + m_n] becomes [m_0::...::m_n]. *)
Definition
ProofChecker
[ "From Stdlib Require Import ZArith List", "From CoLoR Require Import ASignature" ]
ProofChecker/Proof.v
monomial
null
polynomial:= list monomial.
Definition
ProofChecker
[ "From Stdlib Require Import ZArith List", "From CoLoR Require Import ASignature" ]
ProofChecker/Proof.v
polynomial
null
TerminationProof:= | TP_PolyInt (PI: trsInt polynomial) (Prf : TerminationProof) | TP_ProblemEmpty.
Inductive
ProofChecker
[ "From Stdlib Require Import ZArith List", "From CoLoR Require Import ASignature" ]
ProofChecker/Proof.v
TerminationProof
null
TerminationAnalysisResult(P : Problem Sig) := | TerminationEstablished (Prf : Prob_WF P) | Error. Arguments TerminationEstablished [P] _. Arguments Error {P}.
Inductive
ProofChecker
[ "From Stdlib Require Import Relations List", "From CoLoR Require Import SN ATrs ARelation Problem Proof EmptyChecker" ]
ProofChecker/ProofChecker.v
TerminationAnalysisResult
null
Fixpointcheck_proof (Pb : Problem Sig) (Prf : TerminationProof Sig) : TerminationAnalysisResult Pb := match Prf with | TP_PolyInt PI Prf' => match PolyChecker.polySolver PI Pb with | None => Error | Some Pb' => match check_proof Pb' Prf' with | Error => Error | TerminationEstablished _ => TerminationEstablished _ end end | TP_ProblemEmpty _ => match EmptyChecker.is_problem_empty Pb with | true => TerminationEstablished _ | _ => Error end end. Next Obligation. Proof. auto with rainbow. Qed.
Program
ProofChecker
[ "From Stdlib Require Import Relations List", "From CoLoR Require Import SN ATrs ARelation Problem Proof EmptyChecker" ]
ProofChecker/ProofChecker.v
Fixpoint
null
status_name: Set := | lexicographic : status_name | multiset : status_name.
Inductive
RPO
[ "From CoLoR Require Import VPrecedence MultisetListOrder ListLex VRPO_Type", "From Stdlib Require Import Relations" ]
RPO/VRPO_Status.v
status_name
null
enum_tuple2n : list (vector I n) := match n with | 0 => nil | S p => fold_left (fun e ds => fold_left (fun e d => Vcons d ds :: e) Is e) (enum_tuple2 p) nil end.*) Definition enum R := flat_map (fun ds => map (lab_rule (val_of_vec I ds)) R) (enum_tuple (S (maxvar_rules R))). Lemma enum_correct : forall R a, In a (enum R) -> lab_rules (of_list R) a. Proof. intros. unfold enum in H. rewrite in_flat_map in H. do 2 destruct H. rewrite in_map_iff in H0. do 2 destruct H0. exists x0. exists (val_of_vec I x). intuition. Qed. Lemma enum_complete : forall R a, lab_rules (of_list R) a -> In a (enum R). Proof. intros. do 3 destruct H. set (n := maxvar_rules R). unfold enum. rewrite in_flat_map. exists (vec_of_val x0 (S n)). split. apply enum_tuple_complete. subst. change (In (lab_rule x0 x) (map (lab_rule (fval x0 (S n))) R)). rewrite map_lab_rule_fval. apply in_map. hyp. unfold n. lia. Qed. Infix "[=]" := equiv. Lemma lab_rules_enum : forall R, lab_rules (of_list R) [=] of_list (enum R). Proof. split. apply enum_complete. apply enum_correct. Qed. (*REMARK: define a more efficient function?
Fixpoint
SemLab
[ "From CoLoR Require Import ATrs AInterpretation BoolUtil LogicUtil EqUtil", "From Stdlib Require Import List" ]
SemLab/ASemLab.v
enum_tuple2
null
enum2R := let n := S (maxvar_rules R) in fold_left (fun e ds => let v := val_of_vec I ds in fold_left (fun e (a : rule) => let (l,r) := a in mkRule (lab v l) (lab v r) :: e) R e) (enum_tuple n) nil.*) Variable Fs : list Sig. Variable Fs_ok : forall x, In x Fs. Variable Ls : forall f, list (L f). Variable Ls_ok : forall f (x : L f), In x (Ls f). Definition Fs_lab := flat_map (fun f => map (@mk f) (Ls f)) Fs. Lemma Fs_lab_ok : forall f : Sig', In f Fs_lab. Proof. intros [f l]. unfold Fs_lab. rewrite in_flat_map. exists f. split. apply Fs_ok. rewrite in_map_iff. exists l. intuition. Qed. Variable L2s : forall f, list (L f * L f). Variable L2s_ok : forall f (x y : L f), x >L y <-> In (x,y) (L2s f). Definition enum_Decr := flat_map (fun f => map (fun x : L f * L f => let (a,b) := x in decr a b) (L2s f)) Fs. Notation D' := enum_Decr. Lemma enum_Decr_correct : forall x, In x D' -> Decr x. Proof. intros. unfold enum_Decr in H. rewrite in_flat_map in H. destruct H as [f]. destruct H. rewrite in_map_iff in H0. destruct H0 as [[a b]]. destruct H0. exists f. exists a. exists b. rewrite L2s_ok. auto. Qed. Lemma enum_Decr_complete : forall x, Decr x -> In x D'. Proof. intros. destruct H as [f [a [b [h]]]]. unfold enum_Decr. rewrite in_flat_map. exists f. split. apply Fs_ok. rewrite in_map_iff. exists (a,b). rewrite <- L2s_ok. auto. Qed. Lemma Rules_enum_Decr : of_list D' [=] Decr. Proof. unfold equiv. split; intro. apply enum_Decr_correct. hyp. apply enum_Decr_complete. hyp. Qed. Import ATrs List. Notation rules := (rules Sig). Notation term := S.term. Variable bge : term -> term -> bool. Variable bge_ok : rel_of_bool bge << Ige. Section bge. Variable R : rules. Variable bge_compat : forallb (brule bge) R = true. Lemma ge_compat : forall l r, In (mkRule l r) R -> l >=I r. Proof. intros. apply bge_ok. unfold rel. change (brule bge (mkRule l r) = true). rewrite forallb_forall in bge_compat. apply bge_compat. hyp. Qed. End bge. Arguments ge_compat [R] _ _ _ _ _. Section red_mod. Variables E R : rules. Notation E' := (enum E). Notation R' := (enum R). Variable bge_compatE : forallb (brule bge) E = true. Variable bge_compatR : forallb (brule bge) R = true. Notation ge_compatE := (ge_compat bge_compatE). Notation ge_compatR := (ge_compat bge_compatR). Lemma WF_red_lab_fin : WF (red R) <-> WF (red_mod D' R'). Proof. rewrite <- red_Rules, <- red_mod_Rules, WF_red_lab. 2: apply ge_compatR. apply WF_same. rewrite Rules_enum_Decr, lab_rules_enum. refl. Qed. Import List. Lemma WF_red_mod_lab_fin : WF (red_mod E R) <-> WF (red_mod (D' ++ E') R'). Proof. rewrite <- !red_mod_Rules, WF_red_mod_lab. 2: apply ge_compatE. 2: apply ge_compatR. apply WF_same. rewrite of_app, Rules_enum_Decr, !lab_rules_enum. refl. Qed. Lemma WF_hd_red_mod_lab_fin : WF (hd_red_mod E R) <-> WF (hd_red_mod (D' ++ E') R'). Proof. rewrite <- !hd_red_mod_Rules, WF_hd_red_mod_lab. 2: apply ge_compatE. apply WF_same. rewrite of_app, Rules_enum_Decr, !lab_rules_enum. refl. Qed. End red_mod. Lemma WF_red_unlab_fin : forall R, WF (red (unlab_rules_fin R)) -> WF (red R). Proof. intros. apply Fred_WF_fin with (S2:=Sig) (F:=F) (HF:=HF). hyp. Qed. Lemma WF_red_mod_unlab_fin : forall E R, WF (red_mod (unlab_rules_fin E) (unlab_rules_fin R)) -> WF (red_mod E R). Proof. intros. apply Fred_mod_WF_fin with (S2:=Sig) (F:=F) (HF:=HF). hyp. Qed. Lemma WF_hd_red_mod_unlab_fin : forall E R, WF (hd_red_mod (unlab_rules_fin E) (unlab_rules_fin R)) -> WF (hd_red_mod E R). Proof. intros. apply Fhd_red_mod_WF_fin with (S2:=Sig) (F:=F) (HF:=HF). hyp. Qed. End enum.
Definition
SemLab
[ "From CoLoR Require Import ATrs AInterpretation BoolUtil LogicUtil EqUtil", "From Stdlib Require Import List" ]
SemLab/ASemLab.v
enum2
null
validFs_ok := rewrite <- (bvalid_ok _ Fs_ok); (check_eq || fail 10 "invalid simple projection").
Ltac
SubtermCrit
[ "From CoLoR Require Import ATrs NatUtil BoolUtil VecUtil ListUtil LogicUtil" ]
SubtermCrit/ASimpleProj.v
valid
null
ac_one_step_at_top: term -> term -> Prop := | a_axiom : forall (f:symbol) (t1 t2 t3:term), arity f = AC -> ac_one_step_at_top (Term f ((Term f (t1 :: t2 :: nil)) :: t3 :: nil)) (Term f (t1 :: ((Term f (t2 :: t3 :: nil)) :: nil))) | c_axiom : forall (f:symbol) (t1 t2:term), arity f = C \/ arity f = AC -> ac_one_step_at_top (Term f (t1 :: t2 :: nil)) (Term f (t2 :: t1 :: nil)). #[global] Hint Constructors ac_one_step_at_top : core.
Inductive
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
ac_one_step_at_top
null
ac:= th_eq ac_one_step_at_top.
Definition
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
ac
null
flatten(f : symbol) (l : list term) : list term := match l with | nil => nil | (Var _ as t) :: tl => t :: (flatten f tl) | (Term g ll as t) :: tl => if F.Symb.eq_bool f g then ll ++ (flatten f tl) else t :: (flatten f tl) end.
Fixpoint
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
flatten
null
canonical_form(t : term) : term := match t with | Var _ => t | Term f l => Term f (match arity f with | Free _ => map canonical_form l | C => quicksort (map canonical_form l) | AC => quicksort (flatten f (map canonical_form l)) end) end. Fixpoint well_formed_cf (t:term) : Prop := match t with | Var _ => True | Term f l => let wf_cf_list := (fix wf_cf_list (l:list term) : Prop := match l with | nil => True | h :: tl => well_formed_cf h /\ wf_cf_list tl end) in wf_cf_list l /\ (match arity f with | Free n => length l = n | C => length l = 2 /\ is_sorted l | AC => length l >= 2 /\ is_sorted l /\ (forall s, In s l -> match s with | Var _ => True | Term g _ => f<>g end) end) end.
Fixpoint
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
canonical_form
null
build(f : symbol) l := match l with | t :: nil => t | _ => Term f (quicksort l) end.
Definition
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
build
null
well_formed_cf_substsigma := forall v, match find X.eq_bool v sigma with | None => True | Some t => well_formed_cf t end. Fixpoint apply_cf_subst (sigma : substitution) (t : term) {struct t} : term := match t with | Var v => match find X.eq_bool v sigma with | None => t | Some v_sigma => v_sigma end | Term f l => let l_sigma := match arity f with | AC => quicksort (flatten f (map (apply_cf_subst sigma) l)) | C => quicksort (map (apply_cf_subst sigma) l) | Free _ => map (apply_cf_subst sigma) l end in Term f l_sigma end. Fixpoint ac_size (t:term) : nat := match t with | Var v => 1 | Term f l => let ac_size_list := (fix ac_size_list (l : list term) {struct l} : nat := match l with | nil => 0 | t :: lt => ac_size t + ac_size_list lt end) in (match arity f with | AC => (length l) - 1 | C => 1 | Free _ => 1 end) + ac_size_list l end. Parameter l_assoc : forall f t1 t2 t3, arity f = AC -> ac (Term f (Term f (t1 :: t2 :: nil) :: t3 :: nil)) (Term f (t1 :: (Term f (t2 :: t3 :: nil)) :: nil)).
Definition
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
well_formed_cf_subst
null
r_assoc: forall f t1 t2 t3, arity f = AC -> ac (Term f (t1 :: (Term f (t2 :: t3 :: nil)) :: nil)) (Term f (Term f (t1 :: t2 :: nil) :: t3 :: nil)).
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
r_assoc
null
comm: forall f t1 t2, arity f = C \/ arity f = AC -> ac (Term f (t1 :: t2 :: nil)) (Term f (t2 :: t1 :: nil)).
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
comm
null
ac_top_eq: forall t1 t2, ac t1 t2 -> match t1, t2 with | Var x1, Var x2 => x1 = x2 | Term _ _, Var _ => False | Var _, Term _ _ => False | Term f1 _, Term f2 _ => f1 = f2 end.
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
ac_top_eq
null
well_formed_cf_unfold: forall t, well_formed_cf t -> match t with | Var _ => True | Term f l => (forall u, In u l -> well_formed_cf u) /\ (match arity f with | AC => length l >= 2 /\ is_sorted l /\ (forall u, In u l -> match u with | Var _ => True | Term g _ => f <> g end) | C => length l = 2 /\ is_sorted l | Free n => length l = n end) end.
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
well_formed_cf_unfold
null
well_formed_cf_subterms: forall f l, well_formed_cf (Term f l) -> (forall t, In t l -> well_formed_cf t).
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
well_formed_cf_subterms
null
well_formed_cf_length: forall f l, arity f = AC -> well_formed_cf (Term f l) -> 2 <= length l.
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
well_formed_cf_length
null
well_formed_cf_sorted: forall f l, arity f = AC -> well_formed_cf (Term f l) -> is_sorted l.
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
well_formed_cf_sorted
null
well_formed_cf_alien: forall f l, arity f = AC -> well_formed_cf (Term f l) -> (forall t, In t l -> match t with | Var _ => True | Term g _ => f <> g end). Parameter flatten_app : forall f l1 l2, flatten f (l1 ++ l2) = (flatten f l1) ++ (flatten f l2).
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
well_formed_cf_alien
null
list_permut_flatten: forall f l1 l2, permut l1 l2 -> permut (flatten f l1) (flatten f l2).
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
list_permut_flatten
null
length_flatten_bis: forall f, arity f = AC -> forall l, (forall t, In t l -> well_formed_cf t) -> (length l) <= length (flatten f l).
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
length_flatten_bis
null
flatten_cf: forall f t1 t2, arity f = AC -> well_formed_cf t1 -> well_formed_cf t2 -> permut (flatten f (t1 :: nil)) (flatten f (t2 :: nil)) -> t1 = t2. Parameter flatten_cf_cf : forall f t1 t2, arity f = AC -> well_formed t1 -> well_formed t2 -> permut (flatten f (canonical_form t1 :: nil)) (flatten f (canonical_form t2 :: nil)) -> canonical_form t1 = canonical_form t2.
Parameter
Coccinelle
[ "From Stdlib Require Import Relations List Arith Morphisms", "From CoLoR Require Import more_list list_permut list_sort term_spec term_o equational_theory_spec equational_theory" ]
Coccinelle/ac_matching/ac.v
flatten_cf
null