proposition: Lemma lagrange_poly_part_correct {R: fieldType} (x y: R) l m r: uniq (unzip1 (l ++ (m :: r))) -> (x, y) \in m :: r -> (\sum_(j <- subseqs_rec l m r) lagrange_poly_part j).[x] = y.
proof: Proof. elim: r l m => [|m' r IHr] l [x0 y0] Huniq Hin. 1: { rewrite big_seq1 hornerZ. rewrite mem_seq1 in Hin. move /eqP in Hin. case: Hin => -> ->. rewrite /unzip1 map_cat uniq_catC -/unzip1 /= in Huniq. move: Huniq => /andP [Hnotin Huniq]. rewrite lagrange_basis_1 in Hnotin. move /eqP in Hnotin. by rewrite Hnotin GRing.mulr1. } rewrite /= big_cons hornerD hornerZ. rewrite in_cons in Hin. move: Hin => /orP [/eqP Heq|Hin]. 1: { case: Heq => -> ->. rewrite lagrange_poly_part_0 ?GRing.addr0 //. 2: by rewrite -catA cat_cons. 2: by rewrite /unzip1 map_cat mem_cat Bool.orb_comm mem_seq1 eq_refl. rewrite /unzip1 map_cat uniq_catC -map_cat cat_cons -/unzip1 in Huniq. apply (uniq_unzip1_in (x0, y0)) in Huniq. rewrite /unzip1 map_cat mem_cat Bool.orb_comm -mem_cat -map_cat -/unzip1 in Huniq. rewrite lagrange_basis_1 /= in Huniq. move /eqP in Huniq. by rewrite Huniq GRing.mulr1. } rewrite IHr //. 2: by rewrite -catA cat_cons. rewrite lagrange_basis_0 ?GRing.mulr0 ?GRing.add0r //. apply (map_f fst) in Hin. by rewrite /unzip1 map_cat mem_cat Bool.orb_comm Hin. Qed.
imports: Relational(OrderEnrichedCategory GenericRulesSimple) mathcomp(all_ssreflect all_algebra reals distr realsum ssrnat ssreflect ssrfun ssrbool ssrnum eqtype choice seq) Mon(SPropBase) Crypt(Axioms ChoiceAsOrd SubDistr Couplings UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb pkg_core_definition choice_type pkg_composition pkg_rhl Package Prelude) extructures(ord fset fmap) Equations(Equations)