Split a list at an entry: by position, in a filtered image, and against the fold before it

未关闭
#397 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
44/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
领域
backend

调研方向

Start in Probability.List, then read the related issue #369 and the core lemmas filterMap_eq_append_iff and filterMap_eq_cons_iff. Add the requested split, prefix, and ForallScan lemmas, using the acceptance examples to check them. Done means all four list examples in the acceptance criteria can be proved.

由索引模型根据 Issue 内容生成。

描述

Background

Predicates on transcripts speak of an entry together with the entries before it: a split $l=p\mathbin{+!!+}e::s$. Four facts about such splits are used again and again.

A split is a position, so a property of the splits is decided at the finitely many positions:

\big(\exists\,p\ e\ s,\ l=p\mathbin{+\!\!+}e::s\ \land\ P\,p\,e\big)\iff\big(\exists\,i<|l|,\ P\,(\mathrm{take}\ i\ l)\ l_i\big),
\qquad
\big(\forall\,p\ e,\ p\mathbin{+\!\!+}[e]\ \text{prefix of}\ l\ \to\ Q\,p\,e\big)\iff\big(\forall\,i<|l|,\ Q\,(\mathrm{take}\ i\ l)\ l_i\big).

An entry of a filtered image has a place in the list:

\mathrm{filterMap}\,f\,l=\mathit{pre}\mathbin{+\!\!+}d::\mathit{post}\ \Longrightarrow\ \exists\,l_a\,a\,l_b,\quad l=l_a\mathbin{+\!\!+}a::l_b,\quad \mathrm{filterMap}\,f\,l_a=\mathit{pre},\quad f\,a=\mathrm{some}\ d,

and the same for filter. Last, say that $P$ holds along $l$ from $b$ when every entry $a$ satisfies $P(c,a)$, with $c$ the fold of a step $f$ from $b$ over the entries before $a$. "Each query is valid for the state reached before it" is of this form:

\mathrm{ForallScan}\ b\ l\ \land\ \mathrm{ForallScan}\ (\mathrm{foldl}\,f\,b\,l)\ m\ \Longrightarrow\ \mathrm{ForallScan}\ b\ (l\mathbin{+\!\!+}m),
\qquad
\mathrm{ForallScan}\ b\ (l\mathbin{+\!\!+}a::m)\ \Longrightarrow\ P(\mathrm{foldl}\,f\,b\,l,\ a).
Proposed change

In Probability.List, add List.exists_eq_append_cons_iff, List.forall_prefix_concat_iff_forall_take, List.exists_split_of_filterMap_eq, List.exists_split_of_filter_eq (from core's filterMap_eq_append_iff and filterMap_eq_cons_iff), and List.ForallScan with ForallScan.append and ForallScan.of_append_cons. Related to #369.

Acceptance criteria

Decide whether some entry of [1, 2, 4] is larger than the sum of the entries before it. Split [1, 2, 3, 4] at an entry of its even entries, in the filterMap and the filter form. With a running sum as the fold, check a predicate at each entry of a list split in two.

主要语言
Lean
星标
3
派生
0
平均合并
1 天 7 小时
30 天内合并 PR
123

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

trailofbits/constructive-cryptography 的其他 Issue

查看 trailofbits/constructive-cryptography 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。