@ -290,12 +290,42 @@ end = struct
type equal_or_opposite = Equal | Opposite | Unknown
type equal_or_opposite = Equal | Opposite | Unknown
let rec equal_or_opposite p q : equal_or_opposite =
let rec equal_or_opposite p q =
if equal_fml p q then Equal
match ( p , q ) with
else if equal_fml p ( _ Not q ) then Opposite
| Tt , Ff | Ff , Tt -> Opposite
else Unknown
| Eq ( a , b ) , Dq ( a' , b' ) | Dq ( a , b ) , Eq ( a' , b' ) ->
if equal_trm a a' && equal_trm b b' then Opposite else Unknown
and _ And p q =
| Eq0 a , Dq0 a'
| Dq0 a , Eq0 a'
| Gt0 a , Le0 a'
| Ge0 a , Lt0 a'
| Lt0 a , Ge0 a'
| Le0 a , Gt0 a' ->
if equal_trm a a' then Opposite else Unknown
| And ( a , b ) , Or ( a' , b' ) | Or ( a' , b' ) , And ( a , b ) -> (
match equal_or_opposite a a' with
| Opposite -> (
match equal_or_opposite b b' with
| Opposite -> Opposite
| _ -> Unknown )
| _ -> Unknown )
| Iff ( p , q ) , Xor ( p' , q' ) | Xor ( p , q ) , Iff ( p' , q' ) ->
if equal_fml p p' && equal_fml q q' then Opposite else Unknown
| Cond { cnd = c ; pos = p ; neg = n } , Cond { cnd = c' ; pos = p' ; neg = n' } ->
if equal_fml c c' then
match equal_or_opposite p p' with
| Opposite -> (
match equal_or_opposite n n' with
| Opposite -> Opposite
| _ -> Unknown )
| Equal -> if equal_fml n n' then Equal else Unknown
| Unknown -> Unknown
else Unknown
| UPosLit ( p , x ) , UNegLit ( p' , x' ) | UNegLit ( p , x ) , UPosLit ( p' , x' ) ->
if Predsym . equal p p' && equal_trm x x' then Opposite else Unknown
| _ -> if equal_fml p q then Equal else Unknown
let _ And p q =
match ( p , q ) with
match ( p , q ) with
| Tt , p | p , Tt -> p
| Tt , p | p , Tt -> p
| Ff , _ | _ , Ff -> Ff
| Ff , _ | _ , Ff -> Ff
@ -307,7 +337,7 @@ end = struct
let p , q = sort_fml p q in
let p , q = sort_fml p q in
And ( p , q ) )
And ( p , q ) )
and _ Or p q =
let _ Or p q =
match ( p , q ) with
match ( p , q ) with
| Ff , p | p , Ff -> p
| Ff , p | p , Ff -> p
| Tt , _ | _ , Tt -> Tt
| Tt , _ | _ , Tt -> Tt
@ -319,7 +349,7 @@ end = struct
let p , q = sort_fml p q in
let p , q = sort_fml p q in
Or ( p , q ) )
Or ( p , q ) )
and _ Iff p q =
let rec _ Iff p q =
match ( p , q ) with
match ( p , q ) with
| Tt , p | p , Tt -> p
| Tt , p | p , Tt -> p
| Ff , p | p , Ff -> _ Not p
| Ff , p | p , Ff -> _ Not p