Skip to content

Distributivity of exponentials - #21

Closed
arthuraa wants to merge 8 commits into
masterfrom
exp-distr
Closed

arthuraa wants to merge 8 commits into
masterfrom
exp-distr

Conversation

@arthuraa

Copy link
Copy Markdown
Owner

This pull request enables the distributivity equation (ab) ^ x = a^x b^x. This equation means that the group of exponents is the same group as the Diffie-Hellman group.

arthuraa and others added 8 commits September 14, 2026 08:47
…es, examples.

Stages 4-6 of enabling (a*b)^x = a^x * b^x: core/public.v, the HeapLang
primitives, lib/dh.v and the case studies.

Lemmas whose base must now be an atom gained negb (is_mul _) / negb (is_inv _)
premises; public_TExp, TExpA, TExpK, TExp_TMulN, TExp_TInv, minted_base_exps
and twp_texp stay unconditional.

New factor-level API, for protocols that exponentiate an attacker-supplied
value and so cannot assume an atomic base:

  algebra.v   is_inv_TExp, TExp_injl, invs_canceled_TExp, factors_TExp
  subterms.v  subterm_factors, subterm_TExp_factors
  public.v    public_TExp_factors

The OPAQUE server exercises all of them.  It also needs a group-membership
check it never had: 1 ^ x = 1 drops the server's ephemeral secret out of the
session key, so Server.session now rejects an identity X_u -- the check its
own TODO was already asking for.

CLAUDE.md records the endomorphism law, the atomic-base wf invariant, and both
downstream consequences.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E8khwa8zca1fMdMbwHLikG
PTMul is replaced by PTN of term_opN & list pre_term, mirroring PT0/PT1/PT2.
term_opN currently has the single constructor ONMul, with the same derived
eqType/choiceType/countType/orderType instances as the other operation types,
and PTMul ts becomes a Notation for PTN ONMul ts (alongside PTInv/PTExp).

Keeping PTMul as a notation means product-specific matches read as before and,
once term_opN gains a constructor, become non-exhaustiveness errors rather
than silently taking the product branch.

The HeapLang encoding follows the arities too: outer TOpN_tag = 3, inner
TMul_tag = 0, PTN o ts represented as (#TOpN_tag, (repr o, repr_list ...)).
eq_term, leq_term, hl_is_mul, hl_one, hl_factors and hl_mul_aux are updated
accordingly, with eq_term_opN / leq_term_opN and their specs.

Order plumbing: leqE's PTN case compares the operation first, as PT1/PT2 do;
with_stdpp.v gains int_of_term_opN / opN_le / opN_leE, and pt_order_mul
becomes pt_order_N, quantified over the operation.

Case patterns in the n-ary branch now destruct the operation -- [] rather than
a binder, so is_mul and friends keep reducing as before, and a second n-ary
operation fails loudly.  Structural functions that ignore the operation
(height, tsize, nonces_of_pre_term) match on PTN _ ts; product-specific ones
(is_mul, factors, wf, normalize) stay on PTMul.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E8khwa8zca1fMdMbwHLikG
@arthuraa arthuraa closed this Sep 14, 2026
@arthuraa

Copy link
Copy Markdown
Owner Author

NB As it stands, this doesn't make much sense. Because inverses are total, the group of exponents is a symbolic model of the integers modulo some prime number p. But x^{p+1}, modulo p, is equal to x^p x^1 = x * x = x^2 instead of x^1. In other words, arithmetic in the exponent is not modulo p.

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.

1 participant