pcp/logic/
mod.rs

1// Copyright 2017 Pierre Talbot (IRCAM)
2
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6
7//     http://www.apache.org/licenses/LICENSE-2.0
8
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pub mod boolean;
16pub mod boolean_neg;
17pub mod conjunction;
18pub mod disjunction;
19pub mod ops;
20
21pub use logic::boolean::*;
22pub use logic::boolean_neg::*;
23pub use logic::conjunction::*;
24pub use logic::disjunction::*;
25pub use logic::ops::*;
26
27use gcollections::*;
28use concept::*;
29
30pub fn implication<VStore>(f: Formula<VStore>, g: Formula<VStore>) -> Formula<VStore> where
31 VStore: Collection + 'static
32{
33  Box::new(Disjunction::new(vec![f, g.not()]))
34}
35
36pub fn equivalence<VStore>(f: Formula<VStore>, g: Formula<VStore>) -> Formula<VStore> where
37 VStore: Collection + 'static
38{
39  Box::new(Conjunction::new(vec![
40    implication(f.bclone(), g.bclone()),
41    implication(g, f)
42  ]))
43}