Skip to content

New lemmas for List - #1072

Open
namasikanam wants to merge 1 commit into
mainfrom
oram-new-lemmas-list
Open

New lemmas for List#1072
namasikanam wants to merge 1 commit into
mainfrom
oram-new-lemmas-list

Conversation

@namasikanam

Copy link
Copy Markdown
Collaborator

There are a few new lemmas and four new operators:

  • isprefix: whether one list is a prefix of the other list
  • prefixes: the sets of all prefixes of a list
  • interval: a consecutive subsequence of a list
  • rfind: reverse finding (start from the end of the list)

Also, I reduced smt usage in some old proofs, as smt solving in those proof fails on my machine. I believe these updates only make proofs better :)

@strub

strub commented Jul 15, 2026

Copy link
Copy Markdown
Member

@namasikanam Did you change some lemmas?

@fdupress

Copy link
Copy Markdown
Member

The SHA3 one could be a smt(@List) that blows up with new lemmas. The stdlib failure is inside List itself, so likely one of the new lemmas. (Different SMT environment between @namasikanam's machine and the docker?)

@namasikanam

namasikanam commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

I didn't change any statement of existing lemmas (only update some proofs when they are not running on my machine). I coudn't find smt(@List) in SHA3, either. Do not understand why sha-3 is broken. I will try to reproduce the failure in a local docker.

@strub

strub commented Jul 17, 2026

Copy link
Copy Markdown
Member

I didn't change any statement of existing lemmas (only update some proofs when they are not running on my machine). I didn't find smt(@List). Do not understand why sha-3 is broken. I will try to reproduce the failure in a local docker.

Maybe the sha3 dev contains rogue smt?

@namasikanam
namasikanam force-pushed the oram-new-lemmas-list branch from e221166 to e211fc2 Compare July 18, 2026 09:44
@namasikanam

Copy link
Copy Markdown
Collaborator Author

Maybe the sha3 dev contains rogue smt?

I fixed the inconsistency in docker. I couldn't reproduce the failure for SHA3. But it turned out that the failure in SHA3 gets also resolved magically :)

@namasikanam

Copy link
Copy Markdown
Collaborator Author

I will always test within docker before creating a PR in the future :)

Comment thread theories/datatypes/List.ec Outdated
Comment thread theories/datatypes/List.ec
Comment thread theories/datatypes/List.ec Outdated
Comment thread theories/datatypes/List.ec
Comment thread theories/datatypes/List.ec Outdated
Comment thread theories/datatypes/List.ec Outdated
Comment thread theories/datatypes/List.ec Outdated
@namasikanam
namasikanam force-pushed the oram-new-lemmas-list branch 2 times, most recently from 4e5de52 to 601f53a Compare September 1, 2026 08:09
=> nth x (sublist s l r) m = nth x s (m + l).
proof. by move => ??; rewrite /sublist nth_drop // 1:/# nth_take /#. qed.

lemma sublist_subseq_sublist ['a] (s : 'a list) (m l r : int) :

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name should be something like sublist_cat.

proof. by move => ??; rewrite /sublist nth_drop // 1:/# nth_take /#. qed.

lemma sublist_subseq_sublist ['a] (s : 'a list) (m l r : int) :
0 <= l <= m <= r <= size s

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need 0 <= l and r <= size s.


lemma sublist_subseq_sublist ['a] (s : 'a list) (m l r : int) :
0 <= l <= m <= r <= size s
=> sublist s l r = sublist s l m ++ sublist s m r.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer putting the more complex thing (the expression with concatenation) on the left side.

qed.

lemma sublistS ['a] (s : 'a list) (n m : int) :
0 <= n < m <= size s

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're assuming m = n + 1 so you don't need n < m.

Maybe use n+1 directly instead of using m? Then you can drop the equality assumption as well.

size s <= r => sublist s l r = drop l s.
proof. by move=> *; rewrite /sublist take_oversize. qed.

lemma sublist_subseq ['a] (s : 'a list) (l1 l2 r1 r2 : int) :

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should be named sublist_subseq_sublist

proof. by move=> *; rewrite /sublist take_oversize. qed.

lemma sublist_subseq ['a] (s : 'a list) (l1 l2 r1 r2 : int) :
0 <= l1 <= l2 <= r1 <= r2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need l2 <= r1.

Also, the numbering on the ls and rs are inconsistent. Switch the names of l1 and l2.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need 0 <= l1 either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants