haskell-te: d136f6da010a7210cc14e1e9b9b46675772efd10

     1: ; Simple theory of pairs (cartesian products), meant to be explored quickly
     2: (declare-datatypes (a)
     3:   ((Pair (MkPair (fst a) (snd a)))))
     4: 
     5: ; Functions equivalent to the constructors
     6: (define-fun
     7:   (par (a)
     8:     (constructor-MkPair ((local-fst a) (local-snd a)) (Pair a)
     9:       (as (MkPair local-fst local-snd) (Pair a)))))
    10: 
    11: ; Functions equivalent to the destructors
    12: (define-fun
    13:   (par (a)
    14:     (destructor-fst ((local-x (Pair a))) a
    15:       (match local-x
    16:         (case (MkPair local-y local-z) local-y)))))
    17: 
    18: (define-fun
    19:   (par (a)
    20:     (destructor-snd ((local-x (Pair a))) a
    21:       (match local-x
    22:         (case (MkPair local-y local-z) local-z)))))
    23: 
    24: ; Other functions
    25: (define-fun
    26:   (par (a)
    27:     (swap
    28:        ((x (Pair a))) (Pair a)
    29:        (MkPair (destructor-snd x) (destructor-fst x)))))
    30: 
    31: (define-fun
    32:   (par (a)
    33:     (map
    34:        ((f (=> a a)) (x (Pair a))) (Pair a)
    35:        (MkPair (@ f (destructor-fst x)) (@ f (destructor-snd x))))))
    36: 
    37: (define-fun
    38:   (par (a)
    39:     (uncurry
    40:        ((f (=> a (=> a a))) (x (Pair a))) a
    41:        (@ (@ f (destructor-fst x)) (destructor-snd x)))))
    42: 
    43: 
    44: (check-sat)

Generated by git2html.