Comparison to CycleQ

October 4, 2023 · View on GitHub

cyclegg is a theorem prover for equational reasoning. It is based on the ideas from CycleQ but implements them on top of egraphs and equality saturation in order to avoid backtracking proof search.

To prove commutativity of addition, run:

cargo run -- examples/add.ceg

TODO

Organizational

  • Add flag for grounding
  • Create goals inside parser, do not expose RawGoal
  • Decouple proof generation from proof search (e.g. put Defs, Proof term somewhere else)
  • Make partial applications without $ work
  • Move from SymbolLang to a proper language.
  • Emit a proof data structure
    • Right now we just emit strings that are (mostly) valid LiquidHaskell.
    • Creating a proper equational proof data structure would allow us to emit to other backends.
    • It would also be cleaner.
  • Canonical forms for termination checking:
    • Grounding for cyclic mode: extend the domain of grounding_instantiations to include new vars; instantiate sides of all lemmas
  • In cyclic mode: use multi-patterns instead of requiring that the premise has no extra vars?
  • Blocking variables analysis

Proofs

  • Conditional props proof generation
    • Add explanation for conditional unions (cannot just union_trusted).
    • Include the premise into the LH precondition
      • This can be accomplished by taking a witness of the precondition as an argument.
    • How to include the proof of the condition holding?
      • To use a conditional lemma you need a witness of the condition. We can take the e-graph from which we are getting the explanation and ask it to explain why the e-classes of the condition are equal and use those to build a proof. In LH this would look something like

        let conditionWitness =   condLHS 
                             ==. condLHS'
                             ? lemma lemmaArgs
                             ==. condRHS
                             *** QED
         in conditionalLemma conditionWitness args
        

Comparison to CycleQ

Results generated from a282086 using the command (prop52 removed because its proof was made easier by a bug)

cargo run --release -- examples/cycleq.ceg -t 10 --save-results

and compared to results from CycleQ.

All results come from runs on a Macbook Air M2.

N.B. We have cyclic proofs for prop_30 (49ms) and prop_73 (5364ms) but not with uncyclegg but these are believed unsound.

N.B. The cyclegg timing is a little suspect (e.g. I time prop_56 as taking 201ms instead of 5000 ms using cyclegg).

NameCycleq resultUncyclegg resultCycleq time (ms)Cyclegg time (ms)Uncyclegg time (ms)
prop_01ValidValid0.6730.837…0.589…
prop_02UnknownValid-1.0007.748…1.684…
prop_03UnknownValid-1.0003.529…2.117…
prop_04UnknownValid-1.0003.090…1.654…
prop_06ValidValid0.1340.202…0.142…
prop_07ValidValid0.2100.191…0.142…
prop_08ValidValid1.2700.237…0.166…
prop_09ValidValid0.6410.783…0.350…
prop_10ValidValid0.0790.141…0.108…
prop_11ValidValid0.0140.029…0.025…
prop_12ValidValid1.0070.504…0.343…
prop_13ValidValid0.0470.034…0.029…
prop_14UnknownValid-1.0001.963…0.400…
prop_15UnknownValid-1.0002.072…1.029…
prop_17ValidValid0.0510.151…0.120…
prop_18ValidValid0.1630.170…0.126…
prop_19ValidValid0.8470.480…0.333…
prop_21ValidValid0.1430.170…0.123…
prop_22ValidValid1.5911.110…0.593…
prop_23ValidValid1.1040.422…0.212…
prop_24ValidValid1.4451.146…0.442…
prop_25ValidValid0.6400.716…0.430…
prop_28UnknownValid-1.0002.503…0.995…
prop_29UnknownValid-1.0004.213…2.262…
prop_31ValidValid1.3521.210…0.586…
prop_32ValidValid1.0710.452…0.202…
prop_33ValidValid0.4270.417…0.271…
prop_34ValidValid0.7090.524…0.351…
prop_35ValidValid0.0590.319…0.126…
prop_36ValidValid0.1880.332…0.125…
prop_37UnknownValid-1.0001.310…1.402…
prop_38UnknownValid-1.0006.999…1.343…
prop_39UnknownValid-1.0002.048…0.250…
prop_40ValidValid0.0140.024…0.020…
prop_41ValidValid0.9780.476…0.280…
prop_42ValidValid0.0670.029…0.025…
prop_43UnknownValid-1.0000.593…0.306…
prop_44ValidValid0.1930.552…0.420…
prop_45ValidValid0.1010.032…0.027…
prop_46ValidValid0.0200.021…0.018…
prop_49ValidValid231.5692.492…1.021…
prop_50ValidValid21.2070.796…0.425…
prop_51ValidValid1.8550.453…0.459…
prop_55ValidValid1.5160.631…0.381…
prop_56ValidValid1,615.5855,194.048…12.648…
prop_57ValidValid35.0903.122…4.161…
prop_58ValidValid3.6330.910…0.651…
prop_61ValidValid163.4632.073…0.874…
prop_64ValidValid0.6600.413…0.393…
prop_67ValidValid1.0450.653…0.366…
prop_75UnknownValid-1.0002,770.103…17.077…
prop_79ValidValid507.3991.054…0.284…
prop_80ValidValid1.0820.682…0.415…
prop_82ValidValid2.4371.176…0.726…
prop_83ValidValid2.6877.345…1.645…
prop_84ValidValid7.1101.412…0.847…
prop_86UnknownValid-1.0000.768…0.219…
prop_87UnknownValid-1.0001.698…0.398…
prop_88UnknownValid-1.0001.157…0.405…
prop_89UnknownValid-1.0001.606…0.360…
prop_90UnknownValid-1.0000.630…0.312…