Skip to content

Commit 0ac1cbe

Browse files
committed
style: apply cargo fmt
1 parent 1b5f6d3 commit 0ac1cbe

62 files changed

Lines changed: 1791 additions & 933 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

benches/proof_benchmarks.rs

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use echidna::verification::axiom_tracker::AxiomTracker;
1414
use echidna::verification::confidence::{compute_trust_level, TrustFactors, TrustLevel};
1515
use echidna::verification::mutation::MutationTester;
1616
use echidna::verification::pareto::{ParetoFrontier, ProofCandidate, ProofObjective};
17+
use echidna::verification::portfolio::PortfolioConfidence;
1718
use echidna::verification::statistics::StatisticsTracker;
1819
use echidna::verification::DangerLevel;
19-
use echidna::verification::portfolio::PortfolioConfidence;
2020

2121
use std::collections::HashMap;
2222

@@ -192,7 +192,11 @@ fn bench_trust_computation(c: &mut Criterion) {
192192
/// Benchmark axiom danger scanning
193193
fn bench_axiom_scanning(c: &mut Criterion) {
194194
let test_contents = [
195-
("clean_lean", ProverKind::Lean, "theorem foo : True := trivial"),
195+
(
196+
"clean_lean",
197+
ProverKind::Lean,
198+
"theorem foo : True := trivial",
199+
),
196200
(
197201
"sorry_lean",
198202
ProverKind::Lean,
@@ -237,10 +241,7 @@ fn bench_mutation_generation(c: &mut Criterion) {
237241
args: vec![
238242
Term::App {
239243
func: Box::new(Term::Const("add".to_string())),
240-
args: vec![
241-
Term::Var("x".to_string()),
242-
Term::Const("0".to_string()),
243-
],
244+
args: vec![Term::Var("x".to_string()), Term::Const("0".to_string())],
244245
},
245246
Term::Var("x".to_string()),
246247
],
@@ -258,27 +259,23 @@ fn bench_mutation_generation(c: &mut Criterion) {
258259
fn bench_pareto_frontier(c: &mut Criterion) {
259260
let mut group = c.benchmark_group("pareto_frontier");
260261
for n_points in [10, 50, 100] {
261-
group.bench_with_input(
262-
BenchmarkId::from_parameter(n_points),
263-
&n_points,
264-
|b, &n| {
265-
b.iter(|| {
266-
let mut candidates: Vec<ProofCandidate> = (0..n)
267-
.map(|i| ProofCandidate {
268-
id: format!("candidate_{i}"),
269-
objectives: ProofObjective {
270-
proof_time_ms: (i as u64) * 100,
271-
trust_level: TrustLevel::Level3,
272-
memory_bytes: (n as u64 - i as u64) * 1024,
273-
proof_steps: i * 5,
274-
},
275-
is_pareto_optimal: false,
276-
})
277-
.collect();
278-
black_box(ParetoFrontier::compute(&mut candidates))
279-
})
280-
},
281-
);
262+
group.bench_with_input(BenchmarkId::from_parameter(n_points), &n_points, |b, &n| {
263+
b.iter(|| {
264+
let mut candidates: Vec<ProofCandidate> = (0..n)
265+
.map(|i| ProofCandidate {
266+
id: format!("candidate_{i}"),
267+
objectives: ProofObjective {
268+
proof_time_ms: (i as u64) * 100,
269+
trust_level: TrustLevel::Level3,
270+
memory_bytes: (n as u64 - i as u64) * 1024,
271+
proof_steps: i * 5,
272+
},
273+
is_pareto_optimal: false,
274+
})
275+
.collect();
276+
black_box(ParetoFrontier::compute(&mut candidates))
277+
})
278+
});
282279
}
283280
group.finish();
284281
}
@@ -329,11 +326,7 @@ criterion_group!(
329326
bench_prover_detection,
330327
);
331328

332-
criterion_group!(
333-
trust_benches,
334-
bench_trust_computation,
335-
bench_axiom_scanning,
336-
);
329+
criterion_group!(trust_benches, bench_trust_computation, bench_axiom_scanning,);
337330

338331
criterion_group!(
339332
verification_benches,

benches/routing_benchmarks.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ fn bench_routing_decision_latency(c: &mut Criterion) {
5757
|b, content| {
5858
b.iter(|| {
5959
// Deterministic hash-based prover selection — the routing hot path.
60-
let hash: usize = content
61-
.as_bytes()
62-
.iter()
63-
.fold(0usize, |acc, &byte| acc.wrapping_mul(31).wrapping_add(byte as usize));
60+
let hash: usize = content.as_bytes().iter().fold(0usize, |acc, &byte| {
61+
acc.wrapping_mul(31).wrapping_add(byte as usize)
62+
});
6463
let provers = black_box(ProverKind::all());
6564
let selected = provers[hash % provers.len()];
6665
black_box(selected)
@@ -239,9 +238,7 @@ fn bench_agentic_config_throughput(c: &mut Criterion) {
239238
// Benchmark: clone from existing config.
240239
let base_config = AgentConfig::default();
241240
group.bench_function("agent_config_clone", |b| {
242-
b.iter(|| {
243-
black_box(base_config.clone())
244-
})
241+
b.iter(|| black_box(base_config.clone()))
245242
});
246243

247244
// Benchmark: JSON serialisation (used for config logging and audit).

src/rust/agent/actors.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,28 +248,32 @@ fn collect_lemma_candidates(term: &Term, out: &mut Vec<String>, cap: usize) {
248248
if !out.contains(name) {
249249
out.push(name.clone());
250250
}
251-
}
251+
},
252252
Term::App { func, args } => {
253253
collect_lemma_candidates(func, out, cap);
254254
for a in args {
255255
collect_lemma_candidates(a, out, cap);
256256
}
257-
}
258-
Term::Pi { param_type, body, .. } => {
257+
},
258+
Term::Pi {
259+
param_type, body, ..
260+
} => {
259261
collect_lemma_candidates(param_type, out, cap);
260262
collect_lemma_candidates(body, out, cap);
261-
}
262-
Term::Lambda { param_type, body, .. } => {
263+
},
264+
Term::Lambda {
265+
param_type, body, ..
266+
} => {
263267
if let Some(pt) = param_type {
264268
collect_lemma_candidates(pt, out, cap);
265269
}
266270
collect_lemma_candidates(body, out, cap);
267-
}
271+
},
268272
Term::Let { value, body, .. } => {
269273
collect_lemma_candidates(value, out, cap);
270274
collect_lemma_candidates(body, out, cap);
271-
}
272-
_ => {}
275+
},
276+
_ => {},
273277
}
274278
}
275279

src/rust/agent/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,17 @@ impl AgentCore {
376376
prover: prover_kind,
377377
time_ms,
378378
});
379-
}
379+
},
380380
Ok(TacticResult::Success(new_state)) => {
381381
current_state = new_state;
382382
current_state.proof_script.push(tactic.clone());
383-
}
383+
},
384384
Ok(TacticResult::Error(msg)) => {
385385
debug!("Tactic {:?} rejected: {}", tactic, msg);
386-
}
386+
},
387387
Err(e) => {
388388
debug!("Backend error on tactic {:?}: {}", tactic, e);
389-
}
389+
},
390390
}
391391
}
392392

src/rust/core.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ impl fmt::Display for Term {
150150
}
151151

152152
/// Current state of a proof
153-
#[derive(Debug, Clone, Serialize, Deserialize)]
154-
#[derive(Default)]
153+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
155154
pub struct ProofState {
156155
/// Current goals to prove
157156
pub goals: Vec<Goal>,
@@ -283,7 +282,6 @@ pub enum TacticResult {
283282
QED,
284283
}
285284

286-
287285
impl fmt::Display for Definition {
288286
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
289287
write!(f, "{} : {} = {}", self.name, self.ty, self.body)

src/rust/disciplines/mod.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ use crate::provers::ProverKind;
6868
///
6969
/// Order is stable; inserting a new variant should always append, never
7070
/// re-order, because downstream consumers serialise by discriminant.
71-
#[derive(
72-
Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize,
73-
)]
71+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
7472
pub enum TypeDiscipline {
7573
// Entry points / kernels.
7674
TypeLl,
@@ -224,14 +222,12 @@ impl TypeDiscipline {
224222
match self {
225223
D::TypeLl | D::Katagoria => EntryPoint,
226224
D::Ordinary => Foundation,
227-
D::Phantom | D::Polymorphic | D::Existential | D::HigherKinded | D::Row => {
228-
Polymorphism
229-
}
225+
D::Phantom | D::Polymorphic | D::Existential | D::HigherKinded | D::Row => Polymorphism,
230226
D::Subtyping | D::Intersection | D::Union | D::Gradual => Subtyping,
231227
D::Dependent | D::Refinement | D::Hoare | D::Indexed => DependentRefinement,
232228
D::Qtt | D::Linear | D::Affine | D::Relevant | D::Ordered | D::Uniqueness => {
233229
Substructural
234-
}
230+
},
235231
D::Immutable | D::Capability | D::Bunched => MutabilityCapability,
236232
D::Modal | D::Epistemic | D::Temporal | D::Provability => Modal,
237233
D::EffectRow | D::Impure | D::Coeffect | D::Probabilistic => EffectsCoeffects,
@@ -419,7 +415,7 @@ impl TypeDiscipline {
419415
// that have explicit STLC tutorials.
420416
D::Ordinary => {
421417
vec![P::Agda, P::Coq, P::Lean, P::Isabelle, P::Idris2, P::FStar]
422-
}
418+
},
423419

424420
// Polymorphism family.
425421
D::Polymorphic => vec![
@@ -436,9 +432,7 @@ impl TypeDiscipline {
436432
D::Existential => vec![P::Agda, P::Coq, P::Lean, P::Idris2, P::FStar],
437433
D::HigherKinded => vec![P::Agda, P::Coq, P::Lean, P::Idris2, P::FStar],
438434
D::Row => vec![], // Koka-native; none in echidna's classical lineup.
439-
D::Phantom => vec![
440-
P::Agda, P::Coq, P::Lean, P::Idris2, P::FStar, P::Dafny,
441-
],
435+
D::Phantom => vec![P::Agda, P::Coq, P::Lean, P::Idris2, P::FStar, P::Dafny],
442436

443437
// Subtyping family.
444438
D::Subtyping => vec![P::FStar, P::Dafny],
@@ -473,15 +467,13 @@ impl TypeDiscipline {
473467
// Modal family.
474468
D::Modal => vec![P::Isabelle], // Isabelle/ModalHOL + other instances.
475469
D::Epistemic => vec![], // DEL / S5 tooling lives outside echidna's current lineup.
476-
D::Temporal => vec![
477-
P::NuSMV, P::TLC, P::SPIN, P::UPPAAL, P::Prism, P::TLAPS,
478-
],
470+
D::Temporal => vec![P::NuSMV, P::TLC, P::SPIN, P::UPPAAL, P::Prism, P::TLAPS],
479471
D::Provability => vec![], // GL logic, mostly research.
480472

481473
// Effects / coeffects.
482474
D::EffectRow => vec![P::FStar], // F* effect algebras.
483475
D::Impure => vec![P::FStar, P::Dafny], // Stateful-program verifiers.
484-
D::Coeffect => vec![], // Granule; not in echidna.
476+
D::Coeffect => vec![], // Granule; not in echidna.
485477
D::Probabilistic => vec![P::Prism, P::DReal],
486478

487479
// Process / communication — the HP stack is specifically here
@@ -584,8 +576,7 @@ mod tests {
584576

585577
#[test]
586578
fn tags_are_unique() {
587-
let mut tags: Vec<&'static str> =
588-
TypeDiscipline::ALL.iter().map(|d| d.tag()).collect();
579+
let mut tags: Vec<&'static str> = TypeDiscipline::ALL.iter().map(|d| d.tag()).collect();
589580
tags.sort_unstable();
590581
let before = tags.len();
591582
tags.dedup();

src/rust/dispatch.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use tracing::{info, warn};
1414

1515
use crate::integrity::solver_integrity::{IntegrityChecker, IntegrityStatus};
1616
use crate::llm::LlmAdvisor;
17-
use crate::provers::{ProverConfig, ProverFactory, ProverKind};
1817
use crate::provers::outcome::{classify_anyhow_error, ProverOutcome};
18+
use crate::provers::{ProverConfig, ProverFactory, ProverKind};
1919
use crate::verification::axiom_tracker::{AxiomTracker, AxiomUsage, DangerLevel};
2020
use crate::verification::confidence::{compute_trust_level, TrustFactors, TrustLevel};
2121

@@ -256,7 +256,7 @@ impl ProverDispatcher {
256256
outcome,
257257
diagnostics,
258258
});
259-
}
259+
},
260260
};
261261

262262
// Step 3: Run the rich `check()` variant — gives us a full outcome
@@ -586,19 +586,14 @@ mod tests {
586586

587587
#[test]
588588
fn test_prover_selection_agda() {
589-
let prover = ProverDispatcher::select_prover(
590-
"module MyModule where\ndata Nat : Set where",
591-
None,
592-
);
589+
let prover =
590+
ProverDispatcher::select_prover("module MyModule where\ndata Nat : Set where", None);
593591
assert_eq!(prover, ProverKind::Agda);
594592
}
595593

596594
#[test]
597595
fn test_prover_selection_isabelle() {
598-
let prover = ProverDispatcher::select_prover(
599-
"theory MyTheory\nimports Main",
600-
None,
601-
);
596+
let prover = ProverDispatcher::select_prover("theory MyTheory\nimports Main", None);
602597
assert_eq!(prover, ProverKind::Isabelle);
603598
}
604599

0 commit comments

Comments
 (0)