Skip to content

feat(Core): add Str.ToLower and Str.ToUpper string operations#621

Open
shigoel wants to merge 4 commits intomainfrom
shilpi/str-to-lower
Open

feat(Core): add Str.ToLower and Str.ToUpper string operations#621
shigoel wants to merge 4 commits intomainfrom
shilpi/str-to-lower

Conversation

@shigoel
Copy link
Contributor

@shigoel shigoel commented Mar 19, 2026

Summary

  • Add str.tolower and str.toupper operations to Strata Core, each with concrete evaluation and SMT axioms
  • Extend the unaryOp combinator in IntBoolFactory.lean with an optional axioms parameter
  • Skip axiom-bearing factory functions in ExprEvalTest to avoid MBQI timeouts on UF-based operations

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

shigoel and others added 2 commits March 19, 2026 17:04
- Add `unaryOp` optional `axioms` parameter in IntBoolFactory.lean
- Add `strToLowerFunc` and `strToUpperFunc` in Factory.lean, each with
  concrete evaluation (String.toLower / String.toUpper) and three SMT
  axioms: idempotence, length preservation, and concat distributivity
- Wire both ops into the DDM grammar, ASTtoCST, and Translate passes
- Skip axiom-bearing factory functions in ExprEvalTest to avoid MBQI
  timeouts on UF-based operations
- Merge StrToLowerTest and StrToUpperTest into StrCaseTest.lean
- Update ProcedureEvalTests and ProgramTypeTests expected outputs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shigoel shigoel requested a review from a team March 19, 2026 22:14
@shigoel shigoel changed the title feat: add Str.ToLower and Str.ToUpper string operations feat(Core): add Str.ToLower and Str.ToUpper string operations Mar 19, 2026
shigoel and others added 2 commits March 19, 2026 17:17
@shigoel shigoel added the Core label Mar 19, 2026
(((~Str.Concat : string → string → string) %1) %0))
== (((~Str.Concat : string → string → string)
((~Str.ToUpper : string → string) %1))
((~Str.ToUpper : string → string) %0)))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Confirmed that all these axioms and their ToLower versions are indeed valid, using CVC5.
I heard ß uppercases to SS, but probably ToUpper only deals with English alphabets.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should have a test with an unprovable or false goal to demonstrate that the axioms are not vacuous.

Copy link
Contributor

@joehendrix joehendrix left a comment

Choose a reason for hiding this comment

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

It's be nice to see if we can reduce some of the per-operator boilerplate wrt DDM integration, but that's clearly a separate PR.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants