From 4a142843c8268d5e0091856dc483336df8f5487f Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 18 Nov 2026 13:51:30 +0800 Subject: [PATCH] feat(proof): admit only Int abstraction for Number contracts and generate omega path implication goals --- src/knowledge/symbolic.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/knowledge/symbolic.rs b/src/knowledge/symbolic.rs index e7dc0d8..49376d9 100644 --- a/src/knowledge/symbolic.rs +++ b/src/knowledge/symbolic.rs @@ -12,6 +12,7 @@ pub struct SymbolicGoal{ pub guard_index:usize, pub binders:Vec, pub runtime_domain_verified:bool, + pub abstract_integer_model_supported:bool, } fn identifier(s:&str)->bool { !s.is_empty()&&s.chars().all(|c|c.is_alphanumeric()||c=='_') @@ -62,7 +63,11 @@ pub fn plan(semantic:&SemanticProject,call:&BoundCall,premise:&str)->OptionOption>>()?; - let idx=all.iter().position(|guard|guard==&wanted)?; + let idx=all.iter().position(|guard|guard==&wanted); Some(SymbolicGoal { proposition:wanted,guard_propositions:all,guard_index:idx, - binders,runtime_domain_verified:domain + binders,runtime_domain_verified:false, + abstract_integer_model_supported:model_supported }) } pub fn emit_lean(goals:&[(String,SymbolicGoal)])->String{ @@ -91,8 +97,13 @@ pub fn emit_lean(goals:&[(String,SymbolicGoal)])->String{ let hypotheses=g.guard_propositions.iter().enumerate() .map(|(n,p)|format!("(h{n} : {p})")) .collect::>().join(" "); - text.push_str(&format!("theorem path_vc_{i} {vars} {hypotheses} : {} := by\n exact h{}\n", - g.proposition,g.guard_index)); + let tactic=if let Some(n)=g.guard_index { + format!(" exact h{n}") + } else { + " omega".to_string() + }; + text.push_str(&format!("theorem path_vc_{i} {vars} {hypotheses} : {} := by\n{tactic}\n", + g.proposition)); } text.push_str("end MarqdoSymbolic\n"); text @@ -118,8 +129,9 @@ mod tests{ assert!(call.control_blocker.is_none()); let goal=plan(&c.semantics,call,"n > 0") .expect("path condition should imply imported precondition"); - assert!(goal.runtime_domain_verified); - assert_eq!(goal.guard_index,0); + assert!(!goal.runtime_domain_verified); + assert!(goal.abstract_integer_model_supported); + assert_eq!(goal.guard_index,Some(0)); let source=emit_lean(&[("branch-call".into(),goal)]); assert!(source.contains("theorem path_vc_0")); assert!(source.contains("exact h0"));