fact: Definition InvertedIndex_binsert (it : InvertedIndexMap) (item : TItem) : InvertedIndexMap := {| KeyMap := let (includedKeys, notIncludedKeys) := MKeysProperties.partition (fun key _ => if (InA_dec E.eq_dec key (projection item)) then true else false) (KeyMap it) in let oldKeys := map fst (MKeys.elements includedKeys) in let newKeys := List.filter (fun key : E.t => if InA_dec E.eq_dec key oldKeys then false else true) (projection item) in MKeysProperties.update (MKeysProperties.update notIncludedKeys (MKeys.map (cons (NumValues it)) includedKeys)) (fold_left (fun m k => MKeys.add k [NumValues it] m) newKeys (MKeys.empty _)); ValuesMap := MValues.add (NumValues it) item (ValuesMap it); NumValues := S (NumValues it) |}.
imports: Fiat.Common.Coq__8_4__8_5__Compat Fiat.QueryStructure.Implementation.DataStructures.Bags.BagsInterface Fiat.QueryStructure.Implementation.DataStructures.Bags.BagsProperties Coq.Arith.Peano_dec Coq.Structures.OrdersEx Coq.FSets.FMapInterface Coq.FSets.FMapFacts Coq.FSets.FMapAVL Coq.ZArith.ZArith Fiat.Common Fiat.Common.String_as_OT Fiat.Common.List.ListFacts Fiat.Common.List.FlattenList Fiat.Common.SetEqProperties Fiat.Common.FMapExtensions Fiat.Common.List.PermutationFacts Fiat.QueryStructure.Specification.SearchTerms.ListInclusion