Skip to content

Commit

Permalink
Switch on ifeq bonus depending on settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
nick8325 committed Sep 8, 2017
1 parent bf5dd7f commit 946e0fb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
10 changes: 9 additions & 1 deletion executable/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Jukebox.Form hiding ((:=:), Var, Symbolic(..), Term, Axiom, size, Lemma)
import Jukebox.Tools.EncodeTypes
import Jukebox.TPTP.Print
import Jukebox.Tools.Clausify(ClausifyFlags(..), clausify)
import Jukebox.Tools.HornToUnit
import qualified Data.IntMap.Strict as IntMap
import System.IO
import System.Exit
Expand Down Expand Up @@ -53,7 +54,7 @@ parseMainFlags =
parseConfig :: OptionParser Config
parseConfig =
Config <$> maxSize <*> maxCPs <*> maxCPDepth <*> simplify <*> normPercent <*>
(CP.Config <$> lweight <*> rweight <*> funweight <*> varweight <*> depthweight <*> dupcost <*> dupfactor) <*>
(CP.Config <$> lweight <*> rweight <*> funweight <*> varweight <*> depthweight <*> dupcost <*> dupfactor <*> ifeqBonus) <*>
(Join.Config <$> ground_join <*> connectedness <*> set_join) <*>
(Proof.Config <$> all_lemmas <*> flat_proof <*> show_instances)
where
Expand Down Expand Up @@ -145,6 +146,13 @@ parseConfig =
flag name [desc ++ " (" ++ show def ++ " by default)."] def parser
where
def = field defaultConfig
ifeqBonus = p <$> hornFlags
where
p flags =
case encoding flags of
Symmetric -> True
Asymmetric1 -> True
Asymmetric2 -> False

parsePrecedence :: OptionParser [String]
parsePrecedence =
Expand Down
3 changes: 2 additions & 1 deletion src/Twee.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ defaultConfig =
cfg_varweight = 6,
cfg_depthweight = 16,
cfg_dupcost = 7,
cfg_dupfactor = 0 },
cfg_dupfactor = 0,
cfg_ifeq_bonus = False },
cfg_join = Join.defaultConfig,
cfg_proof_presentation = Proof.defaultConfig }

Expand Down
11 changes: 7 additions & 4 deletions src/Twee/CP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ data Config =
cfg_varweight :: !Int,
cfg_depthweight :: !Int,
cfg_dupcost :: !Int,
cfg_dupfactor :: !Int }
cfg_dupfactor :: !Int,
cfg_ifeq_bonus :: !Bool }

-- We compute:
-- cfg_lhsweight * size l + cfg_rhsweight * size r
Expand All @@ -162,9 +163,11 @@ score Config{..} Overlap{..} =
size' n (Cons t ts)
| len t > 1, t `isSubtermOfList` ts =
size' (n+cfg_dupcost+cfg_dupfactor*size t) ts
size' n (Cons (App f (Cons a (Cons b ts))) us)
| isIfeq (fun_value f), isJust (unify a b) =
size' (size' (n+1) ts) us
size' n ts
| cfg_ifeq_bonus,
Cons (App f (Cons a (Cons b us))) vs <- ts,
isIfeq (fun_value f), isJust (unify a b) =
size' (size' (n+1) us) vs
size' n (Cons (Var _) ts) =
size' (n+cfg_varweight) ts
size' n (ConsSym (App f _) ts) =
Expand Down

0 comments on commit 946e0fb

Please sign in to comment.