2021-04-30
slides.com/jod/pt_18b
Docent: Jo Devriendt
Assistent: Ann Philips
Coördinator: Joost Vennekens
voornaam.achternaam@kuleuven.be
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
Hoe oplossen?
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
8
7
6
5
4
3
2
1
15
14
13
12
11
10
9
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
1
2
3
...
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
!r : ?=1 c : queen(r,c).
!c : ?=1 r : queen(r,c).
!d : #{r c : diag1(r,c)=d & queen(r,c)} =< 1.
!d : #{r c : diag2(r,c)=d & queen(r,c)} =< 1.
Formules in precieze FO(.)-syntax:
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
vocabulary V {
type index isa int
queen(index, index)
n : index
type diag isa int
diag1(index, index) : diag
diag2(index, index) : diag
}
theory T : V {
{ diag1(r,c) = r - c + n. }
{ diag2(r,c) = r + c - 1. }
!r : ?=1 c : queen(r,c).
!c : ?=1 r : queen(r,c).
!d : #{r c : diag1(r,c)=d & queen(r,c)} =< 1.
!d : #{r c : diag2(r,c)=d & queen(r,c)} =< 1.
}
structure S : V{
index = {1;2;3;4;5;6;7;8}
diag = {1;2;3;4;5;6;7;8;9;10;11;12;13;14;15}
n = 8
}
Volledige FO(.)-specificatie:
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
We vragen IDP om alle predikaten en functiesymbolen een interpretatie te geven zodat alle formules waar zijn:
structure : V {
diag = { 1..15 }
index = { 1..8 }
queen = { 1,4; 2,7; 3,3; 4,8; 5,2; 6,5; 7,1; 8,6 }
diag1 = { 1,1->8; 1,2->7; 1,3->6; 1,4->5; 1,5->4; ...
diag2 = { 1,1->1; 1,2->2; 1,3->3; 1,4->4; 1,5->5; ...
n = 8
}
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021
Programmeertechnieken [B-KUL-YI0855]
De Nayer, IIW, E-ICT, 2Ba + schakel, 2020-2021