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 天 2 小時
30 天內合併 PR
159

環境準備

這個專案沒有提供開發容器、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 摘要。