Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prover][Compiler-v2] add spec block to lambda expressions #15916

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rahxephon89
Copy link
Contributor

@rahxephon89 rahxephon89 commented Feb 9, 2025

Description

This PR extends the language to allow spec block to be attached to lambda expression:

    public fun test_inline_1() {
        let v = vector[1u64, 2, 3];
        let z;
        inline_1(&mut v, |e| { *e = 2; b.v = 3; z = 2; (*e > 1, z == 2) }
        spec {
            requires e == 1;
            ensures e == 2;
            ensures z == 2;
            ensures result_1 == (e > 1);
            ensures result_2;
        }
        );
    }

Currently, only requires and ensures are supported in the spec block. Support of let, let post and old will be implemented in a separate PR.

How Has This Been Tested?

  1. existing tests pass;
  2. add a new prover test.

Key Areas to Review

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Move prover

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

Copy link

trunk-io bot commented Feb 9, 2025

⏱️ 1h total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-targeted-unit-tests 28m 🟩
check-dynamic-deps 13m 🟩🟩🟩🟩🟩 (+1 more)
rust-cargo-deny 11m 🟩🟩🟩🟩🟩 (+1 more)
semgrep/ci 4m 🟩🟩🟩🟩🟩 (+1 more)
general-lints 3m 🟩🟩🟩🟩🟩 (+1 more)
file_change_determinator 1m 🟩🟩🟩🟩🟩 (+1 more)
permission-check 17s 🟩🟩🟩🟩🟩 (+1 more)
permission-check 12s 🟩🟩🟩🟩🟩 (+1 more)

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@rahxephon89 rahxephon89 changed the title fix [WIP][Prover] add spec block to lambda expressions Feb 9, 2025
@rahxephon89 rahxephon89 force-pushed the teng/add-spec-block-to-lambda branch 2 times, most recently from 3ab9d76 to eb181ba Compare February 11, 2025 01:28
@@ -941,7 +941,7 @@ fn exp_(context: &mut Context, e: E::Exp) -> N::Exp {
EE::While(_, eb, el) => NE::While(exp(context, *eb), exp(context, *el)),
EE::Loop(_, el) => NE::Loop(exp(context, *el)),
EE::Block(seq) => NE::Block(sequence(context, seq)),
EE::Lambda(args, body, _lambda_capture_kind, _abilities) => {
EE::Lambda(args, body, _lambda_capture_kind, _abilities, _spec_opt) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

don't do anything because spec is not supported in compiler V1

@rahxephon89 rahxephon89 force-pushed the teng/add-spec-block-to-lambda branch from eb181ba to dd0fe62 Compare February 11, 2025 04:34
@rahxephon89 rahxephon89 force-pushed the teng/add-spec-block-to-lambda branch from 42ec100 to 0803cc9 Compare February 11, 2025 07:52
@rahxephon89 rahxephon89 marked this pull request as ready for review February 11, 2025 08:40
@rahxephon89 rahxephon89 changed the title [WIP][Prover] add spec block to lambda expressions [Prover][Compiler-v2] add spec block to lambda expressions Feb 11, 2025
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