Skip to content

Commit 3bd79bb

Browse files
committed
Simplify the ecdsa example a bit to avoid stepping on #2726.
1 parent e1da98a commit 3bd79bb

File tree

1 file changed

+26
-39
lines changed

1 file changed

+26
-39
lines changed

examples/ecdsa/ecdsa.saw

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -412,115 +412,102 @@ p384_point_ops_sub_simp <- do {
412412
};
413413

414414
p384_point_ops_field_mul_simp <- do {
415-
let {{ thm x = p384_ec_point_ops::p384_point_ops.field.mul x ==
416-
p384_field::p384_field_mul x }};
415+
let t = {{ \x -> p384_ec_point_ops::p384_point_ops.field.mul x ==
416+
p384_field::p384_field_mul x }};
417417
// This is pretty quick even without the rewriting and uniterpretation
418418
// used above.
419-
let t = unfold_term ["thm"] {{ thm }};
420419
let t = rewrite ss0 t;
421420
//print_term t;
422421
prove_print z3 t;
423422
};
424423
p384_point_ops_field_sq_simp <- do {
425-
let {{ thm x = p384_ec_point_ops::p384_point_ops.field.sq x ==
426-
p384_field::p384_field_sq x }};
424+
let t = {{ \x -> p384_ec_point_ops::p384_point_ops.field.sq x ==
425+
p384_field::p384_field_sq x }};
427426
// This is pretty quick even without the rewriting and uninterpretation
428427
// used above.
429-
let t = unfold_term ["thm"] {{ thm }};
430428
let t = rewrite ss0 t;
431429
//print_term t;
432430
prove_print z3 t;
433431
};
434432
p384_point_ops_field_mul_simp2 <- do {
435-
let {{ thm x = ecc::p384_curve.point_ops.field.mul x ==
436-
p384_field::p384_field_mul x }};
433+
let t = {{ \x -> ecc::p384_curve.point_ops.field.mul x ==
434+
p384_field::p384_field_mul x }};
437435
// This is pretty quick even without the rewriting and uniterpretation
438436
// used above.
439-
let t = unfold_term ["thm"] {{ thm }};
440437
let t = rewrite ss0 t;
441438
//print_term t;
442439
prove_print z3 t;
443440
};
444441
p384_point_ops_field_sq_simp2 <- do {
445-
let {{ thm x = ecc::p384_curve.point_ops.field.sq x ==
446-
p384_field::p384_field_sq x }};
442+
let t = {{ \x -> ecc::p384_curve.point_ops.field.sq x ==
443+
p384_field::p384_field_sq x }};
447444
// This is pretty quick even without the rewriting and uniterpretation
448445
// used above.
449-
let t = unfold_term ["thm"] {{ thm }};
450446
let t = rewrite ss0 t;
451447
//print_term t;
452448
prove_print z3 t;
453449
};
454450

455451
p384_curve_field_mul_simp <- do {
456-
let {{ thm x y = ecc::p384_curve.point_ops.group_field.mul (x, y) ==
457-
mul_java::p384_group_mul (p384_field::p384_group_size, x, y) }};
458-
let t = unfold_term ["thm"] {{ thm }};
452+
let t = {{ \x y -> ecc::p384_curve.point_ops.group_field.mul (x, y) ==
453+
mul_java::p384_group_mul (p384_field::p384_group_size, x, y) }};
459454
let t = rewrite ss0 t;
460455
//print_term t;
461456
prove_print (unint_z3 ["p384_group_mul"]) t;
462457
};
463458

464459
p384_curve_field_sq_simp <- do {
465-
let {{ thm x = ecc::p384_curve.point_ops.group_field.sq x ==
466-
p384_field::p384_mod_mul (p384_field::p384_group_size, x, x) }};
467-
let t = unfold_term ["thm"] {{ thm }};
460+
let t = {{ \x -> ecc::p384_curve.point_ops.group_field.sq x ==
461+
p384_field::p384_mod_mul (p384_field::p384_group_size, x, x) }};
468462
let t = rewrite ss0 t;
469463
//print_term t;
470464
prove_print (unint_z3 ["p384_mod_mul"]) t;
471465
};
472466
p384_curve_field_div_simp <- do {
473-
let {{ thm x y = ecc::p384_curve.point_ops.group_field.div (x,y) ==
474-
p384_field::p384_mod_div (p384_field::p384_group_size, x, y) }};
475-
let t = unfold_term ["thm"] {{ thm }};
467+
let t = {{ \x y -> ecc::p384_curve.point_ops.group_field.div (x,y) ==
468+
p384_field::p384_mod_div (p384_field::p384_group_size, x, y) }};
476469
let t = rewrite ss0 t;
477470
//print_term t;
478471
prove_print (unint_z3 ["p384_mod_div"]) t;
479472
};
480473
p384_curve_twin_mul_simp <- do {
481-
let {{ thm x = ecc::p384_curve.twin_mul x ==
482-
p384_ec_mul::p384_ec_twin_mul x }};
483-
let t = unfold_term ["thm"] {{ thm }};
474+
let t = {{ \x -> ecc::p384_curve.twin_mul x ==
475+
p384_ec_mul::p384_ec_twin_mul x }};
484476
let t = rewrite ss0 t;
485477
//print_term t;
486478
prove_print (unint_z3 ["p384_ec_twin_mul"]) t;
487479
};
488480
p384_curve_is_equal_simp <- do {
489-
let {{ thm x y = ecc::p384_curve.point_ops.group_field.is_equal (x, y) ==
490-
(x == y) }};
491-
let t = unfold_term ["thm"] {{ thm }};
481+
let t = {{ \x y -> ecc::p384_curve.point_ops.group_field.is_equal (x, y) ==
482+
(x == y) }};
492483
let t = rewrite ss0 t;
493484
//print_term t;
494485
prove_print z3 t;
495486
};
496487
p384_curve_is_val_simp <- do {
497-
let {{ thm x = ecc::p384_curve.point_ops.group_field.is_val x ==
498-
p384_field::p384_is_group_val x }};
499-
let t = unfold_term ["thm"] {{ thm }};
488+
let t = {{ \x -> ecc::p384_curve.point_ops.group_field.is_val x ==
489+
p384_field::p384_is_group_val x }};
500490
let t = rewrite ss0 t;
501491
//print_term t;
502492
prove_print z3 t;
503493
};
504494
p384_curve_norm_simp <- do {
505-
let {{ thm x = ecc::p384_curve.point_ops.group_field.normalize x ==
506-
(if x < p384_field::p384_group_size
507-
then x
508-
else x - p384_field::p384_group_size) }};
509-
let t = unfold_term ["thm"] {{ thm }};
495+
let t = {{ \x -> ecc::p384_curve.point_ops.group_field.normalize x ==
496+
(if x < p384_field::p384_group_size
497+
then x
498+
else x - p384_field::p384_group_size) }};
510499
let t = rewrite ss0 t;
511500
//print_term t;
512501
prove_print z3 t;
513502
};
514503
p384_curve_field_zero_simp <- do {
515-
let {{ thm = ecc::p384_curve.point_ops.group_field.field_zero == 0 }};
516-
let t = unfold_term ["thm"] {{ thm }};
504+
let t = {{ ecc::p384_curve.point_ops.group_field.field_zero == 0 }};
517505
let t = rewrite ss0 t;
518506
//print_term t;
519507
prove_print z3 t;
520508
};
521509
p384_curve_base_simp <- do {
522-
let {{ thm = ecc::p384_curve.base == ecc::p384_base }};
523-
let t = unfold_term ["thm"] {{ thm }};
510+
let t = {{ ecc::p384_curve.base == ecc::p384_base }};
524511
let t = rewrite ss0 t;
525512
//print_term t;
526513
prove_print z3 t;

0 commit comments

Comments
 (0)