From 25e2eb01865350d1bb73320772a14d6ac3785e71 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Mon, 3 Apr 2017 17:43:44 -0400 Subject: More fine-grained tactic imports Most files no longer import Crypto.Util.Tactics. We remove an unused lemma depending on classical axioms; closes #143. After | File Name | Before || Change ----------------------------------------------------------------------------------------------------------- 28m38.18s | Total | 29m04.51s || -0m26.32s ----------------------------------------------------------------------------------------------------------- 0m41.70s | ModularArithmetic/ModularBaseSystemProofs | 0m32.66s || +0m09.04s 1m39.88s | MontgomeryX | 1m46.07s || -0m06.18s 1m56.52s | WeierstrassCurve/Projective | 2m00.76s || -0m04.23s 10m36.85s | WeierstrassCurve/WeierstrassCurveTheorems | 10m40.14s || -0m03.28s 0m21.35s | ModularArithmetic/Pow2BaseProofs | 0m22.54s || -0m01.18s 0m20.24s | Reflection/Named/MapCastWf | 0m21.41s || -0m01.17s 1m30.28s | Test/Curve25519SpecTestVectors | 1m31.19s || -0m00.90s 0m49.53s | Specific/IntegrationTest | 0m50.01s || -0m00.47s 0m42.19s | MontgomeryCurveTheorems | 0m42.18s || +0m00.00s 0m41.08s | ModularArithmetic/Conversion | 0m41.84s || -0m00.76s 0m36.62s | Spec/Ed25519 | 0m37.13s || -0m00.51s 0m23.64s | CompleteEdwardsCurve/CompleteEdwardsCurveTheorems | 0m24.44s || -0m00.80s 0m19.94s | Specific/GF25519 | 0m20.12s || -0m00.17s 0m19.59s | CompleteEdwardsCurve/ExtendedCoordinates | 0m19.83s || -0m00.23s 0m19.14s | Reflection/Z/Bounds/InterpretationLemmas | 0m19.90s || -0m00.75s 0m18.65s | EdDSARepChange | 0m18.74s || -0m00.08s 0m16.24s | Reflection/Z/ArithmeticSimplifierWf | 0m17.11s || -0m00.87s 0m15.03s | Util/ZUtil | 0m15.93s || -0m00.90s 0m14.74s | Reflection/Named/ContextProperties/NameUtil | 0m15.11s || -0m00.36s 0m14.62s | Reflection/Named/ContextProperties/SmartMap | 0m14.93s || -0m00.31s 0m12.96s | Specific/NewBaseSystemTest | 0m13.24s || -0m00.27s 0m11.84s | Algebra/Field | 0m12.49s || -0m00.65s 0m10.21s | Testbit | 0m09.86s || +0m00.35s 0m09.86s | Reflection/Z/ArithmeticSimplifierInterp | 0m10.69s || -0m00.83s 0m09.44s | Reflection/Named/MapCastInterp | 0m09.82s || -0m00.38s 0m08.81s | BoundedArithmetic/ArchitectureToZLikeProofs | 0m09.37s || -0m00.55s 0m08.60s | Assembly/GF25519 | 0m08.66s || -0m00.06s 0m08.58s | ModularArithmetic/Montgomery/ZProofs | 0m08.77s || -0m00.18s 0m08.53s | BoundedArithmetic/Double/Proofs/ShiftRightDoubleWordImmediate | 0m08.34s || +0m00.18s 0m08.41s | BoundedArithmetic/Double/Proofs/Multiply | 0m08.77s || -0m00.35s 0m08.26s | Reflection/InlineWf | 0m08.59s || -0m00.33s 0m07.54s | Algebra/Ring | 0m08.04s || -0m00.49s 0m07.43s | MxDHRepChange | 0m07.10s || +0m00.33s 0m07.15s | BoundedArithmetic/Double/Proofs/SpreadLeftImmediate | 0m07.09s || +0m00.06s 0m07.00s | NewBaseSystem | 0m07.16s || -0m00.16s 0m06.51s | Specific/GF1305 | 0m06.52s || -0m00.00s 0m06.09s | Util/FixedWordSizesEquality | 0m06.37s || -0m00.28s 0m05.56s | BoundedArithmetic/Double/Proofs/RippleCarryAddSub | 0m05.51s || +0m00.04s 0m05.38s | CompleteEdwardsCurve/Pre | 0m05.38s || +0m00.00s 0m05.28s | ModularArithmetic/ModularBaseSystemListProofs | 0m05.15s || +0m00.12s 0m05.24s | Experiments/GenericFieldPow | 0m05.54s || -0m00.29s 0m05.01s | Specific/SC25519 | 0m05.38s || -0m00.37s 0m04.93s | Algebra/Field_test | 0m04.81s || +0m00.12s 0m04.78s | Reflection/InlineCastWf | 0m04.94s || -0m00.16s 0m04.10s | Reflection/Z/Syntax/Equality | 0m04.28s || -0m00.18s 0m03.92s | BaseSystemProofs | 0m03.90s || +0m00.02s 0m03.75s | ModularArithmetic/BarrettReduction/ZHandbook | 0m03.94s || -0m00.18s 0m03.72s | CompleteEdwardsCurve/EdwardsMontgomery | 0m03.69s || +0m00.03s 0m03.72s | Reflection/EtaWf | 0m03.71s || +0m00.01s 0m03.60s | Reflection/Named/CompileWf | 0m04.01s || -0m00.40s 0m03.58s | SaturatedBaseSystem | 0m03.76s || -0m00.17s 0m03.33s | BoundedArithmetic/InterfaceProofs | 0m03.72s || -0m00.39s 0m03.16s | Reflection/LinearizeWf | 0m03.26s || -0m00.09s 0m03.08s | ModularArithmetic/ZBoundedZ | 0m03.16s || -0m00.08s 0m03.01s | Specific/FancyMachine256/Montgomery | 0m03.16s || -0m00.15s 0m02.99s | Reflection/Named/CompileInterp | 0m03.24s || -0m00.25s 0m02.92s | ModularArithmetic/ModularArithmeticTheorems | 0m03.06s || -0m00.14s 0m02.92s | ModularArithmetic/BarrettReduction/ZGeneralized | 0m03.15s || -0m00.23s 0m02.90s | Specific/FancyMachine256/Barrett | 0m03.18s || -0m00.28s 0m02.80s | Spec/MontgomeryCurve | 0m03.05s || -0m00.25s 0m02.77s | BoundedArithmetic/Double/Proofs/ShiftRight | 0m02.75s || +0m00.02s 0m02.75s | BoundedArithmetic/Double/Proofs/Decode | 0m02.81s || -0m00.06s 0m02.64s | BoundedArithmetic/Double/Proofs/ShiftLeft | 0m02.62s || +0m00.02s 0m02.54s | Reflection/InlineInterp | 0m02.60s || -0m00.06s 0m02.48s | Reflection/Named/ContextProperties | 0m02.58s || -0m00.10s 0m02.47s | ModularArithmetic/ModularBaseSystemOpt | 0m02.39s || +0m00.08s 0m02.40s | Reflection/TestCase | 0m02.60s || -0m00.20s 0m02.35s | ModularArithmetic/BarrettReduction/ZBounded | 0m02.40s || -0m00.04s 0m02.35s | Reflection/Z/Bounds/Relax | 0m02.46s || -0m00.10s 0m02.33s | Reflection/Named/NameUtilProperties | 0m02.40s || -0m00.06s 0m02.15s | Reflection/WfProofs | 0m02.26s || -0m00.10s 0m02.00s | Reflection/WfReflective | 0m02.04s || -0m00.04s 0m01.97s | ModularArithmetic/Montgomery/ZBounded | 0m02.14s || -0m00.17s 0m01.90s | Specific/FancyMachine256/Core | 0m01.98s || -0m00.08s 0m01.89s | Util/WordUtil | 0m01.96s || -0m00.07s 0m01.88s | Assembly/Evaluables | 0m01.82s || +0m00.05s 0m01.62s | WeierstrassCurve/Pre | 0m01.64s || -0m00.01s 0m01.56s | Reflection/Named/InterpretToPHOASWf | 0m01.61s || -0m00.05s 0m01.46s | Assembly/Compile | 0m01.51s || -0m00.05s 0m01.44s | ModularArithmetic/PrimeFieldTheorems | 0m01.43s || +0m00.01s 0m01.44s | ModularArithmetic/BarrettReduction/Z | 0m01.57s || -0m00.13s 0m01.41s | Algebra/Group | 0m01.87s || -0m00.46s 0m01.40s | Util/Tuple | 0m01.46s || -0m00.06s 0m01.38s | Reflection/MapCastInterp | 0m01.38s || +0m00.00s 0m01.31s | BoundedArithmetic/Double/Repeated/Proofs/Decode | 0m01.05s || +0m00.26s 0m01.26s | ModularArithmetic/ExtendedBaseVector | 0m01.28s || -0m00.02s 0m01.16s | Assembly/Conversions | 0m01.13s || +0m00.03s 0m01.14s | Reflection/Z/Bounds/Pipeline/Definition | 0m01.15s || -0m00.01s 0m01.13s | BaseSystem | 0m01.14s || -0m00.01s 0m01.06s | Reflection/SmartBoundInterp | 0m01.07s || -0m00.01s 0m01.04s | Reflection/Named/InterpretToPHOASInterp | 0m00.99s || +0m00.05s 0m01.01s | Reflection/SmartCastWf | 0m00.94s || +0m00.07s 0m01.01s | Assembly/Pipeline | 0m01.02s || -0m00.01s 0m01.01s | Reflection/Relations | 0m01.06s || -0m00.05s 0m00.97s | Assembly/HL | 0m00.99s || -0m00.02s 0m00.96s | Algebra/IntegralDomain | 0m01.00s || -0m00.04s 0m00.94s | Assembly/LL | 0m01.02s || -0m00.08s 0m00.92s | BoundedArithmetic/Double/Proofs/BitwiseOr | 0m00.91s || +0m00.01s 0m00.90s | Assembly/PhoasCommon | 0m00.87s || +0m00.03s 0m00.89s | Util/NumTheoryUtil | 0m00.92s || -0m00.03s 0m00.87s | BoundedArithmetic/Double/Proofs/LoadImmediate | 0m00.96s || -0m00.08s 0m00.84s | Reflection/WfInversion | 0m00.88s || -0m00.04s 0m00.83s | Reflection/InlineCastInterp | 0m00.85s || -0m00.02s 0m00.81s | Reflection/Named/CompileProperties | 0m00.87s || -0m00.05s 0m00.80s | BoundedArithmetic/X86ToZLikeProofs | 0m00.86s || -0m00.05s 0m00.78s | Karatsuba | 0m00.84s || -0m00.05s 0m00.72s | Util/PartiallyReifiedProp | 0m00.73s || -0m00.01s 0m00.72s | Reflection/MultiSizeTest | 0m00.72s || +0m00.00s 0m00.69s | ModularArithmetic/ModularBaseSystem | 0m00.72s || -0m00.03s 0m00.68s | BoundedArithmetic/Double/Repeated/Proofs/Multiply | 0m00.61s || +0m00.07s 0m00.68s | Reflection/MapCastByDeBruijnInterp | 0m00.76s || -0m00.07s 0m00.68s | Encoding/ModularWordEncodingTheorems | 0m00.80s || -0m00.12s 0m00.68s | ModularArithmetic/ExtPow2BaseMulProofs | 0m00.72s || -0m00.03s 0m00.67s | Spec/EdDSA | 0m00.66s || +0m00.01s 0m00.67s | ModularArithmetic/PseudoMersenneBaseParamProofs | 0m00.74s || -0m00.06s 0m00.66s | Reflection/Z/Bounds/Pipeline/ReflectiveTactics | 0m00.62s || +0m00.04s 0m00.66s | Util/IterAssocOp | 0m00.94s || -0m00.27s 0m00.64s | Encoding/ModularWordEncodingPre | 0m00.73s || -0m00.08s 0m00.63s | ModularArithmetic/ModularBaseSystemList | 0m00.77s || -0m00.14s 0m00.62s | Spec/ModularWordEncoding | 0m00.66s || -0m00.04s 0m00.61s | Reflection/MapCastByDeBruijnWf | 0m00.61s || +0m00.00s 0m00.58s | BoundedArithmetic/X86ToZLike | 0m00.57s || +0m00.01s 0m00.58s | Reflection/Z/CNotations | 0m00.56s || +0m00.01s 0m00.57s | Spec/WeierstrassCurve | 0m00.57s || +0m00.00s 0m00.56s | Spec/CompleteEdwardsCurve | 0m00.59s || -0m00.02s 0m00.56s | BoundedArithmetic/Double/Proofs/SelectConditional | 0m00.58s || -0m00.01s 0m00.56s | Reflection/InterpByIsoProofs | 0m00.60s || -0m00.03s 0m00.55s | Reflection/Named/WfInterp | 0m00.57s || -0m00.01s 0m00.55s | BoundedArithmetic/Double/Repeated/Proofs/ShiftLeftRight | 0m00.57s || -0m00.01s 0m00.54s | Reflection/Named/FMapContext | 0m00.70s || -0m00.15s 0m00.54s | Util/AdditionChainExponentiation | 0m00.62s || -0m00.07s 0m00.54s | Reflection/SmartBoundWf | 0m00.55s || -0m00.01s 0m00.54s | Reflection/WfReflectiveGen | 0m00.54s || +0m00.00s 0m00.54s | BoundedArithmetic/Interface | 0m00.56s || -0m00.02s 0m00.52s | BoundedArithmetic/ArchitectureToZLike | 0m00.46s || +0m00.06s 0m00.52s | Reflection/Z/JavaNotations | 0m00.58s || -0m00.05s 0m00.52s | Reflection/Z/Syntax/Util | 0m00.53s || -0m00.01s 0m00.52s | Util/CPSUtil | 0m00.57s || -0m00.04s 0m00.51s | Reflection/BoundByCastInterp | 0m00.51s || +0m00.00s 0m00.50s | BoundedArithmetic/Double/Repeated/Proofs/ShiftRightDoubleWordImmediate | 0m00.53s || -0m00.03s 0m00.50s | BoundedArithmetic/Double/Repeated/Proofs/RippleCarryAddSub | 0m00.57s || -0m00.06s 0m00.50s | Reflection/InterpWfRel | 0m00.54s || -0m00.04s 0m00.49s | Reflection/Z/InlineInterp | 0m00.37s || +0m00.12s 0m00.49s | Reflection/InputSyntax | 0m00.55s || -0m00.06s 0m00.49s | Util/Decidable | 0m00.48s || +0m00.01s 0m00.48s | ModularArithmetic/PseudoMersenneBaseParams | 0m00.39s || +0m00.08s 0m00.48s | BoundedArithmetic/Double/Repeated/Core | 0m00.48s || +0m00.00s 0m00.47s | BoundedArithmetic/Double/Core | 0m00.50s || -0m00.03s 0m00.47s | Reflection/Z/Bounds/Pipeline | 0m00.46s || +0m00.00s 0m00.47s | BoundedArithmetic/Double/Repeated/Proofs/SelectConditional | 0m00.54s || -0m00.07s 0m00.47s | ModularArithmetic/ModularBaseSystemListZOperationsProofs | 0m00.42s || +0m00.04s 0m00.47s | Util/NUtil | 0m00.50s || -0m00.03s 0m00.47s | Reflection/Z/Bounds/Interpretation | 0m00.42s || +0m00.04s 0m00.47s | Reflection/Z/Reify | 0m00.49s || -0m00.02s 0m00.46s | BoundedArithmetic/StripCF | 0m00.44s || +0m00.02s 0m00.46s | BoundedArithmetic/Double/Repeated/Proofs/BitwiseOr | 0m00.51s || -0m00.04s 0m00.46s | Reflection/Z/MapCastByDeBruijn | 0m00.50s || -0m00.03s 0m00.46s | Reflection/Z/Bounds/MapCastByDeBruijnWf | 0m00.42s || +0m00.04s 0m00.46s | BoundedArithmetic/Double/Repeated/Proofs/LoadImmediate | 0m00.55s || -0m00.09s 0m00.45s | Util/HList | 0m00.50s || -0m00.04s 0m00.44s | Reflection/Z/Inline | 0m00.39s || +0m00.04s 0m00.44s | Reflection/InterpWf | 0m00.55s || -0m00.11s 0m00.44s | Reflection/Z/Syntax | 0m00.46s || -0m00.02s 0m00.44s | Reflection/Z/ArithmeticSimplifier | 0m00.47s || -0m00.02s 0m00.44s | Reflection/Named/DeadCodeElimination | 0m00.36s || +0m00.08s 0m00.44s | ModularArithmetic/ZBounded | 0m00.49s || -0m00.04s 0m00.43s | ModularArithmetic/Pre | 0m00.44s || -0m00.01s 0m00.42s | ModularArithmetic/Montgomery/Z | 0m00.39s || +0m00.02s 0m00.42s | Reflection/Z/Bounds/MapCastByDeBruijnInterp | 0m00.43s || -0m00.01s 0m00.42s | Util/ZRange | 0m00.42s || +0m00.00s 0m00.42s | Reflection/Z/MapCastByDeBruijnInterp | 0m00.46s || -0m00.04s 0m00.41s | BoundedArithmetic/Double/Proofs/ShiftLeftRightTactic | 0m00.45s || -0m00.04s 0m00.41s | Reflection/Z/Bounds/MapCastByDeBruijn | 0m00.50s || -0m00.09s 0m00.40s | Reflection/Z/MapCastByDeBruijnWf | 0m00.50s || -0m00.09s 0m00.40s | Reflection/Z/InlineWf | 0m00.42s || -0m00.01s 0m00.40s | Reflection/Z/Bounds/Pipeline/OutputType | 0m00.38s || +0m00.02s 0m00.40s | ModularArithmetic/Pow2Base | 0m00.43s || -0m00.02s 0m00.40s | Reflection/Named/PositiveContext/DefaultsProperties | 0m00.52s || -0m00.12s 0m00.40s | Reflection/MapCastByDeBruijn | 0m00.39s || +0m00.01s 0m00.39s | Reflection/Z/Bounds/Pipeline/Glue | 0m00.46s || -0m00.07s 0m00.39s | Reflection/Named/PositiveContext/Defaults | 0m00.40s || -0m00.01s 0m00.39s | Reflection/Named/ContextDefinitions | 0m00.37s || +0m00.02s 0m00.38s | Reflection/Z/FoldTypes | 0m00.38s || +0m00.00s 0m00.38s | Reflection/Z/HexNotationConstants | 0m00.42s || -0m00.03s 0m00.38s | Reflection/Z/OpInversion | 0m00.37s || +0m00.01s 0m00.38s | ModularArithmetic/ModularBaseSystemListZOperations | 0m00.41s || -0m00.02s 0m00.38s | Reflection/Named/EstablishLiveness | 0m00.38s || +0m00.00s 0m00.38s | Reflection/Named/RegisterAssign | 0m00.38s || +0m00.00s 0m00.38s | Reflection/Reify | 0m00.40s || -0m00.02s 0m00.37s | ModularArithmetic/ModularBaseSystemWord | 0m00.38s || -0m00.01s 0m00.36s | Reflection/Named/InterpretToPHOAS | 0m00.45s || -0m00.09s 0m00.36s | Reflection/Named/Syntax | 0m00.35s || +0m00.01s 0m00.36s | BoundedArithmetic/Eta | 0m00.42s || -0m00.06s 0m00.35s | Reflection/Named/Compile | 0m00.34s || +0m00.00s 0m00.35s | Reflection/MapCastWf | 0m00.31s || +0m00.03s 0m00.35s | Reflection/Named/SmartMap | 0m00.36s || -0m00.01s 0m00.35s | Util/BoundedWord | 0m00.40s || -0m00.05s 0m00.35s | Spec/ModularArithmetic | 0m00.36s || -0m00.01s 0m00.34s | Reflection/Named/ContextOn | 0m00.34s || +0m00.00s 0m00.34s | Reflection/FilterLive | 0m00.32s || +0m00.02s 0m00.34s | Reflection/Named/MapCast | 0m00.37s || -0m00.02s 0m00.33s | Reflection/Named/PositiveContext | 0m00.39s || -0m00.06s 0m00.33s | Algebra/ScalarMult | 0m00.56s || -0m00.23s 0m00.32s | Reflection/Z/BinaryNotationConstants | 0m00.35s || -0m00.02s 0m00.32s | Reflection/Tuple | 0m00.38s || -0m00.06s 0m00.32s | Reflection/Named/ContextProperties/Tactics | 0m00.48s || -0m00.15s 0m00.32s | Reflection/Named/IdContext | 0m00.33s || -0m00.01s 0m00.31s | Reflection/Named/Wf | 0m00.38s || -0m00.07s 0m00.30s | Reflection/MultiSizeTest2 | 0m00.34s || -0m00.04s 0m00.29s | Reflection/ExprInversion | 0m00.26s || +0m00.02s 0m00.29s | Spec/MxDH | 0m00.43s || -0m00.14s 0m00.26s | Algebra/Monoid | 0m00.51s || -0m00.25s 0m00.26s | Util/Sum | 0m00.34s || -0m00.08s 0m00.24s | Algebra | 0m00.43s || -0m00.19s 0m00.23s | Reflection/Equality | 0m00.25s || -0m00.01s 0m00.22s | Reflection/CommonSubexpressionElimination | 0m00.17s || +0m00.04s 0m00.21s | Reflection/SmartMap | 0m00.23s || -0m00.02s 0m00.20s | Reflection/EtaInterp | 0m00.22s || -0m00.01s 0m00.20s | Reflection/BoundByCastWf | 0m00.12s || +0m00.08s 0m00.20s | Reflection/LinearizeInterp | 0m00.23s || -0m00.03s 0m00.18s | Util/LetInMonad | 0m00.19s || -0m00.01s 0m00.16s | Reflection/InterpProofs | 0m00.18s || -0m00.01s 0m00.13s | Util/Option | 0m00.14s || -0m00.01s 0m00.13s | Reflection/Wf | 0m00.12s || +0m00.01s 0m00.12s | Reflection/RewriterWf | 0m00.19s || -0m00.07s 0m00.08s | Reflection/Conversion | 0m00.08s || +0m00.00s 0m00.08s | Reflection/Named/NameUtil | 0m00.12s || -0m00.03s 0m00.07s | Reflection/Inline | 0m00.04s || +0m00.03s 0m00.06s | Reflection/TypeInversion | 0m00.08s || -0m00.02s 0m00.06s | Reflection/SmartBound | 0m00.06s || +0m00.00s 0m00.06s | Reflection/InlineCast | 0m00.06s || +0m00.00s 0m00.06s | Util/Tactics | 0m00.07s || -0m00.01s 0m00.06s | Reflection/RewriterInterp | 0m00.05s || +0m00.00s 0m00.06s | Reflection/MapCast | 0m00.06s || +0m00.00s 0m00.05s | Reflection/TypeUtil | 0m00.04s || +0m00.01s 0m00.04s | Reflection/Syntax | 0m00.09s || -0m00.05s 0m00.04s | Reflection/FoldTypes | 0m00.05s || -0m00.01s 0m00.04s | Reflection/Linearize | 0m00.04s || +0m00.00s 0m00.04s | Reflection/Rewriter | 0m00.03s || +0m00.01s 0m00.04s | Reflection/Map | 0m00.04s || +0m00.00s 0m00.04s | Util/Tactics/OnSubterms | N/A || +0m00.04s 0m00.04s | Reflection/CountLets | 0m00.04s || +0m00.00s 0m00.04s | Reflection/SmartCast | 0m00.04s || +0m00.00s 0m00.04s | Util/LetIn | 0m00.07s || -0m00.03s 0m00.04s | Reflection/Eta | 0m00.05s || -0m00.01s 0m00.04s | Reflection/BoundByCast | 0m00.06s || -0m00.01s 0m00.03s | Reflection/SmartCastInterp | 0m00.05s || -0m00.02s 0m00.03s | Util/Tactics/SubstEvars | N/A || +0m00.03s 0m00.03s | Reflection/InterpByIso | 0m00.04s || -0m00.01s 0m00.03s | Util/Tactics/Forward | N/A || +0m00.03s 0m00.03s | Util/Tactics/BreakMatch | 0m00.02s || +0m00.00s 0m00.03s | Reflection/RenameBinders | 0m00.03s || +0m00.00s 0m00.03s | Util/Tactics/ConvoyDestruct | N/A || +0m00.03s 0m00.02s | Util/Tactics/SideConditionsBeforeToAfter | N/A || +0m00.02s 0m00.02s | Util/Tactics/Revert | N/A || +0m00.02s 0m00.02s | Util/Tactics/Test | N/A || +0m00.02s 0m00.02s | Util/Tactics/SetEvars | N/A || +0m00.02s 0m00.02s | Util/Tactics/SetoidSubst | N/A || +0m00.02s 0m00.02s | Util/Tactics/DestructTrivial | N/A || +0m00.02s 0m00.02s | Util/Tactics/ESpecialize | N/A || +0m00.02s 0m00.02s | Util/Tactics/SimplifyProjections | N/A || +0m00.02s 0m00.02s | Util/Tactics/Not | N/A || +0m00.02s 0m00.02s | Util/Tactics/Contains | N/A || +0m00.02s 0m00.02s | Util/Tactics/SimplifyRepeatedIfs | N/A || +0m00.02s 0m00.02s | Util/Tactics/ClearDuplicates | N/A || +0m00.02s 0m00.02s | Util/Tactics/DebugPrint | N/A || +0m00.02s 0m00.01s | Util/Tactics/GetGoal | N/A || +0m00.01s --- _CoqProject | 18 ++ src/Algebra.v | 10 +- src/Algebra/Field.v | 10 +- src/Algebra/Group.v | 4 +- src/Algebra/IntegralDomain.v | 11 +- src/Algebra/Monoid.v | 4 +- src/Algebra/Ring.v | 13 +- src/BoundedArithmetic/ArchitectureToZLikeProofs.v | 3 +- src/BoundedArithmetic/Double/Proofs/BitwiseOr.v | 2 +- src/BoundedArithmetic/Double/Proofs/Multiply.v | 2 +- .../Double/Proofs/RippleCarryAddSub.v | 3 +- src/BoundedArithmetic/Double/Proofs/ShiftLeft.v | 2 +- .../Double/Proofs/ShiftLeftRightTactic.v | 3 +- src/BoundedArithmetic/Double/Proofs/ShiftRight.v | 2 +- .../Double/Proofs/ShiftRightDoubleWordImmediate.v | 2 +- .../Double/Proofs/SpreadLeftImmediate.v | 3 +- src/BoundedArithmetic/X86ToZLikeProofs.v | 3 +- .../CompleteEdwardsCurveTheorems.v | 18 +- src/CompleteEdwardsCurve/EdwardsMontgomery.v | 2 +- src/CompleteEdwardsCurve/ExtendedCoordinates.v | 6 +- src/CompleteEdwardsCurve/Pre.v | 2 +- src/EdDSARepChange.v | 6 +- src/Encoding/ModularWordEncodingTheorems.v | 2 +- src/Experiments/GenericFieldPow.v | 3 +- src/ModularArithmetic/BarrettReduction/Z.v | 3 +- src/ModularArithmetic/BarrettReduction/ZBounded.v | 2 +- .../BarrettReduction/ZGeneralized.v | 2 +- src/ModularArithmetic/BarrettReduction/ZHandbook.v | 2 +- src/ModularArithmetic/Conversion.v | 9 +- .../ModularBaseSystemListProofs.v | 3 +- .../ModularBaseSystemListZOperationsProofs.v | 1 + src/ModularArithmetic/ModularBaseSystemProofs.v | 33 +- src/ModularArithmetic/Montgomery/ZBounded.v | 3 +- src/ModularArithmetic/Montgomery/ZProofs.v | 4 +- src/ModularArithmetic/Pow2BaseProofs.v | 5 +- src/ModularArithmetic/PrimeFieldTheorems.v | 4 +- src/ModularArithmetic/ZBounded.v | 2 +- src/ModularArithmetic/ZBoundedZ.v | 2 +- src/MontgomeryCurveTheorems.v | 5 +- src/MontgomeryX.v | 2 +- src/MxDHRepChange.v | 4 +- src/NewBaseSystem.v | 16 +- src/Reflection/CommonSubexpressionElimination.v | 2 +- src/Reflection/Conversion.v | 3 +- src/Reflection/InputSyntax.v | 2 +- src/Reflection/InterpProofs.v | 3 +- src/Reflection/InterpWf.v | 4 +- src/Reflection/InterpWfRel.v | 2 +- src/Reflection/Linearize.v | 2 +- src/Reflection/LinearizeInterp.v | 4 +- src/Reflection/LinearizeWf.v | 2 +- src/Reflection/Named/Syntax.v | 2 +- src/Reflection/Reify.v | 3 +- src/Reflection/Relations.v | 4 +- src/Reflection/WfInversion.v | 3 +- src/Reflection/WfProofs.v | 5 +- src/Reflection/WfReflective.v | 4 +- src/Reflection/WfReflectiveGen.v | 3 +- src/SaturatedBaseSystem.v | 25 +- src/Spec/MontgomeryCurve.v | 4 +- src/Specific/FancyMachine256/Core.v | 1 + src/Specific/GF25519.v | 4 +- src/Specific/NewBaseSystemTest.v | 2 +- src/Specific/SC25519.v | 2 +- src/SpecificGen/GFtemplate3mod4 | 2 +- src/SpecificGen/GFtemplate5mod8 | 2 +- src/Testbit.v | 3 +- src/Util/CPSUtil.v | 10 +- src/Util/Decidable.v | 1 - src/Util/IterAssocOp.v | 3 +- src/Util/LetIn.v | 2 +- src/Util/Option.v | 10 +- src/Util/Tactics.v | 333 ++------------------- src/Util/Tactics/BreakMatch.v | 6 + src/Util/Tactics/ClearDuplicates.v | 6 + src/Util/Tactics/Contains.v | 13 + src/Util/Tactics/ConvoyDestruct.v | 33 ++ src/Util/Tactics/DebugPrint.v | 40 +++ src/Util/Tactics/DestructTrivial.v | 6 + src/Util/Tactics/ESpecialize.v | 2 + src/Util/Tactics/Forward.v | 22 ++ src/Util/Tactics/GetGoal.v | 2 + src/Util/Tactics/Not.v | 4 + src/Util/Tactics/OnSubterms.v | 6 + src/Util/Tactics/Revert.v | 13 + src/Util/Tactics/SetEvars.v | 4 + src/Util/Tactics/SetoidSubst.v | 35 +++ src/Util/Tactics/SideConditionsBeforeToAfter.v | 22 ++ src/Util/Tactics/SimplifyProjections.v | 32 ++ src/Util/Tactics/SimplifyRepeatedIfs.v | 16 + src/Util/Tactics/SubstEvars.v | 4 + src/Util/Tactics/Test.v | 3 + src/Util/WordUtil.v | 4 +- src/Util/ZUtil.v | 23 +- src/WeierstrassCurve/Pre.v | 3 +- src/WeierstrassCurve/Projective.v | 8 +- 96 files changed, 526 insertions(+), 469 deletions(-) create mode 100644 src/Util/Tactics/ClearDuplicates.v create mode 100644 src/Util/Tactics/Contains.v create mode 100644 src/Util/Tactics/ConvoyDestruct.v create mode 100644 src/Util/Tactics/DebugPrint.v create mode 100644 src/Util/Tactics/DestructTrivial.v create mode 100644 src/Util/Tactics/ESpecialize.v create mode 100644 src/Util/Tactics/Forward.v create mode 100644 src/Util/Tactics/GetGoal.v create mode 100644 src/Util/Tactics/Not.v create mode 100644 src/Util/Tactics/OnSubterms.v create mode 100644 src/Util/Tactics/Revert.v create mode 100644 src/Util/Tactics/SetEvars.v create mode 100644 src/Util/Tactics/SetoidSubst.v create mode 100644 src/Util/Tactics/SideConditionsBeforeToAfter.v create mode 100644 src/Util/Tactics/SimplifyProjections.v create mode 100644 src/Util/Tactics/SimplifyRepeatedIfs.v create mode 100644 src/Util/Tactics/SubstEvars.v create mode 100644 src/Util/Tactics/Test.v diff --git a/_CoqProject b/_CoqProject index 3bba84956..942930051 100644 --- a/_CoqProject +++ b/_CoqProject @@ -286,16 +286,34 @@ src/Util/ZUtil.v src/Util/Sigma/Associativity.v src/Util/Sigma/Lift.v src/Util/Tactics/BreakMatch.v +src/Util/Tactics/ClearDuplicates.v +src/Util/Tactics/Contains.v +src/Util/Tactics/ConvoyDestruct.v +src/Util/Tactics/DebugPrint.v src/Util/Tactics/DestructHead.v src/Util/Tactics/DestructHyps.v +src/Util/Tactics/DestructTrivial.v src/Util/Tactics/DoWithHyp.v +src/Util/Tactics/ESpecialize.v src/Util/Tactics/ETransitivity.v src/Util/Tactics/EvarExists.v +src/Util/Tactics/Forward.v +src/Util/Tactics/GetGoal.v src/Util/Tactics/Head.v +src/Util/Tactics/Not.v +src/Util/Tactics/OnSubterms.v +src/Util/Tactics/Revert.v src/Util/Tactics/RewriteHyp.v +src/Util/Tactics/SetEvars.v +src/Util/Tactics/SetoidSubst.v +src/Util/Tactics/SideConditionsBeforeToAfter.v +src/Util/Tactics/SimplifyProjections.v +src/Util/Tactics/SimplifyRepeatedIfs.v src/Util/Tactics/SpecializeBy.v src/Util/Tactics/SplitInContext.v +src/Util/Tactics/SubstEvars.v src/Util/Tactics/SubstLet.v +src/Util/Tactics/Test.v src/Util/Tactics/UnifyAbstractReflexivity.v src/Util/Tactics/UniquePose.v src/Util/Tactics/VM.v diff --git a/src/Algebra.v b/src/Algebra.v index 02ad4731f..7f1310957 100644 --- a/src/Algebra.v +++ b/src/Algebra.v @@ -1,13 +1,11 @@ Require Export Crypto.Util.FixCoqMistakes. Require Export Crypto.Util.Decidable. -Require Import Coq.Classes.Morphisms. Require Coq.Setoids.Setoid. -Require Import Crypto.Util.Tactics. -Require Import Crypto.Util.Notations. +Require Coq.PArith.BinPos. +Require Import Coq.Classes.Morphisms. -Require Coq.setoid_ring.Field_theory. -Require Crypto.Tactics.Algebra_syntax.Nsatz. Require Coq.Numbers.Natural.Peano.NPeano. +Require Coq.Lists.List. Local Close Scope nat_scope. Local Close Scope type_scope. Local Close Scope core_scope. @@ -153,4 +151,4 @@ Section ZeroNeqOne. Proof. intro HH; symmetry in HH. auto using zero_neq_one. Qed. -End ZeroNeqOne. \ No newline at end of file +End ZeroNeqOne. diff --git a/src/Algebra/Field.v b/src/Algebra/Field.v index ebc92c0e5..f35e2c1cc 100644 --- a/src/Algebra/Field.v +++ b/src/Algebra/Field.v @@ -1,4 +1,6 @@ -Require Import Crypto.Util.Relations Crypto.Util.Tactics Crypto.Util.Notations. +Require Import Crypto.Util.Relations Crypto.Util.Notations. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.DebugPrint. Require Import Coq.Classes.RelationClasses Coq.Classes.Morphisms. Require Import Crypto.Algebra Crypto.Algebra.Ring Crypto.Algebra.IntegralDomain. Require Coq.setoid_ring.Field_theory. @@ -243,7 +245,7 @@ Ltac inequalities_to_inverse_equations fld := unique pose proof (right_multiplicative_inverse(H:=fld) _ H) | not (eq zero ?d) => unique pose proof (right_multiplicative_inverse(H:=fld) _ (symmetry(R:=fun a b => not (eq a b)) H)) - | not (eq ?x ?y) => + | not (eq ?x ?y) => unique pose proof (right_multiplicative_inverse(H:=fld) _ (Ring.neq_sub_neq_zero _ _ H)) end end. @@ -261,7 +263,7 @@ Ltac inverses_to_conditional_equations fld := repeat match goal with | |- context[inv ?d] => unique_pose_implication constr:(right_multiplicative_inverse(H:=fld) d) - | H: context[inv ?d] |- _ => + | H: context[inv ?d] |- _ => unique_pose_implication constr:(right_multiplicative_inverse(H:=fld) d) end. @@ -324,4 +326,4 @@ Section FieldSquareRoot. eapply zero_product_zero_factor. fsatz. Qed. -End FieldSquareRoot. \ No newline at end of file +End FieldSquareRoot. diff --git a/src/Algebra/Group.v b/src/Algebra/Group.v index c1c514171..b053fc844 100644 --- a/src/Algebra/Group.v +++ b/src/Algebra/Group.v @@ -1,4 +1,4 @@ -Require Import Coq.Classes.Morphisms Crypto.Util.Relations Crypto.Util.Tactics. +Require Import Coq.Classes.Morphisms Crypto.Util.Relations (*Crypto.Util.Tactics*). Require Import Crypto.Algebra Crypto.Algebra.Monoid Crypto.Algebra.ScalarMult. Section BasicProperties. @@ -213,4 +213,4 @@ Section HomomorphismComposition. Global Instance is_homomorphism_compose_refl : @Monoid.is_homomorphism G EQ OP K eqK opK (fun x => phi' (phi x)) := is_homomorphism_compose (fun x => reflexivity _). -End HomomorphismComposition. \ No newline at end of file +End HomomorphismComposition. diff --git a/src/Algebra/IntegralDomain.v b/src/Algebra/IntegralDomain.v index f58874710..083c10242 100644 --- a/src/Algebra/IntegralDomain.v +++ b/src/Algebra/IntegralDomain.v @@ -1,6 +1,9 @@ -Require Import Crypto.Util.Tactics Crypto.Util.Relations. +Require Coq.setoid_ring.Integral_domain. +Require Crypto.Tactics.Algebra_syntax.Nsatz. Require Import Crypto.Util.Factorize. Require Import Crypto.Algebra Crypto.Algebra.Ring. +Require Import Crypto.Util.Tactics.RewriteHyp. +Require Import Crypto.Util.Tactics.BreakMatch. Module IntegralDomain. Section IntegralDomain. @@ -25,7 +28,7 @@ Module IntegralDomain. Local Infix "=" := eq. Local Notation "a <> b" := (not (a = b)). Local Infix "=" := eq : type_scope. Local Notation "a <> b" := (not (a = b)) : type_scope. Local Infix "+" := add. Local Infix "-" := sub. Local Infix "*" := mul. - + Inductive coef := | Coef_one | Coef_opp (_:coef) @@ -62,7 +65,7 @@ Module IntegralDomain. Section WithChar. Context C (char_ge_C:@Ring.char_ge R eq zero one opp add sub mul C) (HC: Pos.lt xH C). - + Definition is_factor_nonzero (n:N) : bool := match n with N0 => false | N.pos p => BinPos.Pos.ltb p C end. Lemma is_factor_nonzero_correct (n:N) (refl:Logic.eq (is_factor_nonzero n) true) @@ -79,7 +82,7 @@ Module IntegralDomain. { rewrite Znat.N2Z.inj_mul; Ring.push_homomorphism of_Z. eapply Ring.nonzero_product_iff_nonzero_factor; eauto. } Qed. - + Definition is_constant_nonzero (z:Z) : bool := match factorize_or_fail (Z.abs_N z) with | Some factors => List.forallb is_factor_nonzero factors diff --git a/src/Algebra/Monoid.v b/src/Algebra/Monoid.v index f71efff3e..565058cf7 100644 --- a/src/Algebra/Monoid.v +++ b/src/Algebra/Monoid.v @@ -1,5 +1,5 @@ Require Import Coq.Classes.Morphisms. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.RewriteHyp. Require Import Crypto.Algebra. Section Monoid. @@ -57,4 +57,4 @@ Section Homomorphism. is_homomorphism_phi_proper : Proper (respectful EQ eq) phi }. Global Existing Instance is_homomorphism_phi_proper. -End Homomorphism. \ No newline at end of file +End Homomorphism. diff --git a/src/Algebra/Ring.v b/src/Algebra/Ring.v index 5c1cb1603..2b0e1ba80 100644 --- a/src/Algebra/Ring.v +++ b/src/Algebra/Ring.v @@ -1,8 +1,13 @@ +Require Coq.setoid_ring.Ncring. +Require Coq.setoid_ring.Cring. Require Import Coq.Classes.Morphisms. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.OnSubterms. +Require Import Crypto.Util.Tactics.Revert. Require Import Crypto.Algebra Crypto.Algebra.Group Crypto.Algebra.Monoid. Require Coq.ZArith.ZArith Coq.PArith.PArith. + Section Ring. Context {T eq zero one opp add sub mul} `{@ring T eq zero one opp add sub mul}. Local Infix "=" := eq : type_scope. Local Notation "a <> b" := (not (a = b)) : type_scope. @@ -86,10 +91,6 @@ Section Ring. forall x y : T, not (eq (mul x y) zero) <-> (not (eq x zero) /\ not (eq y zero)). Proof. intros; rewrite zero_product_iff_zero_factor; tauto. Qed. - Lemma nonzero_hypothesis_to_goal {Hzpzf:@is_zero_product_zero_factor T eq zero mul} : - forall x y : T, (not (eq x zero) -> eq y zero) <-> (eq (mul x y) zero). - Proof. intros; rewrite zero_product_iff_zero_factor; tauto. Qed. - Global Instance Ncring_Ring_ops : @Ncring.Ring_ops T zero one add mul sub opp eq. Global Instance Ncring_Ring : @Ncring.Ring T zero one add mul sub opp eq Ncring_Ring_ops. Proof. @@ -434,4 +435,4 @@ Create HintDb ring_simplify_subterms discriminated. Create HintDb ring_simplify_subterms_in_all discriminated. Hint Extern 1 => progress ring_simplify : ring_simplify. Hint Extern 1 => progress ring_simplify_subterms : ring_simplify_subterms. -Hint Extern 1 => progress ring_simplify_subterms_in_all : ring_simplify_subterms_in_all. \ No newline at end of file +Hint Extern 1 => progress ring_simplify_subterms_in_all : ring_simplify_subterms_in_all. diff --git a/src/BoundedArithmetic/ArchitectureToZLikeProofs.v b/src/BoundedArithmetic/ArchitectureToZLikeProofs.v index a816d8ebd..e08624274 100644 --- a/src/BoundedArithmetic/ArchitectureToZLikeProofs.v +++ b/src/BoundedArithmetic/ArchitectureToZLikeProofs.v @@ -8,7 +8,8 @@ Require Import Crypto.BoundedArithmetic.Double.Proofs.Multiply. Require Import Crypto.BoundedArithmetic.ArchitectureToZLike. Require Import Crypto.ModularArithmetic.ZBounded. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.ZUtil Crypto.Util.Tactics. +Require Import Crypto.Util.ZUtil. +Require Import Crypto.Util.Tactics.UniquePose. Require Import Crypto.Util.LetIn. Local Open Scope nat_scope. diff --git a/src/BoundedArithmetic/Double/Proofs/BitwiseOr.v b/src/BoundedArithmetic/Double/Proofs/BitwiseOr.v index 3a3748546..048b83887 100644 --- a/src/BoundedArithmetic/Double/Proofs/BitwiseOr.v +++ b/src/BoundedArithmetic/Double/Proofs/BitwiseOr.v @@ -3,7 +3,7 @@ Require Import Crypto.BoundedArithmetic.Interface. Require Import Crypto.BoundedArithmetic.Double.Core. Require Import Crypto.BoundedArithmetic.Double.Proofs.Decode. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. Local Open Scope Z_scope. diff --git a/src/BoundedArithmetic/Double/Proofs/Multiply.v b/src/BoundedArithmetic/Double/Proofs/Multiply.v index a8de1f705..bb09f8b2b 100644 --- a/src/BoundedArithmetic/Double/Proofs/Multiply.v +++ b/src/BoundedArithmetic/Double/Proofs/Multiply.v @@ -6,7 +6,7 @@ Require Import Crypto.BoundedArithmetic.Double.Proofs.Decode. Require Import Crypto.BoundedArithmetic.Double.Proofs.SpreadLeftImmediate. Require Import Crypto.BoundedArithmetic.Double.Proofs.RippleCarryAddSub. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.SimplifyProjections. Require Import Crypto.Util.Notations. Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Prod. diff --git a/src/BoundedArithmetic/Double/Proofs/RippleCarryAddSub.v b/src/BoundedArithmetic/Double/Proofs/RippleCarryAddSub.v index c2b87d5a4..672a62685 100644 --- a/src/BoundedArithmetic/Double/Proofs/RippleCarryAddSub.v +++ b/src/BoundedArithmetic/Double/Proofs/RippleCarryAddSub.v @@ -5,7 +5,8 @@ Require Import Crypto.BoundedArithmetic.Double.Core. Require Import Crypto.BoundedArithmetic.Double.Proofs.Decode. Require Import Crypto.Util.Tuple. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SimplifyProjections. Require Import Crypto.Util.Notations. Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Prod. diff --git a/src/BoundedArithmetic/Double/Proofs/ShiftLeft.v b/src/BoundedArithmetic/Double/Proofs/ShiftLeft.v index c1f9b7968..193dc59bf 100644 --- a/src/BoundedArithmetic/Double/Proofs/ShiftLeft.v +++ b/src/BoundedArithmetic/Double/Proofs/ShiftLeft.v @@ -4,7 +4,7 @@ Require Import Crypto.BoundedArithmetic.Double.Core. Require Import Crypto.BoundedArithmetic.Double.Proofs.Decode. Require Import Crypto.BoundedArithmetic.Double.Proofs.ShiftLeftRightTactic. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Local Open Scope Z_scope. diff --git a/src/BoundedArithmetic/Double/Proofs/ShiftLeftRightTactic.v b/src/BoundedArithmetic/Double/Proofs/ShiftLeftRightTactic.v index 44b4eb36d..997fb1937 100644 --- a/src/BoundedArithmetic/Double/Proofs/ShiftLeftRightTactic.v +++ b/src/BoundedArithmetic/Double/Proofs/ShiftLeftRightTactic.v @@ -1,7 +1,8 @@ Require Import Coq.ZArith.ZArith. Require Import Crypto.BoundedArithmetic.Interface. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.BreakMatch. Local Open Scope Z_scope. diff --git a/src/BoundedArithmetic/Double/Proofs/ShiftRight.v b/src/BoundedArithmetic/Double/Proofs/ShiftRight.v index aed7093e6..dde19595e 100644 --- a/src/BoundedArithmetic/Double/Proofs/ShiftRight.v +++ b/src/BoundedArithmetic/Double/Proofs/ShiftRight.v @@ -4,7 +4,7 @@ Require Import Crypto.BoundedArithmetic.Double.Core. Require Import Crypto.BoundedArithmetic.Double.Proofs.Decode. Require Import Crypto.BoundedArithmetic.Double.Proofs.ShiftLeftRightTactic. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Local Open Scope Z_scope. diff --git a/src/BoundedArithmetic/Double/Proofs/ShiftRightDoubleWordImmediate.v b/src/BoundedArithmetic/Double/Proofs/ShiftRightDoubleWordImmediate.v index 8e9506de8..dce9940d5 100644 --- a/src/BoundedArithmetic/Double/Proofs/ShiftRightDoubleWordImmediate.v +++ b/src/BoundedArithmetic/Double/Proofs/ShiftRightDoubleWordImmediate.v @@ -4,7 +4,7 @@ Require Import Crypto.BoundedArithmetic.Double.Core. Require Import Crypto.BoundedArithmetic.Double.Proofs.Decode. Require Import Crypto.BoundedArithmetic.Double.Proofs.ShiftLeftRightTactic. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Local Open Scope Z_scope. diff --git a/src/BoundedArithmetic/Double/Proofs/SpreadLeftImmediate.v b/src/BoundedArithmetic/Double/Proofs/SpreadLeftImmediate.v index 564b29f5f..f2061bafe 100644 --- a/src/BoundedArithmetic/Double/Proofs/SpreadLeftImmediate.v +++ b/src/BoundedArithmetic/Double/Proofs/SpreadLeftImmediate.v @@ -4,7 +4,8 @@ Require Import Crypto.BoundedArithmetic.InterfaceProofs. Require Import Crypto.BoundedArithmetic.Double.Core. Require Import Crypto.BoundedArithmetic.Double.Proofs.Decode. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Import Crypto.Util.Notations. Require Import Crypto.Util.LetIn. Import Bug5107WorkAround. diff --git a/src/BoundedArithmetic/X86ToZLikeProofs.v b/src/BoundedArithmetic/X86ToZLikeProofs.v index 58d2bbfff..530c91dc9 100644 --- a/src/BoundedArithmetic/X86ToZLikeProofs.v +++ b/src/BoundedArithmetic/X86ToZLikeProofs.v @@ -14,7 +14,8 @@ Require Import Crypto.BoundedArithmetic.StripCF. Require Import Crypto.BoundedArithmetic.X86ToZLike. Require Import Crypto.ModularArithmetic.ZBounded. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.ZUtil Crypto.Util.Tactics. +Require Import Crypto.Util.ZUtil. +Require Import Crypto.Util.Tactics.UniquePose. Require Import Crypto.Util.LetIn. Import NPeano. diff --git a/src/CompleteEdwardsCurve/CompleteEdwardsCurveTheorems.v b/src/CompleteEdwardsCurve/CompleteEdwardsCurveTheorems.v index 996c5d672..e3496775f 100644 --- a/src/CompleteEdwardsCurve/CompleteEdwardsCurveTheorems.v +++ b/src/CompleteEdwardsCurve/CompleteEdwardsCurveTheorems.v @@ -6,7 +6,11 @@ Require Import Coq.Logic.Eqdep_dec. Require Import Crypto.Tactics.VerdiTactics. Require Import Coq.Classes.Morphisms. Require Import Coq.Relations.Relation_Definitions. -Require Import Crypto.Util.Tuple Crypto.Util.Notations Crypto.Util.Tactics. +Require Import Crypto.Util.Tuple Crypto.Util.Notations. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SetoidSubst. Require Export Crypto.Util.FixCoqMistakes. Module E. @@ -33,7 +37,7 @@ Module E. {nonzero_a : a <> 0} {square_a : exists sqrt_a, sqrt_a^2 = a} {nonsquare_d : forall x, x^2 <> d}. - + Local Notation onCurve x y := (a*x^2 + y^2 = 1 + d*x^2*y^2) (only parsing). Local Notation point := (@E.point F Feq Fone Fadd Fmul a d). Local Notation eq := (@E.eq F Feq Fone Fadd Fmul a d). @@ -50,7 +54,7 @@ Module E. | _ => intro | |- Equivalence _ => split | |- abelian_group => split | |- group => split | |- monoid => split - | |- is_associative => split | |- is_commutative => split + | |- is_associative => split | |- is_commutative => split | |- is_left_inverse => split | |- is_right_inverse => split | |- is_left_identity => split | |- is_right_identity => split | _ => progress destruct_head' @E.point @@ -175,7 +179,7 @@ Module E. | _ => solve [trivial | eapply solve_correct; fsatz] end. Local Ltac t := repeat t_step. - + Program Definition decompress (b:bool*F) : option point := exist_option _ match b return option (F*F) with @@ -219,7 +223,7 @@ Module E. {nonzero_a : not (Feq Fa Fzero)} {square_a : exists sqrt_a, Feq (Fmul sqrt_a sqrt_a) Fa} {nonsquare_d : forall x, not (Feq (Fmul x x) Fd)}. - + Context {K Keq Kzero Kone Kopp Kadd Ksub Kmul Kinv Kdiv} {fieldK: @Algebra.field K Keq Kzero Kone Kopp Kadd Ksub Kmul Kinv Kdiv} {Keq_dec:DecidableRel Keq}. @@ -264,7 +268,7 @@ Module E. etransitivity; [|eexact X]; clear X. (* TODO: Ring.of_Z of isomorphism *) Admitted. - + Local Notation Fpoint := (@E.point F Feq Fone Fadd Fmul Fa Fd). Local Notation Kpoint := (@E.point K Keq Kone Kadd Kmul Ka Kd). Local Notation FzeroP := (E.zero(nonzero_a:=nonzero_a)(d:=Fd)). @@ -311,4 +315,4 @@ Module E. end. Qed. End Homomorphism. -End E. \ No newline at end of file +End E. diff --git a/src/CompleteEdwardsCurve/EdwardsMontgomery.v b/src/CompleteEdwardsCurve/EdwardsMontgomery.v index 2a987735d..c02e833ac 100644 --- a/src/CompleteEdwardsCurve/EdwardsMontgomery.v +++ b/src/CompleteEdwardsCurve/EdwardsMontgomery.v @@ -2,7 +2,7 @@ Require Import Crypto.CompleteEdwardsCurve.CompleteEdwardsCurveTheorems. Require Import Crypto.Spec.MontgomeryCurve Crypto.MontgomeryCurveTheorems. Require Import Crypto.Util.Notations Crypto.Util.Decidable. -Require Import Crypto.Util.Tactics Crypto.Util.Sum Crypto.Util.Prod. +Require Import (*Crypto.Util.Tactics*) Crypto.Util.Sum Crypto.Util.Prod. Require Import Crypto.Algebra Crypto.Algebra.Field. Module E. diff --git a/src/CompleteEdwardsCurve/ExtendedCoordinates.v b/src/CompleteEdwardsCurve/ExtendedCoordinates.v index ad0d79c52..2545a57d4 100644 --- a/src/CompleteEdwardsCurve/ExtendedCoordinates.v +++ b/src/CompleteEdwardsCurve/ExtendedCoordinates.v @@ -4,7 +4,9 @@ Require Import Crypto.Spec.CompleteEdwardsCurve Crypto.CompleteEdwardsCurve.Comp Require Import Crypto.Algebra Crypto.Algebra. Require Import Crypto.Util.Notations Crypto.Util.GlobalSettings. -Require Export Crypto.Util.FixCoqMistakes Crypto.Util.Tactics. +Require Export Crypto.Util.FixCoqMistakes. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.UniquePose. Module Extended. Section ExtendedCoordinates. @@ -61,7 +63,7 @@ Module Extended. Global Instance Proper_from_twisted : Proper (E.eq==>eq) from_twisted. Proof. cbv [from_twisted]; t. Qed. - Program Definition to_twisted (P:point) : Epoint := + Program Definition to_twisted (P:point) : Epoint := let XYZT := coordinates P in let T := snd XYZT in let XYZ := fst XYZT in let Z := snd XYZ in let XY := fst XYZ in let Y := snd XY in diff --git a/src/CompleteEdwardsCurve/Pre.v b/src/CompleteEdwardsCurve/Pre.v index 32eae2334..96d2ebfb3 100644 --- a/src/CompleteEdwardsCurve/Pre.v +++ b/src/CompleteEdwardsCurve/Pre.v @@ -1,6 +1,6 @@ Require Import Coq.Classes.Morphisms. Require Coq.Setoids.Setoid Crypto.Util.Relations. Require Import Crypto.Algebra Crypto.Algebra.Ring Crypto.Algebra.Field. -Require Import Crypto.Util.Notations Crypto.Util.Decidable Crypto.Util.Tactics. +Require Import Crypto.Util.Notations Crypto.Util.Decidable (*Crypto.Util.Tactics*). Require Import Coq.PArith.BinPos. Section Edwards. diff --git a/src/EdDSARepChange.v b/src/EdDSARepChange.v index e44b634f8..e52070249 100644 --- a/src/EdDSARepChange.v +++ b/src/EdDSARepChange.v @@ -2,7 +2,11 @@ Require Import Crypto.Util.FixCoqMistakes. Require Import Crypto.Spec.EdDSA Bedrock.Word. Require Import Coq.Classes.Morphisms Coq.Relations.Relation_Definitions. Require Import Crypto.Algebra. Import Monoid Group ScalarMult. -Require Import Crypto.Util.Decidable Crypto.Util.Option Crypto.Util.Tactics. +Require Import Crypto.Util.Decidable Crypto.Util.Option. +Require Import Crypto.Util.Tactics.SetEvars. +Require Import Crypto.Util.Tactics.SubstEvars. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Import Coq.omega.Omega. Require Import Crypto.Util.Notations. Require Import Crypto.Util.Option Crypto.Util.Logic Crypto.Util.Relations Crypto.Util.WordUtil Util.LetIn Util.NatUtil. diff --git a/src/Encoding/ModularWordEncodingTheorems.v b/src/Encoding/ModularWordEncodingTheorems.v index 66617ec29..dd36b3266 100644 --- a/src/Encoding/ModularWordEncodingTheorems.v +++ b/src/Encoding/ModularWordEncodingTheorems.v @@ -3,9 +3,9 @@ Require Import Coq.Numbers.Natural.Peano.NPeano. Require Import Crypto.CompleteEdwardsCurve.CompleteEdwardsCurveTheorems. Require Import Crypto.ModularArithmetic.PrimeFieldTheorems Crypto.ModularArithmetic.ModularArithmeticTheorems. Require Import Bedrock.Word. -Require Import Crypto.Tactics.VerdiTactics Crypto.Util.Tactics. Require Import Crypto.Spec.Encoding. Require Import Crypto.Util.ZUtil. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Import Crypto.Util.FixCoqMistakes. Require Import Crypto.Spec.ModularWordEncoding. diff --git a/src/Experiments/GenericFieldPow.v b/src/Experiments/GenericFieldPow.v index 2dce738a1..76d9cfa4f 100644 --- a/src/Experiments/GenericFieldPow.v +++ b/src/Experiments/GenericFieldPow.v @@ -1,11 +1,11 @@ Require Import Coq.setoid_ring.Cring. Require Import Coq.omega.Omega. Require Export Crypto.Util.FixCoqMistakes. +Require Import Crypto.Util.Tactics.UniquePose. (** TODO: Move some imports up here from below, if it doesn't break things *) Require Coq.setoid_ring.Field_theory Coq.setoid_ring.Field_tac. Require Coq.setoid_ring.Ring_theory Coq.setoid_ring.NArithRing. Require Coq.nsatz.Nsatz. -Require Crypto.Util.Tactics. Generalizable All Variables. @@ -130,7 +130,6 @@ Module F. try (exact I); try (idtac; []; clear H;intro H). - Import Util.Tactics. Inductive field_simplify_done {x y:F} : (x==y) -> Type := Field_simplify_done : forall (H:x==y), field_simplify_done H. Ltac field_nsatz := diff --git a/src/ModularArithmetic/BarrettReduction/Z.v b/src/ModularArithmetic/BarrettReduction/Z.v index 7ee51afaf..39f99c149 100644 --- a/src/ModularArithmetic/BarrettReduction/Z.v +++ b/src/ModularArithmetic/BarrettReduction/Z.v @@ -1,7 +1,8 @@ (*** Barrett Reduction *) (** This file implements Barrett Reduction on [Z]. We follow Wikipedia. *) Require Import Coq.ZArith.ZArith Coq.micromega.Psatz. -Require Import Crypto.Util.ZUtil Crypto.Util.Tactics. +Require Import Crypto.Util.ZUtil. +Require Import Crypto.Util.Tactics.BreakMatch. Local Open Scope Z_scope. diff --git a/src/ModularArithmetic/BarrettReduction/ZBounded.v b/src/ModularArithmetic/BarrettReduction/ZBounded.v index c9414fe01..60cd3df72 100644 --- a/src/ModularArithmetic/BarrettReduction/ZBounded.v +++ b/src/ModularArithmetic/BarrettReduction/ZBounded.v @@ -8,7 +8,7 @@ Require Import Crypto.ModularArithmetic.ExtendedBaseVector. Require Import Crypto.ModularArithmetic.ZBounded. Require Import Crypto.BaseSystem. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Require Import Crypto.Util.Notations. Local Open Scope small_zlike_scope. diff --git a/src/ModularArithmetic/BarrettReduction/ZGeneralized.v b/src/ModularArithmetic/BarrettReduction/ZGeneralized.v index f31eb5dd8..aad0cf112 100644 --- a/src/ModularArithmetic/BarrettReduction/ZGeneralized.v +++ b/src/ModularArithmetic/BarrettReduction/ZGeneralized.v @@ -9,7 +9,7 @@ base ([b]), exponent ([k]), and the [offset] than those given in the HAC. *) Require Import Coq.ZArith.ZArith Coq.micromega.Psatz. -Require Import Crypto.Util.ZUtil Crypto.Util.Tactics Crypto.Algebra. +Require Import Crypto.Util.ZUtil Crypto.Util.Tactics.BreakMatch Crypto.Algebra. Local Open Scope Z_scope. diff --git a/src/ModularArithmetic/BarrettReduction/ZHandbook.v b/src/ModularArithmetic/BarrettReduction/ZHandbook.v index 3fc1214eb..b0d6480d8 100644 --- a/src/ModularArithmetic/BarrettReduction/ZHandbook.v +++ b/src/ModularArithmetic/BarrettReduction/ZHandbook.v @@ -9,7 +9,7 @@ have to carry around extra precision), but requires more stringint conditions on the base ([b]), exponent ([k]), and the [offset]. *) Require Import Coq.ZArith.ZArith Coq.micromega.Psatz. -Require Import Crypto.Util.ZUtil Crypto.Util.Tactics Crypto.Algebra. +Require Import Crypto.Util.ZUtil Crypto.Util.Tactics.BreakMatch Crypto.Algebra. Local Open Scope Z_scope. diff --git a/src/ModularArithmetic/Conversion.v b/src/ModularArithmetic/Conversion.v index 4f28d7eec..0fb07e26b 100644 --- a/src/ModularArithmetic/Conversion.v +++ b/src/ModularArithmetic/Conversion.v @@ -4,7 +4,10 @@ Require Import Coq.Lists.List. Require Import Coq.funind.Recdef. Require Import Crypto.Util.ListUtil Crypto.Util.ZUtil Crypto.Util.NatUtil. Require Import Crypto.Tactics.VerdiTactics. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.SpecializeBy. +Require Import Crypto.Util.Tactics.SubstLet. +Require Import Crypto.Util.Tactics.Forward. Require Import Crypto.ModularArithmetic.Pow2Base. Require Import Crypto.ModularArithmetic.Pow2BaseProofs Crypto.BaseSystemProofs. Require Import Crypto.Util.Notations. @@ -298,7 +301,7 @@ Section Conversion. rewrite nth_default_zeros. split; zero_bounds. Qed. - + (* This is part of convert'_invariant, but proving it separately strips preconditions *) Lemma length_convert' : forall inp i out, length (convert' inp i out) = length out. @@ -312,4 +315,4 @@ Section Conversion. rewrite length_convert', length_zeros. reflexivity. Qed. -End Conversion. \ No newline at end of file +End Conversion. diff --git a/src/ModularArithmetic/ModularBaseSystemListProofs.v b/src/ModularArithmetic/ModularBaseSystemListProofs.v index 428239498..83db33dfe 100644 --- a/src/ModularArithmetic/ModularBaseSystemListProofs.v +++ b/src/ModularArithmetic/ModularBaseSystemListProofs.v @@ -11,7 +11,8 @@ Require Import Crypto.ModularArithmetic.ExtendedBaseVector. Require Import Crypto.ModularArithmetic.PrimeFieldTheorems. Require Import Crypto.ModularArithmetic.PseudoMersenneBaseParams. Require Import Crypto.ModularArithmetic.PseudoMersenneBaseParamProofs. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Import Crypto.Util.ListUtil. Require Import Crypto.Util.ZUtil. Require Import Crypto.Util.Notations. diff --git a/src/ModularArithmetic/ModularBaseSystemListZOperationsProofs.v b/src/ModularArithmetic/ModularBaseSystemListZOperationsProofs.v index 6163650e4..eb310f0f8 100644 --- a/src/ModularArithmetic/ModularBaseSystemListZOperationsProofs.v +++ b/src/ModularArithmetic/ModularBaseSystemListZOperationsProofs.v @@ -2,6 +2,7 @@ Require Import Coq.ZArith.ZArith. Require Import Crypto.ModularArithmetic.ModularBaseSystemListZOperations. Require Import Crypto.Util.Tuple. Require Import Crypto.Util.ZUtil. +Require Import Crypto.Util.Tactics.BreakMatch. Local Open Scope Z_scope. diff --git a/src/ModularArithmetic/ModularBaseSystemProofs.v b/src/ModularArithmetic/ModularBaseSystemProofs.v index 34a331fa1..57ae4e10d 100644 --- a/src/ModularArithmetic/ModularBaseSystemProofs.v +++ b/src/ModularArithmetic/ModularBaseSystemProofs.v @@ -1,7 +1,6 @@ Require Import Coq.ZArith.Zpower Coq.ZArith.ZArith. Require Import Coq.Numbers.Natural.Peano.NPeano. Require Import Coq.Lists.List. -Require Import Crypto.Tactics.VerdiTactics. Require Import Crypto.Algebra. Require Import Crypto.BaseSystem. Require Import Crypto.BaseSystemProofs. @@ -17,7 +16,9 @@ Require Import Crypto.ModularArithmetic.ModularBaseSystem. Require Import Crypto.Util.ListUtil Crypto.Util.CaseUtil Crypto.Util.ZUtil Crypto.Util.NatUtil. Require Import Crypto.Util.AdditionChainExponentiation. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Import Crypto.Util.Notations. Require Export Crypto.Util.FixCoqMistakes. Local Open Scope Z_scope. @@ -415,7 +416,7 @@ Section CarryProofs. distr_length. assert (0 < length limb_widths)%nat by (pose proof limb_widths_nonnil; destruct limb_widths; distr_length; congruence). - repeat break_if; repeat rewrite ?pred_mod, ?Nat.succ_pred,?Nat.mod_same in * by omega; + break_match; repeat rewrite ?pred_mod, ?Nat.succ_pred,?Nat.mod_same in * by omega; try omega. rewrite !nth_default_base by (auto || destruct (length limb_widths); auto). rewrite sum_firstn_0. @@ -449,7 +450,7 @@ Section CarryProofs. specialize_by eauto. cbv [ModularBaseSystemList.carry]. - break_if; subst; eauto. + break_match; subst; eauto. apply F.eq_of_Z_iff. rewrite to_list_from_list. apply carry_decode_eq_reduce. auto. @@ -584,7 +585,7 @@ Section CanonicalizationProofs. Proof. intros. cbv [carry]. - break_if. + break_innermost_match_step. + subst i. pose proof lt_1_length_limb_widths. autorewrite with push_nth_default natsimplify. @@ -624,16 +625,15 @@ Section CanonicalizationProofs. Proof. induction i; intros; cbv [carry_sequence]. + cbv [pred make_chain fold_right]. - repeat break_if; subst; omega || reflexivity || auto using Z.add_0_r. + break_match; subst; omega || reflexivity || auto using Z.add_0_r. apply nth_default_out_of_bounds. omega. + replace (make_chain (S i)) with (i :: make_chain i) by reflexivity. rewrite fold_right_cons. pose proof lt_1_length_limb_widths. autorewrite with push_nth_default natsimplify; rewrite ?Nat.pred_succ; fold (carry_sequence (make_chain i) us); - rewrite length_carry_sequence; auto. - repeat break_if; try omega; rewrite ?IHi by (omega || auto); - rewrite ?Z.add_0_r; try reflexivity. + rewrite length_carry_sequence; auto. + repeat (break_innermost_match_step; try omega). Qed. Lemma nth_default_carry : forall i us, @@ -665,7 +665,8 @@ Section CanonicalizationProofs. | |- _ => progress (intros; subst) | |- _ => unique pose proof lt_1_length_limb_widths | |- _ => unique pose proof c_reduce2 - | |- _ => break_if; try omega + | |- _ => break_innermost_match_step; try omega + | |- _ => break_innermost_match_hyps_step; try omega | |- _ => progress simpl pred in * | |- _ => progress rewrite ?Z.add_0_r, ?Z.sub_0_r in * | |- _ => rewrite nth_default_out_of_bounds by omega @@ -690,7 +691,7 @@ Section CanonicalizationProofs. unique assert (0 <= a < 2 * 2 ^ n) by omega | H : 0 <= ?a < 2 * 2 ^ ?n |- appcontext [?a >> ?n] => pose proof c_pos; - apply Z.lt_mul_2_pow_2_shiftr in H; break_if; rewrite H; omega + apply Z.lt_mul_2_pow_2_shiftr in H; (break_innermost_match_step || break_innermost_match_hyps_step); rewrite H; omega | H : 0 <= ?a < 2 ^ ?n |- appcontext [?a >> ?n] => pose proof c_pos; apply Z.lt_pow_2_shiftr in H; rewrite H; omega @@ -743,7 +744,7 @@ Section CanonicalizationProofs. specialize (Hfbound Hbound). specialize (Hloop (f us) Hflength Hfbound (length limb_widths) n). specialize_by omega. - repeat (break_if; try omega). + repeat (omega || break_innermost_match_step || break_innermost_match_hyps_step). Qed. Lemma bound_after_loop : forall us (Hlength : length us = length limb_widths) @@ -767,7 +768,7 @@ Section CanonicalizationProofs. specialize (Hfbound Hbound). specialize (Hloop (f us) Hflength Hfbound (length limb_widths) n). specialize_by omega. - repeat (break_if; try omega). + repeat (omega || break_innermost_match_step || break_innermost_match_hyps_step). Qed. Lemma bound_after_first_loop_pre : forall us, @@ -798,7 +799,7 @@ Section CanonicalizationProofs. rewrite !nth_default_out_of_bounds by (rewrite ?length_carry_full; omega). autorewrite with zsimplify. rewrite Z.pow_0_r. - break_if; omega. + break_innermost_match_step; omega. Qed. Lemma bound_during_second_loop : forall us, @@ -1089,7 +1090,7 @@ Section SquareRootProofs. (if dec (?c = _) then _ else _) => assert (a ~= c) by (cbv [rep]; rewrite <-chain_correct, <-pow_rep, <-mul_rep; - eassumption); repeat break_if + eassumption); break_innermost_match | |- _ => apply mul_rep; try reflexivity; rewrite <-chain_correct, <-pow_rep; eassumption | |- _ => rewrite <-chain_correct, <-pow_rep; eassumption @@ -1139,6 +1140,6 @@ Section ConversionProofs. rewrite F.to_Z_of_Z. rewrite <-Conversion.convert_correct; auto using length_to_list. Qed. - + End ConversionProofs. diff --git a/src/ModularArithmetic/Montgomery/ZBounded.v b/src/ModularArithmetic/Montgomery/ZBounded.v index 97bcf87b9..2e9f3b3cc 100644 --- a/src/ModularArithmetic/Montgomery/ZBounded.v +++ b/src/ModularArithmetic/Montgomery/ZBounded.v @@ -9,7 +9,8 @@ Require Import Crypto.ModularArithmetic.ExtendedBaseVector. Require Import Crypto.ModularArithmetic.ZBounded. Require Import Crypto.BaseSystem. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.Test. +Require Import Crypto.Util.Tactics.Not. Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Notations. diff --git a/src/ModularArithmetic/Montgomery/ZProofs.v b/src/ModularArithmetic/Montgomery/ZProofs.v index 96fe41759..9a7ee1e3d 100644 --- a/src/ModularArithmetic/Montgomery/ZProofs.v +++ b/src/ModularArithmetic/Montgomery/ZProofs.v @@ -4,7 +4,9 @@ Wikipedia. *) Require Import Coq.ZArith.ZArith Coq.micromega.Psatz Coq.Structures.Equalities. Require Import Crypto.ModularArithmetic.Montgomery.Z. -Require Import Crypto.Util.ZUtil Crypto.Util.Tactics. +Require Import Crypto.Util.ZUtil. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SimplifyRepeatedIfs. Require Import Crypto.Util.Notations. Declare Module Nop : Nop. diff --git a/src/ModularArithmetic/Pow2BaseProofs.v b/src/ModularArithmetic/Pow2BaseProofs.v index 70947abdb..914b19c11 100644 --- a/src/ModularArithmetic/Pow2BaseProofs.v +++ b/src/ModularArithmetic/Pow2BaseProofs.v @@ -4,7 +4,10 @@ Require Import Coq.Lists.List. Require Import Coq.funind.Recdef. Require Import Crypto.Util.ListUtil Crypto.Util.ZUtil Crypto.Util.NatUtil. Require Import Crypto.Tactics.VerdiTactics. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.SpecializeBy. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.RewriteHyp. Require Import Crypto.ModularArithmetic.Pow2Base Crypto.BaseSystemProofs. Require Import Crypto.Util.Notations. Require Export Crypto.Util.Bool. diff --git a/src/ModularArithmetic/PrimeFieldTheorems.v b/src/ModularArithmetic/PrimeFieldTheorems.v index 1e9b86552..d48aab36e 100644 --- a/src/ModularArithmetic/PrimeFieldTheorems.v +++ b/src/ModularArithmetic/PrimeFieldTheorems.v @@ -9,7 +9,7 @@ Require Import Coq.Classes.Morphisms Coq.Setoids.Setoid. Require Import Coq.ZArith.BinInt Coq.NArith.BinNat Coq.ZArith.ZArith Coq.ZArith.Znumtheory Coq.NArith.NArith. (* import Zdiv before Znumtheory *) Require Import Coq.Logic.Eqdep_dec. Require Import Crypto.Util.NumTheoryUtil Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Import Crypto.Util.Decidable. Require Export Crypto.Util.FixCoqMistakes. Require Crypto.Algebra Crypto.Algebra.Field. @@ -291,4 +291,4 @@ Module F. assumption || exact _ || exact inv_proof || exact div_proof. Qed. End IsomorphicRings. End Iso. -End F. \ No newline at end of file +End F. diff --git a/src/ModularArithmetic/ZBounded.v b/src/ModularArithmetic/ZBounded.v index cd4444dcf..bccbf7428 100644 --- a/src/ModularArithmetic/ZBounded.v +++ b/src/ModularArithmetic/ZBounded.v @@ -3,7 +3,7 @@ operations for Montgomery Reduction and Barrett Reduction. *) Require Import Coq.ZArith.ZArith. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. Require Import Crypto.Util.Notations. Local Open Scope Z_scope. diff --git a/src/ModularArithmetic/ZBoundedZ.v b/src/ModularArithmetic/ZBoundedZ.v index 008012526..fd004451b 100644 --- a/src/ModularArithmetic/ZBoundedZ.v +++ b/src/ModularArithmetic/ZBoundedZ.v @@ -2,7 +2,7 @@ Require Import Coq.ZArith.ZArith Coq.micromega.Psatz. Require Import Crypto.ModularArithmetic.ZBounded. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Notations. diff --git a/src/MontgomeryCurveTheorems.v b/src/MontgomeryCurveTheorems.v index 2f226b594..61eb5f880 100644 --- a/src/MontgomeryCurveTheorems.v +++ b/src/MontgomeryCurveTheorems.v @@ -1,6 +1,7 @@ Require Import Crypto.Algebra Crypto.Algebra.Field. Require Import Crypto.Util.GlobalSettings. -Require Import Crypto.Util.Tactics Crypto.Util.Sum Crypto.Util.Prod. +Require Import Crypto.Util.Sum Crypto.Util.Prod. +Require Import Crypto.Util.Tactics.BreakMatch. Require Import Crypto.Spec.MontgomeryCurve Crypto.Spec.WeierstrassCurve. Require Import Crypto.WeierstrassCurve.WeierstrassCurveTheorems. @@ -109,4 +110,4 @@ Module M. Global Instance homomorphism_to_Weierstrass : Monoid.is_homomorphism(phi:=to_Weierstrass) := proj2 (proj2 _MW). End MontgomeryWeierstrass. End MontgomeryCurve. -End M. \ No newline at end of file +End M. diff --git a/src/MontgomeryX.v b/src/MontgomeryX.v index b3e9a5ae8..0bc611473 100644 --- a/src/MontgomeryX.v +++ b/src/MontgomeryX.v @@ -1,6 +1,6 @@ Require Import Crypto.Algebra Crypto.Algebra.Field. Require Import Crypto.Util.GlobalSettings Crypto.Util.Notations. -Require Import Crypto.Util.Tactics Crypto.Util.Sum Crypto.Util.Prod. +Require Import (*Crypto.Util.Tactics*) Crypto.Util.Sum Crypto.Util.Prod. Require Import Crypto.Spec.MontgomeryCurve Crypto.MontgomeryCurveTheorems. Module M. diff --git a/src/MxDHRepChange.v b/src/MxDHRepChange.v index bafa62131..c5e1e7f95 100644 --- a/src/MxDHRepChange.v +++ b/src/MxDHRepChange.v @@ -1,6 +1,8 @@ Require Import Crypto.Spec.MxDH. Require Import Crypto.Algebra Crypto.Algebra.Monoid Crypto.Algebra.Group Crypto.Algebra.Ring Crypto.Algebra.Field. Require Import Crypto.Util.Tuple. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.BreakMatch. Section MxDHRepChange. Context {F Feq Fzero Fone Fopp Fadd Fsub Fmul Finv Fdiv} {field:@Algebra.field F Feq Fzero Fone Fopp Fadd Fsub Fmul Finv Fdiv} {Feq_dec:Decidable.DecidableRel Feq} {Fcswap:bool->F*F->F*F->(F*F)*(F*F)} {Fa24:F} {tb1:nat->bool}. @@ -36,7 +38,7 @@ Section MxDHRepChange. reflexivity ). - Import Crypto.Util.Tactics. + (*Import Crypto.Util.Tactics.*) Import List. Import Coq.Classes.Morphisms. diff --git a/src/NewBaseSystem.v b/src/NewBaseSystem.v index 3afc1d8b8..620011fa7 100644 --- a/src/NewBaseSystem.v +++ b/src/NewBaseSystem.v @@ -244,11 +244,15 @@ Require Import Coq.ZArith.ZArith Coq.micromega.Psatz Coq.omega.Omega. Require Import Coq.ZArith.BinIntDef. Local Open Scope Z_scope. +Require Import Crypto.Tactics.VerdiTactics. Require Import Crypto.Tactics.Algebra_syntax.Nsatz. -Require Import Crypto.Util.Tactics Crypto.Util.Decidable Crypto.Util.LetIn. +Require Import Crypto.Util.Decidable Crypto.Util.LetIn. Require Import Crypto.Util.ZUtil Crypto.Util.ListUtil Crypto.Util.Sigma. -Require Import Crypto.Util.CPSUtil Crypto.Util.Prod Crypto.Util.Tactics. +Require Import Crypto.Util.CPSUtil Crypto.Util.Prod. Require Import Crypto.ModularArithmetic.PrimeFieldTheorems. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.UniquePose. +Require Import Crypto.Util.Tactics.VM. Require Import Coq.Lists.List. Import ListNotations. Require Crypto.Util.Tuple. Local Notation tuple := Tuple.tuple. @@ -259,8 +263,7 @@ Local Ltac prove_id := | _ => progress simpl | _ => progress cbv [Let_In] | _ => progress (autorewrite with uncps push_id in * ) - | _ => break_if - | _ => break_match + | _ => break_innermost_match_step | _ => contradiction | _ => reflexivity | _ => nsatz @@ -274,8 +277,7 @@ Local Ltac prove_eval := | _ => progress simpl | _ => progress cbv [Let_In] | _ => progress (autorewrite with push_basesystem_eval uncps push_id cancel_pair in * ) - | _ => break_if - | _ => break_match + | _ => break_innermost_match_step | _ => split | H : _ /\ _ |- _ => destruct H | H : Some _ = Some _ |- _ => progress (inversion H; subst) @@ -866,7 +868,7 @@ Section DivMod. Lemma div_mod a b (H:b <> 0) : a = b * div a b + modulo a b. Proof. - cbv [div modulo]; intros. break_if; auto using Z.div_mod. + cbv [div modulo]; intros. break_match; auto using Z.div_mod. rewrite Z.land_ones, Z.shiftr_div_pow2 by apply Z.log2_nonneg. pose proof (Z.div_mod a b H). congruence. Qed. diff --git a/src/Reflection/CommonSubexpressionElimination.v b/src/Reflection/CommonSubexpressionElimination.v index 433c45aa8..6d3921aa6 100644 --- a/src/Reflection/CommonSubexpressionElimination.v +++ b/src/Reflection/CommonSubexpressionElimination.v @@ -2,7 +2,7 @@ Require Import Coq.Lists.List. Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.SmartMap. -Require Import Crypto.Util.Tactics Crypto.Util.Bool. +Require Import (*Crypto.Util.Tactics*) Crypto.Util.Bool. Local Open Scope list_scope. diff --git a/src/Reflection/Conversion.v b/src/Reflection/Conversion.v index 3520db4e2..8d2250a7a 100644 --- a/src/Reflection/Conversion.v +++ b/src/Reflection/Conversion.v @@ -1,7 +1,8 @@ (** * Convert between interpretations of types *) Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.Map. -Require Import Crypto.Util.Notations Crypto.Util.Tactics. +Require Import Crypto.Util.Notations. +Require Import Crypto.Util.Tactics.RewriteHyp. Local Open Scope expr_scope. diff --git a/src/Reflection/InputSyntax.v b/src/Reflection/InputSyntax.v index 12810d20d..832f5fdfd 100644 --- a/src/Reflection/InputSyntax.v +++ b/src/Reflection/InputSyntax.v @@ -5,7 +5,7 @@ Require Import Crypto.Reflection.SmartMap. Require Import Crypto.Reflection.ExprInversion. Require Import Crypto.Reflection.InterpProofs. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.RewriteHyp. Require Import Crypto.Util.Notations. (** We parameterize the language over a type of basic type codes (for diff --git a/src/Reflection/InterpProofs.v b/src/Reflection/InterpProofs.v index a9ecdd674..88ceaac56 100644 --- a/src/Reflection/InterpProofs.v +++ b/src/Reflection/InterpProofs.v @@ -3,7 +3,8 @@ Require Import Crypto.Reflection.Wf. Require Import Crypto.Reflection.SmartMap. Require Import Crypto.Reflection.WfProofs. Require Import Crypto.Util.LetIn. -Require Import Crypto.Util.Tactics Crypto.Util.Sigma Crypto.Util.Prod. +Require Import Crypto.Util.Sigma Crypto.Util.Prod. +Require Import Crypto.Util.Tactics.RewriteHyp. Local Open Scope ctype_scope. Section language. diff --git a/src/Reflection/InterpWf.v b/src/Reflection/InterpWf.v index b3b83698e..e4c3e7de0 100644 --- a/src/Reflection/InterpWf.v +++ b/src/Reflection/InterpWf.v @@ -5,7 +5,9 @@ Require Import Crypto.Reflection.Relations. Require Import Crypto.Util.Tuple. Require Import Crypto.Util.Sigma. Require Import Crypto.Util.Prod. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.SpecializeBy. +Require Import Crypto.Util.Tactics.RewriteHyp. Require Import Crypto.Util.Notations. Local Open Scope ctype_scope. Local Open Scope expr_scope. diff --git a/src/Reflection/InterpWfRel.v b/src/Reflection/InterpWfRel.v index 59ff53ffe..b827c235a 100644 --- a/src/Reflection/InterpWfRel.v +++ b/src/Reflection/InterpWfRel.v @@ -5,7 +5,7 @@ Require Import Crypto.Reflection.Relations. Require Import Crypto.Util.Tuple. Require Import Crypto.Util.Sigma. Require Import Crypto.Util.Prod. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.DestructHead. Require Import Crypto.Util.Notations. Local Open Scope ctype_scope. Local Open Scope expr_scope. diff --git a/src/Reflection/Linearize.v b/src/Reflection/Linearize.v index 42ae9c14f..9fc45c798 100644 --- a/src/Reflection/Linearize.v +++ b/src/Reflection/Linearize.v @@ -1,7 +1,7 @@ (** * Linearize: Place all and only operations in let binders *) Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.SmartMap. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Local Open Scope ctype_scope. Section language. diff --git a/src/Reflection/LinearizeInterp.v b/src/Reflection/LinearizeInterp.v index 443cb9e3c..e6acac0d6 100644 --- a/src/Reflection/LinearizeInterp.v +++ b/src/Reflection/LinearizeInterp.v @@ -5,7 +5,9 @@ Require Import Crypto.Reflection.Relations. Require Import Crypto.Reflection.LinearizeWf. Require Import Crypto.Reflection.InterpProofs. Require Import Crypto.Reflection.Linearize. -Require Import Crypto.Util.Tactics Crypto.Util.Sigma Crypto.Util.Prod. +Require Import Crypto.Util.Sigma Crypto.Util.Prod. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SpecializeBy. Local Open Scope ctype_scope. diff --git a/src/Reflection/LinearizeWf.v b/src/Reflection/LinearizeWf.v index b58ae654f..4e4b4fc38 100644 --- a/src/Reflection/LinearizeWf.v +++ b/src/Reflection/LinearizeWf.v @@ -3,7 +3,7 @@ Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.Wf. Require Import Crypto.Reflection.WfProofs. Require Import Crypto.Reflection.Linearize. -Require Import Crypto.Util.Tactics Crypto.Util.Sigma. +Require Import (*Crypto.Util.Tactics*) Crypto.Util.Sigma. Local Open Scope ctype_scope. Section language. diff --git a/src/Reflection/Named/Syntax.v b/src/Reflection/Named/Syntax.v index 28e7256fc..b4846be9a 100644 --- a/src/Reflection/Named/Syntax.v +++ b/src/Reflection/Named/Syntax.v @@ -4,7 +4,7 @@ Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.SmartMap. Require Import Crypto.Util.PointedProp. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Require Import Crypto.Util.Notations. Require Import Crypto.Util.LetIn. diff --git a/src/Reflection/Reify.v b/src/Reflection/Reify.v index 187cb47f0..18819e210 100644 --- a/src/Reflection/Reify.v +++ b/src/Reflection/Reify.v @@ -6,7 +6,8 @@ Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.Relations. Require Import Crypto.Reflection.InputSyntax. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.DebugPrint. +Require Import Crypto.Util.Tactics.Head. Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Notations. diff --git a/src/Reflection/Relations.v b/src/Reflection/Relations.v index f7fbe682c..8ea1eaf18 100644 --- a/src/Reflection/Relations.v +++ b/src/Reflection/Relations.v @@ -2,7 +2,9 @@ Require Import Coq.Lists.List Coq.Classes.RelationClasses Coq.Classes.Morphisms. Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.SmartMap. Require Import Crypto.Reflection.Wf. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.RewriteHyp. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.SplitInContext. Require Import Crypto.Util.Prod. Require Import Crypto.Util.Sigma. diff --git a/src/Reflection/WfInversion.v b/src/Reflection/WfInversion.v index 111c8a4a4..b8cb16c6a 100644 --- a/src/Reflection/WfInversion.v +++ b/src/Reflection/WfInversion.v @@ -4,7 +4,8 @@ Require Import Crypto.Reflection.ExprInversion. Require Import Crypto.Util.Sigma. Require Import Crypto.Util.Option. Require Import Crypto.Util.Equality. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.DestructHead. Require Import Crypto.Util.Notations. Section language. diff --git a/src/Reflection/WfProofs.v b/src/Reflection/WfProofs.v index 680a16f83..dcf3d8347 100644 --- a/src/Reflection/WfProofs.v +++ b/src/Reflection/WfProofs.v @@ -3,7 +3,10 @@ Require Import Crypto.Reflection.Wf. Require Import Crypto.Reflection.WfInversion. Require Import Crypto.Reflection.SmartMap. Require Import Crypto.Reflection.ExprInversion. -Require Import Crypto.Util.Tactics Crypto.Util.Sigma Crypto.Util.Prod. +Require Import Crypto.Util.Sigma Crypto.Util.Prod. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.RewriteHyp. +Require Import Crypto.Util.Tactics.SplitInContext. Local Open Scope ctype_scope. Section language. diff --git a/src/Reflection/WfReflective.v b/src/Reflection/WfReflective.v index aafe67c84..d55b543cd 100644 --- a/src/Reflection/WfReflective.v +++ b/src/Reflection/WfReflective.v @@ -52,7 +52,9 @@ Require Import Crypto.Reflection.Syntax. Require Import Crypto.Reflection.Wf. Require Import Crypto.Reflection.EtaWf. Require Import Crypto.Reflection.WfReflectiveGen. -Require Import Crypto.Util.Notations Crypto.Util.Tactics Crypto.Util.Option Crypto.Util.Sigma Crypto.Util.Prod Crypto.Util.Decidable Crypto.Util.ListUtil. +Require Import Crypto.Util.Notations Crypto.Util.Option Crypto.Util.Sigma Crypto.Util.Prod Crypto.Util.Decidable Crypto.Util.ListUtil. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Export Crypto.Util.PartiallyReifiedProp. (* export for the [bool >-> reified_Prop] coercion *) Require Export Crypto.Util.FixCoqMistakes. diff --git a/src/Reflection/WfReflectiveGen.v b/src/Reflection/WfReflectiveGen.v index 0e745f059..0e484998b 100644 --- a/src/Reflection/WfReflectiveGen.v +++ b/src/Reflection/WfReflectiveGen.v @@ -49,7 +49,8 @@ Require Import Coq.Arith.Arith Coq.Logic.Eqdep_dec. Require Import Crypto.Reflection.Syntax. -Require Import Crypto.Util.Notations Crypto.Util.Tactics Crypto.Util.Option Crypto.Util.Sigma Crypto.Util.Prod Crypto.Util.Decidable Crypto.Util.ListUtil. +Require Import Crypto.Util.Notations Crypto.Util.Option Crypto.Util.Sigma Crypto.Util.Prod Crypto.Util.Decidable Crypto.Util.ListUtil. +Require Import Crypto.Util.Tactics.RewriteHyp. Require Import Crypto.Reflection.Wf. Require Export Crypto.Util.PartiallyReifiedProp. (* export for the [bool >-> reified_Prop] coercion *) Require Export Crypto.Util.FixCoqMistakes. diff --git a/src/SaturatedBaseSystem.v b/src/SaturatedBaseSystem.v index 0b9e8ebdb..eb6262f96 100644 --- a/src/SaturatedBaseSystem.v +++ b/src/SaturatedBaseSystem.v @@ -6,7 +6,8 @@ Local Open Scope Z_scope. Require Import Crypto.Tactics.Algebra_syntax.Nsatz. Require Import Crypto.NewBaseSystem. Require Import Crypto.Util.LetIn Crypto.Util.CPSUtil. -Require Import Crypto.Util.Tuple Crypto.Util.ListUtil Crypto.Util.Tactics. +Require Import Crypto.Util.Tuple Crypto.Util.ListUtil. +Require Import Crypto.Util.Tactics.BreakMatch. Local Notation "A ^ n" := (tuple A n) : type_scope. (*** @@ -83,8 +84,8 @@ Module Columns. Proof. cbv [compact_step_cps compact_step]; autorewrite with uncps; reflexivity. Qed. Hint Opaque compact_step : uncps. Hint Rewrite compact_step_id : uncps. - - Definition compact_cps {n} (xs : (list Z)^n) {T} (f:Z * Z^n->T) := + + Definition compact_cps {n} (xs : (list Z)^n) {T} (f:Z * Z^n->T) := mapi_with_cps compact_step_cps 0 xs f. Definition compact {n} xs := @compact_cps n xs _ id. @@ -120,7 +121,7 @@ Module Columns. repeat match goal with | _ => rewrite B.Positional.eval_step | _ => rewrite eval_from_S - | _ => rewrite sum_cons + | _ => rewrite sum_cons | _ => rewrite weight_multiples | _ => rewrite Nat.add_succ_l in * | _ => rewrite Nat.add_succ_r in * @@ -173,7 +174,7 @@ Module Columns. Qed. Hint Opaque cons_to_nth : uncps. Hint Rewrite @cons_to_nth_id : uncps. - + Lemma map_sum_update_nth l : forall i x, List.map sum (update_nth i (cons x) l) = update_nth i (Z.add x) (List.map sum l). @@ -194,7 +195,7 @@ Module Columns. distr_length. distr_length. Qed. - + Lemma eval_cons_to_nth n i x t : (i < n)%nat -> eval (@cons_to_nth n i x t) = weight i * x + eval t. Proof. @@ -244,13 +245,13 @@ Module Columns. autorewrite with uncps push_id push_basesystem_eval in *. rewrite eval_cons_to_nth by omega. nsatz. Qed. - + Definition mul_cps {n m} (p q : Z^n) {T} (f : (list Z)^m->T) := B.Positional.to_associational_cps weight p (fun P => B.Positional.to_associational_cps weight q (fun Q => B.Associational.mul_cps P Q (fun PQ => from_associational_cps m PQ f))). - + Definition add_cps {n} (p q : Z^n) {T} (f : (list Z)^n->T) := B.Positional.to_associational_cps weight p (fun P => B.Positional.to_associational_cps weight q @@ -261,8 +262,8 @@ End Columns. (* (* Just some pretty-printing *) -Local Notation "fst~ a" := (let (x,_) := a in x) (at level 40, only printing). -Local Notation "snd~ a" := (let (_,y) := a in y) (at level 40, only printing). +Local Notation "fst~ a" := (let (x,_) := a in x) (at level 40, only printing). +Local Notation "snd~ a" := (let (_,y) := a in y) (at level 40, only printing). (* Simple example : base 10, multiply two bignums and compact them *) Definition base10 i := Eval compute in 10^(Z.of_nat i). @@ -274,11 +275,11 @@ Eval cbv -[runtime_add runtime_mul Let_In] in Definition base2pow56 i := Eval compute in 2^(56*Z.of_nat i). Time Eval cbv -[runtime_add runtime_mul Let_In] in (fun adc a0 a1 a2 a3 a4 a5 a6 a7 b0 b1 b2 b3 b4 b5 b6 b7 => - Columns.mul_cps (weight := base2pow56) (n:=8) (a7,a6,a5,a4,a3,a2,a1,a0) (b7,b6,b5,b4,b3,b2,b1,b0) (fun ab => Columns.compact (n:=15) (add_get_carry:=adc) (weight:=base2pow56) ab)). (* Finished transaction in 151.392 secs *) + Columns.mul_cps (weight := base2pow56) (n:=8) (a7,a6,a5,a4,a3,a2,a1,a0) (b7,b6,b5,b4,b3,b2,b1,b0) (fun ab => Columns.compact (n:=15) (add_get_carry:=adc) (weight:=base2pow56) ab)). (* Finished transaction in 151.392 secs *) (* Mixed-radix example : base 2^25.5, 10 limbs *) Definition base2pow25p5 i := Eval compute in 2^(25*Z.of_nat i + ((Z.of_nat i + 1) / 2)). Time Eval cbv -[runtime_add runtime_mul Let_In] in (fun adc a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 => Columns.mul_cps (weight := base2pow25p5) (n:=10) (a9,a8,a7,a6,a5,a4,a3,a2,a1,a0) (b9,b8,b7,b6,b5,b4,b3,b2,b1,b0) (fun ab => Columns.compact (n:=19) (add_get_carry:=adc) (weight:=base2pow25p5) ab)). (* Finished transaction in 97.341 secs *) -*) \ No newline at end of file +*) diff --git a/src/Spec/MontgomeryCurve.v b/src/Spec/MontgomeryCurve.v index a12f2ef96..e5ed281f9 100644 --- a/src/Spec/MontgomeryCurve.v +++ b/src/Spec/MontgomeryCurve.v @@ -1,6 +1,6 @@ Require Crypto.Algebra Crypto.Algebra.Field. Require Crypto.Util.GlobalSettings. -Require Crypto.Util.Tactics Crypto.Util.Sum Crypto.Util.Prod. +Require Crypto.Util.Tactics.DestructHead Crypto.Util.Sum Crypto.Util.Prod. Module M. Section MontgomeryCurve. @@ -54,7 +54,7 @@ Module M. | _, ∞ => coordinates P1 end. Next Obligation. - Proof. + Proof. repeat match goal with | _ => solve [ trivial ] | _ => progress Tactics.DestructHead.destruct_head' @point diff --git a/src/Specific/FancyMachine256/Core.v b/src/Specific/FancyMachine256/Core.v index 704144a07..6ea614936 100644 --- a/src/Specific/FancyMachine256/Core.v +++ b/src/Specific/FancyMachine256/Core.v @@ -24,6 +24,7 @@ Require Export Crypto.Util.Option. Require Export Crypto.Util.Notations. Require Import Crypto.Util.ListUtil. Require Export Crypto.Util.LetIn. +Require Import Crypto.Util.Tactics.BreakMatch. Export ListNotations. Open Scope Z_scope. diff --git a/src/Specific/GF25519.v b/src/Specific/GF25519.v index 5c5c5741d..1a74de889 100644 --- a/src/Specific/GF25519.v +++ b/src/Specific/GF25519.v @@ -9,7 +9,9 @@ Require Import Crypto.Util.Tuple. Require Import Coq.Lists.List Crypto.Util.ListUtil. Require Import Crypto.Tactics.VerdiTactics. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.SetEvars. +Require Import Crypto.Util.Tactics.SubstEvars. +Require Import Crypto.Util.Tactics.DestructHead. Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Tower. Require Import Crypto.Util.Notations. diff --git a/src/Specific/NewBaseSystemTest.v b/src/Specific/NewBaseSystemTest.v index 2271db4e4..8cbb8a596 100644 --- a/src/Specific/NewBaseSystemTest.v +++ b/src/Specific/NewBaseSystemTest.v @@ -2,7 +2,7 @@ Require Import Coq.ZArith.ZArith Coq.ZArith.BinIntDef. Require Import Coq.Lists.List. Import ListNotations. Require Import Crypto.NewBaseSystem. Import B. Require Import Crypto.ModularArithmetic.PrimeFieldTheorems. -Require Import Crypto.Util.Tactics Crypto.Util.Decidable. +Require Import (*Crypto.Util.Tactics*) Crypto.Util.Decidable. Require Import Crypto.Util.LetIn Crypto.Util.ZUtil. Require Crypto.Util.Tuple. Local Notation tuple := Tuple.tuple. diff --git a/src/Specific/SC25519.v b/src/Specific/SC25519.v index 033750453..eaf1f564a 100644 --- a/src/Specific/SC25519.v +++ b/src/Specific/SC25519.v @@ -6,7 +6,7 @@ Require Import Crypto.ModularArithmetic.ZBoundedZ. Require Import Crypto.Spec.ModularArithmetic. Require Import Crypto.Util.Tuple. Require Import Crypto.Util.LetIn. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.SpecializeBy. Require Import Crypto.Util.ZUtil. Require Import Crypto.Util.WordUtil. Import NPeano. diff --git a/src/SpecificGen/GFtemplate3mod4 b/src/SpecificGen/GFtemplate3mod4 index a9d6c574f..b98067a9a 100644 --- a/src/SpecificGen/GFtemplate3mod4 +++ b/src/SpecificGen/GFtemplate3mod4 @@ -9,7 +9,7 @@ Require Import Coq.Lists.List Crypto.Util.ListUtil. Require Import Crypto.Tactics.VerdiTactics. Require Import Crypto.Util.ZUtil. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Tower. Require Import Crypto.Util.Notations. diff --git a/src/SpecificGen/GFtemplate5mod8 b/src/SpecificGen/GFtemplate5mod8 index c0ad5a630..d6e8f32ad 100644 --- a/src/SpecificGen/GFtemplate5mod8 +++ b/src/SpecificGen/GFtemplate5mod8 @@ -9,7 +9,7 @@ Require Import Coq.Lists.List Crypto.Util.ListUtil. Require Import Crypto.Tactics.VerdiTactics. Require Import Crypto.Util.ZUtil. Require Import Crypto.Util.Tuple. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Require Import Crypto.Util.LetIn. Require Import Crypto.Util.Tower. Require Import Crypto.Util.Notations. diff --git a/src/Testbit.v b/src/Testbit.v index c7e698e04..57362d10b 100644 --- a/src/Testbit.v +++ b/src/Testbit.v @@ -5,8 +5,7 @@ Require Import Crypto.ModularArithmetic.Pow2Base Crypto.ModularArithmetic.Pow2Ba Require Import Coq.ZArith.ZArith Coq.ZArith.Zdiv. Require Import Coq.omega.Omega Coq.Numbers.Natural.Peano.NPeano. Require Import Coq.micromega.Psatz. -Require Import Crypto.Tactics.VerdiTactics. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.UniquePose. Require Coq.Arith.Arith. Import Nat. Local Open Scope Z. diff --git a/src/Util/CPSUtil.v b/src/Util/CPSUtil.v index da56bc964..9b8fbe318 100644 --- a/src/Util/CPSUtil.v +++ b/src/Util/CPSUtil.v @@ -1,6 +1,8 @@ Require Import Coq.Lists.List. Import ListNotations. Require Import Coq.ZArith.ZArith Coq.omega.Omega. -Require Import Crypto.Util.ListUtil Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.ListUtil. Require Crypto.Util.Tuple. Local Notation tuple := Tuple.tuple. Local Open Scope Z_scope. @@ -30,7 +32,7 @@ Proof. break_innermost_match; solve [ trivial | omega ]. Qed. -Lemma mod_add_mul_full a b c k m : m <> 0 -> c mod m = k mod m -> +Lemma mod_add_mul_full a b c k m : m <> 0 -> c mod m = k mod m -> (a + b * c) mod m = (a + b * k) mod m. Proof. intros; rewrite Z.add_mod, Z.mul_mod by auto. @@ -142,7 +144,7 @@ Qed. Hint Rewrite @on_tuple_cps_correct using (intros; autorewrite with uncps; Fixpoint update_nth_cps {A} n (g:A->A) xs {T} (f:list A->T) := match n with - | O => + | O => match xs with | [] => f [] | x' :: xs' => f (g x' :: xs') @@ -235,7 +237,7 @@ Lemma fold_right_no_starter_cps_correct {A} g ls {T} f : @fold_right_no_starter_cps A g ls T f = f (fold_right_no_starter g ls). Proof. cbv [fold_right_no_starter_cps fold_right_no_starter]; break_match; reflexivity. -Qed. +Qed. Hint Rewrite @fold_right_no_starter_cps_correct : uncps. Import Tuple. diff --git a/src/Util/Decidable.v b/src/Util/Decidable.v index e3f4a5930..e7e8ce471 100644 --- a/src/Util/Decidable.v +++ b/src/Util/Decidable.v @@ -4,7 +4,6 @@ Require Import Coq.Logic.Eqdep_dec. Require Import Crypto.Util.FixCoqMistakes. Require Import Crypto.Util.Sigma. Require Import Crypto.Util.HProp. -Require Import Crypto.Util.Equality. Require Import Coq.ZArith.BinInt Coq.ZArith.ZArith_dec. Require Import Coq.NArith.BinNat. diff --git a/src/Util/IterAssocOp.v b/src/Util/IterAssocOp.v index 7e6ec1e81..15b74134d 100644 --- a/src/Util/IterAssocOp.v +++ b/src/Util/IterAssocOp.v @@ -3,6 +3,7 @@ Require Import Coq.NArith.NArith Coq.PArith.BinPosDef. Require Import Coq.Numbers.Natural.Peano.NPeano. Require Import Crypto.Algebra Crypto.Algebra.Monoid Crypto.Algebra.ScalarMult. Require Import Crypto.Util.NUtil. +Require Import Crypto.Util.Tactics.BreakMatch. Local Open Scope equiv_scope. @@ -121,7 +122,7 @@ Section IterAssocOp. End IterAssocOp. Require Import Coq.Classes.Morphisms. -Require Import Crypto.Util.Tactics. +(*Require Import Crypto.Util.Tactics.*) Require Import Crypto.Util.Relations. Global Instance Proper_funexp {T R} {Equivalence_R:Equivalence R} diff --git a/src/Util/LetIn.v b/src/Util/LetIn.v index 18e763b93..69cacd75e 100644 --- a/src/Util/LetIn.v +++ b/src/Util/LetIn.v @@ -1,6 +1,6 @@ Require Import Crypto.Util.FixCoqMistakes. Require Import Coq.Classes.Morphisms Coq.Relations.Relation_Definitions. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.GetGoal. Require Import Crypto.Util.Notations. Definition Let_In {A P} (x : A) (f : forall a : A, P a) : P x := let y := x in f y. diff --git a/src/Util/Option.v b/src/Util/Option.v index c26d6cca3..5544fa428 100644 --- a/src/Util/Option.v +++ b/src/Util/Option.v @@ -1,7 +1,7 @@ Require Import Coq.Classes.Morphisms. Require Import Coq.Relations.Relation_Definitions. -Require Import Crypto.Tactics.VerdiTactics. -Require Import Crypto.Util.Logic. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.DestructHead. Section Relations. Definition option_eq {A} eq (x y : option A) := @@ -51,7 +51,7 @@ Lemma option_rect_false_returns_true_iff (f:T->bool) {Proper_f:Proper(R==>eq)f} (o:option T) : option_rect (fun _ => bool) f false o = true <-> exists s:T, option_eq R o (Some s) /\ f s = true. Proof. - unfold option_rect; break_match; logic; [ | | congruence .. ]. + unfold option_rect; break_match; repeat intuition (destruct_head ex; eauto); [ | | congruence.. ]. { repeat esplit; simpl; easy. } { match goal with [H : f _ = true |- f _ = true ] => solve [rewrite <- H; eauto] end. } @@ -60,7 +60,7 @@ Qed. Lemma option_rect_false_returns_true_iff_eq {T} (f:T->bool) (o:option T) : option_rect (fun _ => bool) f false o = true <-> exists s:T, Logic.eq o (Some s) /\ f s = true. -Proof. unfold option_rect; break_match; logic; congruence. Qed. +Proof. unfold option_rect; break_match; repeat intuition (destruct_head ex; eauto); congruence. Qed. Lemma option_rect_option_map : forall {A B C} (f:A->B) some none v, option_rect (fun _ => C) (fun x => some (f x)) none v = option_rect (fun _ => C) some none (option_map f v). @@ -129,7 +129,7 @@ Lemma option_eq_to_leq_to_eq {A x y} v : @option_leq_to_eq A x y (@option_eq_to_ Proof. compute in *. repeat first [ progress subst - | progress break_match + | progress break_innermost_match_step | reflexivity ]. Qed. diff --git a/src/Util/Tactics.v b/src/Util/Tactics.v index d6ab637aa..88dcb0aa8 100644 --- a/src/Util/Tactics.v +++ b/src/Util/Tactics.v @@ -1,331 +1,34 @@ (** * Generic Tactics *) Require Export Crypto.Util.FixCoqMistakes. Require Export Crypto.Util.Tactics.BreakMatch. +Require Export Crypto.Util.Tactics.Contains. +Require Export Crypto.Util.Tactics.ConvoyDestruct. +Require Export Crypto.Util.Tactics.ClearDuplicates. Require Export Crypto.Util.Tactics.Head. +Require Export Crypto.Util.Tactics.DebugPrint. Require Export Crypto.Util.Tactics.DestructHyps. Require Export Crypto.Util.Tactics.DestructHead. +Require Export Crypto.Util.Tactics.DestructTrivial. Require Export Crypto.Util.Tactics.DoWithHyp. +Require Export Crypto.Util.Tactics.ESpecialize. Require Export Crypto.Util.Tactics.ETransitivity. Require Export Crypto.Util.Tactics.EvarExists. +Require Export Crypto.Util.Tactics.Forward. +Require Export Crypto.Util.Tactics.GetGoal. +Require Export Crypto.Util.Tactics.OnSubterms. +Require Export Crypto.Util.Tactics.Not. +Require Export Crypto.Util.Tactics.Revert. Require Export Crypto.Util.Tactics.RewriteHyp. +Require Export Crypto.Util.Tactics.SetEvars. +Require Export Crypto.Util.Tactics.SetoidSubst. +Require Export Crypto.Util.Tactics.SideConditionsBeforeToAfter. +Require Export Crypto.Util.Tactics.SimplifyProjections. +Require Export Crypto.Util.Tactics.SimplifyRepeatedIfs. Require Export Crypto.Util.Tactics.SpecializeBy. Require Export Crypto.Util.Tactics.SplitInContext. +Require Export Crypto.Util.Tactics.SubstEvars. Require Export Crypto.Util.Tactics.SubstLet. +Require Export Crypto.Util.Tactics.Test. Require Export Crypto.Util.Tactics.UnifyAbstractReflexivity. Require Export Crypto.Util.Tactics.UniquePose. Require Export Crypto.Util.Tactics.VM. - -(** Test if a tactic succeeds, but always roll-back the results *) -Tactic Notation "test" tactic3(tac) := - try (first [ tac | fail 2 tac "does not succeed" ]; fail 0 tac "succeeds"; [](* test for [t] solved all goals *)). - -(** [not tac] is equivalent to [fail tac "succeeds"] if [tac] succeeds, and is equivalent to [idtac] if [tac] fails *) -Tactic Notation "not" tactic3(tac) := try ((test tac); fail 1 tac "succeeds"). - -Ltac get_goal := - match goal with |- ?G => G end. - -(** [contains x expr] succeeds iff [x] appears in [expr] *) -Ltac contains search_for in_term := - idtac; - lazymatch in_term with - | appcontext[search_for] => idtac - end. - -Ltac debuglevel := constr:(0%nat). - -Ltac solve_debugfail tac := - solve [tac] || - ( let dbg := debuglevel in - match dbg with - | O => idtac - | _ => match goal with |- ?G => idtac "couldn't prove" G end - end; - fail). - -Ltac set_evars := - repeat match goal with - | [ |- appcontext[?E] ] => is_evar E; let e := fresh "e" in set (e := E) - end. - -Ltac subst_evars := - repeat match goal with - | [ e := ?E |- _ ] => is_evar E; subst e - end. - -Ltac free_in x y := - idtac; - match y with - | appcontext[x] => fail 1 x "appears in" y - | _ => idtac - end. - -Ltac setoid_subst'' R x := - is_var x; - match goal with - | [ H : R x ?y |- _ ] - => free_in x y; rewrite ?H in *; clear x H - | [ H : R ?y x |- _ ] - => free_in x y; rewrite <- ?H in *; clear x H - end. - -Ltac setoid_subst' x := - is_var x; - match goal with - | [ H : ?R x _ |- _ ] => setoid_subst'' R x - | [ H : ?R _ x |- _ ] => setoid_subst'' R x - end. - -Ltac setoid_subst_rel' R := - idtac; - match goal with - | [ H : R ?x _ |- _ ] => setoid_subst'' R x - | [ H : R _ ?x |- _ ] => setoid_subst'' R x - end. - -Ltac setoid_subst_rel R := repeat setoid_subst_rel' R. - -Ltac setoid_subst_all := - repeat match goal with - | [ H : ?R ?x ?y |- _ ] => is_var x; setoid_subst'' R x - | [ H : ?R ?x ?y |- _ ] => is_var y; setoid_subst'' R y - end. - -Tactic Notation "setoid_subst" ident(x) := setoid_subst' x. -Tactic Notation "setoid_subst" := setoid_subst_all. - -Ltac destruct_trivial_step := - match goal with - | [ H : unit |- _ ] => clear H || destruct H - | [ H : True |- _ ] => clear H || destruct H - end. -Ltac destruct_trivial := repeat destruct_trivial_step. - -Ltac clear_duplicates_step := - match goal with - | [ H : ?T, H' : ?T |- _ ] => clear H' - | [ H := ?T, H' := ?T |- _ ] => clear H' - end. -Ltac clear_duplicates := repeat clear_duplicates_step. - - -(** given a [matcher] that succeeds on some hypotheses and fails on - others, destruct any matching hypotheses, and then execute [tac] - after each [destruct]. - - The [tac] part exists so that you can, e.g., [simpl in *], to - speed things up. *) -Ltac do_one_match_then matcher do_tac tac := - idtac; - match goal with - | [ H : ?T |- _ ] - => matcher T; do_tac H; - try match type of H with - | T => clear H - end; - tac - end. - -Ltac do_all_matches_then matcher do_tac tac := - repeat do_one_match_then matcher do_tac tac. - -Ltac destruct_all_matches_then matcher tac := - do_all_matches_then matcher ltac:(fun H => destruct H) tac. -Ltac destruct_one_match_then matcher tac := - do_one_match_then matcher ltac:(fun H => destruct H) tac. - -Ltac inversion_all_matches_then matcher tac := - do_all_matches_then matcher ltac:(fun H => inversion H; subst) tac. -Ltac inversion_one_match_then matcher tac := - do_one_match_then matcher ltac:(fun H => inversion H; subst) tac. - -Ltac destruct_all_matches matcher := - destruct_all_matches_then matcher ltac:( simpl in * ). -Ltac destruct_one_match matcher := destruct_one_match_then matcher ltac:( simpl in * ). -Ltac destruct_all_matches' matcher := destruct_all_matches_then matcher idtac. - -Ltac inversion_all_matches matcher := inversion_all_matches_then matcher ltac:( simpl in * ). -Ltac inversion_one_match matcher := inversion_one_match_then matcher ltac:( simpl in * ). -Ltac inversion_all_matches' matcher := inversion_all_matches_then matcher idtac. - -(** If [tac_in H] operates in [H] and leaves side-conditions before - the original goal, then - [side_conditions_before_to_side_conditions_after tac_in H] does - the same thing to [H], but leaves side-conditions after the - original goal. *) -Ltac side_conditions_before_to_side_conditions_after tac_in H := - let HT := type of H in - let HTT := type of HT in - let H' := fresh in - rename H into H'; - let HT' := fresh in - evar (HT' : HTT); - cut HT'; - [ subst HT'; intro H - | tac_in H'; - [ .. - | subst HT'; eexact H' ] ]; - instantiate; (* required in 8.4 for the [move] to succeed, because evar dependencies *) - [ (* We preserve the order of the hypotheses. We need to do this - here, after evars are instantiated, and not above. *) - move H after H'; clear H' - | .. ]. - -(** Execute [progress tac] on all subterms of the goal. Useful for things like [ring_simplify]. *) -Ltac tac_on_subterms tac := - repeat match goal with - | [ |- context[?t] ] - => progress tac t - end. - -(** Like [Coq.Program.Tactics.revert_last], but only for non-dependent hypotheses *) -Ltac revert_last_nondep := - match goal with - | [ H : _ |- _ ] - => lazymatch goal with - | [ H' : appcontext[H] |- _ ] => fail - | [ |- appcontext[H] ] => fail - | _ => idtac - end; - revert H - end. - -Ltac reverse_nondep := repeat revert_last_nondep. - -Ltac simplify_repeated_ifs_step := - match goal with - | [ |- context G[if ?b then ?x else ?y] ] - => let x' := match x with - | context x'[b] => let x'' := context x'[true] in x'' - end in - let G' := context G[if b then x' else y] in - cut G'; [ destruct b; exact (fun z => z) | cbv iota ] - | [ |- context G[if ?b then ?x else ?y] ] - => let y' := match y with - | context y'[b] => let y'' := context y'[false] in y'' - end in - let G' := context G[if b then x else y'] in - cut G'; [ destruct b; exact (fun z => z) | cbv iota ] - end. -Ltac simplify_repeated_ifs := repeat simplify_repeated_ifs_step. - -(** Like [specialize] but allows holes that get filled with evars. *) -Tactic Notation "especialize" open_constr(H) := specialize H. - -(** [forward H] specializes non-dependent binders in a hypothesis [H] - with side-conditions. Side-conditions come after the main goal, - like with [replace] and [rewrite]. - - [eforward H] is like [forward H], but also specializes dependent - binders with evars. - - Both tactics do nothing on hypotheses they cannot handle. *) -Ltac forward_step H := - match type of H with - | ?A -> ?B => let a := fresh in cut A; [ intro a; specialize (H a); clear a | ] - end. -Ltac eforward_step H := - match type of H with - | _ => forward_step H - | forall x : ?A, _ - => let x_or_fresh := fresh x in - evar (x_or_fresh : A); - specialize (H x_or_fresh); subst x_or_fresh - end. -Ltac forward H := try (forward_step H; [ forward H | .. ]). -Ltac eforward H := try (eforward_step H; [ eforward H | .. ]). - -(** [simplify_projections] reduces terms of the form [fst (_, _)] (for - any projection from [prod], [sig], [sigT], or [and]) *) -Ltac pre_simplify_projection proj proj' uproj' := - pose proj as proj'; - pose proj as uproj'; - unfold proj in uproj'; - change proj with proj'. -Ltac do_simplify_projection_2Targ_4carg_step proj proj' uproj' construct := - change proj' with uproj' at 1; - lazymatch goal with - | [ |- appcontext[uproj' _ _ (construct _ _ _ _)] ] - => cbv beta iota delta [uproj'] - | _ => change uproj' with proj - end. -Ltac do_simplify_projection_2Targ_4carg proj proj' uproj' construct := - repeat do_simplify_projection_2Targ_4carg_step proj proj' uproj' construct. -Ltac simplify_projection_2Targ_4carg proj construct := - let proj' := fresh "proj" in - let uproj' := fresh "proj" in - pre_simplify_projection proj proj' uproj'; - do_simplify_projection_2Targ_4carg proj proj' uproj' construct; - clear proj' uproj'. - -Ltac simplify_projections := - repeat (simplify_projection_2Targ_4carg @fst @pair - || simplify_projection_2Targ_4carg @snd @pair - || simplify_projection_2Targ_4carg @proj1_sig @exist - || simplify_projection_2Targ_4carg @proj2_sig @exist - || simplify_projection_2Targ_4carg @projT1 @existT - || simplify_projection_2Targ_4carg @projT2 @existT - || simplify_projection_2Targ_4carg @proj1 @conj - || simplify_projection_2Targ_4carg @proj2 @conj). - -(** constr-based [idtac] *) -Class cidtac {T} (msg : T) := Build_cidtac : True. -Hint Extern 0 (cidtac ?msg) => idtac msg; exact I : typeclass_instances. -(** constr-based [idtac] *) -Class cidtac2 {T1 T2} (msg1 : T1) (msg2 : T2) := Build_cidtac2 : True. -Hint Extern 0 (cidtac2 ?msg1 ?msg2) => idtac msg1 msg2; exact I : typeclass_instances. -Class cidtac3 {T1 T2 T3} (msg1 : T1) (msg2 : T2) (msg3 : T3) := Build_cidtac3 : True. -Hint Extern 0 (cidtac3 ?msg1 ?msg2 ?msg3) => idtac msg1 msg2 msg3; exact I : typeclass_instances. - -Class cfail {T} (msg : T) := Build_cfail : True. -Hint Extern 0 (cfail ?msg) => idtac "Error:" msg; exact I : typeclass_instances. -Class cfail2 {T1 T2} (msg1 : T1) (msg2 : T2) := Build_cfail2 : True. -Hint Extern 0 (cfail2 ?msg1 ?msg2) => idtac "Error:" msg1 msg2; exact I : typeclass_instances. -Class cfail3 {T1 T2 T3} (msg1 : T1) (msg2 : T2) (msg3 : T3) := Build_cfail3 : True. -Hint Extern 0 (cfail3 ?msg1 ?msg2 ?msg3) => idtac "Error:" msg1 msg2 msg3; exact I : typeclass_instances. - -Ltac cidtac msg := constr:(_ : cidtac msg). -Ltac cidtac2 msg1 msg2 := constr:(_ : cidtac2 msg1 msg2). -Ltac cidtac3 msg1 msg2 msg3 := constr:(_ : cidtac2 msg1 msg2 msg3). -Ltac cfail msg := let dummy := constr:(_ : cfail msg) in constr:(I : I). -Ltac cfail2 msg1 msg2 := let dummy := constr:(_ : cfail2 msg1 msg2) in constr:(I : I). -Ltac cfail3 msg1 msg2 msg3 := let dummy := constr:(_ : cfail2 msg1 msg2 msg3) in constr:(I : I). - -Ltac idtac_goal := lazymatch goal with |- ?G => idtac "Goal:" G end. -Ltac idtac_context := - try (repeat match goal with H : _ |- _ => revert H end; - idtac_goal; - lazymatch goal with |- ?G => idtac "Context:" G end; - fail). - -(** Destruct the convoy pattern ([match e as x return x = e -> _ with _ => _ end eq_refl] *) -Ltac convoy_destruct_gen T change_in := - let e' := fresh in - let H' := fresh in - match T with - | context G[?f eq_refl] - => match f with - | match ?e with _ => _ end - => pose e as e'; - match f with - | context F[e] - => let F' := context F[e'] in - first [ pose (eq_refl : e = e') as H'; - let G' := context G[F' H'] in - change_in G'; - clearbody H' e' - | pose (eq_refl : e' = e) as H'; - let G' := context G[F' H'] in - change_in G'; - clearbody H' e' ] - end - end; - destruct e' - end. - -Ltac convoy_destruct_in H := - let T := type of H in - convoy_destruct_gen T ltac:(fun T' => change T' in H). -Ltac convoy_destruct := - let T := get_goal in - convoy_destruct_gen T ltac:(fun T' => change T'). diff --git a/src/Util/Tactics/BreakMatch.v b/src/Util/Tactics/BreakMatch.v index 486d3ef92..f03823a92 100644 --- a/src/Util/Tactics/BreakMatch.v +++ b/src/Util/Tactics/BreakMatch.v @@ -117,4 +117,10 @@ Ltac break_innermost_match_step := | appcontext[match _ with _ => _ end] => fail | _ => idtac end). +Ltac break_innermost_match_hyps_step := + break_match_hyps_step ltac:(fun v => lazymatch v with + | appcontext[match _ with _ => _ end] => fail + | _ => idtac + end). Ltac break_innermost_match := repeat break_innermost_match_step. +Ltac break_innermost_match_hyps := repeat break_innermost_match_hyps_step. diff --git a/src/Util/Tactics/ClearDuplicates.v b/src/Util/Tactics/ClearDuplicates.v new file mode 100644 index 000000000..471f9c1a3 --- /dev/null +++ b/src/Util/Tactics/ClearDuplicates.v @@ -0,0 +1,6 @@ +Ltac clear_duplicates_step := + match goal with + | [ H : ?T, H' : ?T |- _ ] => clear H' + | [ H := ?T, H' := ?T |- _ ] => clear H' + end. +Ltac clear_duplicates := repeat clear_duplicates_step. diff --git a/src/Util/Tactics/Contains.v b/src/Util/Tactics/Contains.v new file mode 100644 index 000000000..aa4fddac2 --- /dev/null +++ b/src/Util/Tactics/Contains.v @@ -0,0 +1,13 @@ +(** [contains x expr] succeeds iff [x] appears in [expr] *) +Ltac contains search_for in_term := + idtac; + lazymatch in_term with + | appcontext[search_for] => idtac + end. + +Ltac free_in x y := + idtac; + match y with + | appcontext[x] => fail 1 x "appears in" y + | _ => idtac + end. diff --git a/src/Util/Tactics/ConvoyDestruct.v b/src/Util/Tactics/ConvoyDestruct.v new file mode 100644 index 000000000..5ed556142 --- /dev/null +++ b/src/Util/Tactics/ConvoyDestruct.v @@ -0,0 +1,33 @@ +Require Import Crypto.Util.Tactics.GetGoal. + +(** Destruct the convoy pattern ([match e as x return x = e -> _ with _ => _ end eq_refl] *) +Ltac convoy_destruct_gen T change_in := + let e' := fresh in + let H' := fresh in + match T with + | context G[?f eq_refl] + => match f with + | match ?e with _ => _ end + => pose e as e'; + match f with + | context F[e] + => let F' := context F[e'] in + first [ pose (eq_refl : e = e') as H'; + let G' := context G[F' H'] in + change_in G'; + clearbody H' e' + | pose (eq_refl : e' = e) as H'; + let G' := context G[F' H'] in + change_in G'; + clearbody H' e' ] + end + end; + destruct e' + end. + +Ltac convoy_destruct_in H := + let T := type of H in + convoy_destruct_gen T ltac:(fun T' => change T' in H). +Ltac convoy_destruct := + let T := get_goal in + convoy_destruct_gen T ltac:(fun T' => change T'). diff --git a/src/Util/Tactics/DebugPrint.v b/src/Util/Tactics/DebugPrint.v new file mode 100644 index 000000000..e1650f170 --- /dev/null +++ b/src/Util/Tactics/DebugPrint.v @@ -0,0 +1,40 @@ +Ltac debuglevel := constr:(0%nat). + +Ltac solve_debugfail tac := + solve [tac] || + ( let dbg := debuglevel in + match dbg with + | O => idtac + | _ => match goal with |- ?G => idtac "couldn't prove" G end + end; + fail). + +(** constr-based [idtac] *) +Class cidtac {T} (msg : T) := Build_cidtac : True. +Hint Extern 0 (cidtac ?msg) => idtac msg; exact I : typeclass_instances. +(** constr-based [idtac] *) +Class cidtac2 {T1 T2} (msg1 : T1) (msg2 : T2) := Build_cidtac2 : True. +Hint Extern 0 (cidtac2 ?msg1 ?msg2) => idtac msg1 msg2; exact I : typeclass_instances. +Class cidtac3 {T1 T2 T3} (msg1 : T1) (msg2 : T2) (msg3 : T3) := Build_cidtac3 : True. +Hint Extern 0 (cidtac3 ?msg1 ?msg2 ?msg3) => idtac msg1 msg2 msg3; exact I : typeclass_instances. + +Class cfail {T} (msg : T) := Build_cfail : True. +Hint Extern 0 (cfail ?msg) => idtac "Error:" msg; exact I : typeclass_instances. +Class cfail2 {T1 T2} (msg1 : T1) (msg2 : T2) := Build_cfail2 : True. +Hint Extern 0 (cfail2 ?msg1 ?msg2) => idtac "Error:" msg1 msg2; exact I : typeclass_instances. +Class cfail3 {T1 T2 T3} (msg1 : T1) (msg2 : T2) (msg3 : T3) := Build_cfail3 : True. +Hint Extern 0 (cfail3 ?msg1 ?msg2 ?msg3) => idtac "Error:" msg1 msg2 msg3; exact I : typeclass_instances. + +Ltac cidtac msg := constr:(_ : cidtac msg). +Ltac cidtac2 msg1 msg2 := constr:(_ : cidtac2 msg1 msg2). +Ltac cidtac3 msg1 msg2 msg3 := constr:(_ : cidtac2 msg1 msg2 msg3). +Ltac cfail msg := let dummy := constr:(_ : cfail msg) in constr:(I : I). +Ltac cfail2 msg1 msg2 := let dummy := constr:(_ : cfail2 msg1 msg2) in constr:(I : I). +Ltac cfail3 msg1 msg2 msg3 := let dummy := constr:(_ : cfail2 msg1 msg2 msg3) in constr:(I : I). + +Ltac idtac_goal := lazymatch goal with |- ?G => idtac "Goal:" G end. +Ltac idtac_context := + try (repeat match goal with H : _ |- _ => revert H end; + idtac_goal; + lazymatch goal with |- ?G => idtac "Context:" G end; + fail). diff --git a/src/Util/Tactics/DestructTrivial.v b/src/Util/Tactics/DestructTrivial.v new file mode 100644 index 000000000..716e953fb --- /dev/null +++ b/src/Util/Tactics/DestructTrivial.v @@ -0,0 +1,6 @@ +Ltac destruct_trivial_step := + match goal with + | [ H : unit |- _ ] => clear H || destruct H + | [ H : True |- _ ] => clear H || destruct H + end. +Ltac destruct_trivial := repeat destruct_trivial_step. diff --git a/src/Util/Tactics/ESpecialize.v b/src/Util/Tactics/ESpecialize.v new file mode 100644 index 000000000..288bc8607 --- /dev/null +++ b/src/Util/Tactics/ESpecialize.v @@ -0,0 +1,2 @@ +(** Like [specialize] but allows holes that get filled with evars. *) +Tactic Notation "especialize" open_constr(H) := specialize H. diff --git a/src/Util/Tactics/Forward.v b/src/Util/Tactics/Forward.v new file mode 100644 index 000000000..63ac6ef38 --- /dev/null +++ b/src/Util/Tactics/Forward.v @@ -0,0 +1,22 @@ +(** [forward H] specializes non-dependent binders in a hypothesis [H] + with side-conditions. Side-conditions come after the main goal, + like with [replace] and [rewrite]. + + [eforward H] is like [forward H], but also specializes dependent + binders with evars. + + Both tactics do nothing on hypotheses they cannot handle. *) +Ltac forward_step H := + match type of H with + | ?A -> ?B => let a := fresh in cut A; [ intro a; specialize (H a); clear a | ] + end. +Ltac eforward_step H := + match type of H with + | _ => forward_step H + | forall x : ?A, _ + => let x_or_fresh := fresh x in + evar (x_or_fresh : A); + specialize (H x_or_fresh); subst x_or_fresh + end. +Ltac forward H := try (forward_step H; [ forward H | .. ]). +Ltac eforward H := try (eforward_step H; [ eforward H | .. ]). diff --git a/src/Util/Tactics/GetGoal.v b/src/Util/Tactics/GetGoal.v new file mode 100644 index 000000000..2d99ca31e --- /dev/null +++ b/src/Util/Tactics/GetGoal.v @@ -0,0 +1,2 @@ +Ltac get_goal := + match goal with |- ?G => G end. diff --git a/src/Util/Tactics/Not.v b/src/Util/Tactics/Not.v new file mode 100644 index 000000000..09985ad73 --- /dev/null +++ b/src/Util/Tactics/Not.v @@ -0,0 +1,4 @@ +Require Import Crypto.Util.Tactics.Test. + +(** [not tac] is equivalent to [fail tac "succeeds"] if [tac] succeeds, and is equivalent to [idtac] if [tac] fails *) +Tactic Notation "not" tactic3(tac) := try ((test tac); fail 1 tac "succeeds"). diff --git a/src/Util/Tactics/OnSubterms.v b/src/Util/Tactics/OnSubterms.v new file mode 100644 index 000000000..0aabf80c8 --- /dev/null +++ b/src/Util/Tactics/OnSubterms.v @@ -0,0 +1,6 @@ +(** Execute [progress tac] on all subterms of the goal. Useful for things like [ring_simplify]. *) +Ltac tac_on_subterms tac := + repeat match goal with + | [ |- context[?t] ] + => progress tac t + end. diff --git a/src/Util/Tactics/Revert.v b/src/Util/Tactics/Revert.v new file mode 100644 index 000000000..5f549025d --- /dev/null +++ b/src/Util/Tactics/Revert.v @@ -0,0 +1,13 @@ +(** Like [Coq.Program.Tactics.revert_last], but only for non-dependent hypotheses *) +Ltac revert_last_nondep := + match goal with + | [ H : _ |- _ ] + => lazymatch goal with + | [ H' : appcontext[H] |- _ ] => fail + | [ |- appcontext[H] ] => fail + | _ => idtac + end; + revert H + end. + +Ltac reverse_nondep := repeat revert_last_nondep. diff --git a/src/Util/Tactics/SetEvars.v b/src/Util/Tactics/SetEvars.v new file mode 100644 index 000000000..471d61f60 --- /dev/null +++ b/src/Util/Tactics/SetEvars.v @@ -0,0 +1,4 @@ +Ltac set_evars := + repeat match goal with + | [ |- appcontext[?E] ] => is_evar E; let e := fresh "e" in set (e := E) + end. diff --git a/src/Util/Tactics/SetoidSubst.v b/src/Util/Tactics/SetoidSubst.v new file mode 100644 index 000000000..4ccf910ed --- /dev/null +++ b/src/Util/Tactics/SetoidSubst.v @@ -0,0 +1,35 @@ +Require Import Crypto.Util.Tactics.Contains. + +Ltac setoid_subst'' R x := + is_var x; + match goal with + | [ H : R x ?y |- _ ] + => free_in x y; rewrite ?H in *; clear x H + | [ H : R ?y x |- _ ] + => free_in x y; rewrite <- ?H in *; clear x H + end. + +Ltac setoid_subst' x := + is_var x; + match goal with + | [ H : ?R x _ |- _ ] => setoid_subst'' R x + | [ H : ?R _ x |- _ ] => setoid_subst'' R x + end. + +Ltac setoid_subst_rel' R := + idtac; + match goal with + | [ H : R ?x _ |- _ ] => setoid_subst'' R x + | [ H : R _ ?x |- _ ] => setoid_subst'' R x + end. + +Ltac setoid_subst_rel R := repeat setoid_subst_rel' R. + +Ltac setoid_subst_all := + repeat match goal with + | [ H : ?R ?x ?y |- _ ] => is_var x; setoid_subst'' R x + | [ H : ?R ?x ?y |- _ ] => is_var y; setoid_subst'' R y + end. + +Tactic Notation "setoid_subst" ident(x) := setoid_subst' x. +Tactic Notation "setoid_subst" := setoid_subst_all. diff --git a/src/Util/Tactics/SideConditionsBeforeToAfter.v b/src/Util/Tactics/SideConditionsBeforeToAfter.v new file mode 100644 index 000000000..0067d53f5 --- /dev/null +++ b/src/Util/Tactics/SideConditionsBeforeToAfter.v @@ -0,0 +1,22 @@ +(** If [tac_in H] operates in [H] and leaves side-conditions before + the original goal, then + [side_conditions_before_to_side_conditions_after tac_in H] does + the same thing to [H], but leaves side-conditions after the + original goal. *) +Ltac side_conditions_before_to_side_conditions_after tac_in H := + let HT := type of H in + let HTT := type of HT in + let H' := fresh in + rename H into H'; + let HT' := fresh in + evar (HT' : HTT); + cut HT'; + [ subst HT'; intro H + | tac_in H'; + [ .. + | subst HT'; eexact H' ] ]; + instantiate; (* required in 8.4 for the [move] to succeed, because evar dependencies *) + [ (* We preserve the order of the hypotheses. We need to do this + here, after evars are instantiated, and not above. *) + move H after H'; clear H' + | .. ]. diff --git a/src/Util/Tactics/SimplifyProjections.v b/src/Util/Tactics/SimplifyProjections.v new file mode 100644 index 000000000..f9b319057 --- /dev/null +++ b/src/Util/Tactics/SimplifyProjections.v @@ -0,0 +1,32 @@ +(** [simplify_projections] reduces terms of the form [fst (_, _)] (for + any projection from [prod], [sig], [sigT], or [and]) *) +Ltac pre_simplify_projection proj proj' uproj' := + pose proj as proj'; + pose proj as uproj'; + unfold proj in uproj'; + change proj with proj'. +Ltac do_simplify_projection_2Targ_4carg_step proj proj' uproj' construct := + change proj' with uproj' at 1; + lazymatch goal with + | [ |- appcontext[uproj' _ _ (construct _ _ _ _)] ] + => cbv beta iota delta [uproj'] + | _ => change uproj' with proj + end. +Ltac do_simplify_projection_2Targ_4carg proj proj' uproj' construct := + repeat do_simplify_projection_2Targ_4carg_step proj proj' uproj' construct. +Ltac simplify_projection_2Targ_4carg proj construct := + let proj' := fresh "proj" in + let uproj' := fresh "proj" in + pre_simplify_projection proj proj' uproj'; + do_simplify_projection_2Targ_4carg proj proj' uproj' construct; + clear proj' uproj'. + +Ltac simplify_projections := + repeat (simplify_projection_2Targ_4carg @fst @pair + || simplify_projection_2Targ_4carg @snd @pair + || simplify_projection_2Targ_4carg @proj1_sig @exist + || simplify_projection_2Targ_4carg @proj2_sig @exist + || simplify_projection_2Targ_4carg @projT1 @existT + || simplify_projection_2Targ_4carg @projT2 @existT + || simplify_projection_2Targ_4carg @proj1 @conj + || simplify_projection_2Targ_4carg @proj2 @conj). diff --git a/src/Util/Tactics/SimplifyRepeatedIfs.v b/src/Util/Tactics/SimplifyRepeatedIfs.v new file mode 100644 index 000000000..54d79ee48 --- /dev/null +++ b/src/Util/Tactics/SimplifyRepeatedIfs.v @@ -0,0 +1,16 @@ +Ltac simplify_repeated_ifs_step := + match goal with + | [ |- context G[if ?b then ?x else ?y] ] + => let x' := match x with + | context x'[b] => let x'' := context x'[true] in x'' + end in + let G' := context G[if b then x' else y] in + cut G'; [ destruct b; exact (fun z => z) | cbv iota ] + | [ |- context G[if ?b then ?x else ?y] ] + => let y' := match y with + | context y'[b] => let y'' := context y'[false] in y'' + end in + let G' := context G[if b then x else y'] in + cut G'; [ destruct b; exact (fun z => z) | cbv iota ] + end. +Ltac simplify_repeated_ifs := repeat simplify_repeated_ifs_step. diff --git a/src/Util/Tactics/SubstEvars.v b/src/Util/Tactics/SubstEvars.v new file mode 100644 index 000000000..5e1765c2f --- /dev/null +++ b/src/Util/Tactics/SubstEvars.v @@ -0,0 +1,4 @@ +Ltac subst_evars := + repeat match goal with + | [ e := ?E |- _ ] => is_evar E; subst e + end. diff --git a/src/Util/Tactics/Test.v b/src/Util/Tactics/Test.v new file mode 100644 index 000000000..63529bbfc --- /dev/null +++ b/src/Util/Tactics/Test.v @@ -0,0 +1,3 @@ +(** Test if a tactic succeeds, but always roll-back the results *) +Tactic Notation "test" tactic3(tac) := + try (first [ tac | fail 2 tac "does not succeed" ]; fail 0 tac "succeeds"; [](* test for [t] solved all goals *)). diff --git a/src/Util/WordUtil.v b/src/Util/WordUtil.v index 68f477505..4833f0df6 100644 --- a/src/Util/WordUtil.v +++ b/src/Util/WordUtil.v @@ -10,7 +10,9 @@ Require Import Coq.Bool.Bool. Require Import Crypto.Util.Bool. Require Import Crypto.Util.NatUtil. Require Import Crypto.Util.ZUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.RewriteHyp. Require Import Crypto.Util.Sigma. Require Import Bedrock.Word. diff --git a/src/Util/ZUtil.v b/src/Util/ZUtil.v index e8cf62ce0..b7c22c997 100644 --- a/src/Util/ZUtil.v +++ b/src/Util/ZUtil.v @@ -3,12 +3,15 @@ Require Import Coq.Classes.RelationClasses Coq.Classes.Morphisms. Require Import Coq.Structures.Equalities. Require Import Coq.omega.Omega Coq.micromega.Psatz Coq.Numbers.Natural.Peano.NPeano Coq.Arith.Arith. Require Import Crypto.Util.NatUtil. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.SpecializeBy. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.Contains. +Require Import Crypto.Util.Tactics.Not. Require Import Crypto.Util.Bool. Require Import Crypto.Util.Notations. Require Import Coq.Lists.List. Require Export Crypto.Util.FixCoqMistakes. -Require Export Crypto.Tactics.VerdiTactics. +(*Require Export Crypto.Tactics.VerdiTactics.*) Import Nat. Local Open Scope Z. @@ -291,7 +294,7 @@ Module Z. Lemma ones_spec : forall n m, 0 <= n -> 0 <= m -> Z.testbit (Z.ones n) m = if Z_lt_dec m n then true else false. Proof. intros. - break_if. + break_match. + apply Z.ones_spec_low. omega. + apply Z.ones_spec_high. omega. Qed. @@ -305,7 +308,7 @@ Module Z. else if Z_lt_dec m n then true else false. Proof. intros. - repeat (break_if || autorewrite with Ztestbit); try reflexivity; try omega. + repeat (break_match || autorewrite with Ztestbit); try reflexivity; try omega. unfold Z.ones. rewrite <- Z.shiftr_opp_r, Z.shiftr_eq_0 by (simpl; omega); simpl. destruct m; simpl in *; try reflexivity. @@ -319,7 +322,7 @@ Module Z. cbv [Z.pow2_mod]; intros; destruct (Z_le_dec 0 i); repeat match goal with | |- _ => rewrite Z.testbit_neg_r by omega - | |- _ => break_if + | |- _ => break_innermost_match_step | |- _ => omega | |- _ => reflexivity | |- _ => progress autorewrite with Ztestbit @@ -364,7 +367,7 @@ Module Z. Proof. intros; cbv [Z.pow2_mod]. apply Z.bits_inj'; intros. - repeat progress (try break_if; autorewrite with Ztestbit zsimplify; try reflexivity). + repeat progress (try break_match; autorewrite with Ztestbit zsimplify; try reflexivity). try match goal with H : ?a < ?b |- appcontext[Z.testbit _ (?a - ?b)] => rewrite !Z.testbit_neg_r with (n := a - b) by omega end. autorewrite with Ztestbit; reflexivity. @@ -375,7 +378,7 @@ Module Z. Proof. intros; cbv [Z.pow2_mod]. apply Z.bits_inj'; intros. - apply Z.min_case_strong; intros; repeat progress (try break_if; autorewrite with Ztestbit zsimplify; try reflexivity). + apply Z.min_case_strong; intros; repeat progress (try break_match; autorewrite with Ztestbit zsimplify; try reflexivity). Qed. Lemma pow2_mod_pos_bound a b : 0 < b -> 0 <= Z.pow2_mod a b < 2^b. @@ -1020,7 +1023,7 @@ Module Z. intros. assert (a = Z.pow2_mod a x). { apply Z.bits_inj'; intros. - rewrite Z.testbit_pow2_mod by omega; break_if; auto. + rewrite Z.testbit_pow2_mod by omega; break_match; auto. } rewrite H1. rewrite Z.pow2_mod_spec; try apply Z.mod_pos_bound; zero_bounds. @@ -1134,7 +1137,7 @@ Module Z. | |- _ => rewrite Z.shiftl_mul_pow2 by omega | |- _ => rewrite add_compare_mono_r | |- _ => rewrite <-Z.mul_sub_distr_r - | |- _ => break_if + | |- _ => break_innermost_match_step | H : Z.pow2_mod _ _ = _ |- _ => rewrite pow2_mod_id_iff in H by omega | H : ?a <> ?b |- _ = (?a ?= ?b) => case_eq (a ?= b); rewrite ?Z.compare_eq_iff, ?Z.compare_gt_iff, ?Z.compare_lt_iff @@ -2145,7 +2148,7 @@ Module Z. Lemma lt_mul_2_pow_2_shiftr : forall a n, 0 <= a < 2 * 2 ^ n -> a >> n = if Z_lt_dec a (2 ^ n) then 0 else 1. Proof. - intros; break_if; [ apply lt_pow_2_shiftr; omega | ]. + intros; break_match; [ apply lt_pow_2_shiftr; omega | ]. destruct (Z_le_dec 0 n). + replace (2 * 2 ^ n) with (2 ^ (n + 1)) in * by (rewrite Z.pow_add_r; try omega; ring). diff --git a/src/WeierstrassCurve/Pre.v b/src/WeierstrassCurve/Pre.v index 58ec8b5bf..906a7d1d6 100644 --- a/src/WeierstrassCurve/Pre.v +++ b/src/WeierstrassCurve/Pre.v @@ -1,6 +1,7 @@ Require Import Coq.Classes.Morphisms. Require Coq.Setoids.Setoid. Require Import Crypto.Algebra Crypto.Algebra.Field. -Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.BreakMatch. Require Import Crypto.Util.Notations. Require Import Crypto.Util.Decidable. Import BinNums. diff --git a/src/WeierstrassCurve/Projective.v b/src/WeierstrassCurve/Projective.v index a62bf027a..cba28dfff 100644 --- a/src/WeierstrassCurve/Projective.v +++ b/src/WeierstrassCurve/Projective.v @@ -1,5 +1,9 @@ Require Import Crypto.Spec.WeierstrassCurve. -Require Import Crypto.Util.Decidable Crypto.Util.Tactics Crypto.Algebra.Field. +Require Import Crypto.Util.Decidable Crypto.Algebra.Field. +Require Import Crypto.Util.Tactics.BreakMatch. +Require Import Crypto.Util.Tactics.DestructHead. +Require Import Crypto.Util.Tactics.SpecializeBy. +Require Import Crypto.Util.Tactics.SetoidSubst. Require Import Crypto.Util.Notations Crypto.Util.FixCoqMistakes. Require Import Crypto.Util.Sum Crypto.Util.Prod Crypto.Util.Sigma. @@ -150,4 +154,4 @@ Module Projective. assert (X2 = 0) by (setoid_subst_rel Feq; Nsatz.nsatz_power 3%nat); t; fsatz. Qed. End Projective. -End Projective. \ No newline at end of file +End Projective. -- cgit v1.2.3