@@ -410,28 +410,6 @@ instance Printable Term where
410
410
negationTable =
411
411
[(Const. negName, Nothing )]
412
412
413
- -------------------------------------------------------------------------
414
- -- Operators of a given arity
415
- -------------------------------------------------------------------------
416
-
417
- destUnaryOp :: Term -> Maybe (Const ,Term )
418
- destUnaryOp tm = do
419
- (t,x) <- Term. destApp tm
420
- (c,_) <- Term. destConst t
421
- return (c,x)
422
-
423
- destBinaryOp :: Term -> Maybe (Const ,Term ,Term )
424
- destBinaryOp tm = do
425
- (t,y) <- Term. destApp tm
426
- (c,x) <- destUnaryOp t
427
- return (c,x,y)
428
-
429
- destTernaryOp :: Term -> Maybe (Const ,Term ,Term ,Term )
430
- destTernaryOp tm = do
431
- (t,z) <- Term. destApp tm
432
- (c,x,y) <- destBinaryOp t
433
- return (c,x,y,z)
434
-
435
413
-------------------------------------------------------------------------
436
414
-- Infix operators
437
415
-------------------------------------------------------------------------
@@ -461,7 +439,7 @@ instance Printable Term where
461
439
462
440
destInfix :: Term -> Maybe (InfixOp ,Term ,Term )
463
441
destInfix tm = do
464
- (c,x,y) <- destBinaryOp tm
442
+ (c,x,y) <- Term. destBinaryOp tm
465
443
i <- lookupOp (Term. typeOf x) (Const. name c)
466
444
return (i,x,y)
467
445
where
@@ -492,7 +470,7 @@ instance Printable Term where
492
470
493
471
destForall :: Term -> Maybe (Var ,Term )
494
472
destForall tm = do
495
- (c,t) <- destUnaryOp tm
473
+ (c,t) <- Term. destUnaryOp tm
496
474
(v,b) <- Term. destAbs t
497
475
guard (Const. name c == Const. forallName)
498
476
return (v,b)
@@ -541,7 +519,7 @@ instance Printable Term where
541
519
542
520
destQuantifier :: Term -> Maybe (Const ,Term ,Term )
543
521
destQuantifier tm = do
544
- (c,vb) <- destUnaryOp tm
522
+ (c,vb) <- Term. destUnaryOp tm
545
523
(v,b) <- destAbs vb
546
524
return (c,v,b)
547
525
@@ -588,7 +566,7 @@ instance Printable Term where
588
566
589
567
destNegation :: Term -> Maybe (PrefixOp ,Term )
590
568
destNegation tm = do
591
- (c,t) <- destUnaryOp tm
569
+ (c,t) <- Term. destUnaryOp tm
592
570
p <- Map. lookup (Const. name c) negations
593
571
return (p,t)
594
572
@@ -607,7 +585,7 @@ instance Printable Term where
607
585
608
586
destCond :: Term -> Maybe (Term ,Term ,Term )
609
587
destCond tm = do
610
- (c,x,y,z) <- destTernaryOp tm
588
+ (c,x,y,z) <- Term. destTernaryOp tm
611
589
guard (Const. name c == Const. condName)
612
590
return (x,y,z)
613
591
@@ -674,7 +652,7 @@ instance Printable Term where
674
652
675
653
destFromNatural :: Term -> Maybe Term
676
654
destFromNatural tm = do
677
- (c,t) <- destUnaryOp tm
655
+ (c,t) <- Term. destUnaryOp tm
678
656
guard (Set. member (Const. name c) fromNaturals)
679
657
return t
680
658
@@ -692,7 +670,7 @@ instance Printable Term where
692
670
693
671
destBit :: Term -> Maybe (Bool ,Term )
694
672
destBit tm = do
695
- (c,t) <- destUnaryOp tm
673
+ (c,t) <- Term. destUnaryOp tm
696
674
fmap (flip (,) t) $ bit (Const. name c)
697
675
where
698
676
bit n = if n == Const. bit0Name then Just False
@@ -722,7 +700,7 @@ instance Printable Term where
722
700
723
701
destPair :: Term -> Maybe (Term ,Term )
724
702
destPair tm = do
725
- (c,x,y) <- destBinaryOp tm
703
+ (c,x,y) <- Term. destBinaryOp tm
726
704
guard (Const. name c == Const. pairName)
727
705
return (x,y)
728
706
@@ -744,19 +722,19 @@ instance Printable Term where
744
722
745
723
destFromPredicate :: Term -> Maybe Term
746
724
destFromPredicate tm = do
747
- (c,t) <- destUnaryOp tm
725
+ (c,t) <- Term. destUnaryOp tm
748
726
guard (Const. name c == Const. fromPredicateName)
749
727
return t
750
728
751
729
destConj :: Term -> Maybe (Term ,Term )
752
730
destConj tm = do
753
- (c,x,y) <- destBinaryOp tm
731
+ (c,x,y) <- Term. destBinaryOp tm
754
732
guard (Const. name c == Const. conjName)
755
733
return (x,y)
756
734
757
735
destExists :: Term -> Maybe (Var ,Term )
758
736
destExists tm = do
759
- (c,t) <- destUnaryOp tm
737
+ (c,t) <- Term. destUnaryOp tm
760
738
(v,b) <- Term. destAbs t
761
739
guard (Const. name c == Const. existsName)
762
740
return (v,b)
0 commit comments